@happyvertical/smrt-cli 0.57.10 → 0.57.11

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 (26) hide show
  1. package/README.md +5 -0
  2. package/agents/commerce-money-upgrade.md +2 -0
  3. package/dist/{AuditLogCollection-WDHL-_AF-B-XEAxVt.js → AuditLogCollection-WDHL-_AF-B-Lxv2zK.js} +1 -1
  4. package/dist/{OidcIdentity-BUblgQLs-CNCLrvjW.js → OidcIdentity-BUblgQLs-Ckm8QYCF.js} +2 -2
  5. package/dist/{OidcIdentityCollection-ClOyaHeF-CXbCuX6s.js → OidcIdentityCollection-ClOyaHeF-DgdpVtwP.js} +1 -1
  6. package/dist/{ProfileAssetCollection-CRMcjLJ--c-GEluUg.js → ProfileAssetCollection-CRMcjLJ--C0ZOnhYa.js} +3 -3
  7. package/dist/{ProfileCollection-C4INKh7Y-DOp8miUa.js → ProfileCollection-C4INKh7Y-CWCUc0Hb.js} +17 -17
  8. package/dist/{ProfileLinkCollection-DFfZRsgv-B6WUopKV.js → ProfileLinkCollection-DFfZRsgv-ChNJUwmD.js} +2 -2
  9. package/dist/{ProfileMetadataCollection-BIYKy4Y3-0ifgavRP.js → ProfileMetadataCollection-BIYKy4Y3-CtIYgKhg.js} +1 -1
  10. package/dist/{ProfileMetafieldCollection-Buz7gzag-LmZuJkfj.js → ProfileMetafieldCollection-Buz7gzag-iqEnkSKu.js} +1 -1
  11. package/dist/{ProfileRelationshipCollection-C4g_QLI4-zqqRMcCG.js → ProfileRelationshipCollection-C4g_QLI4-CZhaklz3.js} +1 -1
  12. package/dist/{ProfileTypeCollection-B7kwi1mU-Ce3gA1Qy.js → ProfileTypeCollection-B7kwi1mU-4EyAFp2c.js} +2 -2
  13. package/dist/cli-generator.d.ts +9 -0
  14. package/dist/cli-generator.d.ts.map +1 -1
  15. package/dist/commands/db-upgrade-commerce-money.d.ts.map +1 -1
  16. package/dist/{commands-DTdDVLOD.js → commands-CogDQhN_.js} +3 -2
  17. package/dist/{dist-Br3DJiYF.js → dist-BDzUy1ec.js} +5 -5
  18. package/dist/{dist-Bh0ccFH6.js → dist-BM-JGnJr.js} +16 -16
  19. package/dist/{dist-DtPJO_5w.js → dist-BVztM_cy.js} +2 -2
  20. package/dist/dist-C7aZJWmJ.js +21 -0
  21. package/dist/{dist-DQc67vUC.js → dist-qMFMMDSO.js} +3 -3
  22. package/dist/index.js +50 -11
  23. package/dist/{oidcProvisioningPrimitives-DNP9EZlU-DwTTwWII.js → oidcProvisioningPrimitives-DNP9EZlU-B9po079I.js} +3 -3
  24. package/dist/{resolveIdentity-CkyqvctR-AkDcBv37.js → resolveIdentity-CkyqvctR-BWp3cZAz.js} +14 -14
  25. package/package.json +15 -15
  26. package/dist/dist-cdXD3BbE.js +0 -21
package/dist/index.js CHANGED
@@ -51,77 +51,77 @@ var _cookbookCommands = null;
51
51
  var _kitchenCommands = null;
52
52
  async function getGnodeCommands() {
53
53
  if (!_gnodeCommands) {
54
- const { gnodeCommands } = await import("./commands-DTdDVLOD.js");
54
+ const { gnodeCommands } = await import("./commands-CogDQhN_.js");
55
55
  _gnodeCommands = gnodeCommands;
56
56
  }
57
57
  return _gnodeCommands;
58
58
  }
59
59
  async function getGitCommands() {
60
60
  if (!_gitCommands) {
61
- const { gitCommands } = await import("./commands-DTdDVLOD.js");
61
+ const { gitCommands } = await import("./commands-CogDQhN_.js");
62
62
  _gitCommands = gitCommands;
63
63
  }
64
64
  return _gitCommands;
65
65
  }
66
66
  async function getGenerateCommands() {
67
67
  if (!_generateCommands) {
68
- const { generateCommands } = await import("./commands-DTdDVLOD.js");
68
+ const { generateCommands } = await import("./commands-CogDQhN_.js");
69
69
  _generateCommands = generateCommands;
70
70
  }
71
71
  return _generateCommands;
72
72
  }
73
73
  async function getInitCommands() {
74
74
  if (!_initCommands) {
75
- const { initCommands } = await import("./commands-DTdDVLOD.js");
75
+ const { initCommands } = await import("./commands-CogDQhN_.js");
76
76
  _initCommands = initCommands;
77
77
  }
78
78
  return _initCommands;
79
79
  }
80
80
  async function getUtilityCommands() {
81
81
  if (!_utilityCommands) {
82
- const { utilityCommands } = await import("./commands-DTdDVLOD.js");
82
+ const { utilityCommands } = await import("./commands-CogDQhN_.js");
83
83
  _utilityCommands = utilityCommands;
84
84
  }
85
85
  return _utilityCommands;
86
86
  }
87
87
  async function getDispatchCommands() {
88
88
  if (!_dispatchCommands) {
89
- const { dispatchCommands } = await import("./commands-DTdDVLOD.js");
89
+ const { dispatchCommands } = await import("./commands-CogDQhN_.js");
90
90
  _dispatchCommands = dispatchCommands;
91
91
  }
92
92
  return _dispatchCommands;
93
93
  }
94
94
  async function getDocsCommands() {
95
95
  if (!_docsCommands) {
96
- const { docsCommands } = await import("./commands-DTdDVLOD.js");
96
+ const { docsCommands } = await import("./commands-CogDQhN_.js");
97
97
  _docsCommands = docsCommands;
98
98
  }
99
99
  return _docsCommands;
100
100
  }
101
101
  async function getPlaygroundCommands() {
102
102
  if (!_playgroundCommands) {
103
- const { playgroundCommands } = await import("./commands-DTdDVLOD.js");
103
+ const { playgroundCommands } = await import("./commands-CogDQhN_.js");
104
104
  _playgroundCommands = playgroundCommands;
105
105
  }
106
106
  return _playgroundCommands;
107
107
  }
108
108
  async function getCookbookCommands() {
109
109
  if (!_cookbookCommands) {
110
- const { cookbookCommands } = await import("./commands-DTdDVLOD.js");
110
+ const { cookbookCommands } = await import("./commands-CogDQhN_.js");
111
111
  _cookbookCommands = cookbookCommands;
112
112
  }
113
113
  return _cookbookCommands;
114
114
  }
115
115
  async function getKitchenCommands() {
116
116
  if (!_kitchenCommands) {
117
- const { kitchenCommands } = await import("./commands-DTdDVLOD.js");
117
+ const { kitchenCommands } = await import("./commands-CogDQhN_.js");
118
118
  _kitchenCommands = kitchenCommands;
119
119
  }
120
120
  return _kitchenCommands;
121
121
  }
122
122
  async function getWorkbenchCommands() {
123
123
  if (!_workbenchCommands) {
124
- const { workbenchCommands } = await import("./commands-DTdDVLOD.js");
124
+ const { workbenchCommands } = await import("./commands-CogDQhN_.js");
125
125
  _workbenchCommands = workbenchCommands;
126
126
  }
127
127
  return _workbenchCommands;
@@ -1234,6 +1234,41 @@ var CLIGenerator = class {
1234
1234
  }
1235
1235
  }
1236
1236
  /**
1237
+ * Keep only the fields a generated create/update may write, exactly as the
1238
+ * REST routes and MCP tools do: never framework/server-managed keys,
1239
+ * underscored internals or `readonly` fields, and only `api.writable` when
1240
+ * the model declares it. Applies to every input mode (`--from-file`,
1241
+ * interactive, flags), so the CLI is not a way around a model's write
1242
+ * allowlist.
1243
+ */
1244
+ applyWritablePolicy(objectName, data) {
1245
+ if (!data || typeof data !== "object" || Array.isArray(data)) return {};
1246
+ const serverManaged = /* @__PURE__ */ new Set([
1247
+ "id",
1248
+ "tenantId",
1249
+ "tenant_id",
1250
+ "createdAt",
1251
+ "created_at",
1252
+ "updatedAt",
1253
+ "updated_at"
1254
+ ]);
1255
+ const apiConfig = ObjectRegistry.getConfig(objectName)?.api;
1256
+ const writable = apiConfig && typeof apiConfig === "object" && Array.isArray(apiConfig.writable) ? apiConfig.writable : null;
1257
+ const readonly = /* @__PURE__ */ new Set();
1258
+ for (const [name, definition] of ObjectRegistry.getFields(objectName)) {
1259
+ const meta = definition;
1260
+ if (meta?.readonly === true || meta?._meta?.readonly === true) readonly.add(name);
1261
+ }
1262
+ const result = {};
1263
+ for (const [key, value] of Object.entries(data)) {
1264
+ if (key.startsWith("_")) continue;
1265
+ if (serverManaged.has(key) || readonly.has(key)) continue;
1266
+ if (writable && !writable.includes(key)) continue;
1267
+ result[key] = value;
1268
+ }
1269
+ return result;
1270
+ }
1271
+ /**
1237
1272
  * Handle CREATE command
1238
1273
  */
1239
1274
  async handleCreate(objectName, options) {
@@ -1251,6 +1286,9 @@ var CLIGenerator = class {
1251
1286
  if (options[optionName] !== void 0) data[fieldName] = this.parseFieldValue(String(options[optionName]));
1252
1287
  }
1253
1288
  }
1289
+ const metaType = data._meta_type;
1290
+ data = this.applyWritablePolicy(objectName, data);
1291
+ if (typeof metaType === "string") data._meta_type = metaType;
1254
1292
  const spinner = this.createSpinner(`Creating ${objectName}...`);
1255
1293
  const result = await (await this.getCollection(objectName)).create(data);
1256
1294
  spinner.succeed(`Created ${objectName} with ID: ${result.id}`);
@@ -1283,6 +1321,7 @@ var CLIGenerator = class {
1283
1321
  if (options[optionName] !== void 0) data[fieldName] = this.parseFieldValue(String(options[optionName]));
1284
1322
  }
1285
1323
  }
1324
+ data = this.applyWritablePolicy(objectName, data);
1286
1325
  const spinner = this.createSpinner(`Updating ${objectName}...`);
1287
1326
  await collection.withAuditMutation(existing, "updated", async (bound) => {
1288
1327
  Object.assign(bound, data);
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
3
- import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-CNCLrvjW.js";
4
- import { a as ProfileCollection, f as saveOidcRaceArbiter, i as Profile } from "./ProfileCollection-C4INKh7Y-DOp8miUa.js";
5
- import { t as ProfileTypeCollection } from "./ProfileTypeCollection-B7kwi1mU-Ce3gA1Qy.js";
3
+ import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-Ckm8QYCF.js";
4
+ import { a as ProfileCollection, f as saveOidcRaceArbiter, i as Profile } from "./ProfileCollection-C4INKh7Y-CWCUc0Hb.js";
5
+ import { t as ProfileTypeCollection } from "./ProfileTypeCollection-B7kwi1mU-4EyAFp2c.js";
6
6
  import { smrt } from "@happyvertical/smrt-core";
7
7
  //#region ../profiles/dist/chunks/oidcProvisioningPrimitives-DNP9EZlU.js
8
8
  var oidcProvisioningPrimitives_DNP9EZlU_exports = /* @__PURE__ */ __exportAll({
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { m as withSystemContext } from "./dist-DtPJO_5w.js";
2
+ import { m as withSystemContext } from "./dist-BVztM_cy.js";
3
3
  import { n as __exportAll$1, t as NostrIdentity, u as verifyAuthEvent } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
4
4
  import { t as ApiKey } from "./ApiKey-CVmlf3V6-BAeHuH48.js";
5
- import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-CNCLrvjW.js";
6
- import { c as coordinateOidcProvisioning, l as isOidcProvisioningRaceConflict, u as normalizeIdentityEmail } from "./ProfileCollection-C4INKh7Y-DOp8miUa.js";
7
- import { a as insertOidcProvisioningIdentity, i as createOidcProvisioningPerson } from "./oidcProvisioningPrimitives-DNP9EZlU-DwTTwWII.js";
5
+ import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-Ckm8QYCF.js";
6
+ import { c as coordinateOidcProvisioning, l as isOidcProvisioningRaceConflict, u as normalizeIdentityEmail } from "./ProfileCollection-C4INKh7Y-CWCUc0Hb.js";
7
+ import { a as insertOidcProvisioningIdentity, i as createOidcProvisioningPerson } from "./oidcProvisioningPrimitives-DNP9EZlU-B9po079I.js";
8
8
  import { resolveDatabase } from "@happyvertical/smrt-core";
9
9
  //#region ../profiles/dist/chunks/resolveIdentity-CkyqvctR.js
10
10
  var resolveIdentity_CkyqvctR_exports = /* @__PURE__ */ __exportAll({
@@ -72,13 +72,13 @@ async function resolveIdentity(context) {
72
72
  };
73
73
  }
74
74
  async function findProfileByExternalId(provider, externalId, options) {
75
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CXbCuX6s.js").then((n) => n.r).then((n) => n.r);
75
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-DgdpVtwP.js").then((n) => n.r).then((n) => n.r);
76
76
  const identities = await (await OidcIdentityCollection.create(options)).findByProvider(provider);
77
77
  for (const identity of identities) if (identity.subject === externalId || identity.email?.includes(externalId)) {
78
78
  const profile = await identity.getProfile();
79
79
  if (profile) return profile;
80
80
  }
81
- const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-DOp8miUa.js").then((n) => n.o).then((n) => n.r);
81
+ const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-CWCUc0Hb.js").then((n) => n.o).then((n) => n.r);
82
82
  const profiles = await (await ProfileCollection.create(options)).list({
83
83
  where: { email: `${externalId}@users.noreply.github.com` },
84
84
  limit: 1
@@ -99,7 +99,7 @@ async function reuseExistingOidcIdentityForProfile(profileId, claims, provider,
99
99
  createConcurrencyError: (cause) => new Error("Concurrent exact OIDC identity reuse did not converge.", cause === void 0 ? void 0 : { cause }),
100
100
  rebindRootResult: rebindOidcProfileResult,
101
101
  provision: (tx) => withSystemContext(async () => {
102
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CXbCuX6s.js").then((n) => n.r).then((n) => n.r);
102
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-DgdpVtwP.js").then((n) => n.r).then((n) => n.r);
103
103
  const identity = await (await OidcIdentityCollection.create({ db: tx })).findBySubject(normalizedClaims.iss, normalizedClaims.sub);
104
104
  if (!identity) throw new Error("OidcIdentity.findOrCreate() no longer creates authentication links; use UserCollection.getOrCreateFromOidc() or createProfileFromOidc().");
105
105
  if (identity.profileId !== profileId) throw new Error(`OIDC identity ${normalizedClaims.iss} subject ${normalizedClaims.sub} belongs to a different Profile.`);
@@ -133,7 +133,7 @@ async function coordinateProfileOidcProvisioning(claims, provider, options) {
133
133
  });
134
134
  }
135
135
  async function provisionOidcProfile(claims, provider, options) {
136
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CXbCuX6s.js").then((n) => n.r).then((n) => n.r);
136
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-DgdpVtwP.js").then((n) => n.r).then((n) => n.r);
137
137
  const existingIdentity = await (await OidcIdentityCollection.create(options)).findBySubject(claims.iss, claims.sub);
138
138
  if (existingIdentity) {
139
139
  const profile2 = await existingIdentity.getProfile();
@@ -148,7 +148,7 @@ async function provisionOidcProfile(claims, provider, options) {
148
148
  created: false
149
149
  };
150
150
  }
151
- const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-DOp8miUa.js").then((n) => n.o).then((n) => n.r);
151
+ const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-CWCUc0Hb.js").then((n) => n.o).then((n) => n.r);
152
152
  const profileCollection = await ProfileCollection.create(options);
153
153
  if (claims.email) {
154
154
  if (await profileCollection.findUniqueGlobalPersonByEmail(claims.email)) {
@@ -175,8 +175,8 @@ async function provisionOidcProfile(claims, provider, options) {
175
175
  };
176
176
  }
177
177
  async function rebindOidcProfileResult(result, rootDb) {
178
- const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CXbCuX6s.js").then((n) => n.r).then((n) => n.r);
179
- const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-DOp8miUa.js").then((n) => n.o).then((n) => n.r);
178
+ const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-DgdpVtwP.js").then((n) => n.r).then((n) => n.r);
179
+ const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-CWCUc0Hb.js").then((n) => n.o).then((n) => n.r);
180
180
  const profileId = requireOidcProfileId(result.profile.id);
181
181
  const identityId = requireOidcProfileId(result.oidcIdentity.id);
182
182
  const [profile, oidcIdentity] = await withSystemContext(async () => {
@@ -225,11 +225,11 @@ async function createProfileFromNostr(email, nostrData, options) {
225
225
  created: false
226
226
  };
227
227
  }
228
- const { Person } = await import("./oidcProvisioningPrimitives-DNP9EZlU-DwTTwWII.js").then((n) => n.o).then((n) => n.o);
229
- const { ProfileTypeCollection } = await import("./ProfileTypeCollection-B7kwi1mU-Ce3gA1Qy.js").then((n) => n.n).then((n) => n.n);
228
+ const { Person } = await import("./oidcProvisioningPrimitives-DNP9EZlU-B9po079I.js").then((n) => n.o).then((n) => n.o);
229
+ const { ProfileTypeCollection } = await import("./ProfileTypeCollection-B7kwi1mU-4EyAFp2c.js").then((n) => n.n).then((n) => n.n);
230
230
  let personType = await (await ProfileTypeCollection.create(options)).getBySlug("person");
231
231
  if (!personType) {
232
- const { ProfileType } = await import("./ProfileCollection-C4INKh7Y-DOp8miUa.js").then((n) => n.o).then((n) => n.h);
232
+ const { ProfileType } = await import("./ProfileCollection-C4INKh7Y-CWCUc0Hb.js").then((n) => n.o).then((n) => n.h);
233
233
  personType = new ProfileType({
234
234
  ...options,
235
235
  slug: "person",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-cli",
3
- "version": "0.57.10",
3
+ "version": "0.57.11",
4
4
  "description": "Developer CLI for SMRT framework - introspection, testing, and project management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,20 +30,20 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
- "@happyvertical/ai": "^0.105.3",
34
- "@happyvertical/files": "^0.105.3",
35
- "@happyvertical/logger": "^0.105.3",
36
- "@happyvertical/smrt-agents": "0.57.10",
37
- "@happyvertical/smrt-app-runtime": "0.57.10",
38
- "@happyvertical/smrt-config": "0.57.10",
39
- "@happyvertical/smrt-core": "0.57.10",
40
- "@happyvertical/smrt-dev-mcp": "0.57.10",
41
- "@happyvertical/smrt-ledgers": "0.57.10",
42
- "@happyvertical/smrt-playground": "0.57.10",
43
- "@happyvertical/smrt-types": "0.57.10",
44
- "@happyvertical/smrt-users": "0.57.10",
45
- "@happyvertical/sql": "^0.105.3",
46
- "@happyvertical/utils": "^0.105.3",
33
+ "@happyvertical/ai": "^0.105.5",
34
+ "@happyvertical/files": "^0.105.5",
35
+ "@happyvertical/logger": "^0.105.5",
36
+ "@happyvertical/smrt-agents": "0.57.11",
37
+ "@happyvertical/smrt-app-runtime": "0.57.11",
38
+ "@happyvertical/smrt-config": "0.57.11",
39
+ "@happyvertical/smrt-core": "0.57.11",
40
+ "@happyvertical/smrt-dev-mcp": "0.57.11",
41
+ "@happyvertical/smrt-ledgers": "0.57.11",
42
+ "@happyvertical/smrt-playground": "0.57.11",
43
+ "@happyvertical/smrt-types": "0.57.11",
44
+ "@happyvertical/smrt-users": "0.57.11",
45
+ "@happyvertical/sql": "^0.105.5",
46
+ "@happyvertical/utils": "^0.105.5",
47
47
  "@modelcontextprotocol/server": "2.0.0",
48
48
  "acorn": "^8.18.0",
49
49
  "fast-glob": "3.3.3",
@@ -1,21 +0,0 @@
1
- import "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
2
- import "./ApiKey-CVmlf3V6-BAeHuH48.js";
3
- import "./ApiKeyCollection-CiiDNFdD-CMGF3_ul.js";
4
- import "./AuditLogCollection-WDHL-_AF-B-XEAxVt.js";
5
- import "./NostrIdentityCollection-CctlECpX-fkAPnK02.js";
6
- import "./OidcIdentity-BUblgQLs-CNCLrvjW.js";
7
- import "./OidcIdentityCollection-ClOyaHeF-CXbCuX6s.js";
8
- import "./ProfileAssetCollection-CRMcjLJ--c-GEluUg.js";
9
- import { a as ProfileCollection } from "./ProfileCollection-C4INKh7Y-DOp8miUa.js";
10
- import "./ProfileLinkCollection-DFfZRsgv-B6WUopKV.js";
11
- import "./ProfileMetadataCollection-BIYKy4Y3-0ifgavRP.js";
12
- import "./ProfileMetafieldCollection-Buz7gzag-LmZuJkfj.js";
13
- import "./ProfileRelationshipCollection-C4g_QLI4-zqqRMcCG.js";
14
- import "./ProfileRelationshipTermCollection-C9J7mC7P-ChIFqjCg.js";
15
- import "./ProfileRelationshipType-U7IwF6Wf-DNavf24e.js";
16
- import "./ProfileRelationshipTypeCollection-_n22WqTb-DiZUWvev.js";
17
- import "./ProfileTypeCollection-B7kwi1mU-Ce3gA1Qy.js";
18
- import "./oidcProvisioningPrimitives-DNP9EZlU-DwTTwWII.js";
19
- import "./resolveIdentity-CkyqvctR-AkDcBv37.js";
20
- import "./dist-Bh0ccFH6.js";
21
- export { ProfileCollection };