@flydocs/cli 0.6.0-alpha.3 → 0.6.0-alpha.31

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 (151) hide show
  1. package/dist/cli.js +2053 -469
  2. package/package.json +1 -1
  3. package/template/.claude/CLAUDE.md +43 -48
  4. package/template/.claude/agents/implementation-agent.md +1 -1
  5. package/template/.claude/agents/pm-agent.md +1 -1
  6. package/template/.claude/commands/activate.md +1 -1
  7. package/template/.claude/commands/attach.md +1 -1
  8. package/template/.claude/commands/block.md +2 -2
  9. package/template/.claude/commands/capture.md +1 -1
  10. package/template/.claude/commands/close.md +1 -1
  11. package/template/.claude/commands/flydocs-setup.md +359 -72
  12. package/template/.claude/commands/flydocs-upgrade.md +26 -27
  13. package/template/.claude/commands/implement.md +1 -1
  14. package/template/.claude/commands/knowledge.md +61 -0
  15. package/template/.claude/commands/new-project.md +1 -1
  16. package/template/.claude/commands/onboard.md +275 -0
  17. package/template/.claude/commands/project-update.md +1 -1
  18. package/template/.claude/commands/refine.md +1 -1
  19. package/template/.claude/commands/review.md +1 -1
  20. package/template/.claude/commands/start-session.md +1 -1
  21. package/template/.claude/commands/status.md +1 -1
  22. package/template/.claude/commands/validate.md +1 -1
  23. package/template/.claude/commands/wrap-session.md +1 -1
  24. package/template/.claude/hooks/auto-approve.py +212 -0
  25. package/template/.claude/hooks/post-pr-check.py +108 -0
  26. package/template/.claude/hooks/post-transition-check.py +281 -0
  27. package/template/.claude/hooks/prompt-submit.py +554 -0
  28. package/template/.claude/hooks/session-start.py +262 -0
  29. package/template/.claude/hooks/stop-gate.py +162 -0
  30. package/template/.claude/settings.json +41 -4
  31. package/template/.claude/skills/README.md +23 -25
  32. package/template/.claude/skills/flydocs-workflow/SKILL.md +134 -42
  33. package/template/.claude/skills/flydocs-workflow/cursor-rule.mdc +9 -8
  34. package/template/.claude/skills/flydocs-workflow/reference/comment-templates.md +1 -0
  35. package/template/.claude/skills/flydocs-workflow/reference/golden-rules.md +28 -17
  36. package/template/.claude/skills/flydocs-workflow/reference/graph-schema.md +116 -0
  37. package/template/.claude/skills/flydocs-workflow/reference/pr-workflow.md +120 -0
  38. package/template/.claude/skills/flydocs-workflow/reference/priority-estimates.md +37 -15
  39. package/template/.claude/skills/flydocs-workflow/reference/service-descriptor-schema.md +260 -0
  40. package/template/.claude/skills/flydocs-workflow/reference/status-workflow.md +26 -26
  41. package/template/.claude/skills/flydocs-workflow/scripts/_local/__init__.py +0 -0
  42. package/template/.claude/skills/{flydocs-local/scripts/flydocs_api.py → flydocs-workflow/scripts/_local/file_store.py} +137 -47
  43. package/template/.claude/skills/flydocs-workflow/scripts/flydocs_api.py +724 -0
  44. package/template/{.flydocs → .claude/skills/flydocs-workflow}/scripts/generate_manifest.py +4 -4
  45. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_build.py +132 -1
  46. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_query.py +18 -5
  47. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_session.py +1 -10
  48. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_update.py +4 -4
  49. package/template/.claude/skills/{flydocs-context-graph → flydocs-workflow}/scripts/graph_utils.py +2 -1
  50. package/template/.claude/skills/flydocs-workflow/scripts/issues.py +738 -0
  51. package/template/.claude/skills/flydocs-workflow/scripts/projects.py +144 -0
  52. package/template/.claude/skills/flydocs-workflow/scripts/pull_services.py +128 -0
  53. package/template/.claude/skills/flydocs-workflow/scripts/push_service.py +132 -0
  54. package/template/.claude/skills/flydocs-workflow/scripts/session.py +54 -0
  55. package/template/.claude/skills/flydocs-workflow/scripts/test_enforcement.py +225 -0
  56. package/template/.claude/skills/flydocs-workflow/scripts/workspace.py +902 -0
  57. package/template/.claude/skills/flydocs-workflow/session.md +87 -29
  58. package/template/.claude/skills/flydocs-workflow/stages/activate.md +18 -7
  59. package/template/.claude/skills/flydocs-workflow/stages/capture.md +10 -5
  60. package/template/.claude/skills/flydocs-workflow/stages/close.md +4 -3
  61. package/template/.claude/skills/flydocs-workflow/stages/implement.md +33 -9
  62. package/template/.claude/skills/flydocs-workflow/stages/refine.md +22 -6
  63. package/template/.claude/skills/flydocs-workflow/stages/review.md +16 -4
  64. package/template/.claude/skills/flydocs-workflow/stages/validate.md +3 -1
  65. package/template/.claude/skills/flydocs-workflow/templates/pr/default.md +33 -0
  66. package/template/.cursor/agents/implementation-agent.md +1 -1
  67. package/template/.cursor/agents/pm-agent.md +2 -2
  68. package/template/.cursor/hooks.json +10 -3
  69. package/template/.env.example +6 -6
  70. package/template/.flydocs/config.json +5 -18
  71. package/template/.flydocs/templates/README.md +13 -14
  72. package/template/.flydocs/templates/bug.md +17 -153
  73. package/template/.flydocs/templates/chore.md +10 -98
  74. package/template/.flydocs/templates/feature.md +12 -158
  75. package/template/.flydocs/templates/idea.md +11 -111
  76. package/template/.flydocs/templates/quick-capture.md +4 -8
  77. package/template/.flydocs/version +1 -1
  78. package/template/AGENTS.md +44 -32
  79. package/template/CHANGELOG.md +37 -0
  80. package/template/flydocs/README.md +1 -3
  81. package/template/flydocs/context/project.md +6 -3
  82. package/template/flydocs/design-system/README.md +3 -3
  83. package/template/flydocs/knowledge/INDEX.md +38 -53
  84. package/template/flydocs/knowledge/README.md +60 -9
  85. package/template/flydocs/knowledge/templates/decision.md +47 -0
  86. package/template/flydocs/knowledge/templates/feature.md +35 -0
  87. package/template/flydocs/knowledge/templates/note.md +25 -0
  88. package/template/manifest.json +24 -20
  89. package/template/.claude/skills/flydocs-cloud/SKILL.md +0 -113
  90. package/template/.claude/skills/flydocs-cloud/cursor-rule.mdc +0 -50
  91. package/template/.claude/skills/flydocs-cloud/scripts/assign.py +0 -22
  92. package/template/.claude/skills/flydocs-cloud/scripts/assign_cycle.py +0 -28
  93. package/template/.claude/skills/flydocs-cloud/scripts/assign_milestone.py +0 -22
  94. package/template/.claude/skills/flydocs-cloud/scripts/comment.py +0 -29
  95. package/template/.claude/skills/flydocs-cloud/scripts/create_issue.py +0 -66
  96. package/template/.claude/skills/flydocs-cloud/scripts/create_milestone.py +0 -35
  97. package/template/.claude/skills/flydocs-cloud/scripts/create_project.py +0 -33
  98. package/template/.claude/skills/flydocs-cloud/scripts/create_team.py +0 -39
  99. package/template/.claude/skills/flydocs-cloud/scripts/estimate.py +0 -29
  100. package/template/.claude/skills/flydocs-cloud/scripts/flydocs_api.py +0 -210
  101. package/template/.claude/skills/flydocs-cloud/scripts/get_issue.py +0 -24
  102. package/template/.claude/skills/flydocs-cloud/scripts/link.py +0 -28
  103. package/template/.claude/skills/flydocs-cloud/scripts/list_cycles.py +0 -28
  104. package/template/.claude/skills/flydocs-cloud/scripts/list_issues.py +0 -44
  105. package/template/.claude/skills/flydocs-cloud/scripts/list_labels.py +0 -19
  106. package/template/.claude/skills/flydocs-cloud/scripts/list_milestones.py +0 -28
  107. package/template/.claude/skills/flydocs-cloud/scripts/list_projects.py +0 -31
  108. package/template/.claude/skills/flydocs-cloud/scripts/list_providers.py +0 -19
  109. package/template/.claude/skills/flydocs-cloud/scripts/list_teams.py +0 -19
  110. package/template/.claude/skills/flydocs-cloud/scripts/priority.py +0 -29
  111. package/template/.claude/skills/flydocs-cloud/scripts/project_update.py +0 -45
  112. package/template/.claude/skills/flydocs-cloud/scripts/set_labels.py +0 -68
  113. package/template/.claude/skills/flydocs-cloud/scripts/set_provider.py +0 -46
  114. package/template/.claude/skills/flydocs-cloud/scripts/set_team.py +0 -41
  115. package/template/.claude/skills/flydocs-cloud/scripts/transition.py +0 -26
  116. package/template/.claude/skills/flydocs-cloud/scripts/update_description.py +0 -36
  117. package/template/.claude/skills/flydocs-cloud/scripts/update_issue.py +0 -82
  118. package/template/.claude/skills/flydocs-context-graph/SKILL.md +0 -87
  119. package/template/.claude/skills/flydocs-context-graph/schema.md +0 -78
  120. package/template/.claude/skills/flydocs-context-graph/scripts/graph_context.py +0 -338
  121. package/template/.claude/skills/flydocs-context7/SKILL.md +0 -105
  122. package/template/.claude/skills/flydocs-context7/cursor-rule.mdc +0 -49
  123. package/template/.claude/skills/flydocs-context7/scripts/context7.py +0 -293
  124. package/template/.claude/skills/flydocs-estimates/SKILL.md +0 -384
  125. package/template/.claude/skills/flydocs-figma/SKILL.md +0 -377
  126. package/template/.claude/skills/flydocs-figma/references/PROMPTING.md +0 -108
  127. package/template/.claude/skills/flydocs-figma/references/TROUBLESHOOTING.md +0 -112
  128. package/template/.claude/skills/flydocs-local/SKILL.md +0 -103
  129. package/template/.claude/skills/flydocs-local/cursor-rule.mdc +0 -43
  130. package/template/.claude/skills/flydocs-local/scripts/assign.py +0 -20
  131. package/template/.claude/skills/flydocs-local/scripts/comment.py +0 -27
  132. package/template/.claude/skills/flydocs-local/scripts/create_issue.py +0 -44
  133. package/template/.claude/skills/flydocs-local/scripts/estimate.py +0 -37
  134. package/template/.claude/skills/flydocs-local/scripts/get_issue.py +0 -20
  135. package/template/.claude/skills/flydocs-local/scripts/link.py +0 -41
  136. package/template/.claude/skills/flydocs-local/scripts/list_issues.py +0 -34
  137. package/template/.claude/skills/flydocs-local/scripts/priority.py +0 -37
  138. package/template/.claude/skills/flydocs-local/scripts/project_update.py +0 -67
  139. package/template/.claude/skills/flydocs-local/scripts/status_summary.py +0 -16
  140. package/template/.claude/skills/flydocs-local/scripts/transition.py +0 -24
  141. package/template/.claude/skills/flydocs-local/scripts/update_description.py +0 -35
  142. package/template/.claude/skills/flydocs-local/scripts/update_issue.py +0 -84
  143. package/template/.flydocs/hooks/auto-approve.py +0 -71
  144. package/template/.flydocs/hooks/prompt-submit.py +0 -277
  145. package/template/.flydocs/scripts/skill_manager.py +0 -541
  146. /package/template/{.flydocs → .claude}/hooks/post-edit.py +0 -0
  147. /package/template/.claude/skills/{flydocs-estimates/references → flydocs-workflow/reference}/provider-costs.md +0 -0
  148. /package/template/.claude/skills/flydocs-workflow/templates/{bug.md → issues/bug.md} +0 -0
  149. /package/template/.claude/skills/flydocs-workflow/templates/{chore.md → issues/chore.md} +0 -0
  150. /package/template/.claude/skills/flydocs-workflow/templates/{feature.md → issues/feature.md} +0 -0
  151. /package/template/.claude/skills/flydocs-workflow/templates/{idea.md → issues/idea.md} +0 -0
@@ -1,277 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- FlyDocs Hook: prompt-submit.py
4
- Triggered: When user submits a prompt
5
- Purpose: Inject context and validate workflow state
6
-
7
- Exit codes:
8
- 0 - Success (plain text output adds context to conversation)
9
- 2 - Block prompt (stderr shown as reason)
10
-
11
- NOTE: Uses plain text output instead of JSON due to Claude Code bug (Issue #13912)
12
- where JSON output from UserPromptSubmit hooks causes "hook error" despite documentation.
13
- """
14
-
15
- import json
16
- import os
17
- import re
18
- import subprocess
19
- import sys
20
- from pathlib import Path
21
-
22
-
23
- DEBUG_HOOK = os.environ.get('DEBUG_HOOK', '0') == '1'
24
- SCRIPT_DIR = Path(__file__).parent.resolve()
25
- DEBUG_LOG = SCRIPT_DIR.parent / 'logs' / 'hook-debug.log'
26
-
27
-
28
- def debug_log(message: str) -> None:
29
- """Write debug message to log file if DEBUG_HOOK is enabled."""
30
- if not DEBUG_HOOK:
31
- return
32
- try:
33
- DEBUG_LOG.parent.mkdir(parents=True, exist_ok=True)
34
- from datetime import datetime
35
- timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
36
- with open(DEBUG_LOG, 'a') as f:
37
- f.write(f'[{timestamp}] {message}\n')
38
- except (OSError, IOError):
39
- pass
40
-
41
-
42
- def get_git_context() -> str | None:
43
- """Get git branch and uncommitted status."""
44
- try:
45
- # Check if in git repo
46
- result = subprocess.run(
47
- ['git', 'rev-parse', '--is-inside-work-tree'],
48
- capture_output=True,
49
- text=True,
50
- timeout=5
51
- )
52
- if result.returncode != 0:
53
- return None
54
-
55
- # Get branch name
56
- result = subprocess.run(
57
- ['git', 'branch', '--show-current'],
58
- capture_output=True,
59
- text=True,
60
- timeout=5
61
- )
62
- branch = result.stdout.strip() or 'detached'
63
-
64
- # Check for uncommitted changes
65
- uncommitted = 'no'
66
- result = subprocess.run(['git', 'diff', '--quiet'], capture_output=True, timeout=5)
67
- if result.returncode != 0:
68
- uncommitted = 'yes'
69
- result = subprocess.run(['git', 'diff', '--cached', '--quiet'], capture_output=True, timeout=5)
70
- if result.returncode != 0:
71
- uncommitted = 'yes'
72
-
73
- return f'Git: branch={branch}, uncommitted={uncommitted}'
74
- except (subprocess.TimeoutExpired, FileNotFoundError, subprocess.SubprocessError):
75
- return None
76
-
77
-
78
- def get_issue_context() -> tuple[str | None, str | None]:
79
- """Get active issue and status from session files."""
80
- focus_file = Path('.flydocs/session/focus.md')
81
- status_file = Path('.flydocs/session/status')
82
-
83
- issue_id = None
84
- status = None
85
-
86
- if focus_file.exists():
87
- try:
88
- content = focus_file.read_text()
89
- match = re.search(r'[A-Z]+-[0-9]+', content)
90
- if match:
91
- issue_id = match.group(0)
92
- except (OSError, IOError):
93
- pass
94
-
95
- if status_file.exists():
96
- try:
97
- status = status_file.read_text().strip()
98
- except (OSError, IOError):
99
- pass
100
-
101
- return issue_id, status
102
-
103
-
104
- def get_ac_progress() -> str | None:
105
- """Get acceptance criteria progress."""
106
- ac_file = Path('.flydocs/session/acceptance-criteria.md')
107
- if not ac_file.exists():
108
- return None
109
-
110
- try:
111
- content = ac_file.read_text()
112
- total = len(re.findall(r'^\s*-\s*\[', content, re.MULTILINE))
113
- done = len(re.findall(r'^\s*-\s*\[x\]', content, re.MULTILINE | re.IGNORECASE))
114
- if total > 0:
115
- return f'AC: {done}/{total} complete'
116
- except (OSError, IOError):
117
- pass
118
-
119
- return None
120
-
121
-
122
- def get_workflow_reminder(status: str) -> str | None:
123
- """Get workflow reminder based on current status."""
124
- reminders = {
125
- 'IMPLEMENTING': '[Reminder: Log progress with comments, run tests before REVIEW]',
126
- 'REVIEW': '[Reminder: Check acceptance criteria before approving]',
127
- 'TESTING': '[Reminder: Validate all AC met before marking COMPLETE]'
128
- }
129
- return reminders.get(status)
130
-
131
-
132
- def get_graph_context(issue_id: str | None, branch: str | None) -> str | None:
133
- """Get context graph output for the current session."""
134
- graph_script = Path('.claude/skills/flydocs-context-graph/scripts/graph_context.py')
135
- if not graph_script.exists():
136
- return None
137
-
138
- try:
139
- cmd = ['python3', str(graph_script)]
140
- if issue_id:
141
- cmd.extend(['--issue', issue_id])
142
- if branch:
143
- cmd.extend(['--branch', branch])
144
-
145
- result = subprocess.run(
146
- cmd,
147
- capture_output=True,
148
- text=True,
149
- timeout=5
150
- )
151
- if result.returncode == 0 and result.stdout.strip():
152
- return result.stdout.strip()
153
- except (subprocess.TimeoutExpired, FileNotFoundError, subprocess.SubprocessError):
154
- pass
155
-
156
- return None
157
-
158
-
159
- def get_flydocs_version() -> str | None:
160
- """Get FlyDocs version."""
161
- version_file = Path('.flydocs/version')
162
- if version_file.exists():
163
- try:
164
- return version_file.read_text().strip()
165
- except (OSError, IOError):
166
- pass
167
- return None
168
-
169
-
170
- def get_setup_nudge() -> str | None:
171
- """Check if setup has been completed, return nudge if not."""
172
- config_file = Path('.flydocs/config.json')
173
- if not config_file.exists():
174
- return None
175
- try:
176
- config = json.loads(config_file.read_text())
177
- # Only nudge if field is explicitly set to false (not missing)
178
- if 'setupComplete' in config and config['setupComplete'] is False:
179
- return '[Setup incomplete — run /flydocs-setup to configure your project]'
180
- except (json.JSONDecodeError, OSError, IOError):
181
- pass
182
- return None
183
-
184
-
185
- def main() -> None:
186
- """Main hook execution."""
187
- debug_log('=== Hook invoked ===')
188
- debug_log(f'PWD: {os.getcwd()}')
189
- debug_log(f'SCRIPT_DIR: {SCRIPT_DIR}')
190
- debug_log(f'CLAUDE_PROJECT_DIR: {os.environ.get("CLAUDE_PROJECT_DIR", "<not set>")}')
191
-
192
- # Read hook input from stdin
193
- try:
194
- input_data = json.loads(sys.stdin.read())
195
- except (json.JSONDecodeError, ValueError):
196
- input_data = {}
197
-
198
- prompt = input_data.get('prompt', '')
199
- session_id = input_data.get('session_id', '')
200
- cwd = input_data.get('cwd', '')
201
-
202
- debug_log(f'Parsed PROMPT: {prompt[:100]}...' if prompt else 'Parsed PROMPT: <empty>')
203
- debug_log(f'Parsed SESSION_ID: {session_id}')
204
- debug_log(f'Parsed CWD: {cwd}')
205
-
206
- # Change to working directory
207
- debug_log('Attempting to change directory...')
208
- if cwd and Path(cwd).is_dir():
209
- debug_log(f'Using CWD from input: {cwd}')
210
- os.chdir(cwd)
211
- elif os.environ.get('CLAUDE_PROJECT_DIR') and Path(os.environ['CLAUDE_PROJECT_DIR']).is_dir():
212
- debug_log(f'Using CLAUDE_PROJECT_DIR: {os.environ["CLAUDE_PROJECT_DIR"]}')
213
- os.chdir(os.environ['CLAUDE_PROJECT_DIR'])
214
- else:
215
- debug_log(f'No valid directory to change to, staying in: {os.getcwd()}')
216
-
217
- debug_log(f'Now in directory: {os.getcwd()}')
218
-
219
- # Build context parts
220
- context_parts = []
221
-
222
- # Git context
223
- git_context = get_git_context()
224
- branch = None
225
- if git_context:
226
- debug_log(f'Git context: {git_context}')
227
- context_parts.append(git_context)
228
- # Extract branch name for graph context
229
- branch_match = re.search(r'branch=(\S+)', git_context)
230
- if branch_match:
231
- branch = branch_match.group(1).rstrip(',')
232
-
233
- # Issue and status context
234
- issue_id, status = get_issue_context()
235
- if issue_id:
236
- context_parts.append(f'Active issue: {issue_id}')
237
- if status:
238
- context_parts.append(f'Status: {status}')
239
- reminder = get_workflow_reminder(status)
240
- if reminder:
241
- context_parts.append(reminder)
242
-
243
- # AC progress
244
- ac_progress = get_ac_progress()
245
- if ac_progress:
246
- context_parts.append(ac_progress)
247
-
248
- # Setup completion nudge
249
- setup_nudge = get_setup_nudge()
250
- if setup_nudge:
251
- context_parts.append(setup_nudge)
252
-
253
- # FlyDocs version
254
- version = get_flydocs_version()
255
- if version:
256
- context_parts.append(f'FlyDocs: {version}')
257
-
258
- # Output status line
259
- context = ' | '.join(context_parts)
260
- debug_log(f'Final CONTEXT: {context}')
261
-
262
- if context:
263
- debug_log(f'Outputting plain text context: {context}')
264
- print(context)
265
-
266
- # Graph context (appended as separate block below status line)
267
- graph_context = get_graph_context(issue_id, branch)
268
- if graph_context:
269
- debug_log(f'Graph context: {graph_context[:100]}...')
270
- print(graph_context)
271
-
272
- debug_log('=== Hook completed successfully ===')
273
- sys.exit(0)
274
-
275
-
276
- if __name__ == '__main__':
277
- main()