cowork-flow 0.0.1

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 (101) hide show
  1. package/README.md +193 -0
  2. package/bin/cowork-flow.js +9 -0
  3. package/package.json +28 -0
  4. package/src/cli.js +61 -0
  5. package/src/commands/init.js +88 -0
  6. package/src/commands/sync.js +33 -0
  7. package/src/commands/update.js +60 -0
  8. package/src/lib/copy-template.js +189 -0
  9. package/src/lib/package-info.js +49 -0
  10. package/src/lib/paths.js +6 -0
  11. package/template/.agent/skills/break-loop/SKILL.md +131 -0
  12. package/template/.agent/skills/check-cross-layer/SKILL.md +158 -0
  13. package/template/.agent/skills/finish-work/SKILL.md +163 -0
  14. package/template/.agent/skills/record-session/SKILL.md +78 -0
  15. package/template/.agent/skills/start/SKILL.md +390 -0
  16. package/template/.agent/skills/update-spec/SKILL.md +335 -0
  17. package/template/.cowork-flow/.version +1 -0
  18. package/template/.cowork-flow/changes/archive/.gitkeep +1 -0
  19. package/template/.cowork-flow/config.yaml +49 -0
  20. package/template/.cowork-flow/plans/.gitkeep +1 -0
  21. package/template/.cowork-flow/scripts/add_session.py +441 -0
  22. package/template/.cowork-flow/scripts/change.py +314 -0
  23. package/template/.cowork-flow/scripts/common/__init__.py +84 -0
  24. package/template/.cowork-flow/scripts/common/config.py +128 -0
  25. package/template/.cowork-flow/scripts/common/developer.py +205 -0
  26. package/template/.cowork-flow/scripts/common/files.py +24 -0
  27. package/template/.cowork-flow/scripts/common/git_context.py +628 -0
  28. package/template/.cowork-flow/scripts/common/paths.py +350 -0
  29. package/template/.cowork-flow/scripts/common/task_utils.py +200 -0
  30. package/template/.cowork-flow/scripts/get_context.py +16 -0
  31. package/template/.cowork-flow/scripts/get_developer.py +26 -0
  32. package/template/.cowork-flow/scripts/init_developer.py +51 -0
  33. package/template/.cowork-flow/scripts/task.py +1378 -0
  34. package/template/.cowork-flow/spec/backend/database-guidelines.md +26 -0
  35. package/template/.cowork-flow/spec/backend/directory-structure.md +27 -0
  36. package/template/.cowork-flow/spec/backend/error-handling.md +20 -0
  37. package/template/.cowork-flow/spec/backend/index.md +36 -0
  38. package/template/.cowork-flow/spec/backend/logging-guidelines.md +20 -0
  39. package/template/.cowork-flow/spec/backend/quality-guidelines.md +24 -0
  40. package/template/.cowork-flow/spec/frontend/component-guidelines.md +19 -0
  41. package/template/.cowork-flow/spec/frontend/directory-structure.md +18 -0
  42. package/template/.cowork-flow/spec/frontend/hook-guidelines.md +17 -0
  43. package/template/.cowork-flow/spec/frontend/index.md +28 -0
  44. package/template/.cowork-flow/spec/frontend/quality-guidelines.md +23 -0
  45. package/template/.cowork-flow/spec/frontend/state-management.md +18 -0
  46. package/template/.cowork-flow/spec/frontend/type-safety.md +18 -0
  47. package/template/.cowork-flow/spec/guides/code-reuse-thinking-guide.md +26 -0
  48. package/template/.cowork-flow/spec/guides/cross-layer-thinking-guide.md +21 -0
  49. package/template/.cowork-flow/spec/guides/index.md +31 -0
  50. package/template/.cowork-flow/spec/guides/pre-implementation-checklist.md +15 -0
  51. package/template/.cowork-flow/tasks/.gitkeep +1 -0
  52. package/template/.cowork-flow/tasks/archive/.gitkeep +1 -0
  53. package/template/.cowork-flow/workflow.md +411 -0
  54. package/template/.cowork-flow/workspace/index.md +95 -0
  55. package/template/.superpowers/brainstorming/SKILL.md +164 -0
  56. package/template/.superpowers/brainstorming/scripts/frame-template.html +214 -0
  57. package/template/.superpowers/brainstorming/scripts/helper.js +88 -0
  58. package/template/.superpowers/brainstorming/scripts/server.cjs +354 -0
  59. package/template/.superpowers/brainstorming/scripts/start-server.sh +148 -0
  60. package/template/.superpowers/brainstorming/scripts/stop-server.sh +56 -0
  61. package/template/.superpowers/brainstorming/spec-document-reviewer-prompt.md +49 -0
  62. package/template/.superpowers/brainstorming/visual-companion.md +287 -0
  63. package/template/.superpowers/dispatching-parallel-agents/SKILL.md +182 -0
  64. package/template/.superpowers/executing-plans/SKILL.md +70 -0
  65. package/template/.superpowers/finishing-a-development-branch/SKILL.md +251 -0
  66. package/template/.superpowers/receiving-code-review/SKILL.md +213 -0
  67. package/template/.superpowers/requesting-code-review/SKILL.md +103 -0
  68. package/template/.superpowers/requesting-code-review/code-reviewer.md +168 -0
  69. package/template/.superpowers/subagent-driven-development/SKILL.md +279 -0
  70. package/template/.superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
  71. package/template/.superpowers/subagent-driven-development/implementer-prompt.md +113 -0
  72. package/template/.superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  73. package/template/.superpowers/systematic-debugging/CREATION-LOG.md +119 -0
  74. package/template/.superpowers/systematic-debugging/SKILL.md +296 -0
  75. package/template/.superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
  76. package/template/.superpowers/systematic-debugging/condition-based-waiting.md +115 -0
  77. package/template/.superpowers/systematic-debugging/defense-in-depth.md +122 -0
  78. package/template/.superpowers/systematic-debugging/find-polluter.sh +63 -0
  79. package/template/.superpowers/systematic-debugging/root-cause-tracing.md +169 -0
  80. package/template/.superpowers/systematic-debugging/test-academic.md +14 -0
  81. package/template/.superpowers/systematic-debugging/test-pressure-1.md +58 -0
  82. package/template/.superpowers/systematic-debugging/test-pressure-2.md +68 -0
  83. package/template/.superpowers/systematic-debugging/test-pressure-3.md +69 -0
  84. package/template/.superpowers/test-driven-development/SKILL.md +371 -0
  85. package/template/.superpowers/test-driven-development/testing-anti-patterns.md +299 -0
  86. package/template/.superpowers/using-git-worktrees/SKILL.md +215 -0
  87. package/template/.superpowers/using-superpowers/SKILL.md +117 -0
  88. package/template/.superpowers/using-superpowers/references/codex-tools.md +59 -0
  89. package/template/.superpowers/using-superpowers/references/copilot-tools.md +42 -0
  90. package/template/.superpowers/using-superpowers/references/gemini-tools.md +51 -0
  91. package/template/.superpowers/verification-before-completion/SKILL.md +139 -0
  92. package/template/.superpowers/writing-plans/SKILL.md +152 -0
  93. package/template/.superpowers/writing-plans/plan-document-reviewer-prompt.md +49 -0
  94. package/template/.superpowers/writing-skills/SKILL.md +655 -0
  95. package/template/.superpowers/writing-skills/anthropic-best-practices.md +1150 -0
  96. package/template/.superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  97. package/template/.superpowers/writing-skills/graphviz-conventions.dot +172 -0
  98. package/template/.superpowers/writing-skills/persuasion-principles.md +187 -0
  99. package/template/.superpowers/writing-skills/render-graphs.js +168 -0
  100. package/template/.superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
  101. package/template/AGENTS.md +116 -0
@@ -0,0 +1,205 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Developer management utilities.
4
+
5
+ Provides:
6
+ init_developer - Initialize developer
7
+ ensure_developer - Ensure developer is initialized (exit if not)
8
+ show_developer_info - Show developer information
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import sys
14
+ from datetime import datetime
15
+ from pathlib import Path
16
+
17
+ from .paths import (
18
+ DIR_WORKFLOW,
19
+ DIR_WORKSPACE,
20
+ DIR_TASKS,
21
+ FILE_DEVELOPER,
22
+ FILE_JOURNAL_PREFIX,
23
+ get_repo_root,
24
+ get_developer,
25
+ check_developer,
26
+ )
27
+
28
+
29
+ # =============================================================================
30
+ # Developer Initialization
31
+ # =============================================================================
32
+
33
+ INITIAL_JOURNAL_NUMBER = 1
34
+ INDEX_FILE_NAME = "index.md"
35
+
36
+
37
+ def _initial_journal_content(name: str, today: str) -> str:
38
+ """Build the initial journal file content."""
39
+ return f"""# Development Journal - {name} (Part 1)
40
+
41
+ > AI development session journal
42
+ > Start date: {today}
43
+
44
+ ---
45
+
46
+ """
47
+
48
+
49
+ def _initial_index_content(name: str) -> str:
50
+ """Build the initial workspace index content."""
51
+ return f"""# Workspace Index - {name}
52
+
53
+ > Tracks AI development session records.
54
+
55
+ ---
56
+
57
+ ## Current Status
58
+
59
+ <!-- @@@auto:current-status -->
60
+ - **Current file**: `journal-1.md`
61
+ - **Total Sessions**: 0
62
+ - **Last Active**: -
63
+ <!-- @@@/auto:current-status -->
64
+
65
+ ---
66
+
67
+ ## Active Documents
68
+
69
+ <!-- @@@auto:active-documents -->
70
+ | File | Lines | Status |
71
+ |------|------|------|
72
+ | `journal-1.md` | ~0 | Current |
73
+ <!-- @@@/auto:active-documents -->
74
+
75
+ ---
76
+
77
+ ## Session History
78
+
79
+ <!-- @@@auto:session-history -->
80
+ | # | Date | Title | Commit |
81
+ |---|------|------|------|
82
+ <!-- @@@/auto:session-history -->
83
+
84
+ ---
85
+
86
+ ## Notes
87
+
88
+ - Sessions are appended to the journal file
89
+ - A new journal file is created automatically after the current file exceeds 2000 lines
90
+ - Use `add_session.py` to record sessions
91
+ - New records use English text; legacy records can remain as they are
92
+ """
93
+
94
+
95
+ def init_developer(name: str, repo_root: Path | None = None) -> bool:
96
+ """Initialize developer.
97
+
98
+ Creates:
99
+ - .cowork-flow/.developer file with developer info
100
+ - .cowork-flow/workspace/<name>/ directory structure
101
+ - Initial journal file and index.md
102
+
103
+ Args:
104
+ name: Developer name.
105
+ repo_root: Repository root path. Defaults to auto-detected.
106
+
107
+ Returns:
108
+ True on success, False on error.
109
+ """
110
+ if not name:
111
+ print("Error: developer name cannot be empty.", file=sys.stderr)
112
+ return False
113
+
114
+ if repo_root is None:
115
+ repo_root = get_repo_root()
116
+
117
+ dev_file = repo_root / DIR_WORKFLOW / FILE_DEVELOPER
118
+ workspace_dir = repo_root / DIR_WORKFLOW / DIR_WORKSPACE / name
119
+
120
+ # Create .developer file
121
+ initialized_at = datetime.now().isoformat()
122
+ try:
123
+ dev_file.write_text(
124
+ f"name={name}\ninitialized_at={initialized_at}\n",
125
+ encoding="utf-8"
126
+ )
127
+ except (OSError, IOError) as e:
128
+ print(f"Error: failed to create .developer file: {e}", file=sys.stderr)
129
+ return False
130
+
131
+ # Create workspace directory structure
132
+ try:
133
+ workspace_dir.mkdir(parents=True, exist_ok=True)
134
+ except (OSError, IOError) as e:
135
+ print(f"Error: failed to create workspace directory: {e}", file=sys.stderr)
136
+ return False
137
+
138
+ # Create initial journal file
139
+ journal_file = workspace_dir / f"{FILE_JOURNAL_PREFIX}{INITIAL_JOURNAL_NUMBER}.md"
140
+ if not journal_file.exists():
141
+ today = datetime.now().strftime("%Y-%m-%d")
142
+ journal_content = _initial_journal_content(name, today)
143
+ try:
144
+ journal_file.write_text(journal_content, encoding="utf-8")
145
+ except (OSError, IOError) as e:
146
+ print(f"Error: failed to create journal file: {e}", file=sys.stderr)
147
+ return False
148
+
149
+ # Create index.md with markers for auto-update
150
+ index_file = workspace_dir / INDEX_FILE_NAME
151
+ if not index_file.exists():
152
+ index_content = _initial_index_content(name)
153
+ try:
154
+ index_file.write_text(index_content, encoding="utf-8")
155
+ except (OSError, IOError) as e:
156
+ print(f"Error: failed to create index.md: {e}", file=sys.stderr)
157
+ return False
158
+
159
+ print(f"Developer initialized: {name}")
160
+ print(f" .developer file: {dev_file}")
161
+ print(f" Workspace directory: {workspace_dir}")
162
+
163
+ return True
164
+
165
+
166
+ def ensure_developer(repo_root: Path | None = None) -> None:
167
+ """Ensure developer is initialized, exit if not.
168
+
169
+ Args:
170
+ repo_root: Repository root path. Defaults to auto-detected.
171
+ """
172
+ if repo_root is None:
173
+ repo_root = get_repo_root()
174
+
175
+ if not check_developer(repo_root):
176
+ print("Error: developer identity has not been initialized.", file=sys.stderr)
177
+ print(f"Run: python3 ./{DIR_WORKFLOW}/scripts/init_developer.py <your-name>", file=sys.stderr)
178
+ sys.exit(1)
179
+
180
+
181
+ def show_developer_info(repo_root: Path | None = None) -> None:
182
+ """Show developer information.
183
+
184
+ Args:
185
+ repo_root: Repository root path. Defaults to auto-detected.
186
+ """
187
+ if repo_root is None:
188
+ repo_root = get_repo_root()
189
+
190
+ developer = get_developer(repo_root)
191
+
192
+ if not developer:
193
+ print("Developer: not initialized")
194
+ else:
195
+ print(f"Developer: {developer}")
196
+ print(f"Workspace: {DIR_WORKFLOW}/{DIR_WORKSPACE}/{developer}/")
197
+ print(f"Tasks directory: {DIR_WORKFLOW}/{DIR_TASKS}/")
198
+
199
+
200
+ # =============================================================================
201
+ # Main Entry (for testing)
202
+ # =============================================================================
203
+
204
+ if __name__ == "__main__":
205
+ show_developer_info()
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env python3
2
+ """Common file helpers for cowork-flow scripts."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import json
7
+ from pathlib import Path
8
+
9
+
10
+ def read_json_file(path: Path) -> dict | None:
11
+ """Read and parse a JSON file."""
12
+ try:
13
+ return json.loads(path.read_text(encoding="utf-8"))
14
+ except (FileNotFoundError, json.JSONDecodeError, OSError):
15
+ return None
16
+
17
+
18
+ def write_json_file(path: Path, data: dict) -> bool:
19
+ """Write dict to JSON file."""
20
+ try:
21
+ path.write_text(json.dumps(data, indent=2, ensure_ascii=False), encoding="utf-8")
22
+ return True
23
+ except OSError:
24
+ return False