wyvrnpm 2.10.2 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +1914 -1860
  2. package/bin/{wyvrn.js → wyvrnpm.js} +66 -0
  3. package/cmake/cpp.cmake +9 -9
  4. package/cmake/functions.cmake +224 -224
  5. package/cmake/macros.cmake +284 -284
  6. package/package.json +3 -2
  7. package/src/auth.js +66 -66
  8. package/src/binary-dir.js +95 -0
  9. package/src/bootstrap/cookbook.js +196 -196
  10. package/src/bootstrap/detect.js +150 -150
  11. package/src/bootstrap/index.js +220 -220
  12. package/src/bootstrap/version.js +72 -72
  13. package/src/build/cache.js +344 -344
  14. package/src/build/clone.js +170 -170
  15. package/src/build/cmake.js +342 -342
  16. package/src/build/index.js +299 -297
  17. package/src/build/msvc-env.js +260 -260
  18. package/src/build/recipe.js +188 -188
  19. package/src/commands/add.js +141 -141
  20. package/src/commands/bootstrap.js +96 -96
  21. package/src/commands/build.js +482 -452
  22. package/src/commands/cache.js +189 -189
  23. package/src/commands/clean.js +80 -80
  24. package/src/commands/configure.js +92 -92
  25. package/src/commands/init.js +70 -70
  26. package/src/commands/install-skill.js +115 -115
  27. package/src/commands/install.js +730 -674
  28. package/src/commands/link.js +320 -320
  29. package/src/commands/profile.js +237 -237
  30. package/src/commands/publish.js +584 -555
  31. package/src/commands/show.js +252 -252
  32. package/src/commands/version.js +187 -0
  33. package/src/compat.js +273 -273
  34. package/src/conf/index.js +415 -391
  35. package/src/conf/namespaces.js +94 -94
  36. package/src/context.js +230 -230
  37. package/src/http-fetch.js +53 -53
  38. package/src/ignore.js +118 -118
  39. package/src/logger.js +122 -122
  40. package/src/options.js +303 -303
  41. package/src/settings-overrides.js +152 -152
  42. package/src/toolchain/deps.js +164 -164
  43. package/src/toolchain/index.js +212 -212
  44. package/src/toolchain/presets.js +356 -340
  45. package/src/toolchain/template.cmake +77 -77
  46. package/src/upload-built.js +265 -265
  47. package/src/version-range.js +301 -301
  48. package/src/zip-safe.js +52 -52
  49. package/src/zip-stream.js +126 -0
@@ -1,189 +1,189 @@
1
- 'use strict';
2
-
3
- // F12: source-build cache inspection + targeted pruning.
4
- //
5
- // `wyvrnpm cache list [pattern]` prints a human-readable table (or JSON
6
- // with --format json) of everything in the machine-wide source-build
7
- // cache at `%LOCALAPPDATA%\wyvrnpm\bc\`.
8
- //
9
- // `wyvrnpm cache prune` removes cache entries per a policy:
10
- // --keep-last N retain N most-recently-touched per (name,version)
11
- // --older-than 30d also remove entries older than the threshold
12
- // --pattern <glob> restrict to matching package names
13
- // --dry-run print what would go, remove nothing
14
- //
15
- // The existing `wyvrnpm clean --build-cache` nukes everything; this is
16
- // the targeted alternative for teams whose `--upload-built` cache has
17
- // ballooned.
18
-
19
- const {
20
- listCacheEntries,
21
- computePruneSet,
22
- removeCacheEntries,
23
- parseDurationToCutoff,
24
- getBuildCacheRoot,
25
- } = require('../build/cache');
26
- const log = require('../logger');
27
-
28
- // ---------------------------------------------------------------------------
29
- // Helpers
30
- // ---------------------------------------------------------------------------
31
-
32
- function formatBytes(n) {
33
- if (n < 1024) return `${n} B`;
34
- const units = ['KB', 'MB', 'GB', 'TB'];
35
- let size = n / 1024, i = 0;
36
- while (size >= 1024 && i < units.length - 1) { size /= 1024; i++; }
37
- return `${size.toFixed(size >= 100 ? 0 : 1)} ${units[i]}`;
38
- }
39
-
40
- function formatMtime(ms) {
41
- if (!ms) return '<unknown>';
42
- return new Date(ms).toISOString().replace('T', ' ').slice(0, 16);
43
- }
44
-
45
- function globToRegExp(glob) {
46
- const escaped = glob.replace(/[.+^${}()|[\]\\]/g, '\\$&');
47
- return new RegExp(`^${escaped.replace(/\*/g, '.*').replace(/\?/g, '.')}$`);
48
- }
49
-
50
- function patternFor(argPattern, positional) {
51
- const src = argPattern ?? positional ?? null;
52
- return src ? globToRegExp(src) : null;
53
- }
54
-
55
- // ---------------------------------------------------------------------------
56
- // list
57
- // ---------------------------------------------------------------------------
58
-
59
- /**
60
- * wyvrnpm cache list [pattern] [--format json|text]
61
- *
62
- * @param {object} argv
63
- */
64
- function list(argv) {
65
- const entries = listCacheEntries();
66
- const regex = patternFor(argv.pattern, argv._?.[1]);
67
- const filtered = regex ? entries.filter((e) => regex.test(e.name)) : entries;
68
-
69
- // Newest first — matches what `ls -lt` users expect.
70
- filtered.sort((a, b) => b.mtimeMs - a.mtimeMs);
71
-
72
- if (argv.format === 'json') {
73
- process.stdout.write(JSON.stringify({
74
- command: 'cache-list',
75
- cacheRoot: getBuildCacheRoot(),
76
- totalEntries: filtered.length,
77
- totalBytes: filtered.reduce((s, e) => s + e.sizeBytes, 0),
78
- entries: filtered.map((e) => ({
79
- name: e.name,
80
- version: e.version,
81
- profileHash: e.profileHash,
82
- sizeBytes: e.sizeBytes,
83
- mtime: new Date(e.mtimeMs).toISOString(),
84
- hasArtefact: e.hasArtefact,
85
- uploadCount: e.uploads.length,
86
- })),
87
- }, null, 2) + '\n');
88
- return;
89
- }
90
-
91
- log.info(`Cache root : ${getBuildCacheRoot()}`);
92
- if (filtered.length === 0) {
93
- log.info(' (empty)');
94
- return;
95
- }
96
-
97
- const rows = filtered.map((e) => [
98
- e.name,
99
- e.version,
100
- e.profileHash,
101
- formatBytes(e.sizeBytes),
102
- formatMtime(e.mtimeMs),
103
- e.uploads.length > 0 ? `${e.uploads.length}` : '-',
104
- ]);
105
- const header = ['NAME', 'VERSION', 'PROFILE HASH', 'SIZE', 'MTIME', 'UPLOADS'];
106
- const widths = header.map((h, i) =>
107
- Math.max(h.length, ...rows.map((r) => String(r[i]).length)),
108
- );
109
-
110
- const format = (cells) => cells.map((c, i) => String(c).padEnd(widths[i])).join(' ');
111
- console.log('');
112
- console.log(' ' + format(header));
113
- console.log(' ' + widths.map((w) => '-'.repeat(w)).join(' '));
114
- for (const r of rows) console.log(' ' + format(r));
115
- console.log('');
116
-
117
- const totalBytes = filtered.reduce((s, e) => s + e.sizeBytes, 0);
118
- log.info(`${filtered.length} entries, ${formatBytes(totalBytes)} total`);
119
- }
120
-
121
- // ---------------------------------------------------------------------------
122
- // prune
123
- // ---------------------------------------------------------------------------
124
-
125
- /**
126
- * wyvrnpm cache prune [--keep-last N] [--older-than 30d] [--pattern X] [--dry-run]
127
- *
128
- * Requires at least one of --keep-last / --older-than to avoid footgun
129
- * (use `wyvrnpm clean --build-cache` to wipe everything).
130
- *
131
- * @param {object} argv
132
- */
133
- function prune(argv) {
134
- const hasKeep = argv.keepLast !== undefined && argv.keepLast !== null;
135
- const hasOlder = typeof argv.olderThan === 'string' && argv.olderThan.length > 0;
136
-
137
- if (!hasKeep && !hasOlder) {
138
- log.error(
139
- 'cache prune: specify --keep-last <N> and/or --older-than <duration>.\n' +
140
- ' To wipe the entire build cache, use `wyvrnpm clean --build-cache`.',
141
- );
142
- process.exit(1);
143
- }
144
-
145
- const policy = {};
146
- if (hasKeep) {
147
- const n = Number(argv.keepLast);
148
- if (!Number.isInteger(n) || n < 0) {
149
- log.error(`--keep-last must be a non-negative integer, got ${argv.keepLast}`);
150
- process.exit(1);
151
- }
152
- policy.keepLast = n;
153
- }
154
- if (hasOlder) {
155
- try { policy.olderThanMs = parseDurationToCutoff(argv.olderThan); }
156
- catch (err) { log.error(err.message); process.exit(1); }
157
- }
158
- if (argv.pattern) {
159
- policy.patternRegex = globToRegExp(argv.pattern);
160
- }
161
-
162
- const entries = listCacheEntries();
163
- const pruneSet = computePruneSet(entries, policy);
164
-
165
- if (pruneSet.length === 0) {
166
- log.info('Nothing to prune under that policy.');
167
- return;
168
- }
169
-
170
- const totalBytes = pruneSet.reduce((s, e) => s + e.sizeBytes, 0);
171
- const verb = argv.dryRun ? 'Would remove' : 'Removing';
172
- log.info(`${verb} ${pruneSet.length} cache entr${pruneSet.length === 1 ? 'y' : 'ies'}, ${formatBytes(totalBytes)}:`);
173
- for (const e of pruneSet) {
174
- console.log(` - ${e.name}@${e.version} [${e.profileHash}] ${formatBytes(e.sizeBytes)} ${formatMtime(e.mtimeMs)}`);
175
- }
176
-
177
- if (argv.dryRun) {
178
- log.info('(dry-run — nothing deleted)');
179
- return;
180
- }
181
-
182
- const removed = removeCacheEntries(pruneSet);
183
- log.info(`Removed ${removed.length} of ${pruneSet.length} cache entr${pruneSet.length === 1 ? 'y' : 'ies'}`);
184
- if (removed.length < pruneSet.length) {
185
- log.warn(`${pruneSet.length - removed.length} entr${pruneSet.length - removed.length === 1 ? 'y' : 'ies'} could not be removed (permissions or concurrent access)`);
186
- }
187
- }
188
-
189
- module.exports = { list, prune };
1
+ 'use strict';
2
+
3
+ // F12: source-build cache inspection + targeted pruning.
4
+ //
5
+ // `wyvrnpm cache list [pattern]` prints a human-readable table (or JSON
6
+ // with --format json) of everything in the machine-wide source-build
7
+ // cache at `%LOCALAPPDATA%\wyvrnpm\bc\`.
8
+ //
9
+ // `wyvrnpm cache prune` removes cache entries per a policy:
10
+ // --keep-last N retain N most-recently-touched per (name,version)
11
+ // --older-than 30d also remove entries older than the threshold
12
+ // --pattern <glob> restrict to matching package names
13
+ // --dry-run print what would go, remove nothing
14
+ //
15
+ // The existing `wyvrnpm clean --build-cache` nukes everything; this is
16
+ // the targeted alternative for teams whose `--upload-built` cache has
17
+ // ballooned.
18
+
19
+ const {
20
+ listCacheEntries,
21
+ computePruneSet,
22
+ removeCacheEntries,
23
+ parseDurationToCutoff,
24
+ getBuildCacheRoot,
25
+ } = require('../build/cache');
26
+ const log = require('../logger');
27
+
28
+ // ---------------------------------------------------------------------------
29
+ // Helpers
30
+ // ---------------------------------------------------------------------------
31
+
32
+ function formatBytes(n) {
33
+ if (n < 1024) return `${n} B`;
34
+ const units = ['KB', 'MB', 'GB', 'TB'];
35
+ let size = n / 1024, i = 0;
36
+ while (size >= 1024 && i < units.length - 1) { size /= 1024; i++; }
37
+ return `${size.toFixed(size >= 100 ? 0 : 1)} ${units[i]}`;
38
+ }
39
+
40
+ function formatMtime(ms) {
41
+ if (!ms) return '<unknown>';
42
+ return new Date(ms).toISOString().replace('T', ' ').slice(0, 16);
43
+ }
44
+
45
+ function globToRegExp(glob) {
46
+ const escaped = glob.replace(/[.+^${}()|[\]\\]/g, '\\$&');
47
+ return new RegExp(`^${escaped.replace(/\*/g, '.*').replace(/\?/g, '.')}$`);
48
+ }
49
+
50
+ function patternFor(argPattern, positional) {
51
+ const src = argPattern ?? positional ?? null;
52
+ return src ? globToRegExp(src) : null;
53
+ }
54
+
55
+ // ---------------------------------------------------------------------------
56
+ // list
57
+ // ---------------------------------------------------------------------------
58
+
59
+ /**
60
+ * wyvrnpm cache list [pattern] [--format json|text]
61
+ *
62
+ * @param {object} argv
63
+ */
64
+ function list(argv) {
65
+ const entries = listCacheEntries();
66
+ const regex = patternFor(argv.pattern, argv._?.[1]);
67
+ const filtered = regex ? entries.filter((e) => regex.test(e.name)) : entries;
68
+
69
+ // Newest first — matches what `ls -lt` users expect.
70
+ filtered.sort((a, b) => b.mtimeMs - a.mtimeMs);
71
+
72
+ if (argv.format === 'json') {
73
+ process.stdout.write(JSON.stringify({
74
+ command: 'cache-list',
75
+ cacheRoot: getBuildCacheRoot(),
76
+ totalEntries: filtered.length,
77
+ totalBytes: filtered.reduce((s, e) => s + e.sizeBytes, 0),
78
+ entries: filtered.map((e) => ({
79
+ name: e.name,
80
+ version: e.version,
81
+ profileHash: e.profileHash,
82
+ sizeBytes: e.sizeBytes,
83
+ mtime: new Date(e.mtimeMs).toISOString(),
84
+ hasArtefact: e.hasArtefact,
85
+ uploadCount: e.uploads.length,
86
+ })),
87
+ }, null, 2) + '\n');
88
+ return;
89
+ }
90
+
91
+ log.info(`Cache root : ${getBuildCacheRoot()}`);
92
+ if (filtered.length === 0) {
93
+ log.info(' (empty)');
94
+ return;
95
+ }
96
+
97
+ const rows = filtered.map((e) => [
98
+ e.name,
99
+ e.version,
100
+ e.profileHash,
101
+ formatBytes(e.sizeBytes),
102
+ formatMtime(e.mtimeMs),
103
+ e.uploads.length > 0 ? `${e.uploads.length}` : '-',
104
+ ]);
105
+ const header = ['NAME', 'VERSION', 'PROFILE HASH', 'SIZE', 'MTIME', 'UPLOADS'];
106
+ const widths = header.map((h, i) =>
107
+ Math.max(h.length, ...rows.map((r) => String(r[i]).length)),
108
+ );
109
+
110
+ const format = (cells) => cells.map((c, i) => String(c).padEnd(widths[i])).join(' ');
111
+ console.log('');
112
+ console.log(' ' + format(header));
113
+ console.log(' ' + widths.map((w) => '-'.repeat(w)).join(' '));
114
+ for (const r of rows) console.log(' ' + format(r));
115
+ console.log('');
116
+
117
+ const totalBytes = filtered.reduce((s, e) => s + e.sizeBytes, 0);
118
+ log.info(`${filtered.length} entries, ${formatBytes(totalBytes)} total`);
119
+ }
120
+
121
+ // ---------------------------------------------------------------------------
122
+ // prune
123
+ // ---------------------------------------------------------------------------
124
+
125
+ /**
126
+ * wyvrnpm cache prune [--keep-last N] [--older-than 30d] [--pattern X] [--dry-run]
127
+ *
128
+ * Requires at least one of --keep-last / --older-than to avoid footgun
129
+ * (use `wyvrnpm clean --build-cache` to wipe everything).
130
+ *
131
+ * @param {object} argv
132
+ */
133
+ function prune(argv) {
134
+ const hasKeep = argv.keepLast !== undefined && argv.keepLast !== null;
135
+ const hasOlder = typeof argv.olderThan === 'string' && argv.olderThan.length > 0;
136
+
137
+ if (!hasKeep && !hasOlder) {
138
+ log.error(
139
+ 'cache prune: specify --keep-last <N> and/or --older-than <duration>.\n' +
140
+ ' To wipe the entire build cache, use `wyvrnpm clean --build-cache`.',
141
+ );
142
+ process.exit(1);
143
+ }
144
+
145
+ const policy = {};
146
+ if (hasKeep) {
147
+ const n = Number(argv.keepLast);
148
+ if (!Number.isInteger(n) || n < 0) {
149
+ log.error(`--keep-last must be a non-negative integer, got ${argv.keepLast}`);
150
+ process.exit(1);
151
+ }
152
+ policy.keepLast = n;
153
+ }
154
+ if (hasOlder) {
155
+ try { policy.olderThanMs = parseDurationToCutoff(argv.olderThan); }
156
+ catch (err) { log.error(err.message); process.exit(1); }
157
+ }
158
+ if (argv.pattern) {
159
+ policy.patternRegex = globToRegExp(argv.pattern);
160
+ }
161
+
162
+ const entries = listCacheEntries();
163
+ const pruneSet = computePruneSet(entries, policy);
164
+
165
+ if (pruneSet.length === 0) {
166
+ log.info('Nothing to prune under that policy.');
167
+ return;
168
+ }
169
+
170
+ const totalBytes = pruneSet.reduce((s, e) => s + e.sizeBytes, 0);
171
+ const verb = argv.dryRun ? 'Would remove' : 'Removing';
172
+ log.info(`${verb} ${pruneSet.length} cache entr${pruneSet.length === 1 ? 'y' : 'ies'}, ${formatBytes(totalBytes)}:`);
173
+ for (const e of pruneSet) {
174
+ console.log(` - ${e.name}@${e.version} [${e.profileHash}] ${formatBytes(e.sizeBytes)} ${formatMtime(e.mtimeMs)}`);
175
+ }
176
+
177
+ if (argv.dryRun) {
178
+ log.info('(dry-run — nothing deleted)');
179
+ return;
180
+ }
181
+
182
+ const removed = removeCacheEntries(pruneSet);
183
+ log.info(`Removed ${removed.length} of ${pruneSet.length} cache entr${pruneSet.length === 1 ? 'y' : 'ies'}`);
184
+ if (removed.length < pruneSet.length) {
185
+ log.warn(`${pruneSet.length - removed.length} entr${pruneSet.length - removed.length === 1 ? 'y' : 'ies'} could not be removed (permissions or concurrent access)`);
186
+ }
187
+ }
188
+
189
+ module.exports = { list, prune };
@@ -1,80 +1,80 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
-
6
- const {
7
- clearBuildCache,
8
- getBuildCacheRoot,
9
- clearUploadSidecars,
10
- } = require('../build/cache');
11
- const log = require('../logger');
12
-
13
- /**
14
- * Removes the project's `wyvrn_internal/` package cache and `wyvrn.lock` file.
15
- * With `--build-cache`, also clears the machine-wide source-build cache
16
- * under `%LOCALAPPDATA%\wyvrnpm\bc\` (shared across projects).
17
- *
18
- * `--uploaded-built` wipes just the consumer's local RECORD of what they
19
- * have uploaded via `wyvrnpm install --build=missing --upload-built` (the
20
- * `.uploaded-to.json` sidecars under the build cache). It does NOT touch
21
- * the registry, the artefact zips, or the source clones. Privacy / local
22
- * audit cleanup only.
23
- *
24
- * @param {object} argv
25
- * @param {string} argv.root Project root directory.
26
- * @param {string} argv.manifest Path to the manifest file (used to locate wyvrn.lock).
27
- * @param {boolean} [argv.buildCache] When true, also nukes the source-build cache.
28
- * @param {boolean} [argv.uploadedBuilt] When true, wipes upload sidecars only.
29
- * @returns {Promise<void>}
30
- */
31
- async function clean(argv) {
32
- const rootDir = path.resolve(argv.root);
33
- const razerDir = path.join(rootDir, 'wyvrn_internal');
34
- const lockPath = path.join(path.dirname(path.resolve(argv.manifest)), 'wyvrn.lock');
35
-
36
- // --uploaded-built is a targeted cleanup mode. When passed on its own,
37
- // skip the default wyvrn_internal/ + wyvrn.lock scrub so a user can
38
- // "forget uploads" without also wiping their project-local install.
39
- const targetedOnly = argv.uploadedBuilt && !argv.buildCache;
40
-
41
- let removedAnything = false;
42
-
43
- if (!targetedOnly) {
44
- if (fs.existsSync(razerDir)) {
45
- fs.rmSync(razerDir, { recursive: true, force: true });
46
- log.info(`Removed ${razerDir}`);
47
- removedAnything = true;
48
- } else {
49
- log.info(`Nothing to clean at ${razerDir}`);
50
- }
51
-
52
- if (fs.existsSync(lockPath)) {
53
- fs.unlinkSync(lockPath);
54
- log.info(`Removed ${lockPath}`);
55
- removedAnything = true;
56
- }
57
- }
58
-
59
- if (argv.buildCache) {
60
- const removed = clearBuildCache();
61
- if (removed) {
62
- log.info(`Removed source-build cache ${removed}`);
63
- removedAnything = true;
64
- } else {
65
- log.info(`No source-build cache at ${getBuildCacheRoot()}`);
66
- }
67
- } else if (argv.uploadedBuilt) {
68
- // clearBuildCache() would have nuked the sidecars as a side-effect, so
69
- // only bother with the sidecar sweep when the cache itself is surviving.
70
- const removed = clearUploadSidecars();
71
- log.info(`Removed ${removed} upload record${removed === 1 ? '' : 's'} from the build cache`);
72
- if (removed > 0) removedAnything = true;
73
- }
74
-
75
- if (!removedAnything) {
76
- log.info('Nothing to clean.');
77
- }
78
- }
79
-
80
- module.exports = clean;
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const {
7
+ clearBuildCache,
8
+ getBuildCacheRoot,
9
+ clearUploadSidecars,
10
+ } = require('../build/cache');
11
+ const log = require('../logger');
12
+
13
+ /**
14
+ * Removes the project's `wyvrn_internal/` package cache and `wyvrn.lock` file.
15
+ * With `--build-cache`, also clears the machine-wide source-build cache
16
+ * under `%LOCALAPPDATA%\wyvrnpm\bc\` (shared across projects).
17
+ *
18
+ * `--uploaded-built` wipes just the consumer's local RECORD of what they
19
+ * have uploaded via `wyvrnpm install --build=missing --upload-built` (the
20
+ * `.uploaded-to.json` sidecars under the build cache). It does NOT touch
21
+ * the registry, the artefact zips, or the source clones. Privacy / local
22
+ * audit cleanup only.
23
+ *
24
+ * @param {object} argv
25
+ * @param {string} argv.root Project root directory.
26
+ * @param {string} argv.manifest Path to the manifest file (used to locate wyvrn.lock).
27
+ * @param {boolean} [argv.buildCache] When true, also nukes the source-build cache.
28
+ * @param {boolean} [argv.uploadedBuilt] When true, wipes upload sidecars only.
29
+ * @returns {Promise<void>}
30
+ */
31
+ async function clean(argv) {
32
+ const rootDir = path.resolve(argv.root);
33
+ const razerDir = path.join(rootDir, 'wyvrn_internal');
34
+ const lockPath = path.join(path.dirname(path.resolve(argv.manifest)), 'wyvrn.lock');
35
+
36
+ // --uploaded-built is a targeted cleanup mode. When passed on its own,
37
+ // skip the default wyvrn_internal/ + wyvrn.lock scrub so a user can
38
+ // "forget uploads" without also wiping their project-local install.
39
+ const targetedOnly = argv.uploadedBuilt && !argv.buildCache;
40
+
41
+ let removedAnything = false;
42
+
43
+ if (!targetedOnly) {
44
+ if (fs.existsSync(razerDir)) {
45
+ fs.rmSync(razerDir, { recursive: true, force: true });
46
+ log.info(`Removed ${razerDir}`);
47
+ removedAnything = true;
48
+ } else {
49
+ log.info(`Nothing to clean at ${razerDir}`);
50
+ }
51
+
52
+ if (fs.existsSync(lockPath)) {
53
+ fs.unlinkSync(lockPath);
54
+ log.info(`Removed ${lockPath}`);
55
+ removedAnything = true;
56
+ }
57
+ }
58
+
59
+ if (argv.buildCache) {
60
+ const removed = clearBuildCache();
61
+ if (removed) {
62
+ log.info(`Removed source-build cache ${removed}`);
63
+ removedAnything = true;
64
+ } else {
65
+ log.info(`No source-build cache at ${getBuildCacheRoot()}`);
66
+ }
67
+ } else if (argv.uploadedBuilt) {
68
+ // clearBuildCache() would have nuked the sidecars as a side-effect, so
69
+ // only bother with the sidecar sweep when the cache itself is surviving.
70
+ const removed = clearUploadSidecars();
71
+ log.info(`Removed ${removed} upload record${removed === 1 ? '' : 's'} from the build cache`);
72
+ if (removed > 0) removedAnything = true;
73
+ }
74
+
75
+ if (!removedAnything) {
76
+ log.info('Nothing to clean.');
77
+ }
78
+ }
79
+
80
+ module.exports = clean;