adspecs 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.adspecs/feature.json +16 -16
- package/.adspecs/feature.yml +28 -28
- package/.adspecs/paths.json +17 -17
- package/.adspecs/templates/04-/345/211/215/347/253/257/345/212/237/350/203/275/350/256/276/350/256/241/346/250/241/346/235/277.md +1 -1
- package/.adspecs/templates/05-/345/220/216/347/253/257/344/273/273/345/212/241/346/270/205/345/215/225/346/250/241/346/235/277.md +613 -724
- package/.adspecs/templates/05b-/345/211/215/347/253/257/344/273/273/345/212/241/346/270/205/345/215/225/346/250/241/346/235/277.md +51 -51
- package/.claude-plugin/marketplace.json +23 -23
- package/.claude-plugin/plugin.json +18 -18
- package/.qoder-plugin/plugin.json +31 -31
- package/CLAUDE.md +1 -5
- package/INSTALL.md +3 -3
- package/README.md +395 -395
- package/bin/adspecs.js +129 -129
- package/hooks/commit-queue.js +245 -245
- package/hooks/hooks.json +63 -63
- package/hooks/session-start.js +44 -44
- package/hooks/wiki-queue.js +127 -127
- package/package.json +61 -61
- package/references/ant6-front-standard/index.md +99 -99
- package/references/antd-front-demo/public/mockServiceWorker.js +361 -361
- package/references/ecp-end-standard/index.md +63 -63
- package/references/python-end-standard/01-Python/345/220/216/347/253/257/347/274/226/347/240/201/350/247/204/350/214/203.md +372 -372
- package/references/python-end-standard/02-/346/225/260/346/215/256/345/272/223/350/256/276/350/256/241/344/270/216/344/275/277/347/224/250/350/247/204/350/214/203.md +226 -226
- package/references/python-end-standard/03-Celery/345/274/202/346/255/245/344/273/273/345/212/241/350/247/204/350/214/203.md +237 -237
- package/references/python-end-standard/04-Redis/344/275/277/347/224/250/350/247/204/350/214/203.md +231 -231
- package/scripts/postinstall.js +107 -107
- package/scripts/sync-version.js +105 -105
- package/skills/.claude/.wiki-update-queue +26 -26
- package/skills/adspecs-constitution/SKILL.md +157 -0
- package/skills/adspecs-export-word/SKILL.md +498 -498
- package/skills/adspecs-export-word/references/md-to-docx.js +862 -862
- package/skills/adspecs-export-word/references/package-lock.json +220 -220
- package/skills/adspecs-export-word/references/package.json +10 -10
- package/skills/adspecs-front-prototype/SKILL.md +405 -405
- package/skills/adspecs-front-spec/SKILL.md +4 -4
- package/skills/adspecs-front-tasks/SKILL.md +213 -173
- package/skills/adspecs-plan/SKILL.md +59 -69
- package/skills/adspecs-prd/SKILL.md +13 -5
- package/skills/adspecs-prd-to-demo/SKILL.md +532 -0
- package/skills/adspecs-tasks/SKILL.md +175 -204
- package/skills/adspecs-update-status/SKILL.md +382 -382
- package/skills/adspecs-utest/SKILL.md +107 -116
- package/skills/grill-me/SKILL.md +7 -0
- package/skills/grill-me/agents/openai.yaml +5 -0
- package/skills/playwright-cli/SKILL.md +420 -0
- package/skills/playwright-cli/references/element-attributes.md +23 -0
- package/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +241 -0
- package/skills/playwright-cli/references/session-management.md +225 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +433 -0
- package/skills/playwright-cli/references/tracing.md +139 -0
- package/skills/playwright-cli/references/video-recording.md +143 -0
- package/skills/playwright-trace/SKILL.md +171 -0
- package/skills/project-init/SKILL.md +93 -22
- package/skills/project-init/references/front-demo/.claude/settings.local.json +9 -0
- package/skills/wiki-update/SKILL.md +232 -232
- package/src/commands/doctor.js +197 -197
- package/src/commands/init.js +83 -83
- package/src/commands/plugin.js +165 -165
- package/src/commands/update.js +87 -87
- package/src/lib/area-scanner.js +129 -129
- package/src/lib/copier.js +104 -104
- package/src/lib/dir-utils.js +161 -133
- package/src/lib/json-merge.js +114 -114
- package/src/lib/paths-defaults.js +37 -37
- package/src/lib/prompts.js +428 -347
- package/src/lib/readme-gen.js +143 -143
- package/src/lib/report.js +338 -327
- package/src/lib/scaffolder.js +551 -518
- package/src/lib/short-name.js +36 -36
- package/src/utils.js +80 -80
- package/references/antd-front-demo/.env +0 -15
package/scripts/sync-version.js
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 版本同步脚本
|
|
6
|
-
*
|
|
7
|
-
* 在 `npm version <type>` 时自动执行(通过 preversion 钩子)。
|
|
8
|
-
* 将 package.json 的新版本同步到三套插件清单文件:
|
|
9
|
-
* - .claude-plugin/plugin.json
|
|
10
|
-
* - .claude-plugin/marketplace.json
|
|
11
|
-
* - .qoder-plugin/plugin.json
|
|
12
|
-
*
|
|
13
|
-
* 也可手动运行:`npm run sync-version`
|
|
14
|
-
*
|
|
15
|
-
* 使用流程:
|
|
16
|
-
* npm version patch # 自动:升 package.json 版本 → 同步到其他清单 → git commit
|
|
17
|
-
* npm version minor
|
|
18
|
-
* npm version major
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const fs = require('fs');
|
|
22
|
-
const path = require('path');
|
|
23
|
-
|
|
24
|
-
const ROOT = path.resolve(__dirname, '..');
|
|
25
|
-
|
|
26
|
-
function readJson(relativePath) {
|
|
27
|
-
const fullPath = path.join(ROOT, relativePath);
|
|
28
|
-
if (!fs.existsSync(fullPath)) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
return JSON.parse(fs.readFileSync(fullPath, 'utf8'));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function writeJson(relativePath, data) {
|
|
35
|
-
const fullPath = path.join(ROOT, relativePath);
|
|
36
|
-
fs.writeFileSync(fullPath, JSON.stringify(data, null, 2) + '\n', 'utf8');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function main() {
|
|
40
|
-
const pkg = readJson('package.json');
|
|
41
|
-
if (!pkg) {
|
|
42
|
-
console.error('❌ 未找到 package.json');
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const newVersion = pkg.version;
|
|
47
|
-
console.log(`🔧 同步版本 ${newVersion} 到插件清单...`);
|
|
48
|
-
|
|
49
|
-
const updated = [];
|
|
50
|
-
|
|
51
|
-
// 1. .claude-plugin/plugin.json
|
|
52
|
-
const claudePlugin = readJson('.claude-plugin/plugin.json');
|
|
53
|
-
if (claudePlugin && claudePlugin.version !== newVersion) {
|
|
54
|
-
const old = claudePlugin.version;
|
|
55
|
-
claudePlugin.version = newVersion;
|
|
56
|
-
writeJson('.claude-plugin/plugin.json', claudePlugin);
|
|
57
|
-
updated.push(`.claude-plugin/plugin.json (${old} → ${newVersion})`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// 2. .claude-plugin/marketplace.json
|
|
61
|
-
const marketplace = readJson('.claude-plugin/marketplace.json');
|
|
62
|
-
if (marketplace && marketplace.plugins && marketplace.plugins[0]) {
|
|
63
|
-
const old = marketplace.plugins[0].version;
|
|
64
|
-
if (old !== newVersion) {
|
|
65
|
-
marketplace.plugins[0].version = newVersion;
|
|
66
|
-
writeJson('.claude-plugin/marketplace.json', marketplace);
|
|
67
|
-
updated.push(`.claude-plugin/marketplace.json (${old} → ${newVersion})`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// 3. .qoder-plugin/plugin.json — 始终与 package.json 保持版本一致
|
|
72
|
-
const qoderPlugin = readJson('.qoder-plugin/plugin.json');
|
|
73
|
-
if (qoderPlugin && qoderPlugin.version !== newVersion) {
|
|
74
|
-
const old = qoderPlugin.version;
|
|
75
|
-
qoderPlugin.version = newVersion;
|
|
76
|
-
writeJson('.qoder-plugin/plugin.json', qoderPlugin);
|
|
77
|
-
updated.push(`.qoder-plugin/plugin.json (${old} → ${newVersion})`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (updated.length === 0) {
|
|
81
|
-
console.log('✅ 所有清单版本已一致,无需更新');
|
|
82
|
-
} else {
|
|
83
|
-
console.log(`✅ 已更新 ${updated.length} 个清单文件:`);
|
|
84
|
-
for (const u of updated) {
|
|
85
|
-
console.log(` - ${u}`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// 4. 提示 git add(preversion 阶段,文件变更会在 npm version 后一起提交)
|
|
90
|
-
if (updated.length > 0) {
|
|
91
|
-
try {
|
|
92
|
-
const { execSync } = require('child_process');
|
|
93
|
-
// 将修改的清单文件加入 git staging(npm version 会自动 commit)
|
|
94
|
-
const filesToAdd = updated
|
|
95
|
-
.map((u) => u.split(' ')[0])
|
|
96
|
-
.join(' ');
|
|
97
|
-
execSync(`git add ${filesToAdd}`, { stdio: 'ignore', cwd: ROOT });
|
|
98
|
-
console.log(' (已 git add 修改的清单文件)');
|
|
99
|
-
} catch {
|
|
100
|
-
// git add 失败不影响流程
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
main();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 版本同步脚本
|
|
6
|
+
*
|
|
7
|
+
* 在 `npm version <type>` 时自动执行(通过 preversion 钩子)。
|
|
8
|
+
* 将 package.json 的新版本同步到三套插件清单文件:
|
|
9
|
+
* - .claude-plugin/plugin.json
|
|
10
|
+
* - .claude-plugin/marketplace.json
|
|
11
|
+
* - .qoder-plugin/plugin.json
|
|
12
|
+
*
|
|
13
|
+
* 也可手动运行:`npm run sync-version`
|
|
14
|
+
*
|
|
15
|
+
* 使用流程:
|
|
16
|
+
* npm version patch # 自动:升 package.json 版本 → 同步到其他清单 → git commit
|
|
17
|
+
* npm version minor
|
|
18
|
+
* npm version major
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
|
|
24
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
25
|
+
|
|
26
|
+
function readJson(relativePath) {
|
|
27
|
+
const fullPath = path.join(ROOT, relativePath);
|
|
28
|
+
if (!fs.existsSync(fullPath)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return JSON.parse(fs.readFileSync(fullPath, 'utf8'));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function writeJson(relativePath, data) {
|
|
35
|
+
const fullPath = path.join(ROOT, relativePath);
|
|
36
|
+
fs.writeFileSync(fullPath, JSON.stringify(data, null, 2) + '\n', 'utf8');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function main() {
|
|
40
|
+
const pkg = readJson('package.json');
|
|
41
|
+
if (!pkg) {
|
|
42
|
+
console.error('❌ 未找到 package.json');
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const newVersion = pkg.version;
|
|
47
|
+
console.log(`🔧 同步版本 ${newVersion} 到插件清单...`);
|
|
48
|
+
|
|
49
|
+
const updated = [];
|
|
50
|
+
|
|
51
|
+
// 1. .claude-plugin/plugin.json
|
|
52
|
+
const claudePlugin = readJson('.claude-plugin/plugin.json');
|
|
53
|
+
if (claudePlugin && claudePlugin.version !== newVersion) {
|
|
54
|
+
const old = claudePlugin.version;
|
|
55
|
+
claudePlugin.version = newVersion;
|
|
56
|
+
writeJson('.claude-plugin/plugin.json', claudePlugin);
|
|
57
|
+
updated.push(`.claude-plugin/plugin.json (${old} → ${newVersion})`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 2. .claude-plugin/marketplace.json
|
|
61
|
+
const marketplace = readJson('.claude-plugin/marketplace.json');
|
|
62
|
+
if (marketplace && marketplace.plugins && marketplace.plugins[0]) {
|
|
63
|
+
const old = marketplace.plugins[0].version;
|
|
64
|
+
if (old !== newVersion) {
|
|
65
|
+
marketplace.plugins[0].version = newVersion;
|
|
66
|
+
writeJson('.claude-plugin/marketplace.json', marketplace);
|
|
67
|
+
updated.push(`.claude-plugin/marketplace.json (${old} → ${newVersion})`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 3. .qoder-plugin/plugin.json — 始终与 package.json 保持版本一致
|
|
72
|
+
const qoderPlugin = readJson('.qoder-plugin/plugin.json');
|
|
73
|
+
if (qoderPlugin && qoderPlugin.version !== newVersion) {
|
|
74
|
+
const old = qoderPlugin.version;
|
|
75
|
+
qoderPlugin.version = newVersion;
|
|
76
|
+
writeJson('.qoder-plugin/plugin.json', qoderPlugin);
|
|
77
|
+
updated.push(`.qoder-plugin/plugin.json (${old} → ${newVersion})`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (updated.length === 0) {
|
|
81
|
+
console.log('✅ 所有清单版本已一致,无需更新');
|
|
82
|
+
} else {
|
|
83
|
+
console.log(`✅ 已更新 ${updated.length} 个清单文件:`);
|
|
84
|
+
for (const u of updated) {
|
|
85
|
+
console.log(` - ${u}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 4. 提示 git add(preversion 阶段,文件变更会在 npm version 后一起提交)
|
|
90
|
+
if (updated.length > 0) {
|
|
91
|
+
try {
|
|
92
|
+
const { execSync } = require('child_process');
|
|
93
|
+
// 将修改的清单文件加入 git staging(npm version 会自动 commit)
|
|
94
|
+
const filesToAdd = updated
|
|
95
|
+
.map((u) => u.split(' ')[0])
|
|
96
|
+
.join(' ');
|
|
97
|
+
execSync(`git add ${filesToAdd}`, { stdio: 'ignore', cwd: ROOT });
|
|
98
|
+
console.log(' (已 git add 修改的清单文件)');
|
|
99
|
+
} catch {
|
|
100
|
+
// git add 失败不影响流程
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
main();
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "adspecs-constitution"
|
|
3
|
+
description: "根据交互式输入或提供的原则输入创建或更新项目章程,确保所有依赖模板保持同步。"
|
|
4
|
+
argument-hint: "项目章程的原则或价值观"
|
|
5
|
+
compatibility: "需要 adspecs 项目结构,包含 .adspecs/ 目录"
|
|
6
|
+
metadata:
|
|
7
|
+
author: "adspecs"
|
|
8
|
+
source: "templates/commands/constitution.md"
|
|
9
|
+
user-invocable: true
|
|
10
|
+
disable-model-invocation: false
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 用户输入
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
$ARGUMENTS
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**必须** 在继续之前考虑用户输入(如果非空)。
|
|
21
|
+
|
|
22
|
+
## 执行前检查
|
|
23
|
+
|
|
24
|
+
**检查扩展钩子(章程更新前)**:
|
|
25
|
+
- 检查项目根目录是否存在 `.adspecs/extensions.yml`。
|
|
26
|
+
- 如果存在,读取它并查找 `hooks.before_constitution` 下的条目。
|
|
27
|
+
- 如果 YAML 无法解析或无效,静默跳过钩子检查并继续正常执行。
|
|
28
|
+
- 过滤掉 `enabled` 明确为 `false` 的钩子。没有 `enabled` 字段的钩子默认视为启用。
|
|
29
|
+
- 对于每个剩余的钩子,**不要** 尝试解释或评估钩子的 `condition` 表达式:
|
|
30
|
+
- 如果钩子没有 `condition` 字段,或为空/null,视为可执行。
|
|
31
|
+
- 如果钩子定义了非空的 `condition`,跳过该钩子,将条件评估留给 HookExecutor 实现。
|
|
32
|
+
- 从钩子命令名构造斜杠命令时,将点号(`.`)替换为连字符(`-`)。例如:`adspecs.git.commit` → `/adspecs-git-commit`。
|
|
33
|
+
- 对于每个可执行钩子,根据其 `optional` 标志输出以下内容:
|
|
34
|
+
- **可选钩子** (`optional: true`):
|
|
35
|
+
```
|
|
36
|
+
## 扩展钩子
|
|
37
|
+
|
|
38
|
+
**可选前置钩子**: {extension}
|
|
39
|
+
命令: `/{command}`
|
|
40
|
+
描述: {description}
|
|
41
|
+
|
|
42
|
+
提示: {prompt}
|
|
43
|
+
执行: `/{command}`
|
|
44
|
+
```
|
|
45
|
+
- **必选钩子** (`optional: false`):
|
|
46
|
+
```
|
|
47
|
+
## 扩展钩子
|
|
48
|
+
|
|
49
|
+
**自动前置钩子**: {extension}
|
|
50
|
+
执行: `/{command}`
|
|
51
|
+
EXECUTE_COMMAND: {command}
|
|
52
|
+
|
|
53
|
+
等待钩子命令结果后再继续执行。
|
|
54
|
+
```
|
|
55
|
+
- 如果没有注册钩子或 `.adspecs/extensions.yml` 不存在,静默跳过。
|
|
56
|
+
|
|
57
|
+
## 执行流程
|
|
58
|
+
|
|
59
|
+
你需要更新位于 `.adspecs/memory/constitution.md` 的项目章程。该文件是一个模板,包含方括号形式的占位符标记(例如 `[PROJECT_NAME]`、`[PRINCIPLE_1_NAME]`)。你的任务是:(a)收集/推导具体值,(b)精确填充模板,(c)将任何修订传播到依赖产物中。
|
|
60
|
+
|
|
61
|
+
**注意**: 如果 `.adspecs/memory/constitution.md` 尚不存在,它应该已在项目初始化阶段从 `.adspecs/templates/constitution-template.md` 模板复制而来。如果缺失,请先复制模板。
|
|
62
|
+
|
|
63
|
+
按以下执行流程操作:
|
|
64
|
+
|
|
65
|
+
1. 加载现有章程 `.adspecs/memory/constitution.md`。
|
|
66
|
+
- 识别所有形如 `[全大写字母标识符]` 的占位符标记。
|
|
67
|
+
**重要**: 用户要求的原则数量可能少于或多于模板中的数量。如果指定了数量,请遵循该数量——按通用模板结构处理。你需要相应地更新文档。
|
|
68
|
+
|
|
69
|
+
2. 收集/推导占位符的值:
|
|
70
|
+
- 如果用户输入(对话)提供了值,直接使用该值。
|
|
71
|
+
- 否则从现有仓库上下文推断(README、文档、先前的章程版本(如果嵌入))。
|
|
72
|
+
- 对于治理日期:`RATIFICATION_DATE` 为最初采纳日期(如果未知则询问或标记 TODO),`LAST_AMENDED_DATE` 为今天(如果做了更改),否则保留之前的日期。
|
|
73
|
+
- `CONSTITUTION_VERSION` 必须按语义化版本规则递增:
|
|
74
|
+
- MAJOR(主版本): 向后不兼容的治理/原则删除或重新定义。
|
|
75
|
+
- MINOR(次版本): 新增原则/章节或实质性扩展指引。
|
|
76
|
+
- PATCH(补丁版本): 澄清、措辞、错别字修复、非语义性改进。
|
|
77
|
+
- 如果版本递增类型存在歧义,在最终确定之前先提出推理说明。
|
|
78
|
+
|
|
79
|
+
3. 草拟更新后的章程内容:
|
|
80
|
+
- 将每个占位符替换为具体文本(不遗留方括号标记,除非是项目有意选择暂不定义的模板槽位——需对任何保留项进行明确说明)。
|
|
81
|
+
- 保留标题层级结构;注释在替换后可以删除,除非它们仍然提供有 clarifying 指引价值。
|
|
82
|
+
- 确保每个原则章节包含:简洁的名称行、描述不可协商规则的段落(或项目符号列表)、以及如果不显然则提供明确的理由。
|
|
83
|
+
- 确保治理章节列出修订程序、版本策略和合规审查要求。
|
|
84
|
+
|
|
85
|
+
4. 一致性传播检查清单(将先前检查清单转化为主动验证):
|
|
86
|
+
- 读取 `.adspecs/templates/plan-template.md`,确保任何"章程检查"或规则与更新后的原则一致。
|
|
87
|
+
- 读取 `.adspecs/templates/spec-template.md`,检查范围/需求对齐——如果章程添加/删除了必填章节或约束,则更新。
|
|
88
|
+
- 读取 `.adspecs/templates/tasks-template.md`,确保任务分类反映新增或删除的原则驱动任务类型(例如可观测性、版本管理、测试纪律)。
|
|
89
|
+
- 读取 `.adspecs/templates/commands/*.md` 中的每个命令文件(包括本文件),验证当需要通用指引时,不存在过时的引用(仅针对特定 agent 的名称如 CLAUDE)。
|
|
90
|
+
- 读取任何运行时指引文档(例如 `README.md`、`docs/quickstart.md`,或存在的 agent 特定指引文件)。更新引用已变更原则的内容。
|
|
91
|
+
|
|
92
|
+
5. 生成同步影响报告(在更新后以 HTML 注释形式.prepend.到章程文件顶部):
|
|
93
|
+
- 版本变更: 旧版本 → 新版本
|
|
94
|
+
- 已修改的原则列表(如果重命名,标注旧标题 → 新标题)
|
|
95
|
+
- 新增章节
|
|
96
|
+
- 删除章节
|
|
97
|
+
- 需要更新的模板(✅ 已更新 / ⚠ 待处理)及文件路径
|
|
98
|
+
- 如果有任何占位符有意延迟处理,列出后续 TODO。
|
|
99
|
+
|
|
100
|
+
6. 最终输出前的验证:
|
|
101
|
+
- 无遗留的未解释方括号标记。
|
|
102
|
+
- 版本行与报告一致。
|
|
103
|
+
- 日期使用 ISO 格式 YYYY-MM-DD。
|
|
104
|
+
- 原则是声明性的、可测试的,不含模糊语言("应该" → 在适当位置替换为 MUST/SHOULD 理由)。
|
|
105
|
+
|
|
106
|
+
7. 将完成的章程写回 `.adspecs/memory/constitution.md`(覆盖)。
|
|
107
|
+
|
|
108
|
+
8. 向用户输出最终总结,包含:
|
|
109
|
+
- 新版本及递增理由。
|
|
110
|
+
- 任何标记为需要手动跟进的文件。
|
|
111
|
+
- 建议的提交消息(例如 `docs: 修订章程至 vX.Y.Z(原则新增 + 治理更新)`)。
|
|
112
|
+
|
|
113
|
+
格式与风格要求:
|
|
114
|
+
|
|
115
|
+
- 使用模板中完全一致的 Markdown 标题(不要降级/升级层级)。
|
|
116
|
+
- 长理由行可换行以保持可读性(理想 <100 字符),但不强制硬性截断。
|
|
117
|
+
- 章节之间保留一个空行。
|
|
118
|
+
- 避免尾随空白。
|
|
119
|
+
|
|
120
|
+
如果用户提供部分更新(例如仅修订一个原则),仍需执行验证和版本决策步骤。
|
|
121
|
+
|
|
122
|
+
如果关键信息缺失(例如批准日期确实未知),插入 `TODO(<FIELD_NAME>): 说明` 并在同步影响报告的延迟项中列出。
|
|
123
|
+
|
|
124
|
+
不要创建新模板;始终操作现有的 `.adspecs/memory/constitution.md` 文件。
|
|
125
|
+
|
|
126
|
+
## 执行后检查
|
|
127
|
+
|
|
128
|
+
**检查扩展钩子(章程更新后)**:
|
|
129
|
+
检查项目根目录是否存在 `.adspecs/extensions.yml`。
|
|
130
|
+
- 如果存在,读取它并查找 `hooks.after_constitution` 下的条目。
|
|
131
|
+
- 如果 YAML 无法解析或无效,静默跳过钩子检查并继续正常执行。
|
|
132
|
+
- 过滤掉 `enabled` 明确为 `false` 的钩子。没有 `enabled` 字段的钩子默认视为启用。
|
|
133
|
+
- 对于每个剩余的钩子,**不要** 尝试解释或评估钩子的 `condition` 表达式:
|
|
134
|
+
- 如果钩子没有 `condition` 字段,或为空/null,视为可执行。
|
|
135
|
+
- 如果钩子定义了非空的 `condition`,跳过该钩子,将条件评估留给 HookExecutor 实现。
|
|
136
|
+
- 从钩子命令名构造斜杠命令时,将点号(`.`)替换为连字符(`-`)。例如:`adspecs.git.commit` → `/adspecs-git-commit`。
|
|
137
|
+
- 对于每个可执行钩子,根据其 `optional` 标志输出以下内容:
|
|
138
|
+
- **可选钩子** (`optional: true`):
|
|
139
|
+
```
|
|
140
|
+
## 扩展钩子
|
|
141
|
+
|
|
142
|
+
**可选钩子**: {extension}
|
|
143
|
+
命令: `/{command}`
|
|
144
|
+
描述: {description}
|
|
145
|
+
|
|
146
|
+
提示: {prompt}
|
|
147
|
+
执行: `/{command}`
|
|
148
|
+
```
|
|
149
|
+
- **必选钩子** (`optional: false`):
|
|
150
|
+
```
|
|
151
|
+
## 扩展钩子
|
|
152
|
+
|
|
153
|
+
**自动钩子**: {extension}
|
|
154
|
+
执行: `/{command}`
|
|
155
|
+
EXECUTE_COMMAND: {command}
|
|
156
|
+
```
|
|
157
|
+
- 如果没有注册钩子或 `.adspecs/extensions.yml` 不存在,静默跳过。
|