Skip to content

Commit fea0295

Browse files
committed
release: v1.9.11 — auto v1.1 runtime whitelist
1 parent 9f481d8 commit fea0295

13 files changed

Lines changed: 222 additions & 10 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
| 版本 | 日期 | 变更摘要 | 详细 |
1111
|------|------|---------|------|
12+
| [v1.9.11](./changelogs/v1.9.11.md) | 2026-05-21 | 🔧 **Auto v1.1 runtime 收口 + 白名单门禁落地**:将 auto 正式入口收敛为显式 `@devcodex-auto`,在 `lifecycle.cjs` 中新增 `executionMode` 与白名单路径门禁,只对白名单路径自动推进;补齐 hooks runtime 回归用例、`validate.js` V14 auto 语义探针,并同步 README 与父级 `.github/.claude` 部署副本 | [查看](./changelogs/v1.9.11.md) |
1213
| [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) |
1314
| [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) |
1415
| [v1.9.8](./changelogs/v1.9.8.md) | 2026-05-21 | 🎯 **单源规范 + agents 恢复 + 多项目工作区阻断**(含 PATCH Breaking Change,由用户 D1 决策接受 Semver 违规):① Q1 `agents/` 恢复 Copilot 默认分发(`index.js` SOURCES 重新包含 `agents`,Claude Code 端保持 Skill 路由);② Q2 单源规范——删除 `copilot-instructions.md`,新增 `instructions.md` 作为唯一规范源;`cmdInit`/`cmdInitClaude` 均以 `instructions.md` 为源、按平台 rename 到 `.github/copilot-instructions.md` 或 `CLAUDE.md`(**Breaking**:删除文件 + 双平台单源);③ Q3 项目未识别硬阻断——`01-common` + `load-profile` + `17-compliance` PC0 + `18-spec-radar` Axis A/G11 同步「必须先询问用户、禁止猜测、禁止超范围扫描」;`lifecycle.cjs` UserPromptSubmit 新增多项目工作区检测(≥2 含 `package.json`/`.devcodex/profile` 的同级子目录 + 无 workspace 根 profile → 阻断),豁免词 `workspace/monorepo/全工作区/all projects/所有项目`;④ `scripts/validate.js` 新增 V12(源仓库不得含 `copilot-instructions.md`) | [查看](./changelogs/v1.9.8.md) |

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ DevCodex 通过 GitHub Copilot Agent Plugin API 向 Copilot 注入结构化的
1313
## 功能特性
1414

1515
- **8 种工作流**: `dev` / `fix` / `audit` / `analyze` / `self-fix` / `resume` / `plan` / `chat`
16-
- **2 种模式**: 确认模式(@DevCodex)/ 全自动模式(@DevCodex Auto)
16+
- **2 种模式**: 确认模式(@DevCodex)/ 全自动模式(@DevCodex Auto,Auto v1.1 仅对显式 `@devcodex-auto` + 白名单路径提供硬保证)
1717
- **合规管线**: FC(形式合规)→ SC(实质合规)→ RC(恢复性检查)→ T(任务完成验证)
1818
- **持久记忆**: 每 Agent、每日的会话记录,结构化字段
1919
- **自动报告**: 每次会话自动写入报告,从不询问 — 直接执行
@@ -241,6 +241,8 @@ DevCodex 的 `plugin.json` 声明 `tier: "free"`,所有 Skill 均标注 `tier:
241241
- **推荐**:通过 `copilot-instructions.md` + `instructions/` 自动注入,直接在 Copilot Chat 对话即可
242242
- **可选**:通过 `.github/agents/` 使用 `@devcodex` / `@devcodex-auto` 自定义 Agent 入口
243243

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

246248
AGPL-3.0-or-later © Rocky / [vextjs](https://github.com/vextjs)

‎RULES.md‎

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

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

‎agents/devcodex-auto.agent.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: DevCodex Auto
3-
description: AI 开发规范助手(全自动模式)— CP 门控自动通过,安全底线仍强制执行。所有规则由 instructions/ 自动注入。
3+
description: AI 开发规范助手(全自动模式 v1.1)— 仅在显式 @devcodex-auto + 白名单路径下自动推进,安全底线仍强制执行。所有规则由 instructions/ 自动注入。
44
tools:
55
- edit
66
- execute
@@ -12,8 +12,12 @@ disable-model-invocation: true
1212

1313
## 全自动模式
1414

15-
与 `DevCodex` 行为完全一致,唯一差异:**CP1/CP2/CP3 确认自动通过**。
15+
`DevCodex Auto` 不是“所有任务都自动推进”,而是 **Auto v1.1 最小闭环**:
1616

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

‎changelogs/v1.9.11.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# v1.9.11 — Auto v1.1 runtime 收口 + 白名单门禁落地
2+
3+
> **发布日期**: 2026-05-21
4+
> **类型**: PATCH
5+
> **关联报告**: `.devcodex/bugs/devcodex-auto模式智能性不足/reports/claude-code/20260521/01--auto实施与验证.md`
6+
7+
---
8+
9+
## Fixed
10+
11+
- 将 Auto v1.1 的正式入口收敛为显式 `@devcodex-auto`,不再把 `auto:` / `/auto` / profile `executionMode` 误写成当前已生效能力。
12+
- 在 `hooks/_runtime/lifecycle.cjs` 中新增 `executionMode` 状态与 Auto 白名单门禁:仅对白名单路径自动推进,非白名单默认回确认模式,危险命令仍保持阻断。
13+
- 补齐 `scripts/test-hooks-runtime.js` 的 auto 专属回归用例,覆盖 executionMode 写入、白名单放行、非白名单阻断与危险命令阻断。
14+
- 扩展 `scripts/validate.js` V14,校验 agent / instructions / skills / runtime / test / README 的 auto 语义联动。
15+
- 同步 README 与父级 `.github/.claude` 部署副本,消除“源码已改、部署滞后”的 V8 噪音。
16+
17+
## Validation
18+
19+
- `npm run test:all`
20+
- `node scripts/validate.js`
21+
- `npm view @vextjs/devcodex version --registry https://npm.pkg.github.com`(发布前确认当前 registry 为 `1.9.10`,需要 bump 后才能 publish)
22+
23+
## Impact
24+
25+
- Auto 模式从“仅 CP 自动通过”提升为可执行的最小 runtime 闭环,但边界仍保持在 hook-enforced + 白名单路径,避免过度承诺。
26+
- 非 auto 模式继续走原 confirm 路径;完整回归已覆盖 validate、hooks runtime 与 pack-clean。
27+
- 后续如果要推进 Auto v1.2/v2,可在现有 executionMode 与 V14 基础上继续扩展,不需要重做本轮收口。
28+
29+
## Breaking Changes
30+
31+
无。

‎hooks/_runtime/lifecycle.cjs‎

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ 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 EXECUTION_MODE = { CONFIRM: 'confirm', AUTO: 'auto' }
31+
const AUTO_ALLOWED_PATH_PATTERNS = [
32+
/^\.devcodex\//,
33+
/^agents\/devcodex-auto\.agent\.md$/i,
34+
/^instructions\/01-common\.instructions\.md$/i,
35+
/^skills\/cp-gate\/SKILL\.md$/i,
36+
/^skills\/compliance\/SKILL\.md$/i,
37+
/^hooks\/_runtime\/lifecycle\.cjs$/i,
38+
/^scripts\/test-hooks-runtime\.js$/i,
39+
/^scripts\/validate\.js$/i,
40+
/^README\.md$/i,
41+
/^\.(?:claude|github)\/(?:instructions|skills|hooks|agents|prompts|data|settings\.json|settings\.local\.json)(?:\/|$)/i
42+
]
3043

3144
// ─── Multi-project workspace guard (v1.9.8+) ─────────────────────────────────────
3245
const MULTI_PROJECT_EXEMPTION_KEYWORDS = [
@@ -175,6 +188,11 @@ function detectProjectFromPrompt(prompt) {
175188
return ''
176189
}
177190

191+
function detectExecutionMode(payload) {
192+
const prompt = extractUserPrompt(payload)
193+
return /@devcodex-auto\b/i.test(prompt) ? EXECUTION_MODE.AUTO : EXECUTION_MODE.CONFIRM
194+
}
195+
178196
function buildMultiProjectBlockMessage() {
179197
return [
180198
'⚠️ Multi-project workspace detected.',
@@ -264,6 +282,7 @@ function buildDefaultState(mode) {
264282
const m = mode === 'dev' ? 'dev' : 'prod'
265283
return {
266284
version: 1, mode: m,
285+
executionMode: EXECUTION_MODE.CONFIRM,
267286
phase: m === 'dev' ? 'bootstrapping' : 'active',
268287
startedAt: new Date().toISOString(), updatedAt: new Date().toISOString(),
269288
promptCount: 0, toolUseCount: 0,
@@ -419,6 +438,13 @@ function extractToolPaths(payload) {
419438
if (!payload) return []
420439
const input = payload.tool_input || payload.toolInput || {}
421440
const out = []
441+
if (typeof input.input === 'string' && input.input) {
442+
const patchPathRe = /^\*\*\* (?:Update|Add|Delete) File:\s+(.+)$/gm
443+
let m
444+
while ((m = patchPathRe.exec(input.input)) !== null) {
445+
if (m[1]) out.push(m[1].trim())
446+
}
447+
}
422448
if (typeof input.file_path === 'string' && input.file_path) out.push(input.file_path)
423449
if (typeof input.filePath === 'string' && input.filePath) out.push(input.filePath)
424450
if (typeof input.path === 'string' && input.path && /[/\\]/.test(input.path)) out.push(input.path)
@@ -459,6 +485,39 @@ function getRequirementNameFromPath(p) {
459485
return parts.length > 0 ? parts[0] : null
460486
}
461487

488+
function toWorkspaceRelativePath(p) {
489+
if (!p) return ''
490+
let abs = p
491+
try { abs = path.isAbsolute(abs) ? abs : path.resolve(WORKSPACE_ROOT, abs) } catch { }
492+
let rel = abs
493+
try { rel = path.isAbsolute(abs) ? path.relative(WORKSPACE_ROOT, abs) : abs } catch { }
494+
return String(rel || '').replace(/\\/g, '/').replace(/^\.\//, '').trim()
495+
}
496+
497+
function isAutoAllowedPath(p) {
498+
const rel = toWorkspaceRelativePath(p)
499+
return AUTO_ALLOWED_PATH_PATTERNS.some(re => re.test(rel))
500+
}
501+
502+
function checkAutoWhitelist(payload, platform, state) {
503+
if (state.executionMode !== EXECUTION_MODE.AUTO) return null
504+
if (!isSourceCodeMutation(payload, platform)) return null
505+
const paths = [...new Set(extractToolPaths(payload))]
506+
if (!paths.length) {
507+
return {
508+
allowed: false,
509+
reason: 'Auto v1.1 无法识别当前变更目标路径,不能安全判定是否属于白名单。'
510+
}
511+
}
512+
const nonWhitelisted = paths.filter(p => !isAutoAllowedPath(p))
513+
if (!nonWhitelisted.length) return { allowed: true }
514+
const preview = nonWhitelisted.map(toWorkspaceRelativePath).slice(0, 3).join(', ')
515+
return {
516+
allowed: false,
517+
reason: `Auto v1.1 仅对白名单路径自动推进,以下目标不在白名单内:${preview}`
518+
}
519+
}
520+
462521
// Path-aware CP gate: when all tool paths belong to specific requirement dirs,
463522
// only check those requirements' CP status (avoids cross-requirement deny).
464523
// Falls back to global findIncompleteRequirement() for mixed/source-code paths.
@@ -640,7 +699,7 @@ function captureFinalPayloadSample(payload, eventName, state) {
640699
payloadKeys: Object.keys(payload).sort(),
641700
visiblePayloadDetected: hasVisibleReplyPayload(payload),
642701
interestingStrings: collectInterestingStrings(payload),
643-
state: { mode: state.mode, phase: state.phase, mutated: state.mutated }
702+
state: { mode: state.mode, executionMode: state.executionMode, phase: state.phase, mutated: state.mutated }
644703
}
645704
fs.appendFileSync(FINAL_PAYLOAD_LOG, `${JSON.stringify(snap)}\n`)
646705
if (eventName === 'Stop') fs.unlinkSync(FINAL_PAYLOAD_FLAG)
@@ -683,6 +742,7 @@ async function main() {
683742
const prompt = extractUserPrompt(payload)
684743
const explicitProject = detectProjectFromPrompt(prompt)
685744
state = resetState(mode, state)
745+
state.executionMode = detectExecutionMode(payload)
686746
if (hasMultiProjectExemption(prompt)) {
687747
state.activeProject = ''
688748
} else if (explicitProject) {
@@ -741,6 +801,25 @@ async function main() {
741801
updateBootstrapState(state, payload)
742802
}
743803

804+
// 2.5. Auto v1.1 whitelist gate — only whitelisted governance/test/docs paths can bypass CP gate
805+
const autoWhitelist = checkAutoWhitelist(payload, platform, state)
806+
if (autoWhitelist && autoWhitelist.allowed) {
807+
state.lastReason = 'auto-whitelist-bypass'
808+
updateArtifactTouches(state, payload, platform)
809+
saveState(state)
810+
writeStdout(noopOutput())
811+
return
812+
}
813+
if (autoWhitelist && !autoWhitelist.allowed) {
814+
state.lastReason = 'auto-non-whitelist-block'
815+
saveState(state)
816+
writeStdout(blockOutput(
817+
platform, eventName, 'auto-whitelist-boundary',
818+
`${autoWhitelist.reason} — 请切回确认模式,或先把变更范围收敛到白名单路径。`
819+
))
820+
return
821+
}
822+
744823
// 3. CP gate — block source code mutations until checkpoints confirmed
745824
// payload-aware: when tool paths target specific requirement dirs, only that requirement's CP is checked
746825
const gate = checkCpGate(payload)

‎instructions/01-common.instructions.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ applyTo: "**"
6767

6868
当用户选择 `@devcodex-auto`(全自动模式)时:
6969

70-
- CP1 / CP2 / CP3 确认**自动通过**(不等待用户确认)
70+
- Auto v1.1 **唯一正式入口**为显式 `@devcodex-auto`;`auto:` / `/auto` / profile `executionMode` 延后到后续版本
71+
- 仅在 `hook-enforced` 宿主中,对治理文件 / `.devcodex/` 产物 / README / auto 专属回归脚本等**白名单路径**启用自动推进
72+
- 非白名单路径默认切回确认模式,不承诺“所有源码任务自动执行”
73+
- `instruction-fallback` 宿主只保留 auto 规则语义,不承诺 runtime 级硬放行
74+
- CP1 / CP2 / CP3 确认**自动通过**(不等待用户确认),但该自动通过只对上述白名单路径形成 runtime 放行效果
7175
- 以下约束**不可豁免**:S01(不可逆确认)/ S02~S07 / C01 / C10 / C18
7276
- 可恢复失败:重试 ≤ 2 次;不可恢复失败:切换回确认模式并通知用户 ⚠️
7377

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vextjs/devcodex",
3-
"version": "1.9.10",
3+
"version": "1.9.11",
44
"description": "DevCodex — AI-powered development workflow rules as a GitHub Copilot Agent Plugin",
55
"main": "index.js",
66
"bin": {

‎plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"_format": "DevCodex internal metadata — NOT a GitHub Copilot official format. Copilot reads .github/agents|skills|instructions|prompts directly.",
33
"_note_skills": "Adding a new sub-type Skill (e.g. dev-<name> / fix-<name>) requires L1~L3 sync per audit-dimensions D5: (L1) routing/SKILL.md 路由表 (L2) 02-output-paths.instructions.md 产物目录 (L3) 对应 report 模板子类型字段. Skill name field must match directory name. See audit-dimensions D5 关键检查 for full rules.",
44
"id": "devcodex",
5-
"version": "1.9.10",
5+
"version": "1.9.11",
66
"name": "DevCodex",
77
"publisher": "Rocky",
88
"displayName": "DevCodex — AI Development Workflow Assistant",

‎scripts/test-hooks-runtime.js‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,71 @@ function main() {
142142
assert.strictEqual(captureEntries[1].eventName, 'Stop')
143143
assert.strictEqual(fs.existsSync(CAPTURE_FLAG), false)
144144

145+
// Auto v1.1: explicit @devcodex-auto should write executionMode=auto and only allow whitelisted paths.
146+
cleanState()
147+
const autoReq = path.join(TEMP_ROOT, '.devcodex', 'requirements', '自动模式需求')
148+
fs.mkdirSync(path.join(autoReq, '.memory'), { recursive: true })
149+
fs.writeFileSync(path.join(autoReq, '01-需求概述.md'), '# auto req\n')
150+
fs.writeFileSync(path.join(autoReq, '.memory', 'sessions.md'), '| CP1 | ✅ |\n')
151+
152+
run({ hookEventName: 'UserPromptSubmit', prompt: '@devcodex-auto 修复 auto runtime 行为' })
153+
run({ hookEventName: 'PreToolUse', tool_name: 'read_file', tool_input: { filePath: '.devcodex/profile/config.json' } })
154+
run({ hookEventName: 'PreToolUse', tool_name: 'read_file', tool_input: { filePath: '.devcodex/.memory/clients/copilot/SUMMARY.md' } })
155+
run({ hookEventName: 'PreToolUse', tool_name: 'read_file', tool_input: { filePath: '.devcodex/.memory/clients/copilot/tasks/20260510.md' } })
156+
const autoState = JSON.parse(fs.readFileSync(STATE_FILE, 'utf8'))
157+
assert.strictEqual(autoState.executionMode, 'auto')
158+
159+
const autoWhitelistAllowed = run({
160+
hookEventName: 'PreToolUse',
161+
tool_name: 'apply_patch',
162+
tool_input: {
163+
input: '*** Begin Patch\n*** Update File: README.md\n*** End Patch'
164+
}
165+
})
166+
assert.strictEqual(autoWhitelistAllowed.continue, true)
167+
assert.ok(!autoWhitelistAllowed.hookSpecificOutput)
168+
169+
const autoNonWhitelistBlocked = run({
170+
hookEventName: 'PreToolUse',
171+
tool_name: 'apply_patch',
172+
tool_input: {
173+
input: '*** Begin Patch\n*** Update File: src/foo.js\n*** End Patch'
174+
}
175+
})
176+
assert.strictEqual(autoNonWhitelistBlocked.hookSpecificOutput.permissionDecision, 'deny')
177+
assert.match(autoNonWhitelistBlocked.hookSpecificOutput.additionalContext || '', /白名单|whitelist/i)
178+
179+
const autoDangerousCommand = run({
180+
hookEventName: 'PreToolUse',
181+
tool_name: 'run_in_terminal',
182+
tool_input: {
183+
command: 'git reset --hard HEAD~1'
184+
}
185+
})
186+
assert.strictEqual(autoDangerousCommand.hookSpecificOutput.permissionDecision, 'deny')
187+
assert.match(autoDangerousCommand.hookSpecificOutput.permissionDecisionReason || '', /git reset --hard/i)
188+
189+
cleanState()
190+
run({
191+
hookEventName: 'UserPromptSubmit',
192+
prompt: 'Need a root cure for dev mode drift.'
193+
})
194+
run({
195+
hookEventName: 'PreToolUse',
196+
tool_name: 'read_file',
197+
tool_input: { filePath: '.devcodex/profile/config.json' }
198+
})
199+
run({
200+
hookEventName: 'PreToolUse',
201+
tool_name: 'read_file',
202+
tool_input: { filePath: '.devcodex/.memory/clients/copilot/SUMMARY.md' }
203+
})
204+
run({
205+
hookEventName: 'PreToolUse',
206+
tool_name: 'read_file',
207+
tool_input: { filePath: '.devcodex/.memory/clients/copilot/tasks/20260510.md' }
208+
})
209+
145210
// Archive marker bypass test: an unfinished requirement with .archived must NOT block
146211
const reqDir = path.join(TEMP_ROOT, '.devcodex', 'requirements', '历史归档需求')
147212
fs.mkdirSync(path.join(reqDir, '.memory'), { recursive: true })

0 commit comments

Comments
 (0)