@slats/claude-assets-sync 0.0.6 → 0.1.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/commands/update.cjs +7 -3
- package/dist/commands/update.mjs +7 -3
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/localSource.cjs +8 -2
- package/dist/core/localSource.mjs +8 -2
- package/dist/core/packageScanner.cjs +2 -4
- package/dist/core/packageScanner.mjs +2 -4
- package/dist/core/sync.cjs +1 -1
- package/dist/core/sync.mjs +1 -1
- package/dist/core/syncMeta.cjs +7 -2
- package/dist/core/syncMeta.d.ts +1 -1
- package/dist/core/syncMeta.mjs +7 -2
- package/dist/version.cjs +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +2 -2
package/dist/commands/update.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var pc = require('picocolors');
|
|
4
|
+
var constants = require('../core/constants.cjs');
|
|
4
5
|
var packageScanner = require('../core/packageScanner.cjs');
|
|
5
6
|
var sync = require('../core/sync.cjs');
|
|
6
7
|
var syncMeta = require('../core/syncMeta.cjs');
|
|
7
|
-
var constants = require('../core/constants.cjs');
|
|
8
8
|
var logger = require('../utils/logger.cjs');
|
|
9
9
|
var _package = require('../utils/package.cjs');
|
|
10
10
|
var packageName = require('../utils/packageName.cjs');
|
|
@@ -113,8 +113,12 @@ const runUpdateCommand = async (options, cwd = process.cwd()) => {
|
|
|
113
113
|
const refreshedUnits = currentUnits.map((current) => {
|
|
114
114
|
const scanned = scannedUnits.find((s) => s.name === current.name);
|
|
115
115
|
if (scanned && scanned.isDirectory && current.isDirectory) {
|
|
116
|
-
const currentInternal = (current.internalFiles || [])
|
|
117
|
-
|
|
116
|
+
const currentInternal = (current.internalFiles || [])
|
|
117
|
+
.sort()
|
|
118
|
+
.join(',');
|
|
119
|
+
const scannedInternal = (scanned.internalFiles || [])
|
|
120
|
+
.sort()
|
|
121
|
+
.join(',');
|
|
118
122
|
if (currentInternal !== scannedInternal) {
|
|
119
123
|
internalChanged = true;
|
|
120
124
|
return { ...current, internalFiles: scanned.internalFiles };
|
package/dist/commands/update.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import pc from 'picocolors';
|
|
2
|
+
import { SCHEMA_VERSIONS } from '../core/constants.mjs';
|
|
2
3
|
import { scanPackageAssets, buildSkillUnitsFromTree } from '../core/packageScanner.mjs';
|
|
3
4
|
import { syncPackage } from '../core/sync.mjs';
|
|
4
5
|
import { readUnifiedSyncMeta, updatePackageVersion, updatePackageFilesystemMeta, writeUnifiedSyncMeta } from '../core/syncMeta.mjs';
|
|
5
|
-
import { SCHEMA_VERSIONS } from '../core/constants.mjs';
|
|
6
6
|
import { logger } from '../utils/logger.mjs';
|
|
7
7
|
import { findGitRoot, readLocalPackageJson, readPackageJson } from '../utils/package.mjs';
|
|
8
8
|
import { packageNameToPrefix } from '../utils/packageName.mjs';
|
|
@@ -111,8 +111,12 @@ const runUpdateCommand = async (options, cwd = process.cwd()) => {
|
|
|
111
111
|
const refreshedUnits = currentUnits.map((current) => {
|
|
112
112
|
const scanned = scannedUnits.find((s) => s.name === current.name);
|
|
113
113
|
if (scanned && scanned.isDirectory && current.isDirectory) {
|
|
114
|
-
const currentInternal = (current.internalFiles || [])
|
|
115
|
-
|
|
114
|
+
const currentInternal = (current.internalFiles || [])
|
|
115
|
+
.sort()
|
|
116
|
+
.join(',');
|
|
117
|
+
const scannedInternal = (scanned.internalFiles || [])
|
|
118
|
+
.sort()
|
|
119
|
+
.join(',');
|
|
116
120
|
if (currentInternal !== scannedInternal) {
|
|
117
121
|
internalChanged = true;
|
|
118
122
|
return { ...current, internalFiles: scanned.internalFiles };
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const META_FILES: {
|
|
|
22
22
|
* Schema versions for metadata files
|
|
23
23
|
*/
|
|
24
24
|
export declare const SCHEMA_VERSIONS: {
|
|
25
|
-
readonly UNIFIED_SYNC_META: "0.0
|
|
25
|
+
readonly UNIFIED_SYNC_META: "0.1.0";
|
|
26
26
|
readonly LEGACY_SYNC_META: "1.0.0";
|
|
27
27
|
readonly SKILL_UNIT_FORMAT: "2";
|
|
28
28
|
};
|
|
@@ -6,7 +6,10 @@ var path = require('node:path');
|
|
|
6
6
|
const canUseLocalSource = (packageName, requestedVersion, assetPath, cwd) => {
|
|
7
7
|
const docsPath = path.join(cwd, 'node_modules', packageName, assetPath);
|
|
8
8
|
if (!fs.existsSync(docsPath)) {
|
|
9
|
-
return {
|
|
9
|
+
return {
|
|
10
|
+
available: false,
|
|
11
|
+
reason: `Local docs path not found: ${docsPath}`,
|
|
12
|
+
};
|
|
10
13
|
}
|
|
11
14
|
try {
|
|
12
15
|
const pkgJsonPath = path.join(cwd, 'node_modules', packageName, 'package.json');
|
|
@@ -19,7 +22,10 @@ const canUseLocalSource = (packageName, requestedVersion, assetPath, cwd) => {
|
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
catch {
|
|
22
|
-
return {
|
|
25
|
+
return {
|
|
26
|
+
available: false,
|
|
27
|
+
reason: 'Failed to read package.json from node_modules',
|
|
28
|
+
};
|
|
23
29
|
}
|
|
24
30
|
return { available: true, docsPath };
|
|
25
31
|
};
|
|
@@ -4,7 +4,10 @@ import { join } from 'node:path';
|
|
|
4
4
|
const canUseLocalSource = (packageName, requestedVersion, assetPath, cwd) => {
|
|
5
5
|
const docsPath = join(cwd, 'node_modules', packageName, assetPath);
|
|
6
6
|
if (!existsSync(docsPath)) {
|
|
7
|
-
return {
|
|
7
|
+
return {
|
|
8
|
+
available: false,
|
|
9
|
+
reason: `Local docs path not found: ${docsPath}`,
|
|
10
|
+
};
|
|
8
11
|
}
|
|
9
12
|
try {
|
|
10
13
|
const pkgJsonPath = join(cwd, 'node_modules', packageName, 'package.json');
|
|
@@ -17,7 +20,10 @@ const canUseLocalSource = (packageName, requestedVersion, assetPath, cwd) => {
|
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
catch {
|
|
20
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
available: false,
|
|
25
|
+
reason: 'Failed to read package.json from node_modules',
|
|
26
|
+
};
|
|
21
27
|
}
|
|
22
28
|
return { available: true, docsPath };
|
|
23
29
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('node:fs');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
-
var _package = require('../utils/package.cjs');
|
|
6
5
|
var nameTransform = require('../utils/nameTransform.cjs');
|
|
6
|
+
var _package = require('../utils/package.cjs');
|
|
7
7
|
var constants = require('./constants.cjs');
|
|
8
8
|
var github = require('./github.cjs');
|
|
9
9
|
|
|
@@ -215,9 +215,7 @@ function buildTreeFromGitHubEntries(label, entries, basePath, dirContentsMap) {
|
|
|
215
215
|
}
|
|
216
216
|
else if (entry.type === 'dir') {
|
|
217
217
|
const dirEntries = dirContentsMap?.get(entry.name);
|
|
218
|
-
const hasSkillMd = dirEntries
|
|
219
|
-
? isDirectorySkill(dirEntries)
|
|
220
|
-
: false;
|
|
218
|
+
const hasSkillMd = dirEntries ? isDirectorySkill(dirEntries) : false;
|
|
221
219
|
if (hasSkillMd) {
|
|
222
220
|
const skillPath = `${basePath}/${entry.name}`;
|
|
223
221
|
const internalChildren = dirEntries
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import { parseGitHubRepo } from '../utils/package.mjs';
|
|
4
3
|
import { toFlatFileName } from '../utils/nameTransform.mjs';
|
|
4
|
+
import { parseGitHubRepo } from '../utils/package.mjs';
|
|
5
5
|
import { DEFAULT_ASSET_TYPES } from './constants.mjs';
|
|
6
6
|
import { fetchDirectoryContents } from './github.mjs';
|
|
7
7
|
|
|
@@ -213,9 +213,7 @@ function buildTreeFromGitHubEntries(label, entries, basePath, dirContentsMap) {
|
|
|
213
213
|
}
|
|
214
214
|
else if (entry.type === 'dir') {
|
|
215
215
|
const dirEntries = dirContentsMap?.get(entry.name);
|
|
216
|
-
const hasSkillMd = dirEntries
|
|
217
|
-
? isDirectorySkill(dirEntries)
|
|
218
|
-
: false;
|
|
216
|
+
const hasSkillMd = dirEntries ? isDirectorySkill(dirEntries) : false;
|
|
219
217
|
if (hasSkillMd) {
|
|
220
218
|
const skillPath = `${basePath}/${entry.name}`;
|
|
221
219
|
const internalChildren = dirEntries
|
package/dist/core/sync.cjs
CHANGED
|
@@ -5,11 +5,11 @@ var nameTransform = require('../utils/nameTransform.cjs');
|
|
|
5
5
|
var _package = require('../utils/package.cjs');
|
|
6
6
|
var packageName = require('../utils/packageName.cjs');
|
|
7
7
|
var paths = require('../utils/paths.cjs');
|
|
8
|
+
var constants = require('./constants.cjs');
|
|
8
9
|
var filesystem = require('./filesystem.cjs');
|
|
9
10
|
var github = require('./github.cjs');
|
|
10
11
|
var localSource = require('./localSource.cjs');
|
|
11
12
|
var syncMeta = require('./syncMeta.cjs');
|
|
12
|
-
var constants = require('./constants.cjs');
|
|
13
13
|
var assetStructure = require('./assetStructure.cjs');
|
|
14
14
|
|
|
15
15
|
function groupEntriesIntoSkillUnits(entries, prefix) {
|
package/dist/core/sync.mjs
CHANGED
|
@@ -3,11 +3,11 @@ import { toFlatFileName } from '../utils/nameTransform.mjs';
|
|
|
3
3
|
import { findGitRoot, readLocalPackageJson, readPackageJson, parseGitHubRepo, buildAssetPath, getAssetTypes, buildVersionTag } from '../utils/package.mjs';
|
|
4
4
|
import { packageNameToPrefix } from '../utils/packageName.mjs';
|
|
5
5
|
import { getDestinationDir, getFlatDestinationDir } from '../utils/paths.mjs';
|
|
6
|
+
import { SCHEMA_VERSIONS } from './constants.mjs';
|
|
6
7
|
import { cleanAssetDir, cleanFlatAssetFiles, writeAssetFile, writeFlatAssetFile, needsSync, writeSyncMeta, createSyncMeta } from './filesystem.mjs';
|
|
7
8
|
import { fetchAssetFiles, downloadAssetFiles, RateLimitError } from './github.mjs';
|
|
8
9
|
import { canUseLocalSource, fetchLocalAssetFiles, downloadLocalAssetFiles } from './localSource.mjs';
|
|
9
10
|
import { readUnifiedSyncMeta, createEmptyUnifiedMeta, needsSyncUnified, updatePackageInMeta, writeUnifiedSyncMeta } from './syncMeta.mjs';
|
|
10
|
-
import { SCHEMA_VERSIONS } from './constants.mjs';
|
|
11
11
|
import { getAssetStructure } from './assetStructure.mjs';
|
|
12
12
|
|
|
13
13
|
function groupEntriesIntoSkillUnits(entries, prefix) {
|
package/dist/core/syncMeta.cjs
CHANGED
|
@@ -143,7 +143,9 @@ function needsSkillUnitMigration(meta) {
|
|
|
143
143
|
!('isDirectory' in first)) {
|
|
144
144
|
return true;
|
|
145
145
|
}
|
|
146
|
-
if (typeof first === 'object' &&
|
|
146
|
+
if (typeof first === 'object' &&
|
|
147
|
+
first !== null &&
|
|
148
|
+
'isDirectory' in first) {
|
|
147
149
|
return false;
|
|
148
150
|
}
|
|
149
151
|
}
|
|
@@ -191,7 +193,10 @@ function migrateToSkillUnitSchema(meta) {
|
|
|
191
193
|
? mapping.transformed.substring(0, transformedSlashIndex)
|
|
192
194
|
: mapping.transformed;
|
|
193
195
|
if (!groupedByDir.has(dirName)) {
|
|
194
|
-
groupedByDir.set(dirName, {
|
|
196
|
+
groupedByDir.set(dirName, {
|
|
197
|
+
transformed: transformedDir,
|
|
198
|
+
internalFiles: [],
|
|
199
|
+
});
|
|
195
200
|
}
|
|
196
201
|
groupedByDir.get(dirName).internalFiles.push(internalFile);
|
|
197
202
|
}
|
package/dist/core/syncMeta.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { PackageSyncInfo, SkillUnit, UnifiedSyncMeta } from '../utils/types
|
|
|
2
2
|
/**
|
|
3
3
|
* Schema version for the unified metadata format
|
|
4
4
|
*/
|
|
5
|
-
export declare const SCHEMA_VERSION: "0.0
|
|
5
|
+
export declare const SCHEMA_VERSION: "0.1.0";
|
|
6
6
|
/**
|
|
7
7
|
* Read unified sync metadata from .claude/.sync-meta.json
|
|
8
8
|
*
|
package/dist/core/syncMeta.mjs
CHANGED
|
@@ -141,7 +141,9 @@ function needsSkillUnitMigration(meta) {
|
|
|
141
141
|
!('isDirectory' in first)) {
|
|
142
142
|
return true;
|
|
143
143
|
}
|
|
144
|
-
if (typeof first === 'object' &&
|
|
144
|
+
if (typeof first === 'object' &&
|
|
145
|
+
first !== null &&
|
|
146
|
+
'isDirectory' in first) {
|
|
145
147
|
return false;
|
|
146
148
|
}
|
|
147
149
|
}
|
|
@@ -189,7 +191,10 @@ function migrateToSkillUnitSchema(meta) {
|
|
|
189
191
|
? mapping.transformed.substring(0, transformedSlashIndex)
|
|
190
192
|
: mapping.transformed;
|
|
191
193
|
if (!groupedByDir.has(dirName)) {
|
|
192
|
-
groupedByDir.set(dirName, {
|
|
194
|
+
groupedByDir.set(dirName, {
|
|
195
|
+
transformed: transformedDir,
|
|
196
|
+
internalFiles: [],
|
|
197
|
+
});
|
|
193
198
|
}
|
|
194
199
|
groupedByDir.get(dirName).internalFiles.push(internalFile);
|
|
195
200
|
}
|
package/dist/version.cjs
CHANGED
package/dist/version.d.ts
CHANGED
package/dist/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slats/claude-assets-sync",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "CLI tool to sync Claude commands and skills from npm packages to your project's .claude directory",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"version:patch": "yarn version patch"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@winglet/react-utils": "^0.
|
|
56
|
+
"@winglet/react-utils": "^0.11.0",
|
|
57
57
|
"commander": "^12.1.0",
|
|
58
58
|
"ink": "^6.6.0",
|
|
59
59
|
"ink-spinner": "^5.0.0",
|