@kb-labs/cli-commands 2.93.0 → 2.94.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.
@@ -64,8 +64,9 @@ interface DiscoveryResult {
64
64
  /**
65
65
  * Scope this result came from. Platform-wide discovery (monorepo workspace,
66
66
  * platform node_modules) reports `platform`; discovery from
67
- * `<projectRoot>/.kb/plugins/` reports `project`. On collision (same
68
- * packageName in both scopes) the platform entry wins — see ADR-0012.
67
+ * `<projectRoot>/.kb/plugins/` or `<projectRoot>` workspace reports `project`.
68
+ * On collision (same packageName in both scopes) the project entry wins —
69
+ * project overrides platform defaults.
69
70
  */
70
71
  scope: 'platform' | 'project';
71
72
  packageName: string;
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-D_Is1Qqq.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-D_Is1Qqq.js';
1
+ import { C as CommandGroup, P as ProductGroup, a as Command, R as RegisteredCommand } from './discover-CCE84_5E.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-CCE84_5E.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
@@ -759,14 +759,14 @@ function deduplicateManifests(all) {
759
759
  byPackageName.set(result.packageName, projectEntry);
760
760
  continue;
761
761
  }
762
- const winner = existing.scope === "platform" ? existing : result;
763
- const loser = existing.scope === "platform" ? result : existing;
764
- log("warn", JSON.stringify({
765
- code: "DISCOVERY_SCOPE_COLLISION",
762
+ const winner = existing.scope === "project" ? existing : result;
763
+ const loser = existing.scope === "project" ? result : existing;
764
+ log("debug", JSON.stringify({
765
+ code: "DISCOVERY_SCOPE_OVERRIDE",
766
766
  packageName: result.packageName,
767
- platformPath: winner.pkgRoot,
768
- projectPath: loser.pkgRoot,
769
- message: "Package exists in both platform and project scopes \u2014 platform wins."
767
+ projectPath: winner.pkgRoot,
768
+ platformPath: loser.pkgRoot,
769
+ message: "Package exists in both platform and project scopes \u2014 project wins."
770
770
  }));
771
771
  byPackageName.set(result.packageName, winner);
772
772
  continue;
@@ -1063,8 +1063,21 @@ async function discoverManifests(cwd, noCache = false, options = {}) {
1063
1063
  if (projectLocal.length > 0) {
1064
1064
  log("info", `Discovered ${projectLocal.length} project-local plugins`);
1065
1065
  }
1066
+ let projectWorkspace = [];
1067
+ if (roots.projectRoot !== roots.platformRoot) {
1068
+ try {
1069
+ const pwStart = Date.now();
1070
+ const raw = await discoverWorkspace(roots.projectRoot);
1071
+ projectWorkspace = raw.map((r) => ({ ...r, scope: "project" }));
1072
+ timings.projectWorkspace = Date.now() - pwStart;
1073
+ if (projectWorkspace.length > 0) {
1074
+ log("info", `Discovered ${projectWorkspace.length} project workspace packages with CLI manifests`);
1075
+ }
1076
+ } catch {
1077
+ }
1078
+ }
1066
1079
  const dedupStart = Date.now();
1067
- const results = deduplicateManifests([...workspace, ...installed, ...projectLocal]);
1080
+ const results = deduplicateManifests([...workspace, ...installed, ...projectLocal, ...projectWorkspace]);
1068
1081
  timings.deduplicate = Date.now() - dedupStart;
1069
1082
  const saveStart = Date.now();
1070
1083
  await saveCache(cwd, results, roots);