softschema 0.1.2__tar.gz → 0.1.4__tar.gz
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.
- {softschema-0.1.2 → softschema-0.1.4}/.gitignore +6 -0
- {softschema-0.1.2 → softschema-0.1.4}/AGENTS.md +12 -6
- {softschema-0.1.2 → softschema-0.1.4}/PKG-INFO +108 -50
- {softschema-0.1.2 → softschema-0.1.4}/README.md +105 -48
- softschema-0.1.4/docs/development.md +211 -0
- softschema-0.1.4/docs/installation.md +74 -0
- softschema-0.1.4/docs/publishing-npm.md +210 -0
- softschema-0.1.4/docs/publishing.md +137 -0
- {softschema-0.1.2 → softschema-0.1.4}/docs/softschema-guide.md +56 -29
- {softschema-0.1.2 → softschema-0.1.4}/docs/softschema-python-design.md +93 -13
- {softschema-0.1.2 → softschema-0.1.4}/docs/softschema-spec.md +39 -6
- softschema-0.1.4/docs/softschema-typescript-design.md +104 -0
- {softschema-0.1.2 → softschema-0.1.4}/examples/movie_page/README.md +2 -2
- {softschema-0.1.2 → softschema-0.1.4}/examples/movie_page/movie-page.schema.yaml +46 -74
- {softschema-0.1.2 → softschema-0.1.4}/examples/movie_page/spirited-away.md +1 -1
- softschema-0.1.4/examples/parity/__init__.py +0 -0
- softschema-0.1.4/examples/parity/model.py +94 -0
- softschema-0.1.4/examples/parity/parity.schema.yaml +147 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/__init__.py +14 -13
- softschema-0.1.4/packages/python/src/softschema/canonicalize.py +171 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/cli.py +184 -71
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/compile.py +32 -24
- softschema-0.1.4/packages/python/src/softschema/errors.py +102 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/generate.py +8 -6
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/models.py +7 -23
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/schema_view.py +17 -15
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/validate.py +213 -227
- softschema-0.1.4/packages/python/tests/test_canonicalize.py +53 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/tests/test_cli.py +181 -11
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/tests/test_core.py +136 -70
- softschema-0.1.4/packages/python/tests/test_doc_topics_resolve.py +41 -0
- softschema-0.1.4/packages/python/tests/test_enforced_extras.py +99 -0
- softschema-0.1.4/packages/python/tests/test_errors.py +51 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/tests/test_generate.py +34 -0
- softschema-0.1.4/packages/python/tests/test_metadata_rules.py +42 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/tests/test_movie_page_example.py +2 -1
- softschema-0.1.4/packages/python/tests/test_parity.py +30 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/tests/test_schema_view.py +33 -4
- softschema-0.1.4/packages/python/tests/test_skill_mirror_drift.py +32 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/tests/test_soft_field.py +2 -2
- softschema-0.1.4/packages/typescript/LICENSE +21 -0
- softschema-0.1.4/packages/typescript/README.md +55 -0
- {softschema-0.1.2 → softschema-0.1.4}/pyproject.toml +19 -7
- softschema-0.1.4/skills/softschema/SKILL.md +113 -0
- softschema-0.1.4/tests/golden/README.md +118 -0
- softschema-0.1.2/docs/development.md +0 -137
- softschema-0.1.2/docs/installation.md +0 -25
- softschema-0.1.2/docs/publishing.md +0 -91
- softschema-0.1.2/packages/typescript/README.md +0 -26
- softschema-0.1.2/skills/softschema/SKILL.md +0 -72
- {softschema-0.1.2 → softschema-0.1.4}/LICENSE +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/examples/__init__.py +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/examples/movie_page/__init__.py +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/examples/movie_page/host_integration.py +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/examples/movie_page/model.py +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/README.md +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/py.typed +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/registry.py +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/src/softschema/soft_field.py +0 -0
- {softschema-0.1.2 → softschema-0.1.4}/packages/python/tests/test_warning_codes.py +0 -0
|
@@ -6,6 +6,9 @@ __pycache__/
|
|
|
6
6
|
# C extensions
|
|
7
7
|
*.so
|
|
8
8
|
|
|
9
|
+
# Node / TypeScript
|
|
10
|
+
node_modules/
|
|
11
|
+
|
|
9
12
|
# Distribution / packaging
|
|
10
13
|
.Python
|
|
11
14
|
build/
|
|
@@ -223,3 +226,6 @@ __marimo__/
|
|
|
223
226
|
|
|
224
227
|
# Streamlit
|
|
225
228
|
.streamlit/secrets.toml
|
|
229
|
+
|
|
230
|
+
# TS bundled doc/skill resources (generated at build by copy-resources)
|
|
231
|
+
packages/typescript/resources/
|
|
@@ -9,11 +9,21 @@ Start here:
|
|
|
9
9
|
- [Softschema Spec](docs/softschema-spec.md): exact language-neutral artifact format.
|
|
10
10
|
- [Movie page example](examples/movie_page/README.md): complete Python-backed example.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
softschema ships two interchangeable implementations with the same CLI and library
|
|
13
|
+
surface: Python/Pydantic (`softschema`, `softschema-py`) and TypeScript/Zod
|
|
14
|
+
(`softschema`, `softschema-ts`). They are held to exact behavioral parity: same flags,
|
|
15
|
+
same canonical JSON Schema sidecar, same validation results, so authoring an artifact is
|
|
16
|
+
identical regardless of which you run.
|
|
17
|
+
|
|
18
|
+
For implementer reference (only when changing a package itself):
|
|
13
19
|
|
|
14
20
|
- [Python Package Design](docs/softschema-python-design.md): module layout, CLI surface,
|
|
15
21
|
validation layers, and ADR-style decisions.
|
|
16
|
-
|
|
22
|
+
- [TypeScript Package Design](docs/softschema-typescript-design.md): the Zod port and
|
|
23
|
+
the Python↔TypeScript API parity table.
|
|
24
|
+
- When changing behavior, follow the parity development process (golden-first, then port
|
|
25
|
+
to both) in [docs/development.md](docs/development.md).
|
|
26
|
+
Skip all of this when only authoring or validating artifacts.
|
|
17
27
|
|
|
18
28
|
Key rules:
|
|
19
29
|
|
|
@@ -53,10 +63,6 @@ Documentation rules:
|
|
|
53
63
|
- Include the standard documentation footer in repo docs.
|
|
54
64
|
Do not add it to authored softschema example artifacts.
|
|
55
65
|
|
|
56
|
-
<!-- This document follows common-doc-guidelines.md.
|
|
57
|
-
See github.com/jlevy/practical-prose and review guidelines before editing.
|
|
58
|
-
-->
|
|
59
|
-
|
|
60
66
|
<!-- BEGIN TBD INTEGRATION format=f04 surface=agents-md -->
|
|
61
67
|
## tbd
|
|
62
68
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: softschema
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Soft schema conventions and validation tools for Markdown/YAML artifacts
|
|
5
5
|
Project-URL: Homepage, https://github.com/jlevy/softschema
|
|
6
6
|
Project-URL: Repository, https://github.com/jlevy/softschema
|
|
@@ -22,11 +22,23 @@ Requires-Python: <4.0,>=3.11
|
|
|
22
22
|
Requires-Dist: frontmatter-format>=0.3.0
|
|
23
23
|
Requires-Dist: jsonschema>=4.20
|
|
24
24
|
Requires-Dist: pydantic>=2
|
|
25
|
-
Requires-Dist:
|
|
25
|
+
Requires-Dist: ruamel-yaml>=0.18
|
|
26
|
+
Requires-Dist: strif>=3.1.0
|
|
26
27
|
Description-Content-Type: text/markdown
|
|
27
28
|
|
|
28
29
|
# softschema
|
|
29
30
|
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
To set up softschema in a repository with an agent, tell the agent:
|
|
34
|
+
|
|
35
|
+
> Run `uvx softschema@latest --help` (for the Python implementation) or
|
|
36
|
+
> `npx softschema@latest --help` (for the Node implementation) and follow the
|
|
37
|
+
> instructions to set up softschema for this repo as a skill.
|
|
38
|
+
|
|
39
|
+
The help output points the agent to `skill --install`, which writes discoverable
|
|
40
|
+
`SKILL.md` mirrors for Codex, Claude Code, Gemini CLI, and other coding agents.
|
|
41
|
+
|
|
30
42
|
## What Are Soft Schemas?
|
|
31
43
|
|
|
32
44
|
Soft schemas are a practice for adding structure gradually to artifacts that mix
|
|
@@ -131,14 +143,42 @@ This repo is simply:
|
|
|
131
143
|
defining soft schema file format conventions for Markdown documents with YAML
|
|
132
144
|
frontmatter.
|
|
133
145
|
|
|
134
|
-
- A
|
|
135
|
-
|
|
146
|
+
- A small CLI (and library) that handles formatting, compilation, validation, and other
|
|
147
|
+
common workflows on soft schema-style documents.
|
|
136
148
|
|
|
137
149
|
The CLI can be used directly, as a library, or installed as a skill.
|
|
138
150
|
|
|
139
151
|
For the full conceptual reference and adoption playbooks, see the
|
|
140
152
|
[Softschema Guide](docs/softschema-guide.md).
|
|
141
153
|
|
|
154
|
+
## Two Synchronized Implementations
|
|
155
|
+
|
|
156
|
+
softschema ships **two complete, fully supported implementations** with the same CLI and
|
|
157
|
+
library surface:
|
|
158
|
+
|
|
159
|
+
- **Python / Pydantic**: [`softschema`](docs/softschema-python-design.md) on PyPI (run
|
|
160
|
+
as `softschema` or `softschema-py`).
|
|
161
|
+
- **TypeScript / Zod**: [`softschema`](docs/softschema-typescript-design.md) on npm (run
|
|
162
|
+
as `softschema` or `softschema-ts`).
|
|
163
|
+
|
|
164
|
+
The TypeScript package is a **synchronized port** of the Python one, held to **exact
|
|
165
|
+
behavioral parity**: equivalent CLI inputs, outputs, and flags; equivalent library APIs;
|
|
166
|
+
the same canonical JSON Schema sidecar (content-identical, with an equal `schema_sha256`
|
|
167
|
+
fingerprint over its canonical JSON); and the same engine-neutral validation results.
|
|
168
|
+
Only idiomatic surface details differ (snake_case ↔ camelCase, Pydantic ↔ Zod).
|
|
169
|
+
Authoring or validating an artifact is identical regardless of which you run, so a team
|
|
170
|
+
can adopt either runtime, or both, without divergence.
|
|
171
|
+
|
|
172
|
+
The two are **maintained in lockstep**: every behavior change lands in a shared
|
|
173
|
+
golden-test corpus first, then in both packages, and CI fails if their outputs or
|
|
174
|
+
compiled schemas drift.
|
|
175
|
+
They release together under **the same version number** on PyPI and npm.
|
|
176
|
+
See
|
|
177
|
+
[Keeping Python and TypeScript in Parity](docs/development.md#keeping-python-and-typescript-in-parity)
|
|
178
|
+
for the development process and the parity invariants CI enforces, and
|
|
179
|
+
[Publishing](https://github.com/jlevy/softschema/blob/main/docs/publishing.md) for the
|
|
180
|
+
synchronized release.
|
|
181
|
+
|
|
142
182
|
## Example Artifact Shape
|
|
143
183
|
|
|
144
184
|
The default shape is Markdown with YAML frontmatter.
|
|
@@ -192,39 +232,14 @@ It won the 2003 Academy Award for Best Animated Feature.
|
|
|
192
232
|
Rotten Tomatoes shows a 96% Tomatometer from 225 critic reviews and a 96% Popcornmeter
|
|
193
233
|
from the audience; IMDb users give it 8.6 out of 10 across more than 850,000 votes.
|
|
194
234
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
| Field | Value |
|
|
198
|
-
| --- | --- |
|
|
199
|
-
| Title | Spirited Away |
|
|
200
|
-
| Release year | 2001 |
|
|
201
|
-
| Runtime | 125 minutes |
|
|
202
|
-
| MPAA rating | PG |
|
|
203
|
-
| Director | Hayao Miyazaki |
|
|
204
|
-
| Genres | Animation, Adventure, Family |
|
|
205
|
-
|
|
206
|
-
## Lead Cast
|
|
207
|
-
|
|
208
|
-
| Actor | Character |
|
|
209
|
-
| --- | --- |
|
|
210
|
-
| Rumi Hiiragi | Chihiro / Sen |
|
|
211
|
-
| Miyu Irino | Haku |
|
|
212
|
-
| Mari Natsuki | Yubaba |
|
|
213
|
-
|
|
214
|
-
## Ratings
|
|
215
|
-
|
|
216
|
-
| Source | Score | Count |
|
|
217
|
-
| --- | ---: | ---: |
|
|
218
|
-
| Rotten Tomatoes Critics | 96% Tomatometer | 225 reviews |
|
|
219
|
-
| Rotten Tomatoes Audience | 96% Popcornmeter | — |
|
|
220
|
-
| IMDb | 8.6 / 10 | 850,000+ votes |
|
|
235
|
+
<!-- The reader-facing body continues with prose and tables; see the full example. -->
|
|
221
236
|
```
|
|
222
237
|
|
|
223
238
|
The YAML payload is authoritative; a consumer reads it.
|
|
224
|
-
The Markdown body overlaps with it but is for human readers: the
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
fields
|
|
239
|
+
The Markdown body overlaps with it but is for human readers: the prose adds context like
|
|
240
|
+
the film’s Academy Award (which no structured field carries), the YAML alone carries
|
|
241
|
+
downstream fields such as `critic_review_count`, and the full example’s body mirrors
|
|
242
|
+
some YAML fields as tables for the reader’s convenience.
|
|
228
243
|
|
|
229
244
|
Only the `softschema` block and the chosen envelope key (`movie:` above) are
|
|
230
245
|
softschema’s concern.
|
|
@@ -304,52 +319,95 @@ uv run softschema compile examples.movie_page.model:MoviePage \
|
|
|
304
319
|
--out examples/movie_page/movie-page.schema.yaml
|
|
305
320
|
```
|
|
306
321
|
|
|
322
|
+
## Try the TypeScript Package
|
|
323
|
+
|
|
324
|
+
The TypeScript CLI takes the same arguments and emits byte-identical output.
|
|
325
|
+
Validate the same artifact against the same language-neutral schema sidecar with a
|
|
326
|
+
pinned zero-install runner:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
npx softschema@latest validate examples/movie_page/spirited-away.md \
|
|
330
|
+
--schema examples/movie_page/movie-page.schema.yaml \
|
|
331
|
+
--envelope movie
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
The bundled docs and skill are served identically:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
npx softschema@latest docs --list
|
|
338
|
+
npx softschema@latest docs guide
|
|
339
|
+
npx softschema@latest skill --brief
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Semantic models are written in Zod instead of Pydantic; everything else (flags, result
|
|
343
|
+
JSON, error records, and the compiled sidecar, down to its `schema_sha256`) matches the
|
|
344
|
+
Python package exactly.
|
|
345
|
+
See the [TypeScript Design](docs/softschema-typescript-design.md) doc for the Zod model
|
|
346
|
+
shape and the full Python ↔ TypeScript API table.
|
|
347
|
+
|
|
307
348
|
## Use as an Agent Skill
|
|
308
349
|
|
|
309
|
-
|
|
350
|
+
Both packages ship the same [`SKILL.md`](https://agentskills.io) following the open
|
|
310
351
|
Agent Skills standard discovered by Claude Code, Codex, Gemini CLI, Cursor, Copilot, and
|
|
311
352
|
~20 other coding agents.
|
|
312
353
|
Pointing an agent at the CLI is enough to bootstrap its understanding of the soft-schema
|
|
313
|
-
approach: the `--help` epilog routes it to a brief and the bundled
|
|
354
|
+
approach: the `--help` epilog routes it to `skill --install`, a brief, and the bundled
|
|
355
|
+
docs.
|
|
314
356
|
|
|
315
357
|
```bash
|
|
316
|
-
|
|
317
|
-
uvx softschema@
|
|
318
|
-
uvx softschema@
|
|
358
|
+
# Python:
|
|
359
|
+
uvx softschema@latest --help # entry point with skill setup pointers
|
|
360
|
+
uvx softschema@latest skill --install # install repo-local skill mirrors
|
|
361
|
+
uvx softschema@latest skill --brief # compact operating brief
|
|
362
|
+
uvx softschema@latest docs guide # full mental model and adoption path
|
|
363
|
+
|
|
364
|
+
# TypeScript (same commands, same bundled docs/skill):
|
|
365
|
+
npx softschema@latest --help
|
|
366
|
+
npx softschema@latest skill --install
|
|
367
|
+
npx softschema@latest skill --brief
|
|
368
|
+
npx softschema@latest docs guide
|
|
319
369
|
```
|
|
320
370
|
|
|
321
|
-
Self-install the skill into a project so any agent working in the repo finds it
|
|
322
|
-
|
|
371
|
+
Self-install the skill into a project so any agent working in the repo finds it natively
|
|
372
|
+
(either package writes the identical mirrors):
|
|
323
373
|
|
|
324
374
|
```bash
|
|
325
|
-
uvx softschema@
|
|
375
|
+
uvx softschema@latest skill --install
|
|
376
|
+
# or: npx softschema@latest skill --install
|
|
326
377
|
# writes:
|
|
327
378
|
# .agents/skills/softschema/SKILL.md (Codex, Gemini CLI, cross-agent installers)
|
|
328
379
|
# .claude/skills/softschema/SKILL.md (Claude Code mirror)
|
|
329
380
|
```
|
|
330
381
|
|
|
331
|
-
Both mirrors carry a `DO NOT EDIT` marker
|
|
332
|
-
Re-run `
|
|
382
|
+
Both mirrors carry a `DO NOT EDIT` marker.
|
|
383
|
+
Re-run `skill --install` to refresh after upgrading the CLI.
|
|
333
384
|
|
|
334
385
|
## Repository Layout
|
|
335
386
|
|
|
336
387
|
```text
|
|
337
|
-
docs/ guide, spec, Python
|
|
388
|
+
docs/ guide, spec, package design (Python + TypeScript), and workflow docs
|
|
338
389
|
examples/movie_page/ complete example with model, host integration, artifact, schema
|
|
339
|
-
|
|
340
|
-
packages/
|
|
341
|
-
|
|
390
|
+
examples/parity/ cross-language parity fixture (Pydantic + Zod compile to one schema)
|
|
391
|
+
packages/python/ Python/Pydantic implementation and tests
|
|
392
|
+
packages/typescript/ TypeScript/Zod implementation and tests
|
|
393
|
+
skills/softschema/ agent-facing usage guidance (shared SKILL.md source)
|
|
394
|
+
tests/golden/ shared CLI golden corpus, run against both implementations
|
|
342
395
|
```
|
|
343
396
|
|
|
344
397
|
The root `pyproject.toml` builds the Python package from
|
|
345
|
-
`packages/python/src/softschema
|
|
346
|
-
|
|
398
|
+
`packages/python/src/softschema`; `packages/typescript` builds the npm `softschema`
|
|
399
|
+
package with bun. The shared golden corpus and the cross-language conformance test keep
|
|
400
|
+
the two implementations byte-for-byte in sync.
|
|
347
401
|
|
|
348
402
|
## Development and Contributing
|
|
349
403
|
|
|
350
404
|
See [Development](docs/development.md) for repo setup, common commands, CI checks,
|
|
351
405
|
release workflow, and pointers to the installation and publishing docs.
|
|
352
406
|
|
|
407
|
+
The Python and TypeScript implementations **must be kept in exact sync**. Any behavior
|
|
408
|
+
change goes through the shared golden corpus first and then lands in both packages; see
|
|
409
|
+
[Keeping Python and TypeScript in Parity](docs/development.md#keeping-python-and-typescript-in-parity).
|
|
410
|
+
|
|
353
411
|
<!-- This document follows common-doc-guidelines.md.
|
|
354
412
|
See github.com/jlevy/practical-prose and review guidelines before editing.
|
|
355
413
|
-->
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# softschema
|
|
2
2
|
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
To set up softschema in a repository with an agent, tell the agent:
|
|
6
|
+
|
|
7
|
+
> Run `uvx softschema@latest --help` (for the Python implementation) or
|
|
8
|
+
> `npx softschema@latest --help` (for the Node implementation) and follow the
|
|
9
|
+
> instructions to set up softschema for this repo as a skill.
|
|
10
|
+
|
|
11
|
+
The help output points the agent to `skill --install`, which writes discoverable
|
|
12
|
+
`SKILL.md` mirrors for Codex, Claude Code, Gemini CLI, and other coding agents.
|
|
13
|
+
|
|
3
14
|
## What Are Soft Schemas?
|
|
4
15
|
|
|
5
16
|
Soft schemas are a practice for adding structure gradually to artifacts that mix
|
|
@@ -104,14 +115,42 @@ This repo is simply:
|
|
|
104
115
|
defining soft schema file format conventions for Markdown documents with YAML
|
|
105
116
|
frontmatter.
|
|
106
117
|
|
|
107
|
-
- A
|
|
108
|
-
|
|
118
|
+
- A small CLI (and library) that handles formatting, compilation, validation, and other
|
|
119
|
+
common workflows on soft schema-style documents.
|
|
109
120
|
|
|
110
121
|
The CLI can be used directly, as a library, or installed as a skill.
|
|
111
122
|
|
|
112
123
|
For the full conceptual reference and adoption playbooks, see the
|
|
113
124
|
[Softschema Guide](docs/softschema-guide.md).
|
|
114
125
|
|
|
126
|
+
## Two Synchronized Implementations
|
|
127
|
+
|
|
128
|
+
softschema ships **two complete, fully supported implementations** with the same CLI and
|
|
129
|
+
library surface:
|
|
130
|
+
|
|
131
|
+
- **Python / Pydantic**: [`softschema`](docs/softschema-python-design.md) on PyPI (run
|
|
132
|
+
as `softschema` or `softschema-py`).
|
|
133
|
+
- **TypeScript / Zod**: [`softschema`](docs/softschema-typescript-design.md) on npm (run
|
|
134
|
+
as `softschema` or `softschema-ts`).
|
|
135
|
+
|
|
136
|
+
The TypeScript package is a **synchronized port** of the Python one, held to **exact
|
|
137
|
+
behavioral parity**: equivalent CLI inputs, outputs, and flags; equivalent library APIs;
|
|
138
|
+
the same canonical JSON Schema sidecar (content-identical, with an equal `schema_sha256`
|
|
139
|
+
fingerprint over its canonical JSON); and the same engine-neutral validation results.
|
|
140
|
+
Only idiomatic surface details differ (snake_case ↔ camelCase, Pydantic ↔ Zod).
|
|
141
|
+
Authoring or validating an artifact is identical regardless of which you run, so a team
|
|
142
|
+
can adopt either runtime, or both, without divergence.
|
|
143
|
+
|
|
144
|
+
The two are **maintained in lockstep**: every behavior change lands in a shared
|
|
145
|
+
golden-test corpus first, then in both packages, and CI fails if their outputs or
|
|
146
|
+
compiled schemas drift.
|
|
147
|
+
They release together under **the same version number** on PyPI and npm.
|
|
148
|
+
See
|
|
149
|
+
[Keeping Python and TypeScript in Parity](docs/development.md#keeping-python-and-typescript-in-parity)
|
|
150
|
+
for the development process and the parity invariants CI enforces, and
|
|
151
|
+
[Publishing](https://github.com/jlevy/softschema/blob/main/docs/publishing.md) for the
|
|
152
|
+
synchronized release.
|
|
153
|
+
|
|
115
154
|
## Example Artifact Shape
|
|
116
155
|
|
|
117
156
|
The default shape is Markdown with YAML frontmatter.
|
|
@@ -165,39 +204,14 @@ It won the 2003 Academy Award for Best Animated Feature.
|
|
|
165
204
|
Rotten Tomatoes shows a 96% Tomatometer from 225 critic reviews and a 96% Popcornmeter
|
|
166
205
|
from the audience; IMDb users give it 8.6 out of 10 across more than 850,000 votes.
|
|
167
206
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
| Field | Value |
|
|
171
|
-
| --- | --- |
|
|
172
|
-
| Title | Spirited Away |
|
|
173
|
-
| Release year | 2001 |
|
|
174
|
-
| Runtime | 125 minutes |
|
|
175
|
-
| MPAA rating | PG |
|
|
176
|
-
| Director | Hayao Miyazaki |
|
|
177
|
-
| Genres | Animation, Adventure, Family |
|
|
178
|
-
|
|
179
|
-
## Lead Cast
|
|
180
|
-
|
|
181
|
-
| Actor | Character |
|
|
182
|
-
| --- | --- |
|
|
183
|
-
| Rumi Hiiragi | Chihiro / Sen |
|
|
184
|
-
| Miyu Irino | Haku |
|
|
185
|
-
| Mari Natsuki | Yubaba |
|
|
186
|
-
|
|
187
|
-
## Ratings
|
|
188
|
-
|
|
189
|
-
| Source | Score | Count |
|
|
190
|
-
| --- | ---: | ---: |
|
|
191
|
-
| Rotten Tomatoes Critics | 96% Tomatometer | 225 reviews |
|
|
192
|
-
| Rotten Tomatoes Audience | 96% Popcornmeter | — |
|
|
193
|
-
| IMDb | 8.6 / 10 | 850,000+ votes |
|
|
207
|
+
<!-- The reader-facing body continues with prose and tables; see the full example. -->
|
|
194
208
|
```
|
|
195
209
|
|
|
196
210
|
The YAML payload is authoritative; a consumer reads it.
|
|
197
|
-
The Markdown body overlaps with it but is for human readers: the
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
fields
|
|
211
|
+
The Markdown body overlaps with it but is for human readers: the prose adds context like
|
|
212
|
+
the film’s Academy Award (which no structured field carries), the YAML alone carries
|
|
213
|
+
downstream fields such as `critic_review_count`, and the full example’s body mirrors
|
|
214
|
+
some YAML fields as tables for the reader’s convenience.
|
|
201
215
|
|
|
202
216
|
Only the `softschema` block and the chosen envelope key (`movie:` above) are
|
|
203
217
|
softschema’s concern.
|
|
@@ -277,52 +291,95 @@ uv run softschema compile examples.movie_page.model:MoviePage \
|
|
|
277
291
|
--out examples/movie_page/movie-page.schema.yaml
|
|
278
292
|
```
|
|
279
293
|
|
|
294
|
+
## Try the TypeScript Package
|
|
295
|
+
|
|
296
|
+
The TypeScript CLI takes the same arguments and emits byte-identical output.
|
|
297
|
+
Validate the same artifact against the same language-neutral schema sidecar with a
|
|
298
|
+
pinned zero-install runner:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
npx softschema@latest validate examples/movie_page/spirited-away.md \
|
|
302
|
+
--schema examples/movie_page/movie-page.schema.yaml \
|
|
303
|
+
--envelope movie
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
The bundled docs and skill are served identically:
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
npx softschema@latest docs --list
|
|
310
|
+
npx softschema@latest docs guide
|
|
311
|
+
npx softschema@latest skill --brief
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Semantic models are written in Zod instead of Pydantic; everything else (flags, result
|
|
315
|
+
JSON, error records, and the compiled sidecar, down to its `schema_sha256`) matches the
|
|
316
|
+
Python package exactly.
|
|
317
|
+
See the [TypeScript Design](docs/softschema-typescript-design.md) doc for the Zod model
|
|
318
|
+
shape and the full Python ↔ TypeScript API table.
|
|
319
|
+
|
|
280
320
|
## Use as an Agent Skill
|
|
281
321
|
|
|
282
|
-
|
|
322
|
+
Both packages ship the same [`SKILL.md`](https://agentskills.io) following the open
|
|
283
323
|
Agent Skills standard discovered by Claude Code, Codex, Gemini CLI, Cursor, Copilot, and
|
|
284
324
|
~20 other coding agents.
|
|
285
325
|
Pointing an agent at the CLI is enough to bootstrap its understanding of the soft-schema
|
|
286
|
-
approach: the `--help` epilog routes it to a brief and the bundled
|
|
326
|
+
approach: the `--help` epilog routes it to `skill --install`, a brief, and the bundled
|
|
327
|
+
docs.
|
|
287
328
|
|
|
288
329
|
```bash
|
|
289
|
-
|
|
290
|
-
uvx softschema@
|
|
291
|
-
uvx softschema@
|
|
330
|
+
# Python:
|
|
331
|
+
uvx softschema@latest --help # entry point with skill setup pointers
|
|
332
|
+
uvx softschema@latest skill --install # install repo-local skill mirrors
|
|
333
|
+
uvx softschema@latest skill --brief # compact operating brief
|
|
334
|
+
uvx softschema@latest docs guide # full mental model and adoption path
|
|
335
|
+
|
|
336
|
+
# TypeScript (same commands, same bundled docs/skill):
|
|
337
|
+
npx softschema@latest --help
|
|
338
|
+
npx softschema@latest skill --install
|
|
339
|
+
npx softschema@latest skill --brief
|
|
340
|
+
npx softschema@latest docs guide
|
|
292
341
|
```
|
|
293
342
|
|
|
294
|
-
Self-install the skill into a project so any agent working in the repo finds it
|
|
295
|
-
|
|
343
|
+
Self-install the skill into a project so any agent working in the repo finds it natively
|
|
344
|
+
(either package writes the identical mirrors):
|
|
296
345
|
|
|
297
346
|
```bash
|
|
298
|
-
uvx softschema@
|
|
347
|
+
uvx softschema@latest skill --install
|
|
348
|
+
# or: npx softschema@latest skill --install
|
|
299
349
|
# writes:
|
|
300
350
|
# .agents/skills/softschema/SKILL.md (Codex, Gemini CLI, cross-agent installers)
|
|
301
351
|
# .claude/skills/softschema/SKILL.md (Claude Code mirror)
|
|
302
352
|
```
|
|
303
353
|
|
|
304
|
-
Both mirrors carry a `DO NOT EDIT` marker
|
|
305
|
-
Re-run `
|
|
354
|
+
Both mirrors carry a `DO NOT EDIT` marker.
|
|
355
|
+
Re-run `skill --install` to refresh after upgrading the CLI.
|
|
306
356
|
|
|
307
357
|
## Repository Layout
|
|
308
358
|
|
|
309
359
|
```text
|
|
310
|
-
docs/ guide, spec, Python
|
|
360
|
+
docs/ guide, spec, package design (Python + TypeScript), and workflow docs
|
|
311
361
|
examples/movie_page/ complete example with model, host integration, artifact, schema
|
|
312
|
-
|
|
313
|
-
packages/
|
|
314
|
-
|
|
362
|
+
examples/parity/ cross-language parity fixture (Pydantic + Zod compile to one schema)
|
|
363
|
+
packages/python/ Python/Pydantic implementation and tests
|
|
364
|
+
packages/typescript/ TypeScript/Zod implementation and tests
|
|
365
|
+
skills/softschema/ agent-facing usage guidance (shared SKILL.md source)
|
|
366
|
+
tests/golden/ shared CLI golden corpus, run against both implementations
|
|
315
367
|
```
|
|
316
368
|
|
|
317
369
|
The root `pyproject.toml` builds the Python package from
|
|
318
|
-
`packages/python/src/softschema
|
|
319
|
-
|
|
370
|
+
`packages/python/src/softschema`; `packages/typescript` builds the npm `softschema`
|
|
371
|
+
package with bun. The shared golden corpus and the cross-language conformance test keep
|
|
372
|
+
the two implementations byte-for-byte in sync.
|
|
320
373
|
|
|
321
374
|
## Development and Contributing
|
|
322
375
|
|
|
323
376
|
See [Development](docs/development.md) for repo setup, common commands, CI checks,
|
|
324
377
|
release workflow, and pointers to the installation and publishing docs.
|
|
325
378
|
|
|
379
|
+
The Python and TypeScript implementations **must be kept in exact sync**. Any behavior
|
|
380
|
+
change goes through the shared golden corpus first and then lands in both packages; see
|
|
381
|
+
[Keeping Python and TypeScript in Parity](docs/development.md#keeping-python-and-typescript-in-parity).
|
|
382
|
+
|
|
326
383
|
<!-- This document follows common-doc-guidelines.md.
|
|
327
384
|
See github.com/jlevy/practical-prose and review guidelines before editing.
|
|
328
385
|
-->
|