@omnidev-ai/core 0.11.0 → 0.12.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 CHANGED
@@ -467,16 +467,25 @@ type CapabilitySourceConfig = string | GitCapabilitySourceConfig | FileCapabilit
467
467
  * Type guard to check if a source config is a FileCapabilitySourceConfig
468
468
  */
469
469
  declare function isFileSourceConfig(config: CapabilitySourceConfig): config is FileCapabilitySourceConfig;
470
+ /**
471
+ * Source where the version was detected from.
472
+ * Used for debugging and auditing to understand version provenance.
473
+ */
474
+ type VersionSource = "capability.toml" | "plugin.json" | "package.json" | "commit" | "content_hash";
470
475
  /** Lock file entry for a capability (version tracking) */
471
476
  interface CapabilityLockEntry {
472
477
  /** Original source reference */
473
478
  source: string;
474
- /** Version from capability.toml or package.json */
479
+ /** Version from capability.toml, plugin.json, package.json, or fallback */
475
480
  version: string;
481
+ /** Where the version was detected from (for auditing/debugging) */
482
+ version_source?: VersionSource;
476
483
  /** For git sources: exact commit hash */
477
484
  commit?: string;
478
485
  /** Pinned ref if specified */
479
486
  ref?: string;
487
+ /** For file sources: SHA-256 hash of content for reproducibility */
488
+ content_hash?: string;
480
489
  /** Last update timestamp (ISO 8601) */
481
490
  updated_at: string;
482
491
  }
@@ -500,6 +509,37 @@ interface CapabilitiesConfig {
500
509
  interface ProfileConfig {
501
510
  capabilities?: string[];
502
511
  }
512
+ /**
513
+ * Security scan mode
514
+ * - off: No scanning (default)
515
+ * - warn: Report findings but continue
516
+ * - error: Report findings and fail sync
517
+ */
518
+ type SecurityMode = "off" | "warn" | "error";
519
+ /**
520
+ * Individual scan toggles for security scanning
521
+ */
522
+ interface ScanSettings {
523
+ /** Detect suspicious Unicode characters (bidi overrides, zero-width, control chars) */
524
+ unicode?: boolean;
525
+ /** Detect symlinks inside capability directories */
526
+ symlinks?: boolean;
527
+ /** Detect suspicious patterns in scripts/hooks */
528
+ scripts?: boolean;
529
+ /** Detect binary files in content folders */
530
+ binaries?: boolean;
531
+ }
532
+ /**
533
+ * Security configuration section in omni.toml
534
+ */
535
+ interface SecurityConfig {
536
+ /** Scan mode: off, warn, or error (default: off) */
537
+ mode?: SecurityMode;
538
+ /** Trusted source patterns (host/org/repo) that skip scanning */
539
+ trusted_sources?: string[];
540
+ /** Individual scan settings */
541
+ scan?: ScanSettings;
542
+ }
503
543
  interface OmniConfig {
504
544
  profiles?: Record<string, ProfileConfig>;
505
545
  providers?: {
@@ -509,6 +549,8 @@ interface OmniConfig {
509
549
  capabilities?: CapabilitiesConfig;
510
550
  /** MCP server definitions that auto-generate capabilities */
511
551
  mcps?: Record<string, McpConfig>;
552
+ /** Security scanning configuration */
553
+ security?: SecurityConfig;
512
554
  }
513
555
  type Provider = "claude" | "codex" | "claude-code" | "cursor" | "opencode";
514
556
  interface ProviderConfig {
@@ -652,8 +694,12 @@ interface FetchResult {
652
694
  id: string;
653
695
  path: string;
654
696
  version: string;
697
+ /** Source where version was detected from */
698
+ versionSource: VersionSource;
655
699
  /** Git commit hash */
656
700
  commit?: string;
701
+ /** Content hash for file sources (SHA-256) */
702
+ contentHash?: string;
657
703
  updated: boolean;
658
704
  wrapped: boolean;
659
705
  }
@@ -1086,9 +1132,7 @@ declare function writeMcpJson(config: McpJsonConfig): Promise<void>;
1086
1132
  * Each capability with an [mcp] section is registered using its capability ID.
1087
1133
  * Uses the previous manifest to track which MCPs were managed by OmniDev.
1088
1134
  */
1089
- declare function syncMcpJson(capabilities: LoadedCapability[], previousManifest: ResourceManifest, options?: {
1090
- silent?: boolean;
1091
- }): Promise<void>;
1135
+ declare function syncMcpJson(capabilities: LoadedCapability[], previousManifest: ResourceManifest): Promise<void>;
1092
1136
  /**
1093
1137
  * Read the active profile from state file.
1094
1138
  * Returns null if no active profile is set in state.
@@ -1131,6 +1175,130 @@ declare function disableProvider(providerId: ProviderId): Promise<void>;
1131
1175
  * @param providerId - The provider to check
1132
1176
  */
1133
1177
  declare function isProviderEnabled(providerId: ProviderId): Promise<boolean>;
1178
+ /**
1179
+ * Severity level for security findings
1180
+ */
1181
+ type FindingSeverity = "low" | "medium" | "high" | "critical";
1182
+ /**
1183
+ * Types of security findings
1184
+ */
1185
+ type FindingType = "unicode_bidi" | "unicode_zero_width" | "unicode_control" | "symlink_escape" | "symlink_absolute" | "suspicious_script" | "binary_file";
1186
+ /**
1187
+ * A security finding (potential issue)
1188
+ */
1189
+ interface SecurityFinding {
1190
+ /** Type of finding */
1191
+ type: FindingType;
1192
+ /** Severity level */
1193
+ severity: FindingSeverity;
1194
+ /** File path relative to capability root */
1195
+ file: string;
1196
+ /** Line number (if applicable) */
1197
+ line?: number;
1198
+ /** Column number (if applicable) */
1199
+ column?: number;
1200
+ /** Human-readable description */
1201
+ message: string;
1202
+ /** Additional details (e.g., specific codepoints found) */
1203
+ details?: string;
1204
+ }
1205
+ /**
1206
+ * Result of scanning a capability
1207
+ */
1208
+ interface ScanResult {
1209
+ /** Capability ID */
1210
+ capabilityId: string;
1211
+ /** Capability path */
1212
+ path: string;
1213
+ /** List of findings */
1214
+ findings: SecurityFinding[];
1215
+ /** Whether the scan passed (no findings or mode=warn) */
1216
+ passed: boolean;
1217
+ /** Scan duration in milliseconds */
1218
+ duration: number;
1219
+ }
1220
+ /**
1221
+ * Overall scan summary
1222
+ */
1223
+ interface ScanSummary {
1224
+ /** Total capabilities scanned */
1225
+ totalCapabilities: number;
1226
+ /** Capabilities with findings */
1227
+ capabilitiesWithFindings: number;
1228
+ /** Total findings */
1229
+ totalFindings: number;
1230
+ /** Findings by type */
1231
+ findingsByType: Record<FindingType, number>;
1232
+ /** Findings by severity */
1233
+ findingsBySeverity: Record<FindingSeverity, number>;
1234
+ /** Individual scan results */
1235
+ results: ScanResult[];
1236
+ /** Whether all scans passed */
1237
+ allPassed: boolean;
1238
+ }
1239
+ /**
1240
+ * Default security configuration
1241
+ */
1242
+ declare const DEFAULT_SECURITY_CONFIG: Required<SecurityConfig>;
1243
+ /**
1244
+ * Default scan settings
1245
+ */
1246
+ declare const DEFAULT_SCAN_SETTINGS: Required<ScanSettings>;
1247
+ /**
1248
+ * Security allows state structure
1249
+ */
1250
+ interface SecurityAllowsState {
1251
+ /** Schema version */
1252
+ version: 1;
1253
+ /** Timestamp of last modification */
1254
+ modifiedAt: string;
1255
+ /** Map of capability ID -> array of allowed finding types */
1256
+ allows: Record<string, FindingType[]>;
1257
+ }
1258
+ /**
1259
+ * An individual security allow entry
1260
+ */
1261
+ interface SecurityAllow {
1262
+ capabilityId: string;
1263
+ findingType: FindingType;
1264
+ }
1265
+ /**
1266
+ * Read the security allows from local state.
1267
+ * Returns empty state if no file exists.
1268
+ */
1269
+ declare function readSecurityAllows(): Promise<SecurityAllowsState>;
1270
+ /**
1271
+ * Write security allows to local state.
1272
+ */
1273
+ declare function writeSecurityAllows(state: SecurityAllowsState): Promise<void>;
1274
+ /**
1275
+ * Add an allow for a specific capability and finding type.
1276
+ */
1277
+ declare function addSecurityAllow(capabilityId: string, findingType: FindingType): Promise<boolean>;
1278
+ /**
1279
+ * Remove an allow for a specific capability and finding type.
1280
+ */
1281
+ declare function removeSecurityAllow(capabilityId: string, findingType: FindingType): Promise<boolean>;
1282
+ /**
1283
+ * Check if a finding type is allowed for a capability.
1284
+ */
1285
+ declare function isSecurityAllowed(capabilityId: string, findingType: FindingType): Promise<boolean>;
1286
+ /**
1287
+ * Get all allows for a capability.
1288
+ */
1289
+ declare function getCapabilityAllows(capabilityId: string): Promise<FindingType[]>;
1290
+ /**
1291
+ * Get all security allows as a flat list.
1292
+ */
1293
+ declare function getAllSecurityAllows(): Promise<SecurityAllow[]>;
1294
+ /**
1295
+ * Clear all allows for a capability.
1296
+ */
1297
+ declare function clearCapabilityAllows(capabilityId: string): Promise<boolean>;
1298
+ /**
1299
+ * Clear all security allows.
1300
+ */
1301
+ declare function clearAllSecurityAllows(): Promise<void>;
1134
1302
  interface SyncResult {
1135
1303
  capabilities: string[];
1136
1304
  skillCount: number;
@@ -1143,8 +1311,8 @@ interface SyncOptions {
1143
1311
  adapters?: ProviderAdapter[];
1144
1312
  }
1145
1313
  /**
1146
- * Install dependencies for capabilities in .omni/capabilities/
1147
- * Only installs for capabilities that have a package.json
1314
+ * Install dependencies and build TypeScript capabilities in .omni/capabilities/
1315
+ * Only processes capabilities that have a package.json
1148
1316
  */
1149
1317
  declare function installCapabilityDependencies(silent: boolean): Promise<void>;
1150
1318
  /**
@@ -1164,6 +1332,21 @@ declare function buildSyncBundle(options?: {
1164
1332
  */
1165
1333
  declare function syncAgentConfiguration(options?: SyncOptions): Promise<SyncResult>;
1166
1334
  /**
1335
+ * Scan a single capability directory
1336
+ */
1337
+ declare function scanCapability(capabilityId: string, capabilityPath: string, settings?: ScanSettings): Promise<ScanResult>;
1338
+ /**
1339
+ * Scan multiple capabilities and produce a summary
1340
+ */
1341
+ declare function scanCapabilities(capabilities: Array<{
1342
+ id: string;
1343
+ path: string;
1344
+ }>, config?: SecurityConfig): Promise<ScanSummary>;
1345
+ /**
1346
+ * Format scan results for console output
1347
+ */
1348
+ declare function formatScanResults(summary: ScanSummary, verbose?: boolean): string;
1349
+ /**
1167
1350
  * Template for AGENTS.md (Codex provider)
1168
1351
  * Creates a minimal file - actual content is generated during sync from OMNI.md + instructions
1169
1352
  */
@@ -1214,4 +1397,4 @@ declare function generateOmniMdTemplate(): string;
1214
1397
  declare function debug(message: string, data?: unknown): void;
1215
1398
  declare const version = "0.1.0";
1216
1399
  declare function getVersion(): string;
1217
- export { writeProviderConfig, writeMcpJson, writeEnabledProviders, writeConfig, writeActiveProfileState, version, validateHooksConfig, validateHook, 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, loadDocs, loadConfig, loadCommands, loadCapabilityHooks, loadCapabilityConfig, loadCapability, loadBaseConfig, isValidMatcherPattern, 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, 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 };
1400
+ export { writeSecurityAllows, writeProviderConfig, writeMcpJson, writeEnabledProviders, writeConfig, writeActiveProfileState, version, validateHooksConfig, validateHook, transformToOmnidev, transformToClaude, transformHooksConfig, syncMcpJson, syncAgentConfiguration, sourceToGitUrl, setProfile, setActiveProfile, scanCapability, scanCapabilities, saveManifest, saveLockFile, resolveEnabledCapabilities, removeSecurityAllow, readSecurityAllows, readMcpJson, readEnabledProviders, readCapabilityIdFromPath, readActiveProfileState, patchAddToProfile, patchAddMcp, patchAddCapabilitySource, parseSourceConfig, parseProviderFlag, parseOmniConfig, parseFileSourcePath, parseCapabilityConfig, mergeHooksConfigs, mergeAndDeduplicateHooks, loadSubagents, loadSkills, loadRules, loadProviderConfig, loadProfileConfig, loadManifest, loadLockFile, loadHooksFromCapability, loadDocs, loadConfig, loadCommands, loadCapabilityHooks, loadCapabilityConfig, loadCapability, loadBaseConfig, isValidMatcherPattern, isSecurityAllowed, isProviderEnabled, isPromptHookEvent, isMatcherEvent, isHookType, isHookPrompt, isHookEvent, isHookCommand, isGitSource, isFileSourceConfig, isFileSource, installCapabilityDependencies, hasHooks, hasAnyHooks, getVersion, getSourceCapabilityPath, getLockFilePath, getHooksDirectory, getHooksConfigPath, getEventsWithHooks, getEnabledCapabilities, getCapabilityAllows, getAllSecurityAllows, getActiveProviders, getActiveProfile, generateSkillTemplate, generateRuleTemplate, generateOmniMdTemplate, generateHooksTemplate, generateHookScript, generateClaudeTemplate, generateCapabilityToml, generateAgentsTemplate, formatScanResults, findDuplicateCommands, fetchCapabilitySource, fetchAllCapabilitySources, enableProvider, enableCapability, discoverCapabilities, disableProvider, disableCapability, debug, createEmptyValidationResult, createEmptyHooksConfig, countHooks, containsOmnidevVariables, containsClaudeVariables, clearCapabilityAllows, clearAllSecurityAllows, clearActiveProfileState, cleanupStaleResources, checkForUpdates, buildSyncBundle, buildRouteMap, buildManifestFromCapabilities, buildCommand, buildCapabilityRegistry, addSecurityAllow, VersionSource, ValidationSeverity, VARIABLE_MAPPINGS, SyncResult, SyncOptions, SyncConfig, SyncBundle, SubagentPermissionMode, SubagentModel, SubagentHooks, SubagentHookConfig, SubagentExport, Subagent, SourceUpdateInfo, SkillExport, Skill, SessionStartMatcher, SecurityMode, SecurityFinding, SecurityConfig, SecurityAllowsState, SecurityAllow, ScanSummary, ScanSettings, ScanResult, 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, FindingType, FindingSeverity, FileContent, FileCapabilitySourceConfig, FetchResult, DoctorCheckStatus, DocExport, Doc, DiscoveredContent, DeduplicateOptions, DEFAULT_SECURITY_CONFIG, DEFAULT_SCAN_SETTINGS, 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 };