Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/api",
"version": "0.10.10",
"version": "0.10.11",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@naturalcycles/diffity",
"version": "0.10.10",
"version": "0.10.11",
"description": "Agent-agnostic, GitHub-style diff viewer and code review tool with a live agent loop",
"type": "module",
"bin": {
Expand Down
13 changes: 11 additions & 2 deletions packages/cli/src/inbox/open-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@ import { checkInstanceHealth, findInstanceForRepo } from '../registry.js';
export async function openPreparedSession(worktree: string, bundlePath: string, deps: OpenSessionDeps): Promise<OpenedSession> {
const ref = deps.baseRefOf(bundlePath);
const port = await deps.ensureServer(worktree, ref);
const url = sessionUrl(port, ref);
try {
deps.importBundle(worktree, bundlePath);
} catch (err) {
return { url: `http://localhost:${port}/`, imported: false, importError: err instanceof Error ? err.message : String(err) };
return { url, imported: false, importError: err instanceof Error ? err.message : String(err) };
}
return { url: `http://localhost:${port}/`, imported: true };
return { url, imported: true };
}

/**
* The diff page at the session's ref. The bare root redirects to the working-tree diff, which is
* empty for a clean worktree at the pull request's head.
*/
function sessionUrl(port: number, ref: string): string {
return `http://localhost:${port}/diff?ref=${encodeURIComponent(ref)}`;
}

/** The base commit a bundle was built against; the session diffs the worktree against it. */
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/tests/inbox-open.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('openPreparedSession', () => {

const result = await openPreparedSession('/wt', '/b.json', deps);

expect(result).toEqual({ url: 'http://localhost:5599/', imported: true });
expect(result).toEqual({ url: 'http://localhost:5599/diff?ref=basesha', imported: true });
expect(calls).toEqual(['ensure /wt basesha', 'import /wt /b.json']);
});

Expand All @@ -99,7 +99,7 @@ describe('openPreparedSession', () => {
importBundle: () => { throw new Error('head moved'); },
};
const result = await openPreparedSession('/wt', '/b.json', deps);
expect(result).toEqual({ url: 'http://localhost:5599/', imported: false, importError: 'head moved' });
expect(result).toEqual({ url: 'http://localhost:5599/diff?ref=basesha', imported: false, importError: 'head moved' });
});
});

Expand Down Expand Up @@ -179,7 +179,7 @@ describe('the inbox server routes', () => {
try {
const res = await fetch(`http://127.0.0.1:${port}/open/${encodeURIComponent('o/r#4')}`, { redirect: 'manual' });
expect(res.status).toBe(302);
expect(res.headers.get('location')).toBe('http://localhost:7788/');
expect(res.headers.get('location')).toBe('http://localhost:7788/diff?ref=basesha');

store.observe({ ...snapshot(), number: 8 }, true, 'now');
const notReady = await fetch(`http://127.0.0.1:${port}/open/${encodeURIComponent('o/r#8')}`, { redirect: 'manual' });
Expand Down
2 changes: 1 addition & 1 deletion packages/git/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/git",
"version": "0.10.10",
"version": "0.10.11",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/github/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/github",
"version": "0.10.10",
"version": "0.10.11",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/parser",
"version": "0.10.10",
"version": "0.10.11",
"private": true,
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diffity/ui",
"version": "0.10.10",
"version": "0.10.11",
"type": "module",
"private": true,
"scripts": {
Expand Down
Loading