@structured-vibe-coding/core 0.3.0 → 0.4.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.
- package/dist/agents-2ONGBIGG.js +20 -0
- package/dist/{chunk-PT2BZ23N.js → chunk-BP54LEAD.js} +190 -184
- package/dist/index.d.ts +34 -5
- package/dist/index.js +13 -4
- package/package.json +1 -1
- package/dist/agents-7PTSPJFQ.js +0 -10
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AGENT_TARGET_OPTIONS,
|
|
3
|
+
ALL_AGENT_TARGETS,
|
|
4
|
+
PROTOCOL_MD,
|
|
5
|
+
SDD_AGENT_ROLES,
|
|
6
|
+
installAgentIntegrations,
|
|
7
|
+
parseAgentTargets,
|
|
8
|
+
refreshActiveAgentContext,
|
|
9
|
+
renderThinAgent
|
|
10
|
+
} from "./chunk-BP54LEAD.js";
|
|
11
|
+
export {
|
|
12
|
+
AGENT_TARGET_OPTIONS,
|
|
13
|
+
ALL_AGENT_TARGETS,
|
|
14
|
+
PROTOCOL_MD,
|
|
15
|
+
SDD_AGENT_ROLES,
|
|
16
|
+
installAgentIntegrations,
|
|
17
|
+
parseAgentTargets,
|
|
18
|
+
refreshActiveAgentContext,
|
|
19
|
+
renderThinAgent
|
|
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-
|
|
521
|
+
const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-2ONGBIGG.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-
|
|
741
|
+
const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-2ONGBIGG.js");
|
|
742
742
|
await refreshActiveAgentContext2(projectRoot);
|
|
743
743
|
} catch {
|
|
744
744
|
}
|
|
@@ -961,8 +961,83 @@ async function buildAgentPrompt(ctx, config, projectRoot) {
|
|
|
961
961
|
|
|
962
962
|
// src/agents.ts
|
|
963
963
|
var ALL_AGENT_TARGETS = ["copilot", "claude-code", "intellij"];
|
|
964
|
+
var AGENT_TARGET_OPTIONS = [
|
|
965
|
+
{
|
|
966
|
+
id: "copilot",
|
|
967
|
+
label: "GitHub Copilot",
|
|
968
|
+
hint: ".github/agents/*.agent.md"
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
id: "claude-code",
|
|
972
|
+
label: "Claude Code",
|
|
973
|
+
hint: ".claude/agents/*.md"
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
id: "intellij",
|
|
977
|
+
label: "IntelliJ / JetBrains",
|
|
978
|
+
hint: ".idea/sdd-agent-notes.md"
|
|
979
|
+
}
|
|
980
|
+
];
|
|
981
|
+
function parseAgentTargets(raw) {
|
|
982
|
+
const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((s) => String(s).split(",")).map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
983
|
+
const out = [];
|
|
984
|
+
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)) {
|
|
987
|
+
throw new Error(
|
|
988
|
+
`Unknown agent platform "${p}". Choose one of: ${ALL_AGENT_TARGETS.join(", ")}`
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
if (!out.includes(id)) out.push(id);
|
|
992
|
+
}
|
|
993
|
+
return out;
|
|
994
|
+
}
|
|
995
|
+
var SDD_AGENT_ROLES = [
|
|
996
|
+
{
|
|
997
|
+
id: "sdd",
|
|
998
|
+
description: "Default SDD agent. Use for any Spec-Driven Development work on the active change pack.",
|
|
999
|
+
roleLine: "Router: inspect stage in active-context; plan or implement accordingly.",
|
|
1000
|
+
roleRules: [
|
|
1001
|
+
"If stage is intent/feature/design/tasks/stories/research: act as planner (artifacts, little or no product code).",
|
|
1002
|
+
"If stage is implement: act as implementer (scoped code only).",
|
|
1003
|
+
"If stage is local_verify: act as reviewer (gaps vs acceptance; fixes only)."
|
|
1004
|
+
]
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
id: "sdd-planner",
|
|
1008
|
+
description: "SDD planner. Use when filling intent, design, research, stories, or tasks \u2014 not large code changes.",
|
|
1009
|
+
roleLine: "Planner: produce/update stage markdown only.",
|
|
1010
|
+
roleRules: [
|
|
1011
|
+
"Do not make large product code changes unless the user explicitly overrides.",
|
|
1012
|
+
"Keep artifacts short and actionable."
|
|
1013
|
+
]
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
id: "sdd-implementer",
|
|
1017
|
+
description: "SDD implementer. Use when coding the active change (implement stage).",
|
|
1018
|
+
roleLine: "Implementer: code only for the active change pack.",
|
|
1019
|
+
roleRules: [
|
|
1020
|
+
"Follow tasks.md / acceptance; honor arb-decision and design constraints.",
|
|
1021
|
+
"Do not expand scope beyond the change title/intent."
|
|
1022
|
+
]
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
id: "sdd-reviewer",
|
|
1026
|
+
description: "SDD reviewer. Use before verify/complete or to check work against the change pack.",
|
|
1027
|
+
roleLine: "Reviewer: compare work to acceptance and stage artifacts.",
|
|
1028
|
+
roleRules: [
|
|
1029
|
+
"List gaps; suggest minimal fixes only.",
|
|
1030
|
+
"Remind user to run sdd verify before sdd complete."
|
|
1031
|
+
]
|
|
1032
|
+
}
|
|
1033
|
+
];
|
|
964
1034
|
async function installAgentIntegrations(opts) {
|
|
965
|
-
|
|
1035
|
+
if (!opts.targets?.length) {
|
|
1036
|
+
throw new Error(
|
|
1037
|
+
`Specify at least one agent platform: ${ALL_AGENT_TARGETS.join(", ")} (do not install all by default)`
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
const targets = opts.targets;
|
|
966
1041
|
const created = [];
|
|
967
1042
|
const skipped = [];
|
|
968
1043
|
const root = opts.projectRoot;
|
|
@@ -976,36 +1051,34 @@ async function installAgentIntegrations(opts) {
|
|
|
976
1051
|
await writeText(full, content);
|
|
977
1052
|
created.push(rel);
|
|
978
1053
|
};
|
|
1054
|
+
await write(join4(".sdd", "protocol.md"), PROTOCOL_MD);
|
|
979
1055
|
await refreshActiveAgentContext(root);
|
|
980
|
-
if (targets.includes("copilot")) {
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
".github/instructions/sdd.instructions.md",
|
|
991
|
-
COPILOT_PATH_INSTRUCTIONS
|
|
992
|
-
);
|
|
993
|
-
}
|
|
994
|
-
if (targets.includes("claude-code")) {
|
|
995
|
-
await write(".claude/skills/sdd/SKILL.md", CLAUDE_SDD_SKILL);
|
|
996
|
-
await write(".claude/CLAUDE.md", CLAUDE_PROJECT_MD);
|
|
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
|
+
}
|
|
1065
|
+
}
|
|
997
1066
|
}
|
|
998
1067
|
if (targets.includes("intellij")) {
|
|
999
1068
|
await write(".idea/sdd-agent-notes.md", INTELLIJ_NOTES);
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
await write("AGENTS.md",
|
|
1069
|
+
}
|
|
1070
|
+
if (targets.includes("copilot") || targets.includes("claude-code") || targets.includes("intellij")) {
|
|
1071
|
+
await write("AGENTS.md", AGENTS_MD_THIN);
|
|
1003
1072
|
}
|
|
1004
1073
|
await write(
|
|
1005
1074
|
join4(".sdd", "agents.json"),
|
|
1006
1075
|
JSON.stringify(
|
|
1007
1076
|
{
|
|
1008
|
-
version:
|
|
1077
|
+
version: 2,
|
|
1078
|
+
mode: "agents-only",
|
|
1079
|
+
protocol: ".sdd/protocol.md",
|
|
1080
|
+
activeContext: ".sdd/active-context.md",
|
|
1081
|
+
roles: SDD_AGENT_ROLES.map((r) => r.id),
|
|
1009
1082
|
installed: targets,
|
|
1010
1083
|
updated: (/* @__PURE__ */ new Date()).toISOString()
|
|
1011
1084
|
},
|
|
@@ -1015,11 +1088,42 @@ async function installAgentIntegrations(opts) {
|
|
|
1015
1088
|
);
|
|
1016
1089
|
return { created, skipped, targets };
|
|
1017
1090
|
}
|
|
1091
|
+
function renderThinAgent(role) {
|
|
1092
|
+
const rules = role.roleRules.map((r) => `- ${r}`).join("\n");
|
|
1093
|
+
return `---
|
|
1094
|
+
name: ${role.id}
|
|
1095
|
+
description: ${role.description}
|
|
1096
|
+
---
|
|
1097
|
+
|
|
1098
|
+
# ${role.id}
|
|
1099
|
+
|
|
1100
|
+
${role.roleLine}
|
|
1101
|
+
|
|
1102
|
+
## Required reads (in order)
|
|
1103
|
+
|
|
1104
|
+
1. \`.sdd/active-context.md\` \u2014 current change and stage
|
|
1105
|
+
2. \`.sdd/protocol.md\` \u2014 SDD rules for this repo (single playbook)
|
|
1106
|
+
3. Active change files under \`changes/<id>/\` as listed in active-context
|
|
1107
|
+
|
|
1108
|
+
## Role rules
|
|
1109
|
+
|
|
1110
|
+
${rules}
|
|
1111
|
+
|
|
1112
|
+
## Done
|
|
1113
|
+
|
|
1114
|
+
Remind the human: \`sdd verify\` then \`sdd next\` / \`sdd complete\` as appropriate.
|
|
1115
|
+
Do not claim the change is complete without local verification when the workflow requires it.
|
|
1116
|
+
`;
|
|
1117
|
+
}
|
|
1018
1118
|
async function refreshActiveAgentContext(projectRoot) {
|
|
1019
1119
|
const markerDir = sddRoot(projectRoot);
|
|
1020
1120
|
if (!await pathExists(join4(markerDir, "config.yaml"))) {
|
|
1021
1121
|
return null;
|
|
1022
1122
|
}
|
|
1123
|
+
const protocolPath = join4(markerDir, "protocol.md");
|
|
1124
|
+
if (!await pathExists(protocolPath)) {
|
|
1125
|
+
await writeText(protocolPath, PROTOCOL_MD);
|
|
1126
|
+
}
|
|
1023
1127
|
const config = await loadConfig(projectRoot);
|
|
1024
1128
|
const activeId = await getActiveChangeId(projectRoot, config);
|
|
1025
1129
|
const outPath = join4(markerDir, "active-context.md");
|
|
@@ -1029,6 +1133,8 @@ async function refreshActiveAgentContext(projectRoot) {
|
|
|
1029
1133
|
_No active change._ Run \`sdd new "\u2026"\` or **SDD: New Change** in the IDE.
|
|
1030
1134
|
|
|
1031
1135
|
Then re-run \`sdd agents refresh\` (or advance a stage) to update this file.
|
|
1136
|
+
|
|
1137
|
+
Protocol: \`.sdd/protocol.md\`
|
|
1032
1138
|
`;
|
|
1033
1139
|
await writeText(outPath, empty);
|
|
1034
1140
|
return outPath;
|
|
@@ -1038,8 +1144,9 @@ Then re-run \`sdd agents refresh\` (or advance a stage) to update this file.
|
|
|
1038
1144
|
const status = formatStatus(ctx);
|
|
1039
1145
|
const body = `# SDD active context
|
|
1040
1146
|
|
|
1041
|
-
> Auto-generated for
|
|
1042
|
-
> Change: **${ctx.meta.title}** \xB7 \`${ctx.id}\` \xB7 stage **${ctx.meta.stage}**
|
|
1147
|
+
> Auto-generated for coding agents.
|
|
1148
|
+
> Change: **${ctx.meta.title}** \xB7 \`${ctx.id}\` \xB7 stage **${ctx.meta.stage}**
|
|
1149
|
+
> Protocol: \`.sdd/protocol.md\`
|
|
1043
1150
|
|
|
1044
1151
|
## Status
|
|
1045
1152
|
|
|
@@ -1052,191 +1159,85 @@ ${handoff}
|
|
|
1052
1159
|
await writeText(outPath, body);
|
|
1053
1160
|
return outPath;
|
|
1054
1161
|
}
|
|
1055
|
-
var
|
|
1056
|
-
|
|
1057
|
-
This repository uses **Spec-Driven Development** via the \`sdd\` tool (CLI / VS Code / IntelliJ).
|
|
1162
|
+
var PROTOCOL_MD = `# SDD protocol
|
|
1058
1163
|
|
|
1059
|
-
|
|
1164
|
+
This repo uses **Structured Vibe Coding** (\`sdd\`). Agents must follow this file plus \`.sdd/active-context.md\`. Do not invent a parallel process.
|
|
1060
1165
|
|
|
1061
|
-
|
|
1062
|
-
2. Read \`.sdd/active-context.md\` at the start of a coding session (refresh with \`sdd agents refresh\`).
|
|
1063
|
-
3. Read \`memory/\` for product and architecture constraints.
|
|
1064
|
-
4. Do **not** invent large features outside the current change intent.
|
|
1065
|
-
5. Respect **ARB / gate decisions** (e.g. \`arb-decision.md\`) and workflow constraints.
|
|
1066
|
-
6. When implementation is done, remind the human to run **local verify** (\`sdd verify\`) before \`sdd complete\`.
|
|
1166
|
+
## Source of truth
|
|
1067
1167
|
|
|
1068
|
-
|
|
1168
|
+
| What | Where |
|
|
1169
|
+
|------|--------|
|
|
1170
|
+
| Process state | \`changes/<id>/meta.yaml\` (workflow, stage, gates) |
|
|
1171
|
+
| Current task snapshot | \`.sdd/active-context.md\` |
|
|
1172
|
+
| Stable product/tech rules | \`memory/*.md\` |
|
|
1173
|
+
| Stage artifacts | files in \`changes/<id>/\` for the active change |
|
|
1069
1174
|
|
|
1070
|
-
|
|
1175
|
+
## Required read order
|
|
1071
1176
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
| CLI | \`sdd status\`, \`sdd next\`, \`sdd agent\`, \`sdd verify\` |
|
|
1077
|
-
| VS Code / Cursor | Command Palette \u2192 **SDD:*** |
|
|
1078
|
-
| IntelliJ | Tools \u2192 **SDD** actions (runs CLI) |
|
|
1079
|
-
| GitHub Copilot | \`.github/copilot-instructions.md\` + agent \`sdd\` |
|
|
1080
|
-
| Claude Code | \`.claude/skills/sdd/SKILL.md\` |
|
|
1081
|
-
|
|
1082
|
-
## Local only
|
|
1083
|
-
|
|
1084
|
-
Verification is **local development**. Do not assume CI replaced \`sdd verify\`.
|
|
1085
|
-
`;
|
|
1086
|
-
var COPILOT_INSTRUCTIONS = `<!-- Structured Vibe Coding (SDD) \u2014 GitHub Copilot instructions -->
|
|
1087
|
-
|
|
1088
|
-
# Project coding agent rules
|
|
1089
|
-
|
|
1090
|
-
This repo uses **Spec-Driven Development (SDD)** with the \`sdd\` CLI / IDE plugins.
|
|
1091
|
-
|
|
1092
|
-
## Before writing code
|
|
1093
|
-
|
|
1094
|
-
1. Open and follow \`.sdd/active-context.md\` if present.
|
|
1095
|
-
2. Open the active change under \`changes/\` (see \`changes/.active\` or the latest in-progress folder).
|
|
1096
|
-
3. Prefer artifacts for the **current stage** (intent/feature/design/tasks) over guessing.
|
|
1097
|
-
4. Honor \`memory/product.md\`, \`memory/architecture.md\`, \`memory/conventions.md\`.
|
|
1177
|
+
1. \`.sdd/active-context.md\`
|
|
1178
|
+
2. This file (\`.sdd/protocol.md\`)
|
|
1179
|
+
3. \`meta.yaml\` + artifacts for the **current stage** (and prior stages if needed)
|
|
1180
|
+
4. \`memory/\` when architecture or conventions matter
|
|
1098
1181
|
|
|
1099
|
-
##
|
|
1182
|
+
## Stage behavior
|
|
1100
1183
|
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1184
|
+
| Stage kind | Agent focus |
|
|
1185
|
+
|------------|-------------|
|
|
1186
|
+
| intent / feature / stories | Clarify scope; write short artifacts |
|
|
1187
|
+
| design / lld / db / research / hl_arb | Specs and decisions; minimal product code |
|
|
1188
|
+
| tasks | Break work into implementable checklist |
|
|
1189
|
+
| implement | Code only for this change; follow tasks/acceptance |
|
|
1190
|
+
| local_verify | Check acceptance; fix only; prepare for complete |
|
|
1105
1191
|
|
|
1106
|
-
##
|
|
1192
|
+
## Hard rules
|
|
1107
1193
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1194
|
+
1. **Do not skip hard gates.** If blocked, tell the human to run \`sdd gate approve\` (or fix the gate).
|
|
1195
|
+
2. **Stay in scope** of the active change title/intent. No drive-by refactors or new features.
|
|
1196
|
+
3. **Honor constraints** in \`arb-decision.md\`, design, and memory non-negotiables.
|
|
1197
|
+
4. **Local verify** is part of done when the workflow has a verify stage: \`sdd verify\`.
|
|
1198
|
+
5. Prefer small, reviewable diffs.
|
|
1110
1199
|
|
|
1111
|
-
## Commands
|
|
1200
|
+
## Commands (human / shell)
|
|
1112
1201
|
|
|
1113
1202
|
\`\`\`bash
|
|
1114
1203
|
sdd status
|
|
1115
1204
|
sdd next
|
|
1116
|
-
sdd agent
|
|
1117
|
-
sdd agents refresh
|
|
1205
|
+
sdd agent # print handoff
|
|
1206
|
+
sdd agents refresh # refresh active-context.md
|
|
1118
1207
|
sdd verify
|
|
1119
1208
|
sdd complete
|
|
1120
1209
|
\`\`\`
|
|
1121
|
-
`;
|
|
1122
|
-
var COPILOT_SDD_AGENT = `---
|
|
1123
|
-
name: sdd
|
|
1124
|
-
description: Spec-Driven Development agent for this repo. Use when implementing the active sdd change, advancing stages, or following .sdd workflows.
|
|
1125
|
-
---
|
|
1126
|
-
|
|
1127
|
-
# SDD agent (GitHub Copilot)
|
|
1128
|
-
|
|
1129
|
-
You are the **SDD implementer** for this workspace.
|
|
1130
|
-
|
|
1131
|
-
## Mission
|
|
1132
|
-
|
|
1133
|
-
Implement only what the **active change pack** specifies. Specs and gates win over improvisation.
|
|
1134
|
-
|
|
1135
|
-
## Required reads (in order)
|
|
1136
|
-
|
|
1137
|
-
1. \`.sdd/active-context.md\`
|
|
1138
|
-
2. \`changes/<active-id>/meta.yaml\` (workflow + stage)
|
|
1139
|
-
3. Artifacts for the current stage and prior stages in that folder
|
|
1140
|
-
4. \`memory/*.md\`
|
|
1141
|
-
|
|
1142
|
-
## Behavior
|
|
1143
|
-
|
|
1144
|
-
- If there is no active change, tell the user to run \`sdd new "\u2026"\` or **SDD: New Change**.
|
|
1145
|
-
- If \`meta.yaml\` stage is not \`implement\`, help fill the current stage artifact instead of large code rewrites\u2014unless the user explicitly wants implementation early.
|
|
1146
|
-
- On implement stage: execute tasks from \`tasks.md\` / acceptance criteria; keep diffs scoped.
|
|
1147
|
-
- After code changes: remind them to run **local** \`sdd verify\`.
|
|
1148
1210
|
|
|
1149
|
-
## Out of scope
|
|
1211
|
+
## Out of scope for agents
|
|
1150
1212
|
|
|
1151
|
-
-
|
|
1152
|
-
-
|
|
1153
|
-
-
|
|
1213
|
+
- Replacing CI/CD or team process tools
|
|
1214
|
+
- Deleting \`.sdd\` / archive history
|
|
1215
|
+
- Claiming complete without verify when required
|
|
1154
1216
|
`;
|
|
1155
|
-
var
|
|
1156
|
-
applyTo: "changes/**,memory/**,.sdd/**"
|
|
1157
|
-
---
|
|
1158
|
-
|
|
1159
|
-
# SDD paths
|
|
1160
|
-
|
|
1161
|
-
Files under \`changes/\`, \`memory/\`, and \`.sdd/\` drive Spec-Driven Development.
|
|
1162
|
-
|
|
1163
|
-
- Treat \`changes/**/meta.yaml\` as process state (do not invent fields).
|
|
1164
|
-
- Prefer editing stage artifacts over deleting workflow history.
|
|
1165
|
-
- When modifying code for an active change, keep alignment with that change's intent/design/tasks.
|
|
1166
|
-
`;
|
|
1167
|
-
var CLAUDE_SDD_SKILL = `---
|
|
1168
|
-
name: sdd
|
|
1169
|
-
description: Use Spec-Driven Development (sdd) for this repository \u2014 read active change, follow stages, implement within scope, local verify.
|
|
1170
|
-
---
|
|
1171
|
-
|
|
1172
|
-
# Skill: Structured Vibe Coding (SDD)
|
|
1173
|
-
|
|
1174
|
-
## When to use
|
|
1217
|
+
var AGENTS_MD_THIN = `# Agents
|
|
1175
1218
|
|
|
1176
|
-
|
|
1177
|
-
- User mentions sdd, change packs, stages, ARB, or local verify
|
|
1178
|
-
- You need the source of truth for the current task
|
|
1219
|
+
This repo uses **SDD agents only** (no skills).
|
|
1179
1220
|
|
|
1180
|
-
|
|
1221
|
+
| Read first | |
|
|
1222
|
+
|------------|--|
|
|
1223
|
+
| Live task | \`.sdd/active-context.md\` |
|
|
1224
|
+
| Playbook | \`.sdd/protocol.md\` |
|
|
1181
1225
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
5. Implement **only** in-scope work for the current change.
|
|
1187
|
-
6. Prefer project conventions in \`memory/conventions.md\`.
|
|
1188
|
-
7. When done coding, instruct the user to run:
|
|
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) |
|
|
1189
1230
|
|
|
1190
|
-
|
|
1191
|
-
sdd verify
|
|
1192
|
-
sdd gate approve # if hard gate
|
|
1193
|
-
sdd next # or sdd complete on last stage
|
|
1194
|
-
\`\`\`
|
|
1195
|
-
|
|
1196
|
-
## Bash helpers (if tools allow)
|
|
1197
|
-
|
|
1198
|
-
\`\`\`bash
|
|
1199
|
-
sdd status
|
|
1200
|
-
sdd agent
|
|
1201
|
-
sdd agents refresh
|
|
1202
|
-
\`\`\`
|
|
1203
|
-
|
|
1204
|
-
## Do not
|
|
1205
|
-
|
|
1206
|
-
- Skip hard gates
|
|
1207
|
-
- Expand scope beyond the change title/intent
|
|
1208
|
-
- Delete \`.sdd\` or archive history casually
|
|
1209
|
-
`;
|
|
1210
|
-
var CLAUDE_PROJECT_MD = `# Claude Code \u2014 this repo uses SDD
|
|
1211
|
-
|
|
1212
|
-
Load the **sdd** skill under \`.claude/skills/sdd/\` for implementation work.
|
|
1213
|
-
|
|
1214
|
-
Always check \`.sdd/active-context.md\` and the active folder under \`changes/\` before large edits.
|
|
1215
|
-
|
|
1216
|
-
CLI: \`sdd\` (npm: \`@structured-vibe-coding/cli\`).
|
|
1231
|
+
Refresh context: \`sdd agents refresh\`.
|
|
1217
1232
|
`;
|
|
1218
|
-
var INTELLIJ_NOTES = `# SDD + IntelliJ
|
|
1219
|
-
|
|
1220
|
-
This project uses Structured Vibe Coding (\`sdd\`).
|
|
1221
|
-
|
|
1222
|
-
## IntelliJ plugin
|
|
1223
|
-
|
|
1224
|
-
Install the **Structured Vibe Coding (SDD)** plugin (or run the Gradle plugin from \`packages/intellij\`).
|
|
1225
|
-
Actions under **Tools \u2192 SDD** shell out to the \`sdd\` CLI \u2014 install the CLI on PATH:
|
|
1226
|
-
|
|
1227
|
-
\`\`\`bash
|
|
1228
|
-
npm i -g @structured-vibe-coding/cli
|
|
1229
|
-
\`\`\`
|
|
1230
|
-
|
|
1231
|
-
## GitHub Copilot in IntelliJ
|
|
1232
|
-
|
|
1233
|
-
Copilot respects repository instructions:
|
|
1233
|
+
var INTELLIJ_NOTES = `# SDD + IntelliJ
|
|
1234
1234
|
|
|
1235
|
-
|
|
1236
|
-
- \`AGENTS.md\`
|
|
1237
|
-
- \`.sdd/active-context.md\` (refresh often)
|
|
1235
|
+
Agents only. Playbook: \`.sdd/protocol.md\`. Live: \`.sdd/active-context.md\`.
|
|
1238
1236
|
|
|
1239
|
-
|
|
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**
|
|
1240
1241
|
`;
|
|
1241
1242
|
|
|
1242
1243
|
export {
|
|
@@ -1292,8 +1293,13 @@ export {
|
|
|
1292
1293
|
changeDirName,
|
|
1293
1294
|
uniqueChangeDirName,
|
|
1294
1295
|
ALL_AGENT_TARGETS,
|
|
1296
|
+
AGENT_TARGET_OPTIONS,
|
|
1297
|
+
parseAgentTargets,
|
|
1298
|
+
SDD_AGENT_ROLES,
|
|
1295
1299
|
installAgentIntegrations,
|
|
1300
|
+
renderThinAgent,
|
|
1296
1301
|
refreshActiveAgentContext,
|
|
1302
|
+
PROTOCOL_MD,
|
|
1297
1303
|
createChange,
|
|
1298
1304
|
loadChangeMeta,
|
|
1299
1305
|
saveChangeMeta,
|
package/dist/index.d.ts
CHANGED
|
@@ -1166,6 +1166,24 @@ declare function buildAgentPrompt(ctx: ChangeContext, config: Config, projectRoo
|
|
|
1166
1166
|
|
|
1167
1167
|
type AgentTarget = "copilot" | "claude-code" | "intellij";
|
|
1168
1168
|
declare const ALL_AGENT_TARGETS: AgentTarget[];
|
|
1169
|
+
/** Human-facing labels for interactive platform pick (CLI / IDE). */
|
|
1170
|
+
declare const AGENT_TARGET_OPTIONS: {
|
|
1171
|
+
id: AgentTarget;
|
|
1172
|
+
label: string;
|
|
1173
|
+
hint: string;
|
|
1174
|
+
}[];
|
|
1175
|
+
/** Parse `copilot`, `claude-code,copilot`, etc. Throws on unknown ids. */
|
|
1176
|
+
declare function parseAgentTargets(raw: string | string[]): AgentTarget[];
|
|
1177
|
+
/** Roles emitted as thin agents (shared body generator — no skill files). */
|
|
1178
|
+
type SddAgentRoleId = "sdd" | "sdd-planner" | "sdd-implementer" | "sdd-reviewer";
|
|
1179
|
+
interface SddAgentRole {
|
|
1180
|
+
id: SddAgentRoleId;
|
|
1181
|
+
description: string;
|
|
1182
|
+
roleLine: string;
|
|
1183
|
+
/** Extra one-liner constraints for this role only */
|
|
1184
|
+
roleRules: string[];
|
|
1185
|
+
}
|
|
1186
|
+
declare const SDD_AGENT_ROLES: SddAgentRole[];
|
|
1169
1187
|
interface InstallAgentsOptions {
|
|
1170
1188
|
projectRoot: string;
|
|
1171
1189
|
targets?: AgentTarget[];
|
|
@@ -1177,19 +1195,30 @@ interface InstallAgentsResult {
|
|
|
1177
1195
|
targets: AgentTarget[];
|
|
1178
1196
|
}
|
|
1179
1197
|
/**
|
|
1180
|
-
* Install
|
|
1181
|
-
*
|
|
1198
|
+
* Install **agents only** (no skills, no fat instructions).
|
|
1199
|
+
*
|
|
1200
|
+
* Single playbook: `.sdd/protocol.md`
|
|
1201
|
+
* Live state: `.sdd/active-context.md`
|
|
1202
|
+
* Thin agents: `.claude/agents/*` and `.github/agents/*` (pointers + role)
|
|
1182
1203
|
*/
|
|
1183
1204
|
declare function installAgentIntegrations(opts: InstallAgentsOptions): Promise<InstallAgentsResult>;
|
|
1205
|
+
/** Thin agent body shared by Claude Code and GitHub Copilot (same text). */
|
|
1206
|
+
declare function renderThinAgent(role: SddAgentRole): string;
|
|
1184
1207
|
/** Write .sdd/active-context.md for the current change (all agents read this). */
|
|
1185
1208
|
declare function refreshActiveAgentContext(projectRoot: string): Promise<string | null>;
|
|
1209
|
+
/** Single playbook — only long agent-facing content we author once. */
|
|
1210
|
+
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";
|
|
1186
1211
|
|
|
1187
1212
|
interface InitOptions {
|
|
1188
1213
|
projectRoot: string;
|
|
1189
1214
|
force?: boolean;
|
|
1190
1215
|
pack?: "default" | "enterprise";
|
|
1191
|
-
/**
|
|
1192
|
-
|
|
1216
|
+
/**
|
|
1217
|
+
* Agent platforms to install. Opt-in only — never defaults to all platforms.
|
|
1218
|
+
* - omit / `false` — no agent files
|
|
1219
|
+
* - `AgentTarget[]` — install only those hosts
|
|
1220
|
+
*/
|
|
1221
|
+
agents?: false | AgentTarget[];
|
|
1193
1222
|
}
|
|
1194
1223
|
interface InitResult {
|
|
1195
1224
|
created: string[];
|
|
@@ -1247,4 +1276,4 @@ declare function listFiles(path: string): Promise<string[]>;
|
|
|
1247
1276
|
declare function copyDir(src: string, dest: string): Promise<void>;
|
|
1248
1277
|
declare function removePath(path: string): Promise<void>;
|
|
1249
1278
|
|
|
1250
|
-
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, SDD_DIR, 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, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AGENT_TARGET_OPTIONS,
|
|
2
3
|
ALL_AGENT_TARGETS,
|
|
3
4
|
ArtifactDefSchema,
|
|
4
5
|
ChangeMetaSchema,
|
|
5
6
|
ConfigSchema,
|
|
6
7
|
GateSchema,
|
|
8
|
+
PROTOCOL_MD,
|
|
9
|
+
SDD_AGENT_ROLES,
|
|
7
10
|
SDD_DIR,
|
|
8
11
|
StageSchema,
|
|
9
12
|
VerifyCommandSchema,
|
|
@@ -46,6 +49,7 @@ import {
|
|
|
46
49
|
memoryDir,
|
|
47
50
|
nextStageId,
|
|
48
51
|
nowIso,
|
|
52
|
+
parseAgentTargets,
|
|
49
53
|
pathExists,
|
|
50
54
|
previousStageId,
|
|
51
55
|
projectPaths,
|
|
@@ -54,6 +58,7 @@ import {
|
|
|
54
58
|
recommendWorkflow,
|
|
55
59
|
refreshActiveAgentContext,
|
|
56
60
|
removePath,
|
|
61
|
+
renderThinAgent,
|
|
57
62
|
resolveChangeId,
|
|
58
63
|
resolveStages,
|
|
59
64
|
saveChangeMeta,
|
|
@@ -70,7 +75,7 @@ import {
|
|
|
70
75
|
workflowsDir,
|
|
71
76
|
writeText,
|
|
72
77
|
writeYaml
|
|
73
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-BP54LEAD.js";
|
|
74
79
|
|
|
75
80
|
// src/init.ts
|
|
76
81
|
import { join as join2 } from "pathe";
|
|
@@ -189,11 +194,10 @@ sdd complete
|
|
|
189
194
|
created.push(sddReadme);
|
|
190
195
|
}
|
|
191
196
|
let agentsResult;
|
|
192
|
-
if (opts.agents
|
|
193
|
-
const targets = Array.isArray(opts.agents) && opts.agents.length ? opts.agents : void 0;
|
|
197
|
+
if (Array.isArray(opts.agents) && opts.agents.length > 0) {
|
|
194
198
|
const ag = await installAgentIntegrations({
|
|
195
199
|
projectRoot,
|
|
196
|
-
targets,
|
|
200
|
+
targets: opts.agents,
|
|
197
201
|
force
|
|
198
202
|
});
|
|
199
203
|
created.push(...ag.created);
|
|
@@ -333,11 +337,14 @@ ${output}`
|
|
|
333
337
|
};
|
|
334
338
|
}
|
|
335
339
|
export {
|
|
340
|
+
AGENT_TARGET_OPTIONS,
|
|
336
341
|
ALL_AGENT_TARGETS,
|
|
337
342
|
ArtifactDefSchema,
|
|
338
343
|
ChangeMetaSchema,
|
|
339
344
|
ConfigSchema,
|
|
340
345
|
GateSchema,
|
|
346
|
+
PROTOCOL_MD,
|
|
347
|
+
SDD_AGENT_ROLES,
|
|
341
348
|
SDD_DIR,
|
|
342
349
|
StageSchema,
|
|
343
350
|
VerifyCommandSchema,
|
|
@@ -385,6 +392,7 @@ export {
|
|
|
385
392
|
memoryDir,
|
|
386
393
|
nextStageId,
|
|
387
394
|
nowIso,
|
|
395
|
+
parseAgentTargets,
|
|
388
396
|
pathExists,
|
|
389
397
|
previousStageId,
|
|
390
398
|
projectPaths,
|
|
@@ -393,6 +401,7 @@ export {
|
|
|
393
401
|
recommendWorkflow,
|
|
394
402
|
refreshActiveAgentContext,
|
|
395
403
|
removePath,
|
|
404
|
+
renderThinAgent,
|
|
396
405
|
resolveChangeId,
|
|
397
406
|
resolveStages,
|
|
398
407
|
runLocalVerify,
|
package/package.json
CHANGED