@detergent-software/atk 3.0.0-dev.2 → 3.0.0-dev.21
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 +361 -0
- package/build/commands/audit.d.ts.map +1 -1
- package/build/commands/audit.js +79 -37
- package/build/commands/audit.js.map +1 -1
- package/build/commands/browse.d.ts.map +1 -1
- package/build/commands/browse.js +119 -154
- package/build/commands/browse.js.map +1 -1
- package/build/commands/cache.d.ts.map +1 -1
- package/build/commands/cache.js +13 -15
- package/build/commands/cache.js.map +1 -1
- package/build/commands/config.d.ts +1 -1
- package/build/commands/config.d.ts.map +1 -1
- package/build/commands/config.js +7 -3
- package/build/commands/config.js.map +1 -1
- package/build/commands/diff.d.ts.map +1 -1
- package/build/commands/diff.js +4 -117
- package/build/commands/diff.js.map +1 -1
- package/build/commands/freeze.d.ts +1 -2
- package/build/commands/freeze.d.ts.map +1 -1
- package/build/commands/freeze.js +17 -37
- package/build/commands/freeze.js.map +1 -1
- package/build/commands/info.d.ts +1 -2
- package/build/commands/info.d.ts.map +1 -1
- package/build/commands/info.js +36 -35
- package/build/commands/info.js.map +1 -1
- package/build/commands/init.d.ts.map +1 -1
- package/build/commands/init.js +39 -405
- package/build/commands/init.js.map +1 -1
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +49 -34
- package/build/commands/install.js.map +1 -1
- package/build/commands/list.d.ts +2 -2
- package/build/commands/list.d.ts.map +1 -1
- package/build/commands/list.js +138 -27
- package/build/commands/list.js.map +1 -1
- package/build/commands/outdated.d.ts.map +1 -1
- package/build/commands/outdated.js +20 -10
- package/build/commands/outdated.js.map +1 -1
- package/build/commands/pin.d.ts +1 -2
- package/build/commands/pin.d.ts.map +1 -1
- package/build/commands/pin.js +44 -47
- package/build/commands/pin.js.map +1 -1
- package/build/commands/prune.d.ts.map +1 -1
- package/build/commands/prune.js +76 -151
- package/build/commands/prune.js.map +1 -1
- package/build/commands/publish.d.ts +3 -1
- package/build/commands/publish.d.ts.map +1 -1
- package/build/commands/publish.js +67 -390
- package/build/commands/publish.js.map +1 -1
- package/build/commands/search.d.ts.map +1 -1
- package/build/commands/search.js +14 -19
- package/build/commands/search.js.map +1 -1
- package/build/commands/setup.d.ts +1 -1
- package/build/commands/setup.d.ts.map +1 -1
- package/build/commands/setup.js +48 -253
- package/build/commands/setup.js.map +1 -1
- package/build/commands/sync.d.ts.map +1 -1
- package/build/commands/sync.js +43 -169
- package/build/commands/sync.js.map +1 -1
- package/build/commands/thaw.d.ts +1 -2
- package/build/commands/thaw.d.ts.map +1 -1
- package/build/commands/thaw.js +19 -37
- package/build/commands/thaw.js.map +1 -1
- package/build/commands/uninstall.d.ts.map +1 -1
- package/build/commands/uninstall.js +106 -221
- package/build/commands/uninstall.js.map +1 -1
- package/build/commands/unpin.d.ts +1 -2
- package/build/commands/unpin.d.ts.map +1 -1
- package/build/commands/unpin.js +23 -38
- package/build/commands/unpin.js.map +1 -1
- package/build/commands/update.d.ts.map +1 -1
- package/build/commands/update.js +37 -25
- package/build/commands/update.js.map +1 -1
- package/build/commands/why.d.ts +1 -1
- package/build/commands/why.d.ts.map +1 -1
- package/build/commands/why.js +14 -6
- package/build/commands/why.js.map +1 -1
- package/build/components/AssetDetail.d.ts +1 -3
- package/build/components/AssetDetail.d.ts.map +1 -1
- package/build/components/AssetDetail.js +24 -21
- package/build/components/AssetDetail.js.map +1 -1
- package/build/components/AssetTable.d.ts +5 -2
- package/build/components/AssetTable.d.ts.map +1 -1
- package/build/components/AssetTable.js +37 -40
- package/build/components/AssetTable.js.map +1 -1
- package/build/components/BrowseExpandedBundle.d.ts +7 -0
- package/build/components/BrowseExpandedBundle.d.ts.map +1 -1
- package/build/components/BrowseExpandedBundle.js +19 -0
- package/build/components/BrowseExpandedBundle.js.map +1 -1
- package/build/components/BrowseExpandedRow.d.ts +4 -1
- package/build/components/BrowseExpandedRow.d.ts.map +1 -1
- package/build/components/BrowseExpandedRow.js +24 -3
- package/build/components/BrowseExpandedRow.js.map +1 -1
- package/build/components/BrowseList.d.ts +3 -1
- package/build/components/BrowseList.d.ts.map +1 -1
- package/build/components/BrowseList.js +52 -42
- package/build/components/BrowseList.js.map +1 -1
- package/build/components/DiffView.d.ts +0 -2
- package/build/components/DiffView.d.ts.map +1 -1
- package/build/components/DiffView.js +11 -5
- package/build/components/DiffView.js.map +1 -1
- package/build/components/DryRunBanner.d.ts +3 -3
- package/build/components/DryRunBanner.d.ts.map +1 -1
- package/build/components/DryRunBanner.js +2 -2
- package/build/components/DryRunBanner.js.map +1 -1
- package/build/components/FilterBar.d.ts +10 -3
- package/build/components/FilterBar.d.ts.map +1 -1
- package/build/components/FilterBar.js +4 -4
- package/build/components/FilterBar.js.map +1 -1
- package/build/components/FrozenSkippedHint.d.ts +11 -0
- package/build/components/FrozenSkippedHint.d.ts.map +1 -0
- package/build/components/FrozenSkippedHint.js +12 -0
- package/build/components/FrozenSkippedHint.js.map +1 -0
- package/build/components/HelpBar.d.ts.map +1 -1
- package/build/components/HelpBar.js +3 -3
- package/build/components/HelpBar.js.map +1 -1
- package/build/components/InitSuccess.d.ts +5 -0
- package/build/components/InitSuccess.d.ts.map +1 -0
- package/build/components/InitSuccess.js +20 -0
- package/build/components/InitSuccess.js.map +1 -0
- package/build/components/InstallSummary.d.ts +3 -3
- package/build/components/InstallSummary.d.ts.map +1 -1
- package/build/components/InstallSummary.js +2 -2
- package/build/components/InstallSummary.js.map +1 -1
- package/build/components/Link.d.ts +7 -0
- package/build/components/Link.d.ts.map +1 -0
- package/build/components/Link.js +6 -0
- package/build/components/Link.js.map +1 -0
- package/build/components/ListActionBar.d.ts +11 -0
- package/build/components/ListActionBar.d.ts.map +1 -0
- package/build/components/ListActionBar.js +30 -0
- package/build/components/ListActionBar.js.map +1 -0
- package/build/components/ListBrowseList.d.ts +27 -0
- package/build/components/ListBrowseList.d.ts.map +1 -0
- package/build/components/ListBrowseList.js +57 -0
- package/build/components/ListBrowseList.js.map +1 -0
- package/build/components/ListExpandedRow.d.ts +38 -0
- package/build/components/ListExpandedRow.d.ts.map +1 -0
- package/build/components/ListExpandedRow.js +46 -0
- package/build/components/ListExpandedRow.js.map +1 -0
- package/build/components/ListHelpBar.d.ts +19 -0
- package/build/components/ListHelpBar.d.ts.map +1 -0
- package/build/components/ListHelpBar.js +11 -0
- package/build/components/ListHelpBar.js.map +1 -0
- package/build/components/OrphanListItem.d.ts +15 -0
- package/build/components/OrphanListItem.d.ts.map +1 -0
- package/build/components/OrphanListItem.js +6 -0
- package/build/components/OrphanListItem.js.map +1 -0
- package/build/components/PromptField.d.ts +19 -0
- package/build/components/PromptField.d.ts.map +1 -0
- package/build/components/PromptField.js +7 -0
- package/build/components/PromptField.js.map +1 -0
- package/build/components/StatusBadge.d.ts +1 -1
- package/build/components/StatusBadge.d.ts.map +1 -1
- package/build/components/StatusBadge.js +4 -0
- package/build/components/StatusBadge.js.map +1 -1
- package/build/components/SyncAllInSync.d.ts +14 -0
- package/build/components/SyncAllInSync.d.ts.map +1 -0
- package/build/components/SyncAllInSync.js +10 -0
- package/build/components/SyncAllInSync.js.map +1 -0
- package/build/components/SyncDriftedList.d.ts +24 -0
- package/build/components/SyncDriftedList.d.ts.map +1 -0
- package/build/components/SyncDriftedList.js +17 -0
- package/build/components/SyncDriftedList.js.map +1 -0
- package/build/components/SyncNoAssets.d.ts +12 -0
- package/build/components/SyncNoAssets.d.ts.map +1 -0
- package/build/components/SyncNoAssets.js +9 -0
- package/build/components/SyncNoAssets.js.map +1 -0
- package/build/components/index.d.ts +14 -2
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +14 -2
- package/build/components/index.js.map +1 -1
- package/build/hooks/useBrowseState.d.ts +41 -1
- package/build/hooks/useBrowseState.d.ts.map +1 -1
- package/build/hooks/useBrowseState.js +142 -12
- package/build/hooks/useBrowseState.js.map +1 -1
- package/build/hooks/useConfirmation.d.ts +18 -0
- package/build/hooks/useConfirmation.d.ts.map +1 -0
- package/build/hooks/useConfirmation.js +56 -0
- package/build/hooks/useConfirmation.js.map +1 -0
- package/build/hooks/useInitState.d.ts +72 -0
- package/build/hooks/useInitState.d.ts.map +1 -0
- package/build/hooks/useInitState.js +372 -0
- package/build/hooks/useInitState.js.map +1 -0
- package/build/hooks/useListActions.d.ts +15 -0
- package/build/hooks/useListActions.d.ts.map +1 -0
- package/build/hooks/useListActions.js +155 -0
- package/build/hooks/useListActions.js.map +1 -0
- package/build/hooks/useListState.d.ts +151 -0
- package/build/hooks/useListState.d.ts.map +1 -0
- package/build/hooks/useListState.js +448 -0
- package/build/hooks/useListState.js.map +1 -0
- package/build/hooks/usePruneState.d.ts +76 -0
- package/build/hooks/usePruneState.d.ts.map +1 -0
- package/build/hooks/usePruneState.js +246 -0
- package/build/hooks/usePruneState.js.map +1 -0
- package/build/hooks/usePublishState.d.ts +115 -0
- package/build/hooks/usePublishState.d.ts.map +1 -0
- package/build/hooks/usePublishState.js +673 -0
- package/build/hooks/usePublishState.js.map +1 -0
- package/build/hooks/useSetupState.d.ts +57 -0
- package/build/hooks/useSetupState.d.ts.map +1 -0
- package/build/hooks/useSetupState.js +236 -0
- package/build/hooks/useSetupState.js.map +1 -0
- package/build/hooks/useUninstallState.d.ts +102 -0
- package/build/hooks/useUninstallState.d.ts.map +1 -0
- package/build/hooks/useUninstallState.js +342 -0
- package/build/hooks/useUninstallState.js.map +1 -0
- package/build/lib/adapter.d.ts +21 -0
- package/build/lib/adapter.d.ts.map +1 -1
- package/build/lib/adapter.js +59 -1
- package/build/lib/adapter.js.map +1 -1
- package/build/lib/checksum.d.ts +39 -0
- package/build/lib/checksum.d.ts.map +1 -1
- package/build/lib/checksum.js +101 -13
- package/build/lib/checksum.js.map +1 -1
- package/build/lib/config.d.ts +38 -18
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +107 -55
- package/build/lib/config.js.map +1 -1
- package/build/lib/detector.d.ts +2 -11
- package/build/lib/detector.d.ts.map +1 -1
- package/build/lib/detector.js +2 -64
- package/build/lib/detector.js.map +1 -1
- package/build/lib/diagnostics.d.ts +7 -0
- package/build/lib/diagnostics.d.ts.map +1 -1
- package/build/lib/diagnostics.js +54 -34
- package/build/lib/diagnostics.js.map +1 -1
- package/build/lib/diff-command.d.ts +40 -0
- package/build/lib/diff-command.d.ts.map +1 -0
- package/build/lib/diff-command.js +145 -0
- package/build/lib/diff-command.js.map +1 -0
- package/build/lib/diff.d.ts +7 -0
- package/build/lib/diff.d.ts.map +1 -1
- package/build/lib/diff.js +15 -10
- package/build/lib/diff.js.map +1 -1
- package/build/lib/format.d.ts +6 -0
- package/build/lib/format.d.ts.map +1 -0
- package/build/lib/format.js +18 -0
- package/build/lib/format.js.map +1 -0
- package/build/lib/github.d.ts +8 -0
- package/build/lib/github.d.ts.map +1 -1
- package/build/lib/github.js +9 -0
- package/build/lib/github.js.map +1 -1
- package/build/lib/gitignore.d.ts +17 -0
- package/build/lib/gitignore.d.ts.map +1 -1
- package/build/lib/gitignore.js +17 -1
- package/build/lib/gitignore.js.map +1 -1
- package/build/lib/installer.d.ts +1 -0
- package/build/lib/installer.d.ts.map +1 -1
- package/build/lib/installer.js +7 -7
- package/build/lib/installer.js.map +1 -1
- package/build/lib/lockfile.d.ts +19 -17
- package/build/lib/lockfile.d.ts.map +1 -1
- package/build/lib/lockfile.js +43 -67
- package/build/lib/lockfile.js.map +1 -1
- package/build/lib/publisher.d.ts +35 -0
- package/build/lib/publisher.d.ts.map +1 -1
- package/build/lib/publisher.js +210 -16
- package/build/lib/publisher.js.map +1 -1
- package/build/lib/registry.d.ts +20 -5
- package/build/lib/registry.d.ts.map +1 -1
- package/build/lib/registry.js +41 -30
- package/build/lib/registry.js.map +1 -1
- package/build/lib/schemas/config.d.ts +31 -3
- package/build/lib/schemas/config.d.ts.map +1 -1
- package/build/lib/schemas/config.js +21 -2
- package/build/lib/schemas/config.js.map +1 -1
- package/build/lib/schemas/index.d.ts +1 -1
- package/build/lib/schemas/index.d.ts.map +1 -1
- package/build/lib/schemas/index.js +1 -1
- package/build/lib/schemas/index.js.map +1 -1
- package/build/lib/schemas/lockfile.d.ts +18 -2
- package/build/lib/schemas/lockfile.d.ts.map +1 -1
- package/build/lib/schemas/lockfile.js +10 -1
- package/build/lib/schemas/lockfile.js.map +1 -1
- package/build/lib/search.d.ts +15 -1
- package/build/lib/search.d.ts.map +1 -1
- package/build/lib/search.js +65 -65
- package/build/lib/search.js.map +1 -1
- package/build/lib/setup.d.ts +28 -0
- package/build/lib/setup.d.ts.map +1 -0
- package/build/lib/setup.js +98 -0
- package/build/lib/setup.js.map +1 -0
- package/build/lib/sync.d.ts +109 -0
- package/build/lib/sync.d.ts.map +1 -0
- package/build/lib/sync.js +221 -0
- package/build/lib/sync.js.map +1 -0
- package/build/lib/tool-resolver.d.ts +29 -6
- package/build/lib/tool-resolver.d.ts.map +1 -1
- package/build/lib/tool-resolver.js +54 -15
- package/build/lib/tool-resolver.js.map +1 -1
- package/build/lib/updater.d.ts +7 -4
- package/build/lib/updater.d.ts.map +1 -1
- package/build/lib/updater.js +12 -7
- package/build/lib/updater.js.map +1 -1
- package/build/lib/version.js +1 -1
- package/build/lib/version.js.map +1 -1
- package/package.json +79 -65
- package/tool-adapters/claude-code.json +1 -1
- package/tool-adapters/copilot-cli.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { InstallResult } from './installer.js';
|
|
2
|
+
import type { Adapter } from './schemas/adapter.js';
|
|
3
|
+
import type { ProjectConfig } from './schemas/config.js';
|
|
4
|
+
import type { InstalledAsset } from './schemas/lockfile.js';
|
|
5
|
+
import type { Registry } from './schemas/registry.js';
|
|
6
|
+
export interface ClassifySyncEntriesOptions {
|
|
7
|
+
adapter: Adapter;
|
|
8
|
+
assets: InstalledAsset[];
|
|
9
|
+
force: boolean;
|
|
10
|
+
onProgress?: (msg: string) => void;
|
|
11
|
+
projectConfig: null | ProjectConfig;
|
|
12
|
+
projectDir: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ClassifySyncEntriesResult {
|
|
15
|
+
frozenSkipped: number;
|
|
16
|
+
skipped: number;
|
|
17
|
+
toSync: SyncEntry[];
|
|
18
|
+
}
|
|
19
|
+
export interface DryRunSyncOptions {
|
|
20
|
+
force: boolean;
|
|
21
|
+
onProgress?: (msg: string) => void;
|
|
22
|
+
projectConfig: null | ProjectConfig;
|
|
23
|
+
projectDir: string;
|
|
24
|
+
tools: Array<{
|
|
25
|
+
adapter: Adapter;
|
|
26
|
+
tool: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
export interface SyncAssetsOptions {
|
|
30
|
+
force: boolean;
|
|
31
|
+
onProgress?: (msg: string) => void;
|
|
32
|
+
projectConfig: null | ProjectConfig;
|
|
33
|
+
projectDir: string;
|
|
34
|
+
registry: Registry;
|
|
35
|
+
tools: Array<{
|
|
36
|
+
adapter: Adapter;
|
|
37
|
+
tool: string;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export interface SyncEntry {
|
|
41
|
+
asset: InstalledAsset;
|
|
42
|
+
reason: 'forced' | 'missing' | 'modified';
|
|
43
|
+
result?: InstallResult;
|
|
44
|
+
}
|
|
45
|
+
export interface SyncFailure {
|
|
46
|
+
assetName: string;
|
|
47
|
+
assetType: string;
|
|
48
|
+
error: string;
|
|
49
|
+
version: string;
|
|
50
|
+
}
|
|
51
|
+
export type SyncOutcome = {
|
|
52
|
+
outcome: 'dry-run';
|
|
53
|
+
toolResults: ToolDryRunResult[];
|
|
54
|
+
} | {
|
|
55
|
+
outcome: 'synced';
|
|
56
|
+
toolResults: ToolSyncResult[];
|
|
57
|
+
};
|
|
58
|
+
export interface ToolDryRunResult {
|
|
59
|
+
bootstrapHint?: string;
|
|
60
|
+
frozenSkipped: number;
|
|
61
|
+
skipped: number;
|
|
62
|
+
tool: string;
|
|
63
|
+
toSync: SyncEntry[];
|
|
64
|
+
}
|
|
65
|
+
export interface ToolSyncResult {
|
|
66
|
+
bootstrapHint?: string;
|
|
67
|
+
failures: SyncFailure[];
|
|
68
|
+
frozenSkipped: number;
|
|
69
|
+
skipped: number;
|
|
70
|
+
synced: SyncEntry[];
|
|
71
|
+
tool: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Classify installed assets into entries that need syncing vs. those that
|
|
75
|
+
* can be skipped. This consolidates the duplicated checksum-checking loop
|
|
76
|
+
* that previously appeared in both the dry-run and live sync paths.
|
|
77
|
+
*
|
|
78
|
+
* For each asset the function:
|
|
79
|
+
* 1. Checks if the asset is frozen — if so, increments `frozenSkipped`.
|
|
80
|
+
* 2. If `force` is true, marks it as `forced` without checking checksums.
|
|
81
|
+
* 3. Otherwise, resolves installed paths via the adapter, verifies checksums,
|
|
82
|
+
* and classifies as `missing` or `modified` when checksums fail, or
|
|
83
|
+
* increments `skipped` when all checksums pass.
|
|
84
|
+
*/
|
|
85
|
+
export declare function classifySyncEntries(options: ClassifySyncEntriesOptions): Promise<ClassifySyncEntriesResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Perform a dry-run sync: read the lockfile (without locking), classify each
|
|
88
|
+
* tool's assets, and return the results so the UI can display what *would*
|
|
89
|
+
* be synced.
|
|
90
|
+
*
|
|
91
|
+
* This fixes finding O10.3 by populating `bootstrapHint` when a tool has no
|
|
92
|
+
* installed assets, which the original inline dry-run path in sync.tsx omitted.
|
|
93
|
+
*/
|
|
94
|
+
export declare function dryRunSync(options: DryRunSyncOptions): Promise<ToolDryRunResult[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Perform a live sync: acquire the lockfile lock, classify each tool's assets,
|
|
97
|
+
* then remove and reinstall drifted entries.
|
|
98
|
+
*
|
|
99
|
+
* Uses `removeSingleAsset()` for disk-only cleanup (no lockfile I/O) and
|
|
100
|
+
* manages lockfile state in-memory with a single read at the start and a
|
|
101
|
+
* single write at the end. This follows the same pattern established by
|
|
102
|
+
* `executeBundleUninstall()` in `uninstaller.ts`.
|
|
103
|
+
*
|
|
104
|
+
* NOTE: Sync reinstalls only the direct asset, not its dependencies. This is
|
|
105
|
+
* intentional per F4.2 — dependencies are assumed to already be installed and
|
|
106
|
+
* are not re-fetched during a sync operation.
|
|
107
|
+
*/
|
|
108
|
+
export declare function syncAssets(options: SyncAssetsOptions): Promise<ToolSyncResult[]>;
|
|
109
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/lib/sync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AActD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,aAAa,EAAE,IAAI,GAAG,aAAa,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,aAAa,EAAE,IAAI,GAAG,aAAa,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAA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AChB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAMD;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,yBAAyB,CAAC,CAyCpC;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA0CxF;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAyHtF"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { resolveInstalledPaths } from './adapter.js';
|
|
3
|
+
import { verifyChecksums } from './checksum.js';
|
|
4
|
+
import { isFrozenInConfig } from './config.js';
|
|
5
|
+
import { executeInstallPlan, InstallerError } from './installer.js';
|
|
6
|
+
import { addAssetToLockfile, readLockfile, removeAssetFromLockfile, withLockfileErrorHandling, writeLockfile } from './lockfile.js';
|
|
7
|
+
import { resolveInstallPlan, ResolverError } from './resolver.js';
|
|
8
|
+
import { removeSingleAsset, UninstallerError } from './uninstaller.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Dry-run orchestration
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* Classify installed assets into entries that need syncing vs. those that
|
|
14
|
+
* can be skipped. This consolidates the duplicated checksum-checking loop
|
|
15
|
+
* that previously appeared in both the dry-run and live sync paths.
|
|
16
|
+
*
|
|
17
|
+
* For each asset the function:
|
|
18
|
+
* 1. Checks if the asset is frozen — if so, increments `frozenSkipped`.
|
|
19
|
+
* 2. If `force` is true, marks it as `forced` without checking checksums.
|
|
20
|
+
* 3. Otherwise, resolves installed paths via the adapter, verifies checksums,
|
|
21
|
+
* and classifies as `missing` or `modified` when checksums fail, or
|
|
22
|
+
* increments `skipped` when all checksums pass.
|
|
23
|
+
*/
|
|
24
|
+
export async function classifySyncEntries(options) {
|
|
25
|
+
const { adapter, assets, force, onProgress, projectConfig, projectDir } = options;
|
|
26
|
+
const toSync = [];
|
|
27
|
+
let frozenSkipped = 0;
|
|
28
|
+
let skipped = 0;
|
|
29
|
+
for (const asset of assets) {
|
|
30
|
+
onProgress?.(`Checking ${asset.name}...`);
|
|
31
|
+
if (isFrozenInConfig(projectConfig, asset.name, asset.type, asset.org)) {
|
|
32
|
+
frozenSkipped++;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (force) {
|
|
36
|
+
toSync.push({ asset, reason: 'forced' });
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const resolved = resolveInstalledPaths(asset, adapter, projectDir);
|
|
40
|
+
const filesToCheck = resolved.files.map((f) => ({
|
|
41
|
+
checksum: f.checksum,
|
|
42
|
+
path: join(projectDir, f.installedPath),
|
|
43
|
+
}));
|
|
44
|
+
const checksumFailures = await verifyChecksums(filesToCheck);
|
|
45
|
+
if (checksumFailures.length === 0) {
|
|
46
|
+
skipped++;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const hasMissing = checksumFailures.some((f) => f.actual.startsWith('FILE_NOT_FOUND'));
|
|
50
|
+
toSync.push({
|
|
51
|
+
asset,
|
|
52
|
+
reason: hasMissing ? 'missing' : 'modified',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return { frozenSkipped, skipped, toSync };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Perform a dry-run sync: read the lockfile (without locking), classify each
|
|
59
|
+
* tool's assets, and return the results so the UI can display what *would*
|
|
60
|
+
* be synced.
|
|
61
|
+
*
|
|
62
|
+
* This fixes finding O10.3 by populating `bootstrapHint` when a tool has no
|
|
63
|
+
* installed assets, which the original inline dry-run path in sync.tsx omitted.
|
|
64
|
+
*/
|
|
65
|
+
export async function dryRunSync(options) {
|
|
66
|
+
const { force, onProgress, projectConfig, projectDir, tools } = options;
|
|
67
|
+
onProgress?.('Reading lockfile...');
|
|
68
|
+
const lockfile = await readLockfile(projectDir);
|
|
69
|
+
const toolResults = [];
|
|
70
|
+
for (const { adapter, tool: toolName } of tools) {
|
|
71
|
+
const toolAssets = lockfile.assets ?? [];
|
|
72
|
+
if (toolAssets.length === 0) {
|
|
73
|
+
toolResults.push({
|
|
74
|
+
bootstrapHint: `Run "atk install <asset>" to install assets for ${toolName}`,
|
|
75
|
+
frozenSkipped: 0,
|
|
76
|
+
skipped: 0,
|
|
77
|
+
tool: toolName,
|
|
78
|
+
toSync: [],
|
|
79
|
+
});
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const classified = await classifySyncEntries({
|
|
83
|
+
adapter,
|
|
84
|
+
assets: toolAssets,
|
|
85
|
+
force,
|
|
86
|
+
onProgress: onProgress
|
|
87
|
+
? (msg) => onProgress(`${msg} for ${toolName}`)
|
|
88
|
+
: undefined,
|
|
89
|
+
projectConfig,
|
|
90
|
+
projectDir,
|
|
91
|
+
});
|
|
92
|
+
toolResults.push({
|
|
93
|
+
frozenSkipped: classified.frozenSkipped,
|
|
94
|
+
skipped: classified.skipped,
|
|
95
|
+
tool: toolName,
|
|
96
|
+
toSync: classified.toSync,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return toolResults;
|
|
100
|
+
}
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// Live sync orchestration
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
/**
|
|
105
|
+
* Perform a live sync: acquire the lockfile lock, classify each tool's assets,
|
|
106
|
+
* then remove and reinstall drifted entries.
|
|
107
|
+
*
|
|
108
|
+
* Uses `removeSingleAsset()` for disk-only cleanup (no lockfile I/O) and
|
|
109
|
+
* manages lockfile state in-memory with a single read at the start and a
|
|
110
|
+
* single write at the end. This follows the same pattern established by
|
|
111
|
+
* `executeBundleUninstall()` in `uninstaller.ts`.
|
|
112
|
+
*
|
|
113
|
+
* NOTE: Sync reinstalls only the direct asset, not its dependencies. This is
|
|
114
|
+
* intentional per F4.2 — dependencies are assumed to already be installed and
|
|
115
|
+
* are not re-fetched during a sync operation.
|
|
116
|
+
*/
|
|
117
|
+
export async function syncAssets(options) {
|
|
118
|
+
const { force, onProgress, projectConfig, projectDir, registry, tools } = options;
|
|
119
|
+
return withLockfileErrorHandling(projectDir, async () => {
|
|
120
|
+
onProgress?.('Reading lockfile...');
|
|
121
|
+
let lockfile = await readLockfile(projectDir);
|
|
122
|
+
const toolResults = [];
|
|
123
|
+
for (const { adapter, tool: toolName } of tools) {
|
|
124
|
+
const toolAssets = lockfile.assets ?? [];
|
|
125
|
+
if (toolAssets.length === 0) {
|
|
126
|
+
toolResults.push({
|
|
127
|
+
bootstrapHint: 'No assets installed. Run `atk setup` to initialize.',
|
|
128
|
+
failures: [],
|
|
129
|
+
frozenSkipped: 0,
|
|
130
|
+
skipped: 0,
|
|
131
|
+
synced: [],
|
|
132
|
+
tool: toolName,
|
|
133
|
+
});
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const classified = await classifySyncEntries({
|
|
137
|
+
adapter,
|
|
138
|
+
assets: toolAssets,
|
|
139
|
+
force,
|
|
140
|
+
onProgress: onProgress
|
|
141
|
+
? (msg) => onProgress(`${msg} for ${toolName}`)
|
|
142
|
+
: undefined,
|
|
143
|
+
projectConfig,
|
|
144
|
+
projectDir,
|
|
145
|
+
});
|
|
146
|
+
if (classified.toSync.length === 0) {
|
|
147
|
+
toolResults.push({
|
|
148
|
+
failures: [],
|
|
149
|
+
frozenSkipped: classified.frozenSkipped,
|
|
150
|
+
skipped: classified.skipped,
|
|
151
|
+
synced: [],
|
|
152
|
+
tool: toolName,
|
|
153
|
+
});
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const failures = [];
|
|
157
|
+
for (const entry of classified.toSync) {
|
|
158
|
+
onProgress?.(`Syncing ${entry.asset.name} for ${toolName}...`);
|
|
159
|
+
// Save the original lockfile entry so we can restore it on reinstall failure
|
|
160
|
+
const originalEntry = entry.asset;
|
|
161
|
+
// Step 1: Disk-only cleanup via removeSingleAsset (no lockfile I/O).
|
|
162
|
+
// Tolerate UninstallerError (e.g., files already missing) but propagate
|
|
163
|
+
// unexpected errors.
|
|
164
|
+
try {
|
|
165
|
+
await removeSingleAsset(originalEntry, adapter, projectDir, onProgress);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
if (!(error instanceof UninstallerError)) {
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Step 2: Track removal in the in-memory lockfile
|
|
173
|
+
lockfile = removeAssetFromLockfile(lockfile, originalEntry.name, originalEntry.type, originalEntry.org);
|
|
174
|
+
// Step 3: Reinstall the direct asset only (not dependencies — intentional per F4.2).
|
|
175
|
+
// Resolve the full plan but filter to just the direct asset entry.
|
|
176
|
+
try {
|
|
177
|
+
const plan = resolveInstallPlan(registry, originalEntry.name, originalEntry.type, originalEntry.version);
|
|
178
|
+
const directEntries = plan.entries.filter((e) => e.asset.name === originalEntry.name);
|
|
179
|
+
const directPlan = { entries: directEntries, totalCount: directEntries.length };
|
|
180
|
+
const results = await executeInstallPlan(directPlan, {
|
|
181
|
+
adapter,
|
|
182
|
+
onProgress,
|
|
183
|
+
projectDir,
|
|
184
|
+
});
|
|
185
|
+
entry.result = results[0];
|
|
186
|
+
// Step 4: After successful reinstall, re-read the lockfile from disk
|
|
187
|
+
// to capture the state that executeInstallPlan wrote, and keep our
|
|
188
|
+
// in-memory copy in sync.
|
|
189
|
+
lockfile = await readLockfile(projectDir);
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (error instanceof ResolverError || error instanceof InstallerError) {
|
|
193
|
+
// On reinstall failure, restore the original InstalledAsset entry
|
|
194
|
+
// back into the in-memory lockfile so it is not silently dropped.
|
|
195
|
+
lockfile = addAssetToLockfile(lockfile, originalEntry);
|
|
196
|
+
failures.push({
|
|
197
|
+
assetName: originalEntry.name,
|
|
198
|
+
assetType: originalEntry.type,
|
|
199
|
+
error: error.message,
|
|
200
|
+
version: originalEntry.version,
|
|
201
|
+
});
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
toolResults.push({
|
|
208
|
+
failures,
|
|
209
|
+
frozenSkipped: classified.frozenSkipped,
|
|
210
|
+
skipped: classified.skipped,
|
|
211
|
+
synced: classified.toSync.filter((e) => e.result !== undefined),
|
|
212
|
+
tool: toolName,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// Write the lockfile once at the end to persist any in-memory mutations
|
|
216
|
+
// (e.g., restored entries from failed reinstalls)
|
|
217
|
+
await writeLockfile(projectDir, lockfile);
|
|
218
|
+
return toolResults;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/lib/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACpI,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAkFvE,8EA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AAW,CAAC,IAAI,CAAC;gBACf,QAAQ;gBACR,aAAa,EAAE,UAAU,CAAC,aAAa;gBACvC,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC;gBAC/D,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;QACL,CAAC;QAED,wEAAwE;QACxE,kDAAkD;QAClD,MAAM,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE1C,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
import type { Adapter } from './schemas/adapter.js';
|
|
2
2
|
/**
|
|
3
|
-
* Resolve
|
|
3
|
+
* Resolve a single tool to target, returning both the resolved tool name and its adapter config.
|
|
4
|
+
*
|
|
5
|
+
* Convenience wrapper around `resolveTools()` that returns the first result.
|
|
6
|
+
* When `toolOption` is provided, returns that specific tool.
|
|
7
|
+
* When no `toolOption`, returns the first tool from the project config `tools` array.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveTool(toolOption?: string, projectDir?: string): Promise<{
|
|
10
|
+
adapter: Adapter;
|
|
11
|
+
tool: string;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve targeted tool names without loading adapter JSON.
|
|
4
15
|
*
|
|
5
16
|
* Resolution order:
|
|
6
|
-
* 1. Explicit `--tool` CLI flag
|
|
7
|
-
* 2. Project config `.atkrc.json` `
|
|
17
|
+
* 1. Explicit `--tool` CLI flag → returns `[toolOption]` immediately
|
|
18
|
+
* 2. Project config `.atkrc.json` `tools` array → returns the array as-is
|
|
8
19
|
* 3. Error directing user to run `atk setup`
|
|
9
20
|
*
|
|
10
|
-
*
|
|
21
|
+
* This is a lightweight alternative to `resolveTools()` for callers that only
|
|
22
|
+
* need the tool name strings and do not need the full adapter definitions.
|
|
11
23
|
*/
|
|
12
|
-
export declare function
|
|
24
|
+
export declare function resolveToolNames(toolOption?: string, projectDir?: string): Promise<string[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve all targeted tools, returning an array of tool names and their adapter configs.
|
|
27
|
+
*
|
|
28
|
+
* Resolution order:
|
|
29
|
+
* 1. Explicit `--tool` CLI flag → returns only that single tool (filter behavior)
|
|
30
|
+
* 2. Project config `.atkrc.json` `tools` array → returns all configured tools
|
|
31
|
+
* 3. Error directing user to run `atk setup`
|
|
32
|
+
*
|
|
33
|
+
* No auto-detection is performed — tools must be explicitly configured.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveTools(toolOption?: string, projectDir?: string): Promise<Array<{
|
|
13
36
|
adapter: Adapter;
|
|
14
37
|
tool: string;
|
|
15
|
-
}
|
|
38
|
+
}>>;
|
|
16
39
|
//# sourceMappingURL=tool-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-resolver.d.ts","sourceRoot":"","sources":["../../src/lib/tool-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMpD
|
|
1
|
+
{"version":3,"file":"tool-resolver.d.ts","sourceRoot":"","sources":["../../src/lib/tool-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAMpD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAG7C;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,EAAE,CAAC,CAcnB;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,KAAK,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAwBpD"}
|
|
@@ -2,28 +2,67 @@ import { loadAdapter } from './adapter.js';
|
|
|
2
2
|
import { loadProjectConfig } from './config.js';
|
|
3
3
|
import { findProjectRoot } from './paths.js';
|
|
4
4
|
/**
|
|
5
|
-
* Resolve
|
|
5
|
+
* Resolve a single tool to target, returning both the resolved tool name and its adapter config.
|
|
6
|
+
*
|
|
7
|
+
* Convenience wrapper around `resolveTools()` that returns the first result.
|
|
8
|
+
* When `toolOption` is provided, returns that specific tool.
|
|
9
|
+
* When no `toolOption`, returns the first tool from the project config `tools` array.
|
|
10
|
+
*/
|
|
11
|
+
export async function resolveTool(toolOption, projectDir) {
|
|
12
|
+
const results = await resolveTools(toolOption, projectDir);
|
|
13
|
+
return results[0];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve targeted tool names without loading adapter JSON.
|
|
6
17
|
*
|
|
7
18
|
* Resolution order:
|
|
8
|
-
* 1. Explicit `--tool` CLI flag
|
|
9
|
-
* 2. Project config `.atkrc.json` `
|
|
19
|
+
* 1. Explicit `--tool` CLI flag → returns `[toolOption]` immediately
|
|
20
|
+
* 2. Project config `.atkrc.json` `tools` array → returns the array as-is
|
|
10
21
|
* 3. Error directing user to run `atk setup`
|
|
11
22
|
*
|
|
12
|
-
*
|
|
23
|
+
* This is a lightweight alternative to `resolveTools()` for callers that only
|
|
24
|
+
* need the tool name strings and do not need the full adapter definitions.
|
|
13
25
|
*/
|
|
14
|
-
export async function
|
|
26
|
+
export async function resolveToolNames(toolOption, projectDir) {
|
|
27
|
+
if (toolOption) {
|
|
28
|
+
return [toolOption];
|
|
29
|
+
}
|
|
15
30
|
const resolvedDir = projectDir ?? findProjectRoot();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
const projectConfig = await loadProjectConfig(resolvedDir);
|
|
32
|
+
const tools = projectConfig?.tools;
|
|
33
|
+
if (!tools || tools.length === 0) {
|
|
34
|
+
throw new Error('No tools configured. Run `atk setup` to select your AI coding tool.');
|
|
35
|
+
}
|
|
36
|
+
return tools;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve all targeted tools, returning an array of tool names and their adapter configs.
|
|
40
|
+
*
|
|
41
|
+
* Resolution order:
|
|
42
|
+
* 1. Explicit `--tool` CLI flag → returns only that single tool (filter behavior)
|
|
43
|
+
* 2. Project config `.atkrc.json` `tools` array → returns all configured tools
|
|
44
|
+
* 3. Error directing user to run `atk setup`
|
|
45
|
+
*
|
|
46
|
+
* No auto-detection is performed — tools must be explicitly configured.
|
|
47
|
+
*/
|
|
48
|
+
export async function resolveTools(toolOption, projectDir) {
|
|
49
|
+
const resolvedDir = projectDir ?? findProjectRoot();
|
|
50
|
+
// When --tool flag is provided, return only that single tool
|
|
51
|
+
if (toolOption) {
|
|
52
|
+
const adapter = await loadAdapter(toolOption);
|
|
53
|
+
return [{ adapter, tool: toolOption }];
|
|
54
|
+
}
|
|
55
|
+
// Read all tools from project config
|
|
56
|
+
const projectConfig = await loadProjectConfig(resolvedDir);
|
|
57
|
+
const tools = projectConfig?.tools;
|
|
58
|
+
if (!tools || tools.length === 0) {
|
|
59
|
+
throw new Error('No tools configured. Run `atk setup` to select your AI coding tool.');
|
|
22
60
|
}
|
|
23
|
-
|
|
24
|
-
|
|
61
|
+
const results = [];
|
|
62
|
+
for (const tool of tools) {
|
|
63
|
+
const adapter = await loadAdapter(tool);
|
|
64
|
+
results.push({ adapter, tool });
|
|
25
65
|
}
|
|
26
|
-
|
|
27
|
-
return { adapter, tool };
|
|
66
|
+
return results;
|
|
28
67
|
}
|
|
29
68
|
//# sourceMappingURL=tool-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-resolver.js","sourceRoot":"","sources":["../../src/lib/tool-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"tool-resolver.js","sourceRoot":"","sources":["../../src/lib/tool-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,UAAmB,EACnB,UAAmB;IAEnB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC3D,OAAO,OAAO,CAAC,CAAC,CAAE,CAAC;AACrB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,UAAmB,EACnB,UAAmB;IAEnB,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IAED,MAAM,WAAW,GAAG,UAAU,IAAI,eAAe,EAAE,CAAC;IACpD,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,aAAa,EAAE,KAAK,CAAC;IAEnC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,UAAmB,EACnB,UAAmB;IAEnB,MAAM,WAAW,GAAG,UAAU,IAAI,eAAe,EAAE,CAAC;IAEpD,6DAA6D;IAC7D,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,CAAC;QAC9C,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,qCAAqC;IACrC,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,aAAa,EAAE,KAAK,CAAC;IAEnC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IAED,MAAM,OAAO,GAA8C,EAAE,CAAC;IAC9D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/build/lib/updater.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Adapter } from './schemas/adapter.js';
|
|
2
2
|
import type { InstalledAsset, Lockfile } from './schemas/lockfile.js';
|
|
3
|
+
import type { AssetType } from './schemas/manifest.js';
|
|
3
4
|
import type { Registry } from './schemas/registry.js';
|
|
4
5
|
import { type InstallResult } from './installer.js';
|
|
5
6
|
export interface OutdatedAsset {
|
|
@@ -12,7 +13,7 @@ export interface OutdatedAsset {
|
|
|
12
13
|
org?: string;
|
|
13
14
|
/** Whether the asset is version-pinned. */
|
|
14
15
|
pinned?: boolean;
|
|
15
|
-
type:
|
|
16
|
+
type: AssetType;
|
|
16
17
|
}
|
|
17
18
|
export interface UpdateAssetsResult {
|
|
18
19
|
failures: UpdateFailure[];
|
|
@@ -25,13 +26,15 @@ export interface UpdateAssetsResult {
|
|
|
25
26
|
export interface UpdateFailure {
|
|
26
27
|
error: string;
|
|
27
28
|
name: string;
|
|
28
|
-
type:
|
|
29
|
+
type: AssetType;
|
|
29
30
|
}
|
|
30
31
|
export interface UpdateOptions {
|
|
31
32
|
/** Adapter for the target tool. */
|
|
32
33
|
adapter: Adapter;
|
|
33
34
|
/** Force update even if the asset is pinned. */
|
|
34
35
|
force?: boolean;
|
|
36
|
+
/** Set of frozen asset composite keys in format `${type}:${org ?? ''}:${name}`. */
|
|
37
|
+
frozenAssets?: Set<string>;
|
|
35
38
|
/** Pre-read lockfile to avoid redundant reads (used for dropped dependency cleanup). */
|
|
36
39
|
lockfile?: Lockfile;
|
|
37
40
|
/** Callback for progress updates. */
|
|
@@ -46,7 +49,7 @@ export interface UpdateResult {
|
|
|
46
49
|
installResult: InstallResult;
|
|
47
50
|
name: string;
|
|
48
51
|
toVersion: string;
|
|
49
|
-
type:
|
|
52
|
+
type: AssetType;
|
|
50
53
|
}
|
|
51
54
|
export declare class UpdaterError extends Error {
|
|
52
55
|
constructor(message: string);
|
|
@@ -56,7 +59,7 @@ export declare class UpdaterError extends Error {
|
|
|
56
59
|
* Compares the installed version against the asset's `latest` version
|
|
57
60
|
* using the version-aware `findAsset` lookup.
|
|
58
61
|
*/
|
|
59
|
-
export declare function checkOutdated(lockfile: Lockfile, registry: Registry): OutdatedAsset[];
|
|
62
|
+
export declare function checkOutdated(lockfile: Lockfile, registry: Registry, frozenNames?: Set<string>): OutdatedAsset[];
|
|
60
63
|
/**
|
|
61
64
|
* Update a single asset to the target version (defaults to latest).
|
|
62
65
|
* Uninstalls the current version and installs the target from registry.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../src/lib/updater.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAMxE,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../src/lib/updater.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAMxE,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,MAAM,CAAC,EAAE,OAAO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,wBAAsB,WAAW,CAC/B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,cAAc,EACzB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAwGvB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,EAChC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAuH7B"}
|
package/build/lib/updater.js
CHANGED
|
@@ -15,7 +15,7 @@ export class UpdaterError extends Error {
|
|
|
15
15
|
* Compares the installed version against the asset's `latest` version
|
|
16
16
|
* using the version-aware `findAsset` lookup.
|
|
17
17
|
*/
|
|
18
|
-
export function checkOutdated(lockfile, registry) {
|
|
18
|
+
export function checkOutdated(lockfile, registry, frozenNames) {
|
|
19
19
|
const outdated = [];
|
|
20
20
|
for (const installed of lockfile.assets ?? []) {
|
|
21
21
|
const resolved = findAsset(registry, installed.name, installed.type, undefined, installed.org);
|
|
@@ -25,8 +25,9 @@ export function checkOutdated(lockfile, registry) {
|
|
|
25
25
|
}
|
|
26
26
|
// resolved.version is the latest version (findAsset defaults to latest)
|
|
27
27
|
if (isNewer(resolved.version, installed.version)) {
|
|
28
|
+
const compositeKey = `${installed.type}:${installed.org ?? ''}:${installed.name}`;
|
|
28
29
|
outdated.push({
|
|
29
|
-
frozen:
|
|
30
|
+
frozen: frozenNames?.has(compositeKey) ? true : undefined,
|
|
30
31
|
installedVersion: installed.version,
|
|
31
32
|
latestVersion: resolved.version,
|
|
32
33
|
name: installed.name,
|
|
@@ -43,7 +44,8 @@ export function checkOutdated(lockfile, registry) {
|
|
|
43
44
|
* Uninstalls the current version and installs the target from registry.
|
|
44
45
|
*/
|
|
45
46
|
export async function updateAsset(assetName, installed, registry, options) {
|
|
46
|
-
const { adapter, onProgress, projectDir, targetVersion } = options;
|
|
47
|
+
const { adapter: defaultAdapter, onProgress, projectDir, targetVersion } = options;
|
|
48
|
+
const adapter = defaultAdapter;
|
|
47
49
|
// Resolve the target version — defaults to latest when targetVersion is undefined
|
|
48
50
|
const resolved = findAsset(registry, assetName, installed.type, targetVersion, installed.org);
|
|
49
51
|
if (!resolved) {
|
|
@@ -108,7 +110,7 @@ export async function updateAsset(assetName, installed, registry, options) {
|
|
|
108
110
|
if (droppedDeps.length > 0) {
|
|
109
111
|
const updatedLockfile = options.lockfile ?? (await readLockfile(projectDir));
|
|
110
112
|
for (const dep of droppedDeps) {
|
|
111
|
-
const depAsset = findInstalledAsset(updatedLockfile, dep.name, dep.type);
|
|
113
|
+
const depAsset = findInstalledAsset(updatedLockfile, dep.name, dep.type, dep.org);
|
|
112
114
|
if (!depAsset)
|
|
113
115
|
continue;
|
|
114
116
|
// Only remove if it was a dependency and no other asset depends on it
|
|
@@ -144,7 +146,8 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
144
146
|
throw new UpdaterError(`Asset "${name}" is not installed.`);
|
|
145
147
|
}
|
|
146
148
|
// Check frozen state for explicitly targeted asset
|
|
147
|
-
|
|
149
|
+
const compositeKey = `${installed.type}:${installed.org ?? ''}:${name}`;
|
|
150
|
+
if (options.frozenAssets?.has(compositeKey)) {
|
|
148
151
|
throw new UpdaterError(`Asset "${name}" is frozen. Use "atk thaw ${name}" to unfreeze it before updating.`);
|
|
149
152
|
}
|
|
150
153
|
// Check pin state for explicitly targeted asset
|
|
@@ -158,7 +161,7 @@ export async function updateAssets(assetNames, lockfile, registry, options) {
|
|
|
158
161
|
});
|
|
159
162
|
return { failures: [], results: [result] };
|
|
160
163
|
}
|
|
161
|
-
const outdated = checkOutdated(lockfile, registry);
|
|
164
|
+
const outdated = checkOutdated(lockfile, registry, options.frozenAssets);
|
|
162
165
|
let toUpdate;
|
|
163
166
|
const frozenSkipped = [];
|
|
164
167
|
const skipped = [];
|
|
@@ -250,7 +253,9 @@ function isNewer(registryVersion, installedVersion) {
|
|
|
250
253
|
if (valid(registryVersion) && valid(installedVersion)) {
|
|
251
254
|
return compare(registryVersion, installedVersion) > 0;
|
|
252
255
|
}
|
|
253
|
-
//
|
|
256
|
+
// Defensive fallback: when version strings are not valid semver, treat any
|
|
257
|
+
// difference as "newer" so the change is surfaced for user review rather than
|
|
258
|
+
// silently ignored.
|
|
254
259
|
return registryVersion !== installedVersion;
|
|
255
260
|
}
|
|
256
261
|
//# sourceMappingURL=updater.js.map
|