提交

349 次代码提交

作者 SHA1 备注 提交日期
Phumrapee Limpianchop 1336074d43 fix(decode): prevent false array header detection for unquoted keys c… (#314)
CI / ci (push) Has been cancelled
Deploy Docs / Deploy Docs (push) Has been cancelled
* fix(decode): prevent false array header detection for unquoted keys containing brackets and colons

* test(decode): pin stream parity for an unquoted bracket-colon scalar

* chore(toon): bump `@toon-format/spec` to ^3.3.2

---------

Co-authored-by: Johann Schopplich <johann@schopplich.com>
2026-07-18 21:15:25 +02:00
Johann Schopplich 352a5b017d chore: release v2.3.1
Release + Publish / Release (push) Has been cancelled
v2.3.1
2026-07-16 08:06:50 +02:00
Johann Schopplich e2003970dd chore: revert v2.3.1 version bump and quote build filter glob 2026-07-16 08:02:04 +02:00
Johann Schopplich bb9a09ad6c chore: remove pnpm shamefully hoisting 2026-07-16 07:31:14 +02:00
Johann Schopplich 2013a7e09c chore: release v2.3.1 2026-07-16 07:26:53 +02:00
Johann Schopplich 9024af9e6a fix(decode): treat quoted spans as opaque in line classification 2026-07-16 07:22:49 +02:00
Johann Schopplich 27b65c2931 chore: upgrade dependencies 2026-07-15 23:07:17 +02:00
Chris Korhonen 94a2b7560b fix: harden encode and decode against prototype pollution (#316)
* fix: prevent prototype pollution during decode

* fix: preserve __proto__ during encode

* fix: ignore inherited tabular fields

* refactor: consolidate own-property helper and tighten __proto__ regression tests

* perf: fast-path setOwnProperty for non-__proto__ keys

* docs: trim object-utils remarks to rationale

* chore: update comment

---------

Co-authored-by: Johann Schopplich <johann@schopplich.com>
2026-07-15 22:58:34 +02:00
Johann Schopplich 09a7b38f2c test: cover malformed array length marker error context 2026-07-15 18:30:22 +02:00
Johann Schopplich 702301231c fix(decode): slice key-value rest at key token end offset 2026-07-15 18:30:22 +02:00
Johann Schopplich a19a117919 ci: update GitHub Actions to latest versions 2026-06-12 17:56:06 +02:00
Mohammad Raziei a52f2d2815 docs: add Matlab and Python implementations to ecosystem list (CToon Project) (#309)
* docs: add Python (C++ backend) implementation to ecosystem list

Added a new entry for the Python implementation with a C++ backend (ctoon) to the ecosystem documentation, ensuring it appears alongside other language implementations.

* docs: add Matlab implementation to ecosystem implementations list

Add Matlab entry (ctoon) to the ecosystem implementations table, acknowledging the new community implementation and providing its repository link and author.
2026-05-23 10:00:46 +02:00
Johann Schopplich a956757de0 test: align canonical number form titles with file conventions
Drop the (§2 carve-out) suffix from the describe block — no other test in this file references spec sections. Switch it() titles from 'emits X' to 'encodes X as Y' to match the existing converts/normalizes verb pattern.
2026-05-21 10:39:05 +02:00
Johann Schopplich c0af15e592 chore: close v3.3 release cleanup
- docs/guide/format-overview.md: drop duplicated Type Conversions table; link to canonical api.md#type-normalization (drift surface 3 -> 2 tables)
- packages/toon/test/normalization.test.ts: add 7 §2 carve-out boundary tests (encode + round-trip per value); locks current conformance against future String(value) refactors
2026-05-21 10:33:14 +02:00
Johann Schopplich 5b66523e42 chore: align with spec v3.3
- bump @toon-format/spec to ^3.3.0; update SPEC.md pointer and badges
- docs: align number-form prose with §2 carve-out (canonical in [1e-6, 1e21) or zero; exponent form permitted outside)
- docs/reference/spec.md: add lowercase booleans/null to encoder checklist; add Java to Appendix F language list
- docs/reference/efficiency-formalization.md: drop overstated "matching TOON's requirement" claim
- packages/toon/README.md: drop "What's New in v3.2" section (now stale)

All 593 tests pass (packages/toon: 497, packages/cli: 96). Encoder remains conformant by default under the v3.3 §2 carve-out via String(value).
2026-05-21 10:10:20 +02:00
Johann Schopplich e2b5611d37 docs: quote §7.2 timestamps in examples and propagate dd856fe to docs/cli
Two regrade fixes surfaced by a post-v3.2 verification swarm:

* llm-prompts.md and api.md had ISO-8601 timestamps as unquoted TOON
  values, violating §7.2 (strings containing a colon MUST be quoted).
  The spec repo's examples and packages/toon/README.md already quote
  timestamps; the docs repo had drifted.

* docs/cli/index.md is the docs-site twin of packages/cli/README.md.
  The prior v3.2 swarm (dd856fe) updated the README's --no-strict
  options row and Lenient Decoding prose to cite "header delimiter"
  but did not propagate to the parallel paragraphs in docs/cli/index.md
  (lines 159 and 234).
2026-05-20 12:28:18 +02:00
Johann Schopplich 3c66a1bead chore: release v2.3.0
Release + Publish / Release (push) Has been cancelled
v2.3.0
2026-05-20 11:48:16 +02:00
Johann Schopplich 4b8aa998c3 chore(toon): bump @toon-format/spec to ^3.2.0
Matches the lockfile bumped in d6c64d2; CI's frozen-lockfile install
fails until the manifest catches up. The dep was skip-worktree'd during
the v3.2 development window.
2026-05-20 11:42:26 +02:00
Johann Schopplich 1d23fa36d2 chore: fix linting issues 2026-05-20 11:38:55 +02:00
Johann Schopplich d6c64d23e4 chore: upgrade dependencies 2026-05-20 11:34:51 +02:00
Johann Schopplich dd856fe590 docs: align prose with v3.2 spec wording
- packages/toon/README.md: drop two v3.1 bullets that crept into the
  "What's new in v3.2" list (canonical empty-array form and \uXXXX
  escape both landed in v3.1).
- docs/reference/api.md: rename "Delimiter mismatches" entry to
  "Header delimiter mismatch" and cite §14.2 – the previous wording
  invited the false reading that non-active delimiter chars in row
  data are an error. Add §14.4 cross-ref to the duplicate-key entry.
- docs/reference/spec.md: include \uXXXX in the §7 escape list; soften
  the charset MUST claim to match §17; en-dash the §-ranges in the
  glance table.
- docs/reference/syntax-cheatsheet.md: rename "Strings with Active
  Delimiter" to "Strings Containing Delimiters" and distinguish
  active-delim (array scope) from document-delim (object field
  values) per §11.1.
- docs/guide/format-overview.md: same active-vs-document distinction
  in the delimiter paragraph; drop incorrect "strict mode" qualifier
  from the unknown-escape error claim (§7.1 rejects unconditionally);
  trim redundant "with leading zeros" parenthetical.
- docs/guide/llm-prompts.md: fix two broken anchors
  (/reference/api#decode → #decode-input-options, similar for
  encodelines); use -o instead of --output for CLI example
  consistency.
- packages/cli/README.md: enumerate what --no-strict actually skips
  in the options table; replace "delimiter consistency" with the
  more specific "header delimiter mismatches" in the Lenient Decoding
  prose to avoid the same false reading the api.md fix addresses.
2026-05-20 10:57:48 +02:00
Johann Schopplich d514942fc0 fix(decode): reject whitespace gap in array header per §6
The bracket-to-colon and bracket-to-fields checks previously trimmed
before comparing, so `items[2] :` and `items[2] {a,b}:` slipped through
strict mode. Tighten both checks to reject any non-empty gap and
distinguish whitespace-only gaps in the error message.
2026-05-20 09:32:55 +02:00
Johann Schopplich 979152508d docs(toon): bump SPEC badge to v3.2, add What's new section, fix §17 anchor
The README now flips the shields.io SPEC badge to v3.2 (the conformance
work just landed), adds a six-bullet "What's new in v3.2" subsection
between Key Features and Media Type, and fixes the stale §18.2 anchor
in the Media Type paragraph to point at §17 IANA Considerations.
2026-05-20 07:04:50 +02:00
Johann Schopplich 1446cae85d docs(cli): widen --no-strict description for v3.2 semantics
In v3.2, --no-strict no longer just skips count/indent/delimiter
validation - it also applies last-write-wins on duplicate sibling
keys and tolerates malformed array headers as plain key-value lines.
The previous "faster processing" framing didn't reflect any of this.

- Lenient Decoding sections in cli docs and packages/cli/README spell
  out which checks the decoder stops enforcing
- Options table description shifts from "Disable strict validation"
  to "Skip decode validation; last-write-wins on duplicate keys"
- --strict help text in the CLI reads "Strict decode validation
  (disable with --no-strict)"
- §17 IANA anchor fix in the cli docs media-type note
2026-05-20 07:04:41 +02:00
Johann Schopplich 13110eb975 docs: align guides and API reference with v3.2 spec changes
- Canonical empty-array form (`key: []` / root `[]`) replaces `key[0]:`
  in format-overview, syntax-cheatsheet, and the efficiency-formalization
  worked example. Legacy form still decodes.
- Escape tables grow a `\uXXXX` row covering U+0000-U+001F outside
  \n/\r/\t, with a note rejecting lone-surrogate \uXXXX values.
- "Special characters" lists widened to "any control character (U+0000-U+001F)"
  instead of the LF/HTAB/CR triplet.
- Tabular eligibility note adds the "at least one key" rule so arrays
  containing an empty {} fall back to the expanded list.
- New short example for nested arrays-of-objects as list items (`- [N]:`).
- API reference: Date row gets an info callout noting it's an
  implementation choice the spec leaves open; strict-mode bullet list
  picks up header structure, duplicate sibling keys, path-expansion
  conflicts, and lone-surrogate escapes; Expansion Conflict Resolution
  notes the matching duplicate-key policy.
- §17 IANA anchor fix in getting-started media-type paragraph.
2026-05-20 07:04:27 +02:00
Johann Schopplich 1f53af3582 docs(spec): refresh §17-19 layout, Appendix F, and §14 subsection references
- Drop the removed §17 Interoperability and §19 Core Profile bullets
- Renumber §18 IANA -> §17, add §18 Versioning and §19 IP entries
- Appendix G -> F (Host Type Normalization Examples)
- Update the Sections-at-a-Glance table to the v3.2 layout
- §14.5 -> §14.3 path-expansion reference in the Decoder Checklist
- §14 enumeration covers count/width, syntax/structural, expansion, dup keys
- Encoder Checklist mentions \uXXXX escapes alongside the five base escapes
- Major-version example swapped to v2 -> v3 / v3.1 -> v3.2
- Working Draft date updated to 2026-05-20
2026-05-20 07:04:14 +02:00
Johann Schopplich 1a9c72a6c2 chore: bump spec version references to v3.2 (2026-05-20)
Updates the `$spec.version` VitePress global property and the root SPEC.md
stub to track the published v3.2 working draft.
2026-05-20 07:03:40 +02:00
Johann Schopplich bc1ae4e194 docs: refresh decode/encode JSDoc examples
Updates the JSDoc `@example` blocks for `encode` and `decode` to reflect
v3.2 output: tabular header is `users[2]{id}:` not `users[]:`, and
empty arrays render as `tags: []`.
2026-05-19 21:11:36 +02:00
Johann Schopplich a13dcb5eec feat(decode): strict-mode error coverage for §6/§9.1/§14
Widens decoder behavior to match v3.2 strict-mode normative rules:

- Accepts the canonical `[]` empty-array form on all decode paths
  (root, key-value, list-item-after-hyphen — sync and async)
- §6: parseBracketSegment now uses an anchored regex for the length
  (rejects 0x10, 01, 1e5, -0, etc.) and throws in strict mode on
  malformed bracket segments
- §14.2: parser scans the fields segment for any unquoted candidate
  delimiter that mismatches the bracket-declared one and throws in
  strict mode
- §14.4: assertNoDuplicateKey rejects duplicate sibling keys in strict
  mode at every nested object site (root, child objects, list-item
  objects, tabular-first list items)
- Strict flag now threads through parseArrayHeaderLine so header
  diagnostics surface as decode errors rather than silent fallthrough
- Multi-line root that starts with a bare token now errors in strict
  mode with a clear diagnostic
2026-05-19 21:11:25 +02:00
Johann Schopplich e6d97d232e feat(encode): emit canonical empty-array form key: []
Per §9.1 v3.2, empty arrays MUST emit as `key: []` (and `- []` after a
list-item marker), not as `key[0]:`. The header-only emission is now
reserved for non-empty arrays.
2026-05-19 21:11:10 +02:00
Johann Schopplich 178207636d fix(decode): support \uXXXX escape per §7.1
Per the v3.2 spec, control characters U+0000–U+001F outside of \n, \r, \t
encode as \uXXXX escapes and decode them back. Lone surrogates are rejected.

- escapeString emits \uXXXX for any remaining U+0000–U+001F byte
- unescapeString recognises \uXXXX (4 hex digits) and rejects D800–DFFF
- isSafeUnquoted widens the control-char check to cover the full range
2026-05-19 21:10:53 +02:00
Father of chain caa59ae4dc docs: surface tooner mcp proxy across readme and docs site (#283)
Adds the [Tooner](https://github.com/chaindead/tooner) MCP proxy entry to the Tools & Integration list in the package README and to docs/ecosystem/tools-and-playgrounds.md.
2026-05-17 18:55:28 +02:00
ernestoalconada 269e43e960 docs(ecosystem): add delphi implementation (#273)
Adds the Delphi community port (ernestoalconada/toon) to docs/ecosystem/implementations.md.
2026-05-17 18:47:02 +02:00
Montana Flynn 86006809cd docs: add toon-zig to community implementations (#298)
Adds the Zig community port (LatentEvals/toon-zig) and fixes the Python (Rust backend) row to alphabetical position.
2026-05-17 18:43:47 +02:00
swetasanghi2004-prog 90a04bd34b feat(docs): add YAML input to Playground with tests (#303)
* feat(docs): add YAML input to Playground with tests

- Add input format selector and YAML parsing (YAML 1.2, merge keys off)
- Extract parse/stringify helpers for testability and SPEC-aligned encoding
- Add Vitest for docs package and playground parse tests
- Update Playground copy in package README and ecosystem docs

* refactor(docs): simplify Playground YAML support

- Inline parse/stringify helpers into the component, drop the separate
  parse-input module and its tests
- Rename input state from `jsonInput`/`formattedJson`/`jsonTokens` to
  `inputText`/`formattedInput`/`inputTokens` so names no longer lie when
  YAML is selected
- Hide the JSON Baseline selector in YAML mode and make the token-count
  tooltip conditional on input format
- Store input under `state.input` with a fallback read of legacy
  `state.json` so existing share URLs keep working
- Drop redundant YAML parse options (merge/version match library
  defaults); use lineWidth: 0 for editor display so long scalars do not
  fold mid-sentence
- Remove the duplicated vitest devDep, docs vitest.config.ts, and `test`
  script – the playground is verified through the dev server

* chore(docs): tighten Playground wording and drop empty-string fallback

- "in real-time" → "in real time" (real-time only hyphenates as a
  compound modifier before a noun)
- Header copy now matches the ecosystem page: "Convert JSON or YAML to
  TOON in real time"
- Token-count tooltip unified across input formats; the JSON baseline
  selector is right next to it and already communicates the format
- Drop `?? ''` fallback on state.input — decodeState already gates on
  successful JSON parse; the chain falls through to the legacy
  state.json field

---------

Co-authored-by: Sweta <sweta@Swetas-MacBook-Air.local>
Co-authored-by: Johann Schopplich <johann@schopplich.com>
2026-05-17 18:04:07 +02:00
Johann Schopplich 9ac3f9ed67 docs: remove explicit JSON type values 2026-05-08 23:23:58 +02:00
Johann Schopplich dd70538e0b chore: release v2.2.0
Release + Publish / Release (push) Has been cancelled
v2.2.0
2026-05-08 23:18:34 +02:00
Johann Schopplich 4819128859 docs: harmonize prose and fix tab delimiter examples 2026-05-08 23:17:10 +02:00
Johann Schopplich 476e4a1784 refactor: variable name 2026-05-08 22:30:55 +02:00
Johann Schopplich 18864cbd1f docs: add error handling guide 2026-05-08 22:27:28 +02:00
Johann Schopplich d826be75d7 chore: upgrade dependencies 2026-05-08 22:23:54 +02:00
Johann Schopplich 3d99b7b9ae feat(cli): render decode error with line context, source, and caret 2026-05-08 22:18:43 +02:00
Johann Schopplich 1181b14bd7 feat: throw ToonDecodeError on error 2026-05-08 22:03:25 +02:00
Johann Schopplich 0f0b1b3217 test: remove unneeded comments 2026-05-08 22:03:03 +02:00
Johann Schopplich 7dabdb303b test: remove duplications 2026-05-08 21:53:18 +02:00
Johann Schopplich ef2f900d2f chore: upgrade to TypeScript 6.0.2 and clean up tsconfig 2026-04-16 11:03:33 +02:00
Johann Schopplich e3458db261 chore: remove redundant TS config options 2026-03-31 10:42:22 +02:00
Alessio Sanfratello d5f50a2ce5 docs: add toons to community implementations (#275) 2026-03-10 19:21:27 +01:00
Johann Schopplich 76c493ceab chore: migrate wrangler config to expanded toml syntax 2026-03-10 17:35:36 +01:00
Johann Schopplich 6edc9ac5e7 chore: upgrade dependencies 2026-03-06 07:52:26 +01:00