@nusoft/nuos-build-catalogue 0.10.1 → 0.10.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 (2) hide show
  1. package/dist/cli.js +27 -8
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -12,20 +12,22 @@
12
12
  */
13
13
  import path from 'node:path';
14
14
  import { fileURLToPath } from 'node:url';
15
- import { selectEmbedderFromEnv } from './embedder/select.js';
16
- import { openStore } from './store/open.js';
17
- import { runIndex } from './indexer/upsert.js';
18
- import { runSearch } from './search/query.js';
19
- import { formatHumanReadable, formatJson } from './search/format.js';
15
+ // Static imports these don't pull in NuVector / NuFlow transitively.
16
+ // init / migrate / regenerate / summary / list / show / install-protocols all
17
+ // work without those native deps being installed.
20
18
  import { runMigrate } from './migrate/run.js';
21
19
  import { openWorkflowStore } from './migrate/store.js';
22
20
  import { listRegister, showRecord, commandToRegister, listAcrossRegisters, } from './commands/handlers.js';
23
21
  import { runRegenerate } from './regenerate/check.js';
24
- import { createBuildCatalogueRuntime } from './runtime/runtime.js';
25
- import { cmdWuAdvance, cmdWuTick, cmdDecisionSupersede, cmdQuestionResolve, } from './commands/write.js';
26
- import { cmdWuCreate, cmdDecisionCreate, cmdQuestionCreate, cmdPersonaCreate, } from './commands/create.js';
27
22
  import { openPrompt } from './commands/prompt.js';
28
23
  import { cmdInit, cmdInstallProtocols } from './commands/init.js';
24
+ // Dynamic imports below — index / search / write commands / create commands
25
+ // load NuVector or NuFlow transitively. Loading them at module-parse time
26
+ // would crash on platforms where the NuVector native binary isn't resolved
27
+ // (e.g. fresh npx installs before @nusoft/nuvector ships its platform-specific
28
+ // binaries as optionalDependencies). Lazy-load so the lightweight commands
29
+ // (init, migrate, etc.) work universally; the heavyweight commands degrade
30
+ // gracefully when their deps are missing.
29
31
  const __filename = fileURLToPath(import.meta.url);
30
32
  const PACKAGE_ROOT = path.resolve(path.dirname(__filename), '..');
31
33
  // Defaults resolve in this order: env var > flag-supplied > package-relative
@@ -65,6 +67,9 @@ async function cmdIndex(flags) {
65
67
  const catalogueRoot = String(flags['catalogue'] ?? DEFAULT_CATALOGUE_ROOT);
66
68
  const indexPath = String(flags['index'] ?? DEFAULT_INDEX_PATH);
67
69
  const hashPath = String(flags['hash-file'] ?? DEFAULT_HASH_PATH);
70
+ const { selectEmbedderFromEnv } = await import('./embedder/select.js');
71
+ const { openStore } = await import('./store/open.js');
72
+ const { runIndex } = await import('./indexer/upsert.js');
68
73
  const embedder = await selectEmbedderFromEnv();
69
74
  const store = await openStore({ storagePath: indexPath, dimensions: embedder.dimensions });
70
75
  console.log(`indexing ${catalogueRoot}`);
@@ -95,6 +100,10 @@ async function cmdSearch(positional, flags) {
95
100
  process.exit(2);
96
101
  }
97
102
  const indexPath = String(flags['index'] ?? DEFAULT_INDEX_PATH);
103
+ const { selectEmbedderFromEnv } = await import('./embedder/select.js');
104
+ const { openStore } = await import('./store/open.js');
105
+ const { runSearch } = await import('./search/query.js');
106
+ const { formatHumanReadable, formatJson } = await import('./search/format.js');
98
107
  const embedder = await selectEmbedderFromEnv();
99
108
  const store = await openStore({ storagePath: indexPath, dimensions: embedder.dimensions });
100
109
  const limit = flags['limit'] ? Number(flags['limit']) : 10;
@@ -190,6 +199,8 @@ async function cmdRegisterDispatch(command, positional, flags) {
190
199
  console.error(`'advance' is a wu subcommand only`);
191
200
  process.exit(2);
192
201
  }
202
+ const { createBuildCatalogueRuntime } = await import('./runtime/runtime.js');
203
+ const { cmdWuAdvance } = await import('./commands/write.js');
193
204
  const runtime = createBuildCatalogueRuntime({ store, catalogueRoot: buildRoot });
194
205
  const result = await cmdWuAdvance(store, runtime, {
195
206
  handle: positional[1],
@@ -205,6 +216,8 @@ async function cmdRegisterDispatch(command, positional, flags) {
205
216
  console.error(`'tick' is a wu subcommand only`);
206
217
  process.exit(2);
207
218
  }
219
+ const { createBuildCatalogueRuntime } = await import('./runtime/runtime.js');
220
+ const { cmdWuTick } = await import('./commands/write.js');
208
221
  const runtime = createBuildCatalogueRuntime({ store, catalogueRoot: buildRoot });
209
222
  const result = await cmdWuTick(store, runtime, {
210
223
  handle: positional[1],
@@ -220,6 +233,8 @@ async function cmdRegisterDispatch(command, positional, flags) {
220
233
  console.error(`'supersede' is a decision subcommand only`);
221
234
  process.exit(2);
222
235
  }
236
+ const { createBuildCatalogueRuntime } = await import('./runtime/runtime.js');
237
+ const { cmdDecisionSupersede } = await import('./commands/write.js');
223
238
  const runtime = createBuildCatalogueRuntime({ store, catalogueRoot: buildRoot });
224
239
  const result = await cmdDecisionSupersede(store, runtime, {
225
240
  target: positional[1],
@@ -235,6 +250,8 @@ async function cmdRegisterDispatch(command, positional, flags) {
235
250
  console.error(`'resolve' is a question subcommand only`);
236
251
  process.exit(2);
237
252
  }
253
+ const { createBuildCatalogueRuntime } = await import('./runtime/runtime.js');
254
+ const { cmdQuestionResolve } = await import('./commands/write.js');
238
255
  const runtime = createBuildCatalogueRuntime({ store, catalogueRoot: buildRoot });
239
256
  const result = await cmdQuestionResolve(store, runtime, {
240
257
  qHandle: positional[1],
@@ -246,6 +263,8 @@ async function cmdRegisterDispatch(command, positional, flags) {
246
263
  break;
247
264
  }
248
265
  case 'create': {
266
+ const { createBuildCatalogueRuntime } = await import('./runtime/runtime.js');
267
+ const { cmdWuCreate, cmdDecisionCreate, cmdQuestionCreate, cmdPersonaCreate, } = await import('./commands/create.js');
249
268
  const runtime = createBuildCatalogueRuntime({ store, catalogueRoot: buildRoot });
250
269
  const prompt = openPrompt();
251
270
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nusoft/nuos-build-catalogue",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "NuOS build-catalogue tooling: semantic search (WU 110) + migration runner that lifts markdown artefacts into JSON-backed workflow records (WU 111, Phase G).",
5
5
  "type": "module",
6
6
  "bin": {