@voxgig/sdkgen 4.45.0 → 4.47.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 +73 -4
- 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 +26 -2
- package/dist/action/doctor.js +208 -11
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/package.d.ts +1 -1
- package/dist/action/package.js +15 -16
- package/dist/action/package.js.map +1 -1
- package/dist/action/remove.js +16 -4
- package/dist/action/remove.js.map +1 -1
- package/dist/action/resolve.d.ts +1 -0
- package/dist/action/resolve.js +10 -4
- package/dist/action/resolve.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/admin/status.d.ts +7 -1
- package/dist/admin/status.js +34 -5
- package/dist/admin/status.js.map +1 -1
- package/dist/cmp/AgentGuide.js +46 -23
- package/dist/cmp/AgentGuide.js.map +1 -1
- package/dist/cmp/AgentGuideContent.d.ts +9 -7
- package/dist/cmp/AgentGuideContent.js +73 -43
- package/dist/cmp/AgentGuideContent.js.map +1 -1
- package/dist/cmp/AgentGuideFeature.js +19 -9
- package/dist/cmp/AgentGuideFeature.js.map +1 -1
- package/dist/cmp/AgentGuideTop.js +95 -49
- package/dist/cmp/AgentGuideTop.js.map +1 -1
- package/dist/cmp/Changelog.js +45 -4
- package/dist/cmp/Changelog.js.map +1 -1
- package/dist/cmp/Deploy.js +73 -35
- package/dist/cmp/Deploy.js.map +1 -1
- package/dist/cmp/Entity.js +1 -1
- package/dist/cmp/Entity.js.map +1 -1
- package/dist/cmp/ExternalTarget.js +10 -5
- package/dist/cmp/ExternalTarget.js.map +1 -1
- package/dist/cmp/Feature.js +12 -5
- 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/Main.js +1 -1
- package/dist/cmp/Main.js.map +1 -1
- package/dist/cmp/PublishWorkflow.js +89 -55
- 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 +4 -3
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeModel.js +2 -2
- package/dist/cmp/ReadmeModel.js.map +1 -1
- package/dist/cmp/ReadmeRefFeatures.js +34 -24
- package/dist/cmp/ReadmeRefFeatures.js.map +1 -1
- package/dist/cmp/ReadmeStation.js +12 -9
- package/dist/cmp/ReadmeStation.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +479 -382
- 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/Registered.js +1 -1
- package/dist/cmp/Registered.js.map +1 -1
- package/dist/cmp/Security.js +26 -5
- package/dist/cmp/Security.js.map +1 -1
- package/dist/cmp/Test.js +1 -1
- package/dist/cmp/Test.js.map +1 -1
- package/dist/helpers/alongside.d.ts +2 -3
- package/dist/helpers/alongside.js +16 -15
- package/dist/helpers/alongside.js.map +1 -1
- package/dist/helpers/applicability.d.ts +3 -1
- package/dist/helpers/applicability.js +40 -1
- package/dist/helpers/applicability.js.map +1 -1
- package/dist/helpers/component.js +9 -1
- package/dist/helpers/component.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/definitionPlan.js +0 -1
- package/dist/helpers/definitionPlan.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 +85 -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 +2 -1
- package/dist/helpers/facts.js +210 -5
- package/dist/helpers/facts.js.map +1 -1
- package/dist/helpers/flowGuard.d.ts +1 -1
- package/dist/helpers/flowGuard.js +20 -7
- package/dist/helpers/flowGuard.js.map +1 -1
- package/dist/helpers/generated.d.ts +1 -0
- package/dist/helpers/generated.js +1 -1
- package/dist/helpers/generated.js.map +1 -1
- package/dist/helpers/graphqlPoint.d.ts +2 -1
- package/dist/helpers/graphqlPoint.js +17 -0
- package/dist/helpers/graphqlPoint.js.map +1 -1
- package/dist/helpers/guardModel.d.ts +2 -0
- package/dist/helpers/guardModel.js +41 -0
- package/dist/helpers/guardModel.js.map +1 -0
- package/dist/helpers/manifest.d.ts +2 -1
- package/dist/helpers/manifest.js +16 -0
- package/dist/helpers/manifest.js.map +1 -1
- package/dist/helpers/mcpTools.d.ts +2 -1
- package/dist/helpers/mcpTools.js +8 -1
- package/dist/helpers/mcpTools.js.map +1 -1
- 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 +29 -17
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/packageMeta.d.ts +6 -4
- package/dist/helpers/packageMeta.js +88 -53
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/helpers/placement.d.ts +15 -0
- package/dist/helpers/placement.js +76 -0
- package/dist/helpers/placement.js.map +1 -0
- package/dist/helpers/semver.d.ts +3 -1
- package/dist/helpers/semver.js +28 -0
- package/dist/helpers/semver.js.map +1 -1
- package/dist/helpers/serverVars.js +3 -2
- package/dist/helpers/serverVars.js.map +1 -1
- package/dist/helpers/shipped.d.ts +2 -1
- package/dist/helpers/shipped.js +12 -0
- package/dist/helpers/shipped.js.map +1 -1
- package/dist/helpers/sourcestring.d.ts +3 -0
- package/dist/helpers/sourcestring.js +43 -0
- package/dist/helpers/sourcestring.js.map +1 -0
- package/dist/helpers/stdrep.d.ts +1 -1
- package/dist/helpers/stdrep.js +5 -1
- package/dist/helpers/stdrep.js.map +1 -1
- package/dist/helpers/surface.d.ts +7 -0
- package/dist/helpers/surface.js +69 -0
- package/dist/helpers/surface.js.map +1 -0
- package/dist/helpers/targetguard.d.ts +13 -0
- package/dist/helpers/targetguard.js +65 -0
- package/dist/helpers/targetguard.js.map +1 -0
- package/dist/helpers/text.d.ts +3 -1
- package/dist/helpers/text.js +16 -0
- package/dist/helpers/text.js.map +1 -1
- package/dist/helpers/textguard.d.ts +31 -0
- package/dist/helpers/textguard.js +157 -0
- package/dist/helpers/textguard.js.map +1 -0
- package/dist/helpers/title.d.ts +4 -0
- package/dist/helpers/title.js +52 -0
- package/dist/helpers/title.js.map +1 -0
- package/dist/sdkgen.d.ts +4 -6
- package/dist/sdkgen.js +72 -63
- package/dist/sdkgen.js.map +1 -1
- package/dist/testkit.d.ts +7 -2
- package/dist/testkit.js +27 -20
- 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 +150 -0
- package/model/sdkgen.aontu +15 -3
- package/package.json +3 -1
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +2 -2
- 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/clojure/ReadmeQuick_clojure.ts +1 -1
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +1 -1
- package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +1 -1
- package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +1 -1
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +1 -1
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +1 -1
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +1 -1
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +1 -1
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +1 -1
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +1 -1
- package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +4 -1
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +2 -1
- 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/ts/ReadmeQuick_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/TestDefinition_ts.ts +3 -1
- package/project/.sdk/src/cmp/zig/ReadmeOptions_zig.ts +1 -1
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
- package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +2 -1
- package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +11 -2
- package/project/sdkgen-package.json +1 -1
- package/src/action/check.ts +99 -4
- package/src/action/copies.ts +2 -0
- package/src/action/doctor.ts +304 -15
- package/src/action/package.ts +11 -13
- package/src/action/remove.ts +20 -5
- package/src/action/resolve.ts +11 -4
- package/src/action/target.ts +66 -15
- package/src/admin/status.ts +25 -5
- package/src/cmp/AgentGuide.ts +52 -25
- package/src/cmp/AgentGuideContent.ts +75 -43
- package/src/cmp/AgentGuideFeature.ts +21 -10
- package/src/cmp/AgentGuideTop.ts +119 -49
- package/src/cmp/Changelog.ts +56 -5
- package/src/cmp/Deploy.ts +81 -40
- package/src/cmp/Entity.ts +1 -1
- package/src/cmp/ExternalTarget.ts +12 -6
- package/src/cmp/Feature.ts +13 -6
- package/src/cmp/FeatureDocs.ts +21 -40
- package/src/cmp/FeatureHook.ts +38 -1
- package/src/cmp/Main.ts +1 -1
- package/src/cmp/PublishWorkflow.ts +94 -60
- 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 +4 -3
- package/src/cmp/ReadmeModel.ts +2 -2
- package/src/cmp/ReadmeRefFeatures.ts +39 -27
- package/src/cmp/ReadmeStation.ts +13 -16
- package/src/cmp/ReadmeTop.ts +538 -397
- package/src/cmp/ReadmeUnions.ts +10 -2
- package/src/cmp/Registered.ts +1 -1
- package/src/cmp/Security.ts +35 -7
- package/src/cmp/Test.ts +1 -1
- package/src/helpers/alongside.ts +16 -19
- package/src/helpers/applicability.ts +44 -1
- package/src/helpers/component.ts +11 -1
- package/src/helpers/copymerge.ts +58 -10
- package/src/helpers/definitionPlan.ts +0 -1
- package/src/helpers/doccheck.ts +174 -0
- package/src/helpers/doctext.ts +115 -0
- package/src/helpers/exampleCall.ts +415 -0
- package/src/helpers/exportnames.ts +47 -0
- package/src/helpers/facts.ts +259 -5
- package/src/helpers/flowGuard.ts +22 -7
- package/src/helpers/generated.ts +3 -1
- package/src/helpers/graphqlPoint.ts +20 -1
- package/src/helpers/guardModel.ts +50 -0
- package/src/helpers/manifest.ts +19 -0
- package/src/helpers/mcpTools.ts +11 -1
- package/src/helpers/modelcheck.ts +16 -0
- package/src/helpers/opExample.ts +34 -2
- package/src/helpers/opShape.ts +29 -16
- package/src/helpers/packageMeta.ts +89 -52
- package/src/helpers/placement.ts +114 -0
- package/src/helpers/semver.ts +35 -0
- package/src/helpers/serverVars.ts +4 -2
- package/src/helpers/shipped.ts +13 -0
- package/src/helpers/sourcestring.ts +47 -0
- package/src/helpers/stdrep.ts +6 -1
- package/src/helpers/surface.ts +82 -0
- package/src/helpers/targetguard.ts +91 -0
- package/src/helpers/text.ts +22 -0
- package/src/helpers/textguard.ts +208 -0
- package/src/helpers/title.ts +59 -0
- package/src/sdkgen.ts +82 -78
- package/src/testkit.ts +42 -20
- package/src/utility.ts +2 -1
package/src/cmp/ReadmeTop.ts
CHANGED
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import { credentialPlacement } from '../utility'
|
|
11
11
|
import { optionalComponent } from '../helpers/optional'
|
|
12
|
-
import { featureDocs } from './FeatureDocs'
|
|
12
|
+
import { featureDocs, codeList } from './FeatureDocs'
|
|
13
|
+
import { PIPELINE_STAGES, pipelineLength } from './FeatureHook'
|
|
13
14
|
import type { FeatureDoc } from './FeatureDocs'
|
|
14
15
|
|
|
15
16
|
import {
|
|
@@ -20,8 +21,10 @@ import { mcpTools, MCP_WRITE_OPS } from '../helpers/mcpTools'
|
|
|
20
21
|
import type { ExampleLang, PrimaryCall } from '../helpers/opExample'
|
|
21
22
|
import { canonScalarKey } from '../helpers/canonType'
|
|
22
23
|
import { safeVarName, exampleVarName, jsKey } from '../helpers/naming'
|
|
23
|
-
import { modelText } from '../helpers/text'
|
|
24
|
-
import {
|
|
24
|
+
import { definitionName, modelText } from '../helpers/text'
|
|
25
|
+
import { fact } from '../helpers/facts'
|
|
26
|
+
import { documentOrder, surfaceOf } from '../helpers/surface'
|
|
27
|
+
import { copyMode, MERGE } from '../helpers/copymerge'
|
|
25
28
|
|
|
26
29
|
import {
|
|
27
30
|
installCommand as pkgInstall,
|
|
@@ -31,6 +34,7 @@ import {
|
|
|
31
34
|
vendorCommand,
|
|
32
35
|
apiName,
|
|
33
36
|
nonAffiliation,
|
|
37
|
+
publisherInfo,
|
|
34
38
|
docsSiteUrl,
|
|
35
39
|
originName,
|
|
36
40
|
isDefaultPublisher,
|
|
@@ -97,243 +101,186 @@ function entityExample(lang: ExampleLang, Name: string, call: PrimaryCall | null
|
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
|
|
100
|
-
const
|
|
101
|
-
const {
|
|
102
|
-
const { model } = ctx$
|
|
103
|
-
|
|
104
|
-
if (model.name && !model.Name) names(model, model.name)
|
|
105
|
-
|
|
106
|
-
const info = modelText(model)
|
|
107
|
-
const def = (model.main && model.main.def) || {}
|
|
108
|
-
|
|
109
|
-
const productName = info.title || `${model.Name} API`
|
|
110
|
-
|
|
111
|
-
const tagline = info.tagline
|
|
112
|
-
|| def.tagline
|
|
113
|
-
|| `${productName} client, generated from the OpenAPI spec.`
|
|
114
|
-
|
|
115
|
-
const aboutMd = info.about_md || ''
|
|
116
|
-
const homepage = info.homepage || ''
|
|
117
|
-
const docsUrl = info.docs_url || ''
|
|
118
|
-
const entityDesc = info.entity_desc || {}
|
|
119
|
-
|
|
120
|
-
const apiSummary = (info.summary || '').trim()
|
|
121
|
-
const apiWebsite = (info.website || '').trim()
|
|
122
|
-
const websiteLine = apiWebsite
|
|
123
|
-
? `Learn more about ${productName} at ` +
|
|
124
|
-
`[${apiWebsite.replace(/^https?:\/\//, '').replace(/\/$/, '')}](${apiWebsite}).`
|
|
125
|
-
: ''
|
|
126
|
-
|
|
127
|
-
// Attribution for API metadata sourced from a third-party catalogue (e.g.
|
|
128
|
-
// freepublicapis.com). Rendered only when the model carries an
|
|
129
|
-
// `info.meta_source` URL, so first-party SDKs never show it. The link points
|
|
130
|
-
// back to the catalogue that kindly supplied the metadata.
|
|
131
|
-
const metaSource = (info.meta_source || '').trim()
|
|
132
|
-
const metaSourceLine = metaSource
|
|
133
|
-
? `Metadata kindly supplied by ` +
|
|
134
|
-
`[${metaSource.replace(/^https?:\/\//, '').replace(/\/$/, '')}](${metaSource}).`
|
|
135
|
-
: ''
|
|
136
|
-
|
|
137
|
-
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
138
|
-
const target = getModelPath(model, `main.${KIT}.target`)
|
|
139
|
-
const feature = getModelPath(model, `main.${KIT}.feature`)
|
|
140
|
-
|
|
141
|
-
each(entity, (ent: any) => { if (!ent.Name) names(ent, ent.name) })
|
|
142
|
-
each(feature, (feat: any) => { if (!feat.Name) names(feat, feat.name) })
|
|
143
|
-
|
|
144
|
-
const activeEntities = each(entity).filter((e: any) => e.active !== false)
|
|
145
|
-
const activeTargets = each(target).filter((t: any) => t.active !== false)
|
|
146
|
-
|
|
147
|
-
const hasCli = activeTargets.some((t: any) => t.name === 'go-cli')
|
|
148
|
-
const hasMcp = activeTargets.some((t: any) => t.name === 'go-mcp')
|
|
104
|
+
const ReadmeTopTitle = cmp(function ReadmeTopTitle(props: any) {
|
|
105
|
+
const { model, tagline, apiSummary, websiteLine, metaSourceLine } = props.s
|
|
149
106
|
|
|
150
|
-
|
|
151
|
-
const docsOrder: string[] = (getModelPath(model, `main.${KIT}.config.docs_order`,
|
|
152
|
-
{ only_active: false, required: false }) as any) || []
|
|
153
|
-
|
|
154
|
-
const orderOf = (name: string): number => {
|
|
155
|
-
const i = docsOrder.indexOf(name)
|
|
156
|
-
if (i !== -1) return i
|
|
157
|
-
if (name === 'go-cli') return docsOrder.length + 1
|
|
158
|
-
if (name === 'go-mcp') return docsOrder.length + 2
|
|
159
|
-
return docsOrder.length
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const ordered = activeTargets
|
|
163
|
-
.slice()
|
|
164
|
-
.sort((a: any, b: any) => orderOf(a.name) - orderOf(b.name))
|
|
165
|
-
|
|
166
|
-
const isCliOrMcp = (t: any) => t.name === 'go-cli' || t.name === 'go-mcp'
|
|
167
|
-
|
|
168
|
-
const sdkTargets = ordered.filter((t: any) => !isConsumer(t))
|
|
169
|
-
|
|
170
|
-
// The CLI and the MCP server have surfaces of their own below.
|
|
171
|
-
const consumerTargets = ordered.filter((t: any) => isConsumer(t) && !isCliOrMcp(t))
|
|
172
|
-
|
|
173
|
-
const docTargets = ordered.filter((t: any) => !isCliOrMcp(t))
|
|
174
|
-
|
|
175
|
-
const pkgTargets = activeTargets
|
|
176
|
-
.filter((t: any) => hasPackageName(model, t.name))
|
|
177
|
-
.sort((a: any, b: any) => orderOf(a.name) - orderOf(b.name))
|
|
178
|
-
|
|
179
|
-
const langList = sdkTargets.map((t: any) => t.title).join(', ')
|
|
180
|
-
const leadTarget = pickLeadTarget(sdkTargets)
|
|
181
|
-
|
|
182
|
-
File({ name: 'README.md' }, () => {
|
|
183
|
-
|
|
184
|
-
Content(`# ${model.Name} SDK
|
|
107
|
+
Content(`# ${model.Name} SDK
|
|
185
108
|
|
|
186
109
|
${tagline}
|
|
187
110
|
|
|
188
111
|
`)
|
|
189
|
-
|
|
190
|
-
|
|
112
|
+
if (apiSummary) {
|
|
113
|
+
Content(`${apiSummary}
|
|
191
114
|
|
|
192
115
|
`)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
116
|
+
}
|
|
117
|
+
if (websiteLine) {
|
|
118
|
+
Content(`${websiteLine}
|
|
196
119
|
|
|
197
120
|
`)
|
|
198
|
-
|
|
199
|
-
|
|
121
|
+
}
|
|
122
|
+
Content(`${nonAffiliation(model)}
|
|
200
123
|
|
|
201
124
|
`)
|
|
202
|
-
|
|
203
|
-
|
|
125
|
+
if (isDefaultPublisher(model)) {
|
|
126
|
+
Content(`Learn more about Voxgig SDKs at [voxgig.com/sdk](${VOXGIG_SDK}).
|
|
204
127
|
|
|
205
128
|
`)
|
|
206
|
-
|
|
129
|
+
}
|
|
207
130
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
131
|
+
// THE GENERATED SITE, LINKED FROM THE TOP, because the repository was the
|
|
132
|
+
// one place it could not be found from. `docs_url` further down is the
|
|
133
|
+
// UPSTREAM API's documentation, not this, and a reader who lands on the
|
|
134
|
+
// repo rather than arriving from a link had no route to the site at all.
|
|
135
|
+
// Empty unless the project actually publishes one -- see docsSiteUrl.
|
|
136
|
+
const siteUrl = docsSiteUrl(model)
|
|
137
|
+
if (siteUrl) {
|
|
138
|
+
Content(`Full documentation for this SDK: [${siteUrl}](${siteUrl})
|
|
216
139
|
|
|
217
140
|
`)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
141
|
+
}
|
|
142
|
+
if (metaSourceLine) {
|
|
143
|
+
Content(`${metaSourceLine}
|
|
221
144
|
|
|
222
145
|
`)
|
|
223
|
-
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
const ReadmeTopSurfaceLine = cmp(function ReadmeTopSurfaceLine(props: any) {
|
|
151
|
+
const { hasCli, hasMcp, sdkTargets, consumerTargets, langList, definition } = props.s
|
|
224
152
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
153
|
+
if (sdkTargets.length > 1) {
|
|
154
|
+
const surfaces = []
|
|
155
|
+
surfaces.push(`${langList} SDKs`)
|
|
156
|
+
if (hasCli) surfaces.push('a CLI with an interactive REPL')
|
|
157
|
+
if (hasMcp) surfaces.push('an MCP server for AI agents')
|
|
158
|
+
consumerTargets.forEach((t: any) => surfaces.push(`the ${fact(t, 'title')} package`))
|
|
159
|
+
const surfaceList = surfaces.length > 1
|
|
160
|
+
? surfaces.slice(0, -1).join(', ') + ', and ' + surfaces[surfaces.length - 1]
|
|
161
|
+
: surfaces[0]
|
|
162
|
+
Content(`> ${surfaceList} — all generated from one ${definition} by [@voxgig/sdkgen](${SDKGEN_REPO}).
|
|
235
163
|
|
|
236
164
|
`)
|
|
237
|
-
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
|
|
238
168
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
169
|
+
const ReadmeTopFeatureLine = cmp(function ReadmeTopFeatureLine(props: any) {
|
|
170
|
+
const { model } = props.s
|
|
171
|
+
|
|
172
|
+
// FEATURES BELONG BESIDE THE TARGETS. What an SDK can do is as much a
|
|
173
|
+
// reason to choose it as which language it is in, and a reader who has to
|
|
174
|
+
// scroll past every language section to discover that retries, caching and
|
|
175
|
+
// tracing are built in has already decided it is a thin HTTP wrapper.
|
|
176
|
+
// Named here, in one line, with the detail left to each target's README.
|
|
177
|
+
const features = featureDocs(model)
|
|
178
|
+
if (0 < features.length) {
|
|
179
|
+
const on = features.filter((f: FeatureDoc) => f.on).map((f: FeatureDoc) => f.name)
|
|
180
|
+
const state = 0 === on.length ? `opt-in,
|
|
181
|
+
> inactive until switched on, and configured per client.` : `configured per client.
|
|
182
|
+
> ${codeList(on)} ${1 === on.length ? 'runs' : 'run'} by default${on.length < features.length ?
|
|
183
|
+
'; the rest are opt-in, inactive until switched on' : ''}.`
|
|
184
|
+
Content(`> **Features:** ${features.map((f: FeatureDoc) => '`' + f.name + '`').join(', ')} — ${state} See the Features
|
|
248
185
|
> section of any SDK README below for what each one does.
|
|
249
186
|
|
|
250
187
|
`)
|
|
251
|
-
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
|
|
252
191
|
|
|
253
|
-
|
|
254
|
-
|
|
192
|
+
const ReadmeTopAbout = cmp(function ReadmeTopAbout(props: any) {
|
|
193
|
+
const { text, productName, aboutMd } = props.s
|
|
255
194
|
|
|
256
|
-
|
|
195
|
+
if (aboutMd) {
|
|
196
|
+
Content(`## About ${productName}
|
|
197
|
+
|
|
198
|
+
${aboutMd}
|
|
257
199
|
|
|
258
200
|
`)
|
|
259
|
-
|
|
260
|
-
|
|
201
|
+
} else if (text.desc.text) {
|
|
202
|
+
Content(`${text.desc.text}
|
|
261
203
|
|
|
262
204
|
`)
|
|
263
|
-
|
|
205
|
+
}
|
|
206
|
+
})
|
|
264
207
|
|
|
265
|
-
if (activeEntities.length > 0) {
|
|
266
|
-
const entNames = activeEntities.map((e: any) => e.Name)
|
|
267
|
-
const entCount = entNames.length
|
|
268
|
-
const entList = entCount > 1
|
|
269
|
-
? entNames.slice(0, -1).join(', ') + ' and ' + entNames[entNames.length - 1]
|
|
270
|
-
: entNames[0]
|
|
271
|
-
const NAME_INLINE_MAX = 6
|
|
272
|
-
const inlineNames = entCount <= NAME_INLINE_MAX
|
|
273
|
-
const surface = inlineNames
|
|
274
|
-
? `a small set of **semantic entities** — ${entList} —`
|
|
275
|
-
: `**${entCount} semantic entities**`
|
|
276
|
-
const seeEntities = inlineNames
|
|
277
|
-
? ''
|
|
278
|
-
: ' See the [Entities](#entities) table below for the full list.'
|
|
279
|
-
const exEnt = activeEntities[0]
|
|
280
|
-
const ex = exEnt.Name
|
|
281
|
-
const exLower = exampleVarName(ex.toLowerCase(), 'ts')
|
|
282
|
-
// The example call uses the entity's PRIMARY op — an op it actually
|
|
283
|
-
// exposes (prefer list -> the array, then load -> the record, else a
|
|
284
|
-
// create with its required fields). A create-only entity therefore never
|
|
285
|
-
// shows a phantom .list()/.load() that would not compile. If it exposes
|
|
286
|
-
// only remove (or nothing), the op line is omitted entirely.
|
|
287
|
-
const primaryOp = entityPrimaryOp(exEnt)
|
|
288
|
-
let exCall = ''
|
|
289
|
-
const exIdField = entityIdField(exEnt)
|
|
290
|
-
const exListArg = listMatchArg('ts', exEnt)
|
|
291
|
-
const exLoadArg = matchArg('ts', exEnt, 'load', exIdField,
|
|
292
|
-
idLiteral(exEnt, 'load', exIdField))
|
|
293
|
-
|
|
294
|
-
if ('list' === primaryOp) {
|
|
295
|
-
exCall = `const items = await client.${ex}().list(${exListArg})`
|
|
296
|
-
} else if ('load' === primaryOp) {
|
|
297
|
-
exCall = `const ${exLower} = await client.${ex}().load(${exLoadArg})`
|
|
298
|
-
} else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
|
|
299
|
-
const exIdF = entityIdField(exEnt)
|
|
300
|
-
// Drop the id only when the request shape says it is OPTIONAL. It is
|
|
301
|
-
// server-assigned on a normal create, but an op whose id comes from a
|
|
302
|
-
// PATH PARAMETER requires it, and the typed CreateData then rejects a
|
|
303
|
-
// body without it. Same rule as dataArg in helpers/opExample.
|
|
304
|
-
const shapeItems = requestExampleItems(exEnt, primaryOp)
|
|
305
|
-
.filter((it: any) =>
|
|
306
|
-
(it.name !== exIdF && it.name !== 'id') || !it.optional)
|
|
307
|
-
const required = shapeItems.filter((it: any) => !it.optional)
|
|
308
|
-
const chosen = required.length ? required : shapeItems.slice(0, 3)
|
|
309
|
-
const bodyLines = chosen.map((it: any) => ` ${jsKey(it.name)}: ${tsExampleLiteral(it.type)},`)
|
|
310
|
-
const body = bodyLines.length ? `\n${bodyLines.join('\n')}\n` : ''
|
|
311
|
-
exCall = `const ${exLower} = await client.${ex}().${primaryOp}({${body}})`
|
|
312
|
-
}
|
|
313
|
-
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
314
|
-
const opSet = new Set<string>()
|
|
315
|
-
activeEntities.forEach((e: any) => Object.keys(e.op || {})
|
|
316
|
-
.forEach((o: string) => { if ((e.op as any)[o] && (e.op as any)[o].active !== false) opSet.add(o) }))
|
|
317
|
-
const opNames = CANON_OPS.filter((o) => opSet.has(o)).concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
318
|
-
const opList = (opNames.length ? opNames : ['list', 'load']).map((o) => '`' + o + '`').join(', ')
|
|
319
|
-
|
|
320
|
-
// In the SDK's own language: ts when it has one, else the first the
|
|
321
|
-
// example helpers can write, else no example at all.
|
|
322
|
-
const lang = exampleLang(model, sdkTargets)
|
|
323
|
-
let snippet = ''
|
|
324
|
-
if ('ts' === lang) {
|
|
325
|
-
snippet = `const client = new ${model.Name}SDK()${exCall ? '\n' + exCall : ''}`
|
|
326
|
-
}
|
|
327
|
-
else if (null != lang) {
|
|
328
|
-
const call = ['list', 'load', 'create', 'update', 'patch'].includes(String(primaryOp))
|
|
329
|
-
? primaryOpCall(lang, ex, exampleVarName(ex.toLowerCase(), lang), primaryOp!, exIdField, exEnt)
|
|
330
|
-
: null
|
|
331
|
-
snippet = entityExample(lang, model.Name, call)
|
|
332
|
-
}
|
|
333
|
-
const exBlock = '' === snippet ? '.' :
|
|
334
|
-
`:\n\n\`\`\`${EXAMPLE_FENCE[lang!]}\n${snippet}\n\`\`\``
|
|
335
208
|
|
|
336
|
-
|
|
209
|
+
const ReadmeTopEntityModel = cmp(function ReadmeTopEntityModel(props: any) {
|
|
210
|
+
const { model, activeEntities, sdkTargets } = props.s
|
|
211
|
+
|
|
212
|
+
if (activeEntities.length > 0) {
|
|
213
|
+
const entNames = activeEntities.map((e: any) => e.Name)
|
|
214
|
+
const entCount = entNames.length
|
|
215
|
+
const entList = entCount > 1
|
|
216
|
+
? entNames.slice(0, -1).join(', ') + ' and ' + entNames[entNames.length - 1]
|
|
217
|
+
: entNames[0]
|
|
218
|
+
const NAME_INLINE_MAX = 6
|
|
219
|
+
const inlineNames = entCount <= NAME_INLINE_MAX
|
|
220
|
+
const surface = inlineNames
|
|
221
|
+
? `a small set of **semantic entities** — ${entList} —`
|
|
222
|
+
: `**${entCount} semantic entities**`
|
|
223
|
+
const seeEntities = inlineNames
|
|
224
|
+
? ''
|
|
225
|
+
: ' See the [Entities](#entities) table below for the full list.'
|
|
226
|
+
const exEnt = activeEntities[0]
|
|
227
|
+
const ex = exEnt.Name
|
|
228
|
+
const exLower = exampleVarName(ex.toLowerCase(), 'ts')
|
|
229
|
+
// The example call uses the entity's PRIMARY op — an op it actually
|
|
230
|
+
// exposes (prefer list -> the array, then load -> the record, else a
|
|
231
|
+
// create with its required fields). A create-only entity therefore never
|
|
232
|
+
// shows a phantom .list()/.load() that would not compile. If it exposes
|
|
233
|
+
// only remove (or nothing), the op line is omitted entirely.
|
|
234
|
+
const primaryOp = entityPrimaryOp(exEnt)
|
|
235
|
+
let exCall = ''
|
|
236
|
+
const exIdField = entityIdField(exEnt)
|
|
237
|
+
const exListArg = listMatchArg('ts', exEnt)
|
|
238
|
+
const exLoadArg = matchArg('ts', exEnt, 'load', exIdField,
|
|
239
|
+
idLiteral(exEnt, 'load', exIdField))
|
|
240
|
+
|
|
241
|
+
if ('list' === primaryOp) {
|
|
242
|
+
exCall = `const items = await client.${ex}().list(${exListArg})`
|
|
243
|
+
} else if ('load' === primaryOp) {
|
|
244
|
+
exCall = `const ${exLower} = await client.${ex}().load(${exLoadArg})`
|
|
245
|
+
} else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
|
|
246
|
+
const exIdF = entityIdField(exEnt)
|
|
247
|
+
// Drop the id only when the request shape says it is OPTIONAL. It is
|
|
248
|
+
// server-assigned on a normal create, but an op whose id comes from a
|
|
249
|
+
// PATH PARAMETER requires it, and the typed CreateData then rejects a
|
|
250
|
+
// body without it. Same rule as dataArg in helpers/opExample.
|
|
251
|
+
const shapeItems = requestExampleItems(exEnt, primaryOp)
|
|
252
|
+
.filter((it: any) =>
|
|
253
|
+
(it.name !== exIdF && it.name !== 'id') || !it.optional)
|
|
254
|
+
const required = shapeItems.filter((it: any) => !it.optional)
|
|
255
|
+
const chosen = required.length ? required : shapeItems.slice(0, 3)
|
|
256
|
+
const bodyLines = chosen.map((it: any) => ` ${jsKey(it.name)}: ${tsExampleLiteral(it.type)},`)
|
|
257
|
+
const body = bodyLines.length ? `\n${bodyLines.join('\n')}\n` : ''
|
|
258
|
+
exCall = `const ${exLower} = await client.${ex}().${primaryOp}({${body}})`
|
|
259
|
+
}
|
|
260
|
+
const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
|
|
261
|
+
const opSet = new Set<string>()
|
|
262
|
+
activeEntities.forEach((e: any) => Object.keys(e.op || {})
|
|
263
|
+
.forEach((o: string) => { if ((e.op as any)[o] && (e.op as any)[o].active !== false) opSet.add(o) }))
|
|
264
|
+
const opNames = CANON_OPS.filter((o) => opSet.has(o)).concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
|
|
265
|
+
const opList = (opNames.length ? opNames : ['list', 'load']).map((o) => '`' + o + '`').join(', ')
|
|
266
|
+
|
|
267
|
+
// In the SDK's own language: ts when it has one, else the first the
|
|
268
|
+
// example helpers can write, else no example at all.
|
|
269
|
+
const lang = exampleLang(model, sdkTargets)
|
|
270
|
+
let snippet = ''
|
|
271
|
+
if ('ts' === lang) {
|
|
272
|
+
snippet = `const client = new ${model.Name}SDK()${exCall ? '\n' + exCall : ''}`
|
|
273
|
+
}
|
|
274
|
+
else if (null != lang) {
|
|
275
|
+
const call = ['list', 'load', 'create', 'update', 'patch'].includes(String(primaryOp))
|
|
276
|
+
? primaryOpCall(lang, ex, exampleVarName(ex.toLowerCase(), lang), primaryOp!, exIdField, exEnt)
|
|
277
|
+
: null
|
|
278
|
+
snippet = entityExample(lang, model.Name, call)
|
|
279
|
+
}
|
|
280
|
+
const exBlock = '' === snippet ? '.' :
|
|
281
|
+
`:\n\n\`\`\`${EXAMPLE_FENCE[lang!]}\n${snippet}\n\`\`\``
|
|
282
|
+
|
|
283
|
+
Content(`## Entities, not endpoints
|
|
337
284
|
|
|
338
285
|
This SDK exposes the API as ${surface} that you
|
|
339
286
|
call directly, instead of assembling URL paths and query strings.${seeEntities} Entities are
|
|
@@ -344,126 +291,156 @@ Thinking in entities keeps the mental model small — for people and AI agents a
|
|
|
344
291
|
rather than reasoning about raw HTTP routes and query parameters.
|
|
345
292
|
|
|
346
293
|
`)
|
|
347
|
-
|
|
294
|
+
}
|
|
295
|
+
})
|
|
348
296
|
|
|
349
|
-
|
|
350
|
-
|
|
297
|
+
|
|
298
|
+
const ReadmeTopTesting = cmp(function ReadmeTopTesting(props: any) {
|
|
299
|
+
const { ctx$, sdkTargets } = props.s
|
|
300
|
+
|
|
301
|
+
if (sdkTargets.length > 0) {
|
|
302
|
+
Content(`## Offline unit testing
|
|
351
303
|
|
|
352
304
|
Every SDK ships a built-in **test mode** that swaps the HTTP transport for
|
|
353
305
|
an in-memory mock, so your unit tests run fully offline — no server, no
|
|
354
306
|
network, and no credentials:
|
|
355
307
|
|
|
356
308
|
`)
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
309
|
+
sdkTargets.forEach((tgt: any) => {
|
|
310
|
+
const Test =
|
|
311
|
+
optionalComponent(ctx$, tgt, 'ReadmeTopTest')
|
|
312
|
+
if (Test) {
|
|
313
|
+
Content(`### ${fact(tgt, 'title')}
|
|
362
314
|
|
|
363
315
|
`)
|
|
364
|
-
|
|
365
|
-
|
|
316
|
+
Test['ReadmeTopTest']({ target: tgt })
|
|
317
|
+
Content(`
|
|
366
318
|
`)
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
319
|
+
}
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
const ReadmeTopPackages = cmp(function ReadmeTopPackages(props: any) {
|
|
326
|
+
const { model, pkgTargets } = props.s
|
|
370
327
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
328
|
+
// 3. Packages — real published package name + install command per
|
|
329
|
+
// ecosystem. A package that is NOT yet live on its registry (the fleet
|
|
330
|
+
// default: 'pending') must NOT advertise a `npm install ...` that 404s —
|
|
331
|
+
// its Install cell links to the target README's install section instead,
|
|
332
|
+
// as do go-cli and go-mcp, which the Go proxy cannot install.
|
|
333
|
+
if (pkgTargets.length > 0) {
|
|
334
|
+
Content(`## Packages
|
|
378
335
|
|
|
379
336
|
| Language | Package | Install |
|
|
380
337
|
| --- | --- | --- |
|
|
381
338
|
`)
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
`
|
|
401
|
-
}
|
|
402
|
-
Content(
|
|
339
|
+
pkgTargets.forEach((tgt: any) => {
|
|
340
|
+
const state = registryState(model, tgt.name)
|
|
341
|
+
const readme = fact(tgt, 'docs').readme
|
|
342
|
+
let cell: string
|
|
343
|
+
if ('active' === state) {
|
|
344
|
+
const cmd = installCommand(tgt, model)
|
|
345
|
+
cell = cmd
|
|
346
|
+
? '`' + cmd + '`'
|
|
347
|
+
: readme ? `see [${tgt.name}/README.md](${tgt.name}/README.md#install)` : `see \`${tgt.name}/\``
|
|
348
|
+
} else if ('tag' === state) {
|
|
349
|
+
const cmd = vendorCommand(model, tgt.name)
|
|
350
|
+
cell = cmd
|
|
351
|
+
? '`' + cmd + '`'
|
|
352
|
+
: 'build from source — ' + (readme ? `[${tgt.name}/README.md](${tgt.name}/README.md)` : `\`${tgt.name}/\``)
|
|
353
|
+
} else {
|
|
354
|
+
// The target README always gives a route that works without a
|
|
355
|
+
// tag, which a repository may not have.
|
|
356
|
+
cell = readme ? `publish pending — [install from source](${tgt.name}/README.md#install)` :
|
|
357
|
+
`publish pending — install from source in \`${tgt.name}/\``
|
|
358
|
+
}
|
|
359
|
+
Content(`| ${fact(tgt, 'title')} | \`${packageName(model, tgt.name)}\` | ${cell} |
|
|
403
360
|
`)
|
|
404
|
-
}
|
|
361
|
+
})
|
|
362
|
+
Content(`
|
|
363
|
+
`)
|
|
364
|
+
}
|
|
365
|
+
})
|
|
405
366
|
|
|
406
|
-
if (leadTarget) {
|
|
407
|
-
Content(`## Quickstart
|
|
408
367
|
|
|
409
|
-
|
|
368
|
+
const ReadmeTopQuickstart = cmp(function ReadmeTopQuickstart(props: any) {
|
|
369
|
+
const { model, ctx$, leadTarget } = props.s
|
|
410
370
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
LeadQuick['ReadmeTopQuick']({ target: leadTarget })
|
|
416
|
-
}
|
|
417
|
-
const placement = credentialPlacement(model)
|
|
418
|
-
Content(`
|
|
419
|
-
${'' === placement ? '' : placement + '\n\n'}See the [${leadTarget.title} README](${leadTarget.name}/README.md) for the full guide.
|
|
371
|
+
if (leadTarget) {
|
|
372
|
+
Content(`## Quickstart
|
|
373
|
+
|
|
374
|
+
### ${fact(leadTarget, 'title')}
|
|
420
375
|
|
|
421
376
|
`)
|
|
377
|
+
const LeadQuick =
|
|
378
|
+
optionalComponent(ctx$, leadTarget, 'ReadmeTopQuick')
|
|
379
|
+
if (LeadQuick) {
|
|
380
|
+
LeadQuick['ReadmeTopQuick']({ target: leadTarget })
|
|
422
381
|
}
|
|
382
|
+
const placement = credentialPlacement(model)
|
|
383
|
+
Content(`
|
|
384
|
+
${'' === placement ? '' : placement + '\n\n'}${fact(leadTarget, 'docs').readme ?
|
|
385
|
+
`See the [${fact(leadTarget, 'title')} README](${leadTarget.name}/README.md) for the full guide.` : ''}
|
|
386
|
+
|
|
387
|
+
`)
|
|
388
|
+
}
|
|
389
|
+
})
|
|
423
390
|
|
|
424
|
-
|
|
425
|
-
|
|
391
|
+
|
|
392
|
+
const ReadmeTopSurfaces = cmp(function ReadmeTopSurfaces(props: any) {
|
|
393
|
+
const { hasCli, hasMcp, cliTargets, mcpTargets, sdkTargets, consumerTargets, langList } = props.s
|
|
394
|
+
const paths = (targets: any[]) => targets.map((t: any) => `\`${t.name}/\``).join(' ')
|
|
395
|
+
|
|
396
|
+
if (sdkTargets.length > 0 || hasCli || hasMcp || consumerTargets.length > 0) {
|
|
397
|
+
Content(`## Surfaces
|
|
426
398
|
|
|
427
399
|
| Surface | Path |
|
|
428
400
|
| --- | --- |
|
|
429
401
|
`)
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
Content(`| **SDK** (${langList}) | ${paths} |
|
|
402
|
+
if (sdkTargets.length > 0) {
|
|
403
|
+
Content(`| **SDK** (${langList}) | ${paths(sdkTargets)} |
|
|
433
404
|
`)
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
405
|
+
}
|
|
406
|
+
if (hasCli) {
|
|
407
|
+
Content(`| **CLI** | ${paths(cliTargets)} |
|
|
437
408
|
`)
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
409
|
+
}
|
|
410
|
+
if (hasMcp) {
|
|
411
|
+
Content(`| **MCP server** | ${paths(mcpTargets)} |
|
|
441
412
|
`)
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
413
|
+
}
|
|
414
|
+
consumerTargets.forEach((t: any) => {
|
|
415
|
+
Content(`| **${fact(t, 'title')}** | \`${t.name}/\` |
|
|
445
416
|
`)
|
|
446
|
-
|
|
447
|
-
|
|
417
|
+
})
|
|
418
|
+
Content(`
|
|
448
419
|
`)
|
|
449
|
-
|
|
420
|
+
}
|
|
421
|
+
})
|
|
450
422
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
423
|
+
|
|
424
|
+
const ReadmeTopMcp = cmp(function ReadmeTopMcp(props: any) {
|
|
425
|
+
const { model, hasMcp, mcpTargets } = props.s
|
|
426
|
+
|
|
427
|
+
if (hasMcp) {
|
|
428
|
+
const mcp = mcpTargets[0].name
|
|
429
|
+
const mcpOps = mcpTools(model, mcp).map((tool) => tool.op)
|
|
430
|
+
const mcpWrite = true === mcpTargets[0].tool?.write
|
|
431
|
+
const toggle = `\`main: kit: target: '${mcp}': tool: write: true\``
|
|
432
|
+
const opText = mcpOps.length < 2 ? mcpOps.join('') :
|
|
433
|
+
mcpOps.slice(0, -1).join(', ') + ' and ' + mcpOps[mcpOps.length - 1]
|
|
434
|
+
// What the server reads and writes is what it registers, not the flag.
|
|
435
|
+
const reads = mcpOps.some((op) => MCP_WRITE_OPS.includes(op)) ? '' : mcpWrite ?
|
|
436
|
+
' It only reads, as no entity has a create, update, patch or remove a plain call runs.' :
|
|
437
|
+
` It only reads: create, update, patch and remove become tools when the SDK's model sets
|
|
461
438
|
${toggle}.`
|
|
462
|
-
|
|
439
|
+
Content(0 === mcpOps.length ? `## Use it from an AI agent (MCP)
|
|
463
440
|
|
|
464
441
|
The generated MCP server has no tools for this SDK: no entity has a list or
|
|
465
442
|
load a plain call runs${mcpWrite ? ', or a create, update, patch or remove' :
|
|
466
|
-
|
|
443
|
+
`, and create, update, patch and remove are off until the SDK's model sets
|
|
467
444
|
${toggle}`}.
|
|
468
445
|
|
|
469
446
|
` : `## Use it from an AI agent (MCP)
|
|
@@ -473,7 +450,7 @@ The generated MCP server exposes this SDK's ${opText} operations as
|
|
|
473
450
|
can call directly.${reads} Build and register it:
|
|
474
451
|
|
|
475
452
|
\`\`\`bash
|
|
476
|
-
cd
|
|
453
|
+
cd ${mcp} && go build -o ${model.name}-mcp .
|
|
477
454
|
\`\`\`
|
|
478
455
|
|
|
479
456
|
Then add it to your agent's MCP config (Claude Desktop, Cursor, etc.):
|
|
@@ -489,10 +466,15 @@ Then add it to your agent's MCP config (Claude Desktop, Cursor, etc.):
|
|
|
489
466
|
\`\`\`
|
|
490
467
|
|
|
491
468
|
`)
|
|
492
|
-
|
|
469
|
+
}
|
|
470
|
+
})
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
const ReadmeTopEntities = cmp(function ReadmeTopEntities(props: any) {
|
|
474
|
+
const { activeEntities } = props.s
|
|
493
475
|
|
|
494
|
-
|
|
495
|
-
|
|
476
|
+
if (activeEntities.length > 0) {
|
|
477
|
+
Content(`## Entities
|
|
496
478
|
|
|
497
479
|
The API exposes ${activeEntities.length === 1 ? 'one entity' : activeEntities.length + ' entities'}:
|
|
498
480
|
|
|
@@ -500,48 +482,56 @@ The API exposes ${activeEntities.length === 1 ? 'one entity' : activeEntities.le
|
|
|
500
482
|
| --- | --- | --- |
|
|
501
483
|
`)
|
|
502
484
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
485
|
+
activeEntities.map((ent: any) => {
|
|
486
|
+
const ops = ent.op || {}
|
|
487
|
+
const opNames = Object.keys(ops).filter((o: string) => (ops as any)[o]?.active !== false)
|
|
488
|
+
const entdesc = fact(ent, 'desc').cell ||
|
|
489
|
+
`The ${ent.Name} entity${opNames.length ? ' (' + opNames.join(', ') + ')' : ''}.`
|
|
490
|
+
const path = entityPath(ent)
|
|
491
|
+
Content(`| **${ent.Name}** | ${entdesc} | \`${path}\` |
|
|
510
492
|
`)
|
|
511
|
-
|
|
493
|
+
})
|
|
512
494
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
495
|
+
const opUnion = new Set<string>()
|
|
496
|
+
activeEntities.forEach((e: any) => Object.keys(e.op || {})
|
|
497
|
+
.forEach((o: string) => { if ((e.op as any)[o]?.active !== false) opUnion.add(o) }))
|
|
498
|
+
const opAvail = ['load', 'list', 'create', 'update', 'patch', 'remove'].filter((o) => opUnion.has(o))
|
|
499
|
+
const opBold = (opAvail.length ? opAvail : ['load', 'list']).map((o) => '**' + o + '**').join(', ')
|
|
500
|
+
Content(`
|
|
519
501
|
The operations available across these entities are ${opBold} — see each entity's
|
|
520
502
|
own list above for exactly which it supports.
|
|
521
503
|
|
|
522
504
|
`)
|
|
523
|
-
|
|
505
|
+
}
|
|
506
|
+
})
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
const ReadmeTopOtherLanguages = cmp(function ReadmeTopOtherLanguages(props: any) {
|
|
510
|
+
const { ctx$, sdkTargets, leadTarget } = props.s
|
|
524
511
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
512
|
+
const otherTargets = sdkTargets.filter((t: any) => leadTarget && t.name !== leadTarget.name)
|
|
513
|
+
if (otherTargets.length > 0) {
|
|
514
|
+
Content(`## Quickstart in other languages
|
|
528
515
|
|
|
529
516
|
`)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
517
|
+
otherTargets.forEach((tgt: any) => {
|
|
518
|
+
const Quick =
|
|
519
|
+
optionalComponent(ctx$, tgt, 'ReadmeTopQuick')
|
|
520
|
+
if (Quick) {
|
|
521
|
+
Content(`### ${fact(tgt, 'title')}
|
|
535
522
|
|
|
536
523
|
`)
|
|
537
|
-
|
|
538
|
-
|
|
524
|
+
Quick['ReadmeTopQuick']({ target: tgt })
|
|
525
|
+
Content(`
|
|
539
526
|
`)
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
527
|
+
}
|
|
528
|
+
})
|
|
529
|
+
}
|
|
530
|
+
})
|
|
543
531
|
|
|
544
|
-
|
|
532
|
+
|
|
533
|
+
const ReadmeTopDirect = cmp(function ReadmeTopDirect() {
|
|
534
|
+
Content(`## Direct and prepare
|
|
545
535
|
|
|
546
536
|
For endpoints the entity model doesn't cover, use the low-level methods:
|
|
547
537
|
|
|
@@ -552,8 +542,13 @@ Both accept a map with \`path\`, \`method\`, \`params\`, \`query\`,
|
|
|
552
542
|
\`headers\`, and \`body\`. See the [How-to guides](#how-to-guides) below.
|
|
553
543
|
|
|
554
544
|
`)
|
|
545
|
+
})
|
|
555
546
|
|
|
556
|
-
|
|
547
|
+
|
|
548
|
+
const ReadmeTopHowtoGuides = cmp(function ReadmeTopHowtoGuides(props: any) {
|
|
549
|
+
const { ctx$, sdkTargets } = props.s
|
|
550
|
+
|
|
551
|
+
Content(`## How-to guides
|
|
557
552
|
|
|
558
553
|
### Make a direct API call
|
|
559
554
|
|
|
@@ -561,70 +556,79 @@ When the entity interface does not cover an endpoint, use \`direct\`:
|
|
|
561
556
|
|
|
562
557
|
`)
|
|
563
558
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
559
|
+
sdkTargets.forEach((tgt: any) => {
|
|
560
|
+
const Howto =
|
|
561
|
+
optionalComponent(ctx$, tgt, 'ReadmeTopHowto')
|
|
562
|
+
if (Howto) {
|
|
563
|
+
Howto['ReadmeTopHowto']({ target: tgt })
|
|
564
|
+
}
|
|
565
|
+
})
|
|
566
|
+
})
|
|
567
|
+
|
|
571
568
|
|
|
572
|
-
|
|
569
|
+
const ReadmeTopAdvanced = cmp(function ReadmeTopAdvanced(props: any) {
|
|
570
|
+
const { feature } = props.s
|
|
571
|
+
|
|
572
|
+
Content(`## Advanced
|
|
573
573
|
|
|
574
574
|
> Everyday use only needs the sections above. This explains the internals
|
|
575
575
|
> behind every call — relevant when writing custom features.
|
|
576
576
|
|
|
577
|
-
Every
|
|
577
|
+
Every entity operation runs the same ${pipelineLength()}-stage pipeline:
|
|
578
578
|
|
|
579
|
-
1. **
|
|
580
|
-
2. **Spec** — build the HTTP specification (URL, method, headers, body).
|
|
581
|
-
3. **Request** — send the HTTP request.
|
|
582
|
-
4. **Response** — receive and parse the response.
|
|
583
|
-
5. **Result** — extract the result data for the caller.
|
|
579
|
+
${PIPELINE_STAGES.map((s, i) => (i + 1) + '. **' + s.name + '** — ' + s.purpose).join('\n')}
|
|
584
580
|
|
|
585
|
-
A feature hook fires
|
|
586
|
-
\`
|
|
581
|
+
A feature hook fires before each stage (e.g. \`${PIPELINE_STAGES[0].hook}\`, \`${PIPELINE_STAGES[1].hook}\`,
|
|
582
|
+
\`${PIPELINE_STAGES[2].hook}\`), so features can inspect or modify the pipeline without
|
|
587
583
|
forking the SDK.
|
|
588
584
|
|
|
589
|
-
### Features
|
|
590
|
-
|
|
591
585
|
`)
|
|
592
586
|
|
|
593
|
-
|
|
587
|
+
const active = each(feature).filter((feat: any) => feat.active)
|
|
588
|
+
if (0 < active.length) {
|
|
589
|
+
Content(`### Features
|
|
590
|
+
|
|
591
|
+
| Feature | Purpose |
|
|
594
592
|
| --- | --- |
|
|
595
593
|
`)
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
const purpose = feat.title || feat.Name || feat.name
|
|
594
|
+
for (const feat of active) {
|
|
595
|
+
const purpose = fact(feat, 'title').cell || feat.Name || feat.name
|
|
599
596
|
Content(`| **${feat.Name || feat.name}Feature** | ${purpose} |
|
|
600
597
|
`)
|
|
601
|
-
}
|
|
602
|
-
|
|
598
|
+
}
|
|
603
599
|
Content(`
|
|
604
|
-
|
|
600
|
+
`)
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
Content(`Pass custom features via the \`extend\` option at construction time.
|
|
605
604
|
|
|
606
605
|
`)
|
|
606
|
+
})
|
|
607
|
+
|
|
607
608
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
609
|
+
const ReadmeTopCustomizing = cmp(function ReadmeTopCustomizing(props: any) {
|
|
610
|
+
const { model, sdkTargets, docTargets, definition } = props.s
|
|
611
|
+
|
|
612
|
+
// 11c. Customization: model-driven declarations, in-repo templates and
|
|
613
|
+
// components, regeneration that overwrites, customising in `.sdk`, and a
|
|
614
|
+
// map of which paths are the project's to edit. Every SDK repo carries
|
|
615
|
+
// its own generator, so this belongs in every README. A repository that
|
|
616
|
+
// regenerates `.sdk` in full says so, since its copies do not merge.
|
|
617
|
+
const mapTarget = sdkTargets[0] || docTargets[0]
|
|
618
|
+
const targetDir = mapTarget ? `\`<target>/\`, such as \`${mapTarget.name}/\`` : `\`<target>/\``
|
|
619
|
+
const merging = MERGE === copyMode(model.main?.[KIT]?.copies)
|
|
620
|
+
const mergeNote = merging ?
|
|
621
|
+
`An add merges toolchain updates into the
|
|
618
622
|
edited copies, and \`voxgig-sdkgen doctor\` reports any drift from what a
|
|
619
623
|
resync would write.` :
|
|
620
|
-
|
|
624
|
+
`This repository regenerates \`.sdk\` in full
|
|
621
625
|
(\`main: kit: copies: 'overwrite'\`): set it to \`'merge'\` before
|
|
622
626
|
customising, so that an add merges toolchain updates into the edited
|
|
623
627
|
copies.`
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
+
const copiesRow = merging ?
|
|
629
|
+
`Yes. They are this project's copies, and \`target add\` merges toolchain updates into your edits.` :
|
|
630
|
+
`Only after setting \`copies\` to \`'merge'\`. This repository regenerates them in full.`
|
|
631
|
+
Content(`## Customizing this SDK
|
|
628
632
|
|
|
629
633
|
This repository contains its own generator (\`.sdk/\`), so the SDK is
|
|
630
634
|
customizable without forking any upstream tool:
|
|
@@ -658,7 +662,7 @@ customizable without forking any upstream tool:
|
|
|
658
662
|
| \`.sdk/model/text.aontu\` | The README wording, in \`main.kit.text\`: the tagline, the summary and the entity descriptions | Yes. The scaffold writes it once and never again. |
|
|
659
663
|
| \`.sdk/model/guide/guide.aontu\` | How the spec's paths map onto entities and operations | Yes. The scaffold writes it once and never again. |
|
|
660
664
|
| \`.sdk/model/\`, the rest | The API model built from the spec, and the target and feature definitions | Not by hand. Generation, \`target add\` and a new scaffold run rewrite it, apart from a feature or target this project defines itself. |
|
|
661
|
-
| \`.sdk/def/\` | The
|
|
665
|
+
| \`.sdk/def/\` | The ${definition} | Replace it when the API changes. Generation rebuilds the model from it. |
|
|
662
666
|
| \`.sdk/src/cmp/<target>/\`, \`.sdk/tm/<target>/\` | The components and templates that generate each target | ${copiesRow} |
|
|
663
667
|
| \`.sdk/test/\` | The shared test cases the generated tests run | No. |
|
|
664
668
|
| ${targetDir} | One generated SDK per target, with its own tests | No. Generation overwrites it. |
|
|
@@ -681,62 +685,199 @@ How-to: [customize and propagate templates](https://github.com/voxgig/sdkgen/blo
|
|
|
681
685
|
The full story: [voxgig.com/sdk/custom](https://voxgig.com/sdk/custom).
|
|
682
686
|
|
|
683
687
|
`)
|
|
688
|
+
})
|
|
684
689
|
|
|
685
|
-
|
|
686
|
-
|
|
690
|
+
|
|
691
|
+
const ReadmeTopPerLanguage = cmp(function ReadmeTopPerLanguage(props: any) {
|
|
692
|
+
const { docTargets } = props.s
|
|
693
|
+
|
|
694
|
+
if (docTargets.length > 0) {
|
|
695
|
+
Content(`## Per-language documentation
|
|
687
696
|
|
|
688
697
|
`)
|
|
689
|
-
|
|
690
|
-
|
|
698
|
+
docTargets.filter((tgt: any) => fact(tgt, 'docs').readme).forEach((tgt: any) => {
|
|
699
|
+
Content(`- [${fact(tgt, 'title')}](${tgt.name}/README.md)
|
|
691
700
|
`)
|
|
692
|
-
|
|
693
|
-
|
|
701
|
+
})
|
|
702
|
+
Content(`
|
|
694
703
|
`)
|
|
695
|
-
|
|
704
|
+
}
|
|
705
|
+
})
|
|
696
706
|
|
|
697
|
-
const upstreamUrl = (info.contact && info.contact.url)
|
|
698
|
-
|| (info.servers && info.servers[0] && info.servers[0].url)
|
|
699
|
-
|| homepage
|
|
700
|
-
Content(`## Upstream API
|
|
701
707
|
|
|
702
|
-
|
|
703
|
-
|
|
708
|
+
const ReadmeTopUpstream = cmp(function ReadmeTopUpstream(props: any) {
|
|
709
|
+
const { text, definition, definitionFull, model } = props.s
|
|
710
|
+
const upstream = text.upstream
|
|
711
|
+
const docs = text.docs_url
|
|
712
|
+
Content(`## Upstream API
|
|
704
713
|
|
|
705
|
-
|
|
714
|
+
This SDK is generated from the upstream ${definitionFull}.${publisherInfo(model).official ? '' : ` It is an
|
|
715
|
+
unofficial client and is not affiliated with the API provider.`}
|
|
716
|
+
|
|
717
|
+
The ${definition}(s) this SDK was generated from are kept in the
|
|
706
718
|
[\`.sdk/def/\`](.sdk/def/) folder.
|
|
707
719
|
|
|
708
720
|
`)
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
721
|
+
if (upstream.raw) {
|
|
722
|
+
// A per-tenant server URL carries an OpenAPI server variable —
|
|
723
|
+
// `https://{instance}.dreamapply.com/api` — and is the right thing to
|
|
724
|
+
// SHOW, because it tells the reader the host is theirs to fill in. It is
|
|
725
|
+
// not a thing to LINK: the braces are not a resolvable address, so a
|
|
726
|
+
// markdown link renders as clickable and dead. Show it as code instead.
|
|
727
|
+
const templated = /[{}]/.test(upstream.raw)
|
|
728
|
+
Content(templated
|
|
729
|
+
? `- Upstream API: ${upstream.code}
|
|
718
730
|
`
|
|
719
|
-
|
|
731
|
+
: `- Upstream API: [${upstream.inline}](${upstream.link})
|
|
720
732
|
`)
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
733
|
+
}
|
|
734
|
+
if (docs.raw && docs.raw !== upstream.raw) {
|
|
735
|
+
Content(`- Documentation: [${docs.inline}](${docs.link})
|
|
724
736
|
`)
|
|
725
|
-
|
|
726
|
-
|
|
737
|
+
}
|
|
738
|
+
Content(`
|
|
727
739
|
`)
|
|
740
|
+
})
|
|
728
741
|
|
|
729
|
-
|
|
742
|
+
|
|
743
|
+
const ReadmeTopSecurity = cmp(function ReadmeTopSecurity(props: any) {
|
|
744
|
+
const { model } = props.s
|
|
745
|
+
|
|
746
|
+
Content(`## Security
|
|
730
747
|
|
|
731
748
|
Please report security issues ${securityContact(model)}. See [SECURITY.md](SECURITY.md).
|
|
732
749
|
Do not open public issues for suspected vulnerabilities.
|
|
733
750
|
|
|
734
751
|
`)
|
|
752
|
+
})
|
|
753
|
+
|
|
735
754
|
|
|
736
|
-
|
|
755
|
+
const ReadmeTopFooter = cmp(function ReadmeTopFooter(props: any) {
|
|
756
|
+
const { productName, definition } = props.s
|
|
737
757
|
|
|
738
|
-
|
|
758
|
+
Content(`---
|
|
759
|
+
|
|
760
|
+
Generated from the ${productName} ${definition} by [@voxgig/sdkgen](${SDKGEN_REPO}).
|
|
739
761
|
`)
|
|
762
|
+
})
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
const ReadmeTop = cmp(function ReadmeTop(props: any) {
|
|
766
|
+
const { ctx$ } = props
|
|
767
|
+
const { model } = ctx$
|
|
768
|
+
|
|
769
|
+
if (model.name && !model.Name) names(model, model.name)
|
|
770
|
+
|
|
771
|
+
const info = modelText(model)
|
|
772
|
+
const def = (model.main && model.main.def) || {}
|
|
773
|
+
|
|
774
|
+
const text = fact(model.main[KIT], 'text')
|
|
775
|
+
|
|
776
|
+
const productName = fact(model.main[KIT], 'apiName').inline
|
|
777
|
+
|
|
778
|
+
const kind = fact(model.main[KIT], 'definitionKind')
|
|
779
|
+
const definition = definitionName(kind)
|
|
780
|
+
const definitionFull = definitionName(kind, true)
|
|
781
|
+
|
|
782
|
+
const tagline = text.tagline.inline
|
|
783
|
+
|| `${productName} client, generated from the ${definition}.`
|
|
784
|
+
|
|
785
|
+
const aboutMd = text.about_md.text
|
|
786
|
+
|
|
787
|
+
const apiSummary = text.summary.inline
|
|
788
|
+
const websiteLine = text.website.raw
|
|
789
|
+
? `Learn more about ${productName} at [${text.website.label}](${text.website.link}).`
|
|
790
|
+
: ''
|
|
791
|
+
|
|
792
|
+
// Attribution for API metadata sourced from a third-party catalogue (e.g.
|
|
793
|
+
// freepublicapis.com). Rendered only when the model carries an
|
|
794
|
+
// `info.meta_source` URL, so first-party SDKs never show it. The link points
|
|
795
|
+
// back to the catalogue that kindly supplied the metadata.
|
|
796
|
+
const metaSourceLine = text.meta_source.raw
|
|
797
|
+
? `Metadata kindly supplied by [${text.meta_source.label}](${text.meta_source.link}).`
|
|
798
|
+
: ''
|
|
799
|
+
|
|
800
|
+
const entity = getModelPath(model, `main.${KIT}.entity`)
|
|
801
|
+
const target = getModelPath(model, `main.${KIT}.target`)
|
|
802
|
+
const feature = getModelPath(model, `main.${KIT}.feature`)
|
|
803
|
+
|
|
804
|
+
each(entity, (ent: any) => { if (!ent.Name) names(ent, ent.name) })
|
|
805
|
+
each(feature, (feat: any) => { if (!feat.Name) names(feat, feat.name) })
|
|
806
|
+
|
|
807
|
+
const activeEntities = each(entity).filter((e: any) => e.active !== false)
|
|
808
|
+
const activeTargets = fact(model.main[KIT], 'active').map((name: string) => target[name])
|
|
809
|
+
|
|
810
|
+
const cliTargets = activeTargets.filter((t: any) => 'cli' === surfaceOf(t))
|
|
811
|
+
const mcpTargets = activeTargets.filter((t: any) => 'mcp' === surfaceOf(t))
|
|
812
|
+
const hasCli = 0 < cliTargets.length
|
|
813
|
+
const hasMcp = 0 < mcpTargets.length
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
const ordered = documentOrder(model, activeTargets)
|
|
817
|
+
|
|
818
|
+
const isCliOrMcp = (t: any) => ['cli', 'mcp'].includes(surfaceOf(t))
|
|
819
|
+
|
|
820
|
+
const sdkTargets = ordered.filter((t: any) => 'sdk' === surfaceOf(t))
|
|
821
|
+
|
|
822
|
+
// The CLI and the MCP server have surfaces of their own below.
|
|
823
|
+
const consumerTargets = ordered.filter((t: any) => 'sdk' !== surfaceOf(t) && !isCliOrMcp(t))
|
|
824
|
+
|
|
825
|
+
const docTargets = ordered.filter((t: any) => !isCliOrMcp(t))
|
|
826
|
+
|
|
827
|
+
const pkgTargets = ordered.filter((t: any) => hasPackageName(model, t.name))
|
|
828
|
+
|
|
829
|
+
const langList = sdkTargets.map((t: any) => fact(t, 'title')).join(', ')
|
|
830
|
+
const leadTarget = pickLeadTarget(sdkTargets)
|
|
831
|
+
|
|
832
|
+
const s = {
|
|
833
|
+
model,
|
|
834
|
+
ctx$,
|
|
835
|
+
info,
|
|
836
|
+
def,
|
|
837
|
+
text,
|
|
838
|
+
productName,
|
|
839
|
+
definition,
|
|
840
|
+
definitionFull,
|
|
841
|
+
tagline,
|
|
842
|
+
aboutMd,
|
|
843
|
+
apiSummary,
|
|
844
|
+
websiteLine,
|
|
845
|
+
metaSourceLine,
|
|
846
|
+
feature,
|
|
847
|
+
activeEntities,
|
|
848
|
+
hasCli,
|
|
849
|
+
hasMcp,
|
|
850
|
+
cliTargets,
|
|
851
|
+
mcpTargets,
|
|
852
|
+
sdkTargets,
|
|
853
|
+
consumerTargets,
|
|
854
|
+
docTargets,
|
|
855
|
+
pkgTargets,
|
|
856
|
+
langList,
|
|
857
|
+
leadTarget,
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
File({ name: 'README.md' }, () => {
|
|
861
|
+
ReadmeTopTitle({ s })
|
|
862
|
+
ReadmeTopSurfaceLine({ s })
|
|
863
|
+
ReadmeTopFeatureLine({ s })
|
|
864
|
+
ReadmeTopAbout({ s })
|
|
865
|
+
ReadmeTopEntityModel({ s })
|
|
866
|
+
ReadmeTopTesting({ s })
|
|
867
|
+
ReadmeTopPackages({ s })
|
|
868
|
+
ReadmeTopQuickstart({ s })
|
|
869
|
+
ReadmeTopSurfaces({ s })
|
|
870
|
+
ReadmeTopMcp({ s })
|
|
871
|
+
ReadmeTopEntities({ s })
|
|
872
|
+
ReadmeTopOtherLanguages({ s })
|
|
873
|
+
ReadmeTopDirect({ s })
|
|
874
|
+
ReadmeTopHowtoGuides({ s })
|
|
875
|
+
ReadmeTopAdvanced({ s })
|
|
876
|
+
ReadmeTopCustomizing({ s })
|
|
877
|
+
ReadmeTopPerLanguage({ s })
|
|
878
|
+
ReadmeTopUpstream({ s })
|
|
879
|
+
ReadmeTopSecurity({ s })
|
|
880
|
+
ReadmeTopFooter({ s })
|
|
740
881
|
})
|
|
741
882
|
})
|
|
742
883
|
|