agile-context-engineering 0.2.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +10 -0
- package/CHANGELOG.md +82 -0
- package/README.md +27 -18
- package/agents/ace-product-owner.md +1 -1
- package/agents/ace-technical-application-architect.md +28 -0
- package/agents/ace-wiki-mapper.md +144 -29
- package/bin/install.js +67 -63
- package/hooks/ace-check-update.js +17 -9
- package/package.json +7 -5
- package/shared/lib/ace-core.js +308 -0
- package/shared/lib/ace-core.test.js +308 -0
- package/shared/lib/ace-github.js +753 -0
- package/shared/lib/ace-story.js +400 -0
- package/shared/lib/ace-story.test.js +250 -0
- package/{agile-context-engineering → shared}/utils/ui-formatting.md +299 -299
- package/skills/execute-story/SKILL.md +110 -0
- package/skills/execute-story/script.js +305 -0
- package/skills/execute-story/script.test.js +261 -0
- package/skills/execute-story/walkthrough-template.xml +255 -0
- package/{agile-context-engineering/workflows/execute-story.xml → skills/execute-story/workflow.xml} +83 -9
- package/skills/help/SKILL.md +69 -0
- package/skills/help/script.js +318 -0
- package/skills/help/script.test.js +183 -0
- package/{agile-context-engineering/workflows/help.xml → skills/help/workflow.xml} +8 -8
- package/skills/init-coding-standards/SKILL.md +72 -0
- package/{agile-context-engineering/templates/wiki/coding-standards.xml → skills/init-coding-standards/coding-standards-template.xml} +38 -0
- package/skills/init-coding-standards/script.js +59 -0
- package/skills/init-coding-standards/script.test.js +70 -0
- package/{agile-context-engineering/workflows/init-coding-standards.xml → skills/init-coding-standards/workflow.xml} +4 -9
- package/skills/map-cross-cutting/SKILL.md +89 -0
- package/skills/map-cross-cutting/workflow.xml +330 -0
- package/skills/map-guide/SKILL.md +89 -0
- package/skills/map-guide/workflow.xml +320 -0
- package/skills/map-pattern/SKILL.md +89 -0
- package/skills/map-pattern/workflow.xml +331 -0
- package/skills/map-story/SKILL.md +127 -0
- package/skills/map-story/templates/guide.xml +137 -0
- package/skills/map-story/templates/pattern.xml +159 -0
- package/skills/map-story/templates/system-cross-cutting.xml +197 -0
- package/skills/map-story/templates/walkthrough.xml +255 -0
- package/{agile-context-engineering/workflows/map-story.xml → skills/map-story/workflow.xml} +258 -9
- package/skills/map-subsystem/SKILL.md +111 -0
- package/skills/map-subsystem/script.js +60 -0
- package/skills/map-subsystem/script.test.js +68 -0
- package/skills/map-subsystem/templates/decizions.xml +115 -0
- package/skills/map-subsystem/templates/guide.xml +137 -0
- package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/module-discovery.xml +3 -3
- package/skills/map-subsystem/templates/pattern.xml +159 -0
- package/skills/map-subsystem/templates/system-cross-cutting.xml +197 -0
- package/skills/map-subsystem/templates/system.xml +381 -0
- package/skills/map-subsystem/templates/walkthrough.xml +255 -0
- package/{agile-context-engineering/workflows/map-subsystem.xml → skills/map-subsystem/workflow.xml} +17 -21
- package/skills/map-sys-doc/SKILL.md +90 -0
- package/skills/map-sys-doc/system.xml +381 -0
- package/skills/map-sys-doc/workflow.xml +336 -0
- package/skills/map-system/SKILL.md +85 -0
- package/skills/map-system/script.js +84 -0
- package/skills/map-system/script.test.js +73 -0
- package/skills/map-system/templates/wiki-readme.xml +297 -0
- package/{agile-context-engineering/workflows/map-system.xml → skills/map-system/workflow.xml} +11 -16
- package/skills/map-walkthrough/SKILL.md +92 -0
- package/skills/map-walkthrough/walkthrough.xml +255 -0
- package/skills/map-walkthrough/workflow.xml +457 -0
- package/skills/plan-backlog/SKILL.md +75 -0
- package/skills/plan-backlog/script.js +136 -0
- package/skills/plan-backlog/script.test.js +83 -0
- package/{agile-context-engineering/workflows/plan-backlog.xml → skills/plan-backlog/workflow.xml} +13 -21
- package/skills/plan-feature/SKILL.md +76 -0
- package/skills/plan-feature/script.js +148 -0
- package/skills/plan-feature/script.test.js +80 -0
- package/{agile-context-engineering/workflows/plan-feature.xml → skills/plan-feature/workflow.xml} +21 -29
- package/skills/plan-product-vision/SKILL.md +75 -0
- package/skills/plan-product-vision/script.js +60 -0
- package/skills/plan-product-vision/script.test.js +69 -0
- package/{agile-context-engineering/workflows/plan-product-vision.xml → skills/plan-product-vision/workflow.xml} +4 -9
- package/skills/plan-story/SKILL.md +116 -0
- package/skills/plan-story/script.js +326 -0
- package/skills/plan-story/script.test.js +240 -0
- package/skills/plan-story/story-template.xml +451 -0
- package/{agile-context-engineering/workflows/plan-story.xml → skills/plan-story/workflow.xml} +1285 -909
- package/skills/research-external-solution/SKILL.md +107 -0
- package/skills/research-external-solution/script.js +238 -0
- package/skills/research-external-solution/script.test.js +134 -0
- package/{agile-context-engineering/workflows/research-external-solution.xml → skills/research-external-solution/workflow.xml} +4 -6
- package/skills/research-integration-solution/SKILL.md +98 -0
- package/{agile-context-engineering/templates/product/story-integration-solution.xml → skills/research-integration-solution/integration-solution-template.xml} +1 -0
- package/skills/research-integration-solution/script.js +231 -0
- package/skills/research-integration-solution/script.test.js +134 -0
- package/{agile-context-engineering/workflows/research-integration-solution.xml → skills/research-integration-solution/workflow.xml} +4 -5
- package/skills/research-story-wiki/SKILL.md +92 -0
- package/skills/research-story-wiki/script.js +231 -0
- package/skills/research-story-wiki/script.test.js +138 -0
- package/{agile-context-engineering/templates/product/story-wiki.xml → skills/research-story-wiki/story-wiki-template.xml} +4 -0
- package/{agile-context-engineering/workflows/research-story-wiki.xml → skills/research-story-wiki/workflow.xml} +5 -6
- package/skills/research-technical-solution/SKILL.md +103 -0
- package/skills/research-technical-solution/script.js +231 -0
- package/skills/research-technical-solution/script.test.js +134 -0
- package/{agile-context-engineering/workflows/research-technical-solution.xml → skills/research-technical-solution/workflow.xml} +4 -5
- package/skills/review-story/SKILL.md +100 -0
- package/skills/review-story/script.js +257 -0
- package/skills/review-story/script.test.js +169 -0
- package/skills/review-story/story-template.xml +451 -0
- package/{agile-context-engineering/workflows/review-story.xml → skills/review-story/workflow.xml} +1 -3
- package/skills/update/SKILL.md +53 -0
- package/{agile-context-engineering/workflows/update.xml → skills/update/workflow.xml} +237 -207
- package/agile-context-engineering/src/ace-tools.js +0 -2881
- package/agile-context-engineering/src/ace-tools.test.js +0 -1089
- package/agile-context-engineering/templates/_command.md +0 -54
- package/agile-context-engineering/templates/_workflow.xml +0 -17
- package/agile-context-engineering/templates/config.json +0 -0
- package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
- package/agile-context-engineering/templates/wiki/wiki-readme.xml +0 -276
- package/commands/ace/execute-story.md +0 -137
- package/commands/ace/help.md +0 -93
- package/commands/ace/init-coding-standards.md +0 -83
- package/commands/ace/map-story.md +0 -156
- package/commands/ace/map-subsystem.md +0 -138
- package/commands/ace/map-system.md +0 -92
- package/commands/ace/plan-backlog.md +0 -83
- package/commands/ace/plan-feature.md +0 -89
- package/commands/ace/plan-product-vision.md +0 -81
- package/commands/ace/plan-story.md +0 -145
- package/commands/ace/research-external-solution.md +0 -138
- package/commands/ace/research-integration-solution.md +0 -135
- package/commands/ace/research-story-wiki.md +0 -116
- package/commands/ace/research-technical-solution.md +0 -147
- package/commands/ace/review-story.md +0 -109
- package/commands/ace/update.md +0 -54
- /package/{agile-context-engineering → shared}/utils/questioning.xml +0 -0
- /package/{agile-context-engineering/templates/product/story.xml → skills/execute-story/story-template.xml} +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-cross-cutting}/system-cross-cutting.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-guide}/guide.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-pattern}/pattern.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/decizions.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/system.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/tech-debt-index.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-architecture.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-structure.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-architecture.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-structure.xml +0 -0
- /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/testing-framework.xml +0 -0
- /package/{agile-context-engineering/templates/product/product-backlog.xml → skills/plan-backlog/product-backlog-template.xml} +0 -0
- /package/{agile-context-engineering/templates/product/feature.xml → skills/plan-feature/feature-template.xml} +0 -0
- /package/{agile-context-engineering/templates/product/product-vision.xml → skills/plan-product-vision/product-vision-template.xml} +0 -0
- /package/{agile-context-engineering/templates/product/external-solution.xml → skills/research-external-solution/external-solution-template.xml} +0 -0
- /package/{agile-context-engineering/templates/product/story-technical-solution.xml → skills/research-technical-solution/technical-solution-template.xml} +0 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
const { describe, it, beforeEach, afterEach } = require('node:test');
|
|
2
|
+
const assert = require('node:assert');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
loadConfig, pathExists, safeReadFile, generateSlug, currentTimestamp,
|
|
9
|
+
resolveModel, detectBrownfieldStatus,
|
|
10
|
+
loadSettings, writeSettings, parseKeyValueArgs, MODEL_PROFILES,
|
|
11
|
+
} = require('./ace-core');
|
|
12
|
+
|
|
13
|
+
function createTempDir() {
|
|
14
|
+
return fs.mkdtempSync(path.join(os.tmpdir(), 'ace-core-test-'));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function cleanup(dir) {
|
|
18
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// ─── generateSlug ────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
describe('generateSlug', () => {
|
|
24
|
+
it('converts text to lowercase slug', () => {
|
|
25
|
+
assert.strictEqual(generateSlug('Hello World'), 'hello-world');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('handles special characters', () => {
|
|
29
|
+
assert.strictEqual(generateSlug('User Authentication & Login!!!'), 'user-authentication-login');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('trims leading and trailing dashes', () => {
|
|
33
|
+
assert.strictEqual(generateSlug('---hello---'), 'hello');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('returns null for empty input', () => {
|
|
37
|
+
assert.strictEqual(generateSlug(''), null);
|
|
38
|
+
assert.strictEqual(generateSlug(null), null);
|
|
39
|
+
assert.strictEqual(generateSlug(undefined), null);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('handles multi-word input', () => {
|
|
43
|
+
assert.strictEqual(generateSlug('Platform Foundation Setup'), 'platform-foundation-setup');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('handles numeric IDs in text', () => {
|
|
47
|
+
assert.strictEqual(generateSlug('E1-Platform Foundation'), 'e1-platform-foundation');
|
|
48
|
+
assert.strictEqual(generateSlug('#45-User Auth'), '45-user-auth');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// ─── currentTimestamp ────────────────────────────────────────────────────────
|
|
53
|
+
|
|
54
|
+
describe('currentTimestamp', () => {
|
|
55
|
+
it('returns full ISO timestamp by default', () => {
|
|
56
|
+
const ts = currentTimestamp('full');
|
|
57
|
+
assert.match(ts, /^\d{4}-\d{2}-\d{2}T/);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('returns date-only format', () => {
|
|
61
|
+
const ts = currentTimestamp('date');
|
|
62
|
+
assert.match(ts, /^\d{4}-\d{2}-\d{2}$/);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('returns filename-safe format', () => {
|
|
66
|
+
const ts = currentTimestamp('filename');
|
|
67
|
+
assert.ok(!ts.includes(':'), 'should not contain colons');
|
|
68
|
+
assert.ok(ts.includes('_'), 'should contain underscore separator');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// ─── loadConfig ──────────────────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
describe('loadConfig', () => {
|
|
75
|
+
let tmpDir;
|
|
76
|
+
beforeEach(() => { tmpDir = createTempDir(); });
|
|
77
|
+
afterEach(() => { cleanup(tmpDir); });
|
|
78
|
+
|
|
79
|
+
it('returns defaults when no config file exists', () => {
|
|
80
|
+
const config = loadConfig(tmpDir);
|
|
81
|
+
assert.strictEqual(config.version, '0.1.0');
|
|
82
|
+
assert.strictEqual(config.projectName, '');
|
|
83
|
+
assert.strictEqual(config.storage, 'local');
|
|
84
|
+
assert.strictEqual(config.commit_docs, true);
|
|
85
|
+
assert.strictEqual(config.github.enabled, false);
|
|
86
|
+
assert.strictEqual(config.github.labels.epic, 'ace:epic');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('reads existing config and merges with defaults', () => {
|
|
90
|
+
fs.mkdirSync(path.join(tmpDir, '.ace'), { recursive: true });
|
|
91
|
+
fs.writeFileSync(path.join(tmpDir, '.ace', 'config.json'), JSON.stringify({
|
|
92
|
+
projectName: 'Test Project',
|
|
93
|
+
github: { enabled: true, repo: 'owner/repo' },
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
const config = loadConfig(tmpDir);
|
|
97
|
+
assert.strictEqual(config.projectName, 'Test Project');
|
|
98
|
+
assert.strictEqual(config.github.enabled, true);
|
|
99
|
+
assert.strictEqual(config.github.repo, 'owner/repo');
|
|
100
|
+
assert.strictEqual(config.version, '0.1.0'); // default
|
|
101
|
+
assert.strictEqual(config.github.labels.epic, 'ace:epic'); // default
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('handles malformed JSON gracefully', () => {
|
|
105
|
+
fs.mkdirSync(path.join(tmpDir, '.ace'), { recursive: true });
|
|
106
|
+
fs.writeFileSync(path.join(tmpDir, '.ace', 'config.json'), 'not json');
|
|
107
|
+
|
|
108
|
+
const config = loadConfig(tmpDir);
|
|
109
|
+
assert.strictEqual(config.version, '0.1.0');
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// ─── pathExists ──────────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
describe('pathExists', () => {
|
|
116
|
+
let tmpDir;
|
|
117
|
+
beforeEach(() => { tmpDir = createTempDir(); });
|
|
118
|
+
afterEach(() => { cleanup(tmpDir); });
|
|
119
|
+
|
|
120
|
+
it('returns true for existing directory', () => {
|
|
121
|
+
fs.mkdirSync(path.join(tmpDir, '.ace'), { recursive: true });
|
|
122
|
+
assert.strictEqual(pathExists(tmpDir, '.ace'), true);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('returns false for non-existent path', () => {
|
|
126
|
+
assert.strictEqual(pathExists(tmpDir, '.ace/config.json'), false);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('returns true for existing file', () => {
|
|
130
|
+
fs.mkdirSync(path.join(tmpDir, '.ace'), { recursive: true });
|
|
131
|
+
fs.writeFileSync(path.join(tmpDir, '.ace', 'config.json'), '{}');
|
|
132
|
+
assert.strictEqual(pathExists(tmpDir, '.ace/config.json'), true);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// ─── safeReadFile ────────────────────────────────────────────────────────────
|
|
137
|
+
|
|
138
|
+
describe('safeReadFile', () => {
|
|
139
|
+
let tmpDir;
|
|
140
|
+
beforeEach(() => { tmpDir = createTempDir(); });
|
|
141
|
+
afterEach(() => { cleanup(tmpDir); });
|
|
142
|
+
|
|
143
|
+
it('reads file content', () => {
|
|
144
|
+
const fp = path.join(tmpDir, 'test.txt');
|
|
145
|
+
fs.writeFileSync(fp, 'hello');
|
|
146
|
+
assert.strictEqual(safeReadFile(fp), 'hello');
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('returns null for non-existent file', () => {
|
|
150
|
+
assert.strictEqual(safeReadFile(path.join(tmpDir, 'nope.txt')), null);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// ─── resolveModel ────────────────────────────────────────────────────────────
|
|
155
|
+
|
|
156
|
+
describe('resolveModel', () => {
|
|
157
|
+
let tmpDir;
|
|
158
|
+
beforeEach(() => { tmpDir = createTempDir(); });
|
|
159
|
+
afterEach(() => { cleanup(tmpDir); });
|
|
160
|
+
|
|
161
|
+
it('returns quality model for ace-product-owner', () => {
|
|
162
|
+
assert.strictEqual(resolveModel(tmpDir, 'ace-product-owner'), 'opus');
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('returns quality model for ace-code-reviewer', () => {
|
|
166
|
+
assert.strictEqual(resolveModel(tmpDir, 'ace-code-reviewer'), 'sonnet');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('respects budget profile from config', () => {
|
|
170
|
+
fs.mkdirSync(path.join(tmpDir, '.ace'), { recursive: true });
|
|
171
|
+
fs.writeFileSync(path.join(tmpDir, '.ace', 'config.json'), JSON.stringify({
|
|
172
|
+
model_profile: 'budget',
|
|
173
|
+
}));
|
|
174
|
+
assert.strictEqual(resolveModel(tmpDir, 'ace-product-owner'), 'sonnet');
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('returns sonnet for unknown agent type', () => {
|
|
178
|
+
assert.strictEqual(resolveModel(tmpDir, 'unknown-agent'), 'sonnet');
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// ─── detectCodeFiles & detectBrownfieldStatus ────────────────────────────────
|
|
183
|
+
|
|
184
|
+
describe('detectBrownfieldStatus', () => {
|
|
185
|
+
let tmpDir;
|
|
186
|
+
beforeEach(() => { tmpDir = createTempDir(); });
|
|
187
|
+
afterEach(() => { cleanup(tmpDir); });
|
|
188
|
+
|
|
189
|
+
it('detects greenfield (empty project)', () => {
|
|
190
|
+
const result = detectBrownfieldStatus(tmpDir);
|
|
191
|
+
assert.strictEqual(result.is_greenfield, true);
|
|
192
|
+
assert.strictEqual(result.is_brownfield, false);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it('detects brownfield with code files', () => {
|
|
196
|
+
fs.writeFileSync(path.join(tmpDir, 'index.js'), 'console.log("hello");');
|
|
197
|
+
const result = detectBrownfieldStatus(tmpDir);
|
|
198
|
+
assert.strictEqual(result.is_brownfield, true);
|
|
199
|
+
assert.strictEqual(result.has_existing_code, true);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('detects brownfield with package file only', () => {
|
|
203
|
+
fs.writeFileSync(path.join(tmpDir, 'package.json'), '{}');
|
|
204
|
+
const result = detectBrownfieldStatus(tmpDir);
|
|
205
|
+
assert.strictEqual(result.is_brownfield, true);
|
|
206
|
+
assert.strictEqual(result.has_package_file, true);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('ignores node_modules', () => {
|
|
210
|
+
fs.mkdirSync(path.join(tmpDir, 'node_modules', 'pkg'), { recursive: true });
|
|
211
|
+
fs.writeFileSync(path.join(tmpDir, 'node_modules', 'pkg', 'index.js'), '');
|
|
212
|
+
const result = detectBrownfieldStatus(tmpDir);
|
|
213
|
+
assert.strictEqual(result.has_existing_code, false);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('detects nested code files up to depth 3', () => {
|
|
217
|
+
const nested = path.join(tmpDir, 'src', 'lib', 'utils');
|
|
218
|
+
fs.mkdirSync(nested, { recursive: true });
|
|
219
|
+
fs.writeFileSync(path.join(nested, 'helper.ts'), 'export const x = 1;');
|
|
220
|
+
const result = detectBrownfieldStatus(tmpDir);
|
|
221
|
+
assert.strictEqual(result.has_existing_code, true);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('detects .csproj as package file', () => {
|
|
225
|
+
fs.writeFileSync(path.join(tmpDir, 'App.csproj'), '<Project />');
|
|
226
|
+
const result = detectBrownfieldStatus(tmpDir);
|
|
227
|
+
assert.strictEqual(result.has_package_file, true);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// ─── loadSettings / writeSettings ────────────────────────────────────────────
|
|
232
|
+
|
|
233
|
+
describe('loadSettings / writeSettings', () => {
|
|
234
|
+
let tmpDir;
|
|
235
|
+
beforeEach(() => { tmpDir = createTempDir(); });
|
|
236
|
+
afterEach(() => { cleanup(tmpDir); });
|
|
237
|
+
|
|
238
|
+
it('returns defaults when no settings file exists', () => {
|
|
239
|
+
const settings = loadSettings(tmpDir);
|
|
240
|
+
assert.strictEqual(settings.model_profile, 'balanced');
|
|
241
|
+
assert.strictEqual(settings.commit_docs, true);
|
|
242
|
+
assert.strictEqual(settings.github_project.enabled, false);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('reads existing settings', () => {
|
|
246
|
+
fs.mkdirSync(path.join(tmpDir, '.ace'), { recursive: true });
|
|
247
|
+
fs.writeFileSync(path.join(tmpDir, '.ace', 'settings.json'), JSON.stringify({
|
|
248
|
+
model_profile: 'quality',
|
|
249
|
+
github_project: { enabled: true, repo: 'owner/repo' },
|
|
250
|
+
}));
|
|
251
|
+
const settings = loadSettings(tmpDir);
|
|
252
|
+
assert.strictEqual(settings.model_profile, 'quality');
|
|
253
|
+
assert.strictEqual(settings.github_project.enabled, true);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('writes settings and creates .ace directory', () => {
|
|
257
|
+
const settings = { model_profile: 'budget', commit_docs: false };
|
|
258
|
+
writeSettings(tmpDir, settings);
|
|
259
|
+
|
|
260
|
+
const written = JSON.parse(fs.readFileSync(path.join(tmpDir, '.ace', 'settings.json'), 'utf-8'));
|
|
261
|
+
assert.strictEqual(written.model_profile, 'budget');
|
|
262
|
+
assert.strictEqual(written.commit_docs, false);
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
// ─── parseKeyValueArgs ───────────────────────────────────────────────────────
|
|
267
|
+
|
|
268
|
+
describe('parseKeyValueArgs', () => {
|
|
269
|
+
it('parses key=value pairs', () => {
|
|
270
|
+
const result = parseKeyValueArgs(['story=path/to/file', 'status=Refined']);
|
|
271
|
+
assert.strictEqual(result.story, 'path/to/file');
|
|
272
|
+
assert.strictEqual(result.status, 'Refined');
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it('handles values with equals signs', () => {
|
|
276
|
+
const result = parseKeyValueArgs(['query=a=b']);
|
|
277
|
+
assert.strictEqual(result.query, 'a=b');
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it('ignores args without equals', () => {
|
|
281
|
+
const result = parseKeyValueArgs(['--raw', 'story=file.md']);
|
|
282
|
+
assert.strictEqual(result.story, 'file.md');
|
|
283
|
+
assert.strictEqual(result['--raw'], undefined);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it('returns empty object for empty input', () => {
|
|
287
|
+
const result = parseKeyValueArgs([]);
|
|
288
|
+
assert.deepStrictEqual(result, {});
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// ─── MODEL_PROFILES ──────────────────────────────────────────────────────────
|
|
293
|
+
|
|
294
|
+
describe('MODEL_PROFILES', () => {
|
|
295
|
+
it('has entries for all known agent types', () => {
|
|
296
|
+
const agents = [
|
|
297
|
+
'ace-product-owner', 'ace-project-researcher', 'ace-research-synthesizer',
|
|
298
|
+
'ace-wiki-mapper', 'ace-code-integration-analyst', 'ace-code-discovery-analyst',
|
|
299
|
+
'ace-executor', 'ace-code-reviewer',
|
|
300
|
+
];
|
|
301
|
+
for (const agent of agents) {
|
|
302
|
+
assert.ok(MODEL_PROFILES[agent], `Missing profile for ${agent}`);
|
|
303
|
+
assert.ok(MODEL_PROFILES[agent].quality, `Missing quality for ${agent}`);
|
|
304
|
+
assert.ok(MODEL_PROFILES[agent].balanced, `Missing balanced for ${agent}`);
|
|
305
|
+
assert.ok(MODEL_PROFILES[agent].budget, `Missing budget for ${agent}`);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
});
|