claudeos-core 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of claudeos-core might be problematic. Click here for more details.
- package/CHANGELOG.md +26 -0
- package/README.de.md +48 -7
- package/README.es.md +48 -7
- package/README.fr.md +48 -7
- package/README.hi.md +48 -7
- package/README.ja.md +48 -7
- package/README.ko.md +48 -8
- package/README.md +48 -8
- package/README.ru.md +48 -7
- package/README.vi.md +48 -7
- package/README.zh-CN.md +48 -7
- package/bin/cli.js +64 -1
- package/content-validator/index.js +3 -6
- package/health-checker/index.js +5 -7
- package/import-linter/index.js +5 -7
- package/manifest-generator/index.js +9 -46
- package/package.json +2 -1
- package/pass-prompts/templates/java-spring/pass3.md +46 -8
- package/pass-prompts/templates/kotlin-spring/pass3.md +49 -9
- package/pass-prompts/templates/node-express/pass3.md +46 -7
- package/pass-prompts/templates/node-nextjs/pass3.md +45 -7
- package/pass-prompts/templates/python-django/pass3.md +46 -7
- package/pass-prompts/templates/python-fastapi/pass3.md +46 -7
- package/sync-hook/index.js +203 -0
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ ClaudeOS-Core automates the entire process:
|
|
|
23
23
|
1. **Scans** your project — detects stack, domains, ORM, DB, package manager automatically
|
|
24
24
|
2. **Analyzes** your source code in depth — controller patterns, service layers, naming conventions, error handling, security, testing, and 50+ categories
|
|
25
25
|
3. **Generates** a complete documentation ecosystem — `CLAUDE.md`, Standards (15–19 files), Rules, Skills, Guides (9 files), Master Plans, DB docs, and MCP guide
|
|
26
|
-
4. **Validates** everything —
|
|
26
|
+
4. **Validates** everything — 5 built-in verification tools ensure consistency
|
|
27
27
|
|
|
28
28
|
Total time: **5–18 minutes**, depending on project size. Zero manual configuration.
|
|
29
29
|
|
|
@@ -214,7 +214,6 @@ node claudeos-core-tools/manifest-generator/index.js
|
|
|
214
214
|
node claudeos-core-tools/health-checker/index.js
|
|
215
215
|
|
|
216
216
|
# Or run individual checks:
|
|
217
|
-
node claudeos-core-tools/import-linter/index.js # @import path validation
|
|
218
217
|
node claudeos-core-tools/plan-validator/index.js --check # Plan ↔ disk consistency
|
|
219
218
|
node claudeos-core-tools/sync-checker/index.js # Unregistered/orphaned files
|
|
220
219
|
node claudeos-core-tools/content-validator/index.js # File quality checks
|
|
@@ -347,7 +346,7 @@ For multi-stack projects (e.g., Java + React), backend and frontend domains are
|
|
|
347
346
|
|
|
348
347
|
## Verification Tools
|
|
349
348
|
|
|
350
|
-
ClaudeOS-Core includes
|
|
349
|
+
ClaudeOS-Core includes 5 built-in verification tools that run automatically after generation:
|
|
351
350
|
|
|
352
351
|
```bash
|
|
353
352
|
# Run all checks at once (recommended)
|
|
@@ -361,15 +360,13 @@ npx claudeos-core restore # Plan → Disk restore
|
|
|
361
360
|
# Or use node directly (git clone users)
|
|
362
361
|
node claudeos-core-tools/health-checker/index.js
|
|
363
362
|
node claudeos-core-tools/manifest-generator/index.js
|
|
364
|
-
node claudeos-core-tools/import-linter/index.js
|
|
365
363
|
node claudeos-core-tools/plan-validator/index.js --check
|
|
366
364
|
node claudeos-core-tools/sync-checker/index.js
|
|
367
365
|
```
|
|
368
366
|
|
|
369
367
|
| Tool | What It Does |
|
|
370
368
|
|---|---|
|
|
371
|
-
| **manifest-generator** | Builds metadata JSON (rule-manifest,
|
|
372
|
-
| **import-linter** | Validates `@import` paths — detects broken, duplicate, and circular imports (DFS) |
|
|
369
|
+
| **manifest-generator** | Builds metadata JSON (rule-manifest, sync-map, plan-manifest) |
|
|
373
370
|
| **plan-validator** | Compares Master Plan `<file>` blocks against disk — 3 modes: check, refresh, restore |
|
|
374
371
|
| **sync-checker** | Detects unregistered files (on disk but not in plan) and orphaned entries |
|
|
375
372
|
| **content-validator** | Validates file quality — empty files, missing ✅/❌ examples, required sections |
|
|
@@ -377,6 +374,49 @@ node claudeos-core-tools/sync-checker/index.js
|
|
|
377
374
|
|
|
378
375
|
---
|
|
379
376
|
|
|
377
|
+
## How Claude Code Uses Your Documentation
|
|
378
|
+
|
|
379
|
+
ClaudeOS-Core generates documentation that Claude Code actually reads — here's how:
|
|
380
|
+
|
|
381
|
+
### What Claude Code reads automatically
|
|
382
|
+
|
|
383
|
+
| File | When | Guaranteed |
|
|
384
|
+
|---|---|---|
|
|
385
|
+
| `CLAUDE.md` | Every conversation start | Always |
|
|
386
|
+
| `.claude/rules/*.md` | When any file is edited (via `paths: ["**/*"]`) | Always |
|
|
387
|
+
| `.claude/rules/00.core/00.standard-reference.md` | ↑ Included above | Always |
|
|
388
|
+
|
|
389
|
+
### What Claude Code reads via standard-reference rule
|
|
390
|
+
|
|
391
|
+
The `00.standard-reference.md` rule instructs Claude Code to Read the standard documents before writing code:
|
|
392
|
+
|
|
393
|
+
- `claudeos-core/standard/**` — coding patterns, ✅/❌ examples, naming conventions
|
|
394
|
+
- `claudeos-core/database/**` — DB schema (for queries, mappers, migrations)
|
|
395
|
+
|
|
396
|
+
### What Claude Code does NOT read (saves context)
|
|
397
|
+
|
|
398
|
+
These folders are explicitly excluded via the `DO NOT Read` section in the standard-reference rule:
|
|
399
|
+
|
|
400
|
+
| Folder | Why excluded |
|
|
401
|
+
|---|---|
|
|
402
|
+
| `claudeos-core/plan/` | Master Plan backups (~340KB). Auto-synced by hooks. |
|
|
403
|
+
| `claudeos-core/generated/` | Build metadata JSON. Not for coding. |
|
|
404
|
+
| `claudeos-core/guide/` | Onboarding guides for humans. |
|
|
405
|
+
| `claudeos-core/mcp-guide/` | MCP server docs. Not for coding. |
|
|
406
|
+
|
|
407
|
+
### Automatic plan sync (hooks)
|
|
408
|
+
|
|
409
|
+
When Claude Code edits a standard or rules file, a PostToolUse hook automatically syncs the change to the Master Plan:
|
|
410
|
+
|
|
411
|
+
```
|
|
412
|
+
AI edits claudeos-core/standard/10.backend-api/01.controller-patterns.md
|
|
413
|
+
→ sync-hook automatically updates plan/10.standard-master.md
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
No manual sync needed. The hook is installed automatically during `npx claudeos-core init`.
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
380
420
|
## Daily Workflow
|
|
381
421
|
|
|
382
422
|
### After Installation
|
|
@@ -391,7 +431,7 @@ node claudeos-core-tools/sync-checker/index.js
|
|
|
391
431
|
### After Manually Editing Standards
|
|
392
432
|
|
|
393
433
|
```bash
|
|
394
|
-
#
|
|
434
|
+
# If you edited files outside of Claude Code (hooks only trigger inside Claude Code):
|
|
395
435
|
npx claudeos-core refresh
|
|
396
436
|
|
|
397
437
|
# Verify everything is consistent
|
|
@@ -423,7 +463,7 @@ npx claudeos-core restore
|
|
|
423
463
|
| **Project-specific output** | ✅ Every file reflects your patterns | ❌ Generic commands | Partially | ❌ One-size-fits-all |
|
|
424
464
|
| **Multi-stack** | ✅ Auto-detected + separate analysis | ❌ Stack-agnostic | Manual | Varies |
|
|
425
465
|
| **Kotlin + CQRS/BFF** | ✅ Multi-module, Command/Query split | ❌ | ❌ | ❌ |
|
|
426
|
-
| **Self-verifying** | ✅
|
|
466
|
+
| **Self-verifying** | ✅ 5 validation tools | ❌ | ❌ | ❌ |
|
|
427
467
|
| **Backup / Restore** | ✅ Master Plan system | ❌ | ❌ | ❌ |
|
|
428
468
|
| **Setup time** | ~5–18min (automated) | ~5min (manual config) | Hours–Days | ~5min |
|
|
429
469
|
|
package/README.ru.md
CHANGED
|
@@ -23,7 +23,7 @@ ClaudeOS-Core автоматизирует весь процесс:
|
|
|
23
23
|
1. **Сканирует** ваш проект — автоматически определяет стек, домены, ORM, базу данных, пакетный менеджер
|
|
24
24
|
2. **Глубоко анализирует** исходный код — паттерны контроллеров, сервисные слои, соглашения об именовании, обработка ошибок, безопасность, тестирование и 50+ категорий
|
|
25
25
|
3. **Генерирует** полную экосистему документации — `CLAUDE.md`, Standards (15–19 файлов), Rules, Skills, Guides (9 файлов), Master Plans, документацию БД и руководство MCP
|
|
26
|
-
4. **Валидирует** всё —
|
|
26
|
+
4. **Валидирует** всё — 5 встроенных инструментов проверки гарантируют консистентность
|
|
27
27
|
|
|
28
28
|
Общее время: **5–18 минут**, в зависимости от размера проекта. Нулевая ручная настройка.
|
|
29
29
|
|
|
@@ -209,7 +209,6 @@ node claudeos-core-tools/manifest-generator/index.js
|
|
|
209
209
|
node claudeos-core-tools/health-checker/index.js
|
|
210
210
|
|
|
211
211
|
# Или запуск отдельных проверок:
|
|
212
|
-
node claudeos-core-tools/import-linter/index.js # @import validation
|
|
213
212
|
node claudeos-core-tools/plan-validator/index.js --check # Plan ↔ disk
|
|
214
213
|
node claudeos-core-tools/sync-checker/index.js # Sync status
|
|
215
214
|
node claudeos-core-tools/content-validator/index.js # Content quality
|
|
@@ -322,7 +321,7 @@ your-project/
|
|
|
322
321
|
|
|
323
322
|
## Инструменты валидации
|
|
324
323
|
|
|
325
|
-
ClaudeOS-Core включает
|
|
324
|
+
ClaudeOS-Core включает 5 встроенных инструментов проверки, автоматически запускаемых после генерации:
|
|
326
325
|
|
|
327
326
|
```bash
|
|
328
327
|
# Запустить все проверки сразу (рекомендуется)
|
|
@@ -336,8 +335,7 @@ npx claudeos-core restore # Восстановление Plan → Диск
|
|
|
336
335
|
|
|
337
336
|
| Инструмент | Что делает |
|
|
338
337
|
|---|---|
|
|
339
|
-
| **manifest-generator** | Создаёт JSON метаданных (rule-manifest,
|
|
340
|
-
| **import-linter** | Проверяет пути `@import` — обнаруживает сломанные, дублирующие и циклические импорты (DFS) |
|
|
338
|
+
| **manifest-generator** | Создаёт JSON метаданных (rule-manifest, sync-map, plan-manifest) |
|
|
341
339
|
| **plan-validator** | Сравнивает блоки `<file>` Master Plan с диском — 3 режима: check, refresh, restore |
|
|
342
340
|
| **sync-checker** | Обнаруживает незарегистрированные файлы (на диске, но не в плане) и осиротевшие записи |
|
|
343
341
|
| **content-validator** | Проверяет качество файлов — пустые файлы, отсутствующие примеры ✅/❌, обязательные секции |
|
|
@@ -345,6 +343,49 @@ npx claudeos-core restore # Восстановление Plan → Диск
|
|
|
345
343
|
|
|
346
344
|
---
|
|
347
345
|
|
|
346
|
+
## Как Claude Code использует вашу документацию
|
|
347
|
+
|
|
348
|
+
Вот как Claude Code фактически читает документацию, сгенерированную ClaudeOS-Core:
|
|
349
|
+
|
|
350
|
+
### Автоматически читаемые файлы
|
|
351
|
+
|
|
352
|
+
| Файл | Когда | Гарантия |
|
|
353
|
+
|---|---|---|
|
|
354
|
+
| `CLAUDE.md` | При начале каждого разговора | Всегда |
|
|
355
|
+
| `.claude/rules/*.md` | При редактировании файлов (через `paths: ["**/*"]`) | Всегда |
|
|
356
|
+
| `.claude/rules/00.core/00.standard-reference.md` | ↑ Включено выше | Всегда |
|
|
357
|
+
|
|
358
|
+
### Файлы, читаемые через правило standard-reference
|
|
359
|
+
|
|
360
|
+
Правило `00.standard-reference.md` указывает Claude Code Read стандартные документы перед написанием кода:
|
|
361
|
+
|
|
362
|
+
- `claudeos-core/standard/**` — Паттерны кодирования, примеры ✅/❌, соглашения об именах
|
|
363
|
+
- `claudeos-core/database/**` — Схема БД (для запросов, мапперов, миграций)
|
|
364
|
+
|
|
365
|
+
### Файлы, которые НЕ читаются (экономия контекста)
|
|
366
|
+
|
|
367
|
+
Явно исключены через секцию `DO NOT Read` правила standard-reference:
|
|
368
|
+
|
|
369
|
+
| Папка | Причина исключения |
|
|
370
|
+
|---|---|
|
|
371
|
+
| `claudeos-core/plan/` | Резервные копии Master Plan (~340КБ). Автосинхронизация через hooks. |
|
|
372
|
+
| `claudeos-core/generated/` | JSON метаданных сборки. Не для кодирования. |
|
|
373
|
+
| `claudeos-core/guide/` | Руководства для людей. |
|
|
374
|
+
| `claudeos-core/mcp-guide/` | Документация MCP сервера. Не для кодирования. |
|
|
375
|
+
|
|
376
|
+
### Автоматическая синхронизация Plan (hooks)
|
|
377
|
+
|
|
378
|
+
Когда Claude Code редактирует файл standard или rules, хук PostToolUse автоматически синхронизирует Master Plan:
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
AI редактирует claudeos-core/standard/10.backend-api/01.controller-patterns.md
|
|
382
|
+
→ sync-hook автоматически обновляет plan/10.standard-master.md
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Ручная синхронизация не требуется. Хук устанавливается автоматически при `npx claudeos-core init`.
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
348
389
|
## Повседневный рабочий процесс
|
|
349
390
|
|
|
350
391
|
### После установки
|
|
@@ -359,7 +400,7 @@ npx claudeos-core restore # Восстановление Plan → Диск
|
|
|
359
400
|
### После ручного редактирования стандартов
|
|
360
401
|
|
|
361
402
|
```bash
|
|
362
|
-
#
|
|
403
|
+
# Если файлы редактировались вне Claude Code (хуки работают только внутри Claude Code):
|
|
363
404
|
npx claudeos-core refresh
|
|
364
405
|
|
|
365
406
|
# Проверить консистентность
|
|
@@ -391,7 +432,7 @@ npx claudeos-core restore
|
|
|
391
432
|
| **Вывод под проект** | ✅ Каждый файл отражает ваши паттерны | ❌ Универсальные команды | Частично | ❌ Один размер для всех |
|
|
392
433
|
| **Мульти-стек** | ✅ Автоопределение + раздельный анализ | ❌ Стек-агностик | Вручную | Неопределённо |
|
|
393
434
|
| **Kotlin + CQRS/BFF** | ✅ Мультимодульный, разделение Command/Query | ❌ | ❌ | ❌ |
|
|
394
|
-
| **Самопроверка** | ✅
|
|
435
|
+
| **Самопроверка** | ✅ 5 инструментов валидации | ❌ | ❌ | ❌ |
|
|
395
436
|
| **Бэкап / Восстановление** | ✅ Система Master Plan | ❌ | ❌ | ❌ |
|
|
396
437
|
| **Время настройки** | ~5–18 мин (автоматически) | ~5 мин (ручная настройка) | Часы–Дни | ~5 мин |
|
|
397
438
|
|
package/README.vi.md
CHANGED
|
@@ -23,7 +23,7 @@ ClaudeOS-Core tự động hóa toàn bộ quy trình:
|
|
|
23
23
|
1. **Quét** dự án — tự động phát hiện stack, domain, ORM, database, package manager
|
|
24
24
|
2. **Phân tích chuyên sâu** mã nguồn — controller patterns, service layers, quy ước đặt tên, xử lý lỗi, bảo mật, testing và hơn 50 danh mục
|
|
25
25
|
3. **Tạo** hệ sinh thái tài liệu hoàn chỉnh — `CLAUDE.md`, Standards (15–19 file), Rules, Skills, Guides (9 file), Master Plans, tài liệu DB và hướng dẫn MCP
|
|
26
|
-
4. **Xác thực** mọi thứ —
|
|
26
|
+
4. **Xác thực** mọi thứ — 5 công cụ kiểm tra tích hợp đảm bảo tính nhất quán
|
|
27
27
|
|
|
28
28
|
Tổng thời gian: **5–18 phút**, tùy thuộc vào quy mô dự án. Không cần cấu hình thủ công.
|
|
29
29
|
|
|
@@ -209,7 +209,6 @@ node claudeos-core-tools/manifest-generator/index.js
|
|
|
209
209
|
node claudeos-core-tools/health-checker/index.js
|
|
210
210
|
|
|
211
211
|
# Hoặc chạy kiểm tra riêng lẻ:
|
|
212
|
-
node claudeos-core-tools/import-linter/index.js # @import validation
|
|
213
212
|
node claudeos-core-tools/plan-validator/index.js --check # Plan ↔ disk
|
|
214
213
|
node claudeos-core-tools/sync-checker/index.js # Sync status
|
|
215
214
|
node claudeos-core-tools/content-validator/index.js # Content quality
|
|
@@ -322,7 +321,7 @@ Với dự án multi-stack (ví dụ: Java + React), domain backend và frontend
|
|
|
322
321
|
|
|
323
322
|
## Công Cụ Xác Thực
|
|
324
323
|
|
|
325
|
-
ClaudeOS-Core bao gồm
|
|
324
|
+
ClaudeOS-Core bao gồm 5 công cụ xác thực tích hợp, chạy tự động sau khi tạo:
|
|
326
325
|
|
|
327
326
|
```bash
|
|
328
327
|
# Chạy tất cả kiểm tra cùng lúc (khuyến nghị)
|
|
@@ -336,8 +335,7 @@ npx claudeos-core restore # Khôi phục Plan → Đĩa
|
|
|
336
335
|
|
|
337
336
|
| Công Cụ | Chức Năng |
|
|
338
337
|
|---|---|
|
|
339
|
-
| **manifest-generator** | Xây dựng JSON metadata (rule-manifest,
|
|
340
|
-
| **import-linter** | Xác thực đường dẫn `@import` — phát hiện import bị hỏng, trùng lặp và vòng tròn (DFS) |
|
|
338
|
+
| **manifest-generator** | Xây dựng JSON metadata (rule-manifest, sync-map, plan-manifest) |
|
|
341
339
|
| **plan-validator** | So sánh khối `<file>` của Master Plan với đĩa — 3 chế độ: check, refresh, restore |
|
|
342
340
|
| **sync-checker** | Phát hiện file chưa đăng ký (trên đĩa nhưng không trong plan) và mục mồ côi |
|
|
343
341
|
| **content-validator** | Xác thực chất lượng file — file trống, thiếu ví dụ ✅/❌, phần bắt buộc |
|
|
@@ -345,6 +343,49 @@ npx claudeos-core restore # Khôi phục Plan → Đĩa
|
|
|
345
343
|
|
|
346
344
|
---
|
|
347
345
|
|
|
346
|
+
## Claude Code Sử Dụng Tài Liệu Như Thế Nào
|
|
347
|
+
|
|
348
|
+
Đây là cách Claude Code thực sự đọc tài liệu được ClaudeOS-Core tạo ra:
|
|
349
|
+
|
|
350
|
+
### File được đọc tự động
|
|
351
|
+
|
|
352
|
+
| File | Thời điểm | Đảm bảo |
|
|
353
|
+
|---|---|---|
|
|
354
|
+
| `CLAUDE.md` | Mỗi lần bắt đầu cuộc trò chuyện | Luôn luôn |
|
|
355
|
+
| `.claude/rules/*.md` | Khi chỉnh sửa file (qua `paths: ["**/*"]`) | Luôn luôn |
|
|
356
|
+
| `.claude/rules/00.core/00.standard-reference.md` | ↑ Bao gồm ở trên | Luôn luôn |
|
|
357
|
+
|
|
358
|
+
### File được đọc qua quy tắc standard-reference
|
|
359
|
+
|
|
360
|
+
Quy tắc `00.standard-reference.md` hướng dẫn Claude Code Read tài liệu standard trước khi viết code:
|
|
361
|
+
|
|
362
|
+
- `claudeos-core/standard/**` — Pattern coding, ví dụ ✅/❌, quy tắc đặt tên
|
|
363
|
+
- `claudeos-core/database/**` — DB schema (cho query, mapper, migration)
|
|
364
|
+
|
|
365
|
+
### File KHÔNG đọc (tiết kiệm context)
|
|
366
|
+
|
|
367
|
+
Được loại trừ rõ ràng qua phần `DO NOT Read` của quy tắc standard-reference:
|
|
368
|
+
|
|
369
|
+
| Thư mục | Lý do loại trừ |
|
|
370
|
+
|---|---|
|
|
371
|
+
| `claudeos-core/plan/` | Backup Master Plan (~340KB). Tự đồng bộ bằng hooks. |
|
|
372
|
+
| `claudeos-core/generated/` | JSON metadata build. Không dùng cho coding. |
|
|
373
|
+
| `claudeos-core/guide/` | Hướng dẫn onboarding cho người dùng. |
|
|
374
|
+
| `claudeos-core/mcp-guide/` | Tài liệu MCP server. Không dùng cho coding. |
|
|
375
|
+
|
|
376
|
+
### Đồng bộ Plan tự động (hooks)
|
|
377
|
+
|
|
378
|
+
Khi Claude Code chỉnh sửa file standard hoặc rules, hook PostToolUse tự động đồng bộ Master Plan:
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
AI chỉnh sửa claudeos-core/standard/10.backend-api/01.controller-patterns.md
|
|
382
|
+
→ sync-hook tự động cập nhật plan/10.standard-master.md
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Không cần đồng bộ thủ công. Hook được cài đặt tự động khi chạy `npx claudeos-core init`.
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
348
389
|
## Quy Trình Làm Việc Hàng Ngày
|
|
349
390
|
|
|
350
391
|
### Sau Khi Cài Đặt
|
|
@@ -359,7 +400,7 @@ npx claudeos-core restore # Khôi phục Plan → Đĩa
|
|
|
359
400
|
### Sau Khi Chỉnh Sửa Thủ Công Standards
|
|
360
401
|
|
|
361
402
|
```bash
|
|
362
|
-
#
|
|
403
|
+
# Nếu bạn chỉnh sửa file bên ngoài Claude Code (hooks chỉ hoạt động bên trong Claude Code):
|
|
363
404
|
npx claudeos-core refresh
|
|
364
405
|
|
|
365
406
|
# Xác minh mọi thứ nhất quán
|
|
@@ -391,7 +432,7 @@ npx claudeos-core restore
|
|
|
391
432
|
| **Đầu ra riêng dự án** | ✅ Mọi file phản ánh pattern của bạn | ❌ Lệnh chung | Một phần | ❌ Một cỡ cho tất cả |
|
|
392
433
|
| **Multi-stack** | ✅ Tự phát hiện + phân tích riêng | ❌ Không phân biệt stack | Thủ công | Không chắc |
|
|
393
434
|
| **Kotlin + CQRS/BFF** | ✅ Multi-module, Command/Query split | ❌ | ❌ | ❌ |
|
|
394
|
-
| **Tự xác thực** | ✅
|
|
435
|
+
| **Tự xác thực** | ✅ 5 công cụ validation | ❌ | ❌ | ❌ |
|
|
395
436
|
| **Backup / Khôi phục** | ✅ Hệ thống Master Plan | ❌ | ❌ | ❌ |
|
|
396
437
|
| **Thời gian cài đặt** | ~5–18 phút (tự động) | ~5 phút (cấu hình thủ công) | Hàng giờ–ngày | ~5 phút |
|
|
397
438
|
|
package/README.zh-CN.md
CHANGED
|
@@ -23,7 +23,7 @@ ClaudeOS-Core 将整个过程自动化:
|
|
|
23
23
|
1. **扫描** 你的项目——自动检测技术栈、领域、ORM、数据库、包管理器
|
|
24
24
|
2. **深度分析** 源代码——控制器模式、服务层、命名规范、异常处理、安全、测试等 50+ 个类别
|
|
25
25
|
3. **生成** 完整的文档体系——`CLAUDE.md`、Standards(15–19 个文件)、Rules、Skills、Guides(9 个文件)、Master Plans、DB 文档和 MCP 指南
|
|
26
|
-
4. **验证** 一切——
|
|
26
|
+
4. **验证** 一切——5 个内置验证工具确保一致性
|
|
27
27
|
|
|
28
28
|
总耗时:**5–18 分钟**,取决于项目规模。零手动配置。
|
|
29
29
|
|
|
@@ -209,7 +209,6 @@ node claudeos-core-tools/manifest-generator/index.js
|
|
|
209
209
|
node claudeos-core-tools/health-checker/index.js
|
|
210
210
|
|
|
211
211
|
# 或运行单独检查:
|
|
212
|
-
node claudeos-core-tools/import-linter/index.js # @import validation
|
|
213
212
|
node claudeos-core-tools/plan-validator/index.js --check # Plan ↔ disk
|
|
214
213
|
node claudeos-core-tools/sync-checker/index.js # Sync status
|
|
215
214
|
node claudeos-core-tools/content-validator/index.js # Content quality
|
|
@@ -322,7 +321,7 @@ your-project/
|
|
|
322
321
|
|
|
323
322
|
## 验证工具
|
|
324
323
|
|
|
325
|
-
ClaudeOS-Core 内置
|
|
324
|
+
ClaudeOS-Core 内置 5 个验证工具,生成后自动运行:
|
|
326
325
|
|
|
327
326
|
```bash
|
|
328
327
|
# 一次运行所有检查(推荐)
|
|
@@ -336,8 +335,7 @@ npx claudeos-core restore # Plan → 磁盘恢复
|
|
|
336
335
|
|
|
337
336
|
| 工具 | 功能 |
|
|
338
337
|
|---|---|
|
|
339
|
-
| **manifest-generator** | 构建元数据 JSON(rule-manifest、
|
|
340
|
-
| **import-linter** | 验证 `@import` 路径——检测断开、重复和循环导入(DFS) |
|
|
338
|
+
| **manifest-generator** | 构建元数据 JSON(rule-manifest、sync-map、plan-manifest) |
|
|
341
339
|
| **plan-validator** | 比较 Master Plan `<file>` 块与磁盘内容——3 种模式:check、refresh、restore |
|
|
342
340
|
| **sync-checker** | 检测未注册文件(磁盘有但计划中没有)和孤立条目 |
|
|
343
341
|
| **content-validator** | 验证文件质量——空文件、缺少 ✅/❌ 示例、必需章节 |
|
|
@@ -345,6 +343,49 @@ npx claudeos-core restore # Plan → 磁盘恢复
|
|
|
345
343
|
|
|
346
344
|
---
|
|
347
345
|
|
|
346
|
+
## Claude Code 如何使用你的文档
|
|
347
|
+
|
|
348
|
+
ClaudeOS-Core 生成的文档,Claude Code 实际读取方式如下:
|
|
349
|
+
|
|
350
|
+
### 自动读取的文件
|
|
351
|
+
|
|
352
|
+
| 文件 | 时机 | 保证 |
|
|
353
|
+
|---|---|---|
|
|
354
|
+
| `CLAUDE.md` | 每次对话开始 | 始终 |
|
|
355
|
+
| `.claude/rules/*.md` | 编辑文件时(通过 `paths: ["**/*"]`) | 始终 |
|
|
356
|
+
| `.claude/rules/00.core/00.standard-reference.md` | ↑ 包含在上面 | 始终 |
|
|
357
|
+
|
|
358
|
+
### 通过 standard-reference 规则读取的文件
|
|
359
|
+
|
|
360
|
+
`00.standard-reference.md` 规则指示 Claude Code 在编写代码前 Read 以下文档:
|
|
361
|
+
|
|
362
|
+
- `claudeos-core/standard/**` — 编码模式、✅/❌ 示例、命名规范
|
|
363
|
+
- `claudeos-core/database/**` — 数据库 schema(查询、mapper、迁移用)
|
|
364
|
+
|
|
365
|
+
### 不读取的文件(节省上下文)
|
|
366
|
+
|
|
367
|
+
通过 standard-reference 规则的 `DO NOT Read` 部分明确排除:
|
|
368
|
+
|
|
369
|
+
| 文件夹 | 排除原因 |
|
|
370
|
+
|---|---|
|
|
371
|
+
| `claudeos-core/plan/` | Master Plan 备份(~340KB)。由 hooks 自动同步。 |
|
|
372
|
+
| `claudeos-core/generated/` | 构建元数据 JSON。非编码参考。 |
|
|
373
|
+
| `claudeos-core/guide/` | 面向人类的入门指南。 |
|
|
374
|
+
| `claudeos-core/mcp-guide/` | MCP 服务器文档。非编码参考。 |
|
|
375
|
+
|
|
376
|
+
### 自动 Plan 同步(hooks)
|
|
377
|
+
|
|
378
|
+
当 Claude Code 编辑 standard 或 rules 文件时,PostToolUse hook 自动同步 Master Plan:
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
AI 编辑 claudeos-core/standard/10.backend-api/01.controller-patterns.md
|
|
382
|
+
→ sync-hook 自动更新 plan/10.standard-master.md
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
无需手动同步。hook 在 `npx claudeos-core init` 时自动安装。
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
348
389
|
## 日常工作流
|
|
349
390
|
|
|
350
391
|
### 安装后
|
|
@@ -359,7 +400,7 @@ npx claudeos-core restore # Plan → 磁盘恢复
|
|
|
359
400
|
### 手动编辑标准文件后
|
|
360
401
|
|
|
361
402
|
```bash
|
|
362
|
-
#
|
|
403
|
+
# 在 Claude Code 外部编辑了文件时(hooks 仅在 Claude Code 内部触发):
|
|
363
404
|
npx claudeos-core refresh
|
|
364
405
|
|
|
365
406
|
# 验证一切一致
|
|
@@ -391,7 +432,7 @@ npx claudeos-core restore
|
|
|
391
432
|
| **项目定制输出** | ✅ 每个文件反映你的模式 | ❌ 通用命令 | 部分 | ❌ 一刀切 |
|
|
392
433
|
| **多栈支持** | ✅ 自动检测 + 分别分析 | ❌ 栈无关 | 手动 | 不一定 |
|
|
393
434
|
| **Kotlin + CQRS/BFF** | ✅ 多模块, Command/Query 分离 | ❌ | ❌ | ❌ |
|
|
394
|
-
| **自验证** | ✅
|
|
435
|
+
| **自验证** | ✅ 5 个验证工具 | ❌ | ❌ | ❌ |
|
|
395
436
|
| **备份 / 恢复** | ✅ Master Plan 系统 | ❌ | ❌ | ❌ |
|
|
396
437
|
| **配置时间** | ~5–18分钟(自动) | ~5分钟(手动配置) | 数小时–数天 | ~5分钟 |
|
|
397
438
|
|
package/bin/cli.js
CHANGED
|
@@ -150,6 +150,64 @@ function injectProjectRoot(text) {
|
|
|
150
150
|
return text.replace(/\{\{PROJECT_ROOT\}\}/g, PROJECT_ROOT);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
// ─── Install sync hooks into .claude/settings.json ──────
|
|
154
|
+
function installSyncHooks() {
|
|
155
|
+
const settingsPath = path.join(PROJECT_ROOT, ".claude/settings.json");
|
|
156
|
+
|
|
157
|
+
// Determine sync-hook script path (relative to project root)
|
|
158
|
+
// Works for both npx (node_modules) and git clone (direct path) usage
|
|
159
|
+
let syncHookScript;
|
|
160
|
+
const npxPath = path.join(PROJECT_ROOT, "node_modules/claudeos-core/sync-hook/index.js");
|
|
161
|
+
const localPath = path.join(TOOLS_DIR, "sync-hook/index.js");
|
|
162
|
+
|
|
163
|
+
if (fs.existsSync(npxPath)) {
|
|
164
|
+
syncHookScript = "node node_modules/claudeos-core/sync-hook/index.js";
|
|
165
|
+
} else if (fs.existsSync(localPath)) {
|
|
166
|
+
const relScript = path.relative(PROJECT_ROOT, localPath).replace(/\\/g, "/");
|
|
167
|
+
syncHookScript = `node ${relScript}`;
|
|
168
|
+
} else {
|
|
169
|
+
log(" ⏭️ sync-hook script not found, skipping");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const hookEntry = {
|
|
174
|
+
matcher: "Edit|Write",
|
|
175
|
+
command: `${syncHookScript} "$TOOL_INPUT_FILE"`
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
let settings = {};
|
|
179
|
+
if (fs.existsSync(settingsPath)) {
|
|
180
|
+
try {
|
|
181
|
+
settings = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
|
|
182
|
+
} catch {
|
|
183
|
+
// Malformed JSON — start fresh but warn
|
|
184
|
+
log(" ⚠️ Existing settings.json was malformed, recreating");
|
|
185
|
+
settings = {};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Ensure hooks.PostToolUse array exists
|
|
190
|
+
if (!settings.hooks) settings.hooks = {};
|
|
191
|
+
if (!Array.isArray(settings.hooks.PostToolUse)) settings.hooks.PostToolUse = [];
|
|
192
|
+
|
|
193
|
+
// Check if sync-hook is already installed (avoid duplicates)
|
|
194
|
+
const alreadyInstalled = settings.hooks.PostToolUse.some(
|
|
195
|
+
(h) => h.command && h.command.includes("sync-hook")
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
if (alreadyInstalled) {
|
|
199
|
+
log(" ✅ Sync hooks already installed");
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
settings.hooks.PostToolUse.push(hookEntry);
|
|
204
|
+
|
|
205
|
+
ensureDir(path.dirname(settingsPath));
|
|
206
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
207
|
+
log(" ✅ Sync hooks installed → .claude/settings.json");
|
|
208
|
+
log(` Hook: PostToolUse (Edit|Write) → ${syncHookScript}`);
|
|
209
|
+
}
|
|
210
|
+
|
|
153
211
|
// ─── Command: init ───────────────────────────────────────
|
|
154
212
|
async function cmdInit() {
|
|
155
213
|
// ─── Prerequisites check ───────────────────────────────────
|
|
@@ -179,7 +237,7 @@ async function cmdInit() {
|
|
|
179
237
|
}
|
|
180
238
|
|
|
181
239
|
// Verify Claude is authenticated (quick prompt test)
|
|
182
|
-
const claudeAuth = run('claude -p "echo ok"
|
|
240
|
+
const claudeAuth = run('claude -p "echo ok"', { silent: true, ignoreError: true });
|
|
183
241
|
if (!claudeAuth) {
|
|
184
242
|
log("\n ⚠️ Claude Code may not be authenticated.");
|
|
185
243
|
log(" Run: claude (and complete authentication)");
|
|
@@ -250,6 +308,11 @@ async function cmdInit() {
|
|
|
250
308
|
}
|
|
251
309
|
log(" ✅ Done\n");
|
|
252
310
|
|
|
311
|
+
// ─── [2.5] Install sync hooks in .claude/settings.json ────
|
|
312
|
+
header("[2.5] Installing sync hooks...");
|
|
313
|
+
installSyncHooks();
|
|
314
|
+
log("");
|
|
315
|
+
|
|
253
316
|
// ─── [3] Run plan-installer ─────────────────────────
|
|
254
317
|
header("[3] Analyzing project (plan-installer)...");
|
|
255
318
|
run(`node "${path.join(TOOLS_DIR, "plan-installer/index.js")}"`);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Validation items:
|
|
8
8
|
* - File is not empty
|
|
9
9
|
* - standard files contain ✅/❌ examples + rules table
|
|
10
|
-
* - rules files contain paths:
|
|
10
|
+
* - rules files contain paths: ["all files"] frontmatter
|
|
11
11
|
* - CLAUDE.md required sections exist
|
|
12
12
|
* - All 9 guide files are generated
|
|
13
13
|
* - Skills orchestrator + sub-skills exist
|
|
@@ -102,17 +102,14 @@ async function main() {
|
|
|
102
102
|
errors.push({ file: r, type: "EMPTY", msg: "Empty file" });
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
|
-
//
|
|
105
|
+
// All rules (except sync) must have paths: ["**/*"] frontmatter
|
|
106
106
|
if (!r.includes("50.sync")) {
|
|
107
107
|
const hasFrontmatter = c.startsWith("---");
|
|
108
108
|
const hasPathsKey = c.includes("paths:");
|
|
109
109
|
if (!hasFrontmatter) {
|
|
110
110
|
warnings.push({ file: r, type: "NO_FRONTMATTER", msg: "Missing YAML frontmatter (---)" });
|
|
111
111
|
} else if (!hasPathsKey) {
|
|
112
|
-
warnings.push({ file: r, type: "NO_PATHS", msg: "Frontmatter exists but missing paths: key" });
|
|
113
|
-
}
|
|
114
|
-
if (!/^@[^\s]+/m.test(c)) {
|
|
115
|
-
warnings.push({ file: r, type: "NO_IMPORT", msg: "No @import reference found" });
|
|
112
|
+
warnings.push({ file: r, type: "NO_PATHS", msg: "Frontmatter exists but missing paths: key — use paths: [\"**/*\"] to ensure rule is always loaded" });
|
|
116
113
|
}
|
|
117
114
|
}
|
|
118
115
|
}
|
package/health-checker/index.js
CHANGED
|
@@ -6,11 +6,10 @@
|
|
|
6
6
|
* Role: Execute all verification tools sequentially and output consolidated results
|
|
7
7
|
* Execution order:
|
|
8
8
|
* [0] manifest-generator ← prerequisite: generates metadata like sync-map.json
|
|
9
|
-
* [1]
|
|
10
|
-
* [2]
|
|
11
|
-
* [3]
|
|
12
|
-
* [4]
|
|
13
|
-
* [5] pass-json-validator ← Pass 1-3 JSON format validation
|
|
9
|
+
* [1] plan-validator ← Plan ↔ disk consistency
|
|
10
|
+
* [2] sync-checker ← sync verification based on sync-map.json (requires manifest)
|
|
11
|
+
* [3] content-validator ← generated file quality validation
|
|
12
|
+
* [4] pass-json-validator ← Pass 1-3 JSON format validation
|
|
14
13
|
*
|
|
15
14
|
* Usage: npx claudeos-core <cmd> or node claudeos-core-tools/health-checker/index.js
|
|
16
15
|
*/
|
|
@@ -58,9 +57,8 @@ function main() {
|
|
|
58
57
|
}
|
|
59
58
|
console.log();
|
|
60
59
|
|
|
61
|
-
// ─── [1-
|
|
60
|
+
// ─── [1-4] Run verification tools sequentially ────────────────────
|
|
62
61
|
const tools = [
|
|
63
|
-
{ name: "import-linter", script: path.join(TOOLS, "import-linter/index.js"), desc: "@import validation" },
|
|
64
62
|
{ name: "plan-validator", script: path.join(TOOLS, "plan-validator/index.js"), desc: "Plan consistency" },
|
|
65
63
|
{ name: "sync-checker", script: path.join(TOOLS, "sync-checker/index.js"), desc: "Sync status" },
|
|
66
64
|
{ name: "content-validator", script: path.join(TOOLS, "content-validator/index.js"), desc: "Content quality" },
|
package/import-linter/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* ClaudeOS-Core — Import Linter
|
|
4
|
+
* ClaudeOS-Core — Import Linter (DEPRECATED)
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - DUPLICATE: Same path imported multiple times in the same file
|
|
10
|
-
* - CIRCULAR: Circular @import chain detected (DFS)
|
|
6
|
+
* @deprecated @import is not a real Claude Code feature and has been removed.
|
|
7
|
+
* Rules now use paths frontmatter with wildcard glob to ensure they are always loaded.
|
|
8
|
+
* This tool is kept for backward compatibility but is no longer run by health-checker.
|
|
11
9
|
*
|
|
12
|
-
* Usage:
|
|
10
|
+
* Usage: node claudeos-core-tools/import-linter/index.js
|
|
13
11
|
*/
|
|
14
12
|
|
|
15
13
|
const fs = require("fs");
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Role: Generate 4 types of metadata JSON + initialize stale-report
|
|
7
7
|
* Output (claudeos-core/generated/):
|
|
8
8
|
* - rule-manifest.json : rules/standard/skills/guide file list + frontmatter
|
|
9
|
-
* - import-graph.json :
|
|
9
|
+
* - import-graph.json : (deprecated — kept for backward compatibility, @import removed)
|
|
10
10
|
* - sync-map.json : plan/ <file> block → file path mapping
|
|
11
11
|
* - plan-manifest.json : plan/ file list + <file> block count
|
|
12
12
|
* - stale-report.json : initialized (each verification tool appends results)
|
|
@@ -54,25 +54,6 @@ function frontmatter(f) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
function extractImports(f) {
|
|
58
|
-
const content = fs.readFileSync(f, "utf-8");
|
|
59
|
-
const result = [];
|
|
60
|
-
let inCodeFence = false;
|
|
61
|
-
for (const line of content.split("\n")) {
|
|
62
|
-
if (/^```/.test(line)) { inCodeFence = !inCodeFence; continue; }
|
|
63
|
-
if (inCodeFence) continue;
|
|
64
|
-
const m = line.match(/^@(\.\.?\/[^\s]+)/);
|
|
65
|
-
if (m) {
|
|
66
|
-
const target = path.resolve(path.dirname(f), m[1]);
|
|
67
|
-
result.push({
|
|
68
|
-
raw: m[0],
|
|
69
|
-
resolved: rel(target),
|
|
70
|
-
exists: fs.existsSync(target),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
57
|
|
|
77
58
|
function extractFileBlocks(f) {
|
|
78
59
|
if (!fs.existsSync(f)) return [];
|
|
@@ -136,34 +117,16 @@ async function main() {
|
|
|
136
117
|
fs.writeFileSync(path.join(GEN, "rule-manifest.json"), JSON.stringify(mf, null, 2));
|
|
137
118
|
console.log(` ✅ rule-manifest.json — ${mf.summary.total} files indexed`);
|
|
138
119
|
|
|
139
|
-
// ─── import-graph.json
|
|
140
|
-
const gr = {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
for (const f of await glob("**/*.md", { cwd: scanDir, absolute: true })) {
|
|
147
|
-
const r = rel(f);
|
|
148
|
-
ns.add(r);
|
|
149
|
-
for (const i of extractImports(f)) {
|
|
150
|
-
ns.add(i.resolved);
|
|
151
|
-
gr.edges.push({ from: r, to: i.resolved, exists: i.exists });
|
|
152
|
-
if (!i.exists) {
|
|
153
|
-
gr.errors.push({ type: "broken_import", file: r, target: i.resolved });
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
gr.nodes = Array.from(ns).sort();
|
|
160
|
-
gr.summary = {
|
|
161
|
-
totalNodes: gr.nodes.length,
|
|
162
|
-
totalEdges: gr.edges.length,
|
|
163
|
-
brokenImports: gr.errors.length,
|
|
120
|
+
// ─── import-graph.json (deprecated — @import removed) ──
|
|
121
|
+
const gr = {
|
|
122
|
+
generatedAt: new Date().toISOString(),
|
|
123
|
+
deprecated: true,
|
|
124
|
+
note: "@import is not a Claude Code feature and has been removed. Rules now use paths: [\"**/*\"] frontmatter.",
|
|
125
|
+
nodes: [], edges: [], errors: [],
|
|
126
|
+
summary: { totalNodes: 0, totalEdges: 0, brokenImports: 0 },
|
|
164
127
|
};
|
|
165
128
|
fs.writeFileSync(path.join(GEN, "import-graph.json"), JSON.stringify(gr, null, 2));
|
|
166
|
-
console.log(
|
|
129
|
+
console.log(" ✅ import-graph.json — deprecated (no @imports)");
|
|
167
130
|
|
|
168
131
|
// ─── sync-map.json ─────────────────────────────────────
|
|
169
132
|
const sm = { generatedAt: new Date().toISOString(), mappings: [] };
|