@structured-vibe-coding/core 0.4.0 → 0.5.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.
@@ -1,20 +1,28 @@
1
1
  import {
2
2
  AGENT_TARGET_OPTIONS,
3
3
  ALL_AGENT_TARGETS,
4
+ DEFAULT_INIT_INTEGRATION,
4
5
  PROTOCOL_MD,
5
6
  SDD_AGENT_ROLES,
6
7
  installAgentIntegrations,
8
+ integrationKeyFor,
9
+ optionForTarget,
7
10
  parseAgentTargets,
11
+ parseIntegration,
8
12
  refreshActiveAgentContext,
9
13
  renderThinAgent
10
- } from "./chunk-BP54LEAD.js";
14
+ } from "./chunk-32PIFJ2Y.js";
11
15
  export {
12
16
  AGENT_TARGET_OPTIONS,
13
17
  ALL_AGENT_TARGETS,
18
+ DEFAULT_INIT_INTEGRATION,
14
19
  PROTOCOL_MD,
15
20
  SDD_AGENT_ROLES,
16
21
  installAgentIntegrations,
22
+ integrationKeyFor,
23
+ optionForTarget,
17
24
  parseAgentTargets,
25
+ parseIntegration,
18
26
  refreshActiveAgentContext,
19
27
  renderThinAgent
20
28
  };
@@ -518,7 +518,7 @@ async function createChange(input) {
518
518
  await materializeStageArtifacts(projectRoot, config, id, workflow, meta, firstStage);
519
519
  await setActiveChange(projectRoot, config, id);
520
520
  try {
521
- const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-2ONGBIGG.js");
521
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-SVTCSTX4.js");
522
522
  await refreshActiveAgentContext2(projectRoot);
523
523
  } catch {
524
524
  }
@@ -738,7 +738,7 @@ async function advanceStage(projectRoot, config, changeId, opts) {
738
738
  stage
739
739
  );
740
740
  try {
741
- const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-2ONGBIGG.js");
741
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-SVTCSTX4.js");
742
742
  await refreshActiveAgentContext2(projectRoot);
743
743
  } catch {
744
744
  }
@@ -960,38 +960,59 @@ async function buildAgentPrompt(ctx, config, projectRoot) {
960
960
  }
961
961
 
962
962
  // src/agents.ts
963
- var ALL_AGENT_TARGETS = ["copilot", "claude-code", "intellij"];
963
+ var ALL_AGENT_TARGETS = ["copilot", "claude-code"];
964
+ var DEFAULT_INIT_INTEGRATION = "copilot";
964
965
  var AGENT_TARGET_OPTIONS = [
965
966
  {
966
967
  id: "copilot",
968
+ key: "copilot",
967
969
  label: "GitHub Copilot",
968
- hint: ".github/agents/*.agent.md"
970
+ hint: ".github/agents/*.agent.md (VS Code, Cursor, JetBrains, \u2026)",
971
+ requiresCli: false,
972
+ installUrl: "https://github.com/features/copilot"
969
973
  },
970
974
  {
971
975
  id: "claude-code",
976
+ key: "claude",
972
977
  label: "Claude Code",
973
- hint: ".claude/agents/*.md"
974
- },
975
- {
976
- id: "intellij",
977
- label: "IntelliJ / JetBrains",
978
- hint: ".idea/sdd-agent-notes.md"
978
+ hint: ".claude/agents/*.md (terminal agent)",
979
+ requiresCli: true,
980
+ installUrl: "https://docs.anthropic.com/en/docs/claude-code"
979
981
  }
980
982
  ];
983
+ function integrationKeyFor(target) {
984
+ return AGENT_TARGET_OPTIONS.find((o) => o.id === target)?.key ?? target;
985
+ }
986
+ function optionForTarget(target) {
987
+ return AGENT_TARGET_OPTIONS.find((o) => o.id === target);
988
+ }
981
989
  function parseAgentTargets(raw) {
982
990
  const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((s) => String(s).split(",")).map((s) => s.trim().toLowerCase()).filter(Boolean);
983
991
  const out = [];
984
992
  for (const p of parts) {
985
- const id = p === "claude" || p === "claude-code" || p === "claudecode" ? "claude-code" : p === "github-copilot" || p === "gh-copilot" || p === "copilot" ? "copilot" : p === "jetbrains" || p === "idea" || p === "intellij" ? "intellij" : p;
986
- if (!ALL_AGENT_TARGETS.includes(id)) {
993
+ if (p === "intellij" || p === "idea" || p === "jetbrains" || p === "vscode" || p === "vs-code" || p === "cursor") {
987
994
  throw new Error(
988
- `Unknown agent platform "${p}". Choose one of: ${ALL_AGENT_TARGETS.join(", ")}`
995
+ `"${p}" is an IDE, not an AI coding agent. Choose: copilot or claude (Claude Code).`
989
996
  );
990
997
  }
998
+ const id = p === "claude" || p === "claude-code" || p === "claudecode" ? "claude-code" : p === "github-copilot" || p === "gh-copilot" || p === "copilot" ? "copilot" : p;
999
+ if (!ALL_AGENT_TARGETS.includes(id)) {
1000
+ const keys = AGENT_TARGET_OPTIONS.map((o) => o.key).join(", ");
1001
+ throw new Error(`Unknown AI coding agent "${p}". Choose from: ${keys}`);
1002
+ }
991
1003
  if (!out.includes(id)) out.push(id);
992
1004
  }
993
1005
  return out;
994
1006
  }
1007
+ function parseIntegration(raw) {
1008
+ const list = parseAgentTargets(raw);
1009
+ if (list.length !== 1) {
1010
+ throw new Error(
1011
+ `Expected one AI coding agent (like Speckit --integration), got: ${raw}`
1012
+ );
1013
+ }
1014
+ return list[0];
1015
+ }
995
1016
  var SDD_AGENT_ROLES = [
996
1017
  {
997
1018
  id: "sdd",
@@ -1034,7 +1055,7 @@ var SDD_AGENT_ROLES = [
1034
1055
  async function installAgentIntegrations(opts) {
1035
1056
  if (!opts.targets?.length) {
1036
1057
  throw new Error(
1037
- `Specify at least one agent platform: ${ALL_AGENT_TARGETS.join(", ")} (do not install all by default)`
1058
+ `Specify at least one AI coding agent: ${ALL_AGENT_TARGETS.join(", ")} (not an IDE; do not install all by default)`
1038
1059
  );
1039
1060
  }
1040
1061
  const targets = opts.targets;
@@ -1053,23 +1074,16 @@ async function installAgentIntegrations(opts) {
1053
1074
  };
1054
1075
  await write(join4(".sdd", "protocol.md"), PROTOCOL_MD);
1055
1076
  await refreshActiveAgentContext(root);
1056
- if (targets.includes("copilot") || targets.includes("claude-code")) {
1057
- for (const role of SDD_AGENT_ROLES) {
1058
- const body = renderThinAgent(role);
1059
- if (targets.includes("claude-code")) {
1060
- await write(`.claude/agents/${role.id}.md`, body);
1061
- }
1062
- if (targets.includes("copilot")) {
1063
- await write(`.github/agents/${role.id}.agent.md`, body);
1064
- }
1077
+ for (const role of SDD_AGENT_ROLES) {
1078
+ const body = renderThinAgent(role);
1079
+ if (targets.includes("claude-code")) {
1080
+ await write(`.claude/agents/${role.id}.md`, body);
1081
+ }
1082
+ if (targets.includes("copilot")) {
1083
+ await write(`.github/agents/${role.id}.agent.md`, body);
1065
1084
  }
1066
1085
  }
1067
- if (targets.includes("intellij")) {
1068
- await write(".idea/sdd-agent-notes.md", INTELLIJ_NOTES);
1069
- }
1070
- if (targets.includes("copilot") || targets.includes("claude-code") || targets.includes("intellij")) {
1071
- await write("AGENTS.md", AGENTS_MD_THIN);
1072
- }
1086
+ await write("AGENTS.md", renderAgentsMd(targets));
1073
1087
  await write(
1074
1088
  join4(".sdd", "agents.json"),
1075
1089
  JSON.stringify(
@@ -1080,6 +1094,21 @@ async function installAgentIntegrations(opts) {
1080
1094
  activeContext: ".sdd/active-context.md",
1081
1095
  roles: SDD_AGENT_ROLES.map((r) => r.id),
1082
1096
  installed: targets,
1097
+ /** Speckit-style primary integration key (first target). */
1098
+ integration: targets[0] ? integrationKeyFor(targets[0]) : null,
1099
+ updated: (/* @__PURE__ */ new Date()).toISOString()
1100
+ },
1101
+ null,
1102
+ 2
1103
+ ) + "\n"
1104
+ );
1105
+ await write(
1106
+ join4(".sdd", "init-options.json"),
1107
+ JSON.stringify(
1108
+ {
1109
+ ai: targets[0] ? integrationKeyFor(targets[0]) : null,
1110
+ integration: targets[0] ? integrationKeyFor(targets[0]) : null,
1111
+ installed: targets.map(integrationKeyFor),
1083
1112
  updated: (/* @__PURE__ */ new Date()).toISOString()
1084
1113
  },
1085
1114
  null,
@@ -1214,31 +1243,36 @@ sdd complete
1214
1243
  - Deleting \`.sdd\` / archive history
1215
1244
  - Claiming complete without verify when required
1216
1245
  `;
1217
- var AGENTS_MD_THIN = `# Agents
1246
+ function renderAgentsMd(targets) {
1247
+ const rows = [];
1248
+ if (targets.includes("claude-code")) {
1249
+ rows.push(
1250
+ "| Claude Code | `.claude/agents/` (`sdd`, `sdd-planner`, `sdd-implementer`, `sdd-reviewer`) |"
1251
+ );
1252
+ }
1253
+ if (targets.includes("copilot")) {
1254
+ rows.push(
1255
+ "| GitHub Copilot | `.github/agents/*.agent.md` (same roles; any IDE that supports Copilot agents) |"
1256
+ );
1257
+ }
1258
+ return `# Agents
1218
1259
 
1219
1260
  This repo uses **SDD agents only** (no skills).
1220
1261
 
1262
+ AI coding agents are **not** the same as IDEs: VS Code, Cursor, and IntelliJ host tools like Copilot or Claude Code.
1263
+
1221
1264
  | Read first | |
1222
1265
  |------------|--|
1223
1266
  | Live task | \`.sdd/active-context.md\` |
1224
1267
  | Playbook | \`.sdd/protocol.md\` |
1225
1268
 
1226
- | Host | Agents |
1227
- |------|--------|
1228
- | Claude Code | \`.claude/agents/\` (\`sdd\`, \`sdd-planner\`, \`sdd-implementer\`, \`sdd-reviewer\`) |
1229
- | GitHub Copilot | \`.github/agents/*.agent.md\` (same roles) |
1269
+ | AI agent | Files |
1270
+ |----------|--------|
1271
+ ${rows.join("\n")}
1230
1272
 
1231
1273
  Refresh context: \`sdd agents refresh\`.
1232
1274
  `;
1233
- var INTELLIJ_NOTES = `# SDD + IntelliJ
1234
-
1235
- Agents only. Playbook: \`.sdd/protocol.md\`. Live: \`.sdd/active-context.md\`.
1236
-
1237
- 1. Install \`sdd\` on PATH: \`npm i -g @structured-vibe-coding/cli\`
1238
- 2. Tools \u2192 SDD \u2192 Initialize / Install Agent Integrations
1239
- 3. GitHub Copilot uses \`.github/agents/*\` + active-context (same as VS Code)
1240
- 4. After stage changes: **Refresh Agent Context**
1241
- `;
1275
+ }
1242
1276
 
1243
1277
  export {
1244
1278
  GateSchema,
@@ -1293,8 +1327,12 @@ export {
1293
1327
  changeDirName,
1294
1328
  uniqueChangeDirName,
1295
1329
  ALL_AGENT_TARGETS,
1330
+ DEFAULT_INIT_INTEGRATION,
1296
1331
  AGENT_TARGET_OPTIONS,
1332
+ integrationKeyFor,
1333
+ optionForTarget,
1297
1334
  parseAgentTargets,
1335
+ parseIntegration,
1298
1336
  SDD_AGENT_ROLES,
1299
1337
  installAgentIntegrations,
1300
1338
  renderThinAgent,
package/dist/index.d.ts CHANGED
@@ -1164,16 +1164,39 @@ declare function completeChange(projectRoot: string, config: Config, changeId: s
1164
1164
  declare function formatStatus(ctx: ChangeContext): string;
1165
1165
  declare function buildAgentPrompt(ctx: ChangeContext, config: Config, projectRoot: string): Promise<string>;
1166
1166
 
1167
- type AgentTarget = "copilot" | "claude-code" | "intellij";
1167
+ /**
1168
+ * AI coding agents (not IDEs).
1169
+ * VS Code / Cursor / IntelliJ are editors; they host tools like Copilot or Claude Code.
1170
+ *
1171
+ * Speckit-style: one integration at a time; public keys are short (`copilot`, `claude`).
1172
+ */
1173
+ type AgentTarget = "copilot" | "claude-code";
1168
1174
  declare const ALL_AGENT_TARGETS: AgentTarget[];
1169
- /** Human-facing labels for interactive platform pick (CLI / IDE). */
1170
- declare const AGENT_TARGET_OPTIONS: {
1175
+ /** Default when non-interactive and no --ai / --integration (matches Speckit). */
1176
+ declare const DEFAULT_INIT_INTEGRATION: AgentTarget;
1177
+ interface AgentTargetOption {
1178
+ /** Internal install id (file paths / agents.json). */
1171
1179
  id: AgentTarget;
1180
+ /** Speckit-style public key used with --ai / --integration. */
1181
+ key: string;
1172
1182
  label: string;
1173
1183
  hint: string;
1174
- }[];
1175
- /** Parse `copilot`, `claude-code,copilot`, etc. Throws on unknown ids. */
1184
+ /** If true, CLI may check that the agent binary is on PATH. */
1185
+ requiresCli: boolean;
1186
+ installUrl: string;
1187
+ }
1188
+ /** Human-facing options for interactive AI-agent pick (CLI / IDE). */
1189
+ declare const AGENT_TARGET_OPTIONS: AgentTargetOption[];
1190
+ /** Public CLI keys → internal targets (Speckit uses `claude`, not `claude-code`). */
1191
+ declare function integrationKeyFor(target: AgentTarget): string;
1192
+ declare function optionForTarget(target: AgentTarget): AgentTargetOption | undefined;
1193
+ /**
1194
+ * Parse Speckit-style integration keys: `copilot`, `claude`, `claude-code`, …
1195
+ * Throws on unknown ids or IDE names.
1196
+ */
1176
1197
  declare function parseAgentTargets(raw: string | string[]): AgentTarget[];
1198
+ /** Parse a single Speckit-style integration (exactly one). */
1199
+ declare function parseIntegration(raw: string): AgentTarget;
1177
1200
  /** Roles emitted as thin agents (shared body generator — no skill files). */
1178
1201
  type SddAgentRoleId = "sdd" | "sdd-planner" | "sdd-implementer" | "sdd-reviewer";
1179
1202
  interface SddAgentRole {
@@ -1214,9 +1237,10 @@ interface InitOptions {
1214
1237
  force?: boolean;
1215
1238
  pack?: "default" | "enterprise";
1216
1239
  /**
1217
- * Agent platforms to install. Opt-in only — never defaults to all platforms.
1240
+ * AI coding agents to install (copilot | claude-code). Not IDEs.
1241
+ * Opt-in only — never defaults to all agents.
1218
1242
  * - omit / `false` — no agent files
1219
- * - `AgentTarget[]` — install only those hosts
1243
+ * - `AgentTarget[]` — install only those AI agents
1220
1244
  */
1221
1245
  agents?: false | AgentTarget[];
1222
1246
  }
@@ -1276,4 +1300,4 @@ declare function listFiles(path: string): Promise<string[]>;
1276
1300
  declare function copyDir(src: string, dest: string): Promise<void>;
1277
1301
  declare function removePath(path: string): Promise<void>;
1278
1302
 
1279
- export { AGENT_TARGET_OPTIONS, ALL_AGENT_TARGETS, type AdvanceResult, type AgentTarget, type ArtifactDef, ArtifactDefSchema, type ChangeContext, type ChangeMeta, ChangeMetaSchema, type Complexity, type Config, ConfigSchema, type CreateChangeInput, type Gate, GateSchema, type InitOptions, type InitResult, type InstallAgentsOptions, type InstallAgentsResult, PROTOCOL_MD, SDD_AGENT_ROLES, SDD_DIR, type SddAgentRole, type SddAgentRoleId, type Stage, StageSchema, VerifyCommandSchema, type VerifyResult, type Workflow, WorkflowSchema, activePointerPath, activeStages, advanceStage, approveGate, archiveDir, buildAgentPrompt, buildContext, canLeaveStage, changeDirName, changeMetaPath, changePath, changesDir, clearActiveIf, completeChange, configPath, copyDir, createChange, defaultConfig, defaultMemoryDir, defaultTemplatesDir, defaultWorkflowsDir, defaultsRoot, domainsDir, ensureDir, firstActiveStageId, formatStatus, getActiveChangeId, getStage, inferComplexity, initProject, installAgentIntegrations, isInitialized, isStageSkipped, listChanges, listDirs, listFiles, listWorkflowNames, loadChangeMeta, loadConfig, loadWorkflow, memoryDir, nextStageId, nowIso, parseAgentTargets, pathExists, previousStageId, projectPaths, readText, readYaml, recommendWorkflow, refreshActiveAgentContext, removePath, renderThinAgent, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };
1303
+ export { AGENT_TARGET_OPTIONS, ALL_AGENT_TARGETS, type AdvanceResult, type AgentTarget, type AgentTargetOption, type ArtifactDef, ArtifactDefSchema, type ChangeContext, type ChangeMeta, ChangeMetaSchema, type Complexity, type Config, ConfigSchema, type CreateChangeInput, DEFAULT_INIT_INTEGRATION, type Gate, GateSchema, type InitOptions, type InitResult, type InstallAgentsOptions, type InstallAgentsResult, PROTOCOL_MD, SDD_AGENT_ROLES, SDD_DIR, type SddAgentRole, type SddAgentRoleId, type Stage, StageSchema, VerifyCommandSchema, type VerifyResult, type Workflow, WorkflowSchema, activePointerPath, activeStages, advanceStage, approveGate, archiveDir, buildAgentPrompt, buildContext, canLeaveStage, changeDirName, changeMetaPath, changePath, changesDir, clearActiveIf, completeChange, configPath, copyDir, createChange, defaultConfig, defaultMemoryDir, defaultTemplatesDir, defaultWorkflowsDir, defaultsRoot, domainsDir, ensureDir, firstActiveStageId, formatStatus, getActiveChangeId, getStage, inferComplexity, initProject, installAgentIntegrations, integrationKeyFor, isInitialized, isStageSkipped, listChanges, listDirs, listFiles, listWorkflowNames, loadChangeMeta, loadConfig, loadWorkflow, memoryDir, nextStageId, nowIso, optionForTarget, parseAgentTargets, parseIntegration, pathExists, previousStageId, projectPaths, readText, readYaml, recommendWorkflow, refreshActiveAgentContext, removePath, renderThinAgent, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  ArtifactDefSchema,
5
5
  ChangeMetaSchema,
6
6
  ConfigSchema,
7
+ DEFAULT_INIT_INTEGRATION,
7
8
  GateSchema,
8
9
  PROTOCOL_MD,
9
10
  SDD_AGENT_ROLES,
@@ -37,6 +38,7 @@ import {
37
38
  getStage,
38
39
  inferComplexity,
39
40
  installAgentIntegrations,
41
+ integrationKeyFor,
40
42
  isInitialized,
41
43
  isStageSkipped,
42
44
  listChanges,
@@ -49,7 +51,9 @@ import {
49
51
  memoryDir,
50
52
  nextStageId,
51
53
  nowIso,
54
+ optionForTarget,
52
55
  parseAgentTargets,
56
+ parseIntegration,
53
57
  pathExists,
54
58
  previousStageId,
55
59
  projectPaths,
@@ -75,7 +79,7 @@ import {
75
79
  workflowsDir,
76
80
  writeText,
77
81
  writeYaml
78
- } from "./chunk-BP54LEAD.js";
82
+ } from "./chunk-32PIFJ2Y.js";
79
83
 
80
84
  // src/init.ts
81
85
  import { join as join2 } from "pathe";
@@ -342,6 +346,7 @@ export {
342
346
  ArtifactDefSchema,
343
347
  ChangeMetaSchema,
344
348
  ConfigSchema,
349
+ DEFAULT_INIT_INTEGRATION,
345
350
  GateSchema,
346
351
  PROTOCOL_MD,
347
352
  SDD_AGENT_ROLES,
@@ -380,6 +385,7 @@ export {
380
385
  inferComplexity,
381
386
  initProject,
382
387
  installAgentIntegrations,
388
+ integrationKeyFor,
383
389
  isInitialized,
384
390
  isStageSkipped,
385
391
  listChanges,
@@ -392,7 +398,9 @@ export {
392
398
  memoryDir,
393
399
  nextStageId,
394
400
  nowIso,
401
+ optionForTarget,
395
402
  parseAgentTargets,
403
+ parseIntegration,
396
404
  pathExists,
397
405
  previousStageId,
398
406
  projectPaths,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structured-vibe-coding/core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Core engine for structured vibe coding (local-first Spec-Driven Development)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",