@happyvertical/smrt-cli 0.51.15 → 0.51.17
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.
- package/AGENTS.md +1 -0
- package/dist/ApiKey-BZmbOTnL-D3HXUD48.js +157 -0
- package/dist/ApiKeyCollection-Bfb_nw81-iisJ_4LE.js +2 -0
- package/dist/AuditLogCollection-B1YonCAP-BSaKxHp3.js +2 -0
- package/dist/NostrIdentity-n70E0vck-jJyb_ar3.js +4189 -0
- package/dist/NostrIdentityCollection-Ca74dkaL-M4K0-Bkw.js +2 -0
- package/dist/OidcIdentity-CChQnYNH-Cnye-7CI.js +117 -0
- package/dist/OidcIdentityCollection-D3L0WYbM-BOje5aiS.js +2 -0
- package/dist/ProfileAssetCollection-V8u4wqSL-DDnGXiJl.js +2 -0
- package/dist/ProfileCollection-BvhD2cfL-P9hC9GcP.js +1753 -0
- package/dist/ProfileMetadataCollection-DxX_BJKV-ZbSkGI11.js +2 -0
- package/dist/ProfileMetafieldCollection-CMKhVi2I-BrAonTjE.js +2 -0
- package/dist/ProfileRelationshipCollection-DUVgaIqf-0E090hxE.js +2 -0
- package/dist/ProfileRelationshipTermCollection-DtA9OM23-EGZ4UVpV.js +2 -0
- package/dist/ProfileRelationshipType-BRiRka6t-W3qx1WVa.js +101 -0
- package/dist/ProfileRelationshipTypeCollection-BdXwd7Kf-mvIAf7RC.js +2 -0
- package/dist/{commands-BhDS-TVS.js → commands-C3O2NOMh.js} +96 -22
- package/dist/{config-DfBo4hHU.js → config-hqNo4lzH.js} +1 -13
- package/dist/dist-A0mO7r3F.js +142 -0
- package/dist/dist-DNf1dFwn.js +1487 -0
- package/dist/dist-DrGZRXfi.js +3712 -0
- package/dist/index.js +14 -14
- package/dist/{json-validator-CjX8fHx9.js → json-validator-oEN7eUI3.js} +1 -1
- package/dist/oidcProvisioningPrimitives-CjOkg3Zd-BtqRL7sX.js +161 -0
- package/dist/resolveIdentity-73HQnTlT-C4CQBrRn.js +2 -0
- package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
- 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-
|
|
52
|
+
const { gnodeCommands } = await import("./commands-C3O2NOMh.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-
|
|
59
|
+
const { gitCommands } = await import("./commands-C3O2NOMh.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-
|
|
66
|
+
const { generateCommands } = await import("./commands-C3O2NOMh.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-
|
|
73
|
+
const { initCommands } = await import("./commands-C3O2NOMh.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-
|
|
80
|
+
const { utilityCommands } = await import("./commands-C3O2NOMh.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-
|
|
87
|
+
const { dispatchCommands } = await import("./commands-C3O2NOMh.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-
|
|
94
|
+
const { docsCommands } = await import("./commands-C3O2NOMh.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-
|
|
101
|
+
const { playgroundCommands } = await import("./commands-C3O2NOMh.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-
|
|
108
|
+
const { workbenchCommands } = await import("./commands-C3O2NOMh.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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-jJyb_ar3.js";
|
|
3
|
+
import { o as isSystemContext } from "./dist-A0mO7r3F.js";
|
|
4
|
+
import { t as OidcIdentity } from "./OidcIdentity-CChQnYNH-Cnye-7CI.js";
|
|
5
|
+
import { c as saveOidcRaceArbiter, i as ProfileType, n as ProfileCollection, t as Profile } from "./ProfileCollection-BvhD2cfL-P9hC9GcP.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,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.
|
|
3
|
+
"version": "0.51.17",
|
|
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.
|
|
32
|
-
"@happyvertical/smrt-config": "0.51.
|
|
33
|
-
"@happyvertical/smrt-core": "0.51.
|
|
34
|
-
"@happyvertical/smrt-dev-mcp": "0.51.
|
|
35
|
-
"@happyvertical/smrt-playground": "0.51.
|
|
36
|
-
"@happyvertical/smrt-types": "0.51.
|
|
31
|
+
"@happyvertical/smrt-agents": "0.51.17",
|
|
32
|
+
"@happyvertical/smrt-config": "0.51.17",
|
|
33
|
+
"@happyvertical/smrt-core": "0.51.17",
|
|
34
|
+
"@happyvertical/smrt-dev-mcp": "0.51.17",
|
|
35
|
+
"@happyvertical/smrt-playground": "0.51.17",
|
|
36
|
+
"@happyvertical/smrt-types": "0.51.17",
|
|
37
|
+
"@happyvertical/smrt-users": "0.51.17",
|
|
37
38
|
"@happyvertical/sql": "^0.89.12",
|
|
38
39
|
"@happyvertical/utils": "^0.89.12",
|
|
39
40
|
"acorn": "^8.18.0",
|