@detergent-software/atk 3.0.0-dev.9 → 4.0.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/build/commands/_app.d.ts.map +1 -1
- package/build/commands/_app.js +23 -3
- package/build/commands/_app.js.map +1 -1
- package/build/commands/audit.d.ts.map +1 -1
- package/build/commands/audit.js +75 -40
- package/build/commands/audit.js.map +1 -1
- package/build/commands/browse.d.ts.map +1 -1
- package/build/commands/browse.js +117 -80
- 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 -118
- 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 +43 -38
- package/build/commands/info.js.map +1 -1
- package/build/commands/init.d.ts.map +1 -1
- package/build/commands/init.js +7 -14
- package/build/commands/init.js.map +1 -1
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +71 -79
- package/build/commands/install.js.map +1 -1
- package/build/commands/list.d.ts.map +1 -1
- package/build/commands/list.js +13 -6
- package/build/commands/list.js.map +1 -1
- package/build/commands/outdated.d.ts.map +1 -1
- package/build/commands/outdated.js +17 -8
- 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 +73 -132
- package/build/commands/prune.js.map +1 -1
- package/build/commands/publish.d.ts +2 -1
- package/build/commands/publish.d.ts.map +1 -1
- package/build/commands/publish.js +85 -9
- 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.map +1 -1
- package/build/commands/setup.js +6 -18
- package/build/commands/setup.js.map +1 -1
- package/build/commands/sync.d.ts.map +1 -1
- package/build/commands/sync.js +46 -163
- 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 +7 -7
- 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 +33 -40
- 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 +22 -21
- package/build/components/AssetDetail.js.map +1 -1
- package/build/components/AssetTable.d.ts +2 -1
- package/build/components/AssetTable.d.ts.map +1 -1
- package/build/components/AssetTable.js +14 -10
- package/build/components/AssetTable.js.map +1 -1
- package/build/components/AssetVersionLine.d.ts +27 -0
- package/build/components/AssetVersionLine.d.ts.map +1 -0
- package/build/components/AssetVersionLine.js +10 -0
- package/build/components/AssetVersionLine.js.map +1 -0
- package/build/components/BrowseExpandedBundle.d.ts +10 -1
- package/build/components/BrowseExpandedBundle.d.ts.map +1 -1
- package/build/components/BrowseExpandedBundle.js +25 -2
- 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 +5 -1
- package/build/components/BrowseList.d.ts.map +1 -1
- package/build/components/BrowseList.js +57 -47
- package/build/components/BrowseList.js.map +1 -1
- package/build/components/BundleDetail.d.ts +2 -1
- package/build/components/BundleDetail.d.ts.map +1 -1
- package/build/components/BundleDetail.js +3 -2
- package/build/components/BundleDetail.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/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/ListActionBar.d.ts +3 -1
- package/build/components/ListActionBar.d.ts.map +1 -1
- package/build/components/ListActionBar.js +4 -4
- package/build/components/ListActionBar.js.map +1 -1
- package/build/components/ListBrowseList.d.ts +3 -1
- package/build/components/ListBrowseList.d.ts.map +1 -1
- package/build/components/ListBrowseList.js +5 -3
- package/build/components/ListBrowseList.js.map +1 -1
- package/build/components/ListExpandedRow.d.ts +4 -2
- package/build/components/ListExpandedRow.d.ts.map +1 -1
- package/build/components/ListExpandedRow.js +4 -4
- package/build/components/ListExpandedRow.js.map +1 -1
- 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/SkippedAssetSection.d.ts +35 -0
- package/build/components/SkippedAssetSection.d.ts.map +1 -0
- package/build/components/SkippedAssetSection.js +15 -0
- package/build/components/SkippedAssetSection.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 +9 -2
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +9 -2
- package/build/components/index.js.map +1 -1
- package/build/hooks/useBrowseState.d.ts +21 -1
- package/build/hooks/useBrowseState.d.ts.map +1 -1
- package/build/hooks/useBrowseState.js +71 -12
- package/build/hooks/useBrowseState.js.map +1 -1
- package/build/hooks/useInitState.d.ts +37 -0
- package/build/hooks/useInitState.d.ts.map +1 -1
- package/build/hooks/useInitState.js +286 -184
- package/build/hooks/useInitState.js.map +1 -1
- package/build/hooks/useListActions.d.ts +2 -1
- package/build/hooks/useListActions.d.ts.map +1 -1
- package/build/hooks/useListActions.js +23 -19
- package/build/hooks/useListActions.js.map +1 -1
- package/build/hooks/useListState.d.ts +4 -0
- package/build/hooks/useListState.d.ts.map +1 -1
- package/build/hooks/useListState.js +3 -0
- package/build/hooks/useListState.js.map +1 -1
- package/build/hooks/usePruneState.d.ts +76 -0
- package/build/hooks/usePruneState.d.ts.map +1 -0
- package/build/hooks/usePruneState.js +252 -0
- package/build/hooks/usePruneState.js.map +1 -0
- package/build/hooks/usePublishState.d.ts +33 -1
- package/build/hooks/usePublishState.d.ts.map +1 -1
- package/build/hooks/usePublishState.js +258 -12
- package/build/hooks/usePublishState.js.map +1 -1
- package/build/hooks/useSetupState.d.ts +2 -4
- package/build/hooks/useSetupState.d.ts.map +1 -1
- package/build/hooks/useSetupState.js +40 -101
- package/build/hooks/useSetupState.js.map +1 -1
- package/build/hooks/useUninstallState.d.ts.map +1 -1
- package/build/hooks/useUninstallState.js +9 -2
- package/build/hooks/useUninstallState.js.map +1 -1
- 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 +34 -0
- package/build/lib/checksum.d.ts.map +1 -1
- package/build/lib/checksum.js +85 -0
- package/build/lib/checksum.js.map +1 -1
- package/build/lib/config.d.ts +37 -20
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +99 -51
- 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/github.d.ts +27 -0
- package/build/lib/github.d.ts.map +1 -1
- package/build/lib/github.js +35 -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/init.d.ts +22 -0
- package/build/lib/init.d.ts.map +1 -1
- package/build/lib/init.js +163 -18
- package/build/lib/init.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 +6 -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 +42 -63
- package/build/lib/lockfile.js.map +1 -1
- package/build/lib/publisher.d.ts +6 -12
- package/build/lib/publisher.d.ts.map +1 -1
- package/build/lib/publisher.js +17 -51
- 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 +24 -0
- package/build/lib/schemas/config.d.ts.map +1 -1
- package/build/lib/schemas/config.js +9 -0
- 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 +16 -2
- package/build/lib/schemas/lockfile.d.ts.map +1 -1
- package/build/lib/schemas/lockfile.js +6 -1
- package/build/lib/schemas/lockfile.js.map +1 -1
- package/build/lib/schemas/manifest.d.ts +1 -1
- package/build/lib/schemas/manifest.d.ts.map +1 -1
- package/build/lib/schemas/manifest.js +7 -2
- package/build/lib/schemas/manifest.js.map +1 -1
- package/build/lib/schemas/registry.d.ts +2 -4
- package/build/lib/schemas/registry.d.ts.map +1 -1
- package/build/lib/schemas/registry.js +1 -1
- package/build/lib/schemas/registry.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 +217 -0
- package/build/lib/sync.js.map +1 -0
- package/build/lib/tool-resolver.d.ts +12 -0
- package/build/lib/tool-resolver.d.ts.map +1 -1
- package/build/lib/tool-resolver.js +23 -0
- 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 +11 -8
- 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 +2 -1
package/build/lib/search.js
CHANGED
|
@@ -1,4 +1,62 @@
|
|
|
1
1
|
import { filterVisibleAssets } from './registry.js';
|
|
2
|
+
import { AssetType } from './schemas/manifest.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parse and validate a type filter string.
|
|
5
|
+
* Returns 'bundle' for the bundle type, or a validated AssetType.
|
|
6
|
+
* Throws an Error if the type string is not recognized.
|
|
7
|
+
*/
|
|
8
|
+
export function parseTypeFilter(type) {
|
|
9
|
+
if (type === 'bundle') {
|
|
10
|
+
return 'bundle';
|
|
11
|
+
}
|
|
12
|
+
const result = AssetType.safeParse(type);
|
|
13
|
+
if (!result.success) {
|
|
14
|
+
throw new Error(`Invalid type '${type}'. Valid types are: ${AssetType.options.join(', ')}, bundle`);
|
|
15
|
+
}
|
|
16
|
+
return result.data;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Score an item (asset or bundle) against search terms.
|
|
20
|
+
* Higher score = better match.
|
|
21
|
+
*
|
|
22
|
+
* Accepts pre-lowercased name, description, and author strings,
|
|
23
|
+
* the raw tags array, the search terms, and the full query string.
|
|
24
|
+
*/
|
|
25
|
+
export function scoreItem(name, description, author, tags, terms, fullQuery) {
|
|
26
|
+
let score = 0;
|
|
27
|
+
// Exact name match — highest weight
|
|
28
|
+
if (name === fullQuery) {
|
|
29
|
+
score += 100;
|
|
30
|
+
}
|
|
31
|
+
// Name contains the full query
|
|
32
|
+
else if (name.includes(fullQuery)) {
|
|
33
|
+
score += 50;
|
|
34
|
+
}
|
|
35
|
+
// Description contains the full query
|
|
36
|
+
if (description.includes(fullQuery)) {
|
|
37
|
+
score += 20;
|
|
38
|
+
}
|
|
39
|
+
// Per-term matching
|
|
40
|
+
for (const term of terms) {
|
|
41
|
+
// Name contains term
|
|
42
|
+
if (name.includes(term)) {
|
|
43
|
+
score += 10;
|
|
44
|
+
}
|
|
45
|
+
// Description contains term
|
|
46
|
+
if (description.includes(term)) {
|
|
47
|
+
score += 5;
|
|
48
|
+
}
|
|
49
|
+
// Tag exact match
|
|
50
|
+
if (tags.some((t) => t.toLowerCase() === term)) {
|
|
51
|
+
score += 8;
|
|
52
|
+
}
|
|
53
|
+
// Author matches
|
|
54
|
+
if (author.includes(term)) {
|
|
55
|
+
score += 3;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return score;
|
|
59
|
+
}
|
|
2
60
|
/**
|
|
3
61
|
* Search the registry for assets and bundles matching a query.
|
|
4
62
|
* Returns results sorted by relevance score (highest first).
|
|
@@ -18,7 +76,9 @@ export function searchRegistry(registry, options) {
|
|
|
18
76
|
if (tag && !asset.tags.some((t) => t.toLowerCase() === tag.toLowerCase()))
|
|
19
77
|
continue;
|
|
20
78
|
const latestVersion = asset.versions[asset.latest];
|
|
21
|
-
if (
|
|
79
|
+
if (!latestVersion)
|
|
80
|
+
continue;
|
|
81
|
+
if (tool && !latestVersion.tools.includes(tool))
|
|
22
82
|
continue;
|
|
23
83
|
let score = scoreAsset(asset, queryTerms, queryLower);
|
|
24
84
|
// Org-scoped assets get a small scoring bonus when org is active
|
|
@@ -53,83 +113,23 @@ export function searchRegistry(registry, options) {
|
|
|
53
113
|
}
|
|
54
114
|
/**
|
|
55
115
|
* Score an asset against search terms.
|
|
56
|
-
*
|
|
116
|
+
* Thin wrapper that extracts fields from the asset and delegates to scoreItem.
|
|
57
117
|
*/
|
|
58
118
|
function scoreAsset(asset, terms, fullQuery) {
|
|
59
|
-
let score = 0;
|
|
60
119
|
const nameLower = asset.name.toLowerCase();
|
|
61
120
|
const latestVersion = asset.versions[asset.latest];
|
|
62
121
|
const descLower = (latestVersion?.description ?? '').toLowerCase();
|
|
63
122
|
const authorLower = (latestVersion?.author ?? '').toLowerCase();
|
|
64
|
-
|
|
65
|
-
if (nameLower === fullQuery) {
|
|
66
|
-
score += 100;
|
|
67
|
-
}
|
|
68
|
-
// Name contains the full query
|
|
69
|
-
else if (nameLower.includes(fullQuery)) {
|
|
70
|
-
score += 50;
|
|
71
|
-
}
|
|
72
|
-
// Description contains the full query
|
|
73
|
-
if (descLower.includes(fullQuery)) {
|
|
74
|
-
score += 20;
|
|
75
|
-
}
|
|
76
|
-
// Per-term matching
|
|
77
|
-
for (const term of terms) {
|
|
78
|
-
// Name contains term
|
|
79
|
-
if (nameLower.includes(term)) {
|
|
80
|
-
score += 10;
|
|
81
|
-
}
|
|
82
|
-
// Description contains term
|
|
83
|
-
if (descLower.includes(term)) {
|
|
84
|
-
score += 5;
|
|
85
|
-
}
|
|
86
|
-
// Tag exact match
|
|
87
|
-
if (asset.tags.some((t) => t.toLowerCase() === term)) {
|
|
88
|
-
score += 8;
|
|
89
|
-
}
|
|
90
|
-
// Author matches
|
|
91
|
-
if (authorLower.includes(term)) {
|
|
92
|
-
score += 3;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return score;
|
|
123
|
+
return scoreItem(nameLower, descLower, authorLower, asset.tags, terms, fullQuery);
|
|
96
124
|
}
|
|
97
125
|
/**
|
|
98
126
|
* Score a bundle against search terms.
|
|
99
|
-
*
|
|
127
|
+
* Thin wrapper that extracts fields from the bundle and delegates to scoreItem.
|
|
100
128
|
*/
|
|
101
129
|
function scoreBundle(bundle, terms, fullQuery) {
|
|
102
|
-
let score = 0;
|
|
103
130
|
const nameLower = bundle.name.toLowerCase();
|
|
104
131
|
const descLower = bundle.description.toLowerCase();
|
|
105
132
|
const authorLower = bundle.author.toLowerCase();
|
|
106
|
-
|
|
107
|
-
if (nameLower === fullQuery) {
|
|
108
|
-
score += 100;
|
|
109
|
-
}
|
|
110
|
-
// Name contains the full query
|
|
111
|
-
else if (nameLower.includes(fullQuery)) {
|
|
112
|
-
score += 50;
|
|
113
|
-
}
|
|
114
|
-
// Description contains the full query
|
|
115
|
-
if (descLower.includes(fullQuery)) {
|
|
116
|
-
score += 20;
|
|
117
|
-
}
|
|
118
|
-
// Per-term matching
|
|
119
|
-
for (const term of terms) {
|
|
120
|
-
if (nameLower.includes(term)) {
|
|
121
|
-
score += 10;
|
|
122
|
-
}
|
|
123
|
-
if (descLower.includes(term)) {
|
|
124
|
-
score += 5;
|
|
125
|
-
}
|
|
126
|
-
if (bundle.tags.some((t) => t.toLowerCase() === term)) {
|
|
127
|
-
score += 8;
|
|
128
|
-
}
|
|
129
|
-
if (authorLower.includes(term)) {
|
|
130
|
-
score += 3;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return score;
|
|
133
|
+
return scoreItem(nameLower, descLower, authorLower, bundle.tags, terms, fullQuery);
|
|
134
134
|
}
|
|
135
135
|
//# sourceMappingURL=search.js.map
|
package/build/lib/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAclD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC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AAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,KAAoB,EAAE,KAAe,EAAE,SAAiB;IAC1E,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,CAAC,aAAa,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACnE,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAEhE,OAAO,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACpF,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,MAAsB,EAAE,KAAe,EAAE,SAAiB;IAC7E,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;IACnD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;IAEhD,OAAO,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regex for valid org identifiers. Must start with a letter, then letters,
|
|
3
|
+
* digits, or hyphens. Matches the constraint in the manifest schema.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ORG_PATTERN: RegExp;
|
|
6
|
+
export interface SetupCreationOptions {
|
|
7
|
+
orgLocked: boolean;
|
|
8
|
+
orgValue: string;
|
|
9
|
+
projectDir: string;
|
|
10
|
+
selectedTools: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface SetupCreationResult {
|
|
13
|
+
actions: SummaryAction[];
|
|
14
|
+
warnings: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface SummaryAction {
|
|
17
|
+
detail?: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Perform the setup creation step: write project config, write/update the
|
|
22
|
+
* lockfile, and ensure gitignore entries are present for the selected tools.
|
|
23
|
+
*
|
|
24
|
+
* This is the extracted business logic from the `useSetupState` creating
|
|
25
|
+
* effect, made independently testable without React rendering overhead.
|
|
26
|
+
*/
|
|
27
|
+
export declare function performSetupCreation(options: SetupCreationOptions): Promise<SetupCreationResult>;
|
|
28
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/lib/setup.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,eAAO,MAAM,WAAW,QAA4B,CAAC;AAMrD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAiFtG"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { loadAdapter } from './adapter.js';
|
|
3
|
+
import { saveProjectConfig } from './config.js';
|
|
4
|
+
import { ensureGitignoreEntries, ensureGitignorePatterns } from './gitignore.js';
|
|
5
|
+
import { getLockfilePath, readLockfile, writeLockfile } from './lockfile.js';
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Constants
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
/**
|
|
10
|
+
* Regex for valid org identifiers. Must start with a letter, then letters,
|
|
11
|
+
* digits, or hyphens. Matches the constraint in the manifest schema.
|
|
12
|
+
*/
|
|
13
|
+
export const ORG_PATTERN = /^[a-zA-Z][a-zA-Z0-9-]*$/;
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Main function
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
/**
|
|
18
|
+
* Perform the setup creation step: write project config, write/update the
|
|
19
|
+
* lockfile, and ensure gitignore entries are present for the selected tools.
|
|
20
|
+
*
|
|
21
|
+
* This is the extracted business logic from the `useSetupState` creating
|
|
22
|
+
* effect, made independently testable without React rendering overhead.
|
|
23
|
+
*/
|
|
24
|
+
export async function performSetupCreation(options) {
|
|
25
|
+
const { orgLocked, orgValue, projectDir, selectedTools } = options;
|
|
26
|
+
const actions = [];
|
|
27
|
+
const warnings = [];
|
|
28
|
+
const resolvedOrg = orgLocked ? orgValue.trim() : orgValue.trim() || undefined;
|
|
29
|
+
// Validate org format when non-empty
|
|
30
|
+
if (resolvedOrg !== undefined && !ORG_PATTERN.test(resolvedOrg)) {
|
|
31
|
+
throw new Error(`Invalid org "${resolvedOrg}": must start with a letter and contain only letters, digits, or hyphens.`);
|
|
32
|
+
}
|
|
33
|
+
// 1. Write .atkrc.json with { tools: [...] }
|
|
34
|
+
await saveProjectConfig(projectDir, { tools: selectedTools });
|
|
35
|
+
actions.push({ detail: `tools: ${selectedTools.join(', ')}`, label: 'Wrote .atkrc.json' });
|
|
36
|
+
// 2. Write/update .atk-lock.json
|
|
37
|
+
const lockfilePath = getLockfilePath(projectDir);
|
|
38
|
+
if (existsSync(lockfilePath)) {
|
|
39
|
+
// Preserve existing assets and org
|
|
40
|
+
const existing = await readLockfile(projectDir);
|
|
41
|
+
// Only update org if it's not already set and we have a new one
|
|
42
|
+
const updatedLockfile = {
|
|
43
|
+
...existing,
|
|
44
|
+
lockVersion: 1,
|
|
45
|
+
...(resolvedOrg !== undefined && !existing.org ? { org: resolvedOrg } : {}),
|
|
46
|
+
};
|
|
47
|
+
await writeLockfile(projectDir, updatedLockfile);
|
|
48
|
+
actions.push({
|
|
49
|
+
detail: `${(existing.assets ?? []).length} existing asset(s) preserved`,
|
|
50
|
+
label: 'Updated .atk-lock.json',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
await writeLockfile(projectDir, {
|
|
55
|
+
assets: [],
|
|
56
|
+
lockVersion: 1,
|
|
57
|
+
...(resolvedOrg !== undefined ? { org: resolvedOrg } : {}),
|
|
58
|
+
});
|
|
59
|
+
actions.push({
|
|
60
|
+
detail: resolvedOrg ? `org: ${resolvedOrg}` : 'no org',
|
|
61
|
+
label: 'Created .atk-lock.json',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// 3. Ensure .atkrc.json is in .gitignore via the adapters' gitignore entries
|
|
65
|
+
const allAdded = [];
|
|
66
|
+
let anyAdapterLoaded = false;
|
|
67
|
+
for (const tool of selectedTools) {
|
|
68
|
+
try {
|
|
69
|
+
const adapter = await loadAdapter(tool);
|
|
70
|
+
anyAdapterLoaded = true;
|
|
71
|
+
const { added } = await ensureGitignoreEntries(projectDir, adapter);
|
|
72
|
+
allAdded.push(...added);
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
// Individual adapter load failure is non-fatal; record warning and continue
|
|
76
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
77
|
+
warnings.push(`Failed to load adapter for "${tool}": ${message}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!anyAdapterLoaded) {
|
|
81
|
+
// If no adapters could be loaded, manually ensure critical files are gitignored
|
|
82
|
+
try {
|
|
83
|
+
const { added } = await ensureGitignorePatterns(projectDir, ['.atkrc.json', '.atk-lock.json.lock']);
|
|
84
|
+
allAdded.push(...added);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
88
|
+
warnings.push(`Failed to update .gitignore: ${message}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (allAdded.length > 0) {
|
|
92
|
+
// Deduplicate entries
|
|
93
|
+
const uniqueAdded = [...new Set(allAdded)];
|
|
94
|
+
actions.push({ detail: uniqueAdded.join(', '), label: 'Updated .gitignore' });
|
|
95
|
+
}
|
|
96
|
+
return { actions, warnings };
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/lib/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE7E,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,yBAAyB,CAAC;AAuBrD,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAA6B;IACtE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,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H,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,uBAAuB,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC,CAAC;YACpG,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,QAAQ,CAAC,IAAI,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,sBAAsB;QACtB,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -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;AAoBtD,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;QAAC,I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,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAMD;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAyCjH;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAwCxF;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAuHtF"}
|
|
@@ -0,0 +1,217 @@
|
|
|
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 ? (msg) => onProgress(`${msg} for ${toolName}`) : undefined,
|
|
87
|
+
projectConfig,
|
|
88
|
+
projectDir,
|
|
89
|
+
});
|
|
90
|
+
toolResults.push({
|
|
91
|
+
frozenSkipped: classified.frozenSkipped,
|
|
92
|
+
skipped: classified.skipped,
|
|
93
|
+
tool: toolName,
|
|
94
|
+
toSync: classified.toSync,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return toolResults;
|
|
98
|
+
}
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// Live sync orchestration
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
/**
|
|
103
|
+
* Perform a live sync: acquire the lockfile lock, classify each tool's assets,
|
|
104
|
+
* then remove and reinstall drifted entries.
|
|
105
|
+
*
|
|
106
|
+
* Uses `removeSingleAsset()` for disk-only cleanup (no lockfile I/O) and
|
|
107
|
+
* manages lockfile state in-memory with a single read at the start and a
|
|
108
|
+
* single write at the end. This follows the same pattern established by
|
|
109
|
+
* `executeBundleUninstall()` in `uninstaller.ts`.
|
|
110
|
+
*
|
|
111
|
+
* NOTE: Sync reinstalls only the direct asset, not its dependencies. This is
|
|
112
|
+
* intentional per F4.2 — dependencies are assumed to already be installed and
|
|
113
|
+
* are not re-fetched during a sync operation.
|
|
114
|
+
*/
|
|
115
|
+
export async function syncAssets(options) {
|
|
116
|
+
const { force, onProgress, projectConfig, projectDir, registry, tools } = options;
|
|
117
|
+
return withLockfileErrorHandling(projectDir, async () => {
|
|
118
|
+
onProgress?.('Reading lockfile...');
|
|
119
|
+
let lockfile = await readLockfile(projectDir);
|
|
120
|
+
const toolResults = [];
|
|
121
|
+
for (const { adapter, tool: toolName } of tools) {
|
|
122
|
+
const toolAssets = lockfile.assets ?? [];
|
|
123
|
+
if (toolAssets.length === 0) {
|
|
124
|
+
toolResults.push({
|
|
125
|
+
bootstrapHint: 'No assets installed. Run `atk setup` to initialize.',
|
|
126
|
+
failures: [],
|
|
127
|
+
frozenSkipped: 0,
|
|
128
|
+
skipped: 0,
|
|
129
|
+
synced: [],
|
|
130
|
+
tool: toolName,
|
|
131
|
+
});
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const classified = await classifySyncEntries({
|
|
135
|
+
adapter,
|
|
136
|
+
assets: toolAssets,
|
|
137
|
+
force,
|
|
138
|
+
onProgress: onProgress ? (msg) => onProgress(`${msg} for ${toolName}`) : undefined,
|
|
139
|
+
projectConfig,
|
|
140
|
+
projectDir,
|
|
141
|
+
});
|
|
142
|
+
if (classified.toSync.length === 0) {
|
|
143
|
+
toolResults.push({
|
|
144
|
+
failures: [],
|
|
145
|
+
frozenSkipped: classified.frozenSkipped,
|
|
146
|
+
skipped: classified.skipped,
|
|
147
|
+
synced: [],
|
|
148
|
+
tool: toolName,
|
|
149
|
+
});
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const failures = [];
|
|
153
|
+
for (const entry of classified.toSync) {
|
|
154
|
+
onProgress?.(`Syncing ${entry.asset.name} for ${toolName}...`);
|
|
155
|
+
// Save the original lockfile entry so we can restore it on reinstall failure
|
|
156
|
+
const originalEntry = entry.asset;
|
|
157
|
+
// Step 1: Disk-only cleanup via removeSingleAsset (no lockfile I/O).
|
|
158
|
+
// Tolerate UninstallerError (e.g., files already missing) but propagate
|
|
159
|
+
// unexpected errors.
|
|
160
|
+
try {
|
|
161
|
+
await removeSingleAsset(originalEntry, adapter, projectDir, onProgress);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
if (!(error instanceof UninstallerError)) {
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Step 2: Track removal in the in-memory lockfile
|
|
169
|
+
lockfile = removeAssetFromLockfile(lockfile, originalEntry.name, originalEntry.type, originalEntry.org);
|
|
170
|
+
// Step 3: Reinstall the direct asset only (not dependencies — intentional per F4.2).
|
|
171
|
+
// Resolve the full plan but filter to just the direct asset entry.
|
|
172
|
+
try {
|
|
173
|
+
const plan = resolveInstallPlan(registry, originalEntry.name, originalEntry.type, originalEntry.version);
|
|
174
|
+
const directEntries = plan.entries.filter((e) => e.asset.name === originalEntry.name);
|
|
175
|
+
const directPlan = { entries: directEntries, totalCount: directEntries.length };
|
|
176
|
+
const results = await executeInstallPlan(directPlan, {
|
|
177
|
+
adapter,
|
|
178
|
+
onProgress,
|
|
179
|
+
projectDir,
|
|
180
|
+
});
|
|
181
|
+
entry.result = results[0];
|
|
182
|
+
// Step 4: After successful reinstall, re-read the lockfile from disk
|
|
183
|
+
// to capture the state that executeInstallPlan wrote, and keep our
|
|
184
|
+
// in-memory copy in sync.
|
|
185
|
+
lockfile = await readLockfile(projectDir);
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
if (error instanceof ResolverError || error instanceof InstallerError) {
|
|
189
|
+
// On reinstall failure, restore the original InstalledAsset entry
|
|
190
|
+
// back into the in-memory lockfile so it is not silently dropped.
|
|
191
|
+
lockfile = addAssetToLockfile(lockfile, originalEntry);
|
|
192
|
+
failures.push({
|
|
193
|
+
assetName: originalEntry.name,
|
|
194
|
+
assetType: originalEntry.type,
|
|
195
|
+
error: error.message,
|
|
196
|
+
version: originalEntry.version,
|
|
197
|
+
});
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
toolResults.push({
|
|
204
|
+
failures,
|
|
205
|
+
frozenSkipped: classified.frozenSkipped,
|
|
206
|
+
skipped: classified.skipped,
|
|
207
|
+
synced: classified.toSync.filter((e) => e.result !== undefined),
|
|
208
|
+
tool: toolName,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
// Write the lockfile once at the end to persist any in-memory mutations
|
|
212
|
+
// (e.g., restored entries from failed reinstalls)
|
|
213
|
+
await writeLockfile(projectDir, lockfile);
|
|
214
|
+
return toolResults;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=sync.js.map
|