dw-sdlc 0.21.0 → 0.21.1
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/agentic-config.d.ts +16 -0
- package/dist/agentic-config.js +28 -23
- package/dist/cannot-run.d.ts +27 -0
- package/dist/cannot-run.js +48 -0
- package/dist/catalogue.js +2 -1
- package/dist/checks/agents-map.js +7 -8
- package/dist/checks/check.d.ts +10 -8
- package/dist/checks/check.js +9 -7
- package/dist/checks/decision-records.js +3 -2
- package/dist/checks/file-size-ratchet.js +13 -17
- package/dist/checks/index.d.ts +6 -5
- package/dist/checks/index.js +10 -9
- package/dist/checks/markdown-refs.js +1 -1
- package/dist/checks/primitives.js +5 -5
- package/dist/checks/routed-docs.js +1 -3
- package/dist/checks/skill-sections.js +12 -20
- package/dist/checks/tree.js +7 -7
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +26 -5
- package/dist/commands/check.js +27 -42
- package/dist/commands/config.js +22 -27
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +11 -18
- package/dist/commands/gate.js +35 -40
- package/dist/commands/lead-start.js +28 -42
- package/dist/commands/pr-reviewed.js +41 -59
- package/dist/commands/pr-ship.js +71 -89
- package/dist/commands/primitives.js +38 -40
- package/dist/commands/recap.js +23 -74
- package/dist/commands/references-setup.js +28 -76
- package/dist/commands/references-sync.js +29 -53
- package/dist/commands/setup.d.ts +2 -7
- package/dist/commands/setup.js +38 -90
- package/dist/commands/sweep.js +46 -157
- package/dist/commands/worker-ls.js +15 -31
- package/dist/commands/worker-report.js +36 -52
- package/dist/commands/worker-start.js +43 -57
- package/dist/drift.js +2 -1
- package/dist/exec.d.ts +20 -0
- package/dist/exec.js +37 -4
- package/dist/gate-cache.js +2 -1
- package/dist/git.d.ts +32 -0
- package/dist/git.js +60 -0
- package/dist/json-schema.js +1 -3
- package/dist/landed.js +11 -22
- package/dist/paused-operation.d.ts +2 -0
- package/dist/paused-operation.js +17 -0
- package/dist/pins.js +2 -1
- package/dist/pr/decide.d.ts +4 -16
- package/dist/pr/decide.js +48 -84
- package/dist/pr/delta.d.ts +3 -4
- package/dist/pr/delta.js +10 -19
- package/dist/pr/read.d.ts +27 -30
- package/dist/pr/read.js +94 -182
- package/dist/pr/reply.js +3 -5
- package/dist/pr/route.d.ts +11 -3
- package/dist/pr/route.js +5 -5
- package/dist/pr/standing.d.ts +138 -0
- package/dist/pr/standing.js +181 -0
- package/dist/pr/state.d.ts +10 -69
- package/dist/pr/state.js +42 -72
- package/dist/pr/upstream.d.ts +1 -6
- package/dist/pr/upstream.js +2 -2
- package/dist/primitives-diff.js +1 -1
- package/dist/recap-next.js +34 -47
- package/dist/recap-primitives.js +1 -1
- package/dist/references-key.d.ts +0 -1
- package/dist/references-key.js +3 -4
- package/dist/run-command.d.ts +4 -1
- package/dist/run-command.js +32 -11
- package/dist/setup-gate.d.ts +1 -7
- package/dist/setup-rules.js +2 -6
- package/dist/setup-writer.d.ts +32 -0
- package/dist/setup-writer.js +60 -0
- package/dist/shell-line.d.ts +2 -0
- package/dist/shell-line.js +5 -0
- package/dist/sweep-removal.d.ts +31 -0
- package/dist/sweep-removal.js +133 -0
- package/dist/sweep-terminals.d.ts +1 -1
- package/dist/sweep-terminals.js +21 -57
- package/dist/sweep-trees.d.ts +19 -3
- package/dist/sweep-trees.js +67 -31
- package/dist/worker/herdr.d.ts +67 -23
- package/dist/worker/herdr.js +126 -77
- package/dist/worker/launch.js +32 -45
- package/dist/worker/origin.d.ts +1 -1
- package/dist/worker/origin.js +9 -11
- package/dist/worker/tabs.js +11 -7
- package/dist/working-tree.d.ts +0 -8
- package/dist/working-tree.js +6 -22
- package/dist/worktree-lock.js +1 -1
- package/package.json +1 -1
- package/dist/git-env.d.ts +0 -2
- package/dist/git-env.js +0 -10
package/dist/worker/origin.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Brings the clone's view of origin's default branch up to date before a Worker starts: Claude Code's
|
|
2
2
|
// `--worktree` branches from the cached `origin/<default>` and fetches it only when the clone has gone a
|
|
3
3
|
// day without a fetch, so a Worker could otherwise begin from a ref that is hours or days behind.
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { asked } from "../
|
|
7
|
-
import { Refusal } from "./herdr.js";
|
|
4
|
+
import { CannotRun } from "../cannot-run.js";
|
|
5
|
+
import { SLOW_LIMIT_MS, TimedOut } from "../exec.js";
|
|
6
|
+
import { asked, git } from "../git.js";
|
|
8
7
|
const REMOTE_HEAD = "refs/remotes/origin/HEAD";
|
|
9
8
|
const PREFIX = "refs/remotes/origin/";
|
|
10
9
|
/** The branch to fetch: the one origin/HEAD names, else `baseBranch` of the config; undefined when neither names one. */
|
|
@@ -17,7 +16,7 @@ function defaultBranch(root, baseBranch) {
|
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
18
|
* Fetches origin's default branch, or every branch of origin when no default is known, into the remote-tracking
|
|
20
|
-
* refs at `root`; a clone with no origin has nothing to fetch and is left alone. Throws
|
|
19
|
+
* refs at `root`; a clone with no origin has nothing to fetch and is left alone. Throws `CannotRun` when the
|
|
21
20
|
* fetch fails, since a Worker started on a stale base is the fault this prevents.
|
|
22
21
|
*/
|
|
23
22
|
export function freshenOrigin(root, baseBranch) {
|
|
@@ -25,19 +24,18 @@ export function freshenOrigin(root, baseBranch) {
|
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
26
|
const branch = defaultBranch(root, baseBranch);
|
|
28
|
-
const args = ["
|
|
27
|
+
const args = ["fetch", "--quiet", "origin", ...(branch === undefined ? [] : [branch])];
|
|
29
28
|
const fetched = `git fetch origin${branch === undefined ? "" : ` ${branch}`}`;
|
|
30
|
-
const stale = (why) => new
|
|
29
|
+
const stale = (why) => new CannotRun(`${fetched} failed, so the Worker would begin from a stale base: ${why}`, "check the network and the access to origin; when origin/HEAD names a branch the remote no longer has, " +
|
|
31
30
|
"run `git remote set-head origin --auto`; then start the Worker again");
|
|
32
31
|
let result;
|
|
33
32
|
try {
|
|
34
|
-
result =
|
|
33
|
+
result = git(root, args, { limitMs: SLOW_LIMIT_MS });
|
|
35
34
|
}
|
|
36
35
|
catch (error) {
|
|
37
36
|
throw error instanceof TimedOut ? stale(error.message) : error;
|
|
38
37
|
}
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
throw stale(said?.trim() ?? `exited ${result.status ?? "on a signal"}`);
|
|
38
|
+
if ("error" in result) {
|
|
39
|
+
throw stale(result.said);
|
|
42
40
|
}
|
|
43
41
|
}
|
package/dist/worker/tabs.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
// The tab of a Worker's terminal in the herdr window: `hc run` with a `herdr.space` label opens one that herdr
|
|
2
2
|
// numbers, and `herdr-app` names it.
|
|
3
3
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
4
|
+
import { CannotRun } from "../cannot-run.js";
|
|
5
|
+
import { whyFailed } from "../exec.js";
|
|
4
6
|
import { isObject, parseObject } from "../json-text.js";
|
|
5
|
-
import {
|
|
7
|
+
import { herdrApp } from "./herdr.js";
|
|
6
8
|
/** The tabs `herdr-app ls` shows, each with the addresses of its terminals. */
|
|
7
9
|
function tabsOf() {
|
|
8
|
-
const listed =
|
|
10
|
+
const listed = herdrApp(["ls"]);
|
|
9
11
|
if (listed.status !== 0) {
|
|
10
|
-
throw new
|
|
12
|
+
throw new CannotRun(`herdr-app ls failed: ${whyFailed(listed)}`);
|
|
11
13
|
}
|
|
12
14
|
const parsed = parseObject(listed.stdout);
|
|
13
15
|
if (parsed === undefined) {
|
|
14
|
-
throw new
|
|
16
|
+
throw new CannotRun("herdr-app ls answered no JSON object");
|
|
15
17
|
}
|
|
16
18
|
const spaces = Array.isArray(parsed.spaces) ? parsed.spaces : [];
|
|
17
19
|
return spaces
|
|
@@ -47,14 +49,16 @@ export async function nameTab(address, name, boundSeconds) {
|
|
|
47
49
|
if (tab === undefined) {
|
|
48
50
|
return { kept: `the tab of ${address} is not in herdr-app ls within ${boundSeconds} s, so it keeps herdr's name` };
|
|
49
51
|
}
|
|
50
|
-
const renamed =
|
|
52
|
+
const renamed = herdrApp(["do", "tab.rename", "--id", tab.id, "--name", name]);
|
|
51
53
|
if (renamed.status !== 0) {
|
|
52
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
kept: `herdr-app could not rename the tab of ${address}: ${errorOf(renamed.stdout) ?? whyFailed(renamed)}`
|
|
56
|
+
};
|
|
53
57
|
}
|
|
54
58
|
return "renamed";
|
|
55
59
|
}
|
|
56
60
|
catch (error) {
|
|
57
|
-
if (error instanceof
|
|
61
|
+
if (error instanceof CannotRun) {
|
|
58
62
|
return { kept: `the tab of ${address} keeps herdr's name: ${error.message}` };
|
|
59
63
|
}
|
|
60
64
|
throw error;
|
package/dist/working-tree.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/** `git <args>` in the repository at `root`, on `index` when given. */
|
|
2
|
-
export declare function git(root: string, args: string[], index?: string): {
|
|
3
|
-
out: string;
|
|
4
|
-
} | {
|
|
5
|
-
error: string;
|
|
6
|
-
};
|
|
7
|
-
/** `git <args>` at `root`, or undefined when it exits non-zero as a question answered no. */
|
|
8
|
-
export declare function asked(root: string, args: string[]): string | undefined;
|
|
9
1
|
/** The tree of the checkout at `root` and its git dir, or why it has none. */
|
|
10
2
|
export declare function workingTree(root: string): {
|
|
11
3
|
tree: string;
|
package/dist/working-tree.js
CHANGED
|
@@ -3,25 +3,8 @@
|
|
|
3
3
|
import { copyFileSync, existsSync, mkdtempSync, rmSync, statSync, utimesSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
/** `git <args>` in the repository at `root`, on `index` when given. */
|
|
9
|
-
export function git(root, args, index) {
|
|
10
|
-
const env = repositoryFreeEnv();
|
|
11
|
-
const result = exec("git", ["-C", root, ...args], {
|
|
12
|
-
env: index === undefined ? env : { ...env, GIT_INDEX_FILE: index }
|
|
13
|
-
});
|
|
14
|
-
if (result.status === 0) {
|
|
15
|
-
return { out: result.stdout.trim() };
|
|
16
|
-
}
|
|
17
|
-
const reason = result.error?.message ?? result.stderr.split("\n").find((line) => line.trim() !== "");
|
|
18
|
-
return { error: `git ${args[0] ?? ""}: ${reason?.trim() ?? `exited ${result.status ?? "on a signal"}`}` };
|
|
19
|
-
}
|
|
20
|
-
/** `git <args>` at `root`, or undefined when it exits non-zero as a question answered no. */
|
|
21
|
-
export function asked(root, args) {
|
|
22
|
-
const result = git(root, args);
|
|
23
|
-
return "out" in result ? result.out : undefined;
|
|
24
|
-
}
|
|
6
|
+
import { messageOf } from "./cannot-run.js";
|
|
7
|
+
import { git } from "./git.js";
|
|
25
8
|
/**
|
|
26
9
|
* The tree `git write-tree` hashes from a copy of the index after `git add -A` on it: the copy keeps the
|
|
27
10
|
* stat cache, so only what changed is read again; identical content survives a commit, an amend or a
|
|
@@ -39,8 +22,9 @@ function treeOf(root, gitDir) {
|
|
|
39
22
|
copyFileSync(real, index);
|
|
40
23
|
utimesSync(index, atime, mtime);
|
|
41
24
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
25
|
+
const scratchIndex = { env: { GIT_INDEX_FILE: index } };
|
|
26
|
+
const added = git(root, ["add", "-A"], scratchIndex);
|
|
27
|
+
return "error" in added ? added : git(root, ["write-tree"], scratchIndex);
|
|
44
28
|
}
|
|
45
29
|
finally {
|
|
46
30
|
rmSync(scratch, { recursive: true, force: true });
|
|
@@ -57,6 +41,6 @@ export function workingTree(root) {
|
|
|
57
41
|
return "error" in tree ? tree : { tree: tree.out, gitDir: gitDir.out };
|
|
58
42
|
}
|
|
59
43
|
catch (error) {
|
|
60
|
-
return { error:
|
|
44
|
+
return { error: messageOf(error) };
|
|
61
45
|
}
|
|
62
46
|
}
|
package/dist/worktree-lock.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// `claude session <name> (pid <N> start <time>)`, <time> as `ps -o lstart` writes it in UTC. Such a lock is
|
|
3
3
|
// stale once no process N runs or N started at another time. Any other reason is the dev's to lift.
|
|
4
4
|
import { exec } from "./exec.js";
|
|
5
|
-
import { shellLine } from "./
|
|
5
|
+
import { shellLine } from "./shell-line.js";
|
|
6
6
|
const CLAUDE_LOCK = /^claude session .* \(pid (?<pid>\d{1,10}) start (?<start>.+)\)$/;
|
|
7
7
|
const MAX_PID = 2 ** 31 - 1;
|
|
8
8
|
const squeezed = (text) => text.trim().replace(/\s+/g, " ");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dw-sdlc",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "The Gate and the agentic config behind the sdlc Claude Code plugin: a bin with the Gate and its Checks, the setup, the doctor, the Sync of References, the Ship script that drives a pull request to merged, the Sweep, and Lead and Worker sessions in herdr; the resolver of a repository's .ai/agentic.config.json layers and its JSON Schema.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/dist/git-env.d.ts
DELETED
package/dist/git-env.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// The environment a git command runs under to find its repository from its own directory, as a git
|
|
2
|
-
// hook's GIT_DIR or GIT_INDEX_FILE would otherwise aim it at the hook's repository.
|
|
3
|
-
import { exec } from "./exec.js";
|
|
4
|
-
let repositoryVars;
|
|
5
|
-
/** This process's environment without the variables that tie git to one repository, as git lists them. */
|
|
6
|
-
export function repositoryFreeEnv() {
|
|
7
|
-
repositoryVars ??= new Set((exec("git", ["rev-parse", "--local-env-vars"]).stdout ?? "").split("\n").filter(Boolean));
|
|
8
|
-
const vars = repositoryVars;
|
|
9
|
-
return Object.fromEntries(Object.entries(process.env).filter(([name]) => !vars.has(name)));
|
|
10
|
-
}
|