@structured-vibe-coding/core 0.4.1 → 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-M7DQT3X4.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-ADF5FNBS.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-ADF5FNBS.js");
741
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-SVTCSTX4.js");
742
742
  await refreshActiveAgentContext2(projectRoot);
743
743
  } catch {
744
744
  }
@@ -961,37 +961,58 @@ async function buildAgentPrompt(ctx, config, projectRoot) {
961
961
 
962
962
  // src/agents.ts
963
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 \u2014 works in VS Code, Cursor, JetBrains, \u2026"
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 \u2014 CLI / terminal agent"
978
+ hint: ".claude/agents/*.md (terminal agent)",
979
+ requiresCli: true,
980
+ installUrl: "https://docs.anthropic.com/en/docs/claude-code"
974
981
  }
975
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
+ }
976
989
  function parseAgentTargets(raw) {
977
990
  const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((s) => String(s).split(",")).map((s) => s.trim().toLowerCase()).filter(Boolean);
978
991
  const out = [];
979
992
  for (const p of parts) {
980
993
  if (p === "intellij" || p === "idea" || p === "jetbrains" || p === "vscode" || p === "vs-code" || p === "cursor") {
981
994
  throw new Error(
982
- `"${p}" is an IDE, not an AI coding agent. Choose: copilot (GitHub Copilot in any IDE) or claude-code.`
995
+ `"${p}" is an IDE, not an AI coding agent. Choose: copilot or claude (Claude Code).`
983
996
  );
984
997
  }
985
998
  const id = p === "claude" || p === "claude-code" || p === "claudecode" ? "claude-code" : p === "github-copilot" || p === "gh-copilot" || p === "copilot" ? "copilot" : p;
986
999
  if (!ALL_AGENT_TARGETS.includes(id)) {
987
- throw new Error(
988
- `Unknown AI coding agent "${p}". Choose one of: ${ALL_AGENT_TARGETS.join(", ")}`
989
- );
1000
+ const keys = AGENT_TARGET_OPTIONS.map((o) => o.key).join(", ");
1001
+ throw new Error(`Unknown AI coding agent "${p}". Choose from: ${keys}`);
990
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",
@@ -1073,6 +1094,21 @@ async function installAgentIntegrations(opts) {
1073
1094
  activeContext: ".sdd/active-context.md",
1074
1095
  roles: SDD_AGENT_ROLES.map((r) => r.id),
1075
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),
1076
1112
  updated: (/* @__PURE__ */ new Date()).toISOString()
1077
1113
  },
1078
1114
  null,
@@ -1291,8 +1327,12 @@ export {
1291
1327
  changeDirName,
1292
1328
  uniqueChangeDirName,
1293
1329
  ALL_AGENT_TARGETS,
1330
+ DEFAULT_INIT_INTEGRATION,
1294
1331
  AGENT_TARGET_OPTIONS,
1332
+ integrationKeyFor,
1333
+ optionForTarget,
1295
1334
  parseAgentTargets,
1335
+ parseIntegration,
1296
1336
  SDD_AGENT_ROLES,
1297
1337
  installAgentIntegrations,
1298
1338
  renderThinAgent,
package/dist/index.d.ts CHANGED
@@ -1167,17 +1167,36 @@ declare function buildAgentPrompt(ctx: ChangeContext, config: Config, projectRoo
1167
1167
  /**
1168
1168
  * AI coding agents (not IDEs).
1169
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`).
1170
1172
  */
1171
1173
  type AgentTarget = "copilot" | "claude-code";
1172
1174
  declare const ALL_AGENT_TARGETS: AgentTarget[];
1173
- /** Human-facing labels for interactive AI-agent pick (CLI / IDE). */
1174
- 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). */
1175
1179
  id: AgentTarget;
1180
+ /** Speckit-style public key used with --ai / --integration. */
1181
+ key: string;
1176
1182
  label: string;
1177
1183
  hint: string;
1178
- }[];
1179
- /** 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
+ */
1180
1197
  declare function parseAgentTargets(raw: string | string[]): AgentTarget[];
1198
+ /** Parse a single Speckit-style integration (exactly one). */
1199
+ declare function parseIntegration(raw: string): AgentTarget;
1181
1200
  /** Roles emitted as thin agents (shared body generator — no skill files). */
1182
1201
  type SddAgentRoleId = "sdd" | "sdd-planner" | "sdd-implementer" | "sdd-reviewer";
1183
1202
  interface SddAgentRole {
@@ -1281,4 +1300,4 @@ declare function listFiles(path: string): Promise<string[]>;
1281
1300
  declare function copyDir(src: string, dest: string): Promise<void>;
1282
1301
  declare function removePath(path: string): Promise<void>;
1283
1302
 
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 };
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-M7DQT3X4.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.1",
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",