@voxgig/sdkgen 4.44.3 → 4.46.0
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 +1 -1
- package/dist/action/check.js +15 -0
- package/dist/action/check.js.map +1 -1
- package/dist/action/copies.js +1 -0
- package/dist/action/copies.js.map +1 -1
- package/dist/action/doctor.d.ts +21 -2
- package/dist/action/doctor.js +166 -9
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/package.js +9 -0
- package/dist/action/package.js.map +1 -1
- package/dist/action/remove.js +2 -1
- package/dist/action/remove.js.map +1 -1
- package/dist/action/target.d.ts +2 -1
- package/dist/action/target.js +50 -11
- package/dist/action/target.js.map +1 -1
- package/dist/cmp/AgentGuide.js +19 -8
- package/dist/cmp/AgentGuide.js.map +1 -1
- package/dist/cmp/AgentGuideContent.d.ts +6 -4
- package/dist/cmp/AgentGuideContent.js +51 -32
- package/dist/cmp/AgentGuideContent.js.map +1 -1
- package/dist/cmp/AgentGuideFeature.js +7 -4
- package/dist/cmp/AgentGuideFeature.js.map +1 -1
- package/dist/cmp/AgentGuideTop.js +84 -46
- package/dist/cmp/AgentGuideTop.js.map +1 -1
- package/dist/cmp/Changelog.js +12 -1
- package/dist/cmp/Changelog.js.map +1 -1
- package/dist/cmp/Deploy.js +22 -20
- package/dist/cmp/Deploy.js.map +1 -1
- package/dist/cmp/ExternalTarget.js +5 -5
- package/dist/cmp/ExternalTarget.js.map +1 -1
- package/dist/cmp/Feature.js +10 -3
- package/dist/cmp/Feature.js.map +1 -1
- package/dist/cmp/FeatureDocs.d.ts +6 -4
- package/dist/cmp/FeatureDocs.js +14 -39
- package/dist/cmp/FeatureDocs.js.map +1 -1
- package/dist/cmp/FeatureHook.d.ts +7 -1
- package/dist/cmp/FeatureHook.js +34 -1
- package/dist/cmp/FeatureHook.js.map +1 -1
- package/dist/cmp/PublishWorkflow.js +30 -6
- package/dist/cmp/PublishWorkflow.js.map +1 -1
- package/dist/cmp/ReadmeErrors.js +521 -18
- package/dist/cmp/ReadmeErrors.js.map +1 -1
- package/dist/cmp/ReadmeExplanation.js +280 -44
- package/dist/cmp/ReadmeExplanation.js.map +1 -1
- package/dist/cmp/ReadmeFeatures.js +16 -7
- package/dist/cmp/ReadmeFeatures.js.map +1 -1
- package/dist/cmp/ReadmeIntro.js +3 -2
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeRefFeatures.js +34 -24
- package/dist/cmp/ReadmeRefFeatures.js.map +1 -1
- package/dist/cmp/ReadmeStation.js +11 -8
- package/dist/cmp/ReadmeStation.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +472 -373
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/cmp/ReadmeUnions.js +8 -2
- package/dist/cmp/ReadmeUnions.js.map +1 -1
- package/dist/cmp/Security.js +3 -2
- package/dist/cmp/Security.js.map +1 -1
- package/dist/helpers/applicability.d.ts +2 -1
- package/dist/helpers/applicability.js +26 -0
- package/dist/helpers/applicability.js.map +1 -1
- package/dist/helpers/copymerge.d.ts +3 -0
- package/dist/helpers/copymerge.js +43 -10
- package/dist/helpers/copymerge.js.map +1 -1
- package/dist/helpers/doccheck.d.ts +11 -0
- package/dist/helpers/doccheck.js +146 -0
- package/dist/helpers/doccheck.js.map +1 -0
- package/dist/helpers/doctext.d.ts +11 -0
- package/dist/helpers/doctext.js +84 -0
- package/dist/helpers/doctext.js.map +1 -0
- package/dist/helpers/exampleCall.d.ts +16 -0
- package/dist/helpers/exampleCall.js +334 -0
- package/dist/helpers/exampleCall.js.map +1 -0
- package/dist/helpers/exportnames.d.ts +4 -0
- package/dist/helpers/exportnames.js +35 -0
- package/dist/helpers/exportnames.js.map +1 -0
- package/dist/helpers/facts.d.ts +4 -0
- package/dist/helpers/facts.js +92 -0
- package/dist/helpers/facts.js.map +1 -0
- package/dist/helpers/modelcheck.d.ts +2 -1
- package/dist/helpers/modelcheck.js +13 -0
- package/dist/helpers/modelcheck.js.map +1 -1
- package/dist/helpers/opExample.d.ts +9 -2
- package/dist/helpers/opExample.js +22 -2
- package/dist/helpers/opExample.js.map +1 -1
- package/dist/helpers/opShape.d.ts +2 -1
- package/dist/helpers/opShape.js +12 -0
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/packageMeta.js +21 -8
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/helpers/semver.d.ts +2 -1
- package/dist/helpers/semver.js +7 -0
- package/dist/helpers/semver.js.map +1 -1
- package/dist/helpers/shipped.d.ts +2 -1
- package/dist/helpers/shipped.js +4 -0
- package/dist/helpers/shipped.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -1
- package/dist/sdkgen.js +29 -6
- package/dist/sdkgen.js.map +1 -1
- package/dist/testkit.d.ts +1 -0
- package/dist/testkit.js +23 -19
- package/dist/testkit.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.js +2 -1
- package/dist/utility.js.map +1 -1
- package/model/fact.aontu +59 -0
- package/model/sdkgen.aontu +6 -2
- package/package.json +3 -1
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +1 -1
- package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +1 -1
- package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +12 -3
- package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +4 -1
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +1 -0
- package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -0
- package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -1
- package/project/.sdk/src/cmp/zig/ReadmeOptions_zig.ts +1 -1
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
- package/project/sdkgen-package.json +1 -1
- package/src/action/check.ts +21 -0
- package/src/action/copies.ts +2 -0
- package/src/action/doctor.ts +244 -13
- package/src/action/package.ts +10 -0
- package/src/action/remove.ts +2 -1
- package/src/action/target.ts +66 -15
- package/src/cmp/AgentGuide.ts +24 -10
- package/src/cmp/AgentGuideContent.ts +53 -32
- package/src/cmp/AgentGuideFeature.ts +8 -5
- package/src/cmp/AgentGuideTop.ts +108 -47
- package/src/cmp/Changelog.ts +13 -2
- package/src/cmp/Deploy.ts +23 -21
- package/src/cmp/ExternalTarget.ts +6 -6
- package/src/cmp/Feature.ts +11 -4
- package/src/cmp/FeatureDocs.ts +21 -40
- package/src/cmp/FeatureHook.ts +38 -1
- package/src/cmp/PublishWorkflow.ts +33 -7
- package/src/cmp/ReadmeErrors.ts +555 -25
- package/src/cmp/ReadmeExplanation.ts +316 -52
- package/src/cmp/ReadmeFeatures.ts +18 -8
- package/src/cmp/ReadmeIntro.ts +3 -2
- package/src/cmp/ReadmeRefFeatures.ts +39 -27
- package/src/cmp/ReadmeStation.ts +12 -14
- package/src/cmp/ReadmeTop.ts +528 -387
- package/src/cmp/ReadmeUnions.ts +10 -2
- package/src/cmp/Security.ts +3 -2
- package/src/helpers/applicability.ts +28 -0
- package/src/helpers/copymerge.ts +58 -10
- package/src/helpers/doccheck.ts +174 -0
- package/src/helpers/doctext.ts +113 -0
- package/src/helpers/exampleCall.ts +415 -0
- package/src/helpers/exportnames.ts +47 -0
- package/src/helpers/facts.ts +119 -0
- package/src/helpers/modelcheck.ts +16 -0
- package/src/helpers/opExample.ts +34 -2
- package/src/helpers/opShape.ts +13 -0
- package/src/helpers/packageMeta.ts +21 -8
- package/src/helpers/semver.ts +9 -0
- package/src/helpers/shipped.ts +5 -0
- package/src/sdkgen.ts +31 -2
- package/src/testkit.ts +30 -20
- package/src/utility.ts +2 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { featureApplies } from '../helpers/applicability'
|
|
3
|
+
import { fact } from '../helpers/facts'
|
|
4
|
+
import { findFeatureSources } from '../helpers/featureSource'
|
|
5
|
+
import { copyMode, MERGE } from '../helpers/copymerge'
|
|
3
6
|
|
|
4
7
|
import { each } from 'jostraca'
|
|
5
8
|
|
|
@@ -62,26 +65,32 @@ function langCommandsBlock(name: string): string {
|
|
|
62
65
|
|
|
63
66
|
|
|
64
67
|
function featuresEnabled(target: any): boolean {
|
|
65
|
-
return target
|
|
68
|
+
return fact(target, 'phase').feature
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
// ts/js lay each feature out as a directory `src/feature/<name
|
|
69
|
-
// SDK targets (`srcfeature: false`)
|
|
70
|
-
// package. Drives where feature guides live / are referenced.
|
|
71
|
+
// ts/js lay each feature out as a directory `src/feature/<name>/`, which also
|
|
72
|
+
// holds its guide; the other SDK targets (`srcfeature: false`) do not.
|
|
71
73
|
function isDirLayout(target: any): boolean {
|
|
72
74
|
return target?.srcfeature !== false
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
// Each feature's runtime template as discovery finds it in the target's tree,
|
|
78
|
+
// skipping the empty `src/feature/<name>/` a flat-layout target also keeps.
|
|
79
|
+
function featureTemplates(fs: any, target: any, features: any[]): Record<string, string> {
|
|
80
|
+
const dirLayout = isDirLayout(target)
|
|
81
|
+
const out: Record<string, string> = {}
|
|
82
|
+
const found = findFeatureSources(fs, 'tm/' + target.name,
|
|
83
|
+
features.map((f: any) => String(f.name).toLowerCase()))
|
|
84
|
+
for (const s of found) {
|
|
85
|
+
if (!dirLayout && s.path.startsWith('src/feature/')) continue
|
|
86
|
+
if (null == out[s.name]) out[s.name] = s.path + (s.folder ? '/' : '')
|
|
87
|
+
}
|
|
88
|
+
return out
|
|
77
89
|
}
|
|
78
90
|
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return (feature.Name || feature.name) + 'Feature.php'
|
|
83
|
-
}
|
|
84
|
-
return feature.name + '_feature.' + ext
|
|
91
|
+
function writesFeatureGuides(model: any, target: any): boolean {
|
|
92
|
+
return featuresEnabled(target) && isDirLayout(target) &&
|
|
93
|
+
0 < activeFeatures(model, target).length
|
|
85
94
|
}
|
|
86
95
|
|
|
87
96
|
function featureHooks(feature: any): string[] {
|
|
@@ -119,7 +128,26 @@ function projectName(model: any): string {
|
|
|
119
128
|
|
|
120
129
|
|
|
121
130
|
|
|
122
|
-
|
|
131
|
+
// What a run does to the files it generates, stated once for every guide.
|
|
132
|
+
function regenerationStatement(): string {
|
|
133
|
+
return `Each \`npm run generate\` rewrites every file it generates, so an edit
|
|
134
|
+
made to generated output is lost, and deletes the files it generated before
|
|
135
|
+
and no longer emits. A target or a phase switched off is left as it was.`
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function copiesStatement(model: any): string {
|
|
139
|
+
return MERGE === copyMode(model?.main?.[KIT]?.copies) ?
|
|
140
|
+
`\`target add\` and \`feature add\` copy templates and components into
|
|
141
|
+
\`.sdk/\`, and merge toolchain updates into the copies this project has
|
|
142
|
+
edited.` :
|
|
143
|
+
`\`target add\` and \`feature add\` overwrite the templates and components
|
|
144
|
+
in \`.sdk/\` (\`main: kit: copies: 'overwrite'\`): set \`copies\` to
|
|
145
|
+
\`'merge'\` before customising them, so that an add merges toolchain updates
|
|
146
|
+
into the edited copies.`
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
function workflowSection(model: any): string {
|
|
123
151
|
return `## Generating and updating the SDK
|
|
124
152
|
|
|
125
153
|
All generation is driven from the \`.sdk/\` directory. The generated language
|
|
@@ -134,15 +162,8 @@ npm run build # compile .sdk/src/cmp -> .sdk/dist
|
|
|
134
162
|
npm run generate # emit/refresh the SDK into ../<lang>
|
|
135
163
|
\`\`\`
|
|
136
164
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
\`ProjectName\` or \`GOMODULE\` in generated output, delete that one file and
|
|
140
|
-
regenerate it fresh:
|
|
141
|
-
|
|
142
|
-
\`\`\`bash
|
|
143
|
-
rm <lang>/<the-file-with-the-placeholder>
|
|
144
|
-
npm run generate
|
|
145
|
-
\`\`\`
|
|
165
|
+
${regenerationStatement()}
|
|
166
|
+
${copiesStatement(model)}
|
|
146
167
|
|
|
147
168
|
Note: the \`voxgig-sdkgen\` CLI only *scaffolds* (\`target add\` /
|
|
148
169
|
\`feature add\`). Generation itself runs via \`npm run generate\` (backed by
|
|
@@ -170,13 +191,11 @@ so nothing downstream complains. To inspect the model layer **without side
|
|
|
170
191
|
effects**, use \`npm run dry-generate\` (\`-y\`, writes nothing). Never
|
|
171
192
|
\`--no-config\` in anything whose output might be committed.
|
|
172
193
|
|
|
173
|
-
**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
To find either, the target trees must be deleted and regenerated — a
|
|
179
|
-
regeneration in place cannot see stale output at all.
|
|
194
|
+
**Dropping a target deletes nothing.** A run deletes only what it no longer
|
|
195
|
+
emits from the targets and phases that ran, so a target dropped from the
|
|
196
|
+
model, or a phase switched off, leaves its files in the tree, and \`git
|
|
197
|
+
status\` is silent because they are committed and unchanged. Delete them by
|
|
198
|
+
hand.
|
|
180
199
|
`
|
|
181
200
|
}
|
|
182
201
|
|
|
@@ -186,7 +205,7 @@ function featureSection(): string {
|
|
|
186
205
|
|
|
187
206
|
A **feature** is a pipeline extension: an object of hooks that fire at named
|
|
188
207
|
stages of every entity operation (each target's guide documents its
|
|
189
|
-
features).
|
|
208
|
+
features).
|
|
190
209
|
|
|
191
210
|
\`\`\`bash
|
|
192
211
|
cd .sdk
|
|
@@ -295,14 +314,16 @@ export {
|
|
|
295
314
|
langCommandsBlock,
|
|
296
315
|
featuresEnabled,
|
|
297
316
|
isDirLayout,
|
|
298
|
-
|
|
299
|
-
|
|
317
|
+
featureTemplates,
|
|
318
|
+
writesFeatureGuides,
|
|
300
319
|
featureHooks,
|
|
301
320
|
activeTargets,
|
|
302
321
|
activeFeatures,
|
|
303
322
|
activeEntities,
|
|
304
323
|
projectName,
|
|
305
324
|
workflowSection,
|
|
325
|
+
regenerationStatement,
|
|
326
|
+
copiesStatement,
|
|
306
327
|
featureSection,
|
|
307
328
|
customiseSection,
|
|
308
329
|
aontuSection,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { each, Content, File, Folder } from 'jostraca'
|
|
3
3
|
import { cmp } from '../helpers/component'
|
|
4
|
+
import { fact } from '../helpers/facts'
|
|
5
|
+
import { generatedOps } from '../helpers/opShape'
|
|
4
6
|
|
|
5
|
-
import { claudePointer } from './AgentGuideContent'
|
|
7
|
+
import { claudePointer, regenerationStatement } from './AgentGuideContent'
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
function cap(s: string): string {
|
|
@@ -28,7 +30,8 @@ const AgentGuideFeature = cmp(function AgentGuideFeature(props: any) {
|
|
|
28
30
|
.map((h: any) => h.name || h.key$)
|
|
29
31
|
.filter(Boolean)
|
|
30
32
|
|
|
31
|
-
const defaultOn =
|
|
33
|
+
const defaultOn = fact(feature, 'on')
|
|
34
|
+
const ops = generatedOps(ctx$.model)
|
|
32
35
|
|
|
33
36
|
Folder({ name: 'src/feature/' + name }, () => {
|
|
34
37
|
|
|
@@ -38,7 +41,7 @@ const AgentGuideFeature = cmp(function AgentGuideFeature(props: any) {
|
|
|
38
41
|
${title} (v${version}).
|
|
39
42
|
|
|
40
43
|
A **feature** is a pipeline extension: an object of hooks that fire at named
|
|
41
|
-
stages of every entity operation (
|
|
44
|
+
stages of every entity operation${0 < ops.length ? ' (' + ops.join(', ') + ')' : ''} and of
|
|
42
45
|
the SDK/entity lifecycle. Features are how you inspect or modify the request
|
|
43
46
|
pipeline without forking the SDK. This directory holds the **generated**
|
|
44
47
|
runtime for the \`${name}\` feature in the ${target.title || lang} target — do
|
|
@@ -82,8 +85,8 @@ later feature can override an earlier one.
|
|
|
82
85
|
\`.sdk/tm/${lang}/src/feature/${name}/\`, then regenerate.
|
|
83
86
|
|
|
84
87
|
After any change: \`cd ../../../../.sdk && npm run generate\` (add
|
|
85
|
-
\`npm run build\` first if you changed a component).
|
|
86
|
-
|
|
88
|
+
\`npm run build\` first if you changed a component).
|
|
89
|
+
${regenerationStatement()}
|
|
87
90
|
|
|
88
91
|
To author a **new** feature, copy this one's model + template shape — see the
|
|
89
92
|
[project guide](../../../../AGENTS.md) and the
|
package/src/cmp/AgentGuideTop.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { names, Content, File } from 'jostraca'
|
|
3
3
|
import { cmp } from '../helpers/component'
|
|
4
|
+
import { fact } from '../helpers/facts'
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
activeTargets,
|
|
@@ -13,22 +14,17 @@ import {
|
|
|
13
14
|
aontuSection,
|
|
14
15
|
claudePointer,
|
|
15
16
|
langCmd,
|
|
17
|
+
writesFeatureGuides,
|
|
16
18
|
} from './AgentGuideContent'
|
|
17
19
|
|
|
18
20
|
|
|
19
|
-
const
|
|
20
|
-
const {
|
|
21
|
-
const { model } = ctx$
|
|
21
|
+
const AgentGuideTopIntro = cmp(function AgentGuideTopIntro(props: any) {
|
|
22
|
+
const { Name, model, targets } = props.s
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
const featureGuides = targets.some((t: any) =>
|
|
25
|
+
fact(t, 'phase').agentguide && writesFeatureGuides(model, t))
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
const targets = activeTargets(model)
|
|
27
|
-
const features = activeFeatures(model)
|
|
28
|
-
const entities = activeEntities(model)
|
|
29
|
-
|
|
30
|
-
File({ name: 'AGENTS.md' }, () => {
|
|
31
|
-
Content(`# ${Name} SDK — Agent Guide
|
|
27
|
+
Content(`# ${Name} SDK — Agent Guide
|
|
32
28
|
|
|
33
29
|
This is a **generated** multi-language SDK project. The client libraries in
|
|
34
30
|
each language directory are produced by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen)
|
|
@@ -37,55 +33,75 @@ from an API model; the generator, model, templates, and components all live in
|
|
|
37
33
|
a template, or a component and regenerate.
|
|
38
34
|
|
|
39
35
|
There are companion guides deeper in the tree: one per language
|
|
40
|
-
(\`<lang>/AGENTS.md\`) and one per feature
|
|
41
|
-
(\`<lang>/src/feature/<name>/AGENTS.md\`).
|
|
36
|
+
(\`<lang>/AGENTS.md\`)${featureGuides ? `, and one per feature in a target that keeps each
|
|
37
|
+
feature in its own directory (\`<lang>/src/feature/<name>/AGENTS.md\`)` : ''}.
|
|
42
38
|
|
|
43
39
|
## Project map
|
|
44
40
|
|
|
45
41
|
`)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const AgentGuideTopTargets = cmp(function AgentGuideTopTargets(props: any) {
|
|
46
|
+
const { targets } = props.s
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
if (0 < targets.length) {
|
|
49
|
+
Content(`**Targets** (${targets.length}):
|
|
49
50
|
|
|
50
51
|
| Target | Directory | Build guide |
|
|
51
52
|
| --- | --- | --- |
|
|
52
53
|
`)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
targets.forEach((t: any) => {
|
|
55
|
+
const note = langCmd(t.name).note ? ' — ' + langCmd(t.name).note : ''
|
|
56
|
+
Content(`| \`${t.name}\` | \`${t.name}/\`${note} | [\`${t.name}/AGENTS.md\`](./${t.name}/AGENTS.md) |
|
|
56
57
|
`)
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
})
|
|
59
|
+
Content(`
|
|
59
60
|
`)
|
|
60
|
-
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Content(features.map((f: any) => `\`${f.name}\``).join(', ') + `.
|
|
65
|
+
const AgentGuideTopFeatures = cmp(function AgentGuideTopFeatures(props: any) {
|
|
66
|
+
const { features } = props.s
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
if (0 < features.length) {
|
|
69
|
+
Content(`**Features** (${features.length}): `)
|
|
70
|
+
Content(features.map((f: any) => `\`${f.name}\``).join(', ') + `.
|
|
71
|
+
|
|
72
|
+
Each feature is generated into each SDK target that supports it, and each
|
|
73
|
+
target's guide documents where that target keeps its features.
|
|
69
74
|
|
|
70
75
|
`)
|
|
71
|
-
|
|
76
|
+
}
|
|
77
|
+
})
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
|
|
80
|
+
const AgentGuideTopEntities = cmp(function AgentGuideTopEntities(props: any) {
|
|
81
|
+
const { entities } = props.s
|
|
82
|
+
|
|
83
|
+
if (0 < entities.length) {
|
|
84
|
+
Content(`**Entities** (${entities.length}): `)
|
|
85
|
+
Content(entities.map((e: any) => `\`${e.Name || e.name}\``).join(', ') + `.
|
|
76
86
|
|
|
77
87
|
`)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
const AgentGuideTopStation = cmp(function AgentGuideTopStation(props: any) {
|
|
93
|
+
const { features } = props.s
|
|
94
|
+
|
|
95
|
+
// Station paragraph (station design §9.4; declarative design §11
|
|
96
|
+
// item 4), only when the model carries the feature: an agent working
|
|
97
|
+
// on this repo should know the runtime story without leaving
|
|
98
|
+
// AGENTS.md — and, first, that the application's integrations are
|
|
99
|
+
// DECLARED in station.json, so that file is where to look.
|
|
100
|
+
const station = features.find((f: any) => 'station' === f.name)
|
|
101
|
+
if (null != station) {
|
|
102
|
+
Content(`**Station**: this SDK is a
|
|
87
103
|
[voxgig/station](https://github.com/voxgig/station) plugin (the
|
|
88
|
-
\`station\` feature, off by default). An application's outbound
|
|
104
|
+
\`station\` feature, ${fact(station, 'on') ? 'on' : 'off'} by default). An application's outbound
|
|
89
105
|
integrations are **declared in \`station.json\`** at its repo root —
|
|
90
106
|
to learn what the application talks to, read that file: every SDK
|
|
91
107
|
instance (\`sdk\`), per-api default (\`api\`), feature setting, and
|
|
@@ -101,14 +117,32 @@ with Station" README section and \`src/feature/station/\` (or the
|
|
|
101
117
|
target's feature container) for the generated adapter.
|
|
102
118
|
|
|
103
119
|
`)
|
|
104
|
-
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
const AgentGuideTopWorkflow = cmp(function AgentGuideTopWorkflow(props: any) {
|
|
125
|
+
Content(workflowSection(props.s.model))
|
|
126
|
+
})
|
|
127
|
+
|
|
105
128
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Content(aontuSection())
|
|
129
|
+
const AgentGuideTopFeatureGuide = cmp(function AgentGuideTopFeatureGuide() {
|
|
130
|
+
Content(featureSection())
|
|
131
|
+
})
|
|
110
132
|
|
|
111
|
-
|
|
133
|
+
|
|
134
|
+
const AgentGuideTopCustomise = cmp(function AgentGuideTopCustomise() {
|
|
135
|
+
Content(customiseSection())
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
const AgentGuideTopAontu = cmp(function AgentGuideTopAontu() {
|
|
140
|
+
Content(aontuSection())
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
const AgentGuideTopLayout = cmp(function AgentGuideTopLayout() {
|
|
145
|
+
Content(`## Where things live
|
|
112
146
|
|
|
113
147
|
\`\`\`
|
|
114
148
|
.sdk/
|
|
@@ -126,6 +160,33 @@ Makefile per-target deploy recipes
|
|
|
126
160
|
Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen). Regenerate
|
|
127
161
|
with \`cd .sdk && npm run generate\`.
|
|
128
162
|
`)
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
const AgentGuideTop = cmp(function AgentGuideTop(props: any) {
|
|
167
|
+
const { ctx$ } = props
|
|
168
|
+
const { model } = ctx$
|
|
169
|
+
|
|
170
|
+
if (model.name && !model.Name) names(model, model.name)
|
|
171
|
+
|
|
172
|
+
const Name = projectName(model)
|
|
173
|
+
const targets = activeTargets(model)
|
|
174
|
+
const features = activeFeatures(model)
|
|
175
|
+
const entities = activeEntities(model)
|
|
176
|
+
|
|
177
|
+
const s = { Name, model, targets, features, entities }
|
|
178
|
+
|
|
179
|
+
File({ name: 'AGENTS.md' }, () => {
|
|
180
|
+
AgentGuideTopIntro({ s })
|
|
181
|
+
AgentGuideTopTargets({ s })
|
|
182
|
+
AgentGuideTopFeatures({ s })
|
|
183
|
+
AgentGuideTopEntities({ s })
|
|
184
|
+
AgentGuideTopStation({ s })
|
|
185
|
+
AgentGuideTopWorkflow({ s })
|
|
186
|
+
AgentGuideTopFeatureGuide({ s })
|
|
187
|
+
AgentGuideTopCustomise({ s })
|
|
188
|
+
AgentGuideTopAontu({ s })
|
|
189
|
+
AgentGuideTopLayout({ s })
|
|
129
190
|
})
|
|
130
191
|
|
|
131
192
|
File({ name: 'CLAUDE.md' }, () => {
|
package/src/cmp/Changelog.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Content, File } from 'jostraca'
|
|
1
|
+
import { Content, File, each } from 'jostraca'
|
|
2
2
|
import { cmp } from '../helpers/component'
|
|
3
|
+
import { packageVersion } from '../helpers/packageMeta'
|
|
4
|
+
import { KIT, getModelPath } from '../types'
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
const Changelog = cmp(function Changelog(props: any) {
|
|
@@ -8,6 +10,15 @@ const Changelog = cmp(function Changelog(props: any) {
|
|
|
8
10
|
|
|
9
11
|
const name = model.Name || model.name
|
|
10
12
|
|
|
13
|
+
// Written once, so the first entry is the version the targets start at; a
|
|
14
|
+
// heading with no number when they start at different ones.
|
|
15
|
+
const versions = new Set<string>()
|
|
16
|
+
each(getModelPath(model, `main.${KIT}.target`) || {}, (t: any) => {
|
|
17
|
+
if (false !== t.active) versions.add(packageVersion(model, t.name))
|
|
18
|
+
})
|
|
19
|
+
const first = 1 < versions.size ? 'Initial release' :
|
|
20
|
+
`[${[...versions][0] || packageVersion(model, '')}]`
|
|
21
|
+
|
|
11
22
|
File({ name: 'CHANGELOG.md', exclude: true }, () => {
|
|
12
23
|
Content(`# Changelog
|
|
13
24
|
|
|
@@ -17,7 +28,7 @@ This project follows [Keep a Changelog](https://keepachangelog.com) and
|
|
|
17
28
|
|
|
18
29
|
## [Unreleased]
|
|
19
30
|
|
|
20
|
-
##
|
|
31
|
+
## ${first}
|
|
21
32
|
|
|
22
33
|
- Initial generated release of the ${name} SDK (TypeScript, Python, PHP, Go,
|
|
23
34
|
Ruby, and Lua, plus CLI and MCP surfaces), generated from the upstream
|
package/src/cmp/Deploy.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { each, Content, File } from 'jostraca'
|
|
2
2
|
import { cmp } from '../helpers/component'
|
|
3
3
|
|
|
4
|
-
import { packageVersion } from '../helpers/packageMeta'
|
|
4
|
+
import { packageVersion, registryState } from '../helpers/packageMeta'
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
KIT,
|
|
@@ -29,27 +29,25 @@ const Deploy = cmp(function Deploy(props: any) {
|
|
|
29
29
|
|
|
30
30
|
ctx$.log.info({
|
|
31
31
|
point: 'generate-deploy',
|
|
32
|
-
note: 'targets: ' + targets.map((t: any) =>
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
note: 'targets: ' + targets.map((t: any) => {
|
|
33
|
+
const state = registryState(model, t.name)
|
|
34
|
+
return t.name + ('tag' === state ? ':tag-only' :
|
|
35
|
+
':' + registryOf(t).name + ('active' === state ? '' : '(publish ' + pendingWord(state) + ')'))
|
|
36
|
+
}).join(',')
|
|
35
37
|
})
|
|
36
38
|
})
|
|
37
39
|
|
|
38
40
|
|
|
41
|
+
// The declared registry block, `none` included: a port that declares one
|
|
42
|
+
// has its release tag cut at the root, whatever registryState calls it.
|
|
39
43
|
function registryOf(t: any): any | undefined {
|
|
40
44
|
const reg = t.publish?.registry
|
|
41
45
|
return (reg && '' !== (reg.name || '')) ? reg : undefined
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// back-compat alias. Anything else — 'pending' (the default), 'inactive' —
|
|
48
|
-
// means a deploy publishes the git tag only.
|
|
49
|
-
function regIsActive(reg: any): boolean {
|
|
50
|
-
if (null == reg) return false
|
|
51
|
-
if (true === reg.active) return true
|
|
52
|
-
return 'active' === reg.state
|
|
49
|
+
function pendingWord(state: string): string {
|
|
50
|
+
return 'inactive' === state ? 'inactive' : 'pending'
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
|
|
@@ -92,16 +90,16 @@ function makeDeployMakefile(model: any, targets: any[]): string {
|
|
|
92
90
|
aliasVars.set(aliasVarName(ghRecipe), tagVault.alias || ghRecipe)
|
|
93
91
|
}
|
|
94
92
|
const reg = registryOf(t)
|
|
95
|
-
if (reg && !aliasVars.has(aliasVarName(reg.name))) {
|
|
93
|
+
if (reg && 'tag' !== registryState(model, t.name) && !aliasVars.has(aliasVarName(reg.name))) {
|
|
96
94
|
aliasVars.set(aliasVarName(reg.name), reg.vault?.alias || reg.name)
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
const summary = targets.map((t: any) => {
|
|
101
99
|
const reg = registryOf(t)
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
: 'tag
|
|
100
|
+
const rs = registryState(model, t.name)
|
|
101
|
+
const state = 'tag' === rs ? 'tag-only' :
|
|
102
|
+
`${reg.name} (${'active' === rs ? 'ACTIVE' : 'publish ' + pendingWord(rs) + ': deploy publishes the git tag only'}) ${reg.url || ''}`.trim()
|
|
105
103
|
return `# ${t.name.padEnd(8)} ${state}`
|
|
106
104
|
}).join('\n')
|
|
107
105
|
|
|
@@ -113,8 +111,9 @@ function makeDeployMakefile(model: any, targets: any[]): string {
|
|
|
113
111
|
const args = vaultExecArgs(t)
|
|
114
112
|
|
|
115
113
|
const via = t.publish?.tag?.via || 'port'
|
|
114
|
+
const rs = registryState(model, t.name)
|
|
116
115
|
|
|
117
|
-
if (
|
|
116
|
+
if ('tag' === rs && (reg || 'root' === via)) {
|
|
118
117
|
return `
|
|
119
118
|
deploy-${t.name}:
|
|
120
119
|
\t@echo "deploy-${t.name}: tag-only port — publishing the git tag."
|
|
@@ -126,15 +125,16 @@ ${tagPushRecipe(t.name, packageVersion(model, t.name), 'tag-only port')}
|
|
|
126
125
|
`
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
if (
|
|
128
|
+
if ('tag' !== rs && 'active' !== rs) {
|
|
129
|
+
const word = pendingWord(rs)
|
|
130
130
|
return `
|
|
131
131
|
deploy-${t.name}:
|
|
132
|
-
\t@echo "deploy-${t.name}: ${reg.name} publication is
|
|
132
|
+
\t@echo "deploy-${t.name}: ${reg.name} publication is ${word} — publishing the git tag only."
|
|
133
133
|
\tboru vault exec ${ghArgs} -- $(MAKE) tag-push-${t.name}
|
|
134
134
|
|
|
135
135
|
deploy-dry-${t.name}:
|
|
136
136
|
\tboru vault exec --dry-run ${ghArgs} -- $(MAKE) tag-push-${t.name}
|
|
137
|
-
${tagPushRecipe(t.name, packageVersion(model, t.name), reg.name + ' publication
|
|
137
|
+
${tagPushRecipe(t.name, packageVersion(model, t.name), reg.name + ' publication ' + word + ' — tag-only deploy')}
|
|
138
138
|
`
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -192,7 +192,9 @@ deploy:
|
|
|
192
192
|
\t@echo "Registry state is set in the model (.sdk/model/target/<t>.aontu):"
|
|
193
193
|
${targets.map((t: any) => {
|
|
194
194
|
const reg = registryOf(t)
|
|
195
|
-
const
|
|
195
|
+
const rs = registryState(model, t.name)
|
|
196
|
+
const state = 'tag' === rs ? 'tag-only' :
|
|
197
|
+
`${reg.name} ${'active' === rs ? 'ACTIVE' : 'publish ' + pendingWord(rs) + ' (deploy = git tag only)'}`
|
|
196
198
|
return `\t@echo " deploy-${t.name.padEnd(8)} ${state}"`
|
|
197
199
|
}).join('\n')}
|
|
198
200
|
\t@echo "Rehearse everything safely first: make deploy-dry"
|
|
@@ -6,6 +6,8 @@ import { Project } from 'jostraca'
|
|
|
6
6
|
|
|
7
7
|
import { KIT } from '@voxgig/apidef'
|
|
8
8
|
|
|
9
|
+
import { fact } from '../helpers/facts'
|
|
10
|
+
|
|
9
11
|
import { Main } from './Main'
|
|
10
12
|
import { Entity } from './Entity'
|
|
11
13
|
import { Feature } from './Feature'
|
|
@@ -42,12 +44,10 @@ const ExternalTarget = cmp(function ExternalTarget(props: any) {
|
|
|
42
44
|
const entity = model.main[KIT].entity || {}
|
|
43
45
|
const feature = model.main[KIT].feature || {}
|
|
44
46
|
|
|
45
|
-
//
|
|
46
|
-
// off
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const phaseActive = (name: string): boolean =>
|
|
50
|
-
false !== (phase[name] && phase[name].active)
|
|
47
|
+
// Consumer targets (go-cli, go-mcp, py-data, seneca-provider) switch every
|
|
48
|
+
// phase off and emit everything from Main.
|
|
49
|
+
const phase = fact(target, 'phase')
|
|
50
|
+
const phaseActive = (name: string): boolean => true === phase[name]
|
|
51
51
|
|
|
52
52
|
Project({}, () => {
|
|
53
53
|
names(target, target.name)
|
package/src/cmp/Feature.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { Copy, Folder } from 'jostraca'
|
|
|
3
3
|
import { cmp } from '../helpers/component'
|
|
4
4
|
|
|
5
5
|
import { ensureStdrep } from '../helpers/stdrep'
|
|
6
|
-
import { featureApplies, featureTags } from '../helpers/applicability'
|
|
6
|
+
import { featureApplies, featureTags, shippedProvides } from '../helpers/applicability'
|
|
7
7
|
import { pluginExcludesFor } from '../helpers/featureSource'
|
|
8
|
+
import { originName } from '../helpers/packageMeta'
|
|
9
|
+
import { resolvesBundled } from '../action/resolve'
|
|
8
10
|
|
|
9
11
|
const Feature = cmp(function Feature(props: any) {
|
|
10
12
|
const { target, feature, ctx$ } = props
|
|
@@ -18,12 +20,17 @@ const Feature = cmp(function Feature(props: any) {
|
|
|
18
20
|
if (!featureApplies(feature, target)) {
|
|
19
21
|
const provided = featureTags(target.provides)
|
|
20
22
|
const unmet = featureTags(feature.needs).filter((n) => !provided.includes(n))
|
|
23
|
+
const origin = originName(ctx$.model, target.name)
|
|
24
|
+
const stale = resolvesBundled(target, target.name) &&
|
|
25
|
+
unmet.every((n) => shippedProvides(origin).includes(n))
|
|
21
26
|
|
|
22
|
-
log.
|
|
27
|
+
log.warn({
|
|
23
28
|
point: 'feature-not-applicable', target: target.name, feature: feature.name,
|
|
24
29
|
needs: feature.needs, provides: target.provides, unmet,
|
|
25
|
-
note: feature.name + '
|
|
26
|
-
' does not provide ' + unmet.join(', ')
|
|
30
|
+
note: feature.name + ' is active but not generated for ' + target.name +
|
|
31
|
+
', which does not provide ' + unmet.join(', ') + (stale ? '; the installed ' +
|
|
32
|
+
origin + ' target does: `voxgig-sdkgen package update @voxgig/sdkgen --no-fetch`' +
|
|
33
|
+
' or `voxgig-sdkgen target add ' + target.name + '` refreshes the copy' : ''),
|
|
27
34
|
})
|
|
28
35
|
return
|
|
29
36
|
}
|