Repository navigation
feat(profile): versioned KitProfile schema + canonical serialization (Pillar 4 step 1) - #295
Merged
Merged
Conversation
…(Pillar 4 step 1)
The pure floor for the traveling project profile (design:
kit-research/docs/research/pillar4-traveling-profile-5.0.md). Adds src/profile/schema.ts:
- KitProfile type declaring {skills, mcp, workflows, plugins, vault, gates, scope},
each section a reference to setup-state that lives scattered across .kit.toml /
.kit-baseline.json / skills-lock.json / .mcp.json / .kit-policy.* today.
- .kit-profile.toml load/save via smol-toml; PROFILE_SCHEMA_VERSION=1 with fail-closed
refusal of a newer schema, mirroring .kit-policy.toml's version gate.
- Zod validation (strict — catches typos in a signed artifact) with a tagged
InvalidProfileError so gate paths fail closed with a clean message, like InvalidConfigError.
- loadProfile returns null when no profile is declared (honest skip, not empty profile).
- canonicalProfileBytes: recursively key-sorted JSON with the volatile 'generated' stamp
excluded — stable signing/diffing bytes, same discipline as canonicalPolicyBytes. Plus
profileFingerprint (sha256:...).
No CLI, no discovery, no drift yet (later steps). Zero-LLM, deterministic. No secret
values in the profile — backend selection and key names only. 16 unit tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
|
✅ Docker image built successfully
|
This was referenced Jul 9, 2026
sandstream
added a commit
that referenced
this pull request
Jul 9, 2026
#297) Wires the profile schema (#295) + drift core (#296) into a CLI verb via COMMAND_REGISTRY (design: pillar4-traveling-profile-5.0.md). Adds src/commands/profile.ts: - show — render the declared profile with per-line reconciliation marks (✓/DRIFT/REMOVED/ ADDED), fingerprint, and an unaudited note for kinds not yet discoverable. - freeze — snapshot the DISCOVERED toolchain (skills/mcp via discoverAgentToolchain, vault store from .kit.toml) into .kit-profile.toml, PRESERVING operator-authored name/workflows/plugins/gates/scope verbatim. Deliberate action, like baseline freeze. - check — report declared-vs-discovered drift; --gate turns any drift into a non-zero exit for CI (default is warn/exit-0). Honest skip (exit 0) when no profile is declared. --json on every subcommand. Zero-LLM, deterministic; never auto-mutates the toolchain. Registry entry (experimental) + SUBCOMMAND_HELP; contracts/public-surface.json regenerated for the new verb. 7 command tests. Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2 Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
First build step of the versioned, traveling project profile (Pillar 4 of the kit 5.0 North Star). Design note:
kit-research/docs/research/pillar4-traveling-profile-5.0.md(merged as kit-research #27).kit's setup-state is today scattered across ≥6 files (
.kit.toml,.kit-baseline.json,skills-lock.json,.mcp.json/.claude.json,.kit-policy.*) with nothing binding, versioning, or auditing it as a whole. This PR adds the pure floor — the type, schema, load/save, and a canonical signing/diffing byte form — with no CLI, no discovery, and no drift logic yet (those are later steps). Zero-LLM, deterministic.Type of Change
Related Issues
kit-research/docs/research/pillar4-traveling-profile-5.0.mdChanges Made
src/profile/schema.ts:KitProfiletype declaring{skills, mcp, workflows, plugins, vault, gates, scope}— each section a reference to the scattered setup-state, not a copy of it..kit-profile.tomlload/save viasmol-toml;PROFILE_SCHEMA_VERSION = 1with fail-closed refusal of a newer schema (mirrors.kit-policy.toml's version gate).InvalidProfileErrorso gate paths fail closed with a clean message, exactly likeInvalidConfigErrorfor.kit.toml.loadProfilereturnsnullwhen no profile is declared → callers canskiphonestly instead of treating "no profile" as "empty profile".canonicalProfileBytes: recursively key-sorted JSON with the volatilegeneratedstamp excluded — stable across TOML reformatting / key reorder, same discipline ascanonicalPolicyBytes. PlusprofileFingerprint(sha256:...).src/profile/schema.test.ts: 16 unit tests (parse valid/invalid/version-gate/strict-typo/missing-name; load null/present/fail-closed; save round-trip + stamp; canonical bytes excludegenerated, order-independent, move on real change; fingerprint stability).Testing
Test Coverage
npm test) — full suite 2620 pass / 0 fail (2604 baseline + 16 new)Manual Testing
npx tsc --noEmit→ clean.npx eslint src/profile/*.ts→ clean.npm run build && node scripts/test.mjs→ 2620 pass, 0 fail.npx prettier --check src/profile/*.ts→ formatted.Breaking Changes
None / N/A — new module, nothing else imports it yet.
Checklist
npm test).env*write-gatePerformance Impact
Reviewer Notes
Deliberate design choices worth a look: strict Zod (vs.
.kit.toml's.passthrough()) — justified because the profile is a fresh 5.0 artifact that will be signed, and within a schema version an unknown key is a typo, not forward-compat (a real new field bumpsversion, which is refused by older kit). The[scope]/RoE section is declared here but signing (.kit-profile.sig, reusingsignWithIdentity/verifyPolicy) and drift reconciliation land in later steps per the design note's incremental plan.🤖 Generated with Claude Code
https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
Generated by Claude Code