@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,286 @@
1
+ #!/usr/bin/env bash
2
+ ################################################################################
3
+ # Override Loader Library
4
+ #
5
+ # Loads user profile and agent overrides to personalize agent behavior.
6
+ # Overrides are stored in tooling/.automation/overrides/ and survive updates.
7
+ #
8
+ # Usage:
9
+ # source lib/override-loader.sh
10
+ # load_agent_with_overrides "dev" # Returns combined agent prompt
11
+ ################################################################################
12
+
13
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
14
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
15
+ OVERRIDES_DIR="$PROJECT_ROOT/.automation/overrides"
16
+ AGENTS_DIR="$PROJECT_ROOT/.automation/agents"
17
+ MEMORY_DIR="$PROJECT_ROOT/.automation/memory"
18
+
19
+ ################################################################################
20
+ # YAML Parsing Helpers (basic, for simple YAML structures)
21
+ ################################################################################
22
+
23
+ # Extract a simple value from YAML (key: value)
24
+ yaml_get_value() {
25
+ local file="$1"
26
+ local key="$2"
27
+ grep -E "^${key}:" "$file" 2>/dev/null | sed "s/^${key}:[[:space:]]*//" | sed 's/^["'"'"']//' | sed 's/["'"'"']$//'
28
+ }
29
+
30
+ # Extract a nested value (parent.child: value)
31
+ yaml_get_nested() {
32
+ local file="$1"
33
+ local parent="$2"
34
+ local child="$3"
35
+ awk "/^${parent}:/{found=1} found && /^ ${child}:/{print; exit}" "$file" 2>/dev/null | sed "s/^[[:space:]]*${child}:[[:space:]]*//" | sed 's/^["'"'"']//' | sed 's/["'"'"']$//'
36
+ }
37
+
38
+ # Extract a list from YAML (returns newline-separated items)
39
+ yaml_get_list() {
40
+ local file="$1"
41
+ local key="$2"
42
+ awk "/^${key}:/{found=1; next} found && /^[[:space:]]*-/{print} found && /^[a-zA-Z]/{exit}" "$file" 2>/dev/null | sed 's/^[[:space:]]*-[[:space:]]*//' | sed 's/^["'"'"']//' | sed 's/["'"'"']$//'
43
+ }
44
+
45
+ ################################################################################
46
+ # User Profile Loading
47
+ ################################################################################
48
+
49
+ # Load user profile and return formatted context
50
+ load_user_profile() {
51
+ local profile_file="$OVERRIDES_DIR/user-profile.yaml"
52
+
53
+ if [[ ! -f "$profile_file" ]]; then
54
+ return 0
55
+ fi
56
+
57
+ local user_name=$(yaml_get_nested "$profile_file" "user" "name")
58
+ local tech_level=$(yaml_get_nested "$profile_file" "user" "technical_level")
59
+ local comm_style=$(yaml_get_nested "$profile_file" "user" "communication_style")
60
+
61
+ local output=""
62
+
63
+ if [[ -n "$user_name" && "$user_name" != "User" ]]; then
64
+ output+="
65
+ ## User Context
66
+ - User name: $user_name"
67
+ fi
68
+
69
+ if [[ -n "$tech_level" ]]; then
70
+ output+="
71
+ - Technical level: $tech_level"
72
+ fi
73
+
74
+ if [[ -n "$comm_style" ]]; then
75
+ output+="
76
+ - Preferred communication: $comm_style"
77
+ fi
78
+
79
+ # Load code style preferences
80
+ local code_style=$(yaml_get_list "$profile_file" " code_style")
81
+ if [[ -n "$code_style" ]]; then
82
+ output+="
83
+
84
+ ## Code Style Preferences"
85
+ while IFS= read -r style; do
86
+ [[ -n "$style" ]] && output+="
87
+ - $style"
88
+ done <<< "$code_style"
89
+ fi
90
+
91
+ # Load memories
92
+ local memories=$(yaml_get_list "$profile_file" "memories")
93
+ if [[ -n "$memories" ]]; then
94
+ output+="
95
+
96
+ ## Project Memories (Always Remember)"
97
+ while IFS= read -r memory; do
98
+ [[ -n "$memory" ]] && output+="
99
+ - $memory"
100
+ done <<< "$memories"
101
+ fi
102
+
103
+ echo "$output"
104
+ }
105
+
106
+ ################################################################################
107
+ # Agent Override Loading
108
+ ################################################################################
109
+
110
+ # Load agent-specific overrides
111
+ load_agent_override() {
112
+ local agent_name="$1"
113
+ local override_file="$OVERRIDES_DIR/${agent_name}.override.yaml"
114
+
115
+ if [[ ! -f "$override_file" ]]; then
116
+ return 0
117
+ fi
118
+
119
+ local output=""
120
+
121
+ # Load additional rules
122
+ local rules=$(yaml_get_list "$override_file" "additional_rules")
123
+ if [[ -n "$rules" ]]; then
124
+ output+="
125
+
126
+ ## Additional Rules"
127
+ while IFS= read -r rule; do
128
+ [[ -n "$rule" ]] && output+="
129
+ - $rule"
130
+ done <<< "$rules"
131
+ fi
132
+
133
+ # Load memories
134
+ local memories=$(yaml_get_list "$override_file" "memories")
135
+ if [[ -n "$memories" ]]; then
136
+ output+="
137
+
138
+ ## Agent Memories"
139
+ while IFS= read -r memory; do
140
+ [[ -n "$memory" ]] && output+="
141
+ - $memory"
142
+ done <<< "$memories"
143
+ fi
144
+
145
+ # Load critical actions
146
+ local actions=$(yaml_get_list "$override_file" "critical_actions")
147
+ if [[ -n "$actions" ]]; then
148
+ output+="
149
+
150
+ ## Critical Actions (Must Do)"
151
+ while IFS= read -r action; do
152
+ [[ -n "$action" ]] && output+="
153
+ - $action"
154
+ done <<< "$actions"
155
+ fi
156
+
157
+ echo "$output"
158
+ }
159
+
160
+ # Get model override for an agent
161
+ get_agent_model_override() {
162
+ local agent_name="$1"
163
+ local override_file="$OVERRIDES_DIR/${agent_name}.override.yaml"
164
+
165
+ if [[ -f "$override_file" ]]; then
166
+ yaml_get_value "$override_file" "model"
167
+ fi
168
+ }
169
+
170
+ # Get budget override for an agent
171
+ get_agent_budget_override() {
172
+ local agent_name="$1"
173
+ local override_file="$OVERRIDES_DIR/${agent_name}.override.yaml"
174
+
175
+ if [[ -f "$override_file" ]]; then
176
+ yaml_get_value "$override_file" "max_budget_usd"
177
+ fi
178
+ }
179
+
180
+ ################################################################################
181
+ # Agent Memory Loading
182
+ ################################################################################
183
+
184
+ # Load persistent memory for an agent
185
+ load_agent_memory() {
186
+ local agent_name="$1"
187
+ local memory_file="$MEMORY_DIR/${agent_name}.memory.md"
188
+
189
+ if [[ -f "$memory_file" ]]; then
190
+ echo "
191
+
192
+ ## Persistent Memory
193
+
194
+ $(cat "$memory_file")"
195
+ fi
196
+ }
197
+
198
+ # Append to agent memory
199
+ append_agent_memory() {
200
+ local agent_name="$1"
201
+ local memory_entry="$2"
202
+ local memory_file="$MEMORY_DIR/${agent_name}.memory.md"
203
+
204
+ mkdir -p "$MEMORY_DIR"
205
+
206
+ # Add timestamp and entry
207
+ echo "- $(date '+%Y-%m-%d %H:%M'): $memory_entry" >> "$memory_file"
208
+ }
209
+
210
+ ################################################################################
211
+ # Main Loading Function
212
+ ################################################################################
213
+
214
+ # Load agent with all overrides applied
215
+ # Returns the complete agent prompt with user profile, overrides, and memory
216
+ load_agent_with_overrides() {
217
+ local agent_name="$1"
218
+ local agent_file="$AGENTS_DIR/${agent_name}.md"
219
+
220
+ # Start with base agent
221
+ local output=""
222
+ if [[ -f "$agent_file" ]]; then
223
+ output=$(cat "$agent_file")
224
+ else
225
+ echo "Warning: Agent file not found: $agent_file" >&2
226
+ return 1
227
+ fi
228
+
229
+ # Add user profile
230
+ local profile=$(load_user_profile)
231
+ if [[ -n "$profile" ]]; then
232
+ output+="
233
+ $profile"
234
+ fi
235
+
236
+ # Add agent-specific overrides
237
+ local override=$(load_agent_override "$agent_name")
238
+ if [[ -n "$override" ]]; then
239
+ output+="
240
+ $override"
241
+ fi
242
+
243
+ # Add persistent memory
244
+ local memory=$(load_agent_memory "$agent_name")
245
+ if [[ -n "$memory" ]]; then
246
+ output+="
247
+ $memory"
248
+ fi
249
+
250
+ echo "$output"
251
+ }
252
+
253
+ # Check if overrides exist for an agent
254
+ has_overrides() {
255
+ local agent_name="$1"
256
+ [[ -f "$OVERRIDES_DIR/${agent_name}.override.yaml" ]]
257
+ }
258
+
259
+ # List all available overrides
260
+ list_overrides() {
261
+ echo "Available overrides:"
262
+ for file in "$OVERRIDES_DIR"/*.override.yaml; do
263
+ if [[ -f "$file" ]]; then
264
+ local name=$(basename "$file" .override.yaml)
265
+ echo " - $name"
266
+ fi
267
+ done
268
+ }
269
+
270
+ ################################################################################
271
+ # Initialization
272
+ ################################################################################
273
+
274
+ # Create overrides directory if it doesn't exist
275
+ init_overrides() {
276
+ mkdir -p "$OVERRIDES_DIR" "$MEMORY_DIR"
277
+
278
+ # Create user profile if it doesn't exist
279
+ if [[ ! -f "$OVERRIDES_DIR/user-profile.yaml" ]]; then
280
+ echo "# User profile not found. Creating default..." >&2
281
+ # Default will be created by the main setup
282
+ fi
283
+ }
284
+
285
+ # Auto-initialize when sourced
286
+ init_overrides 2>/dev/null || true