agjan 0.0.15 → 0.0.16

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 CHANGED
@@ -55,7 +55,7 @@ Linux, macOS or Windows.
55
55
  npm install --global agjan
56
56
  agjan init my-project --hosts claude-code,copilot # or "agjan init ." in an existing folder
57
57
  cd my-project
58
- agjan doctor
58
+ npx agjan doctor
59
59
  ```
60
60
 
61
61
  `agjan init my-project` creates the folder, the git repository (branch `main`) and a
package/dist/cli.js CHANGED
@@ -115,6 +115,8 @@ Human only, in a terminal:
115
115
  approve spec | design | spec design | verify | amendment <id>
116
116
  accept <finding-id> --reason "<why>"
117
117
  reject spec|design --reason "<why>"
118
+ auto status [--feature <s>] show the real auto mode settings: your default for new
119
+ features and every existing feature
118
120
  auto on|off [--default] auto mode for one feature (--default: every new feature in this
119
121
  checkout): spec and design are approved automatically once
120
122
  their reviews pass (approve verify stays yours)
@@ -3,10 +3,10 @@ import { join, relative } from 'node:path';
3
3
  import { parseArgs } from 'node:util';
4
4
  import { writeJson } from '../json-file.js';
5
5
  import { appendLog, readLog } from '../log.js';
6
- import { APPROVALS_FILE, FEATURES_DIR, gateReview, loadFeature, selectFeature } from '../feature.js';
6
+ import { APPROVALS_FILE, FEATURES_DIR, changedFeatures, gateReview, listFeatures, loadFeature, selectFeature } from '../feature.js';
7
7
  import { documentProblems, designProblems } from '../validate.js';
8
8
  import { AgjanError, UsageError } from '../errors.js';
9
- import { blink, mark, tone } from '../ui.js';
9
+ import { blink, mark, markLine, pad, tone } from '../ui.js';
10
10
  import { git } from '../git.js';
11
11
  import { acceptanceState, verifyState } from '../progress.js';
12
12
  import { NOT_ACCEPTED, runChecks } from './check.js';
@@ -315,6 +315,39 @@ export function approve(ctx, argv) {
315
315
  return approveAmendment(ctx, feature, positionals[1], values);
316
316
  throw new UsageError('usage: agjan approve spec | design | spec design | verify | amendment <id> [--feature <slug>] [--no-commit]');
317
317
  }
318
+ /**
319
+ * agjan auto status [--feature <slug>]: the real settings, read-only: your default for new
320
+ * features, and the auto mode of every existing feature (or the named one).
321
+ */
322
+ function autoStatus(ctx, values) {
323
+ for (const line of markLine(ctx.style, ctx.kit, 'auto mode'))
324
+ ctx.out(line);
325
+ printAutoSettings(ctx, values.feature);
326
+ return 0;
327
+ }
328
+ /** The real settings: your default for new features, then the mode of every feature (or one). */
329
+ function printAutoSettings(ctx, only) {
330
+ const s = ctx.style;
331
+ const root = ctx.root;
332
+ const features = listFeatures(root).map((slug) => loadFeature(root, slug)).filter((f) => f.kind === 'feature');
333
+ const shown = only ? features.filter((f) => f.slug === only) : features;
334
+ if (only && shown.length === 0)
335
+ throw new UsageError(`no feature '${only}'`);
336
+ const here = new Set(changedFeatures(root, ctx.config));
337
+ const state = (on) => (on ? s.yellow('on') : s.gray('off'));
338
+ const standing = readAutoDefault(root);
339
+ ctx.out('', s.bold('Default for new features'), ` ${pad(state(Boolean(standing)), standing ? 'on' : 'off', 5)}${s.gray(standing ? `since ${standing.at_utc}, by ${standing.by} (this checkout only)` : 'new features wait at their gates')}`);
340
+ ctx.out('', s.bold('Features'));
341
+ if (shown.length === 0)
342
+ ctx.out(` ${s.gray('none yet')}`);
343
+ const width = Math.max(0, ...shown.map((f) => f.slug.length)) + 2;
344
+ for (const feature of shown) {
345
+ const mode = feature.approvals.auto;
346
+ const detail = mode ? `since ${mode.at_utc}, by ${mode.by}${mode.from === 'default' ? ', from the default' : ''}` : 'waits at its gates';
347
+ const branch = here.has(feature.slug) ? s.teal(' ◂ this branch') : '';
348
+ ctx.out(` ${pad(feature.slug, feature.slug, width)}${pad(state(Boolean(mode)), mode ? 'on' : 'off', 5)}${s.gray(detail)}${branch}`);
349
+ }
350
+ }
318
351
  /**
319
352
  * agjan auto on|off --default: the person's default for this checkout (decision 79). Every
320
353
  * feature created here afterwards starts with auto mode on; existing features keep theirs.
@@ -352,12 +385,13 @@ async function autoDefault(ctx, on) {
352
385
  }
353
386
  if (on) {
354
387
  writeAutoDefault(ctx.root, { by: ctx.email(), at_utc: ctx.now() });
355
- ctx.out(s.green('auto mode on for every new feature in this checkout'));
388
+ ctx.out(s.green('auto mode on for every new feature in this checkout'), s.gray('(features that already exist keep their mode)'));
356
389
  }
357
390
  else {
358
391
  removeAutoDefault(ctx.root);
359
- ctx.out('auto mode default off: new features wait at their gates again');
392
+ ctx.out('auto mode default off: new features wait at their gates again', s.gray('(features that already exist keep their mode)'));
360
393
  }
394
+ printAutoSettings(ctx);
361
395
  return 0;
362
396
  }
363
397
  /**
@@ -370,7 +404,9 @@ async function autoDefault(ctx, on) {
370
404
  export async function auto(ctx, argv) {
371
405
  const { values, positionals } = parseArgs({ args: argv, options: { ...FEATURE_OPTION, default: { type: 'boolean' } }, allowPositionals: true });
372
406
  const [what] = positionals;
373
- const usage = 'usage: agjan auto on|off [--feature <slug>] [--no-commit] | agjan auto on|off --default';
407
+ const usage = 'usage: agjan auto on|off [--feature <slug>] [--no-commit] | agjan auto on|off --default | agjan auto status [--feature <slug>]';
408
+ if (what === 'status' && positionals.length === 1 && !values.default)
409
+ return autoStatus(ctx, values);
374
410
  if (!['on', 'off'].includes(what) || positionals.length !== 1)
375
411
  throw new UsageError(usage);
376
412
  if (values.default) {
@@ -385,10 +421,18 @@ export async function auto(ctx, argv) {
385
421
  catch (error) {
386
422
  if (!(error instanceof UsageError))
387
423
  throw error;
388
- // No single feature to act on: name both ways, the feature and the default.
389
- throw new UsageError(`${error.message.replace(/; pass --feature <slug>$/, '')}.\n` +
390
- ` every new feature in this checkout: npx agjan auto ${what} --default\n` +
391
- ` one feature: npx agjan auto ${what} --feature <slug>, or run it on the feature's branch after /agjan-spec has created it`);
424
+ // No single feature to act on: say why, and name both ways (the default, one feature).
425
+ const s = ctx.style;
426
+ const cmd = (rest) => s.cyan(`npx agjan auto ${what}${rest}`);
427
+ const several = /^several features changed \((.*?)\)/.exec(error.message);
428
+ throw new UsageError(`there is no single feature to switch auto mode ${what} for: ${several ? `this branch changes several (${several[1]})` : 'this branch has none yet'}.\n` +
429
+ 'Auto mode belongs to a feature, so choose:\n\n' +
430
+ ` ${s.bold('For every feature you start from now on')} (this checkout only):\n` +
431
+ ` ${cmd(' --default')}\n\n` +
432
+ ` ${s.bold('For one existing feature:')}\n` +
433
+ ` ${cmd(' --feature <slug>')}\n` +
434
+ ` or switch to the feature's branch and run ${cmd('')}\n` +
435
+ ` ${s.gray('(npx agjan status --all lists the features; /agjan-spec creates a new one)')}`);
392
436
  }
393
437
  const feature = loadFeature(ctx.root, slug);
394
438
  if (feature.kind !== 'feature')
@@ -408,8 +452,9 @@ export async function auto(ctx, argv) {
408
452
  return 1;
409
453
  feature.approvals.auto = { by: ctx.email(), at_utc: ctx.now() };
410
454
  save(ctx, feature, 'auto-on', {});
411
- ctx.out(ctx.style.green(`auto mode on for ${feature.slug}`));
455
+ ctx.out(ctx.style.green(`auto mode on for ${feature.slug}`), ctx.style.gray('(your default for new features is unchanged)'));
412
456
  await commitRecord(ctx, feature, values, `${feature.key}: auto mode on`);
457
+ printAutoSettings(ctx);
413
458
  return 0;
414
459
  }
415
460
  if (!current)
@@ -420,6 +465,7 @@ export async function auto(ctx, argv) {
420
465
  save(ctx, feature, 'auto-off', {});
421
466
  ctx.out(`auto mode off for ${feature.slug}; the gates wait for you again`);
422
467
  await commitRecord(ctx, feature, values, `${feature.key}: auto mode off`);
468
+ printAutoSettings(ctx);
423
469
  return 0;
424
470
  }
425
471
  /** agjan accept <finding-id> --reason "…" [--feature <slug>] [--no-commit] */
@@ -25,8 +25,12 @@ export function copilotModels() {
25
25
  const AGENTS = {
26
26
  balanced: { agent: 'agjan-reviewer', label: 'reviewer' },
27
27
  deep: { agent: 'agjan-reviewer-deep', label: 'deep reviewer' },
28
- qa: { agent: 'agjan-qa', label: 'QA' },
28
+ qa: { agent: 'agjan-qa', label: 'QA agent' },
29
29
  };
30
+ /** Whether the QA agent has no model of its own on `host`, so it runs on the deep tier's (decision 81). */
31
+ function followsDeep(config, host, tier) {
32
+ return tier === 'qa' && !config.models?.[host]?.qa;
33
+ }
30
34
  /** The steps a tier runs, from the step tiers (`review.tiers` over the defaults). */
31
35
  function stepsOf(config, tier) {
32
36
  if (tier === 'qa')
@@ -63,25 +67,31 @@ function show(ctx) {
63
67
  const config = ctx.config;
64
68
  for (const line of markLine(s, ctx.kit, 'models'))
65
69
  ctx.out(line);
70
+ ctx.out('', s.gray('A tier is the model setting of one agent: balanced and deep are the reviewers, qa is the tester.'));
66
71
  for (const host of config.hosts) {
67
72
  ctx.out('', s.bold(host));
73
+ const head = (text, width) => pad(s.gray(text), text, width);
74
+ // As wide as the longest model name here: real names (claude-sonnet-5.5) outgrow a fixed column.
75
+ const modelWidth = Math.max(13, ...AGENT_TIERS.map((t) => (agentModel(config, host, t) ?? '').length)) + 2;
76
+ ctx.out(` ${head('TIER', 10)}${head('AGENT', 21)}${head('MODEL', modelWidth)}${s.gray('RUNS')}`);
68
77
  for (const tier of AGENT_TIERS) {
69
78
  const { agent, label } = AGENTS[tier];
70
79
  const model = agentModel(config, host, tier);
71
80
  const shown = model ? s.cyan(model) : s.gray('session model');
72
81
  const plain = model ?? 'session model';
73
- const follows = tier === 'qa' && !config.models?.[host]?.qa ? s.gray(' (follows the deep reviewer)') : '';
74
- ctx.out(` ${pad(label, label, 15)}${pad(s.gray(agent), agent, 21)}${pad(shown, plain, 19)}${s.gray(stepsOf(config, tier))}${follows}`);
82
+ const follows = followsDeep(config, host, tier) ? s.gray(' (follows the deep tier)') : '';
83
+ ctx.out(` ${pad(s.bold(tier), tier, 10)}${pad(s.gray(agent), agent, 21)}${pad(shown, plain, modelWidth)}${s.gray(stepsOf(config, tier))}${follows}`);
75
84
  }
76
85
  }
77
86
  ctx.out('', s.bold('Change, in your terminal:'));
78
87
  const change = [
79
- ['npx agjan models set deep <model>', 'tip: another model family than the main agent finds other things'],
80
- ['npx agjan models set qa <model>', 'QA gets its own model'],
81
- [`npx agjan models set <tier> ${SESSION_MODEL}`, "back to the session's model"],
88
+ ['npx agjan models set balanced <model>', 'the reviewer: most review steps'],
89
+ ['npx agjan models set deep <model>', 'the deep reviewer; tip: another model family than the main agent'],
90
+ ['npx agjan models set qa <model>', 'QA gets its own model (else it follows the deep reviewer)'],
91
+ [`npx agjan models set <tier> ${SESSION_MODEL}`, `back to the session's model (tiers: ${AGENT_TIERS.join(', ')})`],
82
92
  ];
83
93
  for (const [command, why] of change)
84
- ctx.out(` ${pad(s.cyan(command), command, 38)}${s.gray(why)}`);
94
+ ctx.out(` ${pad(s.cyan(command), command, 40)}${s.gray(why)}`);
85
95
  if (config.hosts.length > 1)
86
96
  ctx.out(s.gray(' add --host <host> for one host only'));
87
97
  if (config.hosts.includes('copilot')) {
@@ -115,9 +125,14 @@ function set(ctx, tier, model, host) {
115
125
  if (models && !models.includes(model))
116
126
  throw new AgjanError(`GitHub Copilot does not offer '${model}'; its models: ${models.join(', ')}`);
117
127
  }
118
- const answer = ctx.ask(`Let the ${tier} reviewer run on ${model === SESSION_MODEL ? "the session's model" : model} (${hosts.join(', ')})?`, { defaultYes: true });
128
+ const { agent, label } = AGENTS[tier];
129
+ const following = tier === 'deep' ? hosts.filter((h) => followsDeep(config, h, 'qa')) : [];
130
+ if (following.length) {
131
+ ctx.out(ctx.style.gray(`The QA agent has no model of its own${config.hosts.length > 1 ? ` (${following.join(', ')})` : ''} and follows the deep tier, so it moves too.`), ctx.style.gray(`Give it one with: npx agjan models set qa <model>`));
132
+ }
133
+ const answer = ctx.ask(`Let the ${label} (tier ${tier}, ${agent}) run on ${model === SESSION_MODEL ? "the session's model" : model} (${hosts.join(', ')})?`, { defaultYes: true });
119
134
  if (answer === null)
120
- throw new AgjanError('choosing the reviewer model needs a human at a terminal; agents must not run it. Run it yourself in a terminal.');
135
+ throw new AgjanError('choosing a model needs a human at a terminal; agents must not run it. Run it yourself in a terminal.');
121
136
  if (!answer) {
122
137
  ctx.out(ctx.style.yellow('cancelled, nothing changed'));
123
138
  return 1;
@@ -16,7 +16,7 @@ import { GUARD } from '../adapters/copilot.js';
16
16
  import { git, mergeBase, resolveBase } from '../git.js';
17
17
  import { AgjanError, UsageError } from '../errors.js';
18
18
  import { blink, mark, pad, tone, verdictColor } from '../ui.js';
19
- import { mcpServers } from '../mcp-config.js';
19
+ import { PINNED, mcpServers } from '../mcp-config.js';
20
20
  import { addCommand, addCopilotServers, copilotServers } from '../copilot-mcp.js';
21
21
  import { UI_SCRIPT, hasUiTests, probeBrowser } from '../browser.js';
22
22
  import { readAutoDefault } from '../auto.js';
@@ -81,6 +81,23 @@ function doSync(ctx, { force }) {
81
81
  function ask(ctx, question, options) {
82
82
  return ctx.ask(question, options);
83
83
  }
84
+ /** The offer to add the documentation servers to Copilot: why, and what, as a short list. */
85
+ function copilotMcpOffer(ctx, servers) {
86
+ const s = ctx.style;
87
+ const names = Object.keys(servers);
88
+ const width = Math.max(...names.map((n) => n.length));
89
+ const packages = names.map((n) => servers[n].args.at(-1) ?? '');
90
+ const wide = Math.max(...packages.map((p) => p.length));
91
+ return [
92
+ '',
93
+ s.bold('Documentation MCP servers for Copilot'),
94
+ s.gray(" Copilot reads a project's .mcp.json only in folders it remembers as trusted."),
95
+ s.gray(' Added with copilot mcp add, they load in every Copilot session.'),
96
+ '',
97
+ ...names.map((n, i) => ` ${pad(s.bold(s.teal(n)), n, width + 2)}${pad(s.gray(packages[i]), packages[i], wide + 2)}${PINNED[n]?.about ?? ''}`),
98
+ '',
99
+ ];
100
+ }
84
101
  const SETUP_BRANCH = 'chore/set-up-agjan';
85
102
  const SETUP_COMMIT = 'chore: set up agjan';
86
103
  /** The next steps after init, for the configured hosts (design decision 69). */
@@ -105,7 +122,7 @@ function nextSteps(ctx, hosts, left) {
105
122
  if (hosts.includes('copilot')) {
106
123
  steps.push(`Start ${s.cyan('copilot')} in this folder and trust it.`);
107
124
  }
108
- steps.push(`Run: ${s.cyan('agjan doctor')}`);
125
+ steps.push(`Run: ${s.cyan('npx agjan doctor')}`);
109
126
  return ['', s.bold('Next steps:'), ...steps.map((text, i) => ` ${i + 1}. ${text}`)];
110
127
  }
111
128
  /**
@@ -274,9 +291,9 @@ export async function init(ctx, argv) {
274
291
  const resolved = { id: `${d}:${a}`, domain: d, name: a, role: area.role };
275
292
  return [[a, resolved], [`${d}:${a}`, resolved]];
276
293
  })));
277
- const servers = Object.keys(mcpServers({ areas }).servers);
278
- const copilotMcp = hosts.includes('copilot') && servers.length > 0 && (flag('copilot-mcp', 'no-copilot-mcp') ??
279
- ask(ctx, `Add the documentation MCP servers ${servers.join(', ')} to your Copilot configuration (copilot mcp add)?\n(Copilot loads a project's .mcp.json only in folders it remembers as trusted; these then load in every Copilot session.)`, { defaultYes: true }) ?? false);
294
+ const offered = mcpServers({ areas }).servers;
295
+ const copilotMcp = hosts.includes('copilot') && Object.keys(offered).length > 0 && (flag('copilot-mcp', 'no-copilot-mcp') ??
296
+ (ctx.out(...copilotMcpOffer(ctx, offered)), ask(ctx, 'Add them to your Copilot configuration?', { defaultYes: true })) ?? false);
280
297
  const config = {
281
298
  $schema: './node_modules/agjan/schemas/config.schema.json',
282
299
  kit: ctx.kit,
package/docs/guide.md CHANGED
@@ -41,7 +41,7 @@ Requirements: Node.js 22 or later, git, and Claude Code and/or GitHub Copilot.
41
41
  npm install --global agjan
42
42
  agjan init my-project # asks which hosts to set up (or: --hosts claude-code,copilot), then to commit the setup
43
43
  cd my-project # a command cannot move your shell: init prints this as its first next step
44
- agjan doctor
44
+ npx agjan doctor # from here on, npx runs the project's pinned agjan
45
45
  ```
46
46
 
47
47
  `agjan init <folder>` creates the folder, runs `git init -b main`, writes a `package.json`
@@ -66,6 +66,10 @@ the command offers to run the install first; without a terminal it fails and say
66
66
  (`agjan --yes <command>` installs without asking). Without a global install, `npx agjan init
67
67
  <folder>` works the same.
68
68
 
69
+ The global install is for starting projects. Day to day, use `npx agjan <command>` in the
70
+ project: it runs the pinned copy directly and works on every machine, with or without a
71
+ global install. The hooks, the MCP configuration and the skills all call it that way.
72
+
69
73
  `init` writes `agjan.config.json`, the skills (`.claude/skills/`), the reviewer agents,
70
74
  the guardrails against agents running approvals, the MCP configuration, a block in
71
75
  `AGENTS.md` and `CLAUDE.md`, a pre-commit hook and a CI workflow. Your own content in
@@ -158,7 +162,10 @@ decide comes to you as a "Spec question". The tests stay in `test/qa/<feature>/`
158
162
  in `test/ui/qa/<feature>/`) as regression tests; a change to them after QA makes QA run
159
163
  again. The final review, `check --ci` and `approve verify` wait for a passing QA round.
160
164
  QA runs on the deep reviewer's model unless you give it its own:
161
- `npx agjan models set qa <model>`.
165
+ `npx agjan models set qa <model>`. `npx agjan models` shows the three tiers (`balanced` and
166
+ `deep` are the reviewers `agjan-reviewer` and `agjan-reviewer-deep`, `qa` is `agjan-qa`), the
167
+ model each runs on and the steps it covers; `qa` is marked "follows the deep tier" while it has
168
+ no model of its own, and `models set deep` tells you when QA moves with it.
162
169
 
163
170
  The completion block gives you the last gate:
164
171
 
@@ -206,8 +213,15 @@ npx agjan auto on # this feature; asks you to type its key
206
213
  npx agjan auto off # this feature's gates wait for you again
207
214
  npx agjan auto on --default # every feature you create in this checkout from now on
208
215
  npx agjan auto off --default # new features wait at their gates again
216
+ npx agjan auto status # what is set: your default, and every existing feature
209
217
  ```
210
218
 
219
+ The two forms do different things. `auto on` switches one existing feature (the one that
220
+ changed on your branch, or `--feature <slug>`). `auto on --default` changes nothing that
221
+ exists; it only makes the features you create afterwards start in auto mode. To have both,
222
+ run both. `auto status` shows the real settings, read-only: your default and the mode of every
223
+ existing feature.
224
+
211
225
  The default is yours only: it lives in `.agjan/auto.json`, which is git-ignored, so
212
226
  teammates' checkouts keep their gates. A feature takes it when it is created (its
213
227
  `approvals.json` records `from: default`); existing features keep their mode, and
@@ -224,7 +238,8 @@ review still stops the gate. You stay in charge of:
224
238
 
225
239
  Every automatic approval is recorded as `by: auto` with your name as the one who switched
226
240
  auto mode on, never as your approval; `status`, the progress pages and the PR summary
227
- show it. Auto mode belongs to one feature: the next one starts with the gates on. Agents
241
+ show it. Auto mode belongs to one feature: the next one starts with the gates on, unless your
242
+ default is on. Agents
228
243
  cannot switch it on: like `approve`, it needs your terminal, and the guard denies it.
229
244
 
230
245
  ### Following the progress
@@ -1,5 +1,5 @@
1
1
  {
2
- "cap": { "package": "@cap-js/mcp-server", "version": "0.0.8", "areas": ["cap"] },
3
- "ui5": { "package": "@ui5/mcp-server", "version": "0.3.2", "areas": ["fiori"] },
4
- "fiori": { "package": "@sap-ux/fiori-mcp-server", "version": "1.15.13", "areas": ["fiori"] }
2
+ "cap": { "package": "@cap-js/mcp-server", "version": "0.0.8", "about": "CAP documentation and model search", "areas": ["cap"] },
3
+ "ui5": { "package": "@ui5/mcp-server", "version": "0.3.2", "about": "UI5 API reference and linting", "areas": ["fiori"] },
4
+ "fiori": { "package": "@sap-ux/fiori-mcp-server", "version": "1.15.13", "about": "Fiori elements app tooling", "areas": ["fiori"] }
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agjan",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Agentic engineering harness for AI coding agents: role agents, human approval gates, independent review and CI-enforced checks. SAP BTP first.",
5
5
  "keywords": [
6
6
  "agentic-engineering",