supipowers 1.3.0 → 1.5.1

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 (134) hide show
  1. package/README.md +130 -57
  2. package/bin/install.ts +48 -128
  3. package/package.json +25 -3
  4. package/skills/code-review/SKILL.md +137 -40
  5. package/skills/context-mode/SKILL.md +67 -52
  6. package/skills/creating-supi-agents/SKILL.md +204 -0
  7. package/skills/debugging/SKILL.md +86 -40
  8. package/skills/fix-pr/SKILL.md +96 -65
  9. package/skills/planning/SKILL.md +105 -46
  10. package/skills/qa-strategy/SKILL.md +68 -46
  11. package/skills/receiving-code-review/SKILL.md +60 -53
  12. package/skills/release/SKILL.md +111 -39
  13. package/skills/tdd/SKILL.md +118 -67
  14. package/skills/verification/SKILL.md +71 -37
  15. package/src/bootstrap.ts +24 -5
  16. package/src/commands/agents.ts +249 -0
  17. package/src/commands/ai-review.ts +1113 -0
  18. package/src/commands/config.ts +224 -95
  19. package/src/commands/doctor.ts +19 -13
  20. package/src/commands/fix-pr.ts +8 -11
  21. package/src/commands/generate.ts +200 -0
  22. package/src/commands/model-picker.ts +5 -15
  23. package/src/commands/model.ts +4 -5
  24. package/src/commands/plan.ts +148 -92
  25. package/src/commands/qa.ts +14 -23
  26. package/src/commands/release.ts +523 -282
  27. package/src/commands/review.ts +643 -86
  28. package/src/commands/status.ts +44 -17
  29. package/src/commands/supi.ts +69 -42
  30. package/src/commands/update.ts +57 -2
  31. package/src/config/defaults.ts +6 -39
  32. package/src/config/loader.ts +388 -40
  33. package/src/config/model-resolver.ts +26 -22
  34. package/src/config/schema.ts +113 -48
  35. package/src/context/analyzer.ts +4 -2
  36. package/src/context-mode/detector.ts +16 -54
  37. package/src/context-mode/hooks.ts +135 -17
  38. package/src/context-mode/knowledge/chunker.ts +274 -0
  39. package/src/context-mode/knowledge/store.ts +187 -0
  40. package/src/context-mode/routing.ts +3 -9
  41. package/src/context-mode/sandbox/executor.ts +183 -0
  42. package/src/context-mode/sandbox/runners.ts +40 -0
  43. package/src/context-mode/snapshot-builder.ts +2 -2
  44. package/src/context-mode/tools.ts +459 -0
  45. package/src/context-mode/web/fetcher.ts +117 -0
  46. package/src/context-mode/web/html-to-md.ts +293 -0
  47. package/src/debug/logger.ts +107 -0
  48. package/src/deps/registry.ts +0 -20
  49. package/src/docs/drift.ts +454 -0
  50. package/src/fix-pr/fetch-comments.ts +66 -0
  51. package/src/git/commit-msg.ts +2 -1
  52. package/src/git/commit.ts +123 -141
  53. package/src/git/conventions.ts +2 -2
  54. package/src/git/status.ts +4 -1
  55. package/src/lsp/bridge.ts +138 -12
  56. package/src/planning/approval-flow.ts +125 -19
  57. package/src/planning/plan-content-policy.ts +78 -0
  58. package/src/planning/plan-reviewer.ts +8 -8
  59. package/src/planning/plan-writer-prompt.ts +15 -34
  60. package/src/planning/planning-ask-tool.ts +81 -0
  61. package/src/planning/prompt-builder.ts +9 -169
  62. package/src/planning/system-prompt.ts +293 -0
  63. package/src/platform/omp.ts +50 -4
  64. package/src/platform/progress.ts +182 -0
  65. package/src/platform/test-utils.ts +4 -1
  66. package/src/platform/tui-colors.ts +30 -0
  67. package/src/platform/types.ts +1 -0
  68. package/src/qa/detect-app-type.ts +102 -0
  69. package/src/qa/discover-routes.ts +353 -0
  70. package/src/quality/ai-session.ts +96 -0
  71. package/src/quality/ai-setup.ts +86 -0
  72. package/src/quality/gates/ai-review.ts +129 -0
  73. package/src/quality/gates/build.ts +8 -0
  74. package/src/quality/gates/command.ts +150 -0
  75. package/src/quality/gates/format.ts +28 -0
  76. package/src/quality/gates/lint.ts +22 -0
  77. package/src/quality/gates/lsp-diagnostics.ts +84 -0
  78. package/src/quality/gates/test-suite.ts +8 -0
  79. package/src/quality/gates/typecheck.ts +22 -0
  80. package/src/quality/registry.ts +25 -0
  81. package/src/quality/review-gates.ts +33 -0
  82. package/src/quality/runner.ts +268 -0
  83. package/src/quality/schemas.ts +48 -0
  84. package/src/quality/setup.ts +227 -0
  85. package/src/release/changelog.ts +72 -3
  86. package/src/release/channels/custom.ts +43 -0
  87. package/src/release/channels/gitea.ts +35 -0
  88. package/src/release/channels/github.ts +35 -0
  89. package/src/release/channels/gitlab.ts +35 -0
  90. package/src/release/channels/registry.ts +52 -0
  91. package/src/release/channels/types.ts +27 -0
  92. package/src/release/detector.ts +10 -63
  93. package/src/release/executor.ts +61 -51
  94. package/src/release/prompt.ts +38 -38
  95. package/src/release/version.ts +163 -15
  96. package/src/review/agent-loader.ts +335 -0
  97. package/src/review/consolidator.ts +180 -0
  98. package/src/review/default-agents/correctness.md +72 -0
  99. package/src/review/default-agents/maintainability.md +64 -0
  100. package/src/review/default-agents/security.md +67 -0
  101. package/src/review/fixer.ts +219 -0
  102. package/src/review/multi-agent-runner.ts +135 -0
  103. package/src/review/output.ts +147 -0
  104. package/src/review/prompts/agent-review-wrapper.md +36 -0
  105. package/src/review/prompts/fix-findings.md +32 -0
  106. package/src/review/prompts/fix-output-schema.md +18 -0
  107. package/src/review/prompts/invalid-output-retry.md +22 -0
  108. package/src/review/prompts/output-instructions.md +14 -0
  109. package/src/review/prompts/review-output-schema.md +38 -0
  110. package/src/review/prompts/single-review.md +53 -0
  111. package/src/review/prompts/validation-review.md +30 -0
  112. package/src/review/runner.ts +128 -0
  113. package/src/review/scope.ts +353 -0
  114. package/src/review/template.ts +15 -0
  115. package/src/review/types.ts +296 -0
  116. package/src/review/validator.ts +160 -0
  117. package/src/storage/plans.ts +5 -3
  118. package/src/storage/reports.ts +50 -7
  119. package/src/storage/review-sessions.ts +117 -0
  120. package/src/text.ts +19 -0
  121. package/src/types.ts +336 -26
  122. package/src/utils/paths.ts +39 -0
  123. package/src/visual/companion.ts +5 -3
  124. package/src/visual/start-server.ts +101 -0
  125. package/src/visual/stop-server.ts +39 -0
  126. package/bin/ctx-mode-wrapper.mjs +0 -66
  127. package/src/config/profiles.ts +0 -64
  128. package/src/context-mode/installer.ts +0 -38
  129. package/src/quality/ai-review-gate.ts +0 -43
  130. package/src/quality/gate-runner.ts +0 -67
  131. package/src/quality/lsp-gate.ts +0 -24
  132. package/src/quality/test-gate.ts +0 -39
  133. package/src/visual/scripts/start-server.sh +0 -98
  134. package/src/visual/scripts/stop-server.sh +0 -21
package/README.md CHANGED
@@ -23,80 +23,122 @@ Run the interactive installer:
23
23
  bunx supipowers
24
24
  ```
25
25
 
26
- The installer detects your agent, registers the extension, and optionally sets up LSP servers, MCP tools, and the context-mode integration.
26
+ The installer detects your agent, registers the extension, removes legacy external context-mode MCP registrations, and can install missing optional tooling such as LSP servers, `mcpc`, and Playwright CLI.
27
27
 
28
28
  > [!TIP]
29
29
  > Run `/supi:update` at any time to upgrade to the latest version, or `/supi:doctor` to check your setup.
30
30
 
31
31
  ### Requirements
32
32
 
33
- | Dependency | What it's for |
34
- | --- | --- |
35
- | [Oh My Pi (OMP)](https://github.com/can1357/oh-my-pi) | The coding agent that supipowers extends |
36
- | [Bun](https://bun.sh) | Runtime — required for installation and the built-in SQLite FTS index |
37
- | [Git](https://git-scm.com) | Used by the installer and context-mode setup |
33
+ | Dependency | What it's for |
34
+ | ----------------------------------------------------- | --------------------------------------------------------------------- |
35
+ | [Oh My Pi (OMP)](https://github.com/can1357/oh-my-pi) | The coding agent that supipowers extends |
36
+ | [Bun](https://bun.sh) | Runtime — required for installation and the built-in SQLite FTS index |
37
+ | [Git](https://git-scm.com) | Used by the installer and git-based workflows |
38
38
 
39
39
  ### Optional dependencies
40
40
 
41
- The installer scans for these and offers to install any that are missing. Everything works without them, but each one unlocks additional capabilities.
41
+ The installer scans for these and offers to install missing tooling where it can. Everything works without them, but each one unlocks additional capabilities.
42
42
 
43
- | Dependency | What it enables |
44
- | --- | --- |
45
- | [mcpc](https://github.com/apify/mcpc) | MCP server management via `/supi:mcp` |
46
- | [context-mode](https://github.com/ogrodev/context-mode) | Context window protection large outputs are sandboxed automatically |
47
- | `typescript-language-server` | TypeScript/JS diagnostics and references in review gates |
48
- | `pyright` | Python type checking |
49
- | `rust-analyzer` | Rust language server |
50
- | `gopls` | Go language server |
51
- | `@playwright/cli` | Browser exploration and E2E test execution via `/supi:qa` |
43
+ | Dependency | What it enables |
44
+ | ------------------------------------- | --------------------------------------------------------------------- |
45
+ | [mcpc](https://github.com/apify/mcpc) | MCP server management via `/supi:mcp` |
46
+ | `typescript-language-server` | TypeScript/JS diagnostics and references in review gates |
47
+ | `pyright` | Python type checking |
48
+ | `rust-analyzer` | Rust language server |
49
+ | `gopls` | Go language server |
50
+ | `@playwright/cli` | Browser exploration and E2E test execution via `/supi:qa` |
52
51
 
53
52
  > [!NOTE]
54
53
  > LSP servers are language-specific — install only the ones that match your project's stack.
54
+ > Context protection is built into supipowers. No external `context-mode` or `supi-context-mode` dependency is required.
55
+ > The design is inspired by [context-mode](https://github.com/mksglu/context-mode).
55
56
 
56
57
  ## Commands
57
58
 
58
- | Command | What it does |
59
- | --- | --- |
60
- | `/supi` | Interactive menu with commands and project status |
61
- | `/supi:plan` | Collaborative planning with structured task breakdown |
62
- | `/supi:review` | Run quality gates at chosen depth |
63
- | `/supi:qa` | E2E testing pipeline with Playwright |
64
- | `/supi:fix-pr` | Assess and fix PR review comments |
65
- | `/supi:release` | Version bump, release notes, publish |
66
- | `/supi:commit` | AI-powered commit with conventional message generation |
67
- | `/supi:model` | Configure model assignments per action (plan, review, qa…) |
68
- | `/supi:context` | Show current context window usage and system prompt breakdown |
69
- | `/supi:mcp` | Manage MCP servers (connect, disconnect, migrate) |
70
- | `/supi:config` | Interactive settings TUI |
71
- | `/supi:status` | Check running sub-agents and progress |
72
- | `/supi:doctor` | Diagnose extension health and missing dependencies |
73
- | `/supi:update` | Update supipowers to the latest version |
74
-
75
- Commands like `/supi`, `/supi:config`, `/supi:commit`, and `/supi:status` are TUI-only — they open native dialogs without triggering the AI session.
59
+ | Command | What it does |
60
+ | ------------------------ | ------------------------------------------------------------- |
61
+ | `/supi` | Interactive menu with commands and project status |
62
+ | `/supi:plan` | Collaborative planning with structured task breakdown |
63
+ | `/supi:review` | AI code review with validated findings docs and fix/document/discuss actions |
64
+ | `/supi:checks` | Run deterministic quality gates |
65
+ | `/supi:qa` | E2E testing pipeline with Playwright |
66
+ | `/supi:fix-pr` | Assess and fix PR review comments |
67
+ | `/supi:release` | Version bump, release notes, publish |
68
+ | `/supi:commit` | AI-powered commit with conventional message generation |
69
+ | `/supi:model` | Configure model assignments per action (plan, review, qa…) |
70
+ | `/supi:context` | Show current context window usage and system prompt breakdown |
71
+ | `/supi:optimize-context` | Analyze loaded prompt/context usage and suggest reductions |
72
+ | `/supi:mcp` | Manage MCP servers (connect, disconnect, migrate) |
73
+ | `/supi:config` | Interactive settings TUI |
74
+ | `/supi:status` | Show project plans and configuration summary |
75
+ | `/supi:doctor` | Diagnose extension health and missing dependencies |
76
+ | `/supi:generate` | Documentation drift detection |
77
+ | `/supi:update` | Update supipowers to the latest version |
78
+ | `/supi:agents` | Manage review agents |
79
+
80
+ Most commands steer the AI session. These are TUI-only — they open native dialogs without triggering the AI: `/supi`, `/supi:config`, `/supi:status`, `/supi:review`, `/supi:update`, `/supi:doctor`, `/supi:mcp`, `/supi:model`, `/supi:context`, `/supi:optimize-context`, `/supi:commit`, `/supi:release`, `/supi:checks`, `/supi:agents`.
76
81
 
77
82
  ## How it works
78
83
 
79
84
  **Planning.** `/supi:plan` steers the AI through planning phases (scope → decompose → estimate → verify), saves the result to `.omp/supipowers/plans/`, and presents an approval UI. On approval, tasks execute in the same session.
80
85
 
81
- **Quality gates.** `/supi:review` runs composable checks selected by profile. LSP diagnostics surface real type errors. AI review catches logic issues. Test gates run your actual test suite. Each gate reports issues with severity levels.
86
+ **Quality gates.** `/supi:checks` runs deterministic quality gates. Six gates are available: `lsp-diagnostics`, `lint`, `typecheck`, `format`, `test-suite`, and `build`. Each gate can be enabled independently via `/supi:config` or `.omp/supipowers/config.json`. Gates report issues with severity levels.
82
87
 
83
- **PR fixing.** `/supi:fix-pr` fetches PR review comments, critically assesses each one, checks for ripple effects, then fixes or rejects with evidence. Bot reviewers are auto-detected and filtered out.
88
+ **AI code review.** `/supi:review` runs a programmatic AI review pipeline with configurable depth (quick, deep, or multi-agent). It uses headless agent sessions with structured JSON validation, always validates findings before user action, writes the current validated findings to a session `findings.md` document, and then presents three next-step choices: `Fix now`, `Document only`, or `Discuss before fixing`.
89
+
90
+ **Review agents.** Multi-agent review loads agents from two scopes: global and project.
84
91
 
85
- **Context protection.** When [context-mode](https://github.com/ogrodev/context-mode) is detected, supipowers injects routing hooks that protect the agent's context window. Large outputs, file reads, and HTTP calls are automatically routed through sandboxed execution so only summaries enter the conversation.
92
+ - Global defaults and global custom agents live under `~/.omp/supipowers/review-agents/`.
93
+ - Project configuration lives under `.omp/supipowers/review-agents/config.yml`.
94
+ - Default built-in agent markdown files are installed globally, not per-project.
95
+ - Project custom agent markdown files can still live under `.omp/supipowers/review-agents/`.
96
+ - Merge precedence is project over global: if the project config mentions an agent name, it shadows the global agent with the same name.
97
+ - A project entry with `enabled: false` suppresses the global agent with that same name instead of falling back to the global copy.
86
98
 
87
- **Model assignment.** Each action (planning, review, QA) can be assigned a different model and thinking level. `/supi:model` opens a TUI picker backed by OMP's model registry.
99
+ Use `/supi:agents` to inspect the merged set that will actually run.
88
100
 
89
- ## Quality profiles
101
+ **PR fixing.** `/supi:fix-pr` fetches PR review comments, critically assesses each one, checks for ripple effects, then fixes or rejects with evidence. Bot reviewers are auto-detected and filtered out.
90
102
 
91
- Three built-in profiles control how much `/supi:review` checks:
103
+ **Context protection.** Supipowers always enables built-in context protection through native `ctx_*` tools and routing hooks. Search/find and web-fetch style operations are redirected to sandboxed execution or indexed storage, and oversized tool results are compressed before they reach the conversation.
92
104
 
93
- | Profile | LSP | AI Review | Code Quality | Tests | E2E |
94
- | --- | --- | --- | --- | --- | --- |
95
- | `quick` | ✓ | quick scan | — | — | — |
96
- | `thorough` _(default)_ | ✓ | deep | ✓ | — | — |
97
- | `full-regression` | ✓ | deep | ✓ | ✓ | ✓ |
105
+ **Model assignment.** Each action can be assigned a different model and thinking level. `/supi:model` opens a TUI picker backed by OMP's model registry.
98
106
 
99
- Create custom profiles in `.omp/supipowers/profiles/`.
107
+ ## Feature comparison with `obra/superpowers`
108
+
109
+ > [!NOTE]
110
+ > Based on the current `supipowers` repo and the documented features in [`obra/superpowers`](https://github.com/obra/superpowers). ✅ = part of the current documented product surface. ❌ = not part of the current documented product surface.
111
+
112
+ | What is being compared | supipowers | obra/superpowers |
113
+ | ------------------------------------- | ---------- | ---------------- |
114
+ | OMP-native slash commands | ✅ | ❌ |
115
+ | Automatic skill activation | ❌ | ✅ |
116
+ | Plan approval UI | ✅ | ❌ |
117
+ | Parallel agent execution workflow | ✅ | ✅ |
118
+ | Code review workflow | ✅ | ✅ |
119
+ | TDD / debugging / verification skills | ✅ | ✅ |
120
+ | Browser QA / Playwright workflow | ✅ | ❌ |
121
+ | PR review comment fixing workflow | ✅ | ❌ |
122
+ | Release automation | ✅ | ❌ |
123
+ | Commit workflow | ✅ | ❌ |
124
+ | Context-window optimizations | ✅ | ❌ |
125
+ | MCP server management through mcpc | ✅ | ❌ |
126
+ | Git worktree workflow | ❌ | ✅ |
127
+
128
+ ## Quality gates
129
+
130
+ `/supi:checks` runs deterministic quality gates. Each gate is independently configurable in `quality.gates` via `/supi:config` or the config JSON files:
131
+
132
+ | Gate | What it checks | Config type |
133
+ | ------------------ | ------------------------------- | ----------------- |
134
+ | `lsp-diagnostics` | Language server diagnostics | enabled |
135
+ | `lint` | Linter (e.g. `eslint`, `biome`) | enabled + command |
136
+ | `typecheck` | Type checker (e.g. `tsc`) | enabled + command |
137
+ | `format` | Formatter check | enabled + command |
138
+ | `test-suite` | Test runner | enabled + command |
139
+ | `build` | Build verification | enabled + command |
140
+
141
+ Gates default to disabled. Enable them per-project in `.omp/supipowers/config.json` or globally in `~/.omp/supipowers/config.json`.
100
142
 
101
143
  ## Configuration
102
144
 
@@ -112,21 +154,50 @@ Configuration is a three-layer deep-merge (lowest to highest priority):
112
154
  2. `~/.omp/supipowers/config.json` — global overrides
113
155
  3. `.omp/supipowers/config.json` — per-project overrides
114
156
 
157
+
158
+ ## Release channels
159
+
160
+ Three built-in channels are available: `github` (GitHub Release via `gh` CLI), `gitlab` (GitLab Release via `glab` CLI), and `gitea` (Gitea Release via `tea` CLI). Channels are selected per-project in `release.channels`.
161
+
162
+ Custom channels can be defined in `release.customChannels`:
163
+
164
+ ```json
165
+ {
166
+ "release": {
167
+ "customChannels": {
168
+ "my-channel": {
169
+ "label": "My Channel",
170
+ "publishCommand": "./scripts/publish.sh $tag",
171
+ "detectCommand": "which my-tool"
172
+ }
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ | Field | Required | Description |
179
+ | ---------------- | -------- | -------------------------------------------------------------- |
180
+ | `label` | yes | Display name shown in the release picker |
181
+ | `publishCommand` | yes | Shell command run to publish; `$tag`, `$version`, `$changelog` are passed as environment variables |
182
+ | `detectCommand` | no | Shell command to detect availability; exit 0 = available. If omitted, the channel is assumed available |
183
+
115
184
  ## Skills
116
185
 
117
186
  Supipowers ships runtime-loaded prompt skills that are also available to the agent during regular sessions:
118
187
 
119
- | Skill | Used by |
120
- | --- | --- |
121
- | `planning` | `/supi:plan` |
122
- | `code-review` | `/supi:review` |
123
- | `qa-strategy` | `/supi:qa` |
124
- | `fix-pr` | `/supi:fix-pr` |
125
- | `debugging` | Agent sessions |
126
- | `tdd` | Agent sessions |
127
- | `verification` | Agent sessions |
128
- | `receiving-code-review` | Agent sessions |
129
- | `context-mode` | Context window guidance |
188
+ | Skill | Used by |
189
+ | ----------------------- | ----------------------- |
190
+ | `planning` | `/supi:plan` |
191
+ | `code-review` | Manual prompting / reusable review guidance |
192
+ | `qa-strategy` | `/supi:qa` |
193
+ | `fix-pr` | `/supi:fix-pr` |
194
+ | `debugging` | Agent sessions |
195
+ | `tdd` | Agent sessions |
196
+ | `verification` | Agent sessions |
197
+ | `receiving-code-review` | Agent sessions |
198
+ | `release` | `/supi:release` |
199
+ | `context-mode` | Context window guidance |
200
+ | `creating-supi-agents` | Agent creation guidance |
130
201
 
131
202
  ## Development
132
203
 
@@ -138,3 +209,5 @@ bun run build # emit to dist/
138
209
  ```
139
210
 
140
211
  Tests live in `tests/`, mirroring `src/` one-to-one. The test runner is Bun's built-in `bun:test`.
212
+
213
+ Peer dependencies (`@oh-my-pi/pi-coding-agent`, `@oh-my-pi/pi-ai`, `@oh-my-pi/pi-tui`, `@sinclair/typebox`) are provided by the OMP host; they are devDependencies only for type-checking during development.
package/bin/install.ts CHANGED
@@ -315,139 +315,52 @@ function installToPlatform(platformDir: string, packageRoot: string): string {
315
315
  }
316
316
 
317
317
  /**
318
- * Install context-mode as a platform extension and register MCP server.
319
- *
320
- * Per upstream docs (Pi Coding Agent):
321
- * 1. git clone → ~/<platformDir>/extensions/context-mode
322
- * 2. npm install && npm run build
323
- * 3. Register MCP in ~/<platformDir>/settings/mcp.json
324
- *
325
- * Build requires Node.js 18+ (tsc, esbuild, node -e in build script).
326
- * Runtime uses bun to leverage bun:sqlite — context-mode auto-detects
327
- * Bun and skips better-sqlite3 entirely.
318
+ * Remove supi-context-mode / context-mode entries from the current agent/mcp.json
319
+ * and from the legacy settings/mcp.json location.
328
320
  */
329
- async function installContextMode(platformDir: string): Promise<void> {
330
- const extDir = join(homedir(), platformDir, "extensions", "context-mode");
331
- const startMjs = join(extDir, "start.mjs");
332
-
333
- // Check if already installed and built
334
- if (existsSync(startMjs)) {
335
- // Already installed — just ensure MCP registration is up to date
336
- registerContextModeMcp(platformDir, startMjs);
337
- return;
338
- }
339
-
340
- const shouldInstall = await confirm({
341
- message: `Install context-mode extension for context window protection? (${platformDir})`,
342
- });
343
- if (isCancel(shouldInstall) || !shouldInstall) {
344
- note(
345
- `Skipped. You can install later:\n` +
346
- ` git clone https://github.com/mksglu/context-mode.git ~/${platformDir}/extensions/context-mode\n` +
347
- ` cd ~/${platformDir}/extensions/context-mode && npm install && npm run build`,
348
- `context-mode (${platformDir})`,
349
- );
350
- return;
351
- }
352
-
353
- // Check Node.js 18+ (required for build: tsc, esbuild, node -e in build script)
354
- const nodeCheck = run("node", ["--version"]);
355
- if (nodeCheck.error || nodeCheck.status !== 0) {
356
- note(
357
- "Node.js 18+ is required to build context-mode.\n" +
358
- "Install from https://nodejs.org then re-run the installer.",
359
- "context-mode requires Node.js",
360
- );
361
- return;
362
- }
363
- const nodeVersion = parseInt((nodeCheck.stdout ?? "").replace(/^v/, ""), 10);
364
- if (nodeVersion < 18) {
365
- note(
366
- `Found Node.js v${nodeCheck.stdout?.trim()} but context-mode requires v18+.\n` +
367
- "Update Node.js from https://nodejs.org then re-run the installer.",
368
- "context-mode requires Node.js 18+",
369
- );
370
- return;
371
- }
372
-
373
- const s = spinner();
374
- s.start(`Cloning context-mode to ~/${platformDir}/extensions/context-mode...`);
375
-
376
- // Clone
377
- const cloneResult = run("git", [
378
- "clone",
379
- "https://github.com/mksglu/context-mode.git",
380
- extDir,
381
- ]);
382
- if (cloneResult.status !== 0) {
383
- s.stop(`Failed to clone context-mode`);
384
- note(
385
- cloneResult.stderr?.trim() || "Unknown git clone error",
386
- "context-mode install failed",
387
- );
388
- return;
389
- }
390
-
391
- // npm install (builds better-sqlite3 native bindings for Node.js fallback;
392
- // at runtime under Bun, bun:sqlite is used instead via auto-detection)
393
- s.message("Installing context-mode dependencies...");
394
- const npmInstall = run("npm", ["install"], { cwd: extDir });
395
- if (npmInstall.status !== 0) {
396
- s.stop(`Failed to install context-mode dependencies`);
397
- note(
398
- npmInstall.stderr?.trim() || "Unknown npm install error",
399
- "context-mode install failed",
400
- );
401
- return;
402
- }
403
-
404
- // npm run build (requires tsc + esbuild from devDeps, runs under Node.js)
405
- s.message("Building context-mode...");
406
- const npmBuild = run("npm", ["run", "build"], { cwd: extDir });
407
- if (npmBuild.status !== 0) {
408
- s.stop(`Failed to build context-mode`);
409
- note(
410
- npmBuild.stderr?.trim() || "Unknown build error",
411
- "context-mode install failed",
412
- );
413
- return;
414
- }
415
-
416
- s.stop(`context-mode installed to ~/${platformDir}/extensions/context-mode`);
417
-
418
- // Register MCP server
419
- registerContextModeMcp(platformDir, startMjs);
420
- }
421
-
422
- /**
423
- * Register context-mode MCP entry in the platform's settings/mcp.json.
424
- *
425
- * Uses "bun" as the command so context-mode auto-detects Bun runtime
426
- * and uses bun:sqlite — no better-sqlite3 native bindings needed at runtime.
427
- */
428
- function registerContextModeMcp(platformDir: string, startMjs: string): void {
429
- const mcpConfigPath = join(homedir(), platformDir, "settings", "mcp.json");
430
- let mcpConfig: { mcpServers: Record<string, unknown> } = { mcpServers: {} };
431
- if (existsSync(mcpConfigPath)) {
321
+ function cleanupContextModeMcp(platformDir: string): void {
322
+ // Clean supi-context-mode from the current agent/mcp.json
323
+ const agentMcpPath = join(homedir(), platformDir, "agent", "mcp.json");
324
+ if (existsSync(agentMcpPath)) {
432
325
  try {
433
- mcpConfig = JSON.parse(readFileSync(mcpConfigPath, "utf8"));
434
- if (!mcpConfig.mcpServers) mcpConfig.mcpServers = {};
326
+ const agentConfig = JSON.parse(readFileSync(agentMcpPath, "utf8"));
327
+ let changed = false;
328
+ if (agentConfig.mcpServers?.["context-mode"]) {
329
+ delete agentConfig.mcpServers["context-mode"];
330
+ changed = true;
331
+ }
332
+ if (agentConfig.mcpServers?.["supi-context-mode"]) {
333
+ delete agentConfig.mcpServers["supi-context-mode"];
334
+ changed = true;
335
+ }
336
+ if (changed) {
337
+ writeFileSync(agentMcpPath, JSON.stringify(agentConfig, null, 2));
338
+ }
435
339
  } catch {
436
- mcpConfig = { mcpServers: {} };
340
+ // Best effort do not fail install on corrupt mcp.json
437
341
  }
438
342
  }
343
+ }
439
344
 
440
- mcpConfig.mcpServers["context-mode"] = {
441
- command: "bun",
442
- args: [startMjs],
443
- };
345
+ function cleanupLegacyMcp(platformDir: string): void {
346
+ const oldMcpPath = join(homedir(), platformDir, "settings", "mcp.json");
347
+ if (!existsSync(oldMcpPath)) return;
444
348
 
445
- mkdirSync(dirname(mcpConfigPath), { recursive: true });
446
- writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
447
- note(
448
- `Registered in ~/${platformDir}/settings/mcp.json`,
449
- `context-mode (${platformDir})`,
450
- );
349
+ try {
350
+ const config = JSON.parse(readFileSync(oldMcpPath, "utf8"));
351
+ delete config.mcpServers?.["context-mode"];
352
+ delete config.mcpServers?.["supi-context-mode"];
353
+
354
+ if (!config.mcpServers || Object.keys(config.mcpServers).length === 0) {
355
+ rmSync(oldMcpPath);
356
+ } else {
357
+ // Other servers exist — keep the file, just remove our entries
358
+ writeFileSync(oldMcpPath, JSON.stringify(config, null, 2));
359
+ }
360
+ } catch {
361
+ // Corrupted — remove it
362
+ try { rmSync(oldMcpPath); } catch { /* best effort */ }
363
+ }
451
364
  }
452
365
 
453
366
  // ── Main ─────────────────────────────────────────────────────
@@ -544,10 +457,17 @@ async function main(): Promise<void> {
544
457
  for (const target of targets) {
545
458
  installToPlatform(target.dir, packageRoot);
546
459
 
547
- // ── Step 3b: Install context-mode extension + register MCP ──
548
- await installContextMode(target.dir);
460
+ // ── Step 3b: Clean up legacy context-mode MCP registrations ──
461
+ cleanupContextModeMcp(target.dir);
462
+ cleanupLegacyMcp(target.dir);
549
463
  }
550
464
 
465
+ note(
466
+ "Context-mode tools are now built into supipowers (no external MCP server needed).\n" +
467
+ "You can manually remove any legacy installation at ~/<platformDir>/extensions/context-mode/",
468
+ "Context Mode",
469
+ );
470
+
551
471
  if (DEBUG) {
552
472
  note(`Debug log written to:\n${LOG_FILE}`, "Debug");
553
473
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supipowers",
3
- "version": "1.3.0",
3
+ "version": "1.5.1",
4
4
  "description": "Workflow extension for OMP coding agents.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -10,23 +10,44 @@
10
10
  "build": "tsc -p tsconfig.build.json",
11
11
  "prepare": "git config core.hooksPath hooks || true"
12
12
  },
13
+ "engines": {
14
+ "bun": ">=1.3.10"
15
+ },
13
16
  "keywords": [
17
+ "omp",
14
18
  "omp-extension",
19
+ "oh-my-pi",
20
+ "ai-agent",
21
+ "coding-agent",
15
22
  "workflow",
23
+ "code-review",
24
+ "planning",
16
25
  "agent",
17
26
  "supipowers"
18
27
  ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/ogrodev/supipowers.git"
31
+ },
32
+ "homepage": "https://supipowers.com",
33
+ "bugs": {
34
+ "url": "https://github.com/ogrodev/supipowers/issues"
35
+ },
36
+ "author": "ogrodev",
19
37
  "license": "MIT",
20
38
  "bin": {
21
39
  "supipowers": "bin/install.mjs"
22
40
  },
41
+ "publishConfig": {
42
+ "access": "public",
43
+ "registry": "https://registry.npmjs.org"
44
+ },
23
45
  "files": [
24
46
  "src",
25
47
  "skills",
26
48
  "bin/install.mjs",
27
49
  "bin/install.ts",
28
50
  "bin/local-install.sh",
29
- "bin/ctx-mode-wrapper.mjs",
30
51
  "README.md",
31
52
  "LICENSE"
32
53
  ],
@@ -39,7 +60,8 @@
39
60
  ]
40
61
  },
41
62
  "dependencies": {
42
- "@clack/prompts": "^0.10.0"
63
+ "@clack/prompts": "^0.10.0",
64
+ "handlebars": "^4.7.8"
43
65
  },
44
66
  "peerDependencies": {
45
67
  "@oh-my-pi/pi-coding-agent": "*",