@nodii/dev 0.6.9 → 0.6.11

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
@@ -29,7 +29,14 @@ every nodii-dev process on the machine shares it instead of refreshing on each
29
29
  run; refreshes take turns under a per-user lock. A refresh clears the saved
30
30
  sign-in only when nodii-auth answers `invalid_grant` (expired, revoked or
31
31
  replayed). A 429, 5xx, timeout, network error or proxy error page keeps it and
32
- fails with `OAUTH_REFRESH_UNAVAILABLE` (exit 1) after a few retries. Every API
32
+ fails with `OAUTH_REFRESH_UNAVAILABLE` (exit 1). Only answers that show the
33
+ token was not used are retried at once (a connection that never opened, 429,
34
+ 500, 503, a proxy's non-JSON 4xx). After a timeout, a dropped connection, a
35
+ gateway timeout or a 2xx without tokens, nodii-auth may already have rotated
36
+ the token; it is not sent again by that command, though the next one will
37
+ present it, and a rotation whose answer was lost does end the sign-in.
38
+ SIGINT, SIGTERM and SIGHUP wait while a token is in flight and until its
39
+ successor is stored. Every API
33
40
  call goes to the edge's `/devops` prefix with the OAuth bearer and the
34
41
  registered `x-agent-id`; signing in again as the same person keeps that
35
42
  registration. `logout` revokes the refresh chain before erasing local
@@ -228,7 +235,7 @@ nodii-dev lane prioritize|deprioritize KEY --reason TEXT
228
235
  nodii-dev lane stop KEY --reason TEXT
229
236
  nodii-dev lane non-issue KEY --reason TEXT --evidence TEXT --reroute KEY[,KEY]|none
230
237
  --branch carried:ISSUE|dropped[:REASON] [--commits SHA[,SHA]]
231
- nodii-dev next KEY
238
+ nodii-dev next KEY [--paths A,B] [--components K,L] [--role ROLE]
232
239
 
233
240
  nodii-dev built list [--cursor CURSOR] [--include-acknowledged true]
234
241
  nodii-dev built ack KEY [KEY ...] [--note TEXT]
@@ -324,8 +331,60 @@ same checks, plus the ones that need its data, in one transaction.
324
331
  - `docs validate` also prints Dev's warnings for each document (they never
325
332
  block) and any problems with the decision's amends.
326
333
 
334
+ - **Clauses are bullets** (Dev issue 80). A clause is defined only as
335
+ `- **ID** text`. The same id written as a bold paragraph (`**APPR-3.** …`),
336
+ a heading, a bold table row or a numbered item, and defined nowhere as a
337
+ bullet, is refused with `CLAUSE_NOT_A_BULLET` (line and id); text inside the
338
+ bold (`- **ID [INTENDED]** …`) is `CLAUSE_MALFORMED` (write
339
+ `- **ID** [INTENDED] …`). `CLAUSE_COUNT_MISMATCH` then states how many
340
+ clauses Dev would store against how many the source defines, naming the
341
+ missing ids. `docs check` runs these locally; `rulebook list` prints
342
+ `N clauses` for each document.
343
+
344
+ ### Rule delivery (DEC-0020)
345
+
346
+ Every MUST clause declares how it reaches an agent, on one tag line indented
347
+ under the clause:
348
+
349
+ ```
350
+ - **MW2-14** The local gates MUST run in this order, …
351
+ ⟶ enforced · check: review-gates
352
+ - **U03-9** A list MUST page with the shared pager …
353
+ ⟶ served · build: dev_fix · step: adopt_test · side: frontend · comp: data-table
354
+ - **MW1-3** An agent MUST edit only its own config …
355
+ ⟶ core
356
+ ```
357
+
358
+ The delivery is `enforced` (with `check:`, which the document's Enforcement
359
+ table must name), `served` (with optional `build`, `step`, `side`, `svc`,
360
+ `path`, `comp` and `role` tags) or `core`; `gap: ISSUE` marks one that does not
361
+ work yet. `->` and `;` are ASCII aliases for `⟶` and `·`. A tag line as the
362
+ first line under a `###` heading is the default for that sub-section. Dev
363
+ checks every key and value, and refuses a ruling that adds or changes a MUST
364
+ clause with no delivery, and a ratification while any MUST clause has none
365
+ (`RULE_DELIVERY_MISSING`). The full syntax is in Dev's AD-era contract §1.8.
366
+
367
+ ```
368
+ nodii-dev next KEY # the next step, plus the clauses Dev serves for it
369
+ nodii-dev rules core # the generated core (every `core` clause); refused over the cap
370
+ nodii-dev rules report [--section rulebook|services|all] [--lane KEY]
371
+ nodii-dev rules cap TOKENS # operator: the core's token cap (default 3000)
372
+ ```
373
+
374
+ `next` sends the lane's changed files (its branch and working tree against
375
+ `origin/main`, read from the lane's worktree) so Dev serves path-tagged
376
+ clauses only where they apply; `--paths`, `--components` and `--role`
377
+ override. Each served clause prints its id, its first sentence and where to
378
+ read the rest; `--json` carries the full text and token counts. If Dev cannot
379
+ serve rules, `next` still prints the step. `rules report` shows, for each
380
+ document and in total, how many clauses use each delivery, how many MUST
381
+ clauses are untagged and how many carry a tool gap, plus the clauses and
382
+ tokens served to each lane at each step. Tokens are estimated as characters
383
+ divided by four.
384
+
327
385
  Like every other command, these reach Dev only through the platform edge
328
- (`/devops/api/v1/documents`, `/domains`, `/harness`, …) with the OAuth login.
386
+ (`/devops/api/v1/documents`, `/domains`, `/harness`, `/rules`, …) with the
387
+ OAuth login.
329
388
 
330
389
  ## Agent harness
331
390
 
@@ -394,7 +453,8 @@ operation's permission (requested in Dev).
394
453
  name, as Dev compares it), branch and worktree from git unless overridden, and resolves `--issue` keys to the UUIDs
395
454
  required by Dev. Lane keys are passed directly to every lane and Built
396
455
  acknowledgement route. `next` reads the lane's generated
397
- API steps and prints the exact next `lane step` command. Server refusals,
456
+ API steps and prints the exact next `lane step` command, then the rules Dev
457
+ serves for that step (see Rule delivery). Server refusals,
398
458
  including operator-only actions, workflow blocks, lane limits and Built items
399
459
  that are not on dev, retain Dev's error code/message and exit non-zero.
400
460
 
package/bin/nodii-dev CHANGED
@@ -7,6 +7,16 @@ while [ -L "$self" ]; do
7
7
  link=$(readlink "$self")
8
8
  case "$link" in /*) self="$link" ;; *) self="$(dirname "$self")/$link" ;; esac
9
9
  done
10
- entry="$(cd "$(dirname "$self")/.." && pwd)/dist/nodii-dev.js"
10
+ root="$(cd "$(dirname "$self")/.." && pwd)"
11
+ entry="$root/dist/nodii-dev.js"
12
+ # A checkout's own build can be older than its package.json (Dev issue 88: a
13
+ # stale 0.3.1 build once answered `npx @nodii/dev@0.6.10` inside a nodii-clis
14
+ # worktree). Refuse to run one.
15
+ built=$(sed -n 's/^export const VERSION = "\(.*\)";$/\1/p' "$root/dist/core.js" 2>/dev/null)
16
+ wanted=$(sed -n 's/^ "version": "\(.*\)",$/\1/p' "$root/package.json" 2>/dev/null)
17
+ if [ -n "$built" ] && [ -n "$wanted" ] && [ "$built" != "$wanted" ]; then
18
+ echo "nodii-dev: the build at $root is $built but its package.json says $wanted. Run 'npm run build' there, or run npx outside the nodii-clis repo." >&2
19
+ exit 2
20
+ fi
11
21
  if command -v bun >/dev/null 2>&1; then exec bun "$entry" "$@"; fi
12
22
  exec node "$entry" "$@"
package/dist/api.js CHANGED
@@ -103,6 +103,8 @@ export const GROUPS = {
103
103
  swaps: "Swaps", ideas: "Ideas", terminology: "Terminology", credentials: "Credentials",
104
104
  rulebook: "ad-documents", "ad-decisions": "ad-decisions", domains: "ad-domains", standardizations: "standardizations",
105
105
  archive: "archive", harness: "harness",
106
+ // DEC-0020 rule delivery; `rules core|report|cap` are first-class (upload.js).
107
+ rules: "rulebook",
106
108
  };
107
109
 
108
110
  export const ALIASES = {
package/dist/cli.js CHANGED
@@ -27,7 +27,7 @@ import { setupCommand } from "./setup.js";
27
27
  import { harnessCommand } from "./harness.js";
28
28
  import { doctorCommand } from "./doctor.js";
29
29
  import { figmaChangeSetShow, figmaChangeSetText, figmaFileKey, figmaResubmit, notRegisteredHint } from "./figma.js";
30
- import { docsCommand, rulebookCommand } from "./upload.js";
30
+ import { docsCommand, rulebookCommand, rulesCommand } from "./upload.js";
31
31
  import { changeSetCommand, guidelineCommand } from "./guidelines.js";
32
32
  import {
33
33
  ALIASES,
@@ -87,6 +87,9 @@ Usage: nodii-dev <command> [options] [--json]
87
87
  docs ratify --domain KEY [--domain KEY ...] --decision FILE [--wait]
88
88
  docs parked [CODE] [--status pending|acknowledged]
89
89
  rulebook list|show CODE [--version V]|diff CODE
90
+ rules core # the generated core (M05-33); refused over the cap
91
+ rules report [--section S] [--lane KEY] # delivery totals per document; rules served per lane
92
+ rules cap TOKENS # operator: set the core token cap (default 3000)
90
93
 
91
94
  lane start <key> --title TEXT --kind KIND --side SIDE [--repo REPO] [--issue ISSUE]
92
95
  lane step <key> --side SIDE --start|--done|--block <step>
@@ -96,7 +99,8 @@ Usage: nodii-dev <command> [options] [--json]
96
99
  --branch carried:KEY|dropped[:REASON] [--commits SHA[,SHA]]
97
100
  # DEC-0011: terminal non_issue; issue -> wont_do; slot frees
98
101
  lane list [--kind KIND] [--status STATUS] [--mine] [--cursor CURSOR]
99
- lane show <key> | next <key>
102
+ lane show <key> | next <key> [--paths A,B] [--components K,L] [--role R]
103
+ # next step, plus the rules Dev serves for it (DEC-0020)
100
104
  built list | built ack <key...>
101
105
  machine list|show|set-coordinator|assign|report
102
106
  agent lane-limit|grant|revoke
@@ -390,6 +394,7 @@ export async function main(argv = process.argv.slice(2)) {
390
394
  }
391
395
  if (command === "docs") return emitCommand(await docsCommand(action, rest, f));
392
396
  if (command === "rulebook" && ["list", "show", "diff"].includes(action)) return emitCommand(await rulebookCommand(action, rest, f));
397
+ if (command === "rules") return emitCommand(await rulesCommand(action, rest, f));
393
398
  // Guideline change sets: approving or rejecting one is a person's action in Dev.
394
399
  if (command === "design" && action === "guideline") return emitCommand(await guidelineCommand(rest[0], rest.slice(1), f));
395
400
  if (command === "design" && action === "changeset") return emitCommand(await changeSetCommand(rest[0], rest.slice(1), f));
package/dist/core.js CHANGED
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
 
7
- export const VERSION = "0.6.9";
7
+ export const VERSION = "0.6.11";
8
8
  export const configPath = () =>
9
9
  process.env.NODII_DEV_CONFIG_PATH ??
10
10
  join(homedir(), ".config/nodii-dev/config.json");