agjan 0.0.22 → 0.0.25
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/README.md +6 -4
- package/dist/adapters/claude-code.js +3 -3
- package/dist/baseline.js +2 -2
- package/dist/browser.js +25 -8
- package/dist/cli.js +22 -4
- package/dist/commands/check.js +91 -7
- package/dist/commands/discover.js +54 -0
- package/dist/commands/fix.js +8 -3
- package/dist/commands/gates.js +48 -28
- package/dist/commands/import.js +73 -0
- package/dist/commands/log.js +3 -2
- package/dist/commands/map.js +6 -1
- package/dist/commands/new.js +7 -3
- package/dist/commands/pr-summary.js +20 -5
- package/dist/commands/progress.js +1 -1
- package/dist/commands/report.js +1 -1
- package/dist/commands/review.js +21 -9
- package/dist/commands/setup.js +51 -1
- package/dist/commands/status.js +118 -20
- package/dist/commands/summary.js +2 -1
- package/dist/commands/team.js +45 -0
- package/dist/commands/test.js +37 -0
- package/dist/config.js +9 -1
- package/dist/defaults-file.js +33 -0
- package/dist/discovery.js +42 -0
- package/dist/feature.js +14 -7
- package/dist/imports.js +197 -0
- package/dist/plan.js +1 -1
- package/dist/progress-view.js +46 -11
- package/dist/qa.js +27 -3
- package/dist/readiness.js +33 -0
- package/dist/review-policy.js +2 -1
- package/dist/review.js +68 -17
- package/dist/schema.js +4 -0
- package/dist/story.js +15 -8
- package/dist/teams.js +127 -0
- package/dist/test-run.js +101 -0
- package/dist/types.js +0 -4
- package/dist/workflow.js +83 -0
- package/docs/guide.md +166 -24
- package/kit/domains/btp/domain.json +1 -0
- package/kit/hooks/guard.mjs +134 -6
- package/kit/skills/agjan-ask/SKILL.md +20 -9
- package/kit/skills/agjan-build/SKILL.md +6 -5
- package/kit/skills/agjan-design/SKILL.md +2 -2
- package/kit/skills/agjan-discover/SKILL.md +87 -0
- package/kit/skills/agjan-fix/SKILL.md +10 -6
- package/kit/skills/agjan-map/SKILL.md +12 -8
- package/kit/skills/agjan-spec/SKILL.md +14 -7
- package/kit/skills/agjan-verify/SKILL.md +27 -17
- package/kit/skills/btp-architect/SKILL.md +1 -1
- package/kit/skills/btp-architect/references/security.md +1 -1
- package/kit/skills/cap-developer/SKILL.md +1 -1
- package/kit/skills/cap-developer/references/project-setup.md +1 -1
- package/kit/skills/cap-developer/references/validation-security.md +1 -1
- package/kit/skills/fiori-developer/SKILL.md +1 -1
- package/kit/skills/qa-tester/SKILL.md +4 -2
- package/kit/templates/agents-block.md +13 -6
- package/kit/templates/progress.html +2 -2
- package/kit/templates/proposal.md +22 -0
- package/package.json +1 -1
- package/schemas/approvals.schema.json +9 -1
- package/schemas/config.defaults.json +66 -0
- package/schemas/config.schema.json +33 -1
- package/schemas/log.schema.json +1 -1
- package/schemas/reviews.schema.json +2 -2
package/dist/commands/log.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
2
|
import { appendLog } from '../log.js';
|
|
3
|
+
import { LOG_STAGES, WORKFLOWS } from '../workflow.js';
|
|
3
4
|
import { loadFeature, selectFeature } from '../feature.js';
|
|
4
5
|
import { AgjanError, UsageError } from '../errors.js';
|
|
5
6
|
import { approveAutomatically, cleanMessage, gateReadiness } from './gates.js';
|
|
6
|
-
const STAGES =
|
|
7
|
-
const GATES = [
|
|
7
|
+
const STAGES = LOG_STAGES;
|
|
8
|
+
const GATES = [...new Set(Object.values(WORKFLOWS).flatMap((w) => w.gates))];
|
|
8
9
|
/**
|
|
9
10
|
* agjan log --stage <stage> [--role r] [--task T1] [--skill s] [--host h] [--model m]
|
|
10
11
|
* agjan log --gate-requested <gate> [--message "<commit message>"]
|
package/dist/commands/map.js
CHANGED
|
@@ -6,6 +6,7 @@ import { APPROVALS_FILE, FEATURES_DIR, changedFeatures, emptyApprovals, featureD
|
|
|
6
6
|
import { PROJECT_MD } from '../fix.js';
|
|
7
7
|
import { BASELINE_FILE, refreshBaseline } from '../baseline.js';
|
|
8
8
|
import { appendLog } from '../log.js';
|
|
9
|
+
import { chooseTeam } from '../teams.js';
|
|
9
10
|
import { AgjanError, UsageError } from '../errors.js';
|
|
10
11
|
const TEMPLATE = new URL('../../kit/templates/project.md', import.meta.url);
|
|
11
12
|
/** Map runs need finding ids but no unique key: their findings stay in their own folder. */
|
|
@@ -21,8 +22,12 @@ function start(ctx) {
|
|
|
21
22
|
for (let n = 2; existsSync(featureDir(root, `maps/${id}`)); n += 1)
|
|
22
23
|
id = `${date}-${n}`;
|
|
23
24
|
const dir = featureDir(root, `maps/${id}`);
|
|
25
|
+
const team = chooseTeam(root, ctx.config, 'map');
|
|
24
26
|
mkdirSync(dir, { recursive: true });
|
|
25
|
-
|
|
27
|
+
const approvals = emptyApprovals(id, MAP_KEY, ctx.kit, ctx.now(), 'map');
|
|
28
|
+
if (team)
|
|
29
|
+
approvals.feature.team = team;
|
|
30
|
+
writeJson(join(dir, APPROVALS_FILE), approvals);
|
|
26
31
|
appendLog(dir, ctx.now(), 'step', { stage: 'map', skill: 'agjan-map' });
|
|
27
32
|
ctx.out(`created ${FEATURES_DIR}/maps/${id}/`);
|
|
28
33
|
if (!existsSync(join(root, PROJECT_MD))) {
|
package/dist/commands/new.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { parseArgs } from 'node:util';
|
|
4
|
+
import { chooseTeam } from '../teams.js';
|
|
4
5
|
import { writeJson } from '../json-file.js';
|
|
5
6
|
import { APPROVALS_FILE, CONTAINERS, FEATURES_DIR, KEY, SLUG, emptyApprovals, featureDir, listFeatures, loadFeature, selectFeature } from '../feature.js';
|
|
6
7
|
import { AgjanError, UsageError } from '../errors.js';
|
|
@@ -29,10 +30,10 @@ export function scaffold(ctx, argv) {
|
|
|
29
30
|
}
|
|
30
31
|
/** agjan new <slug> --key <KEY>: creates the feature folder, approvals.json and spec.md. */
|
|
31
32
|
export function run(ctx, argv) {
|
|
32
|
-
const { values, positionals } = parseArgs({ args: argv, options: { key: { type: 'string' } }, allowPositionals: true });
|
|
33
|
+
const { values, positionals } = parseArgs({ args: argv, options: { key: { type: 'string' }, team: { type: 'string' } }, allowPositionals: true });
|
|
33
34
|
const [slug] = positionals;
|
|
34
35
|
if (!slug || positionals.length > 1 || !values.key)
|
|
35
|
-
throw new UsageError('usage: agjan new <slug> --key <KEY>');
|
|
36
|
+
throw new UsageError('usage: agjan new <slug> --key <KEY> [--team <name>]');
|
|
36
37
|
if (!SLUG.test(slug))
|
|
37
38
|
throw new UsageError(`slug '${slug}' must be lowercase letters, digits and '-', at most 48 characters`);
|
|
38
39
|
// The record folders of fixes and map runs (decision 57): a feature there would be invisible.
|
|
@@ -49,15 +50,18 @@ export function run(ctx, argv) {
|
|
|
49
50
|
if (loadFeature(root, other).key === key)
|
|
50
51
|
throw new AgjanError(`key ${key} is already used by feature '${other}'`);
|
|
51
52
|
}
|
|
53
|
+
const team = chooseTeam(root, ctx.config, 'feature', values.team);
|
|
52
54
|
mkdirSync(dir, { recursive: true });
|
|
53
55
|
const approvals = emptyApprovals(slug, key, ctx.kit, ctx.now());
|
|
56
|
+
if (team)
|
|
57
|
+
approvals.feature.team = team;
|
|
54
58
|
// The person's auto mode default for this checkout (decision 79).
|
|
55
59
|
const auto = readAutoDefault(root);
|
|
56
60
|
if (auto)
|
|
57
61
|
approvals.auto = { by: auto.by, at_utc: ctx.now(), from: 'default' };
|
|
58
62
|
writeJson(join(dir, APPROVALS_FILE), approvals);
|
|
59
63
|
writeFileSync(join(dir, 'spec.md'), renderTemplate('spec.md', { slug, key }));
|
|
60
|
-
ctx.out(`created ${FEATURES_DIR}/${slug}/ (key ${key}): ${APPROVALS_FILE}, spec.md`);
|
|
64
|
+
ctx.out(`created ${FEATURES_DIR}/${slug}/ (key ${key}${team ? `, team ${team.name}` : ''}): ${APPROVALS_FILE}, spec.md`);
|
|
61
65
|
if (auto) {
|
|
62
66
|
appendLog(dir, ctx.now(), 'auto-on', { from: 'default' });
|
|
63
67
|
ctx.out(`auto mode on (the default of ${auto.by} in this checkout): spec and design pass automatically after their reviews; approve verify stays with the user`);
|
|
@@ -3,6 +3,8 @@ import { resolveArea } from '../config.js';
|
|
|
3
3
|
import { FEATURES_DIR } from '../feature.js';
|
|
4
4
|
import { acTestFiles } from '../tests-map.js';
|
|
5
5
|
import { acResults, loadResults, resultLabel } from '../test-results.js';
|
|
6
|
+
import { testRunState } from '../test-run.js';
|
|
7
|
+
import { workflowOf } from '../workflow.js';
|
|
6
8
|
import { overrideBase, runChecks } from './check.js';
|
|
7
9
|
import { readFix } from './fix.js';
|
|
8
10
|
import { highlightMarkdown } from '../ui.js';
|
|
@@ -14,7 +16,8 @@ function short(hash) {
|
|
|
14
16
|
}
|
|
15
17
|
/** A fix or a map run in the PR summary. */
|
|
16
18
|
function recordSection(feature) {
|
|
17
|
-
const
|
|
19
|
+
const name = workflowOf(feature.kind).name;
|
|
20
|
+
const out = [`### ${name[0].toUpperCase()}${name.slice(1)} ${feature.slug} (${feature.key})`, ''];
|
|
18
21
|
if (feature.kind === 'fix') {
|
|
19
22
|
const fix = readFix(feature);
|
|
20
23
|
out.push(`**What:** ${fix?.what ?? '(not stated)'}`, '');
|
|
@@ -26,8 +29,13 @@ function recordSection(feature) {
|
|
|
26
29
|
out.push('**Not recorded yet** (`npx agjan fix record`).', '');
|
|
27
30
|
}
|
|
28
31
|
}
|
|
32
|
+
else if (feature.kind === 'discovery') {
|
|
33
|
+
const stamp = feature.approvals.approvals.proposal;
|
|
34
|
+
out.push(`**Proposal:** \`${FEATURES_DIR}/${feature.slug}/proposal.md\` (a recommendation; no code changes).`, '');
|
|
35
|
+
out.push(`**Decision:** ${feature.state.proposal === 'approved' && stamp ? `approved by ${stamp.by} at ${stamp.at_utc}` : feature.state.proposal === 'stale' ? '**changed after its approval**' : '**not approved yet**'}`, '');
|
|
36
|
+
}
|
|
29
37
|
else {
|
|
30
|
-
out.push('Writes the baseline `docs/
|
|
38
|
+
out.push('Writes the baseline `agjan-docs/project.md` and `agjan-docs/baseline.json`.', '');
|
|
31
39
|
}
|
|
32
40
|
for (const r of feature.reviews.records)
|
|
33
41
|
out.push(`- ${r.id} ${r.step} round ${r.round}: ${r.verdict} (${r.findings?.length ?? 0} findings, isolation ${r.reviewer?.isolation ?? 'unknown'})`);
|
|
@@ -64,7 +72,8 @@ function featureSection(ctx, feature) {
|
|
|
64
72
|
const tests = acTestFiles(ctx.root, ctx.config, areaNames, feature.key);
|
|
65
73
|
const tasksFor = (id) => tasks.parsed.tasks.filter((t) => t.covers.includes(id)).map((t) => t.id).join(', ') || '-';
|
|
66
74
|
const loaded = loadResults(ctx.root, ctx.config, areaNames);
|
|
67
|
-
const
|
|
75
|
+
const testRun = ctx.config.test_evidence === 'names' ? null : testRunState(ctx.root, ctx.config, feature);
|
|
76
|
+
const results = testRun?.run?.results ? new Map(Object.entries(testRun.run.results)) : loaded.files.length ? acResults(loaded, feature.key) : null;
|
|
68
77
|
out.push('**Acceptance criteria**', '');
|
|
69
78
|
out.push(results ? '| AC | Verification | Tasks | Tests | Result |' : '| AC | Verification | Tasks | Tests |');
|
|
70
79
|
out.push(results ? '|---|---|---|---|---|' : '|---|---|---|---|');
|
|
@@ -78,7 +87,13 @@ function featureSection(ctx, feature) {
|
|
|
78
87
|
out.push(`${row} ${manual ? '-' : resultLabel(results.get(ac.id)).replace(/^(failed|not run|skipped)$/, '**$1**')} |`);
|
|
79
88
|
}
|
|
80
89
|
out.push('');
|
|
81
|
-
if (
|
|
90
|
+
if (testRun) {
|
|
91
|
+
const run = testRun.run;
|
|
92
|
+
const ui = run?.ui.state === 'skipped' ? ` UI tests skipped: ${run.ui.reason}.` : run?.ui.state === 'passed' ? ' UI tests passed.' : '';
|
|
93
|
+
const state = { none: '**not run** on this change', stale: `**outdated**: files changed after the run (${run?.at_utc})`, failed: `**failed** (${run?.at_utc})`, passed: `passed on this change (${run?.at_utc})` }[testRun.state];
|
|
94
|
+
out.push(`Test run (\`agjan test\`): ${state}.${ui}${results ? '' : ' Coverage per AC is by AC id in test files.'}`, '');
|
|
95
|
+
}
|
|
96
|
+
else if (results)
|
|
82
97
|
out.push(`Results from ${loaded.files.map((f) => `\`${f.file}\``).join(', ')}.`, '');
|
|
83
98
|
else
|
|
84
99
|
out.push('Test coverage is by AC id in test files (existence only).', '');
|
|
@@ -158,7 +173,7 @@ export function run(ctx, argv) {
|
|
|
158
173
|
if (code.length)
|
|
159
174
|
out.push('');
|
|
160
175
|
if (files.includes(`${FEATURES_DIR}/project.md`))
|
|
161
|
-
out.push('The baseline `docs/
|
|
176
|
+
out.push('The baseline `agjan-docs/project.md` is updated in this change.', '');
|
|
162
177
|
if (policy.length) {
|
|
163
178
|
out.push('**Policy changes** (these change the rules that check this PR)', '');
|
|
164
179
|
for (const p of policy)
|
|
@@ -35,7 +35,7 @@ export function run(ctx, argv) {
|
|
|
35
35
|
ctx.out(`${s.bold(m.key.padEnd(6))} ${m.slug.padEnd(34)} ${stage.padEnd(15)} ${turn}${m.turn === 'merged' ? '' : s.gray(` · ${m.now}`)}`);
|
|
36
36
|
}
|
|
37
37
|
const html = relative(ctx.root, result.html).split('\\').join('/');
|
|
38
|
-
ctx.out('', `${s.gray('overview')} ${html} ${s.gray('· per unit: docs
|
|
38
|
+
ctx.out('', `${s.gray('overview')} ${html} ${s.gray('· per unit: agjan-docs/<unit>/progress.md')}`);
|
|
39
39
|
if (values.open && !openFile(result.html))
|
|
40
40
|
ctx.out(`open ${html} in a browser`);
|
|
41
41
|
return 0;
|
package/dist/commands/report.js
CHANGED
|
@@ -94,7 +94,7 @@ export function buildReport(root, feature, { now = Date.now(), homes = {} } = {}
|
|
|
94
94
|
'folder within each time span; other work in the same folder at the same time is included.', '');
|
|
95
95
|
return lines.join('\n');
|
|
96
96
|
}
|
|
97
|
-
/** agjan report [--feature <slug>]: writes docs
|
|
97
|
+
/** agjan report [--feature <slug>]: writes agjan-docs/<slug>/report.md. */
|
|
98
98
|
export function run(ctx, argv) {
|
|
99
99
|
const { values } = parseArgs({ args: argv, options: { feature: { type: 'string' } } });
|
|
100
100
|
const feature = loadFeature(ctx.root, selectFeature(ctx.root, ctx.config, values.feature));
|
package/dist/commands/review.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
|
+
import { join, relative } from 'node:path';
|
|
2
3
|
import { serve } from '../mcp.js';
|
|
3
4
|
import { buildContextText, parseStep } from '../review.js';
|
|
4
5
|
import { loadFeature, selectFeature } from '../feature.js';
|
|
@@ -52,15 +53,17 @@ function nextAfter(feature, config, record) {
|
|
|
52
53
|
return record.verdict === 'pass' ? 'the agent goes on with the next step' : 'minor notes stay open (the PR summary lists them); the agent goes on';
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
55
|
-
* agjan review report [--step <step>] [--feature <slug>]: the latest review round
|
|
56
|
-
* short Markdown report for the user (verdict,
|
|
57
|
-
* loop, what happens next). Agents put it into their message after
|
|
58
|
-
* user sees what the reviewer found
|
|
56
|
+
* agjan review report [--step <step>] [--feature <slug>] [--full]: the latest review round
|
|
57
|
+
* as a short Markdown report for the user (verdict, blockers and majors, the minors in one
|
|
58
|
+
* line, the rounds of this loop, what happens next). Agents put it into their message after
|
|
59
|
+
* every review, so the user sees what the reviewer found without the detail they did not
|
|
60
|
+
* ask for: `review.md` has every finding, `--full` lists them all here, with the reviewer.
|
|
61
|
+
* The markers are emoji, which every host shows.
|
|
59
62
|
*/
|
|
60
63
|
export function report(ctx, argv) {
|
|
61
|
-
const { values, positionals } = parseArgs({ args: argv, options: { step: { type: 'string' }, feature: { type: 'string' } }, allowPositionals: true });
|
|
64
|
+
const { values, positionals } = parseArgs({ args: argv, options: { step: { type: 'string' }, feature: { type: 'string' }, full: { type: 'boolean' } }, allowPositionals: true });
|
|
62
65
|
if (positionals.length)
|
|
63
|
-
throw new UsageError('usage: agjan review report [--step <step>] [--feature <slug>]');
|
|
66
|
+
throw new UsageError('usage: agjan review report [--step <step>] [--feature <slug>] [--full]');
|
|
64
67
|
const feature = loadFeature(ctx.root, selectFeature(ctx.root, ctx.config, values.feature));
|
|
65
68
|
const records = feature.reviews.records.filter((r) => !values.step || r.step === values.step);
|
|
66
69
|
const record = records.at(-1);
|
|
@@ -69,14 +72,23 @@ export function report(ctx, argv) {
|
|
|
69
72
|
const { limit } = roundState(feature, ctx.config, record.step);
|
|
70
73
|
const status = new Map(feature.findings.map((f) => [f.id, f.status]));
|
|
71
74
|
const out = [`**🔍 Review ${record.id} · ${record.step} · round ${record.round} of ${limit} · ${VERDICT[record.verdict]}**`];
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
// The reviewer's isolation matters to the user only when it is missing.
|
|
76
|
+
const isolated = record.reviewer?.isolation === 'agent';
|
|
77
|
+
if (values.full || !isolated) {
|
|
78
|
+
out.push(`- reviewer: ${reviewerFor(ctx.config, record.step)} on ${record.reviewer?.host ?? 'unknown host'}, ${isolated ? 'isolated' : `⚠️ isolation ${record.reviewer?.isolation ?? 'unknown'}`}`);
|
|
79
|
+
}
|
|
74
80
|
const order = { blocker: 0, major: 1, minor: 2 };
|
|
75
|
-
|
|
81
|
+
const sorted = [...record.findings].sort((a, b) => order[a.severity] - order[b.severity]);
|
|
82
|
+
const listed = values.full ? sorted : sorted.filter((f) => f.severity !== 'minor');
|
|
83
|
+
for (const f of listed) {
|
|
76
84
|
const where = f.file ? ` · \`${f.file}${f.line ? `:${f.line}` : ''}\`` : '';
|
|
77
85
|
const state = status.get(f.id) === 'open' ? '' : ` (${status.get(f.id)})`;
|
|
78
86
|
out.push(`- ${SEVERITY[f.severity]} **${f.id}** ${f.severity}${state}${where} · ${oneLine(f.issue)}`);
|
|
79
87
|
}
|
|
88
|
+
const minors = sorted.filter((f) => f.severity === 'minor');
|
|
89
|
+
if (!values.full && minors.length) {
|
|
90
|
+
out.push(`- ${SEVERITY.minor} ${minors.length} minor note${minors.length === 1 ? '' : 's'}: ${minors.map((f) => f.id).join(', ')} (\`${relative(ctx.root, join(feature.dir, 'review.md')).split('\\').join('/')}\`)`);
|
|
91
|
+
}
|
|
80
92
|
if (!record.findings.length)
|
|
81
93
|
out.push('- no findings');
|
|
82
94
|
if (record.resolves?.length)
|
package/dist/commands/setup.js
CHANGED
|
@@ -19,7 +19,7 @@ import { blink, mark, pad, tone, verdictColor } from '../ui.js';
|
|
|
19
19
|
import { PINNED, mcpServers } from '../mcp-config.js';
|
|
20
20
|
import { addCommand, addCopilotServers, copilotServers } from '../copilot-mcp.js';
|
|
21
21
|
import { AGENTS, FOLLOW, OTHER, copilotModels, hostModels, modelChoices } from '../model-choices.js';
|
|
22
|
-
import { UI_SCRIPT, hasUiTests, probeBrowser } from '../browser.js';
|
|
22
|
+
import { DEPS_DOCKERFILE_LINE, UI_SCRIPT, depsCommand, hasUiTests, probeBrowser, runVisible } from '../browser.js';
|
|
23
23
|
import { readAutoDefault } from '../auto.js';
|
|
24
24
|
const CI_FILE = '.github/workflows/agjan.yml';
|
|
25
25
|
const CI_TEMPLATE = new URL('../../kit/templates/agjan-ci.yml', import.meta.url);
|
|
@@ -429,6 +429,7 @@ export async function init(ctx, argv) {
|
|
|
429
429
|
ctx.out(` ${pad(tone(s, 'created'), 'created', 14)} ${CI_FILE}`);
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
+
offerBrowser(ctx, root);
|
|
432
433
|
let committed = null;
|
|
433
434
|
if (wantCommit) {
|
|
434
435
|
const result = commitSetup(root, { firstCommit });
|
|
@@ -449,6 +450,53 @@ export async function init(ctx, argv) {
|
|
|
449
450
|
}));
|
|
450
451
|
return 0;
|
|
451
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Offers to make Chromium start, for a project that has UI tests: the download (no admin rights)
|
|
455
|
+
* and, on Linux, the system libraries (sudo). Asks first and only on a terminal; with no terminal
|
|
456
|
+
* or an answer of no, nothing is installed. `--yes` never covers it.
|
|
457
|
+
*/
|
|
458
|
+
function offerBrowser(ctx, root) {
|
|
459
|
+
if (!hasUiTests(root))
|
|
460
|
+
return;
|
|
461
|
+
const s = ctx.style;
|
|
462
|
+
let changed = false;
|
|
463
|
+
let previous = '';
|
|
464
|
+
for (let step = 0; step < 2; step++) {
|
|
465
|
+
const browser = probeBrowser(root);
|
|
466
|
+
if (browser.ready || browser.missing === previous)
|
|
467
|
+
break; // what was just done did not help: do not ask again
|
|
468
|
+
previous = browser.missing;
|
|
469
|
+
if (browser.missing === 'download') {
|
|
470
|
+
if (!ask(ctx, `UI tests: ${browser.reason}. Download it now (npx playwright install chromium, no admin rights)?`, { defaultYes: true }))
|
|
471
|
+
return;
|
|
472
|
+
if (!runVisible(root, 'npx', ['playwright', 'install', 'chromium']))
|
|
473
|
+
return void ctx.out('', s.yellow('The download failed; the UI tests stay skipped.'));
|
|
474
|
+
}
|
|
475
|
+
else if (browser.missing === 'libraries') {
|
|
476
|
+
const deps = depsCommand();
|
|
477
|
+
if (!deps) {
|
|
478
|
+
if (ctx.isTTY)
|
|
479
|
+
ctx.out('', `${s.bold('ui tests')}: ${browser.reason}.`, ` Installing them needs root: run \`npx playwright install-deps chromium\` as root, and add \`${DEPS_DOCKERFILE_LINE}\``, ' to the Dockerfile so a rebuilt container keeps them.');
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
if (!ask(ctx, `UI tests: ${browser.reason}. Install them now (${deps.shown})? It changes this machine.`, { defaultYes: false })) {
|
|
483
|
+
if (ctx.isTTY)
|
|
484
|
+
ctx.out('', ` To keep them across container rebuilds, add \`${DEPS_DOCKERFILE_LINE}\` to the Dockerfile.`);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (!runVisible(root, deps.command, deps.args))
|
|
488
|
+
return void ctx.out('', s.yellow('The installation failed; the UI tests stay skipped.'));
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
changed = true;
|
|
494
|
+
}
|
|
495
|
+
if (!changed)
|
|
496
|
+
return;
|
|
497
|
+
const last = probeBrowser(root);
|
|
498
|
+
ctx.out('', last.ready ? `${s.bold('ui tests')}: Chromium starts now` : s.yellow(`ui tests: still skipped: ${last.reason}`));
|
|
499
|
+
}
|
|
452
500
|
function addPrepare(root) {
|
|
453
501
|
const file = join(root, 'package.json');
|
|
454
502
|
const pkg = readJson(file);
|
|
@@ -666,5 +714,7 @@ export async function doctor(ctx) {
|
|
|
666
714
|
const failed = rows.filter((r) => r[0] === 'fail').length;
|
|
667
715
|
const warned = rows.filter((r) => r[0] === 'warn').length;
|
|
668
716
|
ctx.out(`${s.bold('agjan doctor')}: ${verdictColor(s, failed, warned)(`${failed} failure(s), ${warned} warning(s)`)}`);
|
|
717
|
+
if (root)
|
|
718
|
+
offerBrowser(ctx, root);
|
|
669
719
|
return failed ? 1 : 0;
|
|
670
720
|
}
|
package/dist/commands/status.js
CHANGED
|
@@ -10,11 +10,26 @@ import { fixAttempts, reviewerFor, roundLimit, roundState } from '../review-poli
|
|
|
10
10
|
import { blink, mark, markLine, pad, tone } from '../ui.js';
|
|
11
11
|
import { acTestFiles } from '../tests-map.js';
|
|
12
12
|
import { acResults, loadResults } from '../test-results.js';
|
|
13
|
-
import {
|
|
13
|
+
import { testRunState } from '../test-run.js';
|
|
14
|
+
import { workflowOf } from '../workflow.js';
|
|
15
|
+
import { proposalProblems, proposalReview } from '../discovery.js';
|
|
16
|
+
import { mainRole, unitTeam } from '../teams.js';
|
|
17
|
+
import { finalSteps, unitModel } from '../progress-view.js';
|
|
18
|
+
import { splitNow } from '../story.js';
|
|
19
|
+
import { verification } from '../readiness.js';
|
|
14
20
|
import { readLog } from '../log.js';
|
|
15
|
-
import { finalSteps } from '../progress-view.js';
|
|
16
21
|
import { readAutoDefault } from '../auto.js';
|
|
17
22
|
import { QA_STEP, qaState, qaTestFiles } from '../qa.js';
|
|
23
|
+
/** The unit's team and the skills of the main agent's role in it (decision 92). */
|
|
24
|
+
function teamRow(ctx, unit) {
|
|
25
|
+
const team = unitTeam(ctx.config, unit.approvals.feature.team);
|
|
26
|
+
if (!team)
|
|
27
|
+
return;
|
|
28
|
+
const role = mainRole(unit.kind);
|
|
29
|
+
const skills = team.team?.personas[role]?.skills ?? [];
|
|
30
|
+
const changed = team.changed ? ctx.style.yellow(' (its definition changed since this unit started)') : '';
|
|
31
|
+
row(ctx, 'team', `${team.name}${skills.length ? ctx.style.gray(` · ${role}: ${skills.join(', ')}`) : ''}${changed}`);
|
|
32
|
+
}
|
|
18
33
|
/** One indented row: a label column, then the value. `next` and `blocks` stand out. */
|
|
19
34
|
function row(ctx, label, value) {
|
|
20
35
|
const s = ctx.style;
|
|
@@ -79,6 +94,9 @@ function nextInBuild(ctx, feature, progress) {
|
|
|
79
94
|
if (state === 'stale')
|
|
80
95
|
return `files changed after the verify review ${record.id}: /agjan-verify again`;
|
|
81
96
|
if (state === 'current') {
|
|
97
|
+
const { problems } = verification(ctx, feature);
|
|
98
|
+
if (problems.length)
|
|
99
|
+
return `the final review ${record.id} passed, but the feature is not verified yet: ${problems[0]}${problems.length > 1 ? ` (and ${problems.length - 1} more)` : ''}; fix it, then /agjan-verify again`;
|
|
82
100
|
const acceptance = acceptanceState(ctx.root, ctx.config, feature, { state, record });
|
|
83
101
|
if (acceptance.state === 'accepted')
|
|
84
102
|
return `${ctx.style.green('done')}: verified (${record.id}) and accepted by ${acceptance.approval.by}; the next steps below are optional`;
|
|
@@ -105,11 +123,36 @@ function findingCount(ctx, open) {
|
|
|
105
123
|
const text = `${open.length} open, ${blockers} blocker(s)`;
|
|
106
124
|
return `${blockers ? ctx.style.red(text) : ctx.style.yellow(text)} ${ctx.style.gray('(npx agjan findings lists them)')}`;
|
|
107
125
|
}
|
|
126
|
+
/** A discovery (decision 91): its proposal, its review, and the decision that is next. */
|
|
127
|
+
function describeDiscovery(ctx, unit) {
|
|
128
|
+
heading(ctx, unit, ctx.style.magenta('discovery'));
|
|
129
|
+
teamRow(ctx, unit);
|
|
130
|
+
row(ctx, 'proposal', tone(ctx.style, unit.state.proposal));
|
|
131
|
+
const problems = proposalProblems(unit);
|
|
132
|
+
const review = proposalReview(unit);
|
|
133
|
+
if (review.record)
|
|
134
|
+
row(ctx, 'review', `${review.record.id} ${tone(ctx.style, review.record.verdict)} (round ${review.record.round} of ${roundState(unit, ctx.config, 'proposal').limit})`);
|
|
135
|
+
const open = unit.findings.filter((f) => f.status === 'open');
|
|
136
|
+
if (open.length)
|
|
137
|
+
row(ctx, 'findings', findingCount(ctx, open));
|
|
138
|
+
if (unit.state.proposal === 'approved')
|
|
139
|
+
return row(ctx, 'next', `${ctx.style.green('approved')}: to build the recommendation, start a feature with /agjan-spec`);
|
|
140
|
+
for (const p of problems)
|
|
141
|
+
row(ctx, 'blocks', p);
|
|
142
|
+
if (problems.length)
|
|
143
|
+
return row(ctx, 'next', 'complete proposal.md, then review step proposal');
|
|
144
|
+
if (review.problems.length)
|
|
145
|
+
return row(ctx, 'next', `${review.problems[0]}: ${reviewNext(ctx, unit, 'proposal')}`);
|
|
146
|
+
row(ctx, 'next', `${ctx.style.green('ready for approval')}: a human runs '${ctx.style.bold('npx agjan approve proposal')}' in a terminal`);
|
|
147
|
+
}
|
|
108
148
|
/** A fix or a map run: its checks, its review, and the next step. */
|
|
109
149
|
function describeRecord(ctx, unit, onBase = false) {
|
|
150
|
+
if (unit.kind === 'discovery')
|
|
151
|
+
return describeDiscovery(ctx, unit);
|
|
110
152
|
if (onBase)
|
|
111
153
|
return describeRecordOnBase(ctx, unit);
|
|
112
154
|
heading(ctx, unit, ctx.style.magenta(unit.kind));
|
|
155
|
+
teamRow(ctx, unit);
|
|
113
156
|
const problems = unit.kind === 'fix' ? fixRules(ctx.root, ctx.config).problems : projectProblems(ctx.root, ctx.config);
|
|
114
157
|
for (const p of problems)
|
|
115
158
|
row(ctx, 'blocks', p);
|
|
@@ -121,7 +164,7 @@ function describeRecord(ctx, unit, onBase = false) {
|
|
|
121
164
|
row(ctx, 'findings', findingCount(ctx, open));
|
|
122
165
|
let next;
|
|
123
166
|
if (problems.length)
|
|
124
|
-
next = unit.kind === 'fix' ? 'the change is not a fix: revert it and use /agjan-spec' : `complete docs/
|
|
167
|
+
next = unit.kind === 'fix' ? 'the change is not a fix: revert it and use /agjan-spec' : `complete agjan-docs/project.md`;
|
|
125
168
|
else if (review.problem)
|
|
126
169
|
next = reviewNext(ctx, unit, unit.kind);
|
|
127
170
|
else if (unit.kind === 'fix' && readFix(unit)?.review?.tree_hash !== record.tree_hash)
|
|
@@ -164,14 +207,16 @@ function describeRecordOnBase(ctx, unit) {
|
|
|
164
207
|
if (open.length)
|
|
165
208
|
row(ctx, 'findings', findingCount(ctx, open));
|
|
166
209
|
if (!merged)
|
|
167
|
-
row(ctx, 'next', `start follow-up work on a branch (
|
|
210
|
+
row(ctx, 'next', `start follow-up work on a branch (/${workflowOf(unit.kind).skill})`);
|
|
168
211
|
}
|
|
169
212
|
/**
|
|
170
|
-
* The end of a feature's agent work
|
|
171
|
-
*
|
|
172
|
-
* ACs and accept it with `approve verify` (Gate 3,
|
|
173
|
-
*
|
|
174
|
-
*
|
|
213
|
+
* The end of a feature's agent work: a screen that says unmistakably whether it is verified
|
|
214
|
+
* (`verification`: the same answer as the acceptance gate), what was met, and what the
|
|
215
|
+
* human does next: try it, check the manual ACs and accept it with `approve verify` (Gate 3,
|
|
216
|
+
* decision 77); once accepted, the optional pull request. While checks still fail it says
|
|
217
|
+
* "not verified yet" and lists them. Colored with the agjan mark on a terminal; the same
|
|
218
|
+
* content as plain text for agents, who end /agjan-verify with it. Returns whether the
|
|
219
|
+
* feature is verified.
|
|
175
220
|
*/
|
|
176
221
|
async function completion(ctx, feature, progress) {
|
|
177
222
|
const s = ctx.style;
|
|
@@ -179,14 +224,14 @@ async function completion(ctx, feature, progress) {
|
|
|
179
224
|
const acs = feature.spec.parsed.acs;
|
|
180
225
|
const automated = acs.filter((ac) => ac.verification !== 'manual');
|
|
181
226
|
const manual = acs.filter((ac) => ac.verification === 'manual');
|
|
227
|
+
const testRun = ctx.config.test_evidence === 'names' ? null : testRunState(ctx.root, ctx.config, feature);
|
|
182
228
|
const loaded = loadResults(ctx.root, ctx.config, areaNames);
|
|
183
|
-
const results = loaded.files.length ? acResults(loaded, feature.key) : null;
|
|
229
|
+
const results = testRun?.run?.results ? new Map(Object.entries(testRun.run.results)) : loaded.files.length ? acResults(loaded, feature.key) : null;
|
|
184
230
|
const tests = acTestFiles(ctx.root, ctx.config, areaNames, feature.key);
|
|
185
231
|
const covered = automated.filter((ac) => (results ? results.get(ac.id)?.passed && !results.get(ac.id)?.failed : tests.has(ac.id))).length;
|
|
186
|
-
const {
|
|
187
|
-
const errors =
|
|
232
|
+
const { problems, accepted } = verification(ctx, feature);
|
|
233
|
+
const errors = problems.filter((p) => p.startsWith('check --ci: ')).length;
|
|
188
234
|
const acceptance = acceptanceState(ctx.root, ctx.config, feature);
|
|
189
|
-
const accepted = acceptance.state === 'accepted';
|
|
190
235
|
const open = feature.findings.filter((f) => f.status === 'open');
|
|
191
236
|
const blockers = open.filter((f) => f.severity === 'blocker').length;
|
|
192
237
|
const ok = (text) => `${s.teal('✔')} ${text}`;
|
|
@@ -196,11 +241,27 @@ async function completion(ctx, feature, progress) {
|
|
|
196
241
|
errors ? bad(`check --ci: ${errors} error(s)`) : ok('check --ci clean')].join(' '),
|
|
197
242
|
[(blockers ? bad : ok)(`reviews ${feature.reviews.records.length}, ${blockers} blocker(s) open`), open.length - blockers ? `${s.gray('●')} ${open.length - blockers} note(s) open` : ok('no open notes')].join(' '),
|
|
198
243
|
];
|
|
199
|
-
if (
|
|
244
|
+
if (testRun) {
|
|
245
|
+
const ui = testRun.run?.ui;
|
|
246
|
+
lines.push([
|
|
247
|
+
(testRun.state === 'passed' ? ok : bad)(testRun.state === 'passed' ? 'tests passed on this change (agjan test)' : testRun.state === 'none' ? 'tests not run on this change' : `test run ${testRun.state}`),
|
|
248
|
+
ui?.state === 'skipped' ? `${s.yellow('●')} UI tests skipped: ${ui.reason}` : ui?.state === 'passed' ? ok('UI tests passed') : '',
|
|
249
|
+
].filter(Boolean).join(' '));
|
|
250
|
+
}
|
|
251
|
+
ctx.out();
|
|
252
|
+
if (problems.length) {
|
|
253
|
+
ctx.out(`${s.red('✖')} ${s.bold(`${feature.key} is not verified yet`)}: the final review passed, but ${problems.length === 1 ? 'one point blocks' : `${problems.length} points block`} it (${feature.slug})`);
|
|
254
|
+
for (const line of lines)
|
|
255
|
+
ctx.out(` ${line}`);
|
|
256
|
+
ctx.out(` ${s.bold('Fix these, then run /agjan-verify again:')}`);
|
|
257
|
+
for (const p of problems)
|
|
258
|
+
ctx.out(` ${s.red('▸')} ${p}`);
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
if (accepted && acceptance.state === 'accepted')
|
|
200
262
|
lines.push(ok(`accepted by ${acceptance.approval.by} (${acceptance.approval.at_utc})`));
|
|
201
263
|
const title = accepted ? `${feature.key} is done` : `${feature.key} is verified`;
|
|
202
264
|
const detail = accepted ? 'implemented, verified and accepted' : 'development finished and verified; your acceptance is next';
|
|
203
|
-
ctx.out();
|
|
204
265
|
if (s.brand) {
|
|
205
266
|
const stars = `${s.teal('✦')} ${s.violet('✦')} ${s.teal('✦')}`;
|
|
206
267
|
const logo = mark(s, ctx.kit, `${stars} ${s.bold(title)} ${stars}`, `${feature.slug} · ${detail}`);
|
|
@@ -222,6 +283,9 @@ async function completion(ctx, feature, progress) {
|
|
|
222
283
|
ctx.out(` ${s.bold(accepted ? 'Optional next steps:' : 'Then, optional:')}`);
|
|
223
284
|
for (const step of optional)
|
|
224
285
|
ctx.out(` ${s.violet('▸')} ${step}`);
|
|
286
|
+
// The details stay one step away: the records, and the story for whoever wants it.
|
|
287
|
+
ctx.out(` ${s.gray(`Details: ${FEATURES_DIR}/${feature.slug}/ (spec, design, reviews, test run, progress.md) · the whole story: npx agjan summary`)}`);
|
|
288
|
+
return true;
|
|
225
289
|
}
|
|
226
290
|
async function describe(ctx, feature, onBase = false) {
|
|
227
291
|
if (feature.kind !== 'feature')
|
|
@@ -230,6 +294,7 @@ async function describe(ctx, feature, onBase = false) {
|
|
|
230
294
|
return describeOnBase(ctx, feature);
|
|
231
295
|
const stage = shownStage(ctx, feature);
|
|
232
296
|
heading(ctx, feature, `stage: ${stage === 'done' ? ctx.style.green(stage) : ctx.style.magenta(stage)}`);
|
|
297
|
+
teamRow(ctx, feature);
|
|
233
298
|
row(ctx, 'spec', tone(ctx.style, feature.state.spec));
|
|
234
299
|
const mode = feature.design?.parsed.mode ? ` (${feature.design.parsed.mode})` : '';
|
|
235
300
|
row(ctx, 'design', `${tone(ctx.style, feature.state.design)}${mode}`);
|
|
@@ -298,15 +363,46 @@ async function done(ctx, slug) {
|
|
|
298
363
|
const feature = loadFeature(ctx.root, slug);
|
|
299
364
|
const progress = feature.kind === 'feature' && feature.stage === 'build' ? buildProgress(ctx.root, ctx.config, feature) : null;
|
|
300
365
|
if (progress?.complete && progress.due.length === 0 && verifyState(ctx.root, ctx.config, feature).state === 'current') {
|
|
301
|
-
await completion(ctx, feature, progress);
|
|
302
|
-
return 0;
|
|
366
|
+
return (await completion(ctx, feature, progress)) ? 0 : 1;
|
|
303
367
|
}
|
|
304
368
|
ctx.out(`${feature.key} is not done yet: ${progress ? nextInBuild(ctx, feature, progress).replace('<KEY>', feature.key) : `stage ${feature.stage}`}`);
|
|
305
369
|
return 1;
|
|
306
370
|
}
|
|
307
|
-
/**
|
|
371
|
+
/**
|
|
372
|
+
* agjan status --json: the state of each unit for tools (the evaluation runner, CI, an
|
|
373
|
+
* IDE), so none of them parses the text: its workflow and stage, whose turn it is, what is
|
|
374
|
+
* next and the command or skill that does it, and for a feature in Build whether it is
|
|
375
|
+
* verified and what blocks it (decision 90).
|
|
376
|
+
*/
|
|
377
|
+
function json(ctx, slugs) {
|
|
378
|
+
const units = slugs.map((slug) => {
|
|
379
|
+
const model = unitModel(ctx, slug, { now: Date.parse(ctx.now()) });
|
|
380
|
+
const unit = loadFeature(ctx.root, slug);
|
|
381
|
+
const verified = unit.kind === 'feature' && unit.stage === 'build' ? verification(ctx, unit) : null;
|
|
382
|
+
return {
|
|
383
|
+
id: slug,
|
|
384
|
+
key: model.key,
|
|
385
|
+
kind: model.kind,
|
|
386
|
+
workflow: workflowOf(unit.kind).name,
|
|
387
|
+
stages: model.stages,
|
|
388
|
+
stage: model.stages[Math.min(model.at, model.stages.length - 1)],
|
|
389
|
+
turn: model.turn,
|
|
390
|
+
now: model.now,
|
|
391
|
+
next: splitNow(model.now).command,
|
|
392
|
+
...((() => {
|
|
393
|
+
const team = unitTeam(ctx.config, unit.approvals.feature.team);
|
|
394
|
+
const role = mainRole(unit.kind);
|
|
395
|
+
return team ? { team: { name: team.name, changed: team.changed, role, skills: team.team?.personas[role]?.skills ?? [] } } : {};
|
|
396
|
+
})()),
|
|
397
|
+
...(verified ? { verified: verified.problems.length === 0, accepted: verified.accepted, problems: verified.problems } : {}),
|
|
398
|
+
};
|
|
399
|
+
});
|
|
400
|
+
ctx.out(JSON.stringify({ schema: 1, units }, null, 2));
|
|
401
|
+
return 0;
|
|
402
|
+
}
|
|
403
|
+
/** agjan status [--feature <slug> | --all | --done | --json] */
|
|
308
404
|
export async function run(ctx, argv) {
|
|
309
|
-
const { values } = parseArgs({ args: argv, options: { feature: { type: 'string' }, all: { type: 'boolean' }, done: { type: 'boolean' } } });
|
|
405
|
+
const { values } = parseArgs({ args: argv, options: { feature: { type: 'string' }, all: { type: 'boolean' }, done: { type: 'boolean' }, json: { type: 'boolean' } } });
|
|
310
406
|
const root = ctx.root;
|
|
311
407
|
if (values.done)
|
|
312
408
|
return done(ctx, selectFeature(root, ctx.config, values.feature));
|
|
@@ -319,8 +415,10 @@ export async function run(ctx, argv) {
|
|
|
319
415
|
else {
|
|
320
416
|
slugs = values.all ? listFeatures(root) : changedFeatures(root, ctx.config);
|
|
321
417
|
}
|
|
418
|
+
if (values.json)
|
|
419
|
+
return json(ctx, slugs);
|
|
322
420
|
const c = ctx.config;
|
|
323
|
-
const branches = 'branches: ask the user, then npx agjan branch';
|
|
421
|
+
const branches = c.git?.branches === 'ask' ? 'branches: ask the user, then npx agjan branch' : 'branches: the agent creates one (npx agjan branch <name>)';
|
|
324
422
|
for (const line of markLine(ctx.style, ctx.kit, 'status'))
|
|
325
423
|
ctx.out(line);
|
|
326
424
|
const autoDefault = readAutoDefault(root) ? '; auto mode: on for new features (your default)' : '';
|
package/dist/commands/summary.js
CHANGED
|
@@ -25,8 +25,9 @@ export function run(ctx, argv) {
|
|
|
25
25
|
for (const slug of slugs) {
|
|
26
26
|
const model = unitModel(ctx, slug, { now: Date.parse(ctx.now()) });
|
|
27
27
|
ctx.out('', `${s.bold(model.slug)} ${s.gray(`(${model.key})`)}`, '');
|
|
28
|
+
// Past blockers stay visible as such; what holds now is the last line.
|
|
28
29
|
for (const item of storyItems(model))
|
|
29
|
-
ctx.out(` ${s.green('✔')} ${item.text}`);
|
|
30
|
+
ctx.out(` ${item.mark === 'issue' ? s.red('✖') : item.mark === 'note' ? s.yellow('●') : s.green('✔')} ${item.text}`);
|
|
30
31
|
const end = storyEnd(model);
|
|
31
32
|
const mark = end.turn === 'you' ? s.violet('⏳') : end.turn === 'agent' ? s.cyan('▶') : s.green('✔');
|
|
32
33
|
ctx.out(` ${mark} ${s.bold(end.text)}`);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { UsageError } from '../errors.js';
|
|
3
|
+
import { BUILT_IN_TEAMS, ROLES, allTeams, defaultTeam, teamProblems } from '../teams.js';
|
|
4
|
+
import { WORKFLOWS } from '../workflow.js';
|
|
5
|
+
const USAGE = 'usage: agjan team list | agjan team show <name>';
|
|
6
|
+
/**
|
|
7
|
+
* agjan team list | show <name> (decision 92): the teams a unit can start with, the default
|
|
8
|
+
* per workflow, and what a team's personas work with. A team is chosen when a unit starts
|
|
9
|
+
* (`--team` on new, fix start, discover start), else the workflow's default.
|
|
10
|
+
*/
|
|
11
|
+
export function run(ctx, argv) {
|
|
12
|
+
const { positionals } = parseArgs({ args: argv, allowPositionals: true });
|
|
13
|
+
const s = ctx.style;
|
|
14
|
+
const teams = allTeams(ctx.config);
|
|
15
|
+
if (positionals[0] === 'list' && positionals.length === 1) {
|
|
16
|
+
for (const [name, team] of Object.entries(teams)) {
|
|
17
|
+
const defaults = Object.keys(WORKFLOWS).filter((k) => defaultTeam(ctx.config, k) === name);
|
|
18
|
+
const origin = BUILT_IN_TEAMS[name] && !ctx.config.teams?.[name] ? 'built in' : 'agjan.config.json';
|
|
19
|
+
ctx.out(`${s.bold(name.padEnd(18))} ${team.workflows.join(', ').padEnd(16)} ${s.gray(origin)}${defaults.length ? s.green(` default for ${defaults.join(', ')}`) : ''}`);
|
|
20
|
+
ctx.out(`${''.padEnd(19)}${s.gray(team.description)}`);
|
|
21
|
+
}
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
if (positionals[0] === 'show' && positionals.length === 2) {
|
|
25
|
+
const name = positionals[1];
|
|
26
|
+
const team = teams[name];
|
|
27
|
+
const problems = teamProblems(ctx.root, ctx.config, name);
|
|
28
|
+
if (!team)
|
|
29
|
+
throw new UsageError(problems[0]);
|
|
30
|
+
ctx.out(`${s.bold(name)}: ${team.description}`, ` workflows ${team.workflows.join(', ')}`);
|
|
31
|
+
for (const role of ROLES) {
|
|
32
|
+
const persona = team.personas[role];
|
|
33
|
+
if (!persona)
|
|
34
|
+
continue;
|
|
35
|
+
ctx.out(` ${role.padEnd(12)}${persona.skills.join(', ')}`);
|
|
36
|
+
if (persona.instructions?.trim())
|
|
37
|
+
ctx.out(` ${''.padEnd(12)}${s.gray(persona.instructions.trim().replace(/\s+/g, ' '))}`);
|
|
38
|
+
}
|
|
39
|
+
ctx.out(s.gray(' The workflow decides the steps, reviews and gates; a team adds what its agents work with.'));
|
|
40
|
+
for (const p of problems)
|
|
41
|
+
ctx.out(` ${s.red('problem')} ${p}`);
|
|
42
|
+
return problems.length ? 1 : 0;
|
|
43
|
+
}
|
|
44
|
+
throw new UsageError(USAGE);
|
|
45
|
+
}
|