@pbuilder/sdk 0.20.0 → 0.21.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/README.md CHANGED
@@ -183,7 +183,7 @@ export default async (input: Input) => {
183
183
  The engine invokes the module's **default export** — that's the factory. (This one builds
184
184
  its output strings in TypeScript; the template language below is the declarative
185
185
  alternative. And if your editor flags the `.ts`-extension import or `bun:test`, that's
186
- just missing tsconfig settings — the [quickstart](./docs/guides/quickstart.md) ships one; Bun
186
+ just missing tsconfig settings — the [quickstart](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/quickstart.md) ships one; Bun
187
187
  itself runs fine without it.)
188
188
 
189
189
  **6. Execute it** — `default:hello` is `<collection>:<schematic>` as registered in
@@ -214,9 +214,9 @@ as it was.
214
214
  **7. Test it** without the CLI or a running engine — see
215
215
  [Testing your factory](#testing-your-factory) below.
216
216
 
217
- From here: [Authoring verbs](./docs/guides/authoring-verbs.md) is the full reference for
217
+ From here: [Authoring verbs](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md) is the full reference for
218
218
  everything you can do inside a factory, and the
219
- [quickstart](./docs/guides/quickstart.md) covers the standalone-package setup (tsconfig
219
+ [quickstart](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/quickstart.md) covers the standalone-package setup (tsconfig
220
220
  included) in more depth.
221
221
 
222
222
  ## Returning a Result
@@ -374,13 +374,13 @@ Everything a factory can do to the tree is one of seven mutation verbs, all impo
374
374
 
375
375
  | Verb | What it schedules |
376
376
  |---|---|
377
- | [`create(path, opts)`](./docs/guides/authoring-verbs.md#create) | A new file. `path` and `template` are template strings rendered against one `options` object; the `templateFile` overload renders a package-local file instead. |
378
- | [`replaceContent(path, content)`](./docs/guides/authoring-verbs.md#replacecontent) | Wholesale replacement of an existing file's content. |
379
- | [`remove(path)`](./docs/guides/authoring-verbs.md#remove) | A deletion. Idempotent on an absent path. |
380
- | [`rename(path, newName)`](./docs/guides/authoring-verbs.md#rename) | A basename-only rename in place. |
381
- | [`move(path, toDir)`](./docs/guides/authoring-verbs.md#move) | A move to a different directory. |
382
- | [`copy(from, to)`](./docs/guides/authoring-verbs.md#copy) | A tree-to-tree copy, chainable via the returned handle. |
383
- | [`copyIn(from, to)`](./docs/guides/authoring-verbs.md#copyin) | A package-local file copied into the tree **verbatim** — never rendered. |
377
+ | [`create(path, opts)`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#create) | A new file. `path` and `template` are template strings rendered against one `options` object; the `templateFile` overload renders a package-local file instead. |
378
+ | [`replaceContent(path, content)`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#replacecontent) | Wholesale replacement of an existing file's content. |
379
+ | [`remove(path)`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#remove) | A deletion. Idempotent on an absent path. |
380
+ | [`rename(path, newName)`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#rename) | A basename-only rename in place. |
381
+ | [`move(path, toDir)`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#move) | A move to a different directory. |
382
+ | [`copy(from, to)`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#copy) | A tree-to-tree copy, chainable via the returned handle. |
383
+ | [`copyIn(from, to)`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#copyin) | A package-local file copied into the tree **verbatim** — never rendered. |
384
384
 
385
385
  The verbs that write to a new path — `create`, `rename`, `move`, `copy`, `copyIn`, and
386
386
  `scaffold` — are fail-closed on collision and accept `{ force: true }` for a deliberate
@@ -389,15 +389,15 @@ trailing argument.
389
389
 
390
390
  Four companions round out the surface:
391
391
 
392
- - [`find(path).read()`](./docs/guides/authoring-verbs.md#the-read-trichotomy-findpathread) — read
392
+ - [`find(path).read()`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#the-read-trichotomy-findpathread) — read
393
393
  a file back from the staging tree.
394
- - [`glob(pattern, { ignore })`](./docs/guides/authoring-verbs.md#many-files-at-once-globpattern--ignore-)
394
+ - [`glob(pattern, { ignore })`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#many-files-at-once-globpattern--ignore-)
395
395
  resolves a handle for every file the pattern matches, ordered by path, or `[]` when none
396
396
  does. Every dialect has its own `glob`, which keeps the files of the extensions it declares.
397
- - [`scaffold({ from, to, options })`](./docs/guides/authoring-verbs.md#scaffold) — mirror an
397
+ - [`scaffold({ from, to, options })`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#scaffold) — mirror an
398
398
  entire package-local folder into the tree, with dynamic file names. The workhorse for
399
399
  multi-file generators — see [Scaffolding a folder of templates](#scaffolding-a-folder-of-templates).
400
- - [`pendingDirectives()`](./docs/guides/pending-directives.md) — inspect the directives still **pending**. A `read()`
400
+ - [`pendingDirectives()`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/pending-directives.md) — inspect the directives still **pending**. A `read()`
401
401
  drains the buffer, so call it before reading if you want the full picture.
402
402
 
403
403
  ### What to keep in mind
@@ -423,7 +423,7 @@ Rules that save you real debugging time — each one is a mistake we've watched
423
423
  - **Errors are structured.** A rejected run surfaces an `AuthoringError` with
424
424
  `verb`/`path`/`reason` fields telling you which directive failed and why (one label
425
425
  quirk: content replacement reports `verb: "modify"` — including plain
426
- `replaceContent()`) — see the [error contract](./docs/guides/authoring-errors.md).
426
+ `replaceContent()`) — see the [error contract](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-errors.md).
427
427
 
428
428
  ## How templates work
429
429
 
@@ -491,7 +491,7 @@ never `eq .count 2`).
491
491
  If templating gets in your way, there is always a way out: build the final
492
492
  strings in TypeScript and pass a token-free template — it renders verbatim. For the full
493
493
  language — `with`, variables, whitespace rules, output-path templating, sandbox limits, and
494
- the error taxonomy — see [Authoring `create` templates](./docs/guides/create-templates.md).
494
+ the error taxonomy — see [Authoring `create` templates](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/create-templates.md).
495
495
 
496
496
  ## Scaffolding a folder of templates
497
497
 
@@ -561,7 +561,7 @@ placeholder if the folder's presence matters) while `include`/`exclude` filters
561
561
  eliminate every entry reject loudly, nested symlinked directories are skipped
562
562
  silently while a symlinked `from` root rejects outright, and a single call caps at 10,000
563
563
  entries. Full edge-and-error semantics:
564
- [`scaffold` in Authoring verbs](./docs/guides/authoring-verbs.md#scaffold).
564
+ [`scaffold` in Authoring verbs](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md#scaffold).
565
565
 
566
566
  `scaffold`, `copyIn`, and `create({ templateFile })` resolve **package-local** files
567
567
  (relative to your schematic's folder), so the run must know where that package is — the CLI
@@ -659,8 +659,8 @@ as the engine will once it nets such writes out. Until then, write each file onc
659
659
 
660
660
  When string-level mutation isn't enough — "add an import to this module", "set a prop on
661
661
  this JSX element" — **dialects** provide structured, AST-aware operations for one file
662
- type: see [authoring a dialect](./docs/guides/authoring-a-dialect.md) for the full story. Seven
663
- ship today: `@pbuilder/sdk/typescript`, `@pbuilder/sdk/react`, `@pbuilder/sdk/nestjs`,
662
+ type: see [authoring a dialect](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-a-dialect.md) for the full story. The SDK
663
+ ships these: `@pbuilder/sdk/typescript`, `@pbuilder/sdk/react`, `@pbuilder/sdk/nestjs`,
664
664
  `@pbuilder/sdk/angular`, `@pbuilder/sdk/json`, `@pbuilder/sdk/yaml`, `@pbuilder/sdk/css`,
665
665
  `@pbuilder/sdk/csharp`, `@pbuilder/sdk/aspnet`, and `@pbuilder/sdk/msbuild`.
666
666
 
@@ -760,7 +760,7 @@ await json
760
760
  Named ops: `setValue`, `addKey`, `removeKey`, `renameKey`, `insertItem`, `appendItem`,
761
761
  `removeItem`, `removeValue`, `replaceItem`, `moveItem`, `merge`, `updateValue`, `moveValue`,
762
762
  `copyValue`, `sortKeys`. `.modify(fn)` exposes [jsonc-parser](https://github.com/microsoft/node-jsonc-parser).
763
- See [the JSON dialect guide](./docs/guides/json-dialect.md).
763
+ See [the JSON dialect guide](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/json-dialect.md).
764
764
 
765
765
  ### `@pbuilder/sdk/yaml`
766
766
 
@@ -779,7 +779,7 @@ await yaml
779
779
 
780
780
  Extra named ops: `setComment`, `removeComment`, `setAnchor`, `removeAnchor`, `setAlias`,
781
781
  `addMergeKey`, `setStyle`, `setTag`, `addDocument`, `removeDocument`. `.modify(fn)` exposes
782
- [yaml](https://eemeli.org/yaml/). See [the YAML dialect guide](./docs/guides/yaml-dialect.md).
782
+ [yaml](https://eemeli.org/yaml/). See [the YAML dialect guide](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/yaml-dialect.md).
783
783
 
784
784
  ### `@pbuilder/sdk/css`
785
785
 
@@ -799,7 +799,7 @@ await css
799
799
  Named ops: `setDeclaration`, `removeDeclaration`, and the query `getDeclaration(target, property)`,
800
800
  which ends the chain and resolves to `{ value, important }` (also exported as
801
801
  `getDeclaration(root, target, property)` for use inside `.modify(fn)`). `.modify(fn)` exposes
802
- [postcss](https://postcss.org/). See [the CSS dialect guide](./docs/guides/css-dialect.md).
802
+ [postcss](https://postcss.org/). See [the CSS dialect guide](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/css-dialect.md).
803
803
 
804
804
  ### `@pbuilder/sdk/csharp`
805
805
 
@@ -817,7 +817,7 @@ await csharp
817
817
 
818
818
  Named ops: `addUsing`, `addBaseType`, `addMember`, `addConstructorParameter`. `.modify(fn)` exposes
819
819
  [web-tree-sitter](https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_web) and the
820
- C# `language`. See [the C# dialect guide](./docs/guides/csharp-dialect.md).
820
+ C# `language`. See [the C# dialect guide](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/csharp-dialect.md).
821
821
 
822
822
  ### `@pbuilder/sdk/aspnet`
823
823
 
@@ -833,7 +833,7 @@ await aspnet
833
833
  .addService("Scoped", "IOrders", "SqlOrders", { serviceFrom: "Shop.Application.Ports", implementationFrom: "Shop.Infrastructure" });
834
834
  ```
835
835
 
836
- See [the ASP.NET dialect guide](./docs/guides/aspnet-dialect.md).
836
+ See [the ASP.NET dialect guide](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/aspnet-dialect.md).
837
837
 
838
838
  ### `@pbuilder/sdk/msbuild`
839
839
 
@@ -851,7 +851,7 @@ await msbuild.find("Shop.slnx").addProject("src/Shop.Api/Shop.Api.csproj", { fol
851
851
  ```
852
852
 
853
853
  Named ops: `addProjectReference`, `addProject`. `.modify(fn)` exposes [saxes](https://github.com/lddubeau/saxes).
854
- See [the MSBuild dialect guide](./docs/guides/msbuild-dialect.md).
854
+ See [the MSBuild dialect guide](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/msbuild-dialect.md).
855
855
 
856
856
  ### `@pbuilder/sdk/nestjs`
857
857
 
@@ -868,7 +868,7 @@ await nestjs
868
868
  ```
869
869
 
870
870
  Extra named ops: `addProvider`, `addController`, `addModuleImport`, `addExport`. `.modify(fn)`
871
- exposes ts-morph. See [the NestJS dialect guide](./docs/guides/nestjs-dialect.md).
871
+ exposes ts-morph. See [the NestJS dialect guide](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/nestjs-dialect.md).
872
872
 
873
873
  ### `@pbuilder/sdk/angular`
874
874
 
@@ -890,7 +890,7 @@ Extra named ops: `addComponentImport`, `addComponentProvider`, `addRootProvider`
890
890
  `addLazyRoute`, `addInjection`, `addInput`, `addModel`, `addOutput`, `addSignal`, `addComputed`,
891
891
  `addNgModuleImport`, `addDeclaration`, `addNgModuleProvider`, `addNgModuleExport`, `addBootstrap`.
892
892
  `.modify(fn)` exposes ts-morph. See
893
- [the Angular dialect guide](./docs/guides/angular-dialect.md).
893
+ [the Angular dialect guide](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/angular-dialect.md).
894
894
 
895
895
  ### `.modify()` — the universal escape hatch
896
896
 
@@ -924,7 +924,7 @@ still flushes as a **single** write. Two things to respect:
924
924
  boundary.
925
925
  - **`.modify()` runs with full process privilege — it is not a sandbox.** Your own
926
926
  callbacks are your own trust; before importing a *third-party* dialect or op-pack built
927
- on it, read [SECURITY.md](./SECURITY.md).
927
+ on it, read [SECURITY.md](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/SECURITY.md).
928
928
 
929
929
  ### `.inspect()` — reading the AST back
930
930
 
@@ -949,7 +949,7 @@ a node you keep goes stale after the next edit.
949
949
  ### Going deeper
950
950
 
951
951
  Everything dialect-related lives in one reference page —
952
- [Authoring a dialect](./docs/guides/authoring-a-dialect.md): the complete method-by-method
952
+ [Authoring a dialect](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-a-dialect.md): the complete method-by-method
953
953
  contracts of both shipped dialects (collision rules, idempotency, rejection semantics),
954
954
  how coalescing turns chained edits into one directive, async usage, and building a dialect
955
955
  of your own with `defineDialect`/`defineOpPack`, validated by the conformance kit (the
@@ -959,14 +959,14 @@ is written down.
959
959
 
960
960
  ## Documentation
961
961
 
962
- The full reading path lives in [`docs/guides/`](./docs/guides/README.md):
962
+ The full reading path lives in [`docs/guides/`](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/README.md):
963
963
 
964
- 1. [Quickstart](./docs/guides/quickstart.md) — standalone factory package, tsconfig, codegen, test.
965
- 2. [Authoring verbs](./docs/guides/authoring-verbs.md) — the seven verbs + `find().read()` in full.
966
- 3. [Authoring `create` templates](./docs/guides/create-templates.md) — the template language.
967
- 4. [Error contract](./docs/guides/authoring-errors.md) — `AuthoringError` and recovery.
968
- 5. [Pending Directives](./docs/guides/pending-directives.md) — previewing pending changes.
969
- 6. [Authoring a dialect](./docs/guides/authoring-a-dialect.md) — AST-aware mutation per file type.
964
+ 1. [Quickstart](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/quickstart.md) — standalone factory package, tsconfig, codegen, test.
965
+ 2. [Authoring verbs](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-verbs.md) — the seven verbs + `find().read()` in full.
966
+ 3. [Authoring `create` templates](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/create-templates.md) — the template language.
967
+ 4. [Error contract](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-errors.md) — `AuthoringError` and recovery.
968
+ 5. [Pending Directives](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/pending-directives.md) — previewing pending changes.
969
+ 6. [Authoring a dialect](https://github.com/Project-Builder-Schematics/project-builder-sdk/blob/main/docs/guides/authoring-a-dialect.md) — AST-aware mutation per file type.
970
970
 
971
971
  ## Design at a glance
972
972
 
@@ -2,7 +2,7 @@
2
2
  "manifestVersion": 1,
3
3
  "algorithm": "sha256",
4
4
  "entry": "dist/bin/pbuilder-runner.js",
5
- "packageVersion": "0.20.0",
5
+ "packageVersion": "0.21.0",
6
6
  "files": [
7
7
  {
8
8
  "path": "dist/acl/irwire/frame-reader.js",
@@ -134,7 +134,7 @@
134
134
  },
135
135
  {
136
136
  "path": "package.json",
137
- "sha256": "14a806989d9b9cb3af2dc9bf2cdd1a3e4ddd099d26ac7c23ec2bcbefd227666c"
137
+ "sha256": "25620cd1ab23de4c32c12bd6118fc0ef21efb2edc4bc3651669bd34d78ee461b"
138
138
  }
139
139
  ],
140
140
  "dialects": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pbuilder/sdk",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "The public TypeScript/Bun authoring layer for Project Builder schematics. Authors file mutations (create, replaceContent, remove, rename, move, copy, copyIn), lowers them to IR, and talks to the Project Builder engine over framed stdio (see docs/engine-sdk-wire-spec.md).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,10 +24,57 @@
24
24
  ]
25
25
  }
26
26
  },
27
+ "externals": {
28
+ "type": "object",
29
+ "description": "External collections the workspace depends on, keyed by package name.",
30
+ "additionalProperties": { "$ref": "#/$defs/externalDeclaration" }
31
+ },
27
32
  "dependencies": {
28
33
  "type": "object",
29
- "description": "Package names mapped to semver ranges.",
30
- "additionalProperties": { "type": "string" }
34
+ "deprecated": true,
35
+ "description": "Deprecated alias of externals; the CLI reads it as externals with a warning, and refuses a Manifest that holds both.",
36
+ "additionalProperties": { "$ref": "#/$defs/externalDeclaration" }
37
+ },
38
+ "dialects": {
39
+ "type": "object",
40
+ "description": "Author-defined dialects, keyed by name: a published dialect's package name, or a local dialect's name.",
41
+ "additionalProperties": {
42
+ "oneOf": [
43
+ {
44
+ "allOf": [{ "$ref": "#/$defs/publishedDeclaration" }],
45
+ "not": { "anyOf": [{ "required": ["path"] }, { "required": ["conformance"] }] },
46
+ "description": "A published dialect, installed from its registry."
47
+ },
48
+ {
49
+ "type": "object",
50
+ "required": ["path"],
51
+ "not": { "anyOf": [{ "required": ["registry"] }, { "required": ["range"] }] },
52
+ "description": "A local dialect, read where it lies in the workspace.",
53
+ "properties": {
54
+ "path": {
55
+ "type": "string",
56
+ "description": "Workspace-relative path to the dialect's base file, inside a folder of the workspace."
57
+ },
58
+ "conformance": {
59
+ "type": "string",
60
+ "description": "Workspace-relative path to the file exporting the dialect's conformance fixture data, inside the folder of its base file."
61
+ }
62
+ }
63
+ }
64
+ ]
65
+ }
66
+ },
67
+ "glob": {
68
+ "type": "object",
69
+ "description": "Settings for finding many files.",
70
+ "properties": {
71
+ "exclude": {
72
+ "type": "array",
73
+ "items": { "type": "string", "minLength": 1 },
74
+ "description": "Patterns every listing of a Run leaves out.",
75
+ "examples": [[".git/**", "node_modules/**"]]
76
+ }
77
+ }
31
78
  },
32
79
  "settings": {
33
80
  "type": "object",
@@ -74,6 +121,32 @@
74
121
  }
75
122
  },
76
123
  "$defs": {
124
+ "publishedDeclaration": {
125
+ "type": "object",
126
+ "required": ["registry", "range"],
127
+ "properties": {
128
+ "registry": {
129
+ "type": "string",
130
+ "pattern": "^[a-z][a-z0-9-]*$",
131
+ "description": "The ecosystem id the package comes from; its URL and credentials come from the ecosystem's own configuration.",
132
+ "examples": ["npm"]
133
+ },
134
+ "range": {
135
+ "type": "string",
136
+ "description": "The semver range the package may resolve to.",
137
+ "examples": ["^1.2.0"]
138
+ }
139
+ }
140
+ },
141
+ "externalDeclaration": {
142
+ "allOf": [{ "$ref": "#/$defs/publishedDeclaration" }],
143
+ "properties": {
144
+ "alias": {
145
+ "type": "string",
146
+ "description": "Another name the workspace addresses the library by; it shares one namespace with every other name in the Manifest (CA-6)."
147
+ }
148
+ }
149
+ },
77
150
  "collectionPointer": {
78
151
  "type": "object",
79
152
  "required": ["path"],