头脑风暴、实施、审查三套提示词引用的 /ecc:plan-prd、grill-me、 /ecc:tdd-workflow、/review 在 ECC 2.2.15 里都不存在,会话拿到的是一 条无效命令。审查提示词里的 /ecc:review-pr 走 gh,对 Gitea 不可用。 改为 ECC 实际链路:/ecc:grilling 讨论、/ecc:spec 出设计文档、 /ecc:plan 出计划、/ecc:tdd 实施,审查直接派 ecc:code-reviewer 等子代 理审 git diff。文档路径随 ECC 约定改成 .claude/specs/<stem>.md 与 .claude/plans/<stem>.md,stem 两者共用,不再带 .prd.md / .plan.md 后 缀;deriveSlug 相应改成取文件名 stem,通用文件名才退回目录名。 Claude-Session: https://claude.ai/code/session_01REdhpbaNyqWASF2HWsnTFv
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import * as os from 'node:os'
|
|
import * as path from 'node:path'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { DEFAULT_WORKTREE_TEMPLATE, deriveSlug, resolveWorktreeDir, slugFromBranch } from '../../src/git/worktreePath'
|
|
|
|
describe('deriveSlug', () => {
|
|
it('计划文件名的 stem 就是 slug', () => {
|
|
expect(deriveSlug('.claude/plans/app-entity.md')).toBe('app-entity')
|
|
})
|
|
it('设计文档与计划共用同一个 stem', () => {
|
|
expect(deriveSlug('.claude/specs/app-entity.md')).toBe('app-entity')
|
|
})
|
|
it('文件名是通用的 plan.md 时退回父目录名', () => {
|
|
expect(deriveSlug('.claude/plans/x/plan.md')).toBe('x')
|
|
})
|
|
it('通用文件名且没有父目录时退回路径 hash 前 8 位', () => {
|
|
expect(deriveSlug('plan.md')).toMatch(/^[0-9a-f]{8}$/)
|
|
})
|
|
})
|
|
|
|
describe('slugFromBranch', () => {
|
|
it('去掉 feature/ 前缀', () => {
|
|
expect(slugFromBranch('feature/app-entity')).toBe('app-entity')
|
|
})
|
|
it('无前缀原样返回', () => {
|
|
expect(slugFromBranch('hotfix-1')).toBe('hotfix-1')
|
|
})
|
|
})
|
|
|
|
describe('resolveWorktreeDir', () => {
|
|
it('展开三个占位符与 ~', () => {
|
|
const out = resolveWorktreeDir(DEFAULT_WORKTREE_TEMPLATE, '/w/proj', 'slug')
|
|
expect(out).toBe(path.join(os.homedir(), 'Sources', 'worktree', 'proj', 'slug'))
|
|
})
|
|
it('$project_root 展开为工作区绝对路径', () => {
|
|
expect(resolveWorktreeDir('$project_root/.wt/$feature_name', '/w/proj', 's')).toBe('/w/proj/.wt/s')
|
|
})
|
|
})
|