@kb-labs/cli-commands 2.28.0 → 2.30.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/dist/{discover-Be0ez3AR.d.ts → discover-DhqYgS-M.d.ts} +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +48 -0
- package/dist/registry/index.js.map +1 -1
- package/package.json +22 -22
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CommandGroup, P as ProductGroup, a as Command, R as RegisteredCommand } from './discover-
|
|
2
|
-
export { A as AvailabilityCheck, b as CacheFile, c as CommandLookupResult, d as CommandManifest, e as CommandModule, f as CommandType, D as DiscoveryResult, F as FlagDefinition, G as GlobalFlags, g as PackageCacheEntry, h as discoverManifests, i as discoverManifestsByNamespace, j as findCommand, k as findCommandWithType, r as registry } from './discover-
|
|
1
|
+
import { C as CommandGroup, P as ProductGroup, a as Command, R as RegisteredCommand } from './discover-DhqYgS-M.js';
|
|
2
|
+
export { A as AvailabilityCheck, b as CacheFile, c as CommandLookupResult, d as CommandManifest, e as CommandModule, f as CommandType, D as DiscoveryResult, F as FlagDefinition, G as GlobalFlags, g as PackageCacheEntry, h as discoverManifests, i as discoverManifestsByNamespace, j as findCommand, k as findCommandWithType, r as registry } from './discover-DhqYgS-M.js';
|
|
3
3
|
import { ILogger } from '@kb-labs/core-platform';
|
|
4
4
|
export { TimingTracker } from '@kb-labs/shared-cli-ui';
|
|
5
5
|
import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';
|
package/dist/index.js
CHANGED
|
@@ -249,6 +249,15 @@ async function computePluginsStateHash(cwd) {
|
|
|
249
249
|
return "";
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
+
async function computeMarketplaceLockHash(cwd) {
|
|
253
|
+
const lockPath = path.join(cwd, ".kb", "marketplace.lock");
|
|
254
|
+
try {
|
|
255
|
+
const content = await promises.readFile(lockPath, "utf8");
|
|
256
|
+
return createHash("sha256").update(content).digest("hex");
|
|
257
|
+
} catch {
|
|
258
|
+
return "";
|
|
259
|
+
}
|
|
260
|
+
}
|
|
252
261
|
async function detectNewWorkspacePackages(cwd, cachedPackages) {
|
|
253
262
|
if (!cachedPackages) {
|
|
254
263
|
return true;
|
|
@@ -470,6 +479,30 @@ async function discoverWorkspace(cwd) {
|
|
|
470
479
|
}
|
|
471
480
|
}
|
|
472
481
|
}
|
|
482
|
+
const localPluginPattern = path.join(
|
|
483
|
+
".kb",
|
|
484
|
+
"plugins",
|
|
485
|
+
"*",
|
|
486
|
+
"packages",
|
|
487
|
+
"*-entry",
|
|
488
|
+
PACKAGE_JSON
|
|
489
|
+
);
|
|
490
|
+
const localPluginFiles = await glob(localPluginPattern, {
|
|
491
|
+
cwd,
|
|
492
|
+
absolute: false,
|
|
493
|
+
ignore: ["**/node_modules/**"]
|
|
494
|
+
});
|
|
495
|
+
for (const pkgFile of localPluginFiles) {
|
|
496
|
+
const pkgRoot = path.dirname(path.join(cwd, pkgFile));
|
|
497
|
+
const pkg = await readPackageJson(path.join(cwd, pkgFile));
|
|
498
|
+
if (!pkg) {
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
const manifestInfo = await findManifestPath(pkgRoot, pkg);
|
|
502
|
+
if (manifestInfo.path) {
|
|
503
|
+
packageInfos.push({ pkgRoot, pkg, manifestPath: manifestInfo.path });
|
|
504
|
+
}
|
|
505
|
+
}
|
|
473
506
|
const loadPromises = packageInfos.map(async ({ pkgRoot, pkg, manifestPath }) => {
|
|
474
507
|
const pkgStart = Date.now();
|
|
475
508
|
try {
|
|
@@ -738,6 +771,11 @@ async function loadCache(cwd) {
|
|
|
738
771
|
log("debug", "Cache invalidated: .kb/plugins.json changed");
|
|
739
772
|
return null;
|
|
740
773
|
}
|
|
774
|
+
const currentMarketplaceLockHash = await computeMarketplaceLockHash(cwd);
|
|
775
|
+
if (currentMarketplaceLockHash && cache.marketplaceLockHash && cache.marketplaceLockHash !== currentMarketplaceLockHash) {
|
|
776
|
+
log("debug", "Cache invalidated: .kb/marketplace.lock changed");
|
|
777
|
+
return null;
|
|
778
|
+
}
|
|
741
779
|
const parsedCache = cache;
|
|
742
780
|
parsedCache.ttlMs = parsedCache.ttlMs ?? DISK_CACHE_TTL_MS;
|
|
743
781
|
for (const entry of Object.values(parsedCache.packages)) {
|
|
@@ -835,6 +873,7 @@ async function saveCache(cwd, results) {
|
|
|
835
873
|
const lockfileHash = await computeLockfileHash(cwd);
|
|
836
874
|
const configHash = await computeConfigHash(cwd);
|
|
837
875
|
const pluginsStateHash = await computePluginsStateHash(cwd);
|
|
876
|
+
const marketplaceLockHash = await computeMarketplaceLockHash(cwd);
|
|
838
877
|
if (lockfileHash) {
|
|
839
878
|
stateHasher.update(lockfileHash);
|
|
840
879
|
}
|
|
@@ -844,6 +883,9 @@ async function saveCache(cwd, results) {
|
|
|
844
883
|
if (pluginsStateHash) {
|
|
845
884
|
stateHasher.update(pluginsStateHash);
|
|
846
885
|
}
|
|
886
|
+
if (marketplaceLockHash) {
|
|
887
|
+
stateHasher.update(marketplaceLockHash);
|
|
888
|
+
}
|
|
847
889
|
const cache = {
|
|
848
890
|
version: process.version,
|
|
849
891
|
cliVersion: process.env.CLI_VERSION || "0.1.0",
|
|
@@ -853,6 +895,7 @@ async function saveCache(cwd, results) {
|
|
|
853
895
|
lockfileHash: lockfileHash || void 0,
|
|
854
896
|
configHash: configHash || void 0,
|
|
855
897
|
pluginsStateHash: pluginsStateHash || void 0,
|
|
898
|
+
marketplaceLockHash: marketplaceLockHash || void 0,
|
|
856
899
|
packages
|
|
857
900
|
};
|
|
858
901
|
try {
|
|
@@ -3665,6 +3708,7 @@ function checkCollision(manifest, existing, currentSource, namespace) {
|
|
|
3665
3708
|
}
|
|
3666
3709
|
function preflightManifests(discoveryResults, logger) {
|
|
3667
3710
|
const log3 = logger ?? platform.logger;
|
|
3711
|
+
const logLevel = getLogLevel();
|
|
3668
3712
|
const valid = [];
|
|
3669
3713
|
const skipped = [];
|
|
3670
3714
|
for (const result of discoveryResults) {
|
|
@@ -3682,6 +3726,10 @@ function preflightManifests(discoveryResults, logger) {
|
|
|
3682
3726
|
reason
|
|
3683
3727
|
});
|
|
3684
3728
|
log3.warn(`Preflight skipped manifest ${manifestId}: ${reason}`);
|
|
3729
|
+
if (logLevel === "debug") {
|
|
3730
|
+
process.stderr.write(`[debug][preflight] skipped ${manifestId} (${result.source}): ${reason}
|
|
3731
|
+
`);
|
|
3732
|
+
}
|
|
3685
3733
|
}
|
|
3686
3734
|
}
|
|
3687
3735
|
if (allowed.length > 0) {
|