@a1st/aix-core 0.1.0 → 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/editors/adapters/base.d.ts +2 -1
- package/dist/editors/adapters/base.d.ts.map +1 -1
- package/dist/editors/adapters/base.js +10 -0
- package/dist/editors/adapters/base.js.map +1 -1
- package/dist/editors/adapters/claude-code.js +3 -3
- package/dist/editors/adapters/claude-code.js.map +1 -1
- package/dist/editors/adapters/codex.d.ts.map +1 -1
- package/dist/editors/adapters/codex.js +7 -15
- package/dist/editors/adapters/codex.js.map +1 -1
- package/dist/editors/adapters/copilot.d.ts +3 -2
- package/dist/editors/adapters/copilot.d.ts.map +1 -1
- package/dist/editors/adapters/copilot.js +21 -6
- package/dist/editors/adapters/copilot.js.map +1 -1
- package/dist/editors/adapters/gemini.d.ts +12 -2
- package/dist/editors/adapters/gemini.d.ts.map +1 -1
- package/dist/editors/adapters/gemini.js +51 -11
- package/dist/editors/adapters/gemini.js.map +1 -1
- package/dist/editors/import.d.ts +2 -1
- package/dist/editors/import.d.ts.map +1 -1
- package/dist/editors/import.js +95 -780
- package/dist/editors/import.js.map +1 -1
- package/dist/editors/install.d.ts.map +1 -1
- package/dist/editors/install.js +1 -3
- 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/strategies/claude-code/hooks.d.ts +5 -1
- package/dist/editors/strategies/claude-code/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/hooks.js +270 -38
- 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 +6 -5
- package/dist/editors/strategies/claude-code/mcp.js.map +1 -1
- package/dist/editors/strategies/claude-code/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/claude-code/prompts.js +15 -67
- 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 +3 -0
- package/dist/editors/strategies/claude-code/rules.js.map +1 -1
- package/dist/editors/strategies/codex/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/codex/prompts.js +20 -72
- 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 +7 -4
- package/dist/editors/strategies/copilot/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/hooks.js +212 -50
- package/dist/editors/strategies/copilot/hooks.js.map +1 -1
- package/dist/editors/strategies/copilot/mcp.d.ts +1 -0
- package/dist/editors/strategies/copilot/mcp.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/mcp.js +7 -0
- package/dist/editors/strategies/copilot/mcp.js.map +1 -1
- package/dist/editors/strategies/copilot/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/copilot/prompts.js +17 -69
- package/dist/editors/strategies/copilot/prompts.js.map +1 -1
- package/dist/editors/strategies/cursor/hooks.d.ts +7 -2
- package/dist/editors/strategies/cursor/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/cursor/hooks.js +171 -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/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 +1 -0
- package/dist/editors/strategies/gemini/index.d.ts.map +1 -1
- package/dist/editors/strategies/gemini/index.js +1 -0
- package/dist/editors/strategies/gemini/index.js.map +1 -1
- package/dist/editors/strategies/gemini/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/gemini/prompts.js +7 -33
- package/dist/editors/strategies/gemini/prompts.js.map +1 -1
- package/dist/editors/strategies/gemini/rules.d.ts +2 -1
- package/dist/editors/strategies/gemini/rules.d.ts.map +1 -1
- package/dist/editors/strategies/gemini/rules.js +22 -0
- package/dist/editors/strategies/gemini/rules.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/mcp.d.ts +2 -0
- package/dist/editors/strategies/opencode/mcp.d.ts.map +1 -1
- package/dist/editors/strategies/opencode/mcp.js +11 -3
- package/dist/editors/strategies/opencode/mcp.js.map +1 -1
- package/dist/editors/strategies/opencode/prompts.d.ts +3 -1
- package/dist/editors/strategies/opencode/prompts.d.ts.map +1 -1
- package/dist/editors/strategies/opencode/prompts.js +72 -64
- package/dist/editors/strategies/opencode/prompts.js.map +1 -1
- package/dist/editors/strategies/opencode/rules.d.ts +3 -1
- package/dist/editors/strategies/opencode/rules.d.ts.map +1 -1
- package/dist/editors/strategies/opencode/rules.js +68 -0
- package/dist/editors/strategies/opencode/rules.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 +2 -0
- package/dist/editors/strategies/shared/native-skills.d.ts.map +1 -1
- package/dist/editors/strategies/shared/native-skills.js +6 -0
- package/dist/editors/strategies/shared/native-skills.js.map +1 -1
- package/dist/editors/strategies/shared/no-hooks.d.ts +7 -3
- package/dist/editors/strategies/shared/no-hooks.d.ts.map +1 -1
- package/dist/editors/strategies/shared/no-hooks.js +14 -2
- package/dist/editors/strategies/shared/no-hooks.js.map +1 -1
- package/dist/editors/strategies/shared/pointer-skills.d.ts +2 -0
- package/dist/editors/strategies/shared/pointer-skills.d.ts.map +1 -1
- package/dist/editors/strategies/shared/pointer-skills.js +6 -0
- 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 +95 -0
- package/dist/editors/strategies/types.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/hooks.d.ts +5 -1
- package/dist/editors/strategies/windsurf/hooks.d.ts.map +1 -1
- package/dist/editors/strategies/windsurf/hooks.js +102 -21
- 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.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 +5 -0
- package/dist/editors/types.d.ts.map +1 -1
- package/dist/entity-hash.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/fs/safe-rm.d.ts +2 -3
- package/dist/fs/safe-rm.d.ts.map +1 -1
- package/dist/fs/safe-rm.js +7 -1
- package/dist/fs/safe-rm.js.map +1 -1
- package/dist/global/processor.d.ts.map +1 -1
- package/dist/global/processor.js +3 -2
- package/dist/global/processor.js.map +1 -1
- package/dist/inheritance.js.map +1 -1
- package/dist/json.js.map +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +3 -3
- package/dist/loader.js.map +1 -1
- package/dist/merge.js.map +1 -1
- package/dist/reference-resolver.js.map +1 -1
- package/dist/remote-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/utils.js.map +1 -1
- package/dist/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +11 -4
- package/dist/runtime/node.js.map +1 -1
- package/dist/skills/resolve.js.map +1 -1
- package/package.json +10 -5
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { McpServerConfig, ParsedSkill, HooksConfig, ActivationMode } from '@a1st/aix-schema';
|
|
2
2
|
import type { EditorPrompt, EditorRule, FileChange } from '../types.js';
|
|
3
|
+
import type { NamedRule } from '../../import-writer.js';
|
|
3
4
|
/**
|
|
4
5
|
* Result of parsing editor-specific frontmatter for rules.
|
|
5
6
|
*/
|
|
@@ -28,6 +29,44 @@ export interface ParsedPromptFrontmatter {
|
|
|
28
29
|
/** Raw frontmatter fields for round-tripping unknown fields */
|
|
29
30
|
rawFrontmatter?: Record<string, unknown>;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Supported import scopes for editor-owned config.
|
|
34
|
+
*/
|
|
35
|
+
export type EditorImportScope = 'project' | 'user';
|
|
36
|
+
/**
|
|
37
|
+
* Result shape for rule imports.
|
|
38
|
+
*/
|
|
39
|
+
export interface ImportedRulesResult {
|
|
40
|
+
rules: NamedRule[];
|
|
41
|
+
paths: Record<string, string>;
|
|
42
|
+
scopes: Record<string, EditorImportScope>;
|
|
43
|
+
warnings: string[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Result shape for prompt imports.
|
|
47
|
+
*/
|
|
48
|
+
export interface ImportedPromptsResult {
|
|
49
|
+
prompts: Record<string, string>;
|
|
50
|
+
paths: Record<string, string>;
|
|
51
|
+
scopes: Record<string, EditorImportScope>;
|
|
52
|
+
warnings: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Result shape for skill imports.
|
|
56
|
+
*/
|
|
57
|
+
export interface ImportedSkillsResult {
|
|
58
|
+
skills: Record<string, string>;
|
|
59
|
+
paths: Record<string, string>;
|
|
60
|
+
scopes: Record<string, EditorImportScope>;
|
|
61
|
+
warnings: string[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Result shape for hook imports.
|
|
65
|
+
*/
|
|
66
|
+
export interface ParsedHooksImportResult {
|
|
67
|
+
hooks: HooksConfig;
|
|
68
|
+
warnings: string[];
|
|
69
|
+
}
|
|
31
70
|
/**
|
|
32
71
|
* Strategy for formatting and writing rules to an editor. Each editor has different rule file
|
|
33
72
|
* formats and activation mode syntax.
|
|
@@ -41,11 +80,17 @@ export interface RulesStrategy {
|
|
|
41
80
|
getFileExtension(): string;
|
|
42
81
|
/** Get the global rules path relative to home directory, or null if not supported */
|
|
43
82
|
getGlobalRulesPath(): string | null;
|
|
83
|
+
/** Get extra global rule directories relative to home directory, if any. */
|
|
84
|
+
getGlobalRuleImportDirs?(): readonly string[];
|
|
44
85
|
/** Parse rules from file content. Returns array of rule strings. */
|
|
45
86
|
parseGlobalRules(content: string): {
|
|
46
87
|
rules: string[];
|
|
47
88
|
warnings: string[];
|
|
48
89
|
};
|
|
90
|
+
/** Override global rule import for editors with non-standard layouts. */
|
|
91
|
+
importGlobalRules?(): Promise<ImportedRulesResult>;
|
|
92
|
+
/** Override project rule import for editors with non-standard layouts. */
|
|
93
|
+
importProjectRules?(projectRoot: string, editorConfigDir: string): Promise<ImportedRulesResult>;
|
|
49
94
|
/** Detect if raw content appears to be in this editor's frontmatter format */
|
|
50
95
|
detectFormat?(content: string): boolean;
|
|
51
96
|
/** Parse editor-specific frontmatter into unified LoadedRule metadata */
|
|
@@ -79,6 +124,10 @@ export interface McpStrategy {
|
|
|
79
124
|
isProjectRootConfig?(): boolean;
|
|
80
125
|
/** Get the global MCP config path relative to home directory, or null if not supported */
|
|
81
126
|
getGlobalMcpConfigPath(): string | null;
|
|
127
|
+
/** Get candidate global import paths, ordered by preference. */
|
|
128
|
+
getGlobalImportPaths?(): readonly string[];
|
|
129
|
+
/** Get candidate project import paths, ordered by preference. */
|
|
130
|
+
getProjectImportPaths?(projectRoot: string, editorConfigDir: string): readonly string[];
|
|
82
131
|
/** Parse MCP config from file content */
|
|
83
132
|
parseGlobalMcpConfig(content: string): {
|
|
84
133
|
mcp: Record<string, McpServerConfig>;
|
|
@@ -109,6 +158,10 @@ export interface SkillsStrategy {
|
|
|
109
158
|
}): EditorRule[];
|
|
110
159
|
/** Get the central skills directory path relative to project root */
|
|
111
160
|
getSkillsDir(): string;
|
|
161
|
+
/** Get project-local skill directories relative to the project root. */
|
|
162
|
+
getProjectImportDirs(): readonly string[];
|
|
163
|
+
/** Get user-level skill directories relative to the home directory. */
|
|
164
|
+
getGlobalImportDirs(): readonly string[];
|
|
112
165
|
/** Whether this strategy uses native Agent Skills support (symlinks) or pointer rules */
|
|
113
166
|
isNative(): boolean;
|
|
114
167
|
}
|
|
@@ -141,6 +194,10 @@ export interface PromptsStrategy {
|
|
|
141
194
|
getFileExtension(): string;
|
|
142
195
|
/** Get the global prompts directory path relative to home directory, or null if not supported */
|
|
143
196
|
getGlobalPromptsPath(): string | null;
|
|
197
|
+
/** Override global prompt import for editors with non-standard layouts. */
|
|
198
|
+
importGlobalPrompts?(): Promise<ImportedPromptsResult>;
|
|
199
|
+
/** Override project prompt import for editors with non-standard layouts. */
|
|
200
|
+
importProjectPrompts?(projectRoot: string, editorConfigDir: string): Promise<ImportedPromptsResult>;
|
|
144
201
|
/**
|
|
145
202
|
* Parse prompts from directory. Receives file list and reader function.
|
|
146
203
|
* Returns map of prompt name to content.
|
|
@@ -175,5 +232,43 @@ export interface HooksStrategy {
|
|
|
175
232
|
* Used to warn users when they configure hooks that won't work for a particular editor.
|
|
176
233
|
*/
|
|
177
234
|
getUnsupportedEvents(hooks: HooksConfig): string[];
|
|
235
|
+
/**
|
|
236
|
+
* Get per-action lists of fields that this editor does not surface natively. Adapters
|
|
237
|
+
* use this so the install command can warn the user that, for example, `show_output`
|
|
238
|
+
* was dropped on Claude Code. Returns an empty array when every field is supported.
|
|
239
|
+
*/
|
|
240
|
+
getUnsupportedFields(hooks: HooksConfig): UnsupportedHookField[];
|
|
241
|
+
/**
|
|
242
|
+
* Get the aix event names this strategy can translate. The support matrix uses this
|
|
243
|
+
* to detect drift between `editor-support.ts` and the live strategy.
|
|
244
|
+
*/
|
|
245
|
+
getSupportedEvents(): readonly string[];
|
|
246
|
+
/**
|
|
247
|
+
* Get the editor's native event names that this strategy emits, deduplicated. The
|
|
248
|
+
* support matrix uses this to enforce that `supportedValues` matches the strategy.
|
|
249
|
+
*/
|
|
250
|
+
getNativeEventNames(): readonly string[];
|
|
251
|
+
/** Parse an editor-native hook config into generic aix hooks. */
|
|
252
|
+
parseImportedConfig(content: string): ParsedHooksImportResult;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* A per-action description of fields the target editor cannot express natively.
|
|
256
|
+
*/
|
|
257
|
+
export interface UnsupportedHookField {
|
|
258
|
+
event: string;
|
|
259
|
+
matcherIndex: number;
|
|
260
|
+
actionIndex: number;
|
|
261
|
+
fields: string[];
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Public strategy bundle exposed by adapters so import/export flows share the same editor wiring.
|
|
265
|
+
*/
|
|
266
|
+
export interface EditorStrategyBundle {
|
|
267
|
+
configDir: string;
|
|
268
|
+
mcpStrategy: McpStrategy;
|
|
269
|
+
rulesStrategy: RulesStrategy;
|
|
270
|
+
skillsStrategy: SkillsStrategy;
|
|
271
|
+
promptsStrategy: PromptsStrategy;
|
|
272
|
+
hooksStrategy: HooksStrategy;
|
|
178
273
|
}
|
|
179
274
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/editors/strategies/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/editors/strategies/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACnC,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,QAAQ,EAAE;QACP,UAAU,CAAC,EAAE,cAAc,CAAC;QAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,+DAA+D;IAC/D,cAAc,CA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MAAM,GAAG,IAAI,CAAC;IAErC;;;OAGG;IACH,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE,CAAC;IAEnD;;;;OAIG;IACH,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,oBAAoB,EAAE,CAAC;IAEjE;;;OAGG;IACH,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAAC;IAExC;;;OAGG;IACH,mBAAmB,IAAI,SAAS,MAAM,EAAE,CAAC;IAEzC,iEAAiE;IACjE,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,eAAe,EAAE,eAAe,CAAC;IACjC,aAAa,EAAE,aAAa,CAAC;CAC/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
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
4
|
* Windsurf hooks strategy. Writes hooks to `hooks.json` in the `.windsurf` directory.
|
|
5
5
|
* Translates generic ai.json event names to Windsurf's snake_case format.
|
|
@@ -9,6 +9,10 @@ export declare class WindsurfHooksStrategy implements HooksStrategy {
|
|
|
9
9
|
getConfigPath(): string;
|
|
10
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/windsurf/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/windsurf/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;AA6GhG;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IACxD,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM;IAIvB,mBAAmB,IAAI,MAAM;IAI7B,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE;IAIlD,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,oBAAoB,EAAE;IAmBhE,kBAAkB,IAAI,SAAS,MAAM,EAAE;IAIvC,mBAAmB,IAAI,SAAS,MAAM,EAAE;IAIxC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB;IAa7D,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;CAyB1C"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { parseFlatImportedHooks, parseHookObject } from '../shared/hook-import-utils.js';
|
|
1
2
|
/**
|
|
2
3
|
* Map from generic ai.json hook events to Windsurf's snake_case event names.
|
|
4
|
+
* Source: https://docs.windsurf.com/windsurf/cascade/hooks
|
|
3
5
|
*/
|
|
4
6
|
const EVENT_MAP = {
|
|
5
7
|
pre_file_read: 'pre_read_code',
|
|
@@ -12,24 +14,70 @@ const EVENT_MAP = {
|
|
|
12
14
|
post_mcp_tool: 'post_mcp_tool_use',
|
|
13
15
|
pre_prompt: 'pre_user_prompt',
|
|
14
16
|
agent_stop: 'post_cascade_response',
|
|
17
|
+
post_response: 'post_cascade_response',
|
|
18
|
+
post_response_with_transcript: 'post_cascade_response_with_transcript',
|
|
15
19
|
worktree_setup: 'post_setup_worktree',
|
|
16
20
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'agent_stop',
|
|
31
|
-
'worktree_setup',
|
|
21
|
+
const SUPPORTED_EVENTS = new Set(Object.keys(EVENT_MAP));
|
|
22
|
+
/** Fields that Windsurf hook entries surface natively. */
|
|
23
|
+
const WINDSURF_RECOGNIZED_FIELDS = new Set([
|
|
24
|
+
'type',
|
|
25
|
+
'command',
|
|
26
|
+
'bash',
|
|
27
|
+
'powershell',
|
|
28
|
+
'shell',
|
|
29
|
+
'show_output',
|
|
30
|
+
'working_directory',
|
|
31
|
+
'cwd',
|
|
32
|
+
'description',
|
|
33
|
+
'name',
|
|
32
34
|
]);
|
|
35
|
+
function buildWindsurfEntry(action) {
|
|
36
|
+
const useBash = action.shell !== 'powershell', useShell = action.shell !== 'bash', command = useBash ? action.command ?? action.bash : undefined, powershell = useShell
|
|
37
|
+
? action.powershell ?? (action.shell === 'powershell' ? action.command : undefined)
|
|
38
|
+
: undefined;
|
|
39
|
+
if (!command && !powershell) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const entry = {};
|
|
43
|
+
if (command) {
|
|
44
|
+
entry.command = command;
|
|
45
|
+
}
|
|
46
|
+
if (powershell) {
|
|
47
|
+
entry.powershell = powershell;
|
|
48
|
+
}
|
|
49
|
+
if (action.show_output !== undefined) {
|
|
50
|
+
entry.show_output = action.show_output;
|
|
51
|
+
}
|
|
52
|
+
const workingDir = action.working_directory ?? action.cwd;
|
|
53
|
+
if (workingDir) {
|
|
54
|
+
entry.working_directory = workingDir;
|
|
55
|
+
}
|
|
56
|
+
return entry;
|
|
57
|
+
}
|
|
58
|
+
function parseWindsurfEntry(value) {
|
|
59
|
+
if (!value || typeof value !== 'object') {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const entry = value, command = typeof entry.command === 'string' && entry.command.length > 0 ? entry.command : undefined, powershell = typeof entry.powershell === 'string' && entry.powershell.length > 0 ? entry.powershell : undefined;
|
|
63
|
+
if (!command && !powershell) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const action = {};
|
|
67
|
+
if (command) {
|
|
68
|
+
action.command = command;
|
|
69
|
+
}
|
|
70
|
+
if (powershell) {
|
|
71
|
+
action.powershell = powershell;
|
|
72
|
+
}
|
|
73
|
+
if (typeof entry.show_output === 'boolean') {
|
|
74
|
+
action.show_output = entry.show_output;
|
|
75
|
+
}
|
|
76
|
+
if (typeof entry.working_directory === 'string' && entry.working_directory.length > 0) {
|
|
77
|
+
action.working_directory = entry.working_directory;
|
|
78
|
+
}
|
|
79
|
+
return { action };
|
|
80
|
+
}
|
|
33
81
|
/**
|
|
34
82
|
* Windsurf hooks strategy. Writes hooks to `hooks.json` in the `.windsurf` directory.
|
|
35
83
|
* Translates generic ai.json event names to Windsurf's snake_case format.
|
|
@@ -47,18 +95,51 @@ export class WindsurfHooksStrategy {
|
|
|
47
95
|
getUnsupportedEvents(hooks) {
|
|
48
96
|
return Object.keys(hooks).filter((event) => !SUPPORTED_EVENTS.has(event));
|
|
49
97
|
}
|
|
98
|
+
getUnsupportedFields(hooks) {
|
|
99
|
+
const result = [];
|
|
100
|
+
for (const [event, matchers] of Object.entries(hooks)) {
|
|
101
|
+
matchers?.forEach((matcher, matcherIndex) => {
|
|
102
|
+
matcher.hooks?.forEach((action, actionIndex) => {
|
|
103
|
+
const fields = Object.keys(action)
|
|
104
|
+
.filter((field) => !WINDSURF_RECOGNIZED_FIELDS.has(field));
|
|
105
|
+
if (fields.length > 0) {
|
|
106
|
+
result.push({ event, matcherIndex, actionIndex, fields });
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
getSupportedEvents() {
|
|
114
|
+
return Object.keys(EVENT_MAP).toSorted();
|
|
115
|
+
}
|
|
116
|
+
getNativeEventNames() {
|
|
117
|
+
return Array.from(new Set(Object.values(EVENT_MAP))).toSorted();
|
|
118
|
+
}
|
|
119
|
+
parseImportedConfig(content) {
|
|
120
|
+
const parsed = parseHookObject(content);
|
|
121
|
+
if (!parsed.rawHooks) {
|
|
122
|
+
return { hooks: {}, warnings: parsed.warnings };
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
hooks: parseFlatImportedHooks(parsed.rawHooks, EVENT_MAP, parseWindsurfEntry),
|
|
126
|
+
warnings: parsed.warnings,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
50
129
|
formatConfig(hooks) {
|
|
51
130
|
const windsurfHooks = {};
|
|
52
131
|
for (const [event, matchers] of Object.entries(hooks)) {
|
|
53
132
|
const windsurfEvent = EVENT_MAP[event];
|
|
54
|
-
if (!windsurfEvent) {
|
|
133
|
+
if (!windsurfEvent || !matchers) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const entries = matchers.flatMap((matcher) => matcher.hooks
|
|
137
|
+
.map((action) => buildWindsurfEntry(action))
|
|
138
|
+
.filter((entry) => entry !== undefined));
|
|
139
|
+
if (entries.length === 0) {
|
|
55
140
|
continue;
|
|
56
141
|
}
|
|
57
|
-
windsurfHooks[windsurfEvent] =
|
|
58
|
-
command: hook.command,
|
|
59
|
-
...(hook.show_output !== undefined && { show_output: hook.show_output }),
|
|
60
|
-
...(hook.working_directory && { working_directory: hook.working_directory }),
|
|
61
|
-
})));
|
|
142
|
+
windsurfHooks[windsurfEvent] = (windsurfHooks[windsurfEvent] ?? []).concat(entries);
|
|
62
143
|
}
|
|
63
144
|
return JSON.stringify({ hooks: windsurfHooks }, null, 2) + '\n';
|
|
64
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../src/editors/strategies/windsurf/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../src/editors/strategies/windsurf/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAA0B,MAAM,gCAAgC,CAAC;AAEjH;;;GAGG;AACH,MAAM,SAAS,GAA2B;IACvC,aAAa,EAAE,eAAe;IAC9B,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,iBAAiB;IAC9B,YAAY,EAAE,kBAAkB;IAChC,YAAY,EAAE,kBAAkB;IAChC,aAAa,EAAE,mBAAmB;IAClC,UAAU,EAAE,iBAAiB;IAC7B,UAAU,EAAE,uBAAuB;IACnC,aAAa,EAAE,uBAAuB;IACtC,6BAA6B,EAAE,uCAAuC;IACtE,cAAc,EAAE,qBAAqB;CACvC,CAAC;AAEF,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AAEzD,0DAA0D;AAC1D,MAAM,0BAA0B,GAAkC,IAAI,GAAG,CAAC;IACvE,MAAM;IACN,SAAS;IACT,MAAM;IACN,YAAY;IACZ,OAAO;IACP,aAAa;IACb,mBAAmB;IACnB,KAAK;IACL,aAAa;IACb,MAAM;CACR,CAAC,CAAC;AASH,SAAS,kBAAkB,CA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ources":["../../../../src/editors/strategies/windsurf/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/windsurf/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAQ5E;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,eAAe;IAC5D,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM;IAIvB,gBAAgB,IAAI,MAAM;IAI1B,oBAAoB,IAAI,MAAM,GAAG,IAAI;IAIrC,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAQpC,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;IAItC;;;OAGG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,uBAAuB;CAG/D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatPromptFile, hasPromptFrontmatterFields, parsePromptFiles, parsePromptFrontmatter, } from '../shared/prompt-utils.js';
|
|
2
2
|
/**
|
|
3
3
|
* Windsurf prompts strategy. Uses markdown files with YAML frontmatter in `.windsurf/workflows/`.
|
|
4
4
|
* Supports `description` frontmatter field.
|
|
@@ -17,81 +17,33 @@ export class WindsurfPromptsStrategy {
|
|
|
17
17
|
return '.codeium/windsurf/global_workflows';
|
|
18
18
|
}
|
|
19
19
|
formatPrompt(prompt) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Only add heading if content doesn't already start with one
|
|
26
|
-
const contentStartsWithHeading = /^#\s/.test(prompt.content.trim());
|
|
27
|
-
if (!contentStartsWithHeading) {
|
|
28
|
-
lines.push(`# ${prompt.name}`, '');
|
|
29
|
-
}
|
|
30
|
-
lines.push(prompt.content);
|
|
31
|
-
return lines.join('\n');
|
|
20
|
+
return formatPromptFile(prompt, {
|
|
21
|
+
frontmatterFields: [{ key: 'description', value: prompt.description }],
|
|
22
|
+
alwaysIncludeFrontmatter: true,
|
|
23
|
+
includeHeading: true,
|
|
24
|
+
});
|
|
32
25
|
}
|
|
33
26
|
async parseGlobalPrompts(files, readFile) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
type: 'prompt',
|
|
41
|
-
name: file.replace(/\.md$/, ''),
|
|
42
|
-
content: content.trim(),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
catch (err) {
|
|
48
|
-
return {
|
|
49
|
-
type: 'warning',
|
|
50
|
-
message: `Failed to read prompt ${file}: ${err.message}`,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}));
|
|
54
|
-
const prompts = {}, warnings = [];
|
|
55
|
-
for (const result of results) {
|
|
56
|
-
if (!result) {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (result.type === 'warning') {
|
|
60
|
-
warnings.push(result.message);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
prompts[result.name] = result.content;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return { prompts, warnings };
|
|
27
|
+
return parsePromptFiles({
|
|
28
|
+
files,
|
|
29
|
+
readFile,
|
|
30
|
+
includeFile: (file) => file.endsWith('.md'),
|
|
31
|
+
stripSuffix: /\.md$/,
|
|
32
|
+
});
|
|
67
33
|
}
|
|
68
34
|
/**
|
|
69
35
|
* Detect if content appears to be in Windsurf's workflow frontmatter format.
|
|
70
36
|
* Windsurf workflows use `description:` in frontmatter (but not rules-specific fields like `trigger`).
|
|
71
37
|
*/
|
|
72
38
|
detectFormat(content) {
|
|
73
|
-
|
|
74
|
-
if (!hasFrontmatter) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
const lines = frontmatter.split('\n'), hasDescription = parseYamlValue(lines, 'description') !== undefined, hasTrigger = parseYamlValue(lines, 'trigger') !== undefined;
|
|
78
|
-
// Windsurf prompts have description but NOT trigger (trigger is rules-specific)
|
|
79
|
-
return hasDescription && !hasTrigger;
|
|
39
|
+
return hasPromptFrontmatterFields(content, ['description'], ['trigger']);
|
|
80
40
|
}
|
|
81
41
|
/**
|
|
82
42
|
* Parse Windsurf-specific frontmatter into unified format.
|
|
83
43
|
* Only extracts `description` field.
|
|
84
44
|
*/
|
|
85
45
|
parseFrontmatter(rawContent) {
|
|
86
|
-
|
|
87
|
-
if (!hasFrontmatter) {
|
|
88
|
-
return { content: rawContent };
|
|
89
|
-
}
|
|
90
|
-
const lines = frontmatter.split('\n'), description = parseYamlValue(lines, 'description');
|
|
91
|
-
return {
|
|
92
|
-
content,
|
|
93
|
-
description,
|
|
94
|
-
};
|
|
46
|
+
return parsePromptFrontmatter(rawContent, ['description']);
|
|
95
47
|
}
|
|
96
48
|
}
|
|
97
49
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/editors/strategies/windsurf/prompts.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/editors/strategies/windsurf/prompts.ts"],"names":[],"mappings":"AAEA,OAAO,EACJ,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,GACxB,MAAM,2BAA2B,CAAC;AAEnC;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IACjC,WAAW;QACR,OAAO,IAAI,CAAC;IACf,CAAC;IAED,aAAa;QACV,OAAO,WAAW,CAAC;IACtB,CAAC;IAED,gBAAgB;QACb,OAAO,KAAK,CAAC;IAChB,CAAC;IAED,oBAAoB;QACjB,OAAO,oCAAoC,CAAC;IAC/C,CAAC;IAED,YAAY,CAAC,MAAoB;QAC9B,OAAO,gBAAgB,CAAC,MAAM,EAAE;YAC7B,iBAAiB,EAAE,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;YACtE,wBAAwB,EAAE,IAAI;YAC9B,cAAc,EAAE,IAAI;SACtB,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,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,UAAkB;QAChC,OAAO,sBAAsB,CAAC,UAAU,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAC9D,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/editors/strategies/windsurf/rules.ts"],"names":[],"mappings":"AA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C,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAEhF,IAAI,CAAC,cAAc,EAAE,CAAC;YACnB,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QAChD,CAAC;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAC/B,OAAO,GAAG,cAAc,CAAC,KAAK,EAAE,SAAS,CAAuB,EAChE,WAAW,GAAG,cAAc,CAAC,KAAK,EAAE,aAAa,CAAuB,EACxE,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAE7C,0DAA0D;QAC1D,MAAM,mBAAmB,GAAmC;YACzD,SAAS,EAAE,QAAQ;YACnB,cAAc,EAAE,MAAM;YACtB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,QAAQ;SAClB,CAAC;QAEF,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EAC/D,UAAU,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,KAA8B,CAAC;QAEvH,OAAO;YACJ,OAAO;YACP,QAAQ,EAAE;gBACP,UAAU;gBACV,WAAW;gBACX,KAAK,EAAE,UAAU;aACnB;SACH,CAAC;IACL,CAAC;CACH"}
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { PromptsStrategy } from '../types.js';
|
|
1
|
+
import { NoPromptsStrategy } from '../shared/no-prompts.js';
|
|
3
2
|
/**
|
|
4
3
|
* Zed prompts strategy. Zed uses a Rules Library UI, not file-based prompts.
|
|
5
4
|
* Prompts are not supported in Zed at this time.
|
|
6
5
|
*/
|
|
7
|
-
export declare class ZedPromptsStrategy
|
|
8
|
-
isSupported(): boolean;
|
|
9
|
-
getPromptsDir(): string;
|
|
10
|
-
getFileExtension(): string;
|
|
11
|
-
getGlobalPromptsPath(): string | null;
|
|
12
|
-
formatPrompt(_prompt: EditorPrompt): string;
|
|
13
|
-
parseGlobalPrompts(_files: string[], _readFile: (filename: string) => Promise<string>): Promise<{
|
|
14
|
-
prompts: Record<string, string>;
|
|
15
|
-
warnings: string[];
|
|
16
|
-
}>;
|
|
6
|
+
export declare class ZedPromptsStrategy extends NoPromptsStrategy {
|
|
17
7
|
}
|
|
18
8
|
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/zed/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/zed/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;CAAG"}
|
|
@@ -1,25 +1,8 @@
|
|
|
1
|
+
import { NoPromptsStrategy } from '../shared/no-prompts.js';
|
|
1
2
|
/**
|
|
2
3
|
* Zed prompts strategy. Zed uses a Rules Library UI, not file-based prompts.
|
|
3
4
|
* Prompts are not supported in Zed at this time.
|
|
4
5
|
*/
|
|
5
|
-
export class ZedPromptsStrategy {
|
|
6
|
-
isSupported() {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
getPromptsDir() {
|
|
10
|
-
return '';
|
|
11
|
-
}
|
|
12
|
-
getFileExtension() {
|
|
13
|
-
return '';
|
|
14
|
-
}
|
|
15
|
-
getGlobalPromptsPath() {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
formatPrompt(_prompt) {
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
async parseGlobalPrompts(_files, _readFile) {
|
|
22
|
-
return { prompts: {}, warnings: [] };
|
|
23
|
-
}
|
|
6
|
+
export class ZedPromptsStrategy extends NoPromptsStrategy {
|
|
24
7
|
}
|
|
25
8
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/editors/strategies/zed/prompts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/editors/strategies/zed/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;CAAG"}
|
|
@@ -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
|
* Zed rules strategy. Uses a single `.rules` file at project root (plain markdown, no frontmatter).
|
|
@@ -12,6 +12,7 @@ export declare class ZedRulesStrategy implements RulesStrategy {
|
|
|
12
12
|
rules: string[];
|
|
13
13
|
warnings: string[];
|
|
14
14
|
};
|
|
15
|
+
importProjectRules(projectRoot: string): Promise<ImportedRulesResult>;
|
|
15
16
|
formatRule(rule: EditorRule): string;
|
|
16
17
|
}
|
|
17
18
|
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/zed/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/zed/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;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,aAAa;IACnD,WAAW,IAAI,MAAM;IAKrB,gBAAgB,IAAI,MAAM;IAK1B,kBAAkB,IAAI,MAAM,GAAG,IAAI;IAKnC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE;IAIrE,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA6B3E,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
|
* Zed rules strategy. Uses a single `.rules` file at project root (plain markdown, no frontmatter).
|
|
3
5
|
* Zed reads `.rules` files at the top level of worktrees.
|
|
@@ -18,6 +20,31 @@ export class ZedRulesStrategy {
|
|
|
18
20
|
parseGlobalRules(_content) {
|
|
19
21
|
return { rules: [], warnings: [] };
|
|
20
22
|
}
|
|
23
|
+
async importProjectRules(projectRoot) {
|
|
24
|
+
const warnings = [], rulesPath = join(projectRoot, '.rules');
|
|
25
|
+
try {
|
|
26
|
+
const content = await getRuntimeAdapter().fs.readFile(rulesPath, 'utf-8');
|
|
27
|
+
if (content.trim()) {
|
|
28
|
+
return {
|
|
29
|
+
rules: [{
|
|
30
|
+
content: content.trim(),
|
|
31
|
+
name: 'project rules',
|
|
32
|
+
path: rulesPath,
|
|
33
|
+
scope: 'project',
|
|
34
|
+
}],
|
|
35
|
+
paths: { 'project rules': rulesPath },
|
|
36
|
+
scopes: { 'project rules': 'project' },
|
|
37
|
+
warnings,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
if (err.code !== 'ENOENT') {
|
|
43
|
+
warnings.push(`Failed to read Zed rules from ${rulesPath}: ${err.message}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { rules: [], paths: {}, scopes: {}, warnings };
|
|
47
|
+
}
|
|
21
48
|
formatRule(rule) {
|
|
22
49
|
const lines = [];
|
|
23
50
|
// Zed uses plain markdown without frontmatter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/editors/strategies/zed/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/editors/strategies/zed/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAC1B,WAAW;QACR,gDAAgD;QAChD,OAAO,IAAI,CAAC;IACf,CAAC;IAED,gBAAgB;QACb,qCAAqC;QACrC,OAAO,EAAE,CAAC;IACb,CAAC;IAED,kBAAkB;QACf,qCAAqC;QACrC,OAAO,IAAI,CAAC;IACf,CAAC;IAED,gBAAgB,CAAC,QAAgB;QAC9B,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,WAAmB;QACzC,MAAM,QAAQ,GAAa,EAAE,EACvB,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAE9C,IAAI,CAAC;YACF,MAAM,OAAO,GAAG,MAAM,iBAAiB,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAE1E,IAAI,OAAO,CAAC,IAA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