@codyswann/lisa 4.99.4 → 4.99.6
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/lib/completion-proof-github.mjs +155 -3
- package/all/copy-overwrite/scripts/lib/completion-proof-publisher.mjs +153 -18
- package/all/copy-overwrite/scripts/lisa-work-item.mjs +46 -2
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +4 -3
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +20 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +41 -24
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/opencode/relative-imports.d.ts +59 -0
- package/dist/opencode/relative-imports.d.ts.map +1 -0
- package/dist/opencode/relative-imports.js +119 -0
- package/dist/opencode/relative-imports.js.map +1 -0
- package/dist/opencode/shared-scripts-cleanup.d.ts +43 -0
- package/dist/opencode/shared-scripts-cleanup.d.ts.map +1 -0
- package/dist/opencode/shared-scripts-cleanup.js +94 -0
- package/dist/opencode/shared-scripts-cleanup.js.map +1 -0
- package/dist/opencode/shared-scripts-emitter.d.ts +18 -0
- package/dist/opencode/shared-scripts-emitter.d.ts.map +1 -0
- package/dist/opencode/shared-scripts-emitter.js +173 -0
- package/dist/opencode/shared-scripts-emitter.js.map +1 -0
- package/dist/opencode/skills-installer.d.ts +4 -1
- package/dist/opencode/skills-installer.d.ts.map +1 -1
- package/dist/opencode/skills-installer.js +19 -3
- package/dist/opencode/skills-installer.js.map +1 -1
- package/package.json +4 -4
- 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-evidence/SKILL.md +19 -9
- package/plugins/lisa/.codex-plugin/skills/lisa-github-journey/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-jira-evidence/SKILL.md +18 -5
- package/plugins/lisa/.codex-plugin/skills/lisa-jira-evidence/agents/openai.yaml +2 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-jira-journey/SKILL.md +8 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-linear-evidence/SKILL.md +3 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-linear-journey/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/SKILL.md +4 -4
- package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/references/completion-authorization.md +32 -4
- package/plugins/lisa/.codex-plugin/skills/lisa-verify/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-verify-prd/SKILL.md +3 -3
- package/plugins/lisa/agents/github-agent.md +1 -1
- package/plugins/lisa/skills/lisa-github-evidence/SKILL.md +19 -9
- package/plugins/lisa/skills/lisa-github-evidence/agents/openai.yaml +2 -2
- package/plugins/lisa/skills/lisa-github-journey/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-jira-evidence/SKILL.md +17 -4
- package/plugins/lisa/skills/lisa-jira-evidence/agents/openai.yaml +2 -2
- package/plugins/lisa/skills/lisa-jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa/skills/lisa-jira-journey/SKILL.md +8 -0
- package/plugins/lisa/skills/lisa-jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa/skills/lisa-linear-evidence/SKILL.md +3 -3
- package/plugins/lisa/skills/lisa-linear-evidence/agents/openai.yaml +2 -2
- package/plugins/lisa/skills/lisa-linear-journey/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-tracker-evidence/SKILL.md +4 -4
- package/plugins/lisa/skills/lisa-tracker-evidence/references/completion-authorization.md +32 -4
- package/plugins/lisa/skills/lisa-verify/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-verify-prd/SKILL.md +3 -3
- package/plugins/lisa-agy/agents/github-agent.md +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-github-evidence/SKILL.md +19 -9
- package/plugins/lisa-agy/skills/lisa-github-journey/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-agy/skills/lisa-jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-agy/skills/lisa-jira-journey/SKILL.md +8 -0
- package/plugins/lisa-agy/skills/lisa-jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-agy/skills/lisa-linear-evidence/SKILL.md +3 -3
- package/plugins/lisa-agy/skills/lisa-linear-journey/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-tracker-evidence/SKILL.md +4 -4
- package/plugins/lisa-agy/skills/lisa-tracker-evidence/references/completion-authorization.md +32 -4
- package/plugins/lisa-agy/skills/lisa-verify/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-verify-prd/SKILL.md +3 -3
- 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-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/agents/github-agent.agent.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-github-evidence/SKILL.md +19 -9
- package/plugins/lisa-copilot/skills/lisa-github-journey/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-copilot/skills/lisa-jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-copilot/skills/lisa-jira-journey/SKILL.md +8 -0
- package/plugins/lisa-copilot/skills/lisa-jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-copilot/skills/lisa-linear-evidence/SKILL.md +3 -3
- package/plugins/lisa-copilot/skills/lisa-linear-journey/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-tracker-evidence/SKILL.md +4 -4
- package/plugins/lisa-copilot/skills/lisa-tracker-evidence/references/completion-authorization.md +32 -4
- package/plugins/lisa-copilot/skills/lisa-verify/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-verify-prd/SKILL.md +3 -3
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/agents/github-agent.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-github-evidence/SKILL.md +19 -9
- package/plugins/lisa-cursor/skills/lisa-github-journey/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-cursor/skills/lisa-jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-cursor/skills/lisa-jira-journey/SKILL.md +8 -0
- package/plugins/lisa-cursor/skills/lisa-jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-cursor/skills/lisa-linear-evidence/SKILL.md +3 -3
- package/plugins/lisa-cursor/skills/lisa-linear-journey/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-tracker-evidence/SKILL.md +4 -4
- package/plugins/lisa-cursor/skills/lisa-tracker-evidence/references/completion-authorization.md +32 -4
- package/plugins/lisa-cursor/skills/lisa-verify/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-verify-prd/SKILL.md +3 -3
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/agents/github-agent.md +1 -1
- package/plugins/lisa-devin/skills/lisa-github-evidence/SKILL.md +19 -9
- package/plugins/lisa-devin/skills/lisa-github-journey/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-devin/skills/lisa-jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-devin/skills/lisa-jira-journey/SKILL.md +8 -0
- package/plugins/lisa-devin/skills/lisa-jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-devin/skills/lisa-linear-evidence/SKILL.md +3 -3
- package/plugins/lisa-devin/skills/lisa-linear-journey/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-tracker-evidence/SKILL.md +4 -4
- package/plugins/lisa-devin/skills/lisa-tracker-evidence/references/completion-authorization.md +32 -4
- package/plugins/lisa-devin/skills/lisa-verify/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-verify-prd/SKILL.md +3 -3
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/skills/jira-evidence/SKILL.md +18 -5
- package/plugins/lisa-expo/.codex-plugin/skills/jira-evidence/agents/openai.yaml +2 -2
- package/plugins/lisa-expo/.codex-plugin/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-expo/.codex-plugin/skills/jira-journey/SKILL.md +8 -0
- package/plugins/lisa-expo/.codex-plugin/skills/jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-expo/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-expo/skills/jira-evidence/agents/openai.yaml +2 -2
- package/plugins/lisa-expo/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-expo/skills/jira-journey/SKILL.md +8 -0
- package/plugins/lisa-expo/skills/jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-agy/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-expo-agy/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-expo-agy/skills/jira-journey/SKILL.md +8 -0
- package/plugins/lisa-expo-agy/skills/jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-expo-copilot/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-expo-copilot/skills/jira-journey/SKILL.md +8 -0
- package/plugins/lisa-expo-copilot/skills/jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-expo-cursor/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-expo-cursor/skills/jira-journey/SKILL.md +8 -0
- package/plugins/lisa-expo-cursor/skills/jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-expo-devin/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-expo-devin/skills/jira-journey/SKILL.md +8 -0
- package/plugins/lisa-expo-devin/skills/jira-journey/scripts/generate-templates.py +32 -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-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-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-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-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-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-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-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-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/.codex-plugin/skills/jira-evidence/SKILL.md +18 -5
- package/plugins/lisa-rails/.codex-plugin/skills/jira-evidence/agents/openai.yaml +2 -2
- package/plugins/lisa-rails/.codex-plugin/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-rails/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-rails/skills/jira-evidence/agents/openai.yaml +2 -2
- package/plugins/lisa-rails/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-agy/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-rails-agy/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-rails-copilot/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-rails-cursor/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/lisa-rails-devin/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- 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-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-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/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/agents/github-agent.md +1 -1
- package/plugins/src/base/skills/lisa-github-evidence/SKILL.md +19 -9
- package/plugins/src/base/skills/lisa-github-journey/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-jira-evidence/SKILL.md +17 -4
- package/plugins/src/base/skills/lisa-jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/src/base/skills/lisa-jira-journey/SKILL.md +8 -0
- package/plugins/src/base/skills/lisa-jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/src/base/skills/lisa-linear-evidence/SKILL.md +3 -3
- package/plugins/src/base/skills/lisa-linear-journey/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-tracker-evidence/SKILL.md +4 -4
- package/plugins/src/base/skills/lisa-tracker-evidence/references/completion-authorization.md +32 -4
- package/plugins/src/base/skills/lisa-verify/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-verify-prd/SKILL.md +3 -3
- package/plugins/src/expo/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/src/expo/skills/jira-evidence/scripts/post-evidence.sh +22 -3
- package/plugins/src/expo/skills/jira-journey/SKILL.md +8 -0
- package/plugins/src/expo/skills/jira-journey/scripts/generate-templates.py +32 -1
- package/plugins/src/rails/skills/jira-evidence/SKILL.md +17 -4
- package/plugins/src/rails/skills/jira-evidence/scripts/post-evidence.sh +22 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remove comments that open a line, so commented-out or documented imports
|
|
3
|
+
* are not followed. Trailing comments after code are left in place; the
|
|
4
|
+
* import pattern only matches a quoted specifier after a keyword anyway.
|
|
5
|
+
* @param source - JavaScript module source.
|
|
6
|
+
* @returns Source with line-opening comments blanked.
|
|
7
|
+
*/
|
|
8
|
+
export declare function stripLineOpeningComments(source: string): string;
|
|
9
|
+
/** One relative import whose target does not exist inside the checked tree. */
|
|
10
|
+
export interface UnresolvedImport {
|
|
11
|
+
/** Importing file, relative to the checked root. */
|
|
12
|
+
readonly importer: string;
|
|
13
|
+
/** The specifier exactly as written in the importer. */
|
|
14
|
+
readonly specifier: string;
|
|
15
|
+
/** Resolved target, relative to the checked root (may start with `..`). */
|
|
16
|
+
readonly target: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Predicate: is `file` a JavaScript module whose imports should be followed?
|
|
20
|
+
* @param file - Any file path.
|
|
21
|
+
* @returns True for `.mjs`, `.js`, and `.cjs` files.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isScriptModule(file: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Extract every static relative specifier from module source text.
|
|
26
|
+
* @param source - JavaScript module source.
|
|
27
|
+
* @returns Unique relative specifiers in first-seen order.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractRelativeSpecifiers(source: string): readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* Read a module and resolve each relative specifier against its directory.
|
|
32
|
+
* @param absFile - Absolute path to the module.
|
|
33
|
+
* @returns Pairs of specifier and absolute resolved target.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveRelativeImports(absFile: string): Promise<readonly {
|
|
36
|
+
specifier: string;
|
|
37
|
+
target: string;
|
|
38
|
+
}[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Predicate: is `candidate` the directory `root` or somewhere beneath it?
|
|
41
|
+
* @param root - Absolute directory.
|
|
42
|
+
* @param candidate - Absolute path to test.
|
|
43
|
+
* @returns True when `candidate` does not escape `root`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isWithin(root: string, candidate: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Find every relative import, in every script module under `rootDir`, whose
|
|
48
|
+
* target is missing or lies outside `rootDir`.
|
|
49
|
+
* @param rootDir - Absolute root of the emitted tree to check.
|
|
50
|
+
* @returns Unresolved imports, empty when the tree is self-contained.
|
|
51
|
+
*/
|
|
52
|
+
export declare function findUnresolvedImports(rootDir: string): Promise<readonly UnresolvedImport[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Render one unresolved import as a single diagnostic line naming both ends.
|
|
55
|
+
* @param unresolved - The unresolved import.
|
|
56
|
+
* @returns `<importer> imports "<specifier>" but <target> is not in the tree`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function formatUnresolvedImport(unresolved: UnresolvedImport): string;
|
|
59
|
+
//# sourceMappingURL=relative-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-imports.d.ts","sourceRoot":"","sources":["../../src/opencode/relative-imports.ts"],"names":[],"mappings":"AA6CA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAI/D;AAED,+EAA+E;AAC/E,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAM3E;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAM3D;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAGjE;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CAsBtC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,gBAAgB,GAAG,MAAM,CAE3E"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static relative-import discovery for JavaScript modules Lisa emits.
|
|
3
|
+
*
|
|
4
|
+
* Skill scripts are copied verbatim into a host's `.opencode/` tree, so a
|
|
5
|
+
* relative specifier that resolves inside a Lisa plugin can point at nothing
|
|
6
|
+
* once the file moves (CodySwannGT/lisa#4642: `../../../scripts/<m>.mjs` lands
|
|
7
|
+
* on `.opencode/skills/scripts/`). Both the shared-script emitter and the
|
|
8
|
+
* self-containment guard need the same answer to "which relative files does
|
|
9
|
+
* this module load?", so the parse lives here once.
|
|
10
|
+
*
|
|
11
|
+
* The parse is a deliberate regex over `from "…"`, `import "…"`,
|
|
12
|
+
* `import("…")`, and `require("…")` with a string-literal relative specifier
|
|
13
|
+
* (`./` or `../`), after comments that open a line are removed.
|
|
14
|
+
* Bare specifiers (`node:fs`, packages) are not files Lisa ships and are
|
|
15
|
+
* ignored. Template-literal or computed dynamic imports cannot be resolved
|
|
16
|
+
* statically and are out of reach by construction.
|
|
17
|
+
* @module opencode/relative-imports
|
|
18
|
+
*/
|
|
19
|
+
import * as fse from "fs-extra";
|
|
20
|
+
import { readFile } from "node:fs/promises";
|
|
21
|
+
import * as path from "node:path";
|
|
22
|
+
import { listFilesRecursive } from "../core/lisa-skill-sources.js";
|
|
23
|
+
/** File extensions treated as executable JavaScript modules. */
|
|
24
|
+
const SCRIPT_MODULE_EXTENSIONS = [".mjs", ".js", ".cjs"];
|
|
25
|
+
/**
|
|
26
|
+
* Matches a relative string-literal specifier after `from`, `import`, or
|
|
27
|
+
* `import(`. Group 2 is the specifier. A dynamic import is matched only in its
|
|
28
|
+
* formatted shape, `import("…")` with no space before the quote, which keeps
|
|
29
|
+
* the pattern free of adjacent optional whitespace runs (linear-time).
|
|
30
|
+
*/
|
|
31
|
+
const RELATIVE_SPECIFIER_PATTERN = /\b(?:from|import\(?|require\()\s*(["'])(\.\.?\/[^"'\n]*)\1/g;
|
|
32
|
+
/**
|
|
33
|
+
* Block comments that open a line (after indentation). Anchoring at line start
|
|
34
|
+
* is the conservative choice: a `/*` inside a string such as the glob
|
|
35
|
+
* `"src/**\/*.ts"` never opens a line, so it cannot swallow real imports.
|
|
36
|
+
*/
|
|
37
|
+
const LINE_OPENING_BLOCK_COMMENT = /^[ \t]*\/\*[\s\S]*?\*\//gm;
|
|
38
|
+
/** Line comments that open a line; `"https://…"` inside code is untouched. */
|
|
39
|
+
const LINE_OPENING_LINE_COMMENT = /^[ \t]*\/\/.*$/gm;
|
|
40
|
+
/**
|
|
41
|
+
* Remove comments that open a line, so commented-out or documented imports
|
|
42
|
+
* are not followed. Trailing comments after code are left in place; the
|
|
43
|
+
* import pattern only matches a quoted specifier after a keyword anyway.
|
|
44
|
+
* @param source - JavaScript module source.
|
|
45
|
+
* @returns Source with line-opening comments blanked.
|
|
46
|
+
*/
|
|
47
|
+
export function stripLineOpeningComments(source) {
|
|
48
|
+
return source
|
|
49
|
+
.replace(LINE_OPENING_BLOCK_COMMENT, "")
|
|
50
|
+
.replace(LINE_OPENING_LINE_COMMENT, "");
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Predicate: is `file` a JavaScript module whose imports should be followed?
|
|
54
|
+
* @param file - Any file path.
|
|
55
|
+
* @returns True for `.mjs`, `.js`, and `.cjs` files.
|
|
56
|
+
*/
|
|
57
|
+
export function isScriptModule(file) {
|
|
58
|
+
return SCRIPT_MODULE_EXTENSIONS.includes(path.extname(file));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Extract every static relative specifier from module source text.
|
|
62
|
+
* @param source - JavaScript module source.
|
|
63
|
+
* @returns Unique relative specifiers in first-seen order.
|
|
64
|
+
*/
|
|
65
|
+
export function extractRelativeSpecifiers(source) {
|
|
66
|
+
const specifiers = Array.from(stripLineOpeningComments(source).matchAll(RELATIVE_SPECIFIER_PATTERN), match => match[2]).filter((specifier) => Boolean(specifier));
|
|
67
|
+
return Object.freeze(Array.from(new Set(specifiers)));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Read a module and resolve each relative specifier against its directory.
|
|
71
|
+
* @param absFile - Absolute path to the module.
|
|
72
|
+
* @returns Pairs of specifier and absolute resolved target.
|
|
73
|
+
*/
|
|
74
|
+
export async function resolveRelativeImports(absFile) {
|
|
75
|
+
const source = await readFile(absFile, "utf8");
|
|
76
|
+
return extractRelativeSpecifiers(source).map(specifier => ({
|
|
77
|
+
specifier,
|
|
78
|
+
target: path.resolve(path.dirname(absFile), specifier),
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Predicate: is `candidate` the directory `root` or somewhere beneath it?
|
|
83
|
+
* @param root - Absolute directory.
|
|
84
|
+
* @param candidate - Absolute path to test.
|
|
85
|
+
* @returns True when `candidate` does not escape `root`.
|
|
86
|
+
*/
|
|
87
|
+
export function isWithin(root, candidate) {
|
|
88
|
+
const rel = path.relative(root, candidate);
|
|
89
|
+
return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Find every relative import, in every script module under `rootDir`, whose
|
|
93
|
+
* target is missing or lies outside `rootDir`.
|
|
94
|
+
* @param rootDir - Absolute root of the emitted tree to check.
|
|
95
|
+
* @returns Unresolved imports, empty when the tree is self-contained.
|
|
96
|
+
*/
|
|
97
|
+
export async function findUnresolvedImports(rootDir) {
|
|
98
|
+
const files = (await listFilesRecursive(rootDir)).filter(isScriptModule);
|
|
99
|
+
const perFile = await Promise.all(files.map(async (importer) => {
|
|
100
|
+
const imports = await resolveRelativeImports(path.join(rootDir, importer));
|
|
101
|
+
const checked = await Promise.all(imports.map(async ({ specifier, target }) => {
|
|
102
|
+
const resolves = isWithin(rootDir, target) && (await fse.pathExists(target));
|
|
103
|
+
return resolves
|
|
104
|
+
? undefined
|
|
105
|
+
: { importer, specifier, target: path.relative(rootDir, target) };
|
|
106
|
+
}));
|
|
107
|
+
return checked.filter((entry) => entry !== undefined);
|
|
108
|
+
}));
|
|
109
|
+
return Object.freeze(perFile.flat());
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Render one unresolved import as a single diagnostic line naming both ends.
|
|
113
|
+
* @param unresolved - The unresolved import.
|
|
114
|
+
* @returns `<importer> imports "<specifier>" but <target> is not in the tree`.
|
|
115
|
+
*/
|
|
116
|
+
export function formatUnresolvedImport(unresolved) {
|
|
117
|
+
return `${unresolved.importer} imports "${unresolved.specifier}" but ${unresolved.target} is not in the tree`;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=relative-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relative-imports.js","sourceRoot":"","sources":["../../src/opencode/relative-imports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,M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EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;QACtE,CAAC,CAAC,CACH,CAAC;QACF,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,KAAK,EAA6B,EAAE,CAAC,KAAK,KAAK,SAAS,CAC1D,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAA4B;IACjE,OAAO,GAAG,UAAU,CAAC,QAAQ,aAAa,UAAU,CAAC,SAAS,SAAS,UAAU,CAAC,MAAM,qBAAqB,CAAC;AAChH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest prefix of the only subtree the shared-script emitter writes and may
|
|
3
|
+
* clean up: `.opencode/skills/scripts/`, where `../../../scripts/<m>` from a
|
|
4
|
+
* skill script lands. Host folders elsewhere under `skills/` (for example a
|
|
5
|
+
* host's own `skills/<name>/`) are never selected, even if a manifest names
|
|
6
|
+
* them. The emitter refuses any target outside this prefix, so it can never
|
|
7
|
+
* write a file this cleanup cannot later remove.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SHARED_SCRIPTS_PREFIX = "skills/scripts/";
|
|
10
|
+
/** Absolute `<destDir>/.opencode` the cleanup works under. */
|
|
11
|
+
interface CleanupRoots {
|
|
12
|
+
/** Absolute `<destDir>/.opencode`. */
|
|
13
|
+
readonly opencodeDir: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Convert a relative path to the manifest's forward-slash form.
|
|
17
|
+
* @param relativePath - Path relative to `.opencode/`, either separator.
|
|
18
|
+
* @returns The same path with forward slashes.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toManifestPath(relativePath: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Choose the previous manifest entries that belong to the shared-script
|
|
23
|
+
* emitter and are not emitted this run.
|
|
24
|
+
*
|
|
25
|
+
* The emitter owns {@link SHARED_SCRIPTS_PREFIX} only; skill folders, host
|
|
26
|
+
* folders, and every other installer's entries are never selected.
|
|
27
|
+
* @param previousManagedFiles - Manifest entries from the previous run.
|
|
28
|
+
* @param currentShared - Shared modules emitted this run.
|
|
29
|
+
* @returns Stale entries in manifest form, sorted.
|
|
30
|
+
*/
|
|
31
|
+
export declare function selectStaleSharedEntries(previousManagedFiles: readonly string[], currentShared: readonly string[]): readonly string[];
|
|
32
|
+
/**
|
|
33
|
+
* Delete shared modules Lisa emitted last run that this run no longer needs,
|
|
34
|
+
* then remove any directory the deletions left empty (never `skills/` itself).
|
|
35
|
+
* Files Lisa never recorded in the manifest are left alone.
|
|
36
|
+
* @param previousManagedFiles - Manifest entries from the previous run.
|
|
37
|
+
* @param currentShared - Shared modules emitted this run.
|
|
38
|
+
* @param roots - Emit roots for this host project.
|
|
39
|
+
* @returns Deleted entries in manifest form, sorted.
|
|
40
|
+
*/
|
|
41
|
+
export declare function deleteStaleSharedScripts(previousManagedFiles: readonly string[], currentShared: readonly string[], roots: CleanupRoots): Promise<readonly string[]>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=shared-scripts-cleanup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-scripts-cleanup.d.ts","sourceRoot":"","sources":["../../src/opencode/shared-scripts-cleanup.ts"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,8DAA8D;AAC9D,UAAU,YAAY;IACpB,sCAAsC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,oBAAoB,EAAE,SAAS,MAAM,EAAE,EACvC,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,SAAS,MAAM,EAAE,CAQnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,oBAAoB,EAAE,SAAS,MAAM,EAAE,EACvC,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAO5B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stale-file cleanup for the shared modules `opencode/shared-scripts-emitter`
|
|
3
|
+
* writes outside skill folders (CodySwannGT/lisa#4642).
|
|
4
|
+
*
|
|
5
|
+
* Every comparison happens on manifest-shaped paths: relative to `.opencode/`,
|
|
6
|
+
* forward slashes on every platform. `opencode/manifest` normalizes entries to
|
|
7
|
+
* forward slashes when it reads them, so comparing them against
|
|
8
|
+
* `path.relative` output (backslashes on Windows) would mark every shared
|
|
9
|
+
* module stale on the second apply and delete the files just copied.
|
|
10
|
+
* @module opencode/shared-scripts-cleanup
|
|
11
|
+
*/
|
|
12
|
+
import * as fse from "fs-extra";
|
|
13
|
+
import { readdir, rm } from "node:fs/promises";
|
|
14
|
+
import * as path from "node:path";
|
|
15
|
+
/**
|
|
16
|
+
* Manifest prefix of the only subtree the shared-script emitter writes and may
|
|
17
|
+
* clean up: `.opencode/skills/scripts/`, where `../../../scripts/<m>` from a
|
|
18
|
+
* skill script lands. Host folders elsewhere under `skills/` (for example a
|
|
19
|
+
* host's own `skills/<name>/`) are never selected, even if a manifest names
|
|
20
|
+
* them. The emitter refuses any target outside this prefix, so it can never
|
|
21
|
+
* write a file this cleanup cannot later remove.
|
|
22
|
+
*/
|
|
23
|
+
export const SHARED_SCRIPTS_PREFIX = "skills/scripts/";
|
|
24
|
+
/**
|
|
25
|
+
* Convert a relative path to the manifest's forward-slash form.
|
|
26
|
+
* @param relativePath - Path relative to `.opencode/`, either separator.
|
|
27
|
+
* @returns The same path with forward slashes.
|
|
28
|
+
*/
|
|
29
|
+
export function toManifestPath(relativePath) {
|
|
30
|
+
return relativePath.replaceAll("\\", "/");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Choose the previous manifest entries that belong to the shared-script
|
|
34
|
+
* emitter and are not emitted this run.
|
|
35
|
+
*
|
|
36
|
+
* The emitter owns {@link SHARED_SCRIPTS_PREFIX} only; skill folders, host
|
|
37
|
+
* folders, and every other installer's entries are never selected.
|
|
38
|
+
* @param previousManagedFiles - Manifest entries from the previous run.
|
|
39
|
+
* @param currentShared - Shared modules emitted this run.
|
|
40
|
+
* @returns Stale entries in manifest form, sorted.
|
|
41
|
+
*/
|
|
42
|
+
export function selectStaleSharedEntries(previousManagedFiles, currentShared) {
|
|
43
|
+
const keep = new Set(currentShared.map(toManifestPath));
|
|
44
|
+
const stale = previousManagedFiles
|
|
45
|
+
.map(toManifestPath)
|
|
46
|
+
.filter(rel => rel.startsWith(SHARED_SCRIPTS_PREFIX) && !keep.has(rel));
|
|
47
|
+
return Object.freeze(Array.from(new Set(stale)).sort((a, b) => a.localeCompare(b)));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Delete shared modules Lisa emitted last run that this run no longer needs,
|
|
51
|
+
* then remove any directory the deletions left empty (never `skills/` itself).
|
|
52
|
+
* Files Lisa never recorded in the manifest are left alone.
|
|
53
|
+
* @param previousManagedFiles - Manifest entries from the previous run.
|
|
54
|
+
* @param currentShared - Shared modules emitted this run.
|
|
55
|
+
* @param roots - Emit roots for this host project.
|
|
56
|
+
* @returns Deleted entries in manifest form, sorted.
|
|
57
|
+
*/
|
|
58
|
+
export async function deleteStaleSharedScripts(previousManagedFiles, currentShared, roots) {
|
|
59
|
+
const stale = selectStaleSharedEntries(previousManagedFiles, currentShared);
|
|
60
|
+
await Promise.all(stale.map(rel => rm(path.join(roots.opencodeDir, rel), { force: true })));
|
|
61
|
+
await pruneEmptiedDirs(stale, roots);
|
|
62
|
+
return stale;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Remove directories the deletions left empty. Deepest first, sequentially,
|
|
66
|
+
* so a nested directory emptied here lets its parent — up to
|
|
67
|
+
* `skills/scripts/` itself — be removed in the same pass. No-op when nothing
|
|
68
|
+
* was deleted, so an untouched host directory is never pruned.
|
|
69
|
+
* @param deleted - Entries just deleted, in manifest form.
|
|
70
|
+
* @param roots - Emit roots for this host project.
|
|
71
|
+
*/
|
|
72
|
+
async function pruneEmptiedDirs(deleted, roots) {
|
|
73
|
+
const candidates = deleted.length === 0
|
|
74
|
+
? []
|
|
75
|
+
: [
|
|
76
|
+
...deleted.map(rel => path.posix.dirname(rel)),
|
|
77
|
+
SHARED_SCRIPTS_PREFIX.slice(0, -1),
|
|
78
|
+
];
|
|
79
|
+
const ordered = Array.from(new Set(candidates)).sort((a, b) => b.split("/").length - a.split("/").length);
|
|
80
|
+
await ordered.reduce((previous, dir) => previous.then(() => removeIfEmpty(path.join(roots.opencodeDir, dir))), Promise.resolve());
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Remove a directory only when it exists and holds nothing.
|
|
84
|
+
* @param absDir - Absolute directory path.
|
|
85
|
+
*/
|
|
86
|
+
async function removeIfEmpty(absDir) {
|
|
87
|
+
if (!(await fse.pathExists(absDir))) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if ((await readdir(absDir)).length === 0) {
|
|
91
|
+
await rm(absDir, { recursive: true, force: true });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=shared-scripts-cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-scripts-cleanup.js","sourceRoot":"","sources":["../../src/opencode/shared-scripts-cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;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M,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BundledSkillSource } from "../core/lisa-skill-sources.js";
|
|
2
|
+
/** Where the emit writes and which part of it skill folders already own. */
|
|
3
|
+
interface EmitRoots {
|
|
4
|
+
/** Absolute `<destDir>/.opencode`. */
|
|
5
|
+
readonly opencodeDir: string;
|
|
6
|
+
/** Absolute `<destDir>/.opencode/skills/lisa` (skill-owned). */
|
|
7
|
+
readonly skillsDir: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Copy every shared module the bundled skills import from outside their skill
|
|
11
|
+
* folders into the emitted tree.
|
|
12
|
+
* @param bundled - Bundled skills being emitted this run.
|
|
13
|
+
* @param roots - Emit roots for this host project.
|
|
14
|
+
* @returns Emitted paths, relative to `.opencode/`, sorted.
|
|
15
|
+
*/
|
|
16
|
+
export declare function emitSharedScripts(bundled: readonly BundledSkillSource[], roots: EmitRoots): Promise<readonly string[]>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=shared-scripts-emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-scripts-emitter.d.ts","sourceRoot":"","sources":["../../src/opencode/shared-scripts-emitter.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAqCxE,4EAA4E;AAC5E,UAAU,SAAS;IACjB,sCAAsC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,SAAS,kBAAkB,EAAE,EACtC,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAiB5B"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emit the plugin-level modules that bundled skill scripts import from outside
|
|
3
|
+
* their own skill folder (CodySwannGT/lisa#4642).
|
|
4
|
+
*
|
|
5
|
+
* A skill script such as `lisa-session-manager/scripts/cli-cycle.mjs` imports
|
|
6
|
+
* `../../../scripts/automation-run-record.mjs`. Inside a Lisa plugin that path
|
|
7
|
+
* lands on the plugin's own `scripts/` directory. Once the skill is copied to
|
|
8
|
+
* `.opencode/skills/lisa/<skill>/`, the same unchanged specifier lands on
|
|
9
|
+
* `.opencode/skills/scripts/`, so this module copies each such target there —
|
|
10
|
+
* preserving the relative layout instead of rewriting any specifier.
|
|
11
|
+
*
|
|
12
|
+
* The source of an emitted target is found by the same mapping the plugin
|
|
13
|
+
* relies on: `.opencode/skills/` stands where the plugin root stands
|
|
14
|
+
* (`plugins/<p>/`), because `skills/lisa/<n>/scripts/` and `skills/<n>/scripts/`
|
|
15
|
+
* are both three levels below it. Resolving against the skill's own source
|
|
16
|
+
* folder would be wrong for skills discovered under `.codex-plugin/skills/`,
|
|
17
|
+
* whose `../../../` lands on `.codex-plugin/` rather than the plugin root.
|
|
18
|
+
*
|
|
19
|
+
* The file list is DERIVED from the import specifiers of the emitted files,
|
|
20
|
+
* transitively (a shared module's own relative imports are followed too), so a
|
|
21
|
+
* new import is covered the day it lands. There is no hand-written list.
|
|
22
|
+
*
|
|
23
|
+
* Two skills from different plugins may reach the same emitted path. Identical
|
|
24
|
+
* content is copied once; different content is a packaging defect and fails
|
|
25
|
+
* the emit loudly rather than shipping whichever module happened to win.
|
|
26
|
+
*
|
|
27
|
+
* Emitted paths are Lisa-managed: a host file at the same path is overwritten,
|
|
28
|
+
* exactly as for every other managed path in `.opencode/`.
|
|
29
|
+
*
|
|
30
|
+
* Returned paths use forward slashes on every platform, matching how the
|
|
31
|
+
* `.lisa-managed.json` manifest stores them (`opencode/manifest`).
|
|
32
|
+
* @module opencode/shared-scripts-emitter
|
|
33
|
+
*/
|
|
34
|
+
import * as fse from "fs-extra";
|
|
35
|
+
import { copyFile, mkdir, readFile } from "node:fs/promises";
|
|
36
|
+
import * as path from "node:path";
|
|
37
|
+
import { SHARED_SCRIPTS_PREFIX, toManifestPath, } from "./shared-scripts-cleanup.js";
|
|
38
|
+
import { isScriptModule, isWithin, resolveRelativeImports, } from "./relative-imports.js";
|
|
39
|
+
/** Name of the per-plugin directory holding Codex-specific skill roots. */
|
|
40
|
+
const CODEX_PLUGIN_DIR = ".codex-plugin";
|
|
41
|
+
/** Emitted directory that stands in for a plugin root (`.opencode/skills`). */
|
|
42
|
+
const SHARED_ROOT_SUBDIR = "skills";
|
|
43
|
+
/**
|
|
44
|
+
* Copy every shared module the bundled skills import from outside their skill
|
|
45
|
+
* folders into the emitted tree.
|
|
46
|
+
* @param bundled - Bundled skills being emitted this run.
|
|
47
|
+
* @param roots - Emit roots for this host project.
|
|
48
|
+
* @returns Emitted paths, relative to `.opencode/`, sorted.
|
|
49
|
+
*/
|
|
50
|
+
export async function emitSharedScripts(bundled, roots) {
|
|
51
|
+
const seeds = bundled.flatMap(source => source.files.filter(isScriptModule).map(file => ({
|
|
52
|
+
sourcePath: path.join(source.sourceDir, file),
|
|
53
|
+
emittedPath: path.join(roots.skillsDir, source.skillName, file),
|
|
54
|
+
pluginRoot: pluginRootOf(source),
|
|
55
|
+
})));
|
|
56
|
+
const modules = await collectSharedModules(seeds, new Map(), roots);
|
|
57
|
+
await Promise.all([...modules.values()].map(async (module) => {
|
|
58
|
+
const destPath = path.join(roots.opencodeDir, module.emittedRelative);
|
|
59
|
+
await mkdir(path.dirname(destPath), { recursive: true });
|
|
60
|
+
await copyFile(module.sourcePath, destPath);
|
|
61
|
+
}));
|
|
62
|
+
return Object.freeze([...modules.keys()].sort((a, b) => a.localeCompare(b)));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Follow relative imports breadth-first, collecting every target that lands
|
|
66
|
+
* outside the skill-owned `skills/lisa/` subtree.
|
|
67
|
+
* @param pending - Modules whose imports have not been followed yet.
|
|
68
|
+
* @param found - Shared modules collected so far, keyed by emitted path.
|
|
69
|
+
* @param roots - Emit roots for this host project.
|
|
70
|
+
* @returns Every shared module reachable from `pending`, keyed by emitted path.
|
|
71
|
+
*/
|
|
72
|
+
async function collectSharedModules(pending, found, roots) {
|
|
73
|
+
if (pending.length === 0) {
|
|
74
|
+
return found;
|
|
75
|
+
}
|
|
76
|
+
const discovered = (await Promise.all(pending.map(module => escapingImports(module, roots)))).flat();
|
|
77
|
+
const merged = await mergeDiscovered(discovered, found);
|
|
78
|
+
const next = [...merged.values()]
|
|
79
|
+
.filter(module => !found.has(module.emittedRelative))
|
|
80
|
+
.map(module => ({
|
|
81
|
+
sourcePath: module.sourcePath,
|
|
82
|
+
emittedPath: path.join(roots.opencodeDir, module.emittedRelative),
|
|
83
|
+
pluginRoot: module.pluginRoot,
|
|
84
|
+
}));
|
|
85
|
+
return collectSharedModules(next, merged, roots);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* List the relative imports of one module that leave the skill-owned subtree.
|
|
89
|
+
* @param module - Module to inspect.
|
|
90
|
+
* @param roots - Emit roots for this host project.
|
|
91
|
+
* @returns Shared modules this module needs emitted.
|
|
92
|
+
*/
|
|
93
|
+
async function escapingImports(module, roots) {
|
|
94
|
+
const imports = await resolveRelativeImports(module.sourcePath);
|
|
95
|
+
const escaping = imports
|
|
96
|
+
.map(({ specifier }) => ({
|
|
97
|
+
specifier,
|
|
98
|
+
emittedPath: path.resolve(path.dirname(module.emittedPath), specifier),
|
|
99
|
+
}))
|
|
100
|
+
.filter(entry => !isWithin(roots.skillsDir, entry.emittedPath));
|
|
101
|
+
return Promise.all(escaping.map(entry => toSharedModule(module, entry.specifier, entry.emittedPath, roots)));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Map one escaping import onto its plugin source, failing with a named error
|
|
105
|
+
* when it would land outside the owned `.opencode/skills/scripts/` subtree
|
|
106
|
+
* (the only one stale cleanup may delete from) or its source is missing.
|
|
107
|
+
* @param module - Importing module.
|
|
108
|
+
* @param specifier - The specifier as written.
|
|
109
|
+
* @param emittedPath - Absolute path the specifier resolves to once emitted.
|
|
110
|
+
* @param roots - Emit roots for this host project.
|
|
111
|
+
* @returns The shared module to emit.
|
|
112
|
+
*/
|
|
113
|
+
async function toSharedModule(module, specifier, emittedPath, roots) {
|
|
114
|
+
const sharedRoot = path.join(roots.opencodeDir, SHARED_ROOT_SUBDIR);
|
|
115
|
+
const emittedRelative = toManifestPath(path.relative(roots.opencodeDir, emittedPath));
|
|
116
|
+
if (!emittedRelative.startsWith(SHARED_SCRIPTS_PREFIX)) {
|
|
117
|
+
throw new Error(`OpenCode emit: ${module.sourcePath} imports "${specifier}", which resolves outside .opencode/${SHARED_SCRIPTS_PREFIX} once emitted`);
|
|
118
|
+
}
|
|
119
|
+
const sourcePath = path.join(module.pluginRoot, path.relative(sharedRoot, emittedPath));
|
|
120
|
+
if (!(await fse.pathExists(sourcePath))) {
|
|
121
|
+
throw new Error(`OpenCode emit: ${module.sourcePath} imports "${specifier}" but ${sourcePath} does not exist`);
|
|
122
|
+
}
|
|
123
|
+
return { sourcePath, emittedRelative, pluginRoot: module.pluginRoot };
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Find the plugin root a bundled skill ships in. Skills live at
|
|
127
|
+
* `plugins/<p>/skills/<n>/` or `plugins/<p>/.codex-plugin/skills/<n>/`; both
|
|
128
|
+
* belong to `plugins/<p>/`, whose `scripts/` holds the shared modules.
|
|
129
|
+
* @param source - Bundled skill source.
|
|
130
|
+
* @returns Absolute plugin root.
|
|
131
|
+
*/
|
|
132
|
+
function pluginRootOf(source) {
|
|
133
|
+
const skillsRootParent = path.dirname(path.dirname(source.sourceDir));
|
|
134
|
+
return path.basename(skillsRootParent) === CODEX_PLUGIN_DIR
|
|
135
|
+
? path.dirname(skillsRootParent)
|
|
136
|
+
: skillsRootParent;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Merge newly discovered modules into the collected set, accepting a repeat
|
|
140
|
+
* only when it is the same file or byte-identical content.
|
|
141
|
+
* @param discovered - Modules found in this round.
|
|
142
|
+
* @param found - Modules collected in earlier rounds.
|
|
143
|
+
* @returns The merged set.
|
|
144
|
+
*/
|
|
145
|
+
async function mergeDiscovered(discovered, found) {
|
|
146
|
+
return discovered.reduce(async (accPromise, module) => {
|
|
147
|
+
const acc = await accPromise;
|
|
148
|
+
const existing = acc.get(module.emittedRelative);
|
|
149
|
+
if (existing === undefined) {
|
|
150
|
+
return new Map([...acc, [module.emittedRelative, module]]);
|
|
151
|
+
}
|
|
152
|
+
await assertSameModule(existing, module);
|
|
153
|
+
return acc;
|
|
154
|
+
}, Promise.resolve(found));
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Fail when two different source modules would land on one emitted path.
|
|
158
|
+
* @param first - Module already claiming the path.
|
|
159
|
+
* @param second - Module that would claim it too.
|
|
160
|
+
*/
|
|
161
|
+
async function assertSameModule(first, second) {
|
|
162
|
+
if (first.sourcePath === second.sourcePath) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const [a, b] = await Promise.all([
|
|
166
|
+
readFile(first.sourcePath),
|
|
167
|
+
readFile(second.sourcePath),
|
|
168
|
+
]);
|
|
169
|
+
if (!a.equals(b)) {
|
|
170
|
+
throw new Error(`OpenCode emit: ${first.emittedRelative} would be written from two different modules: ${first.sourcePath} and ${second.sourcePath}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=shared-scripts-emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-scripts-emitter.js","sourceRoot":"","sources":["../../src/opencode/shared-scripts-emitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,GAAG,MAAM,UAA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AgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC,EACD,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CACvB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,gBAAgB,CAC7B,KAAmB,EACnB,MAAoB;IAEpB,IAAI,KAAK,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,EAAE,CAAC;QAC3C,OAAO;IACT,CAAC;IACD,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/B,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;QAC1B,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC;KAC5B,CAAC,CAAC;IACH,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,kBAAkB,KAAK,CAAC,eAAe,iDAAiD,KAAK,CAAC,UAAU,QAAQ,MAAM,CAAC,UAAU,EAAE,CACpI,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -14,7 +14,10 @@ export interface InstalledSkill {
|
|
|
14
14
|
export interface SkillsInstallResult {
|
|
15
15
|
readonly installed: readonly InstalledSkill[];
|
|
16
16
|
readonly managedFiles: readonly string[];
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* What Lisa removed because it stopped shipping it: bare skill directory
|
|
19
|
+
* names, then shared modules in manifest form (`skills/scripts/<m>.mjs`).
|
|
20
|
+
*/
|
|
18
21
|
readonly deleted: readonly string[];
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills-installer.d.ts","sourceRoot":"","sources":["../../src/opencode/skills-installer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skills-installer.d.ts","sourceRoot":"","sources":["../../src/opencode/skills-installer.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AASrD,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,QAA8B,CAAC;AAW9D,+BAA+B;AAC/B,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IACvC,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAwB;AACxB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,oBAAoB,EAAE,SAAS,MAAM,EAAE,EACvC,aAAa,GAAE,SAAS,WAAW,EAAO,GACzC,OAAO,CAAC,mBAAmB,CAAC,CAuE9B"}
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
* transform needed, unlike the Codex TOML/openai.yaml path).
|
|
16
16
|
* 2. Lisa commands converted to skills with a `lisa-` prefix, since the safest
|
|
17
17
|
* cross-runtime carrier for a Lisa command is a self-complete skill.
|
|
18
|
+
* 3. The plugin-level modules those skill scripts import from outside their
|
|
19
|
+
* own folder (`../../../scripts/<m>.mjs`), copied to the path the unchanged
|
|
20
|
+
* specifier resolves to in the emitted tree (`.opencode/skills/scripts/`)
|
|
21
|
+
* so the tree is self-contained — see `opencode/shared-scripts-emitter`.
|
|
18
22
|
*
|
|
19
23
|
* Source discovery (walking the plugin tree, dedup, denylist) is shared with the
|
|
20
24
|
* Codex overlay via `core/lisa-skill-sources`.
|
|
@@ -27,6 +31,8 @@ import { discoverBundledSkills, discoverLisaCommands, loadSkillDenylist, } from
|
|
|
27
31
|
import { convertCommandToSkill } from "../codex/command-skill-transformer.js";
|
|
28
32
|
import { opencodeProjectPluginFilter } from "./project-plugin-gate.js";
|
|
29
33
|
import { OPENCODE_CONFIG_DIR } from "./manifest.js";
|
|
34
|
+
import { deleteStaleSharedScripts } from "./shared-scripts-cleanup.js";
|
|
35
|
+
import { emitSharedScripts } from "./shared-scripts-emitter.js";
|
|
30
36
|
/** Runtime label threaded into generated command-as-skill compatibility notes */
|
|
31
37
|
const OPENCODE_RUNTIME_LABEL = "OpenCode";
|
|
32
38
|
/** Subdirectory inside `.opencode/skills/` where Lisa-owned skills live */
|
|
@@ -51,7 +57,8 @@ const INTERNAL_OPENCODE_SKILL_POLICY_RELATIVE_PATH = path.join("scripts", "inter
|
|
|
51
57
|
* @returns Result describing installed skills + managed files + deletions.
|
|
52
58
|
*/
|
|
53
59
|
export async function installSkills(lisaDir, destDir, previousManagedFiles, detectedTypes = []) {
|
|
54
|
-
const
|
|
60
|
+
const opencodeDir = path.join(destDir, OPENCODE_CONFIG_DIR);
|
|
61
|
+
const skillsDir = path.join(opencodeDir, LISA_SKILLS_SUBDIR);
|
|
55
62
|
await fse.ensureDir(skillsDir);
|
|
56
63
|
const denylistedSkills = await loadSkillDenylist(lisaDir, INTERNAL_OPENCODE_SKILL_POLICY_RELATIVE_PATH);
|
|
57
64
|
const pluginFilter = await opencodeProjectPluginFilter(destDir, detectedTypes);
|
|
@@ -59,6 +66,11 @@ export async function installSkills(lisaDir, destDir, previousManagedFiles, dete
|
|
|
59
66
|
const bundled = await discoverBundledSkills(lisaDir, denylistedSkills, pluginFilter);
|
|
60
67
|
const bundledInstalls = await Promise.all(bundled.map(source => copyBundledSkill(source, skillsDir)));
|
|
61
68
|
const bundledFiles = bundled.flatMap(source => source.files.map(file => path.join(LISA_SKILLS_SUBDIR, source.skillName, file)));
|
|
69
|
+
// Shared modules imported from outside a skill folder, derived from the
|
|
70
|
+
// emitted scripts' own import specifiers (CodySwannGT/lisa#4642).
|
|
71
|
+
const sharedRoots = { opencodeDir, skillsDir };
|
|
72
|
+
const sharedFiles = await emitSharedScripts(bundled, sharedRoots);
|
|
73
|
+
const deletedShared = await deleteStaleSharedScripts(previousManagedFiles, sharedFiles, sharedRoots);
|
|
62
74
|
// Step 2: command-as-skill conversions (skip when the bundled skill already
|
|
63
75
|
// owns the target name — native `/lisa:*` commands cover Claude-style entry).
|
|
64
76
|
const bundledSkillNames = new Set(bundled.map(source => source.skillName));
|
|
@@ -73,8 +85,12 @@ export async function installSkills(lisaDir, destDir, previousManagedFiles, dete
|
|
|
73
85
|
const deleted = await deleteStaleSkills(previousManagedFiles, new Set(installed.map(s => s.name)), destDir);
|
|
74
86
|
return {
|
|
75
87
|
installed: Object.freeze(installed),
|
|
76
|
-
managedFiles: Object.freeze([
|
|
77
|
-
|
|
88
|
+
managedFiles: Object.freeze([
|
|
89
|
+
...bundledFiles,
|
|
90
|
+
...sharedFiles,
|
|
91
|
+
...commandFiles,
|
|
92
|
+
]),
|
|
93
|
+
deleted: Object.freeze([...deleted, ...deletedShared]),
|
|
78
94
|
};
|
|
79
95
|
}
|
|
80
96
|
/**
|