@happyvertical/smrt-cli 0.51.14 → 0.51.16

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 (27) hide show
  1. package/AGENTS.md +1 -0
  2. package/dist/ApiKey-BZmbOTnL-Dz-PO2sa.js +157 -0
  3. package/dist/ApiKeyCollection-Bfb_nw81-Dks_0546.js +2 -0
  4. package/dist/AuditLogCollection-B1YonCAP-Db9tLDtf.js +2 -0
  5. package/dist/NostrIdentity-n70E0vck-CZwoR7Rs.js +4189 -0
  6. package/dist/NostrIdentityCollection-Ca74dkaL-DESXyrjY.js +2 -0
  7. package/dist/OidcIdentity-CChQnYNH-DV9jiJ5r.js +117 -0
  8. package/dist/OidcIdentityCollection-D3L0WYbM-C85jz9CB.js +2 -0
  9. package/dist/ProfileAssetCollection-V8u4wqSL-BKz6v8py.js +2 -0
  10. package/dist/ProfileCollection-BvhD2cfL-CT6ctQ3l.js +1753 -0
  11. package/dist/ProfileMetadataCollection-DxX_BJKV-StatXt-E.js +2 -0
  12. package/dist/ProfileMetafieldCollection-CMKhVi2I--ba-T4qA.js +2 -0
  13. package/dist/ProfileRelationshipCollection-DUVgaIqf-B4TDc4TQ.js +2 -0
  14. package/dist/ProfileRelationshipTermCollection-DtA9OM23-1ZkGUm00.js +2 -0
  15. package/dist/ProfileRelationshipType-BRiRka6t-Dw1efEX5.js +101 -0
  16. package/dist/ProfileRelationshipTypeCollection-BdXwd7Kf-GEu0alx6.js +2 -0
  17. package/dist/{commands-BhDS-TVS.js → commands-CL85adn5.js} +95 -21
  18. package/dist/{config-DfBo4hHU.js → config-hqNo4lzH.js} +1 -13
  19. package/dist/dist-9EA_5mOX.js +142 -0
  20. package/dist/dist-BIA7A6wF.js +3712 -0
  21. package/dist/dist-mLcl4Ttr.js +1487 -0
  22. package/dist/index.js +14 -14
  23. package/dist/{json-validator-CjX8fHx9.js → json-validator-oEN7eUI3.js} +1 -1
  24. package/dist/oidcProvisioningPrimitives-CjOkg3Zd-DhC5lyKE.js +161 -0
  25. package/dist/resolveIdentity-73HQnTlT-DQB4z5h5.js +2 -0
  26. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  27. package/package.json +8 -7
package/dist/index.js CHANGED
@@ -49,63 +49,63 @@ var _playgroundCommands = null;
49
49
  var _workbenchCommands = null;
50
50
  async function getGnodeCommands() {
51
51
  if (!_gnodeCommands) {
52
- const { gnodeCommands } = await import("./commands-BhDS-TVS.js");
52
+ const { gnodeCommands } = await import("./commands-CL85adn5.js");
53
53
  _gnodeCommands = gnodeCommands;
54
54
  }
55
55
  return _gnodeCommands;
56
56
  }
57
57
  async function getGitCommands() {
58
58
  if (!_gitCommands) {
59
- const { gitCommands } = await import("./commands-BhDS-TVS.js");
59
+ const { gitCommands } = await import("./commands-CL85adn5.js");
60
60
  _gitCommands = gitCommands;
61
61
  }
62
62
  return _gitCommands;
63
63
  }
64
64
  async function getGenerateCommands() {
65
65
  if (!_generateCommands) {
66
- const { generateCommands } = await import("./commands-BhDS-TVS.js");
66
+ const { generateCommands } = await import("./commands-CL85adn5.js");
67
67
  _generateCommands = generateCommands;
68
68
  }
69
69
  return _generateCommands;
70
70
  }
71
71
  async function getInitCommands() {
72
72
  if (!_initCommands) {
73
- const { initCommands } = await import("./commands-BhDS-TVS.js");
73
+ const { initCommands } = await import("./commands-CL85adn5.js");
74
74
  _initCommands = initCommands;
75
75
  }
76
76
  return _initCommands;
77
77
  }
78
78
  async function getUtilityCommands() {
79
79
  if (!_utilityCommands) {
80
- const { utilityCommands } = await import("./commands-BhDS-TVS.js");
80
+ const { utilityCommands } = await import("./commands-CL85adn5.js");
81
81
  _utilityCommands = utilityCommands;
82
82
  }
83
83
  return _utilityCommands;
84
84
  }
85
85
  async function getDispatchCommands() {
86
86
  if (!_dispatchCommands) {
87
- const { dispatchCommands } = await import("./commands-BhDS-TVS.js");
87
+ const { dispatchCommands } = await import("./commands-CL85adn5.js");
88
88
  _dispatchCommands = dispatchCommands;
89
89
  }
90
90
  return _dispatchCommands;
91
91
  }
92
92
  async function getDocsCommands() {
93
93
  if (!_docsCommands) {
94
- const { docsCommands } = await import("./commands-BhDS-TVS.js");
94
+ const { docsCommands } = await import("./commands-CL85adn5.js");
95
95
  _docsCommands = docsCommands;
96
96
  }
97
97
  return _docsCommands;
98
98
  }
99
99
  async function getPlaygroundCommands() {
100
100
  if (!_playgroundCommands) {
101
- const { playgroundCommands } = await import("./commands-BhDS-TVS.js");
101
+ const { playgroundCommands } = await import("./commands-CL85adn5.js");
102
102
  _playgroundCommands = playgroundCommands;
103
103
  }
104
104
  return _playgroundCommands;
105
105
  }
106
106
  async function getWorkbenchCommands() {
107
107
  if (!_workbenchCommands) {
108
- const { workbenchCommands } = await import("./commands-BhDS-TVS.js");
108
+ const { workbenchCommands } = await import("./commands-CL85adn5.js");
109
109
  _workbenchCommands = workbenchCommands;
110
110
  }
111
111
  return _workbenchCommands;
@@ -322,7 +322,7 @@ var CLIGenerator = class {
322
322
  if (verbose) console.log("[CLI] Loading external classes...");
323
323
  await this.loadExternalClasses();
324
324
  const { getPackageConfig } = await import("@happyvertical/smrt-config");
325
- const { DEFAULT_CLI_CONFIG } = await import("./config-DfBo4hHU.js").then((n) => n.n);
325
+ const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
326
326
  const config = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
327
327
  const registeredCount = ObjectRegistry.getAllClasses().size;
328
328
  if (verbose || config.verbose) console.log(`[CLI] Successfully loaded ${registeredCount} SMRT objects`);
@@ -337,7 +337,7 @@ var CLIGenerator = class {
337
337
  */
338
338
  async loadLocalClasses() {
339
339
  const { getPackageConfig } = await import("@happyvertical/smrt-config");
340
- const { DEFAULT_CLI_CONFIG } = await import("./config-DfBo4hHU.js").then((n) => n.n);
340
+ const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
341
341
  const fs = await import("node:fs");
342
342
  const path = await import("node:path");
343
343
  const config = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
@@ -382,7 +382,7 @@ var CLIGenerator = class {
382
382
  */
383
383
  async loadExternalClasses() {
384
384
  const { getPackageConfig } = await import("@happyvertical/smrt-config");
385
- const { DEFAULT_CLI_CONFIG } = await import("./config-DfBo4hHU.js").then((n) => n.n);
385
+ const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
386
386
  const { loadLocalTestManifestSync } = await import("@happyvertical/smrt-core/manifest");
387
387
  const fs = await import("node:fs");
388
388
  const path = await import("node:path");
@@ -1359,7 +1359,7 @@ var CLIGenerator = class {
1359
1359
  const { getConfig, getPackageConfig, getModuleConfig } = await import("@happyvertical/smrt-config");
1360
1360
  const smrtConfig = getConfig() || {};
1361
1361
  const moduleConfig = getModuleConfig(objectName.toLowerCase(), {});
1362
- const { DEFAULT_CLI_CONFIG } = await import("./config-DfBo4hHU.js").then((n) => n.n);
1362
+ const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
1363
1363
  const cliConfig = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
1364
1364
  let db = this.context.db;
1365
1365
  if (!db && cliConfig?.database?.url) {
@@ -1462,7 +1462,7 @@ var CLIGenerator = class {
1462
1462
  let db = this.context.db;
1463
1463
  if (!db) {
1464
1464
  const { getPackageConfig } = await import("@happyvertical/smrt-config");
1465
- const { DEFAULT_CLI_CONFIG } = await import("./config-DfBo4hHU.js").then((n) => n.n);
1465
+ const { DEFAULT_CLI_CONFIG } = await import("./config-hqNo4lzH.js").then((n) => n.n);
1466
1466
  const config = getPackageConfig("cli", DEFAULT_CLI_CONFIG);
1467
1467
  const { getDatabase } = await import("@happyvertical/sql");
1468
1468
  db = await getDatabase({
@@ -85,7 +85,7 @@ async function resolveDataPath(explicitPath) {
85
85
  return resolved;
86
86
  }
87
87
  try {
88
- const { DEFAULT_CLI_CONFIG: defaultConfig } = await import("./config-DfBo4hHU.js").then((n) => n.n);
88
+ const { DEFAULT_CLI_CONFIG: defaultConfig } = await import("./config-hqNo4lzH.js").then((n) => n.n);
89
89
  const config = getPackageConfig("cli", defaultConfig);
90
90
  if (config.database?.url) {
91
91
  const dbUrl = config.database.url;
@@ -0,0 +1,161 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
+ import { n as __exportAll$1 } from "./NostrIdentity-n70E0vck-CZwoR7Rs.js";
3
+ import { o as isSystemContext } from "./dist-9EA_5mOX.js";
4
+ import { t as OidcIdentity } from "./OidcIdentity-CChQnYNH-DV9jiJ5r.js";
5
+ import { c as saveOidcRaceArbiter, i as ProfileType, n as ProfileCollection, t as Profile } from "./ProfileCollection-BvhD2cfL-CT6ctQ3l.js";
6
+ import { SmrtCollection, smrt } from "@happyvertical/smrt-core";
7
+ //#region ../profiles/dist/chunks/oidcProvisioningPrimitives-CjOkg3Zd.js
8
+ var oidcProvisioningPrimitives_CjOkg3Zd_exports = /* @__PURE__ */ __exportAll({
9
+ a: () => Person,
10
+ c: () => ProfileTypeCollection_exports,
11
+ i: () => Organization,
12
+ n: () => insertOidcProvisioningIdentity,
13
+ o: () => ProfileTypes_exports,
14
+ r: () => Bot,
15
+ s: () => ProfileTypeCollection,
16
+ t: () => createOidcProvisioningPerson
17
+ });
18
+ var ProfileTypeCollection_exports = /* @__PURE__ */ __exportAll$1({ ProfileTypeCollection: () => ProfileTypeCollection });
19
+ function isPostgresUrl(url) {
20
+ return /^postgres(?:ql)?:/iu.test(url ?? "");
21
+ }
22
+ var ProfileTypeCollection = class extends SmrtCollection {
23
+ static _itemClass = ProfileType;
24
+ /**
25
+ * Get profile type by slug
26
+ *
27
+ * @param slug - The slug to search for
28
+ * @returns ProfileType instance or null
29
+ */
30
+ async getBySlug(slug) {
31
+ return await this.get({ slug });
32
+ }
33
+ /**
34
+ * Get or create a profile type by slug
35
+ *
36
+ * @param slug - The slug to search for
37
+ * @param defaults - Default values if creating
38
+ * @returns ProfileType instance
39
+ */
40
+ async getOrCreateBySlug(slug, defaults) {
41
+ const existing = await this.getBySlug(slug);
42
+ if (existing) return existing;
43
+ const profileType = await this.create({
44
+ slug,
45
+ ...defaults
46
+ });
47
+ await profileType.save();
48
+ return profileType;
49
+ }
50
+ /**
51
+ * Atomically create or load a global ProfileType from trusted system code.
52
+ *
53
+ * This intentionally bypasses tenant auto-population and therefore refuses
54
+ * to run outside an explicit `withSystemContext()` boundary.
55
+ */
56
+ async getOrCreateGlobalBySlug(slug, defaults) {
57
+ if (!isSystemContext()) throw new Error("Global ProfileType creation requires an explicit system context.");
58
+ const existing = await this.loadGlobalBySlug(slug);
59
+ if (existing) return existing;
60
+ const insertIfAbsent = async (db) => {
61
+ if (isPostgresUrl(db.url)) await db.query("SELECT pg_advisory_xact_lock(hashtext(?), hashtext(?))", "@happyvertical/smrt-profiles:profile_types:global", slug);
62
+ await db.query(`INSERT INTO profile_types
63
+ (id, slug, context, _meta_type, tenant_id, name, description)
64
+ SELECT ?, ?, '', '@happyvertical/smrt-profiles:ProfileType', NULL, ?, ?
65
+ WHERE NOT EXISTS (
66
+ SELECT 1 FROM profile_types
67
+ WHERE slug = ?
68
+ AND context = ''
69
+ AND _meta_type = '@happyvertical/smrt-profiles:ProfileType'
70
+ AND tenant_id IS NULL
71
+ )`, crypto.randomUUID(), slug, defaults.name, defaults.description ?? null, slug);
72
+ };
73
+ const isTransactionBound = typeof this.db.commit === "function";
74
+ if (isPostgresUrl(this.db.url) && !isTransactionBound && typeof this.db.transaction === "function") await this.db.transaction((tx) => insertIfAbsent(tx));
75
+ else await insertIfAbsent(this.db);
76
+ const profileType = await this.loadGlobalBySlug(slug);
77
+ if (!profileType) throw new Error(`Global ProfileType '${slug}' could not be created or loaded.`);
78
+ return profileType;
79
+ }
80
+ async loadGlobalBySlug(slug) {
81
+ const id = (await this.db.query(`SELECT CAST(id AS VARCHAR) AS id
82
+ FROM profile_types
83
+ WHERE slug = ?
84
+ AND context = ''
85
+ AND _meta_type = '@happyvertical/smrt-profiles:ProfileType'
86
+ AND tenant_id IS NULL
87
+ LIMIT 1`, slug)).rows[0]?.id;
88
+ if (typeof id !== "string") return null;
89
+ const profileType = await this.get({ id });
90
+ if (profileType) profileType.id = id;
91
+ return profileType;
92
+ }
93
+ };
94
+ var ProfileTypes_exports = /* @__PURE__ */ __exportAll$1({
95
+ Bot: () => Bot,
96
+ Organization: () => Organization,
97
+ Person: () => Person
98
+ });
99
+ var __defProp = Object.defineProperty;
100
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
101
+ var __decorateClass = (decorators, target, key, kind) => {
102
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
103
+ for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
104
+ if (kind && result) __defProp(target, key, result);
105
+ return result;
106
+ };
107
+ var Person = class extends Profile {
108
+ constructor(options = {}) {
109
+ super(options);
110
+ }
111
+ };
112
+ Person = __decorateClass([smrt({ tableStrategy: "sti" })], Person);
113
+ var Organization = class extends Profile {
114
+ constructor(options = {}) {
115
+ super(options);
116
+ }
117
+ };
118
+ Organization = __decorateClass([smrt({ tableStrategy: "sti" })], Organization);
119
+ var Bot = class extends Profile {
120
+ constructor(options = {}) {
121
+ super(options);
122
+ }
123
+ };
124
+ Bot = __decorateClass([smrt({ tableStrategy: "sti" })], Bot);
125
+ async function createOidcProvisioningPerson(db, input) {
126
+ const typeId = requireProvisioningId((await (await ProfileTypeCollection.create({ db })).getOrCreateGlobalBySlug("person", {
127
+ name: "Person",
128
+ description: "Individual person profile"
129
+ })).id, "Person ProfileType");
130
+ let profile = new Person({
131
+ db,
132
+ slug: `oidc-${crypto.randomUUID()}`,
133
+ tenantId: null,
134
+ typeId,
135
+ email: input.email ?? "",
136
+ name: input.name || input.preferredUsername || input.subject
137
+ });
138
+ await profile.initialize();
139
+ await saveOidcRaceArbiter(() => profile.save());
140
+ if (input.email) profile = await (await ProfileCollection.create({ db })).reserveCanonicalIdentityEmail(requireProvisioningId(profile.id, "Created Profile"), input.email);
141
+ return profile;
142
+ }
143
+ async function insertOidcProvisioningIdentity(db, input) {
144
+ const identity = new OidcIdentity({
145
+ db,
146
+ email: input.email ?? "",
147
+ issuer: input.issuer,
148
+ profileId: input.profileId,
149
+ provider: input.provider,
150
+ subject: input.subject
151
+ });
152
+ await identity.initialize();
153
+ await saveOidcRaceArbiter(() => identity.save());
154
+ return identity;
155
+ }
156
+ function requireProvisioningId(value, label) {
157
+ if (typeof value !== "string" || !value) throw new Error(`${label} did not produce an id.`);
158
+ return value;
159
+ }
160
+ //#endregion
161
+ export { insertOidcProvisioningIdentity as n, oidcProvisioningPrimitives_CjOkg3Zd_exports as r, createOidcProvisioningPerson as t };
@@ -0,0 +1,2 @@
1
+ import { i as resolveIdentity_exports } from "./dist-BIA7A6wF.js";
2
+ export { resolveIdentity_exports as i };
@@ -0,0 +1,14 @@
1
+ import "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __exportAll = (all, no_symbols) => {
5
+ let target = {};
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
+ return target;
12
+ };
13
+ //#endregion
14
+ export { __exportAll as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-cli",
3
- "version": "0.51.14",
3
+ "version": "0.51.16",
4
4
  "description": "Developer CLI for SMRT framework - introspection, testing, and project management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,12 +28,13 @@
28
28
  "@happyvertical/ai": "^0.89.12",
29
29
  "@happyvertical/files": "^0.89.12",
30
30
  "@happyvertical/logger": "^0.89.12",
31
- "@happyvertical/smrt-agents": "0.51.14",
32
- "@happyvertical/smrt-config": "0.51.14",
33
- "@happyvertical/smrt-core": "0.51.14",
34
- "@happyvertical/smrt-dev-mcp": "0.51.14",
35
- "@happyvertical/smrt-playground": "0.51.14",
36
- "@happyvertical/smrt-types": "0.51.14",
31
+ "@happyvertical/smrt-agents": "0.51.16",
32
+ "@happyvertical/smrt-config": "0.51.16",
33
+ "@happyvertical/smrt-core": "0.51.16",
34
+ "@happyvertical/smrt-dev-mcp": "0.51.16",
35
+ "@happyvertical/smrt-playground": "0.51.16",
36
+ "@happyvertical/smrt-types": "0.51.16",
37
+ "@happyvertical/smrt-users": "0.51.16",
37
38
  "@happyvertical/sql": "^0.89.12",
38
39
  "@happyvertical/utils": "^0.89.12",
39
40
  "acorn": "^8.18.0",