review-workspace 1.7.0 → 1.7.1

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,5 +1,5 @@
1
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
- import { basename, dirname, join, relative } from 'node:path';
2
+ import { basename, dirname, join, relative, resolve } from 'node:path';
3
3
  /**
4
4
  * A stable cross-round identity for one MR: repo slug + number, e.g.
5
5
  * "founda/application/xds-viewer-ui!367".
@@ -33,8 +33,13 @@ function parseBundleDirName(dirName) {
33
33
  }
34
34
  /** The sibling bundle path a new round for `bundlePath` would scaffold into. */
35
35
  export function nextRoundBundlePath(bundlePath) {
36
- const { baseName, round } = parseBundleDirName(basename(bundlePath));
37
- return join(dirname(bundlePath), `${baseName}-r${round + 1}`);
36
+ // Resolve first: basename/dirname on "." or ".." (a bundle path relative to
37
+ // cwd, e.g. when invoked as `round .`) otherwise collapse to "." for both,
38
+ // producing a literal "-r{N}" sibling nested inside the bundle itself
39
+ // instead of a real sibling directory next to it.
40
+ const resolved = resolve(bundlePath);
41
+ const { baseName, round } = parseBundleDirName(basename(resolved));
42
+ return join(dirname(resolved), `${baseName}-r${round + 1}`);
38
43
  }
39
44
  /**
40
45
  * Detects, purely from what's on disk plus a supplied live head, whether a
@@ -56,7 +61,8 @@ export function scaffoldNextRound(bundlePath, liveHead, options) {
56
61
  if (document.comparison.head === liveHead) {
57
62
  throw new Error(`Live head ${liveHead} matches the bundle's recorded head; no new round is needed`);
58
63
  }
59
- const { round: currentRound } = parseBundleDirName(basename(bundlePath));
64
+ const resolvedBundlePath = resolve(bundlePath);
65
+ const { round: currentRound } = parseBundleDirName(basename(resolvedBundlePath));
60
66
  const newBundlePath = nextRoundBundlePath(bundlePath);
61
67
  if (existsSync(newBundlePath)) {
62
68
  throw new Error(`Round bundle already exists at ${newBundlePath}`);
@@ -64,7 +70,7 @@ export function scaffoldNextRound(bundlePath, liveHead, options) {
64
70
  const chain = {
65
71
  mrKey: mrKeyFor(document.comparison),
66
72
  round: currentRound + 1,
67
- previousBundle: relative(newBundlePath, bundlePath),
73
+ previousBundle: relative(newBundlePath, resolvedBundlePath),
68
74
  previousHead: document.comparison.head,
69
75
  };
70
76
  mkdirSync(newBundlePath, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "review-workspace",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "A local, offline decision surface for reviewing a code Comparison — evidence-linked map of intent, behavior, risk, and observable effects.",
5
5
  "license": "MIT",
6
6
  "author": "Salih Sayer",