@nodii/dev 0.6.115 → 0.6.116
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/dist/cli.js +6 -0
- package/dist/core.js +1 -1
- package/dist/flags.js +1 -0
- package/dist/starting.js +41 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -114,6 +114,7 @@ import {
|
|
|
114
114
|
import {
|
|
115
115
|
amendmentGuard,
|
|
116
116
|
amendLaneCommand,
|
|
117
|
+
foldLaneCommand,
|
|
117
118
|
laneAuthorityCommand,
|
|
118
119
|
coordinatorCommand,
|
|
119
120
|
gatherLaneCommand,
|
|
@@ -317,6 +318,10 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
317
318
|
lane amend <key> --objective|--scope|--rules TEXT --reason TEXT
|
|
318
319
|
# an --objective or --scope amendment needs the person's recorded
|
|
319
320
|
# scope_change first (MW1-12.5); a --rules amendment needs none
|
|
321
|
+
lane fold <key> --versions 3,4,5|3-9 --summary TEXT --reason TEXT
|
|
322
|
+
# folds superseded scope/rules amendments into one rules note, so a
|
|
323
|
+
# lane at its note cap (LANE_NOTES_FULL) takes amendments again;
|
|
324
|
+
# coordinator, staff or stepped-up operator (hub-306)
|
|
320
325
|
lane authority record <key> --kind scope_change|handover|deploy_go --quote TEXT --at ISO [--to-agent ID]
|
|
321
326
|
# a person's word, verbatim, with when they said it (MW1-12.5);
|
|
322
327
|
# recorded from their own sign-in, never from a lane's config
|
|
@@ -994,6 +999,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
994
999
|
return emit({ data: result.data }, json, result.text);
|
|
995
1000
|
}
|
|
996
1001
|
if (command === "lane" && action === "amend") return emitCommand(await amendLaneCommand(rest[0], f));
|
|
1002
|
+
if (command === "lane" && action === "fold") return emitCommand(await foldLaneCommand(rest[0], f));
|
|
997
1003
|
if (command === "lane" && action === "authority") return emitCommand(await laneAuthorityCommand(rest[0], rest[1], f));
|
|
998
1004
|
if (command === "lane" && action === "gather") {
|
|
999
1005
|
const result = await gatherLaneCommand(rest[0], 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.
|
|
7
|
+
export const VERSION = "0.6.116";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/flags.js
CHANGED
|
@@ -28,6 +28,7 @@ export const COMMAND_FLAGS = {
|
|
|
28
28
|
"subagents", "notes", "narrowing-note", "narrowing-remainder", "heartbeat-seconds",
|
|
29
29
|
],
|
|
30
30
|
"lane amend": ["objective", "scope", "rules", "reason"],
|
|
31
|
+
"lane fold": ["versions", "summary", "reason"],
|
|
31
32
|
"lane authority": ["kind", "quote", "at", "to-agent"],
|
|
32
33
|
"lane start": ["key", "issue", "title", "kind", "side", "repo", "branch", "worktree", "step-limit"],
|
|
33
34
|
"lane step": ["side", "start", "done", "block", "not-applicable", "reason", "reason-code", "note", "review", "delta"],
|
package/dist/starting.js
CHANGED
|
@@ -723,9 +723,49 @@ const AMEND_REFUSALS = {
|
|
|
723
723
|
LANE_LAUNCH_NOT_FOUND: (key) => `${key} was not started with nodii-dev lane launch, so it has no launch contract to amend.`,
|
|
724
724
|
// MW1-12.5: an objective or scope amendment needs the person's own word.
|
|
725
725
|
SCOPE_CHANGE_AUTHORITY_REQUIRED: (key) => `An --objective or --scope amendment needs a person's recorded word first: they run nodii-dev lane authority record ${key} --kind scope_change --quote TEXT --at ISO-TIME from their own sign-in. A --rules amendment needs none.`,
|
|
726
|
+
// hub-306: Dev refuses the amendment that would cross the note cap.
|
|
727
|
+
LANE_NOTES_FULL: (key, details) =>
|
|
728
|
+
`${key} would have ${details?.notes ?? "too many"} notes; a lane holds at most ${details?.max ?? 100}. Nothing was recorded. Fold superseded amendments into one note first: nodii-dev lane fold ${key} --versions V,V,... --summary TEXT --reason TEXT (lane show ${key} lists the versions).`,
|
|
726
729
|
};
|
|
727
730
|
const ERROR_CODE = /^[A-Z][A-Z0-9_]*$/;
|
|
728
731
|
|
|
732
|
+
const FOLD_REFUSALS = {
|
|
733
|
+
LANE_NOT_FOUND: AMEND_REFUSALS.LANE_NOT_FOUND,
|
|
734
|
+
LANE_LAUNCH_NOT_FOUND: AMEND_REFUSALS.LANE_LAUNCH_NOT_FOUND,
|
|
735
|
+
COORDINATOR_REQUIRED: (key) => `Only the machine coordinator that launched ${key}, a staff person, or the operator with a TOTP step-up may fold its amendments.`,
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* hub-306: `lane fold <key> --versions 3,4,5 --summary TEXT --reason TEXT`
|
|
740
|
+
* replaces superseded scope or rules amendments with one rules note. The
|
|
741
|
+
* originals stay on the lane and in the audit log; the lane acks the new note.
|
|
742
|
+
*/
|
|
743
|
+
export async function foldLaneCommand(key, flags, { request = devRequest } = {}) {
|
|
744
|
+
if (!key) throw new CliError("USAGE", "lane fold needs <key>.", 2);
|
|
745
|
+
const raw = requireFlag(flags, "versions");
|
|
746
|
+
const versions = String(raw).split(",").map((part) => part.trim()).filter(Boolean).flatMap((part) => {
|
|
747
|
+
const range = /^(\d+)-(\d+)$/.exec(part);
|
|
748
|
+
if (!range) return [Number(part)];
|
|
749
|
+
const [from, to] = [Number(range[1]), Number(range[2])];
|
|
750
|
+
if (to < from || to - from > 500) return [Number.NaN];
|
|
751
|
+
return Array.from({ length: to - from + 1 }, (_, index) => from + index);
|
|
752
|
+
});
|
|
753
|
+
if (versions.length < 2 || versions.some((version) => !Number.isInteger(version) || version < 1))
|
|
754
|
+
throw new CliError("USAGE", "lane fold needs --versions with two or more amendment versions, as 3,4,5 or 3-9.", 2);
|
|
755
|
+
const summary = requireFlag(flags, "summary");
|
|
756
|
+
const reason = requireFlag(flags, "reason");
|
|
757
|
+
let payload;
|
|
758
|
+
try {
|
|
759
|
+
payload = await request("POST", `/api/v1/lanes/${encode(key)}/amendments/fold`, { versions, summary, reason, ...via });
|
|
760
|
+
} catch (error) {
|
|
761
|
+
const say = FOLD_REFUSALS[error?.code];
|
|
762
|
+
if (say) throw new CliError(error.code, say(key), error.exitCode ?? 1, error.details);
|
|
763
|
+
throw error;
|
|
764
|
+
}
|
|
765
|
+
const { amendment, folded, notes } = payload.data;
|
|
766
|
+
return { payload, human: `Folded ${folded.length} amendments of ${key} into amendment ${amendment.version}; the lane now has ${notes} notes. Its run acks the new note with lane gather --delta.` };
|
|
767
|
+
}
|
|
768
|
+
|
|
729
769
|
export async function amendLaneCommand(key, flags, { request = devRequest, now = Date.now, config = readConfig } = {}) {
|
|
730
770
|
if (!key) throw new CliError("USAGE", "lane amend needs <key>.", 2);
|
|
731
771
|
const change = Object.fromEntries([["objective", flags.objective], ["scope", flags.scope], ["rules", flags.rules]].filter(([, value]) => value));
|
|
@@ -736,7 +776,7 @@ export async function amendLaneCommand(key, flags, { request = devRequest, now =
|
|
|
736
776
|
payload = await request("POST", `/api/v1/lanes/${encode(key)}/amendments`, { change, reason, ...via });
|
|
737
777
|
} catch (error) {
|
|
738
778
|
const say = AMEND_REFUSALS[error?.code];
|
|
739
|
-
if (say) throw new CliError(error.code, say(key), error.exitCode ?? 1, error.details);
|
|
779
|
+
if (say) throw new CliError(error.code, say(key, error.details), error.exitCode ?? 1, error.details);
|
|
740
780
|
// A Dev before NODII-DEV-CLI-17 answered a recorded amendment with a 409
|
|
741
781
|
// whose code is the reason itself. Read the lane back for the row.
|
|
742
782
|
if (error?.code && !ERROR_CODE.test(error.code) && error.code === reason.trim()) {
|