@omnidev-ai/core 0.8.0 → 0.10.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/index.d.ts +392 -20
- package/dist/index.js +1443 -254
- package/package.json +1 -1
- package/src/capability/index.ts +5 -1
- package/src/capability/loader.ts +9 -0
- package/src/capability/registry.ts +19 -1
- package/src/capability/rules.ts +2 -100
- package/src/capability/sources.ts +191 -10
- package/src/config/capabilities.ts +1 -1
- package/src/config/{loader.ts → config.ts} +27 -2
- package/src/config/index.ts +2 -1
- package/src/config/profiles.ts +23 -3
- package/src/config/toml-patcher.ts +309 -0
- package/src/hooks/constants.ts +100 -0
- package/src/hooks/index.ts +99 -0
- package/src/hooks/loader.ts +189 -0
- package/src/hooks/merger.ts +157 -0
- package/src/hooks/types.ts +212 -0
- package/src/hooks/validation.ts +516 -0
- package/src/hooks/variables.ts +151 -0
- package/src/index.ts +4 -0
- package/src/sync.ts +11 -9
- package/src/templates/agents.ts +2 -2
- package/src/templates/capability.ts +167 -0
- package/src/templates/claude.ts +2 -45
- package/src/types/index.ts +46 -4
package/dist/index.d.ts
CHANGED
|
@@ -138,6 +138,171 @@ interface CapabilityExport {
|
|
|
138
138
|
/** Additional exports for extensibility */
|
|
139
139
|
[key: string]: unknown;
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Hook system constants
|
|
143
|
+
*
|
|
144
|
+
* All constants are defined as readonly arrays/objects to enable
|
|
145
|
+
* TypeScript literal type inference.
|
|
146
|
+
*/
|
|
147
|
+
/** All supported hook events */
|
|
148
|
+
declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PermissionRequest", "UserPromptSubmit", "Stop", "SubagentStop", "Notification", "SessionStart", "SessionEnd", "PreCompact"];
|
|
149
|
+
/** Events that support matchers (regex patterns to filter tool names) */
|
|
150
|
+
declare const MATCHER_EVENTS: readonly ["PreToolUse", "PostToolUse", "PermissionRequest", "Notification", "SessionStart", "PreCompact"];
|
|
151
|
+
/** Events that support prompt-type hooks (LLM evaluation) */
|
|
152
|
+
declare const PROMPT_HOOK_EVENTS: readonly ["Stop", "SubagentStop", "UserPromptSubmit", "PreToolUse", "PermissionRequest"];
|
|
153
|
+
/** Hook execution types */
|
|
154
|
+
declare const HOOK_TYPES: readonly ["command", "prompt"];
|
|
155
|
+
/**
|
|
156
|
+
* Common tool matchers (for validation hints, not exhaustive)
|
|
157
|
+
* These are the tools available in Claude Code that hooks commonly target.
|
|
158
|
+
*/
|
|
159
|
+
declare const COMMON_TOOL_MATCHERS: readonly ["Bash", "Read", "Write", "Edit", "Glob", "Grep", "Task", "WebFetch", "WebSearch", "NotebookEdit", "LSP", "TodoWrite", "AskUserQuestion"];
|
|
160
|
+
/** Notification type matchers */
|
|
161
|
+
declare const NOTIFICATION_MATCHERS: readonly ["permission_prompt", "idle_prompt", "auth_success", "elicitation_dialog"];
|
|
162
|
+
/** SessionStart source matchers */
|
|
163
|
+
declare const SESSION_START_MATCHERS: readonly ["startup", "resume", "clear", "compact"];
|
|
164
|
+
/** PreCompact trigger matchers */
|
|
165
|
+
declare const PRE_COMPACT_MATCHERS: readonly ["manual", "auto"];
|
|
166
|
+
/** Default timeout for command hooks (in seconds) */
|
|
167
|
+
declare const DEFAULT_COMMAND_TIMEOUT = 60;
|
|
168
|
+
/** Default timeout for prompt hooks (in seconds) */
|
|
169
|
+
declare const DEFAULT_PROMPT_TIMEOUT = 30;
|
|
170
|
+
/**
|
|
171
|
+
* Environment variable mappings between OmniDev and Claude Code
|
|
172
|
+
*
|
|
173
|
+
* When capabilities define hooks, they use OMNIDEV_ prefixed variables.
|
|
174
|
+
* When writing to .claude/settings.json, these are transformed to CLAUDE_ variables.
|
|
175
|
+
* When importing external capabilities, CLAUDE_ variables are transformed to OMNIDEV_.
|
|
176
|
+
*/
|
|
177
|
+
declare const VARIABLE_MAPPINGS: {
|
|
178
|
+
readonly OMNIDEV_CAPABILITY_ROOT: "CLAUDE_PLUGIN_ROOT";
|
|
179
|
+
readonly OMNIDEV_PROJECT_DIR: "CLAUDE_PROJECT_DIR";
|
|
180
|
+
};
|
|
181
|
+
/** The hooks configuration filename within a capability */
|
|
182
|
+
declare const HOOKS_CONFIG_FILENAME = "hooks.toml";
|
|
183
|
+
/** The hooks directory name within a capability */
|
|
184
|
+
declare const HOOKS_DIRECTORY = "hooks";
|
|
185
|
+
/** All supported hook event names */
|
|
186
|
+
type HookEvent = (typeof HOOK_EVENTS)[number];
|
|
187
|
+
/** Hook execution types: command or prompt */
|
|
188
|
+
type HookType = (typeof HOOK_TYPES)[number];
|
|
189
|
+
/** Events that support matcher patterns */
|
|
190
|
+
type MatcherEvent = (typeof MATCHER_EVENTS)[number];
|
|
191
|
+
/** Events that support prompt-type hooks */
|
|
192
|
+
type PromptHookEvent = (typeof PROMPT_HOOK_EVENTS)[number];
|
|
193
|
+
type NotificationMatcher = (typeof NOTIFICATION_MATCHERS)[number];
|
|
194
|
+
type SessionStartMatcher = (typeof SESSION_START_MATCHERS)[number];
|
|
195
|
+
type PreCompactMatcher = (typeof PRE_COMPACT_MATCHERS)[number];
|
|
196
|
+
type OmnidevVariable = keyof typeof VARIABLE_MAPPINGS;
|
|
197
|
+
type ClaudeVariable = (typeof VARIABLE_MAPPINGS)[OmnidevVariable];
|
|
198
|
+
/** Command-type hook that executes a shell command */
|
|
199
|
+
interface HookCommand {
|
|
200
|
+
type: "command";
|
|
201
|
+
/** Shell command to execute */
|
|
202
|
+
command: string;
|
|
203
|
+
/** Timeout in seconds (default: 60) */
|
|
204
|
+
timeout?: number;
|
|
205
|
+
}
|
|
206
|
+
/** Prompt-type hook that uses LLM evaluation */
|
|
207
|
+
interface HookPrompt {
|
|
208
|
+
type: "prompt";
|
|
209
|
+
/** Prompt text to send to LLM (use $ARGUMENTS for input) */
|
|
210
|
+
prompt: string;
|
|
211
|
+
/** Timeout in seconds (default: 30) */
|
|
212
|
+
timeout?: number;
|
|
213
|
+
}
|
|
214
|
+
/** Union of all hook types */
|
|
215
|
+
type Hook = HookCommand | HookPrompt;
|
|
216
|
+
/** Hook matcher entry - groups hooks by matcher pattern */
|
|
217
|
+
interface HookMatcher {
|
|
218
|
+
/**
|
|
219
|
+
* Regex pattern to match tool/event names
|
|
220
|
+
* - Use "*" or "" to match all
|
|
221
|
+
* - Supports regex: "Edit|Write", "Bash.*"
|
|
222
|
+
*/
|
|
223
|
+
matcher?: string;
|
|
224
|
+
/** Array of hooks to execute when pattern matches */
|
|
225
|
+
hooks: Hook[];
|
|
226
|
+
}
|
|
227
|
+
/** Full hooks configuration from hooks.toml */
|
|
228
|
+
interface HooksConfig {
|
|
229
|
+
/** Optional description of the hooks */
|
|
230
|
+
description?: string;
|
|
231
|
+
PreToolUse?: HookMatcher[];
|
|
232
|
+
PostToolUse?: HookMatcher[];
|
|
233
|
+
PermissionRequest?: HookMatcher[];
|
|
234
|
+
Notification?: HookMatcher[];
|
|
235
|
+
SessionStart?: HookMatcher[];
|
|
236
|
+
PreCompact?: HookMatcher[];
|
|
237
|
+
UserPromptSubmit?: HookMatcher[];
|
|
238
|
+
Stop?: HookMatcher[];
|
|
239
|
+
SubagentStop?: HookMatcher[];
|
|
240
|
+
SessionEnd?: HookMatcher[];
|
|
241
|
+
}
|
|
242
|
+
type ValidationSeverity = "error" | "warning";
|
|
243
|
+
/** Validation error codes for consistent reporting */
|
|
244
|
+
type HookValidationCode = "HOOKS_INVALID_TOML" | "HOOKS_UNKNOWN_EVENT" | "HOOKS_INVALID_TYPE" | "HOOKS_PROMPT_NOT_ALLOWED" | "HOOKS_MISSING_COMMAND" | "HOOKS_MISSING_PROMPT" | "HOOKS_INVALID_TIMEOUT" | "HOOKS_INVALID_MATCHER" | "HOOKS_SCRIPT_NOT_FOUND" | "HOOKS_SCRIPT_NOT_EXECUTABLE" | "HOOKS_CLAUDE_VARIABLE" | "HOOKS_EMPTY_ARRAY" | "HOOKS_DUPLICATE_COMMAND" | "HOOKS_INVALID_HOOKS_ARRAY";
|
|
245
|
+
interface HookValidationIssue {
|
|
246
|
+
severity: ValidationSeverity;
|
|
247
|
+
/** Validation error code */
|
|
248
|
+
code: HookValidationCode;
|
|
249
|
+
/** Which event the issue is in */
|
|
250
|
+
event?: HookEvent;
|
|
251
|
+
/** Which matcher index (0-based) */
|
|
252
|
+
matcherIndex?: number;
|
|
253
|
+
/** Which hook index within the matcher (0-based) */
|
|
254
|
+
hookIndex?: number;
|
|
255
|
+
/** Human-readable error message */
|
|
256
|
+
message: string;
|
|
257
|
+
/** File path if applicable (for script validation) */
|
|
258
|
+
path?: string;
|
|
259
|
+
/** Suggestion for fixing the issue */
|
|
260
|
+
suggestion?: string;
|
|
261
|
+
}
|
|
262
|
+
interface HookValidationResult {
|
|
263
|
+
valid: boolean;
|
|
264
|
+
errors: HookValidationIssue[];
|
|
265
|
+
warnings: HookValidationIssue[];
|
|
266
|
+
}
|
|
267
|
+
/** Hooks metadata attached to a capability */
|
|
268
|
+
interface CapabilityHooks {
|
|
269
|
+
/** Source capability name */
|
|
270
|
+
capabilityName: string;
|
|
271
|
+
/** Source capability path */
|
|
272
|
+
capabilityPath: string;
|
|
273
|
+
/** The hooks configuration */
|
|
274
|
+
config: HooksConfig;
|
|
275
|
+
/** Validation result */
|
|
276
|
+
validation: HookValidationResult;
|
|
277
|
+
}
|
|
278
|
+
type DoctorCheckStatus = "pass" | "fail" | "warn";
|
|
279
|
+
interface HooksDoctorCheck {
|
|
280
|
+
name: string;
|
|
281
|
+
status: DoctorCheckStatus;
|
|
282
|
+
message: string;
|
|
283
|
+
details?: string[];
|
|
284
|
+
}
|
|
285
|
+
interface HooksDoctorResult {
|
|
286
|
+
checks: HooksDoctorCheck[];
|
|
287
|
+
summary: {
|
|
288
|
+
total: number;
|
|
289
|
+
passed: number;
|
|
290
|
+
failed: number;
|
|
291
|
+
warnings: number;
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/** Check if a hook is a command hook */
|
|
295
|
+
declare function isHookCommand(hook: Hook): hook is HookCommand;
|
|
296
|
+
/** Check if a hook is a prompt hook */
|
|
297
|
+
declare function isHookPrompt(hook: Hook): hook is HookPrompt;
|
|
298
|
+
/** Check if an event supports matchers */
|
|
299
|
+
declare function isMatcherEvent(event: string): event is MatcherEvent;
|
|
300
|
+
/** Check if an event supports prompt-type hooks */
|
|
301
|
+
declare function isPromptHookEvent(event: string): event is PromptHookEvent;
|
|
302
|
+
/** Check if a string is a valid hook event */
|
|
303
|
+
declare function isHookEvent(event: string): event is HookEvent;
|
|
304
|
+
/** Check if a string is a valid hook type */
|
|
305
|
+
declare function isHookType(type: string): type is HookType;
|
|
141
306
|
interface CapabilityMetadata {
|
|
142
307
|
id: string;
|
|
143
308
|
name: string;
|
|
@@ -297,8 +462,17 @@ interface GitCapabilitySourceConfig {
|
|
|
297
462
|
/** Subdirectory within the repo containing the capability */
|
|
298
463
|
path?: string;
|
|
299
464
|
}
|
|
465
|
+
/** Configuration for a local file-sourced capability */
|
|
466
|
+
interface FileCapabilitySourceConfig {
|
|
467
|
+
/** Source path with file:// prefix (e.g., "file://./capabilities/my-cap") */
|
|
468
|
+
source: string;
|
|
469
|
+
}
|
|
300
470
|
/** Combined type for all capability source configurations */
|
|
301
|
-
type CapabilitySourceConfig = string | GitCapabilitySourceConfig;
|
|
471
|
+
type CapabilitySourceConfig = string | GitCapabilitySourceConfig | FileCapabilitySourceConfig;
|
|
472
|
+
/**
|
|
473
|
+
* Type guard to check if a source config is a FileCapabilitySourceConfig
|
|
474
|
+
*/
|
|
475
|
+
declare function isFileSourceConfig(config: CapabilitySourceConfig): config is FileCapabilitySourceConfig;
|
|
302
476
|
/** Lock file entry for a capability (version tracking) */
|
|
303
477
|
interface CapabilityLockEntry {
|
|
304
478
|
/** Original source reference */
|
|
@@ -324,6 +498,8 @@ interface CapabilitiesConfig {
|
|
|
324
498
|
disable?: string[];
|
|
325
499
|
/** Capability sources: id -> source string or full config (git or file) */
|
|
326
500
|
sources?: Record<string, CapabilitySourceConfig>;
|
|
501
|
+
/** Capability groups: group name -> array of capability IDs */
|
|
502
|
+
groups?: Record<string, string[]>;
|
|
327
503
|
}
|
|
328
504
|
interface ProfileConfig {
|
|
329
505
|
capabilities?: string[];
|
|
@@ -374,6 +550,8 @@ interface LoadedCapability {
|
|
|
374
550
|
exports: Record<string, unknown>;
|
|
375
551
|
/** Where this capability comes from */
|
|
376
552
|
source?: CapabilitySource;
|
|
553
|
+
/** Hooks configuration from hooks/hooks.toml */
|
|
554
|
+
hooks?: CapabilityHooks;
|
|
377
555
|
}
|
|
378
556
|
type ProviderId = Provider | (string & {});
|
|
379
557
|
interface SyncBundle {
|
|
@@ -383,7 +561,9 @@ interface SyncBundle {
|
|
|
383
561
|
docs: Doc[];
|
|
384
562
|
commands: Command[];
|
|
385
563
|
subagents: Subagent[];
|
|
386
|
-
|
|
564
|
+
/** Merged hooks from all capabilities */
|
|
565
|
+
hooks?: HooksConfig;
|
|
566
|
+
/** Generated instructions content from rules and docs, embedded directly into provider files */
|
|
387
567
|
instructionsContent: string;
|
|
388
568
|
}
|
|
389
569
|
interface ProviderContext {
|
|
@@ -459,6 +639,10 @@ interface CapabilityRegistry {
|
|
|
459
639
|
getAllSkills(): Skill[];
|
|
460
640
|
getAllRules(): Rule[];
|
|
461
641
|
getAllDocs(): Doc[];
|
|
642
|
+
/** Get all capability hooks metadata */
|
|
643
|
+
getAllCapabilityHooks(): CapabilityHooks[];
|
|
644
|
+
/** Get merged hooks from all capabilities */
|
|
645
|
+
getMergedHooks(): HooksConfig;
|
|
462
646
|
}
|
|
463
647
|
/**
|
|
464
648
|
* Builds a capability registry by discovering, loading, and filtering capabilities.
|
|
@@ -474,13 +658,6 @@ declare function buildCapabilityRegistry(): Promise<CapabilityRegistry>;
|
|
|
474
658
|
* @returns Array of Rule objects
|
|
475
659
|
*/
|
|
476
660
|
declare function loadRules(capabilityPath: string, capabilityId: string): Promise<Rule[]>;
|
|
477
|
-
/**
|
|
478
|
-
* Write aggregated rules and docs to .omni/instructions.md
|
|
479
|
-
* Updates the generated section between markers while preserving user content
|
|
480
|
-
* @param rules Array of rules from all enabled capabilities
|
|
481
|
-
* @param docs Array of docs from all enabled capabilities
|
|
482
|
-
*/
|
|
483
|
-
declare function writeRules(rules: Rule[], docs?: Doc[]): Promise<void>;
|
|
484
661
|
declare function loadSkills(capabilityPath: string, capabilityId: string): Promise<Skill[]>;
|
|
485
662
|
interface FetchResult {
|
|
486
663
|
id: string;
|
|
@@ -499,10 +676,27 @@ interface SourceUpdateInfo {
|
|
|
499
676
|
hasUpdate: boolean;
|
|
500
677
|
}
|
|
501
678
|
/**
|
|
679
|
+
* Check if a source string is a git source
|
|
680
|
+
*/
|
|
681
|
+
declare function isGitSource(source: string): boolean;
|
|
682
|
+
/**
|
|
683
|
+
* Check if a source string is a file source
|
|
684
|
+
*/
|
|
685
|
+
declare function isFileSource(source: string): boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Parse a file:// source to get the actual file path
|
|
688
|
+
*/
|
|
689
|
+
declare function parseFileSourcePath(source: string): string;
|
|
690
|
+
/**
|
|
691
|
+
* Read the capability ID from a capability directory
|
|
692
|
+
* Tries to read from capability.toml first, then falls back to directory name
|
|
693
|
+
*/
|
|
694
|
+
declare function readCapabilityIdFromPath(capabilityPath: string): Promise<string | null>;
|
|
695
|
+
/**
|
|
502
696
|
* Parse a capability source string or config into normalized form
|
|
503
|
-
* Returns a GitCapabilitySourceConfig
|
|
697
|
+
* Returns a GitCapabilitySourceConfig or FileCapabilitySourceConfig
|
|
504
698
|
*/
|
|
505
|
-
declare function parseSourceConfig(source: CapabilitySourceConfig): GitCapabilitySourceConfig;
|
|
699
|
+
declare function parseSourceConfig(source: CapabilitySourceConfig): GitCapabilitySourceConfig | FileCapabilitySourceConfig;
|
|
506
700
|
/**
|
|
507
701
|
* Convert source to a git-cloneable URL
|
|
508
702
|
*/
|
|
@@ -546,7 +740,7 @@ interface DiscoveredContent {
|
|
|
546
740
|
docsDir: string | null;
|
|
547
741
|
}
|
|
548
742
|
/**
|
|
549
|
-
* Fetch a single capability source
|
|
743
|
+
* Fetch a single capability source (git or file)
|
|
550
744
|
*/
|
|
551
745
|
declare function fetchCapabilitySource(id: string, sourceConfig: CapabilitySourceConfig, options?: {
|
|
552
746
|
silent?: boolean;
|
|
@@ -567,6 +761,149 @@ declare function checkForUpdates(config: OmniConfig): Promise<SourceUpdateInfo[]
|
|
|
567
761
|
* Each subagent is a SUBAGENT.md file in its own subdirectory.
|
|
568
762
|
*/
|
|
569
763
|
declare function loadSubagents(capabilityPath: string, capabilityId: string): Promise<Subagent[]>;
|
|
764
|
+
interface ValidationOptions {
|
|
765
|
+
/** Base path for resolving script files */
|
|
766
|
+
basePath?: string;
|
|
767
|
+
/** Check if script files exist and are executable */
|
|
768
|
+
checkScripts?: boolean;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Validate a hooks configuration object
|
|
772
|
+
*/
|
|
773
|
+
declare function validateHooksConfig(config: unknown, options?: ValidationOptions): HookValidationResult;
|
|
774
|
+
/**
|
|
775
|
+
* Validate a single hook entry
|
|
776
|
+
*/
|
|
777
|
+
declare function validateHook(hook: unknown, event: HookEvent, context: {
|
|
778
|
+
matcherIndex: number;
|
|
779
|
+
hookIndex: number;
|
|
780
|
+
}, options?: ValidationOptions): HookValidationIssue[];
|
|
781
|
+
/**
|
|
782
|
+
* Check if a matcher regex pattern is valid
|
|
783
|
+
*/
|
|
784
|
+
declare function isValidMatcherPattern(pattern: string): boolean;
|
|
785
|
+
/**
|
|
786
|
+
* Check for duplicate commands across all hooks
|
|
787
|
+
*/
|
|
788
|
+
declare function findDuplicateCommands(config: HooksConfig): HookValidationIssue[];
|
|
789
|
+
/**
|
|
790
|
+
* Create an empty valid hooks config
|
|
791
|
+
*/
|
|
792
|
+
declare function createEmptyHooksConfig(): HooksConfig;
|
|
793
|
+
/**
|
|
794
|
+
* Create an empty validation result (valid with no issues)
|
|
795
|
+
*/
|
|
796
|
+
declare function createEmptyValidationResult(): HookValidationResult;
|
|
797
|
+
/**
|
|
798
|
+
* Transform Claude Code variables to OmniDev format
|
|
799
|
+
* Used when: importing/wrapping external capabilities
|
|
800
|
+
*
|
|
801
|
+
* CLAUDE_PLUGIN_ROOT -> OMNIDEV_CAPABILITY_ROOT
|
|
802
|
+
* CLAUDE_PROJECT_DIR -> OMNIDEV_PROJECT_DIR
|
|
803
|
+
*/
|
|
804
|
+
declare function transformToOmnidev(content: string): string;
|
|
805
|
+
/**
|
|
806
|
+
* Transform OmniDev variables to Claude Code format
|
|
807
|
+
* Used when: writing to .claude/settings.json
|
|
808
|
+
*
|
|
809
|
+
* OMNIDEV_CAPABILITY_ROOT -> CLAUDE_PLUGIN_ROOT
|
|
810
|
+
* OMNIDEV_PROJECT_DIR -> CLAUDE_PROJECT_DIR
|
|
811
|
+
*/
|
|
812
|
+
declare function transformToClaude(content: string): string;
|
|
813
|
+
/**
|
|
814
|
+
* Transform all variables in a HooksConfig
|
|
815
|
+
*/
|
|
816
|
+
declare function transformHooksConfig(config: HooksConfig, direction: "toOmnidev" | "toClaude"): HooksConfig;
|
|
817
|
+
/**
|
|
818
|
+
* Check if a string contains any Claude variables
|
|
819
|
+
*/
|
|
820
|
+
declare function containsClaudeVariables(content: string): boolean;
|
|
821
|
+
/**
|
|
822
|
+
* Check if a string contains any OmniDev variables
|
|
823
|
+
*/
|
|
824
|
+
declare function containsOmnidevVariables(content: string): boolean;
|
|
825
|
+
interface LoadHooksOptions {
|
|
826
|
+
/** Transform Claude variables to OmniDev format (default: true) */
|
|
827
|
+
transformVariables?: boolean;
|
|
828
|
+
/** Validate the hooks configuration (default: true) */
|
|
829
|
+
validate?: boolean;
|
|
830
|
+
/** Check script files exist and are executable (default: false) */
|
|
831
|
+
checkScripts?: boolean;
|
|
832
|
+
}
|
|
833
|
+
interface LoadHooksResult {
|
|
834
|
+
/** The loaded hooks configuration (empty if not found or invalid) */
|
|
835
|
+
config: HooksConfig;
|
|
836
|
+
/** Validation result */
|
|
837
|
+
validation: HookValidationResult;
|
|
838
|
+
/** Whether hooks were found */
|
|
839
|
+
found: boolean;
|
|
840
|
+
/** Path to the hooks config file (if found) */
|
|
841
|
+
configPath?: string;
|
|
842
|
+
/** Any errors during loading (e.g., TOML parse error) */
|
|
843
|
+
loadError?: string;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Load hooks configuration from a capability directory
|
|
847
|
+
*
|
|
848
|
+
* Looks for hooks/hooks.toml within the capability directory.
|
|
849
|
+
* Transforms variables and validates the configuration.
|
|
850
|
+
*/
|
|
851
|
+
declare function loadHooksFromCapability(capabilityPath: string, options?: LoadHooksOptions): LoadHooksResult;
|
|
852
|
+
/**
|
|
853
|
+
* Load hooks and create CapabilityHooks metadata
|
|
854
|
+
*/
|
|
855
|
+
declare function loadCapabilityHooks(capabilityName: string, capabilityPath: string, options?: LoadHooksOptions): CapabilityHooks | null;
|
|
856
|
+
/**
|
|
857
|
+
* Check if a capability has hooks defined
|
|
858
|
+
*/
|
|
859
|
+
declare function hasHooks(capabilityPath: string): boolean;
|
|
860
|
+
/**
|
|
861
|
+
* Get the hooks directory path for a capability
|
|
862
|
+
*/
|
|
863
|
+
declare function getHooksDirectory(capabilityPath: string): string;
|
|
864
|
+
/**
|
|
865
|
+
* Get the hooks config file path for a capability
|
|
866
|
+
*/
|
|
867
|
+
declare function getHooksConfigPath(capabilityPath: string): string;
|
|
868
|
+
/**
|
|
869
|
+
* Merge hooks from multiple capabilities into a single HooksConfig.
|
|
870
|
+
*
|
|
871
|
+
* Strategy:
|
|
872
|
+
* - All matchers from all capabilities are collected
|
|
873
|
+
* - Hooks are not deduplicated to preserve execution order and capability-specific behavior
|
|
874
|
+
* - Description field is omitted in merged config (it's per-capability metadata)
|
|
875
|
+
*/
|
|
876
|
+
declare function mergeHooksConfigs(capabilityHooks: CapabilityHooks[]): HooksConfig;
|
|
877
|
+
/**
|
|
878
|
+
* Options for deduplication
|
|
879
|
+
*/
|
|
880
|
+
interface DeduplicateOptions {
|
|
881
|
+
/** Deduplicate identical commands across matchers (default: false) */
|
|
882
|
+
deduplicateCommands?: boolean;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Merge and deduplicate hooks from multiple capability hooks.
|
|
886
|
+
*
|
|
887
|
+
* When deduplicateCommands is true:
|
|
888
|
+
* - Commands that are exactly identical are kept only once per event
|
|
889
|
+
* - The first occurrence is kept, subsequent duplicates removed
|
|
890
|
+
*
|
|
891
|
+
* This is useful when multiple capabilities might register the same hook
|
|
892
|
+
* (e.g., a common formatting hook).
|
|
893
|
+
*/
|
|
894
|
+
declare function mergeAndDeduplicateHooks(capabilityHooks: CapabilityHooks[], options?: DeduplicateOptions): HooksConfig;
|
|
895
|
+
/**
|
|
896
|
+
* Check if a merged config has any hooks defined
|
|
897
|
+
*/
|
|
898
|
+
declare function hasAnyHooks(config: HooksConfig): boolean;
|
|
899
|
+
/**
|
|
900
|
+
* Count total number of hook definitions across all events
|
|
901
|
+
*/
|
|
902
|
+
declare function countHooks(config: HooksConfig): number;
|
|
903
|
+
/**
|
|
904
|
+
* Get all events that have hooks defined
|
|
905
|
+
*/
|
|
906
|
+
declare function getEventsWithHooks(config: HooksConfig): HookEvent[];
|
|
570
907
|
/**
|
|
571
908
|
* Get enabled capabilities for the active profile
|
|
572
909
|
* Includes both profile-specific and always-enabled capabilities
|
|
@@ -677,6 +1014,18 @@ declare function loadProviderConfig(): Promise<ProviderConfig>;
|
|
|
677
1014
|
declare function writeProviderConfig(config: ProviderConfig): Promise<void>;
|
|
678
1015
|
declare function parseProviderFlag(flag: string): Provider[];
|
|
679
1016
|
/**
|
|
1017
|
+
* Add a capability source to [capabilities.sources]
|
|
1018
|
+
*/
|
|
1019
|
+
declare function patchAddCapabilitySource(name: string, source: CapabilitySourceConfig): Promise<void>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Add an MCP server configuration
|
|
1022
|
+
*/
|
|
1023
|
+
declare function patchAddMcp(name: string, config: McpConfig): Promise<void>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Add a capability to a profile's capabilities array
|
|
1026
|
+
*/
|
|
1027
|
+
declare function patchAddToProfile(profileName: string, capabilityName: string): Promise<void>;
|
|
1028
|
+
/**
|
|
680
1029
|
* Resources provided by a single capability
|
|
681
1030
|
*/
|
|
682
1031
|
interface CapabilityResources {
|
|
@@ -854,19 +1203,42 @@ declare function buildSyncBundle(options?: {
|
|
|
854
1203
|
declare function syncAgentConfiguration(options?: SyncOptions): Promise<SyncResult>;
|
|
855
1204
|
/**
|
|
856
1205
|
* Template for AGENTS.md (Codex provider)
|
|
857
|
-
* Creates a minimal file
|
|
1206
|
+
* Creates a minimal file - actual content is generated during sync from OMNI.md + instructions
|
|
858
1207
|
*/
|
|
859
1208
|
declare function generateAgentsTemplate(): string;
|
|
860
1209
|
/**
|
|
861
|
-
*
|
|
862
|
-
* Creates a minimal file with reference to OmniDev instructions
|
|
1210
|
+
* Templates for bootstrapping new capabilities.
|
|
863
1211
|
*/
|
|
864
|
-
|
|
1212
|
+
interface CapabilityTemplateOptions {
|
|
1213
|
+
id: string;
|
|
1214
|
+
name: string;
|
|
1215
|
+
description?: string;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Generate a capability.toml file for a new capability.
|
|
1219
|
+
*/
|
|
1220
|
+
declare function generateCapabilityToml(options: CapabilityTemplateOptions): string;
|
|
1221
|
+
/**
|
|
1222
|
+
* Generate a SKILL.md template file.
|
|
1223
|
+
*/
|
|
1224
|
+
declare function generateSkillTemplate(skillName: string): string;
|
|
1225
|
+
/**
|
|
1226
|
+
* Generate a rule markdown template file.
|
|
1227
|
+
*/
|
|
1228
|
+
declare function generateRuleTemplate(ruleName: string): string;
|
|
865
1229
|
/**
|
|
866
|
-
*
|
|
867
|
-
* Contains OmniDev-specific instructions and capability rules
|
|
1230
|
+
* Generate a hooks.toml template file.
|
|
868
1231
|
*/
|
|
869
|
-
declare function
|
|
1232
|
+
declare function generateHooksTemplate(): string;
|
|
1233
|
+
/**
|
|
1234
|
+
* Generate a sample hook script.
|
|
1235
|
+
*/
|
|
1236
|
+
declare function generateHookScript(): string;
|
|
1237
|
+
/**
|
|
1238
|
+
* Template for CLAUDE.md (Claude provider)
|
|
1239
|
+
* Creates a minimal file - actual content is generated during sync from OMNI.md + instructions
|
|
1240
|
+
*/
|
|
1241
|
+
declare function generateClaudeTemplate(): string;
|
|
870
1242
|
/**
|
|
871
1243
|
* Template for OMNI.md - the user's project instructions file.
|
|
872
1244
|
* This is the single source of truth that gets transformed into
|
|
@@ -879,4 +1251,4 @@ declare function generateOmniMdTemplate(): string;
|
|
|
879
1251
|
declare function debug(message: string, data?: unknown): void;
|
|
880
1252
|
declare const version = "0.1.0";
|
|
881
1253
|
declare function getVersion(): string;
|
|
882
|
-
export {
|
|
1254
|
+
export { writeProviderConfig, writeMcpJson, writeEnabledProviders, writeConfig, writeActiveProfileState, version, validateHooksConfig, validateHook, validateEnv, transformToOmnidev, transformToClaude, transformHooksConfig, syncMcpJson, syncAgentConfiguration, sourceToGitUrl, setProfile, setActiveProfile, saveManifest, saveLockFile, resolveEnabledCapabilities, readMcpJson, readEnabledProviders, readCapabilityIdFromPath, readActiveProfileState, patchAddToProfile, patchAddMcp, patchAddCapabilitySource, parseSourceConfig, parseProviderFlag, parseOmniConfig, parseFileSourcePath, parseCapabilityConfig, mergeHooksConfigs, mergeAndDeduplicateHooks, loadSubagents, loadSkills, loadRules, loadProviderConfig, loadProfileConfig, loadManifest, loadLockFile, loadHooksFromCapability, loadEnvironment, loadDocs, loadConfig, loadCommands, loadCapabilityHooks, loadCapabilityConfig, loadCapability, loadBaseConfig, isValidMatcherPattern, isSecretEnvVar, isProviderEnabled, isPromptHookEvent, isMatcherEvent, isHookType, isHookPrompt, isHookEvent, isHookCommand, isGitSource, isFileSourceConfig, isFileSource, installCapabilityDependencies, hasHooks, hasAnyHooks, getVersion, getSourceCapabilityPath, getLockFilePath, getHooksDirectory, getHooksConfigPath, getEventsWithHooks, getEnabledCapabilities, getActiveProviders, getActiveProfile, generateSkillTemplate, generateRuleTemplate, generateOmniMdTemplate, generateHooksTemplate, generateHookScript, generateClaudeTemplate, generateCapabilityToml, generateAgentsTemplate, findDuplicateCommands, fetchCapabilitySource, fetchAllCapabilitySources, enableProvider, enableCapability, discoverCapabilities, disableProvider, disableCapability, debug, createEmptyValidationResult, createEmptyHooksConfig, countHooks, containsOmnidevVariables, containsClaudeVariables, clearActiveProfileState, cleanupStaleResources, checkForUpdates, buildSyncBundle, buildRouteMap, buildManifestFromCapabilities, buildCommand, buildCapabilityRegistry, ValidationSeverity, VARIABLE_MAPPINGS, SyncResult, SyncOptions, SyncConfig, SyncBundle, SubagentPermissionMode, SubagentModel, SubagentHooks, SubagentHookConfig, SubagentExport, Subagent, SourceUpdateInfo, SkillExport, Skill, SessionStartMatcher, SESSION_START_MATCHERS, Rule, ResourceManifest, ProvidersState, ProviderSyncResult, ProviderManifest, ProviderInitResult, ProviderId, ProviderContext, ProviderConfig, ProviderAdapter, Provider, PromptHookEvent, ProfileConfig, PreCompactMatcher, PROMPT_HOOK_EVENTS, PRE_COMPACT_MATCHERS, OmnidevVariable, OmniConfig, NotificationMatcher, NOTIFICATION_MATCHERS, McpTransport, McpToolSchema, McpServerStdioConfig, McpServerSseConfig, McpServerHttpConfig, McpServerConfig, McpJsonConfig, McpConfig, MatcherEvent, MATCHER_EVENTS, LoadedCapability, LoadHooksResult, LoadHooksOptions, HooksDoctorResult, HooksDoctorCheck, HooksConfig, HookValidationResult, HookValidationIssue, HookValidationCode, HookType, HookPrompt, HookMatcher, HookEvent, HookCommand, Hook, HOOK_TYPES, HOOK_EVENTS, HOOKS_DIRECTORY, HOOKS_CONFIG_FILENAME, GitCapabilitySourceConfig, FileContent, FileCapabilitySourceConfig, FetchResult, EnvDeclaration, DoctorCheckStatus, DocExport, Doc, DiscoveredContent, DeduplicateOptions, DEFAULT_PROMPT_TIMEOUT, DEFAULT_COMMAND_TIMEOUT, CommandExport, Command, CliConfig, CleanupResult, ClaudeVariable, CapabilityTemplateOptions, CapabilitySourceType, CapabilitySourceConfig, CapabilitySource, CapabilityResources, CapabilityRegistry, CapabilityMetadata, CapabilityLockEntry, CapabilityHooks, CapabilityExports, CapabilityExport, CapabilityConfig, CapabilitiesLockFile, CapabilitiesConfig, COMMON_TOOL_MATCHERS };
|