| name: dir2md Blueprint |
| on: |
| pull_request: |
| types: [opened, synchronize, reopened] |
| workflow_dispatch: |
|
|
| jobs: |
| build-blueprint: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v4 |
| - uses: actions/setup-python@v5 |
| with: |
| python-version: '3.11' |
| - name: Install dir2md |
| run: | |
| python -m pip install --upgrade pip |
| pip install . |
| - name: Generate blueprint |
| id: gen |
| run: | |
| dir2md . --capsule --emit-manifest --stats -o PROJECT_BLUEPRINT.md || true |
| TOKENS=$(jq .stats.est_tokens_prompt PROJECT_BLUEPRINT.manifest.json) |
| echo "tokens=$TOKENS" >> $GITHUB_OUTPUT |
| - name: Upload artifact |
| uses: actions/upload-artifact@v4 |
| with: |
| name: dir2md-blueprint |
| path: | |
| PROJECT_BLUEPRINT.md |
| PROJECT_BLUEPRINT.manifest.json |
| PROJECT_BLUEPRINT.capsule.zip |
| - name: Comment PR |
| if: github.event_name == 'pull_request' |
| uses: actions/github-script@v7 |
| with: |
| script: | |
| const tokens = '${{ steps.gen.outputs.tokens }}'; |
| const body = [ |
| '## 📦 dir2md Blueprint', |
| `- Estimated prompt tokens: **${tokens}**`, |
| '- Artifacts: _see workflow run → Artifacts_', |
| '', |
| 'Run locally:', |
| '```bash', |
| 'pip install .', |
| 'dir2md .', |
| '```' |
| ].join('\n'); |
| github.rest.issues.createComment({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| issue_number: context.issue.number, |
| body |
| }); |
| |