@memberjunction/cli 5.43.0 → 5.44.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.
@@ -1,13 +1,23 @@
1
1
  /**
2
2
  * Cleanup hook that runs after any command completes.
3
3
  *
4
- * Commands under `mj app *` open an mssql connection pool through
5
- * `ensureProviderInitialized` in utils/open-app-context.ts. The pool keeps
6
- * sockets alive, which pins the Node event loop open and makes the CLI
7
- * appear to hang after the command finishes printing its output.
4
+ * Only `mj app *` commands open an mssql connection pool (through
5
+ * `ensureProviderInitialized` in utils/open-app-context.ts). The pool keeps
6
+ * sockets alive, which pins the Node event loop open and makes the CLI appear
7
+ * to hang after the command finishes printing its output — so for those
8
+ * commands we close it here.
8
9
  *
9
- * `closeConnectionPool` is idempotent if the pool was never opened (most
10
- * non-`app` commands), it no-ops.
10
+ * The import of `open-app-context` is DEFERRED (dynamic) and gated on the
11
+ * command id: that module statically pulls in the entire DB-provider stack
12
+ * (@memberjunction/sqlserver-dataprovider, @memberjunction/metadata-sync,
13
+ * @memberjunction/core), which costs ~2.7s warm and far more on a cold CI
14
+ * runner. Loading it eagerly here charged that cost to EVERY command —
15
+ * including light ones like `install:claude` — which is what made the
16
+ * claude-pack subprocess tests exceed their spawn timeout. Non-`app` commands
17
+ * never open a pool, so they have nothing to close and skip the import.
18
+ *
19
+ * Dynamic import is justified per CLAUDE.md rule #8 (#3 — genuine, measured
20
+ * startup-cost deferral of a single heavy module).
11
21
  */
12
22
  import { Hook } from '@oclif/core';
13
23
  declare const hook: Hook<'postrun'>;
@@ -1 +1 @@
1
- {"version":3,"file":"postrun.d.ts","sourceRoot":"","sources":["../../src/hooks/postrun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,CAMzB,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"postrun.d.ts","sourceRoot":"","sources":["../../src/hooks/postrun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,CAYzB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,6 +1,11 @@
1
- import { closeConnectionPool } from '../utils/open-app-context.js';
2
- const hook = async function () {
1
+ const hook = async function (options) {
2
+ const commandId = options.Command?.id ?? '';
3
+ // Pools are opened exclusively by `app:*` commands; nothing else can leave one open.
4
+ if (!commandId.startsWith('app:')) {
5
+ return;
6
+ }
3
7
  try {
8
+ const { closeConnectionPool } = await import('../utils/open-app-context.js');
4
9
  await closeConnectionPool();
5
10
  }
6
11
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../src/hooks/postrun.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,IAAI,GAAoB,KAAK;IACjC,IAAI,CAAC;QACH,MAAM,mBAAmB,EAAE,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;IAChE,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../src/hooks/postrun.ts"],"names":[],"mappings":"AAuBA,MAAM,IAAI,GAAoB,KAAK,WAAW,OAAO;IACnD,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC;IAC5C,qFAAqF;IACrF,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO;IACT,CAAC;IACD,IAAI,CAAC;QACH,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;QAC7E,MAAM,mBAAmB,EAAE,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;IAChE,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -377,67 +377,6 @@
377
377
  "upgrade.js"
378
378
  ]
379
379
  },
380
- "artifacts:reclassify": {
381
- "aliases": [],
382
- "args": {},
383
- "description": "Upgrade-recovery utility for v5.35 artifact unification. Re-evaluates rows whose TypeID is the deleted JSON fallback but whose actual content does not parse as JSON. Normally a no-op: the v5.35 backfill migration handles this automatically. This command is only relevant when the migration ran BEFORE the artifact-type metadata (Generic Text / Generic Binary) was pushed via `mj sync push`, in which case the migration prints a notice telling you to run this. Reports \"no candidates\" once everything is reconciled. Dry-run by default; --apply writes through Record Changes.",
384
- "examples": [
385
- "<%= config.bin %> <%= command.id %>",
386
- "<%= config.bin %> <%= command.id %> --apply --limit 50"
387
- ],
388
- "flags": {
389
- "conversation-id": {
390
- "description": "Scope to artifacts attached to the given conversation.",
391
- "name": "conversation-id",
392
- "hasDynamicHelp": false,
393
- "multiple": false,
394
- "type": "option"
395
- },
396
- "since": {
397
- "description": "Scope to artifacts created on/after this ISO date.",
398
- "name": "since",
399
- "hasDynamicHelp": false,
400
- "multiple": false,
401
- "type": "option"
402
- },
403
- "limit": {
404
- "description": "Maximum number of rows to inspect.",
405
- "name": "limit",
406
- "default": 100,
407
- "hasDynamicHelp": false,
408
- "multiple": false,
409
- "type": "option"
410
- },
411
- "apply": {
412
- "description": "Write changes. Without this flag, this command only reports what it would do.",
413
- "name": "apply",
414
- "allowNo": false,
415
- "type": "boolean"
416
- },
417
- "verbose": {
418
- "char": "v",
419
- "description": "Print every candidate row, not just the summary.",
420
- "name": "verbose",
421
- "allowNo": false,
422
- "type": "boolean"
423
- }
424
- },
425
- "hasDynamicHelp": false,
426
- "hiddenAliases": [],
427
- "id": "artifacts:reclassify",
428
- "pluginAlias": "@memberjunction/cli",
429
- "pluginName": "@memberjunction/cli",
430
- "pluginType": "core",
431
- "strict": true,
432
- "enableJsonFlag": false,
433
- "isESM": true,
434
- "relativePath": [
435
- "dist",
436
- "commands",
437
- "artifacts",
438
- "reclassify.js"
439
- ]
440
- },
441
380
  "baseline:build": {
442
381
  "aliases": [],
443
382
  "args": {},
@@ -966,6 +905,67 @@
966
905
  "index.js"
967
906
  ]
968
907
  },
908
+ "artifacts:reclassify": {
909
+ "aliases": [],
910
+ "args": {},
911
+ "description": "Upgrade-recovery utility for v5.35 artifact unification. Re-evaluates rows whose TypeID is the deleted JSON fallback but whose actual content does not parse as JSON. Normally a no-op: the v5.35 backfill migration handles this automatically. This command is only relevant when the migration ran BEFORE the artifact-type metadata (Generic Text / Generic Binary) was pushed via `mj sync push`, in which case the migration prints a notice telling you to run this. Reports \"no candidates\" once everything is reconciled. Dry-run by default; --apply writes through Record Changes.",
912
+ "examples": [
913
+ "<%= config.bin %> <%= command.id %>",
914
+ "<%= config.bin %> <%= command.id %> --apply --limit 50"
915
+ ],
916
+ "flags": {
917
+ "conversation-id": {
918
+ "description": "Scope to artifacts attached to the given conversation.",
919
+ "name": "conversation-id",
920
+ "hasDynamicHelp": false,
921
+ "multiple": false,
922
+ "type": "option"
923
+ },
924
+ "since": {
925
+ "description": "Scope to artifacts created on/after this ISO date.",
926
+ "name": "since",
927
+ "hasDynamicHelp": false,
928
+ "multiple": false,
929
+ "type": "option"
930
+ },
931
+ "limit": {
932
+ "description": "Maximum number of rows to inspect.",
933
+ "name": "limit",
934
+ "default": 100,
935
+ "hasDynamicHelp": false,
936
+ "multiple": false,
937
+ "type": "option"
938
+ },
939
+ "apply": {
940
+ "description": "Write changes. Without this flag, this command only reports what it would do.",
941
+ "name": "apply",
942
+ "allowNo": false,
943
+ "type": "boolean"
944
+ },
945
+ "verbose": {
946
+ "char": "v",
947
+ "description": "Print every candidate row, not just the summary.",
948
+ "name": "verbose",
949
+ "allowNo": false,
950
+ "type": "boolean"
951
+ }
952
+ },
953
+ "hasDynamicHelp": false,
954
+ "hiddenAliases": [],
955
+ "id": "artifacts:reclassify",
956
+ "pluginAlias": "@memberjunction/cli",
957
+ "pluginName": "@memberjunction/cli",
958
+ "pluginType": "core",
959
+ "strict": true,
960
+ "enableJsonFlag": false,
961
+ "isESM": true,
962
+ "relativePath": [
963
+ "dist",
964
+ "commands",
965
+ "artifacts",
966
+ "reclassify.js"
967
+ ]
968
+ },
969
969
  "codegen:5-0-fix-entity-names": {
970
970
  "aliases": [],
971
971
  "args": {},
@@ -5453,5 +5453,5 @@
5453
5453
  ]
5454
5454
  }
5455
5455
  },
5456
- "version": "5.43.0"
5456
+ "version": "5.44.0"
5457
5457
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/cli",
3
3
  "type": "module",
4
- "version": "5.43.0",
4
+ "version": "5.44.0",
5
5
  "description": "MemberJunction command line tools",
6
6
  "keywords": [
7
7
  "oclif"
@@ -55,25 +55,25 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@inquirer/prompts": "^8.2.0",
58
- "@memberjunction/ai-cli": "5.43.0",
59
- "@memberjunction/cli-core": "5.43.0",
60
- "@memberjunction/codegen-lib": "5.43.0",
61
- "@memberjunction/config": "5.43.0",
62
- "@memberjunction/core": "5.43.0",
63
- "@memberjunction/generic-database-provider": "5.43.0",
64
- "@memberjunction/installer": "5.43.0",
65
- "@memberjunction/db-auto-doc": "5.43.0",
66
- "@memberjunction/metadata-sync": "5.43.0",
67
- "@memberjunction/open-app-engine": "5.43.0",
68
- "@memberjunction/query-gen": "5.43.0",
69
- "@memberjunction/server-bootstrap-lite": "5.43.0",
58
+ "@memberjunction/ai-cli": "5.44.0",
59
+ "@memberjunction/cli-core": "5.44.0",
60
+ "@memberjunction/codegen-lib": "5.44.0",
61
+ "@memberjunction/config": "5.44.0",
62
+ "@memberjunction/core": "5.44.0",
63
+ "@memberjunction/generic-database-provider": "5.44.0",
64
+ "@memberjunction/installer": "5.44.0",
65
+ "@memberjunction/db-auto-doc": "5.44.0",
66
+ "@memberjunction/metadata-sync": "5.44.0",
67
+ "@memberjunction/open-app-engine": "5.44.0",
68
+ "@memberjunction/query-gen": "5.44.0",
69
+ "@memberjunction/server-bootstrap-lite": "5.44.0",
70
70
  "@memberjunction/skyway-core": "^0.6.2",
71
71
  "@memberjunction/skyway-postgres": "^0.6.2",
72
72
  "@memberjunction/skyway-sqlserver": "^0.6.2",
73
- "@memberjunction/sql-converter": "5.43.0",
74
- "@memberjunction/sqlglot-ts": "5.43.0",
75
- "@memberjunction/sqlserver-dataprovider": "5.43.0",
76
- "@memberjunction/testing-cli": "5.43.0",
73
+ "@memberjunction/sql-converter": "5.44.0",
74
+ "@memberjunction/sqlglot-ts": "5.44.0",
75
+ "@memberjunction/sqlserver-dataprovider": "5.44.0",
76
+ "@memberjunction/testing-cli": "5.44.0",
77
77
  "@oclif/core": "^3.27.0",
78
78
  "@oclif/plugin-help": "^6.2.37",
79
79
  "@oclif/plugin-version": "^2.2.36",