@codyswann/lisa 8.0.1 → 8.1.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/all/copy-overwrite/scripts/lib/completion-authorization.mjs +28 -0
- package/all/copy-overwrite/scripts/lib/completion-proof-adapters.mjs +21 -0
- package/all/copy-overwrite/scripts/lib/completion-proof-projection.mjs +25 -41
- package/all/copy-overwrite/scripts/lib/completion-proof-shape.mjs +23 -0
- package/all/copy-overwrite/scripts/lib/npm-update-bun.mjs +8 -3
- package/all/copy-overwrite/scripts/lib/npm-update-cache-seed.mjs +145 -0
- package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +7 -0
- package/all/copy-overwrite/scripts/lib/npm-update-prepare.mjs +34 -6
- package/all/copy-overwrite/scripts/lib/tracker-row-fold.mjs +48 -0
- package/all/copy-overwrite/scripts/lib/work-item-estimate-actual.mjs +131 -0
- package/all/copy-overwrite/scripts/lib/work-item-estimate-calibration.mjs +16 -33
- package/all/copy-overwrite/scripts/lib/work-item-estimate-check.mjs +26 -5
- package/all/copy-overwrite/scripts/lib/work-item-estimate-config.mjs +21 -0
- package/all/copy-overwrite/scripts/lib/work-item-estimate-tally.mjs +272 -0
- package/all/copy-overwrite/scripts/lib/work-item-estimate.mjs +60 -31
- package/all/copy-overwrite/scripts/lisa-estimate.mjs +60 -9
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +74 -10
- package/dist/core/lisa-owned-hash-ledger.json +112 -6
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.json +48 -19
- package/dist/utils/usage-accounting-totals.d.ts.map +1 -1
- package/dist/utils/usage-accounting-totals.js +6 -1
- package/dist/utils/usage-accounting-totals.js.map +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/SKILL.md +1 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-usage-accounting/SKILL.md +2 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-usage-accounting/references/estimate.md +49 -0
- package/plugins/lisa/rules/reference/work-item-definition-of-ready.md +5 -2
- package/plugins/lisa/skills/lisa-tracker-evidence/SKILL.md +1 -0
- package/plugins/lisa/skills/lisa-usage-accounting/SKILL.md +2 -1
- package/plugins/lisa/skills/lisa-usage-accounting/references/estimate.md +49 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-tracker-evidence/SKILL.md +1 -0
- package/plugins/lisa-agy/skills/lisa-usage-accounting/SKILL.md +2 -1
- package/plugins/lisa-agy/skills/lisa-usage-accounting/references/estimate.md +49 -0
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/rules/reference/work-item-definition-of-ready.md +5 -2
- package/plugins/lisa-copilot/skills/lisa-tracker-evidence/SKILL.md +1 -0
- package/plugins/lisa-copilot/skills/lisa-usage-accounting/SKILL.md +2 -1
- package/plugins/lisa-copilot/skills/lisa-usage-accounting/references/estimate.md +49 -0
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/rules/work-item-definition-of-ready-reference.mdc +5 -2
- package/plugins/lisa-cursor/skills/lisa-tracker-evidence/SKILL.md +1 -0
- package/plugins/lisa-cursor/skills/lisa-usage-accounting/SKILL.md +2 -1
- package/plugins/lisa-cursor/skills/lisa-usage-accounting/references/estimate.md +49 -0
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/rules/reference/work-item-definition-of-ready.md +5 -2
- package/plugins/lisa-devin/skills/lisa-tracker-evidence/SKILL.md +1 -0
- package/plugins/lisa-devin/skills/lisa-usage-accounting/SKILL.md +2 -1
- package/plugins/lisa-devin/skills/lisa-usage-accounting/references/estimate.md +49 -0
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/rules/reference/work-item-definition-of-ready.md +5 -2
- package/plugins/src/base/skills/lisa-tracker-evidence/SKILL.md +1 -0
- package/plugins/src/base/skills/lisa-usage-accounting/SKILL.md +2 -1
- package/plugins/src/base/skills/lisa-usage-accounting/references/estimate.md +49 -0
- package/scripts/record-npm-update-dual-lock-seed.mjs +203 -0
- package/scripts/two-channel-couplings.json +1 -1
- package/typescript/copy-overwrite/.prettierignore +4 -0
|
@@ -195,8 +195,11 @@ missing estimate fails: the claiming agent estimates the item, calibrated
|
|
|
195
195
|
against comparable finished items, and writes it before any work. If
|
|
196
196
|
estimating itself fails, the work still goes ahead: the item stays claimed, the
|
|
197
197
|
result records `estimate_outcome: failed` with the reason, and a plain-English
|
|
198
|
-
comment on the item says why (`lisa-track` step 4).
|
|
199
|
-
|
|
198
|
+
comment on the item says why (`lisa-track` step 4). At done time
|
|
199
|
+
`lisa-work-item complete` refuses the item until its usage ledger has an entry
|
|
200
|
+
and the section shows that ledger's actual tokens and cost beside the estimate
|
|
201
|
+
(`lisa-estimate.mjs tally`). It is `N/A` when the project turns the
|
|
202
|
+
requirement off. Nobody is ever asked for an estimate.
|
|
200
203
|
|
|
201
204
|
## Relationship to the lifecycle
|
|
202
205
|
|
|
@@ -23,6 +23,7 @@ omit the plugin rules tree; do not assume a runtime-specific rules directory.
|
|
|
23
23
|
Then, when an installed stack plugin ships a `journey-guidance` skill (the Expo and Rails plugins do), invoke it and carry its guidance — how the stack names its evidence files — into the vendor skill below. It is tracker-neutral, so it applies to `jira`, `github`, and `linear` alike. When no stack plugin ships one, continue with the base behaviour; that is not an error.
|
|
24
24
|
2. Missing / empty → stop and report `"No tracker configured in .lisa.config.json. Run /lisa:setup:jira, /lisa:setup:github, or /lisa:setup:linear first."`
|
|
25
25
|
3. Before dispatching, update the generated evidence artifact through `lisa-usage-accounting` so the comment body / PR evidence section carries a direct `lisa-verify` usage entry in the canonical `## Lisa Usage` section. If the originating work item's parentage or child refs are already known, prefer `record_and_rollup` so ancestor totals refresh in the same write; otherwise still write the direct entry, and if trustworthy runtime usage is unavailable, write `source: unavailable` with nullable token/cost fields instead of skipping the row.
|
|
26
|
+
Then, unless `workItem.estimate.required` is `false`, tally the actual beside the estimate: run `node scripts/lisa-estimate.mjs tally --body-file <work-item-body.md>` (add one `--usage-file <comment.md>` for every comment on the item that holds a usage ledger, the evidence comment included), write the printed body back to the work item through `lisa-tracker-write`, read it back, and run `node scripts/lisa-estimate.mjs check --phase done --body-file <stored-body.md>` with the same `--usage-file` flags the tally got, so the check reads the ledgers the tally counted. `lisa-work-item complete` refuses an item whose tally is missing or stale. See the usage-accounting skill's `references/estimate.md`.
|
|
26
27
|
4. Dispatch:
|
|
27
28
|
- `jira` → invoke `lisa-jira-evidence` with `$ARGUMENTS` verbatim. Arg shape: `<TICKET_ID> <EVIDENCE_DIR> <PR_NUMBER>`.
|
|
28
29
|
- `github` → invoke `lisa-github-evidence` with `$ARGUMENTS` verbatim. Arg shape: `<ISSUE_REF> <EVIDENCE_DIR> <PR_NUMBER>` where `ISSUE_REF` is `org/repo#<number>` or a GitHub issue URL.
|
|
@@ -195,7 +195,8 @@ failures into a generic "usage update failed."
|
|
|
195
195
|
A work item's token estimate and recommended model live in their own managed `## Lisa Estimate`
|
|
196
196
|
section, beside this ledger, never inside it. The contract, config (`workItem.estimate`) and
|
|
197
197
|
pricing are in the [estimate reference](references/estimate.md); render and check the section
|
|
198
|
-
with `node scripts/lisa-estimate.mjs`.
|
|
198
|
+
with `node scripts/lisa-estimate.mjs`. At done, `lisa-estimate.mjs tally` copies this ledger's
|
|
199
|
+
rollup total into that section as the actual; it reads the ledger and never writes to it.
|
|
199
200
|
|
|
200
201
|
## Rules
|
|
201
202
|
|
|
@@ -91,4 +91,53 @@ goes into the section. Items whose actual is unknown or partial — no ledger, a
|
|
|
91
91
|
the sum of only the known runs. With
|
|
92
92
|
no usable history the range is unchanged and the basis says "no calibration history".
|
|
93
93
|
|
|
94
|
+
## Done: the actual beside the estimate
|
|
95
|
+
|
|
96
|
+
When the work is done, the section also shows what it really cost (CodySwannGT/lisa#4956). The
|
|
97
|
+
actual is the item's `## Lisa Usage` ledgers, on the body and on any comment — the same ledger
|
|
98
|
+
every flow already records into, not a second one. Each distinct run is counted once, by its entry
|
|
99
|
+
id, wherever it is recorded: a comment that repeats the body's runs and adds its own Verify run adds
|
|
100
|
+
only that run. Child work arrives as each ledger's aggregate; the total is `unknown` only when two
|
|
101
|
+
ledgers share some, but not all, of the same child runs, because that aggregate cannot be split:
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
| Estimate | 2M–4M | $3.14–$6.28 USD | claude-opus-5-5 |
|
|
105
|
+
| Actual | 3M | $4.71 USD | — |
|
|
106
|
+
|
|
107
|
+
Actual: the Lisa Usage ledger total over 2 usage entries (source: observed); 1x the estimate's midpoint.
|
|
108
|
+
|
|
109
|
+
<!-- lisa:estimate-actual tokens=3000000 cost=4.71 currency=USD sources=observed entries=2 ratio=1 -->
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
After the Verify usage entry is written (`lisa-tracker-evidence` step 3) and before the accepted
|
|
113
|
+
completion proof is published, tally it and write the body back:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
node scripts/lisa-estimate.mjs tally --body-file <body.md> [--usage-file <comment.md>]...
|
|
117
|
+
node scripts/lisa-estimate.mjs check --phase done --body-file <stored-body.md> [--usage-file <comment.md>]...
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Pass every comment that holds a ledger, each with its own `--usage-file`, to both commands. `complete`
|
|
121
|
+
reads every comment, so the check must read the same ledgers the tally counted. A total that any run
|
|
122
|
+
leaves unknown (`unavailable` telemetry, a `measured-subset` entry, a child run with no token count
|
|
123
|
+
or no cost) is shown as
|
|
124
|
+
`unknown`, never as zero, never as the sum of only the known runs, and never guessed. A `## Lisa
|
|
125
|
+
Usage` section that cannot be read in full (an entry or rollup token the parser refuses or cannot
|
|
126
|
+
match) is never dropped: it makes every total `unknown` and names `unreadable-ledger` among the
|
|
127
|
+
sources, until the section is repaired through `lisa-usage-accounting`. A section without a rollup
|
|
128
|
+
token still has its direct entries counted. An item that
|
|
129
|
+
reached done with no estimate shows `none recorded` in the estimate row rather than an invented
|
|
130
|
+
range.
|
|
131
|
+
|
|
132
|
+
`lisa-work-item complete` enforces it: when `required` is true, it refuses (as `pending-proof`) an
|
|
133
|
+
item with no usage entry, with no tally, or with a tally that no longer matches the ledger. The
|
|
134
|
+
estimate section is machine-owned metadata, so rewriting it does not change the specification
|
|
135
|
+
digest the accepted completion proof is bound to. Only the exact lines `lisa-estimate` writes are
|
|
136
|
+
left out; every other line a person adds inside it still counts, even one that starts with
|
|
137
|
+
`Actual:` or `Basis:`.
|
|
138
|
+
|
|
139
|
+
## When the config is off
|
|
140
|
+
|
|
141
|
+
Nothing about estimates blocks. Every check reports `N/A`, and `complete` skips the done gate.
|
|
142
|
+
|
|
94
143
|
The recommended model is recorded only. It does not choose which model or agent runs the work.
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Record the registry data tests/integration/npm-update-dual-lock.test.ts runs
|
|
4
|
+
* on, so the suite never asks the live registry (CodySwannGT/lisa#5092).
|
|
5
|
+
*
|
|
6
|
+
* Every byte comes from https://registry.npmjs.org/. This runs the commands
|
|
7
|
+
* the suite and the updater it drives run, against the real registry, with
|
|
8
|
+
* npm's and Bun's caches pointed at a fresh seed folder; what they fetched is
|
|
9
|
+
* what an offline run will need. It also resolves each host's npm lock.
|
|
10
|
+
*
|
|
11
|
+
* The record is committed as one archive, tests/fixtures/npm-update-dual-lock/
|
|
12
|
+
* registry-record.tgz, which the suite extracts. Registry responses are
|
|
13
|
+
* third-party data, not Lisa source: kept loose they are cache files with no
|
|
14
|
+
* name a scanner can read, and package metadata naming its authors' public
|
|
15
|
+
* repositories. Recording again replaces the whole archive.
|
|
16
|
+
*
|
|
17
|
+
* Run it under the updater's own Node, so the cache holds what that npm asks
|
|
18
|
+
* for:
|
|
19
|
+
*
|
|
20
|
+
* mise exec node@22.23.3 bun@1.4.4 -- node scripts/record-npm-update-dual-lock-seed.mjs
|
|
21
|
+
*/
|
|
22
|
+
import { spawnSync } from "node:child_process";
|
|
23
|
+
import {
|
|
24
|
+
lstatSync,
|
|
25
|
+
mkdirSync,
|
|
26
|
+
mkdtempSync,
|
|
27
|
+
readdirSync,
|
|
28
|
+
readFileSync,
|
|
29
|
+
rmSync,
|
|
30
|
+
writeFileSync,
|
|
31
|
+
} from "node:fs";
|
|
32
|
+
import { tmpdir } from "node:os";
|
|
33
|
+
import { dirname, join, resolve } from "node:path";
|
|
34
|
+
import { fileURLToPath } from "node:url";
|
|
35
|
+
|
|
36
|
+
const ARCHIVE = resolve(
|
|
37
|
+
dirname(fileURLToPath(import.meta.url)),
|
|
38
|
+
"../tests/fixtures/npm-update-dual-lock/registry-record.tgz"
|
|
39
|
+
);
|
|
40
|
+
const REGISTRY = "https://registry.npmjs.org/";
|
|
41
|
+
const IGNORE = "--ignore-scripts";
|
|
42
|
+
const FLAGS = [IGNORE, "--no-audit", "--no-fund"];
|
|
43
|
+
/** Bun's two installs, as the suite runs them and as the updater does. */
|
|
44
|
+
const BUN_LOCK = ["install", "--lockfile-only", IGNORE];
|
|
45
|
+
const BUN_FROZEN = ["install", "--frozen-lockfile", IGNORE];
|
|
46
|
+
const AT_REGISTRY = ["--registry", REGISTRY];
|
|
47
|
+
const UPDATE = "is-number@7.0.0";
|
|
48
|
+
|
|
49
|
+
/** The hosts the suite builds, as their manifests and recorded locks. */
|
|
50
|
+
const HOSTS = [
|
|
51
|
+
{
|
|
52
|
+
name: "alias",
|
|
53
|
+
devDependencies: {
|
|
54
|
+
"is-number": "6.0.0",
|
|
55
|
+
"fixture-ee-first": "npm:ee-first@1.1.1",
|
|
56
|
+
"pretty-format": "30.5.1",
|
|
57
|
+
},
|
|
58
|
+
lock: "alias-package-lock.json",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "plain",
|
|
62
|
+
devDependencies: { "is-number": "6.0.0" },
|
|
63
|
+
lock: "plain-package-lock.json",
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
if (process.versions.node !== "22.23.3")
|
|
68
|
+
throw new Error(
|
|
69
|
+
`run this under the updater's Node 22.23.3, not ${process.versions.node}`
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const scratch = mkdtempSync(join(tmpdir(), "lisa-dual-lock-seed-"));
|
|
73
|
+
const STAGE = join(scratch, "record");
|
|
74
|
+
const SEED = join(STAGE, "seed");
|
|
75
|
+
mkdirSync(join(SEED, "npm"), { recursive: true });
|
|
76
|
+
mkdirSync(join(SEED, "bun"), { recursive: true });
|
|
77
|
+
const env = {
|
|
78
|
+
PATH: process.env.PATH ?? "/usr/bin:/bin",
|
|
79
|
+
HOME: join(scratch, "home"),
|
|
80
|
+
LANG: "C.UTF-8",
|
|
81
|
+
LC_ALL: "C.UTF-8",
|
|
82
|
+
TZ: "UTC",
|
|
83
|
+
COPYFILE_DISABLE: "1",
|
|
84
|
+
NPM_CONFIG_USERCONFIG: join(scratch, "npmrc"),
|
|
85
|
+
NPM_CONFIG_GLOBALCONFIG: join(scratch, "global-npmrc"),
|
|
86
|
+
NPM_CONFIG_CACHE: join(SEED, "npm"),
|
|
87
|
+
NPM_CONFIG_REGISTRY: REGISTRY,
|
|
88
|
+
NPM_CONFIG_UPDATE_NOTIFIER: "false",
|
|
89
|
+
BUN_INSTALL_CACHE_DIR: join(SEED, "bun"),
|
|
90
|
+
BUN_FEATURE_FLAG_DISABLE_NATIVE_DEPENDENCY_LINKER: "1",
|
|
91
|
+
};
|
|
92
|
+
mkdirSync(env.HOME);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Drop the links Bun's cache keeps beside each package, and the folders that
|
|
96
|
+
* held only links. Bun writes them as absolute paths into this folder, so they
|
|
97
|
+
* would point outside any copy, and the updater refuses a seed holding a link.
|
|
98
|
+
* Bun reads a package from its `name@version` folder without them.
|
|
99
|
+
* @param {string} folder - A folder inside the seed.
|
|
100
|
+
*/
|
|
101
|
+
function dropLinks(folder) {
|
|
102
|
+
for (const name of readdirSync(folder)) {
|
|
103
|
+
const path = join(folder, name);
|
|
104
|
+
const entry = lstatSync(path);
|
|
105
|
+
if (entry.isSymbolicLink()) rmSync(path);
|
|
106
|
+
else if (entry.isDirectory()) {
|
|
107
|
+
dropLinks(path);
|
|
108
|
+
if (readdirSync(path).length === 0) rmSync(path, { recursive: true });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Run one recording command, and stop on a failure it did not expect.
|
|
115
|
+
* @param {string} cwd - Where to run it.
|
|
116
|
+
* @param {string} command - The program.
|
|
117
|
+
* @param {string[]} args - Its arguments.
|
|
118
|
+
* @param {number[]} [allowed] - Exit codes that are not a failure.
|
|
119
|
+
* @param {NodeJS.ProcessEnv} [runEnv] - Its environment.
|
|
120
|
+
*/
|
|
121
|
+
function run(cwd, command, args, allowed = [0], runEnv = env) {
|
|
122
|
+
const done = spawnSync(command, args, {
|
|
123
|
+
cwd,
|
|
124
|
+
env: runEnv,
|
|
125
|
+
encoding: "utf8",
|
|
126
|
+
timeout: 600_000,
|
|
127
|
+
});
|
|
128
|
+
if (done.error !== undefined || !allowed.includes(done.status ?? -1))
|
|
129
|
+
throw new Error(
|
|
130
|
+
`${command} ${args.join(" ")} failed (${done.status}): ${done.stderr}`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
for (const host of HOSTS) {
|
|
136
|
+
const cwd = join(scratch, host.name);
|
|
137
|
+
mkdirSync(cwd);
|
|
138
|
+
writeFileSync(
|
|
139
|
+
join(cwd, "package.json"),
|
|
140
|
+
JSON.stringify({
|
|
141
|
+
name: "anonymous-dual-lock-host",
|
|
142
|
+
version: "1.0.0",
|
|
143
|
+
private: true,
|
|
144
|
+
devDependencies: host.devDependencies,
|
|
145
|
+
})
|
|
146
|
+
);
|
|
147
|
+
// Resolving reads install packuments the suite never needs, since it
|
|
148
|
+
// installs from this lock, so it gets a cache of its own.
|
|
149
|
+
run(cwd, "npm", ["install", "--package-lock-only", ...FLAGS], [0], {
|
|
150
|
+
...env,
|
|
151
|
+
NPM_CONFIG_CACHE: join(scratch, "resolve-cache"),
|
|
152
|
+
});
|
|
153
|
+
writeFileSync(
|
|
154
|
+
join(STAGE, host.lock),
|
|
155
|
+
readFileSync(join(cwd, "package-lock.json"))
|
|
156
|
+
);
|
|
157
|
+
// The suite's baseline, then the updater's prepare, in their order.
|
|
158
|
+
run(cwd, "npm", ["ci", ...FLAGS]);
|
|
159
|
+
run(cwd, "bun", BUN_LOCK);
|
|
160
|
+
run(cwd, "bun", BUN_FROZEN);
|
|
161
|
+
run(cwd, "npm", ["outdated", "--json", "--long"], [0, 1]);
|
|
162
|
+
run(cwd, "npm", ["view", UPDATE, "--json"]);
|
|
163
|
+
run(cwd, "npm", [
|
|
164
|
+
"install",
|
|
165
|
+
UPDATE,
|
|
166
|
+
"--save-exact",
|
|
167
|
+
"--package-lock-only",
|
|
168
|
+
"--save-dev",
|
|
169
|
+
...FLAGS,
|
|
170
|
+
]);
|
|
171
|
+
run(cwd, "bun", [...BUN_LOCK, ...AT_REGISTRY]);
|
|
172
|
+
run(cwd, "npm", ["ci", ...FLAGS]);
|
|
173
|
+
run(cwd, "bun", [...BUN_FROZEN, ...AT_REGISTRY]);
|
|
174
|
+
}
|
|
175
|
+
dropLinks(SEED);
|
|
176
|
+
// Bun's extracted packages are package source, not registry data: the suite
|
|
177
|
+
// extracts the one it needs from npm's recorded, integrity-checked tarball.
|
|
178
|
+
for (const name of readdirSync(join(SEED, "bun")))
|
|
179
|
+
if (lstatSync(join(SEED, "bun", name)).isDirectory())
|
|
180
|
+
rmSync(join(SEED, "bun", name), { recursive: true });
|
|
181
|
+
// npm's debug logs name local paths, and nothing offline reads them.
|
|
182
|
+
rmSync(join(SEED, "npm", "_logs"), { force: true, recursive: true });
|
|
183
|
+
// No local owner, extended attributes or macOS metadata in the archive.
|
|
184
|
+
run(STAGE, "tar", [
|
|
185
|
+
"-czf",
|
|
186
|
+
ARCHIVE,
|
|
187
|
+
"--uid",
|
|
188
|
+
"0",
|
|
189
|
+
"--gid",
|
|
190
|
+
"0",
|
|
191
|
+
"--uname",
|
|
192
|
+
"",
|
|
193
|
+
"--gname",
|
|
194
|
+
"",
|
|
195
|
+
"--no-xattrs",
|
|
196
|
+
"--no-mac-metadata",
|
|
197
|
+
"seed",
|
|
198
|
+
...HOSTS.map(host => host.lock),
|
|
199
|
+
]);
|
|
200
|
+
} finally {
|
|
201
|
+
rmSync(scratch, { force: true, recursive: true });
|
|
202
|
+
}
|
|
203
|
+
console.log(`recorded ${ARCHIVE}`);
|
|
@@ -188,6 +188,7 @@ scripts/lib/npm-update-allocate.mjs
|
|
|
188
188
|
scripts/lib/npm-update-authorization.mjs
|
|
189
189
|
scripts/lib/npm-update-broker-client.mjs
|
|
190
190
|
scripts/lib/npm-update-bun.mjs
|
|
191
|
+
scripts/lib/npm-update-cache-seed.mjs
|
|
191
192
|
scripts/lib/npm-update-cancel-origin.mjs
|
|
192
193
|
scripts/lib/npm-update-cancellation-proof.mjs
|
|
193
194
|
scripts/lib/npm-update-cancellation.mjs
|
|
@@ -265,14 +266,17 @@ scripts/lib/push-timing.mjs
|
|
|
265
266
|
scripts/lib/reusable-workflow-load-adapter.mjs
|
|
266
267
|
scripts/lib/reusable-workflow-load-failure.mjs
|
|
267
268
|
scripts/lib/reusable-workflow-load-scan.mjs
|
|
269
|
+
scripts/lib/tracker-row-fold.mjs
|
|
268
270
|
scripts/lib/usage-artifact-ref.mjs
|
|
269
271
|
scripts/lib/usage-effectiveness.mjs
|
|
270
272
|
scripts/lib/usage-ledger-integrity.mjs
|
|
271
273
|
scripts/lib/usage-ledger.mjs
|
|
272
274
|
scripts/lib/windows-process-job.mjs
|
|
275
|
+
scripts/lib/work-item-estimate-actual.mjs
|
|
273
276
|
scripts/lib/work-item-estimate-calibration.mjs
|
|
274
277
|
scripts/lib/work-item-estimate-check.mjs
|
|
275
278
|
scripts/lib/work-item-estimate-config.mjs
|
|
279
|
+
scripts/lib/work-item-estimate-tally.mjs
|
|
276
280
|
scripts/lib/work-item-estimate.mjs
|
|
277
281
|
scripts/lib/worktree-dependencies.mjs
|
|
278
282
|
scripts/lisa-hooks/worktree-binding-guard.mjs
|