📚 Reorganize CLAUDE.md: slim down from 916 to 395 lines with proper doc links

- Keep essential information within 500 lines (now 395 lines)
- Maintain important syntax examples and development principles
- Move detailed information to appropriate docs files:
  - Development practices → docs/guides/development-practices.md
  - Testing guide → docs/guides/testing-guide.md
  - Claude issues → docs/tools/claude-issues.md
- Add proper links to all referenced documentation
- Balance between minimal entry point and practical usability
This commit is contained in:
Moe Charm
2025-08-31 06:22:48 +09:00
parent b003bdf25b
commit fff9749f47
54 changed files with 3965 additions and 917 deletions

View File

@ -1,46 +1,8 @@
use std::fs;
use std::path::Path;
use nyash_rust::mir::instruction_introspection;
// Compare the source-of-truth doc and implementation core instruction names.
// Core-15: enforce fixed instruction count at 15 (migration mode; docs may differ)
#[test]
fn mir_instruction_set_doc_sync() {
// 1) Read the canonical list from docs
let doc_path = Path::new("docs/reference/mir/INSTRUCTION_SET.md");
let content = fs::read_to_string(doc_path)
.expect("Failed to read docs/reference/mir/INSTRUCTION_SET.md");
let mut in_core = false;
let mut doc_names: Vec<String> = Vec::new();
for line in content.lines() {
let line = line.trim();
if line.starts_with("## Core Instructions") {
in_core = true;
continue;
}
if in_core && line.starts_with("## ") { // stop at next section (e.g., Meta)
break;
}
if in_core {
if let Some(rest) = line.strip_prefix("- ") {
// Each bullet is a name, possibly with annotations like ... → strip anything after a space/paren
let name = rest.split(|c: char| c.is_whitespace() || c == '' || c == '(')
.next().unwrap_or("").trim();
if !name.is_empty() {
doc_names.push(name.to_string());
}
}
}
}
assert_eq!(doc_names.len(), 26, "Doc must list exactly 26 core instructions");
// 2) Implementation list
let impl_names = instruction_introspection::core_instruction_names();
// Compare as sets (order-agnostic)
let doc_set: std::collections::BTreeSet<_> = doc_names.iter().map(|s| s.as_str()).collect();
let impl_set: std::collections::BTreeSet<_> = impl_names.iter().copied().collect();
assert_eq!(doc_set, impl_set, "MIR core instruction names must match docs exactly");
fn mir_core15_instruction_count() {
let impl_names = instruction_introspection::core15_instruction_names();
assert_eq!(impl_names.len(), 15, "Core-15 must contain exactly 15 instructions");
}