| 1 | name: 'TreeTrace' |
| 2 | description: 'Prompt-lineage visibility for coding & CLI agent sessions. Generates a structured local record of every correction, refusal, token, and tool from your agent transcript.' |
| 3 | author: 'Zion Boggan' |
| 4 | branding: |
| 5 | icon: 'git-branch' |
| 6 | color: 'green' |
| 7 | |
| 8 | inputs: |
| 9 | source: |
| 10 | description: > |
| 11 | Path to a transcript file (.jsonl or plain text) committed or produced in |
| 12 | CI. Session logs live on dev machines, not in CI, so typical usage is |
| 13 | regenerating PROMPT_TREE.md from a committed .treetrace/tree.json or an |
| 14 | uploaded transcript artifact. |
| 15 | required: false |
| 16 | default: '' |
| 17 | comment-pr: |
| 18 | description: 'Post the tree summary as a PR comment (requires GITHUB_TOKEN).' |
| 19 | required: false |
| 20 | default: 'false' |
| 21 | |
| 22 | runs: |
| 23 | using: 'composite' |
| 24 | steps: |
| 25 | - name: Generate prompt tree |
| 26 | shell: bash |
| 27 | env: |
| 28 | TT_SOURCE: ${{ inputs.source }} |
| 29 | run: | |
| 30 | set -euo pipefail |
| 31 | if [ -n "$TT_SOURCE" ]; then |
| 32 | npx --yes treetrace --file "$TT_SOURCE" --redact-auto --quiet |
| 33 | elif [ -f .treetrace/tree.json ]; then |
| 34 | echo "::notice::Using committed .treetrace/tree.json" |
| 35 | node -e " |
| 36 | const { readFileSync, writeFileSync } = require('fs'); |
| 37 | const data = JSON.parse(readFileSync('.treetrace/tree.json','utf8')); |
| 38 | console.log('lineage present:', data.nodes.length, 'nodes. TREETRACE_REPORT.md and PROMPT_TREE.md should be committed alongside it'); |
| 39 | " |
| 40 | else |
| 41 | echo "::warning::No source transcript or .treetrace/tree.json found, nothing to do." |
| 42 | fi |
| 43 | - name: Comment on PR |
| 44 | if: ${{ inputs.comment-pr == 'true' && github.event_name == 'pull_request' }} |
| 45 | shell: bash |
| 46 | env: |
| 47 | GH_TOKEN: ${{ github.token }} |
| 48 | PR_NUMBER: ${{ github.event.pull_request.number }} |
| 49 | run: | |
| 50 | set -euo pipefail |
| 51 | if [ -f TREETRACE_REPORT.md ]; then |
| 52 | { |
| 53 | echo "### TreeTrace report" |
| 54 | echo "" |
| 55 | head -c 4000 TREETRACE_REPORT.md |
| 56 | echo "" |
| 57 | echo "_Full report: TREETRACE_REPORT.md_" |
| 58 | } > /tmp/tt-comment.md |
| 59 | gh pr comment "$PR_NUMBER" --body-file /tmp/tt-comment.md |
| 60 | elif [ -f PROMPT_TREE.md ]; then |
| 61 | { |
| 62 | echo "### Prompt tree" |
| 63 | echo "" |
| 64 | head -c 4000 PROMPT_TREE.md |
| 65 | echo "" |
| 66 | echo "_Full lineage: PROMPT_TREE.md_" |
| 67 | } > /tmp/tt-comment.md |
| 68 | gh pr comment "$PR_NUMBER" --body-file /tmp/tt-comment.md |
| 69 | fi |