@codyswann/lisa 4.100.6 → 4.101.0

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 (97) hide show
  1. package/all/copy-overwrite/scripts/lisa-gates.mjs +13 -8
  2. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +1 -1
  3. package/dist/codex/scripts/block-migration-edits.sh +39 -64
  4. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  5. package/dist/core/lisa-owned-hash-ledger.js +6 -0
  6. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  7. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  8. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  9. package/dist/core/upstream-evidence-manifest.js +9 -6
  10. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  11. package/dist/opencode/plugin-templates/lisa-block-migration-edits.ts +31 -32
  12. package/package.json +4 -4
  13. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  14. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  15. package/plugins/lisa-agy/plugin.json +1 -1
  16. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  17. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  18. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  19. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  20. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  21. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  23. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  25. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  27. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  28. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  29. package/plugins/lisa-expo-agy/plugin.json +1 -1
  30. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  32. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  34. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  36. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  37. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  41. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +2 -2
  42. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +2 -2
  43. package/plugins/lisa-nestjs/.codex-plugin/skills/nestjs-rules/SKILL.md +14 -7
  44. package/plugins/lisa-nestjs/hooks/block-migration-edits.sh +47 -77
  45. package/plugins/lisa-nestjs/skills/nestjs-rules/SKILL.md +14 -7
  46. package/plugins/lisa-nestjs-agy/plugin.json +2 -2
  47. package/plugins/lisa-nestjs-agy/skills/nestjs-rules/SKILL.md +14 -7
  48. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +2 -2
  49. package/plugins/lisa-nestjs-copilot/hooks/block-migration-edits.sh +47 -77
  50. package/plugins/lisa-nestjs-copilot/skills/nestjs-rules/SKILL.md +14 -7
  51. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +2 -2
  52. package/plugins/lisa-nestjs-cursor/hooks/block-migration-edits.sh +47 -77
  53. package/plugins/lisa-nestjs-cursor/skills/nestjs-rules/SKILL.md +14 -7
  54. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +2 -2
  55. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +2 -2
  56. package/plugins/lisa-nestjs-devin/hooks/block-migration-edits.sh +47 -77
  57. package/plugins/lisa-nestjs-devin/skills/nestjs-rules/SKILL.md +14 -7
  58. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  60. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  61. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  65. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  67. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  68. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  72. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  74. package/plugins/lisa-rails-agy/plugin.json +1 -1
  75. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  79. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  81. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  82. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  86. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  87. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  88. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  89. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  93. package/plugins/src/nestjs/.claude-plugin/plugin.json +1 -1
  94. package/plugins/src/nestjs/hooks/block-migration-edits.sh +47 -77
  95. package/plugins/src/nestjs/skills/nestjs-rules/SKILL.md +14 -7
  96. package/scripts/generate-codex-plugin-artifacts.mjs +1 -1
  97. package/ui/index.html +1 -1
@@ -2,47 +2,43 @@
2
2
  # This file is managed by Lisa.
3
3
  # Do not edit directly — changes will be overwritten on the next `lisa` run.
4
4
 
5
- # PreToolUse hook: block Write/Edit on TypeORM migration files by default.
6
- # This scopes direct edit tools; it does not verify approval or establish the
7
- # provenance of files written through other tools.
8
- # NestJS projects must use `bun run migration:generate` to create migrations
9
- # from entity diffs. Hand-written migrations drift from entity metadata and
10
- # break the schema/migration contract.
11
- # Reference: https://docs.claude.com/en/docs/claude-code/hooks
12
- # Exit code 2 blocks the tool call and surfaces stderr to Claude.
5
+ # PreToolUse hook: WARN on Write/Edit to TypeORM migration files, then let the
6
+ # edit through. The name is historical; renaming it would orphan every
7
+ # installed copy and every `migration-provenance` declaration that points here.
13
8
  #
14
- # WHAT A REFUSAL HOOK OWES THAT AN ON-EDIT HOOK DOES NOT. The five PostToolUse
15
- # scripts may bail out when they cannot run: the write has already happened and
16
- # a skipped lint is a missed report. This one decides whether the write happens
17
- # at all, so a bail-out is a PERMIT — it lets through exactly the edit it exists
18
- # to stop, while reporting success. Every exit below is therefore one of three
19
- # things and never a fourth: out of scope (nothing to judge), judged by the
20
- # project's declared task, or judged by the built-in. "Could not judge" refuses.
9
+ # WHY A WARNING AND NOT A REFUSAL (operator decision, 2026-11-08). The risk a
10
+ # hand-written migration carries is drift from the entity definitions, and
11
+ # that risk only exists when the change COULD have been expressed in an
12
+ # entity. Plenty of migrations cannot be: view options, grants, functions,
13
+ # policies, backfills, seed data. Refusing all of them blocked legitimate work
14
+ # without making the entity route any more likely, so the hook now tells the
15
+ # agent where the change belongs and trusts it to choose.
16
+ # Reference: https://code.claude.com/docs/en/hooks#pretooluse-decision-control
17
+ #
18
+ # HOW THE WARNING REACHES THE MODEL. stderr on exit 0 is not shown to the
19
+ # model, so the warning is printed as PreToolUse JSON on stdout, in
20
+ # `hookSpecificOutput.additionalContext`. No `permissionDecision` is emitted:
21
+ # "allow" would also skip the user's permission prompt, which is a wider
22
+ # grant than "this edit is not refused" and not one this hook is entitled to
23
+ # make. Without a decision the call continues through the normal permission
24
+ # flow.
21
25
 
22
26
  JSON_INPUT=$(cat)
23
27
 
24
28
  # Project rule (host rules, .agents/rules/): never parse JSON in shell with
25
29
  # grep/sed/cut/awk — always use jq.
26
30
  #
27
- # FAIL CLOSED, reversed from the `exit 0` this shipped with. Without jq the
28
- # payload cannot be read at all, so the hook cannot tell a migration edit from
29
- # any other write — and it said so on stderr while permitting the edit anyway,
30
- # which is a guard announcing that it did not check and then waving the write
31
- # through. The refusal is unscoped for the same reason: with no parse there is
32
- # no path to scope it to.
31
+ # Without jq the payload cannot be parsed, so this hook cannot tell a migration
32
+ # edit from any other write, and cannot emit the JSON warning either. It used
33
+ # to fail closed here, which was right while the in-scope answer was "refuse":
34
+ # a bail-out would have permitted exactly the edit the hook existed to stop.
35
+ # The in-scope answer is now "permit with a warning", so permitting here loses
36
+ # only the warning, while refusing would block every write in the project
37
+ # because a WARNING could not be delivered. The stderr note names jq so the
38
+ # operator can see why the warning (and a declared gate) went unconsulted.
33
39
  if ! command -v jq >/dev/null 2>&1; then
34
- cat >&2 <<'MSG'
35
- ❌ Blocked: block-migration-edits cannot inspect this write.
36
-
37
- `jq` is not installed, so the tool payload cannot be parsed — this hook cannot
38
- tell whether the write targets a TypeORM migration. It refuses rather than
39
- permitting an edit it was unable to check.
40
-
41
- Install jq (`brew install jq`, `apt-get install jq`), or declare the
42
- `migration-provenance` gate at `pre-tool` in .lisa.config.json to have your own
43
- check decide instead.
44
- MSG
45
- exit 2
40
+ echo "block-migration-edits: jq is not installed, so this write was not inspected and is permitted without the migration warning, and a declared migration-provenance gate was NOT consulted. Install jq (brew install jq / apt-get install jq) to restore both." >&2
41
+ exit 0
46
42
  fi
47
43
 
48
44
  FILE_PATH=$(printf '%s' "$JSON_INPUT" | jq -r '.tool_input.file_path // empty')
@@ -64,25 +60,17 @@ esac
64
60
  LISA_HOOK_DIR="$(cd "$(dirname "$0")" 2>/dev/null && pwd)"
65
61
 
66
62
  # ---------------------------------------------------------------------------
67
- # Gate façade. The project's declaration decides BEFORE the built-in refuses.
68
- # Full contract, and why an undeclared project sees no change at all, in
69
- # lisa-edit-gate.sh beside this file.
70
- #
71
- # THE WORKING DIRECTORY IS PART OF THE WIRING HERE, which is why this hook was
72
- # left out of the change that wired the five on-edit ones. Those hooks already
73
- # `cd "$CLAUDE_PROJECT_DIR"` to run a tool against the tree; this one acts on
74
- # the payload and never establishes a directory at all. The helper resolves
75
- # .lisa.config.json and the gate registry RELATIVE to the current directory, so
76
- # without the `cd` it would read whatever directory the harness happened to
77
- # launch in and report "nothing declared" for a project that had declared.
63
+ # Gate façade. A project that declares `migration-provenance` at `pre-tool`
64
+ # decides these edits itself, and its decision is a real one: the declared
65
+ # task's non-zero exit refuses the write, a zero exit permits it. Full
66
+ # contract in lisa-edit-gate.sh beside this file.
78
67
  #
79
- # The `cd` is safe for the built-in below because the built-in reads only the
80
- # path out of the payload — nothing it does depends on the working directory.
81
- # That is what keeps an undeclared project on exactly the command, and exactly
82
- # the exit status, it had before.
83
- #
84
- # A project may supply its own `migration-provenance` check for these edits.
85
- # The built-in only refuses the scoped Write/Edit calls.
68
+ # THE WORKING DIRECTORY IS PART OF THE WIRING HERE. The helper resolves
69
+ # .lisa.config.json and the gate registry RELATIVE to the current directory,
70
+ # and a PreToolUse hook establishes none, so without the `cd` it would read
71
+ # whatever directory the harness launched in and report "nothing declared" for
72
+ # a project that had declared. The built-in below reads only the path out of
73
+ # the payload, so the `cd` cannot change what it does.
86
74
  # ---------------------------------------------------------------------------
87
75
  if [ -n "${CLAUDE_PROJECT_DIR:-}" ] &&
88
76
  [ -f "$LISA_HOOK_DIR/lisa-edit-gate.sh" ] &&
@@ -90,36 +78,18 @@ if [ -n "${CLAUDE_PROJECT_DIR:-}" ] &&
90
78
  # shellcheck source=/dev/null
91
79
  . "$LISA_HOOK_DIR/lisa-edit-gate.sh"
92
80
  if LISA_GATE_COMMANDS="$(lisa_edit_gate_tasks pre-tool migration-provenance)"; then
93
- # The declared task's own exit status decides the write: non-zero refuses,
94
- # exactly as the built-in's outright refusal does. A project that declares
95
- # this gate is saying its own check knows which migrations came from the
96
- # model, which is the judgement the built-in makes by refusing them all.
97
81
  lisa_edit_gate_run "$FILE_PATH" "$LISA_GATE_COMMANDS"
98
82
  exit $?
99
83
  fi
100
84
  fi
101
85
 
102
- cat >&2 <<EOF
103
- ❌ Blocked: This default hook refuses Write/Edit on TypeORM migration files.
104
-
105
- File: $FILE_PATH
106
-
107
- Entity files (src/database/entities/*.ts) are the single source of
108
- truth for the database schema in this project. Migrations are a derived
109
- artifact — generate them from entity diffs:
110
-
111
- 1. Edit the entity to express the desired schema.
112
- 2. Run: bun run migration:generate --name=<DescriptiveName>
113
- 3. Review the generated migration; commit entity + migration together.
86
+ WARNING="block-migration-edits: you are writing a TypeORM migration directly (${FILE_PATH}). This is allowed, but check first:
114
87
 
115
- Out-of-band migrations (backfills, seed data, maintenance) cannot always
116
- come from entity diffs. A project that supports these edits can declare a
117
- \`migration-provenance\` check at \`pre-tool\` in .lisa.config.json. The hook
118
- runs that check and uses its result to permit or refuse the edit.
88
+ - Entity files are the source of truth for the database schema.
89
+ - If this change can be expressed in an entity (columns, indexes, relations, constraints), edit the entity instead and run: bun run migration:generate --name=<Name>
90
+ - If it can't (view options, grants, functions, policies, backfills, seed data), writing the migration directly is fine.
91
+ - If you write it by hand, document why in the migration's class comment (a generated migration needs no such note)."
119
92
 
120
- Document the migration's rationale and verification in its class comment.
121
- This default hook cannot verify human approval and does not inspect Bash
122
- writes. Do not switch tools to evade its refusal. See the nestjs-rules skill
123
- for the supported project-check path.
124
- EOF
125
- exit 2
93
+ jq -n --arg ctx "$WARNING" \
94
+ '{hookSpecificOutput: {hookEventName: "PreToolUse", additionalContext: $ctx}}'
95
+ exit 0
@@ -45,7 +45,7 @@ The `--no-spec` flag is used because this project follows TDD (Test-Driven Devel
45
45
 
46
46
  ### Entity Files Are the Source of Truth
47
47
 
48
- In this project, **entity files (`src/database/entities/*.ts`) are the single source of truth for the database schema**. Migrations are a derived artifact — TypeORM diffs the entity metadata against the current database and emits the migration for you. The workflow is always:
48
+ In this project, **entity files (`src/database/entities/*.ts`) are the single source of truth for the database schema**. Migrations are a derived artifact — TypeORM diffs the entity metadata against the current database and emits the migration for you. For any change an entity can express, the workflow is:
49
49
 
50
50
  1. Edit the entity file to express the desired schema.
51
51
  2. Run `bun run migration:generate --name=<DescriptiveName>` to produce the migration from the diff.
@@ -59,23 +59,30 @@ Use `migration:generate` from `package.json` for changes represented by entity m
59
59
  bun run migration:generate --name=<DescriptiveName>
60
60
  ```
61
61
 
62
- ### Out-of-Band Migrations (Seed Data, Backfills)
62
+ ### Hand-Written Migrations
63
63
 
64
- Some changes genuinely cannot be derived from entity diffs:
64
+ Some changes cannot be expressed in an entity, so they cannot come from an entity diff:
65
65
 
66
+ - **Database objects TypeORM does not model** (view options, grants, functions, row-level security policies)
66
67
  - **Seed data** (reference rows, lookup tables, initial admin user)
67
68
  - **Data backfills** (populating a new column from existing rows)
68
69
  - **Data transformations** (splitting a column, normalizing values)
69
70
  - **One-off cleanup** (deleting orphaned rows before a constraint is added)
70
71
  - **Database maintenance** (refreshing planner statistics with `ANALYZE`)
71
72
 
72
- Use the project's established migration process for these cases. Document the rationale and verification in the migration's class comment so future readers understand why it was not generated. Apply the authorization already given for the work; the default edit hook does not record or verify human approval.
73
-
74
- A project that supports direct migration edits can declare its own `migration-provenance` check at `pre-tool` in `.lisa.config.json`. The Claude and Codex hooks run that check for the targeted migration and permit the edit only when it passes. The check must validate the project's migration policy; an unconditional success command proves nothing. Without a declared check, the built-in still refuses the edit. OpenCode's migration adapter currently does not support this exception path and continues to refuse it.
73
+ Writing these migrations directly is fine. The rule is: if the change can be expressed in an entity, edit the entity and run `bun run migration:generate --name=<Name>`; if it can't, write the migration. A hand-written migration documents why it was written by hand, and how it was verified, in its class comment so future readers understand why it was not generated. A generated migration needs no such note.
75
74
 
76
75
  ### Enforcement
77
76
 
78
- The `lisa-nestjs` plugin's default `PreToolUse` hook (`block-migration-edits.sh`) refuses `Write`/`Edit` on paths matching `**/migrations/*.ts` or `**/migrations/*.js`. Codex also inspects `apply_patch`; its migration matcher and OpenCode's matcher cover numbered TypeScript migration filenames. These are direct-edit checks, not an audit of migration authorship: they do not inspect Bash writes. Do not switch tools to evade a refusal. Use the supported project check where available.
77
+ The `lisa-nestjs` plugin's default `PreToolUse` hook (`block-migration-edits.sh`) **warns but does not refuse** `Write`/`Edit` on paths matching `**/migrations/*.ts` or `**/migrations/*.js`. On Claude Code the warning reaches the agent as `additionalContext` and the edit continues through the normal permission flow. The hook keeps its historical name. The point of the warning is drift: a hand-written migration for a change an entity could express will drift from the entity definitions.
78
+
79
+ Per-agent delivery:
80
+
81
+ - **Claude Code** (and the Cursor, Copilot and Devin variants built from the same script): warning as PreToolUse JSON `additionalContext`. Without `jq` the hook cannot parse the payload, so it permits the edit with a note on stderr instead of the warning.
82
+ - **Codex**: also inspects `apply_patch` and matches numbered TypeScript migration filenames. Codex does not honor `additionalContext` on PreToolUse, so the warning is written to stderr and is not known to reach the model.
83
+ - **OpenCode**: `tool.execute.after` appends the warning to the edit/write tool output after the write.
84
+
85
+ A project that wants to enforce its own migration policy can declare a `migration-provenance` check at `pre-tool` in `.lisa.config.json`. The Claude and Codex hooks run that check for the targeted migration instead of warning, and refuse the edit when it fails. The check must validate the project's migration policy; an unconditional success command proves nothing. The declared check needs `jq`: without it the hooks cannot read the target path, so they permit the edit without running the check and say so on stderr. OpenCode's adapter does not run the declared check.
79
86
 
80
87
  ### Why Auto-Generation
81
88
 
@@ -1015,7 +1015,7 @@ function metadataFor(pluginName, claudeManifest) {
1015
1015
  "lisa-nestjs": {
1016
1016
  displayName: "Lisa NestJS",
1017
1017
  description:
1018
- "NestJS-specific skills and migration write-protection hooks.",
1018
+ "NestJS-specific skills and a hand-written migration warning hook.",
1019
1019
  shortDescription: "NestJS workflow guidance",
1020
1020
  longDescription:
1021
1021
  "Lisa skills and lifecycle checks for NestJS GraphQL, TypeORM, and migration-safe development.",
package/ui/index.html CHANGED
@@ -10319,7 +10319,7 @@
10319
10319
  "lisa-expo@lisa":
10320
10320
  "~40 skills (EAS, expo-router, gluestack), ops-specialist agent, Expo MCP",
10321
10321
  "lisa-nestjs@lisa":
10322
- "GraphQL/TypeORM skills, migration-edit blocking",
10322
+ "GraphQL/TypeORM skills, migration-edit warning",
10323
10323
  "lisa-phaser@lisa": "8 skills, 20 game-dev agents, Phaser rules",
10324
10324
  "lisa-rails@lisa":
10325
10325
  "20 skills, rubocop-on-edit, Rails conventions",