KeiSeiKit-1.0/_primitives/_rust
Parfii-bot 81e3b58533 feat(v0.21): keisei SSoT relocation + Scope enum (user/project)
Two architect-audit P1/P2 findings closed.

PART A — SSoT relocation
  Before: ~/.claude/keisei-attached.toml (baked Claude-Code subpath)
  After: ~/.keisei/attached.toml (client-neutral)
  config::migrate_from_legacy() runs inside config::read() — first
  call after v0.21 install reads legacy path, writes new path,
  deletes legacy, emits stderr notice.
  claude_code adapter's .claude/ subpath UNCHANGED — that's Claude
  Code's real config dir, not keisei's marker namespace.

PART B — Scope enum (architect P1)
  ClientAdapter trait gains:
    fn supported_scopes(&self) -> &[Scope] { &[Scope::User] }  // default
    fn config_path(&self, scope: Scope) -> PathBuf
    fn attach(&self, brain: &Brain, scope: Scope) -> Result<()>
    fn detach(&self, brain_name: &str, scope: Scope) -> Result<()>

  Per-adapter scope support:
    claude_code — [User, Project]  (~/.claude vs ./.claude)
    cursor      — [User, Project]  (~/.cursor vs ./.cursor)
    continue    — [User] only (Continue has no project concept)
    zed         — [User] only (Zed uses global settings)

  CLI: keisei attach <brain> --scope={user|project} (default user).
  keisei mount → always Scope::User (host-wide fan-out).
  Marker Attachment gains scope field with #[serde(default)] so
  v0.20 markers read as Scope::User (backward-compat).

  New Error::ScopeUnsupported { client, scope, supported } — blocks
  invalid combos (e.g. zed --scope=project) with clear message.

New module scope.rs (49 LOC) — Scope enum + serde + Display + FromStr.
paths.rs gains keisei_state_dir() returning $HOME/.keisei.

5 new integration tests:
  - legacy_marker_migrates_on_first_read
  - attach_with_project_scope_writes_local_config
  - attach_user_scope_still_default
  - scope_unsupported_by_adapter_errors
  - detach_respects_scope_from_marker

REAL VERIFIED cargo test -p keisei output: 28 passed; 0 failed.
cargo check -p keisei: clean.
grep /Users/denisparfionovich/ in edits: zero hits.

Constructor Pattern: scope.rs 49 LOC, paths.rs 34 LOC, largest fn
migrate_from_legacy() 22 LOC.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 17:56:10 +08:00
..
firewall-diff feat(primitives): 2 Rust verification cubes 2026-04-21 21:00:01 +08:00
kei-artifact Merge feat/v0.16.1-polish — dynamic schema + mode matrix Phase 3.6 2026-04-22 15:13:05 +08:00
kei-auth fix(kei-auth): remove --key CLI flag (F12 HIGH — /proc/cmdline leak) 2026-04-22 13:36:17 +08:00
kei-changelog feat(primitives): kei-docs-scaffold shell + kei-changelog Rust 2026-04-21 21:01:28 +08:00
kei-chat-store chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-conflict-scan feat(primitives): 4 Rust crates for deep-sleep — conflict-scan, refactor-engine, graph-check, store 2026-04-22 08:28:22 +08:00
kei-content-store chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-crossdomain chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-curator chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-graph-check feat(primitives): 4 Rust crates for deep-sleep — conflict-scan, refactor-engine, graph-check, store 2026-04-22 08:28:22 +08:00
kei-ledger feat(primitives): kei-ledger Rust SQLite agent ledger 2026-04-21 20:52:20 +08:00
kei-memory feat(primitives): kei-memory Rust crate — offline session analyzer (Genesis-clean) 2026-04-22 00:50:04 +08:00
kei-migrate feat(primitives): kei-migrate Rust universal migration runner 2026-04-21 20:35:29 +08:00
kei-refactor-engine fix(kei-refactor-engine): retract 'git apply-ready' claim (F1 RELEASE BLOCKER) 2026-04-22 13:36:17 +08:00
kei-router chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-sage chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-search-core chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-social-store chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
kei-store fix(kei-store): path-traversal guard (F2 RELEASE BLOCKER) + S3 stub gate (F7) + GitHub RULE 0.1 guard (F8) 2026-04-22 13:36:17 +08:00
kei-task chore(rust): misc schema/main refactor in 8 crates (assorted CP splits) 2026-04-22 13:36:17 +08:00
keisei feat(v0.21): keisei SSoT relocation + Scope enum (user/project) 2026-04-22 17:56:10 +08:00
mock-render refactor(mock-render): split main.rs 227 LOC into 4 cubes (F5a Constructor Pattern) 2026-04-22 13:36:17 +08:00
ssh-check feat(primitives): 2 Rust verification cubes 2026-04-21 21:00:01 +08:00
tokens-sync feat(primitives): 3 Rust cubes — mock-render, visual-diff, tokens-sync 2026-04-21 21:07:45 +08:00
visual-diff feat(primitives): 3 Rust cubes — mock-render, visual-diff, tokens-sync 2026-04-21 21:07:45 +08:00
.gitignore feat(primitives): 2 Rust verification cubes 2026-04-21 21:00:01 +08:00
Cargo.lock fix(v0.19): audit hardening — 3 security HIGH + 3 critic HIGH + 2 critic MEDIUM 2026-04-22 16:36:11 +08:00
Cargo.toml fix(v0.19): audit hardening — 3 security HIGH + 3 critic HIGH + 2 critic MEDIUM 2026-04-22 16:36:11 +08:00