@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
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { TreeNode } from '../../utils/types.js';
|
|
3
|
-
export interface AssetTreeNodeProps {
|
|
4
|
-
node: TreeNode;
|
|
5
|
-
isLastAtDepth: boolean[];
|
|
6
|
-
isSelected: boolean;
|
|
7
|
-
onToggle: () => void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Single tree node component for asset selection
|
|
11
|
-
*/
|
|
12
|
-
export declare const AssetTreeNode: React.FC<AssetTreeNodeProps>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
|
|
4
|
-
function hasPartialSelection(node) {
|
|
5
|
-
if (!node.children || node.children.length === 0) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
const selectedCount = node.children.filter((child) => child.selected).length;
|
|
9
|
-
return selectedCount > 0 && selectedCount < node.children.length;
|
|
10
|
-
}
|
|
11
|
-
function getTreePrefix(isLastAtDepth) {
|
|
12
|
-
let prefix = '';
|
|
13
|
-
const depth = isLastAtDepth.length;
|
|
14
|
-
for (let i = 0; i < depth; i++) {
|
|
15
|
-
if (i === depth - 1) {
|
|
16
|
-
prefix += isLastAtDepth[i] ? '└─ ' : '├─ ';
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
prefix += isLastAtDepth[i] ? ' ' : '│ ';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return prefix;
|
|
23
|
-
}
|
|
24
|
-
const AssetTreeNode = ({ node, isLastAtDepth, isSelected, }) => {
|
|
25
|
-
const treePrefix = getTreePrefix(isLastAtDepth);
|
|
26
|
-
if (node.disabled) {
|
|
27
|
-
return (jsx(Box, { children: jsxs(Text, { color: isSelected ? 'cyan' : undefined, dimColor: !isSelected, children: [treePrefix, node.label] }) }));
|
|
28
|
-
}
|
|
29
|
-
let selectionIcon;
|
|
30
|
-
let iconColor;
|
|
31
|
-
if (hasPartialSelection(node)) {
|
|
32
|
-
selectionIcon = '◐';
|
|
33
|
-
iconColor = 'yellow';
|
|
34
|
-
}
|
|
35
|
-
else if (node.selected) {
|
|
36
|
-
selectionIcon = '◉';
|
|
37
|
-
iconColor = 'green';
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
selectionIcon = '○';
|
|
41
|
-
iconColor = 'red';
|
|
42
|
-
}
|
|
43
|
-
const expandIcon = (node.type === 'directory' || node.type === 'skill-directory') &&
|
|
44
|
-
node.children
|
|
45
|
-
? node.expanded
|
|
46
|
-
? '▼'
|
|
47
|
-
: '▶'
|
|
48
|
-
: ' ';
|
|
49
|
-
return (jsx(Box, { children: jsxs(Text, { color: isSelected ? 'cyan' : undefined, children: [treePrefix, expandIcon, " ", jsx(Text, { color: iconColor, children: selectionIcon }), " ", node.label] }) }));
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export { AssetTreeNode };
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var ink = require('ink');
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var AssetTreeNode = require('./AssetTreeNode.cjs');
|
|
7
|
-
|
|
8
|
-
const TreeSelect = ({ trees, onSubmit, onCancel, onRefresh, }) => {
|
|
9
|
-
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
10
|
-
const [treeData, setTreeData] = React.useState(trees);
|
|
11
|
-
const flattenTree = (nodes, depth = 0) => {
|
|
12
|
-
const result = [];
|
|
13
|
-
const traverse = (items, currentDepth, parentPath = [], ancestorIsLast = []) => {
|
|
14
|
-
items.forEach((item, index) => {
|
|
15
|
-
const isLast = index === items.length - 1;
|
|
16
|
-
const currentIsLast = [...ancestorIsLast, isLast];
|
|
17
|
-
const currentPath = [...parentPath, index];
|
|
18
|
-
result.push({ node: item, depth: currentDepth, path: currentPath, isLastAtDepth: currentIsLast });
|
|
19
|
-
if (item.expanded && item.children) {
|
|
20
|
-
traverse(item.children, currentDepth + 1, currentPath, currentIsLast);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
traverse(nodes, depth);
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
const flatItems = flattenTree(treeData);
|
|
28
|
-
ink.useInput((input, key) => {
|
|
29
|
-
if (key.upArrow) {
|
|
30
|
-
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
31
|
-
}
|
|
32
|
-
else if (key.downArrow) {
|
|
33
|
-
setSelectedIndex((prev) => Math.min(flatItems.length - 1, prev + 1));
|
|
34
|
-
}
|
|
35
|
-
else if (key.rightArrow) {
|
|
36
|
-
const current = flatItems[selectedIndex];
|
|
37
|
-
if ((current.node.type === 'directory' || current.node.type === 'skill-directory') &&
|
|
38
|
-
!current.node.expanded &&
|
|
39
|
-
current.node.children) {
|
|
40
|
-
const newTrees = updateNodeAtPath(treeData, current.path, (node) => ({
|
|
41
|
-
...node,
|
|
42
|
-
expanded: true,
|
|
43
|
-
}));
|
|
44
|
-
setTreeData(newTrees);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else if (key.leftArrow) {
|
|
48
|
-
const current = flatItems[selectedIndex];
|
|
49
|
-
if ((current.node.type === 'directory' || current.node.type === 'skill-directory') &&
|
|
50
|
-
current.node.expanded) {
|
|
51
|
-
const newTrees = updateNodeAtPath(treeData, current.path, (node) => ({
|
|
52
|
-
...node,
|
|
53
|
-
expanded: false,
|
|
54
|
-
}));
|
|
55
|
-
setTreeData(newTrees);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else if (input === ' ') {
|
|
59
|
-
const current = flatItems[selectedIndex];
|
|
60
|
-
if (current.node.disabled) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const newTrees = toggleNodeSelection(treeData, current.path);
|
|
64
|
-
setTreeData(newTrees);
|
|
65
|
-
}
|
|
66
|
-
else if (input === 'r' && onRefresh) {
|
|
67
|
-
onRefresh();
|
|
68
|
-
}
|
|
69
|
-
else if (key.return) {
|
|
70
|
-
onSubmit(treeData);
|
|
71
|
-
}
|
|
72
|
-
else if (key.escape || input === 'q') {
|
|
73
|
-
onCancel();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return (jsxRuntime.jsx(ink.Box, { flexDirection: "column", children: flatItems.map((item, index) => (jsxRuntime.jsx(AssetTreeNode.AssetTreeNode, { node: item.node, isLastAtDepth: item.isLastAtDepth, isSelected: index === selectedIndex, onToggle: () => {
|
|
77
|
-
const newTrees = toggleNodeSelection(treeData, item.path);
|
|
78
|
-
setTreeData(newTrees);
|
|
79
|
-
} }, item.path.join('-')))) }));
|
|
80
|
-
};
|
|
81
|
-
function updateNodeAtPath(trees, path, updater) {
|
|
82
|
-
if (path.length === 0)
|
|
83
|
-
return trees;
|
|
84
|
-
const [index, ...rest] = path;
|
|
85
|
-
const newTrees = [...trees];
|
|
86
|
-
if (rest.length === 0) {
|
|
87
|
-
newTrees[index] = updater(newTrees[index]);
|
|
88
|
-
}
|
|
89
|
-
else if (newTrees[index].children) {
|
|
90
|
-
newTrees[index] = {
|
|
91
|
-
...newTrees[index],
|
|
92
|
-
children: updateNodeAtPath(newTrees[index].children, rest, updater),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
return newTrees;
|
|
96
|
-
}
|
|
97
|
-
function toggleNodeSelection(trees, path) {
|
|
98
|
-
const updatedTrees = updateNodeAtPath(trees, path, (node) => {
|
|
99
|
-
const newSelected = !node.selected;
|
|
100
|
-
return toggleNodeAndChildren(node, newSelected);
|
|
101
|
-
});
|
|
102
|
-
return updateAncestors(updatedTrees, path);
|
|
103
|
-
}
|
|
104
|
-
function toggleNodeAndChildren(node, selected) {
|
|
105
|
-
const newNode = { ...node, selected };
|
|
106
|
-
if (node.children) {
|
|
107
|
-
newNode.children = node.children.map((child) => toggleNodeAndChildren(child, selected));
|
|
108
|
-
}
|
|
109
|
-
return newNode;
|
|
110
|
-
}
|
|
111
|
-
function updateAncestors(trees, path) {
|
|
112
|
-
if (path.length <= 1) {
|
|
113
|
-
return trees;
|
|
114
|
-
}
|
|
115
|
-
const parentPath = path.slice(0, -1);
|
|
116
|
-
const updatedTrees = updateNodeAtPath(trees, parentPath, (parentNode) => {
|
|
117
|
-
if (!parentNode.children || parentNode.children.length === 0) {
|
|
118
|
-
return parentNode;
|
|
119
|
-
}
|
|
120
|
-
const anySelected = parentNode.children.some((child) => child.selected);
|
|
121
|
-
return {
|
|
122
|
-
...parentNode,
|
|
123
|
-
selected: anySelected,
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
return updateAncestors(updatedTrees, parentPath);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
exports.TreeSelect = TreeSelect;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { TreeNode } from '../../utils/types.js';
|
|
3
|
-
export interface TreeSelectProps {
|
|
4
|
-
trees: TreeNode[];
|
|
5
|
-
onSubmit: (trees: TreeNode[]) => void;
|
|
6
|
-
onCancel: () => void;
|
|
7
|
-
onRefresh?: () => void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Interactive tree selection component
|
|
11
|
-
*/
|
|
12
|
-
export declare const TreeSelect: React.FC<TreeSelectProps>;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useInput, Box } from 'ink';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { AssetTreeNode } from './AssetTreeNode.mjs';
|
|
5
|
-
|
|
6
|
-
const TreeSelect = ({ trees, onSubmit, onCancel, onRefresh, }) => {
|
|
7
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
8
|
-
const [treeData, setTreeData] = useState(trees);
|
|
9
|
-
const flattenTree = (nodes, depth = 0) => {
|
|
10
|
-
const result = [];
|
|
11
|
-
const traverse = (items, currentDepth, parentPath = [], ancestorIsLast = []) => {
|
|
12
|
-
items.forEach((item, index) => {
|
|
13
|
-
const isLast = index === items.length - 1;
|
|
14
|
-
const currentIsLast = [...ancestorIsLast, isLast];
|
|
15
|
-
const currentPath = [...parentPath, index];
|
|
16
|
-
result.push({ node: item, depth: currentDepth, path: currentPath, isLastAtDepth: currentIsLast });
|
|
17
|
-
if (item.expanded && item.children) {
|
|
18
|
-
traverse(item.children, currentDepth + 1, currentPath, currentIsLast);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
traverse(nodes, depth);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
const flatItems = flattenTree(treeData);
|
|
26
|
-
useInput((input, key) => {
|
|
27
|
-
if (key.upArrow) {
|
|
28
|
-
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
29
|
-
}
|
|
30
|
-
else if (key.downArrow) {
|
|
31
|
-
setSelectedIndex((prev) => Math.min(flatItems.length - 1, prev + 1));
|
|
32
|
-
}
|
|
33
|
-
else if (key.rightArrow) {
|
|
34
|
-
const current = flatItems[selectedIndex];
|
|
35
|
-
if ((current.node.type === 'directory' || current.node.type === 'skill-directory') &&
|
|
36
|
-
!current.node.expanded &&
|
|
37
|
-
current.node.children) {
|
|
38
|
-
const newTrees = updateNodeAtPath(treeData, current.path, (node) => ({
|
|
39
|
-
...node,
|
|
40
|
-
expanded: true,
|
|
41
|
-
}));
|
|
42
|
-
setTreeData(newTrees);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else if (key.leftArrow) {
|
|
46
|
-
const current = flatItems[selectedIndex];
|
|
47
|
-
if ((current.node.type === 'directory' || current.node.type === 'skill-directory') &&
|
|
48
|
-
current.node.expanded) {
|
|
49
|
-
const newTrees = updateNodeAtPath(treeData, current.path, (node) => ({
|
|
50
|
-
...node,
|
|
51
|
-
expanded: false,
|
|
52
|
-
}));
|
|
53
|
-
setTreeData(newTrees);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else if (input === ' ') {
|
|
57
|
-
const current = flatItems[selectedIndex];
|
|
58
|
-
if (current.node.disabled) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const newTrees = toggleNodeSelection(treeData, current.path);
|
|
62
|
-
setTreeData(newTrees);
|
|
63
|
-
}
|
|
64
|
-
else if (input === 'r' && onRefresh) {
|
|
65
|
-
onRefresh();
|
|
66
|
-
}
|
|
67
|
-
else if (key.return) {
|
|
68
|
-
onSubmit(treeData);
|
|
69
|
-
}
|
|
70
|
-
else if (key.escape || input === 'q') {
|
|
71
|
-
onCancel();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return (jsx(Box, { flexDirection: "column", children: flatItems.map((item, index) => (jsx(AssetTreeNode, { node: item.node, isLastAtDepth: item.isLastAtDepth, isSelected: index === selectedIndex, onToggle: () => {
|
|
75
|
-
const newTrees = toggleNodeSelection(treeData, item.path);
|
|
76
|
-
setTreeData(newTrees);
|
|
77
|
-
} }, item.path.join('-')))) }));
|
|
78
|
-
};
|
|
79
|
-
function updateNodeAtPath(trees, path, updater) {
|
|
80
|
-
if (path.length === 0)
|
|
81
|
-
return trees;
|
|
82
|
-
const [index, ...rest] = path;
|
|
83
|
-
const newTrees = [...trees];
|
|
84
|
-
if (rest.length === 0) {
|
|
85
|
-
newTrees[index] = updater(newTrees[index]);
|
|
86
|
-
}
|
|
87
|
-
else if (newTrees[index].children) {
|
|
88
|
-
newTrees[index] = {
|
|
89
|
-
...newTrees[index],
|
|
90
|
-
children: updateNodeAtPath(newTrees[index].children, rest, updater),
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return newTrees;
|
|
94
|
-
}
|
|
95
|
-
function toggleNodeSelection(trees, path) {
|
|
96
|
-
const updatedTrees = updateNodeAtPath(trees, path, (node) => {
|
|
97
|
-
const newSelected = !node.selected;
|
|
98
|
-
return toggleNodeAndChildren(node, newSelected);
|
|
99
|
-
});
|
|
100
|
-
return updateAncestors(updatedTrees, path);
|
|
101
|
-
}
|
|
102
|
-
function toggleNodeAndChildren(node, selected) {
|
|
103
|
-
const newNode = { ...node, selected };
|
|
104
|
-
if (node.children) {
|
|
105
|
-
newNode.children = node.children.map((child) => toggleNodeAndChildren(child, selected));
|
|
106
|
-
}
|
|
107
|
-
return newNode;
|
|
108
|
-
}
|
|
109
|
-
function updateAncestors(trees, path) {
|
|
110
|
-
if (path.length <= 1) {
|
|
111
|
-
return trees;
|
|
112
|
-
}
|
|
113
|
-
const parentPath = path.slice(0, -1);
|
|
114
|
-
const updatedTrees = updateNodeAtPath(trees, parentPath, (parentNode) => {
|
|
115
|
-
if (!parentNode.children || parentNode.children.length === 0) {
|
|
116
|
-
return parentNode;
|
|
117
|
-
}
|
|
118
|
-
const anySelected = parentNode.children.some((child) => child.selected);
|
|
119
|
-
return {
|
|
120
|
-
...parentNode,
|
|
121
|
-
selected: anySelected,
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
return updateAncestors(updatedTrees, parentPath);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export { TreeSelect };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('node:fs');
|
|
4
|
-
require('node:path');
|
|
5
|
-
|
|
6
|
-
const DEFAULT_ASSET_STRUCTURES = {
|
|
7
|
-
commands: 'nested',
|
|
8
|
-
skills: 'flat',
|
|
9
|
-
agents: 'flat',
|
|
10
|
-
};
|
|
11
|
-
function getAssetStructure(assetType, config) {
|
|
12
|
-
if (!config) {
|
|
13
|
-
return DEFAULT_ASSET_STRUCTURES[assetType] || 'flat';
|
|
14
|
-
}
|
|
15
|
-
let assetsConfig;
|
|
16
|
-
if ('assetPath' in config) {
|
|
17
|
-
assetsConfig = config
|
|
18
|
-
.assets;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
assetsConfig = config;
|
|
22
|
-
}
|
|
23
|
-
if (assetsConfig?.[assetType]?.structure) {
|
|
24
|
-
return assetsConfig[assetType].structure;
|
|
25
|
-
}
|
|
26
|
-
return DEFAULT_ASSET_STRUCTURES[assetType] || 'nested';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
exports.DEFAULT_ASSET_STRUCTURES = DEFAULT_ASSET_STRUCTURES;
|
|
30
|
-
exports.getAssetStructure = getAssetStructure;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { AssetStructure, AssetsConfig } from '../utils/types.js';
|
|
2
|
-
import { DEFAULT_ASSET_TYPES } from './constants.js';
|
|
3
|
-
export { DEFAULT_ASSET_TYPES };
|
|
4
|
-
/**
|
|
5
|
-
* Default structure configuration for built-in asset types
|
|
6
|
-
*/
|
|
7
|
-
export declare const DEFAULT_ASSET_STRUCTURES: Record<string, AssetStructure>;
|
|
8
|
-
/**
|
|
9
|
-
* Get the structure type for a given asset type
|
|
10
|
-
* @param assetType - The asset type to query
|
|
11
|
-
* @param config - Optional ClaudeConfig or AssetsConfig
|
|
12
|
-
* @returns The structure type ('nested' or 'flat')
|
|
13
|
-
*/
|
|
14
|
-
export declare function getAssetStructure(assetType: string, config?: AssetsConfig | {
|
|
15
|
-
assetPath: string;
|
|
16
|
-
assets?: AssetsConfig;
|
|
17
|
-
}): AssetStructure;
|
|
18
|
-
/**
|
|
19
|
-
* Detect the structure type of an asset directory
|
|
20
|
-
* @param dir - Directory path to check
|
|
21
|
-
* @returns Structure type ('flat' | 'nested') or null if directory doesn't exist
|
|
22
|
-
*/
|
|
23
|
-
export declare function detectStructureType(dir: string): AssetStructure | null;
|
|
24
|
-
/**
|
|
25
|
-
* Validate that an asset structure value is valid
|
|
26
|
-
* @param structure - Structure value to validate
|
|
27
|
-
* @returns True if valid, false otherwise
|
|
28
|
-
*/
|
|
29
|
-
export declare function validateAssetStructure(structure: unknown): structure is AssetStructure;
|
|
30
|
-
/**
|
|
31
|
-
* Validate and normalize asset structure value
|
|
32
|
-
* @param structure - Structure value to normalize
|
|
33
|
-
* @param defaultValue - Default value if validation fails
|
|
34
|
-
* @returns Validated structure or default
|
|
35
|
-
*/
|
|
36
|
-
export declare function normalizeAssetStructure(structure: unknown, defaultValue?: AssetStructure): AssetStructure;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import 'node:fs';
|
|
2
|
-
import 'node:path';
|
|
3
|
-
|
|
4
|
-
const DEFAULT_ASSET_STRUCTURES = {
|
|
5
|
-
commands: 'nested',
|
|
6
|
-
skills: 'flat',
|
|
7
|
-
agents: 'flat',
|
|
8
|
-
};
|
|
9
|
-
function getAssetStructure(assetType, config) {
|
|
10
|
-
if (!config) {
|
|
11
|
-
return DEFAULT_ASSET_STRUCTURES[assetType] || 'flat';
|
|
12
|
-
}
|
|
13
|
-
let assetsConfig;
|
|
14
|
-
if ('assetPath' in config) {
|
|
15
|
-
assetsConfig = config
|
|
16
|
-
.assets;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
assetsConfig = config;
|
|
20
|
-
}
|
|
21
|
-
if (assetsConfig?.[assetType]?.structure) {
|
|
22
|
-
return assetsConfig[assetType].structure;
|
|
23
|
-
}
|
|
24
|
-
return DEFAULT_ASSET_STRUCTURES[assetType] || 'nested';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { DEFAULT_ASSET_STRUCTURES, getAssetStructure };
|
package/dist/core/cli.cjs
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var commander = require('commander');
|
|
4
|
-
var sync = require('../commands/sync.cjs');
|
|
5
|
-
var list = require('../commands/list.cjs');
|
|
6
|
-
var remove = require('../commands/remove.cjs');
|
|
7
|
-
var status = require('../commands/status.cjs');
|
|
8
|
-
var migrate = require('../commands/migrate.cjs');
|
|
9
|
-
var add = require('../commands/add.cjs');
|
|
10
|
-
var update = require('../commands/update.cjs');
|
|
11
|
-
var version = require('../version.cjs');
|
|
12
|
-
|
|
13
|
-
const createProgram = () => {
|
|
14
|
-
const program = new commander.Command();
|
|
15
|
-
program
|
|
16
|
-
.name('claude-assets-sync')
|
|
17
|
-
.description('Sync Claude commands and skills from npm packages to your project')
|
|
18
|
-
.version(version.VERSION);
|
|
19
|
-
program
|
|
20
|
-
.command('sync', { isDefault: true })
|
|
21
|
-
.description('Sync Claude assets from npm packages')
|
|
22
|
-
.option('-p, --package <name>', 'Package name to sync (can be specified multiple times)', (value, previous) => [...previous, value], [])
|
|
23
|
-
.option('-f, --force', 'Force sync even if version matches', false)
|
|
24
|
-
.option('--dry-run', 'Preview changes without writing files', false)
|
|
25
|
-
.option('-l, --local', 'Read packages from local workspace instead of node_modules', false)
|
|
26
|
-
.option('-r, --ref <ref>', 'Git ref (branch, tag, or commit) to fetch from (overrides version tag)')
|
|
27
|
-
.option('--no-flat', 'Use legacy nested directory structure instead of flat structure (default: flat)')
|
|
28
|
-
.action(async (opts) => {
|
|
29
|
-
await sync.runSyncCommand({
|
|
30
|
-
package: opts.package,
|
|
31
|
-
force: opts.force,
|
|
32
|
-
dryRun: opts.dryRun,
|
|
33
|
-
local: opts.local,
|
|
34
|
-
ref: opts.ref,
|
|
35
|
-
flat: opts.flat,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
program
|
|
39
|
-
.command('add')
|
|
40
|
-
.description('Add a package with interactive asset selection')
|
|
41
|
-
.option('-p, --package <name>', 'Package name to add')
|
|
42
|
-
.option('--pattern <regex>', 'Regex pattern to bulk add matching packages')
|
|
43
|
-
.option('-l, --local', 'Read packages from local workspace instead of node_modules', false)
|
|
44
|
-
.option('-r, --ref <ref>', 'Git ref (branch, tag, or commit) to fetch from')
|
|
45
|
-
.action(async (opts) => {
|
|
46
|
-
await add.runAddCommand({
|
|
47
|
-
package: opts.package,
|
|
48
|
-
pattern: opts.pattern,
|
|
49
|
-
local: opts.local,
|
|
50
|
-
ref: opts.ref,
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
list.registerListCommand(program);
|
|
54
|
-
program
|
|
55
|
-
.command('remove')
|
|
56
|
-
.description('Remove a synced package')
|
|
57
|
-
.requiredOption('-p, --package <name>', 'Package name to remove')
|
|
58
|
-
.option('-y, --yes', 'Skip confirmation prompt')
|
|
59
|
-
.option('--dry-run', 'Preview changes without removing files')
|
|
60
|
-
.action(async (opts) => {
|
|
61
|
-
await remove.runRemoveCommand({
|
|
62
|
-
package: opts.package,
|
|
63
|
-
yes: opts.yes,
|
|
64
|
-
dryRun: opts.dryRun,
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
program
|
|
68
|
-
.command('status')
|
|
69
|
-
.description('Show sync status of all packages')
|
|
70
|
-
.option('--no-remote', 'Skip remote version check')
|
|
71
|
-
.action(async (opts) => {
|
|
72
|
-
await status.runStatusCommand({ noRemote: !opts.remote });
|
|
73
|
-
});
|
|
74
|
-
program
|
|
75
|
-
.command('migrate')
|
|
76
|
-
.description('Migrate from legacy nested structure to flat structure')
|
|
77
|
-
.option('--dry-run', 'Preview migration without making changes')
|
|
78
|
-
.action(async (opts) => {
|
|
79
|
-
await migrate.runMigrateCommand({ dryRun: opts.dryRun });
|
|
80
|
-
});
|
|
81
|
-
program
|
|
82
|
-
.command('update')
|
|
83
|
-
.description('Update package metadata in .sync-meta.json')
|
|
84
|
-
.option('-p, --package <name>', 'Package name to update (default: all)')
|
|
85
|
-
.option('-l, --local', 'Read packages from local workspace instead of node_modules', false)
|
|
86
|
-
.option('-r, --ref <ref>', 'Git ref (branch, tag, or commit) to fetch from')
|
|
87
|
-
.option('--dry-run', 'Preview changes without writing files', false)
|
|
88
|
-
.option('--sync', 'Re-sync files after updating metadata', false)
|
|
89
|
-
.action(async (opts) => {
|
|
90
|
-
await update.runUpdateCommand({
|
|
91
|
-
package: opts.package,
|
|
92
|
-
local: opts.local,
|
|
93
|
-
ref: opts.ref,
|
|
94
|
-
dryRun: opts.dryRun,
|
|
95
|
-
sync: opts.sync,
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
return program;
|
|
99
|
-
};
|
|
100
|
-
const run = async () => {
|
|
101
|
-
const program = createProgram();
|
|
102
|
-
await program.parseAsync(process.argv);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
exports.createProgram = createProgram;
|
|
106
|
-
exports.run = run;
|
package/dist/core/cli.d.ts
DELETED
package/dist/core/cli.mjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { runSyncCommand } from '../commands/sync.mjs';
|
|
3
|
-
import { registerListCommand } from '../commands/list.mjs';
|
|
4
|
-
import { runRemoveCommand } from '../commands/remove.mjs';
|
|
5
|
-
import { runStatusCommand } from '../commands/status.mjs';
|
|
6
|
-
import { runMigrateCommand } from '../commands/migrate.mjs';
|
|
7
|
-
import { runAddCommand } from '../commands/add.mjs';
|
|
8
|
-
import { runUpdateCommand } from '../commands/update.mjs';
|
|
9
|
-
import { VERSION } from '../version.mjs';
|
|
10
|
-
|
|
11
|
-
const createProgram = () => {
|
|
12
|
-
const program = new Command();
|
|
13
|
-
program
|
|
14
|
-
.name('claude-assets-sync')
|
|
15
|
-
.description('Sync Claude commands and skills from npm packages to your project')
|
|
16
|
-
.version(VERSION);
|
|
17
|
-
program
|
|
18
|
-
.command('sync', { isDefault: true })
|
|
19
|
-
.description('Sync Claude assets from npm packages')
|
|
20
|
-
.option('-p, --package <name>', 'Package name to sync (can be specified multiple times)', (value, previous) => [...previous, value], [])
|
|
21
|
-
.option('-f, --force', 'Force sync even if version matches', false)
|
|
22
|
-
.option('--dry-run', 'Preview changes without writing files', false)
|
|
23
|
-
.option('-l, --local', 'Read packages from local workspace instead of node_modules', false)
|
|
24
|
-
.option('-r, --ref <ref>', 'Git ref (branch, tag, or commit) to fetch from (overrides version tag)')
|
|
25
|
-
.option('--no-flat', 'Use legacy nested directory structure instead of flat structure (default: flat)')
|
|
26
|
-
.action(async (opts) => {
|
|
27
|
-
await runSyncCommand({
|
|
28
|
-
package: opts.package,
|
|
29
|
-
force: opts.force,
|
|
30
|
-
dryRun: opts.dryRun,
|
|
31
|
-
local: opts.local,
|
|
32
|
-
ref: opts.ref,
|
|
33
|
-
flat: opts.flat,
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
program
|
|
37
|
-
.command('add')
|
|
38
|
-
.description('Add a package with interactive asset selection')
|
|
39
|
-
.option('-p, --package <name>', 'Package name to add')
|
|
40
|
-
.option('--pattern <regex>', 'Regex pattern to bulk add matching packages')
|
|
41
|
-
.option('-l, --local', 'Read packages from local workspace instead of node_modules', false)
|
|
42
|
-
.option('-r, --ref <ref>', 'Git ref (branch, tag, or commit) to fetch from')
|
|
43
|
-
.action(async (opts) => {
|
|
44
|
-
await runAddCommand({
|
|
45
|
-
package: opts.package,
|
|
46
|
-
pattern: opts.pattern,
|
|
47
|
-
local: opts.local,
|
|
48
|
-
ref: opts.ref,
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
registerListCommand(program);
|
|
52
|
-
program
|
|
53
|
-
.command('remove')
|
|
54
|
-
.description('Remove a synced package')
|
|
55
|
-
.requiredOption('-p, --package <name>', 'Package name to remove')
|
|
56
|
-
.option('-y, --yes', 'Skip confirmation prompt')
|
|
57
|
-
.option('--dry-run', 'Preview changes without removing files')
|
|
58
|
-
.action(async (opts) => {
|
|
59
|
-
await runRemoveCommand({
|
|
60
|
-
package: opts.package,
|
|
61
|
-
yes: opts.yes,
|
|
62
|
-
dryRun: opts.dryRun,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
program
|
|
66
|
-
.command('status')
|
|
67
|
-
.description('Show sync status of all packages')
|
|
68
|
-
.option('--no-remote', 'Skip remote version check')
|
|
69
|
-
.action(async (opts) => {
|
|
70
|
-
await runStatusCommand({ noRemote: !opts.remote });
|
|
71
|
-
});
|
|
72
|
-
program
|
|
73
|
-
.command('migrate')
|
|
74
|
-
.description('Migrate from legacy nested structure to flat structure')
|
|
75
|
-
.option('--dry-run', 'Preview migration without making changes')
|
|
76
|
-
.action(async (opts) => {
|
|
77
|
-
await runMigrateCommand({ dryRun: opts.dryRun });
|
|
78
|
-
});
|
|
79
|
-
program
|
|
80
|
-
.command('update')
|
|
81
|
-
.description('Update package metadata in .sync-meta.json')
|
|
82
|
-
.option('-p, --package <name>', 'Package name to update (default: all)')
|
|
83
|
-
.option('-l, --local', 'Read packages from local workspace instead of node_modules', false)
|
|
84
|
-
.option('-r, --ref <ref>', 'Git ref (branch, tag, or commit) to fetch from')
|
|
85
|
-
.option('--dry-run', 'Preview changes without writing files', false)
|
|
86
|
-
.option('--sync', 'Re-sync files after updating metadata', false)
|
|
87
|
-
.action(async (opts) => {
|
|
88
|
-
await runUpdateCommand({
|
|
89
|
-
package: opts.package,
|
|
90
|
-
local: opts.local,
|
|
91
|
-
ref: opts.ref,
|
|
92
|
-
dryRun: opts.dryRun,
|
|
93
|
-
sync: opts.sync,
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
return program;
|
|
97
|
-
};
|
|
98
|
-
const run = async () => {
|
|
99
|
-
const program = createProgram();
|
|
100
|
-
await program.parseAsync(process.argv);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export { createProgram, run };
|