specweave 1.0.262 β†’ 1.0.264

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 (40) hide show
  1. package/CLAUDE.md +31 -27
  2. package/dist/src/cli/commands/docs.js +4 -4
  3. package/dist/src/cli/commands/docs.js.map +1 -1
  4. package/dist/src/dashboard/server/dashboard-server.d.ts.map +1 -1
  5. package/dist/src/dashboard/server/dashboard-server.js +2 -1
  6. package/dist/src/dashboard/server/dashboard-server.js.map +1 -1
  7. package/dist/src/dashboard/server/data/dashboard-data-aggregator.d.ts +9 -1
  8. package/dist/src/dashboard/server/data/dashboard-data-aggregator.d.ts.map +1 -1
  9. package/dist/src/dashboard/server/data/dashboard-data-aggregator.js +140 -13
  10. package/dist/src/dashboard/server/data/dashboard-data-aggregator.js.map +1 -1
  11. package/dist/src/dashboard/server/data/plugin-scanner.d.ts +1 -1
  12. package/dist/src/dashboard/server/data/plugin-scanner.d.ts.map +1 -1
  13. package/dist/src/dashboard/server/data/plugin-scanner.js +2 -2
  14. package/dist/src/dashboard/server/data/plugin-scanner.js.map +1 -1
  15. package/dist/src/utils/docs-preview/config-generator.d.ts +14 -6
  16. package/dist/src/utils/docs-preview/config-generator.d.ts.map +1 -1
  17. package/dist/src/utils/docs-preview/config-generator.js +504 -126
  18. package/dist/src/utils/docs-preview/config-generator.js.map +1 -1
  19. package/dist/src/utils/docs-preview/docusaurus-setup.d.ts +1 -1
  20. package/dist/src/utils/docs-preview/docusaurus-setup.d.ts.map +1 -1
  21. package/dist/src/utils/docs-preview/docusaurus-setup.js +92 -48
  22. package/dist/src/utils/docs-preview/docusaurus-setup.js.map +1 -1
  23. package/dist/src/utils/docs-preview/index.d.ts +2 -1
  24. package/dist/src/utils/docs-preview/index.d.ts.map +1 -1
  25. package/dist/src/utils/docs-preview/index.js +2 -1
  26. package/dist/src/utils/docs-preview/index.js.map +1 -1
  27. package/dist/src/utils/docs-preview/project-detector.d.ts +16 -0
  28. package/dist/src/utils/docs-preview/project-detector.d.ts.map +1 -0
  29. package/dist/src/utils/docs-preview/project-detector.js +215 -0
  30. package/dist/src/utils/docs-preview/project-detector.js.map +1 -0
  31. package/dist/src/utils/docs-preview/types.d.ts +26 -0
  32. package/dist/src/utils/docs-preview/types.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/plugins/specweave/hooks/hooks.json +9 -0
  35. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use-analytics.sh +83 -0
  36. package/plugins/specweave/scripts/progress.js +148 -50
  37. package/plugins/specweave/scripts/read-progress.sh +128 -52
  38. package/plugins/specweave/scripts/rebuild-dashboard-cache.sh +23 -17
  39. package/plugins/specweave/scripts/track-analytics.sh +4 -0
  40. package/plugins/specweave/skills/progress/SKILL.md +7 -21
@@ -1,3 +1,27 @@
1
+ export interface DocCategory {
2
+ /** Folder name (e.g., 'strategy') */
3
+ id: string;
4
+ /** Human-readable label (e.g., 'Strategy') */
5
+ label: string;
6
+ /** Short description for landing page */
7
+ description: string;
8
+ /** Emoji icon for the category */
9
+ icon: string;
10
+ /** Number of markdown documents found */
11
+ docCount: number;
12
+ }
13
+ export interface ProjectMetadata {
14
+ /** Project name */
15
+ name: string;
16
+ /** Project description / tagline */
17
+ description: string;
18
+ /** 1-2 letter initials for logo generation */
19
+ initials: string;
20
+ /** Detected doc categories that actually exist */
21
+ categories: DocCategory[];
22
+ /** Source of the project name detection */
23
+ source: 'config' | 'package' | 'directory';
24
+ }
1
25
  export interface DocusaurusConfig {
2
26
  title: string;
3
27
  tagline: string;
@@ -7,6 +31,8 @@ export interface DocusaurusConfig {
7
31
  port?: number;
8
32
  theme?: 'default' | 'classic' | 'dark';
9
33
  excludeFolders?: string[];
34
+ /** Auto-detected project metadata */
35
+ projectMetadata?: ProjectMetadata;
10
36
  }
11
37
  export interface SidebarItem {
12
38
  type: 'doc' | 'category';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/docs-pre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AAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specweave",
3
- "version": "1.0.262",
3
+ "version": "1.0.264",
4
4
  "description": "Spec-driven development framework for AI coding agents. First-class support for Claude Code β€” compatible with any LLM-powered coding tool. Living documentation, autonomous execution, quality gates, and multilingual support (9 languages).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -51,6 +51,15 @@
51
51
  "command": "bash -c 'W=\"${CLAUDE_PLUGIN_ROOT}/hooks/universal/fail-fast-wrapper.sh\"; S=\"${CLAUDE_PLUGIN_ROOT}/hooks/v2/dispatchers/post-tool-use.sh\"; [[ -x \"$W\" ]] && exec \"$W\" \"$S\" || (cat >/dev/null && printf \"{\\\"continue\\\":true}\")'"
52
52
  }
53
53
  ]
54
+ },
55
+ {
56
+ "matcher": "Skill|Task",
57
+ "hooks": [
58
+ {
59
+ "type": "command",
60
+ "command": "bash -c 'W=\"${CLAUDE_PLUGIN_ROOT}/hooks/universal/fail-fast-wrapper.sh\"; S=\"${CLAUDE_PLUGIN_ROOT}/hooks/v2/dispatchers/post-tool-use-analytics.sh\"; [[ -x \"$W\" ]] && exec \"$W\" \"$S\" || (cat >/dev/null && printf \"{\\\"continue\\\":true}\")'"
61
+ }
62
+ ]
54
63
  }
55
64
  ],
56
65
  "Stop": [
@@ -0,0 +1,83 @@
1
+ #!/bin/bash
2
+ # post-tool-use-analytics.sh - Track Skill and Task tool usage for analytics
3
+ #
4
+ # PostToolUse hook for Skill|Task tools (separate from Edit|Write dispatcher)
5
+ # Extracts skill/agent info from stdin JSON and calls track-analytics.sh
6
+ #
7
+ # CRITICAL: Must exit 0, never block, run <5s
8
+
9
+ set +e
10
+
11
+ [[ "${SPECWEAVE_DISABLE_HOOKS:-0}" == "1" ]] && exit 0
12
+
13
+ # Project root detection
14
+ PROJECT_ROOT="$PWD"
15
+ while [[ "$PROJECT_ROOT" != "/" ]] && [[ ! -d "$PROJECT_ROOT/.specweave" ]]; do
16
+ PROJECT_ROOT=$(dirname "$PROJECT_ROOT")
17
+ done
18
+ [[ ! -d "$PROJECT_ROOT/.specweave" ]] && exit 0
19
+
20
+ # Read stdin (tool result JSON)
21
+ INPUT=""
22
+ if command -v gtimeout >/dev/null 2>&1; then
23
+ INPUT=$(gtimeout 1 cat 2>/dev/null || echo '{}')
24
+ elif command -v timeout >/dev/null 2>&1; then
25
+ INPUT=$(timeout 1 cat 2>/dev/null || echo '{}')
26
+ else
27
+ INPUT=$(cat 2>/dev/null || echo '{}')
28
+ fi
29
+
30
+ [[ -z "$INPUT" ]] && exit 0
31
+
32
+ # Script paths
33
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
34
+ PLUGIN_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
35
+ TRACK_SCRIPT="$PLUGIN_ROOT/scripts/track-analytics.sh"
36
+
37
+ [[ ! -f "$TRACK_SCRIPT" ]] && exit 0
38
+
39
+ # Detect active increment for context
40
+ ACTIVE_INCREMENT=""
41
+ CACHE_FILE="$PROJECT_ROOT/.specweave/state/status-line.json"
42
+ if [[ -f "$CACHE_FILE" ]] && command -v jq >/dev/null 2>&1; then
43
+ ACTIVE_INCREMENT=$(jq -r '.incrementId // ""' "$CACHE_FILE" 2>/dev/null || echo "")
44
+ fi
45
+
46
+ # Extract tool_name
47
+ TOOL_NAME=$(echo "$INPUT" | grep -o '"tool_name"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"\([^"]*\)".*/\1/')
48
+
49
+ # Fallback: detect tool type from input fields
50
+ if [[ -z "$TOOL_NAME" ]]; then
51
+ if echo "$INPUT" | grep -q '"skill"[[:space:]]*:'; then
52
+ TOOL_NAME="Skill"
53
+ elif echo "$INPUT" | grep -q '"subagent_type"[[:space:]]*:'; then
54
+ TOOL_NAME="Task"
55
+ fi
56
+ fi
57
+
58
+ case "$TOOL_NAME" in
59
+ Skill)
60
+ SKILL_NAME=$(echo "$INPUT" | grep -o '"skill"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"\([^"]*\)".*/\1/')
61
+ [[ -z "$SKILL_NAME" ]] && exit 0
62
+
63
+ # Extract plugin from skill name prefix
64
+ PLUGIN="specweave"
65
+ if [[ "$SKILL_NAME" == *:* ]]; then
66
+ PREFIX="${SKILL_NAME%%:*}"
67
+ if [[ "$PREFIX" != "sw" ]]; then
68
+ PLUGIN="$PREFIX"
69
+ fi
70
+ fi
71
+
72
+ bash "$TRACK_SCRIPT" skill "$SKILL_NAME" --plugin "$PLUGIN" --success --increment "$ACTIVE_INCREMENT" 2>/dev/null &
73
+ ;;
74
+
75
+ Task)
76
+ AGENT_TYPE=$(echo "$INPUT" | grep -o '"subagent_type"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"\([^"]*\)".*/\1/')
77
+ [[ -z "$AGENT_TYPE" ]] && AGENT_TYPE="general"
78
+
79
+ bash "$TRACK_SCRIPT" agent "$AGENT_TYPE" --plugin specweave --success --increment "$ACTIVE_INCREMENT" 2>/dev/null &
80
+ ;;
81
+ esac
82
+
83
+ exit 0
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Instant Increment Progress
3
+ * Instant Increment Progress (Node.js fallback)
4
4
  *
5
- * Executed by UserPromptSubmit hook for /sw:progress
6
- * Bypasses LLM entirely - output shown directly to user
5
+ * Executed by UserPromptSubmit hook for /sw:progress when jq is unavailable.
6
+ * Reads files directly (no cache needed). Bypasses LLM entirely.
7
7
  *
8
8
  * Usage: node progress.js [incrementId] [--help]
9
9
  */
@@ -67,34 +67,80 @@ if (incrementFolders.length === 0) {
67
67
  function parseIncrement(folder) {
68
68
  const metaPath = path.join(incrementsDir, folder, 'metadata.json');
69
69
  const tasksPath = path.join(incrementsDir, folder, 'tasks.md');
70
-
70
+ const specPath = path.join(incrementsDir, folder, 'spec.md');
71
+
71
72
  let metadata = { status: 'unknown' };
72
73
  if (fs.existsSync(metaPath)) {
73
74
  try {
74
75
  metadata = JSON.parse(fs.readFileSync(metaPath, 'utf-8'));
75
76
  } catch {}
76
77
  }
77
-
78
+
78
79
  let totalTasks = 0;
79
80
  let completedTasks = 0;
80
-
81
+
81
82
  if (fs.existsSync(tasksPath)) {
82
83
  const content = fs.readFileSync(tasksPath, 'utf-8');
83
- const taskMatches = content.match(/### T-\d+/g);
84
- totalTasks = taskMatches ? taskMatches.length : 0;
85
-
86
- const completedMatches = content.match(/\*\*Status\*\*:\s*\[x\]/gi);
87
- completedTasks = completedMatches ? completedMatches.length : 0;
84
+ const headingTasks = (content.match(/^#{2,} T-\d+/gm) || []).length;
85
+ const checklistTasks = (content.match(/^- \[[x ]\] T-\d+/gm) || []).length;
86
+ totalTasks = headingTasks + checklistTasks;
87
+
88
+ const completedStatus = (content.match(/\*\*Status\*\*:\s*\[x\]/gi) || []).length;
89
+ const completedDate = (content.match(/\*\*Completed\*\*:\s*\d/gi) || []).length;
90
+ const completedChecklist = (content.match(/^- \[x\] T-\d+/gm) || []).length;
91
+ completedTasks = completedStatus + completedDate + completedChecklist;
88
92
  }
89
-
93
+
94
+ let totalAcs = 0;
95
+ let completedAcs = 0;
96
+ if (fs.existsSync(specPath)) {
97
+ const specContent = fs.readFileSync(specPath, 'utf-8');
98
+ const acMatches = specContent.match(/- \[.\] \*\*AC-/g);
99
+ totalAcs = acMatches ? acMatches.length : 0;
100
+ const acDone = specContent.match(/- \[x\] \*\*AC-/g);
101
+ completedAcs = acDone ? acDone.length : 0;
102
+ }
103
+
104
+ // Get last activity from newest file mtime
105
+ let lastActivity = 0;
106
+ try {
107
+ if (fs.existsSync(metaPath)) lastActivity = Math.max(lastActivity, fs.statSync(metaPath).mtimeMs);
108
+ if (fs.existsSync(tasksPath)) lastActivity = Math.max(lastActivity, fs.statSync(tasksPath).mtimeMs);
109
+ if (fs.existsSync(specPath)) lastActivity = Math.max(lastActivity, fs.statSync(specPath).mtimeMs);
110
+ } catch {}
111
+
90
112
  return {
91
113
  id: folder,
92
114
  status: metadata.status || 'unknown',
93
115
  type: metadata.type || 'feature',
116
+ priority: metadata.priority || 'P1',
94
117
  totalTasks,
95
118
  completedTasks,
96
- percentage: totalTasks > 0 ? Math.round((completedTasks / totalTasks) * 100) : 0
119
+ totalAcs,
120
+ completedAcs,
121
+ percentage: totalTasks > 0 ? Math.round((completedTasks / totalTasks) * 100) : 0,
122
+ lastActivity
123
+ };
124
+ }
125
+
126
+ // Helpers
127
+ function createProgressBar(pct, width = 20) {
128
+ const filled = Math.round((pct / 100) * width);
129
+ const empty = width - filled;
130
+ return `[${'β–ˆ'.repeat(filled)}${'β–‘'.repeat(empty)}]`;
131
+ }
132
+
133
+ function formatStatus(status) {
134
+ const icons = {
135
+ 'active': 'πŸ”„ active',
136
+ 'planning': 'πŸ“ planning',
137
+ 'backlog': 'πŸ“‹ backlog',
138
+ 'ready_for_review': 'πŸ‘€ ready for review',
139
+ 'paused': '⏸️ paused',
140
+ 'completed': 'βœ… completed',
141
+ 'abandoned': '❌ abandoned'
97
142
  };
143
+ return icons[status] || status;
98
144
  }
99
145
 
100
146
  // If specific increment requested
@@ -104,67 +150,139 @@ if (specificId) {
104
150
  console.log(`Increment not found: ${specificId}`);
105
151
  process.exit(1);
106
152
  }
107
-
153
+
108
154
  const inc = parseIncrement(folder);
109
155
  const bar = createProgressBar(inc.percentage);
110
-
156
+
111
157
  console.log(`\nπŸ“Š Progress: ${inc.id}\n`);
112
158
  console.log(`Status: ${formatStatus(inc.status)}`);
113
159
  console.log(`Type: ${inc.type}`);
114
160
  console.log(`Tasks: ${inc.completedTasks}/${inc.totalTasks} (${inc.percentage}%)`);
115
161
  console.log(`Progress: ${bar}`);
162
+ if (inc.totalAcs > 0) {
163
+ const acPct = Math.round((inc.completedAcs / inc.totalAcs) * 100);
164
+ console.log(`ACs: ${inc.completedAcs}/${inc.totalAcs} (${acPct}%)`);
165
+ }
116
166
  process.exit(0);
117
167
  }
118
168
 
119
169
  // Show all active increments
120
170
  const increments = incrementFolders.map(parseIncrement);
121
- const readyForReview = increments.filter(i => i.status === 'ready_for_review');
122
- const active = increments.filter(i => ['active', 'planning', 'backlog'].includes(i.status));
171
+
172
+ // Categorize increments
173
+ const needsClosure = increments
174
+ .filter(i => ['active', 'planning', 'planned'].includes(i.status) && i.totalTasks > 0 && i.completedTasks === i.totalTasks)
175
+ .sort((a, b) => b.lastActivity - a.lastActivity);
176
+
177
+ const readyForReview = increments
178
+ .filter(i => i.status === 'ready_for_review')
179
+ .sort((a, b) => b.lastActivity - a.lastActivity);
180
+
181
+ const active = increments
182
+ .filter(i => ['active', 'planning', 'planned'].includes(i.status) &&
183
+ (i.totalTasks > 0 || i.totalAcs > 0) &&
184
+ !(i.totalTasks > 0 && i.completedTasks === i.totalTasks))
185
+ .sort((a, b) => b.lastActivity - a.lastActivity);
186
+
187
+ const emptyActive = increments
188
+ .filter(i => ['active', 'planning', 'planned'].includes(i.status) && i.totalTasks === 0 && i.totalAcs === 0);
189
+
190
+ const backlog = increments
191
+ .filter(i => i.status === 'backlog')
192
+ .sort((a, b) => b.lastActivity - a.lastActivity);
193
+
123
194
  const paused = increments.filter(i => i.status === 'paused');
124
195
 
125
196
  console.log('\nπŸ“Š Increment Progress\n');
126
197
 
127
- // Show ready_for_review FIRST (needs attention!)
198
+ // Section 1: Needs Closure
199
+ if (needsClosure.length > 0) {
200
+ console.log('⚠️ Needs Closure (100% tasks done):');
201
+ for (const inc of needsClosure) {
202
+ console.log(` ${inc.id} β†’ /sw:done ${inc.id}`);
203
+ }
204
+ console.log('');
205
+ }
206
+
207
+ // Section 2: Ready for Review
128
208
  if (readyForReview.length > 0) {
129
- console.log(`πŸ‘€ Ready for Review (${readyForReview.length}):`);
209
+ console.log('πŸ‘€ Ready for Review:');
130
210
  for (const inc of readyForReview) {
131
- const bar = createProgressBar(inc.percentage, 15);
132
- console.log(` ${inc.id}`);
133
- console.log(` ${bar} ${inc.completedTasks}/${inc.totalTasks} (${inc.percentage}%)`);
211
+ const bar = createProgressBar(inc.percentage, 12);
212
+ const priBadge = inc.priority === 'P0' ? 'πŸ”΄' : inc.priority === 'P1' ? '🟠' : '';
213
+ let acInfo = '';
214
+ if (inc.totalAcs > 0) {
215
+ const acPct = Math.round((inc.completedAcs / inc.totalAcs) * 100);
216
+ acInfo = ` | ${inc.completedAcs}/${inc.totalAcs} ACs (${acPct}%)`;
217
+ }
218
+ console.log(` ${priBadge} ${inc.id}`);
219
+ console.log(` ${bar} ${inc.completedTasks}/${inc.totalTasks} tasks${acInfo}`);
134
220
  console.log(` β†’ /sw:done ${inc.id}`);
135
221
  }
136
222
  console.log('');
137
223
  }
138
224
 
225
+ // Section 3: Active (with work, not done, not empty)
139
226
  if (active.length > 0) {
140
- console.log(`πŸ”„ Active (${active.length}):`);
227
+ console.log('πŸ”„ Active:');
141
228
  for (const inc of active) {
142
- const bar = createProgressBar(inc.percentage, 15);
143
- console.log(` ${inc.id}`);
144
- console.log(` ${bar} ${inc.completedTasks}/${inc.totalTasks} (${inc.percentage}%)`);
229
+ const bar = createProgressBar(inc.percentage, 12);
230
+ const priBadge = inc.priority === 'P0' ? 'πŸ”΄' : inc.priority === 'P1' ? '🟠' : '';
231
+ const statusInd = ['planning', 'planned'].includes(inc.status) ? ' (πŸ“ planning)' : '';
232
+ let acInfo = '';
233
+ if (inc.totalAcs > 0) {
234
+ const acPct = Math.round((inc.completedAcs / inc.totalAcs) * 100);
235
+ acInfo = ` | ${inc.completedAcs}/${inc.totalAcs} ACs (${acPct}%)`;
236
+ }
237
+ console.log(` ${priBadge} ${inc.id}${statusInd}`);
238
+ console.log(` ${bar} ${inc.completedTasks}/${inc.totalTasks} tasks${acInfo}`);
145
239
  }
146
240
  console.log('');
147
241
  }
148
242
 
243
+ // Section 4: Planning (no tasks) β€” collapsed
244
+ if (emptyActive.length > 0) {
245
+ const ids = emptyActive.map(i => i.id).join(', ');
246
+ console.log(`πŸ“ Planning (no tasks): ${ids}`);
247
+ console.log('');
248
+ }
249
+
250
+ // Section 5: Backlog
251
+ if (backlog.length > 0) {
252
+ console.log('πŸ“‹ Backlog:');
253
+ for (const inc of backlog) {
254
+ const priBadge = inc.priority === 'P0' ? 'πŸ”΄' : inc.priority === 'P1' ? '🟠' : '';
255
+ console.log(` ${priBadge} ${inc.id} - ${inc.percentage}% planned`);
256
+ }
257
+ console.log('');
258
+ }
259
+
260
+ // Section 6: Paused
149
261
  if (paused.length > 0) {
150
262
  console.log(`⏸️ Paused (${paused.length}):`);
151
263
  for (const inc of paused) {
152
- console.log(` ${inc.id} - ${inc.percentage}%`);
264
+ console.log(` ${inc.id} - ${inc.percentage}% tasks`);
153
265
  }
154
266
  console.log('');
155
267
  }
156
268
 
157
- // Summary section
158
- if (readyForReview.length > 0 || active.length > 0 || paused.length > 0) {
269
+ // Summary
270
+ const totalActionable = needsClosure.length + readyForReview.length + active.length + emptyActive.length + backlog.length + paused.length;
271
+ if (totalActionable > 0) {
159
272
  console.log('─'.repeat(40));
160
273
  const parts = [];
274
+ if (needsClosure.length > 0) parts.push(`${needsClosure.length} needs closure`);
161
275
  if (readyForReview.length > 0) parts.push(`${readyForReview.length} ready for review`);
162
276
  if (active.length > 0) parts.push(`${active.length} active`);
277
+ if (emptyActive.length > 0) parts.push(`${emptyActive.length} planning`);
278
+ if (backlog.length > 0) parts.push(`${backlog.length} backlog`);
163
279
  if (paused.length > 0) parts.push(`${paused.length} paused`);
164
280
  console.log(`Summary: ${parts.join(', ')}`);
165
281
  console.log('');
166
282
 
167
- if (readyForReview.length > 0) {
283
+ if (needsClosure.length > 0) {
284
+ console.log('πŸ’‘ Run /sw:done <id> to close completed increments');
285
+ } else if (readyForReview.length > 0) {
168
286
  console.log('πŸ’‘ Run /sw:done <id> to close reviewed increments');
169
287
  } else {
170
288
  console.log('πŸ’‘ For details: /sw:progress <incrementId>');
@@ -178,23 +296,3 @@ if (readyForReview.length > 0 || active.length > 0 || paused.length > 0) {
178
296
  console.log('');
179
297
  console.log('πŸ’‘ Run /sw:increment to start new work');
180
298
  }
181
-
182
- // Helpers
183
- function createProgressBar(pct, width = 20) {
184
- const filled = Math.round((pct / 100) * width);
185
- const empty = width - filled;
186
- return `[${'β–ˆ'.repeat(filled)}${'β–‘'.repeat(empty)}]`;
187
- }
188
-
189
- function formatStatus(status) {
190
- const icons = {
191
- 'active': 'πŸ”„ active',
192
- 'planning': 'πŸ“ planning',
193
- 'backlog': 'πŸ“‹ backlog',
194
- 'ready_for_review': 'πŸ‘€ ready for review',
195
- 'paused': '⏸️ paused',
196
- 'completed': 'βœ… completed',
197
- 'abandoned': '❌ abandoned'
198
- };
199
- return icons[status] || status;
200
- }