Files
AirCoding/.dependency-cruiser.js
AirCoding a773bac28c P0-P8: Full V1.0.0 Alpha implementation + audit reports
Implements 123 tasks across 9 phases (T-001..T-809) totaling 146 source files.

Monorepo (P0):
- 7-package Bun + Turborepo + TypeScript monorepo
- dependency-cruiser enforcing 7 forbidden edges + 5 deep-import rules

Contracts (P0):
- 16 type files (ids/error/event/runtime/ipc/task/worker-result/tool/artifact/evidence/project/provider/permission/ui/capability/platform)

Storage & Events (P1):
- DatabaseManager + MigrationRunner (19 tables, 22 indexes, 5 schema_meta seeds)
- 16 repositories (Repository<T,I,U> pattern, INV-1 status columns via EventStore.project only)
- EventSchemaRegistry (54 durable + 7 ephemeral), EventStore, EventBus, EventIngestor
- Project/Session/Artifact/Evidence stores + 8-step Recovery

Tools & Permission (P2):
- PathClassifier (8 categories), CommandRiskAnalyzer (10 categories), SecretRedactor
- PermissionEngine 6-layer evaluation (capability→profile→task_scope→risk→credential→user_prompt)
- ToolRegistry with 20+ tools across fs/shell/git/project/artifact/context/permission/doctor
- CapabilityManifestValidator + CapabilityRegistry

LLM & Context (P3):
- ModelConfigLoader, CapabilityMatrix, AnthropicCanonicalConverter
- AnthropicAdapter + OpenAICompatibleAdapter
- ProviderManager facade
- PromptLayerLoader (L0/L1/L3/L5), CompactionPolicy, ContextAssembler

Worker IPC & Scheduler (P4):
- WorkerProtocol (NDJSON), WorkerProcess (exit codes 0-5), WorkerManager (spawn/handshake)
- WorkerRuntime (INV-3: IPC only, no direct fs/shell/SQLite)
- 5 worker roles (Executor/Reviewer/Debugger/Compactor/ExperienceMiner)
- TaskGraph, WavePlanner, RetryPlanner, AgentMonitor, WorkspaceManager
- Scheduler (state machine), 8-step Recovery

C++ Toolchain (P5):
- DiagnosticParser, CppProjectDetector, CMakeConfigurator, CppBuilder
- CppTestRunner, CppcheckRunner, ClangdClient
- CppToolRegistrar + capability manifest

Projection & TUI (P6):
- ProjectionStore (hydrate/apply/snapshot/subscribe)
- TuiApp + 8 components (Session/Task/Agent/Tool/Diff/Evidence/Permission/Blocker/Hud)
- ProjectionClient in-process ref

Agents & Knowledge (P7):
- MainAgent, ArchitectureDesigner
- DebugKnowledgeStore + LearnedMemoryStore (single-writer, outbox model)
- Role integration wiring

CLI & Doctor & Release (P8):
- Logger + DeveloperLogEncryptor (AES-256-GCM)
- DoctorService (self_bootstrap first)
- RuntimeApp + ServiceRegistry
- 11 CLI commands: run/init/doctor/provider/resume/compact/history/session/restore/e2e/release
- CliEntrypoint + air<TODO>

Audit (in AirPlan/docs/):
- Deepseek开发阶段审计.md (97 findings)
- Opus开发阶段审计.md (140+ findings, 18 P0 blockers)
- MiniMaxM3开发阶段审计.md (18 P0 blockers, focuses on executability)
- AirPlan/TODO.md (technical debt + 42 TODOs by phase)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 19:19:55 +08:00

153 lines
5.1 KiB
JavaScript
Executable File

/**
* Dependency-cruiser configuration for AirCoding monorepo
*
* Enforces DD §2 import-boundary rules:
* contracts -> (nothing) — leaf package, no deps
* llm -> contracts
* toolchain-cpp -> contracts
* tui -> contracts
* runtime -> contracts, llm — llm facade only
* cli -> contracts, runtime, tui, llm, toolchain-cpp
* workers -> contracts — WorkerRuntime IPC surface only
*/
module.exports = {
forbidden: [
/* ── Rule 0: contracts must import NOTHING from sibling packages ── */
{
name: "contracts-no-internal-deps",
comment: "contracts is the leaf package — it must not depend on any other AirCoding package",
severity: "error",
from: { path: "^packages/contracts/src/" },
to: { path: "^packages/(llm|runtime|tui|cli|workers|toolchain-cpp)/" },
},
/* ── Rule 1: llm may only import from contracts ── */
{
name: "llm-boundary",
comment: "llm may only depend on contracts",
severity: "error",
from: { path: "^packages/llm/src/" },
to: {
path: "^packages/(runtime|tui|cli|workers|toolchain-cpp)/",
pathNot: "^packages/contracts/",
},
},
/* ── Rule 2: toolchain-cpp may only import from contracts ── */
{
name: "toolchain-cpp-boundary",
comment: "toolchain-cpp may only depend on contracts",
severity: "error",
from: { path: "^packages/toolchain-cpp/src/" },
to: {
path: "^packages/(llm|runtime|tui|cli|workers)/",
pathNot: "^packages/contracts/",
},
},
/* ── Rule 3: tui may only import from contracts ── */
{
name: "tui-boundary",
comment: "tui may only depend on contracts",
severity: "error",
from: { path: "^packages/tui/src/" },
to: {
path: "^packages/(llm|runtime|cli|workers|toolchain-cpp)/",
pathNot: "^packages/contracts/",
},
},
/* ── Rule 4: runtime may only import from contracts & llm ── */
{
name: "runtime-boundary",
comment: "runtime may only depend on contracts and llm (facade)",
severity: "error",
from: { path: "^packages/runtime/src/" },
to: {
path: "^packages/(tui|cli|workers|toolchain-cpp)/",
pathNot: "^packages/(contracts|llm)/",
},
},
/* ── Rule 5: workers may only import from contracts ── */
{
name: "workers-boundary",
comment: "workers may only depend on contracts (WorkerRuntime IPC surface)",
severity: "error",
from: { path: "^packages/workers/src/" },
to: {
path: "^packages/(llm|runtime|tui|cli|toolchain-cpp)/",
pathNot: "^packages/contracts/",
},
},
/* ── Rule 6: cli may import from contracts, runtime, tui, llm, toolchain-cpp ── */
{
name: "cli-boundary",
comment: "cli may only depend on contracts, runtime, tui, llm, toolchain-cpp",
severity: "error",
from: { path: "^packages/cli/src/" },
to: {
path: "^packages/workers/",
pathNot: "^packages/(contracts|runtime|tui|llm|toolchain-cpp)/",
},
},
/* ── Rules 7-11: no deep cross-package imports (bypass barrel) ── */
{
name: "no-deep-cross-contracts-import",
comment: "Don't deep-import from contracts — use its barrel (index.ts)",
severity: "warn",
from: { path: "^packages/(?!contracts)[^/]+/src/" },
to: { path: "^packages/contracts/src/(?!index\\.ts)" },
},
{
name: "no-deep-cross-llm-import",
comment: "Don't deep-import from llm — use its barrel (index.ts)",
severity: "warn",
from: { path: "^packages/(?!llm)[^/]+/src/" },
to: { path: "^packages/llm/src/(?!index\\.ts)" },
},
{
name: "no-deep-cross-runtime-import",
comment: "Don't deep-import from runtime — use its barrel (index.ts)",
severity: "warn",
from: { path: "^packages/(?!runtime)[^/]+/src/" },
to: { path: "^packages/runtime/src/(?!index\\.ts)" },
},
{
name: "no-deep-cross-tui-import",
comment: "Don't deep-import from tui — use its barrel (index.ts)",
severity: "warn",
from: { path: "^packages/(?!tui)[^/]+/src/" },
to: { path: "^packages/tui/src/(?!index\\.ts)" },
},
{
name: "no-deep-cross-toolchain-cpp-import",
comment: "Don't deep-import from toolchain-cpp — use its barrel (index.ts)",
severity: "warn",
from: { path: "^packages/(?!toolchain-cpp)[^/]+/src/" },
to: { path: "^packages/toolchain-cpp/src/(?!index\\.ts)" },
},
],
options: {
doNotFollow: {
path: "node_modules",
},
moduleSystems: ["es6"],
tsPreCompilationDeps: true,
includeOnly: "^packages/",
exclude: [
"node_modules",
"dist",
"\\.d\\.ts$",
],
/* Use TypeScript path mappings to resolve workspace packages */
tsConfig: {
fileName: "./tsconfig.json"
},
/* Combined deps helps with bun workspaces */
combinedDependencies: true,
},
};