@codyswann/lisa 2.165.8 → 2.166.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 (89) hide show
  1. package/cdk/package-lisa/package.lisa.json +4 -1
  2. package/dist/codex/scripts/block-no-verify.sh +1 -1
  3. package/expo/create-only/stryker.conf.json +28 -0
  4. package/expo/package-lisa/package.lisa.json +3 -0
  5. package/nestjs/package-lisa/package.lisa.json +4 -1
  6. package/package.json +1 -1
  7. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  8. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  9. package/plugins/lisa/hooks/block-no-verify.agy.sh +1 -1
  10. package/plugins/lisa/hooks/block-no-verify.sh +4 -5
  11. package/plugins/lisa/rules/eager/base-rules.md +1 -0
  12. package/plugins/lisa/rules/eager/security-audit-handling.md +8 -2
  13. package/plugins/lisa/rules/reference/base-rules.md +1 -0
  14. package/plugins/lisa/rules/reference/security-audit-handling.md +8 -2
  15. package/plugins/lisa-agy/hooks/block-no-verify.agy.sh +1 -1
  16. package/plugins/lisa-agy/plugin.json +1 -1
  17. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  18. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  19. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  20. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  21. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  23. package/plugins/lisa-copilot/hooks/block-no-verify.sh +4 -5
  24. package/plugins/lisa-copilot/rules/eager/base-rules.md +1 -0
  25. package/plugins/lisa-copilot/rules/eager/security-audit-handling.md +8 -2
  26. package/plugins/lisa-copilot/rules/reference/base-rules.md +1 -0
  27. package/plugins/lisa-copilot/rules/reference/security-audit-handling.md +8 -2
  28. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  29. package/plugins/lisa-cursor/hooks/block-no-verify.sh +4 -5
  30. package/plugins/lisa-cursor/rules/base-rules-reference.mdc +1 -0
  31. package/plugins/lisa-cursor/rules/base-rules.mdc +1 -0
  32. package/plugins/lisa-cursor/rules/security-audit-handling-reference.mdc +8 -2
  33. package/plugins/lisa-cursor/rules/security-audit-handling.mdc +8 -2
  34. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  36. package/plugins/lisa-expo-agy/plugin.json +1 -1
  37. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  41. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  42. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  46. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  47. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  51. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  52. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  56. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  57. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  61. package/plugins/lisa-rails-agy/plugin.json +1 -1
  62. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  66. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  67. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  71. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  72. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  74. package/plugins/src/base/hooks/block-no-verify.agy.sh +1 -1
  75. package/plugins/src/base/hooks/block-no-verify.sh +4 -5
  76. package/plugins/src/base/rules/eager/base-rules.md +1 -0
  77. package/plugins/src/base/rules/eager/security-audit-handling.md +8 -2
  78. package/plugins/src/base/rules/reference/base-rules.md +1 -0
  79. package/plugins/src/base/rules/reference/security-audit-handling.md +8 -2
  80. package/rails/copy-contents/scripts/lisa-mutation.sh +72 -0
  81. package/rails/copy-overwrite/Gemfile.lisa +5 -0
  82. package/rails/copy-overwrite/lefthook.yml +4 -0
  83. package/rails/create-only/.mutant.yml +21 -0
  84. package/rails/create-only/mutation.gate.yml +8 -0
  85. package/typescript/copy-contents/.husky/pre-push +14 -0
  86. package/typescript/copy-contents/scripts/lisa-mutation.mjs +152 -0
  87. package/typescript/create-only/mutation.gate.json +4 -0
  88. package/typescript/create-only/stryker.conf.json +23 -0
  89. package/typescript/package-lisa/package.lisa.json +4 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "2.165.8",
3
+ "version": "2.166.1",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (migration write-protection)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "2.165.8",
3
+ "version": "2.166.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "2.165.8",
3
+ "version": "2.166.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, across Claude and Codex.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "2.165.8",
3
+ "version": "2.166.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "2.165.8",
3
+ "version": "2.166.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "2.165.8",
3
+ "version": "2.166.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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": "2.165.8",
3
+ "version": "2.166.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"
@@ -25,7 +25,7 @@ allow() {
25
25
  }
26
26
 
27
27
  deny() {
28
- printf '%s\n' '{"decision":"deny","reason":"This command bypasses Lisa pre-commit/pre-push quality gates (--no-verify, HUSKY=0, or core.hooksPath disabling). Fix the underlying issue (lint, tests, formatting) or ask the user before bypassing."}'
28
+ printf '%s\n' '{"decision":"deny","reason":"This command bypasses Lisa pre-commit/pre-push quality gates (--no-verify, HUSKY=0, or core.hooksPath disabling). Fix the underlying issue (security audit, lint, typecheck, tests, formatting) instead. If a fix is genuinely impossible, ask the user to make the risk-acceptance decision and add a specific documented ignore; never bypass the hook."}'
29
29
  exit 0
30
30
  }
31
31
 
@@ -91,11 +91,10 @@ PY
91
91
  then
92
92
  cat >&2 <<'EOF'
93
93
  Blocked: this command bypasses pre-commit/pre-push hooks (--no-verify, HUSKY=0,
94
- or core.hooksPath disabling). Fix the underlying issue (lint error, failing
95
- test, formatting) or ask the user before bypassing.
96
-
97
- If the user has explicitly authorized the bypass for this specific command,
98
- re-run after they confirm.
94
+ or core.hooksPath disabling). Fix the underlying issue (security audit, lint,
95
+ typecheck, tests, formatting) instead. If a fix is genuinely impossible, ask the
96
+ user to make the risk-acceptance decision and add a specific documented ignore;
97
+ never bypass the hook.
99
98
  EOF
100
99
  exit 2
101
100
  fi
@@ -25,6 +25,7 @@ Do not begin work if there are blockers, ambiguities, access requirements, or un
25
25
  ## Git Discipline
26
26
 
27
27
  - **Never use `--no-verify`** or bypass any git hook.
28
+ - When a hook or quality gate fails, fix the root cause first. If no fix is genuinely possible, ask the user to make the risk-acceptance decision and add a specific documented ignore; never use a blanket bypass.
28
29
  - **Never bypass branch protection** — no `--admin`, `--force`, no merging a PR with failing CI. "Green in CI" is the definition of done.
29
30
  - Never commit directly to environment branches (`dev`, `staging`, `main`).
30
31
  - Prefix `git push` with `GIT_SSH_COMMAND="ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=5"`.
@@ -1,6 +1,12 @@
1
1
  # Security Audit Handling (load-bearing)
2
2
 
3
- If `git push` fails because the pre-push hook reports security vulnerabilities, follow the rules below. **Never use `--no-verify`** to bypass the security audit.
3
+ If `git push` fails because the pre-push hook reports security vulnerabilities, follow the rules below. **Never use `--no-verify`**, `HUSKY=0`, `core.hooksPath`, or any other hook bypass to skip the security audit.
4
+
5
+ ## Fix before ignore
6
+
7
+ 1. Fix the root cause first: upgrade or override the actually-vulnerable leaf package to a patched compatible version, regenerate the lockfile, and retry the gate.
8
+ 2. Only if no safe fix exists, ask the user to make the risk-acceptance decision. Add a narrow documented ignore for the specific advisory, package, and reason.
9
+ 3. Never add a blanket audit bypass, lower an audit level, or self-approve a new risk-acceptance entry.
4
10
 
5
11
  ## Core rule
6
12
 
@@ -17,7 +23,7 @@ Before adding any override, verify:
17
23
 
18
24
  1. Note GHSA ID, package, advisory URL.
19
25
  2. If a patched version exists: add a resolution AND override in `package.json` for the leaf package, regenerate the lockfile, commit, retry.
20
- 3. If no patch but safe (transitive, no untrusted input, dev/build only): add an exclusion to `audit.ignore.local.json` with `{"id", "package", "reason"}`, commit, retry.
26
+ 3. If no patch but safe (transitive, no untrusted input, dev/build only): ask the user to make the risk-acceptance decision, then add an exclusion to `audit.ignore.local.json` with `{"id", "package", "reason"}`, commit, retry.
21
27
 
22
28
  ## Rails (bundler-audit)
23
29
 
@@ -50,6 +50,7 @@ Git Discipline:
50
50
  - Prefix git push with `GIT_SSH_COMMAND="ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=5"`.
51
51
  - Never commit directly to an environment branch (dev, staging, main).
52
52
  - Never use --no-verify or attempt to bypass a git hook.
53
+ - When a pre-commit, pre-push, CI, or other quality gate fails, fix the root cause first: upgrade the vulnerable dependency, fix the lint/type/test failure, remove the secret, or repair the failing check. If a fix is genuinely impossible, ask the user to make the risk-acceptance decision and add a narrow, documented ignore for the specific failing rule or advisory. Never use `--no-verify`, hook environment switches, blanket ignores, or threshold reductions as a substitute for fixing the gate.
53
54
  - Never bypass branch protection. Never use `--admin`, `--force`, or any other flag to merge a PR that has failing CI checks. If CI fails, fix it. If you cannot fix it, escalate to the human. There are zero exceptions. "Green in CI" is the definition of done — not "green locally." A PR is not complete until CI passes on the actual PR branch.
54
55
  - Never stash changes you cannot commit. Either fix whatever is preventing the commit or fail out and let the human know why.
55
56
  - Never add "BREAKING CHANGE" to a commit message unless there is actually a breaking change.
@@ -1,13 +1,19 @@
1
1
  # Security Audit Handling
2
2
 
3
- If `git push` fails because the pre-push hook reports security vulnerabilities, follow these steps. Never use `--no-verify` to bypass the security audit.
3
+ If `git push` fails because the pre-push hook reports security vulnerabilities, follow these steps. Never use `--no-verify`, `HUSKY=0`, `core.hooksPath`, or any other hook bypass to skip the security audit.
4
+
5
+ ## Fix before ignore
6
+
7
+ 1. Fix the root cause first: upgrade or override the actually-vulnerable leaf package to a patched compatible version, regenerate the lockfile, and retry the gate.
8
+ 2. Only if no safe fix exists, ask the user to make the risk-acceptance decision. Add a narrow documented ignore for the specific advisory, package, and reason.
9
+ 3. Never add a blanket audit bypass, lower an audit level, or self-approve a new risk-acceptance entry.
4
10
 
5
11
  ## Node.js Projects (GHSA advisories)
6
12
 
7
13
  1. Note the GHSA ID(s), affected package(s), and advisory URL from the error output
8
14
  2. Check the advisory URL to determine if a patched version of the vulnerable package exists
9
15
  3. If a patched version exists: add a resolution/override in package.json to force the patched version (add to both `resolutions` and `overrides` sections), then run the package manager install command to regenerate the lockfile, commit the changes, and retry the push
10
- 4. If no patched version exists and the vulnerability is safe for this project (e.g., transitive dependency with no untrusted input, devDeps only, or build tool only): add an exclusion entry to `audit.ignore.local.json` with the format `{"id": "GHSA-xxx", "package": "pkg-name", "reason": "why this is safe for this project"}`, then commit and retry the push
16
+ 4. If no patched version exists and the vulnerability is safe for this project (e.g., transitive dependency with no untrusted input, devDeps only, or build tool only): ask the user to make the risk-acceptance decision, then add an exclusion entry to `audit.ignore.local.json` with the format `{"id": "GHSA-xxx", "package": "pkg-name", "reason": "why this is safe for this project"}`, then commit and retry the push
11
17
 
12
18
  ### Critical: Override the vulnerable package, not its parent
13
19
 
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env bash
2
+ # This file is managed by Lisa.
3
+ # -----------------------------------------------------------------------------
4
+ # Mutation-testing gate (mutant) for Rails
5
+ # -----------------------------------------------------------------------------
6
+ # Opt-in, diff-only mutation-testing gate shared by the lefthook pre-push hook
7
+ # and CI.
8
+ #
9
+ # Behavior:
10
+ # 1. Reads `mutation.gate.yml`. If the gate is disabled (the default), it
11
+ # prints a notice and exits 0 — pushes and CI are never slowed down until a
12
+ # project explicitly opts in.
13
+ # 2. When enabled, it runs mutant with `--since <ref>` so only code changed on
14
+ # this branch (vs the configured `since` ref) is mutated. Mutation testing
15
+ # is slow, so a full-suite run is never done by this gate.
16
+ # 3. The subjects to mutate are defined in `.mutant.yml` (matcher.subjects);
17
+ # mutant exits non-zero when surviving mutants remain in the changed code,
18
+ # which fails the gate.
19
+ #
20
+ # NOTE: mutant is commercially licensed for closed-source projects (free for
21
+ # open source). Enabling this gate requires a valid license or switching
22
+ # the integration to a permissively licensed alternative.
23
+ #
24
+ # Configuration (`mutation.gate.yml`, project-owned / create-only):
25
+ # enabled: false
26
+ # since: main
27
+ #
28
+ # Overridable via env: MUTATION_ENABLED=true|false, MUTATION_SINCE=<ref>.
29
+ # -----------------------------------------------------------------------------
30
+ set -euo pipefail
31
+
32
+ GATE_FILE="mutation.gate.yml"
33
+
34
+ read_gate() {
35
+ local key="$1" default="$2"
36
+ if [ -f "$GATE_FILE" ] && command -v ruby >/dev/null 2>&1; then
37
+ ruby -ryaml -e "puts (YAML.load_file('${GATE_FILE}') || {}).fetch('${key}', '${default}')" 2>/dev/null || echo "$default"
38
+ else
39
+ echo "$default"
40
+ fi
41
+ }
42
+
43
+ ENABLED="${MUTATION_ENABLED:-$(read_gate enabled false)}"
44
+ SINCE="${MUTATION_SINCE:-$(read_gate since main)}"
45
+
46
+ if [ "$ENABLED" != "true" ]; then
47
+ echo "⚪ Mutation-testing gate disabled (mutation.gate.yml: enabled: false). Skipping."
48
+ echo " Set enabled: true (and configure matcher.subjects in .mutant.yml) to turn it on."
49
+ exit 0
50
+ fi
51
+
52
+ # Only mutate when changed Ruby files exist under app/ or lib/.
53
+ BASE=""
54
+ for ref in "origin/${SINCE}" "${SINCE}"; do
55
+ if BASE="$(git merge-base "$ref" HEAD 2>/dev/null)"; then
56
+ [ -n "$BASE" ] && break
57
+ fi
58
+ done
59
+
60
+ if [ -z "$BASE" ]; then
61
+ echo "⚪ Mutation gate: could not resolve a merge-base against '${SINCE}'. Skipping."
62
+ exit 0
63
+ fi
64
+
65
+ CHANGED="$(git diff --name-only --diff-filter=ACMR "${BASE}...HEAD" -- 'app/**/*.rb' 'lib/**/*.rb' || true)"
66
+ if [ -z "$CHANGED" ]; then
67
+ echo "⚪ Mutation gate: no changed Ruby files under app/ or lib/ vs ${SINCE}. Nothing to mutate."
68
+ exit 0
69
+ fi
70
+
71
+ echo "🧬 Mutation gate: running mutant (--since ${SINCE}) on changed subjects..."
72
+ exec bundle exec mutant run --since "$SINCE"
@@ -31,6 +31,11 @@ group :development, :test do
31
31
  gem "flog", "~> 4.8", require: false
32
32
  gem "flay", "~> 2.13", require: false
33
33
 
34
+ # Mutation testing (opt-in gate — see mutation.gate.yml / scripts/lisa-mutation.sh).
35
+ # NOTE: mutant is commercially licensed for closed-source projects (free for OSS).
36
+ # The gate is disabled by default, so the gem is never invoked until opted in.
37
+ gem "mutant-rspec", "~> 0.12", require: false
38
+
34
39
  # Security
35
40
  gem "brakeman", "~> 7.0", require: false
36
41
  gem "bundler-audit", "~> 0.9", require: false
@@ -28,3 +28,7 @@ pre-push:
28
28
  run: bundle exec flog --all --group app/ lib/
29
29
  flay:
30
30
  run: bundle exec flay app/ lib/
31
+ mutation:
32
+ # Opt-in, diff-only mutation gate. Self-skips instantly when disabled
33
+ # (mutation.gate.yml: enabled: false), so it adds no cost until opted in.
34
+ run: bash scripts/lisa-mutation.sh
@@ -0,0 +1,21 @@
1
+ # Mutant configuration (project-owned).
2
+ # Docs: https://github.com/mbj/mutant/blob/main/docs/configuration.md
3
+ #
4
+ # The gate runs `mutant run --since <ref>` (see scripts/lisa-mutation.sh), so
5
+ # only code changed on the branch is mutated. Define the subject scope below —
6
+ # replace the example matcher with your application's top-level namespace(s).
7
+ ---
8
+ integration:
9
+ name: rspec
10
+ # `usage` must reflect your license: opensource | commercial | restricted.
11
+ usage: opensource
12
+ requires:
13
+ - ./config/environment
14
+ includes:
15
+ - app
16
+ - lib
17
+ matcher:
18
+ # Replace with your app's namespace(s), e.g. ["MyApp*"]. Mutant will only
19
+ # mutate subjects matching these expressions that are also in the diff.
20
+ subjects:
21
+ - '*'
@@ -0,0 +1,8 @@
1
+ # Mutation-testing gate toggle (project-owned).
2
+ # Flip `enabled` to true to turn on the diff-only mutant gate in the pre-push
3
+ # hook and CI. The mutation subjects are configured in `.mutant.yml`.
4
+ #
5
+ # NOTE: mutant requires a commercial license for closed-source projects.
6
+ ---
7
+ enabled: false
8
+ since: main
@@ -224,6 +224,20 @@ if [ $? -ne 0 ]; then
224
224
  exit 1
225
225
  fi
226
226
 
227
+ # Run mutation-testing gate - only if script exists.
228
+ # The test:mutation script self-skips instantly when the gate is disabled
229
+ # (mutation.gate.json: "enabled": false), so this adds no cost to projects that
230
+ # have not opted in. When enabled, it runs Stryker diff-only on changed files
231
+ # and fails the push when the mutation score is below thresholds.break.
232
+ if jq -e '.scripts["test:mutation"]' package.json >/dev/null 2>&1; then
233
+ echo "🧬 Running mutation-testing gate..."
234
+ $RUNNER test:mutation
235
+ if [ $? -ne 0 ]; then
236
+ echo "❌ Mutation-testing gate failed (mutation score below threshold). Strengthen tests before pushing."
237
+ exit 1
238
+ fi
239
+ fi
240
+
227
241
  # Run Lighthouse CI performance audit (only if installed)
228
242
  # Disable Lighthouse beause it takes too long to run on push. Just let it run in ci/cd
229
243
  # Check if lighthouse:check script exists in package.json
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env node
2
+ // This file is managed by Lisa.
3
+ // -----------------------------------------------------------------------------
4
+ // Mutation-testing gate (StrykerJS)
5
+ // -----------------------------------------------------------------------------
6
+ // Opt-in, diff-only mutation-testing gate shared by the pre-push hook and CI.
7
+ //
8
+ // Behavior:
9
+ // 1. Reads `mutation.gate.json`. If the gate is disabled (the default), it
10
+ // prints a notice and exits 0 — pushes and CI are never slowed down until
11
+ // a project explicitly opts in.
12
+ // 2. When enabled, it computes the source files changed on this branch
13
+ // (vs the merge-base with the configured `since` ref) and runs Stryker on
14
+ // ONLY those files. Mutation testing is slow, so a full-repo run is never
15
+ // done by this gate.
16
+ // 3. The mutation-score threshold itself lives in `stryker.conf.*`
17
+ // (`thresholds.break`) — Stryker exits non-zero when the score is below it,
18
+ // which fails the gate.
19
+ //
20
+ // Configuration (`mutation.gate.json`, project-owned / create-only):
21
+ // { "enabled": false, "since": "main" }
22
+ //
23
+ // Overridable via env: MUTATION_ENABLED=true|false, MUTATION_SINCE=<ref>.
24
+ // -----------------------------------------------------------------------------
25
+
26
+ import fs from "node:fs";
27
+ import path from "node:path";
28
+ import { execFileSync, spawnSync } from "node:child_process";
29
+
30
+ const CWD = process.cwd();
31
+
32
+ const readGate = () => {
33
+ const gatePath = path.join(CWD, "mutation.gate.json");
34
+ if (!fs.existsSync(gatePath)) {
35
+ return { enabled: false, since: "main" };
36
+ }
37
+ try {
38
+ return JSON.parse(fs.readFileSync(gatePath, "utf8"));
39
+ } catch (err) {
40
+ console.error(`⚠️ Could not parse mutation.gate.json: ${err.message}`);
41
+ return { enabled: false, since: "main" };
42
+ }
43
+ };
44
+
45
+ const envFlag = name => {
46
+ const v = process.env[name];
47
+ if (v === undefined) return undefined;
48
+ return v === "true" || v === "1";
49
+ };
50
+
51
+ const gate = readGate();
52
+ const enabled = envFlag("MUTATION_ENABLED") ?? gate.enabled === true;
53
+ const since = process.env.MUTATION_SINCE || gate.since || "main";
54
+
55
+ if (!enabled) {
56
+ console.log(
57
+ '⚪ Mutation-testing gate disabled (mutation.gate.json: "enabled": false). Skipping.\n' +
58
+ ' Flip "enabled": true (and tune thresholds.break in stryker.conf.json) to turn it on.'
59
+ );
60
+ process.exit(0);
61
+ }
62
+
63
+ // --- Resolve the diff base (merge-base with the `since` ref) -----------------
64
+ // stderr is ignored: failed merge-base/diff probes are expected (e.g. a missing
65
+ // origin/<ref> candidate) and handled by the surrounding try/catch.
66
+ const git = args =>
67
+ execFileSync("git", args, {
68
+ cwd: CWD,
69
+ encoding: "utf8",
70
+ stdio: ["ignore", "pipe", "ignore"],
71
+ }).trim();
72
+
73
+ let base;
74
+ try {
75
+ // Prefer the remote ref when present (CI checks out detached); fall back to local.
76
+ const candidates = [`origin/${since}`, since];
77
+ let resolved = "";
78
+ for (const ref of candidates) {
79
+ try {
80
+ resolved = git(["merge-base", ref, "HEAD"]);
81
+ if (resolved) break;
82
+ } catch {
83
+ /* try next candidate */
84
+ }
85
+ }
86
+ base = resolved;
87
+ } catch {
88
+ base = "";
89
+ }
90
+
91
+ if (!base) {
92
+ console.log(
93
+ `⚪ Mutation gate: could not resolve a merge-base against "${since}" ` +
94
+ "(shallow clone or unknown ref). Skipping rather than mutating the whole repo."
95
+ );
96
+ process.exit(0);
97
+ }
98
+
99
+ // --- Compute changed, mutate-eligible source files ---------------------------
100
+ const isMutable = f =>
101
+ /\.(ts|tsx)$/.test(f) &&
102
+ !/\.(spec|test)\.(ts|tsx)$/.test(f) &&
103
+ !/\.d\.ts$/.test(f) &&
104
+ !/\.stories\.tsx$/.test(f) &&
105
+ (f.startsWith("src/") || f.startsWith("lib/"));
106
+
107
+ let changed = [];
108
+ try {
109
+ changed = git(["diff", "--name-only", "--diff-filter=ACMR", `${base}...HEAD`])
110
+ .split("\n")
111
+ .map(f => f.trim())
112
+ .filter(Boolean)
113
+ .filter(isMutable)
114
+ .filter(f => fs.existsSync(path.join(CWD, f)));
115
+ } catch (err) {
116
+ console.error(`⚠️ Could not compute changed files: ${err.message}`);
117
+ process.exit(0);
118
+ }
119
+
120
+ if (changed.length === 0) {
121
+ console.log(
122
+ "⚪ Mutation gate: no changed source files vs " +
123
+ since +
124
+ ". Nothing to mutate."
125
+ );
126
+ process.exit(0);
127
+ }
128
+
129
+ console.log(
130
+ `🧬 Mutation gate: running Stryker on ${changed.length} changed file(s):`
131
+ );
132
+ for (const f of changed) console.log(` • ${f}`);
133
+
134
+ // --- Run Stryker on just the changed files (diff-only) -----------------------
135
+ const strykerBin = path.join(
136
+ CWD,
137
+ "node_modules",
138
+ ".bin",
139
+ process.platform === "win32" ? "stryker.cmd" : "stryker"
140
+ );
141
+ const useLocal = fs.existsSync(strykerBin);
142
+ const command = useLocal ? strykerBin : "npx";
143
+ const args = useLocal
144
+ ? ["run", "--mutate", changed.join(",")]
145
+ : ["--yes", "stryker", "run", "--mutate", changed.join(",")];
146
+
147
+ const result = spawnSync(command, args, {
148
+ cwd: CWD,
149
+ stdio: "inherit",
150
+ shell: process.platform === "win32",
151
+ });
152
+ process.exit(result.status ?? 1);
@@ -0,0 +1,4 @@
1
+ {
2
+ "enabled": false,
3
+ "since": "main"
4
+ }