infernoflow 0.33.0 → 0.34.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 (84) hide show
  1. package/README.md +208 -120
  2. package/dist/bin/infernoflow.mjs +271 -85
  3. package/dist/lib/adopters/angular.mjs +128 -1
  4. package/dist/lib/adopters/css.mjs +111 -1
  5. package/dist/lib/adopters/react.mjs +104 -1
  6. package/dist/lib/ai/ideDetection.mjs +31 -1
  7. package/dist/lib/ai/localProvider.mjs +88 -1
  8. package/dist/lib/ai/providerRouter.mjs +295 -2
  9. package/dist/lib/commands/adopt.mjs +869 -20
  10. package/dist/lib/commands/adoptWizard.mjs +320 -9
  11. package/dist/lib/commands/agent.mjs +191 -5
  12. package/dist/lib/commands/ai.mjs +407 -2
  13. package/dist/lib/commands/ask.mjs +299 -0
  14. package/dist/lib/commands/audit.mjs +300 -13
  15. package/dist/lib/commands/changelog.mjs +594 -26
  16. package/dist/lib/commands/check.mjs +184 -3
  17. package/dist/lib/commands/ci.mjs +208 -3
  18. package/dist/lib/commands/claudeMd.mjs +139 -28
  19. package/dist/lib/commands/cloud.mjs +521 -5
  20. package/dist/lib/commands/context.mjs +346 -34
  21. package/dist/lib/commands/coverage.mjs +282 -2
  22. package/dist/lib/commands/dashboard.mjs +635 -123
  23. package/dist/lib/commands/demo.mjs +465 -8
  24. package/dist/lib/commands/diff.mjs +274 -5
  25. package/dist/lib/commands/docGate.mjs +81 -2
  26. package/dist/lib/commands/doctor.mjs +321 -3
  27. package/dist/lib/commands/explain.mjs +438 -8
  28. package/dist/lib/commands/export.mjs +239 -10
  29. package/dist/lib/commands/generateSkills.mjs +163 -38
  30. package/dist/lib/commands/graph.mjs +378 -11
  31. package/dist/lib/commands/health.mjs +309 -2
  32. package/dist/lib/commands/impact.mjs +325 -2
  33. package/dist/lib/commands/implement.mjs +103 -7
  34. package/dist/lib/commands/init.mjs +545 -23
  35. package/dist/lib/commands/installCursorHooks.mjs +36 -1
  36. package/dist/lib/commands/installVsCodeCopilotHooks.mjs +37 -1
  37. package/dist/lib/commands/link.mjs +342 -2
  38. package/dist/lib/commands/log.mjs +164 -16
  39. package/dist/lib/commands/monorepo.mjs +428 -4
  40. package/dist/lib/commands/notify.mjs +258 -4
  41. package/dist/lib/commands/onboard.mjs +296 -4
  42. package/dist/lib/commands/prComment.mjs +361 -2
  43. package/dist/lib/commands/prImpact.mjs +157 -2
  44. package/dist/lib/commands/publish.mjs +316 -15
  45. package/dist/lib/commands/recap.mjs +359 -0
  46. package/dist/lib/commands/report.mjs +272 -28
  47. package/dist/lib/commands/review.mjs +223 -9
  48. package/dist/lib/commands/run.mjs +336 -8
  49. package/dist/lib/commands/scaffold.mjs +419 -54
  50. package/dist/lib/commands/scan.mjs +1118 -5
  51. package/dist/lib/commands/scout.mjs +291 -2
  52. package/dist/lib/commands/setup.mjs +310 -5
  53. package/dist/lib/commands/share.mjs +196 -13
  54. package/dist/lib/commands/snapshot.mjs +383 -3
  55. package/dist/lib/commands/stability.mjs +293 -2
  56. package/dist/lib/commands/stats.mjs +402 -0
  57. package/dist/lib/commands/status.mjs +172 -4
  58. package/dist/lib/commands/suggest.mjs +563 -21
  59. package/dist/lib/commands/switch.mjs +310 -0
  60. package/dist/lib/commands/syncAuto.mjs +96 -1
  61. package/dist/lib/commands/synthesize.mjs +228 -10
  62. package/dist/lib/commands/teamSync.mjs +388 -2
  63. package/dist/lib/commands/test.mjs +363 -6
  64. package/dist/lib/commands/theme.mjs +195 -18
  65. package/dist/lib/commands/upgrade.mjs +153 -0
  66. package/dist/lib/commands/version.mjs +282 -2
  67. package/dist/lib/commands/vibe.mjs +357 -7
  68. package/dist/lib/commands/watch.mjs +203 -4
  69. package/dist/lib/commands/why.mjs +358 -4
  70. package/dist/lib/cursorHooksInstall.mjs +60 -1
  71. package/dist/lib/draftToolingInstall.mjs +68 -7
  72. package/dist/lib/git/detect-drift.mjs +208 -4
  73. package/dist/lib/learning/adapt.mjs +101 -6
  74. package/dist/lib/learning/observe.mjs +119 -1
  75. package/dist/lib/learning/patternDetector.mjs +298 -1
  76. package/dist/lib/learning/profile.mjs +279 -2
  77. package/dist/lib/learning/skillSynthesizer.mjs +145 -24
  78. package/dist/lib/templates/index.mjs +131 -1
  79. package/dist/lib/theme/scanner.mjs +343 -4
  80. package/dist/lib/ui/errors.mjs +142 -1
  81. package/dist/lib/ui/output.mjs +72 -6
  82. package/dist/lib/ui/prompts.mjs +147 -6
  83. package/dist/lib/vsCodeCopilotHooksInstall.mjs +42 -1
  84. package/package.json +1 -1
@@ -1,30 +1,104 @@
1
- import*as r from"node:fs";import*as u from"node:path";function c(s,e){const n=u.join(s,"agents");r.mkdirSync(n,{recursive:!0});const t={id:e.id,name:e.name,description:e.description,steps:e.steps.map(i=>({command:i,args:[]})),createdAt:new Date().toISOString(),source:"auto-synthesized",frequency:e.frequency,confidence:e.confidence},o=u.join(n,`${e.name}.json`);return r.writeFileSync(o,JSON.stringify(t,null,2)+`
2
- `,"utf8"),o}function a(s,e){const n=u.join(s,"skills");r.mkdirSync(n,{recursive:!0});const t=(e.examples||[]).map(f=>` - "${f}"`).join(`
3
- `),o=(e.steps||[]).map((f,p)=>`${p+1}. Run \`infernoflow ${f}\``).join(`
4
- `),i=`# Skill: ${e.name}
5
-
6
- > Auto-synthesized from ${e.frequency} observed sessions (confidence: ${Math.round(e.confidence*100)}%)
1
+ /**
2
+ * lib/learning/skillSynthesizer.mjs
3
+ *
4
+ * Converts approved candidates into actual files on disk:
5
+ *
6
+ * AGENTS → inferno/agents/<name>.json
7
+ * (runnable via `infernoflow agent run <name>`)
8
+ *
9
+ * SKILLS → inferno/skills/<name>.md
10
+ * + appends to .cursor/rules/infernoflow-auto.mdc
11
+ * + appends to CLAUDE.md (if it exists)
12
+ */
13
+
14
+ import * as fs from "node:fs";
15
+ import * as path from "node:path";
16
+
17
+ // ── Agent file writer ─────────────────────────────────────────────────────────
18
+
19
+ /**
20
+ * Write an agent definition to inferno/agents/<name>.json.
21
+ * Returns the file path written.
22
+ */
23
+ export function writeAgentFile(infernoDir, candidate) {
24
+ const agentsDir = path.join(infernoDir, "agents");
25
+ fs.mkdirSync(agentsDir, { recursive: true });
26
+
27
+ const agentDef = {
28
+ id: candidate.id,
29
+ name: candidate.name,
30
+ description: candidate.description,
31
+ steps: candidate.steps.map(cmd => ({ command: cmd, args: [] })),
32
+ createdAt: new Date().toISOString(),
33
+ source: "auto-synthesized",
34
+ frequency: candidate.frequency,
35
+ confidence: candidate.confidence,
36
+ };
37
+
38
+ const filePath = path.join(agentsDir, `${candidate.name}.json`);
39
+ fs.writeFileSync(filePath, JSON.stringify(agentDef, null, 2) + "\n", "utf8");
40
+ return filePath;
41
+ }
42
+
43
+ // ── Skill file writers ────────────────────────────────────────────────────────
44
+
45
+ /**
46
+ * Write a skill markdown file to inferno/skills/<name>.md.
47
+ */
48
+ export function writeSkillFile(infernoDir, candidate) {
49
+ const skillsDir = path.join(infernoDir, "skills");
50
+ fs.mkdirSync(skillsDir, { recursive: true });
51
+
52
+ const examples = (candidate.examples || [])
53
+ .map(e => ` - "${e}"`)
54
+ .join("\n");
55
+
56
+ const steps = (candidate.steps || [])
57
+ .map((s, i) => `${i + 1}. Run \`infernoflow ${s}\``)
58
+ .join("\n");
59
+
60
+ const content = `# Skill: ${candidate.name}
61
+
62
+ > Auto-synthesized from ${candidate.frequency} observed sessions (confidence: ${Math.round(candidate.confidence * 100)}%)
7
63
 
8
64
  ## Trigger pattern
9
65
 
10
- \`${e.trigger}\`
66
+ \`${candidate.trigger}\`
11
67
 
12
68
  ## Example tasks this applies to
13
69
 
14
- ${t||" (none recorded)"}
70
+ ${examples || " (none recorded)"}
15
71
 
16
72
  ## Recommended workflow
17
73
 
18
74
  When working on a task matching the pattern above:
19
75
 
20
- ${o}
76
+ ${steps}
21
77
 
22
78
  ## Notes
23
79
 
24
80
  - This skill was automatically generated by \`infernoflow synthesize\`
25
- - Review and edit as needed \u2014 it is yours to own
81
+ - Review and edit as needed it is yours to own
26
82
  - Re-run \`infernoflow synthesize\` to update as your patterns evolve
27
- `,l=u.join(n,`${e.name}.md`);return r.writeFileSync(l,i,"utf8"),l}function m(s,e){const n=u.join(s,".cursor","rules");r.mkdirSync(n,{recursive:!0});const t=u.join(n,"infernoflow-auto.mdc"),o=r.existsSync(t)?"":`---
83
+ `;
84
+
85
+ const filePath = path.join(skillsDir, `${candidate.name}.md`);
86
+ fs.writeFileSync(filePath, content, "utf8");
87
+ return filePath;
88
+ }
89
+
90
+ /**
91
+ * Append a skill rule to .cursor/rules/infernoflow-auto.mdc.
92
+ * Creates the file if it doesn't exist.
93
+ */
94
+ export function appendToCursorRules(cwd, candidate) {
95
+ const rulesDir = path.join(cwd, ".cursor", "rules");
96
+ fs.mkdirSync(rulesDir, { recursive: true });
97
+
98
+ const filePath = path.join(rulesDir, "infernoflow-auto.mdc");
99
+
100
+ const header = fs.existsSync(filePath) ? "" :
101
+ `---
28
102
  description: Auto-generated infernoflow workflow rules
29
103
  globs: ["**/*"]
30
104
  alwaysApply: true
@@ -33,20 +107,67 @@ alwaysApply: true
33
107
  # infernoflow Auto-Generated Workflow Rules
34
108
 
35
109
  These rules are synthesized from your observed development patterns.
36
- Do not edit manually \u2014 re-run \`infernoflow synthesize\` to regenerate.
37
-
38
- `,i=`
39
- ## ${e.name}
110
+ Do not edit manually re-run \`infernoflow synthesize\` to regenerate.
40
111
 
41
- Pattern: \`${e.trigger}\`
112
+ `;
42
113
 
43
- When working on tasks matching this pattern:
44
- ${(e.steps||[]).map((l,f)=>`${f+1}. Run \`infernoflow ${l}\``).join(`
45
- `)}
114
+ const rule = `
115
+ ## ${candidate.name}
46
116
 
47
- `;return r.appendFileSync(t,o+i,"utf8"),t}function y(s,e){const n=u.join(s,"CLAUDE.md");if(!r.existsSync(n))return null;const t=r.readFileSync(n,"utf8"),o="## infernoflow Auto-Skills",i=`
48
- - **${e.name}**: For tasks like \`${e.trigger}\`, run: ${(e.steps||[]).map(l=>`\`infernoflow ${l}\``).join(" \u2192 ")}`;if(!t.includes(o))r.appendFileSync(n,`
117
+ Pattern: \`${candidate.trigger}\`
49
118
 
50
- ${o}
51
- ${i}
52
- `,"utf8");else{const l=t.replace(o,o+i);r.writeFileSync(n,l,"utf8")}return n}function h(s,e,n){const t=[];if(n.type==="agent")t.push(c(e,n));else{t.push(a(e,n));try{t.push(m(s,n))}catch{}try{const o=y(s,n);o&&t.push(o)}catch{}}return{filePaths:t}}export{y as appendToClaudeMd,m as appendToCursorRules,h as synthesizeCandidate,c as writeAgentFile,a as writeSkillFile};
119
+ When working on tasks matching this pattern:
120
+ ${(candidate.steps || []).map((s, i) => `${i + 1}. Run \`infernoflow ${s}\``).join("\n")}
121
+
122
+ `;
123
+
124
+ fs.appendFileSync(filePath, header + rule, "utf8");
125
+ return filePath;
126
+ }
127
+
128
+ /**
129
+ * Append a skill tip to CLAUDE.md if it exists.
130
+ */
131
+ export function appendToClaudeMd(cwd, candidate) {
132
+ const claudeMdPath = path.join(cwd, "CLAUDE.md");
133
+ if (!fs.existsSync(claudeMdPath)) return null;
134
+
135
+ const existing = fs.readFileSync(claudeMdPath, "utf8");
136
+ const marker = "## infernoflow Auto-Skills";
137
+
138
+ const tip = `\n- **${candidate.name}**: For tasks like \`${candidate.trigger}\`, run: ${(candidate.steps || []).map(s => `\`infernoflow ${s}\``).join(" → ")}`;
139
+
140
+ if (!existing.includes(marker)) {
141
+ fs.appendFileSync(claudeMdPath, `\n\n${marker}\n${tip}\n`, "utf8");
142
+ } else {
143
+ // Append after the marker section
144
+ const updated = existing.replace(marker, marker + tip);
145
+ fs.writeFileSync(claudeMdPath, updated, "utf8");
146
+ }
147
+
148
+ return claudeMdPath;
149
+ }
150
+
151
+ // ── Main synthesize function ──────────────────────────────────────────────────
152
+
153
+ /**
154
+ * Write all files for an approved candidate.
155
+ * Returns { filePaths: string[] } — list of files written.
156
+ */
157
+ export function synthesizeCandidate(cwd, infernoDir, candidate) {
158
+ const filePaths = [];
159
+
160
+ if (candidate.type === "agent") {
161
+ filePaths.push(writeAgentFile(infernoDir, candidate));
162
+ } else {
163
+ // skill
164
+ filePaths.push(writeSkillFile(infernoDir, candidate));
165
+ try { filePaths.push(appendToCursorRules(cwd, candidate)); } catch {}
166
+ try {
167
+ const p = appendToClaudeMd(cwd, candidate);
168
+ if (p) filePaths.push(p);
169
+ } catch {}
170
+ }
171
+
172
+ return { filePaths };
173
+ }
@@ -1 +1,131 @@
1
- const i={"rest-api":{description:"Express / Fastify / Hono REST API",capabilities:[{id:"list-items",description:"GET /items \u2014 paginated list with filtering and sorting"},{id:"get-item",description:"GET /items/:id \u2014 fetch a single resource by ID"},{id:"create-item",description:"POST /items \u2014 create a new resource, validate input"},{id:"update-item",description:"PUT /items/:id \u2014 full update of an existing resource"},{id:"delete-item",description:"DELETE /items/:id \u2014 soft or hard delete"},{id:"authenticate",description:"POST /auth/login \u2014 exchange credentials for a JWT token"},{id:"refresh-token",description:"POST /auth/refresh \u2014 extend session with a new token"},{id:"health-check",description:"GET /health \u2014 liveness probe for load balancers"},{id:"paginate",description:"Cursor or offset pagination applied across list endpoints"},{id:"validate-input",description:"Schema validation on all incoming request bodies"}],contextHint:"Building a REST API. Focus on route handlers, middleware, and input validation.",scripts:{dev:"node src/index.js",start:"node dist/index.js"}},nextjs:{description:"Next.js full-stack app (App Router or Pages Router)",capabilities:[{id:"render-home-page",description:"/ \u2014 server-rendered landing page with SEO metadata"},{id:"render-dashboard",description:"/dashboard \u2014 authenticated user dashboard"},{id:"api-authenticate",description:"POST /api/auth/login \u2014 issue session cookie or JWT"},{id:"api-list-resources",description:"GET /api/resources \u2014 paginated list, auth-protected"},{id:"api-create-resource",description:"POST /api/resources \u2014 create and persist a resource"},{id:"server-side-props",description:"Fetch user-specific data server-side before render"},{id:"static-generation",description:"Pre-render marketing pages at build time"},{id:"image-optimization",description:"next/image usage for responsive, lazy-loaded images"},{id:"middleware-auth",description:"Edge middleware to protect dashboard routes"},{id:"error-boundary",description:"Global error.tsx / _error.tsx user-facing error page"}],contextHint:"Building a Next.js app. Use Server Components by default; Client Components only when needed.",scripts:{dev:"next dev",build:"next build",start:"next start"}},cli:{description:"Node.js / Python CLI tool",capabilities:[{id:"parse-args",description:"Parse CLI arguments and flags, show help on --help"},{id:"validate-config",description:"Load and validate config file or env vars on startup"},{id:"main-command",description:"Primary command \u2014 the core action the CLI performs"},{id:"output-formatter",description:"Format output as text, JSON, or table based on --format flag"},{id:"error-handler",description:"Friendly error messages with exit codes, no raw stack traces"},{id:"progress-display",description:"Spinner or progress bar for long-running operations"},{id:"update-check",description:"Check npm/PyPI for a newer version on startup"},{id:"plugin-loader",description:"Discover and load user-installed plugins at runtime"}],contextHint:"Building a CLI tool. Prioritise UX: helpful errors, --json flag, zero-config defaults.",scripts:{start:"node bin/cli.js",link:"npm link"}},graphql:{description:"GraphQL API (Apollo, Pothos, or similar)",capabilities:[{id:"query-viewer",description:"query { viewer } \u2014 return the authenticated user"},{id:"query-list",description:"query { items(first: N, after: cursor) } \u2014 paginated list"},{id:"query-node",description:"query { node(id) } \u2014 global object lookup by ID"},{id:"mutation-create",description:"mutation { createItem(input) } \u2014 create and return new object"},{id:"mutation-update",description:"mutation { updateItem(id, input) } \u2014 update fields"},{id:"mutation-delete",description:"mutation { deleteItem(id) } \u2014 remove and return deleted"},{id:"subscription-event",description:"subscription { itemUpdated } \u2014 real-time push via WebSocket"},{id:"data-loader",description:"Batch and cache DB calls with DataLoader to avoid N+1"},{id:"auth-directive",description:"@auth directive \u2014 enforce authentication on resolvers"},{id:"error-formatting",description:"Consistent GraphQL error shape with extensions and codes"}],contextHint:"Building a GraphQL API. Use DataLoader for all relations, @auth directive on protected resolvers.",scripts:{dev:"ts-node src/server.ts",codegen:"graphql-codegen"}},monorepo:{description:"Monorepo workspace (nx / turborepo / pnpm workspaces)",capabilities:[{id:"build-all",description:"Build all packages in dependency order"},{id:"test-all",description:"Run tests across all packages in parallel"},{id:"lint-all",description:"Lint all packages with shared ESLint / Prettier config"},{id:"publish-packages",description:"Bump versions and publish changed packages to npm"},{id:"shared-ui-library",description:"packages/ui \u2014 shared React component library"},{id:"shared-utils",description:"packages/utils \u2014 shared utility functions and types"},{id:"web-app",description:"apps/web \u2014 primary Next.js or React web application"},{id:"api-service",description:"apps/api \u2014 backend service consumed by apps"},{id:"cache-builds",description:"Remote build cache via Turborepo or Nx Cloud"},{id:"affected-only",description:"Run tasks only for packages affected by a git change"}],contextHint:"Working in a monorepo. Changes in packages/* may affect apps/*. Check affected packages before building.",scripts:{build:"turbo build",dev:"turbo dev",test:"turbo test"}}};function r(){return Object.entries(i).map(([e,t])=>({name:e,description:t.description}))}function a(e){return i[e]||null}export{i as TEMPLATES,a as getTemplate,r as listTemplates};
1
+ /**
2
+ * infernoflow project templates
3
+ *
4
+ * Named starters for `infernoflow init --template <name>`.
5
+ * Each template provides:
6
+ * - capabilities : pre-populated capability list
7
+ * - scenarios : one starter scenario per capability
8
+ * - contextHint : first-session CONTEXT.md guidance
9
+ * - scripts : suggested package.json scripts to add
10
+ */
11
+
12
+ export const TEMPLATES = {
13
+
14
+ // ── REST API ────────────────────────────────────────────────────────────────
15
+ "rest-api": {
16
+ description: "Express / Fastify / Hono REST API",
17
+ capabilities: [
18
+ { id: "list-items", description: "GET /items — paginated list with filtering and sorting" },
19
+ { id: "get-item", description: "GET /items/:id — fetch a single resource by ID" },
20
+ { id: "create-item", description: "POST /items — create a new resource, validate input" },
21
+ { id: "update-item", description: "PUT /items/:id — full update of an existing resource" },
22
+ { id: "delete-item", description: "DELETE /items/:id — soft or hard delete" },
23
+ { id: "authenticate", description: "POST /auth/login — exchange credentials for a JWT token" },
24
+ { id: "refresh-token", description: "POST /auth/refresh — extend session with a new token" },
25
+ { id: "health-check", description: "GET /health — liveness probe for load balancers" },
26
+ { id: "paginate", description: "Cursor or offset pagination applied across list endpoints" },
27
+ { id: "validate-input", description: "Schema validation on all incoming request bodies" },
28
+ ],
29
+ contextHint: "Building a REST API. Focus on route handlers, middleware, and input validation.",
30
+ scripts: {
31
+ "dev": "node src/index.js",
32
+ "start": "node dist/index.js",
33
+ },
34
+ },
35
+
36
+ // ── Next.js ─────────────────────────────────────────────────────────────────
37
+ "nextjs": {
38
+ description: "Next.js full-stack app (App Router or Pages Router)",
39
+ capabilities: [
40
+ { id: "render-home-page", description: "/ — server-rendered landing page with SEO metadata" },
41
+ { id: "render-dashboard", description: "/dashboard — authenticated user dashboard" },
42
+ { id: "api-authenticate", description: "POST /api/auth/login — issue session cookie or JWT" },
43
+ { id: "api-list-resources", description: "GET /api/resources — paginated list, auth-protected" },
44
+ { id: "api-create-resource", description: "POST /api/resources — create and persist a resource" },
45
+ { id: "server-side-props", description: "Fetch user-specific data server-side before render" },
46
+ { id: "static-generation", description: "Pre-render marketing pages at build time" },
47
+ { id: "image-optimization", description: "next/image usage for responsive, lazy-loaded images" },
48
+ { id: "middleware-auth", description: "Edge middleware to protect dashboard routes" },
49
+ { id: "error-boundary", description: "Global error.tsx / _error.tsx user-facing error page" },
50
+ ],
51
+ contextHint: "Building a Next.js app. Use Server Components by default; Client Components only when needed.",
52
+ scripts: {
53
+ "dev": "next dev",
54
+ "build": "next build",
55
+ "start": "next start",
56
+ },
57
+ },
58
+
59
+ // ── CLI tool ────────────────────────────────────────────────────────────────
60
+ "cli": {
61
+ description: "Node.js / Python CLI tool",
62
+ capabilities: [
63
+ { id: "parse-args", description: "Parse CLI arguments and flags, show help on --help" },
64
+ { id: "validate-config", description: "Load and validate config file or env vars on startup" },
65
+ { id: "main-command", description: "Primary command — the core action the CLI performs" },
66
+ { id: "output-formatter", description: "Format output as text, JSON, or table based on --format flag" },
67
+ { id: "error-handler", description: "Friendly error messages with exit codes, no raw stack traces" },
68
+ { id: "progress-display", description: "Spinner or progress bar for long-running operations" },
69
+ { id: "update-check", description: "Check npm/PyPI for a newer version on startup" },
70
+ { id: "plugin-loader", description: "Discover and load user-installed plugins at runtime" },
71
+ ],
72
+ contextHint: "Building a CLI tool. Prioritise UX: helpful errors, --json flag, zero-config defaults.",
73
+ scripts: {
74
+ "start": "node bin/cli.js",
75
+ "link": "npm link",
76
+ },
77
+ },
78
+
79
+ // ── GraphQL ─────────────────────────────────────────────────────────────────
80
+ "graphql": {
81
+ description: "GraphQL API (Apollo, Pothos, or similar)",
82
+ capabilities: [
83
+ { id: "query-viewer", description: "query { viewer } — return the authenticated user" },
84
+ { id: "query-list", description: "query { items(first: N, after: cursor) } — paginated list" },
85
+ { id: "query-node", description: "query { node(id) } — global object lookup by ID" },
86
+ { id: "mutation-create", description: "mutation { createItem(input) } — create and return new object" },
87
+ { id: "mutation-update", description: "mutation { updateItem(id, input) } — update fields" },
88
+ { id: "mutation-delete", description: "mutation { deleteItem(id) } — remove and return deleted" },
89
+ { id: "subscription-event", description: "subscription { itemUpdated } — real-time push via WebSocket" },
90
+ { id: "data-loader", description: "Batch and cache DB calls with DataLoader to avoid N+1" },
91
+ { id: "auth-directive", description: "@auth directive — enforce authentication on resolvers" },
92
+ { id: "error-formatting", description: "Consistent GraphQL error shape with extensions and codes" },
93
+ ],
94
+ contextHint: "Building a GraphQL API. Use DataLoader for all relations, @auth directive on protected resolvers.",
95
+ scripts: {
96
+ "dev": "ts-node src/server.ts",
97
+ "codegen": "graphql-codegen",
98
+ },
99
+ },
100
+
101
+ // ── Monorepo ────────────────────────────────────────────────────────────────
102
+ "monorepo": {
103
+ description: "Monorepo workspace (nx / turborepo / pnpm workspaces)",
104
+ capabilities: [
105
+ { id: "build-all", description: "Build all packages in dependency order" },
106
+ { id: "test-all", description: "Run tests across all packages in parallel" },
107
+ { id: "lint-all", description: "Lint all packages with shared ESLint / Prettier config" },
108
+ { id: "publish-packages", description: "Bump versions and publish changed packages to npm" },
109
+ { id: "shared-ui-library", description: "packages/ui — shared React component library" },
110
+ { id: "shared-utils", description: "packages/utils — shared utility functions and types" },
111
+ { id: "web-app", description: "apps/web — primary Next.js or React web application" },
112
+ { id: "api-service", description: "apps/api — backend service consumed by apps" },
113
+ { id: "cache-builds", description: "Remote build cache via Turborepo or Nx Cloud" },
114
+ { id: "affected-only", description: "Run tasks only for packages affected by a git change" },
115
+ ],
116
+ contextHint: "Working in a monorepo. Changes in packages/* may affect apps/*. Check affected packages before building.",
117
+ scripts: {
118
+ "build": "turbo build",
119
+ "dev": "turbo dev",
120
+ "test": "turbo test",
121
+ },
122
+ },
123
+ };
124
+
125
+ export function listTemplates() {
126
+ return Object.entries(TEMPLATES).map(([name, t]) => ({ name, description: t.description }));
127
+ }
128
+
129
+ export function getTemplate(name) {
130
+ return TEMPLATES[name] || null;
131
+ }