Kyn MVP v2 Proposal¶
Status¶
Draft design document for breaking-change v2 before first public release.
Goal¶
Improve usability, reduce semantic ambiguity, and expand policy power while keeping Kyn a fast, stateless CLI.
Required v2 Outcome¶
For v2 to be considered complete:
- A new user can get Kyn running in 10 minutes or less.
- CI integration works across major CI platforms with first-party examples.
- Release artifacts are published for major Linux/macOS/Windows targets.
- Breaking schema changes include a practical migration path.
Why v2 Now¶
No public release has been made yet, so this is the right time to:
- simplify the rule model
- introduce stronger change metadata
- make CLI defaults friendlier
- keep future extensibility clean
Design Principles¶
- Rules should read like policy, not implementation detail.
- Validation and side effects should be separated.
- CI output must stay deterministic and machine-consumable.
- Defaults should optimize for common CI usage, with strict modes available.
Breaking Changes¶
1) Rule Model Rename: when/require -> if/assert¶
Old:
when:
changedAny: [source]
require:
kinChanged: [story]
New:
if:
changedAny: [source]
assert:
kinChanged: [story]
Rationale:
ifclearly means applicability.assertclearly means pass/fail policy checks.
2) emitFlag moves out of assertions into actions¶
Old:
require:
emitFlag: figmaPublishRequired
New:
actions:
emit:
- figmaPublishRequired
Rationale:
- Assertions should only validate.
- Emission is a side effect.
3) First-class change status support¶
v2 tracks and exposes change status (added, modified, deleted, renamed) instead of flattening away details.
New filter examples:
if:
changedStatusAny: [modified, renamed]
4) Family groups become explicit¶
Families can define named groups to reduce hardcoded assumptions like source.
families:
- id: angular-component
groups:
source:
include: ["libs/**/*.component.ts", "libs/**/*.component.html"]
test:
include: ["libs/**/*.spec.ts"]
story:
include: ["libs/**/*.stories.ts"]
5) CLI input behavior update¶
v2 adds optional auto mode:
- If no change mode is passed and git context exists, default to configured git refs.
- Keep strict enforcement available via
--strict-input-mode.
This ergonomics behavior is required for v2, not optional.
Proposed v2 Config Schema¶
version: 2
families:
- id: angular-component
groups:
source:
include:
- "libs/**/*.component.ts"
- "libs/**/*.component.html"
story:
include:
- "libs/**/*.stories.ts"
baseName:
stripSuffixes:
- ".component"
kin:
story: "{dir}/{base}.stories.ts"
figma: "{dir}/figma.{base}.json"
rules:
- id: story-sync
family: angular-component
severity: error
if:
changedAny: [source]
kinExists: [story]
changedStatusAny: [modified, renamed]
assert:
kinChanged: [story]
message: "Component changed but its Storybook file did not change."
- id: figma-publish-signal
family: angular-component
severity: warn
if:
changedAny: [source]
kinExists: [figma]
actions:
emit:
- figmaPublishRequired
message: "Component changed and has Figma metadata."
Rule Semantics (v2)¶
if:ANDacross keys.assert:ANDacross keys.- List predicates require all listed kin names unless explicitly
Any. actionsnever fail the run on their own.
CLI Contract (v2 Direction)¶
Keep:
kyn check--config,--format,--fail-on,--fail-on-empty
Keep input modes:
--files--files-from--stdin--base --head
Add:
--strict-input-mode(enforce explicit single mode)--summary-only--dry-run-resolve(show resolved families/kin without policy eval)
Planned commands:
kyn explain(detailed per-rule/per-family reasoning)kyn init(bootstrap config from repo patterns)
Output & Integrations¶
v2 targets additional machine reporters:
- SARIF
- reviewdog rdjson
- checkstyle XML
Text output remains deterministic, failures-first, and concise by default.
Ergonomics & Portability Requirements (Required)¶
v2 must satisfy the contract in ergonomics.md, including:
- 10-minute time-to-first-pass onboarding target
- clear happy-path CLI experience
- strong error usability
- multi-platform CI compatibility targets
Migration Plan (v1 -> v2)¶
- Add versioned config parser for
version: 1andversion: 2. - Add migration helper:
kyn config migrate --from v1 --to v2- Auto-map:
when->ifrequire->assertrequire.emitFlag->actions.emit- Warn on v1 usage with deprecation notice before v1 removal.
Implementation Roadmap¶
Phase 1: Schema & Engine Core¶
- Implement v2 config structs + validation.
- Implement dual-parser support (
version: 1andversion: 2). - Refactor evaluator to support
if/assert/actions. - Add change status model end-to-end.
Phase 2: CLI & UX¶
- Add
--strict-input-mode. - Add auto mode defaults for CI-friendly runs.
- Add
--summary-onlyand--dry-run-resolve. - Improve error messages with mode and rule/family context.
Phase 3: Tooling & Adoption¶
- Add
kyn explain. - Add
kyn init. - Add output adapters (SARIF/reviewdog/checkstyle).
- Add preset rule packs for common domains.
Success Criteria¶
- Teams can express policy with less config ambiguity.
- Fewer false positives from status-aware evaluation.
- Faster adoption through init/explain and better defaults.
- Strong CI integration via richer output adapters.
- New-user setup and first passing run can be achieved in <= 10 minutes.