@metaobjectsdev/sdk 0.5.0-rc.1
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/LICENSE +189 -0
- package/README.md +32 -0
- package/dist/agent-docs/body.d.ts +2 -0
- package/dist/agent-docs/body.d.ts.map +1 -0
- package/dist/agent-docs/body.js +563 -0
- package/dist/agent-docs/body.js.map +1 -0
- package/dist/agent-docs/content-hash.d.ts +8 -0
- package/dist/agent-docs/content-hash.d.ts.map +1 -0
- package/dist/agent-docs/content-hash.js +23 -0
- package/dist/agent-docs/content-hash.js.map +1 -0
- package/dist/agent-docs/index.d.ts +3 -0
- package/dist/agent-docs/index.d.ts.map +1 -0
- package/dist/agent-docs/index.js +4 -0
- package/dist/agent-docs/index.js.map +1 -0
- package/dist/config.d.ts +113 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +53 -0
- package/dist/config.js.map +1 -0
- package/dist/forge-types.d.ts +47 -0
- package/dist/forge-types.d.ts.map +1 -0
- package/dist/forge-types.js +133 -0
- package/dist/forge-types.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/memory.d.ts +30 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +105 -0
- package/dist/memory.js.map +1 -0
- package/dist/package.d.ts +65 -0
- package/dist/package.d.ts.map +1 -0
- package/dist/package.js +105 -0
- package/dist/package.js.map +1 -0
- package/dist/paths.d.ts +5 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +26 -0
- package/dist/paths.js.map +1 -0
- package/dist/records/any.d.ts +467 -0
- package/dist/records/any.d.ts.map +1 -0
- package/dist/records/any.js +14 -0
- package/dist/records/any.js.map +1 -0
- package/dist/records/convention.d.ts +90 -0
- package/dist/records/convention.d.ts.map +1 -0
- package/dist/records/convention.js +9 -0
- package/dist/records/convention.js.map +1 -0
- package/dist/records/core.d.ts +84 -0
- package/dist/records/core.d.ts.map +1 -0
- package/dist/records/core.js +47 -0
- package/dist/records/core.js.map +1 -0
- package/dist/records/decision.d.ts +90 -0
- package/dist/records/decision.d.ts.map +1 -0
- package/dist/records/decision.js +9 -0
- package/dist/records/decision.js.map +1 -0
- package/dist/records/failure.d.ts +93 -0
- package/dist/records/failure.d.ts.map +1 -0
- package/dist/records/failure.js +10 -0
- package/dist/records/failure.js.map +1 -0
- package/dist/records/glossary.d.ts +111 -0
- package/dist/records/glossary.d.ts.map +1 -0
- package/dist/records/glossary.js +14 -0
- package/dist/records/glossary.js.map +1 -0
- package/dist/records/principle.d.ts +99 -0
- package/dist/records/principle.d.ts.map +1 -0
- package/dist/records/principle.js +12 -0
- package/dist/records/principle.js.map +1 -0
- package/dist/storage/errors.d.ts +14 -0
- package/dist/storage/errors.d.ts.map +1 -0
- package/dist/storage/errors.js +27 -0
- package/dist/storage/errors.js.map +1 -0
- package/dist/storage/index.d.ts +7 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +6 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/lifecycle.d.ts +5 -0
- package/dist/storage/lifecycle.d.ts.map +1 -0
- package/dist/storage/lifecycle.js +27 -0
- package/dist/storage/lifecycle.js.map +1 -0
- package/dist/storage/list.d.ts +8 -0
- package/dist/storage/list.d.ts.map +1 -0
- package/dist/storage/list.js +42 -0
- package/dist/storage/list.js.map +1 -0
- package/dist/storage/read.d.ts +9 -0
- package/dist/storage/read.d.ts.map +1 -0
- package/dist/storage/read.js +43 -0
- package/dist/storage/read.js.map +1 -0
- package/dist/storage/write.d.ts +8 -0
- package/dist/storage/write.d.ts.map +1 -0
- package/dist/storage/write.js +20 -0
- package/dist/storage/write.js.map +1 -0
- package/dist/workspace.d.ts +49 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +280 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +48 -0
- package/src/agent-docs/body.ts +562 -0
- package/src/agent-docs/content-hash.ts +25 -0
- package/src/agent-docs/index.ts +8 -0
- package/src/config.ts +69 -0
- package/src/forge-types.ts +167 -0
- package/src/index.ts +98 -0
- package/src/memory.ts +116 -0
- package/src/package.ts +120 -0
- package/src/paths.ts +30 -0
- package/src/records/any.ts +15 -0
- package/src/records/convention.ts +10 -0
- package/src/records/core.ts +55 -0
- package/src/records/decision.ts +10 -0
- package/src/records/failure.ts +11 -0
- package/src/records/glossary.ts +15 -0
- package/src/records/principle.ts +13 -0
- package/src/storage/errors.ts +23 -0
- package/src/storage/index.ts +10 -0
- package/src/storage/lifecycle.ts +38 -0
- package/src/storage/list.ts +53 -0
- package/src/storage/read.ts +54 -0
- package/src/storage/write.ts +32 -0
- package/src/workspace.ts +342 -0
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
// Agent reference docs body. Scaffolded into .metaobjects/AGENTS.md and CLAUDE.md by `meta init`.
|
|
2
|
+
export const AGENT_DOCS_BODY = `# Meta Forge — agent reference
|
|
3
|
+
|
|
4
|
+
This file is scaffolded by \`meta init\` and lives alongside your \`metaobjects/\` records. It teaches AI coding assistants (Claude Code, Codex, etc.) how to read and modify MetaObjects metadata correctly. Refresh after CLI updates with \`meta init --refresh-docs\`.
|
|
5
|
+
|
|
6
|
+
## Five working principles (read first)
|
|
7
|
+
|
|
8
|
+
These shape every interaction with a metaobjects-driven project. Follow them when you author metadata, write hand-coded business logic, or review someone else's work.
|
|
9
|
+
|
|
10
|
+
### 1. If it's pattern-derivable from metadata, generate it. Never hand-write boilerplate.
|
|
11
|
+
|
|
12
|
+
The metaobjects raison d'être is that anything the metadata fully describes — schemas, FK references, basic CRUD, query helpers, Zod validators, route handlers, RHF rules, form fields — should be produced by codegen, not hand-typed. If you find yourself hand-writing something the metadata already knows about, stop and use the generated artifact.
|
|
13
|
+
|
|
14
|
+
The first version of the trainer website's database layer had hand-written Drizzle schemas, Zod schemas, and CRUD endpoints. Every one of those is now generated. The hand-written code that remains is real business logic (Stripe webhooks, Loops integration, custom auth flows) — things the generator genuinely cannot derive.
|
|
15
|
+
|
|
16
|
+
When you're about to add a new field or entity: edit \`metaobjects/*.json\` and re-run \`meta gen\`. Don't reach for the generated file directly.
|
|
17
|
+
|
|
18
|
+
### 2. Use the generated constants. Never use magic strings that touch metadata.
|
|
19
|
+
|
|
20
|
+
After \`meta gen\`, each entity file exports a rich metadata-constants block. Each non-dollar-prefixed key is a per-field object that carries everything a consumer might need (name, label, view, html input type, placeholder, RHF validation rules):
|
|
21
|
+
|
|
22
|
+
\`\`\`ts
|
|
23
|
+
export const Subscriber = {
|
|
24
|
+
$entity: "Subscriber", // entity name string
|
|
25
|
+
$table: "subscribers", // SQL table name
|
|
26
|
+
$path: "/subscribers", // REST resource path
|
|
27
|
+
|
|
28
|
+
email: {
|
|
29
|
+
name: "email", // field name string (use for filters, register())
|
|
30
|
+
label: "Email Address", // humanized fallback or @label override
|
|
31
|
+
view: "text", // MetaView subtype
|
|
32
|
+
htmlType: "email", // optional; maps view → HTML <input type=>
|
|
33
|
+
placeholder: "you@example.com", // optional; only when @placeholder is set on the view
|
|
34
|
+
helpText: "We never share this.", // optional; only when @helpText is set
|
|
35
|
+
rules: { // optional; derived from validator children
|
|
36
|
+
required: "Email is required",
|
|
37
|
+
maxLength: { value: 255, message: "Too long" },
|
|
38
|
+
pattern: { value: /.../, message: "Invalid email" },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
firstName: { name: "firstName", label: "First Name", view: "text", htmlType: "text", rules: { required: "First Name is required" } },
|
|
42
|
+
// ...
|
|
43
|
+
} as const;
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
**Use them everywhere — in both generated AND hand-written code:**
|
|
47
|
+
|
|
48
|
+
\`\`\`tsx
|
|
49
|
+
// ✗ Don't:
|
|
50
|
+
<input name="email" type="email" placeholder="Email" />
|
|
51
|
+
|
|
52
|
+
// ✓ Do:
|
|
53
|
+
<input
|
|
54
|
+
type={Subscriber.email.htmlType}
|
|
55
|
+
name={Subscriber.email.name}
|
|
56
|
+
placeholder={Subscriber.email.placeholder}
|
|
57
|
+
aria-label={Subscriber.email.label}
|
|
58
|
+
/>
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
Rename a field in \`metaobjects/\` and re-gen — TypeScript catches every stale reference.
|
|
62
|
+
|
|
63
|
+
**Special case — Drizzle column access:** when you're already inside Drizzle's typed builder, just use the column properties directly. Drizzle's table-const types are themselves derived from metadata, so \`weeks.programId\` is already TS-safe:
|
|
64
|
+
|
|
65
|
+
\`\`\`ts
|
|
66
|
+
// ✓ Use Drizzle's typed accessor directly — no constants needed here:
|
|
67
|
+
db.select().from(weeks).where(eq(weeks.programId, X))
|
|
68
|
+
|
|
69
|
+
// ✗ Don't do this — it's redundant indirection:
|
|
70
|
+
db.select().from(weeks).where(eq(weeks[Week.programId.name], X))
|
|
71
|
+
\`\`\`
|
|
72
|
+
|
|
73
|
+
Use the constants when you need a STRING (filter object keys, registration arguments, REST paths, labels). Use Drizzle properties directly when the type system already does the work.
|
|
74
|
+
|
|
75
|
+
### 3. Forms: spread \`form.input.<field>\` from useEntityForm. One line per input.
|
|
76
|
+
|
|
77
|
+
For React forms, use \`useEntityForm\` from \`@metaobjectsdev/react\`. It returns the standard React Hook Form surface plus a pre-bound \`.input\` accessor — one entry per field, ready to spread onto an \`<input>\`:
|
|
78
|
+
|
|
79
|
+
\`\`\`tsx
|
|
80
|
+
import { useEntityForm } from '@metaobjectsdev/react';
|
|
81
|
+
import { Subscriber, SubscriberInsertSchema } from './generated/Subscriber';
|
|
82
|
+
|
|
83
|
+
const form = useEntityForm(Subscriber, SubscriberInsertSchema);
|
|
84
|
+
|
|
85
|
+
<label>{Subscriber.email.label}</label>
|
|
86
|
+
<input {...form.input.email} /> // ← type, placeholder, name, rules, aria-label all spread automatically
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
For non-\`<input>\` controls (textarea, select), the \`type\` attr is omitted from \`form.input.X\` — pick the right element yourself.
|
|
90
|
+
|
|
91
|
+
The same Zod schema (\`SubscriberInsertSchema\`) validates on the server (in Fastify routes) and on the client (via the resolver). One schema, two surfaces, zero drift.
|
|
92
|
+
|
|
93
|
+
### 4. Routes: use the generated \`<Entity>.routes.ts\` for stock CRUD. Hand-write only what's custom.
|
|
94
|
+
|
|
95
|
+
\`meta gen\` emits a per-entity routes file that mounts the 5 standard verbs via \`mountCrudRoutes\` from \`@metaobjectsdev/runtime-ts/drizzle-fastify\`. The runtime is plain Drizzle + Zod — no extra ORM.
|
|
96
|
+
|
|
97
|
+
For custom flows (Stripe webhooks, side effects, auth-gated actions), hand-write the route — but import the entity constants + generated Zod schema. The boilerplate (CRUD, validation, 404 mapping, pagination) lives in the helper; your hand-written code is just the business logic.
|
|
98
|
+
|
|
99
|
+
**Auth pattern:** install a plugin-level Fastify \`preHandler\` hook at the top of your route plugin. The hook applies to every route registered after it — both hand-written handlers AND metaobjects-generated routes via the \`routeOptions\` field. Beats sprinkling \`if (!auth(...)) return;\` at the top of every handler.
|
|
100
|
+
|
|
101
|
+
### 5. Hand-coded code is always available, but coexists with generated code.
|
|
102
|
+
|
|
103
|
+
Generated code does the boilerplate. Hand-coded code does the business logic. They live in the same project, the same package, sometimes the same file. The hand-coded code consumes the generated constants and generated Zod schemas — it never duplicates schema, never hard-codes paths, never declares its own validators that metadata could declare.
|
|
104
|
+
|
|
105
|
+
Concrete pattern from the trainer website:
|
|
106
|
+
- Generated \`Subscriber.routes.ts\` registers GET / GET-by-id / POST / PATCH / DELETE on \`/api/subscribers\`.
|
|
107
|
+
- Hand-written \`apps/api/src/routes/subscribers.ts\` keeps \`POST /subscribe\` — the custom endpoint with the Loops side-effect.
|
|
108
|
+
- Both registered with \`fastify.register()\`. Both validate via \`SubscriberInsertSchema\`. Both use \`Subscriber.email.name\` / etc. Neither knows the other exists.
|
|
109
|
+
|
|
110
|
+
## Metaobjects metamodel — quick rules
|
|
111
|
+
|
|
112
|
+
The format used by \`metaobjects/*.json\` is **metaobjects metadata**, a cross-language standard. Eight base types:
|
|
113
|
+
|
|
114
|
+
| Type | Purpose |
|
|
115
|
+
|---|---|
|
|
116
|
+
| \`metadata\` | Root document wrapper |
|
|
117
|
+
| \`object\` | An entity (table/record) |
|
|
118
|
+
| \`field\` | A property on an object |
|
|
119
|
+
| \`attr\` | Named scalar/array decoration on any parent |
|
|
120
|
+
| \`validator\` | A validation rule |
|
|
121
|
+
| \`view\` | A UI control kind |
|
|
122
|
+
| \`identity\` | A primary/secondary key |
|
|
123
|
+
| \`relationship\` | An association between objects |
|
|
124
|
+
|
|
125
|
+
### Two most-violated rules
|
|
126
|
+
|
|
127
|
+
1. **Attribute uniqueness.** Within a single parent metadata node, all attribute names must be unique. You cannot have two \`attr\` children both named \`alternative\`. For multi-value, use a single \`stringarray\` attr: \`"@alternatives": ["a", "b", "c"]\`.
|
|
128
|
+
|
|
129
|
+
2. **Inline \`@<name>\` and \`attr\` child are the same thing.** \`"@maxLength": 50\` is shorthand for \`{"attr": {"name": "maxLength", "subType": "int", "value": "50"}}\`. The parser converts inline form into attr children. Don't use both forms for the same attribute name on the same parent.
|
|
130
|
+
|
|
131
|
+
### Object subtypes (v0.3)
|
|
132
|
+
|
|
133
|
+
- \`base\` — abstract template (no runtime semantics)
|
|
134
|
+
- \`entity\` — persistent record; should have a primary identity
|
|
135
|
+
- \`value\` — value-object; equality by content; must NOT have a primary identity
|
|
136
|
+
|
|
137
|
+
Java-runtime strategies (pojo / map / proxy) belong on \`@javaRuntime\`, not in \`subType\`.
|
|
138
|
+
|
|
139
|
+
### Reserved structural keys (NOT attributes)
|
|
140
|
+
|
|
141
|
+
\`name\`, \`subType\`, \`package\`, \`extends\`, \`isAbstract\`, \`children\`, \`merge\`, \`value\`.
|
|
142
|
+
|
|
143
|
+
The v0.2 keys (\`super\`, \`overlay\`, \`override\`, \`isInterface\`, \`implements\`) are **gone**. The current parser will reject them. Use:
|
|
144
|
+
- \`extends:\` instead of \`super:\` for the supertype reference
|
|
145
|
+
- \`merge: true\` instead of \`overlay: true\` / \`override: true\` for in-place modification
|
|
146
|
+
- \`@isAbstract: true\` instead of \`isInterface: true\` (multiple inheritance is not supported)
|
|
147
|
+
|
|
148
|
+
### Package paths and inheritance
|
|
149
|
+
|
|
150
|
+
- Package segments separated by \`::\` — \`acme::common::id\`
|
|
151
|
+
- Relative references in \`extends:\` — \`..::common::id\` means "go up to parent package, descend into \`common::id\`"
|
|
152
|
+
- Cross-file resolution works as long as all files are passed to Loader (or live in the same \`metaobjects/\` directory)
|
|
153
|
+
|
|
154
|
+
### Two special intercepted attrs (parser-routed)
|
|
155
|
+
|
|
156
|
+
- \`@isArray\` → marks a field as a collection
|
|
157
|
+
- \`@isAbstract\` → marks a node as abstract (inheritable but not instantiable)
|
|
158
|
+
|
|
159
|
+
## Validators — two layers
|
|
160
|
+
|
|
161
|
+
Validators can attach in two places, and they compose:
|
|
162
|
+
|
|
163
|
+
**Field-level validators** describe what makes the *stored value* valid. They survive across UI, API, batch import, manual SQL — anywhere data enters the system. The generated Zod \`<Entity>InsertSchema\` encodes these.
|
|
164
|
+
|
|
165
|
+
\`\`\`json
|
|
166
|
+
{"field": {"name": "email", "subType": "string",
|
|
167
|
+
"children": [
|
|
168
|
+
{"validator": {"subType": "required"}},
|
|
169
|
+
{"validator": {"subType": "regex", "@pattern": "^[^@]+@[^@]+\\\\.[^@]+$"}}
|
|
170
|
+
]
|
|
171
|
+
}}
|
|
172
|
+
\`\`\`
|
|
173
|
+
|
|
174
|
+
**View-level validators** describe what makes user *input* valid in a specific UI surface — possibly stricter, possibly with different messages, possibly format-specific. They run client-side in generated forms. They do NOT necessarily reject the stored value if it's already in the DB.
|
|
175
|
+
|
|
176
|
+
\`\`\`json
|
|
177
|
+
{"field": {"name": "phone", "subType": "string",
|
|
178
|
+
"children": [
|
|
179
|
+
{"validator": {"subType": "regex", "@pattern": "^\\\\+?[0-9]+$"}},
|
|
180
|
+
{"view": {"subType": "text-input", "@label": "Phone",
|
|
181
|
+
"children": [
|
|
182
|
+
{"validator": {"subType": "length", "@min": 7, "@max": 20,
|
|
183
|
+
"@message": "Phone must be 7-20 digits"}}
|
|
184
|
+
]
|
|
185
|
+
}}
|
|
186
|
+
]
|
|
187
|
+
}}
|
|
188
|
+
\`\`\`
|
|
189
|
+
|
|
190
|
+
Rule of thumb: rules that protect data integrity → field. Rules that improve input UX → view.
|
|
191
|
+
|
|
192
|
+
## metaobjects.config.ts — generator wiring (project root)
|
|
193
|
+
|
|
194
|
+
\`meta gen\` reads \`metaobjects.config.ts\` at the project root. This is where you declare which generators run and their options. It is TypeScript, type-checked, and imported via \`jiti\` at run time.
|
|
195
|
+
|
|
196
|
+
\`\`\`ts
|
|
197
|
+
import { defineConfig } from "@metaobjectsdev/cli";
|
|
198
|
+
import {
|
|
199
|
+
entityFile, queriesFile, routesFile, /* formFile, */ barrel,
|
|
200
|
+
} from "@metaobjectsdev/codegen-ts/generators";
|
|
201
|
+
|
|
202
|
+
export default defineConfig({
|
|
203
|
+
outDir: "packages/database/src/generated",
|
|
204
|
+
extStyle: "none",
|
|
205
|
+
dbImport: "../index",
|
|
206
|
+
dialect: "sqlite",
|
|
207
|
+
generators: [
|
|
208
|
+
entityFile(),
|
|
209
|
+
queriesFile(),
|
|
210
|
+
routesFile(),
|
|
211
|
+
// formFile(), // opt-in: emits stock React forms per entity
|
|
212
|
+
barrel(),
|
|
213
|
+
],
|
|
214
|
+
});
|
|
215
|
+
\`\`\`
|
|
216
|
+
|
|
217
|
+
3rd-party generator example: \`import { tanstackQuery } from "@metaobjectsdev/codegen-ts-tanstack"; // then add tanstackQuery({ ... }) to the generators array\`
|
|
218
|
+
|
|
219
|
+
Filters live on the generator entry: \`routesFile({ filter: e => e.name !== "AuditLog" })\`
|
|
220
|
+
|
|
221
|
+
\`.metaobjects/config.json\` is unchanged — it still holds static project state (schema_version, pending_in_git, confidence_thresholds). Generator wiring belongs in \`metaobjects.config.ts\` so TypeScript can type-check the imports.
|
|
222
|
+
|
|
223
|
+
## Generated hooks + grids (TanStack)
|
|
224
|
+
|
|
225
|
+
When \`tanstackQuery()\` is in your \`metaobjects.config.ts\`, every entity gets \`<Entity>.hooks.ts\` with a query-key factory + \`useEntity\`, \`useEntities\`, \`useCreate\`, \`useUpdate\`, \`useDelete\` hooks. When \`tanstackGrid()\` is in the config, entities with a \`layout[dataGrid]\` child also get \`<Entity>.columns.tsx\`.
|
|
226
|
+
|
|
227
|
+
\`\`\`tsx
|
|
228
|
+
import { usePrograms, useCreateProgram } from "@your-pkg/database/generated/Program.hooks";
|
|
229
|
+
import { programDefaultColumns, programDefaultGrid } from "@your-pkg/database/generated/Program.columns";
|
|
230
|
+
import { EntityGrid } from "@metaobjectsdev/tanstack";
|
|
231
|
+
|
|
232
|
+
const { data, isLoading } = usePrograms();
|
|
233
|
+
const create = useCreateProgram({ onSuccess: () => navigate("/programs") });
|
|
234
|
+
|
|
235
|
+
<EntityGrid
|
|
236
|
+
columns={programDefaultColumns}
|
|
237
|
+
grid={programDefaultGrid}
|
|
238
|
+
data={data ?? []}
|
|
239
|
+
isLoading={isLoading}
|
|
240
|
+
onRowClick={(row) => navigate(\`/admin/programs/\${row.id}\`)}
|
|
241
|
+
/>
|
|
242
|
+
\`\`\`
|
|
243
|
+
|
|
244
|
+
**Provider setup.** Wrap your app with \`<EntityFetcherProvider value={fetcher}>\` (supplies the HTTP fetcher to all generated hooks). For an admin subtree with different auth, wrap a second time inside: \`<EntityFetcherProvider value={adminFetch}>...</EntityFetcherProvider>\` overrides the outer one.
|
|
245
|
+
|
|
246
|
+
**Metadata layer — grid definition:**
|
|
247
|
+
|
|
248
|
+
\`\`\`jsonc
|
|
249
|
+
{ "layout": {
|
|
250
|
+
"subType": "dataGrid",
|
|
251
|
+
"name": "default",
|
|
252
|
+
"@pageSize": 25,
|
|
253
|
+
"@defaultSortField": "createdAt",
|
|
254
|
+
"@defaultSortOrder": "desc",
|
|
255
|
+
"@filterable": true,
|
|
256
|
+
"@columns": ["email", "firstName", "subscribed", "createdAt"]
|
|
257
|
+
}}
|
|
258
|
+
\`\`\`
|
|
259
|
+
|
|
260
|
+
The \`@columns\` attr is a flat string array listing fields to display. Per-column rendering comes from each field's own \`view\` subtype (the same one that drives forms); sortability comes from the field's \`@sortable\` attr; width belongs in app CSS. There are no nested per-column children — just \`@columns\`.
|
|
261
|
+
|
|
262
|
+
**Cell renderers.** Field rendering inside grids comes from each field's own \`view\` subtype (the same one that drives forms). Override defaults app-wide with \`<CellRendererProvider value={{ currency: ({ getValue }) => <Money value={getValue()} /> }}>\`.
|
|
263
|
+
|
|
264
|
+
**Per-entity opt-out.** \`@emitTanstack: false\` on an entity skips both hooks and columns.
|
|
265
|
+
|
|
266
|
+
## Filtering generated lists
|
|
267
|
+
|
|
268
|
+
Mark filterable fields in metadata with \`@filterable: true\`:
|
|
269
|
+
|
|
270
|
+
\`\`\`jsonc
|
|
271
|
+
{ "field": { "name": "email", "subType": "string", "@filterable": true } }
|
|
272
|
+
\`\`\`
|
|
273
|
+
|
|
274
|
+
The generated \`useSubscribers(filter)\` hook accepts a typed filter:
|
|
275
|
+
|
|
276
|
+
\`\`\`tsx
|
|
277
|
+
const { data } = useSubscribers({
|
|
278
|
+
email: { like: "%@example.com" },
|
|
279
|
+
subscribed: true,
|
|
280
|
+
sort: "createdAt:desc",
|
|
281
|
+
limit: 25,
|
|
282
|
+
});
|
|
283
|
+
\`\`\`
|
|
284
|
+
|
|
285
|
+
URL sent: \`/subscribers?filter[email][like]=%25@example.com&filter[subscribed]=true&sort=createdAt:desc&limit=25\`
|
|
286
|
+
|
|
287
|
+
**Operators by field subtype:**
|
|
288
|
+
- String: \`eq, ne, in, like, isNull\`
|
|
289
|
+
- Number/date: \`eq, ne, gt, gte, lt, lte, in, isNull\`
|
|
290
|
+
- Boolean: \`eq, isNull\`
|
|
291
|
+
|
|
292
|
+
Illegal combinations like \`useSubscribers({ subscribed: { gte: true } })\` fail to compile (booleans don't support \`gte\`).
|
|
293
|
+
|
|
294
|
+
**Per-grid preset filter** via layout \`@filter\`:
|
|
295
|
+
|
|
296
|
+
\`\`\`jsonc
|
|
297
|
+
{ "layout": { "subType": "dataGrid", "name": "active",
|
|
298
|
+
"@filter": { "subscribed": true },
|
|
299
|
+
"@columns": ["email", "firstName", "subscribed"] }}
|
|
300
|
+
\`\`\`
|
|
301
|
+
|
|
302
|
+
Generates \`subscriberActiveFilter\` const consumable in pages. Compose with ad-hoc filters via object spread.
|
|
303
|
+
|
|
304
|
+
## Projections (read models with joined/aggregated columns)
|
|
305
|
+
|
|
306
|
+
When a list needs computed columns (counts, sums, joined fields), create a **projection** — an entity that extends a base entity but reads from a SQL view:
|
|
307
|
+
|
|
308
|
+
\`\`\`json
|
|
309
|
+
// metaobjects/meta.commerce.json (inline with Program)
|
|
310
|
+
{
|
|
311
|
+
"object": {
|
|
312
|
+
"name": "ProgramSummary",
|
|
313
|
+
"subType": "entity",
|
|
314
|
+
"extends": "Program",
|
|
315
|
+
"children": [
|
|
316
|
+
{ "source": { "subType": "dbView", "@name": "v_program_summary" } },
|
|
317
|
+
{ "field": { "name": "weekCount", "subType": "int", "children": [
|
|
318
|
+
{ "origin": { "subType": "aggregate",
|
|
319
|
+
"@agg": "count", "@of": "Week.id", "@via": "Program.weeks" }}
|
|
320
|
+
]}},
|
|
321
|
+
{ "identity": { "subType": "primary", "@fields": "id" } }
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
\`\`\`
|
|
326
|
+
|
|
327
|
+
\`meta gen\` produces a read-only \`useProgramSummaries(filter)\` hook, a SQL view DDL in the migration, and a read-only GET-only route.
|
|
328
|
+
|
|
329
|
+
**Aggregate vocabulary**: \`count\`, \`sum\`, \`avg\`, \`min\`, \`max\`.
|
|
330
|
+
|
|
331
|
+
**Multi-level via paths** are supported: \`@via: "Program.weeks.workouts"\` builds a 2-level JOIN tree.
|
|
332
|
+
|
|
333
|
+
**For pages that need a full nested tree** (e.g., Program → Weeks → Workouts → Exercises), use 4 entity hooks with Project D's filter syntax for batched lookups (no projection needed — flat hooks + client-side stitching is enough):
|
|
334
|
+
|
|
335
|
+
\`\`\`tsx
|
|
336
|
+
const { data: weeks } = useWeeks({ programId, sort: "weekNumber:asc" });
|
|
337
|
+
const weekIds = weeks?.map((w) => w.id) ?? [];
|
|
338
|
+
const { data: workouts } = useWorkouts(
|
|
339
|
+
weekIds.length ? { weekId: { in: weekIds } } : undefined,
|
|
340
|
+
);
|
|
341
|
+
\`\`\`
|
|
342
|
+
|
|
343
|
+
## Currency fields
|
|
344
|
+
|
|
345
|
+
Declare a money field with \`subType: "currency"\`:
|
|
346
|
+
|
|
347
|
+
\`\`\`json
|
|
348
|
+
{ "field": { "name": "priceCents", "subType": "currency", "@currency": "USD" } }
|
|
349
|
+
\`\`\`
|
|
350
|
+
|
|
351
|
+
Storage stays as integer minor units (cents for USD). The generated \`<Entity>\` constants block carries \`view\`, \`currency\`, \`locale\` so admin grids auto-format prices.
|
|
352
|
+
|
|
353
|
+
**Imports — use sub-paths in browser code:**
|
|
354
|
+
|
|
355
|
+
\`\`\`tsx
|
|
356
|
+
import { formatCurrency } from "@metaobjectsdev/runtime-web";
|
|
357
|
+
import { CurrencyInput } from "@metaobjectsdev/react";
|
|
358
|
+
\`\`\`
|
|
359
|
+
|
|
360
|
+
**Display:**
|
|
361
|
+
|
|
362
|
+
\`\`\`tsx
|
|
363
|
+
<span>{formatCurrency(program.priceCents)}</span> // $15.00
|
|
364
|
+
<span>{formatCurrency(p.amountCents, "EUR", "de-DE")}</span> // 15,00 €
|
|
365
|
+
\`\`\`
|
|
366
|
+
|
|
367
|
+
**Form input:**
|
|
368
|
+
|
|
369
|
+
\`\`\`tsx
|
|
370
|
+
<CurrencyInput value={priceCents} onChange={setPriceCents} currency="USD" />
|
|
371
|
+
\`\`\`
|
|
372
|
+
|
|
373
|
+
User types \`15.99\` → component emits \`1599\` to \`onChange\` on blur. Wire format is always integer cents.
|
|
374
|
+
|
|
375
|
+
**Locale override** via a \`view[currency]\` child:
|
|
376
|
+
|
|
377
|
+
\`\`\`json
|
|
378
|
+
{ "field": { "name": "priceCents", "subType": "currency", "@currency": "EUR",
|
|
379
|
+
"children": [{ "view": { "subType": "currency", "@locale": "de-DE" } }]
|
|
380
|
+
}}
|
|
381
|
+
\`\`\`
|
|
382
|
+
|
|
383
|
+
Currency code lives on the field; locale lives on the view.
|
|
384
|
+
|
|
385
|
+
## Generated artifacts — what \`meta gen\` produces
|
|
386
|
+
|
|
387
|
+
After \`meta gen\`, you get one barrel + per-entity files in your configured \`outDir\` (default \`packages/database/src/generated/\`):
|
|
388
|
+
|
|
389
|
+
| File | What's in it | When to touch by hand |
|
|
390
|
+
|---|---|---|
|
|
391
|
+
| \`<Entity>.ts\` | Drizzle table, relations(), inferred types, Zod insert/update schemas, and the rich \`<Entity>\` constants block (per-field objects with name, label, view, htmlType, rules, etc.) | Never. Regenerate. |
|
|
392
|
+
| \`<Entity>.queries.ts\` | Typed query helpers (\`findUserById\`, \`listUsers\`, \`createUser\`, ...) using prepared statements | Never. Regenerate. |
|
|
393
|
+
| \`<Entity>.routes.ts\` | Fastify CRUD plugin delegating to \`mountCrudRoutes\` from \`@metaobjectsdev/runtime-ts/drizzle-fastify\` (5 verbs, Zod validation, 404/204 mapping, Drizzle-direct under the hood) | Never. Regenerate. |
|
|
394
|
+
| \`<Entity>.form.tsx\` | React form using \`useEntityForm\` + the entity constants. **OPT-IN at project level:** add \`formFile()\` to \`generators\` in \`metaobjects.config.ts\`. Opt out per-entity via \`@emitForm: false\`. | Never. Regenerate. |
|
|
395
|
+
| \`index.ts\` | Barrel re-exporting every entity file | Never. Regenerate. |
|
|
396
|
+
|
|
397
|
+
For business logic the generator doesn't cover, create a SIBLING file: \`<Entity>.extra.ts\` for query/route helpers, or any file you like in your apps directory. Import the constants from the generated \`<Entity>.ts\`.
|
|
398
|
+
|
|
399
|
+
### Stock route mounting
|
|
400
|
+
|
|
401
|
+
\`\`\`ts
|
|
402
|
+
import { subscriberRoutes } from "@your-pkg/database/generated/Subscriber.routes";
|
|
403
|
+
fastify.register(subscriberRoutes, { prefix: "/api" });
|
|
404
|
+
\`\`\`
|
|
405
|
+
|
|
406
|
+
That mounts: \`GET /api/subscribers\`, \`GET /api/subscribers/:id\`, \`POST /api/subscribers\`, \`PATCH /api/subscribers/:id\`, \`DELETE /api/subscribers/:id\`. Pagination via \`?limit=\` & \`?offset=\`. Validation via the generated Zod schemas. Drizzle calls under the hood.
|
|
407
|
+
|
|
408
|
+
### Mixing custom routes alongside generated
|
|
409
|
+
|
|
410
|
+
\`\`\`ts
|
|
411
|
+
import { db, subscribers } from "@your-pkg/database";
|
|
412
|
+
import { Subscriber, SubscriberInsertSchema } from "@your-pkg/database/generated/Subscriber";
|
|
413
|
+
import { eq } from "drizzle-orm";
|
|
414
|
+
|
|
415
|
+
fastify.post("/subscribe", async (req, reply) => {
|
|
416
|
+
// Generated Zod schema validates the body — same schema the API route uses.
|
|
417
|
+
const parsed = SubscriberInsertSchema.safeParse(req.body);
|
|
418
|
+
if (!parsed.success) return reply.code(400).send({ issues: parsed.error.issues });
|
|
419
|
+
|
|
420
|
+
// Drizzle's typed accessors are already TS-safe; no need for indirection.
|
|
421
|
+
const existing = await db.select().from(subscribers).where(eq(subscribers.email, parsed.data.email)).get();
|
|
422
|
+
if (existing) return reply.code(409).send({ error: "Already subscribed" });
|
|
423
|
+
|
|
424
|
+
const [row] = await db.insert(subscribers).values(parsed.data).returning();
|
|
425
|
+
// ... your business logic (analytics, Loops/Mailchimp, navigation, etc.)
|
|
426
|
+
return reply.code(201).send(row);
|
|
427
|
+
});
|
|
428
|
+
\`\`\`
|
|
429
|
+
|
|
430
|
+
The fact that every metadata-derived value flows from \`Subscriber\` / \`SubscriberInsertSchema\` / the typed \`subscribers\` table is what makes rename-the-field-in-metadata-and-regen safe.
|
|
431
|
+
|
|
432
|
+
### Hand-written form using \`useEntityForm\`
|
|
433
|
+
|
|
434
|
+
\`\`\`tsx
|
|
435
|
+
import { useEntityForm } from '@metaobjectsdev/react';
|
|
436
|
+
import { Subscriber, SubscriberInsertSchema, type Subscriber as Row } from './generated/Subscriber';
|
|
437
|
+
|
|
438
|
+
export function SubscribeForm() {
|
|
439
|
+
const form = useEntityForm(Subscriber, SubscriberInsertSchema);
|
|
440
|
+
const { handleSubmit, formState: { errors } } = form;
|
|
441
|
+
|
|
442
|
+
return (
|
|
443
|
+
<form onSubmit={handleSubmit(/* your onSubmit */)} className="your-design-system">
|
|
444
|
+
<label>{Subscriber.email.label}</label>
|
|
445
|
+
<input {...form.input.email} />
|
|
446
|
+
{errors.email && <span>{errors.email.message}</span>}
|
|
447
|
+
|
|
448
|
+
<label>{Subscriber.firstName.label}</label>
|
|
449
|
+
<input {...form.input.firstName} />
|
|
450
|
+
{errors.firstName && <span>{errors.firstName.message}</span>}
|
|
451
|
+
|
|
452
|
+
<button type="submit">Subscribe</button>
|
|
453
|
+
</form>
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
\`\`\`
|
|
457
|
+
|
|
458
|
+
Spread \`form.input.<field>\` — it carries name, type, placeholder, rules, aria-label automatically. No magic strings.
|
|
459
|
+
|
|
460
|
+
## Meta Forge additions
|
|
461
|
+
|
|
462
|
+
### \`@forge*\` attribute namespace
|
|
463
|
+
|
|
464
|
+
Provenance and confidence concerns expressed as inline attributes on any metadata child. Names use camelCase (no separator).
|
|
465
|
+
|
|
466
|
+
Most common:
|
|
467
|
+
- \`@forgeConfidence\` (double 0..1) — confidence the record is correct
|
|
468
|
+
- \`@forgeSource\` (string) — \`human\` | \`claude\` | \`ts-ast\` | \`drizzle\` | ...
|
|
469
|
+
- \`@forgePrimaryLocation\` (string) — file path for an entity
|
|
470
|
+
- \`@forgeRationale\` (string, decision only) — why this decision
|
|
471
|
+
- \`@forgeAlternatives\` (stringarray, decision only) — alternatives considered
|
|
472
|
+
|
|
473
|
+
Full inventory in \`packages/sdk/FORGE-METADATA.md\`.
|
|
474
|
+
|
|
475
|
+
### New top-level types
|
|
476
|
+
|
|
477
|
+
Registered by \`@metaobjectsdev/sdk\` into the TypeRegistry:
|
|
478
|
+
|
|
479
|
+
| Type | Purpose |
|
|
480
|
+
|---|---|
|
|
481
|
+
| \`decision\` | Architectural or design decision |
|
|
482
|
+
| \`principle\` | Design principle (advisory/enforced) |
|
|
483
|
+
| \`convention\` | Coding/structural convention |
|
|
484
|
+
| \`glossary\` | Domain-term definition |
|
|
485
|
+
| \`failure\` | Recorded failure mode |
|
|
486
|
+
|
|
487
|
+
These coexist with \`object\` children in the same package files. \`meta gen\` and \`meta migrate\` only consume \`object\`; the descriptive types are context for AI tooling and don't drive codegen.
|
|
488
|
+
|
|
489
|
+
## File layout
|
|
490
|
+
|
|
491
|
+
\`\`\`
|
|
492
|
+
metaobjects/
|
|
493
|
+
├── meta.common.json shared base fields/validators (optional)
|
|
494
|
+
├── meta.<domain>.json your entity packages(s)
|
|
495
|
+
└── _pending/<pkg>.json proposed packages awaiting review
|
|
496
|
+
|
|
497
|
+
.metaobjects/
|
|
498
|
+
├── config.json static project state
|
|
499
|
+
├── migrations/ written by meta migrate
|
|
500
|
+
└── .gen-state/ codegen merge base (gitignored)
|
|
501
|
+
|
|
502
|
+
metaobjects.config.ts generator wiring (committed)
|
|
503
|
+
\`\`\`
|
|
504
|
+
|
|
505
|
+
## Worked example
|
|
506
|
+
|
|
507
|
+
\`\`\`json
|
|
508
|
+
{
|
|
509
|
+
"metadata": {
|
|
510
|
+
"package": "myapp",
|
|
511
|
+
"children": [
|
|
512
|
+
{
|
|
513
|
+
"object": {
|
|
514
|
+
"name": "User",
|
|
515
|
+
"subType": "entity",
|
|
516
|
+
"@forgeConfidence": 0.95,
|
|
517
|
+
"@forgeSource": "human",
|
|
518
|
+
"@forgePrimaryLocation": "src/db/users.schema.ts",
|
|
519
|
+
"children": [
|
|
520
|
+
{"field": {"name": "id", "extends": "..::common::id"}},
|
|
521
|
+
{"field": {"name": "email", "subType": "string",
|
|
522
|
+
"@dbColumn": "email_address",
|
|
523
|
+
"children": [{"validator": {"subType": "required"}}]
|
|
524
|
+
}},
|
|
525
|
+
{"identity": {"name": "pk", "subType": "primary", "@fields": ["id"], "@generation": "increment"}}
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"decision": {
|
|
531
|
+
"name": "useTanstackQuery",
|
|
532
|
+
"subType": "global",
|
|
533
|
+
"@forgeConfidence": 0.9,
|
|
534
|
+
"@forgeSource": "human",
|
|
535
|
+
"@forgeRationale": "Real-time invalidation matters for live game state.",
|
|
536
|
+
"@forgeAlternatives": ["swr", "redux-toolkit-query"]
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
\`\`\`
|
|
543
|
+
|
|
544
|
+
## Authoring guidance
|
|
545
|
+
|
|
546
|
+
| Situation | Action |
|
|
547
|
+
|---|---|
|
|
548
|
+
| Adding a field to an existing entity | Edit the \`object\`'s \`children\`; append a \`field\` node, then \`meta gen\` |
|
|
549
|
+
| New entity in an existing domain | Append an \`object\` to the appropriate package file, then \`meta gen\` |
|
|
550
|
+
| Renaming an entity or field | Edit the metadata, regenerate; TS will surface every stale consumer of the constants |
|
|
551
|
+
| New REST resource | Already done — \`meta gen\` produced \`<Entity>.routes.ts\`. Just \`fastify.register(...)\` it |
|
|
552
|
+
| Custom business logic (Stripe webhook, side-effects, auth flows) | Hand-write a route/handler that imports the generated constants + \`om()\` |
|
|
553
|
+
| Architectural choice affecting how entities are built | Add a \`decision\` with \`@forgeRationale\` + \`@forgeAlternatives\` |
|
|
554
|
+
| Coding convention | Add a \`convention\` with \`@forgePatternDescription\` + \`@forgeAppliesTo\` |
|
|
555
|
+
| Domain term | Add a \`glossary\` entry with \`@forgeTerm\` + \`@forgeDefinition\` |
|
|
556
|
+
|
|
557
|
+
## Deeper references
|
|
558
|
+
|
|
559
|
+
- \`packages/metadata/METAMODEL.md\` — full metamodel reference
|
|
560
|
+
- \`packages/sdk/FORGE-METADATA.md\` — full \`@forge*\` inventory + MetaObjects layout details
|
|
561
|
+
- \`docs/strategy/2026-05-12-v0.3-ai-first-metadata-loading.md\` — current strategy (v0.3 vocab, packages, AI-first loading)
|
|
562
|
+
`;
|
|
563
|
+
//# sourceMappingURL=body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../src/agent-docs/body.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgjB9B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function computeContentHash(body: string): string;
|
|
2
|
+
/** Returns the body with a content-hash HTML comment prepended. */
|
|
3
|
+
export declare function withContentHash(body: string): string;
|
|
4
|
+
/** Extract the embedded hash, or undefined if not present. */
|
|
5
|
+
export declare function extractContentHash(fileBody: string): string | undefined;
|
|
6
|
+
/** True iff the file body's hash matches its own content (i.e. unmodified). */
|
|
7
|
+
export declare function isUnmodified(fileBody: string): boolean;
|
|
8
|
+
//# sourceMappingURL=content-hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-hash.d.ts","sourceRoot":"","sources":["../../src/agent-docs/content-hash.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGvE;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKtD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export function computeContentHash(body) {
|
|
3
|
+
return createHash("sha256").update(body, "utf8").digest("hex");
|
|
4
|
+
}
|
|
5
|
+
/** Returns the body with a content-hash HTML comment prepended. */
|
|
6
|
+
export function withContentHash(body) {
|
|
7
|
+
const hash = computeContentHash(body);
|
|
8
|
+
return `<!-- metaobjects-content-hash: ${hash} -->\n${body}`;
|
|
9
|
+
}
|
|
10
|
+
/** Extract the embedded hash, or undefined if not present. */
|
|
11
|
+
export function extractContentHash(fileBody) {
|
|
12
|
+
const match = /<!-- metaobjects-content-hash: ([a-f0-9]{64}) -->/.exec(fileBody);
|
|
13
|
+
return match?.[1];
|
|
14
|
+
}
|
|
15
|
+
/** True iff the file body's hash matches its own content (i.e. unmodified). */
|
|
16
|
+
export function isUnmodified(fileBody) {
|
|
17
|
+
const embedded = extractContentHash(fileBody);
|
|
18
|
+
if (embedded === undefined)
|
|
19
|
+
return false;
|
|
20
|
+
const withoutHash = fileBody.replace(/^<!-- metaobjects-content-hash: [a-f0-9]{64} -->\n/, "");
|
|
21
|
+
return computeContentHash(withoutHash) === embedded;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=content-hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-hash.js","sourceRoot":"","sources":["../../src/agent-docs/content-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,kCAAkC,IAAI,SAAS,IAAI,EAAE,CAAC;AAC/D,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,KAAK,GAAG,mDAAmD,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjF,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,oDAAoD,EAAE,EAAE,CAAC,CAAC;IAC/F,OAAO,kBAAkB,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent-docs/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent-docs/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,YAAY,GACb,MAAM,mBAAmB,CAAC"}
|