@codyswann/lisa 3.17.3 → 3.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/copy-overwrite/scripts/lisa-work-item.mjs +95 -2
- package/dist/cli/ui-ci-quality-jobs-compute.d.ts.map +1 -1
- package/dist/cli/ui-ci-quality-jobs-compute.js +62 -17
- package/dist/cli/ui-ci-quality-jobs-compute.js.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +2 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +12 -7
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/health/agentic.d.ts +11 -0
- package/dist/health/agentic.d.ts.map +1 -1
- package/dist/health/agentic.js +29 -0
- package/dist/health/agentic.js.map +1 -1
- package/package.json +1 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-github-build-intake/SKILL.md +15 -0
- package/plugins/lisa/scripts/automation-run-record.mjs +37 -1
- package/plugins/lisa/scripts/cross-pollinate.mjs +37 -1
- package/plugins/lisa/scripts/design-source-gate.mjs +33 -2
- package/plugins/lisa/scripts/lifecycle-label-trust.mjs +98 -2
- package/plugins/lisa/scripts/plugin-sync-explain.mjs +37 -1
- package/plugins/lisa/skills/lisa-github-build-intake/SKILL.md +15 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/scripts/automation-run-record.mjs +37 -1
- package/plugins/lisa-agy/scripts/cross-pollinate.mjs +37 -1
- package/plugins/lisa-agy/scripts/design-source-gate.mjs +33 -2
- package/plugins/lisa-agy/scripts/lifecycle-label-trust.mjs +98 -2
- package/plugins/lisa-agy/scripts/plugin-sync-explain.mjs +37 -1
- package/plugins/lisa-agy/skills/lisa-github-build-intake/SKILL.md +15 -0
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/scripts/automation-run-record.mjs +37 -1
- package/plugins/lisa-copilot/scripts/cross-pollinate.mjs +37 -1
- package/plugins/lisa-copilot/scripts/design-source-gate.mjs +33 -2
- package/plugins/lisa-copilot/scripts/lifecycle-label-trust.mjs +98 -2
- package/plugins/lisa-copilot/scripts/plugin-sync-explain.mjs +37 -1
- package/plugins/lisa-copilot/skills/lisa-github-build-intake/SKILL.md +15 -0
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/scripts/automation-run-record.mjs +37 -1
- package/plugins/lisa-cursor/scripts/cross-pollinate.mjs +37 -1
- package/plugins/lisa-cursor/scripts/design-source-gate.mjs +33 -2
- package/plugins/lisa-cursor/scripts/lifecycle-label-trust.mjs +98 -2
- package/plugins/lisa-cursor/scripts/plugin-sync-explain.mjs +37 -1
- package/plugins/lisa-cursor/skills/lisa-github-build-intake/SKILL.md +15 -0
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/scripts/automation-run-record.mjs +37 -1
- package/plugins/src/base/scripts/cross-pollinate.mjs +37 -1
- package/plugins/src/base/scripts/design-source-gate.mjs +33 -2
- package/plugins/src/base/scripts/lifecycle-label-trust.mjs +98 -2
- package/plugins/src/base/scripts/plugin-sync-explain.mjs +37 -1
- package/plugins/src/base/skills/lisa-github-build-intake/SKILL.md +15 -0
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
import { createHash } from "node:crypto";
|
|
38
38
|
import fs from "node:fs";
|
|
39
39
|
import path from "node:path";
|
|
40
|
+
import { realpathSync } from "node:fs";
|
|
41
|
+
import { fileURLToPath } from "node:url";
|
|
40
42
|
|
|
41
43
|
const LOCKFILE_REL = path.join(".lisa", "cross-pollination.lock.json");
|
|
42
44
|
const LOCK_VERSION = 1;
|
|
@@ -704,7 +706,41 @@ export function renderReport(p, result) {
|
|
|
704
706
|
}
|
|
705
707
|
|
|
706
708
|
// CLI entrypoint.
|
|
707
|
-
|
|
709
|
+
/**
|
|
710
|
+
* True when `moduleUrl` names the module node was asked to run.
|
|
711
|
+
*
|
|
712
|
+
* Both sides are realpath'd. The previous spelling compared `import.meta.url`
|
|
713
|
+
* against a `file://` string built from `process.argv[1]`, which pits a real
|
|
714
|
+
* path against whatever the caller typed — so reached through a symlinked
|
|
715
|
+
* checkout, a git worktree, or a `/tmp` path on macOS the two disagreed, the
|
|
716
|
+
* body never ran, and the process exited 0 having done nothing. Every
|
|
717
|
+
* Lisa-driven agent runs in a worktree, so that is the routine path, not an
|
|
718
|
+
* exotic one.
|
|
719
|
+
*
|
|
720
|
+
* Written out rather than imported: this ships inside a plugin payload, which
|
|
721
|
+
* has no `./lib/` to resolve against. Same rule and same reasoning as
|
|
722
|
+
* `scripts/lib/invoked-as-script.mjs`.
|
|
723
|
+
*
|
|
724
|
+
* Realpathing BOTH sides matters under `--preserve-symlinks-main`, which tells
|
|
725
|
+
* node not to resolve the main entry: normalizing only `argv[1]` then compares
|
|
726
|
+
* a real path against a symlinked one and answers false for an entry point that
|
|
727
|
+
* WAS invoked directly. Any resolution error returns false — node loaded the
|
|
728
|
+
* entry from that path moments earlier, so a path that will not resolve now is
|
|
729
|
+
* not the path this module came through.
|
|
730
|
+
* @param {string} moduleUrl - The caller's own `import.meta.url`.
|
|
731
|
+
* @param {string | undefined} [argv1] - Entry path; defaults to `process.argv[1]`.
|
|
732
|
+
* @returns {boolean} Whether the caller should run its CLI body.
|
|
733
|
+
*/
|
|
734
|
+
export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
|
|
735
|
+
if (!argv1) return false;
|
|
736
|
+
try {
|
|
737
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
|
|
738
|
+
} catch {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if (invokedAsScript(import.meta.url)) {
|
|
708
744
|
const args = process.argv.slice(2);
|
|
709
745
|
const root = path.resolve(args.find(a => !a.startsWith("-")) ?? ".");
|
|
710
746
|
const dryRun = args.includes("--dry-run") || !args.includes("--write");
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
* Exit 0 = PASS, 1 = FAIL (any violation, or anything unresolvable), 2 = usage.
|
|
36
36
|
*/
|
|
37
37
|
import { execFileSync } from "node:child_process";
|
|
38
|
-
import { readFileSync } from "node:fs";
|
|
38
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
39
|
+
import { fileURLToPath } from "node:url";
|
|
39
40
|
|
|
40
41
|
/** The one designated marker for UI deliberately not captured in Figma. */
|
|
41
42
|
export const DESIGN_SOURCE_NONE_MARKER = "DESIGN-SOURCE: none — not in Figma";
|
|
@@ -534,6 +535,36 @@ export function runCli(argv) {
|
|
|
534
535
|
return result.verdict === "PASS" ? 0 : 1;
|
|
535
536
|
}
|
|
536
537
|
|
|
537
|
-
|
|
538
|
+
/**
|
|
539
|
+
* True when `moduleUrl` names the module node was asked to run.
|
|
540
|
+
*
|
|
541
|
+
* The previous spelling tested whether `process.argv[1]` ENDED WITH this
|
|
542
|
+
* module's basename, which is looser still than the `file://` comparison the
|
|
543
|
+
* sibling modules used: any path ending in `design-source-gate.mjs` satisfied
|
|
544
|
+
* it, including a different copy of this file in another checkout, and a
|
|
545
|
+
* rename silently turned the guard off with nothing to notice.
|
|
546
|
+
*
|
|
547
|
+
* Both sides are realpath'd instead. Reached through a symlinked checkout, a
|
|
548
|
+
* git worktree, or a `/tmp` path on macOS the naive comparisons disagree, the
|
|
549
|
+
* body never runs, and the process exits 0 having done nothing — and every
|
|
550
|
+
* Lisa-driven agent runs in a worktree, so that is the routine path.
|
|
551
|
+
*
|
|
552
|
+
* Written out rather than imported: this ships inside a plugin payload, which
|
|
553
|
+
* has no `./lib/` to resolve against. Same rule and reasoning as
|
|
554
|
+
* `scripts/lib/invoked-as-script.mjs`.
|
|
555
|
+
* @param {string} moduleUrl - The caller's own `import.meta.url`.
|
|
556
|
+
* @param {string | undefined} [argv1] - Entry path; defaults to `process.argv[1]`.
|
|
557
|
+
* @returns {boolean} Whether the caller should run its CLI body.
|
|
558
|
+
*/
|
|
559
|
+
export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
|
|
560
|
+
if (!argv1) return false;
|
|
561
|
+
try {
|
|
562
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
|
|
563
|
+
} catch {
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (invokedAsScript(import.meta.url)) {
|
|
538
569
|
process.exit(runCli(process.argv.slice(2)));
|
|
539
570
|
}
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
* `status:` PREFIX and terminality is resolved from live config.
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
|
+
import { realpathSync } from "node:fs";
|
|
43
|
+
import { fileURLToPath } from "node:url";
|
|
44
|
+
|
|
42
45
|
/** Lifecycle labels are identified by this prefix, never by a pinned set. */
|
|
43
46
|
export const LIFECYCLE_LABEL_PREFIX = "status:";
|
|
44
47
|
|
|
@@ -217,6 +220,62 @@ export function terminalLifecycleLabels(config) {
|
|
|
217
220
|
return [DEFAULT_TERMINAL_LIFECYCLE_LABEL];
|
|
218
221
|
}
|
|
219
222
|
|
|
223
|
+
/** The claimed role's label when config names none. */
|
|
224
|
+
const DEFAULT_CLAIMED_LIFECYCLE_LABEL = "status:in-progress";
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The lifecycle label that means "somebody is already on this", from config.
|
|
228
|
+
* @param {unknown} config a parsed `.lisa.config.json`-shaped object
|
|
229
|
+
* @returns {string} the claimed role's label
|
|
230
|
+
*/
|
|
231
|
+
export function claimedLifecycleLabel(config) {
|
|
232
|
+
const claimed = readPath(config, ["github", "labels", "build", "claimed"]);
|
|
233
|
+
return typeof claimed === "string" && claimed.trim().length > 0
|
|
234
|
+
? claimed.trim()
|
|
235
|
+
: DEFAULT_CLAIMED_LIFECYCLE_LABEL;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Whether intake may claim this issue, and why not when it may not.
|
|
240
|
+
*
|
|
241
|
+
* The scan filters on the ready role alone, so an issue carrying BOTH ready and
|
|
242
|
+
* claimed comes back as a candidate. Trust resolution then rescues the case
|
|
243
|
+
* where a bot applied the claim — but says nothing about the case where a
|
|
244
|
+
* *human* did, which is the strongest claim signal there is and the one that
|
|
245
|
+
* was being ignored. An issue a person marked in-progress is somebody's active
|
|
246
|
+
* work; dispatching a second agent onto it is how two branches end up fixing
|
|
247
|
+
* the same thing.
|
|
248
|
+
*
|
|
249
|
+
* Returned as a verdict rather than left to the skill's prose. This repository
|
|
250
|
+
* has measured the difference: executable controls hold, prose rules are
|
|
251
|
+
* followed by roughly nobody, including their own author. The scan already
|
|
252
|
+
* calls this classifier, so the answer arrives where the decision is made.
|
|
253
|
+
*
|
|
254
|
+
* A claim is only believed when TRUSTED, which is what keeps this from undoing
|
|
255
|
+
* the bot fix: a reflexive bot label leaves the issue claimable exactly as if
|
|
256
|
+
* it were absent.
|
|
257
|
+
* @param {object} options inputs
|
|
258
|
+
* @param {readonly string[]} options.trusted labels the classifier believes
|
|
259
|
+
* @param {unknown} options.config a parsed `.lisa.config.json`-shaped object
|
|
260
|
+
* @returns {{claimable: boolean, reason: string|null}} the verdict
|
|
261
|
+
*/
|
|
262
|
+
export function resolveClaimability({ trusted, config }) {
|
|
263
|
+
const claimed = claimedLifecycleLabel(config);
|
|
264
|
+
const normalizedClaimed = claimed.toLowerCase();
|
|
265
|
+
const hasTrustedClaim = (trusted ?? []).some(
|
|
266
|
+
label => String(label).trim().toLowerCase() === normalizedClaimed
|
|
267
|
+
);
|
|
268
|
+
if (!hasTrustedClaim) {
|
|
269
|
+
return { claimable: true, reason: null };
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
claimable: false,
|
|
273
|
+
reason:
|
|
274
|
+
`already carries a trusted "${claimed}", so somebody is working it; ` +
|
|
275
|
+
`intake must not dispatch a second agent onto the same issue`,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
220
279
|
/**
|
|
221
280
|
* Detect lifecycle labels that contradict native state, in BOTH directions.
|
|
222
281
|
*
|
|
@@ -482,11 +541,48 @@ async function main() {
|
|
|
482
541
|
terminalLabels: terminalLifecycleLabels(payload.config),
|
|
483
542
|
excludeLabels: trust.untrusted.map(entry => entry.label),
|
|
484
543
|
});
|
|
544
|
+
// Computed from `trust.trusted`, never from the raw label set: a bot-applied
|
|
545
|
+
// claim must leave the issue claimable exactly as if it were absent, which is
|
|
546
|
+
// the whole point of the trust pass above.
|
|
547
|
+
const claim = resolveClaimability({
|
|
548
|
+
trusted: trust.trusted,
|
|
549
|
+
config: payload.config,
|
|
550
|
+
});
|
|
485
551
|
|
|
486
|
-
process.stdout.write(
|
|
552
|
+
process.stdout.write(
|
|
553
|
+
`${JSON.stringify({ ...trust, ...drift, ...claim }, null, 2)}\n`
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* True when `moduleUrl` names the module node was asked to run.
|
|
559
|
+
*
|
|
560
|
+
* Both sides are realpath'd. The previous spelling compared `import.meta.url`
|
|
561
|
+
* against a `file://` string built from `process.argv[1]`, which compares a
|
|
562
|
+
* real path against whatever the caller typed — so reached through a symlinked
|
|
563
|
+
* checkout, a git worktree, or a `/tmp` path on macOS the two disagreed and
|
|
564
|
+
* `main()` never ran. This module writes its verdict to stdout, so a no-op
|
|
565
|
+
* leaves the caller parsing an empty payload: no untrusted labels, no
|
|
566
|
+
* unclaimable verdict, everything believed. A guard that fails open on the
|
|
567
|
+
* component whose job is deciding what to believe.
|
|
568
|
+
*
|
|
569
|
+
* Written out rather than imported: this is a plugin payload, which has no
|
|
570
|
+
* `./lib/` to resolve against. Same rule and same reasoning as
|
|
571
|
+
* `scripts/lib/invoked-as-script.mjs`.
|
|
572
|
+
* @param {string} moduleUrl - The caller's own `import.meta.url`.
|
|
573
|
+
* @param {string | undefined} [argv1] - Entry path; defaults to `process.argv[1]`.
|
|
574
|
+
* @returns {boolean} Whether the caller should run its CLI body.
|
|
575
|
+
*/
|
|
576
|
+
export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
|
|
577
|
+
if (!argv1) return false;
|
|
578
|
+
try {
|
|
579
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
|
|
580
|
+
} catch {
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
487
583
|
}
|
|
488
584
|
|
|
489
|
-
if (import.meta.url
|
|
585
|
+
if (invokedAsScript(import.meta.url)) {
|
|
490
586
|
main().catch(error => {
|
|
491
587
|
process.stderr.write(`${error.message}\n`);
|
|
492
588
|
process.exitCode = 1;
|
|
@@ -19,6 +19,8 @@ import {
|
|
|
19
19
|
import { tmpdir } from "node:os";
|
|
20
20
|
import path from "node:path";
|
|
21
21
|
import process from "node:process";
|
|
22
|
+
import { realpathSync } from "node:fs";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
22
24
|
|
|
23
25
|
export const PLUGIN_SYNC_CLASSIFICATIONS = [
|
|
24
26
|
"SOURCE_NOT_BUILT",
|
|
@@ -556,7 +558,41 @@ function linkedWorktreeGitDir(root) {
|
|
|
556
558
|
return path.isAbsolute(gitDir) ? gitDir : path.resolve(root, gitDir);
|
|
557
559
|
}
|
|
558
560
|
|
|
559
|
-
|
|
561
|
+
/**
|
|
562
|
+
* True when `moduleUrl` names the module node was asked to run.
|
|
563
|
+
*
|
|
564
|
+
* Both sides are realpath'd. The previous spelling compared `import.meta.url`
|
|
565
|
+
* against a `file://` string built from `process.argv[1]`, which pits a real
|
|
566
|
+
* path against whatever the caller typed — so reached through a symlinked
|
|
567
|
+
* checkout, a git worktree, or a `/tmp` path on macOS the two disagreed, the
|
|
568
|
+
* body never ran, and the process exited 0 having done nothing. Every
|
|
569
|
+
* Lisa-driven agent runs in a worktree, so that is the routine path, not an
|
|
570
|
+
* exotic one.
|
|
571
|
+
*
|
|
572
|
+
* Written out rather than imported: this ships inside a plugin payload, which
|
|
573
|
+
* has no `./lib/` to resolve against. Same rule and same reasoning as
|
|
574
|
+
* `scripts/lib/invoked-as-script.mjs`.
|
|
575
|
+
*
|
|
576
|
+
* Realpathing BOTH sides matters under `--preserve-symlinks-main`, which tells
|
|
577
|
+
* node not to resolve the main entry: normalizing only `argv[1]` then compares
|
|
578
|
+
* a real path against a symlinked one and answers false for an entry point that
|
|
579
|
+
* WAS invoked directly. Any resolution error returns false — node loaded the
|
|
580
|
+
* entry from that path moments earlier, so a path that will not resolve now is
|
|
581
|
+
* not the path this module came through.
|
|
582
|
+
* @param {string} moduleUrl - The caller's own `import.meta.url`.
|
|
583
|
+
* @param {string | undefined} [argv1] - Entry path; defaults to `process.argv[1]`.
|
|
584
|
+
* @returns {boolean} Whether the caller should run its CLI body.
|
|
585
|
+
*/
|
|
586
|
+
export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
|
|
587
|
+
if (!argv1) return false;
|
|
588
|
+
try {
|
|
589
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
|
|
590
|
+
} catch {
|
|
591
|
+
return false;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (invokedAsScript(import.meta.url)) {
|
|
560
596
|
try {
|
|
561
597
|
const report = explainPluginSync(process.argv[2] ?? process.cwd());
|
|
562
598
|
process.stdout.write(report.text);
|
|
@@ -216,6 +216,21 @@ The classifier returns `trusted`, `untrusted`, `unknownProvenance`, and a per-la
|
|
|
216
216
|
- a candidate whose `$READY` is **untrusted** is **not claimable** — skip it and leave it for a human to flip genuinely ready; report it in the summary rather than dispatching it;
|
|
217
217
|
- a candidate whose `$CLAIMED` is **untrusted** is **not claimed** — if its `$READY` is trusted it stays a normal candidate, exactly as if the bot label were absent.
|
|
218
218
|
|
|
219
|
+
#### 2c. A trusted claim is a skip reason
|
|
220
|
+
|
|
221
|
+
The scan filters on `--label "$READY"` alone, so an issue carrying **both** `$READY` and `$CLAIMED` comes back as a candidate. The rules above rescue the case where a *bot* applied the claim; they say nothing about the case where a **human** did — which is the strongest claim signal there is, and the one that was being ignored. An issue a person marked in-progress is somebody's active work, and dispatching a second agent onto it is how two branches end up fixing the same thing.
|
|
222
|
+
|
|
223
|
+
The classifier answers this directly, so the skill does not have to reason about it:
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{ "claimable": false,
|
|
227
|
+
"reason": "already carries a trusted \"status:in-progress\", so somebody is working it; intake must not dispatch a second agent onto the same issue" }
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**A candidate with `claimable: false` is skipped and reported with its `reason`.** It is not an error and not a stall — it is the queue working. Never strip the claim to make it claimable: that is the label-flap the section above refuses, aimed at a human this time.
|
|
231
|
+
|
|
232
|
+
`claimable` is computed from the **trusted** set, not the raw labels, which is what keeps it from undoing 2b — a bot-applied claim leaves the issue claimable exactly as if it were absent.
|
|
233
|
+
|
|
219
234
|
**Never unlabel to correct this.** The bot re-applies its label on each subsequent review event, so reverting produces a label-flap loop that is worse than the defect. The guard is that intake stops *believing* the label; it writes nothing. Distrust is idempotent and cannot race.
|
|
220
235
|
|
|
221
236
|
A label whose provenance cannot be established (applied at creation, which GitHub records no `labeled` event for) is trusted but listed in `unknownProvenance` — failing closed there would ignore the human `status:ready` that opens the queue. Report that list; do not silently drop it.
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
11
|
+
import { realpathSync } from "node:fs";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
11
13
|
|
|
12
14
|
export const AUTOMATION_RUN_OUTCOMES = [
|
|
13
15
|
"nothing-needed",
|
|
@@ -396,7 +398,41 @@ export async function runAutomationRunRecordCli(argv) {
|
|
|
396
398
|
}
|
|
397
399
|
|
|
398
400
|
// CLI entrypoint.
|
|
399
|
-
|
|
401
|
+
/**
|
|
402
|
+
* True when `moduleUrl` names the module node was asked to run.
|
|
403
|
+
*
|
|
404
|
+
* Both sides are realpath'd. The previous spelling compared `import.meta.url`
|
|
405
|
+
* against a `file://` string built from `process.argv[1]`, which pits a real
|
|
406
|
+
* path against whatever the caller typed — so reached through a symlinked
|
|
407
|
+
* checkout, a git worktree, or a `/tmp` path on macOS the two disagreed, the
|
|
408
|
+
* body never ran, and the process exited 0 having done nothing. Every
|
|
409
|
+
* Lisa-driven agent runs in a worktree, so that is the routine path, not an
|
|
410
|
+
* exotic one.
|
|
411
|
+
*
|
|
412
|
+
* Written out rather than imported: this ships inside a plugin payload, which
|
|
413
|
+
* has no `./lib/` to resolve against. Same rule and same reasoning as
|
|
414
|
+
* `scripts/lib/invoked-as-script.mjs`.
|
|
415
|
+
*
|
|
416
|
+
* Realpathing BOTH sides matters under `--preserve-symlinks-main`, which tells
|
|
417
|
+
* node not to resolve the main entry: normalizing only `argv[1]` then compares
|
|
418
|
+
* a real path against a symlinked one and answers false for an entry point that
|
|
419
|
+
* WAS invoked directly. Any resolution error returns false — node loaded the
|
|
420
|
+
* entry from that path moments earlier, so a path that will not resolve now is
|
|
421
|
+
* not the path this module came through.
|
|
422
|
+
* @param {string} moduleUrl - The caller's own `import.meta.url`.
|
|
423
|
+
* @param {string | undefined} [argv1] - Entry path; defaults to `process.argv[1]`.
|
|
424
|
+
* @returns {boolean} Whether the caller should run its CLI body.
|
|
425
|
+
*/
|
|
426
|
+
export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
|
|
427
|
+
if (!argv1) return false;
|
|
428
|
+
try {
|
|
429
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
|
|
430
|
+
} catch {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (invokedAsScript(import.meta.url)) {
|
|
400
436
|
runAutomationRunRecordCli(process.argv.slice(2)).then(
|
|
401
437
|
code => {
|
|
402
438
|
process.exitCode = code;
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
import { createHash } from "node:crypto";
|
|
38
38
|
import fs from "node:fs";
|
|
39
39
|
import path from "node:path";
|
|
40
|
+
import { realpathSync } from "node:fs";
|
|
41
|
+
import { fileURLToPath } from "node:url";
|
|
40
42
|
|
|
41
43
|
const LOCKFILE_REL = path.join(".lisa", "cross-pollination.lock.json");
|
|
42
44
|
const LOCK_VERSION = 1;
|
|
@@ -704,7 +706,41 @@ export function renderReport(p, result) {
|
|
|
704
706
|
}
|
|
705
707
|
|
|
706
708
|
// CLI entrypoint.
|
|
707
|
-
|
|
709
|
+
/**
|
|
710
|
+
* True when `moduleUrl` names the module node was asked to run.
|
|
711
|
+
*
|
|
712
|
+
* Both sides are realpath'd. The previous spelling compared `import.meta.url`
|
|
713
|
+
* against a `file://` string built from `process.argv[1]`, which pits a real
|
|
714
|
+
* path against whatever the caller typed — so reached through a symlinked
|
|
715
|
+
* checkout, a git worktree, or a `/tmp` path on macOS the two disagreed, the
|
|
716
|
+
* body never ran, and the process exited 0 having done nothing. Every
|
|
717
|
+
* Lisa-driven agent runs in a worktree, so that is the routine path, not an
|
|
718
|
+
* exotic one.
|
|
719
|
+
*
|
|
720
|
+
* Written out rather than imported: this ships inside a plugin payload, which
|
|
721
|
+
* has no `./lib/` to resolve against. Same rule and same reasoning as
|
|
722
|
+
* `scripts/lib/invoked-as-script.mjs`.
|
|
723
|
+
*
|
|
724
|
+
* Realpathing BOTH sides matters under `--preserve-symlinks-main`, which tells
|
|
725
|
+
* node not to resolve the main entry: normalizing only `argv[1]` then compares
|
|
726
|
+
* a real path against a symlinked one and answers false for an entry point that
|
|
727
|
+
* WAS invoked directly. Any resolution error returns false — node loaded the
|
|
728
|
+
* entry from that path moments earlier, so a path that will not resolve now is
|
|
729
|
+
* not the path this module came through.
|
|
730
|
+
* @param {string} moduleUrl - The caller's own `import.meta.url`.
|
|
731
|
+
* @param {string | undefined} [argv1] - Entry path; defaults to `process.argv[1]`.
|
|
732
|
+
* @returns {boolean} Whether the caller should run its CLI body.
|
|
733
|
+
*/
|
|
734
|
+
export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
|
|
735
|
+
if (!argv1) return false;
|
|
736
|
+
try {
|
|
737
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
|
|
738
|
+
} catch {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if (invokedAsScript(import.meta.url)) {
|
|
708
744
|
const args = process.argv.slice(2);
|
|
709
745
|
const root = path.resolve(args.find(a => !a.startsWith("-")) ?? ".");
|
|
710
746
|
const dryRun = args.includes("--dry-run") || !args.includes("--write");
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
* Exit 0 = PASS, 1 = FAIL (any violation, or anything unresolvable), 2 = usage.
|
|
36
36
|
*/
|
|
37
37
|
import { execFileSync } from "node:child_process";
|
|
38
|
-
import { readFileSync } from "node:fs";
|
|
38
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
39
|
+
import { fileURLToPath } from "node:url";
|
|
39
40
|
|
|
40
41
|
/** The one designated marker for UI deliberately not captured in Figma. */
|
|
41
42
|
export const DESIGN_SOURCE_NONE_MARKER = "DESIGN-SOURCE: none — not in Figma";
|
|
@@ -534,6 +535,36 @@ export function runCli(argv) {
|
|
|
534
535
|
return result.verdict === "PASS" ? 0 : 1;
|
|
535
536
|
}
|
|
536
537
|
|
|
537
|
-
|
|
538
|
+
/**
|
|
539
|
+
* True when `moduleUrl` names the module node was asked to run.
|
|
540
|
+
*
|
|
541
|
+
* The previous spelling tested whether `process.argv[1]` ENDED WITH this
|
|
542
|
+
* module's basename, which is looser still than the `file://` comparison the
|
|
543
|
+
* sibling modules used: any path ending in `design-source-gate.mjs` satisfied
|
|
544
|
+
* it, including a different copy of this file in another checkout, and a
|
|
545
|
+
* rename silently turned the guard off with nothing to notice.
|
|
546
|
+
*
|
|
547
|
+
* Both sides are realpath'd instead. Reached through a symlinked checkout, a
|
|
548
|
+
* git worktree, or a `/tmp` path on macOS the naive comparisons disagree, the
|
|
549
|
+
* body never runs, and the process exits 0 having done nothing — and every
|
|
550
|
+
* Lisa-driven agent runs in a worktree, so that is the routine path.
|
|
551
|
+
*
|
|
552
|
+
* Written out rather than imported: this ships inside a plugin payload, which
|
|
553
|
+
* has no `./lib/` to resolve against. Same rule and reasoning as
|
|
554
|
+
* `scripts/lib/invoked-as-script.mjs`.
|
|
555
|
+
* @param {string} moduleUrl - The caller's own `import.meta.url`.
|
|
556
|
+
* @param {string | undefined} [argv1] - Entry path; defaults to `process.argv[1]`.
|
|
557
|
+
* @returns {boolean} Whether the caller should run its CLI body.
|
|
558
|
+
*/
|
|
559
|
+
export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
|
|
560
|
+
if (!argv1) return false;
|
|
561
|
+
try {
|
|
562
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
|
|
563
|
+
} catch {
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (invokedAsScript(import.meta.url)) {
|
|
538
569
|
process.exit(runCli(process.argv.slice(2)));
|
|
539
570
|
}
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
* `status:` PREFIX and terminality is resolved from live config.
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
|
+
import { realpathSync } from "node:fs";
|
|
43
|
+
import { fileURLToPath } from "node:url";
|
|
44
|
+
|
|
42
45
|
/** Lifecycle labels are identified by this prefix, never by a pinned set. */
|
|
43
46
|
export const LIFECYCLE_LABEL_PREFIX = "status:";
|
|
44
47
|
|
|
@@ -217,6 +220,62 @@ export function terminalLifecycleLabels(config) {
|
|
|
217
220
|
return [DEFAULT_TERMINAL_LIFECYCLE_LABEL];
|
|
218
221
|
}
|
|
219
222
|
|
|
223
|
+
/** The claimed role's label when config names none. */
|
|
224
|
+
const DEFAULT_CLAIMED_LIFECYCLE_LABEL = "status:in-progress";
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The lifecycle label that means "somebody is already on this", from config.
|
|
228
|
+
* @param {unknown} config a parsed `.lisa.config.json`-shaped object
|
|
229
|
+
* @returns {string} the claimed role's label
|
|
230
|
+
*/
|
|
231
|
+
export function claimedLifecycleLabel(config) {
|
|
232
|
+
const claimed = readPath(config, ["github", "labels", "build", "claimed"]);
|
|
233
|
+
return typeof claimed === "string" && claimed.trim().length > 0
|
|
234
|
+
? claimed.trim()
|
|
235
|
+
: DEFAULT_CLAIMED_LIFECYCLE_LABEL;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Whether intake may claim this issue, and why not when it may not.
|
|
240
|
+
*
|
|
241
|
+
* The scan filters on the ready role alone, so an issue carrying BOTH ready and
|
|
242
|
+
* claimed comes back as a candidate. Trust resolution then rescues the case
|
|
243
|
+
* where a bot applied the claim — but says nothing about the case where a
|
|
244
|
+
* *human* did, which is the strongest claim signal there is and the one that
|
|
245
|
+
* was being ignored. An issue a person marked in-progress is somebody's active
|
|
246
|
+
* work; dispatching a second agent onto it is how two branches end up fixing
|
|
247
|
+
* the same thing.
|
|
248
|
+
*
|
|
249
|
+
* Returned as a verdict rather than left to the skill's prose. This repository
|
|
250
|
+
* has measured the difference: executable controls hold, prose rules are
|
|
251
|
+
* followed by roughly nobody, including their own author. The scan already
|
|
252
|
+
* calls this classifier, so the answer arrives where the decision is made.
|
|
253
|
+
*
|
|
254
|
+
* A claim is only believed when TRUSTED, which is what keeps this from undoing
|
|
255
|
+
* the bot fix: a reflexive bot label leaves the issue claimable exactly as if
|
|
256
|
+
* it were absent.
|
|
257
|
+
* @param {object} options inputs
|
|
258
|
+
* @param {readonly string[]} options.trusted labels the classifier believes
|
|
259
|
+
* @param {unknown} options.config a parsed `.lisa.config.json`-shaped object
|
|
260
|
+
* @returns {{claimable: boolean, reason: string|null}} the verdict
|
|
261
|
+
*/
|
|
262
|
+
export function resolveClaimability({ trusted, config }) {
|
|
263
|
+
const claimed = claimedLifecycleLabel(config);
|
|
264
|
+
const normalizedClaimed = claimed.toLowerCase();
|
|
265
|
+
const hasTrustedClaim = (trusted ?? []).some(
|
|
266
|
+
label => String(label).trim().toLowerCase() === normalizedClaimed
|
|
267
|
+
);
|
|
268
|
+
if (!hasTrustedClaim) {
|
|
269
|
+
return { claimable: true, reason: null };
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
claimable: false,
|
|
273
|
+
reason:
|
|
274
|
+
`already carries a trusted "${claimed}", so somebody is working it; ` +
|
|
275
|
+
`intake must not dispatch a second agent onto the same issue`,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
220
279
|
/**
|
|
221
280
|
* Detect lifecycle labels that contradict native state, in BOTH directions.
|
|
222
281
|
*
|
|
@@ -482,11 +541,48 @@ async function main() {
|
|
|
482
541
|
terminalLabels: terminalLifecycleLabels(payload.config),
|
|
483
542
|
excludeLabels: trust.untrusted.map(entry => entry.label),
|
|
484
543
|
});
|
|
544
|
+
// Computed from `trust.trusted`, never from the raw label set: a bot-applied
|
|
545
|
+
// claim must leave the issue claimable exactly as if it were absent, which is
|
|
546
|
+
// the whole point of the trust pass above.
|
|
547
|
+
const claim = resolveClaimability({
|
|
548
|
+
trusted: trust.trusted,
|
|
549
|
+
config: payload.config,
|
|
550
|
+
});
|
|
485
551
|
|
|
486
|
-
process.stdout.write(
|
|
552
|
+
process.stdout.write(
|
|
553
|
+
`${JSON.stringify({ ...trust, ...drift, ...claim }, null, 2)}\n`
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* True when `moduleUrl` names the module node was asked to run.
|
|
559
|
+
*
|
|
560
|
+
* Both sides are realpath'd. The previous spelling compared `import.meta.url`
|
|
561
|
+
* against a `file://` string built from `process.argv[1]`, which compares a
|
|
562
|
+
* real path against whatever the caller typed — so reached through a symlinked
|
|
563
|
+
* checkout, a git worktree, or a `/tmp` path on macOS the two disagreed and
|
|
564
|
+
* `main()` never ran. This module writes its verdict to stdout, so a no-op
|
|
565
|
+
* leaves the caller parsing an empty payload: no untrusted labels, no
|
|
566
|
+
* unclaimable verdict, everything believed. A guard that fails open on the
|
|
567
|
+
* component whose job is deciding what to believe.
|
|
568
|
+
*
|
|
569
|
+
* Written out rather than imported: this is a plugin payload, which has no
|
|
570
|
+
* `./lib/` to resolve against. Same rule and same reasoning as
|
|
571
|
+
* `scripts/lib/invoked-as-script.mjs`.
|
|
572
|
+
* @param {string} moduleUrl - The caller's own `import.meta.url`.
|
|
573
|
+
* @param {string | undefined} [argv1] - Entry path; defaults to `process.argv[1]`.
|
|
574
|
+
* @returns {boolean} Whether the caller should run its CLI body.
|
|
575
|
+
*/
|
|
576
|
+
export function invokedAsScript(moduleUrl, argv1 = process.argv[1]) {
|
|
577
|
+
if (!argv1) return false;
|
|
578
|
+
try {
|
|
579
|
+
return realpathSync(argv1) === realpathSync(fileURLToPath(moduleUrl));
|
|
580
|
+
} catch {
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
487
583
|
}
|
|
488
584
|
|
|
489
|
-
if (import.meta.url
|
|
585
|
+
if (invokedAsScript(import.meta.url)) {
|
|
490
586
|
main().catch(error => {
|
|
491
587
|
process.stderr.write(`${error.message}\n`);
|
|
492
588
|
process.exitCode = 1;
|