@pjmendonca/devflow 1.9.0

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 (124) hide show
  1. package/CHANGELOG.md +526 -0
  2. package/LICENSE +21 -0
  3. package/README.md +620 -0
  4. package/bin/devflow-checkpoint.js +10 -0
  5. package/bin/devflow-collab.js +10 -0
  6. package/bin/devflow-cost.js +10 -0
  7. package/bin/devflow-create-persona.js +10 -0
  8. package/bin/devflow-init.js +10 -0
  9. package/bin/devflow-memory.js +10 -0
  10. package/bin/devflow-new-doc.js +10 -0
  11. package/bin/devflow-personalize.js +10 -0
  12. package/bin/devflow-setup-checkpoint.js +10 -0
  13. package/bin/devflow-story.js +10 -0
  14. package/bin/devflow-tech-debt.js +10 -0
  15. package/bin/devflow-validate-overrides.js +10 -0
  16. package/bin/devflow-validate.js +10 -0
  17. package/bin/devflow-version.js +10 -0
  18. package/lib/constants.js +30 -0
  19. package/lib/exec-python.js +78 -0
  20. package/lib/python-check.js +178 -0
  21. package/package.json +64 -0
  22. package/tooling/.automation/agents/architect.md +135 -0
  23. package/tooling/.automation/agents/ba.md +70 -0
  24. package/tooling/.automation/agents/dev.md +79 -0
  25. package/tooling/.automation/agents/maintainer.md +97 -0
  26. package/tooling/.automation/agents/pm.md +116 -0
  27. package/tooling/.automation/agents/reviewer.md +141 -0
  28. package/tooling/.automation/agents/sm.md +61 -0
  29. package/tooling/.automation/agents/writer.md +193 -0
  30. package/tooling/.automation/config.ps1.template +61 -0
  31. package/tooling/.automation/config.sh.template +48 -0
  32. package/tooling/.automation/memory/.gitkeep +6 -0
  33. package/tooling/.automation/memory/knowledge/kg_integration-test.json +94 -0
  34. package/tooling/.automation/memory/knowledge/kg_test-story.json +300 -0
  35. package/tooling/.automation/memory/shared/shared_integration-test.json +30 -0
  36. package/tooling/.automation/memory/shared/shared_test-story.json +78 -0
  37. package/tooling/.automation/overrides/templates/README.md +113 -0
  38. package/tooling/.automation/overrides/templates/architect/README.md +27 -0
  39. package/tooling/.automation/overrides/templates/architect/cloud-native.yaml +92 -0
  40. package/tooling/.automation/overrides/templates/architect/enterprise-architect.yaml +85 -0
  41. package/tooling/.automation/overrides/templates/architect/pragmatic-minimalist.yaml +88 -0
  42. package/tooling/.automation/overrides/templates/ba/README.md +27 -0
  43. package/tooling/.automation/overrides/templates/ba/agile-storyteller.yaml +86 -0
  44. package/tooling/.automation/overrides/templates/ba/domain-expert.yaml +91 -0
  45. package/tooling/.automation/overrides/templates/ba/requirements-engineer.yaml +89 -0
  46. package/tooling/.automation/overrides/templates/dev/README.md +32 -0
  47. package/tooling/.automation/overrides/templates/dev/junior-mentored.yaml +39 -0
  48. package/tooling/.automation/overrides/templates/dev/performance-engineer.yaml +43 -0
  49. package/tooling/.automation/overrides/templates/dev/rapid-prototyper.yaml +52 -0
  50. package/tooling/.automation/overrides/templates/dev/security-focused.yaml +43 -0
  51. package/tooling/.automation/overrides/templates/dev/senior-fullstack.yaml +39 -0
  52. package/tooling/.automation/overrides/templates/maintainer/README.md +27 -0
  53. package/tooling/.automation/overrides/templates/maintainer/devops-maintainer.yaml +113 -0
  54. package/tooling/.automation/overrides/templates/maintainer/legacy-steward.yaml +94 -0
  55. package/tooling/.automation/overrides/templates/maintainer/oss-maintainer.yaml +94 -0
  56. package/tooling/.automation/overrides/templates/pm/README.md +27 -0
  57. package/tooling/.automation/overrides/templates/pm/agile-pm.yaml +91 -0
  58. package/tooling/.automation/overrides/templates/pm/hybrid-delivery.yaml +87 -0
  59. package/tooling/.automation/overrides/templates/pm/traditional-pm.yaml +91 -0
  60. package/tooling/.automation/overrides/templates/reviewer/README.md +11 -0
  61. package/tooling/.automation/overrides/templates/reviewer/mentoring-reviewer.yaml +45 -0
  62. package/tooling/.automation/overrides/templates/reviewer/quick-sanity.yaml +50 -0
  63. package/tooling/.automation/overrides/templates/reviewer/thorough-critic.yaml +48 -0
  64. package/tooling/.automation/overrides/templates/sm/README.md +11 -0
  65. package/tooling/.automation/overrides/templates/sm/agile-coach.yaml +52 -0
  66. package/tooling/.automation/overrides/templates/sm/startup-pm.yaml +50 -0
  67. package/tooling/.automation/overrides/templates/sm/technical-lead.yaml +47 -0
  68. package/tooling/.automation/overrides/templates/user-profile.template.yaml +62 -0
  69. package/tooling/.automation/overrides/templates/writer/README.md +27 -0
  70. package/tooling/.automation/overrides/templates/writer/api-documentarian.yaml +99 -0
  71. package/tooling/.automation/overrides/templates/writer/docs-as-code.yaml +108 -0
  72. package/tooling/.automation/overrides/templates/writer/user-guide-author.yaml +100 -0
  73. package/tooling/completions/DevflowCompletion.ps1 +213 -0
  74. package/tooling/completions/_run-story +116 -0
  75. package/tooling/completions/run-story-completion.bash +136 -0
  76. package/tooling/docs/DOC-STANDARD.md +717 -0
  77. package/tooling/docs/sprint-status.yaml.template +24 -0
  78. package/tooling/docs/templates/bug-report.md +234 -0
  79. package/tooling/docs/templates/migration-spec.md +274 -0
  80. package/tooling/docs/templates/refactor-spec.md +86 -0
  81. package/tooling/docs/templates/tech-debt.md +86 -0
  82. package/tooling/scripts/context_checkpoint.py +556 -0
  83. package/tooling/scripts/cost_dashboard.py +617 -0
  84. package/tooling/scripts/create-persona.py +690 -0
  85. package/tooling/scripts/create-persona.sh +435 -0
  86. package/tooling/scripts/init-project-workflow.ps1 +651 -0
  87. package/tooling/scripts/init-project-workflow.py +70 -0
  88. package/tooling/scripts/init-project-workflow.sh +746 -0
  89. package/tooling/scripts/lib/__init__.py +35 -0
  90. package/tooling/scripts/lib/agent_handoff.py +526 -0
  91. package/tooling/scripts/lib/agent_router.py +698 -0
  92. package/tooling/scripts/lib/checkpoint-integration.ps1 +245 -0
  93. package/tooling/scripts/lib/checkpoint-integration.sh +191 -0
  94. package/tooling/scripts/lib/claude-cli.ps1 +952 -0
  95. package/tooling/scripts/lib/claude-cli.sh +1293 -0
  96. package/tooling/scripts/lib/cost_config.py +222 -0
  97. package/tooling/scripts/lib/cost_display.py +443 -0
  98. package/tooling/scripts/lib/cost_tracker.py +710 -0
  99. package/tooling/scripts/lib/currency_converter.py +328 -0
  100. package/tooling/scripts/lib/errors.py +438 -0
  101. package/tooling/scripts/lib/override-loader.sh +286 -0
  102. package/tooling/scripts/lib/pair_programming.py +589 -0
  103. package/tooling/scripts/lib/shared_memory.py +637 -0
  104. package/tooling/scripts/lib/swarm_orchestrator.py +689 -0
  105. package/tooling/scripts/memory_summarize.py +324 -0
  106. package/tooling/scripts/new-doc.ps1 +405 -0
  107. package/tooling/scripts/new-doc.py +93 -0
  108. package/tooling/scripts/new-doc.sh +534 -0
  109. package/tooling/scripts/personalize_agent.py +385 -0
  110. package/tooling/scripts/rollback-migration.sh +540 -0
  111. package/tooling/scripts/run-collab.ps1 +251 -0
  112. package/tooling/scripts/run-collab.py +605 -0
  113. package/tooling/scripts/run-collab.sh +110 -0
  114. package/tooling/scripts/run-story.ps1 +490 -0
  115. package/tooling/scripts/run-story.py +387 -0
  116. package/tooling/scripts/run-story.sh +467 -0
  117. package/tooling/scripts/setup-checkpoint-service.ps1 +219 -0
  118. package/tooling/scripts/setup-checkpoint-service.py +87 -0
  119. package/tooling/scripts/setup-checkpoint-service.sh +236 -0
  120. package/tooling/scripts/tech-debt-tracker.py +608 -0
  121. package/tooling/scripts/update_version.py +244 -0
  122. package/tooling/scripts/validate-overrides.py +511 -0
  123. package/tooling/scripts/validate-overrides.sh +432 -0
  124. package/tooling/scripts/validate_setup.py +539 -0
@@ -0,0 +1,435 @@
1
+ #!/usr/bin/env bash
2
+ ################################################################################
3
+ # Create Persona - Custom Agent Persona Builder
4
+ #
5
+ # This interactive tool helps create custom agent personas for the Devflow
6
+ # workflow system. It generates properly formatted agent files.
7
+ #
8
+ # Usage:
9
+ # ./create-persona.sh # Interactive mode
10
+ # ./create-persona.sh --list # List existing personas
11
+ # ./create-persona.sh --template dev # Create from template
12
+ #
13
+ ################################################################################
14
+
15
+ set -e
16
+
17
+ # Colors
18
+ RED='\033[0;31m'
19
+ GREEN='\033[0;32m'
20
+ YELLOW='\033[1;33m'
21
+ BLUE='\033[0;34m'
22
+ CYAN='\033[0;36m'
23
+ BOLD='\033[1m'
24
+ NC='\033[0m'
25
+
26
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
27
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
28
+ AGENTS_DIR="$PROJECT_ROOT/.automation/agents"
29
+ OVERRIDES_DIR="$PROJECT_ROOT/.automation/overrides"
30
+
31
+ ################################################################################
32
+ # Helper Functions
33
+ ################################################################################
34
+
35
+ print_header() {
36
+ echo ""
37
+ echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}"
38
+ echo -e "${CYAN} CUSTOM PERSONA BUILDER${NC}"
39
+ echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}"
40
+ echo ""
41
+ }
42
+
43
+ prompt() {
44
+ local message="$1"
45
+ local default="$2"
46
+ local result
47
+
48
+ if [[ -n "$default" ]]; then
49
+ echo -n -e "${BLUE}${message}${NC} [${default}]: "
50
+ else
51
+ echo -n -e "${BLUE}${message}${NC}: "
52
+ fi
53
+
54
+ read result
55
+
56
+ if [[ -z "$result" && -n "$default" ]]; then
57
+ echo "$default"
58
+ else
59
+ echo "$result"
60
+ fi
61
+ }
62
+
63
+ prompt_list() {
64
+ local message="$1"
65
+ local min_items="${2:-0}"
66
+ local items=()
67
+ local count=0
68
+
69
+ echo -e "${BLUE}${message}${NC}"
70
+ echo " (Enter items one per line, empty line to finish)"
71
+
72
+ while true; do
73
+ ((count++))
74
+ echo -n " $count. "
75
+ read item
76
+
77
+ if [[ -z "$item" ]]; then
78
+ if [[ ${#items[@]} -ge $min_items ]]; then
79
+ break
80
+ else
81
+ echo -e "${YELLOW}Please enter at least $min_items item(s).${NC}"
82
+ ((count--))
83
+ continue
84
+ fi
85
+ fi
86
+
87
+ items+=("$item")
88
+ done
89
+
90
+ printf '%s\n' "${items[@]}"
91
+ }
92
+
93
+ ################################################################################
94
+ # Persona Templates
95
+ ################################################################################
96
+
97
+ get_template() {
98
+ local template_name="$1"
99
+
100
+ case "$template_name" in
101
+ developer|dev)
102
+ echo "developer|Software Developer|Writing clean, maintainable code|sonnet"
103
+ ;;
104
+ reviewer)
105
+ echo "reviewer|Code Reviewer|Ensuring code quality and best practices|sonnet"
106
+ ;;
107
+ architect)
108
+ echo "architect|Software Architect|System design and technical decisions|opus"
109
+ ;;
110
+ tester|qa)
111
+ echo "tester|QA Engineer|Quality assurance and testing|sonnet"
112
+ ;;
113
+ security)
114
+ echo "security|Security Engineer|Application security and vulnerability prevention|opus"
115
+ ;;
116
+ devops)
117
+ echo "devops|DevOps Engineer|CI/CD, infrastructure, and deployment|sonnet"
118
+ ;;
119
+ documentation|docs|writer)
120
+ echo "documentation|Technical Writer|Clear and comprehensive documentation|sonnet"
121
+ ;;
122
+ *)
123
+ echo ""
124
+ ;;
125
+ esac
126
+ }
127
+
128
+ ################################################################################
129
+ # Persona Generation
130
+ ################################################################################
131
+
132
+ generate_agent_file() {
133
+ local name="$1"
134
+ local role="$2"
135
+ local focus="$3"
136
+ local model="$4"
137
+ shift 4
138
+ local responsibilities=("${@}")
139
+
140
+ local file="$AGENTS_DIR/${name}.md"
141
+
142
+ cat > "$file" << EOF
143
+ # ${role} Agent
144
+
145
+ You are a ${role}. ${focus}
146
+
147
+ ## Responsibilities
148
+
149
+ EOF
150
+
151
+ local count=0
152
+ for resp in "${responsibilities[@]}"; do
153
+ ((count++))
154
+ echo "$count. $resp" >> "$file"
155
+ done
156
+
157
+ cat >> "$file" << 'EOF'
158
+
159
+ ## Principles
160
+
161
+ 1. **Quality First** - Maintain high standards in all work
162
+ 2. **Clear Communication** - Be precise and explanatory
163
+ 3. **Continuous Improvement** - Learn and adapt from each task
164
+ 4. **Collaboration** - Work effectively with other agents and humans
165
+
166
+ ## Communication Style
167
+
168
+ Professional, clear, and focused on actionable outcomes.
169
+
170
+ ## Context Management
171
+
172
+ You are running in an automated pipeline with limited context window. To avoid losing work:
173
+
174
+ 1. **Work incrementally** - Complete and save files one at a time
175
+ 2. **Checkpoint frequently** - After each significant change, ensure the file is written
176
+ 3. **Monitor your progress** - If you notice you've been working for a while, prioritize critical items
177
+ 4. **Self-assess context usage** - If you estimate you're past 80% of your context:
178
+ - Finish the current file you're working on
179
+ - Write a summary of remaining work
180
+ - Complete what you can rather than leaving partial work
181
+
182
+ If you sense context is running low, output a warning:
183
+ ```
184
+ ⚠️ CONTEXT WARNING: Approaching context limit. Prioritizing completion of current task.
185
+ ```
186
+
187
+ EOF
188
+
189
+ echo "## Model" >> "$file"
190
+ echo "" >> "$file"
191
+ echo "Recommended model: \`${model}\`" >> "$file"
192
+ echo "" >> "$file"
193
+
194
+ echo "$file"
195
+ }
196
+
197
+ generate_override_file() {
198
+ local name="$1"
199
+
200
+ local file="$OVERRIDES_DIR/${name}.override.yaml"
201
+
202
+ # Don't overwrite existing
203
+ if [[ -f "$file" ]]; then
204
+ return
205
+ fi
206
+
207
+ cat > "$file" << EOF
208
+ # ${name^^} Agent Override
209
+ # Customize this agent's behavior without modifying the core agent file
210
+ # These settings survive updates to the core agent
211
+
212
+ # Additional rules (appended to base agent rules)
213
+ additional_rules:
214
+ - "Add your custom rules here"
215
+
216
+ # Memories - facts this agent should always remember
217
+ memories:
218
+ - "Add project-specific context here"
219
+
220
+ # Critical actions - must be done before completing any task
221
+ critical_actions:
222
+ - "Verify work meets requirements"
223
+
224
+ # Model override (optional)
225
+ # model: "sonnet"
226
+
227
+ # Budget override (optional)
228
+ # max_budget_usd: 10.00
229
+
230
+ EOF
231
+
232
+ echo "$file"
233
+ }
234
+
235
+ ################################################################################
236
+ # Commands
237
+ ################################################################################
238
+
239
+ list_personas() {
240
+ echo -e "${BOLD}Available Agent Personas:${NC}"
241
+ echo ""
242
+
243
+ if [[ ! -d "$AGENTS_DIR" ]]; then
244
+ echo -e " ${YELLOW}No agents directory found.${NC}"
245
+ return
246
+ fi
247
+
248
+ printf " %-15s │ %-25s │ Override\n" "NAME" "ROLE"
249
+ printf " %s\n" "$(printf '─%.0s' {1..50})"
250
+
251
+ for agent_file in "$AGENTS_DIR"/*.md; do
252
+ if [[ -f "$agent_file" ]]; then
253
+ local name=$(basename "$agent_file" .md)
254
+ local role=$(head -1 "$agent_file" | sed 's/# //' | sed 's/ Agent$//')
255
+
256
+ local has_override=" "
257
+ if [[ -f "$OVERRIDES_DIR/${name}.override.yaml" ]]; then
258
+ has_override="✓"
259
+ fi
260
+
261
+ printf " ${GREEN}%-15s${NC} │ %-25s │ %s\n" "$name" "$role" "$has_override"
262
+ fi
263
+ done
264
+
265
+ echo ""
266
+ }
267
+
268
+ create_from_template() {
269
+ local template_name="$1"
270
+ local persona_name="$2"
271
+
272
+ local template=$(get_template "$template_name")
273
+
274
+ if [[ -z "$template" ]]; then
275
+ echo -e "${RED}Unknown template: $template_name${NC}"
276
+ echo "Available templates: developer, reviewer, architect, tester, security, devops, documentation"
277
+ exit 1
278
+ fi
279
+
280
+ # Parse template
281
+ IFS='|' read -r tpl_name role focus model <<< "$template"
282
+
283
+ # Use provided name or template name
284
+ local name="${persona_name:-$tpl_name}"
285
+
286
+ # Default responsibilities
287
+ local responsibilities=(
288
+ "Complete assigned tasks efficiently"
289
+ "Follow project standards and best practices"
290
+ "Document work appropriately"
291
+ "Communicate progress and blockers"
292
+ )
293
+
294
+ mkdir -p "$AGENTS_DIR" "$OVERRIDES_DIR"
295
+
296
+ local agent_file=$(generate_agent_file "$name" "$role" "$focus" "$model" "${responsibilities[@]}")
297
+ local override_file=$(generate_override_file "$name")
298
+
299
+ echo -e "${GREEN}✓ Persona created from template!${NC}"
300
+ echo ""
301
+ echo " Agent file: $agent_file"
302
+ [[ -n "$override_file" ]] && echo " Override file: $override_file"
303
+ echo ""
304
+ }
305
+
306
+ interactive_create() {
307
+ echo -e "${BOLD}Let's create your custom agent persona!${NC}"
308
+ echo ""
309
+
310
+ # Get name
311
+ local name=$(prompt "Persona name (e.g., 'qa', 'frontend-dev')")
312
+ name=$(echo "$name" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
313
+
314
+ if [[ -z "$name" ]]; then
315
+ echo -e "${RED}Name is required.${NC}"
316
+ exit 1
317
+ fi
318
+
319
+ # Check if exists
320
+ if [[ -f "$AGENTS_DIR/${name}.md" ]]; then
321
+ echo -e "${YELLOW}Persona '$name' already exists.${NC}"
322
+ local overwrite=$(prompt "Overwrite? (y/n)" "n")
323
+ if [[ "$overwrite" != "y" ]]; then
324
+ exit 0
325
+ fi
326
+ fi
327
+
328
+ # Get details
329
+ echo ""
330
+ local role=$(prompt "Role (e.g., 'Senior QA Engineer')")
331
+ local focus=$(prompt "Focus (one-line description)")
332
+
333
+ echo ""
334
+ echo "Select model:"
335
+ echo " 1. sonnet (default - balanced)"
336
+ echo " 2. opus (complex tasks)"
337
+ echo " 3. haiku (quick tasks)"
338
+ local model_choice=$(prompt "Choice" "1")
339
+
340
+ local model="sonnet"
341
+ case "$model_choice" in
342
+ 2|opus) model="opus" ;;
343
+ 3|haiku) model="haiku" ;;
344
+ esac
345
+
346
+ echo ""
347
+ echo "Enter responsibilities (what this agent does):"
348
+ local responsibilities=()
349
+ local count=0
350
+ while true; do
351
+ ((count++))
352
+ local resp=$(prompt " $count")
353
+ if [[ -z "$resp" ]]; then
354
+ if [[ ${#responsibilities[@]} -ge 2 ]]; then
355
+ break
356
+ else
357
+ echo -e "${YELLOW}Please enter at least 2 responsibilities.${NC}"
358
+ ((count--))
359
+ continue
360
+ fi
361
+ fi
362
+ responsibilities+=("$resp")
363
+ done
364
+
365
+ # Create files
366
+ mkdir -p "$AGENTS_DIR" "$OVERRIDES_DIR"
367
+
368
+ local agent_file=$(generate_agent_file "$name" "$role" "$focus" "$model" "${responsibilities[@]}")
369
+ local override_file=$(generate_override_file "$name")
370
+
371
+ echo ""
372
+ echo -e "${GREEN}✓ Persona created successfully!${NC}"
373
+ echo ""
374
+ echo " Agent file: $agent_file"
375
+ [[ -n "$override_file" ]] && echo " Override file: $override_file"
376
+ echo ""
377
+ echo -e "${BOLD}Next steps:${NC}"
378
+ echo " 1. Review and customize: $agent_file"
379
+ echo " 2. Add project-specific memories in the override file"
380
+ echo " 3. Use with: ./run-story.sh <story> --agent $name"
381
+ echo ""
382
+ }
383
+
384
+ ################################################################################
385
+ # Main
386
+ ################################################################################
387
+
388
+ print_usage() {
389
+ echo "Usage: ./create-persona.sh [options]"
390
+ echo ""
391
+ echo "Commands:"
392
+ echo " (no args) Interactive persona creation"
393
+ echo " --list List existing personas"
394
+ echo " --template <name> Create from template"
395
+ echo ""
396
+ echo "Templates available:"
397
+ echo " developer, reviewer, architect, tester, security, devops, documentation"
398
+ echo ""
399
+ echo "Examples:"
400
+ echo " ./create-persona.sh # Interactive mode"
401
+ echo " ./create-persona.sh --list # List personas"
402
+ echo " ./create-persona.sh --template tester my-qa # Create from template"
403
+ echo ""
404
+ }
405
+
406
+ main() {
407
+ print_header
408
+
409
+ case "$1" in
410
+ --list|-l)
411
+ list_personas
412
+ ;;
413
+ --template|-t)
414
+ shift
415
+ if [[ -z "$1" ]]; then
416
+ echo -e "${RED}Please specify a template name.${NC}"
417
+ exit 1
418
+ fi
419
+ create_from_template "$1" "$2"
420
+ ;;
421
+ --help|-h)
422
+ print_usage
423
+ ;;
424
+ "")
425
+ interactive_create
426
+ ;;
427
+ *)
428
+ echo -e "${RED}Unknown option: $1${NC}"
429
+ print_usage
430
+ exit 1
431
+ ;;
432
+ esac
433
+ }
434
+
435
+ main "$@"