@structured-vibe-coding/core 0.4.1 → 0.5.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,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-
|
|
14
|
+
} from "./chunk-IO6AS6JI.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
|
};
|
|
@@ -255,15 +255,6 @@ async function saveConfig(projectRoot, config) {
|
|
|
255
255
|
function defaultConfig() {
|
|
256
256
|
return ConfigSchema.parse({});
|
|
257
257
|
}
|
|
258
|
-
function projectPaths(projectRoot, config) {
|
|
259
|
-
return {
|
|
260
|
-
sdd: sddRoot(projectRoot),
|
|
261
|
-
config: configPath(projectRoot),
|
|
262
|
-
workflows: workflowsDir(projectRoot),
|
|
263
|
-
templates: templatesDir(projectRoot),
|
|
264
|
-
memory: memoryDir(projectRoot, config)
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
258
|
|
|
268
259
|
// src/change.ts
|
|
269
260
|
import { join as join3 } from "pathe";
|
|
@@ -364,17 +355,6 @@ function nextStageId(workflow, meta) {
|
|
|
364
355
|
}
|
|
365
356
|
return null;
|
|
366
357
|
}
|
|
367
|
-
function previousStageId(workflow, meta) {
|
|
368
|
-
const all = resolveStages(workflow, meta);
|
|
369
|
-
const activeIds = new Set(activeStages(workflow, meta).map((s) => s.id));
|
|
370
|
-
const start = all.findIndex((s) => s.id === meta.stage);
|
|
371
|
-
if (start <= 0) return null;
|
|
372
|
-
for (let i = start - 1; i >= 0; i--) {
|
|
373
|
-
const id = all[i].id;
|
|
374
|
-
if (activeIds.has(id)) return id;
|
|
375
|
-
}
|
|
376
|
-
return null;
|
|
377
|
-
}
|
|
378
358
|
function firstActiveStageId(workflow, meta) {
|
|
379
359
|
return activeStages(workflow, meta)[0]?.id ?? null;
|
|
380
360
|
}
|
|
@@ -518,7 +498,7 @@ async function createChange(input) {
|
|
|
518
498
|
await materializeStageArtifacts(projectRoot, config, id, workflow, meta, firstStage);
|
|
519
499
|
await setActiveChange(projectRoot, config, id);
|
|
520
500
|
try {
|
|
521
|
-
const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-
|
|
501
|
+
const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-MIMBQVHE.js");
|
|
522
502
|
await refreshActiveAgentContext2(projectRoot);
|
|
523
503
|
} catch {
|
|
524
504
|
}
|
|
@@ -738,7 +718,7 @@ async function advanceStage(projectRoot, config, changeId, opts) {
|
|
|
738
718
|
stage
|
|
739
719
|
);
|
|
740
720
|
try {
|
|
741
|
-
const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-
|
|
721
|
+
const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-MIMBQVHE.js");
|
|
742
722
|
await refreshActiveAgentContext2(projectRoot);
|
|
743
723
|
} catch {
|
|
744
724
|
}
|
|
@@ -961,37 +941,58 @@ async function buildAgentPrompt(ctx, config, projectRoot) {
|
|
|
961
941
|
|
|
962
942
|
// src/agents.ts
|
|
963
943
|
var ALL_AGENT_TARGETS = ["copilot", "claude-code"];
|
|
944
|
+
var DEFAULT_INIT_INTEGRATION = "copilot";
|
|
964
945
|
var AGENT_TARGET_OPTIONS = [
|
|
965
946
|
{
|
|
966
947
|
id: "copilot",
|
|
948
|
+
key: "copilot",
|
|
967
949
|
label: "GitHub Copilot",
|
|
968
|
-
hint: ".github/agents/*.agent.md
|
|
950
|
+
hint: ".github/agents/*.agent.md (VS Code, Cursor, JetBrains, \u2026)",
|
|
951
|
+
requiresCli: false,
|
|
952
|
+
installUrl: "https://github.com/features/copilot"
|
|
969
953
|
},
|
|
970
954
|
{
|
|
971
955
|
id: "claude-code",
|
|
956
|
+
key: "claude",
|
|
972
957
|
label: "Claude Code",
|
|
973
|
-
hint: ".claude/agents/*.md
|
|
958
|
+
hint: ".claude/agents/*.md (terminal agent)",
|
|
959
|
+
requiresCli: true,
|
|
960
|
+
installUrl: "https://docs.anthropic.com/en/docs/claude-code"
|
|
974
961
|
}
|
|
975
962
|
];
|
|
963
|
+
function integrationKeyFor(target) {
|
|
964
|
+
return AGENT_TARGET_OPTIONS.find((o) => o.id === target)?.key ?? target;
|
|
965
|
+
}
|
|
966
|
+
function optionForTarget(target) {
|
|
967
|
+
return AGENT_TARGET_OPTIONS.find((o) => o.id === target);
|
|
968
|
+
}
|
|
976
969
|
function parseAgentTargets(raw) {
|
|
977
970
|
const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((s) => String(s).split(",")).map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
978
971
|
const out = [];
|
|
979
972
|
for (const p of parts) {
|
|
980
973
|
if (p === "intellij" || p === "idea" || p === "jetbrains" || p === "vscode" || p === "vs-code" || p === "cursor") {
|
|
981
974
|
throw new Error(
|
|
982
|
-
`"${p}" is an IDE, not an AI coding agent. Choose: copilot
|
|
975
|
+
`"${p}" is an IDE, not an AI coding agent. Choose: copilot or claude (Claude Code).`
|
|
983
976
|
);
|
|
984
977
|
}
|
|
985
978
|
const id = p === "claude" || p === "claude-code" || p === "claudecode" ? "claude-code" : p === "github-copilot" || p === "gh-copilot" || p === "copilot" ? "copilot" : p;
|
|
986
979
|
if (!ALL_AGENT_TARGETS.includes(id)) {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
);
|
|
980
|
+
const keys = AGENT_TARGET_OPTIONS.map((o) => o.key).join(", ");
|
|
981
|
+
throw new Error(`Unknown AI coding agent "${p}". Choose from: ${keys}`);
|
|
990
982
|
}
|
|
991
983
|
if (!out.includes(id)) out.push(id);
|
|
992
984
|
}
|
|
993
985
|
return out;
|
|
994
986
|
}
|
|
987
|
+
function parseIntegration(raw) {
|
|
988
|
+
const list = parseAgentTargets(raw);
|
|
989
|
+
if (list.length !== 1) {
|
|
990
|
+
throw new Error(
|
|
991
|
+
`Expected one AI coding agent (like Speckit --integration), got: ${raw}`
|
|
992
|
+
);
|
|
993
|
+
}
|
|
994
|
+
return list[0];
|
|
995
|
+
}
|
|
995
996
|
var SDD_AGENT_ROLES = [
|
|
996
997
|
{
|
|
997
998
|
id: "sdd",
|
|
@@ -1073,6 +1074,21 @@ async function installAgentIntegrations(opts) {
|
|
|
1073
1074
|
activeContext: ".sdd/active-context.md",
|
|
1074
1075
|
roles: SDD_AGENT_ROLES.map((r) => r.id),
|
|
1075
1076
|
installed: targets,
|
|
1077
|
+
/** Speckit-style primary integration key (first target). */
|
|
1078
|
+
integration: targets[0] ? integrationKeyFor(targets[0]) : null,
|
|
1079
|
+
updated: (/* @__PURE__ */ new Date()).toISOString()
|
|
1080
|
+
},
|
|
1081
|
+
null,
|
|
1082
|
+
2
|
|
1083
|
+
) + "\n"
|
|
1084
|
+
);
|
|
1085
|
+
await write(
|
|
1086
|
+
join4(".sdd", "init-options.json"),
|
|
1087
|
+
JSON.stringify(
|
|
1088
|
+
{
|
|
1089
|
+
ai: targets[0] ? integrationKeyFor(targets[0]) : null,
|
|
1090
|
+
integration: targets[0] ? integrationKeyFor(targets[0]) : null,
|
|
1091
|
+
installed: targets.map(integrationKeyFor),
|
|
1076
1092
|
updated: (/* @__PURE__ */ new Date()).toISOString()
|
|
1077
1093
|
},
|
|
1078
1094
|
null,
|
|
@@ -1272,7 +1288,6 @@ export {
|
|
|
1272
1288
|
loadConfig,
|
|
1273
1289
|
saveConfig,
|
|
1274
1290
|
defaultConfig,
|
|
1275
|
-
projectPaths,
|
|
1276
1291
|
listWorkflowNames,
|
|
1277
1292
|
loadWorkflow,
|
|
1278
1293
|
resolveStages,
|
|
@@ -1281,7 +1296,6 @@ export {
|
|
|
1281
1296
|
activeStages,
|
|
1282
1297
|
getStage,
|
|
1283
1298
|
nextStageId,
|
|
1284
|
-
previousStageId,
|
|
1285
1299
|
firstActiveStageId,
|
|
1286
1300
|
inferComplexity,
|
|
1287
1301
|
recommendWorkflow,
|
|
@@ -1291,8 +1305,12 @@ export {
|
|
|
1291
1305
|
changeDirName,
|
|
1292
1306
|
uniqueChangeDirName,
|
|
1293
1307
|
ALL_AGENT_TARGETS,
|
|
1308
|
+
DEFAULT_INIT_INTEGRATION,
|
|
1294
1309
|
AGENT_TARGET_OPTIONS,
|
|
1310
|
+
integrationKeyFor,
|
|
1311
|
+
optionForTarget,
|
|
1295
1312
|
parseAgentTargets,
|
|
1313
|
+
parseIntegration,
|
|
1296
1314
|
SDD_AGENT_ROLES,
|
|
1297
1315
|
installAgentIntegrations,
|
|
1298
1316
|
renderThinAgent,
|
package/dist/index.d.ts
CHANGED
|
@@ -1073,13 +1073,6 @@ declare function isInitialized(projectRoot: string): Promise<boolean>;
|
|
|
1073
1073
|
declare function loadConfig(projectRoot: string): Promise<Config>;
|
|
1074
1074
|
declare function saveConfig(projectRoot: string, config: Config): Promise<void>;
|
|
1075
1075
|
declare function defaultConfig(): Config;
|
|
1076
|
-
declare function projectPaths(projectRoot: string, config: Config): {
|
|
1077
|
-
sdd: string;
|
|
1078
|
-
config: string;
|
|
1079
|
-
workflows: string;
|
|
1080
|
-
templates: string;
|
|
1081
|
-
memory: string;
|
|
1082
|
-
};
|
|
1083
1076
|
|
|
1084
1077
|
declare function listWorkflowNames(projectRoot: string): Promise<string[]>;
|
|
1085
1078
|
declare function loadWorkflow(projectRoot: string, name: string): Promise<Workflow>;
|
|
@@ -1096,7 +1089,6 @@ declare function getStage(workflow: Workflow, meta: ChangeMeta, stageId: string)
|
|
|
1096
1089
|
* forward from its position in the full stage list (does not jump back to first).
|
|
1097
1090
|
*/
|
|
1098
1091
|
declare function nextStageId(workflow: Workflow, meta: ChangeMeta): string | null;
|
|
1099
|
-
declare function previousStageId(workflow: Workflow, meta: ChangeMeta): string | null;
|
|
1100
1092
|
/** First active stage (honors skip / skip_when). */
|
|
1101
1093
|
declare function firstActiveStageId(workflow: Workflow, meta: ChangeMeta): string | null;
|
|
1102
1094
|
declare function inferComplexity(title: string, hints?: {
|
|
@@ -1167,17 +1159,36 @@ declare function buildAgentPrompt(ctx: ChangeContext, config: Config, projectRoo
|
|
|
1167
1159
|
/**
|
|
1168
1160
|
* AI coding agents (not IDEs).
|
|
1169
1161
|
* VS Code / Cursor / IntelliJ are editors; they host tools like Copilot or Claude Code.
|
|
1162
|
+
*
|
|
1163
|
+
* Speckit-style: one integration at a time; public keys are short (`copilot`, `claude`).
|
|
1170
1164
|
*/
|
|
1171
1165
|
type AgentTarget = "copilot" | "claude-code";
|
|
1172
1166
|
declare const ALL_AGENT_TARGETS: AgentTarget[];
|
|
1173
|
-
/**
|
|
1174
|
-
declare const
|
|
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). */
|
|
1175
1171
|
id: AgentTarget;
|
|
1172
|
+
/** Speckit-style public key used with --ai / --integration. */
|
|
1173
|
+
key: string;
|
|
1176
1174
|
label: string;
|
|
1177
1175
|
hint: string;
|
|
1178
|
-
|
|
1179
|
-
|
|
1176
|
+
/** If true, CLI may check that the agent binary is on PATH. */
|
|
1177
|
+
requiresCli: boolean;
|
|
1178
|
+
installUrl: string;
|
|
1179
|
+
}
|
|
1180
|
+
/** Human-facing options for interactive AI-agent pick (CLI / IDE). */
|
|
1181
|
+
declare const AGENT_TARGET_OPTIONS: AgentTargetOption[];
|
|
1182
|
+
/** Public CLI keys → internal targets (Speckit uses `claude`, not `claude-code`). */
|
|
1183
|
+
declare function integrationKeyFor(target: AgentTarget): string;
|
|
1184
|
+
declare function optionForTarget(target: AgentTarget): AgentTargetOption | undefined;
|
|
1185
|
+
/**
|
|
1186
|
+
* Parse Speckit-style integration keys: `copilot`, `claude`, `claude-code`, …
|
|
1187
|
+
* Throws on unknown ids or IDE names.
|
|
1188
|
+
*/
|
|
1180
1189
|
declare function parseAgentTargets(raw: string | string[]): AgentTarget[];
|
|
1190
|
+
/** Parse a single Speckit-style integration (exactly one). */
|
|
1191
|
+
declare function parseIntegration(raw: string): AgentTarget;
|
|
1181
1192
|
/** Roles emitted as thin agents (shared body generator — no skill files). */
|
|
1182
1193
|
type SddAgentRoleId = "sdd" | "sdd-planner" | "sdd-implementer" | "sdd-reviewer";
|
|
1183
1194
|
interface SddAgentRole {
|
|
@@ -1216,7 +1227,6 @@ declare const PROTOCOL_MD = "# SDD protocol\n\nThis repo uses **Structured Vibe
|
|
|
1216
1227
|
interface InitOptions {
|
|
1217
1228
|
projectRoot: string;
|
|
1218
1229
|
force?: boolean;
|
|
1219
|
-
pack?: "default" | "enterprise";
|
|
1220
1230
|
/**
|
|
1221
1231
|
* AI coding agents to install (copilot | claude-code). Not IDEs.
|
|
1222
1232
|
* Opt-in only — never defaults to all agents.
|
|
@@ -1281,4 +1291,4 @@ declare function listFiles(path: string): Promise<string[]>;
|
|
|
1281
1291
|
declare function copyDir(src: string, dest: string): Promise<void>;
|
|
1282
1292
|
declare function removePath(path: string): Promise<void>;
|
|
1283
1293
|
|
|
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,
|
|
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 };
|
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,10 +51,10 @@ import {
|
|
|
49
51
|
memoryDir,
|
|
50
52
|
nextStageId,
|
|
51
53
|
nowIso,
|
|
54
|
+
optionForTarget,
|
|
52
55
|
parseAgentTargets,
|
|
56
|
+
parseIntegration,
|
|
53
57
|
pathExists,
|
|
54
|
-
previousStageId,
|
|
55
|
-
projectPaths,
|
|
56
58
|
readText,
|
|
57
59
|
readYaml,
|
|
58
60
|
recommendWorkflow,
|
|
@@ -75,7 +77,7 @@ import {
|
|
|
75
77
|
workflowsDir,
|
|
76
78
|
writeText,
|
|
77
79
|
writeYaml
|
|
78
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-IO6AS6JI.js";
|
|
79
81
|
|
|
80
82
|
// src/init.ts
|
|
81
83
|
import { join as join2 } from "pathe";
|
|
@@ -342,6 +344,7 @@ export {
|
|
|
342
344
|
ArtifactDefSchema,
|
|
343
345
|
ChangeMetaSchema,
|
|
344
346
|
ConfigSchema,
|
|
347
|
+
DEFAULT_INIT_INTEGRATION,
|
|
345
348
|
GateSchema,
|
|
346
349
|
PROTOCOL_MD,
|
|
347
350
|
SDD_AGENT_ROLES,
|
|
@@ -380,6 +383,7 @@ export {
|
|
|
380
383
|
inferComplexity,
|
|
381
384
|
initProject,
|
|
382
385
|
installAgentIntegrations,
|
|
386
|
+
integrationKeyFor,
|
|
383
387
|
isInitialized,
|
|
384
388
|
isStageSkipped,
|
|
385
389
|
listChanges,
|
|
@@ -392,10 +396,10 @@ export {
|
|
|
392
396
|
memoryDir,
|
|
393
397
|
nextStageId,
|
|
394
398
|
nowIso,
|
|
399
|
+
optionForTarget,
|
|
395
400
|
parseAgentTargets,
|
|
401
|
+
parseIntegration,
|
|
396
402
|
pathExists,
|
|
397
|
-
previousStageId,
|
|
398
|
-
projectPaths,
|
|
399
403
|
readText,
|
|
400
404
|
readYaml,
|
|
401
405
|
recommendWorkflow,
|