• First concrete code commit for DevLoop. Implements all 7 services that
    P0.A tools will depend on, per plan-migration P0.0.
    
    Services (server/services/devloop/, ~900 lines):
    - path-resolver.js   foundation — resolveProjectRoot + 12 derived paths;
                         sandbox + linked-new mode support; sensitive path
                         blacklist (with /tmp + os.tmpdir() exemptions);
                         ~/.devloop/linked-projects.json registry
    - doc-store.js       PRD/SDD multi-file site IO + cheerio validateHTML +
                         validateUnitsSchema + canonical-JSON hashContract
                         + automatic history/ archival
    - unit-registry.js   FSM (M-2: pending→coding→testing→passed/failed/blocked);
                         l2GateOpen; diffUnits (added/changed/removed);
                         reset semantics for L2 + L3
    - bug-tracker.js     bugs.ndjson append-only + dedupKey + P-9 transition
                         state machine + list/stats/history aggregation
    - timeline-logger.js M-13 ProcessTimeline — append/read/tail;
                         summary truncate to 280; payload oversize → ref form
    - changelog-writer.js M-15 — append/read/latest for prd/sdd/units revs
    - sse-broker.js      per-pid pub/sub + 25s heartbeat + stream.log replay
                         via Last-Event-ID; emit returns monotonic id
    - git-vault.js       spawn-git wrapper — init/commit/tag/log/diff/status/
                         resetWorkingTree/revert/archive; per-pid mutex;
                         nothing-to-commit returns {skipped:true} not throw
    
    Tests (server/tests/devloop/, 71 passing):
    - path-resolver.test.js  (17 cases) — sensitive path · sandbox alloc · linked-new
    - doc-store.test.js      (12 cases) — validateHTML · validateUnitsSchema · hashContract
    - unit-registry.test.js  (15 cases) — FSM transitions · l2GateOpen · diffUnits
    - bug-tracker.test.js    (10 cases) — open dedup · transition · list filter · history
    - timeline-logger.test.js (9 cases) — append/read/tail · summary truncate · oversize
    - git-vault.test.js      (8 cases)  — init idempotent · commit · tag · status · archive
    
    vitest config (`globals: true`) means tests use describe/it/expect globally,
    no `require('vitest')` needed (and would fail under vitest 4).
    
    Dep added: cheerio@^1.0.0 (used by docStore.validateHTML; HTML parsing).
    
    Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
    yibo authored
     
    Browse Dir »