@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.
Files changed (161) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/check.js +15 -0
  3. package/dist/action/check.js.map +1 -1
  4. package/dist/action/copies.js +1 -0
  5. package/dist/action/copies.js.map +1 -1
  6. package/dist/action/doctor.d.ts +21 -2
  7. package/dist/action/doctor.js +166 -9
  8. package/dist/action/doctor.js.map +1 -1
  9. package/dist/action/package.js +9 -0
  10. package/dist/action/package.js.map +1 -1
  11. package/dist/action/remove.js +2 -1
  12. package/dist/action/remove.js.map +1 -1
  13. package/dist/action/target.d.ts +2 -1
  14. package/dist/action/target.js +50 -11
  15. package/dist/action/target.js.map +1 -1
  16. package/dist/cmp/AgentGuide.js +19 -8
  17. package/dist/cmp/AgentGuide.js.map +1 -1
  18. package/dist/cmp/AgentGuideContent.d.ts +6 -4
  19. package/dist/cmp/AgentGuideContent.js +51 -32
  20. package/dist/cmp/AgentGuideContent.js.map +1 -1
  21. package/dist/cmp/AgentGuideFeature.js +7 -4
  22. package/dist/cmp/AgentGuideFeature.js.map +1 -1
  23. package/dist/cmp/AgentGuideTop.js +84 -46
  24. package/dist/cmp/AgentGuideTop.js.map +1 -1
  25. package/dist/cmp/Changelog.js +12 -1
  26. package/dist/cmp/Changelog.js.map +1 -1
  27. package/dist/cmp/Deploy.js +22 -20
  28. package/dist/cmp/Deploy.js.map +1 -1
  29. package/dist/cmp/ExternalTarget.js +5 -5
  30. package/dist/cmp/ExternalTarget.js.map +1 -1
  31. package/dist/cmp/Feature.js +10 -3
  32. package/dist/cmp/Feature.js.map +1 -1
  33. package/dist/cmp/FeatureDocs.d.ts +6 -4
  34. package/dist/cmp/FeatureDocs.js +14 -39
  35. package/dist/cmp/FeatureDocs.js.map +1 -1
  36. package/dist/cmp/FeatureHook.d.ts +7 -1
  37. package/dist/cmp/FeatureHook.js +34 -1
  38. package/dist/cmp/FeatureHook.js.map +1 -1
  39. package/dist/cmp/PublishWorkflow.js +30 -6
  40. package/dist/cmp/PublishWorkflow.js.map +1 -1
  41. package/dist/cmp/ReadmeErrors.js +521 -18
  42. package/dist/cmp/ReadmeErrors.js.map +1 -1
  43. package/dist/cmp/ReadmeExplanation.js +280 -44
  44. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  45. package/dist/cmp/ReadmeFeatures.js +16 -7
  46. package/dist/cmp/ReadmeFeatures.js.map +1 -1
  47. package/dist/cmp/ReadmeIntro.js +3 -2
  48. package/dist/cmp/ReadmeIntro.js.map +1 -1
  49. package/dist/cmp/ReadmeRefFeatures.js +34 -24
  50. package/dist/cmp/ReadmeRefFeatures.js.map +1 -1
  51. package/dist/cmp/ReadmeStation.js +11 -8
  52. package/dist/cmp/ReadmeStation.js.map +1 -1
  53. package/dist/cmp/ReadmeTop.js +472 -373
  54. package/dist/cmp/ReadmeTop.js.map +1 -1
  55. package/dist/cmp/ReadmeUnions.js +8 -2
  56. package/dist/cmp/ReadmeUnions.js.map +1 -1
  57. package/dist/cmp/Security.js +3 -2
  58. package/dist/cmp/Security.js.map +1 -1
  59. package/dist/helpers/applicability.d.ts +2 -1
  60. package/dist/helpers/applicability.js +26 -0
  61. package/dist/helpers/applicability.js.map +1 -1
  62. package/dist/helpers/copymerge.d.ts +3 -0
  63. package/dist/helpers/copymerge.js +43 -10
  64. package/dist/helpers/copymerge.js.map +1 -1
  65. package/dist/helpers/doccheck.d.ts +11 -0
  66. package/dist/helpers/doccheck.js +146 -0
  67. package/dist/helpers/doccheck.js.map +1 -0
  68. package/dist/helpers/doctext.d.ts +11 -0
  69. package/dist/helpers/doctext.js +84 -0
  70. package/dist/helpers/doctext.js.map +1 -0
  71. package/dist/helpers/exampleCall.d.ts +16 -0
  72. package/dist/helpers/exampleCall.js +334 -0
  73. package/dist/helpers/exampleCall.js.map +1 -0
  74. package/dist/helpers/exportnames.d.ts +4 -0
  75. package/dist/helpers/exportnames.js +35 -0
  76. package/dist/helpers/exportnames.js.map +1 -0
  77. package/dist/helpers/facts.d.ts +4 -0
  78. package/dist/helpers/facts.js +92 -0
  79. package/dist/helpers/facts.js.map +1 -0
  80. package/dist/helpers/modelcheck.d.ts +2 -1
  81. package/dist/helpers/modelcheck.js +13 -0
  82. package/dist/helpers/modelcheck.js.map +1 -1
  83. package/dist/helpers/opExample.d.ts +9 -2
  84. package/dist/helpers/opExample.js +22 -2
  85. package/dist/helpers/opExample.js.map +1 -1
  86. package/dist/helpers/opShape.d.ts +2 -1
  87. package/dist/helpers/opShape.js +12 -0
  88. package/dist/helpers/opShape.js.map +1 -1
  89. package/dist/helpers/packageMeta.js +21 -8
  90. package/dist/helpers/packageMeta.js.map +1 -1
  91. package/dist/helpers/semver.d.ts +2 -1
  92. package/dist/helpers/semver.js +7 -0
  93. package/dist/helpers/semver.js.map +1 -1
  94. package/dist/helpers/shipped.d.ts +2 -1
  95. package/dist/helpers/shipped.js +4 -0
  96. package/dist/helpers/shipped.js.map +1 -1
  97. package/dist/sdkgen.d.ts +2 -1
  98. package/dist/sdkgen.js +29 -6
  99. package/dist/sdkgen.js.map +1 -1
  100. package/dist/testkit.d.ts +1 -0
  101. package/dist/testkit.js +23 -19
  102. package/dist/testkit.js.map +1 -1
  103. package/dist/tsconfig.tsbuildinfo +1 -1
  104. package/dist/utility.js +2 -1
  105. package/dist/utility.js.map +1 -1
  106. package/model/fact.aontu +59 -0
  107. package/model/sdkgen.aontu +6 -2
  108. package/package.json +3 -1
  109. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +1 -1
  110. package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +1 -1
  111. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +12 -3
  112. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +4 -1
  113. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +1 -0
  114. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -0
  115. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -1
  116. package/project/.sdk/src/cmp/zig/ReadmeOptions_zig.ts +1 -1
  117. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +2 -2
  118. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
  119. package/project/sdkgen-package.json +1 -1
  120. package/src/action/check.ts +21 -0
  121. package/src/action/copies.ts +2 -0
  122. package/src/action/doctor.ts +244 -13
  123. package/src/action/package.ts +10 -0
  124. package/src/action/remove.ts +2 -1
  125. package/src/action/target.ts +66 -15
  126. package/src/cmp/AgentGuide.ts +24 -10
  127. package/src/cmp/AgentGuideContent.ts +53 -32
  128. package/src/cmp/AgentGuideFeature.ts +8 -5
  129. package/src/cmp/AgentGuideTop.ts +108 -47
  130. package/src/cmp/Changelog.ts +13 -2
  131. package/src/cmp/Deploy.ts +23 -21
  132. package/src/cmp/ExternalTarget.ts +6 -6
  133. package/src/cmp/Feature.ts +11 -4
  134. package/src/cmp/FeatureDocs.ts +21 -40
  135. package/src/cmp/FeatureHook.ts +38 -1
  136. package/src/cmp/PublishWorkflow.ts +33 -7
  137. package/src/cmp/ReadmeErrors.ts +555 -25
  138. package/src/cmp/ReadmeExplanation.ts +316 -52
  139. package/src/cmp/ReadmeFeatures.ts +18 -8
  140. package/src/cmp/ReadmeIntro.ts +3 -2
  141. package/src/cmp/ReadmeRefFeatures.ts +39 -27
  142. package/src/cmp/ReadmeStation.ts +12 -14
  143. package/src/cmp/ReadmeTop.ts +528 -387
  144. package/src/cmp/ReadmeUnions.ts +10 -2
  145. package/src/cmp/Security.ts +3 -2
  146. package/src/helpers/applicability.ts +28 -0
  147. package/src/helpers/copymerge.ts +58 -10
  148. package/src/helpers/doccheck.ts +174 -0
  149. package/src/helpers/doctext.ts +113 -0
  150. package/src/helpers/exampleCall.ts +415 -0
  151. package/src/helpers/exportnames.ts +47 -0
  152. package/src/helpers/facts.ts +119 -0
  153. package/src/helpers/modelcheck.ts +16 -0
  154. package/src/helpers/opExample.ts +34 -2
  155. package/src/helpers/opShape.ts +13 -0
  156. package/src/helpers/packageMeta.ts +21 -8
  157. package/src/helpers/semver.ts +9 -0
  158. package/src/helpers/shipped.ts +5 -0
  159. package/src/sdkgen.ts +31 -2
  160. package/src/testkit.ts +30 -20
  161. 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?.phase?.feature?.active !== false
68
+ return fact(target, 'phase').feature
66
69
  }
67
70
 
68
- // ts/js lay each feature out as a directory `src/feature/<name>/`; the other
69
- // SDK targets (`srcfeature: false`) use flat files in a shared `feature/`
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
- function featureBase(target: any): string {
76
- return isDirLayout(target) ? 'src/feature' : 'feature'
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 featureRuntimeFile(target: any, feature: any): string {
80
- const ext = target?.ext || target?.name || ''
81
- if ('php' === target?.name) {
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
- function workflowSection(): string {
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
- \`generate\` **merges** into existing files and does **not** re-apply
138
- placeholder substitution to merged content. If you ever see a literal
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
- **Regeneration never DELETES.** A file the generator has stopped emitting
174
- stays in the tree, and \`git status\` is silent because it is committed and
175
- unchanged. Narrowing a feature's plugin selection, or dropping a target, can
176
- leave whole modules behind that nothing references and no test covers.
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). Built-in features are \`log\` and \`test\`.
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
- featureBase,
299
- featureRuntimeFile,
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 = true === feature?.config?.options?.active
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 (load, list, create, update, patch, remove) and of
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). If a regenerated file
86
- shows a literal \`FEATURE_Name\`/\`ProjectName\`, delete it and regenerate.
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
@@ -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 AgentGuideTop = cmp(function AgentGuideTop(props: any) {
20
- const { ctx$ } = props
21
- const { model } = ctx$
21
+ const AgentGuideTopIntro = cmp(function AgentGuideTopIntro(props: any) {
22
+ const { Name, model, targets } = props.s
22
23
 
23
- if (model.name && !model.Name) names(model, model.name)
24
+ const featureGuides = targets.some((t: any) =>
25
+ fact(t, 'phase').agentguide && writesFeatureGuides(model, t))
24
26
 
25
- const Name = projectName(model)
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
- if (0 < targets.length) {
48
- Content(`**Targets** (${targets.length}):
48
+ if (0 < targets.length) {
49
+ Content(`**Targets** (${targets.length}):
49
50
 
50
51
  | Target | Directory | Build guide |
51
52
  | --- | --- | --- |
52
53
  `)
53
- targets.forEach((t: any) => {
54
- const note = langCmd(t.name).note ? ' — ' + langCmd(t.name).note : ''
55
- Content(`| \`${t.name}\` | \`${t.name}/\`${note} | [\`${t.name}/AGENTS.md\`](./${t.name}/AGENTS.md) |
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
- Content(`
58
+ })
59
+ Content(`
59
60
  `)
60
- }
61
+ }
62
+ })
63
+
61
64
 
62
- if (0 < features.length) {
63
- Content(`**Features** (${features.length}): `)
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
- Each feature is generated into every SDK target — as a directory
67
- \`<lang>/src/feature/<name>/\` (ts/js) or a flat file in the \`<lang>/feature/\`
68
- package (other languages). Each target's guide documents its features.
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
- if (0 < entities.length) {
74
- Content(`**Entities** (${entities.length}): `)
75
- Content(entities.map((e: any) => `\`${e.Name || e.name}\``).join(', ') + `.
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
- // Station paragraph (station design §9.4; declarative design §11
81
- // item 4), only when the model carries the feature: an agent working
82
- // on this repo should know the runtime story without leaving
83
- // AGENTS.md — and, first, that the application's integrations are
84
- // DECLARED in station.json, so that file is where to look.
85
- if (features.some((f: any) => 'station' === f.name)) {
86
- Content(`**Station**: this SDK is a
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
- Content(workflowSection())
107
- Content(featureSection())
108
- Content(customiseSection())
109
- Content(aontuSection())
129
+ const AgentGuideTopFeatureGuide = cmp(function AgentGuideTopFeatureGuide() {
130
+ Content(featureSection())
131
+ })
110
132
 
111
- Content(`## Where things live
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' }, () => {
@@ -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
- ## [0.0.1]
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
- t.name + (registryOf(t) ? (':' + registryOf(t).name + (regIsActive(registryOf(t)) ? '' : '(publish pending)')) : ':tag-only')
34
- ).join(',')
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
- // A registry is active (package really uploaded) when its tri-state
46
- // `state === 'active'`. The legacy boolean `active: true` is honoured as a
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 state = reg
103
- ? `${reg.name} (${regIsActive(reg) ? 'ACTIVE' : 'publish pending: deploy publishes the git tag only'}) ${reg.url || ''}`.trim()
104
- : 'tag-only'
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 (!reg && 'root' === via) {
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 (reg && !regIsActive(reg)) {
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 pending — publishing the git tag only."
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 pending — tag-only deploy')}
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 state = reg ? `${reg.name} ${regIsActive(reg) ? 'ACTIVE' : 'publish pending (deploy = git tag only)'}` : 'tag-only'
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
- // Defaults are inclusive: a phase runs unless the target's model turns it
46
- // off. Consumer targets (go-cli, go-mcp, py-data, seneca-provider) switch
47
- // every phase off and emit everything from Main.
48
- const phase = target.phase || {}
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)
@@ -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.info({
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 + ': target ' + target.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
  }