@voxgig/sdkgen 4.42.0 → 4.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/feature.js +16 -0
  3. package/dist/action/feature.js.map +1 -1
  4. package/dist/action/kind.js +3 -0
  5. package/dist/action/kind.js.map +1 -1
  6. package/dist/action/remove.js +4 -0
  7. package/dist/action/remove.js.map +1 -1
  8. package/dist/action/resolve.d.ts +1 -0
  9. package/dist/action/resolve.js +30 -0
  10. package/dist/action/resolve.js.map +1 -1
  11. package/dist/action/target.js +10 -4
  12. package/dist/action/target.js.map +1 -1
  13. package/dist/cmp/AgentGuideContent.js +12 -6
  14. package/dist/cmp/AgentGuideContent.js.map +1 -1
  15. package/dist/cmp/ReadmeIntro.js +21 -6
  16. package/dist/cmp/ReadmeIntro.js.map +1 -1
  17. package/dist/cmp/ReadmeTop.js +23 -9
  18. package/dist/cmp/ReadmeTop.js.map +1 -1
  19. package/dist/helpers/opShape.d.ts +2 -1
  20. package/dist/helpers/opShape.js +17 -0
  21. package/dist/helpers/opShape.js.map +1 -1
  22. package/dist/sdkgen.d.ts +2 -2
  23. package/dist/sdkgen.js +5 -4
  24. package/dist/sdkgen.js.map +1 -1
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +1 -1
  27. package/project/.sdk/src/cmp/c/ReadmeIntro_c.ts +6 -25
  28. package/project/.sdk/src/cmp/clojure/ReadmeIntro_clojure.ts +6 -25
  29. package/project/.sdk/src/cmp/cpp/ReadmeIntro_cpp.ts +6 -25
  30. package/project/.sdk/src/cmp/csharp/ReadmeIntro_csharp.ts +6 -25
  31. package/project/.sdk/src/cmp/elixir/ReadmeIntro_elixir.ts +6 -25
  32. package/project/.sdk/src/cmp/go/ReadmeIntro_go.ts +7 -37
  33. package/project/.sdk/src/cmp/java/ReadmeIntro_java.ts +6 -25
  34. package/project/.sdk/src/cmp/js/ReadmeIntro_js.ts +6 -25
  35. package/project/.sdk/src/cmp/kotlin/ReadmeIntro_kotlin.ts +6 -25
  36. package/project/.sdk/src/cmp/lua/ReadmeIntro_lua.ts +6 -25
  37. package/project/.sdk/src/cmp/ocaml/ReadmeIntro_ocaml.ts +6 -25
  38. package/project/.sdk/src/cmp/perl/ReadmeIntro_perl.ts +6 -25
  39. package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +6 -25
  40. package/project/.sdk/src/cmp/py/ReadmeIntro_py.ts +6 -25
  41. package/project/.sdk/src/cmp/rb/ReadmeIntro_rb.ts +6 -25
  42. package/project/.sdk/src/cmp/rust/ReadmeIntro_rust.ts +6 -25
  43. package/project/.sdk/src/cmp/scala/ReadmeIntro_scala.ts +6 -25
  44. package/project/.sdk/src/cmp/swift/ReadmeIntro_swift.ts +6 -25
  45. package/project/.sdk/src/cmp/ts/ReadmeIntro_ts.ts +6 -36
  46. package/project/.sdk/src/cmp/zig/ReadmeIntro_zig.ts +6 -25
  47. package/project/sdkgen-package.json +1 -1
  48. package/src/action/feature.ts +20 -0
  49. package/src/action/kind.ts +4 -0
  50. package/src/action/remove.ts +4 -0
  51. package/src/action/resolve.ts +41 -0
  52. package/src/action/target.ts +11 -4
  53. package/src/cmp/AgentGuideContent.ts +12 -6
  54. package/src/cmp/ReadmeIntro.ts +22 -8
  55. package/src/cmp/ReadmeTop.ts +23 -9
  56. package/src/helpers/opShape.ts +17 -0
  57. package/src/sdkgen.ts +2 -1
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, modelText, alongsideNote } from '@voxgig/sdkgen'
2
+ import { cmp, Content, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -8,16 +8,10 @@ import {
8
8
  } from '@voxgig/apidef'
9
9
 
10
10
 
11
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
11
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
12
12
  const { target, ctx$: { model } } = props
13
- const info = modelText(model)
14
- const tagline = info.tagline || ''
15
13
 
16
- Content(`# ${model.Name} ${target.title} SDK
17
-
18
- ${tagline}
19
-
20
- The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
14
+ Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
21
15
  following idiomatic Perl conventions.
22
16
 
23
17
  `)
@@ -33,20 +27,7 @@ following idiomatic Perl conventions.
33
27
  ? `for example \`$client->${nom(exampleEntity, 'Name')}\` — each`
34
28
  : 'each'
35
29
 
36
- // Model-driven op list — only the operations the active entities actually
37
- // expose (a read-only entity has just list+load); never claim
38
- // create/update/remove exist when no entity has them.
39
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
40
- const opSet = new Set<string>()
41
- Object.values(entity || {}).forEach((e: any) => {
42
- if (!e || e.active === false) return
43
- Object.keys(e.op || {}).forEach((o: string) => {
44
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
45
- })
46
- })
47
- const opNames = CANON_OPS.filter((o) => opSet.has(o))
48
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
49
- const opList = (opNames.length ? opNames : ['list', 'load'])
30
+ const opList = introOps(model)
50
31
  .map((o) => '`' + o + '`').join(', ')
51
32
 
52
33
  Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
@@ -54,10 +35,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
54
35
  paths and query strings. You work with named resources and verbs, which
55
36
  keeps the cognitive load low.
56
37
 
57
- ${alongsideNote(model, target.name)}`)
38
+ `)
58
39
  })
59
40
 
60
41
 
61
42
  export {
62
- ReadmeIntro
43
+ ReadmeIntroBody
63
44
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, phpEntityAccessor, modelText, alongsideNote } from '@voxgig/sdkgen'
2
+ import { cmp, Content, phpEntityAccessor, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -8,30 +8,15 @@ import {
8
8
  } from '@voxgig/apidef'
9
9
 
10
10
 
11
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
11
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
12
12
  const { target, ctx$: { model } } = props
13
- const info = modelText(model)
14
- const tagline = info.tagline || ''
15
13
 
16
14
  // Derive a representative entity (and its operations) from the model so the
17
15
  // semantic-entity pitch names something real rather than a placeholder.
18
16
  const entity = getModelPath(model, `main.${KIT}.entity`) || {}
19
17
  const exampleEntity = Object.values(entity).find((e: any) => e && e.active !== false) as any
20
18
  const eName = exampleEntity ? nom(exampleEntity, 'Name') : null
21
- // Model-driven op list — union of the operations the active entities
22
- // actually expose (a read-only entity has just list+load), in canonical
23
- // order; never claim create/update/remove exist when no entity has them.
24
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
25
- const opSet = new Set<string>()
26
- Object.values(entity || {}).forEach((e: any) => {
27
- if (!e || e.active === false) return
28
- Object.keys(e.op || {}).forEach((o: string) => {
29
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
30
- })
31
- })
32
- const opnames = CANON_OPS.filter((o) => opSet.has(o))
33
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
34
- const opList = (opnames.length > 0 ? opnames : ['list', 'load']).join('`/`')
19
+ const opList = introOps(model).join('`/`')
35
20
 
36
21
  const semantic = eName
37
22
  ? `The SDK exposes the API as capitalised, semantic **Entities** — for example \`$client->${phpEntityAccessor(eName)}()\` — with named operations (\`${opList}\`) instead of raw URL paths and query strings. Working with resources and verbs keeps call sites self-describing and reduces cognitive load.
@@ -39,16 +24,12 @@ const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
39
24
  `
40
25
  : ''
41
26
 
42
- Content(`# ${model.Name} ${target.title} SDK
27
+ Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using PHP conventions.
43
28
 
44
- ${tagline}
45
-
46
- The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using PHP conventions.
47
-
48
- ${semantic}${alongsideNote(model, target.name)}`)
29
+ ${semantic}`)
49
30
  })
50
31
 
51
32
 
52
33
  export {
53
- ReadmeIntro
34
+ ReadmeIntroBody
54
35
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, modelText, alongsideNote } from '@voxgig/sdkgen'
2
+ import { cmp, Content, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -8,16 +8,10 @@ import {
8
8
  } from '@voxgig/apidef'
9
9
 
10
10
 
11
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
11
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
12
12
  const { target, ctx$: { model } } = props
13
- const info = modelText(model)
14
- const tagline = info.tagline || ''
15
13
 
16
- Content(`# ${model.Name} ${target.title} SDK
17
-
18
- ${tagline}
19
-
20
- The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following Pythonic conventions.
14
+ Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following Pythonic conventions.
21
15
 
22
16
  `)
23
17
 
@@ -32,20 +26,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
32
26
  ? `for example \`client.${nom(exampleEntity, 'Name')}()\` — each`
33
27
  : 'each'
34
28
 
35
- // Model-driven op list — only the operations the active entities actually
36
- // expose (a read-only entity has just list+load); never claim
37
- // create/update/remove exist when no entity has them.
38
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
39
- const opSet = new Set<string>()
40
- Object.values(entity || {}).forEach((e: any) => {
41
- if (!e || e.active === false) return
42
- Object.keys(e.op || {}).forEach((o: string) => {
43
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
44
- })
45
- })
46
- const opNames = CANON_OPS.filter((o) => opSet.has(o))
47
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
48
- const opList = (opNames.length ? opNames : ['list', 'load'])
29
+ const opList = introOps(model)
49
30
  .map((o) => '`' + o + '`').join(', ')
50
31
 
51
32
  Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
@@ -53,10 +34,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
53
34
  paths and query strings. You work with named resources and verbs, which
54
35
  keeps the cognitive load low.
55
36
 
56
- ${alongsideNote(model, target.name)}`)
37
+ `)
57
38
  })
58
39
 
59
40
 
60
41
  export {
61
- ReadmeIntro
42
+ ReadmeIntroBody
62
43
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, modelText, alongsideNote } from '@voxgig/sdkgen'
2
+ import { cmp, Content, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -8,30 +8,15 @@ import {
8
8
  } from '@voxgig/apidef'
9
9
 
10
10
 
11
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
11
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
12
12
  const { target, ctx$: { model } } = props
13
- const info = modelText(model)
14
- const tagline = info.tagline || ''
15
13
 
16
14
  // Derive a representative entity (and its operations) from the model so the
17
15
  // semantic-entity pitch names something real rather than a placeholder.
18
16
  const entity = getModelPath(model, `main.${KIT}.entity`) || {}
19
17
  const exampleEntity = Object.values(entity).find((e: any) => e && e.active !== false) as any
20
18
  const eName = exampleEntity ? nom(exampleEntity, 'Name') : null
21
- // Model-driven op list — union of the operations the active entities
22
- // actually expose (a read-only entity has just list+load), in canonical
23
- // order; never claim create/update/remove exist when no entity has them.
24
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
25
- const opSet = new Set<string>()
26
- Object.values(entity || {}).forEach((e: any) => {
27
- if (!e || e.active === false) return
28
- Object.keys(e.op || {}).forEach((o: string) => {
29
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
30
- })
31
- })
32
- const opnames = CANON_OPS.filter((o) => opSet.has(o))
33
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
34
- const opList = (opnames.length > 0 ? opnames : ['list', 'load']).join('`/`')
19
+ const opList = introOps(model).join('`/`')
35
20
 
36
21
  const semantic = eName
37
22
  ? `The SDK exposes the API as capitalised, semantic **Entities** — for example \`client.${eName}\` — with named operations (\`${opList}\`) instead of raw URL paths and query strings. Working with resources and verbs keeps call sites self-describing and reduces cognitive load.
@@ -39,16 +24,12 @@ const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
39
24
  `
40
25
  : ''
41
26
 
42
- Content(`# ${model.Name} ${target.title} SDK
27
+ Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using idiomatic Ruby conventions.
43
28
 
44
- ${tagline}
45
-
46
- The ${target.title} SDK for the ${model.Name} API — an entity-oriented client using idiomatic Ruby conventions.
47
-
48
- ${semantic}${alongsideNote(model, target.name)}`)
29
+ ${semantic}`)
49
30
  })
50
31
 
51
32
 
52
33
  export {
53
- ReadmeIntro
34
+ ReadmeIntroBody
54
35
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, modelText, alongsideNote } from '@voxgig/sdkgen'
2
+ import { cmp, Content, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -9,16 +9,10 @@ import {
9
9
  import { rustVarName, rustMethodName } from './utility_rust'
10
10
 
11
11
 
12
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
12
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
13
13
  const { target, ctx$: { model } } = props
14
- const info = modelText(model)
15
- const tagline = info.tagline || ''
16
14
 
17
- Content(`# ${model.Name} ${target.title} SDK
18
-
19
- ${tagline}
20
-
21
- The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Rust conventions.
15
+ Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Rust conventions.
22
16
 
23
17
  `)
24
18
 
@@ -33,20 +27,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
33
27
  ? `for example \`client.${rustMethodName(exampleEntity.name)}(Value::Noval)\` — each`
34
28
  : 'each'
35
29
 
36
- // Model-driven op list — only the operations the active entities actually
37
- // expose (a read-only entity has just list+load); never claim
38
- // create/update/remove exist when no entity has them.
39
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
40
- const opSet = new Set<string>()
41
- Object.values(entity || {}).forEach((e: any) => {
42
- if (!e || e.active === false) return
43
- Object.keys(e.op || {}).forEach((o: string) => {
44
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
45
- })
46
- })
47
- const opNames = CANON_OPS.filter((o) => opSet.has(o))
48
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
49
- const opList = (opNames.length ? opNames : ['list', 'load'])
30
+ const opList = introOps(model)
50
31
  .map((o) => '`' + o + '`').join(', ')
51
32
 
52
33
  Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
@@ -54,10 +35,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
54
35
  paths and query strings. You work with named resources and verbs, which
55
36
  keeps the cognitive load low.
56
37
 
57
- ${alongsideNote(model, target.name)}`)
38
+ `)
58
39
  })
59
40
 
60
41
 
61
42
  export {
62
- ReadmeIntro
43
+ ReadmeIntroBody
63
44
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, modelText, alongsideNote } from '@voxgig/sdkgen'
2
+ import { cmp, Content, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -9,16 +9,10 @@ import {
9
9
  import { scalaVarName } from './utility_scala'
10
10
 
11
11
 
12
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
12
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
13
13
  const { target, ctx$: { model } } = props
14
- const info = modelText(model)
15
- const tagline = info.tagline || ''
16
14
 
17
- Content(`# ${model.Name} ${target.title} SDK
18
-
19
- ${tagline}
20
-
21
- The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Scala conventions.
15
+ Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Scala conventions.
22
16
 
23
17
  `)
24
18
 
@@ -33,20 +27,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
33
27
  ? `for example \`client.${scalaVarName(exampleEntity.name)}(null)\` — each`
34
28
  : 'each'
35
29
 
36
- // Model-driven op list — only the operations the active entities actually
37
- // expose (a read-only entity has just list+load); never claim
38
- // create/update/remove exist when no entity has them.
39
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
40
- const opSet = new Set<string>()
41
- Object.values(entity || {}).forEach((e: any) => {
42
- if (!e || e.active === false) return
43
- Object.keys(e.op || {}).forEach((o: string) => {
44
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
45
- })
46
- })
47
- const opNames = CANON_OPS.filter((o) => opSet.has(o))
48
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
49
- const opList = (opNames.length ? opNames : ['list', 'load'])
30
+ const opList = introOps(model)
50
31
  .map((o) => '`' + o + '`').join(', ')
51
32
 
52
33
  Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
@@ -54,10 +35,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
54
35
  paths and query strings. You work with named resources and verbs, which
55
36
  keeps the cognitive load low.
56
37
 
57
- ${alongsideNote(model, target.name)}`)
38
+ `)
58
39
  })
59
40
 
60
41
 
61
42
  export {
62
- ReadmeIntro
43
+ ReadmeIntroBody
63
44
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, modelText, alongsideNote } from '@voxgig/sdkgen'
2
+ import { cmp, Content, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -7,16 +7,10 @@ import {
7
7
  } from '@voxgig/apidef'
8
8
 
9
9
 
10
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
10
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
11
11
  const { target, ctx$: { model } } = props
12
- const info = modelText(model)
13
- const tagline = info.tagline || ''
14
12
 
15
- Content(`# ${model.Name} ${target.title} SDK
16
-
17
- ${tagline}
18
-
19
- The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Swift conventions.
13
+ Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Swift conventions.
20
14
 
21
15
  `)
22
16
 
@@ -31,20 +25,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
31
25
  ? `for example \`client.${exampleEntity.Name}()\` — each`
32
26
  : 'each'
33
27
 
34
- // Model-driven op list — only the operations the active entities actually
35
- // expose (a read-only entity has just list+load); never claim
36
- // create/update/remove exist when no entity has them.
37
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
38
- const opSet = new Set<string>()
39
- Object.values(entity || {}).forEach((e: any) => {
40
- if (!e || e.active === false) return
41
- Object.keys(e.op || {}).forEach((o: string) => {
42
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
43
- })
44
- })
45
- const opNames = CANON_OPS.filter((o) => opSet.has(o))
46
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
47
- const opList = (opNames.length ? opNames : ['list', 'load'])
28
+ const opList = introOps(model)
48
29
  .map((o) => '`' + o + '`').join(', ')
49
30
 
50
31
  Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
@@ -52,10 +33,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
52
33
  paths and query strings. You work with named resources and verbs, which
53
34
  keeps the cognitive load low.
54
35
 
55
- ${alongsideNote(model, target.name)}`)
36
+ `)
56
37
  })
57
38
 
58
39
 
59
40
  export {
60
- ReadmeIntro
41
+ ReadmeIntroBody
61
42
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, modelText } from '@voxgig/sdkgen'
2
+ import { cmp, Content, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -8,57 +8,27 @@ import {
8
8
  } from '@voxgig/apidef'
9
9
 
10
10
 
11
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
11
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
12
12
  const { target, ctx$: { model } } = props
13
- const info = modelText(model)
14
- const tagline = info.tagline || ''
15
13
 
16
14
  const entity = getModelPath(model, `main.${KIT}.entity`)
17
15
  const exampleEntity = Object.values(entity).find((e: any) => e.active !== false) as any
18
16
  const eName = exampleEntity ? nom(exampleEntity, 'Name') : 'Entity'
19
17
 
20
- // Model-driven op list — only the operations the active entities actually
21
- // expose (a read-only entity has just list+load); never claim
22
- // create/update/remove exist when no entity has them.
23
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
24
- const opSet = new Set<string>()
25
- Object.values(entity || {}).forEach((e: any) => {
26
- if (!e || e.active === false) return
27
- Object.keys(e.op || {}).forEach((o: string) => {
28
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
29
- })
30
- })
31
- const opNames = CANON_OPS.filter((o) => opSet.has(o))
32
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
33
- const opList = (opNames.length ? opNames : ['list', 'load'])
18
+ const opList = introOps(model)
34
19
  .map((o) => '`' + o + '`').join(', ')
35
20
 
36
- const targets = getModelPath(model, `main.${KIT}.target`) || {}
37
- const siblings = Object.entries(targets)
38
- .filter(([name, t]: any) => name !== target.name && false !== t.active)
39
- .map(([name]: any) => name)
40
- .sort()
41
-
42
- const siblingNote = 0 === siblings.length ? '' : `
43
- > Also generated from this model: ${siblings.map((s: string) => '`' + s + '`').join(', ')} — see
44
- > the [top-level README](../README.md).
45
- `
46
-
47
- Content(`# ${model.Name} ${target.title} SDK
48
-
49
- ${tagline}
50
-
51
- The ${target.title} SDK for the ${model.Name} API — a type-safe, entity-oriented client with full async/await support.
21
+ Content(`The ${target.title} SDK for the ${model.Name} API — a type-safe, entity-oriented client with full async/await support.
52
22
 
53
23
  The API is exposed as capitalised, semantic **Entities** — e.g.
54
24
  \`client.${eName}()\` — each with a small set of operations (${opList})
55
25
  instead of raw URL paths and query parameters. This keeps the surface
56
26
  predictable and low-friction for both humans and AI agents.
57
- ${siblingNote}
27
+
58
28
  `)
59
29
  })
60
30
 
61
31
 
62
32
  export {
63
- ReadmeIntro
33
+ ReadmeIntroBody
64
34
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, modelText, alongsideNote } from '@voxgig/sdkgen'
2
+ import { cmp, Content, introOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -9,16 +9,10 @@ import {
9
9
  import { zigVarName } from './utility_zig'
10
10
 
11
11
 
12
- const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
12
+ const ReadmeIntroBody = cmp(function ReadmeIntroBody(props: any) {
13
13
  const { target, ctx$: { model } } = props
14
- const info = modelText(model)
15
- const tagline = info.tagline || ''
16
14
 
17
- Content(`# ${model.Name} ${target.title} SDK
18
-
19
- ${tagline}
20
-
21
- The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Zig conventions.
15
+ Content(`The ${target.title} SDK for the ${model.Name} API — an entity-oriented client following idiomatic Zig conventions.
22
16
 
23
17
  `)
24
18
 
@@ -33,20 +27,7 @@ The ${target.title} SDK for the ${model.Name} API — an entity-oriented client
33
27
  ? `for example \`client.${zigVarName(exampleEntity.name)}(h.vnull())\` — each`
34
28
  : 'each'
35
29
 
36
- // Model-driven op list — only the operations the active entities actually
37
- // expose (a read-only entity has just list+load); never claim
38
- // create/update/remove exist when no entity has them.
39
- const CANON_OPS = ['list', 'load', 'create', 'update', 'patch', 'remove']
40
- const opSet = new Set<string>()
41
- Object.values(entity || {}).forEach((e: any) => {
42
- if (!e || e.active === false) return
43
- Object.keys(e.op || {}).forEach((o: string) => {
44
- if (e.op[o] && e.op[o].active !== false) opSet.add(o)
45
- })
46
- })
47
- const opNames = CANON_OPS.filter((o) => opSet.has(o))
48
- .concat([...opSet].filter((o) => !CANON_OPS.includes(o)))
49
- const opList = (opNames.length ? opNames : ['list', 'load'])
30
+ const opList = introOps(model)
50
31
  .map((o) => '`' + o + '`').join(', ')
51
32
 
52
33
  Content(`The SDK exposes the API as capitalised, semantic **Entities** — ${example}
@@ -54,10 +35,10 @@ carrying a small, uniform set of operations (${opList}) instead of raw URL
54
35
  paths and query strings. You work with named resources and verbs, which
55
36
  keeps the cognitive load low.
56
37
 
57
- ${alongsideNote(model, target.name)}`)
38
+ `)
58
39
  })
59
40
 
60
41
 
61
42
  export {
62
- ReadmeIntro
43
+ ReadmeIntroBody
63
44
  }
@@ -3,7 +3,7 @@
3
3
  "package": 1
4
4
  },
5
5
  "name": "@voxgig/sdkgen",
6
- "version": "4.42.0",
6
+ "version": "4.44.0",
7
7
  "provides": {
8
8
  "target": [
9
9
  "c",
@@ -195,6 +195,14 @@ const FeatureRoot = cmp(function FeatureRoot(props: any) {
195
195
  content: ctx$.meta.content.feature_index,
196
196
  }))
197
197
 
198
+ if (source.owned) {
199
+ log.info({
200
+ point: 'feature-owned', feature: fname,
201
+ note: fname + ': defined in this project, so its files stay as they are'
202
+ })
203
+ return
204
+ }
205
+
198
206
  each(target, (t) => {
199
207
  // The target's OWN tree, under the name it has in ITS source — an
200
208
  // aliased target's templates live at `tm/<origname>`, so searching
@@ -227,6 +235,18 @@ const FeatureRoot = cmp(function FeatureRoot(props: any) {
227
235
 
228
236
  const tmfolder = 0 < overlay.length ? featuretm : owntm
229
237
 
238
+ // A target the project defines itself carries its own feature sources.
239
+ const inplace = 0 === sources.length && 0 < findFeatureSources(
240
+ fs, Path.join(ctx$.folder ?? '.', 'tm', t.name), [fname]).length
241
+
242
+ if (inplace) {
243
+ log.info({
244
+ point: 'feature-source-in-place', feature: fname, target: t.name,
245
+ note: fname + ': target ' + t.name + ' has its own source'
246
+ })
247
+ return
248
+ }
249
+
230
250
  if (0 === sources.length) {
231
251
  log.warn({
232
252
  point: 'feature-source-missing', feature: fname, target: t.name,
@@ -164,6 +164,10 @@ function kindModel(props: {
164
164
  const fs = ctx$.fs()
165
165
  const log = ctx$.log
166
166
 
167
+ if (source.owned) {
168
+ return
169
+ }
170
+
167
171
  const aliased = source.name !== source.origname
168
172
  const owned = aliased && true === def.ownedWhenAliased
169
173
 
@@ -200,6 +200,10 @@ async function planRemove(
200
200
  plan.refused.push('(source not found: the copy cannot be compared with what' +
201
201
  ' `' + kind + ' add` wrote; every file below is deleted only under --force)')
202
202
  }
203
+ else if (source.owned) {
204
+ plan.refused.push('(defined in this project: these files are its only' +
205
+ ' source, and are deleted only under --force)')
206
+ }
203
207
 
204
208
  // The feature being removed counts as selected, so its own source is
205
209
  // compared rather than written off as stale — see checkTarget.