@voxgig/sdkgen 1.3.7 → 1.3.8

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/bin/voxgig-sdkgen CHANGED
@@ -8,7 +8,7 @@ const { Shape, One } = require('shape')
8
8
 
9
9
  const { SdkGen } = require('../dist/sdkgen.js')
10
10
 
11
- const VERSION = '1.3.7'
11
+ const VERSION = '1.3.8'
12
12
  const KONSOLE = console
13
13
 
14
14
 
@@ -0,0 +1,2 @@
1
+ declare const AgentGuide: import("jostraca").Component;
2
+ export { AgentGuide };
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentGuide = void 0;
4
+ const jostraca_1 = require("jostraca");
5
+ const utility_1 = require("../utility");
6
+ const AgentGuideContent_1 = require("./AgentGuideContent");
7
+ const AgentGuideFeature_1 = require("./AgentGuideFeature");
8
+ // Per-language agent guide. Emitted inside the ambient target folder (the Root
9
+ // enters `Folder({ name: target.name })` before calling this, exactly as for
10
+ // Readme), so it lands at `<lang>/AGENTS.md`. Then it drives the co-located
11
+ // per-feature guides for this target.
12
+ const AgentGuide = (0, jostraca_1.cmp)(function AgentGuide(props) {
13
+ const { target, ctx$ } = props;
14
+ const { model } = ctx$;
15
+ const Name = (0, AgentGuideContent_1.projectName)(model);
16
+ const lang = target.name;
17
+ const title = target.title || lang;
18
+ const surface = (0, AgentGuideContent_1.langCmd)(lang).note;
19
+ const features = (0, AgentGuideContent_1.activeFeatures)(model);
20
+ // go-cli/go-mcp disable the feature phase; ts/js lay features out as
21
+ // per-feature directories, the other SDK targets as flat files.
22
+ const featuresOn = (0, AgentGuideContent_1.featuresEnabled)(target);
23
+ const dirLayout = (0, AgentGuideContent_1.isDirLayout)(target);
24
+ (0, jostraca_1.File)({ name: 'AGENTS.md' }, () => {
25
+ (0, jostraca_1.Content)(`# ${Name} ${title} — Agent Guide
26
+
27
+ ${surface
28
+ ? surface + '\n\nGenerated from the shared model; see the [project guide](../AGENTS.md) for the full workflow.'
29
+ : `The ${title} client for the ${Name} API. This directory is **generated** — do not edit it by hand; change the model/template/component in \`.sdk/\` and regenerate. See the [project guide](../AGENTS.md) for the full workflow and the aontu model language.`}
30
+
31
+ > Paths below (\`.sdk/…\`) are relative to the **project root** — one level up
32
+ > from this \`${lang}/\` directory.
33
+
34
+ ## Regenerate this target
35
+
36
+ \`\`\`bash
37
+ cd ../.sdk
38
+ npm run build # only if you changed a component
39
+ npm run generate # refreshes this ${lang}/ directory
40
+ \`\`\`
41
+
42
+ Then build and test the generated output:
43
+
44
+ ${(0, AgentGuideContent_1.langCommandsBlock)(lang)}
45
+
46
+ ## What generates this target
47
+
48
+ | Source | Path | Edit when… |
49
+ | --- | --- | --- |
50
+ | Target definition | \`.sdk/model/target/${lang}.aontu\` | deps, module, extension, phases change |
51
+ | Templates | \`.sdk/tm/${lang}/\` | the file is the **same for every API** (runtime, transport, base classes) — copied verbatim with placeholder substitution |
52
+ | Components | \`.sdk/src/cmp/${lang}/\` | the file's shape **depends on the API** (entities, constructor, README, tests) — TypeScript that walks the model |
53
+
54
+ Decision rule: *same for every API → template; depends on the API →
55
+ component.* After editing a component run \`npm run build\` before
56
+ \`npm run generate\`; template-only edits just need \`npm run generate\`.
57
+
58
+ `);
59
+ if (featuresOn && 0 < features.length) {
60
+ (0, jostraca_1.Content)(`## Features in this target
61
+
62
+ `);
63
+ if (dirLayout) {
64
+ // ts/js: each feature is a directory under src/feature/ with its own guide.
65
+ features.forEach((f) => {
66
+ const t = f.title ? ' — ' + f.title : '';
67
+ (0, jostraca_1.Content)(`- [\`${f.name}\`](./src/feature/${f.name}/AGENTS.md)${t}
68
+ `);
69
+ });
70
+ (0, jostraca_1.Content)(`
71
+ Each feature's runtime and its own guide live in \`src/feature/<name>/\`.
72
+
73
+ `);
74
+ }
75
+ else {
76
+ // go/py/php/rb/lua: flat files in the shared \`feature/\` package — no
77
+ // per-feature directory, so features are documented inline here.
78
+ (0, jostraca_1.Content)(`Each feature is a flat file in the \`feature/\` package. Its hooks and
79
+ default activation come from \`.sdk/model/feature/<name>.aontu\`; customise
80
+ the runtime under \`.sdk/tm/${lang}/feature/\` and regenerate.
81
+
82
+ | Feature | Runtime file | Active hooks |
83
+ | --- | --- | --- |
84
+ `);
85
+ features.forEach((f) => {
86
+ const file = (0, AgentGuideContent_1.featureRuntimeFile)(target, f);
87
+ const hooks = (0, AgentGuideContent_1.featureHooks)(f);
88
+ const hookList = hooks.length ? hooks.map((h) => '\`' + h + '\`').join(', ') : '—';
89
+ const label = f.title ? `**${f.name}** — ${f.title}` : `**${f.name}**`;
90
+ (0, jostraca_1.Content)(`| ${label} | \`feature/${file}\` | ${hookList} |
91
+ `);
92
+ });
93
+ (0, jostraca_1.Content)(`
94
+ `);
95
+ }
96
+ }
97
+ // Optional per-language enrichment (build/test specifics, idioms). Neutral
98
+ // content above stands alone; a language may add an AgentGuide_<lang>.
99
+ const AgentGuide_sdk = (0, utility_1.requirePath)(ctx$, `./cmp/${lang}/AgentGuide_${lang}`, { ignore: true });
100
+ if (AgentGuide_sdk) {
101
+ AgentGuide_sdk['AgentGuide']({ target });
102
+ }
103
+ (0, jostraca_1.Content)(`---
104
+
105
+ Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen). See the
106
+ [project guide](../AGENTS.md).
107
+ `);
108
+ });
109
+ (0, jostraca_1.File)({ name: 'CLAUDE.md' }, () => {
110
+ (0, jostraca_1.Content)((0, AgentGuideContent_1.claudePointer)(`${Name} ${title}`));
111
+ });
112
+ // Co-located per-feature guide files — only for dir-layout targets (ts/js),
113
+ // where each feature has its own directory to hold the guide. Flat-layout
114
+ // targets document features inline above; phase-disabled targets
115
+ // (go-cli/go-mcp) get no feature docs at all.
116
+ if (featuresOn && dirLayout) {
117
+ features.forEach((feature) => {
118
+ (0, AgentGuideFeature_1.AgentGuideFeature)({ target, feature });
119
+ });
120
+ }
121
+ ctx$.log?.info?.({ point: 'generate-agentguide', target, note: 'target:' + lang });
122
+ });
123
+ exports.AgentGuide = AgentGuide;
124
+ //# sourceMappingURL=AgentGuide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentGuide.js","sourceRoot":"","sources":["../../src/cmp/AgentGuide.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAE7C,wCAAwC;AAExC,2DAU4B;AAE5B,2DAAuD;AAGvD,+EAA+E;AAC/E,6EAA6E;AAC7E,4EAA4E;AAC5E,sCAAsC;AACtC,MAAM,UAAU,GAAG,IAAA,cAAG,EAAC,SAAS,UAAU,CAAC,KAAU;IACnD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;IAC9B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IAEtB,MAAM,IAAI,GAAG,IAAA,+BAAW,EAAC,KAAK,CAAC,CAAA;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;IACxB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAA;IAClC,MAAM,OAAO,GAAG,IAAA,2BAAO,EAAC,IAAI,CAAC,CAAC,IAAI,CAAA;IAElC,MAAM,QAAQ,GAAG,IAAA,kCAAc,EAAC,KAAK,CAAC,CAAA;IACtC,qEAAqE;IACrE,gEAAgE;IAChE,MAAM,UAAU,GAAG,IAAA,mCAAe,EAAC,MAAM,CAAC,CAAA;IAC1C,MAAM,SAAS,GAAG,IAAA,+BAAW,EAAC,MAAM,CAAC,CAAA;IAErC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE;QAC/B,IAAA,kBAAO,EAAC,KAAK,IAAI,IAAI,KAAK;;EAE5B,OAAO;YACP,CAAC,CAAC,OAAO,GAAG,mGAAmG;YAC/G,CAAC,CAAC,OAAO,KAAK,mBAAmB,IAAI,4NAA4N;;;gBAGnP,IAAI;;;;;;;wCAOoB,IAAI;;;;;EAK1C,IAAA,qCAAiB,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1,25 @@
1
+ type LangCmd = {
2
+ install?: string;
3
+ build?: string;
4
+ test?: string;
5
+ viaMake?: boolean;
6
+ note?: string;
7
+ };
8
+ declare const LANG_CMD: Record<string, LangCmd>;
9
+ declare function langCmd(name: string): LangCmd;
10
+ declare function langCommandsBlock(name: string): string;
11
+ declare function featuresEnabled(target: any): boolean;
12
+ declare function isDirLayout(target: any): boolean;
13
+ declare function featureBase(target: any): string;
14
+ declare function featureRuntimeFile(target: any, feature: any): string;
15
+ declare function featureHooks(feature: any): string[];
16
+ declare function activeTargets(model: any): any[];
17
+ declare function activeFeatures(model: any): any[];
18
+ declare function activeEntities(model: any): any[];
19
+ declare function projectName(model: any): string;
20
+ declare function workflowSection(): string;
21
+ declare function featureSection(): string;
22
+ declare function customiseSection(): string;
23
+ declare function aontuSection(): string;
24
+ declare function claudePointer(title: string): string;
25
+ export { LANG_CMD, langCmd, langCommandsBlock, featuresEnabled, isDirLayout, featureBase, featureRuntimeFile, featureHooks, activeTargets, activeFeatures, activeEntities, projectName, workflowSection, featureSection, customiseSection, aontuSection, claudePointer, };
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+ // Shared prose for the generated agent guides (AGENTS.md files emitted at the
3
+ // project top level, per target language, and per feature). The workflow, the
4
+ // two-layer template/component model, and the aontu primer are identical for
5
+ // every generated SDK, so they live here once and the three AgentGuide
6
+ // components (AgentGuideTop / AgentGuide / AgentGuideFeature) render them.
7
+ //
8
+ // IMPORTANT: these guides ship INSIDE a generated SDK project, so every path is
9
+ // consumer-relative (`.sdk/tm/<lang>/`, `.sdk/src/cmp/<lang>/`,
10
+ // `.sdk/model/...`) — NOT the `project/.sdk/...` form used by the sdkgen repo's
11
+ // own developer docs.
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.LANG_CMD = void 0;
14
+ exports.langCmd = langCmd;
15
+ exports.langCommandsBlock = langCommandsBlock;
16
+ exports.featuresEnabled = featuresEnabled;
17
+ exports.isDirLayout = isDirLayout;
18
+ exports.featureBase = featureBase;
19
+ exports.featureRuntimeFile = featureRuntimeFile;
20
+ exports.featureHooks = featureHooks;
21
+ exports.activeTargets = activeTargets;
22
+ exports.activeFeatures = activeFeatures;
23
+ exports.activeEntities = activeEntities;
24
+ exports.projectName = projectName;
25
+ exports.workflowSection = workflowSection;
26
+ exports.featureSection = featureSection;
27
+ exports.customiseSection = customiseSection;
28
+ exports.aontuSection = aontuSection;
29
+ exports.claudePointer = claudePointer;
30
+ const jostraca_1 = require("jostraca");
31
+ const types_1 = require("../types");
32
+ const LANG_CMD = {
33
+ ts: { install: 'npm install', viaMake: true },
34
+ js: { install: 'npm install', viaMake: true },
35
+ go: { viaMake: true },
36
+ py: { install: 'pip install -e .', viaMake: true },
37
+ php: { install: 'composer install', viaMake: true },
38
+ rb: { install: 'bundle install', viaMake: true },
39
+ lua: { install: 'luarocks make', viaMake: true },
40
+ 'go-cli': { build: 'go build ./...', note: 'A CLI surface, not an SDK client library.' },
41
+ 'go-mcp': { build: 'go build ./...', note: 'An MCP server surface for AI agents, not an SDK client library.' },
42
+ };
43
+ exports.LANG_CMD = LANG_CMD;
44
+ function langCmd(name) {
45
+ return LANG_CMD[name] || { viaMake: true };
46
+ }
47
+ // A fenced shell block of the per-target build/test commands, run **in the
48
+ // target directory** (the per-language guide already lives there). Prefers the
49
+ // target's Makefile recipes (`make build` / `make test`).
50
+ function langCommandsBlock(name) {
51
+ const c = langCmd(name);
52
+ const lines = [];
53
+ if (c.install)
54
+ lines.push(c.install);
55
+ if (c.viaMake) {
56
+ lines.push('make build');
57
+ lines.push('make test');
58
+ }
59
+ else {
60
+ if (c.build)
61
+ lines.push(c.build);
62
+ if (c.test)
63
+ lines.push(c.test);
64
+ }
65
+ if (0 === lines.length) {
66
+ return `Build and test with \`${name}\`'s standard toolchain.\n`;
67
+ }
68
+ return '```bash\n# in this target directory (' + name + '/):\n' + lines.join('\n') + '\n```\n';
69
+ }
70
+ // --- feature layout helpers (targets differ) --------------------------------
71
+ // Whether a target generates per-feature output at all. go-cli / go-mcp
72
+ // disable the feature phase (`phase.feature.active: false`).
73
+ function featuresEnabled(target) {
74
+ return target?.phase?.feature?.active !== false;
75
+ }
76
+ // ts/js lay each feature out as a directory `src/feature/<name>/`; the other
77
+ // SDK targets (`srcfeature: false`) use flat files in a shared `feature/`
78
+ // package. Drives where feature guides live / are referenced.
79
+ function isDirLayout(target) {
80
+ return target?.srcfeature !== false;
81
+ }
82
+ function featureBase(target) {
83
+ return isDirLayout(target) ? 'src/feature' : 'feature';
84
+ }
85
+ // The generated runtime file for a feature in a flat-layout target:
86
+ // `<name>_feature.<ext>` (go/py/rb/lua) or `<Name>Feature.php` (php).
87
+ function featureRuntimeFile(target, feature) {
88
+ const ext = target?.ext || target?.name || '';
89
+ if ('php' === target?.name) {
90
+ return (feature.Name || feature.name) + 'Feature.php';
91
+ }
92
+ return feature.name + '_feature.' + ext;
93
+ }
94
+ // A feature's active hook-stage names (feature.hook.<Stage>.active === true),
95
+ // sorted (each() marks map keys as key$).
96
+ function featureHooks(feature) {
97
+ return (0, jostraca_1.each)(feature.hook || {})
98
+ .filter((h) => h && h.active)
99
+ .map((h) => h.name || h.key$)
100
+ .filter(Boolean);
101
+ }
102
+ // --- model readers (mirror the active-item pattern in ReadmeTop.ts) ---
103
+ function activeTargets(model) {
104
+ const target = (0, types_1.getModelPath)(model, `main.${types_1.KIT}.target`) || {};
105
+ return (0, jostraca_1.each)(target).filter((t) => t && t.active !== false);
106
+ }
107
+ function activeFeatures(model) {
108
+ const feature = (0, types_1.getModelPath)(model, `main.${types_1.KIT}.feature`) || {};
109
+ return (0, jostraca_1.each)(feature).filter((f) => f && f.active !== false);
110
+ }
111
+ function activeEntities(model) {
112
+ const entity = (0, types_1.getModelPath)(model, `main.${types_1.KIT}.entity`) || {};
113
+ return (0, jostraca_1.each)(entity).filter((e) => e && e.active !== false);
114
+ }
115
+ function projectName(model) {
116
+ return model.Name || model.const?.Name || model.name || 'SDK';
117
+ }
118
+ // --- shared markdown sections -----------------------------------------------
119
+ // (a) basic generation & updating.
120
+ function workflowSection() {
121
+ return `## Generating and updating the SDK
122
+
123
+ All generation is driven from the \`.sdk/\` directory. The generated language
124
+ directories (\`ts/\`, \`go/\`, …) are **build output** — never edit them by
125
+ hand; fix the model, a template, or a component and regenerate.
126
+
127
+ \`\`\`bash
128
+ cd .sdk
129
+ npm run add-target <lang> # scaffold a language target (ts js go py php rb lua ...)
130
+ npm run add-feature <name> # scaffold a feature (e.g. log, test)
131
+ npm run build # compile .sdk/src/cmp -> .sdk/dist
132
+ npm run generate # emit/refresh the SDK into ../<lang>
133
+ \`\`\`
134
+
135
+ \`generate\` **merges** into existing files and does **not** re-apply
136
+ placeholder substitution to merged content. If you ever see a literal
137
+ \`ProjectName\` or \`GOMODULE\` in generated output, delete that one file and
138
+ regenerate it fresh:
139
+
140
+ \`\`\`bash
141
+ rm <lang>/<the-file-with-the-placeholder>
142
+ npm run generate
143
+ \`\`\`
144
+
145
+ Note: the \`voxgig-sdkgen\` CLI only *scaffolds* (\`target add\` /
146
+ \`feature add\`). Generation itself runs via \`npm run generate\` (backed by
147
+ \`@voxgig/model\`) — there is no \`generate\` CLI subcommand.
148
+ `;
149
+ }
150
+ // (b) adding a new generated feature.
151
+ function featureSection() {
152
+ return `## Adding a feature
153
+
154
+ A **feature** is a pipeline extension: an object of hooks that fire at named
155
+ stages of every entity operation (each target's guide documents its
156
+ features). Built-in features are \`log\` and \`test\`.
157
+
158
+ \`\`\`bash
159
+ cd .sdk
160
+ npm run add-feature <name> # e.g. log (comma-separated for several)
161
+ npm run build && npm run generate
162
+ \`\`\`
163
+
164
+ To author a **new** feature:
165
+
166
+ 1. Define its model at \`.sdk/model/feature/<name>.aontu\` — \`name: key()\`,
167
+ \`title\`, \`version\`, \`active\`, \`config.options.active\`, a \`hook\`
168
+ map (\`<Stage>: active: true\`), and per-language \`deps\`.
169
+ 2. Register it in \`.sdk/model/feature/feature-index.aontu\` with
170
+ \`@"<name>.aontu"\`.
171
+ 3. Provide the per-language runtime under that target's feature template dir
172
+ (\`.sdk/tm/<lang>/src/feature/<name>/\` for ts/js, \`.sdk/tm/<lang>/feature/\`
173
+ otherwise) — the \`FEATURE_Name\` / \`FEATURE_VERSION\` placeholders are
174
+ substituted on \`add-feature\`.
175
+ 4. \`npm run add-feature <name> && npm run build && npm run generate\`.
176
+ `;
177
+ }
178
+ // (c) customising the model and templates (the two-layer mental model).
179
+ function customiseSection() {
180
+ return `## Customising: model, templates, components
181
+
182
+ Each language target is generated from **two layers**:
183
+
184
+ | Layer | Path | Nature |
185
+ | --- | --- | --- |
186
+ | **Templates** | \`.sdk/tm/<lang>/\` | Plain target-language source, copied verbatim with placeholder substitution. Edit when the file is the **same for every API** (transport, base classes, runtime, utilities). |
187
+ | **Components** | \`.sdk/src/cmp/<lang>/\` | TypeScript that **generates** source by walking the model. Edit when the file's shape **depends on the API** (entity classes, the constructor, README, tests). |
188
+
189
+ > Decision rule: *same for every API → template; depends on the API →
190
+ > component.*
191
+
192
+ Placeholders substituted on copy: \`ProjectName\` (Pascal-case SDK name),
193
+ \`GOMODULE\` (Go module path), \`FEATURE_Name\` / \`FEATURE_VERSION\`, and the
194
+ \`$$path$$\` interpolation of a model value (such as the name) in \`.aontu\`.
195
+
196
+ Propagate a change: edit the template/component → \`npm run build\` (only
197
+ needed if you touched a component) → \`npm run generate\`. Target shape and
198
+ deps live in \`.sdk/model/target/<lang>.aontu\`; features in
199
+ \`.sdk/model/feature/<name>.aontu\`.
200
+ `;
201
+ }
202
+ // (d) how the aontu model language works.
203
+ function aontuSection() {
204
+ return `## The model language (aontu, \`.aontu\` files)
205
+
206
+ The model is one structured object assembled by **aontu** (a unification
207
+ engine) from three sources: the API model (entities/operations, from the
208
+ OpenAPI spec via \`@voxgig/apidef\`), the base schema, and the target/feature
209
+ definitions in \`.sdk/model/\`. An \`.aontu\` file is a relaxed JSON (jsonic
210
+ syntax) with unification semantics:
211
+
212
+ | Syntax | Meaning |
213
+ | --- | --- |
214
+ | \`a: b: c: 1\` | Nested-object shorthand for \`a:{b:{c:1}}\`. |
215
+ | \`&: { ... }\` | Schema applied to **every** child of a map (one rule, many entries). |
216
+ | \`*default \\| type\` | A default value unified against a type (e.g. \`*true \\| boolean\`). |
217
+ | \`name: key()\` | Bind a field to its map key (so \`feature: log: {}\` gets \`name: 'log'\`). |
218
+ | \`$$path$$\` | Interpolate a model value into a string — e.g. the SDK \`name\`. |
219
+ | \`@"file.aontu"\` | Include another fragment (how the index files work). |
220
+ | \`x: .y\` | Reference another path's value (e.g. \`deps: ts: .js\`). |
221
+
222
+ For example, the schema for every feature entry:
223
+
224
+ \`\`\`aontu
225
+ main: kit: feature: &: {
226
+ name: key()
227
+ active: *false | boolean
228
+ title: string
229
+ version: *'0.0.1' | string
230
+ hook: &: { active: *false | boolean, await: *false | boolean }
231
+ }
232
+ \`\`\`
233
+
234
+ Caveat: literal disjunctions (\`'prod' | 'peer' | 'dev'\`) are fragile in
235
+ aontu, so the model uses \`*'prod' | string\` and enforces the enum in code —
236
+ do not "fix" these into literal disjunctions.
237
+ `;
238
+ }
239
+ // A thin CLAUDE.md that points at the sibling AGENTS.md (same directory).
240
+ function claudePointer(title) {
241
+ return `# ${title}
242
+
243
+ This project uses **AGENTS.md** as the operating guide for coding agents.
244
+
245
+ See [AGENTS.md](./AGENTS.md).
246
+ `;
247
+ }
248
+ //# sourceMappingURL=AgentGuideContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentGuideContent.js","sourceRoot":"","sources":["../../src/cmp/AgentGuideContent.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,uEAAuE;AACvE,2EAA2E;AAC3E,EAAE;AACF,gFAAgF;AAChF,gEAAgE;AAChE,gFAAgF;AAChF,sBAAsB;;;AAoQpB,0BAAO;AACP,8CAAiB;AACjB,0CAAe;AACf,kCAAW;AACX,kCAAW;AACX,gDAAkB;AAClB,oCAAY;AACZ,sCAAa;A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I,EAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,CAAA;AACjE,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAA;AAC/D,CAAC;AAGD,+EAA+E;AAE/E,mCAAmC;AACnC,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BR,CAAA;AACD,CAAC;AAGD,sCAAsC;AACtC,SAAS,cAAc;IACrB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAwBR,CAAA;AACD,CAAC;AAGD,wEAAwE;AACxE,SAAS,gBAAgB;IACvB,OAAO;;;;;;;;;;;;;;;;;;;;CAoBR,CAAA;AACD,CAAC;AAGD,0CAA0C;AAC1C,SAAS,YAAY;IACnB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCR,CAAA;AACD,CAAC;AAGD,0EAA0E;AAC1E,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,KAAK,KAAK;;;;;CAKlB,CAAA;AACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const AgentGuideFeature: import("jostraca").Component;
2
+ export { AgentGuideFeature };
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentGuideFeature = void 0;
4
+ const jostraca_1 = require("jostraca");
5
+ const AgentGuideContent_1 = require("./AgentGuideContent");
6
+ function cap(s) {
7
+ return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
8
+ }
9
+ // Per-feature agent guide, co-located with the feature's generated runtime.
10
+ // Invoked from AgentGuide inside the ambient target folder, so it lands at
11
+ // `<lang>/src/feature/<name>/AGENTS.md`.
12
+ const AgentGuideFeature = (0, jostraca_1.cmp)(function AgentGuideFeature(props) {
13
+ const { target, feature, ctx$ } = props;
14
+ const name = feature.name;
15
+ const Name = feature.Name || cap(name);
16
+ const title = feature.title || `${Name} feature`;
17
+ const version = feature.version || '0.0.1';
18
+ const lang = target.name;
19
+ // Active hook stages (feature.hook.<Stage>.active === true).
20
+ const hooks = (0, jostraca_1.each)(feature.hook || {})
21
+ .filter((h) => h && h.active)
22
+ .map((h) => h.name || h.key$)
23
+ .filter(Boolean);
24
+ const defaultOn = true === feature?.config?.options?.active;
25
+ (0, jostraca_1.Folder)({ name: 'src/feature/' + name }, () => {
26
+ (0, jostraca_1.File)({ name: 'AGENTS.md' }, () => {
27
+ (0, jostraca_1.Content)(`# ${Name}Feature — Agent Guide
28
+
29
+ ${title} (v${version}).
30
+
31
+ A **feature** is a pipeline extension: an object of hooks that fire at named
32
+ stages of every entity operation (load, list, create, update, remove) and of
33
+ the SDK/entity lifecycle. Features are how you inspect or modify the request
34
+ pipeline without forking the SDK. This directory holds the **generated**
35
+ runtime for the \`${name}\` feature in the ${target.title || lang} target — do
36
+ not edit it by hand; change its template/model in \`.sdk/\` and regenerate.
37
+
38
+ Active by default: **${defaultOn ? 'yes' : 'no'}** (\`config.options.active\`
39
+ in the model). ${defaultOn
40
+ ? 'It runs unless disabled.'
41
+ : 'It only runs when explicitly enabled (e.g. the `test` feature is switched on for test mode).'}
42
+
43
+ `);
44
+ if (0 < hooks.length) {
45
+ (0, jostraca_1.Content)(`## Hooks it fires
46
+
47
+ ${hooks.map((h) => `- \`${h}\``).join('\n')}
48
+
49
+ Each active hook runs at its pipeline stage in feature-registration order, so a
50
+ later feature can override an earlier one.
51
+
52
+ `);
53
+ }
54
+ (0, jostraca_1.Content)(`## Where it is defined
55
+
56
+ | Part | Path |
57
+ | --- | --- |
58
+ | Model definition | \`.sdk/model/feature/${name}.aontu\` (name, title, version, \`config.options.active\`, the \`hook\` map, per-language \`deps\`) |
59
+ | Registered in | \`.sdk/model/feature/feature-index.aontu\` (\`@"${name}.aontu"\`) |
60
+ | Runtime template | \`.sdk/tm/${lang}/src/feature/${name}/\` (copied here on \`generate\`; \`FEATURE_Name\`/\`FEATURE_VERSION\` substituted) |
61
+
62
+ (Paths are relative to the **project root** — four levels up from here.)
63
+
64
+ ## Customising this feature
65
+
66
+ - **Turn hooks on/off**: edit the \`hook\` map in
67
+ \`.sdk/model/feature/${name}.aontu\` (\`<Stage>: active: true|false\`).
68
+ - **Change default activation**: set \`config.options.active\` in the same file.
69
+ - **Dependencies**: edit \`deps.<lang>\` in the same file.
70
+ - **Behaviour**: edit the runtime template under
71
+ \`.sdk/tm/${lang}/src/feature/${name}/\`, then regenerate.
72
+
73
+ After any change: \`cd ../../../../.sdk && npm run generate\` (add
74
+ \`npm run build\` first if you changed a component). If a regenerated file
75
+ shows a literal \`FEATURE_Name\`/\`ProjectName\`, delete it and regenerate.
76
+
77
+ To author a **new** feature, copy this one's model + template shape — see the
78
+ [project guide](../../../../AGENTS.md) and the
79
+ [${target.title || lang} guide](../../../AGENTS.md).
80
+ `);
81
+ });
82
+ (0, jostraca_1.File)({ name: 'CLAUDE.md' }, () => {
83
+ (0, jostraca_1.Content)((0, AgentGuideContent_1.claudePointer)(`${Name}Feature (${lang})`));
84
+ });
85
+ });
86
+ ctx$.log?.info?.({
87
+ point: 'generate-agentguide-feature', target, feature,
88
+ note: 'target:' + lang + ', feature:' + name,
89
+ });
90
+ });
91
+ exports.AgentGuideFeature = AgentGuideFeature;
92
+ //# sourceMappingURL=AgentGuideFeature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentGuideFeature.js","sourceRoot":"","sources":["../../src/cmp/AgentGuideFeature.ts"],"names":[],"mappings":";;;AACA,uCAA2D;AAE3D,2DAAmD;AAGnD,SAAS,GAAG,CAAC,CAAS;IACpB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,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,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;iBAC9B,SAAS;gBACxB,CAAC,CAAC,0BAA0B;gBAC5B,CAAC,CAAC,8FAA8F;;CAEjG,CAAC,CAAA;YAEI,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;gBACrB,IAAA,kBAAO,EAAC;;EAEd,KAAK,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;CAKlD,CAAC,CAAA;YACI,CAAC;YAED,IAAA,kBAAO,EAAC;;;;4CAI8B,IAAI;oEACoB,IAAI;iCACvC,IAAI,gBAAgB,IAAI;;;;;;;yBAOhC,IAAI;;;;cAIf,IAAI,gBAAgB,IAAI;;;;;;;;GAQnC,MAAM,CAAC,KAAK,IAAI,IAAI;CACtB,CAAC,CAAA;QACE,CAAC,CAAC,CAAA;QAEF,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE;YAC/B,IAAA,kBAAO,EAAC,IAAA,iCAAa,EAAC,GAAG,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAA;QACpD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QACf,KAAK,EAAE,6BAA6B,EAAE,MAAM,EAAE,OAAO;QACrD,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI;KAC7C,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAIA,8CAAiB"}
@@ -0,0 +1,2 @@
1
+ declare const AgentGuideTop: import("jostraca").Component;
2
+ export { AgentGuideTop };
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentGuideTop = void 0;
4
+ const jostraca_1 = require("jostraca");
5
+ const AgentGuideContent_1 = require("./AgentGuideContent");
6
+ // Top-level agent guide for a generated SDK project. Emitted once at the
7
+ // project root (no enclosing Folder), alongside README.md/Makefile. Teaches a
8
+ // coding agent how to operate the whole project: regenerate, add features,
9
+ // customise the model/templates, and read the aontu model language.
10
+ const AgentGuideTop = (0, jostraca_1.cmp)(function AgentGuideTop(props) {
11
+ const { ctx$ } = props;
12
+ const { model } = ctx$;
13
+ if (model.name && !model.Name)
14
+ (0, jostraca_1.names)(model, model.name);
15
+ const Name = (0, AgentGuideContent_1.projectName)(model);
16
+ const targets = (0, AgentGuideContent_1.activeTargets)(model);
17
+ const features = (0, AgentGuideContent_1.activeFeatures)(model);
18
+ const entities = (0, AgentGuideContent_1.activeEntities)(model);
19
+ (0, jostraca_1.File)({ name: 'AGENTS.md' }, () => {
20
+ (0, jostraca_1.Content)(`# ${Name} SDK — Agent Guide
21
+
22
+ This is a **generated** multi-language SDK project. The client libraries in
23
+ each language directory are produced by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen)
24
+ from an API model; the generator, model, templates, and components all live in
25
+ \`.sdk/\`. Treat the language directories as build output — change the model,
26
+ a template, or a component and regenerate.
27
+
28
+ There are companion guides deeper in the tree: one per language
29
+ (\`<lang>/AGENTS.md\`) and one per feature
30
+ (\`<lang>/src/feature/<name>/AGENTS.md\`).
31
+
32
+ ## Project map
33
+
34
+ `);
35
+ // Targets
36
+ if (0 < targets.length) {
37
+ (0, jostraca_1.Content)(`**Targets** (${targets.length}):
38
+
39
+ | Target | Directory | Build guide |
40
+ | --- | --- | --- |
41
+ `);
42
+ targets.forEach((t) => {
43
+ const note = (0, AgentGuideContent_1.langCmd)(t.name).note ? ' — ' + (0, AgentGuideContent_1.langCmd)(t.name).note : '';
44
+ (0, jostraca_1.Content)(`| \`${t.name}\` | \`${t.name}/\`${note} | [\`${t.name}/AGENTS.md\`](./${t.name}/AGENTS.md) |
45
+ `);
46
+ });
47
+ (0, jostraca_1.Content)(`
48
+ `);
49
+ }
50
+ // Features
51
+ if (0 < features.length) {
52
+ (0, jostraca_1.Content)(`**Features** (${features.length}): `);
53
+ (0, jostraca_1.Content)(features.map((f) => `\`${f.name}\``).join(', ') + `.
54
+
55
+ Each feature is generated into every SDK target — as a directory
56
+ \`<lang>/src/feature/<name>/\` (ts/js) or a flat file in the \`<lang>/feature/\`
57
+ package (other languages). Each target's guide documents its features.
58
+
59
+ `);
60
+ }
61
+ // Entities
62
+ if (0 < entities.length) {
63
+ (0, jostraca_1.Content)(`**Entities** (${entities.length}): `);
64
+ (0, jostraca_1.Content)(entities.map((e) => `\`${e.Name || e.name}\``).join(', ') + `.
65
+
66
+ `);
67
+ }
68
+ (0, jostraca_1.Content)((0, AgentGuideContent_1.workflowSection)());
69
+ (0, jostraca_1.Content)((0, AgentGuideContent_1.featureSection)());
70
+ (0, jostraca_1.Content)((0, AgentGuideContent_1.customiseSection)());
71
+ (0, jostraca_1.Content)((0, AgentGuideContent_1.aontuSection)());
72
+ (0, jostraca_1.Content)(`## Where things live
73
+
74
+ \`\`\`
75
+ .sdk/
76
+ model/ the model: target/, feature/, and index .aontu files
77
+ src/cmp/<lang>/ components — TypeScript that generates API-specific source
78
+ tm/<lang>/ templates — verbatim source copied with placeholders
79
+ dist/ compiled components (npm run build)
80
+ <lang>/ generated SDK for each target (build output)
81
+ README.md human-facing overview
82
+ Makefile per-target deploy recipes
83
+ \`\`\`
84
+
85
+ ---
86
+
87
+ Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen). Regenerate
88
+ with \`cd .sdk && npm run generate\`.
89
+ `);
90
+ });
91
+ (0, jostraca_1.File)({ name: 'CLAUDE.md' }, () => {
92
+ (0, jostraca_1.Content)((0, AgentGuideContent_1.claudePointer)(`${Name} SDK`));
93
+ });
94
+ ctx$.log?.info?.({ point: 'generate-agentguide-top', note: 'name:' + Name });
95
+ });
96
+ exports.AgentGuideTop = AgentGuideTop;
97
+ //# sourceMappingURL=AgentGuideTop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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