agjan 0.0.6 → 0.0.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/README.md +3 -2
- package/docs/guide.md +81 -29
- package/kit/hooks/guard.mjs +129 -19
- package/kit/skills/agjan-fix/SKILL.md +11 -3
- package/kit/skills/agjan-map/SKILL.md +12 -3
- package/kit/skills/agjan-spec/SKILL.md +12 -5
- package/kit/skills/agjan-verify/SKILL.md +9 -6
- package/kit/skills/cap-developer/SKILL.md +4 -0
- package/kit/skills/cap-developer/references/handlers.md +61 -4
- package/kit/skills/cap-developer/references/modeling.md +33 -1
- package/kit/skills/cap-developer/references/project-setup.md +87 -0
- package/kit/skills/cap-developer/references/services.md +32 -1
- package/kit/skills/cap-developer/references/testing.md +46 -14
- package/kit/skills/cap-developer/references/validation-security.md +66 -2
- package/kit/skills/fiori-developer/SKILL.md +1 -0
- package/kit/skills/fiori-developer/references/app-setup.md +127 -0
- package/kit/skills/fiori-developer/references/elements.md +109 -11
- package/kit/skills/fiori-developer/references/ui5-basics.md +3 -2
- package/kit/templates/agents-block.md +3 -2
- package/kit/templates/progress.html +14 -9
- package/kit/templates/project.md +5 -0
- package/package.json +1 -1
- package/schemas/config.schema.json +1 -15
- package/src/adapters/claude-code.mjs +16 -12
- package/src/cli.mjs +3 -2
- package/src/commands/branch.mjs +34 -24
- package/src/commands/check.mjs +1 -17
- package/src/commands/setup.mjs +73 -35
- package/src/commands/status.mjs +38 -13
- package/src/context.mjs +6 -0
- package/src/plan.mjs +8 -4
- package/src/progress-view.mjs +32 -11
- package/src/review.mjs +1 -1
- package/src/terminal.mjs +7 -3
- package/src/ui.mjs +22 -0
|
@@ -70,9 +70,11 @@ section.detail { display: grid; gap: 22px; }
|
|
|
70
70
|
.headline h1 .key { font-family: var(--mono); font-weight: 500; font-size: 21px; color: var(--accent); }
|
|
71
71
|
.now-box { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
|
|
72
72
|
.now-box.you { background: var(--human-bg); border-color: color-mix(in srgb, var(--human) 35%, transparent); }
|
|
73
|
-
.now-box.merged { background: var(--pass-bg); }
|
|
73
|
+
.now-box.merged, .now-box.done { background: var(--pass-bg); }
|
|
74
|
+
.now-box ul { margin: 6px 0 0; padding-left: 18px; }
|
|
75
|
+
.now-box .opt { display: block; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
|
|
74
76
|
.now-box .ico { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--surface); display: grid; place-items: center; font-weight: 700; }
|
|
75
|
-
.now-box.you .ico { background: var(--human); } .now-box.merged .ico { background: var(--pass); }
|
|
77
|
+
.now-box.you .ico { background: var(--human); } .now-box.merged .ico, .now-box.done .ico { background: var(--pass); }
|
|
76
78
|
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
|
|
77
79
|
.stat { background: var(--surface); padding: 12px 14px; display: grid; gap: 2px; }
|
|
78
80
|
.stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
@@ -141,7 +143,7 @@ footer { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--lin
|
|
|
141
143
|
<div class="gen"><span id="generated"></span><span>refresh: <code>npx agjan progress --open</code></span></div>
|
|
142
144
|
</header>
|
|
143
145
|
<section aria-labelledby="ov">
|
|
144
|
-
<div class="panel-head" style="margin-bottom:10px"><h2 id="ov">Project</h2><span class="legend"><span><i style="background:var(--human)"></i>your turn</span><span><i style="background:var(--accent)"></i>agent working</span><span><i style="background:var(--pass)"></i>done</span></span></div>
|
|
146
|
+
<div class="panel-head" style="margin-bottom:10px"><h2 id="ov">Project</h2><span class="legend"><span><i style="background:var(--human)"></i>your turn</span><span><i style="background:var(--accent)"></i>agent working</span><span><i style="background:var(--pass)"></i>done or merged</span></span></div>
|
|
145
147
|
<div class="units" id="units"></div>
|
|
146
148
|
</section>
|
|
147
149
|
<section class="detail" id="detail" aria-live="polite"></section>
|
|
@@ -170,12 +172,14 @@ function severities(ids, f) {
|
|
|
170
172
|
function turnPill(u) {
|
|
171
173
|
if (u.turn === 'you') return `<span class="pill you"><span class="pulse">●</span> Your turn</span>`;
|
|
172
174
|
if (u.turn === 'merged') return `<span class="pill merged">✓ Merged</span>`;
|
|
175
|
+
if (u.turn === 'done') return `<span class="pill merged">✓ Done</span>`;
|
|
173
176
|
return `<span class="pill agent">Agent working</span>`;
|
|
174
177
|
}
|
|
175
178
|
function trackHtml(u) {
|
|
176
179
|
return u.stages.map((s, i) => {
|
|
177
|
-
const
|
|
178
|
-
const
|
|
180
|
+
const finished = u.turn === 'done' || u.turn === 'merged';
|
|
181
|
+
const cls = i < u.at || finished ? 'done' : i === u.at ? `now ${u.turn === 'you' ? 'you' : ''}` : '';
|
|
182
|
+
const markc = i < u.at || finished ? '✓' : i === u.at ? (u.turn === 'you' ? '!' : '…') : '';
|
|
179
183
|
return `<span class="st ${cls}"><span class="dot">${markc}</span>${esc(s)}</span>`;
|
|
180
184
|
}).join('<span class="bar"></span>');
|
|
181
185
|
}
|
|
@@ -192,7 +196,7 @@ function renderUnits() {
|
|
|
192
196
|
const kind = `${KIND[u.kind] || u.kind}${u.mode ? ` · ${u.mode} mode` : ''}${u.host ? ` · ${u.host}` : ''}`;
|
|
193
197
|
b.innerHTML = `<span class="name"><span class="key">${esc(u.key)}</span><span class="slug">${esc(u.slug)}</span><span class="kind">${esc(kind)}</span></span>
|
|
194
198
|
<span class="track">${trackHtml(u)}</span>
|
|
195
|
-
<span class="turn">${turnPill(u)}<span class="muted">${esc(u.turn === 'merged' ? `${u.stats.reviews} review${u.stats.reviews === 1 ? '' : 's'} · last ${dhm(u.last)}` : u.now)}</span></span>`;
|
|
199
|
+
<span class="turn">${turnPill(u)}<span class="muted">${esc(u.turn === 'merged' || u.turn === 'done' ? `${u.stats.reviews} review${u.stats.reviews === 1 ? '' : 's'} · last ${dhm(u.last)}` : u.now)}</span></span>`;
|
|
196
200
|
b.addEventListener('click', () => { selected = u.slug; filter = 'open'; focusReview = null; renderUnits(); renderDetail(); });
|
|
197
201
|
box.append(b);
|
|
198
202
|
}
|
|
@@ -282,8 +286,9 @@ function renderDetail() {
|
|
|
282
286
|
if (!u) { d.innerHTML = ''; return; }
|
|
283
287
|
const s = u.stats;
|
|
284
288
|
const count = (st) => Object.values(u.findings).filter((f) => st === 'all' || f.status === st).length;
|
|
285
|
-
const icon = u.turn === 'you' ? '!' : u.turn === 'merged' ? '✓' : '…';
|
|
286
|
-
const who = u.turn === 'you' ? 'Your turn' : u.turn === 'merged' ? 'Merged' : 'The agent is working';
|
|
289
|
+
const icon = u.turn === 'you' ? '!' : u.turn === 'merged' || u.turn === 'done' ? '✓' : '…';
|
|
290
|
+
const who = u.turn === 'you' ? 'Your turn' : u.turn === 'merged' ? 'Merged' : u.turn === 'done' ? 'Done' : 'The agent is working';
|
|
291
|
+
const optional = (u.optional || []).length ? `<span class="opt">Optional next steps</span><ul>${u.optional.map((o) => `<li>${esc(o)}</li>`).join('')}</ul>` : '';
|
|
287
292
|
const acs = u.acs ? `<div class="stat"><span class="v">${u.acs.passing ?? u.acs.withTests}/${u.acs.automated}</span><span class="l">ACs with ${u.acs.passing === null ? '' : 'passing '}tests${u.acs.manual.length ? ` · ${u.acs.manual.length} manual` : ''}</span></div>` : '';
|
|
288
293
|
const tasks = u.tasks.length ? `<div class="stat"><span class="v">${u.tasks.filter((t) => t.done).length}/${u.tasks.length}</span><span class="l">tasks committed</span></div>` : '';
|
|
289
294
|
const taskRows = u.tasks.map((t) => `<tr><td><span class="mono">${esc(t.id)}</span> <span class="muted">${esc(t.area)}</span><br>${esc(t.title)}<br><span class="muted">covers ${esc(t.covers.join(', '))}</span></td><td class="mono">${t.commits.map(esc).join('<br>') || '–'}</td><td class="mono">${t.reviews.map(esc).join(', ') || '–'}</td></tr>`).join('');
|
|
@@ -295,7 +300,7 @@ function renderDetail() {
|
|
|
295
300
|
d.innerHTML = `
|
|
296
301
|
<div class="headline"><h2>${esc(KIND[u.kind] || u.kind)}</h2><h1><span class="key">${esc(u.key)}</span>${esc(u.title)}</h1>
|
|
297
302
|
<span class="muted"><span class="mono">docs/agjan/${esc(u.slug)}/</span>${u.mode ? ` · ${esc(u.mode)} mode` : ''}${u.areas.length ? ` · areas ${esc(u.areas.join(', '))}` : ''} · started ${dhm(u.start)}</span></div>
|
|
298
|
-
<div class="now-box ${esc(u.turn)}" role="status"><span class="ico" aria-hidden="true">${icon}</span><span><b>${who}:</b> ${esc(u.now)}${u.acs && u.acs.manual.length ? ` · check by hand: ${esc(u.acs.manual.join(', '))}` : ''}</span></div>
|
|
303
|
+
<div class="now-box ${esc(u.turn)}" role="status"><span class="ico" aria-hidden="true">${icon}</span><span><b>${who}:</b> ${esc(u.now)}${u.turn !== 'done' && u.acs && u.acs.manual.length ? ` · check by hand: ${esc(u.acs.manual.join(', '))}` : ''}${optional}</span></div>
|
|
299
304
|
<div class="stats">
|
|
300
305
|
<div class="stat"><span class="v">${dur(s.activeMs)}</span><span class="l">agent work</span></div>
|
|
301
306
|
<div class="stat"><span class="v">${dur(s.waitingMs)}</span><span class="l">waiting for a human</span></div>
|
package/kit/templates/project.md
CHANGED
|
@@ -17,6 +17,11 @@ Each application: its folder, `app_type` (elements or freestyle), the service it
|
|
|
17
17
|
|
|
18
18
|
Runtime, BTP services, deployment targets.
|
|
19
19
|
|
|
20
|
+
## Run locally
|
|
21
|
+
|
|
22
|
+
How to start the application and try it: the command (for example `npx cds watch`),
|
|
23
|
+
the URLs of the apps, and the test users with their roles and passwords.
|
|
24
|
+
|
|
20
25
|
## Conventions
|
|
21
26
|
|
|
22
27
|
Naming, tests, lint.
|
package/package.json
CHANGED
|
@@ -13,21 +13,7 @@
|
|
|
13
13
|
"git": {
|
|
14
14
|
"type": "object",
|
|
15
15
|
"properties": {
|
|
16
|
-
"base": { "type": ["string", "null"] }
|
|
17
|
-
"branch": {
|
|
18
|
-
"type": "object",
|
|
19
|
-
"properties": {
|
|
20
|
-
"create": {
|
|
21
|
-
"description": "Who creates branches: 'agent' (default; with npx agjan branch) or 'confirm' (the agent proposes a name, a human runs npx agjan branch in a terminal and may edit it).",
|
|
22
|
-
"enum": ["agent", "confirm"]
|
|
23
|
-
},
|
|
24
|
-
"pattern": {
|
|
25
|
-
"description": "Regular expression every branch name must match (npx agjan branch refuses others; check reports them).",
|
|
26
|
-
"type": ["string", "null"]
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"additionalProperties": false
|
|
30
|
-
}
|
|
16
|
+
"base": { "type": ["string", "null"] }
|
|
31
17
|
},
|
|
32
18
|
"additionalProperties": false
|
|
33
19
|
},
|
|
@@ -43,20 +43,26 @@ export const GUARD_HOOK = {
|
|
|
43
43
|
const GUARD_PATH = 'node_modules/agjan/kit/hooks/guard.mjs';
|
|
44
44
|
|
|
45
45
|
/** A guard entry written by an earlier agjan version (for example the exec form). */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
/** The tools the guard sees: the shell, and the file edit tools (records, allow_edits). */
|
|
47
|
+
export const GUARD_MATCHER = 'Bash|Edit|Write|MultiEdit|NotebookEdit';
|
|
48
|
+
|
|
49
|
+
const isGuard = (hook) => JSON.stringify(hook).includes(GUARD_PATH);
|
|
50
|
+
const isCurrent = (hook) => JSON.stringify(hook) === JSON.stringify(GUARD_HOOK);
|
|
50
51
|
|
|
52
|
+
/** The current guard, in a group with the current matcher, and no other guard entry. */
|
|
51
53
|
function hasGuard(data) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
+
const groups = data.hooks?.PreToolUse ?? [];
|
|
55
|
+
const guards = groups.flatMap((group) => (group.hooks ?? []).filter(isGuard).map((hook) => ({ group, hook })));
|
|
56
|
+
return guards.length === 1 && isCurrent(guards[0].hook) && guards[0].group.matcher === GUARD_MATCHER;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
/**
|
|
57
|
-
|
|
59
|
+
/**
|
|
60
|
+
* PreToolUse without any guard entry (earlier forms, or the current one under an older
|
|
61
|
+
* matcher such as 'Bash'); a group left empty is dropped. The caller adds the current one.
|
|
62
|
+
*/
|
|
63
|
+
function withoutGuards(groups) {
|
|
58
64
|
return groups
|
|
59
|
-
.map((group) => (group.hooks?.some(
|
|
65
|
+
.map((group) => (group.hooks?.some(isGuard) ? { ...group, hooks: group.hooks.filter((h) => !isGuard(h)) } : group))
|
|
60
66
|
.filter((group) => !Array.isArray(group.hooks) || group.hooks.length > 0);
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -106,9 +112,7 @@ export function plan(config, skills) {
|
|
|
106
112
|
const deny = [...new Set([...(data.permissions?.deny ?? []), ...DENY_RULES])];
|
|
107
113
|
let hooks = data.hooks ?? {};
|
|
108
114
|
if (!hasGuard(data)) {
|
|
109
|
-
|
|
110
|
-
const current = groups.some((g) => (g.hooks ?? []).some((h) => JSON.stringify(h) === JSON.stringify(GUARD_HOOK)));
|
|
111
|
-
hooks = { ...hooks, PreToolUse: current ? groups : [...groups, { matcher: 'Bash', hooks: [GUARD_HOOK] }] };
|
|
115
|
+
hooks = { ...hooks, PreToolUse: [...withoutGuards(hooks.PreToolUse ?? []), { matcher: GUARD_MATCHER, hooks: [GUARD_HOOK] }] };
|
|
112
116
|
}
|
|
113
117
|
return { ...data, permissions: { ...(data.permissions ?? {}), deny }, hooks };
|
|
114
118
|
},
|
package/src/cli.mjs
CHANGED
|
@@ -58,8 +58,9 @@ Setup (human):
|
|
|
58
58
|
doctor check the environment and the project setup
|
|
59
59
|
|
|
60
60
|
Agent and human:
|
|
61
|
-
branch <name>
|
|
62
|
-
|
|
61
|
+
branch <name> | --list | --use <name>
|
|
62
|
+
create the branch for a feature, fix or map run, list
|
|
63
|
+
the existing ones, or switch to one (after asking the user)
|
|
63
64
|
new <slug> --key <KEY> create a feature folder with approvals.json and spec.md
|
|
64
65
|
scaffold design create design.md and tasks.md from the templates
|
|
65
66
|
progress [--open] regenerate the progress pages and show the overview
|
package/src/commands/branch.mjs
CHANGED
|
@@ -2,43 +2,53 @@ import { parseArgs } from 'node:util';
|
|
|
2
2
|
import { git, currentBranch, resolveBase } from '../git.mjs';
|
|
3
3
|
import { AgjanError, UsageError } from '../errors.mjs';
|
|
4
4
|
|
|
5
|
-
/** Problems with a proposed branch name: git's rules,
|
|
5
|
+
/** Problems with a proposed branch name: git's rules, existence. */
|
|
6
6
|
export function branchProblems(root, config, name) {
|
|
7
7
|
const problems = [];
|
|
8
8
|
if (git(root, ['check-ref-format', '--branch', name], { allowFail: true }) === null) problems.push(`'${name}' is not a valid branch name`);
|
|
9
|
-
const pattern = config.git?.branch?.pattern;
|
|
10
|
-
if (pattern && !new RegExp(pattern).test(name)) problems.push(`'${name}' does not match the branch pattern ${pattern} (git.branch.pattern)`);
|
|
11
9
|
if (git(root, ['rev-parse', '--verify', '--quiet', `refs/heads/${name}`], { allowFail: true }) !== null) problems.push(`branch '${name}' already exists`);
|
|
12
10
|
return problems;
|
|
13
11
|
}
|
|
14
12
|
|
|
13
|
+
/** Local branches other than the base branch, most recent commit first. */
|
|
14
|
+
export function existingBranches(root, config) {
|
|
15
|
+
const base = (resolveBase(root, config.git?.base) ?? '').replace(/^origin\//, '');
|
|
16
|
+
const out = git(root, ['for-each-ref', '--sort=-committerdate', '--format=%(refname:short)\t%(committerdate:relative)', 'refs/heads'], { allowFail: true }) ?? '';
|
|
17
|
+
return out.split('\n').filter(Boolean).map((line) => {
|
|
18
|
+
const [name, when] = line.split('\t');
|
|
19
|
+
return { name, when };
|
|
20
|
+
}).filter((b) => b.name !== base);
|
|
21
|
+
}
|
|
22
|
+
|
|
15
23
|
/**
|
|
16
|
-
* agjan branch <name>:
|
|
17
|
-
*
|
|
18
|
-
* name
|
|
24
|
+
* agjan branch <name> | --list | --use <name>: the branch for a feature, fix or map run.
|
|
25
|
+
* The agent asks the user first (create the proposed name, use an existing branch, or
|
|
26
|
+
* another name; design decision 62), then runs this: <name> creates the branch and
|
|
27
|
+
* switches to it, --list shows the existing ones, --use switches to one of them.
|
|
19
28
|
*/
|
|
20
29
|
export async function run(ctx, argv) {
|
|
21
|
-
const { positionals } = parseArgs({ args: argv, allowPositionals: true });
|
|
22
|
-
if (positionals.length !== 1) throw new UsageError('usage: agjan branch <name>');
|
|
30
|
+
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { list: { type: 'boolean' }, use: { type: 'string' } } });
|
|
23
31
|
const s = ctx.style;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!name) {
|
|
38
|
-
ctx.out(s.yellow('cancelled, no branch created'));
|
|
39
|
-
return 1;
|
|
32
|
+
if (values.list) {
|
|
33
|
+
if (positionals.length || values.use) throw new UsageError('usage: agjan branch --list');
|
|
34
|
+
const current = currentBranch(ctx.root);
|
|
35
|
+
const branches = existingBranches(ctx.root, ctx.config);
|
|
36
|
+
if (!branches.length) ctx.out(s.gray('no branches besides the base branch'));
|
|
37
|
+
for (const b of branches) ctx.out(`${b.name === current ? s.green('* ') : ' '}${s.bold(b.name)} ${s.gray(`(${b.when})`)}`);
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
if (values.use !== undefined) {
|
|
41
|
+
if (positionals.length) throw new UsageError('usage: agjan branch --use <name>');
|
|
42
|
+
const name = values.use;
|
|
43
|
+
if (!existingBranches(ctx.root, ctx.config).some((b) => b.name === name)) {
|
|
44
|
+
throw new AgjanError(`'${name}' is not an existing branch other than the base branch (npx agjan branch --list)`);
|
|
40
45
|
}
|
|
46
|
+
if (currentBranch(ctx.root) !== name) git(ctx.root, ['switch', '-q', name]);
|
|
47
|
+
ctx.out(`${s.green('on branch')} ${s.bold(name)}`);
|
|
48
|
+
return 0;
|
|
41
49
|
}
|
|
50
|
+
if (positionals.length !== 1) throw new UsageError('usage: agjan branch <name> | --list | --use <name>');
|
|
51
|
+
const name = positionals[0];
|
|
42
52
|
const problems = branchProblems(ctx.root, ctx.config, name);
|
|
43
53
|
if (problems.length) throw new AgjanError(`cannot create the branch:\n${problems.map((p) => ` - ${p}`).join('\n')}`);
|
|
44
54
|
const from = currentBranch(ctx.root);
|
package/src/commands/check.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync, statSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { parseArgs } from 'node:util';
|
|
4
|
-
import { git, changedFiles,
|
|
4
|
+
import { git, changedFiles, mergeBase, resolveBase } from '../git.mjs';
|
|
5
5
|
import { CONFIG_FILE, resolveArea } from '../config.mjs';
|
|
6
6
|
import { FEATURES_DIR, changedFeatures, listFeatures, loadFeature } from '../feature.mjs';
|
|
7
7
|
import { documentProblems, designProblems } from '../validate.mjs';
|
|
@@ -335,7 +335,6 @@ export function runChecks(ctx, level, explicitFeature) {
|
|
|
335
335
|
checkScope(report, features, config, files, level);
|
|
336
336
|
const policy = level === 'ci' ? checkPolicy(report, root, config, files, base) : [];
|
|
337
337
|
if (level !== 'staged') {
|
|
338
|
-
checkBranchName(report, root, config, base, level);
|
|
339
338
|
checkManaged(report, ctx);
|
|
340
339
|
// The baseline describes the application; changes to watched files make it stale.
|
|
341
340
|
const drift = features.some((f) => f.kind === 'map') ? null : baselineDrift(root, config);
|
|
@@ -346,21 +345,6 @@ export function runChecks(ctx, level, explicitFeature) {
|
|
|
346
345
|
return { report, slugs, features, files, policy };
|
|
347
346
|
}
|
|
348
347
|
|
|
349
|
-
/**
|
|
350
|
-
* git.branch.pattern (design decision 62): a branch with work on it must match. A warning
|
|
351
|
-
* locally, an error in CI. The base branch itself and a detached HEAD are not judged.
|
|
352
|
-
*/
|
|
353
|
-
function checkBranchName(report, root, config, base, level) {
|
|
354
|
-
const pattern = config.git?.branch?.pattern;
|
|
355
|
-
if (!pattern) return;
|
|
356
|
-
const branch = currentBranch(root);
|
|
357
|
-
if (!branch || branch === base?.replace(/^origin\//, '')) return;
|
|
358
|
-
if (new RegExp(pattern).test(branch)) return;
|
|
359
|
-
const message = `branch '${branch}' does not match the branch pattern ${pattern} (git.branch.pattern)`;
|
|
360
|
-
if (level === 'ci') report.error('git', message);
|
|
361
|
-
else report.warn('git', message);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
348
|
/** `--base <ref>` overrides git.base for this run, for CI where the base ref is known. */
|
|
365
349
|
export function overrideBase(ctx, base) {
|
|
366
350
|
if (base) ctx.config.git = { ...ctx.config.git, base };
|
package/src/commands/setup.mjs
CHANGED
|
@@ -14,23 +14,12 @@ import { hookStatus, installHook } from '../hook.mjs';
|
|
|
14
14
|
import { GUARD } from '../adapters/copilot.mjs';
|
|
15
15
|
import { git, mergeBase, resolveBase } from '../git.mjs';
|
|
16
16
|
import { AgjanError, UsageError } from '../errors.mjs';
|
|
17
|
-
import { mark, pad, tone, verdictColor } from '../ui.mjs';
|
|
17
|
+
import { blink, mark, pad, tone, verdictColor } from '../ui.mjs';
|
|
18
18
|
|
|
19
19
|
const CI_FILE = '.github/workflows/agjan.yml';
|
|
20
20
|
const CI_TEMPLATE = new URL('../../kit/templates/agjan-ci.yml', import.meta.url);
|
|
21
21
|
const BIN = fileURLToPath(new URL('../../bin/agjan.mjs', import.meta.url));
|
|
22
22
|
|
|
23
|
-
const CODEOWNERS = `# agjan: changes to the rules need an owner's review
|
|
24
|
-
/agjan.config.json @<owner>
|
|
25
|
-
/agjan.lock.json @<owner>
|
|
26
|
-
/docs/agjan/**/approvals.json @<owner>
|
|
27
|
-
/.claude/ @<owner>
|
|
28
|
-
/.github/agents/ @<owner>
|
|
29
|
-
/.github/hooks/ @<owner>
|
|
30
|
-
/.github/workflows/ @<owner>
|
|
31
|
-
/package.json @<owner>
|
|
32
|
-
/package-lock.json @<owner>`;
|
|
33
|
-
|
|
34
23
|
function list(value) {
|
|
35
24
|
return value ? value.split(',').map((v) => v.trim()).filter(Boolean) : null;
|
|
36
25
|
}
|
|
@@ -63,6 +52,16 @@ function missingModels(raw, hosts, { existing }) {
|
|
|
63
52
|
return added;
|
|
64
53
|
}
|
|
65
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Settings that decide what agents may do without asking, written visibly into an
|
|
57
|
+
* existing configuration that lacks them, with the behavior it had (design decision 69).
|
|
58
|
+
*/
|
|
59
|
+
function missingSettings(raw) {
|
|
60
|
+
const out = [];
|
|
61
|
+
if (raw.agent?.allow === undefined || raw.agent?.allow_edits === undefined) out.push('agent');
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
|
|
66
65
|
/** Writes the managed files for the current configuration and updates the recorded kit version. */
|
|
67
66
|
function doSync(ctx, { force }) {
|
|
68
67
|
const config = loadConfig(ctx.root);
|
|
@@ -70,14 +69,18 @@ function doSync(ctx, { force }) {
|
|
|
70
69
|
const file = join(ctx.root, CONFIG_FILE);
|
|
71
70
|
const raw = readJson(file) ?? {};
|
|
72
71
|
const added = missingModels(raw, config.hosts, { existing: Boolean(raw.models) || raw.kit !== ctx.kit });
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
const visible = missingSettings(raw);
|
|
73
|
+
if (Object.keys(added).length || visible.length) {
|
|
74
|
+
const next = { ...raw, models: { ...(raw.models ?? {}), ...added } };
|
|
75
|
+
if (visible.includes('agent')) next.agent = { allow: raw.agent?.allow ?? [], allow_edits: raw.agent?.allow_edits ?? false, ...(raw.agent ?? {}) };
|
|
76
|
+
writeJson(file, next);
|
|
75
77
|
config.models = { ...(config.models ?? {}), ...added };
|
|
76
78
|
}
|
|
77
79
|
const results = applyPlan(ctx.root, buildPlan(config), { kit: ctx.kit, force });
|
|
78
80
|
for (const [host, tiers] of Object.entries(added)) {
|
|
79
81
|
results.push({ path: CONFIG_FILE, action: `models.${host}: ${MODEL_TIERS.map((t) => `${t}=${tiers[t]}`).join(', ')}` });
|
|
80
82
|
}
|
|
83
|
+
if (visible.includes('agent')) results.push({ path: CONFIG_FILE, action: 'agent: allow, allow_edits' });
|
|
81
84
|
const current = readJson(file) ?? {};
|
|
82
85
|
if (current.kit !== ctx.kit) {
|
|
83
86
|
writeJson(file, { ...current, kit: ctx.kit });
|
|
@@ -86,9 +89,32 @@ function doSync(ctx, { force }) {
|
|
|
86
89
|
return results;
|
|
87
90
|
}
|
|
88
91
|
|
|
92
|
+
/** Asks a yes/no question; null without a terminal (scripts, CI, agents). */
|
|
93
|
+
function ask(ctx, question, options) {
|
|
94
|
+
return ctx.ask(question, options);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The next steps after init, for the configured hosts (design decision 69). */
|
|
98
|
+
function nextSteps(ctx, hosts, firstCommit) {
|
|
99
|
+
const s = ctx.style;
|
|
100
|
+
const steps = [
|
|
101
|
+
firstCommit
|
|
102
|
+
? `Commit the setup: ${s.cyan('git add -A && git commit -m "chore: set up agjan"')}`
|
|
103
|
+
: `Commit the setup on a branch of its own and merge it with a PR: ${s.cyan('git add -A && git commit -m "chore: set up agjan"')}`,
|
|
104
|
+
];
|
|
105
|
+
if (hosts.includes('claude-code')) {
|
|
106
|
+
steps.push("Open this folder once in Claude Code and trust it: the reviewer's agjan tools load only in trusted folders.");
|
|
107
|
+
}
|
|
108
|
+
if (hosts.includes('copilot')) {
|
|
109
|
+
steps.push(`Start ${s.cyan('copilot')} in this folder and trust it. Without agent.allow_edits, answer the first file edit prompt with "don't ask again for file operations", or start ${s.cyan('copilot --allow-tool write')}.`);
|
|
110
|
+
}
|
|
111
|
+
steps.push(`Run: ${s.cyan('npx agjan doctor')}`);
|
|
112
|
+
return ['', s.bold('Next steps:'), ...steps.map((text, i) => ` ${i + 1}. ${text}`)];
|
|
113
|
+
}
|
|
114
|
+
|
|
89
115
|
/**
|
|
90
116
|
* agjan init [--domains btp] [--hosts claude-code] [--language en] [--base <ref>] [--no-hook] [--no-ci]
|
|
91
|
-
* [--prepare] [--agent-allow | --no-agent-allow]
|
|
117
|
+
* [--prepare] [--agent-allow | --no-agent-allow] [--agent-allow-edits | --no-agent-allow-edits]
|
|
92
118
|
*/
|
|
93
119
|
export async function init(ctx, argv) {
|
|
94
120
|
const { values } = parseArgs({
|
|
@@ -103,6 +129,8 @@ export async function init(ctx, argv) {
|
|
|
103
129
|
prepare: { type: 'boolean' },
|
|
104
130
|
'agent-allow': { type: 'boolean' },
|
|
105
131
|
'no-agent-allow': { type: 'boolean' },
|
|
132
|
+
'agent-allow-edits': { type: 'boolean' },
|
|
133
|
+
'no-agent-allow-edits': { type: 'boolean' },
|
|
106
134
|
},
|
|
107
135
|
});
|
|
108
136
|
const root = ctx.root;
|
|
@@ -112,6 +140,21 @@ export async function init(ctx, argv) {
|
|
|
112
140
|
const hosts = list(values.hosts) ?? ['claude-code'];
|
|
113
141
|
for (const h of hosts) if (!ADAPTERS[h]) throw new UsageError(`host '${h}' is not supported in this version (supported: ${Object.keys(ADAPTERS).join(', ')})`);
|
|
114
142
|
|
|
143
|
+
// The mark first, then the questions (design decision 69).
|
|
144
|
+
const s = ctx.style;
|
|
145
|
+
const lines = mark(s, ctx.kit, 'setting up this repository');
|
|
146
|
+
for (const line of lines) ctx.out(line);
|
|
147
|
+
await blink(ctx, lines);
|
|
148
|
+
|
|
149
|
+
// Opt-in decisions, asked once. Enter takes the recommended answer (yes); without a
|
|
150
|
+
// terminal the safe defaults (no) apply. They are written visibly, so the team sees
|
|
151
|
+
// and can change them.
|
|
152
|
+
const flag = (yes, no) => (values[yes] ? true : values[no] ? false : null);
|
|
153
|
+
const agentAllow = flag('agent-allow', 'no-agent-allow') ??
|
|
154
|
+
ask(ctx, `Let agents run these commands without a prompt: ${RECOMMENDED_ALLOW.join(', ')}?\n(agjan approve, accept and reject stay blocked; change agent.allow in ${CONFIG_FILE} later.)`, { defaultYes: true }) ?? false;
|
|
155
|
+
const allowEdits = flag('agent-allow-edits', 'no-agent-allow-edits') ??
|
|
156
|
+
ask(ctx, 'Let agents change files in this project without a prompt?\n(agjan records and policy files excluded; agjan checks the scope of every change.)', { defaultYes: true }) ?? false;
|
|
157
|
+
|
|
115
158
|
const config = {
|
|
116
159
|
$schema: './node_modules/agjan/schemas/config.schema.json',
|
|
117
160
|
kit: ctx.kit,
|
|
@@ -119,19 +162,16 @@ export async function init(ctx, argv) {
|
|
|
119
162
|
hosts,
|
|
120
163
|
language: values.language ?? 'en',
|
|
121
164
|
models: missingModels({}, hosts, { existing: false }),
|
|
165
|
+
git: { ...(values.base ? { base: values.base } : {}) },
|
|
166
|
+
agent: { allow: agentAllow ? RECOMMENDED_ALLOW : [], allow_edits: allowEdits },
|
|
122
167
|
};
|
|
123
|
-
if (values.base) config.git = { base: values.base };
|
|
124
|
-
// Opt-in (design decision 61): asked once; without a terminal, nothing is allowed.
|
|
125
|
-
let agentAllow = values['agent-allow'] ? true : values['no-agent-allow'] ? false : null;
|
|
126
|
-
agentAllow ??= ctx.ask(`Let agents run these commands without a prompt: ${RECOMMENDED_ALLOW.join(', ')}?\n(agjan approve, accept and reject stay blocked; edit agent.allow in ${CONFIG_FILE} later.)`) ?? false;
|
|
127
|
-
if (agentAllow) config.agent = { allow: RECOMMENDED_ALLOW };
|
|
128
168
|
writeJson(join(root, CONFIG_FILE), config);
|
|
129
|
-
|
|
130
|
-
for (const line of mark(s, ctx.kit, 'setting up this repository')) ctx.out(line);
|
|
131
|
-
ctx.out(`${s.bold('agjan init')}: ${CONFIG_FILE} (domains ${domains.join(', ')}; hosts ${hosts.join(', ')})`);
|
|
169
|
+
ctx.out('', `${s.bold('agjan init')}: ${CONFIG_FILE} (domains ${domains.join(', ')}; hosts ${hosts.join(', ')})`);
|
|
132
170
|
|
|
133
171
|
printResults(ctx, doSync(ctx, { force: false }));
|
|
134
|
-
|
|
172
|
+
const setting = (on, text) => ` ${pad(on ? tone(s, 'created') : s.gray('none'), on ? 'created' : 'none', 14)} ${text}`;
|
|
173
|
+
ctx.out(setting(agentAllow, `agent.allow${agentAllow ? ` (${RECOMMENDED_ALLOW.length} commands)` : ''}`));
|
|
174
|
+
ctx.out(setting(allowEdits, `agent.allow_edits${allowEdits ? ' (file changes without a prompt)' : ''}`));
|
|
135
175
|
|
|
136
176
|
if (!values['no-hook']) {
|
|
137
177
|
const hook = installHook(root);
|
|
@@ -153,16 +193,8 @@ export async function init(ctx, argv) {
|
|
|
153
193
|
if (!pkg?.devDependencies?.agjan && !pkg?.dependencies?.agjan) {
|
|
154
194
|
ctx.out('', s.yellow('Pin agjan in this project so every developer and CI use the same version:'), ` ${s.cyan('npm install --save-dev agjan')}`);
|
|
155
195
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
s.bold('Next steps:'),
|
|
159
|
-
' 1. Open this folder once in Claude Code and trust it: the reviewer agent\'s',
|
|
160
|
-
' agjan MCP server loads only in trusted folders.',
|
|
161
|
-
' 2. Protect the base branch: require the "agjan-check" status check and a review.',
|
|
162
|
-
' 3. Add this to .github/CODEOWNERS (replace @<owner>):',
|
|
163
|
-
...CODEOWNERS.split('\n').map((l) => ` ${l}`),
|
|
164
|
-
` 4. Run: ${s.cyan('npx agjan doctor')}`,
|
|
165
|
-
);
|
|
196
|
+
const firstCommit = git(root, ['rev-parse', '--verify', '--quiet', 'HEAD'], { allowFail: true }) === null;
|
|
197
|
+
ctx.out(...nextSteps(ctx, hosts, firstCommit));
|
|
166
198
|
return 0;
|
|
167
199
|
}
|
|
168
200
|
|
|
@@ -263,7 +295,9 @@ export function doctor(ctx) {
|
|
|
263
295
|
else ok('local install', local.version);
|
|
264
296
|
|
|
265
297
|
const base = resolveBase(root, config.git?.base);
|
|
266
|
-
|
|
298
|
+
const commits = git(root, ['rev-parse', '--verify', '--quiet', 'HEAD'], { allowFail: true }) !== null;
|
|
299
|
+
if (!commits) warn('base branch', 'no commits yet: commit the setup first (git add -A && git commit -m "chore: set up agjan"); main exists after that');
|
|
300
|
+
else if (!base) warn('base branch', `none found; set git.base in ${CONFIG_FILE}`);
|
|
267
301
|
else if (!mergeBase(root, base)) warn('base branch', `${base} has no common history with HEAD (fetch it?)`);
|
|
268
302
|
else ok('base branch', base);
|
|
269
303
|
|
|
@@ -298,7 +332,11 @@ export function doctor(ctx) {
|
|
|
298
332
|
const allow = config.agent?.allow ?? [];
|
|
299
333
|
ok('agent allow list', allow.length ? `${allow.length} command(s) without a prompt: ${allow.join(', ')}` : 'none (the hosts ask for every command)');
|
|
300
334
|
ok('reviewer models', config.hosts.map((h) => `${h}: ${MODEL_TIERS.map((t) => `${t} ${agentModel(config, h, t) ?? 'session model'}`).join(', ')}`).join('; '));
|
|
335
|
+
ok('file edits', config.agent?.allow_edits === true ? 'without a prompt inside the project (agjan records denied, policy files ask)' : 'the host asks for every file change (agent.allow_edits)');
|
|
336
|
+
ok('branches', 'agents ask you, then run npx agjan branch');
|
|
301
337
|
ok('script edits', config.agent?.script_edits === 'allow' ? 'allowed (agent.script_edits)' : 'denied by the guard: agents edit files with their edit tool');
|
|
338
|
+
const tracked = (git(root, ['ls-files', '--', 'node_modules'], { allowFail: true }) ?? '').trim();
|
|
339
|
+
if (tracked) warn('node_modules', 'is committed; remove it: git rm -r -q --cached node_modules && git commit -m "chore: stop tracking node_modules"');
|
|
302
340
|
const ignored = git(root, ['check-ignore', '-q', '.agjan/x'], { allowFail: true }) !== null;
|
|
303
341
|
if (!ignored) warn('.gitignore', '.agjan/ is not ignored; run: npx agjan sync');
|
|
304
342
|
}
|
package/src/commands/status.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
|
-
import { FEATURES_DIR, changedFeatures, listFeatures, loadFeature, stillBlocked } from '../feature.mjs';
|
|
2
|
+
import { FEATURES_DIR, changedFeatures, listFeatures, loadFeature, selectFeature, stillBlocked } from '../feature.mjs';
|
|
3
3
|
import { UsageError } from '../errors.mjs';
|
|
4
4
|
import { buildProgress, verifyState } from '../progress.mjs';
|
|
5
5
|
import { gateReadiness, pendingGate } from './gates.mjs';
|
|
@@ -11,6 +11,8 @@ import { mark, markLine, pad, tone } from '../ui.mjs';
|
|
|
11
11
|
import { acTestFiles } from '../tests-map.mjs';
|
|
12
12
|
import { acResults, loadResults } from '../test-results.mjs';
|
|
13
13
|
import { runChecks } from './check.mjs';
|
|
14
|
+
import { readLog } from '../log.mjs';
|
|
15
|
+
import { optionalSteps } from '../progress-view.mjs';
|
|
14
16
|
|
|
15
17
|
/** One indented row: a label column, then the value. `next` and `blocks` stand out. */
|
|
16
18
|
function row(ctx, label, value) {
|
|
@@ -43,13 +45,21 @@ function gateStep(feature) {
|
|
|
43
45
|
|
|
44
46
|
/** The next action in Build: a due review first, then the next task, then Verify, then the PR. */
|
|
45
47
|
function nextInBuild(ctx, feature, progress) {
|
|
48
|
+
// The same rule as the progress pages: a skill runs once it logged its start (decision 70).
|
|
49
|
+
const events = readLog(feature.dir);
|
|
50
|
+
const since = feature.approvals.approvals.design?.at_utc;
|
|
51
|
+
const building = events.some((e) => e.event === 'step' && e.stage === 'build' && (!since || e.at_utc >= since));
|
|
52
|
+
const lastStage = events.filter((e) => e.event === 'step').at(-1)?.stage;
|
|
53
|
+
if (!building && (progress.next || progress.due.length)) {
|
|
54
|
+
return `a human starts the build: /agjan-build${progress.next ? ` (first task ${progress.next.id}: ${progress.next.title})` : ''}`;
|
|
55
|
+
}
|
|
46
56
|
if (progress.due.length) return reviewNext(ctx, feature, progress.due[0].step);
|
|
47
57
|
if (progress.next) return `task ${progress.next.id}: ${progress.next.title} (commit as '<KEY>-${progress.next.id}: …')`;
|
|
48
58
|
const { state, record } = verifyState(ctx.root, ctx.config, feature);
|
|
49
59
|
if (state === 'blocked') return `the verify review ${record.id} is blocked: resolve its findings, then /agjan-verify again`;
|
|
50
60
|
if (state === 'stale') return `files changed after the verify review ${record.id}: /agjan-verify again`;
|
|
51
|
-
if (state === 'current') return `${ctx.style.green('
|
|
52
|
-
return 'all tasks done and reviewed: /agjan-verify';
|
|
61
|
+
if (state === 'current') return `${ctx.style.green('done')}: development finished and verified (${record.id}); the next steps below are optional`;
|
|
62
|
+
return lastStage === 'verify' ? 'verify is running: /agjan-verify' : 'all tasks done and reviewed: a human starts the verification: /agjan-verify';
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
/** "2 open, 1 blocker(s)", red when a blocker is open. */
|
|
@@ -135,17 +145,17 @@ function completion(ctx, feature, progress) {
|
|
|
135
145
|
report.errors ? bad(`check --ci: ${report.errors} error(s)`) : ok('check --ci clean')].join(' '),
|
|
136
146
|
[(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(' '),
|
|
137
147
|
];
|
|
138
|
-
if (manual.length) lines.push(`${s.violet('▸')} before merging, check by hand: ${manual.map((ac) => ac.id).join(', ')}`);
|
|
139
|
-
if (areaNames.includes('fiori')) lines.push(`${s.violet('▸')} before merging: open the app and try the changed screens`);
|
|
140
|
-
lines.push(`${s.violet('▸')} next: open the PR (description: npx agjan pr-summary), review it, merge it`);
|
|
141
148
|
ctx.out();
|
|
142
149
|
if (s.brand) {
|
|
143
150
|
const stars = `${s.teal('✦')} ${s.violet('✦')} ${s.teal('✦')}`;
|
|
144
|
-
for (const line of mark(s, ctx.kit, `${stars} ${s.bold(`${feature.key} is
|
|
151
|
+
for (const line of mark(s, ctx.kit, `${stars} ${s.bold(`${feature.key} is done`)} ${stars}`, `${feature.slug} · development finished and verified`)) ctx.out(line);
|
|
145
152
|
} else {
|
|
146
|
-
ctx.out(`✔ ${feature.key} is
|
|
153
|
+
ctx.out(`✔ ${feature.key} is done: development finished and verified (${feature.slug})`);
|
|
147
154
|
}
|
|
148
155
|
for (const line of lines) ctx.out(` ${line}`);
|
|
156
|
+
ctx.out(` ${s.bold('Optional next steps:')}`);
|
|
157
|
+
const steps = optionalSteps(ctx.root, feature, { manual: manual.map((ac) => ac.id) });
|
|
158
|
+
for (const step of steps) ctx.out(` ${s.violet('▸')} ${step}`);
|
|
149
159
|
}
|
|
150
160
|
|
|
151
161
|
function describe(ctx, feature, onBase = false) {
|
|
@@ -193,10 +203,26 @@ function describe(ctx, feature, onBase = false) {
|
|
|
193
203
|
}
|
|
194
204
|
}
|
|
195
205
|
|
|
196
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* agjan status --done [--feature <slug>]: only the completion block of a verified feature,
|
|
208
|
+
* for the agent's final message (exit 1 with the next step while it is not done).
|
|
209
|
+
*/
|
|
210
|
+
function done(ctx, slug) {
|
|
211
|
+
const feature = loadFeature(ctx.root, slug);
|
|
212
|
+
const progress = feature.kind === 'feature' && feature.stage === 'build' ? buildProgress(ctx.root, ctx.config, feature) : null;
|
|
213
|
+
if (progress?.complete && progress.due.length === 0 && verifyState(ctx.root, ctx.config, feature).state === 'current') {
|
|
214
|
+
completion(ctx, feature, progress);
|
|
215
|
+
return 0;
|
|
216
|
+
}
|
|
217
|
+
ctx.out(`${feature.key} is not done yet: ${progress ? nextInBuild(ctx, feature, progress).replace('<KEY>', feature.key) : `stage ${feature.stage}`}`);
|
|
218
|
+
return 1;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** agjan status [--feature <slug> | --all | --done] */
|
|
197
222
|
export function run(ctx, argv) {
|
|
198
|
-
const { values } = parseArgs({ args: argv, options: { feature: { type: 'string' }, all: { type: 'boolean' } } });
|
|
223
|
+
const { values } = parseArgs({ args: argv, options: { feature: { type: 'string' }, all: { type: 'boolean' }, done: { type: 'boolean' } } });
|
|
199
224
|
const root = ctx.root;
|
|
225
|
+
if (values.done) return done(ctx, selectFeature(root, ctx.config, values.feature));
|
|
200
226
|
let slugs;
|
|
201
227
|
if (values.feature) {
|
|
202
228
|
if (!listFeatures(root).includes(values.feature)) throw new UsageError(`no feature '${values.feature}'`);
|
|
@@ -205,10 +231,9 @@ export function run(ctx, argv) {
|
|
|
205
231
|
slugs = values.all ? listFeatures(root) : changedFeatures(root, ctx.config);
|
|
206
232
|
}
|
|
207
233
|
const c = ctx.config;
|
|
208
|
-
const branches =
|
|
209
|
-
const pattern = c.git?.branch?.pattern ? `, names matching ${c.git.branch.pattern}` : '';
|
|
234
|
+
const branches = 'branches: ask the user, then npx agjan branch';
|
|
210
235
|
for (const line of markLine(ctx.style, ctx.kit, 'status')) ctx.out(line);
|
|
211
|
-
ctx.out(ctx.style.gray(`settings: documents in '${c.language ?? 'en'}' (headings in English); reviews up to ${roundLimit(c)} rounds; ${fixAttempts(c)} attempts for failing checks; ${branches}
|
|
236
|
+
ctx.out(ctx.style.gray(`settings: documents in '${c.language ?? 'en'}' (headings in English); reviews up to ${roundLimit(c)} rounds; ${fixAttempts(c)} attempts for failing checks; ${branches}`));
|
|
212
237
|
if (slugs.length === 0) {
|
|
213
238
|
ctx.out(values.all ? `no features in ${FEATURES_DIR}` : 'no changed feature on this branch (agjan status --all lists every feature)');
|
|
214
239
|
return 0;
|
package/src/context.mjs
CHANGED
|
@@ -50,6 +50,12 @@ export function createContext({
|
|
|
50
50
|
email() {
|
|
51
51
|
return userEmail(this.root);
|
|
52
52
|
},
|
|
53
|
+
/** Whether stdout is a terminal (for the mark's blink). */
|
|
54
|
+
isTTY: Boolean(stdout?.isTTY),
|
|
55
|
+
/** Writes raw text to stdout, for terminal control sequences. */
|
|
56
|
+
write(text) {
|
|
57
|
+
stdout.write(text);
|
|
58
|
+
},
|
|
53
59
|
/** Writes each argument as one line; no argument writes an empty line. */
|
|
54
60
|
out(...lines) {
|
|
55
61
|
stdout.write(`${(lines.length ? lines : ['']).join('\n')}\n`);
|