@shinnodua/agent-workflows 0.0.0-stage → 0.2.8
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/.agents/agents/backend-developer/agent.md +39 -0
- package/.agents/agents/frontend-developer/agent.md +42 -0
- package/.agents/agents/project-manager/agent.md +37 -0
- package/.agents/agents/tech-lead/agent.md +41 -0
- package/.agents/agents/ui-ux-designer/agent.md +41 -0
- package/.agents/skills/add-project/SKILL.md +90 -0
- package/.agents/skills/add-project/agents/openai.yaml +4 -0
- package/.agents/skills/add-project/references/save-protocol.md +90 -0
- package/.agents/skills/approve-plan/SKILL.md +86 -0
- package/.agents/skills/approve-plan/agents/openai.yaml +4 -0
- package/.agents/skills/approve-prd/SKILL.md +59 -0
- package/.agents/skills/approve-prd/agents/openai.yaml +4 -0
- package/.agents/skills/auto-mode/SKILL.md +103 -0
- package/.agents/skills/auto-mode/agents/openai.yaml +4 -0
- package/.agents/skills/create-design/SKILL.md +197 -0
- package/.agents/skills/create-design/agents/openai.yaml +4 -0
- package/.agents/skills/create-diagram/SKILL.md +83 -0
- package/.agents/skills/create-diagram/agents/openai.yaml +4 -0
- package/.agents/skills/create-plan/SKILL.md +104 -0
- package/.agents/skills/create-plan/agents/openai.yaml +4 -0
- package/.agents/skills/create-prd/SKILL.md +82 -0
- package/.agents/skills/create-prd/agents/openai.yaml +4 -0
- package/.agents/skills/griling-plan/SKILL.md +114 -0
- package/.agents/skills/griling-plan/agents/openai.yaml +4 -0
- package/.agents/skills/griling-prd/SKILL.md +91 -0
- package/.agents/skills/griling-prd/agents/openai.yaml +4 -0
- package/.agents/skills/package-installation/SKILL.md +67 -0
- package/.agents/skills/package-installation/agents/openai.yaml +4 -0
- package/.agents/skills/project-setup/SKILL.md +104 -0
- package/.agents/skills/project-setup/agents/openai.yaml +3 -0
- package/.agents/skills/research/SKILL.md +61 -0
- package/.agents/skills/research/agents/openai.yaml +4 -0
- package/.agents/skills/sprint-meeting/SKILL.md +230 -0
- package/.agents/skills/sprint-meeting/agents/openai.yaml +4 -0
- package/.claude/agents/backend-developer.md +7 -0
- package/.claude/agents/frontend-developer.md +7 -0
- package/.claude/agents/project-manager.md +7 -0
- package/.claude/agents/tech-lead.md +7 -0
- package/.claude/agents/ui-ux-designer.md +7 -0
- package/.claude/skills/add-project/SKILL.md +10 -0
- package/.claude/skills/approve-plan/SKILL.md +8 -0
- package/.claude/skills/approve-prd/SKILL.md +8 -0
- package/.claude/skills/auto-mode/SKILL.md +8 -0
- package/.claude/skills/create-design/SKILL.md +8 -0
- package/.claude/skills/create-diagram/SKILL.md +8 -0
- package/.claude/skills/create-plan/SKILL.md +8 -0
- package/.claude/skills/create-prd/SKILL.md +8 -0
- package/.claude/skills/griling-plan/SKILL.md +8 -0
- package/.claude/skills/griling-prd/SKILL.md +8 -0
- package/.claude/skills/package-installation/SKILL.md +8 -0
- package/.claude/skills/project-setup/SKILL.md +8 -0
- package/.claude/skills/research/SKILL.md +8 -0
- package/.claude/skills/sprint-meeting/SKILL.md +8 -0
- package/.codex/prompts/add-project.md +3 -0
- package/.codex/prompts/approve-plan.md +3 -0
- package/.codex/prompts/approve-prd.md +3 -0
- package/.codex/prompts/auto-mode.md +3 -0
- package/.codex/prompts/create-design.md +3 -0
- package/.codex/prompts/create-diagram.md +3 -0
- package/.codex/prompts/create-plan.md +3 -0
- package/.codex/prompts/create-prd.md +3 -0
- package/.codex/prompts/griling-plan.md +3 -0
- package/.codex/prompts/griling-prd.md +3 -0
- package/.codex/prompts/grilling-plan.md +3 -0
- package/.codex/prompts/project-setup.md +3 -0
- package/.codex/prompts/research.md +3 -0
- package/.codex/prompts/sprint-meeting.md +3 -0
- package/.gitmodules.example +9 -0
- package/AGENTS.md +84 -0
- package/CLAUDE.md +1 -0
- package/INSTALL.md +284 -0
- package/LICENSE +21 -0
- package/README.md +342 -2
- package/bin/postinstall.js +57 -0
- package/bin/workflows.js +1172 -0
- package/bin/workflows.test.mjs +682 -0
- package/commands/add-project.md +20 -0
- package/commands/approve-plan.md +25 -0
- package/commands/approve-prd.md +24 -0
- package/commands/auto-mode.md +15 -0
- package/commands/create-design.md +20 -0
- package/commands/create-diagram.md +16 -0
- package/commands/create-plan.md +22 -0
- package/commands/create-prd.md +16 -0
- package/commands/griling-plan.md +16 -0
- package/commands/griling-prd.md +16 -0
- package/commands/grilling-plan.md +16 -0
- package/commands/project-setup.md +16 -0
- package/commands/research.md +16 -0
- package/commands/sprint-meeting.md +16 -0
- package/dashboard/.agents/skills/coding-conventions/SKILL.md +76 -0
- package/dashboard/.agents/skills/coding-conventions/agents/openai.yaml +4 -0
- package/dashboard/.agents/skills/design-system-guideline/SKILL.md +51 -0
- package/dashboard/.agents/skills/design-system-guideline/agents/openai.yaml +4 -0
- package/dashboard/.agents/skills/lint-and-fix/SKILL.md +55 -0
- package/dashboard/.agents/skills/lint-and-fix/agents/openai.yaml +4 -0
- package/dashboard/.agents/skills/taste-ui/SKILL.md +45 -0
- package/dashboard/.agents/skills/taste-ui/agents/openai.yaml +4 -0
- package/dashboard/AGENTS.md +43 -0
- package/dashboard/bun.lock +352 -0
- package/dashboard/index.html +12 -0
- package/dashboard/package.json +32 -0
- package/dashboard/src/App.tsx +5 -0
- package/dashboard/src/features/task-status/components/ActionRequiredPanel/ActionRequiredPanel.module.css +85 -0
- package/dashboard/src/features/task-status/components/ActionRequiredPanel/ActionRequiredPanel.tsx +80 -0
- package/dashboard/src/features/task-status/components/ArtifactButton/ArtifactButton.module.css +25 -0
- package/dashboard/src/features/task-status/components/ArtifactButton/ArtifactButton.tsx +29 -0
- package/dashboard/src/features/task-status/components/ArtifactSummaryCards/ArtifactSummaryCards.module.css +29 -0
- package/dashboard/src/features/task-status/components/ArtifactSummaryCards/ArtifactSummaryCards.tsx +35 -0
- package/dashboard/src/features/task-status/components/CategoryPanel/CategoryPanel.module.css +85 -0
- package/dashboard/src/features/task-status/components/CategoryPanel/CategoryPanel.tsx +150 -0
- package/dashboard/src/features/task-status/components/DashboardHeader/DashboardHeader.module.css +41 -0
- package/dashboard/src/features/task-status/components/DashboardHeader/DashboardHeader.tsx +41 -0
- package/dashboard/src/features/task-status/components/FilesPanel/FilesPanel.module.css +25 -0
- package/dashboard/src/features/task-status/components/FilesPanel/FilesPanel.tsx +40 -0
- package/dashboard/src/features/task-status/components/HardnessEngineeringPanel/HardnessEngineeringPanel.module.css +330 -0
- package/dashboard/src/features/task-status/components/HardnessEngineeringPanel/HardnessEngineeringPanel.tsx +299 -0
- package/dashboard/src/features/task-status/components/LifecyclePanel/LifecyclePanel.module.css +74 -0
- package/dashboard/src/features/task-status/components/LifecyclePanel/LifecyclePanel.tsx +79 -0
- package/dashboard/src/features/task-status/components/MarkdownDialog/MarkdownDialog.module.css +133 -0
- package/dashboard/src/features/task-status/components/MarkdownDialog/MarkdownDialog.tsx +233 -0
- package/dashboard/src/features/task-status/components/Sidebar/Sidebar.module.css +53 -0
- package/dashboard/src/features/task-status/components/Sidebar/Sidebar.tsx +163 -0
- package/dashboard/src/features/task-status/components/StatusBadge/StatusBadge.module.css +41 -0
- package/dashboard/src/features/task-status/components/StatusBadge/StatusBadge.tsx +48 -0
- package/dashboard/src/features/task-status/components/TaskOverview/TaskOverview.module.css +97 -0
- package/dashboard/src/features/task-status/components/TaskOverview/TaskOverview.tsx +128 -0
- package/dashboard/src/features/task-status/components/TaskStatusDashboard/TaskStatusDashboard.module.css +9 -0
- package/dashboard/src/features/task-status/components/TaskStatusDashboard/TaskStatusDashboard.tsx +318 -0
- package/dashboard/src/features/task-status/components/WorkflowPanel/WorkflowPanel.module.css +221 -0
- package/dashboard/src/features/task-status/components/WorkflowPanel/WorkflowPanel.tsx +344 -0
- package/dashboard/src/features/task-status/taskStatusConfig.ts +100 -0
- package/dashboard/src/features/task-status/utils/actionItems.ts +247 -0
- package/dashboard/src/features/task-status/utils/artifactGrouping.ts +328 -0
- package/dashboard/src/features/task-status/utils/hardnessScanner.ts +406 -0
- package/dashboard/src/features/task-status/utils/lifecycle.ts +73 -0
- package/dashboard/src/features/task-status/utils/markdownInline/markdownInline.module.css +11 -0
- package/dashboard/src/features/task-status/utils/markdownInline/markdownInline.tsx +104 -0
- package/dashboard/src/features/task-status/utils/markdownLinks.ts +83 -0
- package/dashboard/src/features/task-status/utils/markdownRenderer/markdownRenderer.module.css +74 -0
- package/dashboard/src/features/task-status/utils/markdownRenderer/markdownRenderer.tsx +326 -0
- package/dashboard/src/features/task-status/utils/status.ts +7 -0
- package/dashboard/src/features/task-status/utils/test/actionItems.test.ts +134 -0
- package/dashboard/src/features/task-status/utils/test/artifactGrouping.test.ts +294 -0
- package/dashboard/src/features/task-status/utils/test/hardnessScanner.test.ts +138 -0
- package/dashboard/src/features/task-status/utils/test/lifecycle.test.ts +49 -0
- package/dashboard/src/features/task-status/utils/test/markdownInline.test.ts +41 -0
- package/dashboard/src/features/task-status/utils/test/markdownLinks.test.ts +158 -0
- package/dashboard/src/features/task-status/utils/test/workspaceMetadata.test.ts +37 -0
- package/dashboard/src/features/task-status/utils/workspaceMetadata.ts +175 -0
- package/dashboard/src/main.tsx +16 -0
- package/dashboard/src/shared/design-system.css +134 -0
- package/dashboard/src/shared/design-system.tsx +84 -0
- package/dashboard/src/styles.css +41 -0
- package/dashboard/src/types.ts +133 -0
- package/dashboard/src/workspace-artifacts.d.ts +9 -0
- package/dashboard/tsconfig.json +22 -0
- package/dashboard/vite.config.ts +579 -0
- package/designs/.gitkeep +1 -0
- package/docs/add-project-command-completion.md +117 -0
- package/docs/public-npm-registry-completion.md +104 -0
- package/docs/workflows.png +0 -0
- package/docs/workspace-template-setup.md +229 -0
- package/meeting-logs/.gitkeep +1 -0
- package/modules/.gitkeep +1 -0
- package/package.json +96 -5
- package/plans/.gitkeep +1 -0
- package/prds/.gitkeep +1 -0
- package/project/PROJECT.md +26 -0
- package/project/repositories.json +72 -0
- package/project/validation.json +9 -0
- package/project/workflows.json +20 -0
- package/research/.gitkeep +1 -0
- package/roles/backend-developer.md +26 -0
- package/roles/frontend-developer.md +25 -0
- package/roles/project-manager.md +42 -0
- package/roles/tech-lead.md +42 -0
- package/roles/ui-ux-designer.md +43 -0
- package/scripts/add-project.mjs +990 -0
- package/scripts/add-project.test.mjs +804 -0
- package/scripts/check-staged-security.mjs +97 -0
- package/scripts/check-staged-security.test.mjs +68 -0
- package/scripts/workspace-integrity.ts +220 -0
- package/templates/auto-mode-completion-summary-template.md +78 -0
- package/templates/meeting-log-template.md +177 -0
- package/templates/plan-template.md +219 -0
- package/templates/prd-template.md +106 -0
- package/templates/research-template.md +119 -0
- package/workflows.md +590 -0
- package/workspace.config.json +43 -0
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const cli = fileURLToPath(new URL("./workflows.js", import.meta.url));
|
|
10
|
+
|
|
11
|
+
function run(root, ...args) {
|
|
12
|
+
return spawnSync(process.execPath, [cli, ...args, "--root", root], {
|
|
13
|
+
encoding: "utf8",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
test("workspace check accepts formatting differences without changing files", (context) => {
|
|
18
|
+
// Resolve macOS temp aliases so Biome loads the fixture's actual config.
|
|
19
|
+
const root = fs.realpathSync(
|
|
20
|
+
fs.mkdtempSync(path.join(os.tmpdir(), "agent-workflows-check-")),
|
|
21
|
+
);
|
|
22
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
23
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
24
|
+
const config = {
|
|
25
|
+
artifactDirectories: ["prds", "plans", "designs", "research", "docs"],
|
|
26
|
+
};
|
|
27
|
+
for (const content of [
|
|
28
|
+
JSON.stringify(config),
|
|
29
|
+
JSON.stringify(config, null, 2),
|
|
30
|
+
]) {
|
|
31
|
+
fs.writeFileSync(configPath, content);
|
|
32
|
+
const result = run(root, "check");
|
|
33
|
+
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
34
|
+
assert.equal(fs.readFileSync(configPath, "utf8"), content);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const biomeConfig = JSON.stringify({
|
|
38
|
+
formatter: { enabled: true },
|
|
39
|
+
overrides: [
|
|
40
|
+
{ includes: ["workspace.config.json"], formatter: { enabled: true } },
|
|
41
|
+
],
|
|
42
|
+
linter: {
|
|
43
|
+
rules: { preset: "recommended", suspicious: { noDebugger: "error" } },
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
fs.writeFileSync(path.join(root, "biome.json"), biomeConfig);
|
|
47
|
+
const sourcePath = path.join(root, "example.js");
|
|
48
|
+
const source = 'export const value={name:"example"}';
|
|
49
|
+
fs.writeFileSync(sourcePath, source);
|
|
50
|
+
const result = run(root, "check");
|
|
51
|
+
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
52
|
+
assert.equal(fs.readFileSync(sourcePath, "utf8"), source);
|
|
53
|
+
assert.equal(
|
|
54
|
+
fs.readFileSync(path.join(root, "biome.json"), "utf8"),
|
|
55
|
+
biomeConfig,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// Consumer lint rules must still reject actual code problems.
|
|
59
|
+
fs.writeFileSync(sourcePath, "debugger;\n");
|
|
60
|
+
const invalidSource = run(root, "check");
|
|
61
|
+
assert.equal(invalidSource.status, 1);
|
|
62
|
+
assert.match(invalidSource.stdout + invalidSource.stderr, /noDebugger/);
|
|
63
|
+
assert.equal(fs.readFileSync(sourcePath, "utf8"), "debugger;\n");
|
|
64
|
+
|
|
65
|
+
fs.writeFileSync(sourcePath, "export const value = ;\n");
|
|
66
|
+
const invalidSyntax = run(root, "check");
|
|
67
|
+
assert.equal(invalidSyntax.status, 1);
|
|
68
|
+
assert.match(invalidSyntax.stdout + invalidSyntax.stderr, /parse/);
|
|
69
|
+
assert.equal(fs.readFileSync(sourcePath, "utf8"), "export const value = ;\n");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("workspace check preserves syntax, settings, and integrity failures", (context) => {
|
|
73
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "agent-workflows-check-"));
|
|
74
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
75
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
76
|
+
for (const [content, diagnostic] of [
|
|
77
|
+
["{broken", /could not be read as JSON/],
|
|
78
|
+
['{"autoMode":{"enabled":"yes"}}', /invalid autoMode configuration/],
|
|
79
|
+
]) {
|
|
80
|
+
fs.writeFileSync(configPath, content);
|
|
81
|
+
const result = run(root, "check");
|
|
82
|
+
assert.equal(result.status, 1);
|
|
83
|
+
assert.match(result.stderr, diagnostic);
|
|
84
|
+
assert.equal(fs.readFileSync(configPath, "utf8"), content);
|
|
85
|
+
}
|
|
86
|
+
fs.writeFileSync(configPath, '{"artifactDirectories":["prds"]}');
|
|
87
|
+
fs.mkdirSync(path.join(root, "prds"));
|
|
88
|
+
const artifact =
|
|
89
|
+
"# Fixture\n\n- PRD ID: `PRD-20261102-duplicate`\n- Status: `draft`\n";
|
|
90
|
+
for (const name of ["first.md", "second.md"]) {
|
|
91
|
+
fs.writeFileSync(path.join(root, "prds", name), artifact);
|
|
92
|
+
}
|
|
93
|
+
const invalidArtifacts = run(root, "check");
|
|
94
|
+
assert.equal(invalidArtifacts.status, 1);
|
|
95
|
+
assert.match(
|
|
96
|
+
invalidArtifacts.stdout + invalidArtifacts.stderr,
|
|
97
|
+
/Duplicate artifact ID/,
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test("workspace check validates model config keys and values", (context) => {
|
|
102
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "agent-workflows-check-"));
|
|
103
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
104
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
105
|
+
|
|
106
|
+
fs.writeFileSync(
|
|
107
|
+
configPath,
|
|
108
|
+
JSON.stringify({ agentModels: { "unknown-role": "inherit" } }, null, 2),
|
|
109
|
+
);
|
|
110
|
+
const invalidRole = run(root, "check");
|
|
111
|
+
assert.equal(invalidRole.status, 1);
|
|
112
|
+
assert.match(invalidRole.stderr, /unknown role "unknown-role"/);
|
|
113
|
+
|
|
114
|
+
fs.writeFileSync(
|
|
115
|
+
configPath,
|
|
116
|
+
JSON.stringify({ agentModels: { "tech-lead": "" } }, null, 2),
|
|
117
|
+
);
|
|
118
|
+
const invalidModel = run(root, "check");
|
|
119
|
+
assert.equal(invalidModel.status, 1);
|
|
120
|
+
assert.match(invalidModel.stderr, /invalid model/);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("auto mode persists in workspace config and survives workflow updates", (context) => {
|
|
124
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "agent-workflows-auto-"));
|
|
125
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
126
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
127
|
+
|
|
128
|
+
assert.match(run(root, "auto", "status").stdout, /Auto mode: off/);
|
|
129
|
+
assert.equal(
|
|
130
|
+
JSON.parse(fs.readFileSync(configPath, "utf8")).autoMode.enabled,
|
|
131
|
+
false,
|
|
132
|
+
);
|
|
133
|
+
assert.equal(run(root, "init").status, 0);
|
|
134
|
+
assert.equal(run(root, "auto", "on").status, 0);
|
|
135
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
136
|
+
config.projectNote = "keep this";
|
|
137
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
138
|
+
assert.equal(run(root, "update").status, 0);
|
|
139
|
+
assert.match(run(root, "auto", "status").stdout, /Auto mode: on/);
|
|
140
|
+
assert.equal(
|
|
141
|
+
JSON.parse(fs.readFileSync(configPath, "utf8")).projectNote,
|
|
142
|
+
"keep this",
|
|
143
|
+
);
|
|
144
|
+
assert.match(run(root, "auto", "toggle").stdout, /Auto mode: off/);
|
|
145
|
+
assert.match(run(root, "auto", "toggle").stdout, /Auto mode: on/);
|
|
146
|
+
assert.match(run(root, "auto", "off").stdout, /Auto mode: off/);
|
|
147
|
+
assert.equal(
|
|
148
|
+
fs.existsSync(path.join(root, ".codex/prompts/auto-mode.md")),
|
|
149
|
+
true,
|
|
150
|
+
);
|
|
151
|
+
assert.equal(
|
|
152
|
+
fs.existsSync(path.join(root, ".claude/skills/auto-mode/SKILL.md")),
|
|
153
|
+
true,
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("legacy auto mode migrates to workspace config and keeps unrelated metadata", (context) => {
|
|
158
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "agent-workflows-auto-"));
|
|
159
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
160
|
+
assert.equal(run(root, "init").status, 0);
|
|
161
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
162
|
+
const configBeforeMigration = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
163
|
+
delete configBeforeMigration.autoMode;
|
|
164
|
+
fs.writeFileSync(configPath, JSON.stringify(configBeforeMigration));
|
|
165
|
+
const legacyPath = path.join(root, ".agent-workflows/metadata.json");
|
|
166
|
+
fs.mkdirSync(path.dirname(legacyPath), { recursive: true });
|
|
167
|
+
fs.writeFileSync(
|
|
168
|
+
legacyPath,
|
|
169
|
+
JSON.stringify({
|
|
170
|
+
autoMode: { enabled: true, updatedAt: "2026-10-01T08:39:26.255Z" },
|
|
171
|
+
projectNote: "preserve me",
|
|
172
|
+
}),
|
|
173
|
+
);
|
|
174
|
+
assert.equal(run(root, "update").status, 0);
|
|
175
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
176
|
+
assert.deepEqual(config.autoMode, {
|
|
177
|
+
enabled: true,
|
|
178
|
+
updatedAt: "2026-10-01T08:39:26.255Z",
|
|
179
|
+
});
|
|
180
|
+
assert.deepEqual(JSON.parse(fs.readFileSync(legacyPath, "utf8")), {
|
|
181
|
+
projectNote: "preserve me",
|
|
182
|
+
});
|
|
183
|
+
assert.match(run(root, "auto", "status").stdout, /Auto mode: on/);
|
|
184
|
+
|
|
185
|
+
const explicitConfig = { ...config, autoMode: { enabled: false } };
|
|
186
|
+
fs.writeFileSync(configPath, JSON.stringify(explicitConfig));
|
|
187
|
+
fs.writeFileSync(
|
|
188
|
+
legacyPath,
|
|
189
|
+
JSON.stringify({ autoMode: { enabled: true }, projectNote: "keep me too" }),
|
|
190
|
+
);
|
|
191
|
+
assert.equal(run(root, "update").status, 0);
|
|
192
|
+
assert.match(run(root, "auto", "status").stdout, /Auto mode: off/);
|
|
193
|
+
assert.deepEqual(JSON.parse(fs.readFileSync(legacyPath, "utf8")), {
|
|
194
|
+
projectNote: "keep me too",
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
const freshRoot = fs.mkdtempSync(
|
|
198
|
+
path.join(os.tmpdir(), "agent-workflows-auto-init-"),
|
|
199
|
+
);
|
|
200
|
+
context.after(() => fs.rmSync(freshRoot, { recursive: true, force: true }));
|
|
201
|
+
const freshLegacyPath = path.join(
|
|
202
|
+
freshRoot,
|
|
203
|
+
".agent-workflows/metadata.json",
|
|
204
|
+
);
|
|
205
|
+
fs.mkdirSync(path.dirname(freshLegacyPath), { recursive: true });
|
|
206
|
+
fs.writeFileSync(
|
|
207
|
+
freshLegacyPath,
|
|
208
|
+
JSON.stringify({ autoMode: { enabled: true } }),
|
|
209
|
+
);
|
|
210
|
+
assert.equal(run(freshRoot, "init").status, 0);
|
|
211
|
+
assert.equal(
|
|
212
|
+
JSON.parse(
|
|
213
|
+
fs.readFileSync(path.join(freshRoot, "workspace.config.json"), "utf8"),
|
|
214
|
+
).autoMode.enabled,
|
|
215
|
+
true,
|
|
216
|
+
);
|
|
217
|
+
assert.equal(fs.existsSync(freshLegacyPath), false);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
test("invalid auto mode config fails closed without overwriting it", (context) => {
|
|
221
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "agent-workflows-auto-"));
|
|
222
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
223
|
+
const target = path.join(root, "workspace.config.json");
|
|
224
|
+
fs.writeFileSync(target, '{"autoMode":{"enabled":"yes"}}');
|
|
225
|
+
const result = run(root, "auto", "on");
|
|
226
|
+
assert.equal(result.status, 1);
|
|
227
|
+
assert.match(result.stderr, /invalid autoMode configuration/);
|
|
228
|
+
assert.equal(
|
|
229
|
+
fs.readFileSync(target, "utf8"),
|
|
230
|
+
'{"autoMode":{"enabled":"yes"}}',
|
|
231
|
+
);
|
|
232
|
+
fs.writeFileSync(target, "{broken");
|
|
233
|
+
const malformed = run(root, "auto", "status");
|
|
234
|
+
assert.equal(malformed.status, 1);
|
|
235
|
+
assert.match(malformed.stderr, /could not be read as JSON/);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test("runtime-specific role models sync and survive legacy updates", (context) => {
|
|
239
|
+
const root = fs.mkdtempSync(
|
|
240
|
+
path.join(os.tmpdir(), "agent-workflows-models-"),
|
|
241
|
+
);
|
|
242
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
243
|
+
assert.equal(run(root, "init").status, 0);
|
|
244
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
245
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
246
|
+
config.agentModels["tech-lead"] = {
|
|
247
|
+
antigravity: "pro",
|
|
248
|
+
claude: "example-claude-v2",
|
|
249
|
+
};
|
|
250
|
+
config.agentModels["frontend-developer"] = {
|
|
251
|
+
antigravity: "flash",
|
|
252
|
+
claude: "example-ui-3",
|
|
253
|
+
};
|
|
254
|
+
fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`);
|
|
255
|
+
|
|
256
|
+
const firstSync = run(root, "agents", "sync", "--format", "antigravity");
|
|
257
|
+
assert.equal(firstSync.status, 0, firstSync.stderr);
|
|
258
|
+
assert.match(
|
|
259
|
+
firstSync.stdout,
|
|
260
|
+
/tech-lead: antigravity=pro, claude=example-claude-v2 \(updated/,
|
|
261
|
+
);
|
|
262
|
+
for (const [role, agentsModel, claudeModel] of [
|
|
263
|
+
["frontend-developer", "flash", "example-ui-3"],
|
|
264
|
+
["project-manager", "inherit", "inherit"],
|
|
265
|
+
]) {
|
|
266
|
+
assert.match(
|
|
267
|
+
fs.readFileSync(
|
|
268
|
+
path.join(root, `.agents/agents/${role}/agent.md`),
|
|
269
|
+
"utf8",
|
|
270
|
+
),
|
|
271
|
+
new RegExp(`^model: ${agentsModel}$`, "m"),
|
|
272
|
+
);
|
|
273
|
+
assert.match(
|
|
274
|
+
fs.readFileSync(path.join(root, `.claude/agents/${role}.md`), "utf8"),
|
|
275
|
+
new RegExp(`^model: ${claudeModel}$`, "m"),
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
assert.match(
|
|
279
|
+
fs.readFileSync(
|
|
280
|
+
path.join(root, ".agents/agents/tech-lead/agent.md"),
|
|
281
|
+
"utf8",
|
|
282
|
+
),
|
|
283
|
+
/^model: pro$/m,
|
|
284
|
+
);
|
|
285
|
+
assert.match(
|
|
286
|
+
fs.readFileSync(path.join(root, ".claude/agents/tech-lead.md"), "utf8"),
|
|
287
|
+
/^model: example-claude-v2$/m,
|
|
288
|
+
);
|
|
289
|
+
assert.match(
|
|
290
|
+
run(root, "agents", "sync", "--format", "antigravity").stdout,
|
|
291
|
+
/already up to date/,
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
const manifestPath = path.join(root, ".agent-workflows/manifest.json");
|
|
295
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
296
|
+
manifest.managedPaths.push("workspace.config.json");
|
|
297
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest));
|
|
298
|
+
assert.equal(run(root, "update").status, 0);
|
|
299
|
+
assert.equal(
|
|
300
|
+
JSON.parse(fs.readFileSync(configPath, "utf8")).agentModels["tech-lead"]
|
|
301
|
+
.antigravity,
|
|
302
|
+
"pro",
|
|
303
|
+
);
|
|
304
|
+
assert.match(
|
|
305
|
+
fs.readFileSync(path.join(root, ".claude/agents/tech-lead.md"), "utf8"),
|
|
306
|
+
/^model: example-claude-v2$/m,
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
config.agentModels["tech-lead"] = "inherit";
|
|
310
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
311
|
+
assert.equal(run(root, "agents", "sync").status, 0);
|
|
312
|
+
assert.match(
|
|
313
|
+
fs.readFileSync(
|
|
314
|
+
path.join(root, ".agents/agents/tech-lead/agent.md"),
|
|
315
|
+
"utf8",
|
|
316
|
+
),
|
|
317
|
+
/^model: inherit$/m,
|
|
318
|
+
);
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
test("legacy agents and claude model objects remain readable during update", (context) => {
|
|
322
|
+
const root = fs.mkdtempSync(
|
|
323
|
+
path.join(os.tmpdir(), "agent-workflows-legacy-models-"),
|
|
324
|
+
);
|
|
325
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
326
|
+
assert.equal(run(root, "init").status, 0);
|
|
327
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
328
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
329
|
+
config.agentModels["tech-lead"] = {
|
|
330
|
+
agents: "inherit",
|
|
331
|
+
claude: "sonnet",
|
|
332
|
+
};
|
|
333
|
+
config.workflowModels = {
|
|
334
|
+
planning: {
|
|
335
|
+
"tech-lead": { agents: "inherit", claude: "opus" },
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
339
|
+
const update = run(root, "update");
|
|
340
|
+
assert.equal(update.status, 0, update.stderr);
|
|
341
|
+
assert.match(
|
|
342
|
+
fs.readFileSync(
|
|
343
|
+
path.join(root, ".agents/agents/tech-lead/agent.md"),
|
|
344
|
+
"utf8",
|
|
345
|
+
),
|
|
346
|
+
/^model: inherit$/m,
|
|
347
|
+
);
|
|
348
|
+
assert.match(
|
|
349
|
+
fs.readFileSync(path.join(root, ".claude/agents/tech-lead.md"), "utf8"),
|
|
350
|
+
/^model: sonnet$/m,
|
|
351
|
+
);
|
|
352
|
+
const resolve = (format) => {
|
|
353
|
+
const result = run(
|
|
354
|
+
root,
|
|
355
|
+
"agents",
|
|
356
|
+
"resolve",
|
|
357
|
+
"planning",
|
|
358
|
+
"tech-lead",
|
|
359
|
+
"--format",
|
|
360
|
+
format,
|
|
361
|
+
"--json",
|
|
362
|
+
);
|
|
363
|
+
assert.equal(result.status, 0, result.stderr);
|
|
364
|
+
return JSON.parse(result.stdout).model;
|
|
365
|
+
};
|
|
366
|
+
assert.equal(resolve("agents"), "inherit");
|
|
367
|
+
assert.equal(resolve("claude"), "opus");
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
test("invalid role model configuration leaves agent definitions unchanged", (context) => {
|
|
371
|
+
const root = fs.mkdtempSync(
|
|
372
|
+
path.join(os.tmpdir(), "agent-workflows-models-"),
|
|
373
|
+
);
|
|
374
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
375
|
+
assert.equal(run(root, "init").status, 0);
|
|
376
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
377
|
+
const agentPath = path.join(root, ".agents/agents/tech-lead/agent.md");
|
|
378
|
+
const before = fs.readFileSync(agentPath, "utf8");
|
|
379
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
380
|
+
config.agentModels["tech-lead"] = "invalid model\nname";
|
|
381
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
382
|
+
const invalidValue = run(root, "agents", "sync");
|
|
383
|
+
assert.equal(invalidValue.status, 1);
|
|
384
|
+
assert.match(invalidValue.stderr, /agentModels\.tech-lead has invalid model/);
|
|
385
|
+
assert.equal(fs.readFileSync(agentPath, "utf8"), before);
|
|
386
|
+
assert.equal(run(root, "update").status, 1);
|
|
387
|
+
assert.equal(fs.readFileSync(agentPath, "utf8"), before);
|
|
388
|
+
|
|
389
|
+
config.agentModels["tech-lead"] = "inherit";
|
|
390
|
+
config.agentModels.unknown = "inherit";
|
|
391
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
392
|
+
assert.match(run(root, "agents", "sync").stderr, /unknown role/);
|
|
393
|
+
assert.equal(fs.readFileSync(agentPath, "utf8"), before);
|
|
394
|
+
config.agentModels = null;
|
|
395
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
396
|
+
assert.match(
|
|
397
|
+
run(root, "agents", "sync").stderr,
|
|
398
|
+
/agentModels must be an object/,
|
|
399
|
+
);
|
|
400
|
+
assert.equal(fs.readFileSync(agentPath, "utf8"), before);
|
|
401
|
+
fs.writeFileSync(configPath, "{broken");
|
|
402
|
+
assert.match(run(root, "agents", "sync").stderr, /could not be read as JSON/);
|
|
403
|
+
assert.equal(fs.readFileSync(agentPath, "utf8"), before);
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
test("workflow steps override role models with source attribution", (context) => {
|
|
407
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "agent-workflows-steps-"));
|
|
408
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
409
|
+
assert.equal(run(root, "init").status, 0);
|
|
410
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
411
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
412
|
+
config.agentModels["tech-lead"] = {
|
|
413
|
+
antigravity: "flash",
|
|
414
|
+
claude: "base-claude",
|
|
415
|
+
};
|
|
416
|
+
config.workflowModels = {
|
|
417
|
+
planning: {
|
|
418
|
+
default: { antigravity: "pro" },
|
|
419
|
+
"tech-lead": { antigravity: "flash", claude: "planning-claude" },
|
|
420
|
+
},
|
|
421
|
+
coding: { "tech-lead": { antigravity: "pro" } },
|
|
422
|
+
validation: { "tech-lead": { antigravity: "inherit" } },
|
|
423
|
+
};
|
|
424
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
425
|
+
const resolve = (step, role, format) => {
|
|
426
|
+
const result = run(
|
|
427
|
+
root,
|
|
428
|
+
"agents",
|
|
429
|
+
"resolve",
|
|
430
|
+
step,
|
|
431
|
+
role,
|
|
432
|
+
"--format",
|
|
433
|
+
format,
|
|
434
|
+
"--json",
|
|
435
|
+
);
|
|
436
|
+
assert.equal(result.status, 0, result.stderr);
|
|
437
|
+
return JSON.parse(result.stdout);
|
|
438
|
+
};
|
|
439
|
+
assert.deepEqual(resolve("planning", "tech-lead", "antigravity"), {
|
|
440
|
+
step: "planning",
|
|
441
|
+
role: "tech-lead",
|
|
442
|
+
format: "antigravity",
|
|
443
|
+
model: "flash",
|
|
444
|
+
source: "workflowModels.planning.tech-lead",
|
|
445
|
+
});
|
|
446
|
+
assert.equal(
|
|
447
|
+
resolve("planning", "tech-lead", "claude").model,
|
|
448
|
+
"planning-claude",
|
|
449
|
+
);
|
|
450
|
+
assert.equal(resolve("coding", "tech-lead", "antigravity").model, "pro");
|
|
451
|
+
assert.equal(
|
|
452
|
+
resolve("planning", "frontend-developer", "antigravity").model,
|
|
453
|
+
"pro",
|
|
454
|
+
);
|
|
455
|
+
assert.equal(resolve("research", "tech-lead", "antigravity").model, "flash");
|
|
456
|
+
assert.deepEqual(
|
|
457
|
+
[
|
|
458
|
+
resolve("validation", "tech-lead", "antigravity").model,
|
|
459
|
+
resolve("validation", "tech-lead", "antigravity").source,
|
|
460
|
+
],
|
|
461
|
+
["inherit", "workflowModels.validation.tech-lead"],
|
|
462
|
+
);
|
|
463
|
+
assert.match(
|
|
464
|
+
run(
|
|
465
|
+
root,
|
|
466
|
+
"agents",
|
|
467
|
+
"resolve",
|
|
468
|
+
"planning",
|
|
469
|
+
"tech-lead",
|
|
470
|
+
"--format",
|
|
471
|
+
"antigravity",
|
|
472
|
+
).stdout,
|
|
473
|
+
/flash \(source: workflowModels\.planning\.tech-lead; runtime: antigravity\)/,
|
|
474
|
+
);
|
|
475
|
+
assert.match(
|
|
476
|
+
run(root, "agents", "resolve", "unknown", "tech-lead", "--format", "agents")
|
|
477
|
+
.stderr,
|
|
478
|
+
/Unknown workflow step/,
|
|
479
|
+
);
|
|
480
|
+
assert.match(
|
|
481
|
+
run(root, "agents", "resolve", "planning", "unknown", "--format", "agents")
|
|
482
|
+
.stderr,
|
|
483
|
+
/Unknown agent role/,
|
|
484
|
+
);
|
|
485
|
+
assert.match(
|
|
486
|
+
run(root, "agents", "resolve", "planning", "tech-lead", "--format", "other")
|
|
487
|
+
.stderr,
|
|
488
|
+
/--format must be codex, antigravity, or claude/,
|
|
489
|
+
);
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
test("invalid workflow override fails before agent files change", (context) => {
|
|
493
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "agent-workflows-steps-"));
|
|
494
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
495
|
+
assert.equal(run(root, "init").status, 0);
|
|
496
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
497
|
+
const agentPath = path.join(root, ".agents/agents/tech-lead/agent.md");
|
|
498
|
+
const before = fs.readFileSync(agentPath, "utf8");
|
|
499
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
500
|
+
config.workflowModels = { planning: { "tech-lead": { agents: "partial" } } };
|
|
501
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
502
|
+
assert.match(
|
|
503
|
+
run(root, "agents", "sync").stderr,
|
|
504
|
+
/workflowModels\.planning\.tech-lead must use codex, antigravity, and\/or claude model keys/,
|
|
505
|
+
);
|
|
506
|
+
assert.equal(run(root, "update").status, 1);
|
|
507
|
+
assert.equal(fs.readFileSync(agentPath, "utf8"), before);
|
|
508
|
+
config.workflowModels = { unknown: { default: "inherit" } };
|
|
509
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
510
|
+
assert.match(run(root, "agents", "sync").stderr, /unknown step/);
|
|
511
|
+
assert.equal(fs.readFileSync(agentPath, "utf8"), before);
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
test("Antigravity model tiers are listed and invalid tiers fall back to inherit", (context) => {
|
|
515
|
+
const root = fs.mkdtempSync(
|
|
516
|
+
path.join(os.tmpdir(), "agent-workflows-antigravity-models-"),
|
|
517
|
+
);
|
|
518
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
519
|
+
assert.equal(run(root, "init").status, 0);
|
|
520
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
521
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
522
|
+
config.workflowModels = {
|
|
523
|
+
coding: { "tech-lead": { antigravity: "enterprise" } },
|
|
524
|
+
};
|
|
525
|
+
fs.writeFileSync(configPath, JSON.stringify(config));
|
|
526
|
+
const invalidModel = run(
|
|
527
|
+
root,
|
|
528
|
+
"agents",
|
|
529
|
+
"resolve",
|
|
530
|
+
"coding",
|
|
531
|
+
"tech-lead",
|
|
532
|
+
"--format",
|
|
533
|
+
"antigravity",
|
|
534
|
+
"--json",
|
|
535
|
+
);
|
|
536
|
+
assert.equal(invalidModel.status, 0, invalidModel.stderr);
|
|
537
|
+
assert.match(invalidModel.stderr, /not a supported Antigravity model tier/);
|
|
538
|
+
assert.deepEqual(JSON.parse(invalidModel.stdout), {
|
|
539
|
+
step: "coding",
|
|
540
|
+
role: "tech-lead",
|
|
541
|
+
format: "antigravity",
|
|
542
|
+
model: "inherit",
|
|
543
|
+
source: "invalid model fallback (runtime default)",
|
|
544
|
+
});
|
|
545
|
+
const models = run(
|
|
546
|
+
root,
|
|
547
|
+
"agents",
|
|
548
|
+
"models",
|
|
549
|
+
"--format",
|
|
550
|
+
"antigravity",
|
|
551
|
+
"--json",
|
|
552
|
+
);
|
|
553
|
+
assert.deepEqual(JSON.parse(models.stdout), {
|
|
554
|
+
format: "antigravity",
|
|
555
|
+
models: ["inherit", "flash", "pro"],
|
|
556
|
+
});
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
test("update backfills visible model defaults in legacy configs without replacing choices", (context) => {
|
|
560
|
+
const root = fs.mkdtempSync(
|
|
561
|
+
path.join(os.tmpdir(), "agent-workflows-upgrade-"),
|
|
562
|
+
);
|
|
563
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
564
|
+
assert.equal(run(root, "init").status, 0);
|
|
565
|
+
const configPath = path.join(root, "workspace.config.json");
|
|
566
|
+
fs.writeFileSync(
|
|
567
|
+
configPath,
|
|
568
|
+
JSON.stringify({
|
|
569
|
+
projectName: "Legacy project",
|
|
570
|
+
customSetting: { keep: true },
|
|
571
|
+
}),
|
|
572
|
+
);
|
|
573
|
+
const first = run(root, "update");
|
|
574
|
+
assert.equal(first.status, 0, first.stderr);
|
|
575
|
+
assert.match(first.stdout, /Added missing model defaults/);
|
|
576
|
+
const migrated = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
577
|
+
assert.equal(migrated.projectName, "Legacy project");
|
|
578
|
+
assert.deepEqual(migrated.customSetting, { keep: true });
|
|
579
|
+
const inheritedModels = {
|
|
580
|
+
codex: "inherit",
|
|
581
|
+
antigravity: "inherit",
|
|
582
|
+
claude: "inherit",
|
|
583
|
+
};
|
|
584
|
+
assert.deepEqual(migrated.agentModels, {
|
|
585
|
+
"project-manager": inheritedModels,
|
|
586
|
+
"tech-lead": inheritedModels,
|
|
587
|
+
"ui-ux-designer": inheritedModels,
|
|
588
|
+
"backend-developer": inheritedModels,
|
|
589
|
+
"frontend-developer": inheritedModels,
|
|
590
|
+
});
|
|
591
|
+
assert.deepEqual(migrated.workflowModels, { planning: {}, coding: {} });
|
|
592
|
+
|
|
593
|
+
fs.writeFileSync(
|
|
594
|
+
configPath,
|
|
595
|
+
JSON.stringify({
|
|
596
|
+
projectName: "Legacy project",
|
|
597
|
+
customSetting: { keep: true },
|
|
598
|
+
agentModels: { "tech-lead": "chosen-model" },
|
|
599
|
+
workflowModels: { planning: { "tech-lead": "planning-model" } },
|
|
600
|
+
}),
|
|
601
|
+
);
|
|
602
|
+
const second = run(root, "update");
|
|
603
|
+
assert.equal(second.status, 0, second.stderr);
|
|
604
|
+
const partial = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
605
|
+
assert.equal(partial.agentModels["tech-lead"], "chosen-model");
|
|
606
|
+
assert.deepEqual(partial.agentModels["backend-developer"], inheritedModels);
|
|
607
|
+
assert.equal(partial.workflowModels.planning["tech-lead"], "planning-model");
|
|
608
|
+
assert.deepEqual(partial.workflowModels.coding, {});
|
|
609
|
+
const textAfterMigration = fs.readFileSync(configPath, "utf8");
|
|
610
|
+
const third = run(root, "update");
|
|
611
|
+
assert.equal(third.status, 0, third.stderr);
|
|
612
|
+
assert.doesNotMatch(third.stdout, /Added missing model defaults/);
|
|
613
|
+
assert.equal(fs.readFileSync(configPath, "utf8"), textAfterMigration);
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
test("add-project discovery installs and updates without replacing project data", (context) => {
|
|
617
|
+
const root = fs.mkdtempSync(
|
|
618
|
+
path.join(os.tmpdir(), "agent-workflows-add-project-"),
|
|
619
|
+
);
|
|
620
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
621
|
+
const initialized = run(root, "init");
|
|
622
|
+
assert.equal(initialized.status, 0, initialized.stderr);
|
|
623
|
+
for (const relative of [
|
|
624
|
+
".agents/skills/add-project/SKILL.md",
|
|
625
|
+
".agents/skills/add-project/references/save-protocol.md",
|
|
626
|
+
".codex/prompts/add-project.md",
|
|
627
|
+
".claude/skills/add-project/SKILL.md",
|
|
628
|
+
"commands/add-project.md",
|
|
629
|
+
]) {
|
|
630
|
+
assert.equal(fs.existsSync(path.join(root, relative)), true, relative);
|
|
631
|
+
}
|
|
632
|
+
const profilePath = path.join(root, "project/repositories.json");
|
|
633
|
+
const profile = { repositories: [], custom: "keep developer configuration" };
|
|
634
|
+
fs.writeFileSync(profilePath, JSON.stringify(profile));
|
|
635
|
+
const refreshed = run(root, "update");
|
|
636
|
+
assert.equal(refreshed.status, 0, refreshed.stderr);
|
|
637
|
+
assert.deepEqual(JSON.parse(fs.readFileSync(profilePath, "utf8")), profile);
|
|
638
|
+
const skillShim = fs.readFileSync(
|
|
639
|
+
path.join(root, ".agents/skills/add-project/SKILL.md"),
|
|
640
|
+
"utf8",
|
|
641
|
+
);
|
|
642
|
+
assert.match(skillShim, /packaged/i);
|
|
643
|
+
assert.match(skillShim, /add-project/);
|
|
644
|
+
assert.equal(
|
|
645
|
+
fs.existsSync(path.join(root, "scripts/add-project.mjs")),
|
|
646
|
+
false,
|
|
647
|
+
);
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
test("packaged add-project helper targets a consumer rather than the source template", (context) => {
|
|
651
|
+
const root = fs.mkdtempSync(
|
|
652
|
+
path.join(os.tmpdir(), "agent-workflows-add-consumer-"),
|
|
653
|
+
);
|
|
654
|
+
context.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
655
|
+
const sourceProfile = fileURLToPath(
|
|
656
|
+
new URL("../project/repositories.json", import.meta.url),
|
|
657
|
+
);
|
|
658
|
+
const sourceBefore = fs.readFileSync(sourceProfile, "utf8");
|
|
659
|
+
assert.equal(run(root, "init").status, 0);
|
|
660
|
+
const initializedGit = spawnSync("git", ["init", root], { encoding: "utf8" });
|
|
661
|
+
assert.equal(initializedGit.status, 0, initializedGit.stderr);
|
|
662
|
+
const profilePath = path.join(root, "project/repositories.json");
|
|
663
|
+
const profileBefore = fs.readFileSync(profilePath, "utf8");
|
|
664
|
+
const request = path.join(root, "empty-request.json");
|
|
665
|
+
fs.writeFileSync(request, JSON.stringify({ entries: [] }));
|
|
666
|
+
const helper = fileURLToPath(
|
|
667
|
+
new URL("../scripts/add-project.mjs", import.meta.url),
|
|
668
|
+
);
|
|
669
|
+
const result = spawnSync(
|
|
670
|
+
process.execPath,
|
|
671
|
+
[helper, "save", "--root", root, "--request", request],
|
|
672
|
+
{
|
|
673
|
+
cwd: root,
|
|
674
|
+
encoding: "utf8",
|
|
675
|
+
},
|
|
676
|
+
);
|
|
677
|
+
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
678
|
+
assert.equal(JSON.parse(result.stdout).status, "empty");
|
|
679
|
+
assert.equal(fs.readFileSync(profilePath, "utf8"), profileBefore);
|
|
680
|
+
assert.equal(fs.readFileSync(sourceProfile, "utf8"), sourceBefore);
|
|
681
|
+
assert.equal(fs.existsSync(path.join(root, ".gitmodules")), false);
|
|
682
|
+
});
|