Skip to content

Commit 9c2f8d7

Browse files
committed
release: v1.9.12
1 parent 9e833e4 commit 9c2f8d7

48 files changed

Lines changed: 825 additions & 192 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# 变更日志 (CHANGELOG)
22

33
> **说明**: 版本概览摘要。最新版本的详细变更见下方表格首行的 `changelogs/vX.Y.Z.md` 链接;历史版本见对应详细变更文件
4-
> **最后更新**: 2026-05-22
4+
> **最后更新**: 2026-05-25
55
66
---
77

88
## 版本概览
99

1010
| 版本 | 日期 | 变更摘要 | 详细 |
1111
|------|------|---------|------|
12+
| [v1.9.12](./changelogs/v1.9.12.md) | 2026-05-25 | 🔧 **MCP 发布链补强 + 控制面一致性闭环**:补齐 `mcp/` 发布资产与 MCP smoke test,统一 `bugs/` / `requirements/` 任务链口径,收紧跨任务 CP gate 边界,新增确认后前置轻量复审(C19),统一 `data/*` 运行时台账语义、`sessions.md` 模板和任务级报告优先路径;`instruction-fallback-check.js` 对齐 `.archived` 跳过与排序策略,并新增 `V7b` fallback smoke test | [查看](./changelogs/v1.9.12.md) |
1213
| [v1.9.11](./changelogs/v1.9.11.md) | 2026-05-22 | 🔧 **Auto v1.1 runtime 收口 + 控制面校验补强**:在 auto 白名单门禁落地后,继续收紧 bootstrap 到当前 agent + 今日/昨日 tasks,补齐缺少 `agent` 的 fallback 推断与回归测试;对齐 `profile init` 与 `validate-profile.js` 模板/真相源校验;`validate.js` V10 改为结构化探针并新增 V15 audit-state 状态机校验,同时同步父级 `.github/.claude` runtime 副本 | [查看](./changelogs/v1.9.11.md) |
1314
| [v1.9.10](./changelogs/v1.9.10.md) | 2026-05-21 | 🔧 **模板/工作流漂移修复 + V13 语义门禁**:修复 precheck 模板 PC0~PC7 与 chat 预检查口径、Token 当前全开放说明、报告模板强制头部和 fix 专属章节、chat daily memory、CP3 `N/A` 豁免运行时识别、API/场景测试归档路径;`validate.js` 扩展 V8 prompts 覆盖并新增 V13 模板语义探针;同步仓内与父级 `.github/.claude` 部署体 | [查看](./changelogs/v1.9.10.md) |
1415
| [v1.9.9](./changelogs/v1.9.9.md) | 2026-05-21 | 🔧 **单源分发回归修复 + 发布门禁补强**:修复 v1.9.8 `instructions.md` 未进入 npm tarball 导致 `init/update` 主链缺失的问题;V6 与 `test-pack-clean` 新增 required package assets 正向断言;同步 README/RULES/profile 的 agents 分发语义和单源路径;单源正文改为平台中性索引说明;更新 audit-common V8 职责描述,避免 8 文件/33% 旧口径误导审查 | [查看](./changelogs/v1.9.9.md) |
@@ -82,12 +83,11 @@
8283

8384
## 相关文档
8485

85-
- [`changelogs/v1.9.4.md`](./changelogs/v1.9.4.md) — 最新版本详细变更文档
86-
- [`changelogs/v1.9.3.md`](./changelogs/v1.9.3.md) — 上一个版本详细变更文档
87-
- [`changelogs/v1.9.2.md`](./changelogs/v1.9.2.md) — 历史版本详细变更文档
88-
- [`changelogs/v1.9.1.md`](./changelogs/v1.9.1.md) — 历史版本详细变更文档
89-
- [`changelogs/v1.9.0.md`](./changelogs/v1.9.0.md) — 历史版本详细变更文档
86+
- [`changelogs/v1.9.12.md`](./changelogs/v1.9.12.md) — 最新版本详细变更文档
87+
- [`changelogs/v1.9.11.md`](./changelogs/v1.9.11.md) — 上一个版本详细变更文档
88+
- [`changelogs/v1.9.10.md`](./changelogs/v1.9.10.md) — 历史版本详细变更文档
89+
- [`changelogs/v1.9.9.md`](./changelogs/v1.9.9.md) — 历史版本详细变更文档
90+
- [`changelogs/v1.9.8.md`](./changelogs/v1.9.8.md) — 历史版本详细变更文档
9091
- [`changelogs/v1.1.0.md`](./changelogs/v1.1.0.md) — 历史版本详细变更文档
9192
- [README.md](./README.md) — 项目说明
9293
- [requirements/index.md](./website/docs/versions/v1/1.0.0/requirements/index.md) — 需求文档总览
93-

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ DevCodex 的 `plugin.json` 声明 `tier: "free"`,所有 Skill 均标注 `tier:
253253
- **推荐**:通过 `copilot-instructions.md` + `instructions/` 自动注入,直接在 Copilot Chat 对话即可
254254
- **可选**:通过 `.github/agents/` 使用 `@devcodex` / `@devcodex-auto` 自定义 Agent 入口
255255

256-
Auto v1.1 当前只在 `hook-enforced` 宿主里,对显式 `@devcodex-auto` 入口下的白名单路径提供 runtime 级硬保证;JetBrains 等 `instruction-fallback` 宿主与 Claude Code 仅同步规则语义,不承诺完全等价的自动放行。
256+
Auto v1.1 当前只在支持 Hook 的宿主里,对显式 `@devcodex-auto` 入口下的白名单路径提供 runtime 级硬保证;JetBrains 等 `instruction-fallback` 宿主仅同步规则语义,不承诺完全等价的自动放行。
257257

258258
## 许可证
259259

‎RULES.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# DevCodex v1.9.11 — 使用入口
1+
# DevCodex v1.9.12 — 使用入口
22

3-
> GitHub Copilot Agent Plugin · publisher: Rocky · version: 1.9.11
3+
> GitHub Copilot Agent Plugin · publisher: Rocky · version: 1.9.12
44
55
## 默认 Copilot 支持
66

‎agents/devcodex-auto.agent.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ disable-model-invocation: true
1616

1717
- **唯一正式入口**:显式 `@devcodex-auto`
1818
- **hook-enforced 宿主**:仅对白名单路径自动推进;非白名单路径默认回确认模式
19-
- **instruction-fallback / Claude Code**:只同步规则语义,不承诺 runtime 级硬放行
19+
- **instruction-fallback 宿主**:如 JetBrains / Cursor,只同步规则语义,不承诺 runtime 级硬放行;支持 Hook 的宿主按白名单执行 runtime 放行
2020
- **白名单范围**:DevCodex 治理文件、`.devcodex/` 产物、README 与 auto 专属回归脚本
2121
- S01~S07 / C01 / C10 / C18 **不可豁免**
2222
- 可恢复失败:重试 ≤ 2 次;不可恢复失败:通知用户 ⚠️

‎changelogs/v1.9.12.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# v1.9.12 — MCP 发布链补强 + 控制面一致性闭环
2+
3+
> **发布日期**: 2026-05-25
4+
> **类型**: PATCH
5+
> **关联报告**: `.devcodex/bugs/Claude Code MCP发布链修复/reports/claude-code/20260524/04--实施与验证.md`, `.devcodex/bugs/Claude Code MCP全链路收口/reports/claude-code/20260524/04--实施与验证.md`, `.devcodex/bugs/规范控制面一致性收口/reports/claude-code/20260525/07--fallback收口修复.md`
6+
7+
---
8+
9+
## Fixed
10+
11+
- `package.json` 分发面补入 `mcp/`,真实 npm 发布包现在会包含 `mcp/memory-server.js` 与 `mcp/profile-server.js`。
12+
- `mcp/profile-server.js` 的默认 agent 兜底统一为 `claude-code`,不再回落为裸 `claude`。
13+
- `mcp/memory-server.js` 的 `memory_cp_confirm` 支持 `kind=bugs`,MCP 可以直接维护 bug 任务的 `sessions.md`。
14+
- `hooks/_runtime/lifecycle.cjs` 已覆盖 `.devcodex/bugs/`,并收紧跨任务 CP gate 边界,去掉“任一旧任务 CP3 后全局放行”的宽松逻辑。
15+
- `scripts/instruction-fallback-check.js` 现已对齐运行时规则:跳过 `.archived`,并按任务目录 `mtimeMs` 排序判断未完成任务。
16+
- 新增 `scripts/test-instruction-fallback-check.js`,并在 `scripts/validate.js` 中引入 `V7b` fallback smoke test。
17+
- `instructions` / `skills` / `prompts` / `agents` / `README` 同步补入控制面一致性修订:
18+
- 新增确认后前置轻量复审规则 `C19`
19+
- 统一 Claude Auto 的宿主说明
20+
- 统一 `data/*` 运行时台账语义
21+
- 统一 `## 会话 NN` 标题口径
22+
- 重写 `requirement-session.prompt.md` 以匹配 hook 读取的 CP 表格式
23+
- 报告路径示例改为任务级优先、全局兜底
24+
25+
## Validation
26+
27+
- `node scripts/test-hooks-runtime.js`
28+
- `node scripts/test-instruction-fallback-check.js`
29+
- `node scripts/test-mcp-servers.js`
30+
- `node scripts/validate.js`
31+
- `npm pack --dry-run --json`
32+
- `node devcodex-v1\\index.js update`(父级 `E:\Worker\.github` / `E:\Worker\.claude` 部署同步复核)
33+
34+
## Impact
35+
36+
- Claude Code / Copilot Hook / instruction-fallback 三条执行链的控制面边界重新对齐,不再出现“一条放行、一条阻断”的宿主分叉。
37+
- MCP 发布链从“源码可用、npm 包缺件”变为“源码与真实发布物一致”。
38+
- `bugs/` 与 `requirements/` 现在在 MCP、runtime、fallback、测试与核心规范口径上达到同等级支持。
39+
40+
## Breaking Changes
41+
42+
无。

‎data/README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,18 @@ data/
2424
## init 行为
2525

2626
`devcodex init` 将 `data/templates/*.md` 复制到用户项目的 `.github/data/*.md`(目标路径向后兼容,不变)。
27+
28+
## 路径语义
29+
30+
规范文件里出现的以下路径,默认都指**目标项目 / 已部署副本的运行时台账路径**:
31+
32+
- `data/violations.md`
33+
- `data/pending-fixes.md`
34+
- `data/process-improvements.md`
35+
36+
而在**源仓**里:
37+
38+
- `data/templates/*.md`:仅提供空模板
39+
- `.devcodex/.maintainer-state/`:维护者自己的实际记录,不参与 npm 分发
40+
41+
换句话说,规范里写 `data/*.md` 时,表达的是“应该把记录落到运行时台账”,不是说源仓根 `data/` 目录里直接保存真实记录。

‎hooks/_runtime/lifecycle.cjs‎

Lines changed: 109 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ const CP1_FILE = '01-需求概述.md'
2727
const CP2_FILE = '02-技术方案.md'
2828
const CP3_FILE = '04-实施计划.md'
2929
const REQUIREMENTS_DIR = path.join(WORKSPACE_ROOT, '.devcodex', 'requirements')
30+
const BUGS_DIR = path.join(WORKSPACE_ROOT, '.devcodex', 'bugs')
31+
const TASK_ROOTS = [
32+
{ kind: 'requirements', dir: REQUIREMENTS_DIR },
33+
{ kind: 'bugs', dir: BUGS_DIR }
34+
]
3035
const EXECUTION_MODE = { CONFIRM: 'confirm', AUTO: 'auto' }
3136
const AUTO_ALLOWED_PATH_PATTERNS = [
3237
/^\.devcodex\//,
@@ -483,37 +488,71 @@ function readCpConfirmations(reqPath) {
483488
return confirmed
484489
}
485490

486-
function findIncompleteRequirement() {
487-
if (!fs.existsSync(REQUIREMENTS_DIR)) return null
491+
function directoryContainsFileMatching(dir, matcher, depth = 4) {
492+
if (!fs.existsSync(dir) || depth < 0) return false
488493
let entries
489-
try { entries = fs.readdirSync(REQUIREMENTS_DIR) } catch { return null }
490-
const dirs = entries
491-
.map(name => {
492-
const fullPath = path.join(REQUIREMENTS_DIR, name)
493-
try { const s = fs.statSync(fullPath); return s.isDirectory() ? { name, fullPath } : null }
494-
catch { return null }
495-
})
496-
.filter(Boolean)
497-
498-
// v1.9.4+ 跨需求阻断缓解:先扫描"是否存在任意已 CP3 通过的需求"
499-
// 若存在 → 视为有需求已进入实施阶段 → 全局放行(避免旧未完成需求阻断当前实施)
500-
// 配合 `.archived` 旁路(v1.9.3+)共同工作;archived 视为"已归档",不参与 CP3 通过统计
501-
const hasAnyCp3Done = dirs.some(d => {
502-
if (fs.existsSync(path.join(d.fullPath, '.archived'))) return false
503-
if (!fs.existsSync(path.join(d.fullPath, CP1_FILE))) return false
504-
const cp = readCpConfirmations(d.fullPath)
505-
if (cp.CP3Exempt) return false
506-
if (!fs.existsSync(path.join(d.fullPath, CP3_FILE))) return false
507-
return cp.CP3
508-
})
509-
if (hasAnyCp3Done) return null // 已有需求进入实施 → 全局放行(跨需求场景)
494+
try { entries = fs.readdirSync(dir, { withFileTypes: true }) } catch { return false }
495+
for (const entry of entries) {
496+
const full = path.join(dir, entry.name)
497+
if (entry.isFile() && matcher(entry.name, full)) return true
498+
if (entry.isDirectory() && directoryContainsFileMatching(full, matcher, depth - 1)) return true
499+
}
500+
return false
501+
}
502+
503+
function hasTaskArtifact(task, phase) {
504+
const fullPath = task.fullPath
505+
if (phase === 'CP1') {
506+
if (fs.existsSync(path.join(fullPath, CP1_FILE))) return true
507+
if (task.kind === 'bugs') {
508+
return directoryContainsFileMatching(
509+
path.join(fullPath, 'reports'),
510+
name => /^01--.*CP1.*\.md$/i.test(name)
511+
)
512+
}
513+
return false
514+
}
515+
if (phase === 'CP2') {
516+
if (fs.existsSync(path.join(fullPath, CP2_FILE))) return true
517+
if (task.kind === 'bugs') {
518+
return directoryContainsFileMatching(
519+
path.join(fullPath, 'reports'),
520+
name => /^02--.*CP2.*\.md$/i.test(name)
521+
)
522+
}
523+
return false
524+
}
525+
if (phase === 'CP3') return fs.existsSync(path.join(fullPath, CP3_FILE))
526+
return false
527+
}
528+
529+
function listTaskDirs() {
530+
const out = []
531+
for (const root of TASK_ROOTS) {
532+
if (!fs.existsSync(root.dir)) continue
533+
let entries
534+
try { entries = fs.readdirSync(root.dir) } catch { continue }
535+
for (const name of entries) {
536+
const fullPath = path.join(root.dir, name)
537+
try {
538+
const s = fs.statSync(fullPath)
539+
if (s.isDirectory()) out.push({ kind: root.kind, name, fullPath, mtimeMs: s.mtimeMs || 0 })
540+
} catch { }
541+
}
542+
}
543+
return out.sort((a, b) => (b.mtimeMs || 0) - (a.mtimeMs || 0))
544+
}
545+
546+
function findIncompleteTask() {
547+
const dirs = listTaskDirs()
548+
if (!dirs.length) return null
510549

511550
return dirs.find(d => {
512551
if (fs.existsSync(path.join(d.fullPath, '.archived'))) return false
513-
if (!fs.existsSync(path.join(d.fullPath, CP1_FILE))) return false
552+
if (!hasTaskArtifact(d, 'CP1')) return false
514553
const cp = readCpConfirmations(d.fullPath)
515554
if (cp.CP3) return false
516-
if (!fs.existsSync(path.join(d.fullPath, CP3_FILE))) return true
555+
if (!hasTaskArtifact(d, 'CP3')) return true
517556
return !cp.CP3
518557
}) || null
519558
}
@@ -556,18 +595,26 @@ function extractToolPaths(payload) {
556595
return out.map(p => { try { return path.normalize(p) } catch { return p } }).filter(Boolean)
557596
}
558597

559-
// Map a file path to its owning requirement name (.devcodex/requirements/<X>/...);
560-
// returns null when the path is not under any requirement directory.
561-
function getRequirementNameFromPath(p) {
598+
// Map a file path to its owning task scope (.devcodex/requirements/<X>/... or .devcodex/bugs/<X>/...).
599+
// returns null when the path is not under any supported task directory.
600+
function getTaskScopeFromPath(p) {
562601
if (!p) return null
563602
let abs = p
564603
if (!path.isAbsolute(abs)) abs = path.resolve(WORKSPACE_ROOT, abs)
565604
const norm = path.normalize(abs)
566-
const reqsDir = path.normalize(REQUIREMENTS_DIR)
567-
if (!norm.toLowerCase().startsWith(reqsDir.toLowerCase() + path.sep)) return null
568-
const rel = path.relative(reqsDir, norm)
569-
const parts = rel.split(path.sep).filter(Boolean)
570-
return parts.length > 0 ? parts[0] : null
605+
for (const root of TASK_ROOTS) {
606+
const rootDir = path.normalize(root.dir)
607+
if (!norm.toLowerCase().startsWith(rootDir.toLowerCase() + path.sep)) continue
608+
const rel = path.relative(rootDir, norm)
609+
const parts = rel.split(path.sep).filter(Boolean)
610+
if (!parts.length) return null
611+
return {
612+
kind: root.kind,
613+
name: parts[0],
614+
fullPath: path.join(root.dir, parts[0])
615+
}
616+
}
617+
return null
571618
}
572619

573620
function toWorkspaceRelativePath(p) {
@@ -603,41 +650,41 @@ function checkAutoWhitelist(payload, platform, state) {
603650
}
604651
}
605652

606-
// Path-aware CP gate: when all tool paths belong to specific requirement dirs,
607-
// only check those requirements' CP status (avoids cross-requirement deny).
608-
// Falls back to global findIncompleteRequirement() for mixed/source-code paths.
609-
function findIncompleteRequirementForPaths(payload) {
653+
// Path-aware CP gate: when all tool paths belong to specific task dirs,
654+
// only check those tasks' CP status (avoids cross-task deny).
655+
// Falls back to global findIncompleteTask() for mixed/source-code paths.
656+
function findIncompleteTaskForPaths(payload) {
610657
const paths = extractToolPaths(payload)
611-
if (paths.length === 0) return findIncompleteRequirement()
612-
613-
const reqNames = paths.map(getRequirementNameFromPath)
614-
const allInReq = reqNames.every(n => n !== null)
615-
if (!allInReq) return findIncompleteRequirement() // mixed or source-code → preserve original behavior
616-
617-
const targetSet = new Set(reqNames)
618-
for (const reqName of targetSet) {
619-
const fullPath = path.join(REQUIREMENTS_DIR, reqName)
620-
if (!fs.existsSync(fullPath)) continue
621-
if (fs.existsSync(path.join(fullPath, '.archived'))) continue
622-
if (!fs.existsSync(path.join(fullPath, CP1_FILE))) continue
623-
const cp = readCpConfirmations(fullPath)
658+
if (paths.length === 0) return findIncompleteTask()
659+
660+
const taskScopes = paths.map(getTaskScopeFromPath)
661+
const allInTask = taskScopes.every(scope => scope !== null)
662+
if (!allInTask) return findIncompleteTask() // mixed or source-code → preserve original behavior
663+
664+
const targetMap = new Map()
665+
for (const scope of taskScopes) targetMap.set(`${scope.kind}:${scope.name}`, scope)
666+
for (const task of targetMap.values()) {
667+
if (!fs.existsSync(task.fullPath)) continue
668+
if (fs.existsSync(path.join(task.fullPath, '.archived'))) continue
669+
if (!hasTaskArtifact(task, 'CP1')) continue
670+
const cp = readCpConfirmations(task.fullPath)
624671
if (cp.CP3) continue
625-
if (!fs.existsSync(path.join(fullPath, CP3_FILE))) return { name: reqName, fullPath }
626-
if (!cp.CP3) return { name: reqName, fullPath }
672+
if (!hasTaskArtifact(task, 'CP3')) return task
673+
if (!cp.CP3) return task
627674
}
628-
return null // all target requirements have CP3 confirmed → allow
675+
return null // all target tasks have CP3 confirmed → allow
629676
}
630677

631678
function checkCpGate(payload) {
632-
const req = (payload && extractToolPaths(payload).length > 0)
633-
? findIncompleteRequirementForPaths(payload)
634-
: findIncompleteRequirement()
635-
if (!req) return null
636-
const confirmed = readCpConfirmations(req.fullPath)
637-
if (!fs.existsSync(path.join(req.fullPath, CP2_FILE)) || !confirmed.CP2) {
638-
return { phase: 'CP2', reqName: req.name, reqPath: req.fullPath }
679+
const task = (payload && extractToolPaths(payload).length > 0)
680+
? findIncompleteTaskForPaths(payload)
681+
: findIncompleteTask()
682+
if (!task) return null
683+
const confirmed = readCpConfirmations(task.fullPath)
684+
if (!hasTaskArtifact(task, 'CP2') || !confirmed.CP2) {
685+
return { phase: 'CP2', reqName: task.name, reqPath: task.fullPath, kind: task.kind }
639686
}
640-
return { phase: 'CP3', reqName: req.name, reqPath: req.fullPath }
687+
return { phase: 'CP3', reqName: task.name, reqPath: task.fullPath, kind: task.kind }
641688
}
642689

643690
// Source file extensions that indicate code/config being written
@@ -698,7 +745,7 @@ function isSourceCodeMutation(payload, platform) {
698745

699746
function buildCpDenyOutput(platform, eventName, gate, toolName) {
700747
const msgs = {
701-
CP2: `CP2 (技术方案) 未完成 — 请先输出 ${CP2_FILE} 并在 .memory/sessions.md 记录用户确认(✅)后再编码。`,
748+
CP2: 'CP2 (技术方案) 未完成 — 请先输出对应的 CP2 方案产物(如 02-技术方案.md 或 CP2 报告产物),并在 .memory/sessions.md 记录用户确认(✅)后再编码。',
702749
CP3: `CP3 (实施计划) 未完成 — 请先输出 ${CP3_FILE} 并在 .memory/sessions.md 记录用户确认(✅)后再编码。`
703750
}
704751
const msg = msgs[gate.phase]

‎instructions/00-safety.instructions.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,7 @@ applyTo: "**"
5252
| 状态 | ⛔ 致命违规终止 |
5353
| 🎯 任务摘要 | `⛔ S0{N} 违规:[违规类型简述]` |
5454

55-
同时在 `data/violations.md` 登记表中追加违规记录。
55+
同时在运行时违规台账中追加违规记录:
56+
57+
- **目标项目 / 已部署副本**:`data/violations.md`
58+
- **源仓维护态**:模板位于 `data/templates/violations.md`,维护者实录位于 `.devcodex/.maintainer-state/`

0 commit comments

Comments
 (0)