Skip to content

Commit c47814d

Browse files
committed
fix: tighten release gate and runtime bootstrap
1 parent 94347cb commit c47814d

13 files changed

Lines changed: 254 additions & 13 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ export NODE_AUTH_TOKEN=YOUR_GITHUB_PAT
6767

6868
这里的环境变量仅用于 GitHub Packages 认证密钥,不代表项目里的普通配置默认都应 env 化;非敏感、本地、测试或一次性脚本配置优先保持最简单、可直接读懂的写法。
6969

70+
> 当前安装包通过 **GitHub Packages** 分发;在执行 `npm install @vextjs/devcodex` 之前,必须先完成上述 registry 与 `NODE_AUTH_TOKEN` 认证配置。
71+
7072
### 2. 安装并初始化
7173

7274
```bash
@@ -360,7 +362,7 @@ DevCodex Hook runtime 不再把所有拦截都等同为“停止”。拦截会
360362

361363
DevCodex 的 `plugin.json` 声明 `tier: "free"`,所有 Skill 均标注 `tier: "free"`。这些 tier 字段是**面向未来的 prompt-level 声明**(供 `token-check` Skill 在 Agent 侧做软门控),**CLI 不做任何授权校验**:
362364

363-
- `npm install @vextjs/devcodex` 与 `devcodex init/update/status` 对所有用户完全开放
365+
- CLI 本身不做额外 license/tier 授权校验;但当前安装包通过 GitHub Packages 分发,读取包仍需要有效的 registry/认证配置
364366
- 未来接入服务端 token 校验时,tier 字段才会生效
365367
- 当前阶段 tier 仅作为规划信息,不影响功能使用
366368

‎changelogs/unreleased.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@
1212
- 宿主输出、Hook 或项目现实扩展相关条目,建议显式写出 `verified-present / verified-missing / unverified`、sticky `activeProject` 与用户可见 `意图扩展摘要` 是否发生变化。
1313
- 执行闭环、确认机制或发布门禁相关条目,建议补充 `Intent Expansion Card`、`ConfirmationRequest`、`ECR` 与验证证据,方便正式发版时直接归档到版本 changelog。
1414

15-
已归档到 `v1.11.5`;等待后续新增未发布条目。
15+
## 2026-05-31
16+
17+
- 收口发布门禁与 package completeness:`package.json` 新增 `prepublishOnly -> npm run test:all:with-audit`,新增 `scripts/test-release-metadata.js`,`release-verification` / `test-router` / release guide / README / `V42` 同步,关闭 `PF-010`,并将 `PF-012` 收口为“阻断级 gate 已完成、完整 release pre-review 留待后续”。
18+
- 收口 active-root `data` bootstrap 首轮:`ensureRuntimeDirs` 自动补齐运行时 `data/*.md` 模板,`scripts/test-cli-behavior.js` 新增 default init 与 `init --codex + workspace-namespace` 回放,`data/README.md` 同步 active-root 与部署副本边界,推动 `PF-011` 进入部分完成。

‎data/README.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,17 @@ data/
2929

3030
## init 行为
3131

32-
`devcodex init` / `devcodex init --claude` 将 `data/templates/*.md` 复制到目标项目的运行时数据目录:
32+
`devcodex init`、`devcodex init --claude` 与 `devcodex init --codex` 都必须先在目标项目的 **active-root** bootstrap 运行时台账模板:
33+
34+
- 旧布局:`<项目根>/.devcodex/data/*.md`
35+
- workspace-namespace 单项目:`<工作区根>/.devcodex/<project>/data/*.md`
36+
- workspace-namespace 全工作区:`<工作区根>/.devcodex/workspace/data/*.md`
37+
38+
同时,默认 `init` / `init --claude` 仍会把模板副本分发到宿主部署目录,作为随 adapter 下发的辅助副本:
3339

3440
- Copilot:`.github/data/*.md`
3541
- Claude Code:`.claude/data/*.md`
42+
- Codex:不分发 `.codex/data/`,运行时只认 active-root `data/*.md`
3643
- 规范正文中写 `data/*.md` 时,表示目标项目运行时台账的逻辑路径,不表示源仓根 `data/` 保存真实记录。
3744

3845
## 路径语义

‎index.js‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,35 @@ function resolveGitignoreRoot(cwd) {
115115
return layout.enabled ? layout.workspaceRoot : cwd
116116
}
117117

118+
function ensureRuntimeDataTemplates(runtimeRoot, dryRun) {
119+
const templatesDir = path.join(PKG_ROOT, 'data', 'templates')
120+
if (!fs.existsSync(templatesDir)) return 0
121+
122+
const dataDir = path.join(runtimeRoot, 'data')
123+
const templateFiles = walkDir(templatesDir).filter(file => path.extname(file).toLowerCase() === '.md')
124+
let created = 0
125+
126+
if (!dryRun) fs.mkdirSync(dataDir, { recursive: true })
127+
for (const templateFile of templateFiles) {
128+
const relative = path.relative(templatesDir, templateFile)
129+
const destFile = path.join(dataDir, relative)
130+
if (fs.existsSync(destFile)) continue
131+
if (!dryRun) {
132+
fs.mkdirSync(path.dirname(destFile), { recursive: true })
133+
fs.copyFileSync(templateFile, destFile)
134+
}
135+
created++
136+
}
137+
138+
return created
139+
}
140+
118141
function ensureRuntimeDirs(cwd, dryRun) {
119142
if (dryRun) return resolveActiveRuntimeRoot(cwd)
120143
const runtimeRoot = resolveActiveRuntimeRoot(cwd)
121144
fs.mkdirSync(path.join(runtimeRoot, '.memory'), { recursive: true })
122145
fs.mkdirSync(path.join(runtimeRoot, '.audit-state'), { recursive: true })
146+
ensureRuntimeDataTemplates(runtimeRoot, dryRun)
123147
return runtimeRoot
124148
}
125149

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
"devcodex": "index.js"
88
},
99
"scripts": {
10-
"test": "node scripts/validate-versions.js && node scripts/validate.js",
11-
"test:all": "npm test && node scripts/test-spec-governance.js && node scripts/test-governance-intake.js && node scripts/test-validate-profile.js && node scripts/test-readme-governance.js && node scripts/test-requirement-artifacts.js && node scripts/test-hooks-runtime.js && node scripts/test-instruction-fallback-check.js && node scripts/test-mcp-servers.js && node scripts/test-migrate-layout.js && node scripts/test-cli-behavior.js && node scripts/test-pack-clean.js && npm --prefix website run build && node scripts/check-syntax.js",
10+
"test": "npm run test:core && node scripts/test-spec-governance.js && node scripts/test-governance-intake.js && node scripts/test-validate-profile.js && node scripts/test-readme-governance.js && node scripts/test-requirement-artifacts.js && node scripts/test-hooks-runtime.js && node scripts/test-instruction-fallback-check.js && node scripts/test-mcp-servers.js && node scripts/test-migrate-layout.js && node scripts/test-cli-behavior.js && node scripts/test-release-metadata.js && node scripts/test-pack-clean.js && npm --prefix website run build && node scripts/check-syntax.js",
11+
"test:all": "npm test",
12+
"test:core": "node scripts/validate-versions.js && node scripts/validate.js",
1213
"test:all:with-audit": "npm run test:all && npm run test:audit",
1314
"test:audit": "npm audit --omit=dev && npm --prefix website audit --omit=dev",
1415
"test:cli-behavior": "node scripts/test-cli-behavior.js",
@@ -20,9 +21,11 @@
2021
"test:profile-governance": "node scripts/test-validate-profile.js",
2122
"test:readme-governance": "node scripts/test-readme-governance.js",
2223
"test:requirement-artifacts": "node scripts/test-requirement-artifacts.js",
24+
"test:release-metadata": "node scripts/test-release-metadata.js",
2325
"test:governance-intake": "node scripts/test-governance-intake.js",
2426
"test:spec-governance": "node scripts/test-spec-governance.js",
25-
"validate": "node scripts/validate.js"
27+
"validate": "node scripts/validate.js",
28+
"prepublishOnly": "npm run test:all:with-audit"
2629
},
2730
"keywords": [
2831
"copilot",

‎scripts/test-cli-behavior.js‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ function buildClaudeProject(root) {
105105
})
106106
}
107107

108+
function assertRuntimeDataBootstrap(runtimeRoot) {
109+
for (const name of ['violations.md', 'pending-fixes.md', 'pending-issues.md', 'process-improvements.md', 'gap-registry.md']) {
110+
assert.ok(fs.existsSync(path.join(runtimeRoot, 'data', name)), `missing runtime data file: ${name}`)
111+
}
112+
}
113+
108114
function assertClaudeMergeState(root, { claudeMdManaged }) {
109115
const settings = readJson(root, '.claude/settings.json')
110116
const mcp = readJson(root, '.mcp.json')
@@ -190,6 +196,27 @@ function testDoctorAvoidsCodexBiasInMixedHostRepo() {
190196
fs.rmSync(root, { recursive: true, force: true })
191197
}
192198

199+
function testDefaultInitBootstrapsActiveRootData() {
200+
const root = createTempRoot('devcodex-cli-runtime-data-')
201+
writeFile(root, 'package.json', '{ "name": "tmp-runtime-data" }\n')
202+
203+
runCli(['init'], root)
204+
205+
assertRuntimeDataBootstrap(path.join(root, '.devcodex'))
206+
fs.rmSync(root, { recursive: true, force: true })
207+
}
208+
209+
function testCodexInitBootstrapsWorkspaceNamespaceData() {
210+
const root = createTempRoot('devcodex-cli-codex-data-')
211+
writeJson(root, '.devcodex/layout.json', { version: 1, mode: 'workspace-namespace' })
212+
writeFile(root, 'packages/app-a/package.json', '{ "name": "app-a" }\n')
213+
214+
runCli(['init', '--codex'], path.join(root, 'packages', 'app-a'))
215+
216+
assertRuntimeDataBootstrap(path.join(root, '.devcodex', 'packages', 'app-a'))
217+
fs.rmSync(root, { recursive: true, force: true })
218+
}
219+
193220
function testProfileInitUsesNestedNamespaceRoot() {
194221
const root = createTempRoot('devcodex-cli-profile-')
195222
writeJson(root, '.devcodex/layout.json', { version: 1, mode: 'workspace-namespace' })
@@ -210,6 +237,8 @@ function main() {
210237
testClaudeInitPreservesCustomConfig()
211238
testClaudeUpdateBacksUpAndPreservesCustomConfig()
212239
testDoctorAvoidsCodexBiasInMixedHostRepo()
240+
testDefaultInitBootstrapsActiveRootData()
241+
testCodexInitBootstrapsWorkspaceNamespaceData()
213242
testProfileInitUsesNestedNamespaceRoot()
214243
process.stdout.write('cli behavior test passed\n')
215244
}

‎scripts/test-pack-clean.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const forbidden = [
1313
/data\/violations\.md/,
1414
/data\/pending-fixes\.md/,
1515
/data\/process-improvements\.md/,
16+
/data\/pending-issues\.md/,
1617
/data\/gap-registry\.md/,
1718
/schema-dsl/i,
1819
/vext-test/i,

‎scripts/test-readme-governance.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,13 @@ const pkg = JSON.parse(read('package.json'))
8585
if (pkg.scripts['test:readme-governance'] !== 'node scripts/test-readme-governance.js') {
8686
failures.push('package.json missing test:readme-governance script')
8787
}
88-
if (!pkg.scripts['test:all'] || !pkg.scripts['test:all'].includes('node scripts/test-readme-governance.js')) {
89-
failures.push('package.json test:all missing readme governance targeted test')
88+
const testAllScript = pkg.scripts['test:all'] || ''
89+
const testScript = pkg.scripts.test || ''
90+
const readmeGovernanceCovered =
91+
testAllScript.includes('node scripts/test-readme-governance.js') ||
92+
(testAllScript.trim() === 'npm test' && testScript.includes('node scripts/test-readme-governance.js'))
93+
if (!readmeGovernanceCovered) {
94+
failures.push('package.json test/test:all missing readme governance targeted test')
9095
}
9196

9297
if (failures.length) {

‎scripts/test-release-metadata.js‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env node
2+
'use strict'
3+
4+
const fs = require('fs')
5+
const path = require('path')
6+
7+
const ROOT = path.resolve(__dirname, '..')
8+
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'))
9+
const plugin = JSON.parse(fs.readFileSync(path.join(ROOT, 'plugin.json'), 'utf8'))
10+
const readme = fs.readFileSync(path.join(ROOT, 'README.md'), 'utf8')
11+
12+
const errors = []
13+
14+
function expect(condition, message) {
15+
if (!condition) errors.push(message)
16+
}
17+
18+
function nonEmptyString(value) {
19+
return typeof value === 'string' && value.trim().length > 0
20+
}
21+
22+
function readUrl(field) {
23+
if (typeof field === 'string') return field
24+
if (field && typeof field === 'object' && typeof field.url === 'string') return field.url
25+
return ''
26+
}
27+
28+
const keywords = Array.isArray(pkg.keywords)
29+
? pkg.keywords.filter(item => nonEmptyString(item))
30+
: []
31+
const files = Array.isArray(pkg.files)
32+
? pkg.files.filter(item => nonEmptyString(item))
33+
: []
34+
const pluginKeywords = Array.isArray(plugin.keywords)
35+
? plugin.keywords.filter(item => nonEmptyString(item))
36+
: []
37+
const pluginCategories = Array.isArray(plugin.categories)
38+
? plugin.categories.filter(item => nonEmptyString(item))
39+
: []
40+
41+
expect(nonEmptyString(pkg.name), 'package.json name 不能为空')
42+
expect(nonEmptyString(pkg.version), 'package.json version 不能为空')
43+
expect(nonEmptyString(pkg.description), 'package.json description 不能为空')
44+
expect(keywords.length >= 3, 'package.json keywords 至少需要 3 个非空条目')
45+
expect(nonEmptyString(pkg.license), 'package.json license 不能为空')
46+
expect(nonEmptyString(readUrl(pkg.repository)), 'package.json repository.url 不能为空')
47+
expect(nonEmptyString(readUrl(pkg.bugs)), 'package.json bugs.url 不能为空')
48+
expect(nonEmptyString(pkg.homepage), 'package.json homepage 不能为空')
49+
expect(nonEmptyString(pkg.engines && pkg.engines.node), 'package.json engines.node 不能为空')
50+
expect(nonEmptyString(pkg.publishConfig && pkg.publishConfig.registry), 'package.json publishConfig.registry 不能为空')
51+
expect(nonEmptyString(pkg.publishConfig && pkg.publishConfig.access), 'package.json publishConfig.access 不能为空')
52+
expect(files.length > 0, 'package.json files 不能为空')
53+
expect(
54+
nonEmptyString(pkg.main) ||
55+
(pkg.exports && Object.keys(pkg.exports).length > 0) ||
56+
(pkg.bin && Object.keys(pkg.bin).length > 0),
57+
'package.json 至少需要 main / exports / bin 之一'
58+
)
59+
60+
expect(nonEmptyString(plugin.version), 'plugin.json version 不能为空')
61+
expect(plugin.version === pkg.version, 'plugin.json version 必须与 package.json version 一致')
62+
expect(nonEmptyString(plugin.description), 'plugin.json description 不能为空')
63+
expect(nonEmptyString(plugin.repository), 'plugin.json repository 不能为空')
64+
expect(nonEmptyString(plugin.homepage), 'plugin.json homepage 不能为空')
65+
expect(nonEmptyString(plugin.license), 'plugin.json license 不能为空')
66+
expect(pluginKeywords.length >= 3, 'plugin.json keywords 至少需要 3 个非空条目')
67+
expect(pluginCategories.length > 0, 'plugin.json categories 不能为空')
68+
69+
if ((pkg.publishConfig.registry || '').includes('npm.pkg.github.com') || pkg.publishConfig.access === 'restricted') {
70+
for (const needle of ['GitHub Packages', 'npm.pkg.github.com', 'NODE_AUTH_TOKEN']) {
71+
expect(readme.includes(needle), `README 必须显式说明 GitHub Packages 安装边界:${needle}`)
72+
}
73+
}
74+
75+
if (errors.length) {
76+
console.error('\x1b[31m✗ Release metadata checks failed:\x1b[0m')
77+
for (const message of errors) {
78+
console.error(` - ${message}`)
79+
}
80+
process.exit(1)
81+
}
82+
83+
console.log('\x1b[32m✓ Release metadata checks passed\x1b[0m')

‎scripts/validate.js‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* V39 Governance improvement intake sync(全模式主动优化清单、统一回执、PI/PF 联动与强制探针)
3838
* V40 Profile local config sync(config.local schema、env 引用、受控扩展位与本地 overlay 消费链)
3939
* V41 Requirement runtime artifact structure sync(recent requirements 的 01/04/05 运行时结构探针)
40+
* V42 Release gate + package completeness sync(test:audit、metadata gate、prepublishOnly、pack forbidden 与 GitHub Packages 文档边界)
4041
*
4142
* Exit: 0=OK, 1=error, 2=warnings only
4243
*/
@@ -287,6 +288,7 @@ function checkV6() {
287288
/violations\.md$/i.test(f) ||
288289
/pending-fixes\.md$/i.test(f) ||
289290
/process-improvements\.md$/i.test(f) ||
291+
/pending-issues\.md$/i.test(f) ||
290292
/gap-registry\.md$/i.test(f)) &&
291293
!f.startsWith('data/templates/')
292294
)
@@ -2362,6 +2364,77 @@ function checkV41() {
23622364
console.log(`[V41] requirement runtime artifact structure checked: ${checkedDirs.length} dirs`)
23632365
}
23642366

2367+
function checkV42() {
2368+
const pkg = JSON.parse(read(path.join(ROOT, 'package.json')))
2369+
const scripts = pkg.scripts || {}
2370+
const releaseSkill = read(path.join(ROOT, 'skills', 'release-verification', 'SKILL.md'))
2371+
const releaseGuide = read(path.join(ROOT, 'website', 'docs', 'guide', 'release.md'))
2372+
const readme = read(path.join(ROOT, 'README.md'))
2373+
const testRouter = read(path.join(ROOT, 'skills', 'test-router', 'SKILL.md'))
2374+
2375+
const scriptExpectations = [
2376+
['test', 'npm run test:core'],
2377+
['test', 'node scripts/test-release-metadata.js'],
2378+
['test:all', 'npm test'],
2379+
['test:all:with-audit', 'npm run test:audit'],
2380+
['test:release-metadata', 'node scripts/test-release-metadata.js'],
2381+
['prepublishOnly', 'npm run test:all:with-audit']
2382+
]
2383+
for (const [scriptName, needle] of scriptExpectations) {
2384+
const value = scripts[scriptName] || ''
2385+
if (!value.includes(needle)) {
2386+
err(`[V42] package.json script ${scriptName} missing "${needle}"`)
2387+
}
2388+
}
2389+
2390+
for (const needle of [
2391+
'R3b',
2392+
'npm run test:audit',
2393+
'package completeness gate',
2394+
'keywords',
2395+
'publishConfig',
2396+
'prepublishOnly'
2397+
]) {
2398+
if (!releaseSkill.includes(needle)) {
2399+
err(`[V42] release-verification skill missing "${needle}"`)
2400+
}
2401+
}
2402+
2403+
for (const needle of [
2404+
'R3b',
2405+
'npm run test:audit',
2406+
'package completeness gate',
2407+
'keywords',
2408+
'publishConfig',
2409+
'GitHub Packages'
2410+
]) {
2411+
if (!releaseGuide.includes(needle)) {
2412+
err(`[V42] website release guide missing "${needle}"`)
2413+
}
2414+
}
2415+
2416+
for (const needle of [
2417+
'release-verification',
2418+
'npm run test:audit',
2419+
'package completeness gate',
2420+
'publish dry-run'
2421+
]) {
2422+
if (!testRouter.includes(needle)) {
2423+
err(`[V42] test-router missing "${needle}"`)
2424+
}
2425+
}
2426+
2427+
if ((pkg.publishConfig?.registry || '').includes('npm.pkg.github.com') || pkg.publishConfig?.access === 'restricted') {
2428+
for (const needle of ['GitHub Packages', 'npm.pkg.github.com', 'NODE_AUTH_TOKEN']) {
2429+
if (!readme.includes(needle)) {
2430+
err(`[V42] README missing GitHub Packages install boundary "${needle}"`)
2431+
}
2432+
}
2433+
}
2434+
2435+
console.log('[V42] release gate / package completeness sync checked')
2436+
}
2437+
23652438
function checkV29() {
23662439
const probes = [
23672440
{
@@ -2616,6 +2689,7 @@ checkV38()
26162689
checkV39()
26172690
checkV40()
26182691
checkV41()
2692+
checkV42()
26192693

26202694
console.log('')
26212695
if (errors.length) {

0 commit comments

Comments
 (0)