@cleocode/caamp 0.4.0 → 0.4.1

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
@@ -34,7 +34,7 @@ type TransportType = "stdio" | "sse" | "http";
34
34
  *
35
35
  * - `"binary"` - Check if a CLI binary exists on PATH
36
36
  * - `"directory"` - Check if known config/data directories exist
37
- * - `"appBundle"` - Check for macOS .app bundle in /Applications
37
+ * - `"appBundle"` - Check for macOS .app bundle in standard app directories
38
38
  * - `"flatpak"` - Check for Flatpak installation on Linux
39
39
  */
40
40
  type DetectionMethod = "binary" | "directory" | "appBundle" | "flatpak";
@@ -245,10 +245,13 @@ interface SkillMetadata {
245
245
  *
246
246
  * @example
247
247
  * ```typescript
248
+ * import { getCanonicalSkillsDir } from "./core/paths/standard.js";
249
+ * import { join } from "node:path";
250
+ *
248
251
  * const entry: SkillEntry = {
249
252
  * name: "my-skill",
250
253
  * scopedName: "my-skill",
251
- * path: "/home/user/.agents/skills/my-skill",
254
+ * path: join(getCanonicalSkillsDir(), "my-skill"),
252
255
  * metadata: { name: "my-skill", description: "A skill" },
253
256
  * };
254
257
  * ```
@@ -270,6 +273,9 @@ interface SkillEntry {
270
273
  *
271
274
  * @example
272
275
  * ```typescript
276
+ * import { getCanonicalSkillsDir } from "./core/paths/standard.js";
277
+ * import { join } from "node:path";
278
+ *
273
279
  * const entry: LockEntry = {
274
280
  * name: "my-skill",
275
281
  * scopedName: "my-skill",
@@ -277,7 +283,7 @@ interface SkillEntry {
277
283
  * sourceType: "github",
278
284
  * installedAt: "2025-01-15T10:30:00.000Z",
279
285
  * agents: ["claude-code", "cursor"],
280
- * canonicalPath: "/home/user/.agents/skills/my-skill",
286
+ * canonicalPath: join(getCanonicalSkillsDir(), "my-skill"),
281
287
  * isGlobal: true,
282
288
  * };
283
289
  * ```
@@ -307,7 +313,7 @@ interface LockEntry {
307
313
  projectDir?: string;
308
314
  }
309
315
  /**
310
- * The CAAMP lock file structure, stored at `~/.agents/.caamp-lock.json`.
316
+ * The CAAMP lock file structure, stored at the resolved canonical lock path.
311
317
  *
312
318
  * Tracks all installed skills and MCP servers along with their sources,
313
319
  * versions, and linked agents.
@@ -532,7 +538,7 @@ interface InjectionCheckResult {
532
538
  * providerId: "claude-code",
533
539
  * providerName: "Claude Code",
534
540
  * scope: "project",
535
- * configPath: "/project/.claude/settings.json",
541
+ * configPath: "/project/<provider-project-config>",
536
542
  * config: { command: "npx", args: ["-y", "@mcp/server-filesystem"] },
537
543
  * };
538
544
  * ```
@@ -610,6 +616,10 @@ interface DetectionResult {
610
616
  /** Whether the provider has project-level config in the current directory. */
611
617
  projectDetected: boolean;
612
618
  }
619
+ interface DetectionCacheOptions {
620
+ forceRefresh?: boolean;
621
+ ttlMs?: number;
622
+ }
613
623
  /**
614
624
  * Detect if a single provider is installed on the system.
615
625
  *
@@ -643,7 +653,7 @@ declare function detectProvider(provider: Provider): DetectionResult;
643
653
  * console.log(`${installed.length} agents detected`);
644
654
  * ```
645
655
  */
646
- declare function detectAllProviders(): DetectionResult[];
656
+ declare function detectAllProviders(options?: DetectionCacheOptions): DetectionResult[];
647
657
  /**
648
658
  * Get only providers that are currently installed on the system.
649
659
  *
@@ -658,7 +668,7 @@ declare function detectAllProviders(): DetectionResult[];
658
668
  * console.log(installed.map(p => p.toolName).join(", "));
659
669
  * ```
660
670
  */
661
- declare function getInstalledProviders(): Provider[];
671
+ declare function getInstalledProviders(options?: DetectionCacheOptions): Provider[];
662
672
  /**
663
673
  * Detect all providers and enrich results with project-level presence.
664
674
  *
@@ -678,7 +688,8 @@ declare function getInstalledProviders(): Provider[];
678
688
  * }
679
689
  * ```
680
690
  */
681
- declare function detectProjectProviders(projectDir: string): DetectionResult[];
691
+ declare function detectProjectProviders(projectDir: string, options?: DetectionCacheOptions): DetectionResult[];
692
+ declare function resetDetectionCache(): void;
682
693
 
683
694
  /**
684
695
  * MCP config installer
@@ -814,7 +825,7 @@ interface SkillInstallResult {
814
825
  /**
815
826
  * Install a skill from a local path to the canonical location and link to agents.
816
827
  *
817
- * Copies the skill directory to `~/.agents/skills/<name>/` and creates symlinks
828
+ * Copies the skill directory to the canonical skills directory and creates symlinks
818
829
  * (or copies on Windows) from each provider's skills directory to the canonical path.
819
830
  *
820
831
  * @param sourcePath - Local path to the skill directory to install
@@ -834,7 +845,7 @@ declare function installSkill(sourcePath: string, skillName: string, providers:
834
845
  * Remove a skill from the canonical location and all agent symlinks.
835
846
  *
836
847
  * Removes symlinks from each provider's skills directory and then removes the
837
- * canonical copy from `~/.agents/skills/<name>/`.
848
+ * canonical copy from the centralized canonical skills directory.
838
849
  *
839
850
  * @param skillName - Name of the skill to remove
840
851
  * @param providers - Providers to unlink the skill from
@@ -852,7 +863,7 @@ declare function removeSkill(skillName: string, providers: Provider[], isGlobal:
852
863
  errors: string[];
853
864
  }>;
854
865
  /**
855
- * List all skills installed in the canonical directory (`~/.agents/skills/`).
866
+ * List all skills installed in the canonical skills directory.
856
867
  *
857
868
  * Returns the directory names of all skills, which correspond to skill names.
858
869
  *
@@ -1315,6 +1326,21 @@ declare function getProviderCount(): number;
1315
1326
  */
1316
1327
  declare function getRegistryVersion(): string;
1317
1328
 
1329
+ interface PlatformLocations {
1330
+ home: string;
1331
+ config: string;
1332
+ vscodeConfig: string;
1333
+ zedConfig: string;
1334
+ claudeDesktopConfig: string;
1335
+ applications: string[];
1336
+ }
1337
+ declare function getPlatformLocations(): PlatformLocations;
1338
+ declare function getAgentsHome(): string;
1339
+ declare function getProjectAgentsDir(projectRoot?: string): string;
1340
+ declare function getCanonicalSkillsDir(): string;
1341
+ declare function getLockFilePath(): string;
1342
+ declare function resolveRegistryTemplatePath(template: string): string;
1343
+
1318
1344
  /**
1319
1345
  * Source URL/path classifier
1320
1346
  *
@@ -1395,7 +1421,10 @@ declare function parseSkillFile(filePath: string): Promise<SkillMetadata | null>
1395
1421
  *
1396
1422
  * @example
1397
1423
  * ```typescript
1398
- * const skill = await discoverSkill("/home/user/.agents/skills/my-skill");
1424
+ * import { getCanonicalSkillsDir } from "../paths/standard.js";
1425
+ * import { join } from "node:path";
1426
+ *
1427
+ * const skill = await discoverSkill(join(getCanonicalSkillsDir(), "my-skill"));
1399
1428
  * if (skill) {
1400
1429
  * console.log(`Found: ${skill.name}`);
1401
1430
  * }
@@ -1413,7 +1442,9 @@ declare function discoverSkill(skillDir: string): Promise<SkillEntry | null>;
1413
1442
  *
1414
1443
  * @example
1415
1444
  * ```typescript
1416
- * const skills = await discoverSkills("/home/user/.agents/skills");
1445
+ * import { getCanonicalSkillsDir } from "../paths/standard.js";
1446
+ *
1447
+ * const skills = await discoverSkills(getCanonicalSkillsDir());
1417
1448
  * console.log(`Found ${skills.length} skills`);
1418
1449
  * ```
1419
1450
  */
@@ -1467,7 +1498,9 @@ declare function scanFile(filePath: string, rules?: AuditRule[]): Promise<AuditR
1467
1498
  *
1468
1499
  * @example
1469
1500
  * ```typescript
1470
- * const results = await scanDirectory("/home/user/.agents/skills");
1501
+ * import { getCanonicalSkillsDir } from "../../paths/standard.js";
1502
+ *
1503
+ * const results = await scanDirectory(getCanonicalSkillsDir());
1471
1504
  * const failing = results.filter(r => !r.passed);
1472
1505
  * ```
1473
1506
  */
@@ -1538,7 +1571,7 @@ declare function getTransform(providerId: string): ((name: string, config: McpSe
1538
1571
  * @example
1539
1572
  * ```typescript
1540
1573
  * const path = resolveConfigPath(provider, "project", "/home/user/my-project");
1541
- * // "/home/user/my-project/.claude/settings.json"
1574
+ * // Returns provider-specific project config path
1542
1575
  * ```
1543
1576
  */
1544
1577
  declare function resolveConfigPath(provider: Provider, scope: "project" | "global", projectDir?: string): string | null;
@@ -1598,7 +1631,7 @@ declare function removeMcpServer(provider: Provider, serverName: string, scope:
1598
1631
  /**
1599
1632
  * Shared lock file utilities
1600
1633
  *
1601
- * Single source of truth for reading/writing ~/.agents/.caamp-lock.json.
1634
+ * Single source of truth for reading/writing the canonical CAAMP lock file path.
1602
1635
  * Both MCP and skills lock modules import from here.
1603
1636
  */
1604
1637
 
@@ -1609,7 +1642,7 @@ declare function readLockFile(): Promise<CaampLockFile>;
1609
1642
  * MCP lock file management
1610
1643
  *
1611
1644
  * Tracks installed MCP servers with source and agent metadata.
1612
- * Stored at ~/.agents/.caamp-lock.json (shared with skills lock).
1645
+ * Stored in the canonical CAAMP lock file (shared with skills lock).
1613
1646
  */
1614
1647
 
1615
1648
  /**
@@ -1685,7 +1718,7 @@ declare function getLastSelectedAgents(): Promise<string[] | undefined>;
1685
1718
  /**
1686
1719
  * Skills lock file management
1687
1720
  *
1688
- * Shares the same lock file as MCP (~/.agents/.caamp-lock.json).
1721
+ * Shares the same canonical lock file as MCP.
1689
1722
  */
1690
1723
 
1691
1724
  /**
@@ -1706,9 +1739,12 @@ declare function getLastSelectedAgents(): Promise<string[] | undefined>;
1706
1739
  *
1707
1740
  * @example
1708
1741
  * ```typescript
1742
+ * import { getCanonicalSkillsDir } from "../paths/standard.js";
1743
+ * import { join } from "node:path";
1744
+ *
1709
1745
  * await recordSkillInstall(
1710
1746
  * "my-skill", "my-skill", "owner/repo", "github",
1711
- * ["claude-code"], "/home/user/.agents/skills/my-skill", true,
1747
+ * ["claude-code"], join(getCanonicalSkillsDir(), "my-skill"), true,
1712
1748
  * );
1713
1749
  * ```
1714
1750
  */
@@ -2147,4 +2183,4 @@ declare function isVerbose(): boolean;
2147
2183
  */
2148
2184
  declare function isQuiet(): boolean;
2149
2185
 
2150
- export { type AuditFinding, type AuditResult, type AuditRule, type AuditSeverity, type BatchInstallOptions, type BatchInstallResult, type CaampLockFile, type ConfigFormat, type ConflictPolicy, type DetectionResult, type DualScopeConfigureOptions, type DualScopeConfigureResult, type GlobalOptions, type InjectionCheckResult, type InjectionStatus, type InstallResult, type InstructionUpdateSummary, type LockEntry, MarketplaceClient, type MarketplaceResult, type MarketplaceSearchResult, type MarketplaceSkill, type McpBatchOperation, type McpConflict, type McpConflictCode, type McpPlanApplyResult, type McpServerConfig, type McpServerEntry, type NormalizedRecommendationCriteria, type ParsedSource, type Provider, type ProviderPriority, type ProviderStatus, RECOMMENDATION_ERROR_CODES, type RankedSkillRecommendation, type RecommendSkillsResult, type RecommendationCriteriaInput, type RecommendationErrorCode, type RecommendationOptions, type RecommendationReason, type RecommendationReasonCode, type RecommendationScoreBreakdown, type RecommendationValidationIssue, type RecommendationValidationResult, type RecommendationWeights, type SkillBatchOperation, type SkillEntry, type SkillInstallResult, type SkillMetadata, type SourceType, type TransportType, type ValidationIssue, type ValidationResult, applyMcpInstallWithPolicy, buildServerConfig, checkAllInjections, checkInjection, checkSkillUpdate, configureProviderGlobalAndProject, deepMerge, detectAllProviders, detectMcpConfigConflicts, detectProjectProviders, detectProvider, discoverSkill, discoverSkills, ensureDir, formatSkillRecommendations, generateInjectionContent, getAllProviders, getInstalledProviders, getInstructionFiles, getLastSelectedAgents, getNestedValue, getProvider, getProviderCount, getProvidersByInstructFile, getProvidersByPriority, getProvidersByStatus, getRegistryVersion, getTrackedMcpServers, getTrackedSkills, getTransform, groupByInstructFile, inject, injectAll, installBatchWithRollback, installMcpServer, installMcpServerToAll, installSkill, isMarketplaceScoped, isQuiet, isVerbose, listAllMcpServers, listCanonicalSkills, listMcpServers, normalizeRecommendationCriteria, parseSkillFile, parseSource, rankSkills, readConfig, readLockFile, recommendSkills, recordMcpInstall, recordSkillInstall, removeConfig, removeInjection, removeMcpFromLock, removeMcpServer, removeSkill, removeSkillFromLock, resolveAlias, resolveConfigPath, saveLastSelectedAgents, scanDirectory, scanFile, scoreSkillRecommendation, searchSkills, selectProvidersByMinimumPriority, setQuiet, setVerbose, toSarif, tokenizeCriteriaValue, updateInstructionsSingleOperation, validateRecommendationCriteria, validateSkill, writeConfig };
2186
+ export { type AuditFinding, type AuditResult, type AuditRule, type AuditSeverity, type BatchInstallOptions, type BatchInstallResult, type CaampLockFile, type ConfigFormat, type ConflictPolicy, type DetectionCacheOptions, type DetectionResult, type DualScopeConfigureOptions, type DualScopeConfigureResult, type GlobalOptions, type InjectionCheckResult, type InjectionStatus, type InstallResult, type InstructionUpdateSummary, type LockEntry, MarketplaceClient, type MarketplaceResult, type MarketplaceSearchResult, type MarketplaceSkill, type McpBatchOperation, type McpConflict, type McpConflictCode, type McpPlanApplyResult, type McpServerConfig, type McpServerEntry, type NormalizedRecommendationCriteria, type ParsedSource, type Provider, type ProviderPriority, type ProviderStatus, RECOMMENDATION_ERROR_CODES, type RankedSkillRecommendation, type RecommendSkillsResult, type RecommendationCriteriaInput, type RecommendationErrorCode, type RecommendationOptions, type RecommendationReason, type RecommendationReasonCode, type RecommendationScoreBreakdown, type RecommendationValidationIssue, type RecommendationValidationResult, type RecommendationWeights, type SkillBatchOperation, type SkillEntry, type SkillInstallResult, type SkillMetadata, type SourceType, type TransportType, type ValidationIssue, type ValidationResult, applyMcpInstallWithPolicy, buildServerConfig, checkAllInjections, checkInjection, checkSkillUpdate, configureProviderGlobalAndProject, deepMerge, detectAllProviders, detectMcpConfigConflicts, detectProjectProviders, detectProvider, discoverSkill, discoverSkills, ensureDir, formatSkillRecommendations, generateInjectionContent, getAgentsHome, getAllProviders, getCanonicalSkillsDir, getInstalledProviders, getInstructionFiles, getLastSelectedAgents, getLockFilePath, getNestedValue, getPlatformLocations, getProjectAgentsDir, getProvider, getProviderCount, getProvidersByInstructFile, getProvidersByPriority, getProvidersByStatus, getRegistryVersion, getTrackedMcpServers, getTrackedSkills, getTransform, groupByInstructFile, inject, injectAll, installBatchWithRollback, installMcpServer, installMcpServerToAll, installSkill, isMarketplaceScoped, isQuiet, isVerbose, listAllMcpServers, listCanonicalSkills, listMcpServers, normalizeRecommendationCriteria, parseSkillFile, parseSource, rankSkills, readConfig, readLockFile, recommendSkills, recordMcpInstall, recordSkillInstall, removeConfig, removeInjection, removeMcpFromLock, removeMcpServer, removeSkill, removeSkillFromLock, resetDetectionCache, resolveAlias, resolveConfigPath, resolveRegistryTemplatePath, saveLastSelectedAgents, scanDirectory, scanFile, scoreSkillRecommendation, searchSkills, selectProvidersByMinimumPriority, setQuiet, setVerbose, toSarif, tokenizeCriteriaValue, updateInstructionsSingleOperation, validateRecommendationCriteria, validateSkill, writeConfig };
package/dist/index.js CHANGED
@@ -17,11 +17,16 @@ import {
17
17
  ensureDir,
18
18
  formatSkillRecommendations,
19
19
  generateInjectionContent,
20
+ getAgentsHome,
20
21
  getAllProviders,
22
+ getCanonicalSkillsDir,
21
23
  getInstalledProviders,
22
24
  getInstructionFiles,
23
25
  getLastSelectedAgents,
26
+ getLockFilePath,
24
27
  getNestedValue,
28
+ getPlatformLocations,
29
+ getProjectAgentsDir,
25
30
  getProvider,
26
31
  getProviderCount,
27
32
  getProvidersByInstructFile,
@@ -59,8 +64,10 @@ import {
59
64
  removeMcpServer,
60
65
  removeSkill,
61
66
  removeSkillFromLock,
67
+ resetDetectionCache,
62
68
  resolveAlias,
63
69
  resolveConfigPath,
70
+ resolveRegistryTemplatePath,
64
71
  saveLastSelectedAgents,
65
72
  scanDirectory,
66
73
  scanFile,
@@ -75,7 +82,7 @@ import {
75
82
  validateRecommendationCriteria,
76
83
  validateSkill,
77
84
  writeConfig
78
- } from "./chunk-ZYINKJDE.js";
85
+ } from "./chunk-6HQDRJLS.js";
79
86
  export {
80
87
  MarketplaceClient,
81
88
  RECOMMENDATION_ERROR_CODES,
@@ -95,11 +102,16 @@ export {
95
102
  ensureDir,
96
103
  formatSkillRecommendations,
97
104
  generateInjectionContent,
105
+ getAgentsHome,
98
106
  getAllProviders,
107
+ getCanonicalSkillsDir,
99
108
  getInstalledProviders,
100
109
  getInstructionFiles,
101
110
  getLastSelectedAgents,
111
+ getLockFilePath,
102
112
  getNestedValue,
113
+ getPlatformLocations,
114
+ getProjectAgentsDir,
103
115
  getProvider,
104
116
  getProviderCount,
105
117
  getProvidersByInstructFile,
@@ -137,8 +149,10 @@ export {
137
149
  removeMcpServer,
138
150
  removeSkill,
139
151
  removeSkillFromLock,
152
+ resetDetectionCache,
140
153
  resolveAlias,
141
154
  resolveConfigPath,
155
+ resolveRegistryTemplatePath,
142
156
  saveLastSelectedAgents,
143
157
  scanDirectory,
144
158
  scanFile,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/caamp",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Central AI Agent Managed Packages - unified provider registry and package manager for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,9 +24,11 @@
24
24
  "build": "tsup",
25
25
  "dev": "tsx src/cli.ts",
26
26
  "test": "vitest run",
27
+ "test:coverage": "vitest run --coverage",
27
28
  "test:watch": "vitest",
28
29
  "typecheck": "tsc --noEmit",
29
- "lint": "tsc --noEmit",
30
+ "lint": "biome lint src tests",
31
+ "lint:fix": "biome lint --write src tests",
30
32
  "docs:api": "typedoc",
31
33
  "docs:api:check": "typedoc --emit none",
32
34
  "prepublishOnly": "npm run build"
@@ -46,7 +48,6 @@
46
48
  "author": "",
47
49
  "license": "MIT",
48
50
  "dependencies": {
49
- "@clack/prompts": "^1.0.0",
50
51
  "@cleocode/lafs-protocol": "^0.1.1",
51
52
  "@iarna/toml": "^2.2.5",
52
53
  "commander": "^14.0.0",
@@ -57,8 +58,10 @@
57
58
  "simple-git": "^3.30.0"
58
59
  },
59
60
  "devDependencies": {
61
+ "@biomejs/biome": "^2.3.14",
60
62
  "@types/js-yaml": "^4.0.9",
61
63
  "@types/node": "^22.0.0",
64
+ "@vitest/coverage-v8": "^3.2.4",
62
65
  "tsup": "^8.5.0",
63
66
  "tsx": "^4.21.0",
64
67
  "typedoc": "^0.28.16",