@mduan/paseo-cli 0.11.0-fork.4 → 0.11.0-fork.6
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/node_modules/@getpaseo/client/dist/daemon-client.d.ts +4 -0
- package/node_modules/@getpaseo/client/dist/daemon-client.js +1 -0
- package/node_modules/@getpaseo/client/package.json +3 -3
- package/node_modules/@getpaseo/highlight/package.json +1 -1
- package/node_modules/@getpaseo/plugin/package.json +3 -3
- package/node_modules/@getpaseo/protocol/dist/generated/validation/ws-outbound.aot.js +5 -0
- package/node_modules/@getpaseo/protocol/dist/messages.d.ts +20 -0
- package/node_modules/@getpaseo/protocol/dist/messages.js +10 -0
- package/node_modules/@getpaseo/protocol/dist/validation/ws-outbound-schema-metadata.d.ts +1 -0
- package/node_modules/@getpaseo/protocol/package.json +1 -1
- package/node_modules/@getpaseo/relay/package.json +1 -1
- package/node_modules/@getpaseo/server/dist/server/builtin-plugins/package.json +1 -1
- package/node_modules/@getpaseo/server/dist/server/server/session/checkout/checkout-session.js +2 -1
- package/node_modules/@getpaseo/server/dist/server/terminal/terminal-manager.d.ts +2 -1
- package/node_modules/@getpaseo/server/dist/server/terminal/terminal-manager.js +1 -0
- package/node_modules/@getpaseo/server/dist/server/terminal/terminal-session-controller.js +1 -0
- package/node_modules/@getpaseo/server/dist/server/terminal/terminal-worker-protocol.d.ts +2 -1
- package/node_modules/@getpaseo/server/dist/server/terminal/terminal.d.ts +5 -0
- package/node_modules/@getpaseo/server/dist/server/terminal/terminal.js +21 -7
- package/node_modules/@getpaseo/server/dist/server/utils/checkout-git.d.ts +8 -1
- package/node_modules/@getpaseo/server/dist/server/utils/checkout-git.js +30 -18
- package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/{index-7d1ebd536b50ed8d734f6b88b86b8822.js → index-39387227f55ac3348edf743607665554.js} +8 -8
- package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/index-39387227f55ac3348edf743607665554.js.br +0 -0
- package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/{index-7d1ebd536b50ed8d734f6b88b86b8822.js.gz → index-39387227f55ac3348edf743607665554.js.gz} +0 -0
- package/node_modules/@getpaseo/server/dist/server/web-ui/index.html +1 -1
- package/node_modules/@getpaseo/server/dist/server/web-ui/index.html.br +0 -0
- package/node_modules/@getpaseo/server/dist/server/web-ui/index.html.gz +0 -0
- package/node_modules/@getpaseo/server/package.json +6 -6
- package/package.json +7 -7
- package/node_modules/@getpaseo/server/dist/server/web-ui/_expo/static/js/web/index-7d1ebd536b50ed8d734f6b88b86b8822.js.br +0 -0
|
@@ -1257,6 +1257,10 @@ export declare class DaemonClient {
|
|
|
1257
1257
|
rows: number;
|
|
1258
1258
|
cols: number;
|
|
1259
1259
|
};
|
|
1260
|
+
colors?: {
|
|
1261
|
+
foreground: string;
|
|
1262
|
+
background: string;
|
|
1263
|
+
};
|
|
1260
1264
|
}): Promise<CreateTerminalPayload>;
|
|
1261
1265
|
renameTerminal(input: RenameTerminalInput): Promise<RenameTerminalResult>;
|
|
1262
1266
|
/**
|
|
@@ -4028,6 +4028,7 @@ export class DaemonClient {
|
|
|
4028
4028
|
args: options?.args,
|
|
4029
4029
|
...(options?.workspaceId !== undefined ? { workspaceId: options.workspaceId } : {}),
|
|
4030
4030
|
...(options?.size !== undefined ? { size: options.size } : {}),
|
|
4031
|
+
...(options?.colors !== undefined ? { colors: options.colors } : {}),
|
|
4031
4032
|
requestId: resolvedRequestId,
|
|
4032
4033
|
});
|
|
4033
4034
|
return this.sendCorrelatedRequest({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpaseo/client",
|
|
3
|
-
"version": "0.11.0-fork.
|
|
3
|
+
"version": "0.11.0-fork.6",
|
|
4
4
|
"description": "Paseo client SDK package",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vitest": "^4.1.6"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@getpaseo/protocol": "0.11.0-fork.
|
|
48
|
-
"@getpaseo/relay": "0.11.0-fork.
|
|
47
|
+
"@getpaseo/protocol": "0.11.0-fork.6",
|
|
48
|
+
"@getpaseo/relay": "0.11.0-fork.6"
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpaseo/plugin",
|
|
3
|
-
"version": "0.11.0-fork.
|
|
3
|
+
"version": "0.11.0-fork.6",
|
|
4
4
|
"description": "Paseo plugin SDK package",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"test": "vitest run"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@getpaseo/client": "0.11.0-fork.
|
|
70
|
-
"@getpaseo/protocol": "0.11.0-fork.
|
|
69
|
+
"@getpaseo/client": "0.11.0-fork.6",
|
|
70
|
+
"@getpaseo/protocol": "0.11.0-fork.6",
|
|
71
71
|
"@types/node": "^20.9.0",
|
|
72
72
|
"@types/react": "~19.2.0",
|
|
73
73
|
"react": "19.1.0",
|
|
@@ -80530,6 +80530,11 @@ export const WSOutboundMessageSchema = /* @__PURE__ */ (() => {
|
|
|
80530
80530
|
else if (!Number.isFinite(__o_5518["committerDate"])) {
|
|
80531
80531
|
_e.push({ code: "invalid_type", expected: "number", received: "Infinity", input: __o_5518["committerDate"], path: ["message"].concat("payload").concat("branchDetails").concat(__i_5517).concat("committerDate") });
|
|
80532
80532
|
}
|
|
80533
|
+
if (__o_5518["isDefault"] !== undefined) {
|
|
80534
|
+
if (typeof __o_5518["isDefault"] !== "boolean") {
|
|
80535
|
+
_e.push({ code: "invalid_type", expected: "boolean", input: __o_5518["isDefault"], path: ["message"].concat("payload").concat("branchDetails").concat(__i_5517).concat("isDefault") });
|
|
80536
|
+
}
|
|
80537
|
+
}
|
|
80533
80538
|
if (__o_5518["hasLocal"] !== undefined) {
|
|
80534
80539
|
if (typeof __o_5518["hasLocal"] !== "boolean") {
|
|
80535
80540
|
_e.push({ code: "invalid_type", expected: "boolean", input: __o_5518["hasLocal"], path: ["message"].concat("payload").concat("branchDetails").concat(__i_5517).concat("hasLocal") });
|
|
@@ -4392,6 +4392,10 @@ export declare const CreateTerminalRequestSchema: z.ZodObject<{
|
|
|
4392
4392
|
rows: z.ZodNumber;
|
|
4393
4393
|
cols: z.ZodNumber;
|
|
4394
4394
|
}, z.core.$strip>>;
|
|
4395
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
4396
|
+
foreground: z.ZodString;
|
|
4397
|
+
background: z.ZodString;
|
|
4398
|
+
}, z.core.$strip>>;
|
|
4395
4399
|
requestId: z.ZodString;
|
|
4396
4400
|
}, z.core.$strip>;
|
|
4397
4401
|
export declare const RenameTerminalRequestSchema: z.ZodObject<{
|
|
@@ -7310,6 +7314,10 @@ export declare const SessionInboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
7310
7314
|
rows: z.ZodNumber;
|
|
7311
7315
|
cols: z.ZodNumber;
|
|
7312
7316
|
}, z.core.$strip>>;
|
|
7317
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
7318
|
+
foreground: z.ZodString;
|
|
7319
|
+
background: z.ZodString;
|
|
7320
|
+
}, z.core.$strip>>;
|
|
7313
7321
|
requestId: z.ZodString;
|
|
7314
7322
|
}, z.core.$strip>, z.ZodObject<{
|
|
7315
7323
|
type: z.ZodLiteral<"terminal.rename.request">;
|
|
@@ -18887,6 +18895,7 @@ export declare const BranchSuggestionsResponseSchema: z.ZodObject<{
|
|
|
18887
18895
|
branchDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
18888
18896
|
name: z.ZodString;
|
|
18889
18897
|
committerDate: z.ZodNumber;
|
|
18898
|
+
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
18890
18899
|
hasLocal: z.ZodOptional<z.ZodBoolean>;
|
|
18891
18900
|
hasRemote: z.ZodOptional<z.ZodBoolean>;
|
|
18892
18901
|
localAhead: z.ZodOptional<z.ZodNumber>;
|
|
@@ -31840,6 +31849,7 @@ export declare const SessionOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
31840
31849
|
branchDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
31841
31850
|
name: z.ZodString;
|
|
31842
31851
|
committerDate: z.ZodNumber;
|
|
31852
|
+
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
31843
31853
|
hasLocal: z.ZodOptional<z.ZodBoolean>;
|
|
31844
31854
|
hasRemote: z.ZodOptional<z.ZodBoolean>;
|
|
31845
31855
|
localAhead: z.ZodOptional<z.ZodNumber>;
|
|
@@ -37164,6 +37174,10 @@ export declare const WSSessionInboundSchema: z.ZodObject<{
|
|
|
37164
37174
|
rows: z.ZodNumber;
|
|
37165
37175
|
cols: z.ZodNumber;
|
|
37166
37176
|
}, z.core.$strip>>;
|
|
37177
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
37178
|
+
foreground: z.ZodString;
|
|
37179
|
+
background: z.ZodString;
|
|
37180
|
+
}, z.core.$strip>>;
|
|
37167
37181
|
requestId: z.ZodString;
|
|
37168
37182
|
}, z.core.$strip>, z.ZodObject<{
|
|
37169
37183
|
type: z.ZodLiteral<"terminal.rename.request">;
|
|
@@ -47201,6 +47215,7 @@ export declare const WSSessionOutboundSchema: z.ZodObject<{
|
|
|
47201
47215
|
branchDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
47202
47216
|
name: z.ZodString;
|
|
47203
47217
|
committerDate: z.ZodNumber;
|
|
47218
|
+
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
47204
47219
|
hasLocal: z.ZodOptional<z.ZodBoolean>;
|
|
47205
47220
|
hasRemote: z.ZodOptional<z.ZodBoolean>;
|
|
47206
47221
|
localAhead: z.ZodOptional<z.ZodNumber>;
|
|
@@ -52168,6 +52183,10 @@ export declare const WSInboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
52168
52183
|
rows: z.ZodNumber;
|
|
52169
52184
|
cols: z.ZodNumber;
|
|
52170
52185
|
}, z.core.$strip>>;
|
|
52186
|
+
colors: z.ZodOptional<z.ZodObject<{
|
|
52187
|
+
foreground: z.ZodString;
|
|
52188
|
+
background: z.ZodString;
|
|
52189
|
+
}, z.core.$strip>>;
|
|
52171
52190
|
requestId: z.ZodString;
|
|
52172
52191
|
}, z.core.$strip>, z.ZodObject<{
|
|
52173
52192
|
type: z.ZodLiteral<"terminal.rename.request">;
|
|
@@ -62207,6 +62226,7 @@ export declare const WSOutboundMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
62207
62226
|
branchDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
62208
62227
|
name: z.ZodString;
|
|
62209
62228
|
committerDate: z.ZodNumber;
|
|
62229
|
+
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
62210
62230
|
hasLocal: z.ZodOptional<z.ZodBoolean>;
|
|
62211
62231
|
hasRemote: z.ZodOptional<z.ZodBoolean>;
|
|
62212
62232
|
localAhead: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2554,6 +2554,15 @@ export const CreateTerminalRequestSchema = z.object({
|
|
|
2554
2554
|
cols: z.number().int().positive(),
|
|
2555
2555
|
})
|
|
2556
2556
|
.optional(),
|
|
2557
|
+
// Viewer's terminal colors as #rrggbb, answered to OSC 10/11/12 color queries so TUIs like
|
|
2558
|
+
// Codex pick a light or dark palette that matches what the app renders. Daemons without it
|
|
2559
|
+
// answer with a fixed dark palette.
|
|
2560
|
+
colors: z
|
|
2561
|
+
.object({
|
|
2562
|
+
foreground: z.string(),
|
|
2563
|
+
background: z.string(),
|
|
2564
|
+
})
|
|
2565
|
+
.optional(),
|
|
2557
2566
|
requestId: z.string(),
|
|
2558
2567
|
});
|
|
2559
2568
|
export const RenameTerminalRequestSchema = z.object({
|
|
@@ -5273,6 +5282,7 @@ export const BranchSuggestionsResponseSchema = z.object({
|
|
|
5273
5282
|
.array(z.object({
|
|
5274
5283
|
name: z.string(),
|
|
5275
5284
|
committerDate: z.number(),
|
|
5285
|
+
isDefault: z.boolean().optional(),
|
|
5276
5286
|
hasLocal: z.boolean().optional(),
|
|
5277
5287
|
hasRemote: z.boolean().optional(),
|
|
5278
5288
|
localAhead: z.number().int().nonnegative().optional(),
|
|
@@ -9787,6 +9787,7 @@ export declare const WSOutboundMessageSchema: {
|
|
|
9787
9787
|
branchDetails: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
9788
9788
|
name: import("zod").ZodString;
|
|
9789
9789
|
committerDate: import("zod").ZodNumber;
|
|
9790
|
+
isDefault: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
9790
9791
|
hasLocal: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
9791
9792
|
hasRemote: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
9792
9793
|
localAhead: import("zod").ZodOptional<import("zod").ZodNumber>;
|
package/node_modules/@getpaseo/server/dist/server/server/session/checkout/checkout-session.js
CHANGED
|
@@ -5,7 +5,7 @@ import { validateBranchSlug } from "@getpaseo/protocol/branch-slug";
|
|
|
5
5
|
import { toCheckoutError } from "../../checkout-git-utils.js";
|
|
6
6
|
import { buildCheckoutPrStatusPayloadFromSnapshot, buildCheckoutStatusPayloadFromSnapshot, } from "../../checkout/status-projection.js";
|
|
7
7
|
import { assertSafeGitRef } from "../../worktree-session.js";
|
|
8
|
-
import { commitChanges, createPullRequest, discardChanges, forgeAuthStateFromError, isForgeAuthError, mergeFromBase, mergeToBase, pullCurrentBranch, pushCurrentBranch, listCheckoutCommits, getCommitFileDiff, readDiffContextLines, setCurrentBranchBaseRef, } from "../../../utils/checkout-git.js";
|
|
8
|
+
import { BranchCheckoutKind, commitChanges, createPullRequest, discardChanges, forgeAuthStateFromError, isForgeAuthError, mergeFromBase, mergeToBase, pullCurrentBranch, pushCurrentBranch, listCheckoutCommits, getCommitFileDiff, readDiffContextLines, setCurrentBranchBaseRef, } from "../../../utils/checkout-git.js";
|
|
9
9
|
import { runGitCommand } from "../../../utils/run-git-command.js";
|
|
10
10
|
import { expandTilde } from "../../../utils/path.js";
|
|
11
11
|
function assertSafeRelativePath(path) {
|
|
@@ -223,6 +223,7 @@ export class CheckoutSession {
|
|
|
223
223
|
});
|
|
224
224
|
return;
|
|
225
225
|
case "remote-only":
|
|
226
|
+
case BranchCheckoutKind.Remote:
|
|
226
227
|
this.host.emit({
|
|
227
228
|
type: "validate_branch_response",
|
|
228
229
|
payload: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TerminalSession, type TerminalStateSnapshot, type TerminalStateSnapshotOptions } from "./terminal.js";
|
|
1
|
+
import { type TerminalColors, type TerminalSession, type TerminalStateSnapshot, type TerminalStateSnapshotOptions } from "./terminal.js";
|
|
2
2
|
import { type CaptureTerminalLinesResult } from "./terminal-capture.js";
|
|
3
3
|
import type { TerminalActivity, TerminalActivityState } from "@getpaseo/protocol/terminal-activity";
|
|
4
4
|
export interface TerminalListItem {
|
|
@@ -44,6 +44,7 @@ export interface TerminalManager {
|
|
|
44
44
|
args?: string[];
|
|
45
45
|
rows?: number;
|
|
46
46
|
cols?: number;
|
|
47
|
+
colors?: TerminalColors;
|
|
47
48
|
activityToken?: string;
|
|
48
49
|
activityUrl?: string | null;
|
|
49
50
|
}): Promise<TerminalSession>;
|
|
@@ -212,6 +212,7 @@ export function createTerminalManager(managerOptions = {}) {
|
|
|
212
212
|
...(options.args ? { args: options.args } : {}),
|
|
213
213
|
...(options.rows !== undefined ? { rows: options.rows } : {}),
|
|
214
214
|
...(options.cols !== undefined ? { cols: options.cols } : {}),
|
|
215
|
+
...(options.colors ? { colors: options.colors } : {}),
|
|
215
216
|
...(mergedEnv ? { env: mergedEnv } : {}),
|
|
216
217
|
activityEnv,
|
|
217
218
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TerminalExitInfo, ServerMessage, ClientMessage, TerminalStateSnapshot, TerminalStateSnapshotOptions } from "./terminal.js";
|
|
1
|
+
import type { TerminalExitInfo, ServerMessage, ClientMessage, TerminalColors, TerminalStateSnapshot, TerminalStateSnapshotOptions } from "./terminal.js";
|
|
2
2
|
import type { TerminalState } from "@getpaseo/protocol/messages";
|
|
3
3
|
import type { TerminalActivity, TerminalActivityState } from "@getpaseo/protocol/terminal-activity";
|
|
4
4
|
import type { CaptureTerminalLinesResult } from "./terminal-capture.js";
|
|
@@ -21,6 +21,7 @@ export interface WorkerCreateTerminalOptions {
|
|
|
21
21
|
args?: string[];
|
|
22
22
|
rows?: number;
|
|
23
23
|
cols?: number;
|
|
24
|
+
colors?: TerminalColors;
|
|
24
25
|
activityToken?: string;
|
|
25
26
|
activityUrl?: string | null;
|
|
26
27
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { TerminalState } from "@getpaseo/protocol/messages";
|
|
2
2
|
import type { TerminalActivity, TerminalActivityState } from "@getpaseo/protocol/terminal-activity";
|
|
3
|
+
export interface TerminalColors {
|
|
4
|
+
foreground: string;
|
|
5
|
+
background: string;
|
|
6
|
+
}
|
|
3
7
|
export interface TerminalExitInfo {
|
|
4
8
|
exitCode: number | null;
|
|
5
9
|
signal: number | null;
|
|
@@ -97,6 +101,7 @@ export interface CreateTerminalOptions {
|
|
|
97
101
|
title?: string;
|
|
98
102
|
command?: string;
|
|
99
103
|
args?: string[];
|
|
104
|
+
colors?: TerminalColors;
|
|
100
105
|
}
|
|
101
106
|
interface BuildTerminalEnvironmentInput {
|
|
102
107
|
shell: string;
|
|
@@ -22,11 +22,25 @@ let nodePtySpawnHelperChecked = false;
|
|
|
22
22
|
const TERMINAL_TITLE_DEBOUNCE_MS = 150;
|
|
23
23
|
const TERMINAL_EXIT_OUTPUT_LINE_LIMIT = 12;
|
|
24
24
|
const TERMINAL_EXIT_OUTPUT_CHAR_LIMIT = 16000;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
]);
|
|
25
|
+
const DEFAULT_OSC_FOREGROUND = "rgb:e6e6/e6e6/e6e6";
|
|
26
|
+
const DEFAULT_OSC_BACKGROUND = "rgb:0b0b/0b0b/0b0b";
|
|
27
|
+
// OSC color replies use the X11 `rgb:rrrr/gggg/bbbb` form.
|
|
28
|
+
function toOscRgb(hex) {
|
|
29
|
+
const match = hex && /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex);
|
|
30
|
+
return match
|
|
31
|
+
? `rgb:${match[1].repeat(2)}/${match[2].repeat(2)}/${match[3].repeat(2)}`
|
|
32
|
+
: undefined;
|
|
33
|
+
}
|
|
34
|
+
// OSC 10 = foreground, 11 = background, 12 = cursor.
|
|
35
|
+
function buildOscColorQueryResponses(colors) {
|
|
36
|
+
const foreground = toOscRgb(colors?.foreground) ?? DEFAULT_OSC_FOREGROUND;
|
|
37
|
+
const background = toOscRgb(colors?.background) ?? DEFAULT_OSC_BACKGROUND;
|
|
38
|
+
return new Map([
|
|
39
|
+
[10, foreground],
|
|
40
|
+
[11, background],
|
|
41
|
+
[12, foreground],
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
30
44
|
function parseCommandFinishedOsc(data) {
|
|
31
45
|
// OSC 633 is terminal control traffic, but a foreground command can still
|
|
32
46
|
// print arbitrary control bytes. Keep this boundary to the exact VS Code
|
|
@@ -634,7 +648,7 @@ function extractLastOutputLinesFromText(text, limit) {
|
|
|
634
648
|
return lines.slice(-limit);
|
|
635
649
|
}
|
|
636
650
|
export async function createTerminal(options) {
|
|
637
|
-
const { cwd, workspaceId, shell, env = {}, activityEnv = {}, rows = 24, cols = 80, name = "Terminal", title: presetTitle, command, args = [], } = options;
|
|
651
|
+
const { cwd, workspaceId, shell, env = {}, activityEnv = {}, rows = 24, cols = 80, name = "Terminal", title: presetTitle, command, args = [], colors, } = options;
|
|
638
652
|
const resolvedShell = shell ?? resolveDefaultTerminalShell();
|
|
639
653
|
const id = options.id ?? randomUUID();
|
|
640
654
|
const listeners = new Set();
|
|
@@ -771,7 +785,7 @@ export async function createTerminal(options) {
|
|
|
771
785
|
ptyProcess.write(`\x1b[?${buffer.cursorY + 1};${buffer.cursorX + 1}R`);
|
|
772
786
|
return true;
|
|
773
787
|
});
|
|
774
|
-
for (const [code, response] of
|
|
788
|
+
for (const [code, response] of buildOscColorQueryResponses(colors)) {
|
|
775
789
|
terminal.parser.registerOscHandler(code, (data) => {
|
|
776
790
|
if (data.trim() !== "?") {
|
|
777
791
|
return false;
|
|
@@ -24,6 +24,7 @@ export declare function __setPullRequestStatusCacheTtlForTests(ttlMs: number): v
|
|
|
24
24
|
export declare function __resetCheckoutShortstatCacheForTests(): void;
|
|
25
25
|
export declare function __setCheckoutShortstatCacheTtlForTests(ttlMs: number): void;
|
|
26
26
|
export interface BranchSuggestion {
|
|
27
|
+
isDefault?: boolean;
|
|
27
28
|
name: string;
|
|
28
29
|
committerDate: number;
|
|
29
30
|
hasLocal: boolean;
|
|
@@ -47,7 +48,13 @@ export interface RemoteOnlyBranchCheckoutResolution {
|
|
|
47
48
|
export interface NotFoundBranchCheckoutResolution {
|
|
48
49
|
kind: "not-found";
|
|
49
50
|
}
|
|
50
|
-
export
|
|
51
|
+
export declare enum BranchCheckoutKind {
|
|
52
|
+
Remote = "remote"
|
|
53
|
+
}
|
|
54
|
+
export type BranchCheckoutResolution = LocalBranchCheckoutResolution | RemoteOnlyBranchCheckoutResolution | {
|
|
55
|
+
kind: BranchCheckoutKind.Remote;
|
|
56
|
+
remoteRef: string;
|
|
57
|
+
} | NotFoundBranchCheckoutResolution;
|
|
51
58
|
export declare function resolveBranchCheckout(cwd: string, name: string): Promise<BranchCheckoutResolution>;
|
|
52
59
|
export type BranchCheckoutSource = "local" | "remote";
|
|
53
60
|
export interface CheckoutExistingBranchResult {
|
|
@@ -169,9 +169,10 @@ export async function listBranchSuggestions(cwd, options) {
|
|
|
169
169
|
const limit = Math.max(1, Math.min(200, requestedLimit));
|
|
170
170
|
const rawQuery = options?.query?.trim().toLowerCase() ?? "";
|
|
171
171
|
const query = normalizeBranchSuggestionName(rawQuery) ?? rawQuery;
|
|
172
|
-
const [localRefs, remoteRefs] = await Promise.all([
|
|
172
|
+
const [localRefs, remoteRefs, defaultBranch] = await Promise.all([
|
|
173
173
|
listGitRefs(cwd, "refs/heads"),
|
|
174
174
|
listGitRefs(cwd, "refs/remotes/origin"),
|
|
175
|
+
resolveRepositoryDefaultBranch(cwd),
|
|
175
176
|
]);
|
|
176
177
|
const branchMeta = new Map();
|
|
177
178
|
for (const ref of localRefs) {
|
|
@@ -218,6 +219,7 @@ export async function listBranchSuggestions(cwd, options) {
|
|
|
218
219
|
const meta = branchMeta.get(name);
|
|
219
220
|
const suggestion = {
|
|
220
221
|
name,
|
|
222
|
+
isDefault: name === normalizeBranchSuggestionName(defaultBranch ?? ""),
|
|
221
223
|
committerDate: meta?.committerDate ?? 0,
|
|
222
224
|
hasLocal: meta?.hasLocal ?? false,
|
|
223
225
|
hasRemote: meta?.hasRemote ?? false,
|
|
@@ -250,31 +252,38 @@ export async function listBranchSuggestions(cwd, options) {
|
|
|
250
252
|
return suggestion;
|
|
251
253
|
}));
|
|
252
254
|
}
|
|
255
|
+
export var BranchCheckoutKind;
|
|
256
|
+
(function (BranchCheckoutKind) {
|
|
257
|
+
BranchCheckoutKind["Remote"] = "remote";
|
|
258
|
+
})(BranchCheckoutKind || (BranchCheckoutKind = {}));
|
|
253
259
|
export async function resolveBranchCheckout(cwd, name) {
|
|
254
260
|
await requireGitRepo(cwd);
|
|
255
|
-
const
|
|
261
|
+
const requestedRef = name.trim();
|
|
262
|
+
const isExplicitRemote = requestedRef.startsWith("refs/remotes/") || requestedRef.startsWith("origin/");
|
|
263
|
+
if (isExplicitRemote) {
|
|
264
|
+
const remoteRef = requestedRef.startsWith("refs/remotes/")
|
|
265
|
+
? requestedRef
|
|
266
|
+
: `refs/remotes/${requestedRef}`;
|
|
267
|
+
if (await doesGitRefExist(cwd, remoteRef)) {
|
|
268
|
+
return { kind: BranchCheckoutKind.Remote, remoteRef };
|
|
269
|
+
}
|
|
270
|
+
return { kind: "not-found" };
|
|
271
|
+
}
|
|
272
|
+
const isExplicitLocal = requestedRef.startsWith("refs/heads/");
|
|
273
|
+
const normalized = isExplicitLocal
|
|
274
|
+
? requestedRef.slice("refs/heads/".length)
|
|
275
|
+
: normalizeBranchSuggestionName(requestedRef);
|
|
256
276
|
if (!normalized) {
|
|
257
277
|
return { kind: "not-found" };
|
|
258
278
|
}
|
|
259
|
-
|
|
260
|
-
const localResult = await runGitCommand(["rev-parse", "--verify", "--quiet", localRef], {
|
|
261
|
-
cwd,
|
|
262
|
-
envOverlay: READ_ONLY_GIT_ENV,
|
|
263
|
-
acceptExitCodes: [0, 1],
|
|
264
|
-
});
|
|
265
|
-
const hasLocal = localResult.exitCode === 0;
|
|
266
|
-
if (hasLocal) {
|
|
279
|
+
if (await doesGitRefExist(cwd, `refs/heads/${normalized}`)) {
|
|
267
280
|
return { kind: "local", name: normalized };
|
|
268
281
|
}
|
|
282
|
+
if (isExplicitLocal) {
|
|
283
|
+
return { kind: "not-found" };
|
|
284
|
+
}
|
|
269
285
|
const remoteRef = `origin/${normalized}`;
|
|
270
|
-
|
|
271
|
-
const remoteResult = await runGitCommand(["rev-parse", "--verify", "--quiet", remoteRefPath], {
|
|
272
|
-
cwd,
|
|
273
|
-
envOverlay: READ_ONLY_GIT_ENV,
|
|
274
|
-
acceptExitCodes: [0, 1],
|
|
275
|
-
});
|
|
276
|
-
const hasRemote = remoteResult.exitCode === 0;
|
|
277
|
-
if (hasRemote) {
|
|
286
|
+
if (await doesGitRefExist(cwd, `refs/remotes/${remoteRef}`)) {
|
|
278
287
|
return { kind: "remote-only", name: normalized, remoteRef };
|
|
279
288
|
}
|
|
280
289
|
return { kind: "not-found" };
|
|
@@ -282,6 +291,9 @@ export async function resolveBranchCheckout(cwd, name) {
|
|
|
282
291
|
export async function checkoutResolvedBranch(input) {
|
|
283
292
|
const { cwd, resolution } = input;
|
|
284
293
|
switch (resolution.kind) {
|
|
294
|
+
case BranchCheckoutKind.Remote:
|
|
295
|
+
await runGitCommand(["checkout", "--detach", resolution.remoteRef], { cwd });
|
|
296
|
+
return { source: "remote" };
|
|
285
297
|
case "local": {
|
|
286
298
|
const { stdout } = await runGitCommand(["rev-parse", "--abbrev-ref", "HEAD"], { cwd });
|
|
287
299
|
const current = stdout.trim();
|