@happyvertical/smrt-cli 0.36.3 → 0.36.5

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.
@@ -176,7 +176,10 @@ const configExportCommand = {
176
176
  format: outputFormat,
177
177
  includeSecrets
178
178
  });
179
- const outputPath = path.resolve(process.cwd(), options.output);
179
+ const outputPath = path.resolve(
180
+ process.cwd(),
181
+ options.output ?? "smrt.exported.json"
182
+ );
180
183
  const outputDir = path.dirname(outputPath);
181
184
  if (!fs.existsSync(outputDir)) {
182
185
  fs.mkdirSync(outputDir, { recursive: true });
@@ -488,13 +491,7 @@ const dbDiffCommand = {
488
491
  handler: async (_args, options) => {
489
492
  let db;
490
493
  try {
491
- const unsupportedFileOptions = [
492
- "generate",
493
- "name",
494
- "format",
495
- "with-down",
496
- "output"
497
- ].filter(
494
+ const unsupportedFileOptions = ["generate", "name", "format", "with-down", "output"].filter(
498
495
  (option) => options[option] !== void 0 && options[option] !== false
499
496
  );
500
497
  if (unsupportedFileOptions.length > 0) {
@@ -581,15 +578,9 @@ const dbDiffCommand = {
581
578
  }
582
579
  console.log();
583
580
  }
584
- const columnChanges = diff.changes.filter(
585
- (c) => c.type === "add_column"
586
- );
587
- const indexChanges = diff.changes.filter(
588
- (c) => c.type === "add_index"
589
- );
590
- const indexDrops = diff.changes.filter(
591
- (c) => c.type === "drop_index"
592
- );
581
+ const columnChanges = diff.changes.filter((c) => c.type === "add_column");
582
+ const indexChanges = diff.changes.filter((c) => c.type === "add_index");
583
+ const indexDrops = diff.changes.filter((c) => c.type === "drop_index");
593
584
  const typeUpgrades = diff.changes.filter(
594
585
  (c) => c.type === "type_upgrade"
595
586
  );
@@ -623,7 +614,7 @@ const dbDiffCommand = {
623
614
  );
624
615
  }
625
616
  const orphanDrops = indexDrops.filter(
626
- (c) => !recreateNames.has(c.name)
617
+ (c) => !(c.name && recreateNames.has(c.name))
627
618
  );
628
619
  if (orphanDrops.length > 0) {
629
620
  console.log(` 🗑️ Indexes to drop (${orphanDrops.length}):`);
@@ -633,7 +624,7 @@ const dbDiffCommand = {
633
624
  console.log();
634
625
  }
635
626
  const newIndexes = indexChanges.filter(
636
- (c) => !recreateNames.has(c.name)
627
+ (c) => !(c.name && recreateNames.has(c.name))
637
628
  );
638
629
  if (newIndexes.length > 0) {
639
630
  console.log(` 🗂️ New indexes (${newIndexes.length}):`);
@@ -3213,7 +3204,8 @@ async function getExportableFields(typeName, fileConfig, fieldExportDefault) {
3213
3204
  );
3214
3205
  }
3215
3206
  const exportableFields = [];
3216
- for (const [fieldName, fieldDef] of fields) {
3207
+ for (const [fieldName, rawFieldDef] of fields) {
3208
+ const fieldDef = rawFieldDef;
3217
3209
  if (fieldDef._meta?.__smrtSystemField === true) continue;
3218
3210
  if (fieldDef.transient) continue;
3219
3211
  if (fieldDef.type === "oneToMany" || fieldDef.type === "manyToMany")
@@ -4110,7 +4102,9 @@ function mergeArraysByKey(base, ours, theirs, keyField = "id") {
4110
4102
  const keylessObjects = [];
4111
4103
  const getKey = (obj) => {
4112
4104
  if (!obj || typeof obj !== "object") return null;
4113
- return obj[keyField] ?? obj.slug ?? null;
4105
+ const record = obj;
4106
+ const key = record[keyField] ?? record.slug ?? null;
4107
+ return key;
4114
4108
  };
4115
4109
  const getTimestamp = (obj) => {
4116
4110
  if (obj.updated_at) {
@@ -4123,26 +4117,29 @@ function mergeArraysByKey(base, ours, theirs, keyField = "id") {
4123
4117
  }
4124
4118
  return 0;
4125
4119
  };
4126
- for (const obj of base) {
4127
- const key = getKey(obj);
4120
+ for (const item of base) {
4121
+ const key = getKey(item);
4128
4122
  if (key) {
4123
+ const obj = item;
4129
4124
  merged.set(key, { ...obj, _source: "base" });
4130
4125
  }
4131
4126
  }
4132
- for (const obj of ours) {
4133
- const key = getKey(obj);
4127
+ for (const item of ours) {
4128
+ const key = getKey(item);
4134
4129
  if (key) {
4130
+ const obj = item;
4135
4131
  const existing = merged.get(key);
4136
4132
  if (!existing || existing._source === "base") {
4137
4133
  merged.set(key, { ...obj, _source: "ours" });
4138
4134
  }
4139
- } else if (obj && typeof obj === "object") {
4140
- keylessObjects.push(obj);
4135
+ } else if (item && typeof item === "object") {
4136
+ keylessObjects.push(item);
4141
4137
  }
4142
4138
  }
4143
- for (const obj of theirs) {
4144
- const key = getKey(obj);
4139
+ for (const item of theirs) {
4140
+ const key = getKey(item);
4145
4141
  if (key) {
4142
+ const obj = item;
4146
4143
  const existing = merged.get(key);
4147
4144
  if (!existing) {
4148
4145
  merged.set(key, { ...obj, _source: "theirs" });
@@ -4183,12 +4180,13 @@ function sanitizeMergeValue(value) {
4183
4180
  if (value === null || typeof value !== "object") {
4184
4181
  return value;
4185
4182
  }
4183
+ const source = value;
4186
4184
  const clean = {};
4187
- for (const key of Object.keys(value)) {
4185
+ for (const key of Object.keys(source)) {
4188
4186
  if (DANGEROUS_KEYS.has(key)) {
4189
4187
  continue;
4190
4188
  }
4191
- clean[key] = sanitizeMergeValue(value[key]);
4189
+ clean[key] = sanitizeMergeValue(source[key]);
4192
4190
  }
4193
4191
  return clean;
4194
4192
  }
@@ -4203,19 +4201,22 @@ function mergeObjects(base, ours, theirs) {
4203
4201
  if (typeof theirs !== "object" || theirs === null) {
4204
4202
  return sanitizeMergeValue(ours);
4205
4203
  }
4204
+ const baseObj = base ?? {};
4205
+ const oursObj = ours;
4206
+ const theirsObj = theirs;
4206
4207
  const result = {};
4207
4208
  const allKeys = /* @__PURE__ */ new Set([
4208
- ...Object.keys(base || {}),
4209
- ...Object.keys(ours),
4210
- ...Object.keys(theirs)
4209
+ ...Object.keys(baseObj),
4210
+ ...Object.keys(oursObj),
4211
+ ...Object.keys(theirsObj)
4211
4212
  ]);
4212
4213
  for (const key of allKeys) {
4213
4214
  if (DANGEROUS_KEYS.has(key)) {
4214
4215
  continue;
4215
4216
  }
4216
- const baseVal = base?.[key];
4217
- const oursVal = ours[key];
4218
- const theirsVal = theirs[key];
4217
+ const baseVal = baseObj[key];
4218
+ const oursVal = oursObj[key];
4219
+ const theirsVal = theirsObj[key];
4219
4220
  if (Array.isArray(oursVal) || Array.isArray(theirsVal)) {
4220
4221
  const baseArray = Array.isArray(baseVal) ? baseVal : [];
4221
4222
  const oursArray = Array.isArray(oursVal) ? oursVal : [];
@@ -4495,10 +4496,12 @@ function countObjects(data) {
4495
4496
  return data.length;
4496
4497
  }
4497
4498
  if (typeof data === "object" && data !== null) {
4499
+ const record = data;
4498
4500
  let count = 0;
4499
- for (const key of Object.keys(data)) {
4500
- if (Array.isArray(data[key])) {
4501
- count += data[key].length;
4501
+ for (const key of Object.keys(record)) {
4502
+ const value = record[key];
4503
+ if (Array.isArray(value)) {
4504
+ count += value.length;
4502
4505
  } else {
4503
4506
  count += 1;
4504
4507
  }
@@ -4770,20 +4773,21 @@ async function cleanupGitTemplate(config) {
4770
4773
  }
4771
4774
  }
4772
4775
  function validateTemplateConfig$2(config, source) {
4776
+ const record = config && typeof config === "object" ? config : {};
4773
4777
  const required = ["name", "description", "dependencies"];
4774
4778
  for (const field of required) {
4775
- if (!config[field]) {
4779
+ if (!record[field]) {
4776
4780
  throw new Error(
4777
4781
  `Invalid template config at ${source}: missing required field '${field}'`
4778
4782
  );
4779
4783
  }
4780
4784
  }
4781
- if (typeof config.dependencies !== "object") {
4785
+ if (typeof record.dependencies !== "object") {
4782
4786
  throw new Error(
4783
4787
  `Invalid template config at ${source}: 'dependencies' must be an object`
4784
4788
  );
4785
4789
  }
4786
- if (config.devDependencies && typeof config.devDependencies !== "object") {
4790
+ if (record.devDependencies && typeof record.devDependencies !== "object") {
4787
4791
  throw new Error(
4788
4792
  `Invalid template config at ${source}: 'devDependencies' must be an object`
4789
4793
  );
@@ -4881,20 +4885,21 @@ async function loadLocalTemplate(resolvedPath) {
4881
4885
  }
4882
4886
  }
4883
4887
  function validateTemplateConfig$1(config, source) {
4888
+ const record = config && typeof config === "object" ? config : {};
4884
4889
  const required = ["name", "description", "dependencies"];
4885
4890
  for (const field of required) {
4886
- if (!config[field]) {
4891
+ if (!record[field]) {
4887
4892
  throw new Error(
4888
4893
  `Invalid template config at ${source}: missing required field '${field}'`
4889
4894
  );
4890
4895
  }
4891
4896
  }
4892
- if (typeof config.dependencies !== "object") {
4897
+ if (typeof record.dependencies !== "object") {
4893
4898
  throw new Error(
4894
4899
  `Invalid template config at ${source}: 'dependencies' must be an object`
4895
4900
  );
4896
4901
  }
4897
- if (config.devDependencies && typeof config.devDependencies !== "object") {
4902
+ if (record.devDependencies && typeof record.devDependencies !== "object") {
4898
4903
  throw new Error(
4899
4904
  `Invalid template config at ${source}: 'devDependencies' must be an object`
4900
4905
  );
@@ -5007,20 +5012,21 @@ async function discoverInstalledTemplates() {
5007
5012
  return templates;
5008
5013
  }
5009
5014
  function validateTemplateConfig(config, source) {
5015
+ const record = config && typeof config === "object" ? config : {};
5010
5016
  const required = ["name", "description", "dependencies"];
5011
5017
  for (const field of required) {
5012
- if (!config[field]) {
5018
+ if (!record[field]) {
5013
5019
  throw new Error(
5014
5020
  `Invalid template config at ${source}: missing required field '${field}'`
5015
5021
  );
5016
5022
  }
5017
5023
  }
5018
- if (typeof config.dependencies !== "object") {
5024
+ if (typeof record.dependencies !== "object") {
5019
5025
  throw new Error(
5020
5026
  `Invalid template config at ${source}: 'dependencies' must be an object`
5021
5027
  );
5022
5028
  }
5023
- if (config.devDependencies && typeof config.devDependencies !== "object") {
5029
+ if (record.devDependencies && typeof record.devDependencies !== "object") {
5024
5030
  throw new Error(
5025
5031
  `Invalid template config at ${source}: 'devDependencies' must be an object`
5026
5032
  );
@@ -5204,7 +5210,8 @@ async function overlayTemplate(source, config, outputDir) {
5204
5210
  baseDir = dirname(source.resolved);
5205
5211
  break;
5206
5212
  case "git": {
5207
- const baseGitDir = config.__templateRoot ?? config.__tempDir;
5213
+ const gitConfig = config;
5214
+ const baseGitDir = gitConfig.__templateRoot ?? gitConfig.__tempDir;
5208
5215
  if (!baseGitDir) {
5209
5216
  throw new Error("Git template temp directory not found");
5210
5217
  }
@@ -5264,6 +5271,9 @@ async function mergePackageJson(outputDir, config, projectName) {
5264
5271
  devDependencies: {}
5265
5272
  };
5266
5273
  }
5274
+ pkg.scripts ??= {};
5275
+ pkg.dependencies ??= {};
5276
+ pkg.devDependencies ??= {};
5267
5277
  pkg.name = projectName;
5268
5278
  pkg.dependencies = {
5269
5279
  ...pkg.dependencies,
@@ -5950,7 +5960,9 @@ const playgroundCommands = {
5950
5960
  const packageResult = writeFileIfAllowed(
5951
5961
  packagePlaygroundPath,
5952
5962
  (await loadPlaygroundRuntime()).createPackagePlaygroundTemplate(
5953
- packageJson.name
5963
+ // The package target is only reached for a named SMRT package;
5964
+ // String() preserves the previous (untyped) pass-through exactly.
5965
+ String(packageJson.name)
5954
5966
  ),
5955
5967
  force
5956
5968
  );
@@ -7381,7 +7393,7 @@ function rowsFromResult(result) {
7381
7393
  return Array.isArray(result?.rows) ? result.rows : [];
7382
7394
  }
7383
7395
  function getRowCount(result) {
7384
- return typeof result?.rowCount === "number" ? result.rowCount : void 0;
7396
+ return !Array.isArray(result) && typeof result?.rowCount === "number" ? result.rowCount : void 0;
7385
7397
  }
7386
7398
  function buildNullSafeIdentityPredicate(columns) {
7387
7399
  return columns.map((column) => {
@@ -7389,6 +7401,10 @@ function buildNullSafeIdentityPredicate(columns) {
7389
7401
  return `(${quoted} = ? OR (${quoted} IS NULL AND ? IS NULL))`;
7390
7402
  }).join(" AND ");
7391
7403
  }
7404
+ function getRowId(row) {
7405
+ const id = row.id;
7406
+ return id == null ? null : id;
7407
+ }
7392
7408
  function getIdentityParams(row, columns) {
7393
7409
  const params = [];
7394
7410
  for (const column of columns) {
@@ -7447,8 +7463,8 @@ async function repairStiDiscriminatorRows(options) {
7447
7463
  tableName,
7448
7464
  legacyMetaType,
7449
7465
  qualifiedMetaType,
7450
- legacyId: row.id ?? null,
7451
- qualifiedId: duplicateRows[0].id ?? null,
7466
+ legacyId: getRowId(row),
7467
+ qualifiedId: getRowId(duplicateRows[0]),
7452
7468
  conflictIdentity
7453
7469
  });
7454
7470
  continue;
@@ -7521,6 +7537,15 @@ function formatStiConflictIdentity(conflict) {
7521
7537
  const ids = conflict.legacyId || conflict.qualifiedId ? ` (legacy id: ${conflict.legacyId ?? "unknown"}, qualified id: ${conflict.qualifiedId ?? "unknown"})` : "";
7522
7538
  return `${identity}${ids}`;
7523
7539
  }
7540
+ function getErrorContext(error) {
7541
+ if (error && typeof error === "object" && "context" in error) {
7542
+ const context = error.context;
7543
+ if (context && typeof context === "object") {
7544
+ return context;
7545
+ }
7546
+ }
7547
+ return void 0;
7548
+ }
7524
7549
  const utilityCommands = {
7525
7550
  introspect: {
7526
7551
  name: "introspect",
@@ -8575,9 +8600,9 @@ ${error.stack}
8575
8600
  errorCount++;
8576
8601
  const errorMsg = error instanceof Error ? error.message : String(error);
8577
8602
  console.error(` ✗ atomic schema migration failed: ${errorMsg}`);
8578
- if (error instanceof Error && "context" in error && error.context?.originalError) {
8603
+ if (error instanceof Error && getErrorContext(error)?.originalError) {
8579
8604
  console.error(
8580
- ` Cause: ${error.context.originalError}`
8605
+ ` Cause: ${getErrorContext(error)?.originalError}`
8581
8606
  );
8582
8607
  }
8583
8608
  if (options.verbose && error instanceof Error && error.stack) {
@@ -8691,7 +8716,7 @@ ${error.stack}
8691
8716
  } catch (error) {
8692
8717
  const qualifiedName = resolution.currentQualifiedName;
8693
8718
  const errorMsg = error instanceof Error ? error.message : String(error);
8694
- const originalError = error?.context?.originalError;
8719
+ const originalError = getErrorContext(error)?.originalError;
8695
8720
  console.error(
8696
8721
  ` ✗ ${tableName}: "${metaType}" → "${qualifiedName}" failed: ${originalError || errorMsg}`
8697
8722
  );
@@ -8783,7 +8808,7 @@ ${error.stack}
8783
8808
  );
8784
8809
  if (error instanceof Error) {
8785
8810
  console.error(` ${error.message}`);
8786
- const ctx = error.context;
8811
+ const ctx = getErrorContext(error);
8787
8812
  if (ctx) {
8788
8813
  if (ctx.originalError) {
8789
8814
  console.error(` Database error: ${ctx.originalError}`);
@@ -8852,7 +8877,9 @@ ${error.stack}
8852
8877
  check("package.json is valid JSON", false, "Invalid JSON format");
8853
8878
  }
8854
8879
  }
8855
- const hasSmrtCore = packageJson.dependencies?.["@happyvertical/smrt-core"] || packageJson.devDependencies?.["@happyvertical/smrt-core"];
8880
+ const hasSmrtCore = Boolean(
8881
+ packageJson.dependencies?.["@happyvertical/smrt-core"] || packageJson.devDependencies?.["@happyvertical/smrt-core"]
8882
+ );
8856
8883
  check(
8857
8884
  "@happyvertical/smrt-core installed",
8858
8885
  hasSmrtCore,
package/dist/index.js CHANGED
@@ -25,56 +25,56 @@ let _docsCommands = null;
25
25
  let _playgroundCommands = null;
26
26
  async function getGnodeCommands() {
27
27
  if (!_gnodeCommands) {
28
- const { gnodeCommands } = await import("./index-psX--9zT.js");
28
+ const { gnodeCommands } = await import("./index-CoHJ40KM.js");
29
29
  _gnodeCommands = gnodeCommands;
30
30
  }
31
31
  return _gnodeCommands;
32
32
  }
33
33
  async function getGitCommands() {
34
34
  if (!_gitCommands) {
35
- const { gitCommands } = await import("./index-psX--9zT.js");
35
+ const { gitCommands } = await import("./index-CoHJ40KM.js");
36
36
  _gitCommands = gitCommands;
37
37
  }
38
38
  return _gitCommands;
39
39
  }
40
40
  async function getGenerateCommands() {
41
41
  if (!_generateCommands) {
42
- const { generateCommands } = await import("./index-psX--9zT.js");
42
+ const { generateCommands } = await import("./index-CoHJ40KM.js");
43
43
  _generateCommands = generateCommands;
44
44
  }
45
45
  return _generateCommands;
46
46
  }
47
47
  async function getInitCommands() {
48
48
  if (!_initCommands) {
49
- const { initCommands } = await import("./index-psX--9zT.js");
49
+ const { initCommands } = await import("./index-CoHJ40KM.js");
50
50
  _initCommands = initCommands;
51
51
  }
52
52
  return _initCommands;
53
53
  }
54
54
  async function getUtilityCommands() {
55
55
  if (!_utilityCommands) {
56
- const { utilityCommands } = await import("./index-psX--9zT.js");
56
+ const { utilityCommands } = await import("./index-CoHJ40KM.js");
57
57
  _utilityCommands = utilityCommands;
58
58
  }
59
59
  return _utilityCommands;
60
60
  }
61
61
  async function getDispatchCommands() {
62
62
  if (!_dispatchCommands) {
63
- const { dispatchCommands } = await import("./index-psX--9zT.js");
63
+ const { dispatchCommands } = await import("./index-CoHJ40KM.js");
64
64
  _dispatchCommands = dispatchCommands;
65
65
  }
66
66
  return _dispatchCommands;
67
67
  }
68
68
  async function getDocsCommands() {
69
69
  if (!_docsCommands) {
70
- const { docsCommands } = await import("./index-psX--9zT.js");
70
+ const { docsCommands } = await import("./index-CoHJ40KM.js");
71
71
  _docsCommands = docsCommands;
72
72
  }
73
73
  return _docsCommands;
74
74
  }
75
75
  async function getPlaygroundCommands() {
76
76
  if (!_playgroundCommands) {
77
- const { playgroundCommands } = await import("./index-psX--9zT.js");
77
+ const { playgroundCommands } = await import("./index-CoHJ40KM.js");
78
78
  _playgroundCommands = playgroundCommands;
79
79
  }
80
80
  return _playgroundCommands;
@@ -105,7 +105,8 @@ class CLIGenerator {
105
105
  * Check if running in test environment
106
106
  */
107
107
  isTestMode() {
108
- return process.env.NODE_ENV === "test" || process.env.VITEST === "true" || typeof global.it === "function" || typeof global.describe === "function";
108
+ const testGlobals = global;
109
+ return process.env.NODE_ENV === "test" || process.env.VITEST === "true" || typeof testGlobals.it === "function" || typeof testGlobals.describe === "function";
109
110
  }
110
111
  /**
111
112
  * Check if a type string represents an inline object type parameter
@@ -208,7 +209,10 @@ class CLIGenerator {
208
209
  const tableName = itemClass.SMRT_TABLE_NAME || itemClass.name.toLowerCase();
209
210
  const existing = ObjectRegistry.getClass(tableName);
210
211
  if (existing && !existing.collectionConstructor) {
211
- ObjectRegistry.registerCollection(tableName, exportValue);
212
+ ObjectRegistry.registerCollection(
213
+ tableName,
214
+ exportValue
215
+ );
212
216
  if (config.verbose) {
213
217
  console.log(`[CLI] Registered local collection ${exportName}`);
214
218
  }
@@ -1173,14 +1177,14 @@ ${objectName}`);
1173
1177
  try {
1174
1178
  const collection = await this.getCollection(objectName);
1175
1179
  const listOptions = {
1176
- limit: Number.parseInt(options.limit, 10),
1177
- offset: Number.parseInt(options.offset, 10)
1180
+ limit: Number.parseInt(String(options.limit), 10),
1181
+ offset: Number.parseInt(String(options.offset), 10)
1178
1182
  };
1179
1183
  const orderBy = options["order-by"] ?? options.orderBy;
1180
- if (orderBy) {
1184
+ if (typeof orderBy === "string" && orderBy) {
1181
1185
  listOptions.orderBy = orderBy;
1182
1186
  }
1183
- if (options.where) {
1187
+ if (typeof options.where === "string" && options.where) {
1184
1188
  listOptions.where = JSON.parse(options.where);
1185
1189
  }
1186
1190
  const results = await collection.list(listOptions);
@@ -1230,7 +1234,7 @@ ${objectName}`);
1230
1234
  try {
1231
1235
  let data = {};
1232
1236
  const fromFile = options["from-file"] ?? options.fromFile;
1233
- if (fromFile) {
1237
+ if (typeof fromFile === "string" && fromFile) {
1234
1238
  const fs = await import("node:fs/promises");
1235
1239
  const content = await fs.readFile(fromFile, "utf-8");
1236
1240
  data = JSON.parse(content);
@@ -1241,7 +1245,7 @@ ${objectName}`);
1241
1245
  for (const [fieldName] of fields) {
1242
1246
  const optionName = fieldName.replace(/_/g, "-");
1243
1247
  if (options[optionName] !== void 0) {
1244
- data[fieldName] = this.parseFieldValue(options[optionName]);
1248
+ data[fieldName] = this.parseFieldValue(String(options[optionName]));
1245
1249
  }
1246
1250
  }
1247
1251
  }
@@ -1272,18 +1276,21 @@ ${objectName}`);
1272
1276
  }
1273
1277
  let data = {};
1274
1278
  const fromFile = options["from-file"] ?? options.fromFile;
1275
- if (fromFile) {
1279
+ if (typeof fromFile === "string" && fromFile) {
1276
1280
  const fs = await import("node:fs/promises");
1277
1281
  const content = await fs.readFile(fromFile, "utf-8");
1278
1282
  data = JSON.parse(content);
1279
1283
  } else if (options.interactive && this.config.prompt) {
1280
- data = await this.promptForFields(objectName, existing);
1284
+ data = await this.promptForFields(
1285
+ objectName,
1286
+ existing
1287
+ );
1281
1288
  } else {
1282
1289
  const fields = ObjectRegistry.getFields(objectName);
1283
1290
  for (const [fieldName] of fields) {
1284
1291
  const optionName = fieldName.replace(/_/g, "-");
1285
1292
  if (options[optionName] !== void 0) {
1286
- data[fieldName] = this.parseFieldValue(options[optionName]);
1293
+ data[fieldName] = this.parseFieldValue(String(options[optionName]));
1287
1294
  }
1288
1295
  }
1289
1296
  }
@@ -1312,8 +1319,9 @@ ${objectName}`);
1312
1319
  return;
1313
1320
  }
1314
1321
  if (!options.force && this.config.prompt) {
1322
+ const label = existing.name || existing.slug || existing.id;
1315
1323
  const confirmed = await this.confirm(
1316
- `Are you sure you want to delete ${objectName} "${existing.name || existing.slug || existing.id}"?`
1324
+ `Are you sure you want to delete ${objectName} "${label}"?`
1317
1325
  );
1318
1326
  if (!confirmed) {
1319
1327
  console.log("Cancelled");
@@ -1406,7 +1414,10 @@ ${objectName}`);
1406
1414
  this.exitWithError(`Method ${methodName} is not callable`);
1407
1415
  return;
1408
1416
  }
1409
- const result = await method.call(obj, ...methodCallArgs);
1417
+ const result = await method.call(
1418
+ obj,
1419
+ ...methodCallArgs
1420
+ );
1410
1421
  spinner.succeed(`Executed ${methodName}`);
1411
1422
  console.log(JSON.stringify(result, null, 2));
1412
1423
  } catch (error) {
@@ -1500,8 +1511,8 @@ Check that the package exports the class and .smrt/register.js imports it.`
1500
1511
  const instanceConfig = {
1501
1512
  ...smrtConfig,
1502
1513
  ...moduleConfig,
1503
- ...useCliDb && { db },
1504
- ...this.context.ai && { ai: this.context.ai },
1514
+ ...useCliDb ? { db } : {},
1515
+ ...this.context.ai ? { ai: this.context.ai } : {},
1505
1516
  // In JSON mode, silence all log output to ensure clean JSON
1506
1517
  ...jsonMode && { silent: true }
1507
1518
  };
@@ -1559,7 +1570,10 @@ Check that the package exports the class and .smrt/register.js imports it.`
1559
1570
  }
1560
1571
  }
1561
1572
  }
1562
- const result = await method.call(obj, ...methodCallArgs);
1573
+ const result = await method.call(
1574
+ obj,
1575
+ ...methodCallArgs
1576
+ );
1563
1577
  spinner.succeed(`Executed ${methodName}`);
1564
1578
  if (result !== void 0) {
1565
1579
  console.log(JSON.stringify(result, null, 2));
@@ -1686,9 +1700,10 @@ Troubleshooting:
1686
1700
  return;
1687
1701
  }
1688
1702
  const keys = ["id", "name", "slug", "created_at"];
1689
- const rows = results.map(
1690
- (item) => keys.map((key) => String(item[key] || "").substring(0, 30))
1691
- );
1703
+ const rows = results.map((item) => {
1704
+ const record = item;
1705
+ return keys.map((key) => String(record[key] || "").substring(0, 30));
1706
+ });
1692
1707
  console.log();
1693
1708
  console.log(keys.join(" "));
1694
1709
  console.log("-".repeat(80));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-cli",
3
- "version": "0.36.3",
3
+ "version": "0.36.5",
4
4
  "description": "Developer CLI for SMRT framework - introspection, testing, and project management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,20 +24,20 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@happyvertical/ai": "^0.74.7",
28
- "@happyvertical/files": "^0.74.7",
29
- "@happyvertical/logger": "^0.74.7",
30
- "@happyvertical/sql": "^0.74.7",
31
- "@happyvertical/utils": "^0.74.7",
27
+ "@happyvertical/ai": "^0.74.10",
28
+ "@happyvertical/files": "^0.74.10",
29
+ "@happyvertical/logger": "^0.74.10",
30
+ "@happyvertical/sql": "^0.74.10",
31
+ "@happyvertical/utils": "^0.74.10",
32
32
  "acorn": "^8.15.0",
33
33
  "fast-glob": "3.3.3",
34
34
  "tar": "^7.5.2",
35
- "@happyvertical/smrt-agents": "0.36.3",
36
- "@happyvertical/smrt-config": "0.36.3",
37
- "@happyvertical/smrt-playground": "0.36.3",
38
- "@happyvertical/smrt-core": "0.36.3",
39
- "@happyvertical/smrt-dev-mcp": "0.36.3",
40
- "@happyvertical/smrt-types": "0.36.3"
35
+ "@happyvertical/smrt-agents": "0.36.5",
36
+ "@happyvertical/smrt-config": "0.36.5",
37
+ "@happyvertical/smrt-core": "0.36.5",
38
+ "@happyvertical/smrt-dev-mcp": "0.36.5",
39
+ "@happyvertical/smrt-playground": "0.36.5",
40
+ "@happyvertical/smrt-types": "0.36.5"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "25.0.9",