context-mode 1.0.54 → 1.0.57

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 (52) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.openclaw-plugin/openclaw.plugin.json +1 -1
  4. package/.openclaw-plugin/package.json +1 -1
  5. package/README.md +20 -6
  6. package/build/adapters/antigravity/index.d.ts +1 -3
  7. package/build/adapters/antigravity/index.js +0 -30
  8. package/build/adapters/claude-code/index.d.ts +1 -3
  9. package/build/adapters/claude-code/index.js +15 -34
  10. package/build/adapters/codex/index.d.ts +1 -3
  11. package/build/adapters/codex/index.js +1 -31
  12. package/build/adapters/cursor/index.d.ts +1 -3
  13. package/build/adapters/cursor/index.js +0 -11
  14. package/build/adapters/gemini-cli/index.d.ts +1 -3
  15. package/build/adapters/gemini-cli/index.js +0 -30
  16. package/build/adapters/kiro/index.d.ts +1 -3
  17. package/build/adapters/kiro/index.js +0 -30
  18. package/build/adapters/openclaw/index.d.ts +1 -3
  19. package/build/adapters/openclaw/index.js +0 -38
  20. package/build/adapters/opencode/index.d.ts +1 -3
  21. package/build/adapters/opencode/index.js +15 -34
  22. package/build/adapters/types.d.ts +0 -13
  23. package/build/adapters/vscode-copilot/index.d.ts +1 -3
  24. package/build/adapters/vscode-copilot/index.js +0 -32
  25. package/build/adapters/zed/index.d.ts +1 -3
  26. package/build/adapters/zed/index.js +0 -30
  27. package/build/executor.d.ts +0 -1
  28. package/build/executor.js +26 -14
  29. package/build/openclaw-plugin.js +0 -30
  30. package/build/opencode-plugin.d.ts +1 -0
  31. package/build/opencode-plugin.js +1 -8
  32. package/build/server.js +82 -19
  33. package/build/truncate.d.ts +4 -17
  34. package/build/truncate.js +4 -52
  35. package/cli.bundle.mjs +110 -137
  36. package/hooks/ensure-deps.mjs +80 -2
  37. package/hooks/routing-block.mjs +12 -1
  38. package/hooks/session-helpers.mjs +13 -0
  39. package/hooks/session-snapshot.bundle.mjs +13 -13
  40. package/hooks/sessionstart.mjs +5 -2
  41. package/openclaw.plugin.json +1 -1
  42. package/package.json +1 -1
  43. package/server.bundle.mjs +83 -107
  44. package/skills/context-mode-ops/SKILL.md +111 -0
  45. package/skills/context-mode-ops/agent-teams.md +198 -0
  46. package/skills/context-mode-ops/communication.md +224 -0
  47. package/skills/context-mode-ops/release.md +199 -0
  48. package/skills/context-mode-ops/review-pr.md +269 -0
  49. package/skills/context-mode-ops/tdd.md +329 -0
  50. package/skills/context-mode-ops/triage-issue.md +218 -0
  51. package/skills/context-mode-ops/validation.md +238 -0
  52. package/start.mjs +5 -52
@@ -0,0 +1,199 @@
1
+ # Release Workflow
2
+
3
+ ## Trigger
4
+
5
+ User says: "release", "version bump", "npm publish", "ship it"
6
+
7
+ ## Pre-Flight Checks
8
+
9
+ Before ANY release action, verify:
10
+
11
+ ```bash
12
+ # Must be on main branch
13
+ git branch --show-current # expect: main
14
+
15
+ # Must be clean
16
+ git status --porcelain # expect: empty
17
+
18
+ # Must be up to date
19
+ git pull origin main
20
+ ```
21
+
22
+ ## Step-by-Step
23
+
24
+ ### 1. Validate Codebase (Parallel Agents)
25
+
26
+ Spawn these agents simultaneously:
27
+
28
+ | Agent | Task |
29
+ |-------|------|
30
+ | **QA Engineer** | Run `npm test` + `npm run typecheck` — report full pass/fail |
31
+ | **Security Engineer** | Check for any open security issues, audit recent changes |
32
+ | **Release Engineer** | Check current version, changelog, unreleased commits |
33
+ | **DX Engineer** | Verify README is current, install instructions work |
34
+
35
+ All must report PASS before proceeding.
36
+
37
+ ### 2. Version Bump — MANDATORY
38
+
39
+ <version_bump_enforcement>
40
+ You MUST run `npm version patch`. This is NOT optional. Do NOT skip this step.
41
+ Do NOT manually edit package.json version. Do NOT create git tags manually.
42
+ `npm version patch` does EVERYTHING — bump, sync manifests, stage, commit, tag.
43
+ </version_bump_enforcement>
44
+
45
+ ```bash
46
+ npm version patch
47
+ ```
48
+
49
+ This single command does ALL of the following automatically:
50
+ 1. Bumps `package.json` version (e.g., 1.0.56 → 1.0.57)
51
+ 2. Triggers `version` lifecycle hook → runs `scripts/version-sync.mjs`
52
+ 3. `version-sync.mjs` syncs version to ALL 6 manifest files:
53
+ - `.claude-plugin/plugin.json`
54
+ - `.claude-plugin/marketplace.json`
55
+ - `.openclaw-plugin/openclaw.plugin.json`
56
+ - `.openclaw-plugin/package.json`
57
+ - `openclaw.plugin.json`
58
+ - `.pi/extensions/context-mode/package.json`
59
+ 4. Stages the manifest files via `git add`
60
+ 5. Creates a git commit and `v{VERSION}` tag
61
+
62
+ **Do NOT create your own commit or tag. `npm version patch` handles it.**
63
+
64
+ ### 3. Validate (NO Build Needed)
65
+
66
+ **Do NOT run `npm run build` or `npm run bundle`.** CI generates bundle files automatically on GitHub. You only validate:
67
+
68
+ ```bash
69
+ # Tests
70
+ npm test
71
+
72
+ # TypeScript
73
+ npm run typecheck
74
+ ```
75
+
76
+ ### 4. Git Tag & GitHub Release
77
+
78
+ ```bash
79
+ # The npm version command already created a git tag
80
+ # Verify it exists:
81
+ git tag --list 'v*' | tail -5
82
+
83
+ # Push the commit and tag
84
+ git push origin main --tags
85
+
86
+ # Create GitHub release with auto-generated changelog
87
+ gh release create v{VERSION} \
88
+ --title "v{VERSION}" \
89
+ --generate-notes \
90
+ --latest
91
+ ```
92
+
93
+ ### 5. npm Publish (Local)
94
+
95
+ **⚠️ REQUIRES USER APPROVAL — ask before running.**
96
+
97
+ ```bash
98
+ # Dry run first
99
+ npm publish --dry-run
100
+
101
+ # If dry run looks good, publish
102
+ npm publish
103
+ ```
104
+
105
+ Verify publication:
106
+ ```bash
107
+ npm view context-mode version # should show new version
108
+ ```
109
+
110
+ ### 6. Sync Branches
111
+
112
+ Sync `next` with `main` to ensure next has all release changes:
113
+
114
+ ```bash
115
+ # Fetch latest
116
+ git fetch origin
117
+
118
+ # Merge main into next
119
+ git checkout next
120
+ git pull origin next
121
+ git merge main --no-edit
122
+
123
+ # Push
124
+ git push origin next
125
+
126
+ # Return to main
127
+ git checkout main
128
+ ```
129
+
130
+ **If merge conflict:** Resolve in favor of `main` (release branch is authoritative).
131
+
132
+ ### 7. Clean Remote Branches
133
+
134
+ **⚠️ REQUIRES USER APPROVAL for EACH branch.**
135
+
136
+ List stale remote branches (everything except `main` and `next`):
137
+
138
+ ```bash
139
+ # List remote branches excluding main and next
140
+ git branch -r | grep -v 'origin/main' | grep -v 'origin/next' | grep -v 'origin/HEAD'
141
+ ```
142
+
143
+ For each branch, ask the user:
144
+ ```
145
+ Remote branch: origin/{branch-name}
146
+ Last commit: {date} — {message}
147
+ Related PR: #{number} ({state})
148
+
149
+ Delete this branch? [y/n]
150
+ ```
151
+
152
+ Only delete after explicit approval:
153
+ ```bash
154
+ git push origin --delete {branch-name}
155
+ ```
156
+
157
+ ## Release Checklist (EM Verification)
158
+
159
+ Before declaring release complete:
160
+
161
+ - [ ] `npm test` — all pass
162
+ - [ ] `npm run typecheck` — no errors
163
+ - [ ] `npm version patch` — version bumped in all manifests
164
+ - [ ] `git push origin main --tags` — pushed with tag (CI builds bundles automatically)
165
+ - [ ] `gh release create` — GitHub release published
166
+ - [ ] `npm publish` — package on npm registry
167
+ - [ ] `next` branch synced with `main`
168
+ - [ ] Stale remote branches cleaned (user approved)
169
+ - [ ] Verify: `npm view context-mode version` shows new version
170
+
171
+ ## Rollback Plan
172
+
173
+ If something goes wrong after publish:
174
+
175
+ ```bash
176
+ # Unpublish within 72 hours (npm policy)
177
+ npm unpublish context-mode@{BAD_VERSION}
178
+
179
+ # Or deprecate
180
+ npm deprecate context-mode@{BAD_VERSION} "Known issue: {description}"
181
+
182
+ # Revert git
183
+ git revert HEAD
184
+ git push origin main
185
+ ```
186
+
187
+ ## Post-Release
188
+
189
+ After successful release:
190
+
191
+ 1. Comment on all issues fixed in this release:
192
+ ```
193
+ Released in v{VERSION}! Please update and test:
194
+ npm update -g context-mode
195
+ ```
196
+
197
+ 2. Update Discord if there are noteworthy changes
198
+
199
+ 3. Check npm download stats in 24h for any anomalies
@@ -0,0 +1,269 @@
1
+ # Review PR Workflow
2
+
3
+ ## Trigger
4
+
5
+ User says: "review PR #N", "merge PR #N", "check PR #N"
6
+
7
+ ## Core Philosophy
8
+
9
+ **Merge first, fix on top.** Contributors ghost when you request changes. Merge their work (if not absurd), then fix issues in follow-up commits. This keeps momentum and respects their effort.
10
+
11
+ **Exception:** Only reject if the PR introduces a security vulnerability, breaks core functionality beyond repair, or is completely unrelated to the project.
12
+
13
+ ## Step-by-Step
14
+
15
+ ### 1. Gather Intelligence (ONE batch call)
16
+
17
+ ```javascript
18
+ commands: [
19
+ { label: "pr-body", command: "gh pr view {N} --json title,body,state,author,baseRefName,headRefName,additions,deletions,files,reviews,comments,labels" },
20
+ { label: "pr-diff", command: "gh pr diff {N}" },
21
+ { label: "pr-comments", command: "gh pr view {N} --comments" },
22
+ { label: "pr-checks", command: "gh pr checks {N}" },
23
+ { label: "pr-files", command: "gh pr view {N} --json files --jq '.files[].path'" },
24
+ { label: "related-issue", command: "gh pr view {N} --json body --jq '.body' | grep -oP '#\\d+' | head -5" }
25
+ ],
26
+ queries: [
27
+ "PR title description changes",
28
+ "files modified adapter platform",
29
+ "diff code changes additions deletions",
30
+ "review comments feedback",
31
+ "CI check status pass fail",
32
+ "related issues referenced"
33
+ ]
34
+ ```
35
+
36
+ ### 2. Classify & Spawn Agents
37
+
38
+ Same classification as [triage-issue.md](triage-issue.md) step 2, but based on PR diff:
39
+
40
+ ```
41
+ ALWAYS spawn:
42
+ ├── Context Mode Architect (reviews all changes)
43
+ ├── QA Engineer (tests everything)
44
+ ├── DX Engineer (output quality check)
45
+
46
+ BASED ON FILES CHANGED:
47
+ ├── {Platform} Architect (for each affected adapter)
48
+ ├── Validation Engineer (verify ENV vars, hooks, configs via websearch)
49
+
50
+ BASED ON CONTENT:
51
+ ├── {Domain} Architect (database, security, OS, hooks, session, etc.)
52
+ ```
53
+
54
+ **Critical addition for PRs — Validation Engineer:**
55
+
56
+ This agent specifically validates claims made in the PR:
57
+ - ENV variables actually exist in the target platform
58
+ - Hook formats match the platform's actual API
59
+ - Config paths are real, not LLM hallucinations
60
+ - Features referenced actually exist in the platform's codebase
61
+
62
+ Uses WebSearch and Context7 to verify against official docs.
63
+
64
+ ### 3. Validation Phase (Parallel)
65
+
66
+ All agents run simultaneously:
67
+
68
+ **Context Mode Architect:**
69
+ - Does the change align with project architecture?
70
+ - Does it follow existing patterns?
71
+ - Are there edge cases the author missed?
72
+ - Is session continuity preserved?
73
+ - **TDD compliance**: Does the PR include tests? Do tests verify behavior (not implementation)?
74
+ - If no tests: flag as CHANGES_NEEDED (but still merge + add tests in follow-up)
75
+ - If tests mock internal collaborators: flag — tests should use public interfaces per [tdd.md](tdd.md)
76
+
77
+ **QA Engineer:**
78
+ ```shell
79
+ # Checkout PR locally
80
+ gh pr checkout {N}
81
+
82
+ # Run affected adapter tests
83
+ npx vitest run tests/adapters/{affected}.test.ts
84
+
85
+ # Run full suite
86
+ npm test
87
+
88
+ # TypeScript
89
+ npm run typecheck
90
+ ```
91
+
92
+ **Validation Engineer:**
93
+ ```javascript
94
+ // For each ENV var mentioned in the PR:
95
+ // 1. Grep for it in context-mode source
96
+ // 2. WebSearch: "{PLATFORM_NAME} {ENV_VAR} environment variable"
97
+ // 3. Context7: resolve-library-id for the platform, then query-docs
98
+
99
+ // Example: PR adds OPENCODE_CONFIG_PATH
100
+ // → Search OpenCode source: does this env var exist?
101
+ // → If not: flag as potential LLM hallucination
102
+ ```
103
+
104
+ **Platform Architects:**
105
+ - Review changes specific to their platform
106
+ - Validate against platform's actual hook/config format
107
+ - Check backward compatibility
108
+
109
+ ### 4. Merge Decision Matrix
110
+
111
+ ```
112
+ All tests pass + All architects APPROVE?
113
+ ├── YES → Merge immediately
114
+
115
+ ├── TESTS FAIL but fix is trivial?
116
+ │ └── Merge → Fix on top in follow-up commit
117
+
118
+ ├── ARCHITECT has minor concerns?
119
+ │ └── Merge → Fix concerns in follow-up commit
120
+
121
+ ├── VALIDATION catches hallucinated ENV/feature?
122
+ │ └── Merge if core logic is sound → Remove hallucinated parts
123
+ │ └── OR: Comment explaining the issue, give 48h, then merge+fix
124
+
125
+ ├── SECURITY issue found?
126
+ │ └── Do NOT merge. Comment with specific vulnerability.
127
+
128
+ └── PR is completely off-base?
129
+ └── Close with kind explanation. Rare — almost never do this.
130
+ ```
131
+
132
+ ### 5. Merge to `next` & Fix Flow
133
+
134
+ Always use `gh` CLI. Always squash merge into `next`:
135
+
136
+ ```bash
137
+ # Change PR base to next if needed
138
+ gh pr edit {N} --base next
139
+
140
+ # Squash merge into next
141
+ gh pr merge {N} --squash
142
+ ```
143
+
144
+ If follow-up fixes needed, push directly to `next`:
145
+
146
+ ```bash
147
+ git checkout next
148
+ git pull origin next
149
+ ```
150
+
151
+ **Follow-up fixes MUST follow TDD** (per [tdd.md](tdd.md)):
152
+
153
+ ```bash
154
+ # RED: Write failing test for the issue found during review
155
+ npx vitest run tests/{file}.test.ts # verify FAILS
156
+
157
+ # GREEN: Write minimal fix
158
+ # ... edit files ...
159
+ npx vitest run tests/{file}.test.ts # verify PASSES
160
+
161
+ # REFACTOR: Clean up
162
+ npm test # full suite still passes
163
+
164
+ # Commit
165
+ git add {files}
166
+ git commit -m "fix: address review findings from #{N}
167
+
168
+ - {fix 1}
169
+ - {fix 2}
170
+
171
+ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>"
172
+
173
+ git push origin next
174
+ ```
175
+
176
+ ### 6. Comment on PR
177
+
178
+ **After merge (standard):**
179
+
180
+ ```bash
181
+ gh pr comment {N} --body "$(cat <<'EOF'
182
+ Thanks for this contribution, @{author}! 🎉
183
+
184
+ Merged into `next` — this will ship in the next release.
185
+
186
+ Could you please test it in your setup once the release is out? You know this area best, so your verification would be really valuable. 🙏
187
+
188
+ {IF follow-up fixes were made:}
189
+ I made a small follow-up adjustment in {commit_sha}:
190
+ - {what was adjusted and why}
191
+ EOF
192
+ )"
193
+ ```
194
+
195
+ **After merge with concerns:**
196
+
197
+ ```bash
198
+ gh pr comment {N} --body "$(cat <<'EOF'
199
+ Thanks @{author}! Merged this into `next`.
200
+
201
+ I made a few adjustments on top:
202
+ - {change 1}: {reason}
203
+ - {change 2}: {reason}
204
+
205
+ These are in {commit_sha}. Could you review those changes and test the complete flow in your environment? The responsibility for verifying this works end-to-end is on you since you're closest to the use case. 🙏
206
+
207
+ This will ship in the next release!
208
+ EOF
209
+ )"
210
+ ```
211
+
212
+ **Rare: closing without merge:**
213
+
214
+ ```bash
215
+ gh pr comment {N} --body "$(cat <<'EOF'
216
+ Hey @{author}, thanks for taking the time to put this together!
217
+
218
+ Unfortunately, we can't merge this as-is because:
219
+ - {specific technical reason}
220
+
221
+ {IF salvageable:}
222
+ If you'd like to take another pass, here's what would need to change:
223
+ - {specific guidance}
224
+
225
+ {IF not salvageable:}
226
+ The direction we're going with this area is {explanation}. I appreciate the effort though!
227
+ EOF
228
+ )"
229
+ gh pr close {N}
230
+ ```
231
+
232
+ ## ENV/Feature Validation Protocol
233
+
234
+ This is the most critical part of PR review. LLMs frequently hallucinate ENV vars, hooks, and features.
235
+
236
+ ### Red Flags to Watch For
237
+
238
+ 1. **New ENV variable** — Does this actually exist in the platform?
239
+ 2. **New hook type** — Does the platform support this hook lifecycle?
240
+ 3. **Config path** — Is this the real config location?
241
+ 4. **API endpoint** — Does this API actually exist?
242
+ 5. **Feature flag** — Is this a real feature of the platform?
243
+
244
+ ### Verification Steps
245
+
246
+ For EACH claim in the PR:
247
+
248
+ 1. **Grep source**: `rg "{CLAIM}" src/` — is it already used?
249
+ 2. **WebSearch**: Search for official documentation of the claim
250
+ 3. **Context7**: `resolve-library-id` → `query-docs` for the platform
251
+ 4. **GitHub source**: Check the platform's actual repository if open source
252
+
253
+ ### Example: Fake ENV Detection
254
+
255
+ ```
256
+ PR adds: process.env.OPENCODE_HOOK_PATH
257
+ Step 1: rg "OPENCODE_HOOK_PATH" src/ → not found
258
+ Step 2: WebSearch "OpenCode OPENCODE_HOOK_PATH environment variable" → no results
259
+ Step 3: Context7 query OpenCode docs for "HOOK_PATH" → not documented
260
+ Verdict: HALLUCINATED — flag to EM, remove from PR
261
+ ```
262
+
263
+ ## Handling Stale PRs
264
+
265
+ If a PR has been open >7 days with no activity:
266
+ 1. Check if it's still relevant
267
+ 2. If yes: merge it, fix on top
268
+ 3. If no: close with kind explanation
269
+ 4. Never leave PRs in limbo