@vzn/vx 0.0.523 → 0.0.524

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vzn/vx",
3
- "version": "0.0.523",
3
+ "version": "0.0.524",
4
4
  "description": "The fastest task runner and build cache for JavaScript monorepos.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,10 +21,10 @@
21
21
  "node": ">=18"
22
22
  },
23
23
  "optionalDependencies": {
24
- "@vzn/vx-linux-x64": "0.0.523",
25
- "@vzn/vx-linux-arm64": "0.0.523",
26
- "@vzn/vx-darwin-x64": "0.0.523",
27
- "@vzn/vx-darwin-arm64": "0.0.523"
24
+ "@vzn/vx-linux-x64": "0.0.524",
25
+ "@vzn/vx-linux-arm64": "0.0.524",
26
+ "@vzn/vx-darwin-x64": "0.0.524",
27
+ "@vzn/vx-darwin-arm64": "0.0.524"
28
28
  },
29
29
  "dependencies": {
30
30
  "@anthropic-ai/sandbox-runtime": "^0.0.76"
@@ -329,6 +329,23 @@ export interface WorkspaceIdentity {
329
329
  id: string
330
330
  /** Human name for switchers/badges: the repo (or root dir) basename. */
331
331
  name: string
332
+ /** The origin remote, normalized (`github.com/org/repo`); absent without one. */
333
+ repository?: string
334
+ /** The root inside its git work tree, POSIX, `.` at the top; absent outside git. */
335
+ path?: string
336
+ }
337
+
338
+ /** Where `root` sits in the work tree whose `.git` is nearest above it. */
339
+ function workTreePath(root: string): string | undefined {
340
+ const abs = path.resolve(root)
341
+ for (let dir = abs; ;) {
342
+ if (fs.existsSync(path.join(dir, '.git'))) {
343
+ return path.relative(dir, abs).split(path.sep).join('/') || '.'
344
+ }
345
+ const up = path.dirname(dir)
346
+ if (up === dir) return undefined
347
+ dir = up
348
+ }
332
349
  }
333
350
 
334
351
  /**
@@ -375,6 +392,8 @@ export function captureWorkspaceIdentity(
375
392
  originUrl?: string | null,
376
393
  ): WorkspaceIdentity {
377
394
  const base = workspaceRoot.replace(/\/+$/, '').split('/').pop() || 'workspace'
395
+ const at = workTreePath(workspaceRoot)
396
+ const where = at === undefined ? {} : { path: at }
378
397
  try {
379
398
  let url = originUrl ?? ''
380
399
  if (originUrl === undefined) {
@@ -393,7 +412,7 @@ export function captureWorkspaceIdentity(
393
412
  if (url.length > 0) {
394
413
  const normalized = normalizeRemoteUrl(url)
395
414
  const name = normalized.split('/').pop() || base
396
- return { id: xxh3hex(normalized), name }
415
+ return { id: xxh3hex(normalized), name, repository: normalized, ...where }
397
416
  }
398
417
  } catch {
399
418
  // git unavailable — fall through to the salt.
@@ -409,8 +428,8 @@ export function captureWorkspaceIdentity(
409
428
  fs.mkdirSync(path.dirname(saltPath), { recursive: true })
410
429
  fs.writeFileSync(saltPath, salt + '\n')
411
430
  }
412
- return { id: xxh3hex(salt), name: base }
431
+ return { id: xxh3hex(salt), name: base, ...where }
413
432
  } catch {
414
- return { id: xxh3hex(workspaceRoot), name: base }
433
+ return { id: xxh3hex(workspaceRoot), name: base, ...where }
415
434
  }
416
435
  }
@@ -752,6 +752,8 @@ async function runOnBus(
752
752
  arch: hostContext.arch,
753
753
  workspaceId: wsIdentity.id,
754
754
  workspaceName: wsIdentity.name,
755
+ ...(wsIdentity.repository !== undefined ? { repository: wsIdentity.repository } : {}),
756
+ ...(wsIdentity.path !== undefined ? { workspacePath: wsIdentity.path } : {}),
755
757
  tags: maskTags(options.tags ?? {}),
756
758
  }
757
759
  telemetry = await subscribeTelemetry(
@@ -123,6 +123,10 @@ export interface RunContextRecord {
123
123
  */
124
124
  workspaceId: string
125
125
  workspaceName: string
126
+ /** The origin remote, normalized (`github.com/org/repo`); absent without one. Additive. */
127
+ repository?: string
128
+ /** The workspace root relative to its git work tree, `.` at the top; absent outside git. Additive. */
129
+ workspacePath?: string
126
130
  // git / CI / host — straight from run-context.ts.
127
131
  commitSha: string | null
128
132
  branch: string | null