@leeovery/claude-technical-workflows 2.0.34 → 2.0.36
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.
- package/README.md +5 -2
- package/commands/migrate.md +43 -0
- package/commands/workflow/start-discussion.md +13 -5
- package/commands/workflow/start-implementation.md +8 -0
- package/commands/workflow/start-planning.md +8 -0
- package/commands/workflow/start-research.md +8 -0
- package/commands/workflow/start-review.md +8 -0
- package/commands/workflow/start-specification.md +24 -9
- package/commands/workflow/status.md +8 -0
- package/commands/workflow/view-plan.md +8 -0
- package/package.json +1 -1
- package/scripts/migrate.sh +133 -0
- package/scripts/migrations/001-discussion-frontmatter.sh +141 -0
- package/scripts/specification-discovery.sh +3 -14
- package/skills/technical-discussion/references/guidelines.md +2 -0
- package/skills/technical-discussion/references/template.md +9 -4
package/README.md
CHANGED
|
@@ -251,7 +251,9 @@ agents/
|
|
|
251
251
|
└── chain-verifier.md # Parallel task verification for review
|
|
252
252
|
|
|
253
253
|
scripts/ # Helper scripts for commands
|
|
254
|
-
|
|
254
|
+
├── migrate.sh # Migration orchestrator
|
|
255
|
+
├── specification-discovery.sh # Discovery for specification command
|
|
256
|
+
└── migrations/ # Individual migration scripts (numbered)
|
|
255
257
|
```
|
|
256
258
|
|
|
257
259
|
## Skills
|
|
@@ -286,10 +288,11 @@ Sequential commands in `commands/workflow/`. They expect files from previous pha
|
|
|
286
288
|
|
|
287
289
|
### Utility Commands
|
|
288
290
|
|
|
289
|
-
Helpers for navigating and
|
|
291
|
+
Helpers for navigating and maintaining the workflow.
|
|
290
292
|
|
|
291
293
|
| Command | Description |
|
|
292
294
|
|--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
|
295
|
+
| [**/migrate**](commands/migrate.md) | Keep workflow files in sync with the current system design. Runs automatically at the start of every workflow command. |
|
|
293
296
|
| [**/status**](commands/workflow/status.md) | Show workflow status - what topics exist at each phase, and suggested next steps. |
|
|
294
297
|
| [**/view-plan**](commands/workflow/view-plan.md) | View a plan's tasks and progress, regardless of output format. |
|
|
295
298
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run migrations to keep workflow files in sync with the current system design. This command is mandatory before running any workflow command.
|
|
3
|
+
allowed-tools: Bash(.claude/scripts/migrate.sh)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Migrate
|
|
7
|
+
|
|
8
|
+
Keeps your workflow files up to date with how the system is designed to work. Runs all pending migrations automatically.
|
|
9
|
+
|
|
10
|
+
## Instructions
|
|
11
|
+
|
|
12
|
+
Run the migration script:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
.claude/scripts/migrate.sh
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### If files were updated
|
|
19
|
+
|
|
20
|
+
The script will list which files were updated. Present this to the user:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
{list from script output}
|
|
24
|
+
|
|
25
|
+
Review changes with `git diff`, then proceed when ready.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Wait for user acknowledgment before returning control to the calling command.
|
|
29
|
+
|
|
30
|
+
### If no updates needed
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
All documents up to date.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Return control silently - no user interaction needed.
|
|
37
|
+
|
|
38
|
+
## Notes
|
|
39
|
+
|
|
40
|
+
- This command is run automatically at the start of every workflow command
|
|
41
|
+
- Migrations are tracked in `docs/workflow/.cache/migrations.log`
|
|
42
|
+
- To force re-running all migrations, delete the tracking file
|
|
43
|
+
- Each migration is idempotent - safe to run multiple times
|
|
@@ -31,6 +31,14 @@ Before beginning, discover existing work and determine the best entry path.
|
|
|
31
31
|
|
|
32
32
|
Use simple, individual commands. Never combine multiple operations into bash loops or one-liners. Execute commands one at a time.
|
|
33
33
|
|
|
34
|
+
## Step 0: Run Migrations
|
|
35
|
+
|
|
36
|
+
**This step is mandatory. You must complete it before proceeding.**
|
|
37
|
+
|
|
38
|
+
Invoke the `/migrate` command and assess its output before proceeding to Step 1.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
34
42
|
## Step 1: Discover Existing Work
|
|
35
43
|
|
|
36
44
|
Scan the codebase for research and discussions:
|
|
@@ -44,8 +52,8 @@ Scan the codebase for research and discussions:
|
|
|
44
52
|
- Each file is named `{topic}.md`
|
|
45
53
|
|
|
46
54
|
3. **Check discussion status**: For each discussion file
|
|
47
|
-
- Run `head -10 docs/workflow/discussion/{topic}.md` to
|
|
48
|
-
-
|
|
55
|
+
- Run `head -10 docs/workflow/discussion/{topic}.md` to read the frontmatter
|
|
56
|
+
- Extract the `status:` field from YAML frontmatter: `in-progress` or `concluded`
|
|
49
57
|
- Do NOT use bash loops - run separate commands for each file
|
|
50
58
|
|
|
51
59
|
4. **Check for cached analysis** (if research files exist):
|
|
@@ -177,13 +185,13 @@ Then skip to Step 5 (Gather Context) with the fresh topic path.
|
|
|
177
185
|
• {topic}.md — {Status}
|
|
178
186
|
"{Brief description from context section}"
|
|
179
187
|
|
|
180
|
-
• {topic}.md —
|
|
188
|
+
• {topic}.md — concluded
|
|
181
189
|
"{Brief description}"
|
|
182
190
|
```
|
|
183
191
|
|
|
184
192
|
**Key:**
|
|
185
|
-
-
|
|
186
|
-
-
|
|
193
|
+
- in-progress = Active discussion
|
|
194
|
+
- concluded = Complete (can still be reopened)
|
|
187
195
|
|
|
188
196
|
**Then present the options based on what exists:**
|
|
189
197
|
|
|
@@ -37,6 +37,14 @@ Before beginning, discover existing work and gather necessary information.
|
|
|
37
37
|
|
|
38
38
|
Use simple, individual commands. Never combine multiple operations into bash loops or one-liners. Execute commands one at a time.
|
|
39
39
|
|
|
40
|
+
## Step 0: Run Migrations
|
|
41
|
+
|
|
42
|
+
**This step is mandatory. You must complete it before proceeding.**
|
|
43
|
+
|
|
44
|
+
Invoke the `/migrate` command and assess its output before proceeding to Step 1.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
40
48
|
## Step 1: Discover Existing Plans
|
|
41
49
|
|
|
42
50
|
Scan the codebase for plans:
|
|
@@ -31,6 +31,14 @@ Before beginning, discover existing work and gather necessary information.
|
|
|
31
31
|
|
|
32
32
|
Use simple, individual commands. Never combine multiple operations into bash loops or one-liners. Execute commands one at a time.
|
|
33
33
|
|
|
34
|
+
## Step 0: Run Migrations
|
|
35
|
+
|
|
36
|
+
**This step is mandatory. You must complete it before proceeding.**
|
|
37
|
+
|
|
38
|
+
Invoke the `/migrate` command and assess its output before proceeding to Step 1.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
34
42
|
## Step 1: Discover Existing Work
|
|
35
43
|
|
|
36
44
|
Scan the codebase for specifications and plans:
|
|
@@ -23,6 +23,14 @@ This is **Phase 1** of the six-phase workflow:
|
|
|
23
23
|
|
|
24
24
|
## Instructions
|
|
25
25
|
|
|
26
|
+
## Step 0: Run Migrations
|
|
27
|
+
|
|
28
|
+
**This step is mandatory. You must complete it before proceeding.**
|
|
29
|
+
|
|
30
|
+
Invoke the `/migrate` command and assess its output before proceeding.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
26
34
|
Ask these questions to gather context:
|
|
27
35
|
|
|
28
36
|
1. **What's on your mind?**
|
|
@@ -31,6 +31,14 @@ Before beginning, discover existing work and gather necessary information.
|
|
|
31
31
|
|
|
32
32
|
Use simple, individual commands. Never combine multiple operations into bash loops or one-liners. Execute commands one at a time.
|
|
33
33
|
|
|
34
|
+
## Step 0: Run Migrations
|
|
35
|
+
|
|
36
|
+
**This step is mandatory. You must complete it before proceeding.**
|
|
37
|
+
|
|
38
|
+
Invoke the `/migrate` command and assess its output before proceeding to Step 1.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
34
42
|
## Step 1: Discover Existing Plans
|
|
35
43
|
|
|
36
44
|
Scan the codebase for plans:
|
|
@@ -30,6 +30,14 @@ Follow these steps EXACTLY as written. Do not skip steps or combine them. Presen
|
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
+
## Step 0: Run Migrations
|
|
34
|
+
|
|
35
|
+
**This step is mandatory. You must complete it before proceeding.**
|
|
36
|
+
|
|
37
|
+
Invoke the `/migrate` command and assess its output before proceeding to Step 1.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
33
41
|
## Step 1: Run Discovery Script
|
|
34
42
|
|
|
35
43
|
Run the discovery script to gather current state:
|
|
@@ -78,9 +86,9 @@ The specification phase requires a completed discussion. Please run /start-discu
|
|
|
78
86
|
```
|
|
79
87
|
No concluded discussions found.
|
|
80
88
|
|
|
81
|
-
The following discussions are still
|
|
82
|
-
- {topic-1} (
|
|
83
|
-
- {topic-2} (
|
|
89
|
+
The following discussions are still in progress:
|
|
90
|
+
- {topic-1} (in-progress)
|
|
91
|
+
- {topic-2} (in-progress)
|
|
84
92
|
|
|
85
93
|
Please complete the discussion phase before creating specifications. Run /start-discussion to continue a discussion.
|
|
86
94
|
```
|
|
@@ -106,7 +114,7 @@ Discussions:
|
|
|
106
114
|
✓ {topic-1} - concluded - ready
|
|
107
115
|
✓ {topic-2} - concluded - ready
|
|
108
116
|
○ {topic-3} - concluded - has individual spec
|
|
109
|
-
· {topic-4} -
|
|
117
|
+
· {topic-4} - in-progress - not ready
|
|
110
118
|
|
|
111
119
|
Specifications:
|
|
112
120
|
• {spec-1} (active) - sources: {topic-1}
|
|
@@ -118,7 +126,7 @@ Specifications:
|
|
|
118
126
|
**Legend:**
|
|
119
127
|
- `✓` = concluded, no spec yet (ready to specify)
|
|
120
128
|
- `○` = concluded, has individual spec (can be combined or continued)
|
|
121
|
-
- `·` =
|
|
129
|
+
- `·` = in-progress (not ready)
|
|
122
130
|
|
|
123
131
|
#### Routing Based on State
|
|
124
132
|
|
|
@@ -333,7 +341,7 @@ Coupling: {explanation}
|
|
|
333
341
|
|
|
334
342
|
How would you like to proceed?
|
|
335
343
|
|
|
336
|
-
1. **
|
|
344
|
+
1. **Proceed as recommended** - I'll ask which to start with
|
|
337
345
|
2. **Combine differently** - Tell me your preferred groupings
|
|
338
346
|
3. **Single specification** - Consolidate ALL into one unified spec
|
|
339
347
|
4. **Individual specifications** - Create 1:1 specs (I'll ask which to start)
|
|
@@ -351,16 +359,23 @@ How would you like to proceed?
|
|
|
351
359
|
|
|
352
360
|
Based on user's choice from Step 7:
|
|
353
361
|
|
|
354
|
-
#### If "
|
|
362
|
+
#### If "Proceed as recommended"
|
|
355
363
|
|
|
356
364
|
```
|
|
357
|
-
Which
|
|
365
|
+
Which would you like to start with?
|
|
358
366
|
|
|
367
|
+
Grouped:
|
|
359
368
|
1. {Grouping Name A} - {N} discussions
|
|
360
369
|
2. {Grouping Name B} - {N} discussions (specification exists)
|
|
361
370
|
3. {Grouping Name C} - {N} discussions
|
|
371
|
+
|
|
372
|
+
Independent:
|
|
373
|
+
4. {topic-f} - standalone
|
|
374
|
+
5. {topic-g} - standalone
|
|
362
375
|
```
|
|
363
376
|
|
|
377
|
+
List ALL items from the analysis: grouped specifications first, then independent discussions. Number them consecutively.
|
|
378
|
+
|
|
364
379
|
**STOP.** Wait for user to pick a number, then proceed to **Step 9**.
|
|
365
380
|
|
|
366
381
|
#### If "Combine differently"
|
|
@@ -506,7 +521,7 @@ Before invoking the specification skill:
|
|
|
506
521
|
2. Any constraints or changes since the discussion(s) concluded?
|
|
507
522
|
3. Are there existing partial implementations or related documentation I should review?
|
|
508
523
|
|
|
509
|
-
(
|
|
524
|
+
(Say 'none' or 'continue' if nothing to add)
|
|
510
525
|
```
|
|
511
526
|
|
|
512
527
|
**STOP.** Wait for user response.
|
|
@@ -4,6 +4,14 @@ description: Show workflow status - what exists, where you are, and what to do n
|
|
|
4
4
|
|
|
5
5
|
Show the current state of the workflow for this project.
|
|
6
6
|
|
|
7
|
+
## Step 0: Run Migrations
|
|
8
|
+
|
|
9
|
+
**This step is mandatory. You must complete it before proceeding.**
|
|
10
|
+
|
|
11
|
+
Invoke the `/migrate` command and assess its output before proceeding to Step 1.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
7
15
|
## Step 1: Scan Directories
|
|
8
16
|
|
|
9
17
|
Check for files in each workflow directory:
|
|
@@ -4,6 +4,14 @@ description: View a plan's tasks and progress, regardless of output format.
|
|
|
4
4
|
|
|
5
5
|
Display a readable summary of a plan's phases, tasks, and status.
|
|
6
6
|
|
|
7
|
+
## Step 0: Run Migrations
|
|
8
|
+
|
|
9
|
+
**This step is mandatory. You must complete it before proceeding.**
|
|
10
|
+
|
|
11
|
+
Invoke the `/migrate` command and assess its output before proceeding to Step 1.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
7
15
|
## Step 1: Identify the Plan
|
|
8
16
|
|
|
9
17
|
If no topic is specified, list available plans:
|
package/package.json
CHANGED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# migrate.sh
|
|
4
|
+
#
|
|
5
|
+
# Keeps workflow files in sync with the current system design.
|
|
6
|
+
# Runs all migration scripts in order, tracking progress to avoid redundant processing.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# ./scripts/migrate.sh
|
|
10
|
+
#
|
|
11
|
+
# Tracking:
|
|
12
|
+
# Migrations are tracked in docs/workflow/.cache/migrations.log
|
|
13
|
+
# Format: "filepath: migration_id" (one per line, append-only)
|
|
14
|
+
# Delete the log file to force re-running all migrations.
|
|
15
|
+
#
|
|
16
|
+
# Adding new migrations:
|
|
17
|
+
# 1. Create scripts/migrations/NNN-description.sh (e.g., 002-spec-frontmatter.sh)
|
|
18
|
+
# 2. The script will be run automatically in numeric order
|
|
19
|
+
# 3. Each migration script receives helper functions via source
|
|
20
|
+
#
|
|
21
|
+
|
|
22
|
+
set -eo pipefail
|
|
23
|
+
|
|
24
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
25
|
+
MIGRATIONS_DIR="$SCRIPT_DIR/migrations"
|
|
26
|
+
TRACKING_FILE="docs/workflow/.cache/migrations.log"
|
|
27
|
+
|
|
28
|
+
# Track counts for final report
|
|
29
|
+
FILES_UPDATED=0
|
|
30
|
+
FILES_SKIPPED=0
|
|
31
|
+
MIGRATIONS_RUN=0
|
|
32
|
+
|
|
33
|
+
# Ensure cache directory exists
|
|
34
|
+
mkdir -p "$(dirname "$TRACKING_FILE")"
|
|
35
|
+
|
|
36
|
+
# Touch tracking file if it doesn't exist
|
|
37
|
+
touch "$TRACKING_FILE"
|
|
38
|
+
|
|
39
|
+
#
|
|
40
|
+
# Helper function: Check if a migration has been applied to a file
|
|
41
|
+
# Usage: is_migrated "filepath" "migration_id"
|
|
42
|
+
# Returns: 0 if migrated, 1 if not
|
|
43
|
+
#
|
|
44
|
+
is_migrated() {
|
|
45
|
+
local filepath="$1"
|
|
46
|
+
local migration_id="$2"
|
|
47
|
+
grep -q "^${filepath}: ${migration_id}$" "$TRACKING_FILE" 2>/dev/null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#
|
|
51
|
+
# Helper function: Record that a migration was applied to a file
|
|
52
|
+
# Usage: record_migration "filepath" "migration_id"
|
|
53
|
+
#
|
|
54
|
+
record_migration() {
|
|
55
|
+
local filepath="$1"
|
|
56
|
+
local migration_id="$2"
|
|
57
|
+
echo "${filepath}: ${migration_id}" >> "$TRACKING_FILE"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#
|
|
61
|
+
# Helper function: Report a file update (for migration scripts to call)
|
|
62
|
+
# Usage: report_update "filepath" "description"
|
|
63
|
+
#
|
|
64
|
+
report_update() {
|
|
65
|
+
local filepath="$1"
|
|
66
|
+
local description="$2"
|
|
67
|
+
echo " ✓ $filepath ($description)"
|
|
68
|
+
FILES_UPDATED=$((FILES_UPDATED + 1))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#
|
|
72
|
+
# Helper function: Report a file skip (for migration scripts to call)
|
|
73
|
+
# Usage: report_skip "filepath"
|
|
74
|
+
#
|
|
75
|
+
report_skip() {
|
|
76
|
+
local filepath="$1"
|
|
77
|
+
FILES_SKIPPED=$((FILES_SKIPPED + 1))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# Export functions and variables for migration scripts
|
|
81
|
+
export -f is_migrated record_migration report_update report_skip
|
|
82
|
+
export TRACKING_FILE FILES_UPDATED FILES_SKIPPED
|
|
83
|
+
|
|
84
|
+
#
|
|
85
|
+
# Main: Run all migrations in order
|
|
86
|
+
#
|
|
87
|
+
|
|
88
|
+
# Check if migrations directory exists and has scripts
|
|
89
|
+
if [ ! -d "$MIGRATIONS_DIR" ]; then
|
|
90
|
+
echo "No migrations directory found at $MIGRATIONS_DIR"
|
|
91
|
+
exit 0
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# Find all migration scripts, sorted by name (numeric order)
|
|
95
|
+
mapfile -t MIGRATION_SCRIPTS < <(find "$MIGRATIONS_DIR" -name "*.sh" -type f | sort)
|
|
96
|
+
|
|
97
|
+
if [ ${#MIGRATION_SCRIPTS[@]} -eq 0 ]; then
|
|
98
|
+
echo "No migration scripts found."
|
|
99
|
+
exit 0
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
echo "Running migrations..."
|
|
103
|
+
echo ""
|
|
104
|
+
|
|
105
|
+
for script in "${MIGRATION_SCRIPTS[@]}"; do
|
|
106
|
+
# Extract migration ID from filename (e.g., "001" from "001-discussion-frontmatter.sh")
|
|
107
|
+
migration_id=$(basename "$script" .sh | grep -oE '^[0-9]+')
|
|
108
|
+
migration_name=$(basename "$script" .sh)
|
|
109
|
+
|
|
110
|
+
if [ -z "$migration_id" ]; then
|
|
111
|
+
echo "Warning: Skipping $script (no numeric prefix)"
|
|
112
|
+
continue
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
echo "$migration_name:"
|
|
116
|
+
|
|
117
|
+
# Source and run the migration script
|
|
118
|
+
# The script has access to: is_migrated, record_migration, report_update, report_skip
|
|
119
|
+
# shellcheck source=/dev/null
|
|
120
|
+
source "$script"
|
|
121
|
+
|
|
122
|
+
MIGRATIONS_RUN=$((MIGRATIONS_RUN + 1))
|
|
123
|
+
echo ""
|
|
124
|
+
done
|
|
125
|
+
|
|
126
|
+
#
|
|
127
|
+
# Final report
|
|
128
|
+
#
|
|
129
|
+
if [ "$FILES_UPDATED" -gt 0 ]; then
|
|
130
|
+
echo "$FILES_UPDATED file(s) updated. Review with \`git diff\`, then proceed."
|
|
131
|
+
else
|
|
132
|
+
echo "All documents up to date."
|
|
133
|
+
fi
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# 001-discussion-frontmatter.sh
|
|
4
|
+
#
|
|
5
|
+
# Migrates discussion documents from legacy markdown header format to YAML frontmatter.
|
|
6
|
+
#
|
|
7
|
+
# Legacy format:
|
|
8
|
+
# # Discussion: {Topic}
|
|
9
|
+
#
|
|
10
|
+
# **Date**: YYYY-MM-DD
|
|
11
|
+
# **Status**: Exploring | Deciding | Concluded | Complete | ✅ Complete
|
|
12
|
+
# **Status:** Concluded (alternate: colon outside bold)
|
|
13
|
+
#
|
|
14
|
+
# New format:
|
|
15
|
+
# ---
|
|
16
|
+
# topic: {topic-name}
|
|
17
|
+
# status: in-progress | concluded
|
|
18
|
+
# date: YYYY-MM-DD
|
|
19
|
+
# ---
|
|
20
|
+
#
|
|
21
|
+
# # Discussion: {Topic}
|
|
22
|
+
#
|
|
23
|
+
# Status mapping:
|
|
24
|
+
# Exploring, Deciding → in-progress
|
|
25
|
+
# Concluded, Complete, ✅ Complete → concluded
|
|
26
|
+
#
|
|
27
|
+
# This script is sourced by migrate-documents.sh and has access to:
|
|
28
|
+
# - is_migrated "filepath" "migration_id"
|
|
29
|
+
# - record_migration "filepath" "migration_id"
|
|
30
|
+
# - report_update "filepath" "description"
|
|
31
|
+
# - report_skip "filepath"
|
|
32
|
+
#
|
|
33
|
+
|
|
34
|
+
MIGRATION_ID="001"
|
|
35
|
+
DISCUSSION_DIR="docs/workflow/discussion"
|
|
36
|
+
|
|
37
|
+
# Skip if no discussion directory
|
|
38
|
+
if [ ! -d "$DISCUSSION_DIR" ]; then
|
|
39
|
+
echo " No discussion directory found"
|
|
40
|
+
return 0
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Process each discussion file
|
|
44
|
+
for file in "$DISCUSSION_DIR"/*.md; do
|
|
45
|
+
[ -f "$file" ] || continue
|
|
46
|
+
|
|
47
|
+
# Check if already migrated via tracking
|
|
48
|
+
if is_migrated "$file" "$MIGRATION_ID"; then
|
|
49
|
+
report_skip "$file"
|
|
50
|
+
continue
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Check if file already has YAML frontmatter
|
|
54
|
+
if head -1 "$file" 2>/dev/null | grep -q "^---$"; then
|
|
55
|
+
# Already has frontmatter - just record and skip
|
|
56
|
+
record_migration "$file" "$MIGRATION_ID"
|
|
57
|
+
report_skip "$file"
|
|
58
|
+
continue
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Check if file has legacy format (look for **Status**: or **Status:** or **Date**: or **Started:**)
|
|
62
|
+
if ! grep -q '^\*\*Status\*\*:\|^\*\*Status:\*\*\|^\*\*Date\*\*:\|^\*\*Started:\*\*' "$file" 2>/dev/null; then
|
|
63
|
+
# No legacy format found - might be malformed, skip
|
|
64
|
+
record_migration "$file" "$MIGRATION_ID"
|
|
65
|
+
report_skip "$file"
|
|
66
|
+
continue
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
#
|
|
70
|
+
# Extract values from legacy format
|
|
71
|
+
#
|
|
72
|
+
|
|
73
|
+
# Use filename as topic (canonical identifier throughout the workflow)
|
|
74
|
+
topic_kebab=$(basename "$file" .md)
|
|
75
|
+
|
|
76
|
+
# Extract date from **Date**: YYYY-MM-DD or **Started:** YYYY-MM-DD
|
|
77
|
+
date_value=$(grep -m1 '^\*\*Date\*\*:\|^\*\*Started:\*\*' "$file" | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}' || echo "")
|
|
78
|
+
|
|
79
|
+
# Extract status from **Status**: Value or **Status:** Value (colon inside or outside bold)
|
|
80
|
+
# First extract the line, then remove all variations of the prefix
|
|
81
|
+
status_raw=$(grep -m1 '^\*\*Status' "$file" | sed 's/^\*\*Status\*\*:[[:space:]]*//' | sed 's/^\*\*Status:\*\*[[:space:]]*//' | tr '[:upper:]' '[:lower:]')
|
|
82
|
+
# Remove any emoji characters (like ✅) and trim whitespace
|
|
83
|
+
status_raw=$(echo "$status_raw" | sed 's/✅//g' | xargs)
|
|
84
|
+
|
|
85
|
+
# Map legacy status to new values
|
|
86
|
+
case "$status_raw" in
|
|
87
|
+
exploring|deciding)
|
|
88
|
+
status_new="in-progress"
|
|
89
|
+
;;
|
|
90
|
+
concluded|complete)
|
|
91
|
+
status_new="concluded"
|
|
92
|
+
;;
|
|
93
|
+
*)
|
|
94
|
+
status_new="in-progress" # Default for unknown
|
|
95
|
+
;;
|
|
96
|
+
esac
|
|
97
|
+
|
|
98
|
+
# Use today's date if none found
|
|
99
|
+
if [ -z "$date_value" ]; then
|
|
100
|
+
date_value=$(date +%Y-%m-%d)
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
#
|
|
104
|
+
# Build new file content
|
|
105
|
+
#
|
|
106
|
+
|
|
107
|
+
# Create frontmatter
|
|
108
|
+
frontmatter="---
|
|
109
|
+
topic: $topic_kebab
|
|
110
|
+
status: $status_new
|
|
111
|
+
date: $date_value
|
|
112
|
+
---"
|
|
113
|
+
|
|
114
|
+
# Extract H1 heading (preserve original)
|
|
115
|
+
h1_heading=$(grep -m1 "^# " "$file")
|
|
116
|
+
|
|
117
|
+
# Find line number of first ## heading (start of real content)
|
|
118
|
+
first_section_line=$(grep -n "^## " "$file" | head -1 | cut -d: -f1)
|
|
119
|
+
|
|
120
|
+
# Get content from first ## onwards (preserves all content including **Status:** in decisions)
|
|
121
|
+
if [ -n "$first_section_line" ]; then
|
|
122
|
+
content=$(tail -n +$first_section_line "$file")
|
|
123
|
+
else
|
|
124
|
+
# No ## found - take everything after metadata block
|
|
125
|
+
# Find first blank line after H1, then take from there
|
|
126
|
+
content=""
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# Write new content: frontmatter + H1 + blank line + content
|
|
130
|
+
{
|
|
131
|
+
echo "$frontmatter"
|
|
132
|
+
echo ""
|
|
133
|
+
echo "$h1_heading"
|
|
134
|
+
echo ""
|
|
135
|
+
echo "$content"
|
|
136
|
+
} > "$file"
|
|
137
|
+
|
|
138
|
+
# Record and report
|
|
139
|
+
record_migration "$file" "$MIGRATION_ID"
|
|
140
|
+
report_update "$file" "added frontmatter"
|
|
141
|
+
done
|
|
@@ -15,28 +15,17 @@ SPEC_DIR="docs/workflow/specification"
|
|
|
15
15
|
CACHE_FILE="docs/workflow/.cache/discussion-consolidation-analysis.md"
|
|
16
16
|
|
|
17
17
|
# Helper: Extract a frontmatter field value from a file
|
|
18
|
-
# Supports both YAML frontmatter and markdown format (**Field**: Value)
|
|
19
18
|
# Usage: extract_field <file> <field_name>
|
|
20
19
|
extract_field() {
|
|
21
20
|
local file="$1"
|
|
22
21
|
local field="$2"
|
|
23
22
|
local value=""
|
|
24
23
|
|
|
25
|
-
#
|
|
24
|
+
# Extract from YAML frontmatter (file must start with ---)
|
|
26
25
|
if head -1 "$file" 2>/dev/null | grep -q "^---$"; then
|
|
27
26
|
value=$(sed -n '2,/^---$/p' "$file" 2>/dev/null | \
|
|
28
|
-
grep -m1 "^${field}:" | \
|
|
29
|
-
sed "s/^${field}:[[:space:]]*//" || true)
|
|
30
|
-
fi
|
|
31
|
-
|
|
32
|
-
# If empty, try markdown format: **Field**: Value
|
|
33
|
-
# Only search the header (before first ## heading) to avoid body matches
|
|
34
|
-
if [ -z "$value" ]; then
|
|
35
|
-
value=$(awk '/^## /{exit} {print}' "$file" 2>/dev/null | \
|
|
36
|
-
grep -i -m1 "^\*\*${field}\*\*:" | \
|
|
37
|
-
sed -E "s/^\*\*[^*]+\*\*:[[:space:]]*//" || true)
|
|
38
|
-
# Normalize to lowercase for consistency
|
|
39
|
-
value=$(echo "$value" | tr '[:upper:]' '[:lower:]')
|
|
27
|
+
grep -i -m1 "^${field}:" | \
|
|
28
|
+
sed -E "s/^${field}:[[:space:]]*//i" || true)
|
|
40
29
|
fi
|
|
41
30
|
|
|
42
31
|
echo "$value"
|
|
@@ -13,10 +13,13 @@ This is a single file per topic.
|
|
|
13
13
|
## Template
|
|
14
14
|
|
|
15
15
|
```markdown
|
|
16
|
-
|
|
16
|
+
---
|
|
17
|
+
topic: {topic-name}
|
|
18
|
+
status: in-progress
|
|
19
|
+
date: YYYY-MM-DD # Use today's actual date
|
|
20
|
+
---
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
**Status**: Exploring | Deciding | Concluded
|
|
22
|
+
# Discussion: {Topic}
|
|
20
23
|
|
|
21
24
|
## Context
|
|
22
25
|
|
|
@@ -97,7 +100,7 @@ What we chose, why, the deciding factor, trade-offs accepted, confidence level.
|
|
|
97
100
|
**When creating**:
|
|
98
101
|
1. Ensure discussion directory exists: `docs/workflow/discussion/`
|
|
99
102
|
2. Create file: `{topic}.md`
|
|
100
|
-
3. Fill
|
|
103
|
+
3. Fill frontmatter: topic, status, date
|
|
101
104
|
4. Start with context: why discussing?
|
|
102
105
|
5. List questions: what needs deciding?
|
|
103
106
|
|
|
@@ -125,3 +128,5 @@ What we chose, why, the deciding factor, trade-offs accepted, confidence level.
|
|
|
125
128
|
- Major questions concluded with rationale
|
|
126
129
|
- Trade-offs understood
|
|
127
130
|
- Path forward clear
|
|
131
|
+
|
|
132
|
+
**When complete**: Update frontmatter `status: concluded` to signal ready for specification.
|