@specpow/framework 0.5.9 → 0.5.11
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/CHANGELOG.md +623 -623
- package/LICENSE +21 -21
- package/bin/specpow.js +9 -9
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +4 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +12 -11
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/archive.d.ts.map +1 -1
- package/dist/commands/archive.js +30 -3
- package/dist/commands/archive.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +5 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +29 -10
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/execute.d.ts.map +1 -1
- package/dist/commands/execute.js +5 -2
- package/dist/commands/execute.js.map +1 -1
- package/dist/commands/explore.d.ts.map +1 -1
- package/dist/commands/explore.js +8 -10
- package/dist/commands/explore.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +6 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/propose.d.ts.map +1 -1
- package/dist/commands/propose.js +4 -3
- package/dist/commands/propose.js.map +1 -1
- package/dist/commands/schema.d.ts.map +1 -1
- package/dist/commands/schema.js +5 -2
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +17 -11
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/store.d.ts.map +1 -1
- package/dist/commands/store.js +8 -6
- package/dist/commands/store.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +3 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate-specs.d.ts.map +1 -1
- package/dist/commands/validate-specs.js +8 -5
- package/dist/commands/validate-specs.js.map +1 -1
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +17 -19
- package/dist/commands/verify.js.map +1 -1
- package/dist/commands/workflow/index.d.ts.map +1 -1
- package/dist/commands/workflow/index.js +18 -10
- package/dist/commands/workflow/index.js.map +1 -1
- package/dist/core/archive/engine.d.ts.map +1 -1
- package/dist/core/archive/engine.js +10 -6
- package/dist/core/archive/engine.js.map +1 -1
- package/dist/core/artifact-graph/resolver.d.ts.map +1 -1
- package/dist/core/artifact-graph/resolver.js +5 -2
- package/dist/core/artifact-graph/resolver.js.map +1 -1
- package/dist/core/config/config-schema.d.ts +104 -0
- package/dist/core/config/config-schema.d.ts.map +1 -1
- package/dist/core/config/config-schema.js +15 -1
- package/dist/core/config/config-schema.js.map +1 -1
- package/dist/core/hooks/session-start-hook.d.ts.map +1 -1
- package/dist/core/hooks/session-start-hook.js +76 -45
- package/dist/core/hooks/session-start-hook.js.map +1 -1
- package/dist/core/hooks/workflow-state-hook.d.ts.map +1 -1
- package/dist/core/hooks/workflow-state-hook.js +3 -1
- package/dist/core/hooks/workflow-state-hook.js.map +1 -1
- package/dist/core/init/codegraph-step.d.ts +36 -0
- package/dist/core/init/codegraph-step.d.ts.map +1 -0
- package/dist/core/init/codegraph-step.js +109 -0
- package/dist/core/init/codegraph-step.js.map +1 -0
- package/dist/core/init/engine.d.ts +2 -2
- package/dist/core/init/engine.d.ts.map +1 -1
- package/dist/core/init/engine.js +28 -14
- package/dist/core/init/engine.js.map +1 -1
- package/dist/core/memory/adapters/sqlite-adapter.js +55 -55
- package/dist/core/migration/index.d.ts.map +1 -1
- package/dist/core/migration/index.js +128 -4
- package/dist/core/migration/index.js.map +1 -1
- package/dist/core/store/index.d.ts +4 -3
- package/dist/core/store/index.d.ts.map +1 -1
- package/dist/core/store/index.js +7 -7
- package/dist/core/store/index.js.map +1 -1
- package/dist/core/task-parser.d.ts +17 -0
- package/dist/core/task-parser.d.ts.map +1 -0
- package/dist/core/task-parser.js +59 -0
- package/dist/core/task-parser.js.map +1 -0
- package/dist/core/templates/index.d.ts +1 -1
- package/dist/core/templates/index.d.ts.map +1 -1
- package/dist/core/templates/index.js +11 -6
- package/dist/core/templates/index.js.map +1 -1
- package/dist/core/workflow-state.d.ts +1 -1
- package/dist/core/workflow-state.d.ts.map +1 -1
- package/dist/core/workflow-state.js +10 -5
- package/dist/core/workflow-state.js.map +1 -1
- package/dist/templates/claude-commands/specpow-apply.md +23 -23
- package/dist/templates/claude-commands/specpow-archive.md +22 -22
- package/dist/templates/claude-commands/specpow-propose.md +27 -27
- package/dist/templates/claude-commands/specpow-status.md +22 -22
- package/dist/templates/claude-commands/specpow-validate-specs.md +28 -28
- package/dist/templates/claude-commands/specpow-verify.md +21 -21
- package/dist/templates/claude-commands/specpow.md +34 -34
- package/package.json +121 -122
- package/.specpow/agents/controller/sdd-controller.md +0 -55
- package/.specpow/agents/execution/java-codegen-agent.md +0 -39
- package/.specpow/agents/execution/ui-codegen-agent.md +0 -32
- package/.specpow/agents/ops/deploy-agent.md +0 -181
- package/.specpow/agents/planning/db-designer-agent.md +0 -30
- package/.specpow/agents/planning/prd-agent.md +0 -31
- package/.specpow/agents/quality/review-agent.md +0 -36
- package/.specpow/agents/quality/test-agent.md +0 -33
- package/.specpow/hooks/hooks.json +0 -30
- package/.specpow/hooks/run-hook.cmd +0 -19
- package/.specpow/hooks/session-start +0 -62
- package/.specpow/hooks/workflow-state +0 -150
- package/.specpow/schemas/bug-fix/schema.yaml +0 -64
- package/.specpow/schemas/bug-fix/templates/analysis.md +0 -43
- package/.specpow/schemas/bug-fix/templates/fix-plan.md +0 -19
- package/.specpow/schemas/bug-fix/templates/proposal.md +0 -30
- package/.specpow/schemas/crud-module/schema.yaml +0 -65
- package/.specpow/schemas/crud-module/templates/design.md +0 -36
- package/.specpow/schemas/crud-module/templates/proposal.md +0 -30
- package/.specpow/schemas/crud-module/templates/spec.md +0 -38
- package/.specpow/schemas/crud-module/templates/tasks.md +0 -57
- package/.specpow/schemas/spec-driven/schema.yaml +0 -87
- package/.specpow/schemas/spec-driven/templates/design.md +0 -54
- package/.specpow/schemas/spec-driven/templates/proposal.md +0 -31
- package/.specpow/schemas/spec-driven/templates/spec.md +0 -42
- package/.specpow/schemas/spec-driven/templates/tasks.md +0 -98
- package/.specpow/skills/business-code-review/SKILL.md +0 -78
- package/.specpow/skills/business-db-design/SKILL.md +0 -74
- package/.specpow/skills/business-deploy-check/SKILL.md +0 -72
- package/.specpow/skills/business-doc-sync/SKILL.md +0 -72
- package/.specpow/skills/business-java-codegen/SKILL.md +0 -97
- package/.specpow/skills/business-menu-register/SKILL.md +0 -63
- package/.specpow/skills/business-prd-writer/SKILL.md +0 -80
- package/.specpow/skills/business-test-gen/SKILL.md +0 -82
- package/.specpow/skills/business-ui-codegen/SKILL.md +0 -104
- package/.specpow/skills/cli-router/SKILL.md +0 -108
- package/.specpow/skills/execution-finish-branch/SKILL.md +0 -58
- package/.specpow/skills/execution-git-worktrees/SKILL.md +0 -48
- package/.specpow/skills/execution-parallel-agents/SKILL.md +0 -46
- package/.specpow/skills/execution-receiving-review/SKILL.md +0 -47
- package/.specpow/skills/execution-requesting-review/SKILL.md +0 -51
- package/.specpow/skills/execution-sdd-orchestrator/SKILL.md +0 -366
- package/.specpow/skills/execution-subagent-dispatch/SKILL.md +0 -295
- package/.specpow/skills/execution-subagent-driven-dev/SKILL.md +0 -143
- package/.specpow/skills/execution-systematic-debugging/SKILL.md +0 -95
- package/.specpow/skills/execution-tdd/SKILL.md +0 -74
- package/.specpow/skills/execution-verification-before-completion/SKILL.md +0 -75
- package/.specpow/skills/meta-create-skill/SKILL.md +0 -374
- package/.specpow/skills/meta-using-skills/SKILL.md +0 -97
- package/.specpow/skills/meta-writing-skills/SKILL.md +0 -66
- package/.specpow/skills/planning-apply-change/SKILL.md +0 -194
- package/.specpow/skills/planning-archive-change/SKILL.md +0 -43
- package/.specpow/skills/planning-explore/SKILL.md +0 -103
- package/.specpow/skills/planning-onboard/SKILL.md +0 -61
- package/.specpow/skills/planning-propose/SKILL.md +0 -140
- package/.specpow/skills/planning-update-change/SKILL.md +0 -45
- package/.specpow/skills/planning-verify-change/SKILL.md +0 -58
- package/.specpow/skills/planning-write-design/SKILL.md +0 -59
- package/.specpow/skills/planning-write-plans/SKILL.md +0 -55
- package/.specpow/skills/planning-write-specs/SKILL.md +0 -91
- package/.specpow/skills/using-specpow/SKILL.md +0 -232
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hooks": {
|
|
3
|
-
"SessionStart": [
|
|
4
|
-
{
|
|
5
|
-
"matcher": "",
|
|
6
|
-
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
"type": "command",
|
|
9
|
-
"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start",
|
|
10
|
-
"shell": "bash",
|
|
11
|
-
"async": false
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"UserPromptSubmit": [
|
|
17
|
-
{
|
|
18
|
-
"matcher": "",
|
|
19
|
-
"hooks": [
|
|
20
|
-
{
|
|
21
|
-
"type": "command",
|
|
22
|
-
"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" workflow-state",
|
|
23
|
-
"shell": "bash",
|
|
24
|
-
"async": false
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
REM SpecPow Hook Runner for Windows
|
|
3
|
-
REM Usage: run-hook.cmd <hook-name>
|
|
4
|
-
REM
|
|
5
|
-
REM P2-11: 支持 SessionStart 和 WorkflowState 两种 Hook
|
|
6
|
-
|
|
7
|
-
set HOOK_NAME=%1
|
|
8
|
-
set SCRIPT_DIR=%~dp0
|
|
9
|
-
|
|
10
|
-
if "%HOOK_NAME%"=="session-start" (
|
|
11
|
-
bash "%SCRIPT_DIR%session-start"
|
|
12
|
-
) else if "%HOOK_NAME%"=="workflow-state" (
|
|
13
|
-
REM WorkflowState Hook: 注入当前工作流状态
|
|
14
|
-
REM 通过 Node.js 调用 TypeScript Hook 模块
|
|
15
|
-
node -e "import('file:///%SCRIPT_DIR:~0,-1%/../dist/core/hooks/index.js').then(m => m.executeUserPromptSubmit(process.cwd(), '', 'claude').then(c => { if(c) console.log(JSON.stringify({hookSpecificOutput:{hookEventName:'UserPromptSubmit',additionalContext:c}})); else process.exit(0); }))"
|
|
16
|
-
) else (
|
|
17
|
-
echo Unknown hook: %HOOK_NAME%
|
|
18
|
-
exit /b 1
|
|
19
|
-
)
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SpecPow Session Start Hook
|
|
3
|
-
#
|
|
4
|
-
# 在每次会话开始时注入 using-skills 技能内容到 AI 代理上下文
|
|
5
|
-
# 兼容 Claude Code、Cursor、Copilot CLI 等平台
|
|
6
|
-
|
|
7
|
-
set -euo pipefail
|
|
8
|
-
|
|
9
|
-
# Determine plugin root directory
|
|
10
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
11
|
-
PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
12
|
-
|
|
13
|
-
# Read using-skills content
|
|
14
|
-
using_skills_content=$(cat "${PLUGIN_ROOT}/skills/meta-using-skills/SKILL.md" 2>&1 || echo "Error reading using-skills skill")
|
|
15
|
-
|
|
16
|
-
# Escape string for JSON embedding
|
|
17
|
-
escape_for_json() {
|
|
18
|
-
local s="$1"
|
|
19
|
-
s="${s//\\/\\\\}"
|
|
20
|
-
s="${s//\"/\\\"}"
|
|
21
|
-
s="${s//$'\n'/\\n}"
|
|
22
|
-
s="${s//$'\r'/\\r}"
|
|
23
|
-
s="${s//$'\t'/\\t}"
|
|
24
|
-
printf '%s' "$s"
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
using_skills_escaped=$(escape_for_json "$using_skills_content")
|
|
28
|
-
|
|
29
|
-
# Check for OpenSpec context
|
|
30
|
-
openspec_context=""
|
|
31
|
-
if [ -f "${PLUGIN_ROOT}/../openspec/specs" ] 2>/dev/null || [ -d "${PLUGIN_ROOT}/../openspec/specs" ] 2>/dev/null; then
|
|
32
|
-
# Detect active changes
|
|
33
|
-
active_changes=""
|
|
34
|
-
if [ -d "${PLUGIN_ROOT}/../openspec/changes" ] 2>/dev/null; then
|
|
35
|
-
changes_count=$(find "${PLUGIN_ROOT}/../openspec/changes" -maxdepth 1 -mindepth 1 -type d ! -name 'archive' 2>/dev/null | wc -l | tr -d ' ')
|
|
36
|
-
if [ "$changes_count" -gt 0 ] 2>/dev/null; then
|
|
37
|
-
active_changes_list=$(find "${PLUGIN_ROOT}/../openspec/changes" -maxdepth 1 -mindepth 1 -type d ! -name 'archive' 2>/dev/null | while read d; do basename "$d"; done | tr '\n' ', ' | sed 's/, $//')
|
|
38
|
-
active_changes="\nActive changes (${changes_count}): ${active_changes_list}\nUse 'specpow status' to inspect."
|
|
39
|
-
fi
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
openspec_context="\nOpenSpec structure detected in this project. Follow the spec-driven workflow:\n1. Explore → planning-explore skill\n2. Propose → planning-propose skill\n3. Write Specs/Design/Tasks → planning-write-* skills\n4. Implement → execution-* skills (SDD engine)\n5. Verify → execution-verification-before-completion\n6. Archive → specpow archive\n${active_changes}\n"
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
session_context="<EXTREMELY_IMPORTANT>\nYou have specpow — a spec-powered AI development framework. It combines OpenSpec's spec-driven planning with Superpowers' subagent-driven execution.\n\n**Below is the full content of your 'specpow:meta-using-skills' skill - your introduction to using skills. For all other skills, use the 'Skill' tool:**\n\n${using_skills_escaped}\n\n${openspec_context}\n\nAvailable skill categories:\n- Planning: planning-explore, planning-propose, planning-write-plans, planning-write-specs, planning-write-design\n- Execution: planning-apply-change, execution-subagent-driven-dev, execution-tdd, execution-systematic-debugging, execution-parallel-agents\n- Quality: execution-requesting-review, execution-receiving-review, execution-verification-before-completion, planning-verify-change\n- Business: business-java-codegen, business-ui-codegen, business-test-gen, business-code-review, business-db-design, business-prd-writer, business-deploy-check\n- CLI Router: cli-router — maps user intent to SpecPow CLI commands\n\nSpecPow CLI quick reference (execute via Bash tool):\n| Command | Purpose |\n|---------|----------|\n| specpow status | View current change status |\n| specpow explore \"<topic>\" | Socratic requirement exploration (interactive, run in terminal) |\n| specpow propose <name> | Create change proposal |\n| specpow apply | Execute implementation |\n| specpow verify | Verify changes |\n| specpow archive | Archive changes |\n| specpow debug \"<desc>\" | Systematic debugging |\n| specpow doctor | Project diagnostics |\n\nUsers can also use slash commands: /specpow-explore, /specpow-propose, /specpow-apply, /specpow-verify, /specpow-archive, /specpow-status\n\nRemember: Check for relevant skills BEFORE any action.\n</EXTREMELY_IMPORTANT>"
|
|
46
|
-
|
|
47
|
-
# Output context injection as JSON
|
|
48
|
-
# Cursor hooks expect additional_context (snake_case)
|
|
49
|
-
# Claude Code hooks expect hookSpecificOutput.additionalContext (nested)
|
|
50
|
-
# Copilot CLI (v1.0.11+) and others expect additionalContext (top-level, SDK standard)
|
|
51
|
-
if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then
|
|
52
|
-
# Cursor sets CURSOR_PLUGIN_ROOT (may also set CLAUDE_PLUGIN_ROOT)
|
|
53
|
-
printf '{\n "additional_context": "%s"\n}\n' "$session_context" | cat
|
|
54
|
-
elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -z "${COPILOT_CLI:-}" ]; then
|
|
55
|
-
# Claude Code sets CLAUDE_PLUGIN_ROOT without COPILOT_CLI
|
|
56
|
-
printf '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": "%s"\n }\n}\n' "$session_context" | cat
|
|
57
|
-
else
|
|
58
|
-
# Copilot CLI (sets COPILOT_CLI=1) or unknown platform — SDK standard format
|
|
59
|
-
printf '{\n "additionalContext": "%s"\n}\n' "$session_context" | cat
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
exit 0
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SpecPow Workflow State Hook
|
|
3
|
-
#
|
|
4
|
-
# 在用户提交提示时注入当前工作流状态
|
|
5
|
-
# 兼容 Claude Code、Cursor、Copilot CLI 等平台
|
|
6
|
-
|
|
7
|
-
set -euo pipefail
|
|
8
|
-
|
|
9
|
-
# Determine plugin root directory
|
|
10
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
11
|
-
PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
12
|
-
PROJECT_ROOT="$(cd "${PLUGIN_ROOT}/.." 2>/dev/null && pwd || echo "${PLUGIN_ROOT}")"
|
|
13
|
-
|
|
14
|
-
# Escape string for JSON embedding
|
|
15
|
-
escape_for_json() {
|
|
16
|
-
local s="$1"
|
|
17
|
-
s="${s//\\/\\\\}"
|
|
18
|
-
s="${s//\"/\\\"}"
|
|
19
|
-
s="${s//$'\n'/\\n}"
|
|
20
|
-
s="${s//$'\r'/\\r}"
|
|
21
|
-
s="${s//$'\t'/\\t}"
|
|
22
|
-
printf '%s' "$s"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
# Detect active change
|
|
26
|
-
detect_active_change() {
|
|
27
|
-
local changes_dir="${PROJECT_ROOT}/openspec/changes"
|
|
28
|
-
if [ ! -d "$changes_dir" ]; then
|
|
29
|
-
echo ""
|
|
30
|
-
return
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# Find first active change (excluding archive)
|
|
34
|
-
local change_name=""
|
|
35
|
-
for dir in "$changes_dir"/*/; do
|
|
36
|
-
local basename=$(basename "$dir")
|
|
37
|
-
if [ "$basename" != "archive" ] && [ -d "$dir" ]; then
|
|
38
|
-
change_name="$basename"
|
|
39
|
-
break
|
|
40
|
-
fi
|
|
41
|
-
done
|
|
42
|
-
|
|
43
|
-
if [ -z "$change_name" ]; then
|
|
44
|
-
echo ""
|
|
45
|
-
return
|
|
46
|
-
fi
|
|
47
|
-
|
|
48
|
-
echo "$change_name"
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
# Infer workflow stage from change directory contents
|
|
52
|
-
infer_stage() {
|
|
53
|
-
local change_name="$1"
|
|
54
|
-
local change_dir="${PROJECT_ROOT}/openspec/changes/${change_name}"
|
|
55
|
-
|
|
56
|
-
if [ ! -d "$change_dir" ]; then
|
|
57
|
-
echo "idle"
|
|
58
|
-
return
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# Check for verify/review files
|
|
62
|
-
if ls "$change_dir"/*verify* 2>/dev/null | head -1 > /dev/null || \
|
|
63
|
-
ls "$change_dir"/*review* 2>/dev/null | head -1 > /dev/null; then
|
|
64
|
-
echo "verify"
|
|
65
|
-
return
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
# Check for tasks files
|
|
69
|
-
if ls "$change_dir"/*tasks* 2>/dev/null | head -1 > /dev/null; then
|
|
70
|
-
echo "apply"
|
|
71
|
-
return
|
|
72
|
-
fi
|
|
73
|
-
|
|
74
|
-
# Check for spec/design files
|
|
75
|
-
if ls "$change_dir"/*spec* 2>/dev/null | head -1 > /dev/null || \
|
|
76
|
-
ls "$change_dir"/*design* 2>/dev/null | head -1 > /dev/null; then
|
|
77
|
-
echo "propose"
|
|
78
|
-
return
|
|
79
|
-
fi
|
|
80
|
-
|
|
81
|
-
echo "explore"
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
# Main logic
|
|
85
|
-
change_name=$(detect_active_change)
|
|
86
|
-
|
|
87
|
-
if [ -z "$change_name" ]; then
|
|
88
|
-
# No active change, no context to inject
|
|
89
|
-
exit 0
|
|
90
|
-
fi
|
|
91
|
-
|
|
92
|
-
stage=$(infer_stage "$change_name")
|
|
93
|
-
|
|
94
|
-
# Build workflow context
|
|
95
|
-
workflow_context="<!-- workflow-state: ${stage} -->\n<!-- active-change: ${change_name} -->"
|
|
96
|
-
|
|
97
|
-
# Add stage hint
|
|
98
|
-
case "$stage" in
|
|
99
|
-
explore)
|
|
100
|
-
workflow_context="${workflow_context}\n🔍 当前阶段: EXPLORE — 使用 planning-explore 技能理解需求"
|
|
101
|
-
;;
|
|
102
|
-
propose)
|
|
103
|
-
workflow_context="${workflow_context}\n📝 当前阶段: PROPOSE — 使用 planning-propose 创建变更提案"
|
|
104
|
-
;;
|
|
105
|
-
apply)
|
|
106
|
-
workflow_context="${workflow_context}\n⚙️ 当前阶段: APPLY — 使用 planning-apply-change 执行实现"
|
|
107
|
-
;;
|
|
108
|
-
verify)
|
|
109
|
-
workflow_context="${workflow_context}\n✅ 当前阶段: VERIFY — 使用 planning-verify-change 验证规范"
|
|
110
|
-
;;
|
|
111
|
-
archive)
|
|
112
|
-
workflow_context="${workflow_context}\n📦 当前阶段: ARCHIVE — 运行 specpow archive 合并到主规范"
|
|
113
|
-
;;
|
|
114
|
-
esac
|
|
115
|
-
|
|
116
|
-
# Check progress
|
|
117
|
-
change_dir="${PROJECT_ROOT}/openspec/changes/${change_name}"
|
|
118
|
-
progress=""
|
|
119
|
-
if ls "$change_dir"/*proposal* 2>/dev/null | head -1 > /dev/null; then
|
|
120
|
-
progress="${progress}✓ proposal"
|
|
121
|
-
fi
|
|
122
|
-
if ls "$change_dir"/*spec* 2>/dev/null | head -1 > /dev/null; then
|
|
123
|
-
[ -n "$progress" ] && progress="${progress}, "
|
|
124
|
-
progress="${progress}✓ specs"
|
|
125
|
-
fi
|
|
126
|
-
if ls "$change_dir"/*tasks* 2>/dev/null | head -1 > /dev/null; then
|
|
127
|
-
[ -n "$progress" ] && progress="${progress}, "
|
|
128
|
-
progress="${progress}✓ tasks"
|
|
129
|
-
fi
|
|
130
|
-
|
|
131
|
-
if [ -n "$progress" ]; then
|
|
132
|
-
workflow_context="${workflow_context}\n进度: ${progress}"
|
|
133
|
-
fi
|
|
134
|
-
|
|
135
|
-
# Escape for JSON
|
|
136
|
-
workflow_context_escaped=$(escape_for_json "$workflow_context")
|
|
137
|
-
|
|
138
|
-
# Output based on platform
|
|
139
|
-
if [ -n "${CURSOR_PLUGIN_ROOT:-}" ]; then
|
|
140
|
-
# Cursor format
|
|
141
|
-
printf '{\n "additional_context": "%s"\n}\n' "$workflow_context_escaped" | cat
|
|
142
|
-
elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -z "${COPILOT_CLI:-}" ]; then
|
|
143
|
-
# Claude Code format
|
|
144
|
-
printf '{\n "hookSpecificOutput": {\n "hookEventName": "UserPromptSubmit",\n "additionalContext": "%s"\n }\n}\n' "$workflow_context_escaped" | cat
|
|
145
|
-
else
|
|
146
|
-
# Copilot CLI or unknown platform
|
|
147
|
-
printf '{\n "additionalContext": "%s"\n}\n' "$workflow_context_escaped" | cat
|
|
148
|
-
fi
|
|
149
|
-
|
|
150
|
-
exit 0
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# Bug 修复 Schema
|
|
2
|
-
# 用于快速定位和修复 Bug 的工件流
|
|
3
|
-
|
|
4
|
-
name: bug-fix
|
|
5
|
-
description: 系统化定位和修复 Bug
|
|
6
|
-
|
|
7
|
-
apply:
|
|
8
|
-
requires:
|
|
9
|
-
- tasks
|
|
10
|
-
|
|
11
|
-
artifacts:
|
|
12
|
-
- id: proposal
|
|
13
|
-
name: Bug 描述
|
|
14
|
-
description: 描述 Bug 现象和复现步骤
|
|
15
|
-
requires: []
|
|
16
|
-
template: proposal.md
|
|
17
|
-
instruction: |
|
|
18
|
-
记录 Bug 信息:
|
|
19
|
-
- Bug 标题
|
|
20
|
-
- 复现步骤(Step 1, 2, 3...)
|
|
21
|
-
- 预期行为
|
|
22
|
-
- 实际行为
|
|
23
|
-
- 环境信息
|
|
24
|
-
- 影响范围
|
|
25
|
-
output: proposal.md
|
|
26
|
-
|
|
27
|
-
- id: analysis
|
|
28
|
-
name: 根因分析
|
|
29
|
-
description: 分析 Bug 根因
|
|
30
|
-
requires: [proposal]
|
|
31
|
-
template: analysis.md
|
|
32
|
-
instruction: |
|
|
33
|
-
根因分析(4 阶段):
|
|
34
|
-
1. 调查 — 收集日志、堆栈、复现
|
|
35
|
-
2. 模式分析 — 识别错误模式
|
|
36
|
-
3. 假设 — 提出根因假设
|
|
37
|
-
4. 验证 — 验证假设正确性
|
|
38
|
-
output: analysis.md
|
|
39
|
-
|
|
40
|
-
- id: fix-plan
|
|
41
|
-
name: 修复计划
|
|
42
|
-
description: 制定修复方案
|
|
43
|
-
requires: [analysis]
|
|
44
|
-
template: fix-plan.md
|
|
45
|
-
instruction: |
|
|
46
|
-
修复方案:
|
|
47
|
-
- 修复策略(热修复/正常修复/重构修复)
|
|
48
|
-
- 修改文件列表
|
|
49
|
-
- 回归测试计划
|
|
50
|
-
output: fix-plan.md
|
|
51
|
-
|
|
52
|
-
- id: tasks
|
|
53
|
-
name: 修复任务
|
|
54
|
-
description: 修复步骤拆分
|
|
55
|
-
requires: [fix-plan]
|
|
56
|
-
template: tasks.md
|
|
57
|
-
instruction: |
|
|
58
|
-
修复任务拆分:
|
|
59
|
-
1. 编写失败测试(复现 Bug)
|
|
60
|
-
2. 修复代码
|
|
61
|
-
3. 验证测试通过
|
|
62
|
-
4. 回归测试
|
|
63
|
-
5. 更新文档
|
|
64
|
-
output: tasks.md
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# 根因分析
|
|
2
|
-
|
|
3
|
-
## 1. 调查
|
|
4
|
-
|
|
5
|
-
### 错误日志
|
|
6
|
-
```
|
|
7
|
-
(关键错误日志)
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### 堆栈跟踪
|
|
11
|
-
```
|
|
12
|
-
(关键堆栈)
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### 复现结果
|
|
16
|
-
- 是否可稳定复现: 是/否
|
|
17
|
-
- 复现频率:
|
|
18
|
-
|
|
19
|
-
## 2. 模式分析
|
|
20
|
-
|
|
21
|
-
### 错误模式
|
|
22
|
-
- 错误类型:
|
|
23
|
-
- 涉及模块:
|
|
24
|
-
- 最近变更:
|
|
25
|
-
|
|
26
|
-
## 3. 假设
|
|
27
|
-
|
|
28
|
-
### 假设 1: [描述]
|
|
29
|
-
- 证据:
|
|
30
|
-
- 验证方法:
|
|
31
|
-
|
|
32
|
-
### 假设 2: [描述]
|
|
33
|
-
- 证据:
|
|
34
|
-
- 验证方法:
|
|
35
|
-
|
|
36
|
-
## 4. 结论
|
|
37
|
-
|
|
38
|
-
### 根因
|
|
39
|
-
[确认的根因描述]
|
|
40
|
-
|
|
41
|
-
### 影响分析
|
|
42
|
-
- 直接影响:
|
|
43
|
-
- 间接影响:
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Bug 描述
|
|
2
|
-
|
|
3
|
-
## Bug 标题
|
|
4
|
-
{{bugTitle}}
|
|
5
|
-
|
|
6
|
-
## 复现步骤
|
|
7
|
-
1.
|
|
8
|
-
2.
|
|
9
|
-
3.
|
|
10
|
-
|
|
11
|
-
## 预期行为
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## 实际行为
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## 环境信息
|
|
18
|
-
- 环境:
|
|
19
|
-
- 版本:
|
|
20
|
-
- 浏览器/客户端:
|
|
21
|
-
|
|
22
|
-
## 影响范围
|
|
23
|
-
- 影响用户:
|
|
24
|
-
- 影响功能:
|
|
25
|
-
- 严重程度: Critical / Major / Minor
|
|
26
|
-
|
|
27
|
-
## 相关日志
|
|
28
|
-
```
|
|
29
|
-
(粘贴错误日志)
|
|
30
|
-
```
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# CRUD 模块 Schema
|
|
2
|
-
# 用于快速生成标准 CRUD 模块的工件流
|
|
3
|
-
|
|
4
|
-
name: crud-module
|
|
5
|
-
description: 快速生成标准 CRUD 模块(Entity/Mapper/Service/Controller/页面)
|
|
6
|
-
|
|
7
|
-
apply:
|
|
8
|
-
requires:
|
|
9
|
-
- tasks
|
|
10
|
-
|
|
11
|
-
artifacts:
|
|
12
|
-
- id: proposal
|
|
13
|
-
name: 模块提案
|
|
14
|
-
description: 描述要生成的 CRUD 模块
|
|
15
|
-
requires: []
|
|
16
|
-
template: proposal.md
|
|
17
|
-
instruction: |
|
|
18
|
-
根据用户描述,生成 CRUD 模块提案。
|
|
19
|
-
包含:模块名称、核心实体、CRUD 操作列表、业务规则。
|
|
20
|
-
output: proposal.md
|
|
21
|
-
|
|
22
|
-
- id: specs
|
|
23
|
-
name: 模块规范
|
|
24
|
-
description: 定义 CRUD 接口规范
|
|
25
|
-
requires: [proposal]
|
|
26
|
-
template: spec.md
|
|
27
|
-
instruction: |
|
|
28
|
-
定义 CRUD 接口规范:
|
|
29
|
-
- GET /api/{entity} — 分页查询
|
|
30
|
-
- GET /api/{entity}/:id — 详情查询
|
|
31
|
-
- POST /api/{entity} — 新增
|
|
32
|
-
- PUT /api/{entity}/:id — 修改
|
|
33
|
-
- DELETE /api/{entity}/:id — 删除
|
|
34
|
-
每个接口定义请求参数和响应格式。
|
|
35
|
-
output: specs/spec.md
|
|
36
|
-
|
|
37
|
-
- id: design
|
|
38
|
-
name: 模块设计
|
|
39
|
-
description: 数据库设计和接口定义
|
|
40
|
-
requires: [proposal, specs]
|
|
41
|
-
template: design.md
|
|
42
|
-
instruction: |
|
|
43
|
-
设计数据库表结构和接口定义:
|
|
44
|
-
- 表结构(字段、类型、索引)
|
|
45
|
-
- 接口签名
|
|
46
|
-
- 前后端分工
|
|
47
|
-
output: design.md
|
|
48
|
-
|
|
49
|
-
- id: tasks
|
|
50
|
-
name: 任务列表
|
|
51
|
-
description: 代码生成任务拆分
|
|
52
|
-
requires: [design]
|
|
53
|
-
template: tasks.md
|
|
54
|
-
instruction: |
|
|
55
|
-
按以下顺序拆分任务:
|
|
56
|
-
1. Entity 实体类
|
|
57
|
-
2. Mapper + XML
|
|
58
|
-
3. Service 接口 + 实现
|
|
59
|
-
4. Controller
|
|
60
|
-
5. 前端 API 接口
|
|
61
|
-
6. 前端列表页
|
|
62
|
-
7. 前端表单页
|
|
63
|
-
8. 菜单注册
|
|
64
|
-
9. 单元测试
|
|
65
|
-
output: tasks.md
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# CRUD 模块设计
|
|
2
|
-
|
|
3
|
-
## 1. 数据库设计
|
|
4
|
-
|
|
5
|
-
### 表结构
|
|
6
|
-
```sql
|
|
7
|
-
CREATE TABLE `{{table_name}}` (
|
|
8
|
-
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
9
|
-
-- 业务字段(根据提案填充)
|
|
10
|
-
`create_by` varchar(64) DEFAULT '' COMMENT '创建人',
|
|
11
|
-
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
12
|
-
`update_by` varchar(64) DEFAULT '' COMMENT '更新人',
|
|
13
|
-
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
14
|
-
`is_deleted` tinyint(1) DEFAULT 0 COMMENT '逻辑删除',
|
|
15
|
-
PRIMARY KEY (`id`)
|
|
16
|
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='{{table_comment}}';
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## 2. 接口定义
|
|
20
|
-
|
|
21
|
-
| Method | Path | 描述 | 请求参数 | 响应 |
|
|
22
|
-
|--------|------|------|----------|------|
|
|
23
|
-
| GET | /api/{{entity}} | 分页查询 | page, size, 查询条件 | PageResult |
|
|
24
|
-
| GET | /api/{{entity}}/:id | 详情 | - | EntityVO |
|
|
25
|
-
| POST | /api/{{entity}} | 新增 | EntityDTO | id |
|
|
26
|
-
| PUT | /api/{{entity}}/:id | 修改 | EntityDTO | - |
|
|
27
|
-
| DELETE | /api/{{entity}}/:id | 删除 | - | - |
|
|
28
|
-
|
|
29
|
-
## 3. 前后端分工
|
|
30
|
-
|
|
31
|
-
| 功能 | 前端 | 后端 |
|
|
32
|
-
|------|------|------|
|
|
33
|
-
| 列表页 | 表格+搜索+分页 | 分页查询接口 |
|
|
34
|
-
| 新增 | 表单弹窗 | 新增接口 |
|
|
35
|
-
| 编辑 | 表单弹窗 | 修改接口 |
|
|
36
|
-
| 删除 | 确认弹窗 | 删除接口 |
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# CRUD 模块提案
|
|
2
|
-
|
|
3
|
-
## 模块名称
|
|
4
|
-
{{moduleName}}
|
|
5
|
-
|
|
6
|
-
## 核心实体
|
|
7
|
-
- 实体名:
|
|
8
|
-
- 表名:
|
|
9
|
-
- 描述:
|
|
10
|
-
|
|
11
|
-
## CRUD 操作
|
|
12
|
-
- [ ] 分页查询(列表)
|
|
13
|
-
- [ ] 详情查询
|
|
14
|
-
- [ ] 新增
|
|
15
|
-
- [ ] 修改
|
|
16
|
-
- [ ] 删除
|
|
17
|
-
- [ ] 导出(可选)
|
|
18
|
-
- [ ] 导入(可选)
|
|
19
|
-
|
|
20
|
-
## 业务规则
|
|
21
|
-
1.
|
|
22
|
-
2.
|
|
23
|
-
|
|
24
|
-
## 字段清单
|
|
25
|
-
| 字段名 | 类型 | 必填 | 说明 |
|
|
26
|
-
|--------|------|------|------|
|
|
27
|
-
| | | | |
|
|
28
|
-
|
|
29
|
-
## 非目标
|
|
30
|
-
- 不包含:
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# CRUD 接口规范
|
|
2
|
-
|
|
3
|
-
## ADDED
|
|
4
|
-
|
|
5
|
-
### Requirement: 分页查询
|
|
6
|
-
|
|
7
|
-
系统应当提供 `GET /api/{{entity}}` 接口,支持分页查询。
|
|
8
|
-
|
|
9
|
-
**验收标准:**
|
|
10
|
-
- **Given** 数据库中存在 {{entity}} 记录
|
|
11
|
-
- **When** 用户请求 `GET /api/{{entity}}?page=1&size=10`
|
|
12
|
-
- **Then** 返回分页数据,包含 total、list、page、size
|
|
13
|
-
|
|
14
|
-
### Requirement: 详情查询
|
|
15
|
-
|
|
16
|
-
系统应当提供 `GET /api/{{entity}}/:id` 接口。
|
|
17
|
-
|
|
18
|
-
**验收标准:**
|
|
19
|
-
- **Given** 存在 ID 为 1 的记录
|
|
20
|
-
- **When** 用户请求 `GET /api/{{entity}}/1`
|
|
21
|
-
- **Then** 返回该记录详情
|
|
22
|
-
|
|
23
|
-
### Requirement: 新增
|
|
24
|
-
|
|
25
|
-
系统应当提供 `POST /api/{{entity}}` 接口。
|
|
26
|
-
|
|
27
|
-
**验收标准:**
|
|
28
|
-
- **Given** 用户提供必填字段
|
|
29
|
-
- **When** 用户请求 `POST /api/{{entity}}`
|
|
30
|
-
- **Then** 创建记录并返回新 ID
|
|
31
|
-
|
|
32
|
-
### Requirement: 修改
|
|
33
|
-
|
|
34
|
-
系统应当提供 `PUT /api/{{entity}}/:id` 接口。
|
|
35
|
-
|
|
36
|
-
### Requirement: 删除
|
|
37
|
-
|
|
38
|
-
系统应当提供 `DELETE /api/{{entity}}/:id` 接口(逻辑删除)。
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# CRUD 任务列表
|
|
2
|
-
|
|
3
|
-
## 全局约束
|
|
4
|
-
- 分支: feature/{{branch}}
|
|
5
|
-
- 基础: main 分支最新代码
|
|
6
|
-
|
|
7
|
-
## 后端任务
|
|
8
|
-
|
|
9
|
-
### Task-001: 创建 Entity
|
|
10
|
-
- 文件: `src/main/java/com/company/{{module}}/entity/{{Entity}}.java`
|
|
11
|
-
- 依赖: 无
|
|
12
|
-
- 描述: 创建实体类,字段与数据库对应
|
|
13
|
-
- 验证: 编译通过
|
|
14
|
-
|
|
15
|
-
### Task-002: 创建 Mapper
|
|
16
|
-
- 文件: `src/main/java/com/company/{{module}}/mapper/{{Entity}}Mapper.java`, `src/main/resources/mapper/{{Entity}}Mapper.xml`
|
|
17
|
-
- 依赖: Task-001
|
|
18
|
-
- 描述: 创建数据访问层
|
|
19
|
-
- 验证: 编译通过
|
|
20
|
-
|
|
21
|
-
### Task-003: 创建 Service
|
|
22
|
-
- 文件: `src/main/java/com/company/{{module}}/service/{{Entity}}Service.java`, `src/main/java/com/company/{{module}}/service/impl/{{Entity}}ServiceImpl.java`
|
|
23
|
-
- 依赖: Task-002
|
|
24
|
-
- 描述: 创建业务逻辑层(CRUD 方法)
|
|
25
|
-
- 验证: 编译通过
|
|
26
|
-
|
|
27
|
-
### Task-004: 创建 Controller
|
|
28
|
-
- 文件: `src/main/java/com/company/{{module}}/controller/{{Entity}}Controller.java`
|
|
29
|
-
- 依赖: Task-003
|
|
30
|
-
- 描述: 创建 RESTful 接口
|
|
31
|
-
- 验证: 编译通过,接口可访问
|
|
32
|
-
|
|
33
|
-
## 前端任务
|
|
34
|
-
|
|
35
|
-
### Task-005: 创建 API 接口文件
|
|
36
|
-
- 文件: `src/api/{{entity}}.js`
|
|
37
|
-
- 依赖: Task-004
|
|
38
|
-
- 描述: 封装 axios 请求
|
|
39
|
-
- 验证: 无语法错误
|
|
40
|
-
|
|
41
|
-
### Task-006: 创建列表页
|
|
42
|
-
- 文件: `src/views/{{module}}/{{entity}}/index.vue`
|
|
43
|
-
- 依赖: Task-005
|
|
44
|
-
- 描述: 列表页(搜索+表格+分页+操作按钮)
|
|
45
|
-
- 验证: 页面可渲染
|
|
46
|
-
|
|
47
|
-
### Task-007: 创建表单弹窗
|
|
48
|
-
- 文件: `src/views/{{module}}/{{entity}}/form.vue`
|
|
49
|
-
- 依赖: Task-005
|
|
50
|
-
- 描述: 新增/编辑表单弹窗
|
|
51
|
-
- 验证: 表单验证生效
|
|
52
|
-
|
|
53
|
-
### Task-008: 注册路由和菜单
|
|
54
|
-
- 文件: `src/router/modules/{{module}}.js`
|
|
55
|
-
- 依赖: Task-006
|
|
56
|
-
- 描述: 配置路由和菜单 SQL
|
|
57
|
-
- 验证: 菜单可见,页面可访问
|