trellis 3.1.35 → 3.2.2
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/CHANGELOG.md +23 -5
- package/README.md +63 -156
- package/bin/trellis.mjs +2 -75
- package/dist/{better-sqlite-backend-ahx5p0br.js → better-sqlite-backend-2P4F6AOJ.js} +91 -29
- package/dist/boot-middleware-MHLHFCUC.js +9 -0
- package/dist/browser/index.d.ts +18 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +95 -0
- package/dist/{index-53f3b8p8.js → chunk-2W3MHTMG.js} +552 -213
- package/dist/chunk-44FFQKQX.js +142 -0
- package/dist/chunk-4HYPLFJD.js +150 -0
- package/dist/chunk-4XIVMVHC.js +361 -0
- package/dist/{index-yp88he8n.js → chunk-6CTA6MCE.js} +88 -64
- package/dist/chunk-6GEZ6DN5.js +394 -0
- package/dist/chunk-7ZFRVCUE.js +211 -0
- package/dist/chunk-CAG4FULI.js +121 -0
- package/dist/chunk-FF36CQHZ.js +61 -0
- package/dist/{index-h32txmxe.js → chunk-FKQO5A3H.js} +6 -13
- package/dist/{index-nq520y6k.js → chunk-FWRS4CSC.js} +46 -32
- package/dist/chunk-GFZCJ4EH.js +108 -0
- package/dist/chunk-GLM4HGN4.js +55 -0
- package/dist/{index-4cdr7x2x.js → chunk-GU374KWZ.js} +182 -111
- package/dist/chunk-H6JB3PZ3.js +45 -0
- package/dist/chunk-IZX2PLIB.js +1240 -0
- package/dist/chunk-J2TXUFCZ.js +289 -0
- package/dist/chunk-J3WYZO3Q.js +211 -0
- package/dist/{index-xzym9w0m.js → chunk-JA7AIHRK.js} +12 -7
- package/dist/chunk-JHHEXEDM.js +162 -0
- package/dist/chunk-JUEMDWLU.js +233 -0
- package/dist/chunk-KFQGP6VL.js +33 -0
- package/dist/chunk-KIJITUZB.js +419 -0
- package/dist/{index-4wxa8xz4.js → chunk-KQ4A2D2P.js} +162 -23
- package/dist/chunk-KSU2GW22.js +958 -0
- package/dist/{index-rv1p47gp.js → chunk-L5N5PR2S.js} +3015 -2480
- package/dist/{index-h9e2efx4.js → chunk-LNUIGRDZ.js} +71 -55
- package/dist/{index-skhn0agf.js → chunk-MLC5BUYO.js} +19 -20
- package/dist/chunk-MPXUVGT3.js +104 -0
- package/dist/chunk-N6MYZT4O.js +68 -0
- package/dist/chunk-O2AV5WMN.js +48 -0
- package/dist/chunk-PZ4XYZ4J.js +143 -0
- package/dist/chunk-QB5ISE47.js +419 -0
- package/dist/chunk-RSWUFTO2.js +857 -0
- package/dist/chunk-S3XLFZ27.js +1095 -0
- package/dist/{index-w5wccer3.js → chunk-S6GBJ2ZB.js} +28 -12
- package/dist/{index-7pjz3tsy.js → chunk-SGMDTWJJ.js} +57 -15
- package/dist/chunk-SPSPV5BC.js +390 -0
- package/dist/chunk-TCKXSOBP.js +123 -0
- package/dist/chunk-UBGUDMUV.js +59 -0
- package/dist/{index-wt8rz4gn.js → chunk-UQISRW6T.js} +97 -26
- package/dist/chunk-USEINYUL.js +12 -0
- package/dist/{index-bmyt7k8n.js → chunk-UZRUP7QW.js} +12 -4
- package/dist/{index-xhcp6xrn.js → chunk-VBYUTRXX.js} +695 -514
- package/dist/{index-vkpkfwhq.js → chunk-VDAKEOML.js} +234 -194
- package/dist/chunk-WXSWA3MV.js +0 -0
- package/dist/{index-n9f2qyh5.js → chunk-X5FLTRUB.js} +55 -33
- package/dist/{index-h7zxhhhh.js → chunk-XMQ7G77X.js} +46 -38
- package/dist/{index-w7ng765c.js → chunk-YCM7ZYEZ.js} +102 -49
- package/dist/cli/deploy-cli.d.ts +18 -0
- package/dist/cli/deploy-cli.d.ts.map +1 -0
- package/dist/cli/errors.d.ts +6 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/examples.d.ts +23 -0
- package/dist/cli/examples.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2426 -6225
- package/dist/client/index.browser.d.ts +29 -0
- package/dist/client/index.browser.d.ts.map +1 -0
- package/dist/client/index.browser.js +64 -0
- package/dist/client/index.d.ts +6 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +41 -21
- package/dist/client/live.d.ts +67 -0
- package/dist/client/live.d.ts.map +1 -0
- package/dist/client/reactive.d.ts +31 -0
- package/dist/client/reactive.d.ts.map +1 -0
- package/dist/client/sdk.browser.d.ts +104 -0
- package/dist/client/sdk.browser.d.ts.map +1 -0
- package/dist/client/sdk.browser.js +9 -0
- package/dist/client/sdk.d.ts +26 -2
- package/dist/client/sdk.d.ts.map +1 -1
- package/dist/client/sdk.js +9 -0
- package/dist/client/vcs-client.d.ts +129 -0
- package/dist/client/vcs-client.d.ts.map +1 -0
- package/dist/cms/index.js +171 -163
- package/dist/{config-8hczw0rs.js → config-PFTP67TR.js} +8 -9
- package/dist/core/computation/index.d.ts +5 -0
- package/dist/core/computation/index.d.ts.map +1 -0
- package/dist/core/computation/rollup.d.ts +18 -0
- package/dist/core/computation/rollup.d.ts.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +171 -104
- package/dist/core/kernel/boot-middleware.d.ts +10 -0
- package/dist/core/kernel/boot-middleware.d.ts.map +1 -0
- package/dist/core/kernel/logic-middleware.d.ts +7 -1
- package/dist/core/kernel/logic-middleware.d.ts.map +1 -1
- package/dist/core/kernel/trellis-kernel.d.ts.map +1 -1
- package/dist/core/ontology/types.d.ts +5 -0
- package/dist/core/ontology/types.d.ts.map +1 -1
- package/dist/core/persist/better-sqlite-backend.d.ts +9 -2
- package/dist/core/persist/better-sqlite-backend.d.ts.map +1 -1
- package/dist/core/persist/factory.d.ts +6 -7
- package/dist/core/persist/factory.d.ts.map +1 -1
- package/dist/core/persist/factory.js +2 -3
- package/dist/core/persist/sqljs-backend.js +2 -3
- package/dist/db/index.d.ts +4 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +67 -54
- package/dist/db/inspector.js +11 -19
- package/dist/db/trellis.css +1 -1
- package/dist/decisions/index.js +9 -10
- package/dist/deploy-LQ7GUGJ5.js +9 -0
- package/dist/deploy-YNVG5E4E.js +9 -0
- package/dist/deploy-cli-24BCHAXY.js +67 -0
- package/dist/deploy-cli-C35HTITO.js +67 -0
- package/dist/embeddings/auto-embed.d.ts +2 -2
- package/dist/embeddings/auto-embed.d.ts.map +1 -1
- package/dist/embeddings/index.js +20 -22
- package/dist/embeddings/search.d.ts +2 -1
- package/dist/embeddings/search.d.ts.map +1 -1
- package/dist/embeddings/store.d.ts +25 -4
- package/dist/embeddings/store.d.ts.map +1 -1
- package/dist/engine.d.ts +59 -19
- package/dist/engine.d.ts.map +1 -1
- package/dist/import-UZEKXU3B.js +10 -0
- package/dist/index.js +102 -93
- package/dist/launch-explorer-HZ4ZJA4X.js +95 -0
- package/dist/links/index.js +24 -26
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/plugins/agent-memory/index.js +316 -0
- package/dist/plugins/idea-garden/index.js +165 -0
- package/dist/plugins/plan-approval/index.js +579 -0
- package/dist/plugins/proactive-watcher/index.js +194 -0
- package/dist/{index-2r4jxwnb.js → query-XYLTJYSA.js} +14 -15
- package/dist/react/index.js +39 -70
- package/dist/react/realtime.js +11 -0
- package/dist/react/schema-hooks.js +87 -0
- package/dist/realtime/broadcast-channel-transport.d.ts +43 -0
- package/dist/realtime/broadcast-channel-transport.d.ts.map +1 -0
- package/dist/realtime/durable-object-relay-transport.d.ts +96 -0
- package/dist/realtime/durable-object-relay-transport.d.ts.map +1 -0
- package/dist/realtime/index.d.ts +44 -0
- package/dist/realtime/index.d.ts.map +1 -0
- package/dist/realtime/index.js +40 -0
- package/dist/realtime/memory-hub.d.ts +32 -0
- package/dist/realtime/memory-hub.d.ts.map +1 -0
- package/dist/realtime/persistent-channel.d.ts +105 -0
- package/dist/realtime/persistent-channel.d.ts.map +1 -0
- package/dist/realtime/presence.d.ts +73 -0
- package/dist/realtime/presence.d.ts.map +1 -0
- package/dist/realtime/relay-persistence.d.ts +37 -0
- package/dist/realtime/relay-persistence.d.ts.map +1 -0
- package/dist/realtime/relay-persistence.js +107 -0
- package/dist/realtime/relay-server.d.ts +103 -0
- package/dist/realtime/relay-server.d.ts.map +1 -0
- package/dist/realtime/room.d.ts +98 -0
- package/dist/realtime/room.d.ts.map +1 -0
- package/dist/realtime/text.d.ts +73 -0
- package/dist/realtime/text.d.ts.map +1 -0
- package/dist/realtime/types.d.ts +89 -0
- package/dist/realtime/types.d.ts.map +1 -0
- package/dist/realtime/websocket-relay-transport.d.ts +28 -0
- package/dist/realtime/websocket-relay-transport.d.ts.map +1 -0
- package/dist/realtime.bundle.js +1100 -0
- package/dist/{remote-manager-xvbg4230.js → remote-manager-ODE3T2KR.js} +25 -15
- package/dist/scaffold/seed.d.ts.map +1 -1
- package/dist/scaffold/write.d.ts +1 -1
- package/dist/scaffold/write.d.ts.map +1 -1
- package/dist/schema/define.d.ts +137 -0
- package/dist/schema/define.d.ts.map +1 -0
- package/dist/schema/entity-projection.d.ts +34 -0
- package/dist/schema/entity-projection.d.ts.map +1 -0
- package/dist/schema/eql.d.ts +46 -0
- package/dist/schema/eql.d.ts.map +1 -0
- package/dist/schema/index.d.ts +21 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +46 -0
- package/dist/schema/kernel-resolve.d.ts +21 -0
- package/dist/schema/kernel-resolve.d.ts.map +1 -0
- package/dist/schema/mutations.d.ts +20 -0
- package/dist/schema/mutations.d.ts.map +1 -0
- package/dist/schema/resolve.d.ts +21 -0
- package/dist/schema/resolve.d.ts.map +1 -0
- package/dist/server/deploy-meta.d.ts +25 -0
- package/dist/server/deploy-meta.d.ts.map +1 -0
- package/dist/server/deploy.d.ts +7 -2
- package/dist/server/deploy.d.ts.map +1 -1
- package/dist/server/index.d.ts +7 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +100 -58
- package/dist/server/node-adapter.js +5 -104
- package/dist/server/realtime.d.ts +14 -3
- package/dist/server/realtime.d.ts.map +1 -1
- package/dist/server/server.d.ts +8 -16
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/sprites.d.ts +18 -1
- package/dist/server/sprites.d.ts.map +1 -1
- package/dist/server/tenancy.d.ts +4 -0
- package/dist/server/tenancy.d.ts.map +1 -1
- package/dist/server/usage-meter.d.ts +53 -0
- package/dist/server/usage-meter.d.ts.map +1 -0
- package/dist/server-MB3OPSPI.js +18 -0
- package/dist/server-ZVWGLLRF.js +18 -0
- package/dist/sprites-KQGTGM6W.js +27 -0
- package/dist/{sprites-vc4qbrp1.js → sprites-RU3E4XQN.js} +6 -7
- package/dist/svelte/index.d.ts +17 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +51 -0
- package/dist/svelte/schema-hooks.d.ts +45 -0
- package/dist/svelte/schema-hooks.d.ts.map +1 -0
- package/dist/svelte/schema-hooks.js +71 -0
- package/dist/svelte/stores.d.ts +78 -0
- package/dist/svelte/stores.d.ts.map +1 -0
- package/dist/sync/http-transport.d.ts +3 -3
- package/dist/sync/http-transport.d.ts.map +1 -1
- package/dist/sync/index.d.ts +15 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +617 -0
- package/dist/sync/memory-room.d.ts +37 -0
- package/dist/sync/memory-room.d.ts.map +1 -0
- package/dist/sync/memory-transport.d.ts +3 -3
- package/dist/sync/memory-transport.d.ts.map +1 -1
- package/dist/sync/partykit-room.d.ts +40 -0
- package/dist/sync/partykit-room.d.ts.map +1 -0
- package/dist/sync/partykit-transport.d.ts +84 -0
- package/dist/sync/partykit-transport.d.ts.map +1 -0
- package/dist/sync/room-core.d.ts +53 -0
- package/dist/sync/room-core.d.ts.map +1 -0
- package/dist/sync/sync-engine.d.ts +40 -2
- package/dist/sync/sync-engine.d.ts.map +1 -1
- package/dist/sync/sync-room-server.d.ts +39 -0
- package/dist/sync/sync-room-server.d.ts.map +1 -0
- package/dist/sync/types.d.ts +70 -3
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/vcs-sync-peer.d.ts +63 -0
- package/dist/sync/vcs-sync-peer.d.ts.map +1 -0
- package/dist/sync/ws-transport.d.ts +2 -2
- package/dist/sync/ws-transport.d.ts.map +1 -1
- package/dist/tenancy-NBLLGCNJ.js +14 -0
- package/dist/tenancy-POMWQP6M.js +16 -0
- package/dist/ui/client.html +355 -67
- package/dist/ui/launch-explorer.d.ts +22 -0
- package/dist/ui/launch-explorer.d.ts.map +1 -0
- package/dist/ui/server.d.ts +1 -1
- package/dist/ui/server.d.ts.map +1 -1
- package/dist/vcs/blob-store.d.ts.map +1 -1
- package/dist/vcs/idb-op-log.d.ts +67 -0
- package/dist/vcs/idb-op-log.d.ts.map +1 -0
- package/dist/vcs/index.d.ts +1 -0
- package/dist/vcs/index.d.ts.map +1 -1
- package/dist/vcs/index.js +81 -72
- package/dist/vcs/issue.d.ts +22 -5
- package/dist/vcs/issue.d.ts.map +1 -1
- package/dist/vcs/lane-materialize.d.ts +5 -0
- package/dist/vcs/lane-materialize.d.ts.map +1 -1
- package/dist/vcs/op-log.d.ts +28 -2
- package/dist/vcs/op-log.d.ts.map +1 -1
- package/dist/vcs/ops.d.ts +10 -0
- package/dist/vcs/ops.d.ts.map +1 -1
- package/dist/vcs/types.d.ts +2 -0
- package/dist/vcs/types.d.ts.map +1 -1
- package/dist/{vm-config-6xhsj6b3.js → vm-config-JI4OXKDQ.js} +9 -10
- package/dist/vue/hooks.d.ts +64 -0
- package/dist/vue/hooks.d.ts.map +1 -0
- package/dist/vue/index.d.ts +19 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/index.js +59 -0
- package/dist/vue/schema-hooks.d.ts +41 -0
- package/dist/vue/schema-hooks.d.ts.map +1 -0
- package/dist/vue/schema-hooks.js +64 -0
- package/package.json +130 -17
- package/dist/deploy-999q207z.js +0 -10
- package/dist/engine-y0724kjq.js +0 -8
- package/dist/import-s2b8e0ft.js +0 -11
- package/dist/index-a76rekgs.js +0 -67
- package/dist/index-c9h37r6h.js +0 -1
- package/dist/index-hr9qvv77.js +0 -860
- package/dist/index-k5b0xskw.js +0 -1
- package/dist/index-nzb3am4f.js +0 -80
- package/dist/index-wncptktd.js +0 -292
- package/dist/index-y6a4kj0p.js +0 -43
- package/dist/index-yhwjgfvj.js +0 -342
- package/dist/sdk-bepky0xs.js +0 -16
- package/dist/server-szdjx0nt.js +0 -13
- package/dist/sqlite-backend-0vsmc6qj.js +0 -8
- package/dist/tenancy-pjm32b4v.js +0 -14
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
// @bun
|
|
2
1
|
// src/core/ontology/registry.ts
|
|
3
|
-
|
|
4
|
-
schemas = new Map;
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var OntologyRegistry = class {
|
|
3
|
+
schemas = /* @__PURE__ */ new Map();
|
|
4
|
+
/** Resolved entity defs (with inherited attributes merged). */
|
|
5
|
+
resolvedEntities = /* @__PURE__ */ new Map();
|
|
6
|
+
/** Resolved relation defs. */
|
|
7
|
+
resolvedRelations = /* @__PURE__ */ new Map();
|
|
8
|
+
/**
|
|
9
|
+
* Register an ontology schema.
|
|
10
|
+
* Throws if an ontology with the same ID is already registered at the same version.
|
|
11
|
+
*/
|
|
7
12
|
register(schema) {
|
|
8
13
|
const existing = this.schemas.get(schema.id);
|
|
9
14
|
if (existing && existing.version === schema.version) {
|
|
10
|
-
throw new Error(
|
|
15
|
+
throw new Error(
|
|
16
|
+
`Ontology "${schema.id}" v${schema.version} is already registered.`
|
|
17
|
+
);
|
|
11
18
|
}
|
|
12
19
|
this.schemas.set(schema.id, schema);
|
|
13
20
|
this._resolve(schema);
|
|
14
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Unregister an ontology by ID.
|
|
24
|
+
*/
|
|
15
25
|
unregister(id) {
|
|
16
26
|
const schema = this.schemas.get(id);
|
|
17
|
-
if (!schema)
|
|
18
|
-
return;
|
|
27
|
+
if (!schema) return;
|
|
19
28
|
for (const [name, entry] of this.resolvedEntities) {
|
|
20
29
|
if (entry.ontologyId === id) {
|
|
21
30
|
this.resolvedEntities.delete(name);
|
|
@@ -31,21 +40,41 @@ class OntologyRegistry {
|
|
|
31
40
|
}
|
|
32
41
|
this.schemas.delete(id);
|
|
33
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Get a registered ontology schema by ID.
|
|
45
|
+
*/
|
|
34
46
|
get(id) {
|
|
35
47
|
return this.schemas.get(id);
|
|
36
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* List all registered ontology schemas.
|
|
51
|
+
*/
|
|
37
52
|
list() {
|
|
38
53
|
return [...this.schemas.values()];
|
|
39
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Get the resolved entity definition for an entity type name.
|
|
57
|
+
* Returns the entity def with inherited attributes merged in.
|
|
58
|
+
*/
|
|
40
59
|
getEntityDef(typeName) {
|
|
41
60
|
return this.resolvedEntities.get(typeName)?.def;
|
|
42
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the ontology ID that defines a given entity type.
|
|
64
|
+
*/
|
|
43
65
|
getEntityOntology(typeName) {
|
|
44
66
|
return this.resolvedEntities.get(typeName)?.ontologyId;
|
|
45
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* List all known entity type names.
|
|
70
|
+
*/
|
|
46
71
|
listEntityTypes() {
|
|
47
72
|
return [...this.resolvedEntities.keys()];
|
|
48
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Get all relation definitions involving a given entity type
|
|
76
|
+
* (either as source or target).
|
|
77
|
+
*/
|
|
49
78
|
getRelationsForType(typeName) {
|
|
50
79
|
const results = [];
|
|
51
80
|
for (const [, entries] of this.resolvedRelations) {
|
|
@@ -57,22 +86,36 @@ class OntologyRegistry {
|
|
|
57
86
|
}
|
|
58
87
|
return results;
|
|
59
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Get a specific relation definition by name.
|
|
91
|
+
*/
|
|
60
92
|
getRelationDef(name) {
|
|
61
93
|
const entries = this.resolvedRelations.get(name);
|
|
62
94
|
return entries?.[0]?.def;
|
|
63
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* List all known relation names.
|
|
98
|
+
*/
|
|
64
99
|
listRelationNames() {
|
|
65
100
|
return [...this.resolvedRelations.keys()];
|
|
66
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Check if an entity type is known to any registered ontology.
|
|
104
|
+
*/
|
|
67
105
|
hasEntityType(typeName) {
|
|
68
106
|
return this.resolvedEntities.has(typeName);
|
|
69
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Get the required attributes for an entity type.
|
|
110
|
+
*/
|
|
70
111
|
getRequiredAttributes(typeName) {
|
|
71
112
|
const def = this.getEntityDef(typeName);
|
|
72
|
-
if (!def)
|
|
73
|
-
return [];
|
|
113
|
+
if (!def) return [];
|
|
74
114
|
return def.attributes.filter((a) => a.required);
|
|
75
115
|
}
|
|
116
|
+
// -------------------------------------------------------------------------
|
|
117
|
+
// Resolution (inheritance)
|
|
118
|
+
// -------------------------------------------------------------------------
|
|
76
119
|
_resolve(schema) {
|
|
77
120
|
for (const entity of schema.entities) {
|
|
78
121
|
const resolved = this._resolveEntity(entity, schema);
|
|
@@ -88,15 +131,16 @@ class OntologyRegistry {
|
|
|
88
131
|
}
|
|
89
132
|
}
|
|
90
133
|
_resolveEntity(entity, schema) {
|
|
91
|
-
if (!entity.extends)
|
|
92
|
-
return entity;
|
|
134
|
+
if (!entity.extends) return entity;
|
|
93
135
|
let parent = schema.entities.find((e) => e.name === entity.extends);
|
|
94
136
|
if (!parent) {
|
|
95
137
|
const resolved = this.resolvedEntities.get(entity.extends);
|
|
96
138
|
parent = resolved?.def;
|
|
97
139
|
}
|
|
98
140
|
if (!parent) {
|
|
99
|
-
throw new Error(
|
|
141
|
+
throw new Error(
|
|
142
|
+
`Entity "${entity.name}" extends "${entity.extends}" which is not defined.`
|
|
143
|
+
);
|
|
100
144
|
}
|
|
101
145
|
const resolvedParent = this._resolveEntity(parent, schema);
|
|
102
146
|
const childAttrNames = new Set(entity.attributes.map((a) => a.name));
|
|
@@ -109,7 +153,7 @@ class OntologyRegistry {
|
|
|
109
153
|
attributes: mergedAttrs
|
|
110
154
|
};
|
|
111
155
|
}
|
|
112
|
-
}
|
|
156
|
+
};
|
|
113
157
|
|
|
114
158
|
// src/core/ontology/builtins.ts
|
|
115
159
|
var projectOntology = {
|
|
@@ -386,8 +430,7 @@ function validateEntity(entityId, store, registry) {
|
|
|
386
430
|
}
|
|
387
431
|
}
|
|
388
432
|
for (const fact of facts) {
|
|
389
|
-
if (fact.a === "type" || fact.a === "createdAt" || fact.a === "updatedAt")
|
|
390
|
-
continue;
|
|
433
|
+
if (fact.a === "type" || fact.a === "createdAt" || fact.a === "updatedAt") continue;
|
|
391
434
|
const attrDef = def.attributes.find((a) => a.name === fact.a);
|
|
392
435
|
if (!attrDef) {
|
|
393
436
|
warnings.push({
|
|
@@ -429,7 +472,7 @@ function validateEntity(entityId, store, registry) {
|
|
|
429
472
|
});
|
|
430
473
|
}
|
|
431
474
|
}
|
|
432
|
-
if (attrDef.min !==
|
|
475
|
+
if (attrDef.min !== void 0) {
|
|
433
476
|
if (typeof fact.v === "number" && fact.v < attrDef.min) {
|
|
434
477
|
errors.push({
|
|
435
478
|
entityId,
|
|
@@ -449,7 +492,7 @@ function validateEntity(entityId, store, registry) {
|
|
|
449
492
|
});
|
|
450
493
|
}
|
|
451
494
|
}
|
|
452
|
-
if (attrDef.max !==
|
|
495
|
+
if (attrDef.max !== void 0) {
|
|
453
496
|
if (typeof fact.v === "number" && fact.v > attrDef.max) {
|
|
454
497
|
errors.push({
|
|
455
498
|
entityId,
|
|
@@ -472,11 +515,9 @@ function validateEntity(entityId, store, registry) {
|
|
|
472
515
|
}
|
|
473
516
|
const links = store.getLinksByEntity(entityId);
|
|
474
517
|
for (const link of links) {
|
|
475
|
-
if (link.e1 !== entityId)
|
|
476
|
-
continue;
|
|
518
|
+
if (link.e1 !== entityId) continue;
|
|
477
519
|
const relDef = registry.getRelationDef(link.a);
|
|
478
|
-
if (!relDef)
|
|
479
|
-
continue;
|
|
520
|
+
if (!relDef) continue;
|
|
480
521
|
if (!relDef.sourceTypes.includes(entityType)) {
|
|
481
522
|
errors.push({
|
|
482
523
|
entityId,
|
|
@@ -521,32 +562,26 @@ function validateStore(store, registry) {
|
|
|
521
562
|
};
|
|
522
563
|
}
|
|
523
564
|
function validateAttrType(value, def) {
|
|
524
|
-
if (def.type === "any")
|
|
525
|
-
return null;
|
|
565
|
+
if (def.type === "any") return null;
|
|
526
566
|
switch (def.type) {
|
|
527
567
|
case "string":
|
|
528
|
-
if (typeof value !== "string")
|
|
529
|
-
return `Expected string, got ${typeof value}.`;
|
|
568
|
+
if (typeof value !== "string") return `Expected string, got ${typeof value}.`;
|
|
530
569
|
break;
|
|
531
570
|
case "number":
|
|
532
|
-
if (typeof value !== "number")
|
|
533
|
-
return `Expected number, got ${typeof value}.`;
|
|
571
|
+
if (typeof value !== "number") return `Expected number, got ${typeof value}.`;
|
|
534
572
|
break;
|
|
535
573
|
case "boolean":
|
|
536
|
-
if (typeof value !== "boolean")
|
|
537
|
-
return `Expected boolean, got ${typeof value}.`;
|
|
574
|
+
if (typeof value !== "boolean") return `Expected boolean, got ${typeof value}.`;
|
|
538
575
|
break;
|
|
539
576
|
case "date":
|
|
540
577
|
if (typeof value === "string") {
|
|
541
|
-
if (isNaN(Date.parse(value)))
|
|
542
|
-
return `Expected ISO date string, got "${value}".`;
|
|
578
|
+
if (isNaN(Date.parse(value))) return `Expected ISO date string, got "${value}".`;
|
|
543
579
|
} else if (!(value instanceof Date)) {
|
|
544
580
|
return `Expected date, got ${typeof value}.`;
|
|
545
581
|
}
|
|
546
582
|
break;
|
|
547
583
|
case "ref":
|
|
548
|
-
if (typeof value !== "string")
|
|
549
|
-
return `Expected entity reference (string), got ${typeof value}.`;
|
|
584
|
+
if (typeof value !== "string") return `Expected entity reference (string), got ${typeof value}.`;
|
|
550
585
|
break;
|
|
551
586
|
}
|
|
552
587
|
return null;
|
|
@@ -558,45 +593,53 @@ function createValidationMiddleware(registry, options) {
|
|
|
558
593
|
handleOp: (op, ctx, next) => {
|
|
559
594
|
if (op.facts && op.facts.length > 0) {
|
|
560
595
|
for (const fact of op.facts) {
|
|
561
|
-
if (fact.a === "type")
|
|
562
|
-
|
|
563
|
-
if (fact.a === "createdAt" || fact.a === "updatedAt")
|
|
564
|
-
continue;
|
|
596
|
+
if (fact.a === "type") continue;
|
|
597
|
+
if (fact.a === "createdAt" || fact.a === "updatedAt") continue;
|
|
565
598
|
const typeFact = op.facts.find((f) => f.e === fact.e && f.a === "type");
|
|
566
|
-
if (!typeFact)
|
|
567
|
-
continue;
|
|
599
|
+
if (!typeFact) continue;
|
|
568
600
|
const entityType = String(typeFact.v);
|
|
569
601
|
const def = registry.getEntityDef(entityType);
|
|
570
602
|
if (!def) {
|
|
571
603
|
if (strict) {
|
|
572
|
-
throw new Error(
|
|
604
|
+
throw new Error(
|
|
605
|
+
`[ontology-validator] Unknown entity type "${entityType}" for entity "${fact.e}".`
|
|
606
|
+
);
|
|
573
607
|
}
|
|
574
608
|
continue;
|
|
575
609
|
}
|
|
576
610
|
const attrDef = def.attributes.find((a) => a.name === fact.a);
|
|
577
611
|
if (!attrDef) {
|
|
578
612
|
if (strict) {
|
|
579
|
-
throw new Error(
|
|
613
|
+
throw new Error(
|
|
614
|
+
`[ontology-validator] Unknown attribute "${fact.a}" for type "${entityType}".`
|
|
615
|
+
);
|
|
580
616
|
}
|
|
581
617
|
continue;
|
|
582
618
|
}
|
|
583
619
|
const typeErr = validateAttrType(fact.v, attrDef);
|
|
584
620
|
if (typeErr) {
|
|
585
|
-
throw new Error(
|
|
621
|
+
throw new Error(
|
|
622
|
+
`[ontology-validator] Entity "${fact.e}" attribute "${fact.a}": ${typeErr}`
|
|
623
|
+
);
|
|
586
624
|
}
|
|
587
625
|
if (attrDef.enum && !attrDef.enum.includes(fact.v)) {
|
|
588
|
-
throw new Error(
|
|
626
|
+
throw new Error(
|
|
627
|
+
`[ontology-validator] Entity "${fact.e}" attribute "${fact.a}": value "${fact.v}" not in [${attrDef.enum.join(", ")}].`
|
|
628
|
+
);
|
|
589
629
|
}
|
|
590
630
|
}
|
|
591
631
|
}
|
|
592
632
|
if (op.links && op.links.length > 0) {
|
|
593
633
|
for (const link of op.links) {
|
|
594
634
|
const relDef = registry.getRelationDef(link.a);
|
|
595
|
-
if (!relDef)
|
|
596
|
-
|
|
597
|
-
|
|
635
|
+
if (!relDef) continue;
|
|
636
|
+
const sourceTypeFact = op.facts?.find(
|
|
637
|
+
(f) => f.e === link.e1 && f.a === "type"
|
|
638
|
+
);
|
|
598
639
|
if (sourceTypeFact && !relDef.sourceTypes.includes(String(sourceTypeFact.v))) {
|
|
599
|
-
throw new Error(
|
|
640
|
+
throw new Error(
|
|
641
|
+
`[ontology-validator] Relation "${link.a}": source type "${sourceTypeFact.v}" not allowed (expected: ${relDef.sourceTypes.join(", ")}).`
|
|
642
|
+
);
|
|
600
643
|
}
|
|
601
644
|
}
|
|
602
645
|
}
|
|
@@ -604,4 +647,14 @@ function createValidationMiddleware(registry, options) {
|
|
|
604
647
|
}
|
|
605
648
|
};
|
|
606
649
|
}
|
|
607
|
-
|
|
650
|
+
|
|
651
|
+
export {
|
|
652
|
+
OntologyRegistry,
|
|
653
|
+
projectOntology,
|
|
654
|
+
teamOntology,
|
|
655
|
+
agentOntology,
|
|
656
|
+
builtinOntologies,
|
|
657
|
+
validateEntity,
|
|
658
|
+
validateStore,
|
|
659
|
+
createValidationMiddleware
|
|
660
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `trellis deploy` / `trellis db deploy` handler.
|
|
3
|
+
*/
|
|
4
|
+
export interface DeployCliOptions {
|
|
5
|
+
name: string;
|
|
6
|
+
key?: string;
|
|
7
|
+
jwtSecret?: string;
|
|
8
|
+
port?: string | number;
|
|
9
|
+
configDir?: string;
|
|
10
|
+
stub?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function printDeploySuccess(result: {
|
|
13
|
+
url: string;
|
|
14
|
+
name: string;
|
|
15
|
+
apiKey: string;
|
|
16
|
+
}, configDir: string, stub: boolean): void;
|
|
17
|
+
export declare function runDeployCli(opts: DeployCliOptions): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=deploy-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-cli.d.ts","sourceRoot":"","sources":["../../src/cli/deploy-cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACrD,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,GACZ,IAAI,CAqBN;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/cli/errors.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAqBlD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contextual example commands and EQL-S queries for the current repo.
|
|
3
|
+
*/
|
|
4
|
+
import type { BranchInfo } from '../vcs/branch.js';
|
|
5
|
+
import type { IssueInfo } from '../vcs/issue.js';
|
|
6
|
+
import type { MilestoneInfo } from '../vcs/milestone.js';
|
|
7
|
+
export interface ExampleSection {
|
|
8
|
+
title: string;
|
|
9
|
+
commands: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface RepoExamples {
|
|
12
|
+
sections: ExampleSection[];
|
|
13
|
+
eql: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare function buildRepoExamples(input: {
|
|
16
|
+
issues: IssueInfo[];
|
|
17
|
+
milestones: MilestoneInfo[];
|
|
18
|
+
branches: BranchInfo[];
|
|
19
|
+
files: Array<{
|
|
20
|
+
path: string;
|
|
21
|
+
}>;
|
|
22
|
+
}): RepoExamples;
|
|
23
|
+
//# sourceMappingURL=examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../../src/cli/examples.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAWD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChC,GAAG,YAAY,CA4Ef"}
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* files List tracked files
|
|
12
12
|
* import Import from a Git repository
|
|
13
13
|
*/
|
|
14
|
-
export type IdeType = 'cursor' | '
|
|
14
|
+
export type IdeType = 'cursor' | 'devin' | 'claude' | 'copilot' | 'codex' | 'gemini' | 'none';
|
|
15
15
|
export type WorkspaceFootprint = 'minimal' | 'standard' | 'full';
|
|
16
16
|
export type FrameworkType = 'react' | 'vue' | 'svelte' | 'next' | 'nuxt' | 'remotion' | 'expo' | 'bun' | 'node' | 'cli' | 'library' | 'animation' | 'games' | 'none';
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;GAWG;AA4CH,MAAM,MAAM,OAAO,GACf,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,SAAS,GACT,OAAO,GACP,QAAQ,GACR,MAAM,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AACjE,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,KAAK,GACL,QAAQ,GACR,MAAM,GACN,MAAM,GACN,UAAU,GACV,MAAM,GACN,KAAK,GACL,MAAM,GACN,KAAK,GACL,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,CAAC"}
|