zopia 0.3.0 β 0.4.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/CHANGELOG.md +40 -0
- package/README.md +48 -16
- package/docs/07-api-docs.md +77 -2
- package/docs/09-configuration.md +2 -2
- package/docs/10-usage.md +26 -3
- package/package.json +10 -2
- package/src/conversions/api-docs-generate.ts +6 -12
- package/src/conversions/api-docs-names.ts +54 -0
- package/src/conversions/manifest-writer.ts +1 -1
- package/src/conversions/openapi-to-api-docs.ts +5 -10
- package/src/runtime/create-api-docs.ts +321 -0
- package/src/runtime.ts +10 -0
- package/docs/01-overview.md +0 -94
- package/docs/02-targets.md +0 -55
- package/docs/03-roadmap.md +0 -205
- package/docs/04-architecture.md +0 -345
- package/docs/05-concepts.md +0 -239
- package/docs/06-conversions.md +0 -493
- package/docs/08-components.md +0 -223
- package/docs/11-testing.md +0 -267
- package/docs/12-standards.md +0 -242
- package/docs/README.md +0 -42
- package/docs/publish-workflow.yml.example +0 -48
package/docs/12-standards.md
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
# π Engineering Standards
|
|
2
|
-
|
|
3
|
-
How zopia is written, committed, and released. These standards apply to
|
|
4
|
-
**source, tests, and documentation equally** β "pure, safe, clean, with
|
|
5
|
-
descriptions" (T-16) is the headline; everything below makes that checkable.
|
|
6
|
-
|
|
7
|
-
## π£ Toolchain
|
|
8
|
-
|
|
9
|
-
| π§© Piece | π Standard | π |
|
|
10
|
-
| --- | --- | --- |
|
|
11
|
-
| Runtime & toolchain | **Bun β₯ 1.1** β install, run, test, CLI (D-01) | T-14 |
|
|
12
|
-
| Language | **TypeScript 5.9+**, `strict: true`, ESM-only (`"type": "module"`), target ES2022 | β |
|
|
13
|
-
| Test runner | **Vitest 4.1.11** (exactly pinned; D-02) β `bun run test` | T-13 |
|
|
14
|
-
| Package manager lockfiles | authoritative `bun.lock`; npm/Node compatibility `package-lock.json` | β |
|
|
15
|
-
| Node compatibility | generated code must also run on Node β₯ 18 (no Bun-only APIs in generated output) | β |
|
|
16
|
-
|
|
17
|
-
> π Generated `index.ts` files use **no** Bun-only or Node-only APIs β only
|
|
18
|
-
> `zod`, `km-api`, and relative imports (R-502), so the tree runs anywhere.
|
|
19
|
-
|
|
20
|
-
### π£ Bun gate
|
|
21
|
-
|
|
22
|
-
`packageManager` pins the repository's Bun version and the checked-in `bun.lock`
|
|
23
|
-
pins every dependency. Run the complete gate with one PowerShell- and shell-valid
|
|
24
|
-
command:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
bun run release:check
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
The gate rejects a different runtime/version, performs a frozen Bun install,
|
|
31
|
-
runs strict TypeScript, the full Vitest suite, and coverage gates, exercises both
|
|
32
|
-
the direct CLI and package binary, then generates and reverses a component-based
|
|
33
|
-
tree so Bun itself must import the generated `.ts` modules. It also installs the
|
|
34
|
-
exact npm archive in an isolated offline consumer and exercises its package-root
|
|
35
|
-
import and CLI. Temporary output is created under `os.tmpdir()` and always
|
|
36
|
-
removed. `bun:gate`, `release:check`, and `prepublishOnly` share this one gate
|
|
37
|
-
implementation so local, CI, and publish-time validation cannot drift.
|
|
38
|
-
|
|
39
|
-
`package-lock.json` remains checked in as the npm/Node compatibility resolution;
|
|
40
|
-
`bun.lock` is authoritative for the Bun gate and release workflow.
|
|
41
|
-
|
|
42
|
-
**CI publishing** β `docs/publish-workflow.yml.example` is the ready-made
|
|
43
|
-
GitHub Actions workflow: drop it at `.github/workflows/publish.yml` (the
|
|
44
|
-
sandbox's GitHub App token cannot push workflow files β adding it once via
|
|
45
|
-
the GitHub UI or an owner-shell works), then every GitHub Release publishes
|
|
46
|
-
to npm with tagβversion verification and `npm publish --provenance --access
|
|
47
|
-
public` (the `prepublishOnly` hook re-runs the same Bun gate inside CI, so a
|
|
48
|
-
publish cannot bypass it). The pipeline reads an `NPM_TOKEN` repository
|
|
49
|
-
secret or npm trusted-publishing; credentials never appear in the repository
|
|
50
|
-
or in chat.
|
|
51
|
-
|
|
52
|
-
## π Code standard
|
|
53
|
-
|
|
54
|
-
| # | Rule |
|
|
55
|
-
| --- | --- |
|
|
56
|
-
| R-1001 | π§Ό **Pure transforms, explicit adapters** β in-memory schema/operation transforms are pure; documented file reads, generated-tree writes/imports, and process output live at public adapter/CLI boundaries (R-405) |
|
|
57
|
-
| R-1002 | π§ **Narrow at decisions** β user-facing option/result contracts are concrete; deliberately open JSON/OpenAPI records are narrowed before branching, rendering, or filesystem use |
|
|
58
|
-
| R-1003 | π¦ **Named exports only** β no default exports anywhere in `src/` (generated files may have defaults: that's their contract, R-732) |
|
|
59
|
-
| R-1004 | π§© **One concern per module** β modules are divided by conversion/boundary responsibility; `src/index.ts` remains re-exports only |
|
|
60
|
-
| R-1005 | π§΅ **Cycle-aware traversal** β reference chains carry seen sets and schema definition/dependency traversals carry cycle state; cycles terminate as errors or `z.lazy()` according to reference kind (R-402) |
|
|
61
|
-
| R-1006 | π― **Determinism (P-1)** β canonical code-unit order everywhere (R-401), never host-locale collation; no `Date.now()`, `Math.random()`, or environment reads in the pure core |
|
|
62
|
-
| R-1007 | π‘οΈ **Safe I/O** β every generated write passes the outDir guard (R-406); no shell-out, `eval`, or `new Function` in conversion paths |
|
|
63
|
-
|
|
64
|
-
## π JSDoc standard (T-12)
|
|
65
|
-
|
|
66
|
-
**Every exported symbol** β function, class, interface, type alias, enum, and
|
|
67
|
-
constant β carries JSDoc, including declarations exposed through a named export
|
|
68
|
-
list rather than an `export` modifier. The audited public boundary also includes
|
|
69
|
-
every exposed member of an exported interface, class, or nested type-literal
|
|
70
|
-
shape; public methods, constructors, call/construct signatures, and
|
|
71
|
-
function-valued properties are callables. Private and protected implementation
|
|
72
|
-
members are excluded. The AST contract suite scans every production module
|
|
73
|
-
under `src/`, not only the package-root re-export list. The template:
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
/**
|
|
77
|
-
* π One-line summary β what it does, in the active voice.
|
|
78
|
-
*
|
|
79
|
-
* π Optional longer description: contracts, invariants, edge cases.
|
|
80
|
-
* Links to the governing rule, e.g. "See R-641 for the media-type policy."
|
|
81
|
-
*
|
|
82
|
-
* @param input π What it accepts (units/range when relevant).
|
|
83
|
-
* @param options π Behaviour knobs; each field documented inline.
|
|
84
|
-
* @returns π What it produces.
|
|
85
|
-
* @throws {ZopiaError} π `ZOPIA_β¦` β when.
|
|
86
|
-
* @example
|
|
87
|
-
* ```ts
|
|
88
|
-
* const r = await openApiToApiDocs('swagger.json', { mode: 'flat' });
|
|
89
|
-
* ```
|
|
90
|
-
* @see [docs/06-conversions.md β Engine β’](./06-conversions.md)
|
|
91
|
-
*/
|
|
92
|
-
export function openApiToApiDocs(
|
|
93
|
-
input: string | Record<string, unknown>,
|
|
94
|
-
options?: ZopiaGenerateOptions,
|
|
95
|
-
): Promise<ZopiaGenerateResult> { /* β¦ */ }
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
| # | Rule |
|
|
99
|
-
| --- | --- |
|
|
100
|
-
| R-131 | every `@param`, `@returns`, `@throws` is **specific** β no "the options", always *which* option and *what it does* |
|
|
101
|
-
| R-132 | `@default` on every optional config field |
|
|
102
|
-
| R-133 | `@example` is **runnable** code; the contract suite extracts each TypeScript block and typechecks it semantically against the real public source API |
|
|
103
|
-
| R-134 | internal (non-exported) helpers get a one-line comment when the *why* is non-obvious |
|
|
104
|
-
| R-135 | the docs link in `@see` must resolve (checked in CI) |
|
|
105
|
-
|
|
106
|
-
## π Errors
|
|
107
|
-
|
|
108
|
-
| # | Rule |
|
|
109
|
-
| --- | --- |
|
|
110
|
-
| R-141 | one base class `ZopiaError` (`code`, `at?`, actionable `hint`, preserved `cause?`) at every public/CLI boundary; `ZOPIA_ERROR_CODES` is the immutable runtime catalogue and TypeScript-union source β full table in [Architecture β Error model](04-architecture.md#-error-model) |
|
|
111
|
-
| R-142 | codes are stable strings, UPPER_SNAKE, prefixed `ZOPIA_`; adding a code is a **MINOR** change |
|
|
112
|
-
| R-143 | `hint` is always an *action* ("enable `insertComponents` first"), never a lecture; translated parser/import/filesystem failures retain the original value in `cause` |
|
|
113
|
-
| R-144 | warnings (not errors) for lossy-but-recoverable conversions (D-12) β shape: `{ code: ZopiaWarningCode, at?: string, message: string }`; codes come from the stable `ZOPIA_WARNING_CODES` catalogue, `at` is an escaped JSON Pointer when discoverable, and public emission is sanitized, deduplicated, deterministic, and callback/result consistent |
|
|
114
|
-
|
|
115
|
-
## π‘οΈ Safety
|
|
116
|
-
|
|
117
|
-
| # | Rule |
|
|
118
|
-
| --- | --- |
|
|
119
|
-
| R-151 | **outDir guard** (R-406) β canonicalize + prefix-check every path, reject symlinked generated ancestors, exclusively create manifest temporary files, and prune only paths owned by a validated prior manifest; unit-tested with traversal/symlink attempts |
|
|
120
|
-
| R-152 | **Trusted-input contract (D-08)** β engine β£ imports generated `.ts`; the manifest is the trust marker. Documented loudly in [Usage](10-usage.md) and in the CLI help |
|
|
121
|
-
| R-153 | **No secret handling** β zopia reads specs and writes docs; it never touches credentials, never sends data anywhere (no network at all) |
|
|
122
|
-
| R-154 | **Predictable failure** β configuration, source, layout, and component-render validation happen before governed writes; every surfaced write/import failure is typed. Individual manifest replacement is atomic, while the generated tree is updated as ordered guarded file writes rather than as one directory transaction |
|
|
123
|
-
|
|
124
|
-
## π·οΈ Naming
|
|
125
|
-
|
|
126
|
-
| π§© Thing | π Convention |
|
|
127
|
-
| --- | --- |
|
|
128
|
-
| Files | `kebab-case.ts` (`zod-to-json-schema.ts`) |
|
|
129
|
-
| Modules/dirs | `kebab-case`, plural for collections (`conversions/`, `fixtures/`) |
|
|
130
|
-
| Functions | `camelCase`, verb-first (`zodToJsonSchema`, `normalizeOpenApiDocument`) |
|
|
131
|
-
| Types/interfaces | `PascalCase` (`GenerateApiDocsOptions`, `OpenApiOperationIR`) |
|
|
132
|
-
| Constants | `UPPER_SNAKE_CASE` (`ZOPIA_MANIFEST_SCHEMA`) |
|
|
133
|
-
| Tests | centralized under `tests/` as `*.test.ts`; contract and round-trip suites use dedicated subdirectories; `it()` cites rules (R-122) |
|
|
134
|
-
| Generated identifiers | fixed by [API docs β Naming](07-api-docs.md#-naming-conventions-fixed) |
|
|
135
|
-
|
|
136
|
-
## π Commit convention
|
|
137
|
-
|
|
138
|
-
[Conventional Commits](https://www.conventionalcommits.org/), no Co-Authored noise:
|
|
139
|
-
|
|
140
|
-
```text
|
|
141
|
-
<type>(<scope>): <imperative summary β€ 72 chars>
|
|
142
|
-
|
|
143
|
-
[optional body β WHY, not WHAT]
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
| π·οΈ Type | π Use for |
|
|
147
|
-
| --- | --- |
|
|
148
|
-
| `feat` | new engine behaviour, option, CLI flag |
|
|
149
|
-
| `fix` | bug fixes (mapping corrections count as fixes β they are *spec* corrections) |
|
|
150
|
-
| `docs` | documentation-only changes |
|
|
151
|
-
| `test` | tests without behaviour change (e.g. new golden fixtures) |
|
|
152
|
-
| `refactor` | internal restructuring, zero behaviour change |
|
|
153
|
-
| `chore` / `ci` / `build` | tooling, workflows, packaging |
|
|
154
|
-
|
|
155
|
-
> π **Rule R-161** β *a commit that changes behaviour is not merged without
|
|
156
|
-
> its `CHANGELOG.md` entry* (below) and its doc update (if it changes a
|
|
157
|
-
> documented contract) β one commit, one story.
|
|
158
|
-
|
|
159
|
-
## π Changelog convention
|
|
160
|
-
|
|
161
|
-
> π― **T-17** β *changelog after commits.*
|
|
162
|
-
|
|
163
|
-
| # | Rule |
|
|
164
|
-
| --- | --- |
|
|
165
|
-
| R-171 | every user-visible commit appends a bullet under `## [Unreleased]` in `CHANGELOG.md` β same commit (R-161) |
|
|
166
|
-
| R-172 | entries are **user-phrased** ("reverse conversion now restores `servers`"), not internal ("fixed serializer.ts:42") |
|
|
167
|
-
| R-173 | on release: `[Unreleased]` β `[x.y.z] - YYYY-MM-DD`; a fresh empty `[Unreleased]` is created |
|
|
168
|
-
| R-174 | sections per [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): Added / Changed / Deprecated / Removed / Fixed / Security β with the project's emoji markers (β¨ π β οΈ ποΈ π π‘οΈ π π π§) |
|
|
169
|
-
|
|
170
|
-
The contract suite audits every post-release commit that changes `src/`, public
|
|
171
|
-
documentation, the package entry points, or package metadata and fails unless
|
|
172
|
-
that same commit also changes `CHANGELOG.md`. The static Unreleased check remains
|
|
173
|
-
active in shallow/source-only environments where the release boundary is absent.
|
|
174
|
-
|
|
175
|
-
## π Docs convention
|
|
176
|
-
|
|
177
|
-
| # | Rule |
|
|
178
|
-
| --- | --- |
|
|
179
|
-
| R-181 | **docs ship with code** β a behaviour change and its doc change land in the same commit (R-161) |
|
|
180
|
-
| R-182 | **Style** β emoji section headers, tables for anything list-like, code blocks with language tags, one idea per paragraph |
|
|
181
|
-
| R-183 | **Numbering** β targets `T-β¦`, rules `R-β¦`, decisions `D-β¦`, warnings/errors `ZOPIA_β¦` β referenced from code & tests |
|
|
182
|
-
| R-184 | **Cross-links** β every doc links forward & back; the map in [`docs/README.md`](README.md) stays current |
|
|
183
|
-
| R-185 | **Diagrams** β Mermaid for flow, ASCII trees for file layouts (both render on GitHub) |
|
|
184
|
-
| R-186 | **Status honesty** β "planned/contract" is labeled π§ until implemented; never documented as done |
|
|
185
|
-
|
|
186
|
-
## π’ Release flow
|
|
187
|
-
|
|
188
|
-
```text
|
|
189
|
-
1. π bump version (SemVer β [Roadmap β Versioning](03-roadmap.md#-versioning))
|
|
190
|
-
2. π CHANGELOG: [Unreleased] β [x.y.z] - YYYY-MM-DD
|
|
191
|
-
3. π README status banner updated to the new phase
|
|
192
|
-
4. π’ bun run release:check
|
|
193
|
-
5. π·οΈ git tag v0.1.0
|
|
194
|
-
6. π¦ npm publish (package.json: name "zopia", peerDeps zod ^4 + km-api ^0.4 β
|
|
195
|
-
the published `km-api@0.4.1` dependency is installed, D-15)
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
| # | Release-readiness rule |
|
|
199
|
-
| --- | --- |
|
|
200
|
-
| R-191 | **One release identity** β `package.json`, the manifest writer, lockfile, versioned changelog heading, and README status agree on the SemVer version |
|
|
201
|
-
| R-192 | **Minimal verified artifact** β npm receives only `bin/`, `src/`, `docs/`, and the package/legal markdown; the exact archive is installed in isolation and must pass library-import plus generate/reverse CLI smoke tests |
|
|
202
|
-
| R-193 | **Publish guard** β `prepublishOnly` runs the pinned-Bun release gate, including typecheck, all tests, coverage, direct runtime checks, and R-192's packed-consumer check |
|
|
203
|
-
|
|
204
|
-
Preparing these artifacts does not publish or tag a release. Those external steps
|
|
205
|
-
remain explicit maintainer actions after the committed release gate is green.
|
|
206
|
-
|
|
207
|
-
## π¦ Dependencies
|
|
208
|
-
|
|
209
|
-
| π¦ Dep | π·οΈ Kind | π Rule |
|
|
210
|
-
| --- | --- | --- |
|
|
211
|
-
| `zod` `^4` | peer + dev | engines β /β‘ and generated schemas use it at runtime; tests exercise both paths |
|
|
212
|
-
| `km-api` `^0.4.1` (0.4.x) | peer + dev | generated code imports it and engine β£ loads those results β its type surface (method/status codes/content types/operationId) is part of zopia's output contract (D-14). **Resolution:** published npm package `km-api@^0.4.1` (D-15) |
|
|
213
|
-
| *(no `dependencies` entries)* | β | **zero direct/bundled runtime dependencies** in v0.1.0 (D-11); runtime capabilities are declared as peers and every new dependency needs a D-β¦ decision |
|
|
214
|
-
|
|
215
|
-
## π Key decisions
|
|
216
|
-
|
|
217
|
-
> Every non-obvious choice is recorded here β ID, decision, rationale.
|
|
218
|
-
> Changing one is a **MINOR** change that also updates the affected docs.
|
|
219
|
-
|
|
220
|
-
| π | Decision | Rationale |
|
|
221
|
-
| --- | --- | --- |
|
|
222
|
-
| **D-01** | π£ Bun is the primary runtime/toolchain (Node β₯ 18 stays compatible for *generated* code) | project standard; speed; native TS execution β required by the "bun must run the project" target (T-14) |
|
|
223
|
-
| **D-02** | π§ͺ Vitest is the test runner (not `bun:test`) | requested standard; mature snapshot/coverage ecosystem |
|
|
224
|
-
| **D-03** | β builds on Zod v4's built-in `z.toJSONSchema()` | the third-party `zod-to-json-schema` is deprecated (Nov 2025); Zod v4 is self-sufficient; fewer deps (D-11) |
|
|
225
|
-
| **D-04** | β‘ is a custom emitter (Zod's experimental `z.fromJSONSchema()` is test-only) | we control the *style* of emitted code (the product surface); experimental APIs don't sit on an output path; `z.fromJSONSchema` still cross-checks us in S-49 |
|
|
226
|
-
| **D-05** | π£οΈ generated `pathShape` uses OpenAPI `{param}` syntax | km-api's dual syntax makes it lossless both ways; matches the spec |
|
|
227
|
-
| **D-06** | π¦ every generated tree carries `.zopia-manifest.json` (written by default β the `manifest` option, on unless explicitly disabled; no timestamps) | flat names can collide; component schemas, `$ref` placement (`refs`) and non-representable keywords (`overlay`) have no home in Zod code; the manifest is what makes reverse conversion lossless and deterministic |
|
|
228
|
-
| **D-07** | π default layout is `directory` | mirrors the spec's path structure β the most intuitive mapping of "route = directory path" |
|
|
229
|
-
| **D-08** | β£ imports generated `.ts` at runtime (Bun) | the files *are* the source of truth (developers may extend them); importing is the only way to read edited schemas; trust is bounded by the manifest (R-152) |
|
|
230
|
-
| **D-09** | π€ reverse output defaults to OpenAPI **3.1** | 3.1 schemas = full JSON Schema 2020-12 (the "same standard" the project is built on); 3.0 remains one flag away |
|
|
231
|
-
| **D-10** | π MIT license | consistency with the whole `km-*` ecosystem |
|
|
232
|
-
| **D-11** | π¦ zero direct/bundled runtime dependencies in v0.1.0 | `zod` + `km-api` are explicit peers used by conversion/generated-code paths; a small owned dependency surface reduces install and security risk (P-6) |
|
|
233
|
-
| **D-12** | β οΈ unsupported facts never fail silently β every engine emits the shared structured warning; schema emission adds a canonical `// @zopia:warn` marker; restorable source facts also enter the manifest; CLI diagnostics use stderr only | "pure, safe, clean" means *visible* loss without corrupting generated output; reverse conversion restores manifest-recorded facts verbatim where the target dialect permits |
|
|
234
|
-
| **D-13** | π v0.1.0 input is JSON only (external `$ref` resolution β Phase 2, same-folder in v0.2.x via D-17; **YAML input lifted in v0.2.x via D-16**); server variables are manifest-preserved but warn because endpoint modules cannot represent them | keeps the v0.1.0 parsing/resolution contract tight while round-tripping document-frame data |
|
|
235
|
-
| **D-14** | π zopia **targets km-api β₯ 0.4.1** β the output contract is "the generated tree **typechecks** against installed published km-api 0.4.1" (enforced by the golden-tree test, R-126). Eight methods including `trace`, custom/`default` statuses, arbitrary MIME strings, and `operationId` are emitted as code. Published 0.4.1 enumerates known MIME values, so exact OpenAPI extension strings cross one narrow type-only assertion; non-representable parameter metadata and response `headers` remain in manifest overlays (R-635/R-754) | `makeApiConfig` is a type-level factory with no runtime validation. The dedicated strict golden `tsc` gate verifies its real published declarations; exact runtime MIME values remain reversible. Re-verify the boundary on every km-api bump |
|
|
236
|
-
| **D-15** | π¦ **km-api is consumed from npm** β zopia depends on the published `km-api@^0.4.1`; no Git submodule or unpublished commit is required. | reproducible fresh clones and published dependency resolution |
|
|
237
|
-
| **D-16** | π **v0.2.x YAML input is parsed by an owned, deterministic YAML 1.2 core-schema parser** (`src/conversions/yaml.ts`) β block/flow collections, plain/single/double-quoted scalars, literal/folded block scalars with chomping/indent indicators, comments, anchors/aliases/`<<` merge keys (explicit keys win), `%YAML 1.x` directives, single `---`/`...` document; keys are stringified like a JSON round-trip; tab indentation, duplicate keys, undefined aliases, custom tags, multi-document streams, complex `?` keys, and non-JSON numbers (`.inf`/`.nan`) fail with `ZOPIA_SPEC_INVALID_YAML` | a dependency (D-11) would import parser state we cannot pin for determinism (P-1); the subset covers real-world `spec.yaml` files fully, and every rejection is a typed, line-located diagnostic instead of silent approximation (P-4) |
|
|
238
|
-
| **D-17** | π **v0.2.x file input resolves same-folder external `$ref`s by bundling them inline before normalization** (`src/conversions/openapi-external-ref.ts`) β `other.(json|yaml|yml)` with `./β¦` spellings, an optional `#` JSON Pointer ('' = whole file); sibling files are read once (P-1), bundled content is deep-cloned, nested cross-file refs resolve against their owning file, and sibling keys win over bundled content; URLs, `../`, absolute paths, subdirectories, drives, and non-spec extensions keep `ZOPIA_REF_EXTERNAL`; unreadable targets, missing pointers, circular chains, sibling-on-scalar targets, and >512-level expansion fail typed; reverse conversion emits the bundled single file and never re-splits | one predictable grammar keeps resolution deterministic (P-1/P-4) with zero network access or directory walking, while object/text inputs keep their original semantics byte-for-byte |
|
|
239
|
-
|
|
240
|
-
## π Back to
|
|
241
|
-
|
|
242
|
-
- π [README](../README.md) Β· π [Docs home](README.md)
|
package/docs/README.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# π zopia β Documentation
|
|
2
|
-
|
|
3
|
-
Welcome to the **zopia** documentation home. This directory is the single
|
|
4
|
-
source of truth for *how zopia works, what it must do, and how it is built*.
|
|
5
|
-
|
|
6
|
-
> π **Rule** β behaviour and documentation change together. If a commit
|
|
7
|
-
> changes what zopia does, the matching document in this directory changes in
|
|
8
|
-
> the **same** commit. See [Standards β Docs convention](12-standards.md#-docs-convention).
|
|
9
|
-
|
|
10
|
-
## πΊοΈ Map
|
|
11
|
-
|
|
12
|
-
| # | π Document | Read it whenβ¦ |
|
|
13
|
-
| --- | --- | --- |
|
|
14
|
-
| 1 | π§ [Overview](01-overview.md) | You want to know **what** zopia is and **why** it exists |
|
|
15
|
-
| 2 | π― [Targets](02-targets.md) | You want the **explicit, testable goals** of the project |
|
|
16
|
-
| 3 | πΊοΈ [Roadmap](03-roadmap.md) | You want to know **what ships in which phase** |
|
|
17
|
-
| 4 | ποΈ [Architecture](04-architecture.md) | You are **maintaining or extending** modules, pipelines, representations, or errors |
|
|
18
|
-
| 5 | π§© [Concepts](05-concepts.md) | You need the **glossary** β Swagger 2.0, OpenAPI 3.x, JSON Schema, `$ref`, Zod v4, km-api |
|
|
19
|
-
| 6 | π [Conversions](06-conversions.md) | You need the **exact mapping rules** of the four engines |
|
|
20
|
-
| 7 | π [API docs format](07-api-docs.md) | You need the **output contract** β layouts, `index.ts`, manifest |
|
|
21
|
-
| 8 | π§± [Components](08-components.md) | You work with **`$ref`s** and the component options |
|
|
22
|
-
| 9 | βοΈ [Configuration](09-configuration.md) | You want the **full option reference** with defaults |
|
|
23
|
-
| 10 | π [Usage](10-usage.md) | You want to **use** zopia β programmatic API & CLI |
|
|
24
|
-
| 11 | π§ͺ [Testing](11-testing.md) | You are **writing tests** β scenario matrix, fixtures, coverage gates |
|
|
25
|
-
| 12 | π [Standards](12-standards.md) | You are **consuming the project** β code, JSDoc, commits, changelog, decisions |
|
|
26
|
-
|
|
27
|
-
## π§ Suggested paths
|
|
28
|
-
|
|
29
|
-
- π **New here** β [Overview](01-overview.md) β [Targets](02-targets.md) β
|
|
30
|
-
[Concepts](05-concepts.md) β [Usage](10-usage.md)
|
|
31
|
-
- π οΈ **Maintaining or extending zopia** β [Architecture](04-architecture.md) β
|
|
32
|
-
[Conversions](06-conversions.md) β [API docs format](07-api-docs.md) β
|
|
33
|
-
[Testing](11-testing.md)
|
|
34
|
-
- π€ **Question about a decision?** β [Standards β Key decisions](12-standards.md#-key-decisions)
|
|
35
|
-
|
|
36
|
-
## β
How this documentation is written
|
|
37
|
-
|
|
38
|
-
- π¨ Every document uses consistent emoji section headers and tables
|
|
39
|
-
- π Documents cross-link each other β follow a link, don't re-read
|
|
40
|
-
- π’ Rules are numbered (**R-β¦**), decisions are numbered (**D-β¦**), targets are
|
|
41
|
-
numbered (**T-β¦**) so they can be referenced from anywhere (code, tests, PRs)
|
|
42
|
-
- π§Ύ Every non-trivial design choice is recorded as a key decision with its rationale
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
name: publish
|
|
2
|
-
|
|
3
|
-
# Publishes zopia to npm whenever a GitHub Release is published, or manually
|
|
4
|
-
# via workflow_dispatch. Credentials live in the repository secret NPM_TOKEN
|
|
5
|
-
# (automation/classic token with publish rights) or npm trusted publishing;
|
|
6
|
-
# the agent/maintainer running the pipeline never sees them. --provenance
|
|
7
|
-
# attestations require the id-token permission declared below.
|
|
8
|
-
|
|
9
|
-
on:
|
|
10
|
-
release:
|
|
11
|
-
types: [published]
|
|
12
|
-
workflow_dispatch:
|
|
13
|
-
|
|
14
|
-
permissions:
|
|
15
|
-
contents: read
|
|
16
|
-
id-token: write
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
publish:
|
|
20
|
-
runs-on: ubuntu-latest
|
|
21
|
-
steps:
|
|
22
|
-
- name: Checkout
|
|
23
|
-
uses: actions/checkout@v4
|
|
24
|
-
|
|
25
|
-
- name: Install Bun (pinned packageManager version)
|
|
26
|
-
uses: oven-sh/setup-bun@v2
|
|
27
|
-
with:
|
|
28
|
-
bun-version: 1.2.21
|
|
29
|
-
|
|
30
|
-
- name: Install Node (for the npm client)
|
|
31
|
-
uses: actions/setup-node@v4
|
|
32
|
-
with:
|
|
33
|
-
node-version: 22
|
|
34
|
-
registry-url: https://registry.npmjs.org
|
|
35
|
-
|
|
36
|
-
- name: Verify release tag matches package.json version
|
|
37
|
-
if: github.event_name == 'release'
|
|
38
|
-
run: |
|
|
39
|
-
version="$(node -p "require('./package.json').version")"
|
|
40
|
-
test "v${version}" == "${{ github.event.release.tag_name }}" || {
|
|
41
|
-
echo "Tag ${{ github.event.release.tag_name }} does not match package.json v${version}"
|
|
42
|
-
exit 1
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
- name: Publish to npm
|
|
46
|
-
run: npm publish --provenance --access public
|
|
47
|
-
env:
|
|
48
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|