forge-workflow 0.0.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 (105) hide show
  1. package/.claude/commands/dev.md +314 -0
  2. package/.claude/commands/plan.md +389 -0
  3. package/.claude/commands/premerge.md +179 -0
  4. package/.claude/commands/research.md +42 -0
  5. package/.claude/commands/review.md +442 -0
  6. package/.claude/commands/rollback.md +721 -0
  7. package/.claude/commands/ship.md +134 -0
  8. package/.claude/commands/sonarcloud.md +152 -0
  9. package/.claude/commands/status.md +77 -0
  10. package/.claude/commands/validate.md +237 -0
  11. package/.claude/commands/verify.md +221 -0
  12. package/.claude/rules/greptile-review-process.md +285 -0
  13. package/.claude/rules/workflow.md +105 -0
  14. package/.claude/scripts/greptile-resolve.sh +526 -0
  15. package/.claude/scripts/load-env.sh +32 -0
  16. package/.forge/hooks/check-tdd.js +240 -0
  17. package/.github/PLUGIN_TEMPLATE.json +32 -0
  18. package/.mcp.json.example +12 -0
  19. package/AGENTS.md +169 -0
  20. package/CLAUDE.md +99 -0
  21. package/LICENSE +21 -0
  22. package/README.md +414 -0
  23. package/bin/forge-cmd.js +313 -0
  24. package/bin/forge-validate.js +303 -0
  25. package/bin/forge.js +4228 -0
  26. package/docs/AGENT_INSTALL_PROMPT.md +342 -0
  27. package/docs/ENHANCED_ONBOARDING.md +602 -0
  28. package/docs/EXAMPLES.md +482 -0
  29. package/docs/GREPTILE_SETUP.md +400 -0
  30. package/docs/MANUAL_REVIEW_GUIDE.md +106 -0
  31. package/docs/ROADMAP.md +359 -0
  32. package/docs/SETUP.md +632 -0
  33. package/docs/TOOLCHAIN.md +849 -0
  34. package/docs/VALIDATION.md +363 -0
  35. package/docs/WORKFLOW.md +400 -0
  36. package/docs/planning/PROGRESS.md +396 -0
  37. package/docs/plans/.gitkeep +0 -0
  38. package/docs/plans/2026-02-27-forge-test-suite-v2-decisions.md +21 -0
  39. package/docs/plans/2026-02-27-forge-test-suite-v2-design.md +362 -0
  40. package/docs/plans/2026-02-27-forge-test-suite-v2-tasks.md +343 -0
  41. package/docs/plans/2026-03-02-superpowers-gaps-decisions.md +26 -0
  42. package/docs/plans/2026-03-02-superpowers-gaps-design.md +239 -0
  43. package/docs/plans/2026-03-02-superpowers-gaps-tasks.md +260 -0
  44. package/docs/plans/2026-03-04-agent-command-parity-design.md +163 -0
  45. package/docs/plans/2026-03-04-verify-worktree-cleanup-decisions.md +7 -0
  46. package/docs/plans/2026-03-04-verify-worktree-cleanup-design.md +165 -0
  47. package/docs/plans/2026-03-05-forge-uto-decisions.md +6 -0
  48. package/docs/plans/2026-03-05-forge-uto-design.md +116 -0
  49. package/docs/plans/2026-03-05-forge-uto-tasks.md +244 -0
  50. package/docs/plans/2026-03-10-command-creator-and-eval-decisions.md +52 -0
  51. package/docs/plans/2026-03-10-command-creator-and-eval-design.md +350 -0
  52. package/docs/plans/2026-03-10-command-creator-and-eval-tasks.md +426 -0
  53. package/docs/plans/2026-03-10-stale-workflow-refs-decisions.md +8 -0
  54. package/docs/plans/2026-03-10-stale-workflow-refs-design.md +80 -0
  55. package/docs/plans/2026-03-10-stale-workflow-refs-tasks.md +90 -0
  56. package/docs/plans/2026-03-14-beads-plan-context-decisions.md +9 -0
  57. package/docs/plans/2026-03-14-beads-plan-context-design.md +171 -0
  58. package/docs/plans/2026-03-14-beads-plan-context-tasks.md +160 -0
  59. package/docs/plans/2026-03-14-skill-eval-loop-decisions.md +33 -0
  60. package/docs/plans/2026-03-14-skill-eval-loop-design.md +118 -0
  61. package/docs/plans/2026-03-14-skill-eval-loop-results.md +78 -0
  62. package/docs/plans/2026-03-14-skill-eval-loop-tasks.md +160 -0
  63. package/docs/plans/2026-03-15-agent-command-parity-v2-decisions.md +11 -0
  64. package/docs/plans/2026-03-15-agent-command-parity-v2-design.md +145 -0
  65. package/docs/plans/2026-03-15-agent-command-parity-v2-tasks.md +211 -0
  66. package/docs/research/TEMPLATE.md +292 -0
  67. package/docs/research/advanced-testing.md +297 -0
  68. package/docs/research/agent-permissions.md +167 -0
  69. package/docs/research/dependency-chain.md +328 -0
  70. package/docs/research/forge-workflow-v2.md +550 -0
  71. package/docs/research/plugin-architecture.md +772 -0
  72. package/docs/research/pr4-cli-automation.md +326 -0
  73. package/docs/research/premerge-verify-restructure.md +205 -0
  74. package/docs/research/skills-restructure.md +508 -0
  75. package/docs/research/sonarcloud-perfection-plan.md +166 -0
  76. package/docs/research/sonarcloud-quality-gate.md +184 -0
  77. package/docs/research/superpowers-integration.md +403 -0
  78. package/docs/research/superpowers.md +319 -0
  79. package/docs/research/test-environment.md +519 -0
  80. package/install.sh +1062 -0
  81. package/lefthook.yml +39 -0
  82. package/lib/agents/README.md +198 -0
  83. package/lib/agents/claude.plugin.json +28 -0
  84. package/lib/agents/cline.plugin.json +22 -0
  85. package/lib/agents/codex.plugin.json +19 -0
  86. package/lib/agents/copilot.plugin.json +24 -0
  87. package/lib/agents/cursor.plugin.json +25 -0
  88. package/lib/agents/kilocode.plugin.json +22 -0
  89. package/lib/agents/opencode.plugin.json +20 -0
  90. package/lib/agents/roo.plugin.json +23 -0
  91. package/lib/agents-config.js +2112 -0
  92. package/lib/commands/dev.js +513 -0
  93. package/lib/commands/plan.js +696 -0
  94. package/lib/commands/recommend.js +119 -0
  95. package/lib/commands/ship.js +377 -0
  96. package/lib/commands/status.js +378 -0
  97. package/lib/commands/validate.js +602 -0
  98. package/lib/context-merge.js +359 -0
  99. package/lib/plugin-catalog.js +360 -0
  100. package/lib/plugin-manager.js +166 -0
  101. package/lib/plugin-recommender.js +141 -0
  102. package/lib/project-discovery.js +491 -0
  103. package/lib/setup.js +118 -0
  104. package/lib/workflow-profiles.js +203 -0
  105. package/package.json +115 -0
@@ -0,0 +1,772 @@
1
+ # Research: PR6 — Plugin Architecture & Smart Recommendations
2
+
3
+ **Date**: 2026-02-20
4
+ **Beads Issue**: forge-a7n
5
+ **Status**: Research complete, ready for `/plan`
6
+
7
+ ---
8
+
9
+ ## Objective
10
+
11
+ Transform Forge into a **universal developer toolchain recommender** that detects a project's tech stack and recommends the right combination of CLI tools, skills, MCPs, LSPs, configs, and plugins — with pricing transparency and free alternatives for every paid tool.
12
+
13
+ ---
14
+
15
+ ## Ecosystem Analysis
16
+
17
+ ### The 2026 Plugin Ecosystem
18
+
19
+ Three universal installation tools now exist:
20
+
21
+ | Tool | Installs | Command | Agents |
22
+ |------|----------|---------|--------|
23
+ | [npx skills add](https://skills.sh/) | Skills (SKILL.md) | `npx skills add owner/repo` | 18+ |
24
+ | [add-mcp](https://neon.com/blog/add-mcp) | MCP servers | `npx add-mcp owner/repo` | 9+ |
25
+ | [Claude Plugins](https://code.claude.com/docs/en/plugins) | Full bundles | `/plugin install` | Claude Code |
26
+
27
+ Two agent-specific marketplaces:
28
+
29
+ | Marketplace | Format | Launched |
30
+ |-------------|--------|----------|
31
+ | [Cursor Marketplace](https://cursor.com/marketplace) | `.cursor-plugin/plugin.json` | Feb 17, 2026 |
32
+ | Claude Plugin Marketplace | `.claude-plugin/plugin.json` | 2026 |
33
+
34
+ ### skills.sh Format
35
+
36
+ Skills use SKILL.md with YAML frontmatter. No publish command — push to GitHub, auto-listed via install telemetry.
37
+
38
+ ```yaml
39
+ ---
40
+ name: my-skill
41
+ description: When and why to use this skill.
42
+ license: MIT
43
+ metadata:
44
+ version: 1.0.0
45
+ allowed-tools:
46
+ - bash
47
+ ---
48
+ # Instructions...
49
+ ```
50
+
51
+ Directory structure:
52
+ ```
53
+ my-skill/
54
+ SKILL.md # Required
55
+ scripts/ # Optional
56
+ references/ # Optional
57
+ assets/ # Optional
58
+ ```
59
+
60
+ ### Claude Code Plugin Format
61
+
62
+ ```
63
+ my-plugin/
64
+ .claude-plugin/plugin.json # Manifest
65
+ skills/ # Agent skills (SKILL.md)
66
+ commands/ # Slash commands (.md)
67
+ agents/ # Custom agents
68
+ hooks/hooks.json # Event handlers
69
+ .mcp.json # MCP configs
70
+ .lsp.json # LSP configs
71
+ settings.json # Default settings
72
+ ```
73
+
74
+ ### Cursor Plugin Format
75
+
76
+ ```
77
+ my-plugin/
78
+ .cursor-plugin/plugin.json # Manifest
79
+ skills/ # Agent skills
80
+ rules/ # Cursor rules (.mdc)
81
+ mcp.json # MCP configs
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Design Principles
87
+
88
+ ### P1: CLI-First, MCP-Fallback
89
+
90
+ Always prefer CLI tools over MCPs. CLIs work everywhere (all agents, CI/CD, scripts, terminals). MCPs require agent support and protocol overhead.
91
+
92
+ **Preference order:**
93
+ 1. CLI tool (universal, scriptable)
94
+ 2. Skill (portable knowledge, works across agents)
95
+ 3. Config file (zero runtime, declarative)
96
+ 4. MCP server (only for live bidirectional agent interaction)
97
+
98
+ **MCP is justified only when:**
99
+ - No CLI equivalent exists (Figma, Context7)
100
+ - Live agent interaction genuinely adds value (database exploration mid-chat)
101
+ - The tool is inherently interactive (design files, live debugging)
102
+
103
+ | Service | CLI (Prefer) | MCP (Fallback) | MCP Justified? |
104
+ |---------|-------------|----------------|----------------|
105
+ | GitHub | `gh` | github-mcp-server | No |
106
+ | SonarQube | `sonar-scanner` | sonarqube-mcp-server | Yes (query mid-chat) |
107
+ | CodeQL | `codeql` | codeql-mcp | No |
108
+ | Snyk | `snyk` | N/A | N/A |
109
+ | Stripe | `stripe` | stripe-mcp | Partial (API exploration) |
110
+ | Parallel AI | `parallel-cli` | N/A | N/A |
111
+ | Vercel | `vercel` | vercel-mcp | No |
112
+ | Supabase | `supabase` | supabase-mcp | Yes (live DB queries) |
113
+ | Neon | `neonctl` | neon-mcp | Yes (live DB queries) |
114
+ | ESLint | `eslint` | N/A | N/A |
115
+ | Biome | `biome` | N/A | N/A |
116
+ | Playwright | `playwright` | N/A | N/A |
117
+ | Context7 | N/A | context7-mcp | Yes (no CLI) |
118
+ | Figma | N/A | figma-mcp | Yes (no CLI) |
119
+
120
+ ### P2: Pricing Transparency
121
+
122
+ Every recommended tool gets a tier classification:
123
+
124
+ | Tier | Icon | Meaning |
125
+ |------|------|---------|
126
+ | F | Free | Fully free, open source, no limits |
127
+ | FP | Free-Public | Free for open-source repos, paid for private |
128
+ | FL | Free-Limited | Free tier with usage caps |
129
+ | P | Paid | Requires subscription |
130
+
131
+ For every paid tool, Forge shows:
132
+ - What it costs
133
+ - The free alternative
134
+ - What you lose with the free version
135
+
136
+ ### P3: Budget Modes
137
+
138
+ | Mode | Installs | Best For |
139
+ |------|----------|----------|
140
+ | **Free only** | Only F-tier tools | Solo devs, hobby projects |
141
+ | **Open source** | F + FP (free for public) | Open-source projects |
142
+ | **Startup** | F + FP + FL (free tiers) | Small teams on free plans |
143
+ | **Professional** | All recommended | Teams with budget |
144
+ | **Custom** | User picks individually | Full control |
145
+
146
+ ### P4: Tech Stack Detection First
147
+
148
+ Detect before recommending. Expand `lib/project-discovery.js` to detect:
149
+
150
+ | Category | Current | Expanded |
151
+ |----------|---------|----------|
152
+ | Frameworks | React, Next.js, Vue, Express | + Angular, Svelte, Astro, Remix, Nuxt, Fastify, NestJS |
153
+ | Languages | TypeScript, JavaScript | + Python, Go, Rust, Java, Ruby |
154
+ | Databases | None | Convex, Supabase, Neon, Prisma, Drizzle, MongoDB, PostgreSQL |
155
+ | Auth | None | Clerk, Auth.js, Supabase Auth, Firebase Auth |
156
+ | Payments | None | Stripe, Paddle, LemonSqueezy |
157
+ | CI/CD | GitHub Actions, GitLab | + CircleCI, Vercel |
158
+ | Code Quality | ESLint | + Biome, Oxlint, SonarCloud, CodeQL |
159
+ | LSPs | None | TypeScript, Python, Rust, Go, Java |
160
+ | Testing | node:test | + Vitest, Jest, Playwright, Cypress |
161
+
162
+ ---
163
+
164
+ ## Complete Tool Catalog
165
+
166
+ ### By Workflow Stage
167
+
168
+ #### Stages 1-2: `/status` + `/research`
169
+
170
+ | Tool | Type | Tier | Free Alternative |
171
+ |------|------|------|-----------------|
172
+ | `parallel-cli` | CLI | P | Built-in WebSearch |
173
+ | Context7 | MCP | F | — |
174
+ | grep.app | MCP | F | — |
175
+ | Perplexity | MCP | FL ($20/mo) | WebSearch + Context7 |
176
+ | Firecrawl | MCP | FL ($19/mo) | Built-in WebFetch |
177
+
178
+ #### Stage 3: `/plan`
179
+
180
+ | Tool | Type | Tier | Free Alternative |
181
+ |------|------|------|-----------------|
182
+ | Beads | CLI | F | — |
183
+ | OpenSpec | CLI | F | — |
184
+ | Linear | CLI (`linear`) | FL | Beads (free) |
185
+ | Jira | CLI (`jira`) | P | Beads (free) |
186
+
187
+ #### Stage 4: `/dev`
188
+
189
+ **LSP Servers (all free):**
190
+
191
+ | LSP | Detect When | Install |
192
+ |-----|------------|---------|
193
+ | TypeScript LS | `typescript` in deps | `.lsp.json` |
194
+ | Pyright | `*.py` files | `.lsp.json` |
195
+ | rust-analyzer | `Cargo.toml` | `.lsp.json` |
196
+ | gopls | `go.mod` | `.lsp.json` |
197
+
198
+ **Framework Skills:**
199
+
200
+ | Skill | Tier | Detect When |
201
+ |-------|------|------------|
202
+ | [vercel-labs/agent-skills](https://github.com/vercel-labs/agent-skills) (React) | F | `react` in deps |
203
+ | [remotion-dev/skills](https://github.com/remotion-dev/skills) | F | `remotion` in deps |
204
+ | Convex best practices | F | `convex` in deps |
205
+ | Rails conventions | F | `Gemfile` |
206
+
207
+ **Service CLIs:**
208
+
209
+ | CLI | Tier | Detect When | MCP Fallback |
210
+ |-----|------|------------|-------------|
211
+ | `supabase` | FL | `@supabase/supabase-js` | supabase-mcp (live queries) |
212
+ | `neonctl` | FL | `@neondatabase/serverless` | neon-mcp (live queries) |
213
+ | `stripe` | F (CLI free) | `stripe` in deps | stripe-mcp (API explore) |
214
+ | `vercel` | FL | `vercel.json` or Next.js | No |
215
+ | `clerk` | FL | `@clerk/nextjs` | clerk-mcp |
216
+ | `convex` | FL | `convex` in deps | No |
217
+
218
+ #### Stage 5: `/validate`
219
+
220
+ **Linting & Formatting (all free):**
221
+
222
+ | Tool | Detect When | Notes |
223
+ |------|------------|-------|
224
+ | `eslint` | `eslint.config.js` | Standard, huge plugin ecosystem |
225
+ | `biome` | `biome.json` | 10-25x faster, lint+format in one |
226
+ | `oxlint` + `oxfmt` | User preference | 50x faster, Rust-based |
227
+ | `prettier` | `.prettierrc` | Formatting only |
228
+
229
+ **Security Scanning:**
230
+
231
+ | Tool | Type | Tier | Detect When | Free Alternative |
232
+ |------|------|------|------------|-----------------|
233
+ | `eslint` + eslint-plugin-security | CLI+Config | F | Node.js project | — |
234
+ | eslint-plugin-sdl | Config | F | Enterprise | — |
235
+ | `npm audit` | CLI | F | Any npm project | — |
236
+ | `codeql` | CLI | FP | GitHub repo | eslint-plugin-security |
237
+ | `sonar-scanner` | CLI | FP | SonarCloud config | SonarQube Community (free, self-host) |
238
+ | `snyk` | CLI | FL (200/mo) | Snyk config | npm audit + CodeQL |
239
+ | `semgrep` | CLI | F (OSS rules) | Any project | — |
240
+
241
+ **Type Checking (all free):**
242
+
243
+ | Tool | Detect When |
244
+ |------|------------|
245
+ | `tsc` | `tsconfig.json` |
246
+ | `pyright` | Python project |
247
+ | `mypy` | `mypy.ini` |
248
+
249
+ **Testing & Coverage (all free):**
250
+
251
+ | Tool | Detect When |
252
+ |------|------------|
253
+ | `node:test` | Node.js project (built-in) |
254
+ | `vitest` | `vite.config.*` |
255
+ | `jest` | `jest.config.*` |
256
+ | `playwright` | Web app project |
257
+ | `c8` | Node.js + coverage needed |
258
+ | `stryker` | Advanced testing setup |
259
+
260
+ #### Stages 6-7: `/ship` + `/review`
261
+
262
+ | Tool | Type | Tier | Detect When | Free Alternative |
263
+ |------|------|------|------------|-----------------|
264
+ | `gh` | CLI | F | GitHub repo | — |
265
+ | `sonar-scanner` (PR analysis) | CLI | FP | SonarCloud config | SonarQube Community |
266
+ | CodeRabbit | Config | FP | GitHub integration | Qodo Merge (free, self-host) |
267
+ | Greptile | Config | P ($30/mo) | GitHub integration | CodeRabbit (free for public) |
268
+ | [Qodo Merge](https://github.com/Codium-ai/pr-agent) | CLI | F | Self-hosted | — |
269
+ | Vercel Deploy skill | Skill | FL | Vercel project | `vercel` CLI |
270
+
271
+ #### Stages 8-9: `/merge` + `/verify`
272
+
273
+ | Tool | Type | Tier | Detect When |
274
+ |------|------|------|------------|
275
+ | `gh pr merge` | CLI | F | GitHub repo |
276
+ | Changesets | CLI | F | npm package / monorepo |
277
+ | release-please | Config | F | GitHub repo |
278
+ | Lefthook | CLI | F | Git hooks needed |
279
+
280
+ ---
281
+
282
+ ## Key Decisions & Reasoning
283
+
284
+ ### D1: CLI-first, MCP as enhancement only
285
+
286
+ **Decision**: Prefer CLI tools over MCPs in all recommendations
287
+ **Reasoning**: CLIs work in every agent (18+), every CI/CD pipeline, and every terminal. MCPs require agent-specific support and add protocol overhead. CLIs are also easier to debug and script.
288
+ **Evidence**: `gh` CLI covers 100% of GitHub MCP functionality. `sonar-scanner` CLI covers 90% of SonarQube MCP. Most MCPs are thin wrappers around CLIs anyway.
289
+
290
+ ### D2: Pricing tiers with mandatory free alternatives
291
+
292
+ **Decision**: Every paid tool recommendation must show a free alternative
293
+ **Reasoning**: Forge targets individual devs through enterprise teams. Cost should never block adoption. Users should make informed choices, not discover surprise bills.
294
+ **Trade-off**: More complex recommendation UI, but dramatically better user trust.
295
+
296
+ ### D3: Budget modes for quick setup
297
+
298
+ **Decision**: Offer 5 preset budget modes (Free/OpenSource/Startup/Professional/Custom)
299
+ **Reasoning**: Most users know their budget constraint upfront. Presets avoid 20+ individual toggle decisions during setup.
300
+
301
+ ### D4: Expand project-discovery.js detection
302
+
303
+ **Decision**: Detect 20+ frameworks, databases, auth, payments, CI/CD, LSPs
304
+ **Reasoning**: The recommendation engine is only as good as its detection. Current detection (4 frameworks, 2 languages) is too narrow for a universal recommender.
305
+ **Implementation**: File-presence and dependency-based detection (same pattern as current `detectFramework()`).
306
+
307
+ ### D5: Absorb forge-mlm into PR6
308
+
309
+ **Decision**: Close forge-mlm beads issue, fold unique features into PR6
310
+ **Reasoning**: skills.sh (`npx skills add`) and add-mcp (`npx add-mcp`) already handle installation. forge-mlm's custom registry client, publish, and search commands are redundant. Only unique features (sync, validate, AI creation) survive — sync and validate go to PR6, AI creation to PR8.
311
+
312
+ ### D6: Publish our skills to skills.sh in PR5.5
313
+
314
+ **Decision**: Restructure parallel-ai (split into 4) and sonarcloud skills for skills.sh before PR6
315
+ **Reasoning**: PR6 will recommend third-party skills for installation. Our own skills should be in the same format and installable the same way. PR5.5 is a lightweight prerequisite.
316
+
317
+ ### D7: Plugin catalog as data, not code
318
+
319
+ **Decision**: Store the tech-stack-to-tool mapping as a JSON/JS data structure, not hardcoded logic
320
+ **Reasoning**: Makes it easy to add new tools, update pricing, and community-contribute mappings without touching recommendation logic.
321
+
322
+ ---
323
+
324
+ ## Architecture
325
+
326
+ ### PR5.5: Skills Restructure (1-2 days)
327
+
328
+ Restructure existing `.claude/skills/` for skills.sh compatibility:
329
+
330
+ ```
331
+ Before: After:
332
+ .claude/skills/ skills/ (repo root, skills.sh format)
333
+ parallel-ai/ parallel-web-search/
334
+ SKILL.md (monolithic) SKILL.md
335
+ api-reference.md references/api-reference.md
336
+ quick-reference.md parallel-web-extract/
337
+ research-workflows.md SKILL.md
338
+ sonarcloud/ parallel-deep-research/
339
+ SKILL.md SKILL.md
340
+ reference.md references/research-workflows.md
341
+ parallel-data-enrichment/
342
+ SKILL.md
343
+ sonarcloud-analysis/
344
+ SKILL.md
345
+ references/reference.md
346
+ citation-standards/ (rule)
347
+ SKILL.md
348
+ ```
349
+
350
+ All skills use `parallel-cli` as primary method (fallback to curl).
351
+
352
+ ### PR6: Plugin Architecture (4-5 days)
353
+
354
+ ```
355
+ lib/
356
+ plugin-catalog.js # Tool database (JSON mapping)
357
+ plugin-recommender.js # Detection → recommendation logic
358
+ plugin-installer.js # Orchestrate installs
359
+ project-discovery.js # EXPANDED: 20+ detections
360
+
361
+ bin/forge.js
362
+ forge setup # ENHANCED: recommendation UI
363
+ forge recommend # NEW: standalone recommendation
364
+ forge install <tool> # NEW: install specific tool
365
+ ```
366
+
367
+ **Catalog structure:**
368
+ ```javascript
369
+ {
370
+ tools: {
371
+ "eslint-plugin-security": {
372
+ type: "config",
373
+ tier: "free",
374
+ detectWhen: [{ dep: "express" }, { dep: "fastify" }, { file: "package.json" }],
375
+ install: "npm install -D eslint-plugin-security",
376
+ stage: "check",
377
+ category: "security",
378
+ alternatives: []
379
+ },
380
+ "sonar-scanner": {
381
+ type: "cli",
382
+ tier: "free-public",
383
+ detectWhen: [{ file: "sonar-project.properties" }],
384
+ install: "npm install -D sonarqube-scanner",
385
+ stage: "check",
386
+ category: "security",
387
+ paidDetails: { price: "EUR 30/mo", threshold: "100K LoC private" },
388
+ alternatives: [
389
+ { tool: "sonarqube-community", tier: "free", tradeoff: "Self-hosted, 19 languages" },
390
+ { tool: "eslint-plugin-security", tier: "free", tradeoff: "Catches ~60% of issues" }
391
+ ]
392
+ }
393
+ }
394
+ }
395
+ ```
396
+
397
+ ---
398
+
399
+ ## TDD Test Scenarios
400
+
401
+ ### Plugin Catalog Tests (`test/plugin-catalog.test.js`)
402
+
403
+ 1. Every tool has required fields (type, tier, detectWhen, install, stage)
404
+ 2. Every paid tool has at least one free alternative
405
+ 3. Every MCP-type tool has CLI preference documented
406
+ 4. Tier values are valid (free, free-public, free-limited, paid)
407
+ 5. No duplicate tool entries
408
+ 6. Categories cover all 9 workflow stages
409
+
410
+ ### Detection Tests (`test/plugin-detection.test.js`)
411
+
412
+ 1. Detects React from `react` in dependencies
413
+ 2. Detects Supabase from `@supabase/supabase-js` in dependencies
414
+ 3. Detects Stripe from `stripe` in dependencies
415
+ 4. Detects TypeScript LSP need from `tsconfig.json`
416
+ 5. Detects Biome from `biome.json` presence
417
+ 6. Returns empty for unrecognized stack
418
+ 7. Priority: CLI detection over MCP for same service
419
+
420
+ ### Recommendation Tests (`test/plugin-recommender.test.js`)
421
+
422
+ 1. Free-only mode excludes all paid and freemium tools
423
+ 2. Open-source mode includes free-public but not free-limited
424
+ 3. Professional mode includes everything
425
+ 4. Custom mode respects individual toggles
426
+ 5. Recommendations include alternatives for every paid tool
427
+ 6. CLI tools are recommended before MCPs for same service
428
+ 7. Detected LSPs appear in recommendations
429
+
430
+ ### Installation Tests (`test/plugin-installer.test.js`)
431
+
432
+ 1. `npx skills add` called for skill-type tools
433
+ 2. `npx add-mcp` called for MCP-type tools (when justified)
434
+ 3. npm install called for config-type tools
435
+ 4. `.lsp.json` updated for LSP-type tools
436
+ 5. Installation respects budget mode filter
437
+ 6. Failed installations don't block other installs
438
+
439
+ ---
440
+
441
+ ## Implementation Risk Analysis
442
+
443
+ ### R1: npm Package Extraction — Breaking Existing Users
444
+
445
+ **Risk**: Removing `.claude/skills/` from the `files` array means users who `npm update` will lose bundled skills.
446
+
447
+ **Severity**: MEDIUM
448
+
449
+ **Analysis**:
450
+ - npm replaces the entire package on update — skills files vanish from `node_modules/`
451
+ - The `setupClaudeAgent()` function (bin/forge.js:1916) copies from `packageDir` paths — if skills aren't there, copy silently fails
452
+ - The `postinstall` script (`node ./bin/forge.js`) runs `minimalInstall()` which doesn't reference skills
453
+ - Skills are referenced in `.claude/commands/research.md` as recommended tools (soft reference, not hard dependency)
454
+
455
+ **Mitigation**:
456
+ 1. Add `fs.existsSync()` guards before copying skills from packageDir
457
+ 2. Show migration notice during setup: "Skills are now installed separately via `npx skills add`"
458
+ 3. Don't remove skills from `files` in PR6 — **defer to PR7** after skills.sh publishing is validated
459
+
460
+ **Decision**: **Defer skill extraction to PR7.** PR6 adds the catalog + recommendation engine. PR7 publishes skills to skills.sh and removes them from the npm package. This avoids a breaking change before the alternative install path is proven.
461
+
462
+ ### R2: Cross-Platform Prerequisite Checking
463
+
464
+ **Risk**: `execFileSync` with `go version`, `gh --version`, `jq --version` behaves differently across platforms.
465
+
466
+ **Severity**: MEDIUM
467
+
468
+ **Analysis**:
469
+ - Windows: `execFileSync('go', ['version'])` works for `.exe` but NOT for `.cmd`/`.bat` wrappers (some npm-installed CLIs use these)
470
+ - Windows: `where.exe` returns multiple lines; must take first line only
471
+ - macOS (Apple Silicon): Homebrew at `/opt/homebrew/bin/` may not be in non-interactive shell PATH
472
+ - `jq --version` outputs `jq-1.7.1` (non-standard format with prefix)
473
+ - `go version` output includes platform info: `go version go1.22.0 windows/amd64`
474
+
475
+ **Mitigation**:
476
+ 1. Use the existing `secureExecFileSync()` pattern (bin/forge.js:71-94) which already resolves via `where.exe`/`which`
477
+ 2. For version checks, only check command exists (exit code 0), don't parse version strings
478
+ 3. Wrap all checks in try/catch, return structured `{ met: [], missing: [] }`
479
+ 4. Add platform-conditional tests with `test.skip` for Windows-specific behavior
480
+
481
+ ### R3: Installation Orchestration Pitfalls
482
+
483
+ **Risk**: Real-world installs can fail in many ways — timeouts, prompts, permissions, partial state.
484
+
485
+ **Severity**: HIGH
486
+
487
+ **Analysis**:
488
+ - `npx` may prompt "Need to install the following packages... Ok to proceed?" — blocks in non-interactive mode
489
+ - `go install` requires GOPATH/GOBIN on PATH — installed binary may not be found after install
490
+ - Global npm installs (`npm install -g`) need root/admin on some systems
491
+ - Network failures leave partial installation state with no rollback
492
+ - `PKG_MANAGER` global (bin/forge.js:62) defaults to `'npm'` if `checkPrerequisites()` hasn't run
493
+
494
+ **Mitigation**:
495
+ 1. Always use `--yes` flag with npx: `npx --yes skills add owner/repo`
496
+ 2. Add 60s timeout for npm installs, 120s for `go install`, 30s for version checks
497
+ 3. Track per-tool results: `{ installed: [], failed: [], skipped: [], prerequisitesMissing: [] }`
498
+ 4. Never abort batch on single failure — continue installing remaining tools
499
+ 5. Detect package manager before any install (don't rely on global state)
500
+
501
+ **Decision**: **Defer actual installation orchestration to PR6.5 or PR7.** PR6 focuses on `forge recommend` (read-only, zero side effects). Installation via `forge install` comes later after recommendation output is validated with real projects.
502
+
503
+ ### R4: Catalog Scope — 90+ Tools Is Too Ambitious
504
+
505
+ **Risk**: 90+ tool entries means 90+ data assertions, 90+ detection rules, massive maintenance burden.
506
+
507
+ **Severity**: HIGH
508
+
509
+ **Analysis**:
510
+ - Tool versions, pricing, URLs, and free alternatives change frequently
511
+ - Each tool's `detectWhen` rules need testing — combinatorial explosion of project types
512
+ - Review burden: a 500+ line data file is hard to review in one PR
513
+ - Many tools will never be detected because they serve niche stacks
514
+
515
+ **Decision**: **Start with 30-35 core tools in PR6.** Expand to 90+ in PR8. Core tools cover:
516
+ - The most common JS/TS stacks (React, Next.js, Vue, Angular, Express, NestJS)
517
+ - Essential code quality (ESLint, Biome, Prettier)
518
+ - Security scanning (npm audit, eslint-plugin-security, SonarCloud)
519
+ - Testing (node:test, Vitest, Jest, Playwright)
520
+ - Forge workflow tools (Beads, OpenSpec, Skills CLI, gh, lefthook)
521
+ - Skills: parallel-ai, sonarcloud, vercel-agent-skills
522
+ - MCPs: Context7 (justified — no CLI equivalent)
523
+
524
+ ### R5: Setup Flow Integration Conflicts
525
+
526
+ **Risk**: Adding `forge recommend` to the setup flow may conflict with existing tools installation.
527
+
528
+ **Severity**: MEDIUM
529
+
530
+ **Analysis**:
531
+ - Current setup flow: `checkPrerequisites()` → agent selection → `setupProjectTools()` (Beads, OpenSpec, Skills) → complete
532
+ - `checkPrerequisites()` calls `process.exit(1)` on failure — `forge recommend` must NOT depend on this
533
+ - `setupProjectTools()` at bin/forge.js:3370 already handles Skills CLI installation
534
+ - If `forge recommend` also suggests Skills CLI, user gets asked twice
535
+
536
+ **Integration approach**:
537
+ 1. `forge recommend` is a **standalone command** — works without setup, never calls `process.exit()`
538
+ 2. `forge setup` OPTIONALLY shows recommendations AFTER current tool setup completes
539
+ 3. Recommendations come after `setupProjectTools()`, framed as "Additional tools for your stack"
540
+ 4. No conflict with existing Skills CLI prompt — recommendations suggest individual skills (e.g., `npx skills add vercel-labs/agent-skills`), not the Skills CLI itself
541
+
542
+ ### R6: `bin/forge.js` Size Concerns
543
+
544
+ **Risk**: bin/forge.js is already 4,407 lines. Adding more logic makes it harder to maintain.
545
+
546
+ **Severity**: LOW
547
+
548
+ **Analysis**: New commands (`recommend`, `install`) will be thin dispatchers in `main()`, delegating to `lib/plugin-recommender.js` and `lib/plugin-installer.js`. This follows the existing pattern (commands delegate to lib/ modules).
549
+
550
+ **Mitigation**: Each new command is ~10-15 lines in `main()`. All logic lives in lib/ modules.
551
+
552
+ ---
553
+
554
+ ## Setup Flow Architecture
555
+
556
+ ### Current Flow (bin/forge.js)
557
+
558
+ ```
559
+ main() [line 3944]
560
+ ├─ parseFlags()
561
+ ├─ handlePathSetup() (if --path)
562
+ └─ if command === 'setup':
563
+ ├─ quickSetup() [if --quick]
564
+ ├─ handleSetupCommand() [if agents specified]
565
+ └─ interactiveSetupWithFlags() [interactive mode]
566
+ ├─ checkPrerequisites() [line 351] → git, gh, node, pkg manager
567
+ ├─ setupAgentsMdFile() [AGENTS.md]
568
+ ├─ setupCoreDocs() [docs/ARCHITECTURE.md, etc.]
569
+ ├─ loadAndSetupClaudeCommands() [.claude/commands/*.md]
570
+ ├─ setupSelectedAgents() [agent-specific configs]
571
+ └─ displaySetupSummary()
572
+ ```
573
+
574
+ ### Project Tools Sub-Flow
575
+
576
+ ```
577
+ setupProjectTools() [line 3370]
578
+ ├─ promptBeadsSetup() [line 3105] → check/install/init @beads/bd
579
+ ├─ promptOpenSpecSetup() [line 3199] → check/install/init openspec
580
+ └─ promptSkillsSetup() [line 3317] → check/install/init @forge/skills
581
+ ```
582
+
583
+ ### New Flow (PR6 additions)
584
+
585
+ ```
586
+ main() [line 3944]
587
+ ├─ ... existing commands ...
588
+ ├─ if command === 'recommend':
589
+ │ └─ handleRecommend(flags) [NEW — standalone, no setup required]
590
+ │ ├─ detectTechStack() [lib/project-discovery.js — expanded]
591
+ │ ├─ recommend() [lib/plugin-recommender.js]
592
+ │ └─ displayRecommendations()
593
+ └─ if command === 'setup':
594
+ └─ interactiveSetupWithFlags()
595
+ ├─ ... existing flow ...
596
+ └─ showRecommendations() [NEW — optional, after tool setup]
597
+ ├─ detectTechStack()
598
+ ├─ recommend()
599
+ └─ "Run 'forge recommend' for more details"
600
+ ```
601
+
602
+ ### Key Design Decisions
603
+
604
+ 1. **`forge recommend` is read-only** — no installations, no side effects, safe to run anytime
605
+ 2. **`forge setup` shows brief recommendations** — teaser after existing tool setup
606
+ 3. **`forge install <tool>` deferred** — comes in PR7 after recommendation output is validated
607
+ 4. **Never calls `process.exit()`** — `forge recommend` always succeeds (even with empty results)
608
+ 5. **Detects package manager independently** — doesn't rely on global `PKG_MANAGER` state
609
+
610
+ ### Example Output: `forge recommend`
611
+
612
+ ```
613
+ $ forge recommend --budget startup
614
+
615
+ Detected stack: Next.js + TypeScript + Supabase + Stripe
616
+
617
+ Recommended tools for your project:
618
+
619
+ RESEARCH
620
+ ✓ Context7 MCP [F] Live library docs npx add-mcp context7
621
+ ✓ parallel-ai skill [F] Web research npx skills add parallel-ai
622
+
623
+ DEV
624
+ ✓ TypeScript LSP [F] Type checking .lsp.json
625
+ ✓ Supabase CLI [FL] Local dev, migrations npm install -D supabase
626
+ ✓ Stripe CLI [F] Webhook testing brew install stripe/stripe-cli/stripe
627
+
628
+ CHECK
629
+ ✓ ESLint [F] Linting npm install -D eslint
630
+ ✓ eslint-plugin-security [F] Security rules npm install -D eslint-plugin-security
631
+ ✓ SonarCloud skill [FP] Quality gate npx skills add sonarcloud
632
+
633
+ SHIP
634
+ ✓ gh CLI [F] PR workflow https://cli.github.com
635
+ ✓ Lefthook [F] Git hooks npm install -D lefthook
636
+
637
+ Skipped (budget: startup):
638
+ ✗ Greptile [P] $30/mo → Free alt: CodeRabbit (free for public repos)
639
+ ✗ Snyk [P] $25/mo → Free alt: npm audit + eslint-plugin-security
640
+
641
+ [F]=Free [FP]=Free-Public [FL]=Free-Limited [P]=Paid
642
+
643
+ Run 'forge install <tool>' to install individually.
644
+ Run 'forge install --all' to install all recommended tools.
645
+ ```
646
+
647
+ ---
648
+
649
+ ## PR Deferral Strategy
650
+
651
+ ### PR6 Scope (This PR) — Catalog + Recommendations
652
+
653
+ | Component | Action | Why in PR6 |
654
+ |-----------|--------|-----------|
655
+ | `lib/plugin-catalog.js` | CREATE | Core data structure, no side effects |
656
+ | `lib/plugin-recommender.js` | CREATE | Read-only engine, no side effects |
657
+ | `lib/project-discovery.js` | EDIT (additive) | Expanded detection powers recommendations |
658
+ | `bin/forge.js` | EDIT | Add `recommend` command (thin dispatcher) |
659
+ | `test/plugin-catalog.test.js` | CREATE | Data validation tests |
660
+ | `test/plugin-detection.test.js` | CREATE | Detection accuracy tests |
661
+ | `test/plugin-recommender.test.js` | CREATE | Recommendation logic tests |
662
+ | `test/plugin-recommend.test.js` | CREATE | CLI command tests |
663
+
664
+ **Risk**: LOW — all read-only, no installations, no file mutations, no side effects
665
+
666
+ ### PR7 Scope (Deferred) — Installation + Skill Extraction
667
+
668
+ | Component | Action | Why deferred |
669
+ |-----------|--------|-------------|
670
+ | `lib/plugin-installer.js` | CREATE | Side effects (runs npm/go/npx), needs real-world validation |
671
+ | Prerequisite checking | Part of installer | Cross-platform complexity needs careful testing |
672
+ | `forge install` command | CREATE | Depends on installer being battle-tested |
673
+ | Skill extraction from npm `files` | EDIT package.json | Breaking change — needs migration path proven first |
674
+ | Skills publish to skills.sh | External | Must publish before removing from npm |
675
+ | `test/plugin-installer.test.js` | CREATE | Complex mocking for 7 install methods |
676
+ | `test/plugin-setup-integration.test.js` | CREATE | E2E integration with setup flow |
677
+
678
+ **Risk**: MEDIUM-HIGH — file mutations, subprocess execution, cross-platform issues
679
+
680
+ ### PR8 Scope (Future) — Catalog Expansion
681
+
682
+ | Component | Action | Why deferred |
683
+ |-----------|--------|-------------|
684
+ | Expand catalog to 90+ tools | EDIT catalog | Needs community feedback on core 30 |
685
+ | Language-specific LSPs | EDIT catalog | Niche, low priority |
686
+ | AI tool creation (from forge-mlm) | CREATE | Separate feature, different user flow |
687
+
688
+ ---
689
+
690
+ ## Security Analysis (OWASP Top 10)
691
+
692
+ ### A03: Injection — Command Injection via Tool Names
693
+
694
+ **Risk**: HIGH
695
+ **Applicable**: Yes — `plugin-installer.js` will pass user-influenced data to `execFileSync`
696
+ **Mitigation**:
697
+ - Use `execFileSync` with array args (never string concatenation)
698
+ - Validate tool IDs against catalog (whitelist only)
699
+ - Catalog entries are frozen objects — can't be modified at runtime
700
+ - All install commands come from catalog data, never user input
701
+ **Tests**: Verify tool IDs are validated, reject arbitrary input
702
+
703
+ ### A05: Security Misconfiguration — Installing Untrusted Packages
704
+
705
+ **Risk**: MEDIUM
706
+ **Applicable**: Yes — `npx skills add` and `npm install` fetch from registries
707
+ **Mitigation**:
708
+ - Only install packages listed in the frozen catalog
709
+ - Show exact package name and source before install
710
+ - Never auto-install without user confirmation
711
+ - `--dry-run` flag shows what would be installed
712
+ **Tests**: Verify frozen catalog can't be modified, dry-run produces no side effects
713
+
714
+ ### A06: Vulnerable Components — Recommending Outdated Tools
715
+
716
+ **Risk**: LOW
717
+ **Applicable**: Yes — catalog may recommend tools with known CVEs
718
+ **Mitigation**:
719
+ - Catalog is a static data file — easy to audit and update
720
+ - `npm audit` already runs as part of `/validate`
721
+ - SonarCloud detects vulnerable dependencies
722
+ **Tests**: Existing CI/CD checks catch vulnerable dependencies
723
+
724
+ ### A08: Software and Data Integrity — Catalog Tampering
725
+
726
+ **Risk**: LOW
727
+ **Applicable**: Yes — if catalog is modified, wrong tools could be recommended
728
+ **Mitigation**:
729
+ - `Object.freeze()` on catalog object — can't be modified at runtime
730
+ - Catalog is in lib/ (part of npm package) — protected by npm integrity checks
731
+ - Tests validate catalog structure on every CI run
732
+ **Tests**: Verify catalog is frozen, verify all entries pass schema validation
733
+
734
+ ### Other OWASP categories (A01, A02, A04, A07, A09, A10)
735
+
736
+ **Not applicable** — PR6 is read-only (no auth, no data storage, no network requests, no user accounts). Installation in PR7 will need re-evaluation for A03 and A08.
737
+
738
+ ---
739
+
740
+ ## Scope Assessment
741
+
742
+ - **Classification**: Strategic (new feature, architecture change)
743
+ - **Complexity**: Medium (reduced scope — catalog + recommendation only)
744
+ - **PR split**: PR6 (catalog + recommend) → PR7 (installer + extraction) → PR8 (expansion)
745
+ - **Risk**: LOW for PR6 (read-only), MEDIUM for PR7 (side effects)
746
+ - **Dependencies**: None for PR6 (PR5.5 deferred — skills stay bundled for now)
747
+
748
+ ---
749
+
750
+ ## Sources
751
+
752
+ - [skills.sh — Agent Skills Directory](https://skills.sh/)
753
+ - [Vercel — Agent Skills Guide](https://vercel.com/kb/guide/agent-skills-creating-installing-and-sharing-reusable-agent-context)
754
+ - [Claude Code — Create Plugins](https://code.claude.com/docs/en/plugins)
755
+ - [Cursor Plugin Spec](https://github.com/cursor/plugins)
756
+ - [Cursor Marketplace Launch](https://www.adwaitx.com/cursor-marketplace-plugins/)
757
+ - [add-mcp — Universal MCP Installer](https://neon.com/blog/add-mcp)
758
+ - [Vercel Agent Skills Repo](https://github.com/vercel-labs/agent-skills)
759
+ - [parallel-cursor-plugin](https://github.com/parallel-web/parallel-cursor-plugin)
760
+ - [SonarQube MCP Server](https://www.sonarsource.com/products/sonarqube/mcp-server/)
761
+ - [CodeQL MCP Server](https://github.com/JordyZomer/codeql-mcp)
762
+ - [Ultracite — Unified Linting](https://github.com/haydenbleasel/ultracite)
763
+ - [eslint-plugin-security](https://github.com/eslint-community/eslint-plugin-security)
764
+ - [Microsoft eslint-plugin-sdl](https://github.com/microsoft/eslint-plugin-sdl)
765
+ - [SonarCloud Pricing](https://www.sonarsource.com/plans-and-pricing/)
766
+ - [GitHub Advanced Security Pricing](https://github.com/pricing)
767
+ - [CodeRabbit Pricing](https://coderabbit.ai/pricing)
768
+ - [Greptile vs CodeRabbit](https://www.greptile.com/greptile-vs-coderabbit)
769
+ - [Qodo Merge — Free AI Code Review](https://github.com/Codium-ai/pr-agent)
770
+ - [awesome-claude-code-toolkit](https://github.com/rohitg00/awesome-claude-code-toolkit)
771
+ - [Biome Migration Guide](https://pockit.tools/blog/biome-eslint-prettier-migration-guide/)
772
+ - [Node.js Security Best Practices](https://nodejs.org/en/learn/getting-started/security-best-practices)