@wjarka/cezarion 0.17.0-dev.5579 → 0.17.0-dev.5585

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.
@@ -3300,21 +3300,23 @@ export function createApp(deps) {
3300
3300
  })
3301
3301
  // Task diff (spec 006): what this run changed — its worktree vs its base.
3302
3302
  .get('/runs/:id/diff', async (c) => {
3303
- const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { checksAutosave: true, directory: 'existing-worktree' });
3303
+ const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { directory: 'existing-worktree' });
3304
3304
  if ('body' in checkout)
3305
3305
  return c.json(checkout.body, checkout.status);
3306
- const { run, directory: workingDirectory } = checkout;
3307
- if (!workingDirectory) {
3306
+ if (!checkout.directory)
3308
3307
  return c.text('(no worktree — this task ran directly in the repo working tree)');
3309
- }
3310
- return c.text(await worktreeDiff(workingDirectory, run.baseBranch ?? 'HEAD'));
3308
+ const result = await worktreeDiff(checkout.directory, checkout.run.baseBranch ?? 'HEAD', undefined, checkout.beforeLiveIndex);
3309
+ if (typeof result !== 'string')
3310
+ return c.json({ error: result.error }, 409);
3311
+ return c.text(result);
3311
3312
  })
3312
3313
  .get('/runs/:id/changes', async (c) => {
3313
- const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { checksAutosave: true, directory: 'working-directory' });
3314
+ const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { directory: 'working-directory' });
3314
3315
  if ('body' in checkout)
3315
3316
  return c.json(checkout.body, checkout.status);
3316
3317
  const { run, directory: workingDirectory } = checkout;
3317
3318
  const result = await collectChanges(workingDirectory, run.baseBranch ?? 'HEAD', {
3319
+ beforeLiveIndex: checkout.beforeLiveIndex,
3318
3320
  taskBranch: run.branch,
3319
3321
  // Anchors a repointed worktree at the branch as this run found it (#751).
3320
3322
  runStartedAt: run.startedAt,
@@ -3327,7 +3329,7 @@ export function createApp(deps) {
3327
3329
  })
3328
3330
  // The run's own commits (<base>..HEAD on the worktree branch) — the Commits tab.
3329
3331
  .get('/runs/:id/commits', async (c) => {
3330
- const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { checksAutosave: false, directory: 'working-directory' });
3332
+ const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { directory: 'working-directory' });
3331
3333
  if ('body' in checkout)
3332
3334
  return c.json(checkout.body, checkout.status);
3333
3335
  const { run, directory: workingDirectory } = checkout;
@@ -3338,7 +3340,7 @@ export function createApp(deps) {
3338
3340
  })
3339
3341
  // One of the run's commits, structured like the Changes tab (reuses collectCommitChanges).
3340
3342
  .get('/runs/:id/commit/:sha', async (c) => {
3341
- const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { checksAutosave: false, directory: 'working-directory' });
3343
+ const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { directory: 'working-directory' });
3342
3344
  if ('body' in checkout)
3343
3345
  return c.json(checkout.body, checkout.status);
3344
3346
  const { directory: workingDirectory } = checkout;
@@ -3349,7 +3351,7 @@ export function createApp(deps) {
3349
3351
  })
3350
3352
  .get('/runs/:id/file-link', paramZodValidator(artifactParamsSchema.omit({ artifactId: true })), queryZodValidator(fileLinkQuerySchema), async (c) => {
3351
3353
  const { root, store } = c.get('project');
3352
- const checkout = runCheckout(c.get('project'), c.req.valid('param').id, 'read', { checksAutosave: false, directory: 'recorded-path-or-root' });
3354
+ const checkout = runCheckout(c.get('project'), c.req.valid('param').id, 'read', { directory: 'recorded-path-or-root' });
3353
3355
  if ('body' in checkout)
3354
3356
  return c.json(checkout.body, checkout.status);
3355
3357
  const { run, directory: workingDirectory } = checkout;
@@ -3438,7 +3440,7 @@ export function createApp(deps) {
3438
3440
  const wantsRaw = query.raw !== undefined
3439
3441
  ? query.raw === '1'
3440
3442
  : negotiate(c.req.header('accept'), FILE_FORMATS) === 'image/*';
3441
- const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { checksAutosave: false, directory: 'working-directory' });
3443
+ const checkout = runCheckout(c.get('project'), c.req.param('id'), 'read', { directory: 'working-directory' });
3442
3444
  if ('body' in checkout)
3443
3445
  return c.json(checkout.body, checkout.status);
3444
3446
  const { directory: workingDirectory } = checkout;
@@ -3557,7 +3559,7 @@ export function createApp(deps) {
3557
3559
  const { root: repoRoot, store } = c.get('project');
3558
3560
  const id = c.req.param('id');
3559
3561
  const checkout = runCheckout(c.get('project'), id, 'remove', {
3560
- claim: 'publish', activeBeforeLookup: false, checksActive: true, deletion: 'worktree', ignoresHold: true,
3562
+ claim: 'publish', activeBeforeLookup: false, checksActive: true, deletion: 'worktree',
3561
3563
  nullClaimError: 'worktree cleanup pending — retry after cleanup is confirmed',
3562
3564
  });
3563
3565
  if ('status' in checkout)
@@ -3577,7 +3579,7 @@ export function createApp(deps) {
3577
3579
  const { root: repoRoot, store } = c.get('project');
3578
3580
  const id = c.req.param('id');
3579
3581
  const checkout = runCheckout(c.get('project'), id, 'remove', {
3580
- claim: 'publish', activeBeforeLookup: true, checksActive: true, deletion: 'record', ignoresHold: true,
3582
+ claim: 'publish', activeBeforeLookup: true, checksActive: true, deletion: 'record',
3581
3583
  nullClaimError: 'worktree cleanup pending — retry after cleanup is confirmed',
3582
3584
  });
3583
3585
  if ('status' in checkout)
@@ -3690,7 +3692,7 @@ export function createApp(deps) {
3690
3692
  .post('/worktrees/:runId/reclaim', paramZodValidator(reclaimRunParamsSchema), async (c) => {
3691
3693
  const { root: repoRoot, store } = c.get('project');
3692
3694
  const checkout = runCheckout(c.get('project'), c.req.valid('param').runId, 'remove', {
3693
- claim: 'reclaim', activeBeforeLookup: false, checksActive: false, deletion: 'inline', ignoresHold: true,
3695
+ claim: 'reclaim', activeBeforeLookup: false, checksActive: false, deletion: 'inline',
3694
3696
  nullClaimError: 'this worktree is in use or already reclaimed — only a finished task\'s worktree can be reclaimed',
3695
3697
  });
3696
3698
  if ('status' in checkout)