@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.
Files changed (116) hide show
  1. package/all/copy-overwrite/scripts/lib/completion-authorization.mjs +28 -0
  2. package/all/copy-overwrite/scripts/lib/completion-proof-adapters.mjs +21 -0
  3. package/all/copy-overwrite/scripts/lib/completion-proof-projection.mjs +25 -41
  4. package/all/copy-overwrite/scripts/lib/completion-proof-shape.mjs +23 -0
  5. package/all/copy-overwrite/scripts/lib/npm-update-bun.mjs +8 -3
  6. package/all/copy-overwrite/scripts/lib/npm-update-cache-seed.mjs +145 -0
  7. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +7 -0
  8. package/all/copy-overwrite/scripts/lib/npm-update-prepare.mjs +34 -6
  9. package/all/copy-overwrite/scripts/lib/tracker-row-fold.mjs +48 -0
  10. package/all/copy-overwrite/scripts/lib/work-item-estimate-actual.mjs +131 -0
  11. package/all/copy-overwrite/scripts/lib/work-item-estimate-calibration.mjs +16 -33
  12. package/all/copy-overwrite/scripts/lib/work-item-estimate-check.mjs +26 -5
  13. package/all/copy-overwrite/scripts/lib/work-item-estimate-config.mjs +21 -0
  14. package/all/copy-overwrite/scripts/lib/work-item-estimate-tally.mjs +272 -0
  15. package/all/copy-overwrite/scripts/lib/work-item-estimate.mjs +60 -31
  16. package/all/copy-overwrite/scripts/lisa-estimate.mjs +60 -9
  17. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +74 -10
  18. package/dist/core/lisa-owned-hash-ledger.json +112 -6
  19. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  20. package/dist/core/upstream-evidence-manifest.json +48 -19
  21. package/dist/utils/usage-accounting-totals.d.ts.map +1 -1
  22. package/dist/utils/usage-accounting-totals.js +6 -1
  23. package/dist/utils/usage-accounting-totals.js.map +1 -1
  24. package/package.json +4 -4
  25. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  27. package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/SKILL.md +1 -0
  28. package/plugins/lisa/.codex-plugin/skills/lisa-usage-accounting/SKILL.md +2 -1
  29. package/plugins/lisa/.codex-plugin/skills/lisa-usage-accounting/references/estimate.md +49 -0
  30. package/plugins/lisa/rules/reference/work-item-definition-of-ready.md +5 -2
  31. package/plugins/lisa/skills/lisa-tracker-evidence/SKILL.md +1 -0
  32. package/plugins/lisa/skills/lisa-usage-accounting/SKILL.md +2 -1
  33. package/plugins/lisa/skills/lisa-usage-accounting/references/estimate.md +49 -0
  34. package/plugins/lisa-agy/plugin.json +1 -1
  35. package/plugins/lisa-agy/skills/lisa-tracker-evidence/SKILL.md +1 -0
  36. package/plugins/lisa-agy/skills/lisa-usage-accounting/SKILL.md +2 -1
  37. package/plugins/lisa-agy/skills/lisa-usage-accounting/references/estimate.md +49 -0
  38. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  40. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  41. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  45. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-copilot/rules/reference/work-item-definition-of-ready.md +5 -2
  47. package/plugins/lisa-copilot/skills/lisa-tracker-evidence/SKILL.md +1 -0
  48. package/plugins/lisa-copilot/skills/lisa-usage-accounting/SKILL.md +2 -1
  49. package/plugins/lisa-copilot/skills/lisa-usage-accounting/references/estimate.md +49 -0
  50. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-cursor/rules/work-item-definition-of-ready-reference.mdc +5 -2
  52. package/plugins/lisa-cursor/skills/lisa-tracker-evidence/SKILL.md +1 -0
  53. package/plugins/lisa-cursor/skills/lisa-usage-accounting/SKILL.md +2 -1
  54. package/plugins/lisa-cursor/skills/lisa-usage-accounting/references/estimate.md +49 -0
  55. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  57. package/plugins/lisa-devin/rules/reference/work-item-definition-of-ready.md +5 -2
  58. package/plugins/lisa-devin/skills/lisa-tracker-evidence/SKILL.md +1 -0
  59. package/plugins/lisa-devin/skills/lisa-usage-accounting/SKILL.md +2 -1
  60. package/plugins/lisa-devin/skills/lisa-usage-accounting/references/estimate.md +49 -0
  61. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  63. package/plugins/lisa-expo-agy/plugin.json +1 -1
  64. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  68. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  70. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  71. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  75. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  77. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  78. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  82. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  84. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  85. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  86. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  89. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  91. package/plugins/lisa-rails-agy/plugin.json +1 -1
  92. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  93. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  94. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  95. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  96. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  98. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  99. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  100. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  101. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  103. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  104. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  105. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  106. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  107. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  108. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  109. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  110. package/plugins/src/base/rules/reference/work-item-definition-of-ready.md +5 -2
  111. package/plugins/src/base/skills/lisa-tracker-evidence/SKILL.md +1 -0
  112. package/plugins/src/base/skills/lisa-usage-accounting/SKILL.md +2 -1
  113. package/plugins/src/base/skills/lisa-usage-accounting/references/estimate.md +49 -0
  114. package/scripts/record-npm-update-dual-lock-seed.mjs +203 -0
  115. package/scripts/two-channel-couplings.json +1 -1
  116. package/typescript/copy-overwrite/.prettierignore +4 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (hand-written migration warning)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (hand-written migration warning)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Ruby on Rails-specific skills and hooks for RuboCop and ast-grep scanning on edit.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "TypeScript-specific hooks for formatting, linting, and ast-grep scanning on edit.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "Distributable LLM Wiki kernel — ingest, query, lint, and maintain a git-native markdown knowledge base across Claude and Codex.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -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). It is `N/A` when the
199
- project turns the requirement off. Nobody is ever asked for an estimate.
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}`);
@@ -169,7 +169,7 @@
169
169
  "workflows": 27,
170
170
  "steps": 890,
171
171
  "couplings": 50,
172
- "inventory": 252
172
+ "inventory": 256
173
173
  },
174
174
  "counts": {
175
175
  "package-backed": 11,
@@ -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