Skip to content

feat!: cardinality as its own axis with per-source splitting and validated defaults - #115

Open
kjanat wants to merge 1 commit into
v4-source-modelfrom
v4-cardinality
Open

feat!: cardinality as its own axis with per-source splitting and validated defaults#115
kjanat wants to merge 1 commit into
v4-source-modelfrom
v4-cardinality

Conversation

@kjanat

@kjanat kjanat commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Targets v4. Stacked on #114. L16 of the input-model unification.

Cardinality becomes its own internal axis (one, many, entries, count) projected from flat carriers; flag.array, flag.keyValue, flag.count, and arg variadic normalize onto it. New public surface per Decision 3: arg.boolean() consumes literal true/false tokens, arg.keyValue() aggregates k=v tokens with duplicate-key policies, and element-level sugar like flag.array(flag.path()) is legal with per-element path checks from every source. Per-source splitting per Decision 6: .split({ cli, env, stdin }) with whole/lines/delimiter/json policies; env defaults to comma with JSON only explicit; entries split at the first equals; env and config no longer inherit the CLI separator (breaking). Decision 7 splicing: - in a repeated collection represents the stdin source at that occurrence and decoded elements splice in order. Decision 5 lines semantics exact, including the single structural terminal empty element. Defaults are validated per Decision 4 (breaking): codec domain, constraints, cardinality shape, and sync Standard Schema at construction from every declaration order and both paths; async validators and filesystem checks at resolution. Standard Schema splits into element and aggregate levels on both surfaces.

The review's severe catch: preflight tested the sentinel against the scalar shape only, so explicit - on collections never read stdin in a real invocation; fixed and pinned end to end. Also killed a phantom trim field in the published meta-schema and added satisfies guards pinning the meta-schema to the fragment types.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
dreamcli d82e91a Commit Preview URL

Branch Preview URL
Aug 03 2026, 01:36 PM

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 882be804-0a9b-4baa-a940-999fbb4b8e87

📥 Commits

Reviewing files that changed from the base of the PR and between a8fbc35 and 1b3a978.

⛔ Files ignored due to path filters (1)
  • src/core/json-schema/meta-descriptions.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (43)
  • CHANGELOG.md
  • docs/concepts/input.md
  • docs/guide/arguments.md
  • docs/guide/flags.md
  • docs/guide/read-flags.md
  • docs/guide/semantics.md
  • docs/guide/troubleshooting.md
  • docs/guide/upgrading-v4.md
  • docs/reference/main.md
  • docs/reference/resolver-contract.md
  • docs/reference/stability.md
  • dreamcli.schema.json
  • skills/cli-creation/SKILL.md
  • skills/cli-creation/references/pattern-cookbook.md
  • src/core/cli/stdin-eligibility.test.ts
  • src/core/help/help.test.ts
  • src/core/json-schema/index.ts
  • src/core/json-schema/json-schema.test.ts
  • src/core/parse/index.ts
  • src/core/resolve/AGENTS.md
  • src/core/resolve/args.ts
  • src/core/resolve/coerce.ts
  • src/core/resolve/flags.ts
  • src/core/resolve/path-checks.ts
  • src/core/resolve/resolve-cardinality.test.ts
  • src/core/resolve/resolve-path-checks.test.ts
  • src/core/resolve/stages.ts
  • src/core/resolve/standard.ts
  • src/core/schema/AGENTS.md
  • src/core/schema/arg-collection-kinds.test.ts
  • src/core/schema/arg.ts
  • src/core/schema/cardinality.test.ts
  • src/core/schema/cardinality.ts
  • src/core/schema/flag-array-separator.test.ts
  • src/core/schema/flag-element-eligibility.test.ts
  • src/core/schema/flag.ts
  • src/core/schema/index.ts
  • src/core/schema/schema-sealing.test.ts
  • src/core/schema/source.ts
  • src/core/schema/stdin-exclusivity.test.ts
  • src/core/schema/value.test.ts
  • src/core/schema/value.ts
  • src/index.ts

Comment @coderabbitai help to get the list of available commands.

@kjanat kjanat mentioned this pull request Aug 3, 2026
@kjanat kjanat self-assigned this Aug 3, 2026
@kjanat kjanat added this to the v4 milestone Aug 3, 2026 — with ChatGPT Codex Connector
@kjanat
kjanat marked this pull request as ready for review August 3, 2026 23:38
@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

bun add https://pkg.pr.new/@kjanat/dreamcli@115
npm i https://pkg.pr.new/@kjanat/dreamcli@115

commit: 1b3a978

@kjanat kjanat added the cr:review Allow CodeRabbit review label Aug 4, 2026
…dated defaults

Internal Cardinality union (one, many, entries, count) projected from
flat carriers; flag.array, flag.keyValue, flag.count, and arg variadic
normalize onto it, and flagValueSchema becomes total by returning the
element value for collections, deleting both unreachable-kind guards.
New public surface per Decision 3: arg.boolean() consumes literal
true/false tokens, arg.keyValue() aggregates k=v tokens with
duplicate-key policies, and element-level sugar like
flag.array(flag.path()) is legal with per-element path checks from
every source. Per-source splitting per Decision 6: .split({cli, env,
stdin}) with whole/lines/delimiter/json policies, CLI defaulting to
the .separator() carrier, env defaulting to comma with JSON only
explicit, entries splitting at the first equals; env and config no
longer inherit the CLI separator (breaking). Decision 7 splicing: '-'
in a repeated collection represents the stdin source at that
occurrence and decoded elements splice in order, for flags, keyValue
flags, and keyValue args, with preflight eligibility detecting the
sentinel inside collections. Decision 5 lines semantics exact,
including the single structural terminal empty element. Defaults are
validated per Decision 4 (breaking): typed values checked against
codec domain, constraints, cardinality shape, and sync Standard Schema
at construction from every declaration order and both construction
paths, async validators and filesystem checks at resolution. Standard
Schema splits into element and aggregate levels on both surfaces.
Fragments redesigned cleanly at schemaVersion 1 with satisfies guards
pinning the meta-schema to the fragment types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cr:review Allow CodeRabbit review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant