flight-rules 0.14.0 → 0.15.2

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.
@@ -15,6 +15,7 @@ async function copyDocsFromTemplates(templatesDir, docsDir, skipExisting) {
15
15
  ensureDir(docsDir);
16
16
  ensureDir(join(docsDir, 'implementation'));
17
17
  ensureDir(join(docsDir, 'session_logs'));
18
+ ensureDir(join(docsDir, 'backlog'));
18
19
  for (const file of DOC_FILES) {
19
20
  const srcPath = join(templatesDir, file.src);
20
21
  const destPath = join(docsDir, file.dest);
@@ -16,6 +16,10 @@ export interface TaskGroupPlan {
16
16
  status: string;
17
17
  }>;
18
18
  }
19
+ /**
20
+ * Format a timestamp for verbose output: [HH:MM:SS]
21
+ */
22
+ export declare function formatTimestamp(): string;
19
23
  /**
20
24
  * Parse the discovery response from Claude into TaskGroupPlan objects.
21
25
  * Returns null if the response cannot be parsed (tags not found).
@@ -80,6 +80,16 @@ function buildAreaConstraint(area) {
80
80
  - If no incomplete task groups exist in Area ${area}, respond with ALL_COMPLETE
81
81
  `;
82
82
  }
83
+ /**
84
+ * Format a timestamp for verbose output: [HH:MM:SS]
85
+ */
86
+ export function formatTimestamp() {
87
+ const now = new Date();
88
+ const hours = String(now.getHours()).padStart(2, '0');
89
+ const minutes = String(now.getMinutes()).padStart(2, '0');
90
+ const seconds = String(now.getSeconds()).padStart(2, '0');
91
+ return `[${hours}:${minutes}:${seconds}]`;
92
+ }
83
93
  /**
84
94
  * Check if Claude CLI is available
85
95
  */
@@ -116,6 +126,7 @@ async function runClaudeWithPrompt(promptContent, verbose) {
116
126
  let output = '';
117
127
  let errorOutput = '';
118
128
  let lineBuffer = ''; // Buffer for incomplete JSON lines
129
+ let needsTimestamp = true; // Track whether next text output needs a timestamp
119
130
  claude.stdout?.on('data', (data) => {
120
131
  const text = data.toString();
121
132
  output += text;
@@ -134,16 +145,25 @@ async function runClaudeWithPrompt(promptContent, verbose) {
134
145
  if (parsed.type === 'assistant' && parsed.message?.content) {
135
146
  for (const block of parsed.message.content) {
136
147
  if (block.type === 'text' && block.text) {
148
+ if (needsTimestamp) {
149
+ process.stdout.write(`${formatTimestamp()} `);
150
+ needsTimestamp = false;
151
+ }
137
152
  process.stdout.write(block.text);
138
153
  }
139
154
  }
140
155
  }
141
156
  else if (parsed.type === 'content_block_delta' && parsed.delta?.text) {
157
+ if (needsTimestamp) {
158
+ process.stdout.write(`${formatTimestamp()} `);
159
+ needsTimestamp = false;
160
+ }
142
161
  process.stdout.write(parsed.delta.text);
143
162
  }
144
163
  else if (parsed.type === 'content_block_stop') {
145
- // Add newline after each content block ends
146
- process.stdout.write('\n');
164
+ // Add newline + blank line after each content block ends
165
+ process.stdout.write('\n\n');
166
+ needsTimestamp = true;
147
167
  }
148
168
  }
149
169
  catch {
@@ -20,6 +20,7 @@ function copyNewDocsFromTemplates(templatesDir, docsDir) {
20
20
  ensureDir(docsDir);
21
21
  ensureDir(join(docsDir, 'implementation'));
22
22
  ensureDir(join(docsDir, 'session_logs'));
23
+ ensureDir(join(docsDir, 'backlog'));
23
24
  const copied = [];
24
25
  for (const file of DOC_FILES) {
25
26
  const srcPath = join(templatesDir, file.src);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flight-rules",
3
- "version": "0.14.0",
3
+ "version": "0.15.2",
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.14.0
3
+ flight_rules_version: 0.15.2
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.