• 编码期测试的 DB 时序从「DROP+CREATE 空库 → Flyway 从零重建 → seed」
    改为「mysqldump 复制源库→一次性副本 → Flyway 只 apply 本轮新迁移 →
    跑测试 → 绿后晋升新迁移到源库 → 无论红绿删副本」。
    
    - 新模板 scripts/drop-test-db.mjs(删副本,硬拒删源库)、
      scripts/promote-to-source.mjs(移植 flyway 历史行+重放迁移到源库;
      跨 lane 串行由编排层 testGate 起栈互斥保证,文件锁兜底同树重跑)
    - setup-test-db:DROP 空库 → 复制源库到副本;test.mjs:try/finally
      删副本 + 绿后晋升 + 串行缺省显式导出副本名 <schema>__test
    - 命名约定(5 脚本共享):COPY = env > marker > <source>__test,
      每脚本 COPY===SOURCE 即拒绝;application*.yml 占位缺省改为副本名
    - 新 lib/bootstrap-source-flyway.mjs:db-init 建源库+apply V1+写
      checksum 与 Flyway 一致的历史行(Plan 期无 app 可起,手算 CRC32);
      db-init B 段三步换一次 bootstrap 调用
    - coding.mjs 各闸时序对齐;globalTeardown 只 kill 不删副本(teardown
      删副本会让其后的 promote 查不到副本历史而静默跳过晋升);行为门/
      seed 契约允许清单补 drop-test-db;前端 testGate 补收尾删副本
    - 模板测试重写 + 新增 drop/promote/bootstrap 测试(133 全绿,全离线)
    
    已知残留:bootstrap 手算 Flyway checksum 未真机验证(若不一致首次
    起后端报 checksum mismatch,改 flywayChecksum 一处即可);演示种子
    固定主键区间 1000–9999 与源库真实自增数据增长存在长期碰撞风险。
    zichun authored
     
    Browse Code »

  • add-req 的变更检测只哈希 docs/01 REQ 卡片与 docs/08 §三 FE 行文字,从不读
    prototype/,而原型才是前端布局/页面/交互的权威。改原型但 FE 行文字不变时
    台账无变化 → Router 跳过前端 → 原型改动永不重编。
    
    - req-ledger.mjs:collectProtoUnit 把全部 prototype/**/*.html 聚成单一
      __prototype__ 单元(kind=proto),relpath 归一+排序保证跨平台哈希稳定;
      无 .html 不产生该单元。接入 computeUnits。
    - add-req SKILL:步骤 1 说明 kind=proto + 老项目升级建基线语义;步骤 5 新增
      proto 作废分支(删全部 req-done/FE-* + milestone/frontend-phase + 复位
      §三里程碑,整体重跑前端阶段);横幅与 frontmatter 同步。
    - README:lib 说明加 prototype。
    - 测试:新增两用例证明改/删原型内容能被 diff 识别(FE 行文字不变也检测到)。
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    yanghl authored
     
    Browse Code »


  • - mergeAlterStatements 对 MODIFY/CHANGE/RENAME/ALTER/DROP(除 DROP FOREIGN KEY,
      外键维度已移除故对称放行)登记 unsupportedAlters;CLI 非空即 exit 1 并列出子句。
      此前静默跳过导致「migration 改了列但 docs/03 未同步」绿灯假阳性——恰是闸门最该抓
      的场景。未 CREATE 的表同样登记(检测先于 if(!t) 跳过)。parseDDL(text, opts) 不传
      收集器时行为不变(向后兼容)。
    - parseDDL 三遍扫描统一单一抹除底稿(剥注释+抹字面量一次完成,REGEX-3 全覆盖;
      blankStringLiterals 长度不变故偏移可复用);顺带修掉第一遍在未抹除底稿上扫描、
      字面量内 "CREATE TABLE ghost(...)" 产出幽灵表的缺口。
    - 测试 52→58:全部拒绝臂参数化覆盖(RENAME/ALTER COLUMN/DROP INDEX/DROP PRIMARY
      KEY)、混合 ADD+MODIFY(ADD 仍并入且登记)、CLI exit-1 冒烟(spawnSync)、幽灵表
      回归、DROP FOREIGN KEY 容忍。
    - add-req SKILL.md 闸门说明同步硬拒语义,消掉悬空的「见 P2」引用。
    zichun authored
     
    Browse Code »
  • P1#2 — validate-ddl 支持增量 migration:
    - parseDDL 新增第三遍 mergeAlterStatements:ALTER TABLE ADD COLUMN /
      ADD [UNIQUE] INDEX|KEY / ADD PRIMARY KEY 并入对应表(仅追加式,
      MODIFY/CHANGE/DROP/RENAME 不处理;并集与文件顺序无关)。
    - CLI 接受多个 DDL 文件:node validate-ddl docs/03 sql/migrations/V*.sql,
      CREATE + 各 V_n 的 ALTER ADD 并集 ↔ docs/03 累积 SSoT 做 4 维比对。
    - add-req SKILL 新增「增量 DDL 校验(fail-closed)」闸门,替换原「多 migration 不适用」说明。
    - 7 个新测试(含 DEFAULT 字面量里的 ALTER 文本不被误吃);52/52 通过。
    
    P1#3 — coding 首跑自动建需求台账基线:
    - coding-start 透传 pluginRoot;coding.mjs ensureLedgerBaseline()
      首跑若 .req-ledger.json 缺失则 commit 基线(幂等、best-effort、缺 pluginRoot 静默跳过),
      使日后 /add-req 能识别增量、免空跑。
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    yanghl authored
     
    Browse Dir »
  • 初始 Plan 完结后追加/修改需求时,只跑增量、不必整仓重跑。
    
    - lib/req-ledger.mjs(+单测):对 docs/01 REQ 卡 + docs/08 §三 FE 行算 sha256 内容哈希,
      对比 .req-ledger.json,scan/commit 出 new/changed/removed/unchanged
    - skills/plan/add-req:新增 user-invocable 增量入口。基线→检测→校验真实数据→
      A3-delta(写 V_n migration + 同步 docs/03,永不改 V1)→A5-delta(docs/05/02/08)→
      作废 changed 单元的 req-done/milestone tag→提交台账。Router 无需改动,缺 tag 即重跑
    - 变更识别靠内容哈希(非仅 tag 缺失):改过的老 REQ 也能认出并作废其 req-done,
      否则 Router 会跳过它——OpenSpec delta 思路的零依赖落地
    - 首跑无台账则先建基线,避免把存量误当新增重跑整仓
    - plugin.json 注册第 9 个 skill + 版本 0.2.0→0.3.0;CLAUDE 模板 Schema 演化补增量 V_n 规约
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    yanghl authored
     
    Browse File »

  • 标准列:每表 7 列(新增 iOrder/sMemo;sId/sBrandsId/sSubsidiaryId 改 varchar(50) NOT NULL),从表额外 +sParentId 共 8 列。docs-03 模板 + A3 渲染规则 + A4 DDL 默认值翻译(CURRENT_TIMESTAMP / DEFAULT '1111111111' / iOrder app-assigned)。
    
    去外键:A3 不再推导 FK 约束(改语义引用关系,无 ON DELETE/ON UPDATE,应用层维护一致性);A4 DDL 不生成 ALTER ADD FOREIGN KEY;validate-ddl 移除外键维度 5→4 维(表/列/类型/索引),单测 45 pass/0 fail;coding.mjs 种子/sentinel「FK 有序」→「按语义引用有序」(保留先被引用方后引用方/不可悬空)。
    
    注:db-design-gen 的 docs/06 读取清单/步骤B 两条 bullet 与本区域改动同处一个 diff hunk,随本提交落入(实属 docs/06 feature 的 A3 接入)。
    zichun authored
     
    Browse Dir »

  • - coding.mjs: per-module Seed stage after backend testGate (generate
      sql/seed/NN__<module>.sql, cold-stack verify with PK-range COUNT
      reconciliation); behavior gate step2 -> 5-step ordering (demo seed
      before sentinel, sentinel fixed >=100000 range); fe-skeleton adds
      Playwright globalSetup e2e baseline (seed + admin storageState);
      fe tdd e2e assertion constraints
    - skeleton-gen: new scripts-seed-demo-data-template.mjs (mysql CLI,
      _demo_seed_history idempotency ledger, offline-validatable, atomic
      apply+ledger batch) + lib offline tests (93/93 green)
    - db-init: B.3 re-clean DB after DDL smoke apply (hand schema back to
      Flyway, avoid missing-history-table error); fix step-D typo
    - docs-04/CLAUDE templates: data baseline & demo-seed conventions
      (PK ranges 1-999 init / 1000-9999 seed / >=100000 sentinel)
    zichun authored
     
    Browse Code »

  • zichun authored
     
    Browse File »
  • Replaces the phase-level read-only behavior-gate with a per-FE acceptance dimension: each FE is approved only when the code-reviewer approves AND runtime behavior verification is green. Behavior defects (dead control / sentinel text mismatch) become fixable must-fix that drive verify->fix->re-verify, not halts.
    
    - reviewWithFixLoop (frontend only, via if(fe)): at the approve gate, behaviorSubGate boots this FE's full stack + seeds sentinels, enumerates this FE's routes, two-tier asserts. Hard issues with a locator -> fixPrompt -> functional reverify -> next behaviorRound; soft text (i18n/literal/semantic) -> adjudicate(continue); behaviorRound bounded by BEHAVIOR_FE_MAX=3, env race by BEHAVIOR_ATTEMPT_MAX=2. Backend featureLoop branch unchanged.
    
    - New runFrontendSkeleton stage (before featureLoop(frontend)): App shell + full lazy router + FeStub placeholders + shared nav, so the app is buildable at every mid-phase point; tdd swaps FeStub->real component per FE. Idempotent via fe-skeleton-done tag.
    
    - BEHAVIOR_GATE_SCHEMA gains build-failed envError kind (sibling-FE-unimpl short-circuit, not a bug) + locator-not-resolvable coverage reason; deriveSpec emits a per-FE route-scope section, reviewer validates it.
    
    - Removed phase-level runBehaviorGate + 'Behavior' phase; kept phase-level testGate (regression). REVIEW_HARD_ROUNDS 8->10.
    
    - Safety: test-DB naming guard pushed into scripts-setup-test-db.mjs template (fail-closed unless name contains test/_dev/_local or ALLOW_NONTEST_DROP=1) + 3 tests.
    
    - agentType stays erp-workflow:code-reviewer. v1 design doc marked SUPERSEDED; v2 design at docs/design/2026-06-02-frontend-behavior-in-review-loop.md.
    
    Verified: wrapped syntax check SYNTAX_OK, 87/87 lib tests pass, no orphan refs, no time/random builtins, top-level return intact. Not yet run end-to-end against a real ERP project.
    zichun authored
     
    Browse File »

  • validate-ddl now recognizes the db-init A.1 DDL form (CREATE TABLE →
    CREATE INDEX → ALTER TABLE ADD FK), so schemas with out-of-body indexes/
    FKs no longer report false-positive index/FK diffs. Adds a second parse
    pass (mergeStandaloneIndexes / mergeStandaloneForeignKeys), string-literal
    blanking so DEFAULT/COMMENT text isn't mistaken for real DDL, backtick
    non-ASCII identifier support across all matchers (H3), and shared index-
    column normalization (strip backtick / prefix-length / ASC|DESC) on both
    docs and DDL sides. Chinese 主键/唯一 index labels map to PRIMARY/UNIQUE.
    
    apply-ddl resolves mysql2 from the target project dir (not the plugin),
    rejects 【人工填写】 credential placeholders before connecting, and exits 2
    on missing config/DDL paths. setup-test-db template validates schema as an
    ASCII identifier before interpolating it into DROP/CREATE. db-init gains a
    B.1 toolchain precheck (mysql2 module + mysql client) before any DROP.
    zichun authored
     
    Browse Code »
  • - resolveDbConfig only ever received the 5 DB_* keys dbEnvFromConfig emits;
      the MYSQL_*/DB_PASS/DB_NAME fallbacks had no producer (dead speculative
      generality, a dotenv-era leftover). Remove them.
    - collapse the config → DB_* env-shape → connection two-hop: resolveDbConfig
      now reads config.database.{host,port,user,password,schema} directly, and
      dbEnvFromConfig is removed.
    - CLI contract (node apply-ddl.mjs <configPath> <ddlPath>), the only caller
      via db-init, is unchanged.
    - rewrite tests to the parsed-config shape; drop the alias-only tests. 53 pass.
    zichun authored
     
    Browse Dir »
  • - delete lib/merge-gitignore.mjs + merge-gitignore.test.mjs: over-engineered for a once-run greenfield step (base .gitignore usually absent; duplicate ignore patterns are harmless)
    - D now uses C.1-style Read+Write: Write template if no .gitignore, else append missing lines (consistent with render.mjs removal + scope-lock direct-write)
    - removes the 'pre-Write empty .gitignore' fragility (Write self-creates); skeleton-gen drops Bash(node *) from allowed-tools
    zichun authored
     
    Browse Dir »
  • - remove render.mjs/render.test.mjs (scope-lock now writes REQ cards directly)
    - add yaml-config.mjs: minimal 2-level YAML reader (+ tests)
    - apply-ddl: parse config-vars.yaml database: section instead of .env.local dotenv; drop assertSafeDbTarget host-whitelist + schema guards (config-vars.yaml is trusted)
    - merge-gitignore/validate-ddl: self-contained pathToFileURL comment (no longer 'see render.mjs')
    zichun authored
     
    Browse Dir »

  • zichun authored
     
    Browse Dir »
  • zichun authored
     
    Browse Dir »
  • Independent Claude + Codex review of the working-tree diff surfaced
    23 issues; all applied in-place across three domains.
    
    workflows/coding.mjs (9):
    - spec/plan/verify/review prompts now git-commit their artifacts
      (closes milestone-dirty-worktree halt risk)
    - CHECKBOX_STATE_SCHEMA requires `state` + defensive guard in reviewWithFixLoop
    - writeDocs08FieldPromptM scopes edits to module via line anchor
    - assertSafeId guards Router output (module/REQ/FE ids)
    - featureLoop captures reviewWithFixLoop's return value
    - dateFromArtifactPath rejects impossible dates (9999-99-99 etc.)
    - terminal HALT review-unresolved message disambiguated
    - updated comment on top-level `return` (ESM vs node --check)
    
    lib/validate-ddl.mjs + tests (10):
    - extractType preserves unsigned/signed modifiers
    - KEY/INDEX fallthrough no longer creates spurious 'KEY' columns
    - FOREIGN KEY REFERENCES accepts schema-qualified `db.table`
    - index keys normalized to name:kind:cols (UNIQUE-aware)
    - FK keys include ON DELETE action (defaults to RESTRICT)
    - CREATE TEMPORARY TABLE parsed
    - parseForeignKeyBullet/parseIndexBullet reject prose bullets
    - +10 regression tests (62 total, all pass)
    - merge-gitignore.mjs docstring synced to implementation
    
    skills/ (4):
    - docs-06 template header: § 一~二 → § 一~三
    - downstream-gen §A steps renumbered 1-7 (was 1,3,4,5,6,7,8)
    - docs-08 initial template adds tokens.css checkbox
    - coding-start drops "已在后台启动" wording (Workflow is synchronous)
    zichun authored
     
    Browse Code »