@codyswann/lisa 4.95.4 → 4.96.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 (76) hide show
  1. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  2. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  3. package/dist/core/upstream-evidence-manifest.js +34 -1
  4. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  5. package/package.json +4 -4
  6. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  7. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  8. package/plugins/lisa-agy/plugin.json +1 -1
  9. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  10. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  11. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  12. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  13. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  14. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  15. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  16. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  17. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  18. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  19. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  20. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  21. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  22. package/plugins/lisa-expo-agy/plugin.json +1 -1
  23. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  25. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  27. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  28. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  29. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  30. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  32. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  34. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  36. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  37. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  41. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  43. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  44. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  46. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  48. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  50. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  51. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  55. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  57. package/plugins/lisa-rails-agy/plugin.json +1 -1
  58. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  60. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  62. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  64. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  65. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-typescript-devin/.devin-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/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  76. package/scripts/lisa-ci-failure-redispatch.mjs +161 -22
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "4.95.4",
3
+ "version": "4.96.0",
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": "4.95.4",
3
+ "version": "4.96.0",
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": "4.95.4",
3
+ "version": "4.96.0",
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": "4.95.4",
3
+ "version": "4.96.0",
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": "4.95.4",
3
+ "version": "4.96.0",
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": "4.95.4",
3
+ "version": "4.96.0",
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"
@@ -23,6 +23,15 @@
23
23
  * - Every required check PASSED when each bucket is `pass` or `skipping`.
24
24
  * - Anything else is still running: no write.
25
25
  *
26
+ * What triggers a decision (CodySwannGT/lisa#4678): a CI workflow run, and
27
+ * also a third-party required check (CodeRabbit, GitGuardian) completing on
28
+ * its own schedule — a `check_run` or a `status` event. Those are gated first:
29
+ * a pending status, a context that is not required on the default branch's
30
+ * rulesets, and — defensively, since GitHub does not deliver `check_run` for
31
+ * Actions-created suites and workflow_run covers CI jobs — an Actions-owned
32
+ * check run all end with no write and no further read. A passing gate runs the same pipeline; the
33
+ * decision logic is shared. `--head-sha` re-evaluates a past head by hand.
34
+ *
26
35
  * Writes need positive evidence. A run for a superseded head, a fork PR, a PR
27
36
  * with no or a foreign `Work-Item:`, a closed item, or an item outside the
28
37
  * claimed lane all end with no write.
@@ -48,6 +57,8 @@ const CLEARED_MARKER = /<!-- \[lisa-ci-cleared\] run=\d+ -->/u;
48
57
  /** Any Lisa lifecycle marker — the claim, attempt, and CI markers alike. */
49
58
  const LISA_MARKER = /\[(?:lisa-[a-z0-9-]+|claude-build-intake)\]/u;
50
59
  const NO_REQUIRED = /no (?:required )?checks reported/iu;
60
+ /** Read every page of a REST list as one array of pages. */
61
+ const PAGINATE = Object.freeze(["--paginate", "--slurp"]);
51
62
 
52
63
  /**
53
64
  * The only comment authors whose `[lisa-ci-failed]` / `[lisa-ci-cleared]`
@@ -276,8 +287,7 @@ function readItem(item, repo, gh) {
276
287
  const pages = readJson(gh, [
277
288
  "api",
278
289
  `repos/${repo}/issues/${number}/comments`,
279
- "--paginate",
280
- "--slurp",
290
+ ...PAGINATE,
281
291
  ]);
282
292
  const comments = pages
283
293
  .flat()
@@ -388,8 +398,7 @@ function readEvents(number, repo, gh) {
388
398
  return readJson(gh, [
389
399
  "api",
390
400
  `repos/${repo}/issues/${number}/events`,
391
- "--paginate",
392
- "--slurp",
401
+ ...PAGINATE,
393
402
  ]).flat();
394
403
  }
395
404
 
@@ -574,27 +583,127 @@ export function planRedispatch({ run, repository, contract, gh }) {
574
583
  * Plan a recorded fixture: its event payload plus the gh answers it recorded.
575
584
  * @param {{event: object, gh: object}} fixture - Recorded fixture.
576
585
  * @param {object} contract - Tracker contract.
586
+ * @param {Record<string, string|undefined>} [env] - Environment (`GITHUB_RUN_ID`).
577
587
  * @returns {Plan} Plan.
578
588
  */
579
- export function planFromFixture(fixture, contract) {
580
- return planFromEvent(fixture.event, contract, recordedGh(fixture.gh));
589
+ export function planFromFixture(fixture, contract, env = {}) {
590
+ return planFromEvent(fixture.event, contract, recordedGh(fixture.gh), env);
591
+ }
592
+
593
+ /**
594
+ * The Actions run that is making this decision, when the environment names
595
+ * one. A third-party completion has no CI run of its own, so the run that
596
+ * clears a marker is this re-dispatch run — linkable from the comment.
597
+ * @param {Record<string, string|undefined>} env - Environment.
598
+ * @returns {number|undefined} Positive run id, or undefined.
599
+ */
600
+ function actingRunId(env) {
601
+ const value = String(env.GITHUB_RUN_ID ?? "");
602
+ return /^[1-9]\d*$/u.test(value) ? Number(value) : undefined;
603
+ }
604
+
605
+ /**
606
+ * Reduce a `check_run` or `status` event to the run shape `planRedispatch`
607
+ * reads, plus the context it reports and why it can be ignored outright.
608
+ *
609
+ * The cleared marker records `run=<digits>`, so every mode needs a numeric
610
+ * run id: the acting Actions run (`GITHUB_RUN_ID`) when there is one, else the
611
+ * event's own numeric id (the check run id, or the status id).
612
+ * @param {object} event - Event payload.
613
+ * @param {Record<string, string|undefined>} env - Environment.
614
+ * @returns {{run: object, context: string, ignore?: object}|null} Null for any other event.
615
+ */
616
+ function thirdPartyCompletion(event, env) {
617
+ const repository = event.repository;
618
+ if (event.check_run) {
619
+ const check = event.check_run;
620
+ return {
621
+ context: check.name,
622
+ run: {
623
+ id: actingRunId(env) ?? check.id,
624
+ head_sha: check.head_sha,
625
+ pull_requests: check.pull_requests ?? [],
626
+ repository,
627
+ },
628
+ ignore:
629
+ check.app?.slug === "github-actions"
630
+ ? stop(
631
+ "ignored-actions-check",
632
+ "a check run created by GitHub Actions is covered by workflow_run"
633
+ )
634
+ : undefined,
635
+ };
636
+ }
637
+ if (typeof event.context === "string" && typeof event.state === "string")
638
+ return {
639
+ context: event.context,
640
+ run: {
641
+ id: actingRunId(env) ?? event.id,
642
+ head_sha: event.sha,
643
+ pull_requests: [],
644
+ repository,
645
+ },
646
+ ignore:
647
+ event.state === "pending"
648
+ ? stop("ignored-pending-status", "a pending status has not finished")
649
+ : undefined,
650
+ };
651
+ return null;
652
+ }
653
+
654
+ /**
655
+ * The required status-check contexts on a branch, read from its rulesets.
656
+ * Read live rather than hard-coded, so changing which checks are required
657
+ * needs no change here.
658
+ * @param {string} repo - Repository.
659
+ * @param {string} branch - Branch the rulesets apply to.
660
+ * @param {Function} gh - Runner.
661
+ * @returns {Set<string>} Required contexts.
662
+ */
663
+ function requiredContexts(repo, branch, gh) {
664
+ const rules = readJson(gh, [
665
+ "api",
666
+ `repos/${repo}/rules/branches/${encodeURIComponent(branch)}`,
667
+ ...PAGINATE,
668
+ ]).flat();
669
+ return new Set(
670
+ rules
671
+ .filter(rule => rule.type === "required_status_checks")
672
+ .flatMap(rule => rule.parameters?.required_status_checks ?? [])
673
+ .map(check => check.context)
674
+ );
581
675
  }
582
676
 
583
677
  /**
584
- * Plan a `workflow_run` event payload (or a bare run object).
678
+ * Plan a `workflow_run`, `check_run` or `status` event payload (or a bare run
679
+ * object). A check run or status first has to concern a finished, required,
680
+ * non-Actions context; then it runs the same pipeline a `workflow_run` does.
585
681
  * @param {object} event - Event payload.
586
682
  * @param {object} contract - Tracker contract.
587
683
  * @param {Function} gh - Runner.
684
+ * @param {Record<string, string|undefined>} [env] - Environment.
588
685
  * @returns {Plan} Plan.
589
686
  */
590
- function planFromEvent(event, contract, gh) {
591
- const run = event.workflow_run ?? event;
687
+ function planFromEvent(event, contract, gh, env = {}) {
688
+ const completion = thirdPartyCompletion(event, env);
689
+ const run = completion?.run ?? event.workflow_run ?? event;
592
690
  const repository = run.repository?.full_name ?? event.repository?.full_name;
593
- return {
594
- repository: contract.repository,
595
- runId: run.id,
596
- ...planRedispatch({ run, repository, contract, gh }),
597
- };
691
+ const base = { repository: contract.repository, runId: run.id };
692
+ if (completion?.ignore) return { ...base, ...completion.ignore };
693
+ if (completion) {
694
+ const branch = event.repository?.default_branch ?? "main";
695
+ if (
696
+ !requiredContexts(contract.repository, branch, gh).has(completion.context)
697
+ )
698
+ return {
699
+ ...base,
700
+ ...stop(
701
+ "not-required-context",
702
+ `'${completion.context}' is not a required check on ${branch}`
703
+ ),
704
+ };
705
+ }
706
+ return { ...base, ...planRedispatch({ run, repository, contract, gh }) };
598
707
  }
599
708
 
600
709
  /**
@@ -687,7 +796,7 @@ function describePlan(plan, dryRun) {
687
796
  /**
688
797
  * Parse CLI flags.
689
798
  * @param {string[]} argv - Arguments.
690
- * @returns {{runId?: string, payload?: string, dryRun: boolean}} Options.
799
+ * @returns {{runId?: string, payload?: string, headSha?: string, dryRun: boolean}} Options.
691
800
  */
692
801
  function parseArgs(argv) {
693
802
  const options = { dryRun: false };
@@ -695,25 +804,51 @@ function parseArgs(argv) {
695
804
  if (argv[i] === "--dry-run") options.dryRun = true;
696
805
  else if (argv[i] === "--run-id") options.runId = argv[++i];
697
806
  else if (argv[i] === "--payload") options.payload = argv[++i];
807
+ else if (argv[i] === "--head-sha") options.headSha = argv[++i];
698
808
  else throw new Error(`unknown argument: ${argv[i]}`);
699
809
  }
700
- if (!options.runId === !options.payload)
701
- throw new Error("pass exactly one of --run-id <id> or --payload <file>");
810
+ const sources = [options.runId, options.payload, options.headSha];
811
+ if (sources.filter(Boolean).length !== 1)
812
+ throw new Error(
813
+ "pass exactly one of --run-id <id>, --payload <file> or --head-sha <sha>"
814
+ );
702
815
  if (options.runId !== undefined && !/^[1-9]\d*$/u.test(options.runId))
703
816
  throw new Error(
704
817
  `--run-id must be a positive integer, got '${options.runId}'`
705
818
  );
819
+ if (options.headSha !== undefined && !SHA.test(options.headSha))
820
+ throw new Error(
821
+ `--head-sha must be a full 40-character lowercase commit SHA, got '${options.headSha}'`
822
+ );
706
823
  return options;
707
824
  }
708
825
 
709
826
  /**
710
827
  * Load the event and choose the runner it is read through.
711
- * @param {{runId?: string, payload?: string, dryRun: boolean}} options - Options.
828
+ *
829
+ * `--head-sha` re-evaluates a head whose third-party check already completed
830
+ * (a manual dry run against the past). It names no context, so it skips the
831
+ * required-context gate and runs the pipeline as a bare run; the PR comes from
832
+ * searching for the SHA, and the run id is the acting run (`GITHUB_RUN_ID`),
833
+ * or 0 when there is none — numeric either way, so a cleared marker stays
834
+ * well-formed.
835
+ * @param {{runId?: string, payload?: string, headSha?: string, dryRun: boolean}} options - Options.
712
836
  * @param {object} contract - Tracker contract.
713
837
  * @param {Function} gh - Live runner.
838
+ * @param {Record<string, string|undefined>} env - Environment.
714
839
  * @returns {{event: object, gh: Function}} Event and runner.
715
840
  */
716
- function loadEvent(options, contract, gh) {
841
+ function loadEvent(options, contract, gh, env) {
842
+ if (options.headSha)
843
+ return {
844
+ event: {
845
+ id: actingRunId(env) ?? 0,
846
+ head_sha: options.headSha,
847
+ pull_requests: [],
848
+ repository: { full_name: contract.repository },
849
+ },
850
+ gh,
851
+ };
717
852
  if (options.runId)
718
853
  return {
719
854
  event: readJson(gh, [
@@ -732,23 +867,27 @@ function loadEvent(options, contract, gh) {
732
867
  /**
733
868
  * CLI entry: plan one run and, unless `--dry-run`, apply it.
734
869
  * @param {string[]} argv - Arguments.
735
- * @param {{gh?: Function, write?: Function, contract?: object}} [deps] - Injectables.
870
+ * @param {{gh?: Function, write?: Function, contract?: object, env?: Record<string, string|undefined>}} [deps] - Injectables.
736
871
  * @returns {number} Exit code: 0 decided, 1 failed read/write, 2 bad usage.
737
872
  */
738
873
  export function main(argv, deps = {}) {
739
874
  const write = deps.write ?? (line => process.stdout.write(`${line}\n`));
875
+ const env = deps.env ?? process.env;
740
876
  let options;
741
877
  let source;
742
878
  try {
743
879
  options = parseArgs(argv);
744
880
  const contract = deps.contract ?? trackerContract();
745
- source = { contract, ...loadEvent(options, contract, deps.gh ?? liveGh) };
881
+ source = {
882
+ contract,
883
+ ...loadEvent(options, contract, deps.gh ?? liveGh, env),
884
+ };
746
885
  } catch (error) {
747
886
  write(`lisa-ci-failure-redispatch: ${error.message}`);
748
887
  return 2;
749
888
  }
750
889
  try {
751
- const plan = planFromEvent(source.event, source.contract, source.gh);
890
+ const plan = planFromEvent(source.event, source.contract, source.gh, env);
752
891
  if (!options.dryRun) applyPlan(plan, source.gh);
753
892
  for (const line of describePlan(plan, options.dryRun)) write(line);
754
893
  write(JSON.stringify(plan, null, 2));