bigpowers 2.88.17 → 2.88.18

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
  {
2
2
  "name": "bigpowers",
3
- "version": "2.88.17",
3
+ "version": "2.88.18",
4
4
  "description": "81 skills — 73 agent skills synthesizing 17 years of software engineering discipline into a prescriptive methodology for solo developers",
5
5
  "keywords": [
6
6
  "gemini-extension"
package/.pi/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigpowers",
3
- "version": "2.88.17",
3
+ "version": "2.88.18",
4
4
  "description": "81 skills — 73 agent skills synthesizing 17 years of software engineering discipline into a prescriptive methodology for solo developers",
5
5
  "keywords": [
6
6
  "pi-package"
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [2.88.18](https://github.com/danielvm-git/bigpowers/compare/v2.88.17...v2.88.18) (2026-11-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **dashboard:** bind the project dashboard to loopback ([#175](https://github.com/danielvm-git/bigpowers/issues/175)) ([b796b17](https://github.com/danielvm-git/bigpowers/commit/b796b17f3b077a36d725018d3ad6f2fb5cc0426f))
7
+ * **dashboard:** escape project metadata before rendering HTML ([#178](https://github.com/danielvm-git/bigpowers/issues/178)) ([f905d5b](https://github.com/danielvm-git/bigpowers/commit/f905d5b30753e715d8675401aeceefa98d850476))
8
+ * **mcp:** filter every diff before returning its contents ([#174](https://github.com/danielvm-git/bigpowers/issues/174)) ([d0b9f70](https://github.com/danielvm-git/bigpowers/commit/d0b9f70a7319d396858890e2abfa1253b68837ff))
9
+ * **migrate:** treat version metadata and preview paths as data ([#177](https://github.com/danielvm-git/bigpowers/issues/177)) ([2b0649c](https://github.com/danielvm-git/bigpowers/commit/2b0649c0a8723695e2c1f078112bca3993b8b383))
10
+ * **scripts:** escape AGENTS commands when emitting Bash exports ([#176](https://github.com/danielvm-git/bigpowers/issues/176)) ([1800dd5](https://github.com/danielvm-git/bigpowers/commit/1800dd5f682cb98afdbbdce06cbcc8cae2a6eb9f))
11
+
1
12
  ## [2.88.17](https://github.com/danielvm-git/bigpowers/compare/v2.88.16...v2.88.17) (2026-10-30)
2
13
 
3
14
 
@@ -6,17 +6,15 @@ import { GIT_SCOPE_DIRS } from "../config.js";
6
6
  import { isSecretPath } from "./paths.js";
7
7
  function inScope(filePath) {
8
8
  const norm = filePath.replace(/\\/g, "/");
9
- if (isSecretPath(norm))
10
- return false;
11
- return GIT_SCOPE_DIRS.some((d) => norm === d || norm.startsWith(`${d}/`));
9
+ if (isSecretPath(norm)) return false;
10
+ return GIT_SCOPE_DIRS.some((d)=>norm === d || norm.startsWith(`${d}/`));
12
11
  }
13
12
  function groupByDir(files) {
14
13
  const grouped = {};
15
- for (const f of files) {
14
+ for (const f of files){
16
15
  const parts = f.split("/");
17
16
  const dir = parts.length > 1 ? parts[0] : ".";
18
- if (!grouped[dir])
19
- grouped[dir] = [];
17
+ if (!grouped[dir]) grouped[dir] = [];
20
18
  grouped[dir].push(f);
21
19
  }
22
20
  return grouped;
@@ -25,18 +23,20 @@ function git(repoRoot, args) {
25
23
  return execFileSync("git", args, {
26
24
  cwd: repoRoot,
27
25
  encoding: "utf8",
28
- maxBuffer: 10 * 1024 * 1024,
26
+ maxBuffer: 10 * 1024 * 1024
29
27
  }).trim();
30
28
  }
31
29
  export function getGitContext(repoRoot, action) {
32
30
  if (action === "status") {
33
- const out = git(repoRoot, ["status", "--porcelain"]);
34
- const files = out
35
- .split("\n")
36
- .filter(Boolean)
37
- .map((line) => line.slice(3).trim())
38
- .filter(inScope);
39
- return { action, changed_files: groupByDir(files) };
31
+ const out = git(repoRoot, [
32
+ "status",
33
+ "--porcelain"
34
+ ]);
35
+ const files = out.split("\n").filter(Boolean).map((line)=>line.slice(3).trim()).filter(inScope);
36
+ return {
37
+ action,
38
+ changed_files: groupByDir(files)
39
+ };
40
40
  }
41
41
  if (action === "log") {
42
42
  const out = git(repoRoot, [
@@ -45,48 +45,64 @@ export function getGitContext(repoRoot, action) {
45
45
  "--pretty=format:%H|%s",
46
46
  "--name-only",
47
47
  "--",
48
- ...GIT_SCOPE_DIRS,
48
+ ...GIT_SCOPE_DIRS
49
49
  ]);
50
50
  const commits = [];
51
51
  let current = null;
52
- for (const line of out.split("\n")) {
52
+ for (const line of out.split("\n")){
53
53
  if (line.includes("|")) {
54
- if (current)
55
- commits.push(current);
54
+ if (current) commits.push(current);
56
55
  const [hash, subject] = line.split("|");
57
- current = { hash, subject, files: [] };
58
- }
59
- else if (line.trim() && current && inScope(line.trim())) {
56
+ current = {
57
+ hash,
58
+ subject,
59
+ files: []
60
+ };
61
+ } else if (line.trim() && current && inScope(line.trim())) {
60
62
  current.files.push(line.trim());
61
63
  }
62
64
  }
63
- if (current)
64
- commits.push(current);
65
- return { action, changed_files: {}, commits };
65
+ if (current) commits.push(current);
66
+ return {
67
+ action,
68
+ changed_files: {},
69
+ commits
70
+ };
66
71
  }
67
- const diffOut = git(repoRoot, ["diff", "--", ...GIT_SCOPE_DIRS]);
72
+ const diffOut = git(repoRoot, [
73
+ "diff",
74
+ "--",
75
+ ...GIT_SCOPE_DIRS
76
+ ]);
68
77
  const diffs = {};
69
78
  let currentFile = "";
70
79
  let buf = [];
71
- for (const line of diffOut.split("\n")) {
80
+ const flushDiff = ()=>{
81
+ if (currentFile && buf.length && inScope(currentFile)) {
82
+ diffs[currentFile] = buf.join("\n");
83
+ }
84
+ };
85
+ for (const line of diffOut.split("\n")){
72
86
  if (line.startsWith("diff --git")) {
73
- if (currentFile && buf.length)
74
- diffs[currentFile] = buf.join("\n");
87
+ flushDiff();
75
88
  const match = / b\/(.+)$/.exec(line);
76
89
  currentFile = match?.[1] ?? "";
77
- buf = [line];
78
- }
79
- else {
90
+ buf = [
91
+ line
92
+ ];
93
+ } else {
80
94
  buf.push(line);
81
95
  }
82
96
  }
83
- if (currentFile && buf.length && inScope(currentFile) && !isSecretPath(currentFile)) {
84
- diffs[currentFile] = buf.join("\n");
85
- }
97
+ flushDiff();
86
98
  const changed = Object.keys(diffs);
87
- return { action, changed_files: groupByDir(changed), diffs };
99
+ return {
100
+ action,
101
+ changed_files: groupByDir(changed),
102
+ diffs
103
+ };
88
104
  }
89
105
  export function isGitRepo(repoRoot) {
90
106
  return fs.existsSync(path.join(repoRoot, ".git"));
91
107
  }
92
- //# sourceMappingURL=git-context.js.map
108
+ //# sourceMappingURL=git-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-context.js","sourceRoot":"","sources":["../../src/lib/git-context.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS1C,SAAS,OAAO,CAAC,QAAgB;IAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC1C,IAAI,YAAY,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,UAAU,CAAC,KAAe;IACjC,MAAM,OAAO,GAA6B,EAAE,CAAC;IAC7C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,C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QACF;QACA,IAAI,SAAS,QAAQ,IAAI,CAAC;QAC1B,OAAO;YAAE;YAAQ,eAAe,CAAC;YAAG;QAAQ;IAC9C;IAEA,MAAM,UAAU,IAAI,UAAU;QAAC;QAAQ;WAAS;KAAe;IAC/D,MAAM,QAAgC,CAAC;IACvC,IAAI,cAAc;IAClB,IAAI,MAAgB,EAAE;IACtB,MAAM,YAAY;QAChB,IAAI,eAAe,IAAI,MAAM,IAAI,QAAQ,cAAc;YACrD,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,CAAC;QAChC;IACF;IACA,KAAK,MAAM,QAAQ,QAAQ,KAAK,CAAC,MAAO;QACtC,IAAI,KAAK,UAAU,CAAC,eAAe;YACjC;YACA,MAAM,QAAQ,YAAY,IAAI,CAAC;YAC/B,cAAc,OAAO,CAAC,EAAE,IAAI;YAC5B,MAAM;gBAAC;aAAK;QACd,OAAO;YACL,IAAI,IAAI,CAAC;QACX;IACF;IACA;IAEA,MAAM,UAAU,OAAO,IAAI,CAAC;IAC5B,OAAO;QAAE;QAAQ,eAAe,WAAW;QAAU;IAAM;AAC7D;AAEA,OAAO,SAAS,UAAU,QAAgB;IACxC,OAAO,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,UAAU;AAC3C","file":"git-context.js","sourceRoot":""}
@@ -2,7 +2,7 @@
2
2
  import { execFileSync } from "node:child_process";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
- import { GIT_SCOPE_DIRS, SECRET_DENYLIST } from "../config.js";
5
+ import { GIT_SCOPE_DIRS } from "../config.js";
6
6
  import { isSecretPath } from "./paths.js";
7
7
 
8
8
  export interface GitContextResult {
@@ -76,9 +76,14 @@ export function getGitContext(repoRoot: string, action: "status" | "log" | "diff
76
76
  const diffs: Record<string, string> = {};
77
77
  let currentFile = "";
78
78
  let buf: string[] = [];
79
+ const flushDiff = () => {
80
+ if (currentFile && buf.length && inScope(currentFile)) {
81
+ diffs[currentFile] = buf.join("\n");
82
+ }
83
+ };
79
84
  for (const line of diffOut.split("\n")) {
80
85
  if (line.startsWith("diff --git")) {
81
- if (currentFile && buf.length) diffs[currentFile] = buf.join("\n");
86
+ flushDiff();
82
87
  const match = / b\/(.+)$/.exec(line);
83
88
  currentFile = match?.[1] ?? "";
84
89
  buf = [line];
@@ -86,9 +91,7 @@ export function getGitContext(repoRoot: string, action: "status" | "log" | "diff
86
91
  buf.push(line);
87
92
  }
88
93
  }
89
- if (currentFile && buf.length && inScope(currentFile) && !isSecretPath(currentFile)) {
90
- diffs[currentFile] = buf.join("\n");
91
- }
94
+ flushDiff();
92
95
 
93
96
  const changed = Object.keys(diffs);
94
97
  return { action, changed_files: groupByDir(changed), diffs };
@@ -97,3 +100,4 @@ export function getGitContext(repoRoot: string, action: "status" | "log" | "diff
97
100
  export function isGitRepo(repoRoot: string): boolean {
98
101
  return fs.existsSync(path.join(repoRoot, ".git"));
99
102
  }
103
+
@@ -218,6 +218,12 @@
218
218
  let eventSource = null;
219
219
  let pollInterval = null;
220
220
 
221
+ // Project metadata belongs in HTML text content, never in markup.
222
+ function escapeHtml(value) {
223
+ const entities = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' };
224
+ return String(value).replace(/[&<>"']/g, char => entities[char]);
225
+ }
226
+
221
227
  function render(data) {
222
228
  if (!data) return;
223
229
  renderPipeline(data);
@@ -246,14 +252,14 @@
246
252
 
247
253
  let html = '';
248
254
  if (metrics) {
249
- html += `<div class="metric-row"><span class="metric-label">Total BCPs</span><span class="metric-value">${metrics.totalBcps}</span></div>`;
255
+ html += `<div class="metric-row"><span class="metric-label">Total BCPs</span><span class="metric-value">${escapeHtml(metrics.totalBcps)}</span></div>`;
250
256
  html += `<div class="metric-row"><span class="metric-label">Avg BCP/Hour</span><span class="metric-value">${metrics.avgBcpPerHour.toFixed(2)}</span></div>`;
251
257
  }
252
258
  if (velocity) {
253
259
  html += `<div class="metric-row"><span class="metric-label">Current Velocity</span><span class="metric-value">${velocity.avgBcpPerHour.toFixed(2)} BCP/h</span></div>`;
254
260
  }
255
261
  if (data.state?.release?.version) {
256
- html += `<div class="metric-row"><span class="metric-label">Version</span><span class="metric-value">${data.state.release.version}</span></div>`;
262
+ html += `<div class="metric-row"><span class="metric-label">Version</span><span class="metric-value">${escapeHtml(data.state.release.version)}</span></div>`;
257
263
  }
258
264
  if (timestamp) {
259
265
  html += `<div class="metric-row"><span class="metric-label">Updated</span><span class="metric-value" style="font-size: 10px;">${new Date(timestamp).toLocaleTimeString()}</span></div>`;
@@ -271,7 +277,7 @@
271
277
  { key: 'Git Branch', value: state.gitBranch }
272
278
  ];
273
279
  container.innerHTML = pairs.map(pair => {
274
- const val = pair.value || '(none)';
280
+ const val = escapeHtml(pair.value || '(none)');
275
281
  return `<div class="state-pair"><span class="state-key">${pair.key}</span><span class="state-value">${val}</span></div>`;
276
282
  }).join('');
277
283
  }
@@ -288,8 +294,8 @@
288
294
  const storyCount = stories.length;
289
295
  return `
290
296
  <div class="epic-item">
291
- <div class="epic-title">${epic.id || 'Unknown'}</div>
292
- <div style="color: var(--ink-soft); font-size: 11px; margin-bottom: 0;">${epic.title || 'Untitled'}</div>
297
+ <div class="epic-title">${escapeHtml(epic.id || 'Unknown')}</div>
298
+ <div style="color: var(--ink-soft); font-size: 11px; margin-bottom: 0;">${escapeHtml(epic.title || 'Untitled')}</div>
293
299
  <div class="epic-stories">${storyCount} stories</div>
294
300
  </div>
295
301
  `;
@@ -308,10 +314,10 @@
308
314
  const end = row.end ? new Date(row.end).toLocaleDateString() : '(active)';
309
315
  return `
310
316
  <div class="ledger-row">
311
- <div class="ledger-id">${row.id}</div>
317
+ <div class="ledger-id">${escapeHtml(row.id)}</div>
312
318
  <div style="text-align: right;">
313
- <div class="ledger-value">${row.bcps} BCP</div>
314
- <div class="ledger-meta">${row.cycleMin}min | ${row.bcpPerHour.toFixed(2)}/h</div>
319
+ <div class="ledger-value">${escapeHtml(row.bcps)} BCP</div>
320
+ <div class="ledger-meta">${escapeHtml(row.cycleMin)}min | ${row.bcpPerHour.toFixed(2)}/h</div>
315
321
  </div>
316
322
  </div>
317
323
  `;
@@ -417,3 +423,4 @@
417
423
  </script>
418
424
  </body>
419
425
  </html>
426
+
@@ -104,9 +104,10 @@ function createServer(projectRoot, port = 7742) {
104
104
 
105
105
  return {
106
106
  listen(portNum = port, cb) {
107
- return app.listen(portNum, cb);
107
+ return app.listen(portNum, '127.0.0.1', cb);
108
108
  }
109
109
  };
110
110
  }
111
111
 
112
112
  module.exports = { createServer };
113
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigpowers",
3
- "version": "2.88.17",
3
+ "version": "2.88.18",
4
4
  "description": "73 agent skills synthesizing 17 years of software engineering discipline into a prescriptive methodology for solo developers",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -53,9 +53,11 @@ if $PRINT_MODE; then
53
53
  if [ -n "$BP_LINT" ]; then echo "Lint: $BP_LINT"; fi
54
54
  if [ -n "$BP_DEPLOY" ]; then echo "Deploy: $BP_DEPLOY"; fi
55
55
  else
56
- if [ -n "$BP_PREFLIGHT" ]; then echo "export BP_PREFLIGHT='$BP_PREFLIGHT'"; fi
57
- if [ -n "$BP_TEST" ]; then echo "export BP_TEST='$BP_TEST'"; fi
58
- if [ -n "$BP_BUILD" ]; then echo "export BP_BUILD='$BP_BUILD'"; fi
59
- if [ -n "$BP_LINT" ]; then echo "export BP_LINT='$BP_LINT'"; fi
60
- if [ -n "$BP_DEPLOY" ]; then echo "export BP_DEPLOY='$BP_DEPLOY'"; fi
56
+ # Bash %q preserves the command as data when the caller evaluates exports.
57
+ if [ -n "$BP_PREFLIGHT" ]; then printf 'export BP_PREFLIGHT=%q\n' "$BP_PREFLIGHT"; fi
58
+ if [ -n "$BP_TEST" ]; then printf 'export BP_TEST=%q\n' "$BP_TEST"; fi
59
+ if [ -n "$BP_BUILD" ]; then printf 'export BP_BUILD=%q\n' "$BP_BUILD"; fi
60
+ if [ -n "$BP_LINT" ]; then printf 'export BP_LINT=%q\n' "$BP_LINT"; fi
61
+ if [ -n "$BP_DEPLOY" ]; then printf 'export BP_DEPLOY=%q\n' "$BP_DEPLOY"; fi
61
62
  fi
63
+
@@ -9,6 +9,7 @@ GOLDEN_GATES=(
9
9
  "compliance:npm run compliance:false"
10
10
  "g04-selftest:bash scripts/golden-g04-selftest.sh:true"
11
11
  "g06-migrate-version:bash tests/run-golden-migrate-version.sh:true"
12
+ "security-migration:node tests/security/migration.cjs:false"
12
13
  "g07-negative-path:bash scripts/golden-g07-negative-path.sh:false"
13
14
  "g08-anti-vacuity:bash scripts/golden-g08-anti-vacuity.sh:false"
14
15
  "g09-yaml-roundtrip:bash scripts/golden-g09-yaml-roundtrip.sh:false"
@@ -66,10 +67,14 @@ GOLDEN_GATES=(
66
67
  "golden-g11-worktree-venv:bash scripts/test-golden-g11-worktree-venv.sh:false"
67
68
  "install-helpers:bash scripts/test-install-helpers.sh:false"
68
69
  "project-runtime:bash scripts/test-project-runtime.sh:false"
70
+ "security-agents-import:node tests/security/agents-import.cjs:false"
69
71
  "omp-extension:bash scripts/validate-omp-extension.sh:false"
70
72
  "mcp-package:bash scripts/validate-mcp-package.sh:false"
73
+ "security-git-context:node tests/security/git-context.cjs:false"
71
74
  "docs-base-path:bash scripts/validate-docs-base-path.sh:false"
75
+ "security-dashboard-bind:node tests/security/dashboard-bind.cjs:false"
72
76
  "import-boundaries:bash scripts/check-import-boundaries.sh:false"
77
+ "security-dashboard-render:node tests/security/dashboard-render.cjs:false"
73
78
  "skill-catalog:bash scripts/validate-skill-catalog.sh:false"
74
79
  "specs-parse:bash scripts/validate-specs-yaml.sh:false"
75
80
  # The runner itself: failing output is shown, skips are named and reasoned.
@@ -204,3 +209,4 @@ golden_run_deterministic_gates() {
204
209
  fi
205
210
  done
206
211
  }
212
+
@@ -21,23 +21,32 @@ EOF
21
21
  }
22
22
 
23
23
  migrate_installed_version() {
24
- node -e "console.log(require('$BIGPOWERS_ROOT/package.json').version)" 2>/dev/null || echo "unknown"
24
+ node -e 'console.log(require(process.argv[1]).version)' "$BIGPOWERS_ROOT/package.json" 2>/dev/null || echo "unknown"
25
+ }
26
+
27
+ migrate_validate_version() {
28
+ local version="$1" label="$2"
29
+ local pattern='^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$'
30
+ if [[ ! "$version" =~ $pattern ]]; then
31
+ echo "migrate-version: invalid $label version; expected major.minor.patch with optional prerelease/build metadata" >&2
32
+ return 4
33
+ fi
25
34
  }
26
35
 
27
36
  migrate_yaml_get() {
28
37
  local file="$1" key="$2"
29
- $PYTHON -c "
38
+ "$PYTHON" -c "
30
39
  import yaml, sys
31
40
  try:
32
- d = yaml.safe_load(open('$file'))
41
+ d = yaml.safe_load(open(sys.argv[1]))
33
42
  val = d
34
- for k in '$key'.split('.'):
43
+ for k in sys.argv[2].split('.'):
35
44
  if not isinstance(val, dict): sys.exit(1)
36
45
  val = val.get(k)
37
46
  if val is None: sys.exit(1)
38
47
  print(val)
39
48
  except: sys.exit(1)
40
- " 2>/dev/null
49
+ " "$file" "$key" 2>/dev/null
41
50
  }
42
51
 
43
52
  log_info() { echo " [INFO] $*"; }
@@ -111,3 +120,4 @@ migrate_detect_version() {
111
120
  fi
112
121
  return 0
113
122
  }
123
+
@@ -8,15 +8,14 @@ MIGRATE_VERSION_PLAN_LOADED=1
8
8
  migrate_build_plan() {
9
9
  echo "migrate-version: building migration plan from $REGISTRY …"
10
10
 
11
- MIGRATION_PLAN="$($PYTHON -c "
11
+ MIGRATION_PLAN="$("$PYTHON" -c "
12
12
  import yaml, json, sys
13
13
 
14
- with open('$REGISTRY') as f:
14
+ with open(sys.argv[1]) as f:
15
15
  parts = f.read().split('---')
16
16
  fm = yaml.safe_load(parts[1])
17
17
 
18
- detected = '$DETECTED'
19
- installed = '$INSTALLED'
18
+ detected, installed = sys.argv[2:4]
20
19
 
21
20
  plan = []
22
21
  for m in sorted(fm.get('migrations', []), key=lambda x: x.get('order', 99)):
@@ -30,7 +29,7 @@ for m in sorted(fm.get('migrations', []), key=lambda x: x.get('order', 99)):
30
29
 
31
30
  applicable = [m for m in plan if m['since_version'] > detected and m['since_version'] <= installed]
32
31
  print(json.dumps(applicable))
33
- " 2>/dev/null)"
32
+ " "$REGISTRY" "$DETECTED" "$INSTALLED")"
34
33
 
35
34
  MIGRATION_COUNT="$(echo "$MIGRATION_PLAN" | $PYTHON -c "import json,sys; print(len(json.load(sys.stdin)))" 2>/dev/null)"
36
35
 
@@ -79,7 +78,7 @@ for m in json.load(sys.stdin):
79
78
  echo "$MIGRATION_PLAN" | $PYTHON -c "
80
79
  import json, sys, os
81
80
  for m in json.load(sys.stdin):
82
- bundle_path = os.path.join('$MIGRATIONS_DIR', m['file'])
81
+ bundle_path = os.path.join(sys.argv[1], m['file'])
83
82
  if not os.path.exists(bundle_path):
84
83
  print(f\" WARN {m['id']}: bundle file not found ({m['file']})\")
85
84
  continue
@@ -112,8 +111,9 @@ for m in json.load(sys.stdin):
112
111
  for a in fm.get('actions_needed', []):
113
112
  v = a.get('verify', '')
114
113
  if v: print(f\" verify: {v}\")
115
- " 2>/dev/null
114
+ " "$MIGRATIONS_DIR" 2>/dev/null
116
115
 
117
116
  echo ""
118
117
  echo "Run without --dry-run to apply these migrations."
119
118
  }
119
+
@@ -28,6 +28,8 @@ migrate_version_main() {
28
28
 
29
29
  INSTALLED="$(migrate_installed_version)"
30
30
  migrate_detect_version || exit $?
31
+ migrate_validate_version "$DETECTED" detected || exit $?
32
+ migrate_validate_version "$INSTALLED" installed || exit $?
31
33
 
32
34
  echo "migrate-version: detected=$DETECTED installed=$INSTALLED"
33
35
 
@@ -51,3 +53,4 @@ migrate_version_main() {
51
53
  migrate_finalize
52
54
  exit 0
53
55
  }
56
+
@@ -0,0 +1,36 @@
1
+ // story: e21s03
2
+ const assert = require('assert');
3
+ const fs = require('fs');
4
+ const os = require('os');
5
+ const path = require('path');
6
+ const { execFileSync } = require('child_process');
7
+
8
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'bp-agents-'));
9
+ const script = path.resolve(__dirname, '../../scripts/bp-read-agents.sh');
10
+ const commands = [
11
+ "echo'; printf IMPORT_RAN > import-marker; #",
12
+ "node -e 'console.log(\"quoted value\")'",
13
+ 'echo $(touch substitution-marker) `touch backtick-marker` "$HOME"; echo done',
14
+ "printf '%s\\n' 'spaces & symbols | < >'",
15
+ 'echo "deploy" && echo finished'
16
+ ];
17
+ const names = ['PREFLIGHT', 'TEST', 'BUILD', 'LINT', 'DEPLOY'];
18
+ const sections = ['Preflight', 'Test', 'Build', 'Lint', 'Deploy'];
19
+ try {
20
+ for (const source of ['AGENTS.md', 'CLAUDE.md', 'CURSOR.md']) {
21
+ fs.writeFileSync(path.join(root, source), commands.map((c, i) =>
22
+ `## ${sections[i]}\n\n\`\`\`bash\n${c}\n\`\`\`\n`).join('\n'));
23
+ const output = execFileSync('bash', ['-c',
24
+ 'eval "$(bash "$1")"; printf "%s\\0" "$BP_PREFLIGHT" "$BP_TEST" "$BP_BUILD" "$BP_LINT" "$BP_DEPLOY"',
25
+ 'import-test', script], { cwd: root, encoding: 'utf8' });
26
+ for (const marker of ['import-marker', 'substitution-marker', 'backtick-marker']) {
27
+ assert(!fs.existsSync(path.join(root, marker)), `${source}: importing executed ${marker}`);
28
+ }
29
+ assert.deepStrictEqual(output.split('\0').slice(0, -1), commands, `${source}: exact values`);
30
+ const printed = execFileSync('bash', [script, '--print'], { cwd: root, encoding: 'utf8' });
31
+ for (const command of commands) assert(printed.includes(command));
32
+ fs.unlinkSync(path.join(root, source));
33
+ }
34
+ assert.strictEqual(execFileSync('bash', [script], { cwd: root, encoding: 'utf8' }), '');
35
+ console.log(`PASS: ${names.length} command exports round-trip without execution in all 3 source formats`);
36
+ } finally { fs.rmSync(root, { recursive: true, force: true }); }
@@ -0,0 +1,31 @@
1
+ const assert = require('assert');
2
+ const fs = require('fs');
3
+ const http = require('http');
4
+ const path = require('path');
5
+ const vm = require('vm');
6
+
7
+ // Replace filesystem watching and Express routing at the I/O boundary, but
8
+ // exercise a real TCP listener with the arguments supplied by createServer.
9
+ const filename = path.resolve(__dirname, '../../dashboard/src/web/server.js');
10
+ const moduleStub = { exports: {} };
11
+ const sandbox = {
12
+ module: moduleStub, __dirname: path.dirname(filename), console, setTimeout, clearTimeout,
13
+ require(name) {
14
+ if (name === 'path') return path;
15
+ if (name === '../loaders/watcher') return { watch: () => ({ on() {} }) };
16
+ if (name.startsWith('../loaders/')) return {};
17
+ assert.strictEqual(name, 'express');
18
+ return () => ({ get() {}, listen: (...args) => http.createServer().listen(...args) });
19
+ }
20
+ };
21
+ vm.runInNewContext(fs.readFileSync(filename, 'utf8'), sandbox, { filename });
22
+ const app = moduleStub.exports.createServer('/unused', 0);
23
+ const server = app.listen(0, () => {
24
+ try {
25
+ assert.strictEqual(server.address().address, '127.0.0.1');
26
+ assert(server.address().port > 0, 'ephemeral port and callback remain supported');
27
+ console.log('PASS: dashboard binds only to IPv4 loopback');
28
+ } catch (error) { console.error(error); process.exitCode = 1; }
29
+ finally { server.close(); }
30
+ });
31
+ server.on('error', error => { console.error(error); process.exitCode = 1; });
@@ -0,0 +1,60 @@
1
+ const assert = require('assert');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const vm = require('vm');
5
+
6
+ // Execute the shipped client and feed its public fetch/SSE inputs. Capture
7
+ // generated HTML at the DOM boundary; this is not a browser execution test.
8
+ const nodes = new Map(['pipeline', 'metrics', 'state', 'epics', 'ledger', 'status']
9
+ .map(id => [id, { innerHTML: '', classList: { add() {}, remove() {} } }]));
10
+ const events = new Map();
11
+ let stream;
12
+ const payload = '<img src=x onerror="window.__bpXss=1"> & \'quoted\'';
13
+ const escaped = '&lt;img src=x onerror=&quot;window.__bpXss=1&quot;&gt; &amp; &#39;quoted&#39;';
14
+ const snapshot = {
15
+ state: { activeFlow: payload, activeEpic: payload, activeStory: payload,
16
+ gitBranch: payload, release: { version: payload } },
17
+ projectMetrics: { totalBcps: payload, avgBcpPerHour: 1.5 },
18
+ currentVelocity: { avgBcpPerHour: 2 },
19
+ epics: [{ id: payload, title: payload, stories: [] }],
20
+ cycleTimes: [{ id: payload, bcps: payload, cycleMin: payload, bcpPerHour: 3 }]
21
+ };
22
+ const sandbox = {
23
+ console,
24
+ document: {
25
+ getElementById: id => nodes.get(id), querySelectorAll: () => [],
26
+ addEventListener() {}, createElement: () => ({ getContext: () => ({}) })
27
+ },
28
+ window: { addEventListener: (name, fn) => events.set(name, fn) },
29
+ fetch: async () => ({ json: async () => JSON.parse(JSON.stringify(snapshot)) }),
30
+ EventSource: class { constructor() { stream = this; } },
31
+ setInterval() { throw new Error('unexpected polling fallback'); }
32
+ };
33
+ const filename = path.resolve(__dirname, '../../dashboard/src/web/client.html');
34
+ const html = fs.readFileSync(filename, 'utf8');
35
+ for (const match of html.matchAll(/<script>([\s\S]*?)<\/script>/g)) {
36
+ vm.runInNewContext(match[1], sandbox, { filename });
37
+ }
38
+ function assertEscaped() {
39
+ for (const [panel, count] of [['state', 4], ['metrics', 2], ['epics', 2], ['ledger', 3]]) {
40
+ const output = nodes.get(panel).innerHTML;
41
+ assert(!output.includes('<img'), `${panel}: project metadata became HTML`);
42
+ assert.strictEqual(output.split(escaped).length - 1, count, `${panel}: literal text preserved`);
43
+ }
44
+ }
45
+ async function main() {
46
+ events.get('load')();
47
+ await new Promise(resolve => setImmediate(resolve));
48
+ assertEscaped();
49
+ assert(stream, 'initial fetch should connect SSE');
50
+ stream.onmessage({ data: JSON.stringify(snapshot) });
51
+ assertEscaped();
52
+ stream.onmessage({ data: JSON.stringify({ state: { gitBranch: 'feature/example' },
53
+ projectMetrics: { totalBcps: 0, avgBcpPerHour: 0 } }) });
54
+ assert(nodes.get('state').innerHTML.includes('feature/example'));
55
+ assert(nodes.get('metrics').innerHTML.includes('>0</span>'));
56
+ assert(nodes.get('epics').innerHTML.includes('No epics available'));
57
+ assert(nodes.get('ledger').innerHTML.includes('No cycle-time data available'));
58
+ console.log('PASS: fetch and SSE render all project metadata as escaped text');
59
+ }
60
+ main().catch(error => { console.error(error); process.exitCode = 1; });
@@ -0,0 +1,44 @@
1
+ // story: e32s04
2
+ const assert = require('assert');
3
+ const fs = require('fs');
4
+ const os = require('os');
5
+ const path = require('path');
6
+ const { execFileSync } = require('child_process');
7
+
8
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'bp-diff-'));
9
+ const git = (...args) => execFileSync('git', args, { cwd: root, stdio: 'pipe' });
10
+ const put = (name, value) => {
11
+ fs.mkdirSync(path.dirname(path.join(root, name)), { recursive: true });
12
+ fs.writeFileSync(path.join(root, name), value);
13
+ };
14
+
15
+ async function main() {
16
+ const { getGitContext } = await import('../../bigpowers-mcp/build/lib/git-context.js');
17
+ git('init', '-q');
18
+ const secret = 'specs/m-secret.pem';
19
+ const before = 'specs/a-public.md';
20
+ const after = 'specs/z-public.md';
21
+ const outside = 'private/readme.md';
22
+ for (const file of [secret, before, after, outside]) put(file, 'baseline\n');
23
+ git('add', '.');
24
+ git('-c', 'user.name=Test', '-c', 'user.email=test@example.invalid',
25
+ 'commit', '-qm', 'fixture');
26
+ for (const allowed of [[after], [before, after], [before], []]) {
27
+ git('reset', '--hard', 'HEAD');
28
+ put(secret, 'DUMMY_SECRET_VALUE\n');
29
+ put(outside, 'OUT_OF_SCOPE_VALUE\n');
30
+ for (const file of allowed) put(file, 'PUBLIC_CHANGE\n');
31
+ const result = getGitContext(root, 'diff');
32
+ assert.deepStrictEqual(Object.keys(result.diffs).sort(), [...allowed].sort());
33
+ assert.deepStrictEqual(Object.values(result.changed_files).flat().sort(), [...allowed].sort());
34
+ assert(!JSON.stringify(result).includes('DUMMY_SECRET_VALUE'));
35
+ assert(!JSON.stringify(result).includes('OUT_OF_SCOPE_VALUE'));
36
+ for (const file of allowed) assert(result.diffs[file].includes('+PUBLIC_CHANGE'));
37
+ }
38
+ git('reset', '--hard', 'HEAD');
39
+ assert.deepStrictEqual(getGitContext(root, 'diff').diffs, {});
40
+ console.log('PASS: secret diffs excluded in first, middle, last and only positions');
41
+ }
42
+
43
+ main().catch(error => { console.error(error); process.exitCode = 1; })
44
+ .finally(() => fs.rmSync(root, { recursive: true, force: true }));
@@ -0,0 +1,76 @@
1
+ // story: e44s03 e44s06
2
+ const assert = require('assert');
3
+ const fs = require('fs');
4
+ const os = require('os');
5
+ const path = require('path');
6
+ const { execFileSync, spawnSync } = require('child_process');
7
+
8
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'bp-migration-'));
9
+ const repo = path.resolve(__dirname, '../..');
10
+ const project = path.join(root, 'project');
11
+ const specs = path.join(project, 'specs');
12
+ const marker = path.join(root, 'executed-marker');
13
+ const git = (...args) => execFileSync('git', args, { cwd: project, stdio: 'pipe' });
14
+ function stamp(version) {
15
+ fs.writeFileSync(path.join(specs, 'state.yaml'),
16
+ `bigpowers_version: ${JSON.stringify(version)}\nactive_flow: null\n`);
17
+ git('add', '.');
18
+ git('-c', 'user.name=Test', '-c', 'user.email=test@example.invalid',
19
+ 'commit', '--allow-empty', '-qm', 'fixture');
20
+ }
21
+ function preview(script) {
22
+ const before = fs.readFileSync(path.join(specs, 'state.yaml'), 'utf8');
23
+ const result = spawnSync('bash', [script, '--project', project, '--dry-run'],
24
+ { cwd: project, encoding: 'utf8' });
25
+ assert(!result.error, String(result.error));
26
+ assert(!fs.existsSync(marker), 'dry run executed version metadata');
27
+ assert.strictEqual(fs.readFileSync(path.join(specs, 'state.yaml'), 'utf8'), before);
28
+ assert.deepStrictEqual(fs.readdirSync(specs), ['state.yaml'], 'dry run wrote files');
29
+ return result;
30
+ }
31
+ function copyFile(relative, destination) {
32
+ const target = path.join(destination, relative);
33
+ fs.mkdirSync(path.dirname(target), { recursive: true });
34
+ fs.copyFileSync(path.join(repo, relative), target);
35
+ }
36
+ function installFixture(destination) {
37
+ for (const relative of ['package.json', 'scripts/migrate-version.sh',
38
+ 'scripts/lib/python-env.sh', ...['common', 'plan', 'run', 'post', 'execute', 'transforms']
39
+ .map(name => `scripts/lib/migrate-version-${name}.sh`)]) copyFile(relative, destination);
40
+ const migrations = path.join(destination, 'specs/migrations');
41
+ fs.mkdirSync(migrations, { recursive: true });
42
+ fs.writeFileSync(path.join(migrations, 'registry.okf.md'),
43
+ '---\nmigrations:\n - id: test\n since_version: "2.80.0"\n order: 1\n---\n');
44
+ fs.writeFileSync(path.join(migrations, 'test.okf.md'),
45
+ '---\ntransforms: []\nactions_needed: []\n---\n');
46
+ return path.join(destination, 'scripts/migrate-version.sh');
47
+ }
48
+ try {
49
+ fs.mkdirSync(specs, { recursive: true });
50
+ git('init', '-q', '-b', 'main');
51
+ const script = installFixture(path.join(root, 'installation'));
52
+ stamp(`0.0.0'; open('${marker}', 'w').write('DUMMY'); #`);
53
+ const hostile = preview(script);
54
+ assert.notStrictEqual(hostile.status, 0, 'invalid version must fail closed');
55
+ assert(/invalid.*version/i.test(hostile.stderr), hostile.stderr);
56
+ for (const version of ['1.0.0', '2.0.0', '2.20.0', '2.20.0-rc.1+build.2']) {
57
+ stamp(version);
58
+ const result = preview(script);
59
+ assert.strictEqual(result.status, 0, result.stderr);
60
+ assert(result.stdout.includes(`Detected version: ${version}`), result.stdout);
61
+ }
62
+ // The same data boundary applies to legitimate installation/project paths.
63
+ const installation = path.join(root, "install's directory");
64
+ const quotedScript = installFixture(installation);
65
+ stamp('1.0.0');
66
+ const quotedProject = path.join(root, "project's directory");
67
+ fs.symlinkSync(project, quotedProject, 'dir');
68
+ const result = spawnSync('bash', [quotedScript,
69
+ '--project', quotedProject, '--dry-run'], { encoding: 'utf8' });
70
+ assert.strictEqual(result.status, 0, result.stderr);
71
+ assert(result.stdout.includes('Detected version: 1.0.0'), result.stdout);
72
+ assert(result.stdout.includes('Transforms preview:'), result.stdout);
73
+ assert(result.stdout.includes('-- test: test --'), result.stdout);
74
+ assert(!result.stdout.includes('installed=unknown'), result.stdout);
75
+ console.log('PASS: migration preview rejects executable stamps and supports quoted paths');
76
+ } finally { fs.rmSync(root, { recursive: true, force: true }); }