@codragraph/cli 1.6.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +50 -16
  2. package/dist/cli/ai-context.js +2 -2
  3. package/dist/cli/analyze.d.ts +22 -0
  4. package/dist/cli/analyze.js +111 -8
  5. package/dist/cli/compress-stats.d.ts +29 -0
  6. package/dist/cli/compress-stats.js +97 -0
  7. package/dist/cli/graphstore.d.ts +6 -2
  8. package/dist/cli/graphstore.js +24 -2
  9. package/dist/cli/index.js +17 -6
  10. package/dist/cli/profile-heap.d.ts +35 -0
  11. package/dist/cli/profile-heap.js +126 -0
  12. package/dist/cli/setup.d.ts +13 -0
  13. package/dist/cli/setup.js +75 -29
  14. package/dist/cli/skill-gen.d.ts +14 -2
  15. package/dist/cli/skill-gen.js +53 -20
  16. package/dist/cli/tool.js +4 -0
  17. package/dist/config/ignore-service.js +1 -1
  18. package/dist/core/embeddings/embedding-pipeline.js +24 -7
  19. package/dist/core/group/bridge-db.js +111 -24
  20. package/dist/core/group/extractors/grpc-patterns/proto.js +1 -12
  21. package/dist/core/ingestion/call-processor.js +2 -2
  22. package/dist/core/ingestion/cobol/cobol-preprocessor.js +1 -1
  23. package/dist/core/ingestion/cobol/jcl-parser.d.ts +1 -1
  24. package/dist/core/ingestion/cobol/jcl-parser.js +1 -1
  25. package/dist/core/ingestion/cobol-processor.d.ts +1 -1
  26. package/dist/core/ingestion/cobol-processor.js +1 -1
  27. package/dist/core/ingestion/heritage-extractors/generic.js +1 -1
  28. package/dist/core/ingestion/heritage-processor.js +1 -1
  29. package/dist/core/ingestion/import-processor.js +1 -1
  30. package/dist/core/ingestion/mro-processor.js +1 -1
  31. package/dist/core/ingestion/parsing-processor.js +1 -1
  32. package/dist/core/ingestion/type-extractors/c-cpp.js +1 -1
  33. package/dist/core/ingestion/type-extractors/python.js +1 -1
  34. package/dist/core/ingestion/type-extractors/shared.js +0 -3
  35. package/dist/core/lbug/content-read.d.ts +46 -0
  36. package/dist/core/lbug/content-read.js +64 -0
  37. package/dist/core/lbug/csv-generator.d.ts +2 -6
  38. package/dist/core/lbug/csv-generator.js +45 -12
  39. package/dist/core/lbug/lbug-adapter.d.ts +4 -1
  40. package/dist/core/lbug/lbug-adapter.js +157 -25
  41. package/dist/core/lbug/pool-adapter.js +51 -44
  42. package/dist/core/lbug/schema.d.ts +7 -7
  43. package/dist/core/lbug/schema.js +18 -0
  44. package/dist/core/run-analyze.d.ts +13 -0
  45. package/dist/core/run-analyze.js +91 -4
  46. package/dist/core/search/bm25-index.js +153 -12
  47. package/dist/core/wiki/generator.js +4 -4
  48. package/dist/mcp/local/local-backend.js +22 -5
  49. package/dist/mcp/resources.js +2 -3
  50. package/dist/server/api.js +4 -3
  51. package/dist/storage/repo-manager.d.ts +39 -0
  52. package/dist/storage/repo-manager.js +19 -0
  53. package/hooks/claude/codragraph-hook.cjs +108 -5
  54. package/hooks/claude/pre-tool-use.sh +6 -1
  55. package/package.json +4 -4
  56. package/scripts/build-tree-sitter-proto.cjs +15 -3
  57. package/scripts/patch-tree-sitter-swift.cjs +17 -4
  58. package/skills/codragraph-api-surface.md +110 -0
  59. package/skills/codragraph-cli.md +5 -5
  60. package/skills/codragraph-config-audit.md +146 -0
  61. package/skills/codragraph-cross-repo-impact.md +135 -0
  62. package/skills/codragraph-data-lineage.md +137 -0
  63. package/skills/codragraph-dead-code.md +119 -0
  64. package/skills/codragraph-debugging.md +1 -1
  65. package/skills/codragraph-exploring.md +1 -1
  66. package/skills/codragraph-gh-actions-debug.md +162 -0
  67. package/skills/codragraph-gh-issue-workflow.md +178 -0
  68. package/skills/codragraph-gh-pr-workflow.md +176 -0
  69. package/skills/codragraph-gh-release-workflow.md +187 -0
  70. package/skills/codragraph-git-bisect.md +176 -0
  71. package/skills/codragraph-git-force-push.md +147 -0
  72. package/skills/codragraph-git-history-rewrite.md +174 -0
  73. package/skills/codragraph-git-rebase-vs-merge.md +138 -0
  74. package/skills/codragraph-git-recovery.md +181 -0
  75. package/skills/codragraph-git-worktree.md +145 -0
  76. package/skills/codragraph-guide.md +1 -1
  77. package/skills/codragraph-impact-analysis.md +1 -1
  78. package/skills/codragraph-migration-tracking.md +130 -0
  79. package/skills/codragraph-notebook-context.md +136 -0
  80. package/skills/codragraph-observability-coverage.md +125 -0
  81. package/skills/codragraph-onboarding.md +129 -0
  82. package/skills/codragraph-perf-hotspots.md +132 -0
  83. package/skills/codragraph-pr-review.md +1 -1
  84. package/skills/codragraph-project-switcher.md +116 -0
  85. package/skills/codragraph-refactoring.md +1 -1
  86. package/skills/codragraph-security-audit.md +144 -0
  87. package/skills/codragraph-sql-tracing.md +122 -0
  88. package/skills/codragraph-supply-chain-audit.md +153 -0
  89. package/skills/codragraph-test-coverage.md +97 -0
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: codragraph-gh-issue-workflow
3
+ description: "Use for issue management via GitHub CLI — create, triage, label, assign, link to PRs, manage projects (v2), close with reason. Examples: \"open an issue\", \"triage issues\", \"add labels\", \"link this PR to issue\", \"close issue\", \"manage GitHub projects\""
4
+ ---
5
+
6
+ # Issue Workflow with `gh`
7
+
8
+ ## When to Use
9
+
10
+ - "Open an issue for this bug."
11
+ - "Triage the open issues — sort by labels / priority."
12
+ - "Link this PR to issue #42 so it auto-closes on merge."
13
+ - "Add this issue to my project board."
14
+ - "Bulk-relabel old issues."
15
+
16
+ ## Lifecycle commands
17
+
18
+ ### Create
19
+
20
+ ```bash
21
+ # Quick create:
22
+ gh issue create --title "…" --body "…" --label bug --assignee "@me"
23
+
24
+ # Multi-line body via HEREDOC:
25
+ gh issue create --title "Auth times out after 30s" --body "$(cat <<'EOF'
26
+ ## Repro
27
+ 1. Login as user X
28
+ 2. Wait 30s
29
+ 3. Click anywhere
30
+
31
+ ## Expected
32
+ Session refresh transparent.
33
+
34
+ ## Actual
35
+ Hard logout with no warning.
36
+
37
+ ## Environment
38
+ - App version: …
39
+ - Browser: …
40
+ EOF
41
+ )"
42
+
43
+ # From a template (.github/ISSUE_TEMPLATE/<x>.md):
44
+ gh issue create --template bug_report.md
45
+ ```
46
+
47
+ ### List / search / view
48
+
49
+ ```bash
50
+ gh issue list # open issues
51
+ gh issue list --state all --limit 100 # everything
52
+ gh issue list --label "bug,priority:high" # filter
53
+ gh issue list --search "in:title auth" # full-text in title/body
54
+ gh issue list --assignee "@me" # assigned to you
55
+
56
+ gh issue view <N> # one issue
57
+ gh issue view <N> --comments # include comments
58
+ gh issue status # issues needing your attention
59
+ ```
60
+
61
+ ### Triage / edit
62
+
63
+ ```bash
64
+ gh issue edit <N> --add-label "bug,needs-repro" --add-assignee @teammate
65
+ gh issue edit <N> --remove-label "stale" --milestone "v1.7.0"
66
+ gh issue comment <N> --body "Cannot repro. Could you share <X>?"
67
+ gh issue pin <N> # pin to top of issues page
68
+ gh issue unpin <N>
69
+ gh issue lock <N> # freeze further comments
70
+ gh issue unlock <N>
71
+ ```
72
+
73
+ ### Link issues to PRs
74
+
75
+ GitHub auto-closes the issue when a PR with `Closes #N` / `Fixes #N` /
76
+ `Resolves #N` in the body merges. From the CLI:
77
+
78
+ ```bash
79
+ gh pr create --body "$(cat <<'EOF'
80
+ Fixes #42.
81
+
82
+ ## Summary
83
+
84
+ EOF
85
+ )"
86
+ ```
87
+
88
+ For sub-issues / dependencies (no auto-close, just visual link):
89
+
90
+ ```
91
+ Related: #43, #44
92
+ Blocks: #50
93
+ ```
94
+
95
+ ### Close / reopen
96
+
97
+ ```bash
98
+ # State reasons (GitHub Issue State Reasons API):
99
+ gh issue close <N> --reason completed # default
100
+ gh issue close <N> --reason "not planned" # won't fix
101
+ gh issue close <N> --reason duplicate --comment "duplicate of #M"
102
+
103
+ gh issue reopen <N>
104
+ ```
105
+
106
+ ## Triage workflow (recurring)
107
+
108
+ A weekly / per-stand-up triage pass:
109
+
110
+ ```bash
111
+ # 1. Surface issues with no labels (the worst offender):
112
+ gh issue list --search "no:label" --limit 50
113
+
114
+ # 2. Surface "needs repro" stale-bait:
115
+ gh issue list --label "needs-repro" \
116
+ --search "updated:<$(date -u -d '14 days ago' +%Y-%m-%d)" --limit 50
117
+
118
+ # 3. Bulk-label or bulk-close (loop with gh):
119
+ for n in $(gh issue list --label "needs-repro" \
120
+ --search "updated:<$(date -u -d '30 days ago' +%Y-%m-%d)" \
121
+ --json number --jq '.[].number'); do
122
+ gh issue close "$n" --reason "not planned" \
123
+ --comment "Closing for inactivity. Reopen with a fresh repro."
124
+ done
125
+ ```
126
+
127
+ ## Projects (v2)
128
+
129
+ GitHub Projects v2 is the modern board. The CLI has first-class support
130
+ via `gh project`:
131
+
132
+ ```bash
133
+ gh project list --owner <org-or-user>
134
+ gh project view <number> --owner <org> # full board contents
135
+ gh project item-add <project-number> --owner <org> --url <issue-url>
136
+ gh project item-edit --id <item-id> --field-id <fid> --single-select-option-id <oid>
137
+ ```
138
+
139
+ Adding from issue context (one-liner):
140
+
141
+ ```bash
142
+ gh project item-add <pn> --owner <org> --url $(gh issue view <N> --json url --jq .url)
143
+ ```
144
+
145
+ ## Why CodraGraph helps here
146
+
147
+ When triaging a bug, jump straight from issue text to the suspect code:
148
+
149
+ ```
150
+ 1. gh issue view 42 --comments
151
+ → "validateUser fails for users with X"
152
+
153
+ 2. codragraph_query({query: "validateUser X"})
154
+ → suspect symbols ranked
155
+
156
+ 3. codragraph_context({name: "validateUser"})
157
+ → callers + callees + processes
158
+
159
+ 4. codragraph_impact({target: "validateUser", direction: "upstream"})
160
+ → which flows are affected — confirms the bug's blast radius
161
+
162
+ 5. Comment on the issue with concrete next steps:
163
+ gh issue comment 42 --body "Fix likely in src/auth/validate.ts:42 …"
164
+ ```
165
+
166
+ Combine with the `codragraph-debugging` skill for full bug-investigation
167
+ workflow.
168
+
169
+ ## Pitfalls
170
+
171
+ | Pitfall | Fix |
172
+ |---|---|
173
+ | Issue body forgets the repro | Always include "Repro / Expected / Actual / Env" in the template |
174
+ | Closing without a reason | Use `--reason "not planned"` so the state is searchable |
175
+ | Linking to PR via `#N` only | Use `Fixes #N` in PR body — that's what triggers auto-close |
176
+ | Bulk-relabeling without a `--dry-run` | gh has no built-in dry run; do `gh issue list` first to preview |
177
+ | Mixing v1 boards (deprecated) and v2 | New automation: only `gh project` (v2). Old `gh project` v1 commands removed in CLI 2.20+ |
178
+ ```
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: codragraph-gh-pr-workflow
3
+ description: "Use for any pull-request workflow via GitHub CLI — create draft, convert ready, request review, address comments, check CI, merge with the right strategy, manage stacked PRs. Examples: \"open a PR\", \"draft PR\", \"merge this PR\", \"check PR status\", \"address review comments\", \"stacked PRs\""
4
+ ---
5
+
6
+ # Pull Request Workflow with `gh`
7
+
8
+ ## When to Use
9
+
10
+ - "Open a PR for this branch."
11
+ - "Convert this draft to ready-for-review."
12
+ - "Check the status of my PRs."
13
+ - "Merge PR #N — which strategy should I use?"
14
+ - "Address review comments and push fixes."
15
+ - "I have stacked PRs — how do I manage them?"
16
+
17
+ ## Lifecycle commands
18
+
19
+ ### Open
20
+
21
+ ```bash
22
+ # After pushing your branch:
23
+ gh pr create --title "feat: …" --body "…" --reviewer @teammate
24
+ gh pr create --draft # ship as draft
25
+ gh pr create --fill # use the most recent commit message
26
+ gh pr create --base main --head my-branch # explicit base/head
27
+
28
+ # Multi-line body (HEREDOC) — preferred for real PRs:
29
+ gh pr create --title "feat: X" --body "$(cat <<'EOF'
30
+ ## Summary
31
+ - Bullet 1
32
+ - Bullet 2
33
+
34
+ ## Test plan
35
+ - [ ] Unit
36
+ - [ ] Integration
37
+ - [ ] Manual repro of the bug
38
+ EOF
39
+ )"
40
+ ```
41
+
42
+ ### Inspect
43
+
44
+ ```bash
45
+ gh pr list # PRs in this repo (yours by default)
46
+ gh pr list --state all --author "@me" # all your PRs ever
47
+ gh pr status # PRs needing attention (created by you, requesting your review)
48
+ gh pr view <N> # one PR's metadata
49
+ gh pr view <N> --comments # include review comments
50
+ gh pr diff <N> # raw diff
51
+ gh pr checks <N> # CI status per check
52
+ ```
53
+
54
+ ### Update
55
+
56
+ ```bash
57
+ # Push fixes to the same branch:
58
+ git push # PR auto-updates
59
+
60
+ # Convert draft <-> ready:
61
+ gh pr ready <N> # draft → ready-for-review
62
+ gh pr ready --undo <N> # ready → draft
63
+
64
+ # Edit metadata:
65
+ gh pr edit <N> --title "…" --add-reviewer @teammate --add-label "bug"
66
+ ```
67
+
68
+ ### Address review comments
69
+
70
+ ```bash
71
+ # Pull the conversation:
72
+ gh pr view <N> --comments
73
+
74
+ # Push your fixes (same branch):
75
+ git add <files> && git commit -m "address review: <topic>"
76
+ git push
77
+
78
+ # Mark conversations resolved (UI only, no CLI flag) or reply:
79
+ gh pr comment <N> --body "fixed in <new-sha>"
80
+ ```
81
+
82
+ ### Merge
83
+
84
+ | Strategy | When | gh command |
85
+ |---|---|---|
86
+ | **Squash** | One logical change, want one commit on main | `gh pr merge <N> --squash --delete-branch` |
87
+ | **Rebase** | Multiple already-tidy commits, no merge bubble | `gh pr merge <N> --rebase --delete-branch` |
88
+ | **Merge commit** | Long-running release branch, preserve topology | `gh pr merge <N> --merge --delete-branch` |
89
+ | **Auto-merge** | Merge as soon as CI green + reviews approved | `gh pr merge <N> --auto --squash --delete-branch` |
90
+
91
+ See `codragraph-git-rebase-vs-merge` for the decision rule. Default to
92
+ **squash** for typical feature PRs.
93
+
94
+ ### Close / reopen
95
+
96
+ ```bash
97
+ gh pr close <N> --comment "superseded by #<other>"
98
+ gh pr reopen <N>
99
+ ```
100
+
101
+ ## Stacked PR pattern (`gh pr` with branches that depend on each other)
102
+
103
+ When PR #2 depends on PR #1's branch, point #2's base at #1's branch:
104
+
105
+ ```bash
106
+ git switch feat/step-1
107
+ gh pr create --base main --title "feat: step 1"
108
+
109
+ git switch -c feat/step-2 feat/step-1
110
+ # … edit …
111
+ git push -u origin feat/step-2
112
+ gh pr create --base feat/step-1 --title "feat: step 2 (depends on #N)"
113
+
114
+ # When step-1 merges, automatically retarget step-2 to main:
115
+ gh pr edit <step-2-pr> --base main
116
+ ```
117
+
118
+ ## Why CodraGraph helps here
119
+
120
+ The PR review GitHub Action (codragraph-pr-review) ALREADY automates the
121
+ diff-comment side. As an author, you should ALSO run impact locally
122
+ before requesting review — it catches the "I forgot to update a caller"
123
+ class of problem that a reviewer is most likely to flag:
124
+
125
+ ```bash
126
+ codragraph_detect_changes({scope: "compare", base_ref: "main"})
127
+ # → list of changed symbols + affected execution flows
128
+
129
+ # For each non-trivial changed symbol:
130
+ codragraph_impact({target: "<symbol>", direction: "upstream"})
131
+ # → d=1 callers. Are they all updated in the PR?
132
+ ```
133
+
134
+ If d=1 callers exist OUTSIDE your PR diff, that's the breakage waiting
135
+ to happen. Either update them or document the migration path before
136
+ review.
137
+
138
+ ## Author checklist before requesting review
139
+
140
+ ```
141
+ - [ ] Branch rebased onto main (or merged main in, if shared)
142
+ - [ ] CI green: gh pr checks <N>
143
+ - [ ] codragraph_detect_changes — confirm scope is what you intended
144
+ - [ ] codragraph_impact on each public symbol you changed — d=1 callers updated
145
+ - [ ] PR title is conventional (feat: / fix: / docs: / etc.)
146
+ - [ ] PR body has Summary + Test plan
147
+ - [ ] Reviewers and labels set
148
+ - [ ] gh pr ready <N> if it was draft
149
+ ```
150
+
151
+ ## Reviewer checklist (if you're reviewing)
152
+
153
+ ```
154
+ - [ ] Pull the diff: gh pr diff <N> | less
155
+ - [ ] Use codragraph-pr-review skill: detect_changes + impact + context
156
+ - [ ] Run tests locally: gh pr checkout <N> && npm test
157
+ - [ ] Approve / request-changes / comment via gh pr review <N>
158
+ ```
159
+
160
+ ```bash
161
+ gh pr review <N> --approve --body "LGTM. Verified the impact graph clean."
162
+ gh pr review <N> --request-changes --body "…"
163
+ gh pr review <N> --comment --body "…"
164
+
165
+ # Inline comments require the GitHub UI (gh CLI doesn't support them yet).
166
+ ```
167
+
168
+ ## Pitfalls
169
+
170
+ | Pitfall | Symptom | Fix |
171
+ |---|---|---|
172
+ | Created PR from main | "There isn't anything to compare" | Push to a feature branch first |
173
+ | Wrong base | PR shows commits from main | `gh pr edit <N> --base <correct-base>` |
174
+ | Squash-merged a stacked PR's parent | Child PR shows 0 commits | `git rebase main` on child, force-push |
175
+ | `gh pr merge --auto` without branch protection | Merges immediately, not on green | Configure branch-protection rules first |
176
+ | Closing instead of merging | Commits don't land on main | `gh pr merge` not `gh pr close` |
@@ -0,0 +1,187 @@
1
+ ---
2
+ name: codragraph-gh-release-workflow
3
+ description: "Use for the release workflow — semver bump, tag, generate release notes, attach assets, draft vs published, prerelease tagging, and propagating to npm. Examples: \"cut a release\", \"create a GitHub release\", \"draft release notes\", \"upload binaries to release\", \"prerelease v2 alpha\""
4
+ ---
5
+
6
+ # Release Workflow with `gh`
7
+
8
+ ## When to Use
9
+
10
+ - "Cut a 1.7.0 release."
11
+ - "Draft release notes from commits."
12
+ - "Attach the built binaries to the release."
13
+ - "Mark this as a prerelease (alpha / beta / RC)."
14
+ - "Re-publish notes after I edited them."
15
+
16
+ ## Pre-release checklist (do these BEFORE `gh release create`)
17
+
18
+ ```
19
+ - [ ] Branch is main / release/x.y, fully synced
20
+ - [ ] CHANGELOG.md updated (or ready to be auto-generated)
21
+ - [ ] Version bumped in package.json / Cargo.toml / pyproject.toml
22
+ - [ ] All commits since last tag intentional (no leftover wip)
23
+ - [ ] CI green on the release commit (gh pr checks <N>)
24
+ - [ ] codragraph diff <last-tag> HEAD --semantic — review removed APIs
25
+ (any removed public API = SemVer major; document loudly in notes)
26
+ ```
27
+
28
+ ## Cutting the release
29
+
30
+ ```bash
31
+ # 1. Bump + commit version
32
+ npm version 1.7.0 --no-git-tag-version # or pnpm version, or manual edit
33
+ git add package.json package-lock.json
34
+ git commit -m "chore(release): 1.7.0"
35
+ git push origin main
36
+
37
+ # 2. Tag (annotated, signed if you have GPG):
38
+ git tag -a v1.7.0 -m "Release 1.7.0" # annotated
39
+ git tag -s v1.7.0 -m "Release 1.7.0" # signed (requires GPG setup)
40
+ git push origin v1.7.0
41
+
42
+ # 3. Create GitHub release. Auto-generate notes from commits since the previous tag:
43
+ gh release create v1.7.0 --generate-notes
44
+ ```
45
+
46
+ `--generate-notes` uses `.github/release.yml` (if present) for category
47
+ filtering, or falls back to a flat list of commit titles.
48
+
49
+ ## Custom notes
50
+
51
+ ```bash
52
+ # Notes from a file:
53
+ gh release create v1.7.0 --notes-file RELEASE_NOTES.md
54
+
55
+ # Inline (HEREDOC, the right way):
56
+ gh release create v1.7.0 --notes "$(cat <<'EOF'
57
+ ## What's new
58
+ - npx zero-install entry — no more 3-step setup
59
+ - PR review GitHub Action (deterministic + LLM modes)
60
+ - 17 built-in workflow skills
61
+
62
+ ## Breaking
63
+ - None.
64
+
65
+ ## Upgrade
66
+ \`\`\`
67
+ npm i -g @codragraph/cli@1.7.0
68
+ \`\`\`
69
+ EOF
70
+ )"
71
+
72
+ # Edit notes after publishing:
73
+ gh release edit v1.7.0 --notes-file new-notes.md
74
+ ```
75
+
76
+ ## Attach assets
77
+
78
+ ```bash
79
+ # After creating the release, upload binaries / source bundles:
80
+ gh release upload v1.7.0 dist/cli-linux-x64.tar.gz dist/cli-darwin-arm64.tar.gz
81
+
82
+ # Or in one shot at create time:
83
+ gh release create v1.7.0 dist/*.tar.gz dist/*.zip --generate-notes
84
+ ```
85
+
86
+ ## Draft vs published vs prerelease
87
+
88
+ ```bash
89
+ # Draft (visible only to maintainers, not yet announced):
90
+ gh release create v1.7.0 --draft --generate-notes
91
+
92
+ # Promote draft → published:
93
+ gh release edit v1.7.0 --draft=false
94
+
95
+ # Prerelease (alpha / beta / RC — semver string ends with -alpha.N etc.):
96
+ gh release create v2.0.0-alpha.1 --prerelease --generate-notes
97
+
98
+ # Mark an existing release as latest (otherwise GitHub picks by semver):
99
+ gh release edit v1.7.0 --latest
100
+ ```
101
+
102
+ ## Re-publish a release after editing
103
+
104
+ ```bash
105
+ # View existing release:
106
+ gh release view v1.7.0
107
+
108
+ # Edit notes:
109
+ gh release edit v1.7.0 --notes-file fixed-notes.md
110
+
111
+ # Upload missing asset:
112
+ gh release upload v1.7.0 dist/cli-windows-x64.zip
113
+ ```
114
+
115
+ ## Coordinating with npm publish
116
+
117
+ For a TypeScript / Node package, the GitHub release and the npm publish
118
+ are TWO separate events:
119
+
120
+ ```bash
121
+ # Order: tag → npm publish → GH release (so the release links a version
122
+ # users can `npm install`).
123
+
124
+ git tag v1.7.0 && git push origin v1.7.0
125
+ npm publish --access public # for scoped packages
126
+ gh release create v1.7.0 --generate-notes
127
+ ```
128
+
129
+ You can automate this in a workflow that triggers on `push` of a `v*` tag:
130
+
131
+ ```yaml
132
+ on:
133
+ push:
134
+ tags: ['v*']
135
+ jobs:
136
+ release:
137
+ runs-on: ubuntu-latest
138
+ steps:
139
+ - uses: actions/checkout@v4
140
+ - uses: actions/setup-node@v4
141
+ with:
142
+ node-version: '20'
143
+ registry-url: 'https://registry.npmjs.org'
144
+ - run: npm ci && npm run build
145
+ - run: npm publish --access public
146
+ env:
147
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
148
+ - uses: softprops/action-gh-release@v2
149
+ with:
150
+ generate_release_notes: true
151
+ ```
152
+
153
+ ## Why CodraGraph helps here
154
+
155
+ The structural diff between two tags is the most honest changelog you'll
156
+ ever produce — it's derived from the graph, not from commit messages
157
+ that lie:
158
+
159
+ ```bash
160
+ codragraph diff v1.6.4 v1.7.0 --semantic --json > /tmp/diff.json
161
+
162
+ # What changed:
163
+ jq '.semantic.addedAPIs | length, .semantic.removedAPIs | length, .semantic.classifiedModifications | length' /tmp/diff.json
164
+
165
+ # Generate a structured "API changes" section for the release notes:
166
+ jq -r '
167
+ "### Added APIs\n" +
168
+ ([.semantic.addedAPIs[] | "- `" + (.name // .id) + "`"] | join("\n")) +
169
+ "\n\n### Removed APIs (BREAKING)\n" +
170
+ ([.semantic.removedAPIs[] | "- `" + (.name // .id) + "`"] | join("\n"))
171
+ ' /tmp/diff.json
172
+ ```
173
+
174
+ Removed APIs = SemVer major. Modified signatures with parameter-count
175
+ changes = SemVer major. Use this to keep your bump honest.
176
+
177
+ ## Pitfalls
178
+
179
+ | Pitfall | Symptom | Fix |
180
+ |---|---|---|
181
+ | Forgot to push the tag | GH release creation fails | `git push origin v1.7.0` |
182
+ | `npm publish` before the tag | Tag not on the published commit | publish AFTER pushing the tag |
183
+ | Removed an API but bumped only minor | Breaking change in non-major release | Always run `codragraph diff <prev> HEAD --semantic` and bump major if removedAPIs is non-empty |
184
+ | `--generate-notes` produces noise | All commit messages flat-listed | Add `.github/release.yml` to categorize by labels / paths |
185
+ | Wrong release marked `latest` | Older release stays as latest | `gh release edit <new-version> --latest` |
186
+ | Released a prerelease as stable | Users on `latest` channel get unstable code | Always `--prerelease` for alpha / beta / RC |
187
+ ```