@fledge/workflow 0.4.0 → 0.5.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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { i as runMain, n as writeFrontmatter, r as defineCommand, t as parseFrontmatter } from "./frontmatter-BUnjSmTA.js";
3
- import { cwd, stdout } from "node:process";
3
+ import { cwd, env, stdout } from "node:process";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
6
6
  Object.freeze({ status: "aborted" });
@@ -3679,12 +3679,21 @@ const tasksFrontmatter = object({ tasks: array(object({
3679
3679
  //#region ../cli/dist/brief.js
3680
3680
  const BRIEFS_DIRECTORY = path.join(".fledge", "briefs");
3681
3681
  /**
3682
+ * Returns the project root directory.
3683
+ * Uses the `FLEDGE_PROJECT_DIR` environment variable if set, otherwise falls back to `cwd()`.
3684
+ *
3685
+ * @returns The absolute path to the project root.
3686
+ */
3687
+ function getProjectRoot() {
3688
+ return env.FLEDGE_PROJECT_DIR || cwd();
3689
+ }
3690
+ /**
3682
3691
  * Returns the absolute path to the briefs directory for the current project.
3683
3692
  *
3684
- * @returns The absolute path to `.fledge/briefs/` in the current working directory.
3693
+ * @returns The absolute path to `.fledge/briefs/` in the project root.
3685
3694
  */
3686
3695
  function getBriefsDirectory() {
3687
- return path.join(cwd(), BRIEFS_DIRECTORY);
3696
+ return path.join(getProjectRoot(), BRIEFS_DIRECTORY);
3688
3697
  }
3689
3698
  /**
3690
3699
  * Returns the absolute path to a specific brief's directory.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fledge/workflow",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "author": "René Schapka",
6
6
  "license": "MIT",
7
7
  "files": [
@@ -15,7 +15,7 @@
15
15
  "node": ">=24"
16
16
  },
17
17
  "dependencies": {
18
- "@fledge/cli": "^0.7.0"
18
+ "@fledge/cli": "^0.8.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@antfu/eslint-config": "7.7.3",
@@ -7,9 +7,19 @@ metadata:
7
7
  type: workflow
8
8
  ---
9
9
 
10
+ ## Setup
11
+
12
+ Before running any script, set the `FLEDGE_PROJECT_DIR` environment variable to the project root so scripts know where to find and create briefs:
13
+
14
+ ```bash
15
+ export FLEDGE_PROJECT_DIR="$(pwd)"
16
+ ```
17
+
18
+ Set this once at the start of the conversation. All scripts below assume it is set.
19
+
10
20
  ## Available scripts
11
21
 
12
- Self-contained scripts bundled with this skill. Run from the skill directory with `node`:
22
+ Self-contained executable scripts bundled with this skill:
13
23
 
14
24
  - **`scripts/brief.js create <name>`** -- Create a new brief with stub files
15
25
  - **`scripts/brief.js start <name>`** -- Transition a brief from draft to active
@@ -27,7 +37,7 @@ Ask what the user wants to do, or infer from context. Present these options:
27
37
  2. **Continue a brief** -- pick up an existing brief. Proceed to Step 4.
28
38
  3. **Complete a brief** -- wrap up a finished feature. Proceed to Step 5.
29
39
 
30
- If unclear, run `node scripts/brief.js list` to show current briefs and ask.
40
+ If unclear, run `scripts/brief.js list` to show current briefs and ask.
31
41
 
32
42
  ---
33
43
 
@@ -35,7 +45,7 @@ If unclear, run `node scripts/brief.js list` to show current briefs and ask.
35
45
 
36
46
  Before writing anything, build an understanding of what exists.
37
47
 
38
- 1. Run `node scripts/brief.js list --status completed` to read summaries of completed features. Note anything relevant to the new feature.
48
+ 1. Run `scripts/brief.js list --status completed` to read summaries of completed features. Note anything relevant to the new feature.
39
49
  2. Ask the user what they want to build. Keep it conversational, not a form. Aim to understand:
40
50
  - What is the user-facing change?
41
51
  - Why does it matter?
@@ -50,7 +60,7 @@ Proceed to Step 2.
50
60
 
51
61
  ## Step 2: Draft the brief
52
62
 
53
- Run `node scripts/brief.js create <name>` to create the brief directory.
63
+ Run `scripts/brief.js create <name>` to create the brief directory.
54
64
 
55
65
  Write the brief content into `brief.md`. The frontmatter is managed by the scripts. The markdown body should capture:
56
66
 
@@ -86,7 +96,7 @@ tasks:
86
96
 
87
97
  Order tasks by dependency: tasks that others depend on come first within their group.
88
98
 
89
- After writing tasks, run `node scripts/brief.js validate <name>` to confirm the brief is valid, then run `node scripts/brief.js start <name>` to transition to active.
99
+ After writing tasks, run `scripts/brief.js validate <name>` to confirm the brief is valid, then run `scripts/brief.js start <name>` to transition to active.
90
100
 
91
101
  Present the complete brief and task list to the user for review before starting.
92
102
 
@@ -94,22 +104,22 @@ Present the complete brief and task list to the user for review before starting.
94
104
 
95
105
  ## Step 4: Continue a brief
96
106
 
97
- Run `node scripts/brief.js list` to show all briefs. If the user does not specify which brief, ask them to pick one.
107
+ Run `scripts/brief.js list` to show all briefs. If the user does not specify which brief, ask them to pick one.
98
108
 
99
- Run `node scripts/brief.js status <name>` to show progress. Read the brief and tasks files to understand the full context.
109
+ Run `scripts/brief.js status <name>` to show progress. Read the brief and tasks files to understand the full context.
100
110
 
101
111
  From here, the user may want to:
102
112
  - **Discuss a task** -- talk through approach before implementing
103
113
  - **Update tasks** -- mark tasks as done, add new tasks, reorder
104
114
  - **Revise the brief** -- update scope or design decisions based on what was learned during implementation
105
115
 
106
- When updating task status, modify the `tasks.md` frontmatter directly, then run `node scripts/brief.js status <name>` to confirm the update.
116
+ When updating task status, modify the `tasks.md` frontmatter directly, then run `scripts/brief.js status <name>` to confirm the update.
107
117
 
108
118
  ---
109
119
 
110
120
  ## Step 5: Complete a brief
111
121
 
112
- Run `node scripts/brief.js status <name>` to verify all tasks are done.
122
+ Run `scripts/brief.js status <name>` to verify all tasks are done.
113
123
 
114
124
  If there are incomplete tasks, ask the user whether to:
115
125
  1. Mark remaining tasks as done (if they were completed outside this conversation)
@@ -120,4 +130,4 @@ Write a summary into the `brief.md` frontmatter `summary` field. The summary sho
120
130
  - What was built
121
131
  - Key decisions or patterns established that future features should know about
122
132
 
123
- Run `node scripts/brief.js complete <name>` to transition to completed. The script validates that all tasks are done and the summary is present.
133
+ Run `scripts/brief.js complete <name>` to transition to completed. The script validates that all tasks are done and the summary is present.