agjan 0.0.7 → 0.0.9
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 +74 -27
- package/kit/domains/btp/domain.json +2 -1
- package/kit/hooks/guard.mjs +5 -4
- package/kit/skills/agjan-build/SKILL.md +2 -1
- package/kit/skills/agjan-design/SKILL.md +1 -1
- package/kit/skills/agjan-fix/SKILL.md +17 -4
- package/kit/skills/agjan-map/SKILL.md +18 -3
- package/kit/skills/agjan-spec/SKILL.md +17 -7
- package/kit/skills/agjan-verify/SKILL.md +3 -2
- package/kit/skills/fiori-developer/SKILL.md +11 -7
- package/kit/skills/fiori-developer/references/app-setup.md +2 -2
- package/kit/skills/fiori-developer/references/testing.md +2 -1
- package/kit/skills/fiori-developer/references/ui5-basics.md +2 -2
- package/kit/templates/agents-block.md +12 -2
- package/package.json +1 -1
- package/schemas/config.schema.json +16 -15
- package/schemas/log.schema.json +2 -1
- package/src/cli.mjs +10 -3
- package/src/commands/branch.mjs +34 -24
- package/src/commands/check.mjs +1 -17
- package/src/commands/lint.mjs +74 -0
- package/src/commands/log.mjs +9 -2
- package/src/commands/pr-summary.mjs +3 -0
- package/src/commands/report.mjs +6 -1
- package/src/commands/review.mjs +29 -2
- package/src/commands/setup.mjs +50 -69
- package/src/commands/status.mjs +5 -5
- package/src/config.mjs +5 -1
- package/src/context.mjs +6 -0
- package/src/git.mjs +10 -2
- package/src/log.mjs +2 -0
- package/src/plan.mjs +1 -1
- package/src/progress-view.mjs +12 -1
- package/src/review-policy.mjs +17 -3
- package/src/terminal.mjs +3 -1
- package/src/ui.mjs +22 -0
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 };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
import { changedFiles, git, resolveBase } from '../git.mjs';
|
|
6
|
+
import { matcher } from '../scope.mjs';
|
|
7
|
+
import { UsageError } from '../errors.mjs';
|
|
8
|
+
import { overrideBase } from './check.mjs';
|
|
9
|
+
|
|
10
|
+
/** Quotes a path for the shell (sh and cmd both accept double quotes). */
|
|
11
|
+
const quote = (path) => (/^[\w./@-]+$/.test(path) ? path : `"${path.replace(/"/g, '\\"')}"`);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The folders an area's linter runs in, with the files to lint in each (paths relative to
|
|
15
|
+
* the folder). `lint.in` names the folders (for example `app/*`), `lint.files` the files
|
|
16
|
+
* inside them (for example `webapp/**`).
|
|
17
|
+
*/
|
|
18
|
+
export function lintTargets(files, lint) {
|
|
19
|
+
const depth = lint.in.split('/').length;
|
|
20
|
+
const isTarget = matcher([`${lint.in}/${lint.files}`]);
|
|
21
|
+
const folders = new Map();
|
|
22
|
+
for (const file of files.filter((f) => isTarget(f))) {
|
|
23
|
+
const parts = file.split('/');
|
|
24
|
+
const folder = parts.slice(0, depth).join('/');
|
|
25
|
+
if (!folders.has(folder)) folders.set(folder, []);
|
|
26
|
+
folders.get(folder).push(parts.slice(depth).join('/'));
|
|
27
|
+
}
|
|
28
|
+
return folders;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* agjan lint [--all] [--base <ref>]: runs each area's linter from the command line
|
|
33
|
+
* (`lint` in the domain or agjan.config.json; the fiori area runs the UI5 linter, which
|
|
34
|
+
* also checks manifest.json), in every folder with changed files and on those files.
|
|
35
|
+
* --all lints the whole folders. It needs no MCP server, so it runs on every host.
|
|
36
|
+
* Exit code 1 when a linter reports problems or cannot run.
|
|
37
|
+
*/
|
|
38
|
+
export function run(ctx, argv) {
|
|
39
|
+
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { all: { type: 'boolean' }, base: { type: 'string' } } });
|
|
40
|
+
if (positionals.length) throw new UsageError('usage: agjan lint [--all] [--base <ref>]');
|
|
41
|
+
overrideBase(ctx, values.base);
|
|
42
|
+
const s = ctx.style;
|
|
43
|
+
const linters = Object.entries(ctx.config.lint ?? {}).filter(([, l]) => l?.command && l.in && l.files);
|
|
44
|
+
if (!linters.length) {
|
|
45
|
+
ctx.out(s.gray('no linter configured (lint in agjan.config.json)'));
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
const root = ctx.root;
|
|
49
|
+
const files = values.all
|
|
50
|
+
? (git(root, ['ls-files', '--cached', '--others', '--exclude-standard']) ?? '').split('\n').filter(Boolean)
|
|
51
|
+
: changedFiles(root, resolveBase(root, ctx.config.git?.base));
|
|
52
|
+
const present = files.filter((f) => existsSync(join(root, f)));
|
|
53
|
+
let failed = 0;
|
|
54
|
+
let ran = 0;
|
|
55
|
+
for (const [area, lint] of linters) {
|
|
56
|
+
for (const [folder, inside] of lintTargets(present, lint)) {
|
|
57
|
+
ran += 1;
|
|
58
|
+
const command = values.all ? lint.command : `${lint.command} ${inside.map(quote).join(' ')}`;
|
|
59
|
+
ctx.out(`${s.bold(`lint ${area}`)} ${folder}: ${s.gray(values.all ? lint.command : `${lint.command} (${inside.length} file(s))`)}`);
|
|
60
|
+
const result = spawnSync(command, { cwd: join(root, folder), shell: true, encoding: 'utf8', timeout: 600_000, maxBuffer: 64 * 1024 * 1024 });
|
|
61
|
+
const output = `${result.stdout ?? ''}${result.stderr ?? ''}`.trim();
|
|
62
|
+
if (output) ctx.out(output);
|
|
63
|
+
if (result.status === 0) {
|
|
64
|
+
ctx.out(` ${s.green('ok')}`);
|
|
65
|
+
} else {
|
|
66
|
+
failed += 1;
|
|
67
|
+
const why = result.error ? `could not run: ${result.error.message}` : result.status === null ? 'could not run (stopped)' : `problems found (exit code ${result.status})`;
|
|
68
|
+
ctx.out(` ${s.red(why)}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!ran) ctx.out(s.gray(values.all ? 'no files to lint' : 'no changed files to lint (--all lints everything)'));
|
|
73
|
+
return failed ? 1 : 0;
|
|
74
|
+
}
|
package/src/commands/log.mjs
CHANGED
|
@@ -10,8 +10,10 @@ const GATES = ['spec', 'design', 'spec design'];
|
|
|
10
10
|
/**
|
|
11
11
|
* agjan log --stage <stage> [--role r] [--task T1] [--skill s] [--host h] [--model m]
|
|
12
12
|
* agjan log --gate-requested <gate> [--message "<commit message>"]
|
|
13
|
+
* agjan log --waiting "<what the agent needs from the user>"
|
|
13
14
|
* Called once at the start of each step (design 12.1); the end of a step is inferred
|
|
14
15
|
* from the next event. `--message` proposes the commit message `approve` offers the human.
|
|
16
|
+
* `--waiting`: the agent stopped and waits for the user; its next step event ends the wait.
|
|
15
17
|
*/
|
|
16
18
|
export function run(ctx, argv) {
|
|
17
19
|
const { values } = parseArgs({
|
|
@@ -26,15 +28,20 @@ export function run(ctx, argv) {
|
|
|
26
28
|
model: { type: 'string' },
|
|
27
29
|
'gate-requested': { type: 'string' },
|
|
28
30
|
message: { type: 'string' },
|
|
31
|
+
waiting: { type: 'string' },
|
|
29
32
|
},
|
|
30
33
|
});
|
|
31
34
|
const gate = values['gate-requested'];
|
|
32
|
-
|
|
35
|
+
const usage = 'usage: agjan log --stage <stage> [--role r] [--task T1] [--skill s] | --gate-requested <gate> [--message "<text>"] | --waiting "<reason>"';
|
|
36
|
+
if ([gate, values.stage, values.waiting].filter((v) => v !== undefined).length !== 1) throw new UsageError(usage);
|
|
37
|
+
if (values.waiting !== undefined && !values.waiting.trim()) throw new UsageError('--waiting needs a reason: what the user has to do or decide');
|
|
33
38
|
if (gate && !GATES.includes(gate)) throw new UsageError(`--gate-requested must be one of: ${GATES.join(', ')}`);
|
|
34
39
|
if (values.stage && !STAGES.includes(values.stage)) throw new UsageError(`--stage must be one of: ${STAGES.join(', ')}`);
|
|
35
40
|
const feature = loadFeature(ctx.root, selectFeature(ctx.root, ctx.config, values.feature));
|
|
36
41
|
|
|
37
|
-
if (
|
|
42
|
+
if (values.waiting !== undefined) {
|
|
43
|
+
appendLog(feature.dir, ctx.now(), 'waiting', { reason: values.waiting.trim().replace(/\s+/g, ' ') });
|
|
44
|
+
} else if (gate) {
|
|
38
45
|
// A gate is handed to the human only when approving it can succeed.
|
|
39
46
|
const { problems } = gateReadiness(ctx, feature, gate);
|
|
40
47
|
if (problems.length) {
|
|
@@ -6,6 +6,7 @@ import { acResults, loadResults, resultLabel } from '../test-results.mjs';
|
|
|
6
6
|
import { overrideBase, runChecks } from './check.mjs';
|
|
7
7
|
import { readFix } from './fix.mjs';
|
|
8
8
|
import { highlightMarkdown } from '../ui.mjs';
|
|
9
|
+
import { readLog } from '../log.mjs';
|
|
9
10
|
|
|
10
11
|
function short(hash) {
|
|
11
12
|
return hash ? hash.slice('sha256:'.length, 'sha256:'.length + 12) : '-';
|
|
@@ -77,6 +78,8 @@ function featureSection(ctx, feature) {
|
|
|
77
78
|
out.push('');
|
|
78
79
|
const weak = feature.reviews.records.filter((r) => r.reviewer?.isolation !== 'agent');
|
|
79
80
|
if (weak.length) out.push(`Reviews without an isolated reviewer agent: ${weak.map((r) => r.id).join(', ')}.`, '');
|
|
81
|
+
const granted = readLog(feature.dir).filter((e) => e.event === 'round-granted');
|
|
82
|
+
if (granted.length) out.push(`Rounds beyond the limit, allowed by the user: ${granted.map((e) => `${e.step} round ${e.round}`).join(', ')}.`, '');
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
const open = feature.findings.filter((f) => f.status === 'open');
|
package/src/commands/report.mjs
CHANGED
|
@@ -38,7 +38,7 @@ export function spans(events, end) {
|
|
|
38
38
|
events.forEach((event, i) => {
|
|
39
39
|
const at = times[i];
|
|
40
40
|
if (event.event === 'step') {
|
|
41
|
-
const next = events.findIndex((e, j) => j > i &&
|
|
41
|
+
const next = events.findIndex((e, j) => j > i && ['step', 'gate-requested', 'waiting'].includes(e.event));
|
|
42
42
|
const label = [event.stage, event.task, event.role].filter(Boolean).join(' ');
|
|
43
43
|
out.push({ kind: 'step', label, from: at, to: next === -1 ? end : times[next] });
|
|
44
44
|
}
|
|
@@ -46,6 +46,11 @@ export function spans(events, end) {
|
|
|
46
46
|
const done = events.findIndex((e, j) => j > i && (e.event === 'approved' || e.event === 'rejected'));
|
|
47
47
|
out.push({ kind: 'gate', label: `gate ${event.gate}`, from: at, to: done === -1 ? end : times[done], open: done === -1 });
|
|
48
48
|
}
|
|
49
|
+
// The agent stopped for the user: waiting until its next step.
|
|
50
|
+
if (event.event === 'waiting') {
|
|
51
|
+
const next = events.findIndex((e, j) => j > i && e.event === 'step');
|
|
52
|
+
out.push({ kind: 'gate', label: 'waiting for you', from: at, to: next === -1 ? end : times[next], open: next === -1 });
|
|
53
|
+
}
|
|
49
54
|
});
|
|
50
55
|
return out;
|
|
51
56
|
}
|
package/src/commands/review.mjs
CHANGED
|
@@ -2,8 +2,10 @@ import { parseArgs } from 'node:util';
|
|
|
2
2
|
import { serve } from '../mcp.mjs';
|
|
3
3
|
import { buildContextText, parseStep } from '../review.mjs';
|
|
4
4
|
import { loadFeature, selectFeature } from '../feature.mjs';
|
|
5
|
+
import { appendLog } from '../log.mjs';
|
|
6
|
+
import { roundState } from '../review-policy.mjs';
|
|
5
7
|
import { tone } from '../ui.mjs';
|
|
6
|
-
import { UsageError } from '../errors.mjs';
|
|
8
|
+
import { AgjanError, UsageError } from '../errors.mjs';
|
|
7
9
|
|
|
8
10
|
/** agjan mcp [--host <name>] [--isolation agent|fork|none]: the agjan MCP server on stdio. */
|
|
9
11
|
export function mcp(ctx, argv) {
|
|
@@ -17,6 +19,31 @@ export function mcp(ctx, argv) {
|
|
|
17
19
|
return serve(ctx, { host: values.host ?? 'unknown', isolation });
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
/** agjan review show | extend: dispatches to the subcommand. */
|
|
23
|
+
export function run(ctx, argv) {
|
|
24
|
+
return argv[0] === 'extend' ? extend(ctx, argv.slice(1)) : show(ctx, argv);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* agjan review extend <step> [--feature <slug>]: one more correction round for a step
|
|
29
|
+
* that is still blocked at its round limit (design 7.4). The agent runs it only after
|
|
30
|
+
* the user said yes to another round; status, the report and the PR summary show it.
|
|
31
|
+
*/
|
|
32
|
+
export function extend(ctx, argv) {
|
|
33
|
+
const { values, positionals } = parseArgs({ args: argv, options: { feature: { type: 'string' } }, allowPositionals: true });
|
|
34
|
+
if (positionals.length !== 1) throw new UsageError('usage: agjan review extend <step> [--feature <slug>]');
|
|
35
|
+
const step = positionals[0];
|
|
36
|
+
const feature = loadFeature(ctx.root, selectFeature(ctx.root, ctx.config, values.feature));
|
|
37
|
+
const state = roundState(feature, ctx.config, step);
|
|
38
|
+
if (!state.exhausted) {
|
|
39
|
+
const why = state.last ? `round ${state.round} of ${state.limit}, ${state.last.verdict}` : 'no review yet';
|
|
40
|
+
throw new AgjanError(`the ${step} review has not used up its rounds (${why}); another round needs no extension`);
|
|
41
|
+
}
|
|
42
|
+
appendLog(feature.dir, ctx.now(), 'round-granted', { step, round: state.limit + 1 });
|
|
43
|
+
ctx.out(`${ctx.style.green('granted')} round ${state.limit + 1} for ${ctx.style.bold(step)}: fix the blockers, then ask for the review again`);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
20
47
|
/**
|
|
21
48
|
* agjan review show [--step <step>] [--feature <slug>]: read-only. Without --step it lists
|
|
22
49
|
* the review records; with --step it prints the context a reviewer would get.
|
|
@@ -28,7 +55,7 @@ export function show(ctx, argv) {
|
|
|
28
55
|
options: { step: { type: 'string' }, feature: { type: 'string' } },
|
|
29
56
|
allowPositionals: true,
|
|
30
57
|
});
|
|
31
|
-
if (positionals[0] !== 'show' || positionals.length !== 1) throw new UsageError('usage: agjan review show [--step <step>] [--feature <slug>]');
|
|
58
|
+
if (positionals[0] !== 'show' || positionals.length !== 1) throw new UsageError('usage: agjan review show [--step <step>] [--feature <slug>] | agjan review extend <step>');
|
|
32
59
|
const feature = loadFeature(ctx.root, selectFeature(ctx.root, ctx.config, values.feature));
|
|
33
60
|
if (values.step) {
|
|
34
61
|
ctx.out(buildContextText(ctx.root, ctx.config, feature, parseStep(values.step, feature, ctx.config)));
|
package/src/commands/setup.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
4
|
+
import { isAbsolute, join, relative, resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { parseArgs } from 'node:util';
|
|
7
7
|
import { CONFIG_FILE, MODEL_TIERS, RECOMMENDED_ALLOW, SESSION_MODEL, agentModel, loadConfig, loadDomain } from '../config.mjs';
|
|
@@ -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
|
}
|
|
@@ -69,7 +58,6 @@ function missingModels(raw, hosts, { existing }) {
|
|
|
69
58
|
*/
|
|
70
59
|
function missingSettings(raw) {
|
|
71
60
|
const out = [];
|
|
72
|
-
if (raw.git?.branch?.create === undefined) out.push('git.branch.create');
|
|
73
61
|
if (raw.agent?.allow === undefined || raw.agent?.allow_edits === undefined) out.push('agent');
|
|
74
62
|
return out;
|
|
75
63
|
}
|
|
@@ -84,7 +72,6 @@ function doSync(ctx, { force }) {
|
|
|
84
72
|
const visible = missingSettings(raw);
|
|
85
73
|
if (Object.keys(added).length || visible.length) {
|
|
86
74
|
const next = { ...raw, models: { ...(raw.models ?? {}), ...added } };
|
|
87
|
-
if (visible.includes('git.branch.create')) next.git = { ...(raw.git ?? {}), branch: { ...(raw.git?.branch ?? {}), create: 'agent' } };
|
|
88
75
|
if (visible.includes('agent')) next.agent = { allow: raw.agent?.allow ?? [], allow_edits: raw.agent?.allow_edits ?? false, ...(raw.agent ?? {}) };
|
|
89
76
|
writeJson(file, next);
|
|
90
77
|
config.models = { ...(config.models ?? {}), ...added };
|
|
@@ -93,7 +80,6 @@ function doSync(ctx, { force }) {
|
|
|
93
80
|
for (const [host, tiers] of Object.entries(added)) {
|
|
94
81
|
results.push({ path: CONFIG_FILE, action: `models.${host}: ${MODEL_TIERS.map((t) => `${t}=${tiers[t]}`).join(', ')}` });
|
|
95
82
|
}
|
|
96
|
-
if (visible.includes('git.branch.create')) results.push({ path: CONFIG_FILE, action: 'git.branch.create: agent' });
|
|
97
83
|
if (visible.includes('agent')) results.push({ path: CONFIG_FILE, action: 'agent: allow, allow_edits' });
|
|
98
84
|
const current = readJson(file) ?? {};
|
|
99
85
|
if (current.kit !== ctx.kit) {
|
|
@@ -108,30 +94,6 @@ function ask(ctx, question, options) {
|
|
|
108
94
|
return ctx.ask(question, options);
|
|
109
95
|
}
|
|
110
96
|
|
|
111
|
-
/** Asks for one line with a prefilled answer; '' without a terminal. */
|
|
112
|
-
async function askLine(ctx, prompt, initial = '') {
|
|
113
|
-
try {
|
|
114
|
-
return String((await ctx.edit(prompt, initial)) ?? '').trim();
|
|
115
|
-
} catch {
|
|
116
|
-
return '';
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** The branch pattern: asked until it is a valid regular expression (or left empty). */
|
|
121
|
-
async function askPattern(ctx) {
|
|
122
|
-
for (let i = 0; i < 3; i++) {
|
|
123
|
-
const answer = await askLine(ctx, 'Branch name pattern (regular expression, Enter for none): ');
|
|
124
|
-
if (!answer) return null;
|
|
125
|
-
try {
|
|
126
|
-
new RegExp(answer);
|
|
127
|
-
return answer;
|
|
128
|
-
} catch (error) {
|
|
129
|
-
ctx.out(ctx.style.yellow(`not a valid regular expression: ${error.message}`));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
97
|
/** The next steps after init, for the configured hosts (design decision 69). */
|
|
136
98
|
function nextSteps(ctx, hosts, firstCommit) {
|
|
137
99
|
const s = ctx.style;
|
|
@@ -144,10 +106,8 @@ function nextSteps(ctx, hosts, firstCommit) {
|
|
|
144
106
|
steps.push("Open this folder once in Claude Code and trust it: the reviewer's agjan tools load only in trusted folders.");
|
|
145
107
|
}
|
|
146
108
|
if (hosts.includes('copilot')) {
|
|
147
|
-
steps.push(`Start ${s.cyan('copilot')} in this folder and trust
|
|
109
|
+
steps.push(`Start ${s.cyan('copilot')} in this folder and answer "Do you trust the files in this folder?" with "Yes, and remember this folder for future sessions": with plain "Yes", Copilot does not load the MCP servers in .mcp.json. 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')}.`);
|
|
148
110
|
}
|
|
149
|
-
steps.push('Protect the base branch: require the "agjan-check" status check and a review.');
|
|
150
|
-
steps.push(['Add this to .github/CODEOWNERS (replace @<owner>):', ...CODEOWNERS.split('\n')].join('\n '));
|
|
151
111
|
steps.push(`Run: ${s.cyan('npx agjan doctor')}`);
|
|
152
112
|
return ['', s.bold('Next steps:'), ...steps.map((text, i) => ` ${i + 1}. ${text}`)];
|
|
153
113
|
}
|
|
@@ -155,7 +115,6 @@ function nextSteps(ctx, hosts, firstCommit) {
|
|
|
155
115
|
/**
|
|
156
116
|
* agjan init [--domains btp] [--hosts claude-code] [--language en] [--base <ref>] [--no-hook] [--no-ci]
|
|
157
117
|
* [--prepare] [--agent-allow | --no-agent-allow] [--agent-allow-edits | --no-agent-allow-edits]
|
|
158
|
-
* [--branch-create agent|confirm] [--branch-pattern <regex>]
|
|
159
118
|
*/
|
|
160
119
|
export async function init(ctx, argv) {
|
|
161
120
|
const { values } = parseArgs({
|
|
@@ -172,8 +131,6 @@ export async function init(ctx, argv) {
|
|
|
172
131
|
'no-agent-allow': { type: 'boolean' },
|
|
173
132
|
'agent-allow-edits': { type: 'boolean' },
|
|
174
133
|
'no-agent-allow-edits': { type: 'boolean' },
|
|
175
|
-
'branch-create': { type: 'string' },
|
|
176
|
-
'branch-pattern': { type: 'string' },
|
|
177
134
|
},
|
|
178
135
|
});
|
|
179
136
|
const root = ctx.root;
|
|
@@ -182,32 +139,21 @@ export async function init(ctx, argv) {
|
|
|
182
139
|
for (const d of domains) loadDomain(d);
|
|
183
140
|
const hosts = list(values.hosts) ?? ['claude-code'];
|
|
184
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(', ')})`);
|
|
185
|
-
if (values['branch-create'] && !['agent', 'confirm'].includes(values['branch-create'])) throw new UsageError('--branch-create must be agent or confirm');
|
|
186
|
-
if (values['branch-pattern']) {
|
|
187
|
-
try {
|
|
188
|
-
new RegExp(values['branch-pattern']);
|
|
189
|
-
} catch (error) {
|
|
190
|
-
throw new UsageError(`--branch-pattern is not a valid regular expression: ${error.message}`);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
142
|
|
|
194
143
|
// The mark first, then the questions (design decision 69).
|
|
195
144
|
const s = ctx.style;
|
|
196
|
-
|
|
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);
|
|
197
148
|
|
|
198
|
-
// Opt-in decisions, asked once
|
|
199
|
-
//
|
|
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.
|
|
200
152
|
const flag = (yes, no) => (values[yes] ? true : values[no] ? false : null);
|
|
201
153
|
const agentAllow = flag('agent-allow', 'no-agent-allow') ??
|
|
202
|
-
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.)
|
|
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;
|
|
203
155
|
const allowEdits = flag('agent-allow-edits', 'no-agent-allow-edits') ??
|
|
204
|
-
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.)') ?? false;
|
|
205
|
-
let branchCreate = values['branch-create'] ?? null;
|
|
206
|
-
if (!branchCreate) {
|
|
207
|
-
const own = ask(ctx, 'Should agents create branches themselves? (no: they propose a name, you create it with npx agjan branch)', { defaultYes: true });
|
|
208
|
-
branchCreate = own === false ? 'confirm' : 'agent';
|
|
209
|
-
}
|
|
210
|
-
const branchPattern = values['branch-pattern'] ?? (values['branch-create'] ? null : await askPattern(ctx));
|
|
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;
|
|
211
157
|
|
|
212
158
|
const config = {
|
|
213
159
|
$schema: './node_modules/agjan/schemas/config.schema.json',
|
|
@@ -216,7 +162,7 @@ export async function init(ctx, argv) {
|
|
|
216
162
|
hosts,
|
|
217
163
|
language: values.language ?? 'en',
|
|
218
164
|
models: missingModels({}, hosts, { existing: false }),
|
|
219
|
-
git: { ...(values.base ? { base: values.base } : {})
|
|
165
|
+
git: { ...(values.base ? { base: values.base } : {}) },
|
|
220
166
|
agent: { allow: agentAllow ? RECOMMENDED_ALLOW : [], allow_edits: allowEdits },
|
|
221
167
|
};
|
|
222
168
|
writeJson(join(root, CONFIG_FILE), config);
|
|
@@ -226,7 +172,6 @@ export async function init(ctx, argv) {
|
|
|
226
172
|
const setting = (on, text) => ` ${pad(on ? tone(s, 'created') : s.gray('none'), on ? 'created' : 'none', 14)} ${text}`;
|
|
227
173
|
ctx.out(setting(agentAllow, `agent.allow${agentAllow ? ` (${RECOMMENDED_ALLOW.length} commands)` : ''}`));
|
|
228
174
|
ctx.out(setting(allowEdits, `agent.allow_edits${allowEdits ? ' (file changes without a prompt)' : ''}`));
|
|
229
|
-
ctx.out(` ${pad(tone(s, 'created'), 'created', 14)} git.branch: ${branchCreate === 'confirm' ? 'you create branches' : 'agents create branches'}${branchPattern ? `, pattern ${branchPattern}` : ''}`);
|
|
230
175
|
|
|
231
176
|
if (!values['no-hook']) {
|
|
232
177
|
const hook = installHook(root);
|
|
@@ -314,6 +259,39 @@ function claudeTrust(root) {
|
|
|
314
259
|
return data.projects[root]?.hasTrustDialogAccepted === true ? 'trusted' : 'not trusted';
|
|
315
260
|
}
|
|
316
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Whether Copilot CLI trusts the project folder: the folder or a parent is in
|
|
264
|
+
* `trustedFolders` of its config.json or settings.json (in COPILOT_HOME, default
|
|
265
|
+
* ~/.copilot; read-only). Only a remembered folder loads the workspace's .mcp.json.
|
|
266
|
+
*/
|
|
267
|
+
export function copilotTrust(root, dir = process.env.COPILOT_HOME || join(homedir(), '.copilot')) {
|
|
268
|
+
const files = ['config.json', 'settings.json'].map((f) => join(dir, f)).filter((f) => existsSync(f));
|
|
269
|
+
if (!files.length) return 'unknown';
|
|
270
|
+
const folders = files.flatMap((f) => {
|
|
271
|
+
try {
|
|
272
|
+
// Copilot writes comment lines at the top of its config file.
|
|
273
|
+
const list = JSON.parse(readFileSync(f, 'utf8').replace(/^\s*\/\/.*$/gm, '')).trustedFolders;
|
|
274
|
+
return Array.isArray(list) ? list.filter((x) => typeof x === 'string') : [];
|
|
275
|
+
} catch {
|
|
276
|
+
return [];
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
const fold = process.platform === 'darwin' || process.platform === 'win32' ? (p) => p.toLowerCase() : (p) => p;
|
|
280
|
+
const real = (p) => {
|
|
281
|
+
try {
|
|
282
|
+
return fold(realpathSync(p));
|
|
283
|
+
} catch {
|
|
284
|
+
return fold(resolve(p));
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
const here = real(root);
|
|
288
|
+
const inside = (folder) => {
|
|
289
|
+
const rel = relative(real(folder), here);
|
|
290
|
+
return rel === '' || (!rel.startsWith('..') && !isAbsolute(rel));
|
|
291
|
+
};
|
|
292
|
+
return folders.some(inside) ? 'trusted' : 'not trusted';
|
|
293
|
+
}
|
|
294
|
+
|
|
317
295
|
/** agjan doctor: checks the environment and the project setup; exit 1 on any failure. */
|
|
318
296
|
export function doctor(ctx) {
|
|
319
297
|
for (const line of mark(ctx.style, ctx.kit, 'doctor: environment and project setup')) ctx.out(line);
|
|
@@ -378,6 +356,9 @@ export function doctor(ctx) {
|
|
|
378
356
|
const guard = probeGuard(root);
|
|
379
357
|
if (guard) warn('copilot guard', guard);
|
|
380
358
|
else ok('copilot guard', 'denies agjan approve in a test payload');
|
|
359
|
+
const trust = copilotTrust(root);
|
|
360
|
+
if (trust === 'trusted') ok('copilot trust', 'project folder remembered as trusted');
|
|
361
|
+
else warn('copilot trust', `${trust}; start copilot here and answer the trust question with "Yes, and remember this folder for future sessions", or Copilot does not load the MCP servers in .mcp.json`);
|
|
381
362
|
}
|
|
382
363
|
if (config.hosts.includes('claude-code')) {
|
|
383
364
|
const trust = claudeTrust(root);
|
|
@@ -388,7 +369,7 @@ export function doctor(ctx) {
|
|
|
388
369
|
ok('agent allow list', allow.length ? `${allow.length} command(s) without a prompt: ${allow.join(', ')}` : 'none (the hosts ask for every command)');
|
|
389
370
|
ok('reviewer models', config.hosts.map((h) => `${h}: ${MODEL_TIERS.map((t) => `${t} ${agentModel(config, h, t) ?? 'session model'}`).join(', ')}`).join('; '));
|
|
390
371
|
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)');
|
|
391
|
-
ok('branches',
|
|
372
|
+
ok('branches', 'agents ask you, then run npx agjan branch');
|
|
392
373
|
ok('script edits', config.agent?.script_edits === 'allow' ? 'allowed (agent.script_edits)' : 'denied by the guard: agents edit files with their edit tool');
|
|
393
374
|
const tracked = (git(root, ['ls-files', '--', 'node_modules'], { allowFail: true }) ?? '').trim();
|
|
394
375
|
if (tracked) warn('node_modules', 'is committed; remove it: git rm -r -q --cached node_modules && git commit -m "chore: stop tracking node_modules"');
|
package/src/commands/status.mjs
CHANGED
|
@@ -31,7 +31,7 @@ function heading(ctx, unit, detail) {
|
|
|
31
31
|
function reviewNext(ctx, feature, step) {
|
|
32
32
|
const state = roundState(feature, ctx.config, step);
|
|
33
33
|
if (state.exhausted) {
|
|
34
|
-
return `the ${step} review is still blocked after ${state.round} of ${state.limit} rounds:
|
|
34
|
+
return `the ${step} review is still blocked after ${state.round} of ${state.limit} rounds: ask the user whether to run another round (yes: npx agjan review extend ${step}) or to stop and take over (fix with them, accept findings, or change the documents)`;
|
|
35
35
|
}
|
|
36
36
|
const round = state.round ? `, round ${state.next} of ${state.limit}` : '';
|
|
37
37
|
return `review step ${step} with ${reviewerFor(ctx.config, step)}${round}`;
|
|
@@ -169,7 +169,8 @@ function describe(ctx, feature, onBase = false) {
|
|
|
169
169
|
for (const step of steps) {
|
|
170
170
|
const records = feature.reviews.records.filter((r) => r.step === step);
|
|
171
171
|
const last = records[records.length - 1];
|
|
172
|
-
|
|
172
|
+
const { limit, extra } = roundState(feature, ctx.config, step);
|
|
173
|
+
row(ctx, 'review', `${step}: ${tone(ctx.style, last.verdict)} (round ${last.round} of ${limit}${extra ? `, ${extra} granted by the user` : ''}, ${last.id})`);
|
|
173
174
|
}
|
|
174
175
|
const open = feature.findings.filter((f) => f.status === 'open');
|
|
175
176
|
if (open.length) {
|
|
@@ -231,10 +232,9 @@ export function run(ctx, argv) {
|
|
|
231
232
|
slugs = values.all ? listFeatures(root) : changedFeatures(root, ctx.config);
|
|
232
233
|
}
|
|
233
234
|
const c = ctx.config;
|
|
234
|
-
const branches =
|
|
235
|
-
const pattern = c.git?.branch?.pattern ? `, names matching ${c.git.branch.pattern}` : '';
|
|
235
|
+
const branches = 'branches: ask the user, then npx agjan branch';
|
|
236
236
|
for (const line of markLine(ctx.style, ctx.kit, 'status')) ctx.out(line);
|
|
237
|
-
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}
|
|
237
|
+
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}`));
|
|
238
238
|
if (slugs.length === 0) {
|
|
239
239
|
ctx.out(values.all ? `no features in ${FEATURES_DIR}` : 'no changed feature on this branch (agjan status --all lists every feature)');
|
|
240
240
|
return 0;
|
package/src/config.mjs
CHANGED
|
@@ -31,7 +31,7 @@ const DEFAULTS = {
|
|
|
31
31
|
domains: ['btp'],
|
|
32
32
|
hosts: ['claude-code'],
|
|
33
33
|
language: 'en',
|
|
34
|
-
git: { base: null
|
|
34
|
+
git: { base: null },
|
|
35
35
|
scope: { implicit: {} },
|
|
36
36
|
risk_paths: [],
|
|
37
37
|
tests: {},
|
|
@@ -42,6 +42,7 @@ const DEFAULTS = {
|
|
|
42
42
|
ignored: ['package-lock.json', '**/package-lock.json', 'gen/**', 'dist/**'],
|
|
43
43
|
},
|
|
44
44
|
verify: {},
|
|
45
|
+
lint: {},
|
|
45
46
|
build: { fix_attempts: 3 },
|
|
46
47
|
review: { build: 'area', rounds: 3 },
|
|
47
48
|
ci: { policy_changes: 'warn', untracked_changes: 'fail' },
|
|
@@ -84,6 +85,7 @@ export function loadConfig(root) {
|
|
|
84
85
|
const implicit = {};
|
|
85
86
|
const tests = {};
|
|
86
87
|
const verify = {};
|
|
88
|
+
const lint = {};
|
|
87
89
|
for (const [name, area] of Object.entries(domain.areas)) {
|
|
88
90
|
const canonical = `${id}:${name}`;
|
|
89
91
|
areas[canonical] = { id: canonical, domain: id, name, role: area.role };
|
|
@@ -91,11 +93,13 @@ export function loadConfig(root) {
|
|
|
91
93
|
implicit[name] = area.implicit ?? [];
|
|
92
94
|
tests[name] = area.tests ?? [];
|
|
93
95
|
verify[name] = area.verify ?? {};
|
|
96
|
+
if (area.lint) lint[name] = area.lint;
|
|
94
97
|
}
|
|
95
98
|
config = merge(config, {
|
|
96
99
|
scope: { implicit },
|
|
97
100
|
tests,
|
|
98
101
|
verify,
|
|
102
|
+
lint,
|
|
99
103
|
risk_paths: [...config.risk_paths, ...(domain.risk_paths ?? [])],
|
|
100
104
|
fix: { protected: [...config.fix.protected, ...(domain.protected ?? [])] },
|
|
101
105
|
watched: [...(config.watched ?? []), ...(domain.watched ?? [])],
|
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`);
|