cowork-flow 0.0.3 → 0.0.5

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -10
  3. package/package.json +6 -4
  4. package/src/lib/copy-template.js +15 -11
  5. package/src/lib/package-info.js +8 -2
  6. package/template/.agent/skills/agent-team-execution/SKILL.md +26 -0
  7. package/template/{.superpowers → .agent/skills}/brainstorming/SKILL.md +1 -1
  8. package/template/{.superpowers → .agent/skills}/brainstorming/scripts/start-server.sh +0 -0
  9. package/template/{.superpowers → .agent/skills}/brainstorming/scripts/stop-server.sh +0 -0
  10. package/template/.agent/skills/record-session/SKILL.md +8 -8
  11. package/template/.agent/skills/start/SKILL.md +29 -24
  12. package/template/.cowork-flow/.version +1 -1
  13. package/template/.cowork-flow/agent-team/adapters.yaml +15 -0
  14. package/template/.cowork-flow/agent-team/agents.yaml +68 -0
  15. package/template/.cowork-flow/agent-team/policy.yaml +23 -0
  16. package/template/.cowork-flow/config.yaml +9 -0
  17. package/template/.cowork-flow/run +166 -0
  18. package/template/.cowork-flow/run.cmd +198 -0
  19. package/template/.cowork-flow/scripts/add_session.py +2 -2
  20. package/template/.cowork-flow/scripts/agent_team.py +508 -0
  21. package/template/.cowork-flow/scripts/change.py +5 -11
  22. package/template/.cowork-flow/scripts/common/agent_team.py +241 -0
  23. package/template/.cowork-flow/scripts/common/config.py +18 -0
  24. package/template/.cowork-flow/scripts/common/developer.py +1 -1
  25. package/template/.cowork-flow/scripts/common/git_context.py +21 -4
  26. package/template/.cowork-flow/scripts/get_context.py +2 -2
  27. package/template/.cowork-flow/scripts/init_developer.py +1 -1
  28. package/template/.cowork-flow/scripts/task.py +45 -45
  29. package/template/.cowork-flow/workflow.md +61 -175
  30. package/template/.cowork-flow/workspace/index.md +3 -3
  31. package/template/.superpowers/executing-plans/SKILL.md +2 -0
  32. package/template/AGENTS.md +6 -3
  33. /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/frame-template.html +0 -0
  34. /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/helper.js +0 -0
  35. /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/server.cjs +0 -0
  36. /package/template/{.superpowers → .agent/skills}/brainstorming/spec-document-reviewer-prompt.md +0 -0
  37. /package/template/{.superpowers → .agent/skills}/brainstorming/visual-companion.md +0 -0
  38. /package/template/{.superpowers → .agent/skills}/requesting-code-review/SKILL.md +0 -0
  39. /package/template/{.superpowers → .agent/skills}/requesting-code-review/code-reviewer.md +0 -0
  40. /package/template/{.superpowers → .agent/skills}/subagent-driven-development/SKILL.md +0 -0
  41. /package/template/{.superpowers → .agent/skills}/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
  42. /package/template/{.superpowers → .agent/skills}/subagent-driven-development/implementer-prompt.md +0 -0
  43. /package/template/{.superpowers → .agent/skills}/subagent-driven-development/spec-reviewer-prompt.md +0 -0
  44. /package/template/{.superpowers → .agent/skills}/writing-plans/SKILL.md +0 -0
  45. /package/template/{.superpowers → .agent/skills}/writing-plans/plan-document-reviewer-prompt.md +0 -0
@@ -0,0 +1,166 @@
1
+ #!/bin/sh
2
+ set -u
3
+
4
+ MIN_PYTHON_LABEL="Python 3.8+"
5
+ VERSION_CHECK='import sys; raise SystemExit(0 if sys.version_info >= (3, 8) else 1)'
6
+
7
+ WORKFLOW_DIR=$(CDPATH= cd "$(dirname "$0")" && pwd) || exit 1
8
+ SCRIPTS_DIR="$WORKFLOW_DIR/scripts"
9
+
10
+ print_usage() {
11
+ cat <<'EOF'
12
+ 用法:
13
+ ./.cowork-flow/run <command> [args...]
14
+ ./.cowork-flow/run python [python-args...]
15
+
16
+ 常用 command:
17
+ resume
18
+ task
19
+ change
20
+ get-context
21
+ get-developer
22
+ init-developer
23
+ add-session
24
+ agent-team
25
+
26
+ 解释器选择顺序:
27
+ COWORK_FLOW_PYTHON -> PYTHON -> python3 -> python -> py -3
28
+ EOF
29
+ }
30
+
31
+ candidate_is_valid() {
32
+ candidate_cmd=$1
33
+ candidate_arg=${2:-}
34
+
35
+ command -v "$candidate_cmd" >/dev/null 2>&1 || return 1
36
+
37
+ if [ -n "$candidate_arg" ]; then
38
+ "$candidate_cmd" "$candidate_arg" -c "$VERSION_CHECK" >/dev/null 2>&1
39
+ else
40
+ "$candidate_cmd" -c "$VERSION_CHECK" >/dev/null 2>&1
41
+ fi
42
+ }
43
+
44
+ select_explicit_python() {
45
+ env_name=$1
46
+ env_value=$2
47
+
48
+ if candidate_is_valid "$env_value"; then
49
+ SELECTED_PYTHON=$env_value
50
+ SELECTED_PYTHON_ARG=
51
+ return 0
52
+ fi
53
+
54
+ echo "错误:$env_name 指向的解释器不可用或版本低于 ${MIN_PYTHON_LABEL}:$env_value" >&2
55
+ echo "请设置 $env_name 为可执行的 Python 3.8+ 解释器路径。" >&2
56
+ exit 127
57
+ }
58
+
59
+ select_python() {
60
+ SELECTED_PYTHON=
61
+ SELECTED_PYTHON_ARG=
62
+
63
+ if [ -n "${COWORK_FLOW_PYTHON:-}" ]; then
64
+ select_explicit_python "COWORK_FLOW_PYTHON" "$COWORK_FLOW_PYTHON"
65
+ return 0
66
+ fi
67
+
68
+ if [ -n "${PYTHON:-}" ]; then
69
+ select_explicit_python "PYTHON" "$PYTHON"
70
+ return 0
71
+ fi
72
+
73
+ if candidate_is_valid "python3"; then
74
+ SELECTED_PYTHON=python3
75
+ return 0
76
+ fi
77
+
78
+ if candidate_is_valid "python"; then
79
+ SELECTED_PYTHON=python
80
+ return 0
81
+ fi
82
+
83
+ if candidate_is_valid "py" "-3"; then
84
+ SELECTED_PYTHON=py
85
+ SELECTED_PYTHON_ARG=-3
86
+ return 0
87
+ fi
88
+
89
+ echo "错误:需要 ${MIN_PYTHON_LABEL},但未找到可用解释器。" >&2
90
+ echo "已尝试:COWORK_FLOW_PYTHON、PYTHON、python3、python、py -3。" >&2
91
+ echo "可设置 COWORK_FLOW_PYTHON=/path/to/python3 后重试。" >&2
92
+ exit 127
93
+ }
94
+
95
+ exec_python() {
96
+ select_python
97
+
98
+ if [ -n "$SELECTED_PYTHON_ARG" ]; then
99
+ exec "$SELECTED_PYTHON" "$SELECTED_PYTHON_ARG" "$@"
100
+ fi
101
+
102
+ exec "$SELECTED_PYTHON" "$@"
103
+ }
104
+
105
+ run_script() {
106
+ script_path=$1
107
+ shift
108
+
109
+ if [ ! -f "$script_path" ]; then
110
+ echo "错误:找不到脚本:$script_path" >&2
111
+ exit 2
112
+ fi
113
+
114
+ exec_python "$script_path" "$@"
115
+ }
116
+
117
+ if [ "$#" -eq 0 ]; then
118
+ print_usage >&2
119
+ exit 2
120
+ fi
121
+
122
+ command_name=$1
123
+ shift
124
+
125
+ case "$command_name" in
126
+ -h|--help|help)
127
+ print_usage
128
+ exit 0
129
+ ;;
130
+ python)
131
+ exec_python "$@"
132
+ ;;
133
+ resume)
134
+ run_script "$SCRIPTS_DIR/resume.py" "$@"
135
+ ;;
136
+ task)
137
+ run_script "$SCRIPTS_DIR/task.py" "$@"
138
+ ;;
139
+ change)
140
+ run_script "$SCRIPTS_DIR/change.py" "$@"
141
+ ;;
142
+ get-context|get_context)
143
+ run_script "$SCRIPTS_DIR/get_context.py" "$@"
144
+ ;;
145
+ get-developer|get_developer)
146
+ run_script "$SCRIPTS_DIR/get_developer.py" "$@"
147
+ ;;
148
+ init-developer|init_developer)
149
+ run_script "$SCRIPTS_DIR/init_developer.py" "$@"
150
+ ;;
151
+ add-session|add_session)
152
+ run_script "$SCRIPTS_DIR/add_session.py" "$@"
153
+ ;;
154
+ agent-team|agent_team)
155
+ run_script "$SCRIPTS_DIR/agent_team.py" "$@"
156
+ ;;
157
+ *)
158
+ if [ -f "$SCRIPTS_DIR/$command_name.py" ]; then
159
+ run_script "$SCRIPTS_DIR/$command_name.py" "$@"
160
+ fi
161
+
162
+ echo "错误:未知 cowork-flow 命令:$command_name" >&2
163
+ print_usage >&2
164
+ exit 2
165
+ ;;
166
+ esac
@@ -0,0 +1,198 @@
1
+ @echo off
2
+ setlocal EnableExtensions
3
+
4
+ set "MIN_PYTHON_LABEL=Python 3.8+"
5
+ set "VERSION_CHECK=import sys; raise SystemExit(0 if sys.version_info >= (3, 8) else 1)"
6
+ set "WORKFLOW_DIR=%~dp0"
7
+ set "SCRIPTS_DIR=%WORKFLOW_DIR%scripts"
8
+ set "SELECTED_PYTHON="
9
+ set "SELECTED_PYTHON_ARG="
10
+ set "REST_ARGS="
11
+
12
+ if "%~1"=="" goto usage_error
13
+
14
+ set "COMMAND_NAME=%~1"
15
+ if not "%~2"=="" (
16
+ for /F "tokens=1,* delims= " %%A in ("%*") do set "REST_ARGS=%%B"
17
+ )
18
+
19
+ if /I "%COMMAND_NAME%"=="-h" goto usage
20
+ if /I "%COMMAND_NAME%"=="--help" goto usage
21
+ if /I "%COMMAND_NAME%"=="help" goto usage
22
+ if /I "%COMMAND_NAME%"=="python" goto run_python_passthrough
23
+ if /I "%COMMAND_NAME%"=="resume" goto run_resume
24
+ if /I "%COMMAND_NAME%"=="task" goto run_task
25
+ if /I "%COMMAND_NAME%"=="change" goto run_change
26
+ if /I "%COMMAND_NAME%"=="get-context" goto run_get_context
27
+ if /I "%COMMAND_NAME%"=="get_context" goto run_get_context
28
+ if /I "%COMMAND_NAME%"=="get-developer" goto run_get_developer
29
+ if /I "%COMMAND_NAME%"=="get_developer" goto run_get_developer
30
+ if /I "%COMMAND_NAME%"=="init-developer" goto run_init_developer
31
+ if /I "%COMMAND_NAME%"=="init_developer" goto run_init_developer
32
+ if /I "%COMMAND_NAME%"=="add-session" goto run_add_session
33
+ if /I "%COMMAND_NAME%"=="add_session" goto run_add_session
34
+ if /I "%COMMAND_NAME%"=="agent-team" goto run_agent_team
35
+ if /I "%COMMAND_NAME%"=="agent_team" goto run_agent_team
36
+
37
+ if exist "%SCRIPTS_DIR%\%COMMAND_NAME%.py" (
38
+ call :run_script "%SCRIPTS_DIR%\%COMMAND_NAME%.py"
39
+ exit /b %ERRORLEVEL%
40
+ )
41
+
42
+ echo 错误:未知 cowork-flow 命令:%COMMAND_NAME% 1>&2
43
+ call :print_usage 1>&2
44
+ exit /b 2
45
+
46
+ :usage
47
+ call :print_usage
48
+ exit /b 0
49
+
50
+ :usage_error
51
+ call :print_usage 1>&2
52
+ exit /b 2
53
+
54
+ :run_python_passthrough
55
+ call :exec_python %REST_ARGS%
56
+ exit /b %ERRORLEVEL%
57
+
58
+ :run_resume
59
+ call :run_script "%SCRIPTS_DIR%\resume.py"
60
+ exit /b %ERRORLEVEL%
61
+
62
+ :run_task
63
+ call :run_script "%SCRIPTS_DIR%\task.py"
64
+ exit /b %ERRORLEVEL%
65
+
66
+ :run_change
67
+ call :run_script "%SCRIPTS_DIR%\change.py"
68
+ exit /b %ERRORLEVEL%
69
+
70
+ :run_get_context
71
+ call :run_script "%SCRIPTS_DIR%\get_context.py"
72
+ exit /b %ERRORLEVEL%
73
+
74
+ :run_get_developer
75
+ call :run_script "%SCRIPTS_DIR%\get_developer.py"
76
+ exit /b %ERRORLEVEL%
77
+
78
+ :run_init_developer
79
+ call :run_script "%SCRIPTS_DIR%\init_developer.py"
80
+ exit /b %ERRORLEVEL%
81
+
82
+ :run_add_session
83
+ call :run_script "%SCRIPTS_DIR%\add_session.py"
84
+ exit /b %ERRORLEVEL%
85
+
86
+ :run_agent_team
87
+ call :run_script "%SCRIPTS_DIR%\agent_team.py"
88
+ exit /b %ERRORLEVEL%
89
+
90
+ :print_usage
91
+ echo 用法:
92
+ echo .\.cowork-flow\run.cmd ^<command^> [args...]
93
+ echo .\.cowork-flow\run.cmd python [python-args...]
94
+ echo.
95
+ echo 常用 command:
96
+ echo resume
97
+ echo task
98
+ echo change
99
+ echo get-context
100
+ echo get-developer
101
+ echo init-developer
102
+ echo add-session
103
+ echo agent-team
104
+ echo.
105
+ echo 解释器选择顺序:
106
+ echo COWORK_FLOW_PYTHON -^> PYTHON -^> python3 -^> python -^> py -3
107
+ exit /b 0
108
+
109
+ :candidate_is_valid
110
+ set "CANDIDATE_CMD=%~1"
111
+ set "CANDIDATE_ARG=%~2"
112
+
113
+ where "%CANDIDATE_CMD%" >nul 2>nul
114
+ if errorlevel 1 (
115
+ if not exist "%CANDIDATE_CMD%" exit /b 1
116
+ )
117
+
118
+ if not "%CANDIDATE_ARG%"=="" (
119
+ "%CANDIDATE_CMD%" "%CANDIDATE_ARG%" -c "%VERSION_CHECK%" >nul 2>nul
120
+ ) else (
121
+ "%CANDIDATE_CMD%" -c "%VERSION_CHECK%" >nul 2>nul
122
+ )
123
+ exit /b %ERRORLEVEL%
124
+
125
+ :select_explicit_python
126
+ set "ENV_NAME=%~1"
127
+ set "ENV_VALUE=%~2"
128
+
129
+ call :candidate_is_valid "%ENV_VALUE%" ""
130
+ if not errorlevel 1 (
131
+ set "SELECTED_PYTHON=%ENV_VALUE%"
132
+ set "SELECTED_PYTHON_ARG="
133
+ exit /b 0
134
+ )
135
+
136
+ echo 错误:%ENV_NAME% 指向的解释器不可用或版本低于 %MIN_PYTHON_LABEL%:%ENV_VALUE% 1>&2
137
+ echo 请设置 %ENV_NAME% 为可执行的 Python 3.8+ 解释器路径。 1>&2
138
+ exit /b 127
139
+
140
+ :select_python
141
+ set "SELECTED_PYTHON="
142
+ set "SELECTED_PYTHON_ARG="
143
+
144
+ if not "%COWORK_FLOW_PYTHON%"=="" (
145
+ call :select_explicit_python "COWORK_FLOW_PYTHON" "%COWORK_FLOW_PYTHON%"
146
+ exit /b %ERRORLEVEL%
147
+ )
148
+
149
+ if not "%PYTHON%"=="" (
150
+ call :select_explicit_python "PYTHON" "%PYTHON%"
151
+ exit /b %ERRORLEVEL%
152
+ )
153
+
154
+ call :candidate_is_valid "python3" ""
155
+ if not errorlevel 1 (
156
+ set "SELECTED_PYTHON=python3"
157
+ exit /b 0
158
+ )
159
+
160
+ call :candidate_is_valid "python" ""
161
+ if not errorlevel 1 (
162
+ set "SELECTED_PYTHON=python"
163
+ exit /b 0
164
+ )
165
+
166
+ call :candidate_is_valid "py" "-3"
167
+ if not errorlevel 1 (
168
+ set "SELECTED_PYTHON=py"
169
+ set "SELECTED_PYTHON_ARG=-3"
170
+ exit /b 0
171
+ )
172
+
173
+ echo 错误:需要 %MIN_PYTHON_LABEL%,但未找到可用解释器。 1>&2
174
+ echo 已尝试:COWORK_FLOW_PYTHON、PYTHON、python3、python、py -3。 1>&2
175
+ echo 可设置 COWORK_FLOW_PYTHON=C:\Path\To\python.exe 后重试。 1>&2
176
+ exit /b 127
177
+
178
+ :exec_python
179
+ call :select_python
180
+ if errorlevel 1 exit /b %ERRORLEVEL%
181
+
182
+ if not "%SELECTED_PYTHON_ARG%"=="" (
183
+ "%SELECTED_PYTHON%" "%SELECTED_PYTHON_ARG%" %*
184
+ ) else (
185
+ "%SELECTED_PYTHON%" %*
186
+ )
187
+ exit /b %ERRORLEVEL%
188
+
189
+ :run_script
190
+ set "SCRIPT_PATH=%~1"
191
+
192
+ if not exist "%SCRIPT_PATH%" (
193
+ echo 错误:找不到脚本:%SCRIPT_PATH% 1>&2
194
+ exit /b 2
195
+ )
196
+
197
+ call :exec_python "%SCRIPT_PATH%" %REST_ARGS%
198
+ exit /b %ERRORLEVEL%
@@ -4,8 +4,8 @@
4
4
  Add a new session to journal file and update index.md.
5
5
 
6
6
  Usage:
7
- python3 add_session.py --title "Title" --commit "hash" --summary "Summary"
8
- echo "content" | python3 add_session.py --title "Title" --commit "hash"
7
+ ./.cowork-flow/run add-session --title "Title" --commit "hash" --summary "Summary"
8
+ echo "content" | ./.cowork-flow/run add-session --title "Title" --commit "hash"
9
9
  """
10
10
 
11
11
  from __future__ import annotations