@omnidev-ai/core 0.3.0 → 0.5.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.
@@ -0,0 +1,825 @@
1
+ import { buildCommand, buildRouteMap } from "@stricli/core";
2
+ /**
3
+ * Capability Export Types
4
+ *
5
+ * These types define the structure that capabilities use to their features.
6
+ * Capabilities should import these types from @omnidev-ai/core and use them in their index.ts.
7
+ */
8
+ /**
9
+ * File content structure for programmatic file creation
10
+ */
11
+ interface FileContent {
12
+ /** File name (relative path within capability) */
13
+ name: string;
14
+ /** File content */
15
+ content: string;
16
+ }
17
+ /**
18
+ * Documentation structure
19
+ */
20
+ interface DocExport {
21
+ /** Document title */
22
+ title: string;
23
+ /** Markdown content */
24
+ content: string;
25
+ }
26
+ /**
27
+ * Skill structure
28
+ */
29
+ interface SkillExport {
30
+ /** SKILL.md content (markdown with YAML frontmatter) */
31
+ skillMd: string;
32
+ /** Optional: Reference files to create (files the skill needs access to) */
33
+ references?: FileContent[];
34
+ /** Optional: Additional files to create (templates, examples, etc.) */
35
+ additionalFiles?: FileContent[];
36
+ }
37
+ /**
38
+ * Subagent structure
39
+ *
40
+ * Defines a subagent that Claude can delegate tasks to.
41
+ * Uses YAML frontmatter in markdown format for configuration.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const codeReviewer: SubagentExport = {
46
+ * subagentMd: `---
47
+ * name: code-reviewer
48
+ * description: Reviews code for quality and best practices
49
+ * tools: Read, Glob, Grep
50
+ * model: sonnet
51
+ * ---
52
+ *
53
+ * You are a code reviewer. When invoked, analyze the code and provide
54
+ * specific, actionable feedback on quality, security, and best practices.`
55
+ * };
56
+ * ```
57
+ */
58
+ interface SubagentExport {
59
+ /** SUBAGENT.md content (markdown with YAML frontmatter) */
60
+ subagentMd: string;
61
+ }
62
+ /**
63
+ * Slash command structure
64
+ *
65
+ * Defines a slash command that can be invoked in Claude Code.
66
+ * Uses YAML frontmatter in markdown format for configuration.
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const fixIssue: CommandExport = {
71
+ * commandMd: `---
72
+ * name: fix-issue
73
+ * description: Fix a GitHub issue following coding standards
74
+ * allowed-tools: Bash(git add:*), Bash(git commit:*)
75
+ * ---
76
+ *
77
+ * Fix issue #$ARGUMENTS following our coding standards.
78
+ *
79
+ * 1. Read the issue details
80
+ * 2. Implement the fix
81
+ * 3. Write tests
82
+ * 4. Create a commit`
83
+ * };
84
+ * ```
85
+ */
86
+ interface CommandExport {
87
+ /** COMMAND.md content (markdown with YAML frontmatter) */
88
+ commandMd: string;
89
+ }
90
+ /**
91
+ * Complete capability structure
92
+ *
93
+ * Capabilities this as their default from index.ts.
94
+ * All content fields are OPTIONAL and PROGRAMMATIC.
95
+ * Capabilities can also provide content via static files in their directory.
96
+ * Both approaches are supported and will be merged during sync.
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * // Static files approach - just CLI commands
101
+ * {
102
+ * cliCommands: { mycap: myRoutes },
103
+ * gitignore: ["mycap/"],
104
+ * sync
105
+ * } satisfies CapabilityExport;
106
+ * ```
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * // Programmatic approach - generate content dynamically
111
+ * {
112
+ * cliCommands: { mycap: myRoutes },
113
+ * docs: [{ title: "Guide", content: "# Guide\n..." }],
114
+ * rules: ["# Rule content..."],
115
+ * skills: [{ skillMd: "...", references: [...] }],
116
+ * gitignore: ["mycap/"],
117
+ * sync
118
+ * } satisfies CapabilityExport;
119
+ * ```
120
+ */
121
+ interface CapabilityExport {
122
+ /** CLI commands provided by this capability */
123
+ cliCommands?: Record<string, unknown>;
124
+ /** Documentation (programmatic - optional, can also use docs/ directory) */
125
+ docs?: DocExport[];
126
+ /** Rules (programmatic - optional, can also use rules/ directory) */
127
+ rules?: string[];
128
+ /** Skills (programmatic - optional, can also use skills/ directory) */
129
+ skills?: SkillExport[];
130
+ /** Subagents (programmatic - optional, can also use subagents/ directory) */
131
+ subagents?: SubagentExport[];
132
+ /** Commands (programmatic - optional, can also use commands/ directory) */
133
+ commands?: CommandExport[];
134
+ /** Gitignore patterns */
135
+ gitignore?: string[];
136
+ /** Custom sync hook function */
137
+ sync?: () => Promise<void>;
138
+ /** Additional exports for extensibility */
139
+ [key: string]: unknown;
140
+ }
141
+ interface CapabilityMetadata {
142
+ id: string;
143
+ name: string;
144
+ version: string;
145
+ description: string;
146
+ /** Optional author information */
147
+ author?: {
148
+ name?: string;
149
+ email?: string;
150
+ };
151
+ /** Optional metadata about the capability author and source */
152
+ metadata?: {
153
+ author?: string;
154
+ repository?: string;
155
+ license?: string;
156
+ /** True if this capability was auto-generated by wrapping a skills repo */
157
+ wrapped?: boolean;
158
+ /** For wrapped capabilities: the full commit hash */
159
+ commit?: string;
160
+ /** True if this capability was auto-generated from omni.toml [mcps] section */
161
+ generated_from_omni_toml?: boolean;
162
+ };
163
+ }
164
+ interface CapabilityExports {
165
+ module?: string;
166
+ gitignore?: string[];
167
+ }
168
+ interface EnvDeclaration {
169
+ required?: boolean;
170
+ secret?: boolean;
171
+ default?: string;
172
+ }
173
+ interface SyncConfig {
174
+ on_sync?: string;
175
+ }
176
+ interface CliConfig {
177
+ commands?: string[];
178
+ }
179
+ interface CapabilityConfig {
180
+ capability: CapabilityMetadata;
181
+ exports?: CapabilityExports;
182
+ env?: Record<string, EnvDeclaration | Record<string, never>>;
183
+ mcp?: McpConfig;
184
+ sync?: SyncConfig;
185
+ cli?: CliConfig;
186
+ }
187
+ type McpTransport = "stdio" | "sse" | "http";
188
+ interface McpToolSchema {
189
+ name: string;
190
+ description: string;
191
+ inputSchema: Record<string, unknown>;
192
+ }
193
+ interface McpConfig {
194
+ command: string;
195
+ args?: string[];
196
+ env?: Record<string, string>;
197
+ cwd?: string;
198
+ transport?: McpTransport;
199
+ tools?: McpToolSchema[];
200
+ }
201
+ interface Skill {
202
+ name: string;
203
+ description: string;
204
+ instructions: string;
205
+ capabilityId: string;
206
+ }
207
+ interface Rule {
208
+ name: string;
209
+ content: string;
210
+ capabilityId: string;
211
+ }
212
+ interface Doc {
213
+ name: string;
214
+ content: string;
215
+ capabilityId: string;
216
+ }
217
+ type SubagentModel = "sonnet" | "opus" | "haiku" | "inherit";
218
+ type SubagentPermissionMode = "default" | "acceptEdits" | "dontAsk" | "bypassPermissions" | "plan";
219
+ interface SubagentHookConfig {
220
+ matcher?: string;
221
+ hooks: {
222
+ type: "command";
223
+ command: string;
224
+ }[];
225
+ }
226
+ interface SubagentHooks {
227
+ PreToolUse?: SubagentHookConfig[];
228
+ PostToolUse?: SubagentHookConfig[];
229
+ Stop?: SubagentHookConfig[];
230
+ }
231
+ interface Subagent {
232
+ /** Unique identifier using lowercase letters and hyphens */
233
+ name: string;
234
+ /** When Claude should delegate to this subagent */
235
+ description: string;
236
+ /** System prompt that guides the subagent's behavior */
237
+ systemPrompt: string;
238
+ /** Tools the subagent can use (inherits all if omitted) */
239
+ tools?: string[];
240
+ /** Tools to deny (removed from inherited or specified list) */
241
+ disallowedTools?: string[];
242
+ /** Model to use: sonnet, opus, haiku, or inherit */
243
+ model?: SubagentModel;
244
+ /** Permission mode for the subagent */
245
+ permissionMode?: SubagentPermissionMode;
246
+ /** Skills to load into the subagent's context at startup */
247
+ skills?: string[];
248
+ /** Lifecycle hooks scoped to this subagent */
249
+ hooks?: SubagentHooks;
250
+ /** Capability that provides this subagent */
251
+ capabilityId: string;
252
+ }
253
+ interface Command {
254
+ /** Command name (used as /command-name) */
255
+ name: string;
256
+ /** Brief description of what this command does */
257
+ description: string;
258
+ /** Optional allowed tools specification (e.g., "Bash(git add:*), Bash(git status:*)") */
259
+ allowedTools?: string;
260
+ /** Command prompt (markdown content with support for $ARGUMENTS, $1, $2, !`commands`, @files) */
261
+ prompt: string;
262
+ /** Capability that provides this command */
263
+ capabilityId: string;
264
+ }
265
+ type CapabilitySourceType = "local" | "git";
266
+ /** Configuration for a Git-sourced capability */
267
+ interface GitCapabilitySourceConfig {
268
+ /** Source URL or shorthand (e.g., "github:user/repo", "git@github.com:...") */
269
+ source: string;
270
+ /** Git ref to checkout: tag, branch, or commit hash */
271
+ ref?: string;
272
+ /** Subdirectory within the repo containing the capability */
273
+ path?: string;
274
+ }
275
+ /** Combined type for all capability source configurations */
276
+ type CapabilitySourceConfig = string | GitCapabilitySourceConfig;
277
+ /** Lock file entry for a capability (version tracking) */
278
+ interface CapabilityLockEntry {
279
+ /** Original source reference */
280
+ source: string;
281
+ /** Version from capability.toml or package.json */
282
+ version: string;
283
+ /** For git sources: exact commit hash */
284
+ commit?: string;
285
+ /** Pinned ref if specified */
286
+ ref?: string;
287
+ /** Last update timestamp (ISO 8601) */
288
+ updated_at: string;
289
+ }
290
+ /** Lock file structure (omni.lock.toml at project root) */
291
+ interface CapabilitiesLockFile {
292
+ capabilities: Record<string, CapabilityLockEntry>;
293
+ }
294
+ /** Capabilities configuration section in omni.toml */
295
+ interface CapabilitiesConfig {
296
+ /** List of enabled capability IDs */
297
+ enable?: string[];
298
+ /** List of disabled capability IDs */
299
+ disable?: string[];
300
+ /** Capability sources: id -> source string or full config (git or file) */
301
+ sources?: Record<string, CapabilitySourceConfig>;
302
+ }
303
+ interface ProfileConfig {
304
+ capabilities?: string[];
305
+ }
306
+ interface OmniConfig {
307
+ project?: string;
308
+ active_profile?: string;
309
+ always_enabled_capabilities?: string[];
310
+ env?: Record<string, string>;
311
+ profiles?: Record<string, ProfileConfig>;
312
+ providers?: {
313
+ enabled?: Provider[];
314
+ };
315
+ /** Capabilities configuration (enable/disable, sources) */
316
+ capabilities?: CapabilitiesConfig;
317
+ /** MCP server definitions that auto-generate capabilities */
318
+ mcps?: Record<string, McpConfig>;
319
+ }
320
+ type Provider = "claude" | "codex" | "claude-code" | "cursor" | "opencode";
321
+ interface ProviderConfig {
322
+ provider?: Provider;
323
+ providers?: Provider[];
324
+ }
325
+ declare function getActiveProviders(config: ProviderConfig): Provider[];
326
+ /** Runtime info about where a capability came from */
327
+ interface CapabilitySource {
328
+ type: CapabilitySourceType;
329
+ /** For git-sourced capabilities: the source URL/shorthand */
330
+ gitSource?: string;
331
+ /** For git-sourced capabilities: the pinned ref if any */
332
+ ref?: string;
333
+ /** For git-sourced capabilities: the current commit hash */
334
+ commit?: string;
335
+ /** Version from capability.toml or package.json */
336
+ version?: string;
337
+ }
338
+ interface LoadedCapability {
339
+ id: string;
340
+ path: string;
341
+ config: CapabilityConfig;
342
+ skills: Skill[];
343
+ rules: Rule[];
344
+ docs: Doc[];
345
+ subagents: Subagent[];
346
+ commands: Command[];
347
+ typeDefinitions?: string;
348
+ gitignore?: string[];
349
+ exports: Record<string, unknown>;
350
+ /** Where this capability comes from */
351
+ source?: CapabilitySource;
352
+ }
353
+ type ProviderId = Provider | (string & {});
354
+ interface SyncBundle {
355
+ capabilities: LoadedCapability[];
356
+ skills: Skill[];
357
+ rules: Rule[];
358
+ docs: Doc[];
359
+ commands: Command[];
360
+ subagents: Subagent[];
361
+ instructionsPath: string;
362
+ instructionsContent: string;
363
+ }
364
+ interface ProviderContext {
365
+ projectRoot: string;
366
+ config: OmniConfig;
367
+ activeProfile?: string;
368
+ }
369
+ interface ProviderInitResult {
370
+ filesCreated?: string[];
371
+ message?: string;
372
+ }
373
+ interface ProviderSyncResult {
374
+ filesWritten: string[];
375
+ filesDeleted: string[];
376
+ }
377
+ interface ProviderManifest {
378
+ files: string[];
379
+ lastSync: string;
380
+ }
381
+ interface ProviderAdapter {
382
+ id: ProviderId;
383
+ displayName: string;
384
+ init?(ctx: ProviderContext): Promise<ProviderInitResult>;
385
+ sync(bundle: SyncBundle, ctx: ProviderContext): Promise<ProviderSyncResult>;
386
+ cleanup?(manifest: ProviderManifest, ctx: ProviderContext): Promise<void>;
387
+ }
388
+ /**
389
+ * Load commands from a commands/ directory of a capability.
390
+ * Each command is a COMMAND.md file in its own subdirectory.
391
+ */
392
+ declare function loadCommands(capabilityPath: string, capabilityId: string): Promise<Command[]>;
393
+ /**
394
+ * Load documentation from a capability directory
395
+ * Loads both definition.md and all files from docs/ directory
396
+ * @param capabilityPath Path to the capability directory
397
+ * @param capabilityId ID of the capability
398
+ * @returns Array of Doc objects
399
+ */
400
+ declare function loadDocs(capabilityPath: string, capabilityId: string): Promise<Doc[]>;
401
+ /**
402
+ * Discovers capabilities by scanning the .omni/capabilities directory.
403
+ * A directory is considered a capability if it contains a capability.toml file.
404
+ *
405
+ * @returns Array of capability directory paths
406
+ */
407
+ declare function discoverCapabilities(): Promise<string[]>;
408
+ /**
409
+ * Loads and parses a capability configuration file.
410
+ * Validates required fields.
411
+ *
412
+ * @param capabilityPath - Path to the capability directory
413
+ * @returns Parsed capability configuration
414
+ * @throws Error if the config is invalid
415
+ */
416
+ declare function loadCapabilityConfig(capabilityPath: string): Promise<CapabilityConfig>;
417
+ /**
418
+ * Loads a complete capability including config, skills, rules, docs, and exports.
419
+ * Validates environment requirements before loading.
420
+ *
421
+ * @param capabilityPath - Path to the capability directory
422
+ * @param env - Environment variables to validate against
423
+ * @returns Fully loaded capability
424
+ * @throws Error if validation fails or loading errors occur
425
+ */
426
+ declare function loadCapability(capabilityPath: string, env: Record<string, string>): Promise<LoadedCapability>;
427
+ /**
428
+ * Registry of loaded capabilities with helper functions.
429
+ */
430
+ interface CapabilityRegistry {
431
+ capabilities: Map<string, LoadedCapability>;
432
+ getCapability(id: string): LoadedCapability | undefined;
433
+ getAllCapabilities(): LoadedCapability[];
434
+ getAllSkills(): Skill[];
435
+ getAllRules(): Rule[];
436
+ getAllDocs(): Doc[];
437
+ }
438
+ /**
439
+ * Builds a capability registry by discovering, loading, and filtering capabilities.
440
+ * Only enabled capabilities (based on active profile) are included.
441
+ *
442
+ * @returns Capability registry with helper functions
443
+ */
444
+ declare function buildCapabilityRegistry(): Promise<CapabilityRegistry>;
445
+ /**
446
+ * Load rules from a capability's rules/ directory
447
+ * @param capabilityPath Path to the capability directory
448
+ * @param capabilityId ID of the capability
449
+ * @returns Array of Rule objects
450
+ */
451
+ declare function loadRules(capabilityPath: string, capabilityId: string): Promise<Rule[]>;
452
+ /**
453
+ * Write aggregated rules and docs to .omni/instructions.md
454
+ * Updates the generated section between markers while preserving user content
455
+ * @param rules Array of rules from all enabled capabilities
456
+ * @param docs Array of docs from all enabled capabilities
457
+ */
458
+ declare function writeRules(rules: Rule[], docs?: Doc[]): Promise<void>;
459
+ declare function loadSkills(capabilityPath: string, capabilityId: string): Promise<Skill[]>;
460
+ interface FetchResult {
461
+ id: string;
462
+ path: string;
463
+ version: string;
464
+ /** Git commit hash */
465
+ commit?: string;
466
+ updated: boolean;
467
+ wrapped: boolean;
468
+ }
469
+ interface SourceUpdateInfo {
470
+ id: string;
471
+ source: string;
472
+ currentVersion: string;
473
+ latestVersion: string;
474
+ hasUpdate: boolean;
475
+ }
476
+ /**
477
+ * Parse a capability source string or config into normalized form
478
+ * Returns a GitCapabilitySourceConfig
479
+ */
480
+ declare function parseSourceConfig(source: CapabilitySourceConfig): GitCapabilitySourceConfig;
481
+ /**
482
+ * Convert source to a git-cloneable URL
483
+ */
484
+ declare function sourceToGitUrl(source: string): string;
485
+ /**
486
+ * Get the path where a capability source will be stored
487
+ */
488
+ declare function getSourceCapabilityPath(id: string): string;
489
+ /**
490
+ * Get the lock file path
491
+ */
492
+ declare function getLockFilePath(): string;
493
+ /**
494
+ * Load the capabilities lock file
495
+ */
496
+ declare function loadLockFile(): Promise<CapabilitiesLockFile>;
497
+ /**
498
+ * Save the capabilities lock file
499
+ */
500
+ declare function saveLockFile(lockFile: CapabilitiesLockFile): Promise<void>;
501
+ /**
502
+ * Discover content in a wrapped repository
503
+ */
504
+ interface DiscoveredContent {
505
+ skills: Array<{
506
+ name: string;
507
+ path: string;
508
+ isFolder: boolean;
509
+ }>;
510
+ agents: Array<{
511
+ name: string;
512
+ path: string;
513
+ isFolder: boolean;
514
+ }>;
515
+ commands: Array<{
516
+ name: string;
517
+ path: string;
518
+ isFolder: boolean;
519
+ }>;
520
+ rulesDir: string | null;
521
+ docsDir: string | null;
522
+ }
523
+ /**
524
+ * Fetch a single capability source from git
525
+ */
526
+ declare function fetchCapabilitySource(id: string, sourceConfig: CapabilitySourceConfig, options?: {
527
+ silent?: boolean;
528
+ }): Promise<FetchResult>;
529
+ /**
530
+ * Fetch all capability sources from config
531
+ */
532
+ declare function fetchAllCapabilitySources(config: OmniConfig, options?: {
533
+ silent?: boolean;
534
+ force?: boolean;
535
+ }): Promise<FetchResult[]>;
536
+ /**
537
+ * Check for available updates without applying them
538
+ */
539
+ declare function checkForUpdates(config: OmniConfig): Promise<SourceUpdateInfo[]>;
540
+ /**
541
+ * Load subagents from the subagents/ directory of a capability.
542
+ * Each subagent is a SUBAGENT.md file in its own subdirectory.
543
+ */
544
+ declare function loadSubagents(capabilityPath: string, capabilityId: string): Promise<Subagent[]>;
545
+ /**
546
+ * Get enabled capabilities for the active profile
547
+ * Includes both profile-specific and always-enabled capabilities
548
+ * @returns Array of enabled capability IDs
549
+ */
550
+ declare function getEnabledCapabilities(): Promise<string[]>;
551
+ /**
552
+ * Enable a capability by adding it to the active profile's capabilities list
553
+ * @param capabilityId - The ID of the capability to enable
554
+ */
555
+ declare function enableCapability(capabilityId: string): Promise<void>;
556
+ /**
557
+ * Disable a capability by removing it from the active profile's capabilities list
558
+ * @param capabilityId - The ID of the capability to disable
559
+ */
560
+ declare function disableCapability(capabilityId: string): Promise<void>;
561
+ /**
562
+ * Load environment variables from .omni/.env file and merge with process.env.
563
+ * Process environment variables take precedence over file values.
564
+ *
565
+ * @returns Merged environment variables
566
+ */
567
+ declare function loadEnvironment(): Promise<Record<string, string>>;
568
+ /**
569
+ * Validate that all required environment variables are present.
570
+ * Checks declarations from capability config and throws descriptive errors for missing vars.
571
+ *
572
+ * @param declarations - Environment variable declarations from capability.toml
573
+ * @param env - Loaded environment variables
574
+ * @param capabilityId - ID of the capability being validated
575
+ * @throws Error if required environment variables are missing
576
+ */
577
+ declare function validateEnv(declarations: Record<string, EnvDeclaration | Record<string, never>>, env: Record<string, string | undefined>, capabilityId: string): void;
578
+ /**
579
+ * Check if an environment variable should be treated as a secret.
580
+ * Secrets should be masked in logs and error messages.
581
+ *
582
+ * @param key - Environment variable name
583
+ * @param declarations - Environment variable declarations from capability.toml
584
+ * @returns true if the variable is marked as secret
585
+ */
586
+ declare function isSecretEnvVar(key: string, declarations: Record<string, EnvDeclaration | Record<string, never>>): boolean;
587
+ /**
588
+ * Load and merge config and local configuration files
589
+ * @returns Merged OmniConfig object
590
+ *
591
+ * Reads omni.toml (main config) and omni.local.toml (local overrides).
592
+ * Local config takes precedence over main config. Missing files are treated as empty configs.
593
+ */
594
+ declare function loadConfig(): Promise<OmniConfig>;
595
+ /**
596
+ * Write config to omni.toml at project root
597
+ * @param config - The config object to write
598
+ */
599
+ declare function writeConfig(config: OmniConfig): Promise<void>;
600
+ /**
601
+ * Parse a TOML string into an OmniConfig object
602
+ * @param tomlContent - The TOML content to parse
603
+ * @returns Parsed OmniConfig object
604
+ * @throws Error if TOML is invalid
605
+ */
606
+ declare function parseOmniConfig(tomlContent: string): OmniConfig;
607
+ /**
608
+ * Parse a TOML string into a CapabilityConfig object
609
+ * @param tomlContent - The TOML content to parse
610
+ * @returns Parsed CapabilityConfig object
611
+ * @throws Error if TOML is invalid or required fields are missing
612
+ */
613
+ declare function parseCapabilityConfig(tomlContent: string): CapabilityConfig;
614
+ /**
615
+ * Gets the name of the currently active profile.
616
+ * Reads from state file first, falls back to config.toml for backwards compatibility.
617
+ * Returns null if no profile is set.
618
+ */
619
+ declare function getActiveProfile(): Promise<string | null>;
620
+ /**
621
+ * Sets the active profile by writing to state file.
622
+ * @param name - The name of the profile to activate
623
+ */
624
+ declare function setActiveProfile(name: string): Promise<void>;
625
+ /**
626
+ * Resolves the enabled capabilities for a given profile
627
+ *
628
+ * @param config - The merged OmniConfig
629
+ * @param profileName - The name of the profile to apply, or null to use active
630
+ * @returns Array of capability IDs that should be enabled
631
+ */
632
+ declare function resolveEnabledCapabilities(config: OmniConfig, profileName: string | null): string[];
633
+ /**
634
+ * Load a specific profile configuration from config.toml
635
+ * @param profileName - Name of the profile to load
636
+ * @returns ProfileConfig if found, undefined otherwise
637
+ */
638
+ declare function loadProfileConfig(profileName: string): Promise<ProfileConfig | undefined>;
639
+ /**
640
+ * Set a profile configuration in config.toml
641
+ * @param profileName - Name of the profile to set
642
+ * @param profileConfig - Profile configuration
643
+ */
644
+ declare function setProfile(profileName: string, profileConfig: ProfileConfig): Promise<void>;
645
+ declare function loadProviderConfig(): Promise<ProviderConfig>;
646
+ declare function writeProviderConfig(config: ProviderConfig): Promise<void>;
647
+ declare function parseProviderFlag(flag: string): Provider[];
648
+ /**
649
+ * Resources provided by a single capability
650
+ */
651
+ interface CapabilityResources {
652
+ skills: string[];
653
+ rules: string[];
654
+ commands: string[];
655
+ subagents: string[];
656
+ mcps: string[];
657
+ }
658
+ /**
659
+ * Manifest tracking which resources each capability provides.
660
+ * Used to clean up stale resources when capabilities are disabled.
661
+ */
662
+ interface ResourceManifest {
663
+ /** Schema version for future migrations */
664
+ version: 1;
665
+ /** Last sync timestamp (ISO 8601) */
666
+ syncedAt: string;
667
+ /** Map of capability ID → resources it provides */
668
+ capabilities: Record<string, CapabilityResources>;
669
+ }
670
+ /**
671
+ * Result of cleaning up stale resources
672
+ */
673
+ interface CleanupResult {
674
+ deletedSkills: string[];
675
+ deletedRules: string[];
676
+ deletedCommands: string[];
677
+ deletedSubagents: string[];
678
+ deletedMcps: string[];
679
+ }
680
+ /**
681
+ * Load the previous manifest from disk.
682
+ * Returns an empty manifest if the file doesn't exist.
683
+ */
684
+ declare function loadManifest(): Promise<ResourceManifest>;
685
+ /**
686
+ * Save the manifest to disk.
687
+ */
688
+ declare function saveManifest(manifest: ResourceManifest): Promise<void>;
689
+ /**
690
+ * Build a manifest from the current registry capabilities.
691
+ */
692
+ declare function buildManifestFromCapabilities(capabilities: LoadedCapability[]): ResourceManifest;
693
+ /**
694
+ * Delete resources for capabilities that are no longer enabled.
695
+ * Compares the previous manifest against current capability IDs
696
+ * and removes files/directories for capabilities not in the current set.
697
+ */
698
+ declare function cleanupStaleResources(previousManifest: ResourceManifest, currentCapabilityIds: Set<string>): Promise<CleanupResult>;
699
+ /**
700
+ * MCP server configuration in .mcp.json
701
+ */
702
+ interface McpServerConfig {
703
+ command: string;
704
+ args?: string[];
705
+ env?: Record<string, string>;
706
+ }
707
+ /**
708
+ * Structure of .mcp.json file
709
+ */
710
+ interface McpJsonConfig {
711
+ mcpServers: Record<string, McpServerConfig>;
712
+ }
713
+ /**
714
+ * Read .mcp.json or return empty config if doesn't exist
715
+ */
716
+ declare function readMcpJson(): Promise<McpJsonConfig>;
717
+ /**
718
+ * Write .mcp.json, preserving non-OmniDev entries
719
+ */
720
+ declare function writeMcpJson(config: McpJsonConfig): Promise<void>;
721
+ /**
722
+ * Sync .mcp.json with enabled capability MCP servers
723
+ *
724
+ * Each capability with an [mcp] section is registered using its capability ID.
725
+ * Uses the previous manifest to track which MCPs were managed by OmniDev.
726
+ */
727
+ declare function syncMcpJson(capabilities: LoadedCapability[], previousManifest: ResourceManifest, options?: {
728
+ silent?: boolean;
729
+ }): Promise<void>;
730
+ /**
731
+ * Read the active profile from state file.
732
+ * Returns null if no active profile is set in state.
733
+ */
734
+ declare function readActiveProfileState(): Promise<string | null>;
735
+ /**
736
+ * Write the active profile to state file.
737
+ * @param profileName - The name of the profile to set as active
738
+ */
739
+ declare function writeActiveProfileState(profileName: string): Promise<void>;
740
+ /**
741
+ * Clear the active profile state (delete the state file).
742
+ */
743
+ declare function clearActiveProfileState(): Promise<void>;
744
+ interface ProvidersState {
745
+ enabled: ProviderId[];
746
+ }
747
+ /**
748
+ * Read the enabled providers from local state.
749
+ * Returns default providers if no state file exists.
750
+ */
751
+ declare function readEnabledProviders(): Promise<ProviderId[]>;
752
+ /**
753
+ * Write enabled providers to local state.
754
+ * @param providers - List of provider IDs to enable
755
+ */
756
+ declare function writeEnabledProviders(providers: ProviderId[]): Promise<void>;
757
+ /**
758
+ * Enable a specific provider.
759
+ * @param providerId - The provider to enable
760
+ */
761
+ declare function enableProvider(providerId: ProviderId): Promise<void>;
762
+ /**
763
+ * Disable a specific provider.
764
+ * @param providerId - The provider to disable
765
+ */
766
+ declare function disableProvider(providerId: ProviderId): Promise<void>;
767
+ /**
768
+ * Check if a provider is enabled.
769
+ * @param providerId - The provider to check
770
+ */
771
+ declare function isProviderEnabled(providerId: ProviderId): Promise<boolean>;
772
+ interface SyncResult {
773
+ capabilities: string[];
774
+ skillCount: number;
775
+ ruleCount: number;
776
+ docCount: number;
777
+ }
778
+ interface SyncOptions {
779
+ silent?: boolean;
780
+ /** Optional list of adapters to run. If not provided, adapters are not run. */
781
+ adapters?: ProviderAdapter[];
782
+ }
783
+ /**
784
+ * Install dependencies for capabilities in .omni/capabilities/
785
+ * Only installs for capabilities that have a package.json
786
+ */
787
+ declare function installCapabilityDependencies(silent: boolean): Promise<void>;
788
+ /**
789
+ * Build a provider-agnostic SyncBundle from the capability registry.
790
+ * This bundle can then be passed to adapters for provider-specific materialization.
791
+ */
792
+ declare function buildSyncBundle(options?: {
793
+ silent?: boolean;
794
+ }): Promise<{
795
+ bundle: SyncBundle;
796
+ }>;
797
+ /**
798
+ * Central sync function that regenerates all agent configuration files.
799
+ * Called automatically after any config change (init, capability enable/disable, profile change).
800
+ *
801
+ * If adapters are provided, they will be called after core sync to write provider-specific files.
802
+ */
803
+ declare function syncAgentConfiguration(options?: SyncOptions): Promise<SyncResult>;
804
+ /**
805
+ * Template for AGENTS.md (Codex provider)
806
+ * Creates a minimal file with reference to OmniDev instructions
807
+ */
808
+ declare function generateAgentsTemplate(): string;
809
+ /**
810
+ * Template for CLAUDE.md (Claude provider)
811
+ * Creates a minimal file with reference to OmniDev instructions
812
+ */
813
+ declare function generateClaudeTemplate(): string;
814
+ /**
815
+ * Template for .omni/instructions.md
816
+ * Contains OmniDev-specific instructions and capability rules
817
+ */
818
+ declare function generateInstructionsTemplate(): string;
819
+ /**
820
+ * Debug logger that writes to stdout when OMNIDEV_DEBUG=1
821
+ */
822
+ declare function debug(message: string, data?: unknown): void;
823
+ declare const version = "0.1.0";
824
+ declare function getVersion(): string;
825
+ export { writeRules, writeProviderConfig, writeMcpJson, writeEnabledProviders, writeConfig, writeActiveProfileState, version, validateEnv, syncMcpJson, syncAgentConfiguration, sourceToGitUrl, setProfile, setActiveProfile, saveManifest, saveLockFile, resolveEnabledCapabilities, readMcpJson, readEnabledProviders, readActiveProfileState, parseSourceConfig, parseProviderFlag, parseOmniConfig, parseCapabilityConfig, loadSubagents, loadSkills, loadRules, loadProviderConfig, loadProfileConfig, loadManifest, loadLockFile, loadEnvironment, loadDocs, loadConfig, loadCommands, loadCapabilityConfig, loadCapability, isSecretEnvVar, isProviderEnabled, installCapabilityDependencies, getVersion, getSourceCapabilityPath, getLockFilePath, getEnabledCapabilities, getActiveProviders, getActiveProfile, generateInstructionsTemplate, generateClaudeTemplate, generateAgentsTemplate, fetchCapabilitySource, fetchAllCapabilitySources, enableProvider, enableCapability, discoverCapabilities, disableProvider, disableCapability, debug, clearActiveProfileState, cleanupStaleResources, checkForUpdates, buildSyncBundle, buildRouteMap, buildManifestFromCapabilities, buildCommand, buildCapabilityRegistry, SyncResult, SyncOptions, SyncConfig, SyncBundle, SubagentPermissionMode, SubagentModel, SubagentHooks, SubagentHookConfig, SubagentExport, Subagent, SourceUpdateInfo, SkillExport, Skill, Rule, ResourceManifest, ProvidersState, ProviderSyncResult, ProviderManifest, ProviderInitResult, ProviderId, ProviderContext, ProviderConfig, ProviderAdapter, Provider, ProfileConfig, OmniConfig, McpTransport, McpToolSchema, McpServerConfig, McpJsonConfig, McpConfig, LoadedCapability, GitCapabilitySourceConfig, FileContent, FetchResult, EnvDeclaration, DocExport, Doc, DiscoveredContent, CommandExport, Command, CliConfig, CleanupResult, CapabilitySourceType, CapabilitySourceConfig, CapabilitySource, CapabilityResources, CapabilityRegistry, CapabilityMetadata, CapabilityLockEntry, CapabilityExports, CapabilityExport, CapabilityConfig, CapabilitiesLockFile, CapabilitiesConfig };