@structured-vibe-coding/core 0.3.1 → 0.4.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.
@@ -1,16 +1,20 @@
1
1
  import {
2
+ AGENT_TARGET_OPTIONS,
2
3
  ALL_AGENT_TARGETS,
3
4
  PROTOCOL_MD,
4
5
  SDD_AGENT_ROLES,
5
6
  installAgentIntegrations,
7
+ parseAgentTargets,
6
8
  refreshActiveAgentContext,
7
9
  renderThinAgent
8
- } from "./chunk-ANNG5SIL.js";
10
+ } from "./chunk-M7DQT3X4.js";
9
11
  export {
12
+ AGENT_TARGET_OPTIONS,
10
13
  ALL_AGENT_TARGETS,
11
14
  PROTOCOL_MD,
12
15
  SDD_AGENT_ROLES,
13
16
  installAgentIntegrations,
17
+ parseAgentTargets,
14
18
  refreshActiveAgentContext,
15
19
  renderThinAgent
16
20
  };
@@ -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-AIH2DNH3.js");
521
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-ADF5FNBS.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-AIH2DNH3.js");
741
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-ADF5FNBS.js");
742
742
  await refreshActiveAgentContext2(projectRoot);
743
743
  } catch {
744
744
  }
@@ -960,7 +960,38 @@ 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 AGENT_TARGET_OPTIONS = [
965
+ {
966
+ id: "copilot",
967
+ label: "GitHub Copilot",
968
+ hint: ".github/agents/*.agent.md \u2014 works in VS Code, Cursor, JetBrains, \u2026"
969
+ },
970
+ {
971
+ id: "claude-code",
972
+ label: "Claude Code",
973
+ hint: ".claude/agents/*.md \u2014 CLI / terminal agent"
974
+ }
975
+ ];
976
+ function parseAgentTargets(raw) {
977
+ const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((s) => String(s).split(",")).map((s) => s.trim().toLowerCase()).filter(Boolean);
978
+ const out = [];
979
+ for (const p of parts) {
980
+ if (p === "intellij" || p === "idea" || p === "jetbrains" || p === "vscode" || p === "vs-code" || p === "cursor") {
981
+ throw new Error(
982
+ `"${p}" is an IDE, not an AI coding agent. Choose: copilot (GitHub Copilot in any IDE) or claude-code.`
983
+ );
984
+ }
985
+ const id = p === "claude" || p === "claude-code" || p === "claudecode" ? "claude-code" : p === "github-copilot" || p === "gh-copilot" || p === "copilot" ? "copilot" : p;
986
+ if (!ALL_AGENT_TARGETS.includes(id)) {
987
+ throw new Error(
988
+ `Unknown AI coding agent "${p}". Choose one of: ${ALL_AGENT_TARGETS.join(", ")}`
989
+ );
990
+ }
991
+ if (!out.includes(id)) out.push(id);
992
+ }
993
+ return out;
994
+ }
964
995
  var SDD_AGENT_ROLES = [
965
996
  {
966
997
  id: "sdd",
@@ -1001,7 +1032,12 @@ var SDD_AGENT_ROLES = [
1001
1032
  }
1002
1033
  ];
1003
1034
  async function installAgentIntegrations(opts) {
1004
- const targets = opts.targets?.length ? opts.targets : ALL_AGENT_TARGETS;
1035
+ if (!opts.targets?.length) {
1036
+ throw new Error(
1037
+ `Specify at least one AI coding agent: ${ALL_AGENT_TARGETS.join(", ")} (not an IDE; do not install all by default)`
1038
+ );
1039
+ }
1040
+ const targets = opts.targets;
1005
1041
  const created = [];
1006
1042
  const skipped = [];
1007
1043
  const root = opts.projectRoot;
@@ -1017,23 +1053,16 @@ async function installAgentIntegrations(opts) {
1017
1053
  };
1018
1054
  await write(join4(".sdd", "protocol.md"), PROTOCOL_MD);
1019
1055
  await refreshActiveAgentContext(root);
1020
- if (targets.includes("copilot") || targets.includes("claude-code")) {
1021
- for (const role of SDD_AGENT_ROLES) {
1022
- const body = renderThinAgent(role);
1023
- if (targets.includes("claude-code")) {
1024
- await write(`.claude/agents/${role.id}.md`, body);
1025
- }
1026
- if (targets.includes("copilot")) {
1027
- await write(`.github/agents/${role.id}.agent.md`, body);
1028
- }
1056
+ for (const role of SDD_AGENT_ROLES) {
1057
+ const body = renderThinAgent(role);
1058
+ if (targets.includes("claude-code")) {
1059
+ await write(`.claude/agents/${role.id}.md`, body);
1060
+ }
1061
+ if (targets.includes("copilot")) {
1062
+ await write(`.github/agents/${role.id}.agent.md`, body);
1029
1063
  }
1030
1064
  }
1031
- if (targets.includes("intellij")) {
1032
- await write(".idea/sdd-agent-notes.md", INTELLIJ_NOTES);
1033
- }
1034
- if (targets.includes("copilot") || targets.includes("claude-code") || targets.includes("intellij")) {
1035
- await write("AGENTS.md", AGENTS_MD_THIN);
1036
- }
1065
+ await write("AGENTS.md", renderAgentsMd(targets));
1037
1066
  await write(
1038
1067
  join4(".sdd", "agents.json"),
1039
1068
  JSON.stringify(
@@ -1178,31 +1207,36 @@ sdd complete
1178
1207
  - Deleting \`.sdd\` / archive history
1179
1208
  - Claiming complete without verify when required
1180
1209
  `;
1181
- var AGENTS_MD_THIN = `# Agents
1210
+ function renderAgentsMd(targets) {
1211
+ const rows = [];
1212
+ if (targets.includes("claude-code")) {
1213
+ rows.push(
1214
+ "| Claude Code | `.claude/agents/` (`sdd`, `sdd-planner`, `sdd-implementer`, `sdd-reviewer`) |"
1215
+ );
1216
+ }
1217
+ if (targets.includes("copilot")) {
1218
+ rows.push(
1219
+ "| GitHub Copilot | `.github/agents/*.agent.md` (same roles; any IDE that supports Copilot agents) |"
1220
+ );
1221
+ }
1222
+ return `# Agents
1182
1223
 
1183
1224
  This repo uses **SDD agents only** (no skills).
1184
1225
 
1226
+ AI coding agents are **not** the same as IDEs: VS Code, Cursor, and IntelliJ host tools like Copilot or Claude Code.
1227
+
1185
1228
  | Read first | |
1186
1229
  |------------|--|
1187
1230
  | Live task | \`.sdd/active-context.md\` |
1188
1231
  | Playbook | \`.sdd/protocol.md\` |
1189
1232
 
1190
- | Host | Agents |
1191
- |------|--------|
1192
- | Claude Code | \`.claude/agents/\` (\`sdd\`, \`sdd-planner\`, \`sdd-implementer\`, \`sdd-reviewer\`) |
1193
- | GitHub Copilot | \`.github/agents/*.agent.md\` (same roles) |
1233
+ | AI agent | Files |
1234
+ |----------|--------|
1235
+ ${rows.join("\n")}
1194
1236
 
1195
1237
  Refresh context: \`sdd agents refresh\`.
1196
1238
  `;
1197
- var INTELLIJ_NOTES = `# SDD + IntelliJ
1198
-
1199
- Agents only. Playbook: \`.sdd/protocol.md\`. Live: \`.sdd/active-context.md\`.
1200
-
1201
- 1. Install \`sdd\` on PATH: \`npm i -g @structured-vibe-coding/cli\`
1202
- 2. Tools \u2192 SDD \u2192 Initialize / Install Agent Integrations
1203
- 3. GitHub Copilot uses \`.github/agents/*\` + active-context (same as VS Code)
1204
- 4. After stage changes: **Refresh Agent Context**
1205
- `;
1239
+ }
1206
1240
 
1207
1241
  export {
1208
1242
  GateSchema,
@@ -1257,6 +1291,8 @@ export {
1257
1291
  changeDirName,
1258
1292
  uniqueChangeDirName,
1259
1293
  ALL_AGENT_TARGETS,
1294
+ AGENT_TARGET_OPTIONS,
1295
+ parseAgentTargets,
1260
1296
  SDD_AGENT_ROLES,
1261
1297
  installAgentIntegrations,
1262
1298
  renderThinAgent,
package/dist/index.d.ts CHANGED
@@ -1164,8 +1164,20 @@ 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
+ type AgentTarget = "copilot" | "claude-code";
1168
1172
  declare const ALL_AGENT_TARGETS: AgentTarget[];
1173
+ /** Human-facing labels for interactive AI-agent pick (CLI / IDE). */
1174
+ declare const AGENT_TARGET_OPTIONS: {
1175
+ id: AgentTarget;
1176
+ label: string;
1177
+ hint: string;
1178
+ }[];
1179
+ /** Parse `copilot`, `claude-code,copilot`, etc. Throws on unknown ids. */
1180
+ declare function parseAgentTargets(raw: string | string[]): AgentTarget[];
1169
1181
  /** Roles emitted as thin agents (shared body generator — no skill files). */
1170
1182
  type SddAgentRoleId = "sdd" | "sdd-planner" | "sdd-implementer" | "sdd-reviewer";
1171
1183
  interface SddAgentRole {
@@ -1205,8 +1217,13 @@ interface InitOptions {
1205
1217
  projectRoot: string;
1206
1218
  force?: boolean;
1207
1219
  pack?: "default" | "enterprise";
1208
- /** Install Copilot / Claude Code / IntelliJ agent files (default: all). */
1209
- agents?: boolean | AgentTarget[];
1220
+ /**
1221
+ * AI coding agents to install (copilot | claude-code). Not IDEs.
1222
+ * Opt-in only — never defaults to all agents.
1223
+ * - omit / `false` — no agent files
1224
+ * - `AgentTarget[]` — install only those AI agents
1225
+ */
1226
+ agents?: false | AgentTarget[];
1210
1227
  }
1211
1228
  interface InitResult {
1212
1229
  created: string[];
@@ -1264,4 +1281,4 @@ declare function listFiles(path: string): Promise<string[]>;
1264
1281
  declare function copyDir(src: string, dest: string): Promise<void>;
1265
1282
  declare function removePath(path: string): Promise<void>;
1266
1283
 
1267
- export { 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, 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 };
1284
+ 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 };
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ AGENT_TARGET_OPTIONS,
2
3
  ALL_AGENT_TARGETS,
3
4
  ArtifactDefSchema,
4
5
  ChangeMetaSchema,
@@ -48,6 +49,7 @@ import {
48
49
  memoryDir,
49
50
  nextStageId,
50
51
  nowIso,
52
+ parseAgentTargets,
51
53
  pathExists,
52
54
  previousStageId,
53
55
  projectPaths,
@@ -73,7 +75,7 @@ import {
73
75
  workflowsDir,
74
76
  writeText,
75
77
  writeYaml
76
- } from "./chunk-ANNG5SIL.js";
78
+ } from "./chunk-M7DQT3X4.js";
77
79
 
78
80
  // src/init.ts
79
81
  import { join as join2 } from "pathe";
@@ -192,11 +194,10 @@ sdd complete
192
194
  created.push(sddReadme);
193
195
  }
194
196
  let agentsResult;
195
- if (opts.agents !== false) {
196
- const targets = Array.isArray(opts.agents) && opts.agents.length ? opts.agents : void 0;
197
+ if (Array.isArray(opts.agents) && opts.agents.length > 0) {
197
198
  const ag = await installAgentIntegrations({
198
199
  projectRoot,
199
- targets,
200
+ targets: opts.agents,
200
201
  force
201
202
  });
202
203
  created.push(...ag.created);
@@ -336,6 +337,7 @@ ${output}`
336
337
  };
337
338
  }
338
339
  export {
340
+ AGENT_TARGET_OPTIONS,
339
341
  ALL_AGENT_TARGETS,
340
342
  ArtifactDefSchema,
341
343
  ChangeMetaSchema,
@@ -390,6 +392,7 @@ export {
390
392
  memoryDir,
391
393
  nextStageId,
392
394
  nowIso,
395
+ parseAgentTargets,
393
396
  pathExists,
394
397
  previousStageId,
395
398
  projectPaths,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structured-vibe-coding/core",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "Core engine for structured vibe coding (local-first Spec-Driven Development)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",