@a1st/aix-core 0.0.12 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +13 -14
- package/dist/backup.js.map +1 -1
- package/dist/cache/cleanup.d.ts.map +1 -1
- package/dist/cache/cleanup.js +7 -8
- package/dist/cache/cleanup.js.map +1 -1
- package/dist/cache/clear.js +4 -4
- package/dist/cache/clear.js.map +1 -1
- package/dist/cache/status.d.ts.map +1 -1
- package/dist/cache/status.js +4 -5
- package/dist/cache/status.js.map +1 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +18 -17
- package/dist/discovery.js.map +1 -1
- package/dist/editors/adapters/base.d.ts +8 -4
- package/dist/editors/adapters/base.d.ts.map +1 -1
- package/dist/editors/adapters/base.js +131 -40
- package/dist/editors/adapters/base.js.map +1 -1
- package/dist/editors/adapters/claude-code.d.ts +3 -3
- package/dist/editors/adapters/claude-code.d.ts.map +1 -1
- package/dist/editors/adapters/claude-code.js +7 -6
- package/dist/editors/adapters/claude-code.js.map +1 -1
- package/dist/editors/adapters/codex.d.ts +20 -10
- package/dist/editors/adapters/codex.d.ts.map +1 -1
- package/dist/editors/adapters/codex.js +67 -30
- package/dist/editors/adapters/codex.js.map +1 -1
- package/dist/editors/adapters/copilot.d.ts +6 -3
- package/dist/editors/adapters/copilot.d.ts.map +1 -1
- package/dist/editors/adapters/copilot.js +53 -10
- package/dist/editors/adapters/copilot.js.map +1 -1
- package/dist/editors/adapters/cursor.d.ts +2 -2
- package/dist/editors/adapters/cursor.d.ts.map +1 -1
- package/dist/editors/adapters/cursor.js +3 -2
- package/dist/editors/adapters/cursor.js.map +1 -1
- package/dist/editors/adapters/gemini.d.ts +44 -0
- package/dist/editors/adapters/gemini.d.ts.map +1 -0
- package/dist/editors/adapters/gemini.js +139 -0
- package/dist/editors/adapters/gemini.js.map +1 -0
- package/dist/editors/adapters/index.d.ts +2 -0
- package/dist/editors/adapters/index.d.ts.map +1 -1
- package/dist/editors/adapters/index.js +2 -0
- package/dist/editors/adapters/index.js.map +1 -1
- package/dist/editors/adapters/opencode.d.ts +25 -0
- package/dist/editors/adapters/opencode.d.ts.map +1 -0
- package/dist/editors/adapters/opencode.js +74 -0
- package/dist/editors/adapters/opencode.js.map +1 -0
- package/dist/editors/adapters/windsurf.d.ts +1 -1
- package/dist/editors/adapters/windsurf.d.ts.map +1 -1
- package/dist/editors/adapters/windsurf.js +2 -1
- package/dist/editors/adapters/windsurf.js.map +1 -1
- package/dist/editors/adapters/zed.d.ts.map +1 -1
- package/dist/editors/adapters/zed.js +8 -3
- package/dist/editors/adapters/zed.js.map +1 -1
- package/dist/editors/import.d.ts +62 -1
- package/dist/editors/import.d.ts.map +1 -1
- package/dist/editors/import.js +431 -188
- package/dist/editors/import.js.map +1 -1
- package/dist/editors/index.d.ts +4 -4
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +2 -2
- package/dist/editors/index.js.map +1 -1
- package/dist/editors/install.d.ts.map +1 -1
- package/dist/editors/install.js +57 -11
- package/dist/editors/install.js.map +1 -1
- package/dist/editors/prompt-skill-installer.d.ts +17 -0
- package/dist/editors/prompt-skill-installer.d.ts.map +1 -0
- package/dist/editors/prompt-skill-installer.js +23 -0
- package/dist/editors/prompt-skill-installer.js.map +1 -0
- package/dist/editors/section-managed-markdown.d.ts +33 -0
- package/dist/editors/section-managed-markdown.d.ts.map +1 -0
- package/dist/editors/section-managed-markdown.js +97 -0
- package/dist/editors/section-managed-markdown.js.map +1 -0
- package/dist/editors/strategies/claude-code/hooks.d.ts +6 -1
- package/dist/editors/strategies/claude-code/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/hooks.js +278 -29
- package/dist/editors/strategies/claude-code/hooks.js.map +1 -1
- package/dist/editors/strategies/claude-code/mcp.d.ts +3 -2
- package/dist/editors/strategies/claude-code/mcp.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/mcp.js +8 -7
- package/dist/editors/strategies/claude-code/mcp.js.map +1 -1
- package/dist/editors/strategies/claude-code/prompts.d.ts +1 -1
- package/dist/editors/strategies/claude-code/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/prompts.js +18 -39
- package/dist/editors/strategies/claude-code/prompts.js.map +1 -1
- package/dist/editors/strategies/claude-code/rules.d.ts +1 -0
- package/dist/editors/strategies/claude-code/rules.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/rules.js +6 -3
- package/dist/editors/strategies/claude-code/rules.js.map +1 -1
- package/dist/editors/strategies/codex/prompts.d.ts +6 -5
- package/dist/editors/strategies/codex/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/codex/prompts.js +34 -55
- package/dist/editors/strategies/codex/prompts.js.map +1 -1
- package/dist/editors/strategies/codex/rules.d.ts +2 -1
- package/dist/editors/strategies/codex/rules.d.ts.map +1 -1
- package/dist/editors/strategies/codex/rules.js +22 -0
- package/dist/editors/strategies/codex/rules.js.map +1 -1
- package/dist/editors/strategies/copilot/hooks.d.ts +8 -4
- package/dist/editors/strategies/copilot/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/hooks.js +231 -60
- package/dist/editors/strategies/copilot/hooks.js.map +1 -1
- package/dist/editors/strategies/copilot/mcp.d.ts +4 -2
- package/dist/editors/strategies/copilot/mcp.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/mcp.js +83 -41
- package/dist/editors/strategies/copilot/mcp.js.map +1 -1
- package/dist/editors/strategies/copilot/prompts.d.ts +2 -1
- package/dist/editors/strategies/copilot/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/prompts.js +21 -71
- package/dist/editors/strategies/copilot/prompts.js.map +1 -1
- package/dist/editors/strategies/cursor/hooks.d.ts +8 -2
- package/dist/editors/strategies/cursor/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/cursor/hooks.js +174 -22
- package/dist/editors/strategies/cursor/hooks.js.map +1 -1
- package/dist/editors/strategies/cursor/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/cursor/prompts.js +11 -44
- package/dist/editors/strategies/cursor/prompts.js.map +1 -1
- package/dist/editors/strategies/cursor/rules.js +3 -3
- package/dist/editors/strategies/cursor/rules.js.map +1 -1
- package/dist/editors/strategies/gemini/hooks.d.ts +18 -0
- package/dist/editors/strategies/gemini/hooks.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/hooks.js +152 -0
- package/dist/editors/strategies/gemini/hooks.js.map +1 -0
- package/dist/editors/strategies/gemini/index.d.ts +5 -0
- package/dist/editors/strategies/gemini/index.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/index.js +5 -0
- package/dist/editors/strategies/gemini/index.js.map +1 -0
- package/dist/editors/strategies/gemini/mcp.d.ts +19 -0
- package/dist/editors/strategies/gemini/mcp.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/mcp.js +73 -0
- package/dist/editors/strategies/gemini/mcp.js.map +1 -0
- package/dist/editors/strategies/gemini/prompts.d.ts +34 -0
- package/dist/editors/strategies/gemini/prompts.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/prompts.js +92 -0
- package/dist/editors/strategies/gemini/prompts.js.map +1 -0
- package/dist/editors/strategies/gemini/rules.d.ts +19 -0
- package/dist/editors/strategies/gemini/rules.d.ts.map +1 -0
- package/dist/editors/strategies/gemini/rules.js +58 -0
- package/dist/editors/strategies/gemini/rules.js.map +1 -0
- package/dist/editors/strategies/index.d.ts +1 -0
- package/dist/editors/strategies/index.d.ts.map +1 -1
- package/dist/editors/strategies/index.js +1 -0
- package/dist/editors/strategies/index.js.map +1 -1
- package/dist/editors/strategies/opencode/import-utils.d.ts +5 -0
- package/dist/editors/strategies/opencode/import-utils.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/import-utils.js +181 -0
- package/dist/editors/strategies/opencode/import-utils.js.map +1 -0
- package/dist/editors/strategies/opencode/index.d.ts +4 -0
- package/dist/editors/strategies/opencode/index.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/index.js +4 -0
- package/dist/editors/strategies/opencode/index.js.map +1 -0
- package/dist/editors/strategies/opencode/mcp.d.ts +19 -0
- package/dist/editors/strategies/opencode/mcp.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/mcp.js +145 -0
- package/dist/editors/strategies/opencode/mcp.js.map +1 -0
- package/dist/editors/strategies/opencode/prompts.d.ts +22 -0
- package/dist/editors/strategies/opencode/prompts.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/prompts.js +102 -0
- package/dist/editors/strategies/opencode/prompts.js.map +1 -0
- package/dist/editors/strategies/opencode/rules.d.ts +19 -0
- package/dist/editors/strategies/opencode/rules.d.ts.map +1 -0
- package/dist/editors/strategies/opencode/rules.js +99 -0
- package/dist/editors/strategies/opencode/rules.js.map +1 -0
- package/dist/editors/strategies/shared/global-mcp.d.ts.map +1 -1
- package/dist/editors/strategies/shared/global-mcp.js +4 -6
- package/dist/editors/strategies/shared/global-mcp.js.map +1 -1
- package/dist/editors/strategies/shared/hook-import-utils.d.ts +21 -0
- package/dist/editors/strategies/shared/hook-import-utils.d.ts.map +1 -0
- package/dist/editors/strategies/shared/hook-import-utils.js +98 -0
- package/dist/editors/strategies/shared/hook-import-utils.js.map +1 -0
- package/dist/editors/strategies/shared/native-skills.d.ts +10 -4
- package/dist/editors/strategies/shared/native-skills.d.ts.map +1 -1
- package/dist/editors/strategies/shared/native-skills.js +29 -23
- package/dist/editors/strategies/shared/native-skills.js.map +1 -1
- package/dist/editors/strategies/shared/no-hooks.d.ts +8 -3
- package/dist/editors/strategies/shared/no-hooks.d.ts.map +1 -1
- package/dist/editors/strategies/shared/no-hooks.js +17 -2
- package/dist/editors/strategies/shared/no-hooks.js.map +1 -1
- package/dist/editors/strategies/shared/pointer-skills.d.ts +7 -2
- package/dist/editors/strategies/shared/pointer-skills.d.ts.map +1 -1
- package/dist/editors/strategies/shared/pointer-skills.js +21 -10
- package/dist/editors/strategies/shared/pointer-skills.js.map +1 -1
- package/dist/editors/strategies/shared/prompt-utils.d.ts +30 -0
- package/dist/editors/strategies/shared/prompt-utils.d.ts.map +1 -0
- package/dist/editors/strategies/shared/prompt-utils.js +101 -0
- package/dist/editors/strategies/shared/prompt-utils.js.map +1 -0
- package/dist/editors/strategies/types.d.ts +104 -2
- package/dist/editors/strategies/types.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/hooks.d.ts +6 -1
- package/dist/editors/strategies/windsurf/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/hooks.js +106 -20
- package/dist/editors/strategies/windsurf/hooks.js.map +1 -1
- package/dist/editors/strategies/windsurf/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/prompts.js +14 -62
- package/dist/editors/strategies/windsurf/prompts.js.map +1 -1
- package/dist/editors/strategies/windsurf/rules.js +3 -3
- package/dist/editors/strategies/windsurf/rules.js.map +1 -1
- package/dist/editors/strategies/windsurf/skills.d.ts +1 -1
- package/dist/editors/strategies/windsurf/skills.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/skills.js +4 -2
- package/dist/editors/strategies/windsurf/skills.js.map +1 -1
- package/dist/editors/strategies/zed/prompts.d.ts +2 -12
- package/dist/editors/strategies/zed/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/zed/prompts.js +2 -19
- package/dist/editors/strategies/zed/prompts.js.map +1 -1
- package/dist/editors/strategies/zed/rules.d.ts +2 -1
- package/dist/editors/strategies/zed/rules.d.ts.map +1 -1
- package/dist/editors/strategies/zed/rules.js +27 -0
- package/dist/editors/strategies/zed/rules.js.map +1 -1
- package/dist/editors/types.d.ts +44 -1
- package/dist/editors/types.d.ts.map +1 -1
- package/dist/entity-hash.d.ts +26 -0
- package/dist/entity-hash.d.ts.map +1 -0
- package/dist/entity-hash.js +106 -0
- package/dist/entity-hash.js.map +1 -0
- package/dist/env/ci.d.ts +0 -4
- package/dist/env/ci.d.ts.map +1 -1
- package/dist/env/ci.js +10 -8
- package/dist/env/ci.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +13 -1
- package/dist/errors.js.map +1 -1
- package/dist/format-error.d.ts +16 -3
- package/dist/format-error.d.ts.map +1 -1
- package/dist/format-error.js +101 -22
- package/dist/format-error.js.map +1 -1
- package/dist/frontmatter-utils.d.ts +7 -2
- package/dist/frontmatter-utils.d.ts.map +1 -1
- package/dist/frontmatter-utils.js +9 -2
- package/dist/frontmatter-utils.js.map +1 -1
- package/dist/fs/safe-rm.d.ts +2 -3
- package/dist/fs/safe-rm.d.ts.map +1 -1
- package/dist/fs/safe-rm.js +21 -10
- package/dist/fs/safe-rm.js.map +1 -1
- package/dist/git-download.js +4 -4
- package/dist/git-download.js.map +1 -1
- package/dist/git-loader.d.ts.map +1 -1
- package/dist/git-loader.js +5 -6
- package/dist/git-loader.js.map +1 -1
- package/dist/global/index.d.ts +3 -4
- package/dist/global/index.d.ts.map +1 -1
- package/dist/global/index.js +2 -3
- package/dist/global/index.js.map +1 -1
- package/dist/global/processor.d.ts.map +1 -1
- package/dist/global/processor.js +21 -59
- package/dist/global/processor.js.map +1 -1
- package/dist/global/types.d.ts +2 -0
- package/dist/global/types.d.ts.map +1 -1
- package/dist/import-writer.d.ts +2 -0
- package/dist/import-writer.d.ts.map +1 -1
- package/dist/import-writer.js +22 -24
- package/dist/import-writer.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/inheritance.d.ts.map +1 -1
- package/dist/inheritance.js +18 -17
- package/dist/inheritance.js.map +1 -1
- package/dist/json.js.map +1 -1
- package/dist/loader.d.ts +8 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +25 -12
- package/dist/loader.js.map +1 -1
- package/dist/lockfile.d.ts +31 -0
- package/dist/lockfile.d.ts.map +1 -0
- package/dist/lockfile.js +270 -0
- package/dist/lockfile.js.map +1 -0
- package/dist/mcp/env.d.ts.map +1 -1
- package/dist/mcp/env.js +3 -2
- package/dist/mcp/env.js.map +1 -1
- package/dist/merge.d.ts +9 -5
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +8 -6
- package/dist/merge.js.map +1 -1
- package/dist/npm/resolve.d.ts.map +1 -1
- package/dist/npm/resolve.js +15 -17
- package/dist/npm/resolve.js.map +1 -1
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +1 -0
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/loader.d.ts.map +1 -1
- package/dist/prompts/loader.js +4 -5
- package/dist/prompts/loader.js.map +1 -1
- package/dist/prompts/to-skills.d.ts +26 -0
- package/dist/prompts/to-skills.d.ts.map +1 -0
- package/dist/prompts/to-skills.js +87 -0
- package/dist/prompts/to-skills.js.map +1 -0
- package/dist/reference-resolver.d.ts +86 -0
- package/dist/reference-resolver.d.ts.map +1 -0
- package/dist/reference-resolver.js +250 -0
- package/dist/reference-resolver.js.map +1 -0
- package/dist/remote-loader.d.ts.map +1 -1
- package/dist/remote-loader.js +35 -19
- package/dist/remote-loader.js.map +1 -1
- package/dist/rules/loader.d.ts.map +1 -1
- package/dist/rules/loader.js +4 -5
- package/dist/rules/loader.js.map +1 -1
- package/dist/rules/merger.d.ts.map +1 -1
- package/dist/rules/merger.js +2 -2
- package/dist/rules/merger.js.map +1 -1
- package/dist/rules/skill-rules.d.ts.map +1 -1
- package/dist/rules/skill-rules.js +2 -2
- package/dist/rules/skill-rules.js.map +1 -1
- package/dist/rules/utils.js.map +1 -1
- package/dist/runtime/browser-dummy.d.ts +3 -0
- package/dist/runtime/browser-dummy.d.ts.map +1 -0
- package/dist/runtime/browser-dummy.js +46 -0
- package/dist/runtime/browser-dummy.js.map +1 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +23 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/node.d.ts +3 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +219 -0
- package/dist/runtime/node.js.map +1 -0
- package/dist/runtime/types.d.ts +130 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/skills/cache.js +2 -2
- package/dist/skills/cache.js.map +1 -1
- package/dist/skills/parser.d.ts.map +1 -1
- package/dist/skills/parser.js +6 -2
- package/dist/skills/parser.js.map +1 -1
- package/dist/skills/reference-parser.d.ts.map +1 -1
- package/dist/skills/reference-parser.js +6 -6
- package/dist/skills/reference-parser.js.map +1 -1
- package/dist/skills/resolve.js.map +1 -1
- package/dist/skills/resolvers/git.d.ts.map +1 -1
- package/dist/skills/resolvers/git.js +4 -5
- package/dist/skills/resolvers/git.js.map +1 -1
- package/dist/skills/resolvers/local.d.ts.map +1 -1
- package/dist/skills/resolvers/local.js +2 -2
- package/dist/skills/resolvers/local.js.map +1 -1
- package/dist/skills/resolvers/npm.d.ts.map +1 -1
- package/dist/skills/resolvers/npm.js +2 -2
- package/dist/skills/resolvers/npm.js.map +1 -1
- package/dist/skills/validate.d.ts.map +1 -1
- package/dist/skills/validate.js +4 -4
- package/dist/skills/validate.js.map +1 -1
- package/dist/state/index.d.ts +3 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +3 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/tracker.d.ts +68 -0
- package/dist/state/tracker.d.ts.map +1 -0
- package/dist/state/tracker.js +143 -0
- package/dist/state/tracker.js.map +1 -0
- package/dist/state/types.d.ts +37 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/types.js +2 -0
- package/dist/state/types.js.map +1 -0
- package/dist/updater.d.ts.map +1 -1
- package/dist/updater.js +18 -19
- package/dist/updater.js.map +1 -1
- package/dist/url-parsing.d.ts +12 -1
- package/dist/url-parsing.d.ts.map +1 -1
- package/dist/url-parsing.js +26 -3
- package/dist/url-parsing.js.map +1 -1
- package/package.json +14 -5
- package/dist/global/tracking.d.ts +0 -109
- package/dist/global/tracking.d.ts.map +0 -1
- package/dist/global/tracking.js +0 -193
- package/dist/global/tracking.js.map +0 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { EditorPrompt } from '../../types.js';
|
|
2
2
|
import type { ParsedPromptFrontmatter, PromptsStrategy } from '../types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Codex prompts strategy. Codex
|
|
5
|
-
*
|
|
4
|
+
* Codex prompts strategy. Following APM's Codex target mapping, aix does not deploy
|
|
5
|
+
* prompts for Codex; prompt-like reusable behavior should be packaged as skills.
|
|
6
6
|
*/
|
|
7
7
|
export declare class CodexPromptsStrategy implements PromptsStrategy {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Codex has deprecated user-level custom prompts, but no project-local prompt target.
|
|
10
|
+
* Treat prompts as unsupported so project installs do not mutate `~/.codex/prompts`.
|
|
10
11
|
*/
|
|
11
12
|
isSupported(): boolean;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* Codex does not get prompt deployment through aix.
|
|
14
15
|
*/
|
|
15
16
|
isGlobalOnly(): boolean;
|
|
16
17
|
getPromptsDir(): string;
|
|
@@ -29,7 +30,7 @@ export declare class CodexPromptsStrategy implements PromptsStrategy {
|
|
|
29
30
|
*/
|
|
30
31
|
readPrompt(name: string): Promise<string | null>;
|
|
31
32
|
formatPrompt(prompt: EditorPrompt): string;
|
|
32
|
-
parseGlobalPrompts(
|
|
33
|
+
parseGlobalPrompts(files: string[], readFile: (filename: string) => Promise<string>): Promise<{
|
|
33
34
|
prompts: Record<string, string>;
|
|
34
35
|
warnings: string[];
|
|
35
36
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/prompts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/prompts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAS5E;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IACzD;;;OAGG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB,aAAa,IAAI,MAAM;IAIvB,gBAAgB,IAAI,MAAM;IAI1B,oBAAoB,IAAI,MAAM;IAI9B;;OAEG;IACH,qBAAqB,IAAI,MAAM;IAI/B;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMlD;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IActD,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IASpC,kBAAkB,CACrB,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAC/C,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IASnE;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAStC;;;OAGG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,uBAAuB;CAG/D"}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
3
|
-
import { homedir } from 'node:os';
|
|
4
1
|
import { join } from 'pathe';
|
|
5
|
-
import {
|
|
2
|
+
import { getRuntimeAdapter } from '../../../runtime/index.js';
|
|
3
|
+
import { formatPromptFile, hasPromptFrontmatterFields, parsePromptFiles, parsePromptFrontmatter, } from '../shared/prompt-utils.js';
|
|
6
4
|
/**
|
|
7
|
-
* Codex prompts strategy. Codex
|
|
8
|
-
*
|
|
5
|
+
* Codex prompts strategy. Following APM's Codex target mapping, aix does not deploy
|
|
6
|
+
* prompts for Codex; prompt-like reusable behavior should be packaged as skills.
|
|
9
7
|
*/
|
|
10
8
|
export class CodexPromptsStrategy {
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
10
|
+
* Codex has deprecated user-level custom prompts, but no project-local prompt target.
|
|
11
|
+
* Treat prompts as unsupported so project installs do not mutate `~/.codex/prompts`.
|
|
13
12
|
*/
|
|
14
13
|
isSupported() {
|
|
15
|
-
return
|
|
14
|
+
return false;
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
17
|
+
* Codex does not get prompt deployment through aix.
|
|
19
18
|
*/
|
|
20
19
|
isGlobalOnly() {
|
|
21
|
-
return
|
|
20
|
+
return false;
|
|
22
21
|
}
|
|
23
22
|
getPromptsDir() {
|
|
24
23
|
return '';
|
|
@@ -27,90 +26,70 @@ export class CodexPromptsStrategy {
|
|
|
27
26
|
return '.md';
|
|
28
27
|
}
|
|
29
28
|
getGlobalPromptsPath() {
|
|
30
|
-
return '
|
|
29
|
+
return '';
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
32
|
* Get the absolute path to the global prompts directory.
|
|
34
33
|
*/
|
|
35
34
|
getAbsoluteGlobalPath() {
|
|
36
|
-
return join(homedir(), this.getGlobalPromptsPath());
|
|
35
|
+
return join(getRuntimeAdapter().os.homedir(), this.getGlobalPromptsPath());
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
39
38
|
* Check if a prompt exists in the global prompts directory.
|
|
40
39
|
*/
|
|
41
40
|
async promptExists(name) {
|
|
42
41
|
const promptPath = join(this.getAbsoluteGlobalPath(), `${name}.md`);
|
|
43
|
-
return existsSync(promptPath);
|
|
42
|
+
return getRuntimeAdapter().fs.existsSync(promptPath);
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
45
|
* Read an existing prompt from the global prompts directory.
|
|
47
46
|
*/
|
|
48
47
|
async readPrompt(name) {
|
|
49
48
|
const promptPath = join(this.getAbsoluteGlobalPath(), `${name}.md`);
|
|
50
|
-
if (!existsSync(promptPath)) {
|
|
49
|
+
if (!getRuntimeAdapter().fs.existsSync(promptPath)) {
|
|
51
50
|
return null;
|
|
52
51
|
}
|
|
53
52
|
try {
|
|
54
|
-
return await readFile(promptPath, 'utf-8');
|
|
53
|
+
return await getRuntimeAdapter().fs.readFile(promptPath, 'utf-8');
|
|
55
54
|
}
|
|
56
55
|
catch {
|
|
57
56
|
return null;
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
formatPrompt(prompt) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
const lines = [];
|
|
69
|
-
if (Object.keys(frontmatter).length > 0) {
|
|
70
|
-
lines.push('---');
|
|
71
|
-
for (const [key, value] of Object.entries(frontmatter)) {
|
|
72
|
-
lines.push(`${key}: ${value}`);
|
|
73
|
-
}
|
|
74
|
-
lines.push('---', '');
|
|
75
|
-
}
|
|
76
|
-
lines.push(prompt.content);
|
|
77
|
-
return lines.join('\n');
|
|
60
|
+
return formatPromptFile(prompt, {
|
|
61
|
+
frontmatterFields: [
|
|
62
|
+
{ key: 'description', value: prompt.description },
|
|
63
|
+
{ key: 'argument-hint', value: prompt.argumentHint },
|
|
64
|
+
],
|
|
65
|
+
});
|
|
78
66
|
}
|
|
79
|
-
async parseGlobalPrompts(
|
|
80
|
-
return {
|
|
67
|
+
async parseGlobalPrompts(files, readFile) {
|
|
68
|
+
return parsePromptFiles({
|
|
69
|
+
files,
|
|
70
|
+
readFile,
|
|
71
|
+
includeFile: (file) => file.endsWith('.md'),
|
|
72
|
+
stripSuffix: /\.md$/,
|
|
73
|
+
});
|
|
81
74
|
}
|
|
82
75
|
/**
|
|
83
76
|
* Detect if content appears to be in Codex's prompt frontmatter format.
|
|
84
77
|
* Codex prompts use `description:` and optionally `argument-hint:` fields (similar to GitHub Copilot).
|
|
85
78
|
*/
|
|
86
79
|
detectFormat(content) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return parseYamlValue(lines, 'description') !== undefined
|
|
94
|
-
&& parseYamlValue(lines, 'mode') === undefined
|
|
95
|
-
&& parseYamlValue(lines, 'tools') === undefined
|
|
96
|
-
&& parseYamlValue(lines, 'allowed-tools') === undefined
|
|
97
|
-
&& parseYamlValue(lines, 'context') === undefined;
|
|
80
|
+
return hasPromptFrontmatterFields(content, ['description'], [
|
|
81
|
+
'mode',
|
|
82
|
+
'tools',
|
|
83
|
+
'allowed-tools',
|
|
84
|
+
'context',
|
|
85
|
+
]);
|
|
98
86
|
}
|
|
99
87
|
/**
|
|
100
88
|
* Parse Codex-specific frontmatter into unified format.
|
|
101
89
|
* Extracts `description` and `argument-hint` fields.
|
|
102
90
|
*/
|
|
103
91
|
parseFrontmatter(rawContent) {
|
|
104
|
-
|
|
105
|
-
if (!hasFrontmatter) {
|
|
106
|
-
return { content: rawContent };
|
|
107
|
-
}
|
|
108
|
-
const lines = frontmatter.split('\n'), description = parseYamlValue(lines, 'description'), argumentHint = parseYamlValue(lines, 'argument-hint');
|
|
109
|
-
return {
|
|
110
|
-
content,
|
|
111
|
-
description,
|
|
112
|
-
argumentHint,
|
|
113
|
-
};
|
|
92
|
+
return parsePromptFrontmatter(rawContent, ['description', 'argument-hint']);
|
|
114
93
|
}
|
|
115
94
|
}
|
|
116
95
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACJ,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,GACxB,MAAM,2BAA2B,CAAC;AAEnC;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAC9B;;;OAGG;IACH,WAAW;QACR,OAAO,KAAK,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,YAAY;QACT,OAAO,KAAK,CAAC;IAChB,CAAC;IAED,aAAa;QACV,OAAO,EAAE,CAAC;IACb,CAAC;IAED,gBAAgB;QACb,OAAO,KAAK,CAAC;IAChB,CAAC;IAED,oBAAoB;QACjB,OAAO,EAAE,CAAC;IACb,CAAC;IAED;;OAEG;IACH,qBAAqB;QAClB,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,IAAY;QAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;QAEpE,OAAO,iBAAiB,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,IAAY;QAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;QAEpE,IAAI,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAClD,OAAO,IAAI,CAAC;QACf,CAAC;QAED,IAAI,CAAC;YACF,OAAO,MAAM,iBAAiB,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACrE,CAAC;QAAC,MAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACf,CAAC;IACJ,CAAC;IAED,YAAY,CAAC,MAAoB;QAC9B,OAAO,gBAAgB,CAAC,MAAM,EAAE;YAC7B,iBAAiB,EAAE;gBAChB,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE;gBACjD,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE;aACtD;SACH,CAAC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,kBAAkB,CACrB,KAAe,EACf,QAA+C;QAE/C,OAAO,gBAAgB,CAAC;YACrB,KAAK;YACL,QAAQ;YACR,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC3C,WAAW,EAAE,OAAO;SACtB,CAAC,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,OAAe;QACzB,OAAO,0BAA0B,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE;YACzD,MAAM;YACN,OAAO;YACP,eAAe;YACf,SAAS;SACX,CAAC,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,UAAkB;QAChC,OAAO,sBAAsB,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC;IAC/E,CAAC;CACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RulesStrategy } from '../types.js';
|
|
1
|
+
import type { ImportedRulesResult, RulesStrategy } from '../types.js';
|
|
2
2
|
import type { EditorRule } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Codex CLI rules strategy. Uses `AGENTS.md` files at the project root (and optionally in
|
|
@@ -13,6 +13,7 @@ export declare class CodexRulesStrategy implements RulesStrategy {
|
|
|
13
13
|
rules: string[];
|
|
14
14
|
warnings: string[];
|
|
15
15
|
};
|
|
16
|
+
importProjectRules(projectRoot: string): Promise<ImportedRulesResult>;
|
|
16
17
|
formatRule(rule: EditorRule): string;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACrD,WAAW,IAAI,MAAM;IAKrB,gBAAgB,IAAI,MAAM;IAI1B,kBAAkB,IAAI,MAAM,GAAG,IAAI;IAInC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE;IASpE,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAwB3E,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;CActC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { join } from 'pathe';
|
|
2
|
+
import { getRuntimeAdapter } from '../../../runtime/index.js';
|
|
1
3
|
/**
|
|
2
4
|
* Codex CLI rules strategy. Uses `AGENTS.md` files at the project root (and optionally in
|
|
3
5
|
* subdirectories for glob-scoped rules). Plain markdown, no frontmatter. The adapter handles
|
|
@@ -21,6 +23,26 @@ export class CodexRulesStrategy {
|
|
|
21
23
|
}
|
|
22
24
|
return { rules, warnings: [] };
|
|
23
25
|
}
|
|
26
|
+
async importProjectRules(projectRoot) {
|
|
27
|
+
const warnings = [], agentsPath = join(projectRoot, 'AGENTS.md');
|
|
28
|
+
try {
|
|
29
|
+
const content = await getRuntimeAdapter().fs.readFile(agentsPath, 'utf-8');
|
|
30
|
+
if (content.trim()) {
|
|
31
|
+
return {
|
|
32
|
+
rules: [{ content: content.trim(), name: 'AGENTS', path: agentsPath, scope: 'project' }],
|
|
33
|
+
paths: { AGENTS: agentsPath },
|
|
34
|
+
scopes: { AGENTS: 'project' },
|
|
35
|
+
warnings,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
if (err.code !== 'ENOENT') {
|
|
41
|
+
warnings.push(`Failed to read Codex rules from ${agentsPath}: ${err.message}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return { rules: [], paths: {}, scopes: {}, warnings };
|
|
45
|
+
}
|
|
24
46
|
formatRule(rule) {
|
|
25
47
|
const lines = [];
|
|
26
48
|
// Codex uses plain markdown without frontmatter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAC5B,WAAW;QACR,kFAAkF;QAClF,OAAO,IAAI,CAAC;IACf,CAAC;IAED,gBAAgB;QACb,OAAO,KAAK,CAAC;IAChB,CAAC;IAED,kBAAkB;QACf,OAAO,kBAAkB,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,OAAe;QAC7B,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,WAAmB;QACzC,MAAM,QAAQ,GAAa,EAAE,EACvB,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAElD,IAAI,CAAC;YACF,MAAM,OAAO,GAAG,MAAM,iBAAiB,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAE3E,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;gBAClB,OAAO;oBACJ,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;oBACxF,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;oBAC7B,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;oBAC7B,QAAQ;iBACV,CAAC;YACL,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACZ,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACpD,QAAQ,CAAC,IAAI,CAAC,mCAAmC,UAAU,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7F,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;IACzD,CAAC;IAED,UAAU,CAAC,IAAgB;QACxB,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,gDAAgD;QAChD,+FAA+F;QAC/F,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAElE,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACH"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { HooksConfig } from '@a1st/aix-schema';
|
|
2
|
-
import type { HooksStrategy } from '../types.js';
|
|
2
|
+
import type { HooksStrategy, ParsedHooksImportResult, UnsupportedHookField } from '../types.js';
|
|
3
3
|
/**
|
|
4
|
-
* GitHub Copilot hooks strategy. Writes hooks to `.github/hooks/hooks.json
|
|
5
|
-
*
|
|
6
|
-
* Uses the same matcher-based structure as Claude Code hooks.
|
|
4
|
+
* GitHub Copilot CLI hooks strategy. Writes hooks to `.github/hooks/hooks.json` (project)
|
|
5
|
+
* or `~/.copilot/hooks/hooks.json` (user). Wraps output with `version: 1`.
|
|
7
6
|
*/
|
|
8
7
|
export declare class CopilotHooksStrategy implements HooksStrategy {
|
|
9
8
|
isSupported(): boolean;
|
|
10
9
|
getConfigPath(): string;
|
|
10
|
+
getGlobalConfigPath(): string;
|
|
11
11
|
getUnsupportedEvents(hooks: HooksConfig): string[];
|
|
12
|
+
getUnsupportedFields(hooks: HooksConfig): UnsupportedHookField[];
|
|
13
|
+
getSupportedEvents(): readonly string[];
|
|
14
|
+
getNativeEventNames(): readonly string[];
|
|
15
|
+
parseImportedConfig(content: string): ParsedHooksImportResult;
|
|
12
16
|
formatConfig(hooks: HooksConfig): string;
|
|
13
17
|
}
|
|
14
18
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/copilot/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/copilot/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAuNhG;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACvD,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM;IAKvB,mBAAmB,IAAI,MAAM;IAI7B,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE;IAIlD,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,oBAAoB,EAAE;IAyBhE,kBAAkB,IAAI,SAAS,MAAM,EAAE;IAIvC,mBAAmB,IAAI,SAAS,MAAM,EAAE;IAIxC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB;IAkB7D,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;CAqD1C"}
|
|
@@ -1,95 +1,266 @@
|
|
|
1
|
+
import { parseHookObject, parseMatcherImportedHooks } from '../shared/hook-import-utils.js';
|
|
1
2
|
/**
|
|
2
|
-
* Map from generic ai.json hook events to GitHub Copilot's
|
|
3
|
-
*
|
|
4
|
-
* PostToolUse, PreCompact, SubagentStart, SubagentStop, Stop.
|
|
3
|
+
* Map from generic ai.json hook events to GitHub Copilot CLI's camelCase event names.
|
|
4
|
+
* Source: https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-hooks-reference
|
|
5
5
|
*/
|
|
6
6
|
const EVENT_MAP = {
|
|
7
|
-
pre_tool_use: '
|
|
8
|
-
post_tool_use: '
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
pre_tool_use: 'preToolUse',
|
|
8
|
+
post_tool_use: 'postToolUse',
|
|
9
|
+
post_tool_use_failure: 'postToolUseFailure',
|
|
10
|
+
pre_file_read: 'preToolUse',
|
|
11
|
+
post_file_read: 'postToolUse',
|
|
12
|
+
pre_file_write: 'preToolUse',
|
|
13
|
+
post_file_write: 'postToolUse',
|
|
14
|
+
pre_command: 'preToolUse',
|
|
15
|
+
post_command: 'postToolUse',
|
|
16
|
+
pre_mcp_tool: 'preToolUse',
|
|
17
|
+
post_mcp_tool: 'postToolUse',
|
|
18
|
+
permission_request: 'permissionRequest',
|
|
19
|
+
notification: 'notification',
|
|
20
|
+
session_start: 'sessionStart',
|
|
21
|
+
session_end: 'sessionEnd',
|
|
22
|
+
agent_stop: 'agentStop',
|
|
23
|
+
pre_prompt: 'userPromptSubmitted',
|
|
24
|
+
pre_compact: 'preCompact',
|
|
25
|
+
subagent_start: 'subagentStart',
|
|
26
|
+
subagent_stop: 'subagentStop',
|
|
27
|
+
error_occurred: 'errorOccurred',
|
|
20
28
|
};
|
|
21
29
|
/**
|
|
22
|
-
* Tool-name matchers
|
|
23
|
-
*
|
|
24
|
-
*
|
|
30
|
+
* Tool-name matchers for Copilot CLI's tool registry. Tool names taken from the docs:
|
|
31
|
+
* `ask_user`, `bash`, `create`, `edit`, `glob`, `grep`, `powershell`, `task`, `view`,
|
|
32
|
+
* `web_fetch`.
|
|
25
33
|
*/
|
|
26
34
|
const TOOL_MATCHER_MAP = {
|
|
27
|
-
pre_command: '
|
|
28
|
-
post_command: '
|
|
29
|
-
pre_file_read: '
|
|
30
|
-
post_file_read: '
|
|
31
|
-
pre_file_write: '
|
|
32
|
-
post_file_write: '
|
|
35
|
+
pre_command: 'bash|powershell',
|
|
36
|
+
post_command: 'bash|powershell',
|
|
37
|
+
pre_file_read: 'view',
|
|
38
|
+
post_file_read: 'view',
|
|
39
|
+
pre_file_write: 'create|edit',
|
|
40
|
+
post_file_write: 'create|edit',
|
|
33
41
|
pre_mcp_tool: 'mcp__.*',
|
|
34
42
|
post_mcp_tool: 'mcp__.*',
|
|
35
43
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
'
|
|
44
|
+
const SUPPORTED_EVENTS = new Set(Object.keys(EVENT_MAP));
|
|
45
|
+
/** Fields the Copilot command hook entry surfaces natively. */
|
|
46
|
+
const COPILOT_COMMAND_FIELDS = new Set([
|
|
47
|
+
'type',
|
|
48
|
+
'command',
|
|
49
|
+
'bash',
|
|
50
|
+
'powershell',
|
|
51
|
+
'shell',
|
|
52
|
+
'cwd',
|
|
53
|
+
'working_directory',
|
|
54
|
+
'env',
|
|
55
|
+
'timeout',
|
|
56
|
+
'description',
|
|
57
|
+
'name',
|
|
58
|
+
]);
|
|
59
|
+
/** Fields the Copilot prompt hook entry (sessionStart only) surfaces natively. */
|
|
60
|
+
const COPILOT_PROMPT_FIELDS = new Set([
|
|
61
|
+
'type',
|
|
62
|
+
'prompt',
|
|
54
63
|
]);
|
|
64
|
+
function buildCommandEntry(action) {
|
|
65
|
+
const useBash = action.shell !== 'powershell', useShell = action.shell !== 'bash', bash = useBash ? action.bash ?? (action.shell !== 'powershell' ? action.command : undefined) : undefined, powershell = useShell
|
|
66
|
+
? action.powershell ?? (action.shell === 'powershell' ? action.command : undefined)
|
|
67
|
+
: undefined;
|
|
68
|
+
if (!bash && !powershell) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const entry = { type: 'command' };
|
|
72
|
+
if (bash) {
|
|
73
|
+
entry.bash = bash;
|
|
74
|
+
}
|
|
75
|
+
if (powershell) {
|
|
76
|
+
entry.powershell = powershell;
|
|
77
|
+
}
|
|
78
|
+
const cwd = action.cwd ?? action.working_directory;
|
|
79
|
+
if (cwd) {
|
|
80
|
+
entry.cwd = cwd;
|
|
81
|
+
}
|
|
82
|
+
if (action.env) {
|
|
83
|
+
entry.env = action.env;
|
|
84
|
+
}
|
|
85
|
+
if (action.timeout !== undefined) {
|
|
86
|
+
entry.timeoutSec = action.timeout;
|
|
87
|
+
}
|
|
88
|
+
return entry;
|
|
89
|
+
}
|
|
90
|
+
function buildPromptEntry(action) {
|
|
91
|
+
if (!action.prompt) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
return { type: 'prompt', prompt: action.prompt };
|
|
95
|
+
}
|
|
96
|
+
function parseCopilotAction(value) {
|
|
97
|
+
if (!value || typeof value !== 'object') {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const entry = value;
|
|
101
|
+
if (entry.type === 'prompt') {
|
|
102
|
+
if (typeof entry.prompt !== 'string' || entry.prompt.length === 0) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
type: 'prompt',
|
|
107
|
+
prompt: entry.prompt,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const command = typeof entry.command === 'string' && entry.command.length > 0 ? entry.command : undefined, bash = typeof entry.bash === 'string' && entry.bash.length > 0 ? entry.bash : command, powershell = typeof entry.powershell === 'string' && entry.powershell.length > 0 ? entry.powershell : undefined;
|
|
111
|
+
if (!bash && !powershell) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const action = {};
|
|
115
|
+
if (command) {
|
|
116
|
+
action.command = command;
|
|
117
|
+
}
|
|
118
|
+
else if (bash) {
|
|
119
|
+
action.bash = bash;
|
|
120
|
+
}
|
|
121
|
+
if (powershell) {
|
|
122
|
+
action.powershell = powershell;
|
|
123
|
+
}
|
|
124
|
+
if (typeof entry.cwd === 'string' && entry.cwd.length > 0) {
|
|
125
|
+
action.cwd = entry.cwd;
|
|
126
|
+
}
|
|
127
|
+
if (isStringRecord(entry.env)) {
|
|
128
|
+
action.env = entry.env;
|
|
129
|
+
}
|
|
130
|
+
if (typeof entry.timeoutSec === 'number' && entry.timeoutSec > 0) {
|
|
131
|
+
action.timeout = entry.timeoutSec;
|
|
132
|
+
}
|
|
133
|
+
else if (typeof entry.timeout === 'number' && entry.timeout > 0) {
|
|
134
|
+
action.timeout = entry.timeout;
|
|
135
|
+
}
|
|
136
|
+
return action;
|
|
137
|
+
}
|
|
138
|
+
function normalizeImportedMatcher(matcher) {
|
|
139
|
+
switch (matcher) {
|
|
140
|
+
case 'Bash':
|
|
141
|
+
return 'bash|powershell';
|
|
142
|
+
case 'Read':
|
|
143
|
+
return 'view';
|
|
144
|
+
case 'Write|Edit':
|
|
145
|
+
return 'create|edit';
|
|
146
|
+
default:
|
|
147
|
+
return matcher;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function normalizeImportedHookObject(rawHooks) {
|
|
151
|
+
if (rawHooks.stop !== undefined && rawHooks.agentStop === undefined) {
|
|
152
|
+
return {
|
|
153
|
+
...rawHooks,
|
|
154
|
+
agentStop: rawHooks.stop,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return rawHooks;
|
|
158
|
+
}
|
|
159
|
+
function isStringRecord(value) {
|
|
160
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return Object.values(value).every((entry) => typeof entry === 'string');
|
|
164
|
+
}
|
|
55
165
|
/**
|
|
56
|
-
* GitHub Copilot hooks strategy. Writes hooks to `.github/hooks/hooks.json
|
|
57
|
-
*
|
|
58
|
-
* Uses the same matcher-based structure as Claude Code hooks.
|
|
166
|
+
* GitHub Copilot CLI hooks strategy. Writes hooks to `.github/hooks/hooks.json` (project)
|
|
167
|
+
* or `~/.copilot/hooks/hooks.json` (user). Wraps output with `version: 1`.
|
|
59
168
|
*/
|
|
60
169
|
export class CopilotHooksStrategy {
|
|
61
170
|
isSupported() {
|
|
62
171
|
return true;
|
|
63
172
|
}
|
|
64
173
|
getConfigPath() {
|
|
65
|
-
//
|
|
174
|
+
// Copilot hooks live in `.github/hooks/`, two levels up from `.vscode/`.
|
|
66
175
|
return '../.github/hooks/hooks.json';
|
|
67
176
|
}
|
|
177
|
+
getGlobalConfigPath() {
|
|
178
|
+
return '.copilot/hooks/hooks.json';
|
|
179
|
+
}
|
|
68
180
|
getUnsupportedEvents(hooks) {
|
|
69
181
|
return Object.keys(hooks).filter((event) => !SUPPORTED_EVENTS.has(event));
|
|
70
182
|
}
|
|
183
|
+
getUnsupportedFields(hooks) {
|
|
184
|
+
const result = [];
|
|
185
|
+
for (const [event, matchers] of Object.entries(hooks)) {
|
|
186
|
+
matchers?.forEach((matcher, matcherIndex) => {
|
|
187
|
+
matcher.hooks?.forEach((action, actionIndex) => {
|
|
188
|
+
const type = action.type ?? 'command';
|
|
189
|
+
const recognized = type === 'prompt' ? COPILOT_PROMPT_FIELDS : COPILOT_COMMAND_FIELDS;
|
|
190
|
+
const fields = Object.keys(action)
|
|
191
|
+
.filter((field) => !recognized.has(field));
|
|
192
|
+
if (type === 'prompt' && event !== 'session_start') {
|
|
193
|
+
fields.push('prompt');
|
|
194
|
+
}
|
|
195
|
+
if (fields.length > 0) {
|
|
196
|
+
result.push({ event, matcherIndex, actionIndex, fields });
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
getSupportedEvents() {
|
|
204
|
+
return Object.keys(EVENT_MAP).toSorted();
|
|
205
|
+
}
|
|
206
|
+
getNativeEventNames() {
|
|
207
|
+
return Array.from(new Set(Object.values(EVENT_MAP))).toSorted();
|
|
208
|
+
}
|
|
209
|
+
parseImportedConfig(content) {
|
|
210
|
+
const parsed = parseHookObject(content);
|
|
211
|
+
if (!parsed.rawHooks) {
|
|
212
|
+
return { hooks: {}, warnings: parsed.warnings };
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
hooks: parseMatcherImportedHooks(normalizeImportedHookObject(parsed.rawHooks), {
|
|
216
|
+
eventMap: EVENT_MAP,
|
|
217
|
+
parseAction: parseCopilotAction,
|
|
218
|
+
toolMatchers: TOOL_MATCHER_MAP,
|
|
219
|
+
normalizeMatcher: normalizeImportedMatcher,
|
|
220
|
+
}),
|
|
221
|
+
warnings: parsed.warnings,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
71
224
|
formatConfig(hooks) {
|
|
72
225
|
const copilotHooks = {};
|
|
73
226
|
for (const [event, matchers] of Object.entries(hooks)) {
|
|
74
227
|
const copilotEvent = EVENT_MAP[event];
|
|
75
|
-
if (!copilotEvent) {
|
|
228
|
+
if (!copilotEvent || !matchers) {
|
|
76
229
|
continue;
|
|
77
230
|
}
|
|
78
231
|
const toolMatcher = TOOL_MATCHER_MAP[event];
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
type
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
232
|
+
const groups = matchers.map((matcher) => {
|
|
233
|
+
const entries = [];
|
|
234
|
+
for (const action of matcher.hooks) {
|
|
235
|
+
const type = action.type ?? 'command';
|
|
236
|
+
if (type === 'prompt' && event === 'session_start') {
|
|
237
|
+
const prompt = buildPromptEntry(action);
|
|
238
|
+
if (prompt) {
|
|
239
|
+
entries.push(prompt);
|
|
240
|
+
}
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
if (type !== 'command') {
|
|
244
|
+
// Drop unsupported types; user is warned via getUnsupportedFields.
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
const command = buildCommandEntry(action);
|
|
248
|
+
if (command) {
|
|
249
|
+
entries.push(command);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
matcher: toolMatcher ?? matcher.matcher ?? '',
|
|
254
|
+
hooks: entries,
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
const nonEmpty = groups.filter((group) => group.hooks.length > 0);
|
|
258
|
+
if (nonEmpty.length === 0) {
|
|
259
|
+
continue;
|
|
89
260
|
}
|
|
90
|
-
copilotHooks[copilotEvent].
|
|
261
|
+
copilotHooks[copilotEvent] = (copilotHooks[copilotEvent] ?? []).concat(nonEmpty);
|
|
91
262
|
}
|
|
92
|
-
return JSON.stringify({ hooks: copilotHooks }, null, 2) + '\n';
|
|
263
|
+
return JSON.stringify({ version: 1, hooks: copilotHooks }, null, 2) + '\n';
|
|
93
264
|
}
|
|
94
265
|
}
|
|
95
266
|
//# sourceMappingURL=hooks.js.map
|