@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.
Files changed (239) hide show
  1. package/README.md +89 -581
  2. package/bin/inject-claude-settings.mjs +4 -0
  3. package/dist/claude-hashes.json +20 -0
  4. package/dist/commands/index.d.ts +1 -112
  5. package/dist/commands/runCli/index.d.ts +2 -0
  6. package/dist/commands/runCli/runCli.cjs +53 -0
  7. package/dist/commands/runCli/runCli.d.ts +14 -0
  8. package/dist/commands/runCli/runCli.mjs +51 -0
  9. package/dist/commands/runCli/type.d.ts +19 -0
  10. package/dist/commands/runCli/utils/classifyTarget.cjs +48 -0
  11. package/dist/commands/runCli/utils/classifyTarget.d.ts +19 -0
  12. package/dist/commands/runCli/utils/classifyTarget.mjs +46 -0
  13. package/dist/commands/runCli/utils/injectOne.cjs +47 -0
  14. package/dist/commands/runCli/utils/injectOne.d.ts +3 -0
  15. package/dist/commands/runCli/utils/injectOne.mjs +45 -0
  16. package/dist/commands/runCli/utils/resolvePackage.cjs +77 -0
  17. package/dist/commands/runCli/utils/resolvePackage.d.ts +16 -0
  18. package/dist/commands/runCli/utils/resolvePackage.mjs +74 -0
  19. package/dist/commands/runCli/utils/resolveScopeAlias.cjs +69 -0
  20. package/dist/commands/runCli/utils/resolveScopeAlias.d.ts +2 -0
  21. package/dist/commands/runCli/utils/resolveScopeAlias.mjs +67 -0
  22. package/dist/commands/runCli/utils/resolveScopeFlag.cjs +28 -0
  23. package/dist/commands/runCli/utils/resolveScopeFlag.d.ts +2 -0
  24. package/dist/commands/runCli/utils/resolveScopeFlag.mjs +26 -0
  25. package/dist/commands/runCli/utils/resolveTargets.cjs +40 -0
  26. package/dist/commands/runCli/utils/resolveTargets.d.ts +15 -0
  27. package/dist/commands/runCli/utils/resolveTargets.mjs +38 -0
  28. package/dist/commands/runCli/utils/runInject.cjs +52 -0
  29. package/dist/commands/runCli/utils/runInject.d.ts +3 -0
  30. package/dist/commands/runCli/utils/runInject.mjs +50 -0
  31. package/dist/core/buildPlan/buildPlan.cjs +42 -0
  32. package/dist/core/buildPlan/buildPlan.d.ts +2 -0
  33. package/dist/core/buildPlan/buildPlan.mjs +40 -0
  34. package/dist/core/buildPlan/index.d.ts +2 -0
  35. package/dist/core/buildPlan/type.d.ts +32 -0
  36. package/dist/core/buildPlan/utils/toPosix.cjs +9 -0
  37. package/dist/core/buildPlan/utils/toPosix.d.ts +1 -0
  38. package/dist/core/buildPlan/utils/toPosix.mjs +7 -0
  39. package/dist/core/buildPlan/utils/walkFiles.cjs +25 -0
  40. package/dist/core/buildPlan/utils/walkFiles.d.ts +1 -0
  41. package/dist/core/buildPlan/utils/walkFiles.mjs +23 -0
  42. package/dist/core/hash/hash.cjs +30 -0
  43. package/dist/core/hash/hash.d.ts +4 -0
  44. package/dist/core/hash/hash.mjs +26 -0
  45. package/dist/core/hash/index.d.ts +1 -0
  46. package/dist/core/hashManifest/hashManifest.cjs +27 -0
  47. package/dist/core/hashManifest/hashManifest.d.ts +17 -0
  48. package/dist/core/hashManifest/hashManifest.mjs +23 -0
  49. package/dist/core/hashManifest/index.d.ts +1 -0
  50. package/dist/core/index.d.ts +5 -0
  51. package/dist/core/injectDocs/index.d.ts +2 -0
  52. package/dist/core/injectDocs/injectDocs.cjs +43 -0
  53. package/dist/core/injectDocs/injectDocs.d.ts +2 -0
  54. package/dist/core/injectDocs/injectDocs.mjs +41 -0
  55. package/dist/core/injectDocs/type.d.ts +30 -0
  56. package/dist/core/injectDocs/utils/applyAction.cjs +21 -0
  57. package/dist/core/injectDocs/utils/applyAction.d.ts +2 -0
  58. package/dist/core/injectDocs/utils/applyAction.mjs +19 -0
  59. package/dist/core/injectDocs/utils/emitCiForceList.cjs +10 -0
  60. package/dist/core/injectDocs/utils/emitCiForceList.d.ts +2 -0
  61. package/dist/core/injectDocs/utils/emitCiForceList.mjs +8 -0
  62. package/dist/core/injectDocs/utils/printPlan.cjs +20 -0
  63. package/dist/core/injectDocs/utils/printPlan.d.ts +2 -0
  64. package/dist/core/injectDocs/utils/printPlan.mjs +18 -0
  65. package/dist/core/injectDocs/utils/summarize.cjs +27 -0
  66. package/dist/core/injectDocs/utils/summarize.d.ts +3 -0
  67. package/dist/core/injectDocs/utils/summarize.mjs +25 -0
  68. package/dist/core/scope/index.d.ts +1 -0
  69. package/dist/core/scope/scope.cjs +46 -0
  70. package/dist/core/scope/scope.d.ts +16 -0
  71. package/dist/core/scope/scope.mjs +41 -0
  72. package/dist/core/scope/utils/isDirectory.cjs +14 -0
  73. package/dist/core/scope/utils/isDirectory.d.ts +1 -0
  74. package/dist/core/scope/utils/isDirectory.mjs +12 -0
  75. package/dist/index.cjs +15 -9
  76. package/dist/index.d.ts +3 -5
  77. package/dist/index.mjs +7 -3
  78. package/dist/prompts/confirmForce.cjs +27 -0
  79. package/dist/prompts/confirmForce.d.ts +1 -0
  80. package/dist/prompts/confirmForce.mjs +25 -0
  81. package/dist/prompts/index.d.ts +2 -0
  82. package/dist/prompts/selectScope.cjs +30 -0
  83. package/dist/prompts/selectScope.d.ts +2 -0
  84. package/dist/prompts/selectScope.mjs +28 -0
  85. package/dist/utils/heartbeat.cjs +25 -0
  86. package/dist/utils/heartbeat.d.ts +16 -0
  87. package/dist/utils/heartbeat.mjs +23 -0
  88. package/dist/utils/logger.cjs +7 -0
  89. package/dist/utils/logger.d.ts +8 -0
  90. package/dist/utils/logger.mjs +7 -0
  91. package/dist/utils/types.d.ts +1 -252
  92. package/dist/utils/version.cjs +2 -14
  93. package/dist/utils/version.d.ts +3 -53
  94. package/dist/utils/version.mjs +2 -13
  95. package/docs/bundle-size-decision.md +36 -0
  96. package/docs/claude/skills/claude-docs-asset-wiring/SKILL.md +159 -0
  97. package/docs/claude/skills/claude-docs-asset-wiring/knowledge/claude-md-template.md +86 -0
  98. package/docs/claude/skills/claude-docs-asset-wiring/knowledge/dependency-cruiser.md +54 -0
  99. package/docs/claude/skills/claude-docs-asset-wiring/knowledge/gotchas.md +122 -0
  100. package/docs/claude/skills/claude-docs-asset-wiring/knowledge/package-json-patches.md +145 -0
  101. package/docs/claude/skills/claude-docs-asset-wiring/knowledge/reference-files.md +37 -0
  102. package/docs/claude/skills/claude-docs-asset-wiring/knowledge/smoke-tests.md +111 -0
  103. package/docs/consumer-integration.md +94 -0
  104. package/package.json +24 -16
  105. package/scripts/build-hashes.mjs +30 -0
  106. package/scripts/buildHashes.d.mts +15 -0
  107. package/scripts/buildHashes.mjs +82 -0
  108. package/scripts/claude-build-hashes.mjs +42 -0
  109. package/scripts/inject-version.js +112 -0
  110. package/dist/cli.cjs +0 -8
  111. package/dist/cli.d.ts +0 -1
  112. package/dist/cli.mjs +0 -7
  113. package/dist/commands/add.cjs +0 -80
  114. package/dist/commands/add.d.ts +0 -8
  115. package/dist/commands/add.mjs +0 -78
  116. package/dist/commands/list.cjs +0 -94
  117. package/dist/commands/list.d.ts +0 -15
  118. package/dist/commands/list.mjs +0 -91
  119. package/dist/commands/migrate.cjs +0 -9
  120. package/dist/commands/migrate.d.ts +0 -6
  121. package/dist/commands/migrate.mjs +0 -7
  122. package/dist/commands/remove.cjs +0 -127
  123. package/dist/commands/remove.d.ts +0 -6
  124. package/dist/commands/remove.mjs +0 -105
  125. package/dist/commands/status.cjs +0 -193
  126. package/dist/commands/status.d.ts +0 -6
  127. package/dist/commands/status.mjs +0 -171
  128. package/dist/commands/sync.cjs +0 -28
  129. package/dist/commands/sync.d.ts +0 -6
  130. package/dist/commands/sync.mjs +0 -26
  131. package/dist/commands/types.d.ts +0 -89
  132. package/dist/commands/update.cjs +0 -209
  133. package/dist/commands/update.d.ts +0 -29
  134. package/dist/commands/update.mjs +0 -206
  135. package/dist/components/add/AddCommand.cjs +0 -103
  136. package/dist/components/add/AddCommand.d.ts +0 -14
  137. package/dist/components/add/AddCommand.mjs +0 -101
  138. package/dist/components/add/BulkAddView.cjs +0 -165
  139. package/dist/components/add/BulkAddView.d.ts +0 -11
  140. package/dist/components/add/BulkAddView.mjs +0 -163
  141. package/dist/components/add/index.d.ts +0 -2
  142. package/dist/components/index.d.ts +0 -2
  143. package/dist/components/list/EditableTreeItem.d.ts +0 -13
  144. package/dist/components/list/ListCommand.cjs +0 -651
  145. package/dist/components/list/ListCommand.d.ts +0 -5
  146. package/dist/components/list/ListCommand.mjs +0 -649
  147. package/dist/components/list/SyncedPackageTree.d.ts +0 -14
  148. package/dist/components/list/index.d.ts +0 -10
  149. package/dist/components/list/types.d.ts +0 -14
  150. package/dist/components/primitives/Box.d.ts +0 -4
  151. package/dist/components/primitives/Spinner.d.ts +0 -6
  152. package/dist/components/primitives/Text.d.ts +0 -4
  153. package/dist/components/primitives/index.d.ts +0 -3
  154. package/dist/components/remove/RemoveConfirm.cjs +0 -18
  155. package/dist/components/remove/RemoveConfirm.d.ts +0 -11
  156. package/dist/components/remove/RemoveConfirm.mjs +0 -16
  157. package/dist/components/shared/Confirm.cjs +0 -30
  158. package/dist/components/shared/Confirm.d.ts +0 -8
  159. package/dist/components/shared/Confirm.mjs +0 -28
  160. package/dist/components/shared/MenuItem.cjs +0 -18
  161. package/dist/components/shared/MenuItem.d.ts +0 -7
  162. package/dist/components/shared/MenuItem.mjs +0 -16
  163. package/dist/components/shared/ProgressBar.d.ts +0 -7
  164. package/dist/components/shared/StepRunner.cjs +0 -58
  165. package/dist/components/shared/StepRunner.d.ts +0 -15
  166. package/dist/components/shared/StepRunner.mjs +0 -56
  167. package/dist/components/shared/Table.cjs +0 -19
  168. package/dist/components/shared/Table.d.ts +0 -8
  169. package/dist/components/shared/Table.mjs +0 -17
  170. package/dist/components/shared/index.d.ts +0 -6
  171. package/dist/components/status/PackageStatusCard.d.ts +0 -10
  172. package/dist/components/status/StatusDisplay.cjs +0 -26
  173. package/dist/components/status/StatusDisplay.d.ts +0 -23
  174. package/dist/components/status/StatusDisplay.mjs +0 -24
  175. package/dist/components/status/StatusTreeNode.cjs +0 -40
  176. package/dist/components/status/StatusTreeNode.d.ts +0 -15
  177. package/dist/components/status/StatusTreeNode.mjs +0 -38
  178. package/dist/components/status/index.d.ts +0 -6
  179. package/dist/components/tree/AssetTreeNode.cjs +0 -54
  180. package/dist/components/tree/AssetTreeNode.d.ts +0 -12
  181. package/dist/components/tree/AssetTreeNode.mjs +0 -52
  182. package/dist/components/tree/TreeSelect.cjs +0 -129
  183. package/dist/components/tree/TreeSelect.d.ts +0 -12
  184. package/dist/components/tree/TreeSelect.mjs +0 -127
  185. package/dist/components/tree/index.d.ts +0 -4
  186. package/dist/core/assetStructure.cjs +0 -30
  187. package/dist/core/assetStructure.d.ts +0 -36
  188. package/dist/core/assetStructure.mjs +0 -27
  189. package/dist/core/cli.cjs +0 -106
  190. package/dist/core/cli.d.ts +0 -9
  191. package/dist/core/cli.mjs +0 -103
  192. package/dist/core/constants.cjs +0 -28
  193. package/dist/core/constants.d.ts +0 -94
  194. package/dist/core/constants.mjs +0 -21
  195. package/dist/core/filesystem.cjs +0 -98
  196. package/dist/core/filesystem.d.ts +0 -94
  197. package/dist/core/filesystem.mjs +0 -88
  198. package/dist/core/github.cjs +0 -115
  199. package/dist/core/github.d.ts +0 -61
  200. package/dist/core/github.mjs +0 -107
  201. package/dist/core/io.cjs +0 -46
  202. package/dist/core/io.d.ts +0 -40
  203. package/dist/core/io.mjs +0 -39
  204. package/dist/core/listOperations.cjs +0 -228
  205. package/dist/core/listOperations.d.ts +0 -43
  206. package/dist/core/listOperations.mjs +0 -205
  207. package/dist/core/localSource.cjs +0 -126
  208. package/dist/core/localSource.d.ts +0 -33
  209. package/dist/core/localSource.mjs +0 -120
  210. package/dist/core/migration.cjs +0 -201
  211. package/dist/core/migration.d.ts +0 -57
  212. package/dist/core/migration.mjs +0 -198
  213. package/dist/core/packageScanner.cjs +0 -360
  214. package/dist/core/packageScanner.d.ts +0 -22
  215. package/dist/core/packageScanner.mjs +0 -356
  216. package/dist/core/sync.cjs +0 -400
  217. package/dist/core/sync.d.ts +0 -21
  218. package/dist/core/sync.mjs +0 -397
  219. package/dist/core/syncMeta.cjs +0 -242
  220. package/dist/core/syncMeta.d.ts +0 -75
  221. package/dist/core/syncMeta.mjs +0 -229
  222. package/dist/utils/dependencies.cjs +0 -57
  223. package/dist/utils/dependencies.d.ts +0 -10
  224. package/dist/utils/dependencies.mjs +0 -34
  225. package/dist/utils/nameTransform.cjs +0 -13
  226. package/dist/utils/nameTransform.d.ts +0 -65
  227. package/dist/utils/nameTransform.mjs +0 -11
  228. package/dist/utils/package.cjs +0 -170
  229. package/dist/utils/package.d.ts +0 -105
  230. package/dist/utils/package.mjs +0 -157
  231. package/dist/utils/packageName.cjs +0 -24
  232. package/dist/utils/packageName.d.ts +0 -32
  233. package/dist/utils/packageName.mjs +0 -21
  234. package/dist/utils/paths.cjs +0 -18
  235. package/dist/utils/paths.d.ts +0 -55
  236. package/dist/utils/paths.mjs +0 -15
  237. package/dist/version.cjs +0 -5
  238. package/dist/version.d.ts +0 -5
  239. package/dist/version.mjs +0 -3
@@ -1,8 +0,0 @@
1
- import type { AddCommandOptions } from '../commands/types.js';
2
- /**
3
- * Run the add command with interactive asset selection or bulk pattern mode
4
- *
5
- * @param options - Add command options
6
- * @param cwd - Current working directory
7
- */
8
- export declare function runAddCommand(options: AddCommandOptions, cwd?: string): Promise<void>;
@@ -1,78 +0,0 @@
1
- import { render } from 'ink';
2
- import React from 'react';
3
- import { AddCommand } from '../components/add/AddCommand.mjs';
4
- import { BulkAddView } from '../components/add/BulkAddView.mjs';
5
- import { syncPackage } from '../core/sync.mjs';
6
-
7
- async function runAddCommand(options, cwd) {
8
- const workingDir = process.cwd();
9
- if (options.pattern) {
10
- try {
11
- new RegExp(options.pattern);
12
- }
13
- catch (err) {
14
- const msg = err instanceof Error ? err.message : String(err);
15
- throw new Error(`Invalid regex pattern "${options.pattern}": ${msg}`);
16
- }
17
- const { waitUntilExit } = render(React.createElement(BulkAddView, {
18
- pattern: options.pattern,
19
- cwd: workingDir,
20
- local: options.local ?? false,
21
- ref: options.ref,
22
- }));
23
- await waitUntilExit();
24
- return;
25
- }
26
- if (!options.package) {
27
- console.error('Error: either --package or --pattern must be provided');
28
- console.error(' Usage: claude-assets-sync add -p <name>');
29
- console.error(' claude-assets-sync add --pattern <regex>');
30
- process.exit(1);
31
- }
32
- return new Promise((resolve, reject) => {
33
- const { waitUntilExit } = render(React.createElement(AddCommand, {
34
- packageName: options.package,
35
- local: options.local ?? false,
36
- ref: options.ref,
37
- onComplete: async (selection) => {
38
- try {
39
- await performSync(selection, workingDir);
40
- resolve();
41
- }
42
- catch (error) {
43
- reject(error);
44
- }
45
- },
46
- onError: (error) => {
47
- reject(error);
48
- },
49
- onCancel: () => {
50
- console.log('\nSync cancelled');
51
- resolve();
52
- },
53
- }));
54
- waitUntilExit().catch(reject);
55
- });
56
- }
57
- async function performSync(selection, cwd) {
58
- const exclusions = {
59
- directories: [],
60
- files: [],
61
- };
62
- for (const assetType of Object.keys(selection.excludedAssets)) {
63
- for (const excludedPath of selection.excludedAssets[assetType]) {
64
- exclusions.files.push(excludedPath);
65
- }
66
- }
67
- await syncPackage(selection.packageName, {
68
- force: true,
69
- dryRun: false,
70
- local: selection.source === 'local',
71
- ref: selection.ref,
72
- flat: true,
73
- }, cwd, exclusions.directories.length > 0 || exclusions.files.length > 0
74
- ? exclusions
75
- : undefined, undefined);
76
- }
77
-
78
- export { runAddCommand };
@@ -1,94 +0,0 @@
1
- 'use strict';
2
-
3
- var ink = require('ink');
4
- var pc = require('picocolors');
5
- var React = require('react');
6
- var ListCommand = require('../components/list/ListCommand.cjs');
7
- var syncMeta = require('../core/syncMeta.cjs');
8
- var logger = require('../utils/logger.cjs');
9
- var _package = require('../utils/package.cjs');
10
-
11
- function isTTY() {
12
- return process.stdout.isTTY === true && process.stdin.isTTY === true;
13
- }
14
- const runListCommand = async (options, cwd = process.cwd()) => {
15
- const destDir = _package.findGitRoot(cwd) ?? cwd;
16
- const meta = syncMeta.readUnifiedSyncMeta(destDir);
17
- if (!meta || Object.keys(meta.packages).length === 0) {
18
- if (options.json) {
19
- console.log(JSON.stringify([], null, 2));
20
- }
21
- else {
22
- logger.logger.info('No packages synced yet.');
23
- }
24
- return;
25
- }
26
- if (options.json) {
27
- const packages = [];
28
- for (const [, packageInfo] of Object.entries(meta.packages)) {
29
- const assets = {};
30
- let totalCount = 0;
31
- for (const [assetType, files] of Object.entries(packageInfo.files)) {
32
- const count = Array.isArray(files) ? files.length : 0;
33
- assets[assetType] = count;
34
- totalCount += count;
35
- }
36
- packages.push({
37
- name: packageInfo.originalName,
38
- version: packageInfo.version,
39
- syncedAt: meta.syncedAt,
40
- assetCount: totalCount,
41
- assets,
42
- });
43
- }
44
- packages.sort((a, b) => a.name.localeCompare(b.name));
45
- console.log(JSON.stringify(packages, null, 2));
46
- return;
47
- }
48
- if (isTTY()) {
49
- const { waitUntilExit } = ink.render(React.createElement(ListCommand.ListCommand, { cwd: destDir }));
50
- await waitUntilExit();
51
- return;
52
- }
53
- const packages = [];
54
- for (const [, packageInfo] of Object.entries(meta.packages)) {
55
- const assets = {};
56
- let totalCount = 0;
57
- for (const [assetType, files] of Object.entries(packageInfo.files)) {
58
- const count = Array.isArray(files) ? files.length : 0;
59
- assets[assetType] = count;
60
- totalCount += count;
61
- }
62
- packages.push({
63
- name: packageInfo.originalName,
64
- version: packageInfo.version,
65
- syncedAt: meta.syncedAt,
66
- assetCount: totalCount,
67
- assets,
68
- });
69
- }
70
- packages.sort((a, b) => a.name.localeCompare(b.name));
71
- console.log(pc.bold('\nSynced Packages:\n'));
72
- for (const pkg of packages) {
73
- console.log(pc.cyan(` ${pkg.name}@${pkg.version}`));
74
- console.log(` Synced: ${new Date(pkg.syncedAt).toLocaleString()}`);
75
- console.log(` Assets: ${pkg.assetCount} files`);
76
- const assetBreakdown = Object.entries(pkg.assets)
77
- .map(([type, count]) => `${count} ${type}`)
78
- .join(', ');
79
- console.log(` Types: ${assetBreakdown}`);
80
- console.log('');
81
- }
82
- };
83
- function registerListCommand(program) {
84
- program
85
- .command('list')
86
- .description('List all synced packages')
87
- .option('--json', 'Output as JSON')
88
- .action(async (opts) => {
89
- await runListCommand({ json: opts.json });
90
- });
91
- }
92
-
93
- exports.registerListCommand = registerListCommand;
94
- exports.runListCommand = runListCommand;
@@ -1,15 +0,0 @@
1
- /**
2
- * List command - list all synced packages
3
- */
4
- import type { Command } from 'commander';
5
- import type { ListCommandOptions } from './types.js';
6
- /**
7
- * Run the list command
8
- * @param options - List command options
9
- */
10
- declare const runListCommand: (options: ListCommandOptions, cwd?: string) => Promise<void>;
11
- /**
12
- * Register the list command with the CLI program
13
- */
14
- export declare function registerListCommand(program: Command): void;
15
- export { runListCommand };
@@ -1,91 +0,0 @@
1
- import { render } from 'ink';
2
- import pc from 'picocolors';
3
- import React from 'react';
4
- import { ListCommand } from '../components/list/ListCommand.mjs';
5
- import { readUnifiedSyncMeta } from '../core/syncMeta.mjs';
6
- import { logger } from '../utils/logger.mjs';
7
- import { findGitRoot } from '../utils/package.mjs';
8
-
9
- function isTTY() {
10
- return process.stdout.isTTY === true && process.stdin.isTTY === true;
11
- }
12
- const runListCommand = async (options, cwd = process.cwd()) => {
13
- const destDir = findGitRoot(cwd) ?? cwd;
14
- const meta = readUnifiedSyncMeta(destDir);
15
- if (!meta || Object.keys(meta.packages).length === 0) {
16
- if (options.json) {
17
- console.log(JSON.stringify([], null, 2));
18
- }
19
- else {
20
- logger.info('No packages synced yet.');
21
- }
22
- return;
23
- }
24
- if (options.json) {
25
- const packages = [];
26
- for (const [, packageInfo] of Object.entries(meta.packages)) {
27
- const assets = {};
28
- let totalCount = 0;
29
- for (const [assetType, files] of Object.entries(packageInfo.files)) {
30
- const count = Array.isArray(files) ? files.length : 0;
31
- assets[assetType] = count;
32
- totalCount += count;
33
- }
34
- packages.push({
35
- name: packageInfo.originalName,
36
- version: packageInfo.version,
37
- syncedAt: meta.syncedAt,
38
- assetCount: totalCount,
39
- assets,
40
- });
41
- }
42
- packages.sort((a, b) => a.name.localeCompare(b.name));
43
- console.log(JSON.stringify(packages, null, 2));
44
- return;
45
- }
46
- if (isTTY()) {
47
- const { waitUntilExit } = render(React.createElement(ListCommand, { cwd: destDir }));
48
- await waitUntilExit();
49
- return;
50
- }
51
- const packages = [];
52
- for (const [, packageInfo] of Object.entries(meta.packages)) {
53
- const assets = {};
54
- let totalCount = 0;
55
- for (const [assetType, files] of Object.entries(packageInfo.files)) {
56
- const count = Array.isArray(files) ? files.length : 0;
57
- assets[assetType] = count;
58
- totalCount += count;
59
- }
60
- packages.push({
61
- name: packageInfo.originalName,
62
- version: packageInfo.version,
63
- syncedAt: meta.syncedAt,
64
- assetCount: totalCount,
65
- assets,
66
- });
67
- }
68
- packages.sort((a, b) => a.name.localeCompare(b.name));
69
- console.log(pc.bold('\nSynced Packages:\n'));
70
- for (const pkg of packages) {
71
- console.log(pc.cyan(` ${pkg.name}@${pkg.version}`));
72
- console.log(` Synced: ${new Date(pkg.syncedAt).toLocaleString()}`);
73
- console.log(` Assets: ${pkg.assetCount} files`);
74
- const assetBreakdown = Object.entries(pkg.assets)
75
- .map(([type, count]) => `${count} ${type}`)
76
- .join(', ');
77
- console.log(` Types: ${assetBreakdown}`);
78
- console.log('');
79
- }
80
- };
81
- function registerListCommand(program) {
82
- program
83
- .command('list')
84
- .description('List all synced packages')
85
- .option('--json', 'Output as JSON')
86
- .action(async (opts) => {
87
- await runListCommand({ json: opts.json });
88
- });
89
- }
90
-
91
- export { registerListCommand, runListCommand };
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- var migration = require('../core/migration.cjs');
4
-
5
- const runMigrateCommand = async (options, cwd = process.cwd()) => {
6
- await migration.migrateToFlat(cwd, { dryRun: options.dryRun });
7
- };
8
-
9
- exports.runMigrateCommand = runMigrateCommand;
@@ -1,6 +0,0 @@
1
- import type { MigrateCommandOptions } from './types.js';
2
- /**
3
- * Run the migrate command
4
- * @param options - Migration options
5
- */
6
- export declare const runMigrateCommand: (options: MigrateCommandOptions, cwd?: string) => Promise<void>;
@@ -1,7 +0,0 @@
1
- import { migrateToFlat } from '../core/migration.mjs';
2
-
3
- const runMigrateCommand = async (options, cwd = process.cwd()) => {
4
- await migrateToFlat(cwd, { dryRun: options.dryRun });
5
- };
6
-
7
- export { runMigrateCommand };
@@ -1,127 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('node:fs');
4
- var path = require('node:path');
5
- var ink = require('ink');
6
- var pc = require('picocolors');
7
- var React = require('react');
8
- var RemoveConfirm = require('../components/remove/RemoveConfirm.cjs');
9
- var syncMeta = require('../core/syncMeta.cjs');
10
- var logger = require('../utils/logger.cjs');
11
- var packageName = require('../utils/packageName.cjs');
12
-
13
- function _interopNamespaceDefault(e) {
14
- var n = Object.create(null);
15
- if (e) {
16
- Object.keys(e).forEach(function (k) {
17
- if (k !== 'default') {
18
- var d = Object.getOwnPropertyDescriptor(e, k);
19
- Object.defineProperty(n, k, d.get ? d : {
20
- enumerable: true,
21
- get: function () { return e[k]; }
22
- });
23
- }
24
- });
25
- }
26
- n.default = e;
27
- return Object.freeze(n);
28
- }
29
-
30
- var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
31
- var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
32
-
33
- function isTTY() {
34
- return process.stdout.isTTY === true && process.stdin.isTTY === true;
35
- }
36
- function performRemoval(filesToRemove, meta, prefix, packageName, cwd) {
37
- for (const { path: filePath } of filesToRemove) {
38
- try {
39
- const stat = fs__namespace.statSync(filePath);
40
- if (stat.isDirectory()) {
41
- fs__namespace.rmSync(filePath, { recursive: true, force: true });
42
- console.log(`${pc.red('-')} ${filePath}`);
43
- }
44
- else {
45
- fs__namespace.unlinkSync(filePath);
46
- console.log(`${pc.red('-')} ${filePath}`);
47
- }
48
- }
49
- catch (error) {
50
- if (error.code !== 'ENOENT') {
51
- logger.logger.error(`Failed to remove ${filePath}: ${error}`);
52
- }
53
- }
54
- }
55
- if (meta) {
56
- delete meta.packages[prefix];
57
- meta.syncedAt = new Date().toISOString();
58
- syncMeta.writeUnifiedSyncMeta(cwd, meta);
59
- }
60
- logger.logger.success(`\nRemoved package ${packageName}`);
61
- }
62
- const runRemoveCommand = async (options, cwd = process.cwd()) => {
63
- const { package: packageName$1, yes, dryRun } = options;
64
- const prefix = packageName.packageNameToPrefix(packageName$1);
65
- const meta = syncMeta.readUnifiedSyncMeta(cwd);
66
- if (!meta || !meta.packages || !meta.packages[prefix]) {
67
- logger.logger.error(`Package ${packageName$1} is not synced.`);
68
- process.exit(1);
69
- return;
70
- }
71
- const packageInfo = meta.packages[prefix];
72
- if (!packageInfo || !packageInfo.files) {
73
- logger.logger.error(`Package ${packageName$1} has no files to remove.`);
74
- process.exit(1);
75
- return;
76
- }
77
- const filesToRemove = [];
78
- for (const [assetType, files] of Object.entries(packageInfo.files)) {
79
- if (!Array.isArray(files) || files.length === 0)
80
- continue;
81
- const units = files;
82
- const firstUnit = units[0];
83
- if (firstUnit.transformed) {
84
- for (const unit of units) {
85
- const targetPath = path__namespace.join(cwd, '.claude', assetType, unit.transformed);
86
- filesToRemove.push({ assetType, path: targetPath });
87
- }
88
- }
89
- else {
90
- const dirPath = path__namespace.join(cwd, '.claude', assetType, packageName$1);
91
- filesToRemove.push({ assetType, path: dirPath });
92
- }
93
- }
94
- console.log(pc.bold('\nFiles to remove:\n'));
95
- for (const { assetType, path: filePath } of filesToRemove) {
96
- console.log(` ${pc.red('-')} ${assetType}: ${filePath}`);
97
- }
98
- console.log('');
99
- if (dryRun) {
100
- logger.logger.info('[DRY RUN] No changes made.');
101
- return;
102
- }
103
- if (!yes) {
104
- if (isTTY()) {
105
- let confirmed = false;
106
- const { waitUntilExit } = ink.render(React.createElement(RemoveConfirm.RemoveConfirm, {
107
- packageName: packageName$1,
108
- filesToRemove,
109
- onConfirm: (result) => {
110
- confirmed = result;
111
- },
112
- }));
113
- await waitUntilExit();
114
- if (!confirmed) {
115
- logger.logger.info('Cancelled.');
116
- return;
117
- }
118
- }
119
- else {
120
- logger.logger.info('Cancelled (non-interactive terminal).');
121
- return;
122
- }
123
- }
124
- performRemoval(filesToRemove, meta, prefix, packageName$1, cwd);
125
- };
126
-
127
- exports.runRemoveCommand = runRemoveCommand;
@@ -1,6 +0,0 @@
1
- import type { RemoveCommandOptions } from './types.js';
2
- /**
3
- * Run the remove command
4
- * @param options - Remove command options
5
- */
6
- export declare const runRemoveCommand: (options: RemoveCommandOptions, cwd?: string) => Promise<void>;
@@ -1,105 +0,0 @@
1
- import * as fs from 'node:fs';
2
- import * as path from 'node:path';
3
- import { render } from 'ink';
4
- import pc from 'picocolors';
5
- import React from 'react';
6
- import { RemoveConfirm } from '../components/remove/RemoveConfirm.mjs';
7
- import { readUnifiedSyncMeta, writeUnifiedSyncMeta } from '../core/syncMeta.mjs';
8
- import { logger } from '../utils/logger.mjs';
9
- import { packageNameToPrefix } from '../utils/packageName.mjs';
10
-
11
- function isTTY() {
12
- return process.stdout.isTTY === true && process.stdin.isTTY === true;
13
- }
14
- function performRemoval(filesToRemove, meta, prefix, packageName, cwd) {
15
- for (const { path: filePath } of filesToRemove) {
16
- try {
17
- const stat = fs.statSync(filePath);
18
- if (stat.isDirectory()) {
19
- fs.rmSync(filePath, { recursive: true, force: true });
20
- console.log(`${pc.red('-')} ${filePath}`);
21
- }
22
- else {
23
- fs.unlinkSync(filePath);
24
- console.log(`${pc.red('-')} ${filePath}`);
25
- }
26
- }
27
- catch (error) {
28
- if (error.code !== 'ENOENT') {
29
- logger.error(`Failed to remove ${filePath}: ${error}`);
30
- }
31
- }
32
- }
33
- if (meta) {
34
- delete meta.packages[prefix];
35
- meta.syncedAt = new Date().toISOString();
36
- writeUnifiedSyncMeta(cwd, meta);
37
- }
38
- logger.success(`\nRemoved package ${packageName}`);
39
- }
40
- const runRemoveCommand = async (options, cwd = process.cwd()) => {
41
- const { package: packageName, yes, dryRun } = options;
42
- const prefix = packageNameToPrefix(packageName);
43
- const meta = readUnifiedSyncMeta(cwd);
44
- if (!meta || !meta.packages || !meta.packages[prefix]) {
45
- logger.error(`Package ${packageName} is not synced.`);
46
- process.exit(1);
47
- return;
48
- }
49
- const packageInfo = meta.packages[prefix];
50
- if (!packageInfo || !packageInfo.files) {
51
- logger.error(`Package ${packageName} has no files to remove.`);
52
- process.exit(1);
53
- return;
54
- }
55
- const filesToRemove = [];
56
- for (const [assetType, files] of Object.entries(packageInfo.files)) {
57
- if (!Array.isArray(files) || files.length === 0)
58
- continue;
59
- const units = files;
60
- const firstUnit = units[0];
61
- if (firstUnit.transformed) {
62
- for (const unit of units) {
63
- const targetPath = path.join(cwd, '.claude', assetType, unit.transformed);
64
- filesToRemove.push({ assetType, path: targetPath });
65
- }
66
- }
67
- else {
68
- const dirPath = path.join(cwd, '.claude', assetType, packageName);
69
- filesToRemove.push({ assetType, path: dirPath });
70
- }
71
- }
72
- console.log(pc.bold('\nFiles to remove:\n'));
73
- for (const { assetType, path: filePath } of filesToRemove) {
74
- console.log(` ${pc.red('-')} ${assetType}: ${filePath}`);
75
- }
76
- console.log('');
77
- if (dryRun) {
78
- logger.info('[DRY RUN] No changes made.');
79
- return;
80
- }
81
- if (!yes) {
82
- if (isTTY()) {
83
- let confirmed = false;
84
- const { waitUntilExit } = render(React.createElement(RemoveConfirm, {
85
- packageName,
86
- filesToRemove,
87
- onConfirm: (result) => {
88
- confirmed = result;
89
- },
90
- }));
91
- await waitUntilExit();
92
- if (!confirmed) {
93
- logger.info('Cancelled.');
94
- return;
95
- }
96
- }
97
- else {
98
- logger.info('Cancelled (non-interactive terminal).');
99
- return;
100
- }
101
- }
102
- performRemoval(filesToRemove, meta, prefix, packageName, cwd);
103
- };
104
-
105
- export { runRemoveCommand };