buildwright 0.0.13 → 0.0.14

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 CHANGED
@@ -82,6 +82,19 @@ Then open your AI editor and run:
82
82
  /bw-work "your task"
83
83
  ```
84
84
 
85
+ ### Update
86
+
87
+ ```bash
88
+ npm install -g buildwright@latest
89
+ cd your-project
90
+ buildwright update
91
+ ```
92
+
93
+ `buildwright update` refreshes Buildwright commands, agents, default steering,
94
+ and Buildwright-owned support scripts. It also removes paths from the old
95
+ pre-`/bw-work` model so generated tool configs do not contain both old and new
96
+ workflows.
97
+
85
98
  ### From Source
86
99
 
87
100
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "buildwright",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Lightweight engineering workflow for agent-led development.",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -17,6 +17,53 @@ const RESET = '\x1b[0m';
17
17
 
18
18
  const GITHUB_REPO = 'raunakkathuria/buildwright';
19
19
  const UPDATE_DIRS = ['commands', 'agents', 'steering'];
20
+ const SUPPORT_FILES = [
21
+ 'scripts/sync-agents.sh',
22
+ 'scripts/validate-docs.sh',
23
+ 'scripts/validate-skill.sh',
24
+ 'scripts/install-hooks.sh',
25
+ 'scripts/hooks/pre-commit',
26
+ 'scripts/hooks/post-merge',
27
+ 'scripts/hooks/post-checkout',
28
+ ];
29
+ const REMOVED_PATHS = [
30
+ '.buildwright/commands/bw-new-feature.md',
31
+ '.buildwright/commands/bw-quick.md',
32
+ '.buildwright/commands/bw-claw.md',
33
+ '.buildwright/commands/bw-help.md',
34
+ '.buildwright/agents/architect.md',
35
+ '.buildwright/claws',
36
+ '.buildwright/skills',
37
+ '.buildwright/tasks/TEMPLATE.md',
38
+ '.buildwright/steering/quality-gates.md',
39
+ '.buildwright/steering/naming-conventions.md',
40
+ '.buildwright/steering/engineering-philosophy.md',
41
+ 'docs/requirements/TEMPLATE.md',
42
+ '.claude/commands/bw-new-feature.md',
43
+ '.claude/commands/bw-quick.md',
44
+ '.claude/commands/bw-claw.md',
45
+ '.claude/commands/bw-help.md',
46
+ '.claude/agents/architect.md',
47
+ '.claude/claws',
48
+ '.claude/tasks',
49
+ '.opencode/commands/bw-new-feature.md',
50
+ '.opencode/commands/bw-quick.md',
51
+ '.opencode/commands/bw-claw.md',
52
+ '.opencode/commands/bw-help.md',
53
+ '.opencode/agents/architect.md',
54
+ '.opencode/claws',
55
+ '.opencode/skills',
56
+ '.cursor/rules/commands/bw-new-feature.mdc',
57
+ '.cursor/rules/commands/bw-quick.mdc',
58
+ '.cursor/rules/commands/bw-claw.mdc',
59
+ '.cursor/rules/commands/bw-help.mdc',
60
+ '.cursor/rules/agents/architect.mdc',
61
+ '.cursor/rules/claws',
62
+ 'skills/bw-new-feature',
63
+ 'skills/bw-quick',
64
+ 'skills/bw-claw',
65
+ 'skills/bw-help',
66
+ ];
20
67
 
21
68
  /**
22
69
  * Download a URL following redirects. Returns a Buffer.
@@ -86,8 +133,27 @@ async function update() {
86
133
  throw new Error('Downloaded archive is missing .buildwright/ directory');
87
134
  }
88
135
 
89
- // This version is not backward compatible with the older command model.
90
- // Update only adds current files; users should re-run init for a clean tree.
136
+ const removed = [];
137
+ for (const relativePath of REMOVED_PATHS) {
138
+ const target = path.join(cwd, relativePath);
139
+ if (!fs.existsSync(target)) continue;
140
+ fs.rmSync(target, { recursive: true, force: true });
141
+ removed.push(relativePath);
142
+ }
143
+ for (const relativePath of ['.buildwright/tasks', 'docs/requirements']) {
144
+ const target = path.join(cwd, relativePath);
145
+ if (!fs.existsSync(target)) continue;
146
+ if (fs.statSync(target).isDirectory() && fs.readdirSync(target).length === 0) {
147
+ fs.rmdirSync(target);
148
+ }
149
+ }
150
+ if (removed.length > 0) {
151
+ console.log(` Removed old Buildwright paths:`);
152
+ for (const relativePath of removed) {
153
+ console.log(` - ${relativePath}`);
154
+ }
155
+ }
156
+
91
157
  for (const dir of UPDATE_DIRS) {
92
158
  const src = path.join(srcBuildwright, dir);
93
159
  const dest = path.join(cwd, '.buildwright', dir);
@@ -100,6 +166,15 @@ async function update() {
100
166
  copyDir(src, dest, { skipExisting: dir === 'steering' });
101
167
  }
102
168
 
169
+ for (const file of SUPPORT_FILES) {
170
+ const src = path.join(extractedRoot, file);
171
+ const dest = path.join(cwd, file);
172
+ if (!fs.existsSync(src)) continue;
173
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
174
+ fs.copyFileSync(src, dest);
175
+ }
176
+ console.log(` Updated Buildwright support scripts`);
177
+
103
178
  // Also add CLAUDE.md if it doesn't already exist locally
104
179
  const srcClaude = path.join(extractedRoot, 'CLAUDE.md');
105
180
  const destClaude = path.join(cwd, 'CLAUDE.md');
@@ -119,7 +194,7 @@ async function update() {
119
194
 
120
195
  console.log('');
121
196
  console.log(`${GREEN}${BOLD}Update complete!${RESET}`);
122
- console.log('commands, agents, and default steering: new files added. Existing files unchanged.');
197
+ console.log('commands, agents, and default steering updated.');
123
198
  console.log('Your custom files are unchanged.\n');
124
199
 
125
200
  } catch (err) {
@@ -33,6 +33,17 @@ cd "$ROOT_DIR"
33
33
  # Helpers
34
34
  # ============================================================================
35
35
 
36
+ sed_inplace() {
37
+ local expression="$1"
38
+ local file="$2"
39
+
40
+ if sed --version >/dev/null 2>&1; then
41
+ sed -i -e "$expression" "$file"
42
+ else
43
+ sed -i '' -e "$expression" "$file"
44
+ fi
45
+ }
46
+
36
47
  # sync_dir SRC DST [REWRITE_FROM REWRITE_TO]
37
48
  # Copies directory, optionally rewriting path references in .md files
38
49
  sync_dir() {
@@ -58,9 +69,9 @@ sync_dir() {
58
69
  if [ -n "$rewrite_from" ] && [ -n "$rewrite_to" ]; then
59
70
  # Only rewrite @@.buildwright/ (read instructions) → tool-specific path
60
71
  # Bare .buildwright/ (write/canonical instructions) stays untouched
61
- find "$tmpdir" -name "*.md" -exec sed -i '' \
62
- -e "s|@@${rewrite_from}|${rewrite_to}|g" \
63
- {} + 2>/dev/null || true
72
+ while IFS= read -r file; do
73
+ sed_inplace "s|@@${rewrite_from}|${rewrite_to}|g" "$file"
74
+ done < <(find "$tmpdir" -name "*.md" -type f)
64
75
  fi
65
76
  if ! diff -rq "$tmpdir" "$dst" > /dev/null 2>&1; then
66
77
  echo "OUT OF SYNC: $dst differs from $src"
@@ -74,9 +85,9 @@ sync_dir() {
74
85
  # @@.buildwright/ = "resolve to tool-specific dir" → gets rewritten
75
86
  # Bare .buildwright/ = "canonical path" → stays untouched
76
87
  if [ -n "$rewrite_from" ] && [ -n "$rewrite_to" ]; then
77
- find "$dst" -name "*.md" -exec sed -i '' \
78
- -e "s|@@${rewrite_from}|${rewrite_to}|g" \
79
- {} + 2>/dev/null || true
88
+ while IFS= read -r file; do
89
+ sed_inplace "s|@@${rewrite_from}|${rewrite_to}|g" "$file"
90
+ done < <(find "$dst" -name "*.md" -type f)
80
91
  fi
81
92
  echo " synced $src → $dst"
82
93
  fi