flight-rules 0.13.9 → 0.15.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.
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { upgrade } from './commands/upgrade.js';
6
6
  import { adapter } from './commands/adapter.js';
7
7
  import { update } from './commands/update.js';
8
8
  import { ralph } from './commands/ralph.js';
9
+ import { parallel } from './commands/parallel.js';
9
10
  import { getCliVersion } from './utils/files.js';
10
11
  import { checkForUpdate, shouldSkipUpdateCheck } from './utils/version-check.js';
11
12
  import { isInteractive } from './utils/interactive.js';
@@ -121,6 +122,15 @@ async function main() {
121
122
  branch: parseBranchArg(args),
122
123
  });
123
124
  break;
125
+ case 'parallel': {
126
+ const subcommand = args[0] || '';
127
+ const subArgs = args.slice(1).filter(a => !a.startsWith('--'));
128
+ const parallelOptions = {
129
+ force: args.includes('--force'),
130
+ };
131
+ await parallel(subcommand, subArgs, parallelOptions);
132
+ break;
133
+ }
124
134
  case undefined:
125
135
  case '--help':
126
136
  case '-h':
@@ -144,6 +154,7 @@ ${pc.bold('Commands:')}
144
154
  adapter Generate agent-specific adapter files
145
155
  update Update the Flight Rules CLI itself
146
156
  ralph Run autonomous agent loop through task groups
157
+ parallel Manage parallel dev sessions with git worktrees
147
158
 
148
159
  ${pc.bold('Upgrade Options:')}
149
160
  --version <version> Upgrade to a specific version (e.g., 0.1.4)
@@ -165,6 +176,15 @@ ${pc.bold('Ralph Options:')}
165
176
  --dry-run Show what would be executed without running
166
177
  --verbose Show full Claude output during execution
167
178
 
179
+ ${pc.bold('Parallel Subcommands:')}
180
+ parallel create <name> Create a new parallel session in an isolated worktree
181
+ parallel status Show all active parallel sessions
182
+ parallel cleanup Detect and clean up orphaned sessions
183
+ parallel remove <name> Remove a session (with merge workflow)
184
+
185
+ ${pc.bold('Parallel Options:')}
186
+ --force Skip confirmations (cleanup, remove)
187
+
168
188
  ${pc.bold('Examples:')}
169
189
  flight-rules init
170
190
  flight-rules upgrade
@@ -177,6 +197,10 @@ ${pc.bold('Examples:')}
177
197
  flight-rules ralph --area 2 --branch
178
198
  flight-rules ralph --area 2-cli-core --branch feature/cli-work
179
199
  flight-rules ralph --dry-run
200
+ flight-rules parallel create auth-refactor
201
+ flight-rules parallel status
202
+ flight-rules parallel cleanup
203
+ flight-rules parallel remove auth-refactor
180
204
  `);
181
205
  }
182
206
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flight-rules",
3
- "version": "0.13.9",
3
+ "version": "0.15.0",
4
4
  "description": "An opinionated framework for AI-assisted software development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/payload/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Flight Rules – Agent Guidelines
2
2
 
3
- flight_rules_version: 0.13.9
3
+ flight_rules_version: 0.15.0
4
4
 
5
5
  This file defines how agents (Claude Code, Cursor, etc.) should work on software projects using the Flight Rules system.
6
6
 
@@ -0,0 +1,77 @@
1
+ # Add to Backlog
2
+
3
+ When the user invokes "backlog.add", capture an idea with minimum friction. This command prioritizes speed — the user should go from thought to captured file in seconds.
4
+
5
+ ## 1. Determine Mode
6
+
7
+ **One-shot mode (primary):** If the user provided a description with the command (e.g., "/backlog.add dark mode for settings page"), proceed directly to Step 3 using that text as the idea description.
8
+
9
+ **Conversational mode:** If the user invoked the command without a description:
10
+
11
+ > "What idea would you like to capture? Just describe it in a sentence or two — we can flesh it out later with `/backlog.clarify`."
12
+
13
+ Wait for the user's response.
14
+
15
+ ## 2. Gather Title
16
+
17
+ If the user provided a one-shot description, derive a concise title from it (5-8 words max).
18
+
19
+ If in conversational mode and the description is long or complex, ask:
20
+
21
+ > "Got it. What would you call this in a few words? (This becomes the filename.)"
22
+
23
+ If the description is short enough to serve as the title, use it directly — don't ask.
24
+
25
+ ## 3. Check for Duplicates
26
+
27
+ Convert the title to kebab-case for the filename (e.g., "Dark Mode for Settings" → `dark-mode-for-settings.md`).
28
+
29
+ Check if `docs/backlog/` contains a file with the same or very similar name.
30
+
31
+ If a duplicate exists:
32
+
33
+ > "There's already a backlog item with a similar name: `docs/backlog/[existing-file]`. Would you like to:
34
+ > 1. **Add anyway** — Create a new file with a slightly different name
35
+ > 2. **View existing** — Open the existing item instead
36
+ > 3. **Cancel** — Skip this capture"
37
+
38
+ Wait for the user's response.
39
+
40
+ ## 4. Create the Backlog File
41
+
42
+ Ensure `docs/backlog/` exists (create it if needed).
43
+
44
+ Create the file at `docs/backlog/[kebab-case-title].md` with this template:
45
+
46
+ ```markdown
47
+ # [Title]
48
+
49
+ **Captured**: [YYYY-MM-DD]
50
+ **Status**: Raw
51
+ **Tags**:
52
+ **Priority**:
53
+
54
+ ## Idea
55
+
56
+ [User's description]
57
+ ```
58
+
59
+ - Use today's date for the Captured field
60
+ - Tags and Priority are left blank intentionally — they're optional
61
+ - The Idea section contains the user's description as-is, without editing or expanding it
62
+
63
+ ## 5. Confirm
64
+
65
+ > "Captured: `docs/backlog/[filename].md`
66
+ >
67
+ > **Next steps when you're ready:**
68
+ > - `/backlog.clarify [filename]` — Flesh out this idea with more detail
69
+ > - `/backlog.list` — See all your backlog items
70
+ > - `/backlog.add` — Capture another idea"
71
+
72
+ ## Key Behaviors
73
+
74
+ - **Speed over completeness** — Don't ask unnecessary questions. Title + description is enough.
75
+ - **No required fields beyond description** — Tags and priority are always optional and left blank at capture time.
76
+ - **Don't embellish** — Write the user's idea as they described it. Don't add your own analysis or suggestions.
77
+ - **Create the directory if needed** — `docs/backlog/` may not exist yet.
@@ -0,0 +1,138 @@
1
+ # Clarify Backlog Item
2
+
3
+ When the user invokes "backlog.clarify", help them flesh out a raw idea through interactive conversation. The goal is to add enough structure that the idea becomes actionable — without over-formalizing it.
4
+
5
+ ## 1. Find the Backlog Item
6
+
7
+ If the user provided an identifier with the command (e.g., "/backlog.clarify dark-mode"), search `docs/backlog/` for a matching file:
8
+
9
+ - Try exact filename match first: `docs/backlog/[identifier].md`
10
+ - Then try with `.md` appended: `docs/backlog/[identifier].md`
11
+ - Then try partial match against filenames in `docs/backlog/`
12
+
13
+ If no identifier was provided, list the files in `docs/backlog/` (excluding `archive/`) and ask:
14
+
15
+ > "Which backlog item would you like to clarify?"
16
+ >
17
+ > [numbered list of items with their Status]
18
+
19
+ Wait for the user to select one.
20
+
21
+ **If no match found:**
22
+
23
+ > "I couldn't find a backlog item matching '[identifier]'. Run `/backlog.list` to see all items, or `/backlog.add` to create a new one."
24
+
25
+ Stop.
26
+
27
+ **If multiple matches found:**
28
+
29
+ > "I found multiple items matching '[identifier]':
30
+ >
31
+ > [numbered list of matching items]
32
+ >
33
+ > Which one did you mean?"
34
+
35
+ Wait for the user to select one.
36
+
37
+ ## 2. Read the Current Item
38
+
39
+ Read the matched file. Note the current status and content.
40
+
41
+ Present a summary:
42
+
43
+ > **Current item: [Title]**
44
+ > - **Status**: [Raw/Clarified]
45
+ > - **Idea**: [quote the Idea section]
46
+
47
+ If the item is already Clarified:
48
+
49
+ > "This item has already been clarified. Would you like to refine it further, or is it ready to promote with `/backlog.promote`?"
50
+
51
+ If the user wants to refine further, continue. Otherwise, stop.
52
+
53
+ ## 3. Ask Clarifying Questions
54
+
55
+ Ask 3-5 targeted questions to draw out more detail. Choose from these categories based on what's missing:
56
+
57
+ **Problem understanding:**
58
+ - "What problem does this solve? Who experiences this problem?"
59
+ - "How are you (or users) working around this today?"
60
+ - "What happens if we never build this?"
61
+
62
+ **Scope and approach:**
63
+ - "What's the simplest version of this that would be useful?"
64
+ - "Are there parts of this that could be separate ideas?"
65
+ - "Do you have a rough sense of how this would work technically?"
66
+
67
+ **Constraints and dependencies:**
68
+ - "Does this depend on anything else being built first?"
69
+ - "Are there constraints (time, tech, compatibility) to keep in mind?"
70
+ - "Does this conflict with or overlap with any existing features?"
71
+
72
+ **Priority signals:**
73
+ - "How important is this relative to what you're working on now?"
74
+ - "Is this a 'nice to have' or a 'need to have'?"
75
+
76
+ Ask questions conversationally — 1-2 at a time, not all at once. Adapt follow-ups based on the user's answers.
77
+
78
+ ## 4. Update the File
79
+
80
+ After the conversation, update the backlog file with the new detail. Preserve the original Idea section and add new sections below it:
81
+
82
+ ```markdown
83
+ # [Title]
84
+
85
+ **Captured**: [original date]
86
+ **Status**: Clarified
87
+ **Tags**: [add if the conversation revealed natural tags]
88
+ **Priority**: [add if the user indicated priority]
89
+
90
+ ## Idea
91
+
92
+ [Original idea text — preserved as-is]
93
+
94
+ ## Problem
95
+
96
+ [What problem this solves and who it affects]
97
+
98
+ ## Possible Approach
99
+
100
+ [How this might be implemented, at a high level]
101
+
102
+ ## Open Questions
103
+
104
+ - [Unresolved questions from the conversation]
105
+
106
+ ## Notes
107
+
108
+ [Any other relevant context from the conversation]
109
+ ```
110
+
111
+ **Rules for updating:**
112
+ - Change Status from Raw → Clarified
113
+ - Preserve the original Idea text exactly
114
+ - Only add Tags/Priority if the conversation naturally surfaced them — don't ask just to fill fields
115
+ - Omit sections that have no content (e.g., skip Open Questions if there are none)
116
+
117
+ Show the user a preview of the updated content before writing:
118
+
119
+ > "Here's the clarified version. Does this capture everything, or would you like to adjust anything?"
120
+
121
+ Wait for confirmation before writing.
122
+
123
+ ## 5. Confirm
124
+
125
+ > "Updated: `docs/backlog/[filename].md`
126
+ >
127
+ > **Next steps:**
128
+ > - `/backlog.promote [filename]` — Move this into the PRD and implementation workflow
129
+ > - `/backlog.clarify [another-item]` — Clarify another idea
130
+ > - `/backlog.list` — See all backlog items"
131
+
132
+ ## Key Behaviors
133
+
134
+ - **Preserve the original idea** — Never modify the Idea section. Add new sections below it.
135
+ - **Conversational, not interrogative** — Ask 1-2 questions at a time, not a checklist.
136
+ - **Don't over-formalize** — This is a backlog item, not a spec. Keep it concise.
137
+ - **Surface priority naturally** — If the user's answers suggest priority, note it. Don't force a ranking exercise.
138
+ - **Preview before writing** — Always show the updated content and wait for confirmation.
@@ -0,0 +1,65 @@
1
+ # List Backlog
2
+
3
+ When the user invokes "backlog.list", show a summary of all backlog items.
4
+
5
+ ## 1. Read Backlog Items
6
+
7
+ Read all Markdown files in `docs/backlog/` (excluding the `archive/` subdirectory).
8
+
9
+ If `docs/backlog/` doesn't exist or contains no files:
10
+
11
+ > "No backlog items found. Run `/backlog.add` to capture your first idea."
12
+
13
+ Stop.
14
+
15
+ ## 2. Parse Each Item
16
+
17
+ For each file, extract the frontmatter fields:
18
+ - **Title** — from the `# Title` heading
19
+ - **Status** — Raw, Clarified, or Promoted
20
+ - **Tags** — if present
21
+ - **Priority** — if present
22
+ - **Captured** — the date
23
+
24
+ ## 3. Apply Filters (Optional)
25
+
26
+ If the user provided filters with the command (e.g., "/backlog.list clarified" or "/backlog.list tag:api"), apply them:
27
+
28
+ - **By status**: Show only items matching the given status (Raw, Clarified)
29
+ - **By tag**: Show only items with the given tag
30
+ - **By priority**: Show only items with the given priority
31
+
32
+ If no filters, show all items.
33
+
34
+ ## 4. Present the List
35
+
36
+ Display items sorted by capture date (newest first):
37
+
38
+ > **Backlog** — [N] items: [X] Raw, [Y] Clarified
39
+ >
40
+ > | # | Title | Status | Tags | Priority | Captured |
41
+ > |---|-------|--------|------|----------|----------|
42
+ > | 1 | [Title] | Raw | | | 2026-02-11 |
43
+ > | 2 | [Title] | Clarified | api, auth | High | 2026-02-10 |
44
+ > | ... | | | | | |
45
+
46
+ - Leave Tags and Priority blank in the table when not set (don't show "none" or "—")
47
+ - If there are archived items, mention the count at the bottom
48
+
49
+ If there are archived items in `docs/backlog/archive/`:
50
+
51
+ > _[N] promoted items in archive/_
52
+
53
+ ## 5. Suggest Next Actions
54
+
55
+ > **Actions:**
56
+ > - `/backlog.add` — Capture a new idea
57
+ > - `/backlog.clarify [title]` — Flesh out a Raw item
58
+ > - `/backlog.promote [title]` — Move a Clarified item into the PRD workflow
59
+
60
+ ## Key Behaviors
61
+
62
+ - **Quick scan, not deep read** — Extract only the header fields, don't analyze the full content.
63
+ - **Graceful with missing fields** — Tags and Priority will often be blank. Don't treat that as an error.
64
+ - **Newest first** — Most recent ideas are most relevant.
65
+ - **Exclude archive** — Promoted items live in `docs/backlog/archive/` and shouldn't clutter the active list.
@@ -0,0 +1,98 @@
1
+ # Promote Backlog Item
2
+
3
+ When the user invokes "backlog.promote", graduate a backlog idea into the formal PRD and implementation workflow by feeding it into `/feature.add`.
4
+
5
+ ## 1. Find the Backlog Item
6
+
7
+ If the user provided an identifier with the command (e.g., "/backlog.promote dark-mode"), search `docs/backlog/` for a matching file:
8
+
9
+ - Try exact filename match first: `docs/backlog/[identifier].md`
10
+ - Then try with `.md` appended: `docs/backlog/[identifier].md`
11
+ - Then try partial match against filenames in `docs/backlog/`
12
+
13
+ If no identifier was provided, list the files in `docs/backlog/` (excluding `archive/`) and ask:
14
+
15
+ > "Which backlog item would you like to promote to a full feature?"
16
+ >
17
+ > [numbered list of items with their Status]
18
+
19
+ Wait for the user to select one.
20
+
21
+ **If no match found:**
22
+
23
+ > "I couldn't find a backlog item matching '[identifier]'. Run `/backlog.list` to see all items."
24
+
25
+ Stop.
26
+
27
+ ## 2. Read and Present the Item
28
+
29
+ Read the matched file. Present the content:
30
+
31
+ > **Promoting: [Title]**
32
+ > - **Status**: [Raw/Clarified]
33
+ > - **Idea**: [quote the Idea section]
34
+ > - **Problem**: [quote if present]
35
+ > - **Possible Approach**: [quote if present]
36
+
37
+ If the item is Raw (not yet Clarified):
38
+
39
+ > "This idea hasn't been clarified yet. Promoting a Raw item is fine, but you'll get better results if you clarify it first.
40
+ >
41
+ > Would you like to:
42
+ > 1. **Clarify first** — Run `/backlog.clarify` to flesh it out
43
+ > 2. **Promote as-is** — Proceed with the raw idea"
44
+
45
+ Wait for the user's response. If they choose to clarify first, stop and let them run `/backlog.clarify`.
46
+
47
+ ## 3. Launch Feature Add Workflow
48
+
49
+ Feed the backlog item's content into the `/feature.add` workflow as context. Present it as:
50
+
51
+ > "I'll now run the feature addition workflow using this backlog item as the starting point."
52
+
53
+ Proceed to follow the full `/feature.add` process (from `feature.add.md`), using the backlog item's description, problem statement, and approach as the feature description input. This means:
54
+
55
+ 1. Check prerequisites (PRD exists, implementation outline exists)
56
+ 2. Gather context from existing docs
57
+ 3. Skip the "what feature?" question — use the backlog item as the answer
58
+ 4. Continue with understanding, placement, PRD updates, implementation updates, etc.
59
+
60
+ The agent should follow the full `feature.add.md` workflow from Step 4 onward, treating the backlog item content as the user's feature description.
61
+
62
+ ## 4. Archive the Backlog Item
63
+
64
+ After the `/feature.add` workflow completes successfully (PRD and implementation updates applied):
65
+
66
+ Ensure `docs/backlog/archive/` exists (create if needed).
67
+
68
+ Update the backlog file:
69
+ - Change Status to **Promoted**
70
+ - Add a **Promoted To** field with references to where the idea landed
71
+
72
+ ```markdown
73
+ **Status**: Promoted
74
+ **Promoted To**: PRD Goal [N], Implementation [area/spec reference]
75
+ ```
76
+
77
+ Move the file from `docs/backlog/` to `docs/backlog/archive/`.
78
+
79
+ ## 5. Confirm
80
+
81
+ > "Promoted and archived: `docs/backlog/archive/[filename].md`
82
+ >
83
+ > **What was created:**
84
+ > - PRD Goal [N]: [brief description]
85
+ > - Implementation spec: `[path to spec file]`
86
+ >
87
+ > **Next steps:**
88
+ > - `/impl.create` or `/impl.clarify` to add detail to the new spec
89
+ > - `/dev-session.start` to begin implementing
90
+ > - `/backlog.list` to see remaining backlog items"
91
+
92
+ ## Key Behaviors
93
+
94
+ - **Recommend clarifying first** — Raw items work, but Clarified items produce better features.
95
+ - **Reuse `/feature.add` fully** — Don't reinvent the feature addition workflow. Follow `feature.add.md` for the actual PRD/implementation work.
96
+ - **Archive, don't delete** — Promoted items move to `docs/backlog/archive/` so there's a record.
97
+ - **Cross-reference** — The archived file should say where the idea ended up (PRD goal number, implementation area).
98
+ - **Don't modify the original idea** — The Idea section stays as-is, even in the archived version.
@@ -76,4 +76,19 @@ If yes, help prepare a commit message that:
76
76
  - References the session log file
77
77
  - Is concise but meaningful
78
78
 
79
+ ## 8. Handle Parallel Session (If Applicable)
80
+
81
+ If this session is running in a parallel worktree (check if the current directory is inside a `*-sessions/` worktree path, or check `git rev-parse --git-dir` for linked worktrees):
82
+
83
+ 1. **Ensure all changes are committed** — parallel sessions require committed changes before cleanup
84
+ 2. **Offer merge strategy:**
85
+ > "This is a parallel session. How would you like to integrate these changes?"
86
+ > - **Create a PR** (recommended for review)
87
+ > - **Merge directly to main** (for small/safe changes)
88
+ > - **Keep branch for later** (don't merge yet, but clean up worktree)
89
+ > - **Abandon** (discard all changes)
90
+
91
+ 3. Run `flight-rules parallel remove <session-name>` which will execute the chosen strategy and clean up the worktree
92
+ 4. If choosing to create a PR, include the session summary in the PR description
93
+
79
94
 
@@ -43,7 +43,25 @@ Include:
43
43
  - Technical approach
44
44
  - Task breakdown
45
45
 
46
- ## 5. Confirm Before Coding
46
+ ## 5. Offer Parallel Session (Optional)
47
+
48
+ After establishing goals, check if the user wants to run this session in parallel:
49
+
50
+ > "Would you like to run this session in an isolated worktree? This allows other agents to work on the project simultaneously."
51
+ >
52
+ > - **Standard session** (work in main directory)
53
+ > - **Parallel session** (create isolated worktree)
54
+
55
+ If parallel is chosen:
56
+
57
+ 1. Run `flight-rules parallel create <session-name>` (derive a short kebab-case name from the goals)
58
+ 2. Note the worktree path in the session log header: `**Worktree:** <path>`
59
+ 3. Instruct the user to open a new terminal in the worktree directory and run `claude`
60
+ 4. The rest of the session workflow proceeds normally within the worktree
61
+
62
+ **Detecting existing parallel context:** If you notice the current directory is inside a `*-sessions/` worktree (check with `git rev-parse --git-dir` — linked worktrees show `.git/worktrees/<name>`), note this in the session log and skip offering the parallel option.
63
+
64
+ ## 6. Confirm Before Coding
47
65
 
48
66
  Present the plan to the user and ask:
49
67
 
@@ -0,0 +1,18 @@
1
+ # Parallel Session Cleanup
2
+
3
+ When the user invokes "parallel cleanup", detect and clean up orphaned parallel sessions.
4
+
5
+ ## Process
6
+
7
+ 1. Run `flight-rules parallel cleanup` to scan for orphaned sessions
8
+ 2. An orphaned session is one where the manifest entry exists but the worktree directory is missing (e.g., the user closed their terminal without running `/dev-session.end`)
9
+ 3. For each orphan, the CLI will:
10
+ - Remove the entry from the manifest
11
+ - Delete the associated git branch
12
+ 4. If no orphans are found, report that everything is clean
13
+
14
+ ## When to Use
15
+
16
+ - After a crash or unexpected terminal closure during a parallel session
17
+ - If `flight-rules parallel status` shows sessions marked as orphaned
18
+ - As periodic maintenance when using parallel sessions frequently
@@ -0,0 +1,25 @@
1
+ # Parallel Session Status
2
+
3
+ When the user invokes "parallel status", show the state of all active parallel sessions.
4
+
5
+ ## Process
6
+
7
+ 1. Run `flight-rules parallel status` to get the current state
8
+ 2. If there are active sessions, display them clearly with navigation instructions
9
+ 3. If there are orphaned sessions, suggest running `flight-rules parallel cleanup`
10
+ 4. Show the main directory status (clean/dirty, current branch)
11
+
12
+ ## Quick Reference
13
+
14
+ | Command | Purpose |
15
+ |---------|---------|
16
+ | `flight-rules parallel create <name>` | Start a new parallel session |
17
+ | `flight-rules parallel status` | Show this status view |
18
+ | `flight-rules parallel cleanup` | Clean up orphaned sessions |
19
+ | `flight-rules parallel remove <name>` | End a session with merge workflow |
20
+
21
+ To switch to a session, open a new terminal:
22
+ ```
23
+ cd <worktree-path>
24
+ claude
25
+ ```