@orkestrel/scaffold 0.0.141 → 0.0.143

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/dist/bin/main.js CHANGED
@@ -10,7 +10,7 @@ import { readdirSync } from "node:fs";
10
10
  import { parseArgs } from "node:util";
11
11
  var package_default = {
12
12
  name: "@orkestrel/scaffold",
13
- version: "0.0.141",
13
+ version: "0.0.143",
14
14
  description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
15
15
  keywords: [
16
16
  "audit",
@@ -764,6 +764,111 @@ function collectQuestions(target: string, writing: boolean): readonly Question[]
764
764
  }
765
765
  ```
766
766
 
767
+ ## `exemptions.record` and `exemptions.copy` (**Exemptions**)
768
+
769
+ - **Signatures.** Computed-key writes, `\b[A-Za-z_$][\w$]*\[(?:[^\]'"\[]|\[[^\]]*\])+\]\s*=[^=>]`,
770
+ and member definitions, `\.define(?:Property|Properties)?\(`. Then resolve the object each hit
771
+ writes to the binding that creates it.
772
+ - **Reading.**
773
+ - Drop a write into a record that meets every condition of the record item (**Exemptions**): the
774
+ function that writes the record creates it as a `{ __proto__: null }` literal, fills it in a
775
+ counted loop over a list that function owns, writes one own data property per key, writes no
776
+ key twice, and returns or freezes the record.
777
+ - Drop a definition on a copy that meets every condition of the copy item (**Exemptions**): a
778
+ traversal creates the copy before it visits the copy's members, the traversal step that owns the
779
+ copy writes it, each write defines one own property, and no key is written twice.
780
+ - Keep a write into a record that a caller passed or that a parameter reaches, a write whose key
781
+ can repeat, such as a key list that can name one key twice or a tally that rewrites its key, and
782
+ a definition on a copy that another step owns. Rule each kept hit under **Running values**,
783
+ **Lists and logs**, and **Per-call state**.
784
+ - Drop a write into a typed array, and a write that `exemptions.platform` drops.
785
+
786
+ Hit fixture, `exemptions.record.hit.ts`:
787
+
788
+ ```ts
789
+ function countWords(words: readonly string[], counts: Record<string, number>): void {
790
+ for (let index = 0; index < words.length; index++) {
791
+ const word = words[index]
792
+ if (word !== undefined) counts[word] = (counts[word] ?? 0) + 1
793
+ }
794
+ }
795
+ ```
796
+
797
+ Hit fixture, `exemptions.copy.hit.ts`:
798
+
799
+ ```ts
800
+ interface TreeFrame {
801
+ readonly source: Readonly<Record<string, unknown>>
802
+ readonly copy: object
803
+ readonly parent: TreeFrame | undefined
804
+ }
805
+
806
+ function fillFrame(frame: TreeFrame): void {
807
+ for (const key of Object.keys(frame.source)) {
808
+ Object.defineProperty(frame.copy, key, { value: frame.source[key], enumerable: true })
809
+ }
810
+ if (frame.parent !== undefined) {
811
+ Object.defineProperty(frame.parent.copy, 'last', { value: frame.copy, configurable: true })
812
+ }
813
+ }
814
+ ```
815
+
816
+ Clear fixture, `exemptions.record.clear.ts`:
817
+
818
+ ```ts
819
+ function selectMembers(
820
+ source: Readonly<Record<string, unknown>>,
821
+ keys: readonly string[],
822
+ ): Readonly<Record<string, unknown>> {
823
+ const present = [...new Set(keys)].filter((key) => Object.hasOwn(source, key))
824
+ const result: Record<string, unknown> = { __proto__: null }
825
+ for (let index = 0; index < present.length; index++) {
826
+ const key = present[index]
827
+ if (key !== undefined) result[key] = source[key]
828
+ }
829
+ return Object.freeze(result)
830
+ }
831
+ ```
832
+
833
+ Clear fixture, `exemptions.copy.clear.ts`:
834
+
835
+ ```ts
836
+ interface CopyFrame {
837
+ readonly source: object
838
+ readonly copy: Record<string, unknown>
839
+ }
840
+
841
+ function captureValue(
842
+ value: unknown,
843
+ copies: Map<object, Record<string, unknown>>,
844
+ pending: CopyFrame[],
845
+ ): unknown {
846
+ if (typeof value !== 'object' || value === null) return value
847
+ const known = copies.get(value)
848
+ if (known !== undefined) return known
849
+ const copy: Record<string, unknown> = { __proto__: null }
850
+ copies.set(value, copy)
851
+ pending.push({ source: value, copy })
852
+ return copy
853
+ }
854
+
855
+ function cloneGraph(root: object): unknown {
856
+ const copies = new Map<object, Record<string, unknown>>()
857
+ const pending: CopyFrame[] = []
858
+ const clone = captureValue(root, copies, pending)
859
+ for (const frame of pending) {
860
+ for (const key of Object.keys(frame.source)) {
861
+ Object.defineProperty(frame.copy, key, {
862
+ value: captureValue(Reflect.get(frame.source, key), copies, pending),
863
+ enumerable: true,
864
+ })
865
+ }
866
+ Object.freeze(frame.copy)
867
+ }
868
+ return clone
869
+ }
870
+ ```
871
+
767
872
  ## `percall.builtins` (**Per-call state**)
768
873
 
769
874
  - **Signatures.** In an `async` function, or one that registers callbacks, find every local
@@ -78,7 +78,7 @@ Treat generated package identifiers, versions, layers, and dependency ranges as
78
78
  | `@orkestrel/reason` | `0.0.20` | L2 | `@orkestrel/emitter` `^0.0.18`, `@orkestrel/contract` `^0.0.26` | |
79
79
  | `@orkestrel/relation` | `0.0.26` | L3 | `@orkestrel/emitter` `^0.0.18`, `@orkestrel/contract` `^0.0.26`, `@orkestrel/database` `^0.0.28` | |
80
80
  | `@orkestrel/router` | `0.0.24` | L2 | `@orkestrel/abort` `^0.0.19`, `@orkestrel/emitter` `^0.0.18`, `@orkestrel/contract` `^0.0.26` | |
81
- | `@orkestrel/scaffold` | `0.0.140` | L3 | `@orkestrel/console` `^0.0.22`, `@orkestrel/emitter` `^0.0.18`, `@orkestrel/process` `^0.0.22`, `@orkestrel/contract` `^0.0.26`, `@orkestrel/markdown` `^0.0.23`, `@orkestrel/template` `^0.0.16` | |
81
+ | `@orkestrel/scaffold` | `0.0.142` | L3 | `@orkestrel/console` `^0.0.22`, `@orkestrel/emitter` `^0.0.18`, `@orkestrel/process` `^0.0.22`, `@orkestrel/contract` `^0.0.26`, `@orkestrel/markdown` `^0.0.23`, `@orkestrel/template` `^0.0.16` | |
82
82
  | `@orkestrel/sea` | `0.0.25` | L3 | `@orkestrel/emitter` `^0.0.18`, `@orkestrel/process` `^0.0.22`, `@orkestrel/contract` `^0.0.26` | |
83
83
  | `@orkestrel/server` | `0.0.30` | L3 | `@orkestrel/abort` `^0.0.19`, `@orkestrel/codec` `^0.0.12`, `@orkestrel/router` `^0.0.24`, `@orkestrel/emitter` `^0.0.18`, `@orkestrel/timeout` `^0.0.19`, `@orkestrel/contract` `^0.0.26` | |
84
84
  | `@orkestrel/sqlite` | `0.0.20` | L1 | `@orkestrel/contract` `^0.0.26` | |
@@ -116,6 +116,13 @@ The non-negotiables and design laws in `AGENTS.md` apply without exception and a
116
116
  requires, such as zlib, a PNG encoder, or `Buffer`, which is a platform-API write, or as the
117
117
  result a counted loop computes into a typed array its own function creates; write no index
118
118
  twice;
119
+ - a null-prototype record (`{ __proto__: null }`) that a function creates and fills in a counted
120
+ loop over a list that function owns, with one own data property per key, each key written once,
121
+ as the record that function returns or freezes; never write into a record a caller passed or
122
+ that a parameter reaches;
123
+ - a copy that a traversal creates before it visits the copy's members, so that a cycle can reach
124
+ the copy, filled with one own property per key, each key written once, by the traversal step
125
+ that owns the copy;
119
126
  - a counted loop's index and its accumulators, which the **Counted loops** bullet admits.
120
127
  - **Per-call state.** Keep state that the awaits or callbacks of one call change, other than a log,
121
128
  in `#` fields of an entity created for that call. Treat a list that more than one concurrently
@@ -302,19 +302,19 @@ then runs the configured scoped checks that prove environment isolation.
302
302
  - Lint is a separate complementary gate; neither lint nor root checking replaces
303
303
  environment-isolation checks.
304
304
 
305
- | Scope | `lib` | `types` | Permitted host globals |
306
- | ---------------------------- | --------------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
307
- | `src:core`, `app:core` | `["ESNext","WebWorker"]` | `[]` | WHATWG web interop: fetch family, streams, URL, Abort, encoders, crypto, timers, console, DOMException, structuredClone; no DOM, no Node |
308
- | `src:browser`, `app:browser` | `["ESNext","DOM","DOM.Iterable"]` | `["vite/client"]` | DOM; no Node |
309
- | `src:server`, `app:server` | `["ESNext"]` | `["node"]` | Node; no DOM |
310
- | `src:styles`, `src:<name>` | `["ESNext"]` | `["vite/client"]` | Vite SCSS module declaration only |
311
- | `src:vue` | `["ESNext","DOM","DOM.Iterable"]` | `["vite/client"]` | DOM; no Node |
312
- | `app:vue` | `["ESNext","DOM","DOM.Iterable"]` | `["vite/client","vue"]` | DOM and Vue; no Node |
305
+ | Scope | `lib` | `types` | Permitted host globals |
306
+ | ------------------------------------- | --------------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
307
+ | `src:core`, `app:core` | `["ESNext","WebWorker"]` | `[]` | Web interop: fetch family, streams, URL, Abort, encoders, crypto, timers, console, DOMException, structuredClone, WebAssembly; no DOM, no Node |
308
+ | `src:browser`, `app:browser` | `["ESNext","DOM","DOM.Iterable"]` | `["vite/client"]` | DOM; no Node |
309
+ | `src:server`, `app:server`, `src:bin` | `["ESNext","WebWorker"]` | `["node"]` | Node, plus the core globals; no DOM |
310
+ | `src:styles`, `src:<name>` | `["ESNext"]` | `["vite/client"]` | Vite SCSS module declaration only |
311
+ | `src:vue` | `["ESNext","DOM","DOM.Iterable"]` | `["vite/client"]` | DOM; no Node |
312
+ | `app:vue` | `["ESNext","DOM","DOM.Iterable"]` | `["vite/client","vue"]` | DOM and Vue; no Node |
313
313
 
314
314
  Strict core is load-bearing:
315
315
 
316
316
  - Put a host-dependent helper in its host environment. A `generateId` reading `node:crypto` belongs in server, not core.
317
- - Core declares `WebWorker` to widen the WHATWG interop surface, not to admit a worker host. Policy fences these worker-only globals out of core sources: `name`, `onrtctransform`, `close`, `postMessage`, `dispatchEvent`, `location`, `onerror`, `onlanguagechange`, `onoffline`, `ononline`, `onrejectionhandled`, `onunhandledrejection`, `self`, `importScripts`, `fonts`, `caches`, `crossOriginIsolated`, `indexedDB`, `isSecureContext`, `origin`, `scheduler`, `createImageBitmap`, `reportError`, `cancelAnimationFrame`, `requestAnimationFrame`, `onmessage`, `onmessageerror`, `addEventListener`, `removeEventListener`.
317
+ - Core declares `WebWorker` to widen the web interop surface, not to admit a worker host. Give `src:server`, `app:server`, and `src:bin` core's library; a browser scope keeps DOM, which declares every global core names. The vendored `.oxlintrc.json` fences these worker-only globals out of `src/core`, `app/core`, `src/server`, `app/server`, and `src/bin` sources through `no-restricted-globals`, which reads an unresolved identifier and not a `globalThis` member: `name`, `onrtctransform`, `close`, `postMessage`, `dispatchEvent`, `location`, `onerror`, `onlanguagechange`, `onoffline`, `ononline`, `onrejectionhandled`, `onunhandledrejection`, `self`, `importScripts`, `fonts`, `caches`, `crossOriginIsolated`, `indexedDB`, `isSecureContext`, `origin`, `scheduler`, `createImageBitmap`, `reportError`, `cancelAnimationFrame`, `requestAnimationFrame`, `onmessage`, `onmessageerror`, `addEventListener`, `removeEventListener`.
318
318
 
319
319
  Build/check config alignment:
320
320