@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/action/target.ts
CHANGED
|
@@ -554,32 +554,23 @@ function trimFeatures(
|
|
|
554
554
|
}
|
|
555
555
|
|
|
556
556
|
|
|
557
|
+
type TargetFeature = { trim: boolean, fullset: string[] }
|
|
558
|
+
|
|
559
|
+
|
|
557
560
|
function readTargetFeature(
|
|
558
561
|
ctx$: any,
|
|
559
562
|
tfolder: string,
|
|
560
563
|
torigname: string,
|
|
561
564
|
tname: string,
|
|
562
|
-
):
|
|
565
|
+
): TargetFeature {
|
|
563
566
|
const { log } = ctx$
|
|
564
567
|
const fs = ctx$.fs()
|
|
565
568
|
|
|
566
569
|
const path = definitionPathAny(fs, tfolder, 'target', torigname)
|
|
567
570
|
|
|
571
|
+
let source: TargetFeature
|
|
568
572
|
try {
|
|
569
|
-
|
|
570
|
-
const src = migrateIncludes(fs.readFileSync(path, 'utf8'))
|
|
571
|
-
const model = new Aontu().generate(src, { path, errs })
|
|
572
|
-
|
|
573
|
-
if (0 < errs.length) {
|
|
574
|
-
throw new Error(errs.map((e: any) => e.msg || String(e)).join('\n'))
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
const feature = model?.main?.[KIT]?.target?.[torigname]?.feature ?? {}
|
|
578
|
-
|
|
579
|
-
return {
|
|
580
|
-
trim: false !== feature.trim,
|
|
581
|
-
fullset: Array.isArray(feature.fullset) ? feature.fullset : [],
|
|
582
|
-
}
|
|
573
|
+
source = compiledTargetFeature(fs, path, torigname)
|
|
583
574
|
}
|
|
584
575
|
catch (err: any) {
|
|
585
576
|
log.warn({
|
|
@@ -590,6 +581,66 @@ function readTargetFeature(
|
|
|
590
581
|
})
|
|
591
582
|
return { trim: false, fullset: [] }
|
|
592
583
|
}
|
|
584
|
+
|
|
585
|
+
const own = projectTargetFeature(ctx$, tname)
|
|
586
|
+
|
|
587
|
+
return {
|
|
588
|
+
trim: own.trim ?? source.trim,
|
|
589
|
+
fullset: own.fullset ?? source.fullset,
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
function compiledTargetFeature(fs: any, path: string, name: string): TargetFeature {
|
|
595
|
+
const errs: any[] = []
|
|
596
|
+
const src = migrateIncludes(fs.readFileSync(path, 'utf8'))
|
|
597
|
+
const model = new Aontu().generate(src, { path, errs })
|
|
598
|
+
|
|
599
|
+
if (0 < errs.length) {
|
|
600
|
+
throw new Error(errs.map((e: any) => e.msg || String(e)).join('\n'))
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
const feature = model?.main?.[KIT]?.target?.[name]?.feature ?? {}
|
|
604
|
+
|
|
605
|
+
return {
|
|
606
|
+
trim: false !== feature.trim,
|
|
607
|
+
fullset: Array.isArray(feature.fullset) ? feature.fullset : [],
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
// What the project sets for itself: where its compiled model differs from
|
|
613
|
+
// the copy of the target file it holds, the setting comes from elsewhere in
|
|
614
|
+
// its model and survives the re-add, so the add must follow it as generate
|
|
615
|
+
// does. Anything else came with the copy, and the incoming copy replaces it.
|
|
616
|
+
function projectTargetFeature(ctx$: any, tname: string): Partial<TargetFeature> {
|
|
617
|
+
const compiled = ctx$.model?.main?.[KIT]?.target?.[tname]?.feature
|
|
618
|
+
if (null == compiled) {
|
|
619
|
+
return {}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
const fs = ctx$.fs()
|
|
623
|
+
const path = definitionPathAny(fs, ctx$.folder ?? '.', 'target', tname)
|
|
624
|
+
|
|
625
|
+
let copied: TargetFeature = { trim: true, fullset: [] }
|
|
626
|
+
if (fs.existsSync(path)) {
|
|
627
|
+
try {
|
|
628
|
+
copied = compiledTargetFeature(fs, path, tname)
|
|
629
|
+
}
|
|
630
|
+
catch (_err) {
|
|
631
|
+
return {}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
const own: Partial<TargetFeature> = {}
|
|
636
|
+
if ('boolean' === typeof compiled.trim && compiled.trim !== copied.trim) {
|
|
637
|
+
own.trim = compiled.trim
|
|
638
|
+
}
|
|
639
|
+
if (Array.isArray(compiled.fullset) &&
|
|
640
|
+
JSON.stringify(compiled.fullset) !== JSON.stringify(copied.fullset)) {
|
|
641
|
+
own.fullset = [...compiled.fullset]
|
|
642
|
+
}
|
|
643
|
+
return own
|
|
593
644
|
}
|
|
594
645
|
|
|
595
646
|
|
package/src/admin/status.ts
CHANGED
|
@@ -2,6 +2,10 @@ import Fs from 'node:fs'
|
|
|
2
2
|
import Path from 'node:path'
|
|
3
3
|
import { spawnSync } from 'node:child_process'
|
|
4
4
|
|
|
5
|
+
import { applyFacts } from '../helpers/facts'
|
|
6
|
+
import { guardModel } from '../helpers/guardModel'
|
|
7
|
+
import { readOverride, runFolder, runPlace } from '../helpers/placement'
|
|
8
|
+
|
|
5
9
|
function command(cwd: string, bin: string, args: string[]) {
|
|
6
10
|
return spawnSync(bin, args, { cwd, encoding: 'utf8', timeout: 15000, windowsHide: true, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } })
|
|
7
11
|
}
|
|
@@ -21,8 +25,14 @@ function workingTree(folder: string) {
|
|
|
21
25
|
return state === null ? 'not a git repository' : state ? 'modified' : 'clean'
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
// The model a generate reads, which `sdk.json` is written before.
|
|
29
|
+
function prepare(model: any): string | undefined {
|
|
30
|
+
try { applyFacts(guardModel(model)) }
|
|
31
|
+
catch (err: any) { return 'Cannot prepare the compiled model: ' + err.message }
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
// Read the compiled model and working trees. Never fetch, build, test, or publish.
|
|
25
|
-
export function repositoryStatus(root: string) {
|
|
35
|
+
export function repositoryStatus(root: string, env: Record<string, string | undefined> = process.env) {
|
|
26
36
|
root = Path.resolve(root)
|
|
27
37
|
const sdk = Path.join(root, '.sdk')
|
|
28
38
|
if (!directory(sdk)) throw new Error('Expected an SDK repository containing .sdk: ' + root)
|
|
@@ -34,7 +44,11 @@ export function repositoryStatus(root: string) {
|
|
|
34
44
|
if (!model?.main?.kit) throw new Error('missing main.kit')
|
|
35
45
|
} catch (err: any) { modelError = 'Invalid compiled model: ' + err.message }
|
|
36
46
|
}
|
|
47
|
+
if (model && !modelError) modelError = prepare(model)
|
|
37
48
|
const kit = model?.main?.kit || {}
|
|
49
|
+
let override: any = {}, overridden: string[] = [], overrideError: string | undefined
|
|
50
|
+
try { ({ override, named: overridden } = readOverride(undefined, env.SDKGEN_EXTERNAL, Object.keys(kit.target || {}))) }
|
|
51
|
+
catch (err: any) { overrideError = err.message }
|
|
38
52
|
const upstream = git(root, ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'])
|
|
39
53
|
const counts = upstream && git(root, ['rev-list', '--left-right', '--count', 'HEAD...@{upstream}'])
|
|
40
54
|
const [ahead, behind] = counts ? counts.split(/\s+/).map(Number) : [null, null]
|
|
@@ -51,11 +65,15 @@ export function repositoryStatus(root: string) {
|
|
|
51
65
|
},
|
|
52
66
|
model: { path: file, compiled: !!model && !modelError, error: modelError,
|
|
53
67
|
generatedAt: Fs.existsSync(file) ? Fs.statSync(file).mtime.toISOString() : null },
|
|
68
|
+
override: { targets: overridden, error: overrideError },
|
|
54
69
|
toolchain: { node: process.version, packages },
|
|
55
70
|
targets: entries(kit.target).map(([name, target]) => {
|
|
56
|
-
const
|
|
71
|
+
const place = runPlace(target, override[name])
|
|
72
|
+
const folder = runFolder(target, name, root, override[name])
|
|
57
73
|
const present = directory(folder)
|
|
58
|
-
|
|
74
|
+
const intree = Path.resolve(root, name)
|
|
75
|
+
const stale = 'external' === place && intree !== folder && directory(intree) ? intree : null
|
|
76
|
+
return { name, active: target.active !== false, place, path: folder, present, stale,
|
|
59
77
|
state: workingTree(folder), readme: Fs.existsSync(Path.join(folder, 'README.md')),
|
|
60
78
|
version: target.publish?.version || null,
|
|
61
79
|
publication: target.publish?.registry?.state || 'not recorded',
|
|
@@ -95,7 +113,7 @@ export function main(args = process.argv.slice(2)): number {
|
|
|
95
113
|
}
|
|
96
114
|
if (!root || args.some(arg => !['--json', '--github'].includes(arg))) throw new Error('Usage: status.sh [--json] [--github]')
|
|
97
115
|
const report: any = repositoryStatus(root)
|
|
98
|
-
let failed = !!report.model.error
|
|
116
|
+
let failed = !!report.model.error || !!report.override.error
|
|
99
117
|
if (args.includes('--github')) {
|
|
100
118
|
try { report.github = githubStatus(report.root) }
|
|
101
119
|
catch (err: any) { report.github = { error: err.message }; failed = true }
|
|
@@ -107,8 +125,10 @@ export function main(args = process.argv.slice(2)): number {
|
|
|
107
125
|
console.log('Upstream: ' + (report.repository.upstream ? report.repository.upstream + ' | ahead ' + report.repository.ahead + ', behind ' + report.repository.behind + ' (local tracking refs)' : 'not configured'))
|
|
108
126
|
console.log('Model: ' + (report.model.error || (report.model.compiled ? 'compiled ' + report.model.generatedAt : 'not generated; run npm run generate from .sdk')))
|
|
109
127
|
console.log('Toolchain: Node ' + report.toolchain.node + '; ' + report.toolchain.packages.map((p: any) => p.name + ' ' + p.version).join('; '))
|
|
128
|
+
if (report.override.error) console.log('Override: ' + report.override.error)
|
|
129
|
+
else if (report.override.targets.length) console.log('Override: SDKGEN_EXTERNAL places ' + report.override.targets.join(', ') + ' for this run')
|
|
110
130
|
console.log('\nSDKs and tools (publication state comes from the model):')
|
|
111
|
-
for (const t of report.targets) console.log(' ' + t.name + ' | ' + (t.active ? 'active' : 'inactive') + ' | ' + t.state + ' | version ' + (t.version || 'not recorded') + ' | ' + t.publication + ' | ' + t.path)
|
|
131
|
+
for (const t of report.targets) console.log(' ' + t.name + ' | ' + (t.active ? 'active' : 'inactive') + ' | ' + t.state + ' | version ' + (t.version || 'not recorded') + ' | ' + t.publication + ' | ' + t.path + (t.stale ? ' | stale in-tree folder ' + t.stale : ''))
|
|
112
132
|
if (!report.targets.length) console.log(' No targets in the compiled model.')
|
|
113
133
|
console.log('\nDocumentation:')
|
|
114
134
|
for (const e of report.editions) console.log(' ' + e.name + ' | ' + (e.active ? 'active' : 'inactive') + ' | ' + (e.present ? 'present' : 'missing') + ' | ' + (e.path || 'no output path'))
|
package/src/cmp/AgentGuide.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { Content, File } from 'jostraca'
|
|
|
3
3
|
import { cmp } from '../helpers/component'
|
|
4
4
|
|
|
5
5
|
import { optionalComponent } from '../helpers/optional'
|
|
6
|
+
import { fact } from '../helpers/facts'
|
|
7
|
+
import { apiName } from '../helpers/packageMeta'
|
|
6
8
|
|
|
7
9
|
import {
|
|
8
10
|
activeFeatures,
|
|
@@ -12,8 +14,11 @@ import {
|
|
|
12
14
|
claudePointer,
|
|
13
15
|
featuresEnabled,
|
|
14
16
|
isDirLayout,
|
|
15
|
-
|
|
17
|
+
featureTemplates,
|
|
18
|
+
writesFeatureGuides,
|
|
16
19
|
featureHooks,
|
|
20
|
+
regenerationStatement,
|
|
21
|
+
copiesStatement,
|
|
17
22
|
} from './AgentGuideContent'
|
|
18
23
|
|
|
19
24
|
import { AgentGuideFeature } from './AgentGuideFeature'
|
|
@@ -29,34 +34,47 @@ const AgentGuide = cmp(function AgentGuide(props: any) {
|
|
|
29
34
|
|
|
30
35
|
const Name = projectName(model)
|
|
31
36
|
const lang = target.name
|
|
32
|
-
const title = target
|
|
33
|
-
const surface = langCmd(lang).note
|
|
37
|
+
const title = fact(target, 'title')
|
|
38
|
+
const surface = langCmd(lang, model).note
|
|
34
39
|
|
|
35
40
|
const features = activeFeatures(model, target)
|
|
36
41
|
const featuresOn = featuresEnabled(target)
|
|
37
42
|
const dirLayout = isDirLayout(target)
|
|
38
43
|
|
|
44
|
+
const place = fact(target, 'place')
|
|
45
|
+
const guide = fact(target, 'link').agents
|
|
46
|
+
const sdk = 'folder' === place ? '../.sdk' : 'root' === place ? '.sdk' :
|
|
47
|
+
null == ctx$.sdkrelpath ? '' : ctx$.sdkrelpath + '/.sdk'
|
|
48
|
+
const pathNote = 'folder' === place ?
|
|
49
|
+
`> Paths below (\`.sdk/…\`) are relative to the **project root** — one level up
|
|
50
|
+
> from this \`${lang}/\` directory.
|
|
51
|
+
|
|
52
|
+
` : 'external' === place ? `> Paths below (\`.sdk/…\`) are relative to the SDK project that generates
|
|
53
|
+
> this package.
|
|
54
|
+
|
|
55
|
+
` : ''
|
|
56
|
+
|
|
39
57
|
File({ name: 'AGENTS.md' }, () => {
|
|
40
58
|
Content(`# ${Name} ${title} — Agent Guide
|
|
41
59
|
|
|
42
60
|
${surface
|
|
43
|
-
? surface + '\n\nGenerated from the shared model
|
|
44
|
-
|
|
61
|
+
? surface + '\n\nGenerated from the shared model' +
|
|
62
|
+
('' === guide ? '.' : `; see the [project guide](${guide}) for the full workflow.`)
|
|
63
|
+
: `The ${title} client for the ${apiName(model)} API. This directory is **generated** — do not edit it by hand; change the model/template/component in \`.sdk/\` and regenerate.` +
|
|
64
|
+
('' === guide ? '' : ` See the [project guide](${guide}) for the full workflow and the aontu model language.`)}
|
|
45
65
|
|
|
46
|
-
|
|
47
|
-
> from this \`${lang}/\` directory.
|
|
66
|
+
${pathNote}## Regenerate this target
|
|
48
67
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
cd ../.sdk
|
|
53
|
-
npm run build # only if you changed a component
|
|
54
|
-
npm run generate # refreshes this ${lang}/ directory
|
|
68
|
+
${'' === sdk ? 'From the SDK project\'s `.sdk/` directory:\n\n' : ''}\`\`\`bash
|
|
69
|
+
${'' === sdk ? '' : 'cd ' + sdk + '\n'}npm run build # only if you changed a component
|
|
70
|
+
npm run generate # refreshes this ${'folder' === place ? lang + '/ directory' : 'target'}
|
|
55
71
|
\`\`\`
|
|
56
72
|
|
|
73
|
+
${regenerationStatement()}
|
|
74
|
+
|
|
57
75
|
Then build and test the generated output:
|
|
58
76
|
|
|
59
|
-
${langCommandsBlock(lang)}
|
|
77
|
+
${langCommandsBlock(lang, model)}
|
|
60
78
|
|
|
61
79
|
## What generates this target
|
|
62
80
|
|
|
@@ -69,6 +87,7 @@ ${langCommandsBlock(lang)}
|
|
|
69
87
|
Decision rule: *same for every API → template; depends on the API →
|
|
70
88
|
component.* After editing a component run \`npm run build\` before
|
|
71
89
|
\`npm run generate\`; template-only edits just need \`npm run generate\`.
|
|
90
|
+
${copiesStatement(model)}
|
|
72
91
|
|
|
73
92
|
`)
|
|
74
93
|
|
|
@@ -88,19 +107,27 @@ Each feature's runtime and its own guide live in \`src/feature/<name>/\`.
|
|
|
88
107
|
`)
|
|
89
108
|
}
|
|
90
109
|
else {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
110
|
+
const templates = featureTemplates(ctx$.fs(), target, features)
|
|
111
|
+
const shared = 0 === Object.keys(templates).length
|
|
112
|
+
Content(`Each feature's hooks and default activation come from
|
|
113
|
+
\`.sdk/model/feature/<name>.aontu\`. ${shared
|
|
114
|
+
? `This target has no template per
|
|
115
|
+
feature: customise its features in the runtime under \`.sdk/tm/${lang}/\`
|
|
116
|
+
and regenerate.`
|
|
117
|
+
: `Its runtime is generated from the template
|
|
118
|
+
listed here: customise that and regenerate.`}
|
|
119
|
+
|
|
120
|
+
| Feature | ${shared ? '' : 'Template | '}Active hooks |
|
|
121
|
+
| --- | ${shared ? '' : '--- | '}--- |
|
|
97
122
|
`)
|
|
98
123
|
features.forEach((f: any) => {
|
|
99
|
-
const
|
|
124
|
+
const template = templates[f.name]
|
|
100
125
|
const hooks = featureHooks(f)
|
|
101
126
|
const hookList = hooks.length ? hooks.map((h: string) => '\`' + h + '\`').join(', ') : '—'
|
|
102
127
|
const label = f.title ? `**${f.name}** — ${f.title}` : `**${f.name}**`
|
|
103
|
-
|
|
128
|
+
const where = shared ? '' :
|
|
129
|
+
(null == template ? '—' : '\`.sdk/tm/' + lang + '/' + template + '\`') + ' | '
|
|
130
|
+
Content(`| ${label} | ${where}${hookList} |
|
|
104
131
|
`)
|
|
105
132
|
})
|
|
106
133
|
Content(`
|
|
@@ -116,8 +143,8 @@ the runtime under \`.sdk/tm/${lang}/feature/\` and regenerate.
|
|
|
116
143
|
|
|
117
144
|
Content(`---
|
|
118
145
|
|
|
119
|
-
Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen)
|
|
120
|
-
[project guide](
|
|
146
|
+
Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen).${'' === guide ? '' : ` See the
|
|
147
|
+
[project guide](${guide}).`}
|
|
121
148
|
`)
|
|
122
149
|
})
|
|
123
150
|
|
|
@@ -129,7 +156,7 @@ Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen). See the
|
|
|
129
156
|
// where each feature has its own directory to hold the guide. Flat-layout
|
|
130
157
|
// targets document features inline above; phase-disabled targets
|
|
131
158
|
// (go-cli/go-mcp) get no feature docs at all.
|
|
132
|
-
if (
|
|
159
|
+
if (writesFeatureGuides(model, target)) {
|
|
133
160
|
features.forEach((feature: any) => {
|
|
134
161
|
AgentGuideFeature({ target, feature })
|
|
135
162
|
})
|
|
@@ -1,5 +1,10 @@
|
|
|
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'
|
|
6
|
+
import { originName } from '../helpers/packageMeta'
|
|
7
|
+
import { definitionName } from '../helpers/text'
|
|
3
8
|
|
|
4
9
|
import { each } from 'jostraca'
|
|
5
10
|
|
|
@@ -33,16 +38,17 @@ const LANG_CMD: Record<string, LangCmd> = {
|
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
// Keyed by origin, so an alias reads its origin's row.
|
|
42
|
+
function langCmd(name: string, model?: any): LangCmd {
|
|
43
|
+
return LANG_CMD[null == model ? name : originName(model, name)] || { viaMake: true }
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
|
|
41
47
|
// A fenced shell block of the per-target build/test commands, run **in the
|
|
42
48
|
// target directory** (the per-language guide already lives there). Prefers the
|
|
43
49
|
// target's Makefile recipes (`make build` / `make test`).
|
|
44
|
-
function langCommandsBlock(name: string): string {
|
|
45
|
-
const c = langCmd(name)
|
|
50
|
+
function langCommandsBlock(name: string, model?: any): string {
|
|
51
|
+
const c = langCmd(name, model)
|
|
46
52
|
const lines: string[] = []
|
|
47
53
|
if (c.install) lines.push(c.install)
|
|
48
54
|
if (c.viaMake) {
|
|
@@ -56,32 +62,41 @@ function langCommandsBlock(name: string): string {
|
|
|
56
62
|
if (0 === lines.length) {
|
|
57
63
|
return `Build and test with \`${name}\`'s standard toolchain.\n`
|
|
58
64
|
}
|
|
59
|
-
|
|
65
|
+
const node = model?.main?.[KIT]?.target?.[name]
|
|
66
|
+
const place = null == node ? 'folder' : fact(node, 'place')
|
|
67
|
+
const dir = 'folder' === place ? name + '/' : 'root' === place ? 'the project root' : "this package's root"
|
|
68
|
+
return '```bash\n# in this target directory (' + dir + '):\n' + lines.join('\n') + '\n```\n'
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
|
|
63
72
|
|
|
64
73
|
function featuresEnabled(target: any): boolean {
|
|
65
|
-
return target
|
|
74
|
+
return fact(target, 'phase').feature
|
|
66
75
|
}
|
|
67
76
|
|
|
68
|
-
// ts/js lay each feature out as a directory `src/feature/<name
|
|
69
|
-
// SDK targets (`srcfeature: false`)
|
|
70
|
-
// package. Drives where feature guides live / are referenced.
|
|
77
|
+
// ts/js lay each feature out as a directory `src/feature/<name>/`, which also
|
|
78
|
+
// holds its guide; the other SDK targets (`srcfeature: false`) do not.
|
|
71
79
|
function isDirLayout(target: any): boolean {
|
|
72
80
|
return target?.srcfeature !== false
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
// Each feature's runtime template as discovery finds it in the target's tree,
|
|
84
|
+
// skipping the empty `src/feature/<name>/` a flat-layout target also keeps.
|
|
85
|
+
function featureTemplates(fs: any, target: any, features: any[]): Record<string, string> {
|
|
86
|
+
const dirLayout = isDirLayout(target)
|
|
87
|
+
const out: Record<string, string> = {}
|
|
88
|
+
const found = findFeatureSources(fs, 'tm/' + target.name,
|
|
89
|
+
features.map((f: any) => String(f.name).toLowerCase()))
|
|
90
|
+
for (const s of found) {
|
|
91
|
+
if (!dirLayout && s.path.startsWith('src/feature/')) continue
|
|
92
|
+
if (null == out[s.name]) out[s.name] = s.path + (s.folder ? '/' : '')
|
|
93
|
+
}
|
|
94
|
+
return out
|
|
77
95
|
}
|
|
78
96
|
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return (feature.Name || feature.name) + 'Feature.php'
|
|
83
|
-
}
|
|
84
|
-
return feature.name + '_feature.' + ext
|
|
97
|
+
function writesFeatureGuides(model: any, target: any): boolean {
|
|
98
|
+
return featuresEnabled(target) && isDirLayout(target) &&
|
|
99
|
+
0 < activeFeatures(model, target).length
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
function featureHooks(feature: any): string[] {
|
|
@@ -94,8 +109,8 @@ function featureHooks(feature: any): string[] {
|
|
|
94
109
|
|
|
95
110
|
|
|
96
111
|
function activeTargets(model: any): any[] {
|
|
97
|
-
const
|
|
98
|
-
return
|
|
112
|
+
const kit = model.main[KIT]
|
|
113
|
+
return fact(kit, 'active').map((name: string) => kit.target[name])
|
|
99
114
|
}
|
|
100
115
|
|
|
101
116
|
// With a target, also drops features that do not APPLY to it — a guide
|
|
@@ -119,11 +134,35 @@ function projectName(model: any): string {
|
|
|
119
134
|
|
|
120
135
|
|
|
121
136
|
|
|
122
|
-
|
|
137
|
+
// What a run does to the files it generates, stated once for every guide.
|
|
138
|
+
function regenerationStatement(): string {
|
|
139
|
+
return `Each \`npm run generate\` rewrites every file it generates, so an edit
|
|
140
|
+
made to generated output is lost, and deletes the files it generated before
|
|
141
|
+
and no longer emits. A target or a phase switched off is left as it was.`
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function copiesStatement(model: any): string {
|
|
145
|
+
return MERGE === copyMode(model?.main?.[KIT]?.copies) ?
|
|
146
|
+
`\`target add\` and \`feature add\` copy templates and components into
|
|
147
|
+
\`.sdk/\`, and merge toolchain updates into the copies this project has
|
|
148
|
+
edited.` :
|
|
149
|
+
`\`target add\` and \`feature add\` overwrite the templates and components
|
|
150
|
+
in \`.sdk/\` (\`main: kit: copies: 'overwrite'\`): set \`copies\` to
|
|
151
|
+
\`'merge'\` before customising them, so that an add merges toolchain updates
|
|
152
|
+
into the edited copies.`
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
function workflowSection(model: any): string {
|
|
157
|
+
const dirs = activeTargets(model).filter((t: any) => 'folder' === fact(t, 'place'))
|
|
158
|
+
.map((t: any) => '\`' + t.name + '/\`')
|
|
159
|
+
const output = 0 === dirs.length ? 'The generated output is **build output** — never edit it by' :
|
|
160
|
+
1 === dirs.length ? 'The generated\ndirectory (' + dirs[0] + ') is **build output** — never edit it by' :
|
|
161
|
+
'The generated language\ndirectories (' + dirs.slice(0, 2).join(', ') + (2 < dirs.length ? ', …' : '') +
|
|
162
|
+
') are **build output** — never edit them by'
|
|
123
163
|
return `## Generating and updating the SDK
|
|
124
164
|
|
|
125
|
-
All generation is driven from the \`.sdk/\` directory.
|
|
126
|
-
directories (\`ts/\`, \`go/\`, …) are **build output** — never edit them by
|
|
165
|
+
All generation is driven from the \`.sdk/\` directory. ${output}
|
|
127
166
|
hand; fix the model, a template, or a component and regenerate.
|
|
128
167
|
|
|
129
168
|
\`\`\`bash
|
|
@@ -134,15 +173,8 @@ npm run build # compile .sdk/src/cmp -> .sdk/dist
|
|
|
134
173
|
npm run generate # emit/refresh the SDK into ../<lang>
|
|
135
174
|
\`\`\`
|
|
136
175
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
\`ProjectName\` or \`GOMODULE\` in generated output, delete that one file and
|
|
140
|
-
regenerate it fresh:
|
|
141
|
-
|
|
142
|
-
\`\`\`bash
|
|
143
|
-
rm <lang>/<the-file-with-the-placeholder>
|
|
144
|
-
npm run generate
|
|
145
|
-
\`\`\`
|
|
176
|
+
${regenerationStatement()}
|
|
177
|
+
${copiesStatement(model)}
|
|
146
178
|
|
|
147
179
|
Note: the \`voxgig-sdkgen\` CLI only *scaffolds* (\`target add\` /
|
|
148
180
|
\`feature add\`). Generation itself runs via \`npm run generate\` (backed by
|
|
@@ -170,13 +202,11 @@ so nothing downstream complains. To inspect the model layer **without side
|
|
|
170
202
|
effects**, use \`npm run dry-generate\` (\`-y\`, writes nothing). Never
|
|
171
203
|
\`--no-config\` in anything whose output might be committed.
|
|
172
204
|
|
|
173
|
-
**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
To find either, the target trees must be deleted and regenerated — a
|
|
179
|
-
regeneration in place cannot see stale output at all.
|
|
205
|
+
**Dropping a target deletes nothing.** A run deletes only what it no longer
|
|
206
|
+
emits from the targets and phases that ran, so a target dropped from the
|
|
207
|
+
model, or a phase switched off, leaves its files in the tree, and \`git
|
|
208
|
+
status\` is silent because they are committed and unchanged. Delete them by
|
|
209
|
+
hand.
|
|
180
210
|
`
|
|
181
211
|
}
|
|
182
212
|
|
|
@@ -186,7 +216,7 @@ function featureSection(): string {
|
|
|
186
216
|
|
|
187
217
|
A **feature** is a pipeline extension: an object of hooks that fire at named
|
|
188
218
|
stages of every entity operation (each target's guide documents its
|
|
189
|
-
features).
|
|
219
|
+
features).
|
|
190
220
|
|
|
191
221
|
\`\`\`bash
|
|
192
222
|
cd .sdk
|
|
@@ -241,12 +271,12 @@ deps live in \`.sdk/model/target/<lang>.aontu\`; features in
|
|
|
241
271
|
}
|
|
242
272
|
|
|
243
273
|
|
|
244
|
-
function aontuSection(): string {
|
|
274
|
+
function aontuSection(model: any): string {
|
|
245
275
|
return `## The model language (aontu, \`.aontu\` files)
|
|
246
276
|
|
|
247
277
|
The model is one structured object assembled by **aontu** (a unification
|
|
248
278
|
engine) from three sources: the API model (entities/operations, from the
|
|
249
|
-
|
|
279
|
+
${definitionName(fact(model.main[KIT], 'definitionKind'))} via \`@voxgig/apidef\`), the base schema, and the target/feature
|
|
250
280
|
definitions in \`.sdk/model/\`. An \`.aontu\` file is a relaxed JSON (jsonic
|
|
251
281
|
syntax) with unification semantics:
|
|
252
282
|
|
|
@@ -295,14 +325,16 @@ export {
|
|
|
295
325
|
langCommandsBlock,
|
|
296
326
|
featuresEnabled,
|
|
297
327
|
isDirLayout,
|
|
298
|
-
|
|
299
|
-
|
|
328
|
+
featureTemplates,
|
|
329
|
+
writesFeatureGuides,
|
|
300
330
|
featureHooks,
|
|
301
331
|
activeTargets,
|
|
302
332
|
activeFeatures,
|
|
303
333
|
activeEntities,
|
|
304
334
|
projectName,
|
|
305
335
|
workflowSection,
|
|
336
|
+
regenerationStatement,
|
|
337
|
+
copiesStatement,
|
|
306
338
|
featureSection,
|
|
307
339
|
customiseSection,
|
|
308
340
|
aontuSection,
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { each, Content, File, Folder } from 'jostraca'
|
|
3
3
|
import { cmp } from '../helpers/component'
|
|
4
4
|
import { fact } from '../helpers/facts'
|
|
5
|
+
import { generatedOps } from '../helpers/opShape'
|
|
5
6
|
|
|
6
|
-
import { claudePointer } from './AgentGuideContent'
|
|
7
|
+
import { claudePointer, regenerationStatement } from './AgentGuideContent'
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
function cap(s: string): string {
|
|
@@ -30,6 +31,15 @@ const AgentGuideFeature = cmp(function AgentGuideFeature(props: any) {
|
|
|
30
31
|
.filter(Boolean)
|
|
31
32
|
|
|
32
33
|
const defaultOn = fact(feature, 'on')
|
|
34
|
+
const ops = generatedOps(ctx$.model)
|
|
35
|
+
|
|
36
|
+
const place = fact(target, 'place')
|
|
37
|
+
const guide = fact(target, 'link').agents
|
|
38
|
+
const root = 'folder' === place ? '../../../../' : 'root' === place ? '../../../' :
|
|
39
|
+
null == ctx$.sdkrelpath ? null : '../../../' + ctx$.sdkrelpath + '/'
|
|
40
|
+
const where = 'folder' === place ? 'the **project root** — four levels up from here' :
|
|
41
|
+
'root' === place ? 'the **project root** — three levels up from here' :
|
|
42
|
+
'the SDK project that generates this package'
|
|
33
43
|
|
|
34
44
|
Folder({ name: 'src/feature/' + name }, () => {
|
|
35
45
|
|
|
@@ -39,10 +49,10 @@ const AgentGuideFeature = cmp(function AgentGuideFeature(props: any) {
|
|
|
39
49
|
${title} (v${version}).
|
|
40
50
|
|
|
41
51
|
A **feature** is a pipeline extension: an object of hooks that fire at named
|
|
42
|
-
stages of every entity operation (
|
|
52
|
+
stages of every entity operation${0 < ops.length ? ' (' + ops.join(', ') + ')' : ''} and of
|
|
43
53
|
the SDK/entity lifecycle. Features are how you inspect or modify the request
|
|
44
54
|
pipeline without forking the SDK. This directory holds the **generated**
|
|
45
|
-
runtime for the \`${name}\` feature in the ${target
|
|
55
|
+
runtime for the \`${name}\` feature in the ${fact(target, 'title')} target — do
|
|
46
56
|
not edit it by hand; change its template/model in \`.sdk/\` and regenerate.
|
|
47
57
|
|
|
48
58
|
Active by default: **${defaultOn ? 'yes' : 'no'}** (\`config.options.active\`
|
|
@@ -71,7 +81,7 @@ later feature can override an earlier one.
|
|
|
71
81
|
| Registered in | \`.sdk/model/feature/feature-index.aontu\` (\`@"${name}.aontu"\`) |
|
|
72
82
|
| Runtime template | \`.sdk/tm/${lang}/src/feature/${name}/\` (copied here on \`generate\`; \`FEATURE_Name\`/\`FEATURE_VERSION\` substituted) |
|
|
73
83
|
|
|
74
|
-
(Paths are relative to
|
|
84
|
+
(Paths are relative to ${where}.)
|
|
75
85
|
|
|
76
86
|
## Customising this feature
|
|
77
87
|
|
|
@@ -82,13 +92,14 @@ later feature can override an earlier one.
|
|
|
82
92
|
- **Behaviour**: edit the runtime template under
|
|
83
93
|
\`.sdk/tm/${lang}/src/feature/${name}/\`, then regenerate.
|
|
84
94
|
|
|
85
|
-
After any change:
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
After any change: \`${null == root ? '' : 'cd ' + root + '.sdk && '}npm run generate\`${null == root ?
|
|
96
|
+
' in the SDK project\'s `.sdk/`' : ''} (add
|
|
97
|
+
\`npm run build\` first if you changed a component).
|
|
98
|
+
${regenerationStatement()}
|
|
88
99
|
|
|
89
|
-
To author a **new** feature, copy this one's model + template shape — see
|
|
90
|
-
[project guide](
|
|
91
|
-
[${target
|
|
100
|
+
To author a **new** feature, copy this one's model + template shape — see ${'' === guide ? '' :
|
|
101
|
+
`the\n[project guide](../../../${guide}) and `}the
|
|
102
|
+
[${fact(target, 'title')} guide](../../../AGENTS.md).
|
|
92
103
|
`)
|
|
93
104
|
})
|
|
94
105
|
|