@structured-vibe-coding/core 0.5.1 → 0.5.3

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.
package/dist/index.d.ts CHANGED
@@ -1103,15 +1103,6 @@ declare function recommendWorkflow(projectRoot: string, title: string, config: C
1103
1103
  alternatives: string[];
1104
1104
  }>;
1105
1105
 
1106
- interface CreateChangeInput {
1107
- projectRoot: string;
1108
- config: Config;
1109
- title: string;
1110
- workflowName: string;
1111
- domain?: string;
1112
- flags?: Record<string, boolean | string | number>;
1113
- branch?: string;
1114
- }
1115
1106
  interface ChangeContext {
1116
1107
  id: string;
1117
1108
  path: string;
@@ -1120,16 +1111,35 @@ interface ChangeContext {
1120
1111
  stages: Stage[];
1121
1112
  active: Stage[];
1122
1113
  }
1123
- declare function createChange(input: CreateChangeInput): Promise<ChangeContext>;
1124
1114
  declare function loadChangeMeta(projectRoot: string, config: Config, changeId: string): Promise<ChangeMeta>;
1125
1115
  declare function saveChangeMeta(projectRoot: string, config: Config, meta: ChangeMeta): Promise<void>;
1126
1116
  declare function buildContext(projectRoot: string, config: Config, changeId: string): Promise<ChangeContext>;
1127
1117
  declare function listChanges(projectRoot: string, config: Config): Promise<string[]>;
1128
1118
  declare function getActiveChangeId(projectRoot: string, config: Config): Promise<string | null>;
1129
- /** Clear active pointer if it points at this change id (does not re-resolve). */
1130
1119
  declare function clearActiveIf(projectRoot: string, config: Config, changeId: string): Promise<void>;
1131
1120
  declare function setActiveChange(projectRoot: string, config: Config, changeId: string): Promise<void>;
1132
1121
  declare function resolveChangeId(projectRoot: string, config: Config, changeId?: string): Promise<string>;
1122
+
1123
+ /** Artifact + gate + verify checks before leaving the current stage. */
1124
+ declare function canLeaveStage(ctx: ChangeContext, config: Config): Promise<{
1125
+ ok: boolean;
1126
+ errors: string[];
1127
+ warnings: string[];
1128
+ }>;
1129
+ declare function approveGate(projectRoot: string, config: Config, changeId: string, stageId: string | undefined, note?: string, status?: "approved" | "waived" | "failed"): Promise<ChangeContext>;
1130
+
1131
+ declare function formatStatus(ctx: ChangeContext): string;
1132
+ declare function buildAgentPrompt(ctx: ChangeContext, config: Config, projectRoot: string): Promise<string>;
1133
+
1134
+ interface CreateChangeInput {
1135
+ projectRoot: string;
1136
+ config: Config;
1137
+ title: string;
1138
+ workflowName: string;
1139
+ domain?: string;
1140
+ flags?: Record<string, boolean | string | number>;
1141
+ branch?: string;
1142
+ }
1133
1143
  interface AdvanceResult {
1134
1144
  ctx: ChangeContext;
1135
1145
  from: string;
@@ -1138,88 +1148,101 @@ interface AdvanceResult {
1138
1148
  artifactsCreated: string[];
1139
1149
  warnings: string[];
1140
1150
  }
1141
- declare function canLeaveStage(ctx: ChangeContext, config: Config): Promise<{
1142
- ok: boolean;
1143
- errors: string[];
1144
- warnings: string[];
1145
- }>;
1151
+ declare function createChange(input: CreateChangeInput): Promise<ChangeContext>;
1146
1152
  declare function advanceStage(projectRoot: string, config: Config, changeId: string, opts?: {
1147
1153
  force?: boolean;
1148
1154
  }): Promise<AdvanceResult>;
1149
1155
  declare function skipStage(projectRoot: string, config: Config, changeId: string, stageId: string, reason: string): Promise<ChangeContext>;
1150
1156
  declare function switchWorkflow(projectRoot: string, config: Config, changeId: string, workflowName: string, reason?: string): Promise<ChangeContext>;
1151
- declare function approveGate(projectRoot: string, config: Config, changeId: string, stageId: string | undefined, note?: string, status?: "approved" | "waived" | "failed"): Promise<ChangeContext>;
1152
1157
  declare function completeChange(projectRoot: string, config: Config, changeId: string): Promise<{
1153
1158
  archivedTo: string | null;
1154
1159
  ctx: ChangeContext;
1155
1160
  }>;
1156
- declare function formatStatus(ctx: ChangeContext): string;
1157
- declare function buildAgentPrompt(ctx: ChangeContext, config: Config, projectRoot: string): Promise<string>;
1158
1161
 
1159
1162
  /**
1160
1163
  * AI coding agents (not IDEs).
1161
- * VS Code / Cursor / IntelliJ are editors; they host tools like Copilot or Claude Code.
1162
- *
1163
1164
  * Speckit-style: one integration at a time; public keys are short (`copilot`, `claude`).
1164
1165
  */
1165
1166
  type AgentTarget = "copilot" | "claude-code";
1166
- declare const ALL_AGENT_TARGETS: AgentTarget[];
1167
- /** Default when non-interactive and no --ai / --integration (matches Speckit). */
1168
- declare const DEFAULT_INIT_INTEGRATION: AgentTarget;
1169
- interface AgentTargetOption {
1170
- /** Internal install id (file paths / agents.json). */
1167
+ /** Registry entry — add a new AI agent by appending here only. */
1168
+ interface AgentIntegration {
1171
1169
  id: AgentTarget;
1172
- /** Speckit-style public key used with --ai / --integration. */
1170
+ /** Speckit-style public key (`--ai` / `--integration`). */
1173
1171
  key: string;
1172
+ aliases: string[];
1174
1173
  label: string;
1175
1174
  hint: string;
1176
- /** If true, CLI may check that the agent binary is on PATH. */
1177
1175
  requiresCli: boolean;
1178
1176
  installUrl: string;
1177
+ /** Binary name when requiresCli (e.g. `claude`). */
1178
+ cliBinary?: string;
1179
+ /** Relative path for a thin role agent file. */
1180
+ rolePath: (roleId: string) => string;
1181
+ /** One markdown table row for AGENTS.md. */
1182
+ agentsMdRow: string;
1179
1183
  }
1180
- /** Human-facing options for interactive AI-agent pick (CLI / IDE). */
1184
+ declare const AGENT_INTEGRATIONS: AgentIntegration[];
1185
+ declare const ALL_AGENT_TARGETS: AgentTarget[];
1186
+ /** Default when non-interactive and no --ai (matches Speckit). */
1187
+ declare const DEFAULT_INIT_INTEGRATION: AgentTarget;
1188
+ /** @deprecated Prefer AgentIntegration / AGENT_INTEGRATIONS — kept for UI option lists. */
1189
+ type AgentTargetOption = Pick<AgentIntegration, "id" | "key" | "label" | "hint" | "requiresCli" | "installUrl">;
1181
1190
  declare const AGENT_TARGET_OPTIONS: AgentTargetOption[];
1182
- /** Public CLI keys → internal targets (Speckit uses `claude`, not `claude-code`). */
1191
+ declare function getIntegration(target: AgentTarget): AgentIntegration;
1183
1192
  declare function integrationKeyFor(target: AgentTarget): string;
1184
- declare function optionForTarget(target: AgentTarget): AgentTargetOption | undefined;
1193
+ declare function optionForTarget(target: AgentTarget): AgentTargetOption;
1194
+ /** Parse one Speckit-style integration key. */
1195
+ declare function parseIntegration(raw: string): AgentTarget;
1185
1196
  /**
1186
- * Parse Speckit-style integration keys: `copilot`, `claude`, `claude-code`, …
1187
- * Throws on unknown ids or IDE names.
1197
+ * Parse one or more keys (comma-separated). Prefer parseIntegration for product flows.
1198
+ * @deprecated Multi-install is not the product default; use parseIntegration.
1188
1199
  */
1189
1200
  declare function parseAgentTargets(raw: string | string[]): AgentTarget[];
1190
- /** Parse a single Speckit-style integration (exactly one). */
1191
- declare function parseIntegration(raw: string): AgentTarget;
1192
- /** Roles emitted as thin agents (shared body generator — no skill files). */
1201
+ /** Roles emitted as thin agents (shared body generator). */
1193
1202
  type SddAgentRoleId = "sdd" | "sdd-planner" | "sdd-implementer" | "sdd-reviewer";
1194
1203
  interface SddAgentRole {
1195
1204
  id: SddAgentRoleId;
1196
1205
  description: string;
1197
1206
  roleLine: string;
1198
- /** Extra one-liner constraints for this role only */
1199
1207
  roleRules: string[];
1200
1208
  }
1201
1209
  declare const SDD_AGENT_ROLES: SddAgentRole[];
1202
- interface InstallAgentsOptions {
1210
+ interface InstallAgentOptions {
1203
1211
  projectRoot: string;
1204
- targets?: AgentTarget[];
1212
+ /** Single AI coding agent (Speckit-style). */
1213
+ target: AgentTarget;
1205
1214
  force?: boolean;
1206
1215
  }
1207
- interface InstallAgentsResult {
1216
+ interface InstallAgentResult {
1208
1217
  created: string[];
1209
1218
  skipped: string[];
1210
- targets: AgentTarget[];
1219
+ target: AgentTarget;
1211
1220
  }
1221
+ /** @deprecated Use InstallAgentOptions / installAgentIntegration. */
1222
+ type InstallAgentsOptions = {
1223
+ projectRoot: string;
1224
+ targets?: AgentTarget[];
1225
+ force?: boolean;
1226
+ };
1227
+ /** @deprecated Use InstallAgentResult. */
1228
+ type InstallAgentsResult = {
1229
+ created: string[];
1230
+ skipped: string[];
1231
+ targets: AgentTarget[];
1232
+ };
1233
+ /**
1234
+ * Install thin agents for **one** AI integration (registry-driven).
1235
+ * Writes protocol + active-context + role stubs + single `.sdd/agents.json` snapshot.
1236
+ */
1237
+ declare function installAgentIntegration(opts: InstallAgentOptions): Promise<InstallAgentResult>;
1212
1238
  /**
1213
- * Install **agents only** (no skills, no fat instructions).
1214
- *
1215
- * Single playbook: `.sdd/protocol.md`
1216
- * Live state: `.sdd/active-context.md`
1217
- * Thin agents: `.claude/agents/*` and `.github/agents/*` (pointers + role)
1239
+ * Install one or more integrations (writes each host's files; snapshot = last target).
1240
+ * Prefer installAgentIntegration for product flows.
1218
1241
  */
1219
1242
  declare function installAgentIntegrations(opts: InstallAgentsOptions): Promise<InstallAgentsResult>;
1220
- /** Thin agent body shared by Claude Code and GitHub Copilot (same text). */
1243
+ /** Thin agent body shared across hosts (same text). */
1221
1244
  declare function renderThinAgent(role: SddAgentRole): string;
1222
- /** Write .sdd/active-context.md for the current change (all agents read this). */
1245
+ /** Write .sdd/active-context.md for the current change. */
1223
1246
  declare function refreshActiveAgentContext(projectRoot: string): Promise<string | null>;
1224
1247
  /** Single playbook — only long agent-facing content we author once. */
1225
1248
  declare const PROTOCOL_MD = "# SDD protocol\n\nThis repo uses **Structured Vibe Coding** (`sdd`). Agents must follow this file plus `.sdd/active-context.md`. Do not invent a parallel process.\n\n## Source of truth\n\n| What | Where |\n|------|--------|\n| Process state | `changes/<id>/meta.yaml` (workflow, stage, gates) |\n| Current task snapshot | `.sdd/active-context.md` |\n| Stable product/tech rules | `memory/*.md` |\n| Stage artifacts | files in `changes/<id>/` for the active change |\n\n## Required read order\n\n1. `.sdd/active-context.md`\n2. This file (`.sdd/protocol.md`)\n3. `meta.yaml` + artifacts for the **current stage** (and prior stages if needed)\n4. `memory/` when architecture or conventions matter\n\n## Stage behavior\n\n| Stage kind | Agent focus |\n|------------|-------------|\n| intent / feature / stories | Clarify scope; write short artifacts |\n| design / lld / db / research / hl_arb | Specs and decisions; minimal product code |\n| tasks | Break work into implementable checklist |\n| implement | Code only for this change; follow tasks/acceptance |\n| local_verify | Check acceptance; fix only; prepare for complete |\n\n## Hard rules\n\n1. **Do not skip hard gates.** If blocked, tell the human to run `sdd gate approve` (or fix the gate).\n2. **Stay in scope** of the active change title/intent. No drive-by refactors or new features.\n3. **Honor constraints** in `arb-decision.md`, design, and memory non-negotiables.\n4. **Local verify** is part of done when the workflow has a verify stage: `sdd verify`.\n5. Prefer small, reviewable diffs.\n\n## Commands (human / shell)\n\n```bash\nsdd status\nsdd next\nsdd agent # print handoff\nsdd agents refresh # refresh active-context.md\nsdd verify\nsdd complete\n```\n\n## Out of scope for agents\n\n- Replacing CI/CD or team process tools\n- Deleting `.sdd` / archive history\n- Claiming complete without verify when required\n";
@@ -1228,12 +1251,11 @@ interface InitOptions {
1228
1251
  projectRoot: string;
1229
1252
  force?: boolean;
1230
1253
  /**
1231
- * AI coding agents to install (copilot | claude-code). Not IDEs.
1232
- * Opt-in only — never defaults to all agents.
1254
+ * AI coding agent to install (single, Speckit-style). Not an IDE.
1233
1255
  * - omit / `false` — no agent files
1234
- * - `AgentTarget[]` — install only those AI agents
1256
+ * - `AgentTarget` — install that integration only
1235
1257
  */
1236
- agents?: false | AgentTarget[];
1258
+ agents?: false | AgentTarget;
1237
1259
  }
1238
1260
  interface InitResult {
1239
1261
  created: string[];
@@ -1291,4 +1313,4 @@ declare function listFiles(path: string): Promise<string[]>;
1291
1313
  declare function copyDir(src: string, dest: string): Promise<void>;
1292
1314
  declare function removePath(path: string): Promise<void>;
1293
1315
 
1294
- 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, readText, readYaml, recommendWorkflow, refreshActiveAgentContext, removePath, renderThinAgent, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };
1316
+ export { AGENT_INTEGRATIONS, AGENT_TARGET_OPTIONS, ALL_AGENT_TARGETS, type AdvanceResult, type AgentIntegration, 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 InstallAgentOptions, type InstallAgentResult, 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, getIntegration, getStage, inferComplexity, initProject, installAgentIntegration, installAgentIntegrations, integrationKeyFor, isInitialized, isStageSkipped, listChanges, listDirs, listFiles, listWorkflowNames, loadChangeMeta, loadConfig, loadWorkflow, memoryDir, nextStageId, nowIso, optionForTarget, parseAgentTargets, parseIntegration, pathExists, readText, readYaml, recommendWorkflow, refreshActiveAgentContext, removePath, renderThinAgent, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };