@slats/claude-assets-sync 0.1.4 → 0.3.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/README.md +89 -581
- package/bin/inject-claude-settings.mjs +4 -0
- package/dist/claude-hashes.json +20 -0
- package/dist/commands/index.d.ts +1 -112
- package/dist/commands/runCli/index.d.ts +2 -0
- package/dist/commands/runCli/runCli.cjs +53 -0
- package/dist/commands/runCli/runCli.d.ts +14 -0
- package/dist/commands/runCli/runCli.mjs +51 -0
- package/dist/commands/runCli/type.d.ts +19 -0
- package/dist/commands/runCli/utils/classifyTarget.cjs +48 -0
- package/dist/commands/runCli/utils/classifyTarget.d.ts +19 -0
- package/dist/commands/runCli/utils/classifyTarget.mjs +46 -0
- package/dist/commands/runCli/utils/injectOne.cjs +47 -0
- package/dist/commands/runCli/utils/injectOne.d.ts +3 -0
- package/dist/commands/runCli/utils/injectOne.mjs +45 -0
- package/dist/commands/runCli/utils/resolvePackage.cjs +77 -0
- package/dist/commands/runCli/utils/resolvePackage.d.ts +16 -0
- package/dist/commands/runCli/utils/resolvePackage.mjs +74 -0
- package/dist/commands/runCli/utils/resolveScopeAlias.cjs +69 -0
- package/dist/commands/runCli/utils/resolveScopeAlias.d.ts +2 -0
- package/dist/commands/runCli/utils/resolveScopeAlias.mjs +67 -0
- package/dist/commands/runCli/utils/resolveScopeFlag.cjs +28 -0
- package/dist/commands/runCli/utils/resolveScopeFlag.d.ts +2 -0
- package/dist/commands/runCli/utils/resolveScopeFlag.mjs +26 -0
- package/dist/commands/runCli/utils/resolveTargets.cjs +40 -0
- package/dist/commands/runCli/utils/resolveTargets.d.ts +15 -0
- package/dist/commands/runCli/utils/resolveTargets.mjs +38 -0
- package/dist/commands/runCli/utils/runInject.cjs +52 -0
- package/dist/commands/runCli/utils/runInject.d.ts +3 -0
- package/dist/commands/runCli/utils/runInject.mjs +50 -0
- package/dist/core/buildPlan/buildPlan.cjs +42 -0
- package/dist/core/buildPlan/buildPlan.d.ts +2 -0
- package/dist/core/buildPlan/buildPlan.mjs +40 -0
- package/dist/core/buildPlan/index.d.ts +2 -0
- package/dist/core/buildPlan/type.d.ts +32 -0
- package/dist/core/buildPlan/utils/toPosix.cjs +9 -0
- package/dist/core/buildPlan/utils/toPosix.d.ts +1 -0
- package/dist/core/buildPlan/utils/toPosix.mjs +7 -0
- package/dist/core/buildPlan/utils/walkFiles.cjs +25 -0
- package/dist/core/buildPlan/utils/walkFiles.d.ts +1 -0
- package/dist/core/buildPlan/utils/walkFiles.mjs +23 -0
- package/dist/core/hash/hash.cjs +30 -0
- package/dist/core/hash/hash.d.ts +4 -0
- package/dist/core/hash/hash.mjs +26 -0
- package/dist/core/hash/index.d.ts +1 -0
- package/dist/core/hashManifest/hashManifest.cjs +27 -0
- package/dist/core/hashManifest/hashManifest.d.ts +17 -0
- package/dist/core/hashManifest/hashManifest.mjs +23 -0
- package/dist/core/hashManifest/index.d.ts +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/injectDocs/index.d.ts +2 -0
- package/dist/core/injectDocs/injectDocs.cjs +43 -0
- package/dist/core/injectDocs/injectDocs.d.ts +2 -0
- package/dist/core/injectDocs/injectDocs.mjs +41 -0
- package/dist/core/injectDocs/type.d.ts +30 -0
- package/dist/core/injectDocs/utils/applyAction.cjs +21 -0
- package/dist/core/injectDocs/utils/applyAction.d.ts +2 -0
- package/dist/core/injectDocs/utils/applyAction.mjs +19 -0
- package/dist/core/injectDocs/utils/emitCiForceList.cjs +10 -0
- package/dist/core/injectDocs/utils/emitCiForceList.d.ts +2 -0
- package/dist/core/injectDocs/utils/emitCiForceList.mjs +8 -0
- package/dist/core/injectDocs/utils/printPlan.cjs +20 -0
- package/dist/core/injectDocs/utils/printPlan.d.ts +2 -0
- package/dist/core/injectDocs/utils/printPlan.mjs +18 -0
- package/dist/core/injectDocs/utils/summarize.cjs +27 -0
- package/dist/core/injectDocs/utils/summarize.d.ts +3 -0
- package/dist/core/injectDocs/utils/summarize.mjs +25 -0
- package/dist/core/scope/index.d.ts +1 -0
- package/dist/core/scope/scope.cjs +46 -0
- package/dist/core/scope/scope.d.ts +16 -0
- package/dist/core/scope/scope.mjs +41 -0
- package/dist/core/scope/utils/isDirectory.cjs +14 -0
- package/dist/core/scope/utils/isDirectory.d.ts +1 -0
- package/dist/core/scope/utils/isDirectory.mjs +12 -0
- package/dist/index.cjs +15 -9
- package/dist/index.d.ts +3 -5
- package/dist/index.mjs +7 -3
- package/dist/prompts/confirmForce.cjs +27 -0
- package/dist/prompts/confirmForce.d.ts +1 -0
- package/dist/prompts/confirmForce.mjs +25 -0
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/selectScope.cjs +30 -0
- package/dist/prompts/selectScope.d.ts +2 -0
- package/dist/prompts/selectScope.mjs +28 -0
- package/dist/utils/heartbeat.cjs +25 -0
- package/dist/utils/heartbeat.d.ts +16 -0
- package/dist/utils/heartbeat.mjs +23 -0
- package/dist/utils/logger.cjs +7 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.mjs +7 -0
- package/dist/utils/types.d.ts +1 -252
- package/dist/utils/version.cjs +2 -14
- package/dist/utils/version.d.ts +3 -53
- package/dist/utils/version.mjs +2 -13
- package/docs/bundle-size-decision.md +36 -0
- package/docs/claude/skills/claude-docs-asset-wiring/SKILL.md +159 -0
- package/docs/claude/skills/claude-docs-asset-wiring/knowledge/claude-md-template.md +86 -0
- package/docs/claude/skills/claude-docs-asset-wiring/knowledge/dependency-cruiser.md +54 -0
- package/docs/claude/skills/claude-docs-asset-wiring/knowledge/gotchas.md +122 -0
- package/docs/claude/skills/claude-docs-asset-wiring/knowledge/package-json-patches.md +145 -0
- package/docs/claude/skills/claude-docs-asset-wiring/knowledge/reference-files.md +37 -0
- package/docs/claude/skills/claude-docs-asset-wiring/knowledge/smoke-tests.md +111 -0
- package/docs/consumer-integration.md +94 -0
- package/package.json +24 -16
- package/scripts/build-hashes.mjs +30 -0
- package/scripts/buildHashes.d.mts +15 -0
- package/scripts/buildHashes.mjs +82 -0
- package/scripts/claude-build-hashes.mjs +42 -0
- package/scripts/inject-version.js +112 -0
- package/dist/cli.cjs +0 -8
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -7
- package/dist/commands/add.cjs +0 -80
- package/dist/commands/add.d.ts +0 -8
- package/dist/commands/add.mjs +0 -78
- package/dist/commands/list.cjs +0 -94
- package/dist/commands/list.d.ts +0 -15
- package/dist/commands/list.mjs +0 -91
- package/dist/commands/migrate.cjs +0 -9
- package/dist/commands/migrate.d.ts +0 -6
- package/dist/commands/migrate.mjs +0 -7
- package/dist/commands/remove.cjs +0 -127
- package/dist/commands/remove.d.ts +0 -6
- package/dist/commands/remove.mjs +0 -105
- package/dist/commands/status.cjs +0 -193
- package/dist/commands/status.d.ts +0 -6
- package/dist/commands/status.mjs +0 -171
- package/dist/commands/sync.cjs +0 -28
- package/dist/commands/sync.d.ts +0 -6
- package/dist/commands/sync.mjs +0 -26
- package/dist/commands/types.d.ts +0 -89
- package/dist/commands/update.cjs +0 -209
- package/dist/commands/update.d.ts +0 -29
- package/dist/commands/update.mjs +0 -206
- package/dist/components/add/AddCommand.cjs +0 -103
- package/dist/components/add/AddCommand.d.ts +0 -14
- package/dist/components/add/AddCommand.mjs +0 -101
- package/dist/components/add/BulkAddView.cjs +0 -165
- package/dist/components/add/BulkAddView.d.ts +0 -11
- package/dist/components/add/BulkAddView.mjs +0 -163
- package/dist/components/add/index.d.ts +0 -2
- package/dist/components/index.d.ts +0 -2
- package/dist/components/list/EditableTreeItem.d.ts +0 -13
- package/dist/components/list/ListCommand.cjs +0 -651
- package/dist/components/list/ListCommand.d.ts +0 -5
- package/dist/components/list/ListCommand.mjs +0 -649
- package/dist/components/list/SyncedPackageTree.d.ts +0 -14
- package/dist/components/list/index.d.ts +0 -10
- package/dist/components/list/types.d.ts +0 -14
- package/dist/components/primitives/Box.d.ts +0 -4
- package/dist/components/primitives/Spinner.d.ts +0 -6
- package/dist/components/primitives/Text.d.ts +0 -4
- package/dist/components/primitives/index.d.ts +0 -3
- package/dist/components/remove/RemoveConfirm.cjs +0 -18
- package/dist/components/remove/RemoveConfirm.d.ts +0 -11
- package/dist/components/remove/RemoveConfirm.mjs +0 -16
- package/dist/components/shared/Confirm.cjs +0 -30
- package/dist/components/shared/Confirm.d.ts +0 -8
- package/dist/components/shared/Confirm.mjs +0 -28
- package/dist/components/shared/MenuItem.cjs +0 -18
- package/dist/components/shared/MenuItem.d.ts +0 -7
- package/dist/components/shared/MenuItem.mjs +0 -16
- package/dist/components/shared/ProgressBar.d.ts +0 -7
- package/dist/components/shared/StepRunner.cjs +0 -58
- package/dist/components/shared/StepRunner.d.ts +0 -15
- package/dist/components/shared/StepRunner.mjs +0 -56
- package/dist/components/shared/Table.cjs +0 -19
- package/dist/components/shared/Table.d.ts +0 -8
- package/dist/components/shared/Table.mjs +0 -17
- package/dist/components/shared/index.d.ts +0 -6
- package/dist/components/status/PackageStatusCard.d.ts +0 -10
- package/dist/components/status/StatusDisplay.cjs +0 -26
- package/dist/components/status/StatusDisplay.d.ts +0 -23
- package/dist/components/status/StatusDisplay.mjs +0 -24
- package/dist/components/status/StatusTreeNode.cjs +0 -40
- package/dist/components/status/StatusTreeNode.d.ts +0 -15
- package/dist/components/status/StatusTreeNode.mjs +0 -38
- package/dist/components/status/index.d.ts +0 -6
- package/dist/components/tree/AssetTreeNode.cjs +0 -54
- package/dist/components/tree/AssetTreeNode.d.ts +0 -12
- package/dist/components/tree/AssetTreeNode.mjs +0 -52
- package/dist/components/tree/TreeSelect.cjs +0 -129
- package/dist/components/tree/TreeSelect.d.ts +0 -12
- package/dist/components/tree/TreeSelect.mjs +0 -127
- package/dist/components/tree/index.d.ts +0 -4
- package/dist/core/assetStructure.cjs +0 -30
- package/dist/core/assetStructure.d.ts +0 -36
- package/dist/core/assetStructure.mjs +0 -27
- package/dist/core/cli.cjs +0 -106
- package/dist/core/cli.d.ts +0 -9
- package/dist/core/cli.mjs +0 -103
- package/dist/core/constants.cjs +0 -28
- package/dist/core/constants.d.ts +0 -94
- package/dist/core/constants.mjs +0 -21
- package/dist/core/filesystem.cjs +0 -98
- package/dist/core/filesystem.d.ts +0 -94
- package/dist/core/filesystem.mjs +0 -88
- package/dist/core/github.cjs +0 -115
- package/dist/core/github.d.ts +0 -61
- package/dist/core/github.mjs +0 -107
- package/dist/core/io.cjs +0 -46
- package/dist/core/io.d.ts +0 -40
- package/dist/core/io.mjs +0 -39
- package/dist/core/listOperations.cjs +0 -228
- package/dist/core/listOperations.d.ts +0 -43
- package/dist/core/listOperations.mjs +0 -205
- package/dist/core/localSource.cjs +0 -126
- package/dist/core/localSource.d.ts +0 -33
- package/dist/core/localSource.mjs +0 -120
- package/dist/core/migration.cjs +0 -201
- package/dist/core/migration.d.ts +0 -57
- package/dist/core/migration.mjs +0 -198
- package/dist/core/packageScanner.cjs +0 -360
- package/dist/core/packageScanner.d.ts +0 -22
- package/dist/core/packageScanner.mjs +0 -356
- package/dist/core/sync.cjs +0 -400
- package/dist/core/sync.d.ts +0 -21
- package/dist/core/sync.mjs +0 -397
- package/dist/core/syncMeta.cjs +0 -242
- package/dist/core/syncMeta.d.ts +0 -75
- package/dist/core/syncMeta.mjs +0 -229
- package/dist/utils/dependencies.cjs +0 -57
- package/dist/utils/dependencies.d.ts +0 -10
- package/dist/utils/dependencies.mjs +0 -34
- package/dist/utils/nameTransform.cjs +0 -13
- package/dist/utils/nameTransform.d.ts +0 -65
- package/dist/utils/nameTransform.mjs +0 -11
- package/dist/utils/package.cjs +0 -170
- package/dist/utils/package.d.ts +0 -105
- package/dist/utils/package.mjs +0 -157
- package/dist/utils/packageName.cjs +0 -24
- package/dist/utils/packageName.d.ts +0 -32
- package/dist/utils/packageName.mjs +0 -21
- package/dist/utils/paths.cjs +0 -18
- package/dist/utils/paths.d.ts +0 -55
- package/dist/utils/paths.mjs +0 -15
- package/dist/version.cjs +0 -5
- package/dist/version.d.ts +0 -5
- package/dist/version.mjs +0 -3
package/dist/utils/package.d.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { ClaudeConfig, GitHubRepoInfo, PackageInfo, WorkspaceInfo } from './types.js';
|
|
2
|
-
export { getAssetStructure } from '../core/assetStructure.js';
|
|
3
|
-
/**
|
|
4
|
-
* Resolve package path in node_modules by walking up the directory tree.
|
|
5
|
-
* Mimics Node.js module resolution: checks cwd/node_modules, then ../node_modules, etc.
|
|
6
|
-
*
|
|
7
|
-
* @param packageName - Package name (e.g., "@canard/schema-form")
|
|
8
|
-
* @param cwd - Starting directory for resolution
|
|
9
|
-
* @returns Absolute path to the package directory, or null if not found
|
|
10
|
-
*/
|
|
11
|
-
export declare const resolvePackagePath: (packageName: string, cwd: string) => string | null;
|
|
12
|
-
/**
|
|
13
|
-
* Read package.json from node_modules
|
|
14
|
-
* @param packageName - Package name (e.g., "@canard/schema-form")
|
|
15
|
-
* @param cwd - Current working directory
|
|
16
|
-
* @returns PackageInfo or null if not found
|
|
17
|
-
*/
|
|
18
|
-
export declare const readPackageJson: (packageName: string, cwd?: string) => PackageInfo | null;
|
|
19
|
-
/**
|
|
20
|
-
* Parse GitHub repository URL to extract owner and repo
|
|
21
|
-
* Supports formats:
|
|
22
|
-
* - https://github.com/owner/repo.git
|
|
23
|
-
* - https://github.com/owner/repo
|
|
24
|
-
* - git@github.com:owner/repo.git
|
|
25
|
-
* - github:owner/repo
|
|
26
|
-
*
|
|
27
|
-
* @param repository - Repository info from package.json
|
|
28
|
-
* @returns GitHubRepoInfo or null if parsing failed
|
|
29
|
-
*/
|
|
30
|
-
export declare const parseGitHubRepo: (repository: PackageInfo["repository"]) => GitHubRepoInfo | null;
|
|
31
|
-
/**
|
|
32
|
-
* Build version tag for GitHub
|
|
33
|
-
* @param packageName - Package name (e.g., "@canard/schema-form")
|
|
34
|
-
* @param version - Package version (e.g., "0.10.0")
|
|
35
|
-
* @returns Version tag (e.g., "@canard/schema-form@0.10.0")
|
|
36
|
-
*/
|
|
37
|
-
export declare const buildVersionTag: (packageName: string, version: string) => string;
|
|
38
|
-
/**
|
|
39
|
-
* Build asset path for a package
|
|
40
|
-
* @param assetPath - Base asset path (e.g., "docs/claude")
|
|
41
|
-
* @param directory - Repository directory (optional)
|
|
42
|
-
* @returns Full asset path
|
|
43
|
-
*/
|
|
44
|
-
export declare const buildAssetPath: (assetPath: string, directory?: string) => string;
|
|
45
|
-
/**
|
|
46
|
-
* Find git repository root directory
|
|
47
|
-
* @param cwd - Current working directory
|
|
48
|
-
* @returns Git root path or null if not in a git repository
|
|
49
|
-
*/
|
|
50
|
-
export declare const findGitRoot: (cwd?: string) => string | null;
|
|
51
|
-
/**
|
|
52
|
-
* Find the workspace root directory by looking for package.json with workspaces
|
|
53
|
-
* @param startDir - Directory to start searching from
|
|
54
|
-
* @returns Workspace root path or null if not found
|
|
55
|
-
*/
|
|
56
|
-
export declare const findWorkspaceRoot: (startDir?: string) => string | null;
|
|
57
|
-
/**
|
|
58
|
-
* Get list of workspaces using yarn workspaces list
|
|
59
|
-
* @param workspaceRoot - Workspace root directory
|
|
60
|
-
* @returns Array of WorkspaceInfo
|
|
61
|
-
*/
|
|
62
|
-
export declare const getWorkspaceList: (workspaceRoot: string) => WorkspaceInfo[];
|
|
63
|
-
/**
|
|
64
|
-
* Find workspace location by package name
|
|
65
|
-
* @param packageName - Package name to find
|
|
66
|
-
* @param workspaceRoot - Workspace root directory
|
|
67
|
-
* @returns Workspace location path or null if not found
|
|
68
|
-
*/
|
|
69
|
-
export declare const findWorkspaceLocation: (packageName: string, workspaceRoot: string) => string | null;
|
|
70
|
-
/**
|
|
71
|
-
* Read package.json from local workspace
|
|
72
|
-
* @param packageName - Package name (e.g., "@canard/schema-form")
|
|
73
|
-
* @param cwd - Current working directory
|
|
74
|
-
* @returns PackageInfo or null if not found
|
|
75
|
-
*/
|
|
76
|
-
export declare const readLocalPackageJson: (packageName: string, cwd?: string) => PackageInfo | null;
|
|
77
|
-
/**
|
|
78
|
-
* Parse assets configuration from package.json with defaults
|
|
79
|
-
* @param config - ClaudeConfig from package.json
|
|
80
|
-
* @returns Normalized AssetsConfig with defaults
|
|
81
|
-
*/
|
|
82
|
-
export declare function parseAssetsConfig(config: {
|
|
83
|
-
assetPath: string;
|
|
84
|
-
assets?: Record<string, {
|
|
85
|
-
structure: 'nested' | 'flat';
|
|
86
|
-
}>;
|
|
87
|
-
}): Record<string, {
|
|
88
|
-
structure: 'nested' | 'flat';
|
|
89
|
-
}>;
|
|
90
|
-
/**
|
|
91
|
-
* Get list of asset types to sync from configuration
|
|
92
|
-
* @param config - ClaudeConfig from package.json
|
|
93
|
-
* @returns Array of asset type names
|
|
94
|
-
*/
|
|
95
|
-
export declare function getAssetTypes(config: {
|
|
96
|
-
assetPath: string;
|
|
97
|
-
assets?: Record<string, {
|
|
98
|
-
structure: 'nested' | 'flat';
|
|
99
|
-
}>;
|
|
100
|
-
}): string[];
|
|
101
|
-
/**
|
|
102
|
-
* Resolve claude config with default assetPath fallback.
|
|
103
|
-
* If claude config is missing or assetPath is not set, defaults to DEFAULT_ASSET_PATH.
|
|
104
|
-
*/
|
|
105
|
-
export declare const resolveClaudeConfig: (claude?: ClaudeConfig) => ClaudeConfig;
|
package/dist/utils/package.mjs
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { readFileSync, existsSync } from 'node:fs';
|
|
3
|
-
import { join, dirname } from 'node:path';
|
|
4
|
-
import { DEFAULT_ASSET_PATH, FS_PATTERNS, DEFAULT_ASSET_TYPES } from '../core/constants.mjs';
|
|
5
|
-
|
|
6
|
-
const resolvePackagePath = (packageName, cwd) => {
|
|
7
|
-
let dir = cwd;
|
|
8
|
-
while (true) {
|
|
9
|
-
const candidate = join(dir, 'node_modules', packageName);
|
|
10
|
-
if (existsSync(join(candidate, 'package.json'))) {
|
|
11
|
-
return candidate;
|
|
12
|
-
}
|
|
13
|
-
const parent = dirname(dir);
|
|
14
|
-
if (parent === dir)
|
|
15
|
-
break;
|
|
16
|
-
dir = parent;
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
};
|
|
20
|
-
const readPackageJson = (packageName, cwd = process.cwd()) => {
|
|
21
|
-
try {
|
|
22
|
-
const packagePath = resolvePackagePath(packageName, cwd);
|
|
23
|
-
if (!packagePath)
|
|
24
|
-
return null;
|
|
25
|
-
const content = readFileSync(join(packagePath, 'package.json'), 'utf-8');
|
|
26
|
-
const json = JSON.parse(content);
|
|
27
|
-
if (!json.name || !json.version || !json.repository)
|
|
28
|
-
return null;
|
|
29
|
-
return {
|
|
30
|
-
name: json.name,
|
|
31
|
-
version: json.version,
|
|
32
|
-
repository: json.repository,
|
|
33
|
-
claude: json.claude,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const parseGitHubRepo = (repository) => {
|
|
41
|
-
if (!repository || typeof repository.url !== 'string')
|
|
42
|
-
return null;
|
|
43
|
-
const url = repository.url;
|
|
44
|
-
const httpsMatch = url.match(FS_PATTERNS.GITHUB_HTTPS_URL);
|
|
45
|
-
if (httpsMatch)
|
|
46
|
-
return {
|
|
47
|
-
owner: httpsMatch[1],
|
|
48
|
-
repo: httpsMatch[2],
|
|
49
|
-
directory: repository.directory,
|
|
50
|
-
};
|
|
51
|
-
const sshMatch = url.match(FS_PATTERNS.GITHUB_SSH_URL);
|
|
52
|
-
if (sshMatch)
|
|
53
|
-
return {
|
|
54
|
-
owner: sshMatch[1],
|
|
55
|
-
repo: sshMatch[2],
|
|
56
|
-
directory: repository.directory,
|
|
57
|
-
};
|
|
58
|
-
const shorthandMatch = url.match(FS_PATTERNS.GITHUB_SHORTHAND);
|
|
59
|
-
if (shorthandMatch)
|
|
60
|
-
return {
|
|
61
|
-
owner: shorthandMatch[1],
|
|
62
|
-
repo: shorthandMatch[2],
|
|
63
|
-
directory: repository.directory,
|
|
64
|
-
};
|
|
65
|
-
return null;
|
|
66
|
-
};
|
|
67
|
-
const buildVersionTag = (packageName, version) => `${packageName}@${version}`;
|
|
68
|
-
const buildAssetPath = (assetPath, directory) => (assetPath);
|
|
69
|
-
const findGitRoot = (cwd = process.cwd()) => {
|
|
70
|
-
try {
|
|
71
|
-
const gitRoot = execSync('git rev-parse --show-toplevel', {
|
|
72
|
-
cwd,
|
|
73
|
-
encoding: 'utf-8',
|
|
74
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
75
|
-
}).trim();
|
|
76
|
-
return gitRoot;
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const findWorkspaceRoot = (startDir = process.cwd()) => {
|
|
83
|
-
let currentDir = startDir;
|
|
84
|
-
while (currentDir !== '/') {
|
|
85
|
-
const packageJsonPath = join(currentDir, 'package.json');
|
|
86
|
-
if (existsSync(packageJsonPath)) {
|
|
87
|
-
try {
|
|
88
|
-
const content = readFileSync(packageJsonPath, 'utf-8');
|
|
89
|
-
const json = JSON.parse(content);
|
|
90
|
-
if (json.workspaces)
|
|
91
|
-
return currentDir;
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
currentDir = dirname(currentDir);
|
|
97
|
-
}
|
|
98
|
-
return null;
|
|
99
|
-
};
|
|
100
|
-
const getWorkspaceList = (workspaceRoot) => {
|
|
101
|
-
try {
|
|
102
|
-
const output = execSync('yarn workspaces list --json', {
|
|
103
|
-
cwd: workspaceRoot,
|
|
104
|
-
encoding: 'utf-8',
|
|
105
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
106
|
-
});
|
|
107
|
-
return output
|
|
108
|
-
.trim()
|
|
109
|
-
.split('\n')
|
|
110
|
-
.filter(Boolean)
|
|
111
|
-
.map((line) => JSON.parse(line));
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
return [];
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const findWorkspaceLocation = (packageName, workspaceRoot) => {
|
|
118
|
-
const workspaces = getWorkspaceList(workspaceRoot);
|
|
119
|
-
const workspace = workspaces.find((ws) => ws.name === packageName);
|
|
120
|
-
return workspace ? join(workspaceRoot, workspace.location) : null;
|
|
121
|
-
};
|
|
122
|
-
const readLocalPackageJson = (packageName, cwd = process.cwd()) => {
|
|
123
|
-
try {
|
|
124
|
-
const workspaceRoot = findWorkspaceRoot(cwd);
|
|
125
|
-
if (!workspaceRoot)
|
|
126
|
-
return null;
|
|
127
|
-
const packageLocation = findWorkspaceLocation(packageName, workspaceRoot);
|
|
128
|
-
if (!packageLocation)
|
|
129
|
-
return null;
|
|
130
|
-
const packageJsonPath = join(packageLocation, 'package.json');
|
|
131
|
-
const content = readFileSync(packageJsonPath, 'utf-8');
|
|
132
|
-
const json = JSON.parse(content);
|
|
133
|
-
if (!json.name || !json.version || !json.repository)
|
|
134
|
-
return null;
|
|
135
|
-
return {
|
|
136
|
-
name: json.name,
|
|
137
|
-
version: json.version,
|
|
138
|
-
repository: json.repository,
|
|
139
|
-
claude: json.claude,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
catch {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
function getAssetTypes(config) {
|
|
147
|
-
if (!config.assets) {
|
|
148
|
-
return Array.from(DEFAULT_ASSET_TYPES);
|
|
149
|
-
}
|
|
150
|
-
return Object.keys(config.assets);
|
|
151
|
-
}
|
|
152
|
-
const resolveClaudeConfig = (claude) => ({
|
|
153
|
-
assetPath: claude?.assetPath ?? DEFAULT_ASSET_PATH,
|
|
154
|
-
...(claude?.assets ? { assets: claude.assets } : {}),
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
export { buildAssetPath, buildVersionTag, findGitRoot, findWorkspaceLocation, findWorkspaceRoot, getAssetTypes, getWorkspaceList, parseGitHubRepo, readLocalPackageJson, readPackageJson, resolveClaudeConfig, resolvePackagePath };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function parsePackageName(packageName) {
|
|
4
|
-
if (packageName.startsWith('@')) {
|
|
5
|
-
const [scope, name] = packageName.split('/');
|
|
6
|
-
return [scope, name];
|
|
7
|
-
}
|
|
8
|
-
return ['', packageName];
|
|
9
|
-
}
|
|
10
|
-
function kebabToCamel(str) {
|
|
11
|
-
return str.replace(/-./g, (match) => match[1].toUpperCase());
|
|
12
|
-
}
|
|
13
|
-
function packageNameToPrefix(packageName) {
|
|
14
|
-
const [scope, name] = parsePackageName(packageName);
|
|
15
|
-
if (!scope) {
|
|
16
|
-
return kebabToCamel(name);
|
|
17
|
-
}
|
|
18
|
-
const scopeWithoutAt = scope.replace('@', '');
|
|
19
|
-
const camelName = kebabToCamel(name);
|
|
20
|
-
return `${scopeWithoutAt}-${camelName}`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.packageNameToPrefix = packageNameToPrefix;
|
|
24
|
-
exports.parsePackageName = parsePackageName;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse scoped package name into scope and name
|
|
3
|
-
* @param packageName - Package name (e.g., "@canard/schema-form")
|
|
4
|
-
* @returns [scope, name] tuple (e.g., ["@canard", "schema-form"])
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* parsePackageName('@canard/schema-form') // ['@canard', 'schema-form']
|
|
8
|
-
* parsePackageName('lodash') // ['', 'lodash']
|
|
9
|
-
*/
|
|
10
|
-
export declare function parsePackageName(packageName: string): [string, string];
|
|
11
|
-
/**
|
|
12
|
-
* Converts a scoped package name to a flat prefix
|
|
13
|
-
* @param packageName - Scoped package name (e.g., '@canard/schema-form')
|
|
14
|
-
* @returns Flat prefix (e.g., 'canard-schemaForm')
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* packageNameToPrefix('@canard/schema-form') // 'canard-schemaForm'
|
|
18
|
-
* packageNameToPrefix('@winglet/react-utils') // 'winglet-reactUtils'
|
|
19
|
-
* packageNameToPrefix('lodash') // 'lodash'
|
|
20
|
-
*/
|
|
21
|
-
export declare function packageNameToPrefix(packageName: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Converts a flat prefix back to package name
|
|
24
|
-
* @param prefix - Flat prefix (e.g., 'canard-schemaForm')
|
|
25
|
-
* @returns Package name (e.g., '@canard/schema-form')
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* prefixToPackageName('canard-schemaForm') // '@canard/schema-form'
|
|
29
|
-
* prefixToPackageName('winglet-reactUtils') // '@winglet/react-utils'
|
|
30
|
-
* prefixToPackageName('lodash') // 'lodash'
|
|
31
|
-
*/
|
|
32
|
-
export declare function prefixToPackageName(prefix: string): string;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function parsePackageName(packageName) {
|
|
2
|
-
if (packageName.startsWith('@')) {
|
|
3
|
-
const [scope, name] = packageName.split('/');
|
|
4
|
-
return [scope, name];
|
|
5
|
-
}
|
|
6
|
-
return ['', packageName];
|
|
7
|
-
}
|
|
8
|
-
function kebabToCamel(str) {
|
|
9
|
-
return str.replace(/-./g, (match) => match[1].toUpperCase());
|
|
10
|
-
}
|
|
11
|
-
function packageNameToPrefix(packageName) {
|
|
12
|
-
const [scope, name] = parsePackageName(packageName);
|
|
13
|
-
if (!scope) {
|
|
14
|
-
return kebabToCamel(name);
|
|
15
|
-
}
|
|
16
|
-
const scopeWithoutAt = scope.replace('@', '');
|
|
17
|
-
const camelName = kebabToCamel(name);
|
|
18
|
-
return `${scopeWithoutAt}-${camelName}`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { packageNameToPrefix, parsePackageName };
|
package/dist/utils/paths.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var path = require('node:path');
|
|
4
|
-
var constants = require('../core/constants.cjs');
|
|
5
|
-
var packageName = require('./packageName.cjs');
|
|
6
|
-
|
|
7
|
-
function getDestinationDir(cwd, packageName$1, assetType) {
|
|
8
|
-
const [scope, name] = packageName.parsePackageName(packageName$1);
|
|
9
|
-
if (scope)
|
|
10
|
-
return path.join(cwd, constants.CLAUDE_BASE_DIR, assetType, scope, name);
|
|
11
|
-
return path.join(cwd, constants.CLAUDE_BASE_DIR, assetType, name);
|
|
12
|
-
}
|
|
13
|
-
function getFlatDestinationDir(cwd, assetType) {
|
|
14
|
-
return path.join(cwd, constants.CLAUDE_BASE_DIR, assetType);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.getDestinationDir = getDestinationDir;
|
|
18
|
-
exports.getFlatDestinationDir = getFlatDestinationDir;
|
package/dist/utils/paths.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { AssetType } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Get the destination directory for synced assets (nested structure)
|
|
4
|
-
* @param cwd - Current working directory
|
|
5
|
-
* @param packageName - Package name
|
|
6
|
-
* @param assetType - Asset type (commands or skills)
|
|
7
|
-
* @returns Full path to destination directory
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* getDestinationDir('/project', '@canard/schema-form', 'commands')
|
|
11
|
-
* // => '/project/.claude/commands/@canard/schema-form'
|
|
12
|
-
*/
|
|
13
|
-
export declare function getDestinationDir(cwd: string, packageName: string, assetType: AssetType): string;
|
|
14
|
-
/**
|
|
15
|
-
* Get the flat destination directory for synced assets (no nesting)
|
|
16
|
-
* @param cwd - Current working directory
|
|
17
|
-
* @param assetType - Asset type (commands or skills)
|
|
18
|
-
* @returns Full path to flat destination directory
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* getFlatDestinationDir('/project', 'commands')
|
|
22
|
-
* // => '/project/.claude/commands'
|
|
23
|
-
*/
|
|
24
|
-
export declare function getFlatDestinationDir(cwd: string, assetType: AssetType): string;
|
|
25
|
-
/**
|
|
26
|
-
* Get the path to sync metadata file for nested structure
|
|
27
|
-
* @param cwd - Current working directory
|
|
28
|
-
* @param packageName - Package name
|
|
29
|
-
* @param assetType - Asset type
|
|
30
|
-
* @returns Full path to .sync-meta.json
|
|
31
|
-
*/
|
|
32
|
-
export declare function getMetaFilePath(cwd: string, packageName: string, assetType: AssetType): string;
|
|
33
|
-
/**
|
|
34
|
-
* Get the path to unified sync metadata file
|
|
35
|
-
* @param cwd - Current working directory
|
|
36
|
-
* @returns Full path to .claude/.sync-meta.json
|
|
37
|
-
*/
|
|
38
|
-
export declare function getUnifiedMetaFilePath(cwd: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Get the path to an asset file in nested structure
|
|
41
|
-
* @param cwd - Current working directory
|
|
42
|
-
* @param packageName - Package name
|
|
43
|
-
* @param assetType - Asset type
|
|
44
|
-
* @param fileName - File name
|
|
45
|
-
* @returns Full path to asset file
|
|
46
|
-
*/
|
|
47
|
-
export declare function getAssetFilePath(cwd: string, packageName: string, assetType: AssetType, fileName: string): string;
|
|
48
|
-
/**
|
|
49
|
-
* Get the path to an asset file in flat structure
|
|
50
|
-
* @param cwd - Current working directory
|
|
51
|
-
* @param assetType - Asset type
|
|
52
|
-
* @param flatFileName - Flat file name with prefix
|
|
53
|
-
* @returns Full path to flat asset file
|
|
54
|
-
*/
|
|
55
|
-
export declare function getFlatAssetFilePath(cwd: string, assetType: AssetType, flatFileName: string): string;
|
package/dist/utils/paths.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import { CLAUDE_BASE_DIR } from '../core/constants.mjs';
|
|
3
|
-
import { parsePackageName } from './packageName.mjs';
|
|
4
|
-
|
|
5
|
-
function getDestinationDir(cwd, packageName, assetType) {
|
|
6
|
-
const [scope, name] = parsePackageName(packageName);
|
|
7
|
-
if (scope)
|
|
8
|
-
return join(cwd, CLAUDE_BASE_DIR, assetType, scope, name);
|
|
9
|
-
return join(cwd, CLAUDE_BASE_DIR, assetType, name);
|
|
10
|
-
}
|
|
11
|
-
function getFlatDestinationDir(cwd, assetType) {
|
|
12
|
-
return join(cwd, CLAUDE_BASE_DIR, assetType);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { getDestinationDir, getFlatDestinationDir };
|
package/dist/version.cjs
DELETED
package/dist/version.d.ts
DELETED
package/dist/version.mjs
DELETED