@zhuan-ai/zhuanspec 2.11.14 → 2.11.16
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.
|
@@ -238,13 +238,13 @@ async function runDeviationCheck(filePath, trigger, promptText, _options) {
|
|
|
238
238
|
// Propose phase → block all code modifications (Iron Law 1: No Spec No Code)
|
|
239
239
|
// But check if we can transition to Apply phase
|
|
240
240
|
if (phase === 'propose') {
|
|
241
|
-
//
|
|
242
|
-
if (filePath.includes('zhuanspec/changes/') || filePath.includes('zhuanspec/specs/')) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
241
|
+
// TODO: 路径匹配对相对路径不准,先注释掉放行分支(后续用正则+白名单修复)
|
|
242
|
+
// if (filePath.includes('zhuanspec/changes/') || filePath.includes('zhuanspec/specs/')) {
|
|
243
|
+
// return {
|
|
244
|
+
// continue: true,
|
|
245
|
+
// systemMessage: '✓ Proposal file modification allowed in propose phase',
|
|
246
|
+
// };
|
|
247
|
+
// }
|
|
248
248
|
// Check if this is a code file that might trigger Apply phase transition
|
|
249
249
|
const isCodeFile = !filePath.includes('zhuanspec/') &&
|
|
250
250
|
/\.(java|ts|tsx|js|jsx|py|go|rs|sql|kt|scala|c|cpp|cs)$/i.test(filePath);
|
package/dist/core/hooks/init.js
CHANGED
|
@@ -18,9 +18,19 @@ import { resolveZhuanSpecRoot } from '../../utils/resolve-root.js';
|
|
|
18
18
|
const execAsync = promisify(exec);
|
|
19
19
|
async function checkVersionUpdate() {
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// 当前版本:以用户实际使用的全局 CLI 为准(`zhuanspec --version`),避免受 hook 执行路径
|
|
22
|
+
// (本地开发目录 / npm link / 多份安装)干扰。
|
|
23
|
+
// 兜底:当全局 CLI 不可达时,降级读取 hook 自身 package.json。
|
|
24
|
+
let current = '';
|
|
25
|
+
try {
|
|
26
|
+
const { stdout: verOut } = await execAsync('zhuanspec --version', { timeout: 3000 });
|
|
27
|
+
current = verOut.trim().replace(/^v/, '');
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
const pkgPath = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..', 'package.json');
|
|
31
|
+
const pkgContent = JSON.parse(await fs.promises.readFile(pkgPath, 'utf-8'));
|
|
32
|
+
current = pkgContent.version;
|
|
33
|
+
}
|
|
24
34
|
// 显式指定公共 npm registry,避免受用户本地 registry 或私有源同步延迟影响
|
|
25
35
|
// --cache-min=0 强制绕过本地 metadata 缓存,确保拿到真正的 latest
|
|
26
36
|
const { stdout } = await execAsync('npm view @zhuan-ai/zhuanspec version --registry https://registry.npmjs.org/ --cache-min=0', { timeout: 5000 });
|
|
@@ -89,7 +89,6 @@ const proposalSteps = `**步骤**
|
|
|
89
89
|
- **获取方式**:若用户提供链接(格式:\`https://zzcase.zhuanspirit.com/plan/taskDetail/module/{moduleId}/task/{taskId}\`),从 URL 路径中提取 \`moduleId\`,调用 MCP 工具 \`mcp__caseweb__GET_get2\` 读取数据;否则手动录入
|
|
90
90
|
- **创建 test-cases.md**(路径:\`changes/<change-id>/test-cases.md\`),使用 \`getTestCasesTemplate\` 模板,每个 TC-XXX 包含:前置条件、测试步骤、预期结果、验收点
|
|
91
91
|
- tasks.md 中使用 \`@test-case:TC-XXX\` 关联任务与测试 case,表格四列:Task、测试 Case ID、测试 Case 文件路径、覆盖场景
|
|
92
|
-
- 任务实施顺序调整为:先写测试 → 再写实现 → 验证测试通过
|
|
93
92
|
|
|
94
93
|
用户选择"暂不提供":跳过,按常规流程继续
|
|
95
94
|
用户选择"其他":等待用户补充说明后继续
|