fix: organize seeded claude shim files

This commit is contained in:
lucaronin
2026-04-19 17:00:30 +02:00
parent 2c5cb593d3
commit 8581a1b1e6
4 changed files with 28 additions and 5 deletions

View File

@@ -442,7 +442,7 @@ Once a vault is ready, `useAiAgentsOnboarding` can show a one-time `AiAgentsOnbo
`useGettingStartedClone` reuses the same parent-folder semantics for the status-bar / command-palette clone action, and `Toast` is rendered through the AI-agents onboarding gate so the resolved destination path stays visible right after a successful clone.
The starter content no longer lives in the app repo. `src-tauri/src/vault/getting_started.rs` holds the public starter repo URL (`refactoringhq/tolaria-getting-started`), delegates the clone to the git backend, then normalizes Tolaria-managed root guidance and type scaffolding (`AGENTS.md`, `CLAUDE.md`, `type.md`, `note.md`) so fresh starter vaults pick up the current defaults even when the remote starter repo still carries a legacy copy or an older pre-`type:` `is_a`-era template. `AGENTS.md` stays the canonical vault guidance file; `CLAUDE.md` is a compatibility shim that imports it for Claude Code without duplicating the instructions. The clone helper still accepts the legacy `LAPUTA_GETTING_STARTED_REPO_URL` environment override so older automation can continue to redirect the starter source during the transition.
The starter content no longer lives in the app repo. `src-tauri/src/vault/getting_started.rs` holds the public starter repo URL (`refactoringhq/tolaria-getting-started`), delegates the clone to the git backend, then normalizes Tolaria-managed root guidance and type scaffolding (`AGENTS.md`, `CLAUDE.md`, `type.md`, `note.md`) so fresh starter vaults pick up the current defaults even when the remote starter repo still carries a legacy copy or an older pre-`type:` `is_a`-era template. `AGENTS.md` stays the canonical vault guidance file; `CLAUDE.md` is a compatibility shim that imports it for Claude Code without duplicating the instructions, and Tolaria seeds it as an organized `Note` so it stays out of the way in a fresh vault. The clone helper still accepts the legacy `LAPUTA_GETTING_STARTED_REPO_URL` environment override so older automation can continue to redirect the starter source during the transition.
After the clone completes, Tolaria removes every configured git remote from the new starter vault. Getting Started vaults therefore open as local-only by default, and users opt into a remote later with the explicit Add Remote flow.

View File

@@ -193,7 +193,7 @@ tolaria/
├── playwright.smoke.config.ts # Curated pre-push Playwright config
├── ui-design.pen # Master design file
├── AGENTS.md # Canonical shared instructions for coding agents
├── CLAUDE.md # Claude Code compatibility shim importing AGENTS.md
├── CLAUDE.md # Claude Code compatibility shim importing AGENTS.md as an organized Note
└── docs/ # This documentation
```

View File

@@ -341,8 +341,10 @@ mod tests {
assert!(agents.contains("Legacy `title:` frontmatter is still read as a fallback"));
assert!(agents.contains("views/*.yml"));
assert!(claude.starts_with("@AGENTS.md"));
assert!(claude.contains("# CLAUDE.md"));
assert!(claude.starts_with("---\ntype: Note\n_organized: true\n---"));
assert!(claude.contains("@AGENTS.md"));
assert!(claude.contains("only a Claude Code compatibility shim"));
assert!(!claude.contains("# CLAUDE.md"));
}
fn assert_seeded_type_scaffolding(vault_path: &Path) {

View File

@@ -41,13 +41,23 @@ const LEGACY_CLAUDE_MD_SHIM: &str = "@AGENTS.md
This file is a Claude Code compatibility shim. Keep shared agent instructions in `AGENTS.md`.
";
const CLAUDE_MD_SHIM: &str = "@AGENTS.md
const HEADING_CLAUDE_MD_SHIM: &str = "@AGENTS.md
# CLAUDE.md
This file is a Claude Code compatibility shim. Keep shared agent instructions in `AGENTS.md`.
";
const CLAUDE_MD_SHIM: &str = "---
type: Note
_organized: true
---
@AGENTS.md
This file is only a Claude Code compatibility shim. Keep shared agent instructions in `AGENTS.md`.
";
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum AiGuidanceFileState {
@@ -95,6 +105,7 @@ fn matches_claude_shim(content: &str) -> bool {
let trimmed = content.trim();
trimmed == "@AGENTS.md"
|| trimmed == LEGACY_CLAUDE_MD_SHIM.trim()
|| trimmed == HEADING_CLAUDE_MD_SHIM.trim()
|| trimmed == CLAUDE_MD_SHIM.trim()
}
@@ -517,6 +528,16 @@ mod tests {
assert!(read_root_claude(&vault).contains("Custom Claude instructions"));
}
#[test]
fn test_seed_config_files_refreshes_previous_managed_claude_shim() {
let (_dir, vault) = create_vault();
write_root_claude(&vault, HEADING_CLAUDE_MD_SHIM);
seed_config_files(vault.to_str().unwrap());
assert_eq!(read_root_claude(&vault), CLAUDE_MD_SHIM);
}
#[test]
fn test_migrate_agents_md_moves_config_to_root() {
assert_legacy_agents_move_to_root(