@spencerboucher/switchyard 0.15.0 → 0.17.0
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/README.md +1 -1
- package/dist/policies/worker.js +31 -1
- package/dist/switchyard.mjs +247 -28
- package/package.json +1 -1
- package/web-dist/assets/AutomationView-BMQuTl3j.js +2 -0
- package/web-dist/assets/{AutomationView-CMDz-eFh.js.map → AutomationView-BMQuTl3j.js.map} +1 -1
- package/web-dist/assets/InteractionCard-CdBv3Sm7.js +4 -0
- package/web-dist/assets/{InteractionCard-Bhur-sU9.js.map → InteractionCard-CdBv3Sm7.js.map} +1 -1
- package/web-dist/assets/{Overlay-zQBNtPf6.js → Overlay-Cv0SIpoa.js} +2 -2
- package/web-dist/assets/{Overlay-zQBNtPf6.js.map → Overlay-Cv0SIpoa.js.map} +1 -1
- package/web-dist/assets/{Priority-CgO3ns6b.js → Priority-aNWh1i4H.js} +2 -2
- package/web-dist/assets/{Priority-CgO3ns6b.js.map → Priority-aNWh1i4H.js.map} +1 -1
- package/web-dist/assets/Select-Dv-F-HZR.js +2 -0
- package/web-dist/assets/{Select-CpWLZnId.js.map → Select-Dv-F-HZR.js.map} +1 -1
- package/web-dist/assets/{Tabs-DZ2T9VBY.js → Tabs-DPj-rKor.js} +5 -5
- package/web-dist/assets/{Tabs-DZ2T9VBY.js.map → Tabs-DPj-rKor.js.map} +1 -1
- package/web-dist/assets/{UINodeRenderer-JQy6g7ZB.js → UINodeRenderer-GbSP56mL.js} +2 -2
- package/web-dist/assets/{UINodeRenderer-JQy6g7ZB.js.map → UINodeRenderer-GbSP56mL.js.map} +1 -1
- package/web-dist/assets/ViewSelect-DTXqcHvg.js +2 -0
- package/web-dist/assets/ViewSelect-DTXqcHvg.js.map +1 -0
- package/web-dist/assets/attention-eEYmUIPZ.js +2 -0
- package/web-dist/assets/{attention-DrHtkJHs.js.map → attention-eEYmUIPZ.js.map} +1 -1
- package/web-dist/assets/auth-e3n8h2VO.js +2 -0
- package/web-dist/assets/auth-e3n8h2VO.js.map +1 -0
- package/web-dist/assets/automations-DQMWPvqT.js +2 -0
- package/web-dist/assets/{automations-TOhPm8sF.js.map → automations-DQMWPvqT.js.map} +1 -1
- package/web-dist/assets/board-CxPUJBjR.js +10 -0
- package/web-dist/assets/board-CxPUJBjR.js.map +1 -0
- package/web-dist/assets/code-BfD33VCt.js +25 -0
- package/web-dist/assets/code-BfD33VCt.js.map +1 -0
- package/web-dist/assets/{describe-CtmmeUfI.js → describe-ype6dIHS.js} +2 -2
- package/web-dist/assets/{describe-CtmmeUfI.js.map → describe-ype6dIHS.js.map} +1 -1
- package/web-dist/assets/enroll-BTNVVoWB.js +2 -0
- package/web-dist/assets/{enroll-C4m0rxHw.js.map → enroll-BTNVVoWB.js.map} +1 -1
- package/web-dist/assets/index-BE-Sxt6h.css +2 -0
- package/web-dist/assets/index-xw7YOYjs.js +23 -0
- package/web-dist/assets/index-xw7YOYjs.js.map +1 -0
- package/web-dist/assets/more-AZ4rHFG5.js +2 -0
- package/web-dist/assets/{more-BonXabXm.js.map → more-AZ4rHFG5.js.map} +1 -1
- package/web-dist/assets/{policyLogic-nqL3E08V.js → policyLogic-AZSVROoe.js} +2 -2
- package/web-dist/assets/{policyLogic-nqL3E08V.js.map → policyLogic-AZSVROoe.js.map} +1 -1
- package/web-dist/assets/{queue-p_rnOc-9.js → queue-LyV9HFK4.js} +2 -2
- package/web-dist/assets/{queue-p_rnOc-9.js.map → queue-LyV9HFK4.js.map} +1 -1
- package/web-dist/assets/{repo-3GZtN4L8.js → repo-CRmEGTNk.js} +2 -2
- package/web-dist/assets/{repo-3GZtN4L8.js.map → repo-CRmEGTNk.js.map} +1 -1
- package/web-dist/assets/selection-BgO3-HZn.js +2 -0
- package/web-dist/assets/selection-BgO3-HZn.js.map +1 -0
- package/web-dist/assets/settings-CK-9B48D.js +12 -0
- package/web-dist/assets/settings-CK-9B48D.js.map +1 -0
- package/web-dist/assets/states-D7g0-4EY.js +58 -0
- package/web-dist/assets/states-D7g0-4EY.js.map +1 -0
- package/web-dist/assets/terminal-login-B20sSCfk.js +2 -0
- package/web-dist/assets/{terminal-login-j20zSRZp.js.map → terminal-login-B20sSCfk.js.map} +1 -1
- package/web-dist/assets/useNow-DvXAU3dJ.js +2 -0
- package/web-dist/assets/useNow-DvXAU3dJ.js.map +1 -0
- package/web-dist/assets/{useResource-DhvWL_9X.js → useResource-CFaJYaSY.js} +2 -2
- package/web-dist/assets/{useResource-DhvWL_9X.js.map → useResource-CFaJYaSY.js.map} +1 -1
- package/web-dist/index.html +5 -10
- package/web-dist/sw.js +1 -1
- package/web-dist/sw.js.map +1 -1
- package/web-dist/assets/AutomationView-CMDz-eFh.js +0 -2
- package/web-dist/assets/InteractionCard-Bhur-sU9.js +0 -4
- package/web-dist/assets/Menu-dT22Gwzm.js +0 -2
- package/web-dist/assets/Menu-dT22Gwzm.js.map +0 -1
- package/web-dist/assets/Select-CpWLZnId.js +0 -2
- package/web-dist/assets/TextArea-BQPdfjO_.js +0 -2
- package/web-dist/assets/TextArea-BQPdfjO_.js.map +0 -1
- package/web-dist/assets/attention-DrHtkJHs.js +0 -2
- package/web-dist/assets/automations-TOhPm8sF.js +0 -2
- package/web-dist/assets/board-BZWPMk0Z.js +0 -10
- package/web-dist/assets/board-BZWPMk0Z.js.map +0 -1
- package/web-dist/assets/code-DVA5CKfS.js +0 -25
- package/web-dist/assets/code-DVA5CKfS.js.map +0 -1
- package/web-dist/assets/drafts-BP2GMlHS.js +0 -13
- package/web-dist/assets/drafts-BP2GMlHS.js.map +0 -1
- package/web-dist/assets/enroll-C4m0rxHw.js +0 -2
- package/web-dist/assets/index-LsagdEq-.js +0 -11
- package/web-dist/assets/index-LsagdEq-.js.map +0 -1
- package/web-dist/assets/index-f4tQ91xN.css +0 -2
- package/web-dist/assets/key-round-DIA3lje5.js +0 -2
- package/web-dist/assets/key-round-DIA3lje5.js.map +0 -1
- package/web-dist/assets/more-BonXabXm.js +0 -2
- package/web-dist/assets/pencil-BtK08_f_.js +0 -2
- package/web-dist/assets/pencil-BtK08_f_.js.map +0 -1
- package/web-dist/assets/preload-helper-DOFsWE7_.js +0 -3
- package/web-dist/assets/preload-helper-DOFsWE7_.js.map +0 -1
- package/web-dist/assets/presence-BnGwJNSq.js +0 -2
- package/web-dist/assets/presence-BnGwJNSq.js.map +0 -1
- package/web-dist/assets/registry-D8Ph1G2W.js +0 -2
- package/web-dist/assets/registry-D8Ph1G2W.js.map +0 -1
- package/web-dist/assets/settings-jyGW1LsI.js +0 -9
- package/web-dist/assets/settings-jyGW1LsI.js.map +0 -1
- package/web-dist/assets/states-BXOts8eT.js +0 -58
- package/web-dist/assets/states-BXOts8eT.js.map +0 -1
- package/web-dist/assets/terminal-login-j20zSRZp.js +0 -2
- package/web-dist/assets/useNow-DfER3XvS.js +0 -2
- package/web-dist/assets/useNow-DfER3XvS.js.map +0 -1
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ switchyard up
|
|
|
118
118
|
```sh
|
|
119
119
|
docker run -d --name switchyard -p 127.0.0.1:7400:7400 -v switchyard-data:/data \
|
|
120
120
|
-e SWITCHYARD_PUBLIC_URL=https://switchyard.example.com \
|
|
121
|
-
ghcr.io/justmytwospence/switchyard:0.
|
|
121
|
+
ghcr.io/justmytwospence/switchyard:0.17.0
|
|
122
122
|
# Single sign-on is required off localhost: see docs/auth.md
|
|
123
123
|
```
|
|
124
124
|
|
package/dist/policies/worker.js
CHANGED
|
@@ -927,6 +927,8 @@ var Tracker = z6.object({
|
|
|
927
927
|
hostId: Id4,
|
|
928
928
|
owner: GitHubLogin,
|
|
929
929
|
repositories: z6.array(GitHubRepository).min(1).max(50).nullable(),
|
|
930
|
+
/** Repositories outside `owner` that belong to this tracker too (never limited by `repositories`). */
|
|
931
|
+
extraRepositories: z6.array(GitHubRepository).max(20).optional(),
|
|
930
932
|
board: TrackerBoard.nullable(),
|
|
931
933
|
writeBack: z6.boolean(),
|
|
932
934
|
moveShared: z6.boolean(),
|
|
@@ -943,6 +945,7 @@ var TrackerInput = z6.object({
|
|
|
943
945
|
hostId: Id4,
|
|
944
946
|
owner: GitHubLogin,
|
|
945
947
|
repositories: Tracker.shape.repositories.default(null),
|
|
948
|
+
extraRepositories: z6.array(GitHubRepository).max(20).default([]),
|
|
946
949
|
board: TrackerBoard.nullable().default(null),
|
|
947
950
|
writeBack: z6.boolean().default(false),
|
|
948
951
|
moveShared: z6.boolean().default(true),
|
|
@@ -953,6 +956,7 @@ var TrackerPatch = z6.object({
|
|
|
953
956
|
hostId: Id4.optional(),
|
|
954
957
|
owner: GitHubLogin.optional(),
|
|
955
958
|
repositories: Tracker.shape.repositories.optional(),
|
|
959
|
+
extraRepositories: z6.array(GitHubRepository).max(20).optional(),
|
|
956
960
|
board: TrackerBoard.nullable().optional(),
|
|
957
961
|
writeBack: z6.boolean().optional(),
|
|
958
962
|
moveShared: z6.boolean().optional(),
|
|
@@ -2139,6 +2143,7 @@ var TermCoordinatorMsg = z12.discriminatedUnion("t", [
|
|
|
2139
2143
|
|
|
2140
2144
|
// packages/protocol/dist/host-wire.js
|
|
2141
2145
|
var Origin = z13.enum(["human", "automation"]);
|
|
2146
|
+
var DiffRev = z13.string().regex(/^(uncommitted|[0-9a-f]{40})$/);
|
|
2142
2147
|
var HostCommand = z13.discriminatedUnion("type", [
|
|
2143
2148
|
z13.object({
|
|
2144
2149
|
type: z13.literal("session.start"),
|
|
@@ -2281,7 +2286,15 @@ var HostCommand = z13.discriminatedUnion("type", [
|
|
|
2281
2286
|
type: z13.literal("workspace.diff"),
|
|
2282
2287
|
path: z13.string(),
|
|
2283
2288
|
base: z13.string().nullable(),
|
|
2284
|
-
file: z13.string().nullable()
|
|
2289
|
+
file: z13.string().nullable(),
|
|
2290
|
+
/** Hosts without gitLog.v1 never receive it. */
|
|
2291
|
+
rev: DiffRev.optional()
|
|
2292
|
+
}),
|
|
2293
|
+
z13.object({
|
|
2294
|
+
type: z13.literal("workspace.log"),
|
|
2295
|
+
path: z13.string(),
|
|
2296
|
+
base: z13.string().nullable(),
|
|
2297
|
+
limit: z13.number().int().min(1).max(200)
|
|
2285
2298
|
}),
|
|
2286
2299
|
z13.object({ type: z13.literal("workspace.files"), path: z13.string(), dir: z13.string() }),
|
|
2287
2300
|
z13.object({ type: z13.literal("workspace.readFile"), path: z13.string(), file: z13.string() }),
|
|
@@ -2365,6 +2378,23 @@ var ProjectSuggestion = z13.object({
|
|
|
2365
2378
|
lastActivityAt: z13.string()
|
|
2366
2379
|
});
|
|
2367
2380
|
var ProjectSuggestions = z13.object({ suggestions: z13.array(ProjectSuggestion) });
|
|
2381
|
+
var GitCommit = z13.object({
|
|
2382
|
+
sha: z13.string().regex(/^[0-9a-f]{40}$/),
|
|
2383
|
+
subject: z13.string().max(300),
|
|
2384
|
+
author: z13.string().max(200),
|
|
2385
|
+
authoredAt: z13.string(),
|
|
2386
|
+
pushed: z13.boolean()
|
|
2387
|
+
});
|
|
2388
|
+
var LogResult = z13.object({
|
|
2389
|
+
/** The base branch the commits are counted from. */
|
|
2390
|
+
base: z13.string(),
|
|
2391
|
+
/** `branch`: commits since the merge base; `recent`: HEAD's latest commits (no commits of its own). */
|
|
2392
|
+
scope: z13.enum(["branch", "recent"]),
|
|
2393
|
+
commits: z13.array(GitCommit).max(200),
|
|
2394
|
+
truncated: z13.boolean(),
|
|
2395
|
+
/** Changed and untracked files not committed yet. */
|
|
2396
|
+
uncommitted: z13.number().int().min(0)
|
|
2397
|
+
});
|
|
2368
2398
|
var DiffFile = z13.object({
|
|
2369
2399
|
path: z13.string(),
|
|
2370
2400
|
oldPath: z13.string().nullable(),
|
package/dist/switchyard.mjs
CHANGED
|
@@ -997,6 +997,8 @@ var Tracker = z6.object({
|
|
|
997
997
|
hostId: Id4,
|
|
998
998
|
owner: GitHubLogin,
|
|
999
999
|
repositories: z6.array(GitHubRepository).min(1).max(50).nullable(),
|
|
1000
|
+
/** Repositories outside `owner` that belong to this tracker too (never limited by `repositories`). */
|
|
1001
|
+
extraRepositories: z6.array(GitHubRepository).max(20).optional(),
|
|
1000
1002
|
board: TrackerBoard.nullable(),
|
|
1001
1003
|
writeBack: z6.boolean(),
|
|
1002
1004
|
moveShared: z6.boolean(),
|
|
@@ -1013,6 +1015,7 @@ var TrackerInput = z6.object({
|
|
|
1013
1015
|
hostId: Id4,
|
|
1014
1016
|
owner: GitHubLogin,
|
|
1015
1017
|
repositories: Tracker.shape.repositories.default(null),
|
|
1018
|
+
extraRepositories: z6.array(GitHubRepository).max(20).default([]),
|
|
1016
1019
|
board: TrackerBoard.nullable().default(null),
|
|
1017
1020
|
writeBack: z6.boolean().default(false),
|
|
1018
1021
|
moveShared: z6.boolean().default(true),
|
|
@@ -1023,6 +1026,7 @@ var TrackerPatch = z6.object({
|
|
|
1023
1026
|
hostId: Id4.optional(),
|
|
1024
1027
|
owner: GitHubLogin.optional(),
|
|
1025
1028
|
repositories: Tracker.shape.repositories.optional(),
|
|
1029
|
+
extraRepositories: z6.array(GitHubRepository).max(20).optional(),
|
|
1026
1030
|
board: TrackerBoard.nullable().optional(),
|
|
1027
1031
|
writeBack: z6.boolean().optional(),
|
|
1028
1032
|
moveShared: z6.boolean().optional(),
|
|
@@ -2217,6 +2221,8 @@ var TermCoordinatorMsg = z12.discriminatedUnion("t", [
|
|
|
2217
2221
|
|
|
2218
2222
|
// packages/protocol/dist/host-wire.js
|
|
2219
2223
|
var Origin = z13.enum(["human", "automation"]);
|
|
2224
|
+
var GIT_LOG_FEATURE = "gitLog.v1";
|
|
2225
|
+
var DiffRev = z13.string().regex(/^(uncommitted|[0-9a-f]{40})$/);
|
|
2220
2226
|
var HostCommand = z13.discriminatedUnion("type", [
|
|
2221
2227
|
z13.object({
|
|
2222
2228
|
type: z13.literal("session.start"),
|
|
@@ -2359,7 +2365,15 @@ var HostCommand = z13.discriminatedUnion("type", [
|
|
|
2359
2365
|
type: z13.literal("workspace.diff"),
|
|
2360
2366
|
path: z13.string(),
|
|
2361
2367
|
base: z13.string().nullable(),
|
|
2362
|
-
file: z13.string().nullable()
|
|
2368
|
+
file: z13.string().nullable(),
|
|
2369
|
+
/** Hosts without gitLog.v1 never receive it. */
|
|
2370
|
+
rev: DiffRev.optional()
|
|
2371
|
+
}),
|
|
2372
|
+
z13.object({
|
|
2373
|
+
type: z13.literal("workspace.log"),
|
|
2374
|
+
path: z13.string(),
|
|
2375
|
+
base: z13.string().nullable(),
|
|
2376
|
+
limit: z13.number().int().min(1).max(200)
|
|
2363
2377
|
}),
|
|
2364
2378
|
z13.object({ type: z13.literal("workspace.files"), path: z13.string(), dir: z13.string() }),
|
|
2365
2379
|
z13.object({ type: z13.literal("workspace.readFile"), path: z13.string(), file: z13.string() }),
|
|
@@ -2443,6 +2457,23 @@ var ProjectSuggestion = z13.object({
|
|
|
2443
2457
|
lastActivityAt: z13.string()
|
|
2444
2458
|
});
|
|
2445
2459
|
var ProjectSuggestions = z13.object({ suggestions: z13.array(ProjectSuggestion) });
|
|
2460
|
+
var GitCommit = z13.object({
|
|
2461
|
+
sha: z13.string().regex(/^[0-9a-f]{40}$/),
|
|
2462
|
+
subject: z13.string().max(300),
|
|
2463
|
+
author: z13.string().max(200),
|
|
2464
|
+
authoredAt: z13.string(),
|
|
2465
|
+
pushed: z13.boolean()
|
|
2466
|
+
});
|
|
2467
|
+
var LogResult = z13.object({
|
|
2468
|
+
/** The base branch the commits are counted from. */
|
|
2469
|
+
base: z13.string(),
|
|
2470
|
+
/** `branch`: commits since the merge base; `recent`: HEAD's latest commits (no commits of its own). */
|
|
2471
|
+
scope: z13.enum(["branch", "recent"]),
|
|
2472
|
+
commits: z13.array(GitCommit).max(200),
|
|
2473
|
+
truncated: z13.boolean(),
|
|
2474
|
+
/** Changed and untracked files not committed yet. */
|
|
2475
|
+
uncommitted: z13.number().int().min(0)
|
|
2476
|
+
});
|
|
2446
2477
|
var DiffFile = z13.object({
|
|
2447
2478
|
path: z13.string(),
|
|
2448
2479
|
oldPath: z13.string().nullable(),
|
|
@@ -6817,6 +6848,22 @@ function recordCreatedWorkspace(ctx, project, checkout, info) {
|
|
|
6817
6848
|
return ctx.store.putWorkspace(ws);
|
|
6818
6849
|
});
|
|
6819
6850
|
}
|
|
6851
|
+
function rehomeSessions(ctx, checkout, active) {
|
|
6852
|
+
const under = (s) => active.filter((w) => s.cwd === w.path || s.cwd.startsWith(`${w.path}/`)).sort((a, b) => b.path.length - a.path.length)[0];
|
|
6853
|
+
for (const s of ctx.store.sessions.list("host_id = ? AND archived_at IS NULL", [
|
|
6854
|
+
checkout.hostId
|
|
6855
|
+
])) {
|
|
6856
|
+
if (s.provenance !== "imported" || s.runId || s.taskId || !s.cwd)
|
|
6857
|
+
continue;
|
|
6858
|
+
const local = under(s);
|
|
6859
|
+
if (!local || local.id === s.workspaceId)
|
|
6860
|
+
continue;
|
|
6861
|
+
const ws = ctx.store.workspaceContaining(checkout.hostId, s.cwd);
|
|
6862
|
+
if (!ws || ws.id === s.workspaceId)
|
|
6863
|
+
continue;
|
|
6864
|
+
ctx.store.putSession({ ...s, workspaceId: ws.id, projectId: ws.projectId });
|
|
6865
|
+
}
|
|
6866
|
+
}
|
|
6820
6867
|
async function refreshCheckoutWorkspaces(ctx, checkout) {
|
|
6821
6868
|
const raw = await ctx.hostHub.request(checkout.hostId, {
|
|
6822
6869
|
type: "workspace.discover",
|
|
@@ -6857,6 +6904,7 @@ async function refreshCheckoutWorkspaces(ctx, checkout) {
|
|
|
6857
6904
|
if (!seen.has(ws.path))
|
|
6858
6905
|
ctx.store.putWorkspace({ ...ws, archivedAt: now, updatedAt: now });
|
|
6859
6906
|
}
|
|
6907
|
+
rehomeSessions(ctx, checkout, out);
|
|
6860
6908
|
return out;
|
|
6861
6909
|
});
|
|
6862
6910
|
}
|
|
@@ -12241,12 +12289,32 @@ function projectForRepository(projects, repository) {
|
|
|
12241
12289
|
}
|
|
12242
12290
|
function inScope(tracker, project) {
|
|
12243
12291
|
const identity2 = project.repoIdentity.toLowerCase();
|
|
12292
|
+
if ((tracker.extraRepositories ?? []).some((r) => identity2 === `${GITHUB}${r}`.toLowerCase())) {
|
|
12293
|
+
return true;
|
|
12294
|
+
}
|
|
12244
12295
|
if (!identity2.startsWith(`${GITHUB}${tracker.owner.toLowerCase()}/`))
|
|
12245
12296
|
return false;
|
|
12246
12297
|
if (!tracker.repositories)
|
|
12247
12298
|
return true;
|
|
12248
12299
|
return tracker.repositories.some((r) => identity2 === `${GITHUB}${r}`.toLowerCase());
|
|
12249
12300
|
}
|
|
12301
|
+
function mergeSyncResults(parts) {
|
|
12302
|
+
const seen = /* @__PURE__ */ new Set();
|
|
12303
|
+
const items = [];
|
|
12304
|
+
for (const p of parts) {
|
|
12305
|
+
for (const i of p.items) {
|
|
12306
|
+
if (seen.has(i.itemId))
|
|
12307
|
+
continue;
|
|
12308
|
+
seen.add(i.itemId);
|
|
12309
|
+
items.push(i);
|
|
12310
|
+
}
|
|
12311
|
+
}
|
|
12312
|
+
return {
|
|
12313
|
+
login: parts[0]?.login ?? "",
|
|
12314
|
+
items: items.slice(0, 200),
|
|
12315
|
+
truncated: parts.some((p) => p.truncated) || items.length > 200
|
|
12316
|
+
};
|
|
12317
|
+
}
|
|
12250
12318
|
function issueBranch(number, title) {
|
|
12251
12319
|
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40).replace(/-+$/g, "");
|
|
12252
12320
|
return slug ? `${number}-${slug}` : String(number);
|
|
@@ -12318,15 +12386,17 @@ var TrackerService = class {
|
|
|
12318
12386
|
lastError: `Host ${this.hostName(tracker.hostId)} is offline`
|
|
12319
12387
|
});
|
|
12320
12388
|
}
|
|
12389
|
+
const board = tracker.board ? { projectNumber: tracker.board.projectNumber, statusField: tracker.board.statusField } : null;
|
|
12390
|
+
const extra = tracker.extraRepositories ?? [];
|
|
12391
|
+
const scopes = [tracker.repositories, ...extra.length ? [extra] : []];
|
|
12321
12392
|
let result2;
|
|
12322
12393
|
try {
|
|
12323
|
-
const
|
|
12324
|
-
|
|
12325
|
-
owner: tracker.owner,
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
result2 = TrackerSyncResult.parse(raw);
|
|
12394
|
+
const parts = [];
|
|
12395
|
+
for (const repositories of scopes) {
|
|
12396
|
+
const raw = await hostHub.request(tracker.hostId, { type: "tracker.sync", owner: tracker.owner, repositories, board }, { timeoutMs: SYNC_TIMEOUT_MS });
|
|
12397
|
+
parts.push(TrackerSyncResult.parse(raw));
|
|
12398
|
+
}
|
|
12399
|
+
result2 = mergeSyncResults(parts);
|
|
12330
12400
|
} catch (err) {
|
|
12331
12401
|
return this.save(trackerId, { lastError: this.hostError(tracker, err) });
|
|
12332
12402
|
}
|
|
@@ -12378,9 +12448,10 @@ var TrackerService = class {
|
|
|
12378
12448
|
this.syncView(store.trackers.require(trackerId), projects);
|
|
12379
12449
|
});
|
|
12380
12450
|
const current = { ...tracker, login: result2.login };
|
|
12451
|
+
const refreshed = /* @__PURE__ */ new Set();
|
|
12381
12452
|
for (const m of matched) {
|
|
12382
12453
|
try {
|
|
12383
|
-
await this.linkWorkspace(current, m.item, m.project, m.taskId);
|
|
12454
|
+
await this.linkWorkspace(current, m.item, m.project, m.taskId, refreshed);
|
|
12384
12455
|
} catch (err) {
|
|
12385
12456
|
errors.push(err instanceof Error ? err.message : String(err));
|
|
12386
12457
|
}
|
|
@@ -12428,7 +12499,7 @@ var TrackerService = class {
|
|
|
12428
12499
|
store.putView({ ...view, trackerId: tracker.id, projectIds, updatedAt: now });
|
|
12429
12500
|
}
|
|
12430
12501
|
/** Create (once) and link the worktree for an issue's branch. */
|
|
12431
|
-
async linkWorkspace(tracker, item, project, taskId) {
|
|
12502
|
+
async linkWorkspace(tracker, item, project, taskId, refreshed) {
|
|
12432
12503
|
const { store, hostHub } = this.ctx;
|
|
12433
12504
|
const branch = item.branches[0];
|
|
12434
12505
|
if (!branch || item.pullRequest?.state === "MERGED")
|
|
@@ -12438,10 +12509,21 @@ var TrackerService = class {
|
|
|
12438
12509
|
return;
|
|
12439
12510
|
const find = () => store.workspaces.list("checkout_id = ? AND archived_at IS NULL", [checkout.id]).find((w) => w.branch !== null && item.branches.includes(w.branch));
|
|
12440
12511
|
let ws = find();
|
|
12512
|
+
const key = `trackerBranchTried:${taskId}:${branch}`;
|
|
12441
12513
|
if (!ws) {
|
|
12442
|
-
const key = `trackerBranchTried:${taskId}:${branch}`;
|
|
12443
12514
|
if (store.getSetting(key, null) !== null)
|
|
12444
12515
|
return;
|
|
12516
|
+
if (!refreshed.has(checkout.id)) {
|
|
12517
|
+
refreshed.add(checkout.id);
|
|
12518
|
+
try {
|
|
12519
|
+
await refreshCheckoutWorkspaces(this.ctx, checkout);
|
|
12520
|
+
} catch (err) {
|
|
12521
|
+
this.ctx.log.debug({ err, checkoutId: checkout.id }, "tracker: workspace discovery failed");
|
|
12522
|
+
}
|
|
12523
|
+
ws = find();
|
|
12524
|
+
}
|
|
12525
|
+
}
|
|
12526
|
+
if (!ws) {
|
|
12445
12527
|
store.setSetting(key, store.nowIso());
|
|
12446
12528
|
await hostHub.request(tracker.hostId, { type: "tracker.prepareBranch", checkoutPath: checkout.path, branch }, { timeoutMs: 6e4 });
|
|
12447
12529
|
ws = await createWorkspace(this.ctx, project, checkout, branch, null);
|
|
@@ -12576,21 +12658,54 @@ var WorkspaceLifecycleService = class {
|
|
|
12576
12658
|
opts;
|
|
12577
12659
|
timer = null;
|
|
12578
12660
|
running = false;
|
|
12661
|
+
/** `${sessionId}\n${cwd}` already checked for an unknown worktree (per process). */
|
|
12662
|
+
checked = /* @__PURE__ */ new Set();
|
|
12663
|
+
/** Checkouts with a rescan in flight. */
|
|
12664
|
+
rescanning = /* @__PURE__ */ new Set();
|
|
12665
|
+
onEvent = (ev) => {
|
|
12666
|
+
if (ev.type === "session.updated")
|
|
12667
|
+
this.noteSession(ev.data);
|
|
12668
|
+
};
|
|
12579
12669
|
constructor(ctx, opts) {
|
|
12580
12670
|
this.ctx = ctx;
|
|
12581
12671
|
this.opts = opts;
|
|
12582
12672
|
}
|
|
12583
12673
|
start() {
|
|
12674
|
+
this.ctx.hub.on("event", this.onEvent);
|
|
12584
12675
|
if (this.opts.tickMs <= 0)
|
|
12585
12676
|
return;
|
|
12586
12677
|
this.timer = setInterval(() => void this.tick(), this.opts.tickMs);
|
|
12587
12678
|
this.timer.unref();
|
|
12588
12679
|
}
|
|
12589
12680
|
stop() {
|
|
12681
|
+
this.ctx.hub.off("event", this.onEvent);
|
|
12590
12682
|
if (this.timer)
|
|
12591
12683
|
clearInterval(this.timer);
|
|
12592
12684
|
this.timer = null;
|
|
12593
12685
|
}
|
|
12686
|
+
/** A hand-started session below the main checkout, in a folder that is no known worktree: rescan once. */
|
|
12687
|
+
noteSession(s) {
|
|
12688
|
+
const { store, hostHub } = this.ctx;
|
|
12689
|
+
if (s?.archivedAt !== null || s.provenance !== "imported" || !s.cwd || !s.workspaceId)
|
|
12690
|
+
return;
|
|
12691
|
+
const ws = store.workspaces.get(s.workspaceId);
|
|
12692
|
+
if (!ws || ws.archivedAt || ws.provenance !== "main" || s.cwd === ws.path)
|
|
12693
|
+
return;
|
|
12694
|
+
const key = `${s.id}
|
|
12695
|
+
${s.cwd}`;
|
|
12696
|
+
if (this.checked.has(key))
|
|
12697
|
+
return;
|
|
12698
|
+
const checkout = store.checkouts.get(ws.checkoutId);
|
|
12699
|
+
if (!checkout || !hostHub.isConnected(checkout.hostId) || this.rescanning.has(checkout.id)) {
|
|
12700
|
+
return;
|
|
12701
|
+
}
|
|
12702
|
+
this.checked.add(key);
|
|
12703
|
+
this.rescanning.add(checkout.id);
|
|
12704
|
+
void refreshCheckoutWorkspaces(this.ctx, checkout).catch((err) => {
|
|
12705
|
+
this.checked.delete(key);
|
|
12706
|
+
this.ctx.log.warn({ err, checkoutId: checkout.id }, "workspace discovery failed");
|
|
12707
|
+
}).finally(() => this.rescanning.delete(checkout.id));
|
|
12708
|
+
}
|
|
12594
12709
|
async tick(now = this.ctx.store.now().getTime()) {
|
|
12595
12710
|
if (this.running)
|
|
12596
12711
|
return;
|
|
@@ -12713,6 +12828,7 @@ function installBuiltins(app, ctx, opts = {}) {
|
|
|
12713
12828
|
const lifetime = new AbortController();
|
|
12714
12829
|
const policies = new PolicyService({
|
|
12715
12830
|
store: ctx.store,
|
|
12831
|
+
evaluator: opts.policyEvaluator,
|
|
12716
12832
|
get publicUrl() {
|
|
12717
12833
|
return ctx.config.publicUrl;
|
|
12718
12834
|
},
|
|
@@ -14088,6 +14204,10 @@ var HostHub = class {
|
|
|
14088
14204
|
if (command.type === "session.deliverMessage" || command.type === "session.messageStatus") {
|
|
14089
14205
|
return conn.features.has("agentRequests.v1");
|
|
14090
14206
|
}
|
|
14207
|
+
if (command.type === "workspace.log")
|
|
14208
|
+
return conn.gitLog;
|
|
14209
|
+
if (command.type === "workspace.diff" && command.rev !== void 0)
|
|
14210
|
+
return conn.gitLog;
|
|
14091
14211
|
if (command.type.startsWith("tracker."))
|
|
14092
14212
|
return conn.trackers;
|
|
14093
14213
|
if ((command.type === "session.start" || command.type === "dispatch.start") && command.policyRequired !== void 0) {
|
|
@@ -14230,7 +14350,8 @@ var HostHub = class {
|
|
|
14230
14350
|
alive: true,
|
|
14231
14351
|
features,
|
|
14232
14352
|
github: hello.github !== void 0,
|
|
14233
|
-
trackers: hello.features?.includes(TRACKERS_FEATURE) === true
|
|
14353
|
+
trackers: hello.features?.includes(TRACKERS_FEATURE) === true,
|
|
14354
|
+
gitLog: hello.features?.includes(GIT_LOG_FEATURE) === true
|
|
14234
14355
|
});
|
|
14235
14356
|
if (old && old.socket !== socket)
|
|
14236
14357
|
old.socket.close(4e3, "replaced by a newer connection");
|
|
@@ -16772,7 +16893,8 @@ var ListQuery6 = z29.object({
|
|
|
16772
16893
|
projectId: z29.string().optional(),
|
|
16773
16894
|
includeArchived: z29.enum(["true", "false"]).optional()
|
|
16774
16895
|
});
|
|
16775
|
-
var DiffQuery = z29.object({ file: z29.string().optional() });
|
|
16896
|
+
var DiffQuery = z29.object({ file: z29.string().optional(), rev: DiffRev.optional() });
|
|
16897
|
+
var CommitsQuery = z29.object({ limit: z29.coerce.number().int().min(1).max(200).default(50) });
|
|
16776
16898
|
var FilesQuery = z29.object({ dir: z29.string().default("") });
|
|
16777
16899
|
var FileQuery = z29.object({ path: z29.string().min(1) });
|
|
16778
16900
|
function registerWorkspaceRoutes(app, ctx) {
|
|
@@ -16815,7 +16937,19 @@ function registerWorkspaceRoutes(app, ctx) {
|
|
|
16815
16937
|
type: "workspace.diff",
|
|
16816
16938
|
path: ws.path,
|
|
16817
16939
|
base: baseFor(ctx, ws),
|
|
16818
|
-
file: q.file ?? null
|
|
16940
|
+
file: q.file ?? null,
|
|
16941
|
+
...q.rev ? { rev: q.rev } : {}
|
|
16942
|
+
});
|
|
16943
|
+
});
|
|
16944
|
+
app.get("/api/workspaces/:id/commits", async (req) => {
|
|
16945
|
+
const ws = ctx.store.workspaces.require(req.params.id);
|
|
16946
|
+
const q = parse(CommitsQuery, req.query, "query");
|
|
16947
|
+
requireConnected(ctx, ws.hostId);
|
|
16948
|
+
return ctx.hostHub.request(ws.hostId, {
|
|
16949
|
+
type: "workspace.log",
|
|
16950
|
+
path: ws.path,
|
|
16951
|
+
base: baseFor(ctx, ws),
|
|
16952
|
+
limit: q.limit
|
|
16819
16953
|
});
|
|
16820
16954
|
});
|
|
16821
16955
|
app.get("/api/workspaces/:id/files", async (req) => {
|
|
@@ -20633,7 +20767,7 @@ new file mode ${mode2}
|
|
|
20633
20767
|
patch += "\\n";
|
|
20634
20768
|
return { path: rel, lines, patch };
|
|
20635
20769
|
}
|
|
20636
|
-
async function
|
|
20770
|
+
async function branchPoint(path3, base) {
|
|
20637
20771
|
const top = await realpathOr((await runGit(path3, ["rev-parse", "--show-toplevel"])).stdout.trim());
|
|
20638
20772
|
const baseRef = base ?? (await inspectCheckout2(top)).defaultBranch;
|
|
20639
20773
|
let mergeBase;
|
|
@@ -20642,10 +20776,30 @@ async function diffWorkspace(path3, base, file) {
|
|
|
20642
20776
|
mergeBase = mb.stdout.trim();
|
|
20643
20777
|
else
|
|
20644
20778
|
mergeBase = await refResolves(top, "HEAD") ? "HEAD" : EMPTY_TREE;
|
|
20779
|
+
return { top, baseRef, mergeBase };
|
|
20780
|
+
}
|
|
20781
|
+
async function diffWorkspace(path3, base, file, rev = null) {
|
|
20782
|
+
const { top, baseRef, mergeBase } = await branchPoint(path3, base);
|
|
20783
|
+
let range = [mergeBase];
|
|
20784
|
+
let label = baseRef;
|
|
20785
|
+
let withUntracked = true;
|
|
20786
|
+
if (rev === "uncommitted") {
|
|
20787
|
+
range = [await refResolves(top, "HEAD") ? "HEAD" : EMPTY_TREE];
|
|
20788
|
+
label = "HEAD";
|
|
20789
|
+
} else if (rev !== null) {
|
|
20790
|
+
const exists2 = await runGit(top, ["cat-file", "-e", `${rev}^{commit}`], { allowFail: true });
|
|
20791
|
+
const onBranch = exists2.code === 0 ? await runGit(top, ["merge-base", "--is-ancestor", rev, "HEAD"], { allowFail: true }) : null;
|
|
20792
|
+
if (onBranch?.code !== 0) {
|
|
20793
|
+
throw new SwitchyardError("not_found", "That commit is not on this branch");
|
|
20794
|
+
}
|
|
20795
|
+
range = [await refResolves(top, `${rev}^`) ? `${rev}^` : EMPTY_TREE, rev];
|
|
20796
|
+
label = `${rev.slice(0, 7)}^`;
|
|
20797
|
+
withUntracked = false;
|
|
20798
|
+
}
|
|
20645
20799
|
const [numstatOut, nameStatusOut, untrackedOut] = await Promise.all([
|
|
20646
|
-
runGit(top, ["diff", "--no-color", "-M", "--numstat", "-z",
|
|
20647
|
-
runGit(top, ["diff", "--no-color", "-M", "--name-status", "-z",
|
|
20648
|
-
runGit(top, ["ls-files", "--others", "--exclude-standard", "-z"])
|
|
20800
|
+
runGit(top, ["diff", "--no-color", "-M", "--numstat", "-z", ...range, "--"]),
|
|
20801
|
+
runGit(top, ["diff", "--no-color", "-M", "--name-status", "-z", ...range, "--"]),
|
|
20802
|
+
withUntracked ? runGit(top, ["ls-files", "--others", "--exclude-standard", "-z"]) : Promise.resolve({ stdout: "", stderr: "", code: 0 })
|
|
20649
20803
|
]);
|
|
20650
20804
|
const numstat = parseNumstat(numstatOut.stdout);
|
|
20651
20805
|
const nameStatus = parseNameStatus(nameStatusOut.stdout);
|
|
@@ -20674,14 +20828,56 @@ async function diffWorkspace(path3, base, file) {
|
|
|
20674
20828
|
status: "untracked"
|
|
20675
20829
|
});
|
|
20676
20830
|
}
|
|
20677
|
-
const diffArgs = ["--literal-pathspecs", "diff", "--no-color", "-M",
|
|
20831
|
+
const diffArgs = ["--literal-pathspecs", "diff", "--no-color", "-M", ...range, "--"];
|
|
20678
20832
|
if (file !== null)
|
|
20679
20833
|
diffArgs.push(file);
|
|
20680
20834
|
let patch = (await runGit(top, diffArgs)).stdout;
|
|
20681
20835
|
for (const p of wanted)
|
|
20682
20836
|
patch += untracked.get(p).patch;
|
|
20683
20837
|
const limitPatch = file === null && Buffer.byteLength(patch, "utf8") > MAX_PATCH_BYTES;
|
|
20684
|
-
return { base:
|
|
20838
|
+
return { base: label, files, patch: limitPatch ? null : patch };
|
|
20839
|
+
}
|
|
20840
|
+
async function logWorkspace(path3, base, limit) {
|
|
20841
|
+
const { top, baseRef, mergeBase } = await branchPoint(path3, base);
|
|
20842
|
+
const uncommitted = (await worktreeStatus(top, baseRef)).changedFiles;
|
|
20843
|
+
if (!await refResolves(top, "HEAD")) {
|
|
20844
|
+
return { base: baseRef, scope: "branch", commits: [], truncated: false, uncommitted };
|
|
20845
|
+
}
|
|
20846
|
+
const own = mergeBase !== "HEAD" && mergeBase !== EMPTY_TREE ? Number((await runGit(top, ["rev-list", "--count", `${mergeBase}..HEAD`])).stdout.trim()) : 0;
|
|
20847
|
+
const range = own > 0 ? `${mergeBase}..HEAD` : "HEAD";
|
|
20848
|
+
const out = await runGit(top, [
|
|
20849
|
+
"log",
|
|
20850
|
+
"-z",
|
|
20851
|
+
"--no-color",
|
|
20852
|
+
"--format=%H%x1f%an%x1f%aI%x1f%s",
|
|
20853
|
+
"-n",
|
|
20854
|
+
String(limit + 1),
|
|
20855
|
+
range
|
|
20856
|
+
]);
|
|
20857
|
+
const rows = out.stdout.split("\0").map((r) => r.replace(/^\n+/, "")).filter((r) => r !== "").map((r) => r.split(""));
|
|
20858
|
+
const truncated = rows.length > limit;
|
|
20859
|
+
let upstream = null;
|
|
20860
|
+
const up2 = await runGit(top, ["rev-parse", "--verify", "--quiet", "@{u}"], { allowFail: true });
|
|
20861
|
+
if (up2.code === 0 && up2.stdout.trim() !== "")
|
|
20862
|
+
upstream = up2.stdout.trim();
|
|
20863
|
+
else {
|
|
20864
|
+
const br = await runGit(top, ["symbolic-ref", "--quiet", "--short", "HEAD"], {
|
|
20865
|
+
allowFail: true
|
|
20866
|
+
});
|
|
20867
|
+
const name = br.code === 0 ? br.stdout.trim() : "";
|
|
20868
|
+
if (name && await refResolves(top, `refs/remotes/origin/${name}`)) {
|
|
20869
|
+
upstream = `refs/remotes/origin/${name}`;
|
|
20870
|
+
}
|
|
20871
|
+
}
|
|
20872
|
+
const unpushed = upstream ? new Set((await runGit(top, ["rev-list", `${upstream}..HEAD`])).stdout.split("\n").map((l) => l.trim()).filter(Boolean)) : null;
|
|
20873
|
+
const commits = rows.slice(0, limit).map(([sha2 = "", author = "", at = "", subject = ""]) => ({
|
|
20874
|
+
sha: sha2,
|
|
20875
|
+
subject: subject.slice(0, 300),
|
|
20876
|
+
author: author.slice(0, 200),
|
|
20877
|
+
authoredAt: at,
|
|
20878
|
+
pushed: unpushed ? !unpushed.has(sha2) : false
|
|
20879
|
+
}));
|
|
20880
|
+
return { base: baseRef, scope: own > 0 ? "branch" : "recent", commits, truncated, uncommitted };
|
|
20685
20881
|
}
|
|
20686
20882
|
async function removeWorktree(opts) {
|
|
20687
20883
|
let real;
|
|
@@ -24452,6 +24648,7 @@ var READ_ONLY_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
24452
24648
|
"workspace.discover",
|
|
24453
24649
|
"workspace.status",
|
|
24454
24650
|
"workspace.diff",
|
|
24651
|
+
"workspace.log",
|
|
24455
24652
|
"workspace.files",
|
|
24456
24653
|
"workspace.readFile",
|
|
24457
24654
|
"workspace.prView",
|
|
@@ -24482,6 +24679,7 @@ var RERUNNABLE = /* @__PURE__ */ new Set([
|
|
|
24482
24679
|
"workspace.discover",
|
|
24483
24680
|
"workspace.status",
|
|
24484
24681
|
"workspace.diff",
|
|
24682
|
+
"workspace.log",
|
|
24485
24683
|
"workspace.files",
|
|
24486
24684
|
"workspace.readFile",
|
|
24487
24685
|
"workspace.prView",
|
|
@@ -24821,7 +25019,9 @@ var CommandRouter = class {
|
|
|
24821
25019
|
case "workspace.remove":
|
|
24822
25020
|
return workspaces.remove(c.path, c.checkoutPath, c.base, c.force, c.deleteBranch === true);
|
|
24823
25021
|
case "workspace.diff":
|
|
24824
|
-
return diffWorkspace(c.path, c.base, c.file);
|
|
25022
|
+
return diffWorkspace(c.path, c.base, c.file, c.rev ?? null);
|
|
25023
|
+
case "workspace.log":
|
|
25024
|
+
return logWorkspace(c.path, c.base, c.limit);
|
|
24825
25025
|
case "workspace.files":
|
|
24826
25026
|
return listDir(c.path, c.dir);
|
|
24827
25027
|
case "workspace.readFile":
|
|
@@ -25466,7 +25666,7 @@ import WebSocket3 from "ws";
|
|
|
25466
25666
|
var OUTBOX_RETENTION_MS = 24 * 60 * 60 * 1e3;
|
|
25467
25667
|
var ACKED_META = "outbox.ackedHostSeq";
|
|
25468
25668
|
var AGENT_FEATURES = ["agentRequests.v1", "policies.v1"];
|
|
25469
|
-
var HOST_FEATURES = [TRACKERS_FEATURE];
|
|
25669
|
+
var HOST_FEATURES = [TRACKERS_FEATURE, GIT_LOG_FEATURE];
|
|
25470
25670
|
function hostSocketUrl(coordinatorUrl) {
|
|
25471
25671
|
const u = new URL(coordinatorUrl);
|
|
25472
25672
|
if (u.protocol === "http:")
|
|
@@ -26725,6 +26925,7 @@ var ExternalSessionWatcher = class {
|
|
|
26725
26925
|
// packages/host-agent/dist/github.js
|
|
26726
26926
|
import { spawn as spawn4 } from "node:child_process";
|
|
26727
26927
|
import { createHash as createHash10 } from "node:crypto";
|
|
26928
|
+
import { once } from "node:events";
|
|
26728
26929
|
import { realpath as realpath7 } from "node:fs/promises";
|
|
26729
26930
|
|
|
26730
26931
|
// packages/host-agent/dist/github-trackers.js
|
|
@@ -28028,8 +28229,16 @@ var GitHubService2 = class {
|
|
|
28028
28229
|
const children2 = [...this.children];
|
|
28029
28230
|
for (const child of children2)
|
|
28030
28231
|
signalGroup(child, "SIGTERM");
|
|
28031
|
-
if (children2.length
|
|
28032
|
-
|
|
28232
|
+
if (children2.length) {
|
|
28233
|
+
let grace;
|
|
28234
|
+
await Promise.race([
|
|
28235
|
+
Promise.all(children2.map((child) => child.exitCode !== null || child.signalCode !== null ? void 0 : once(child, "exit"))),
|
|
28236
|
+
new Promise((resolve16) => {
|
|
28237
|
+
grace = setTimeout(resolve16, 3e3);
|
|
28238
|
+
})
|
|
28239
|
+
]);
|
|
28240
|
+
clearTimeout(grace);
|
|
28241
|
+
}
|
|
28033
28242
|
for (const child of children2)
|
|
28034
28243
|
signalGroup(child, "SIGKILL");
|
|
28035
28244
|
for (const timer of this.kills)
|
|
@@ -31507,7 +31716,11 @@ async function runHostAgent(opts = {}) {
|
|
|
31507
31716
|
policies: agentSupport,
|
|
31508
31717
|
adapterDevelopment: true
|
|
31509
31718
|
} : null,
|
|
31510
|
-
features: [
|
|
31719
|
+
features: [
|
|
31720
|
+
...agentSupport ? ["agentRequests.v1", "policies.v1"] : [],
|
|
31721
|
+
TRACKERS_FEATURE,
|
|
31722
|
+
GIT_LOG_FEATURE
|
|
31723
|
+
],
|
|
31511
31724
|
protocolVersion: PROTOCOL_VERSION,
|
|
31512
31725
|
github: github.github
|
|
31513
31726
|
}),
|
|
@@ -35684,7 +35897,7 @@ async function trackersList(ctx, flags) {
|
|
|
35684
35897
|
t.name,
|
|
35685
35898
|
hosts.find((h) => h.id === t.hostId)?.name ?? t.hostId,
|
|
35686
35899
|
t.owner,
|
|
35687
|
-
t.repositories ? t.repositories.join(", ") : "any",
|
|
35900
|
+
(t.repositories ? t.repositories.join(", ") : "any") + (t.extraRepositories?.length ? ` + ${t.extraRepositories.join(", ")}` : ""),
|
|
35688
35901
|
t.board ? `#${t.board.projectNumber}` : "-",
|
|
35689
35902
|
t.writeBack ? "on" : "off",
|
|
35690
35903
|
t.lastSyncedAt ?? "never",
|
|
@@ -35706,6 +35919,7 @@ async function trackersCreate(ctx, name, flags) {
|
|
|
35706
35919
|
hostId: host.id,
|
|
35707
35920
|
owner: flags.owner,
|
|
35708
35921
|
...flags.repo?.length ? { repositories: flags.repo } : {},
|
|
35922
|
+
...flags.also?.length ? { extraRepositories: flags.also } : {},
|
|
35709
35923
|
...flags.board ? { board: { projectNumber: boardNumber(flags.board), ...fields } } : {},
|
|
35710
35924
|
...flags.writeBack ? { writeBack: true } : {},
|
|
35711
35925
|
...flags.moveShared === false ? { moveShared: false } : {}
|
|
@@ -35720,6 +35934,8 @@ async function trackersEdit(ctx, ref, flags) {
|
|
|
35720
35934
|
throw new CliError("--all-repos cannot be combined with --repo");
|
|
35721
35935
|
if (flags.enable && flags.disable)
|
|
35722
35936
|
throw new CliError("--enable and --disable conflict");
|
|
35937
|
+
if (flags.noAlso && flags.also?.length)
|
|
35938
|
+
throw new CliError("--no-also cannot be combined with --also");
|
|
35723
35939
|
const { api } = connect(ctx, flags);
|
|
35724
35940
|
const t = await resolveTracker(api, ref);
|
|
35725
35941
|
let board;
|
|
@@ -35739,6 +35955,7 @@ async function trackersEdit(ctx, ref, flags) {
|
|
|
35739
35955
|
...flags.host ? { hostId: (await resolveHost(api, flags.host)).id } : {},
|
|
35740
35956
|
...flags.owner ? { owner: flags.owner } : {},
|
|
35741
35957
|
...flags.allRepos ? { repositories: null } : flags.repo?.length ? { repositories: flags.repo } : {},
|
|
35958
|
+
...flags.noAlso ? { extraRepositories: [] } : flags.also?.length ? { extraRepositories: flags.also } : {},
|
|
35742
35959
|
...board !== void 0 ? { board } : {},
|
|
35743
35960
|
...flags.writeBack !== void 0 ? { writeBack: flags.writeBack } : {},
|
|
35744
35961
|
...flags.moveShared !== void 0 ? { moveShared: flags.moveShared } : {},
|
|
@@ -36201,6 +36418,8 @@ function buildProgram(ctx = defaultCtx()) {
|
|
|
36201
36418
|
owner: o.owner,
|
|
36202
36419
|
repo: o.repo,
|
|
36203
36420
|
allRepos: o.allRepos,
|
|
36421
|
+
also: Array.isArray(o.also) ? o.also : void 0,
|
|
36422
|
+
noAlso: o.also === false,
|
|
36204
36423
|
board: typeof o.board === "string" ? o.board : void 0,
|
|
36205
36424
|
noBoard: o.board === false,
|
|
36206
36425
|
statusField: o.statusField,
|
|
@@ -36212,8 +36431,8 @@ function buildProgram(ctx = defaultCtx()) {
|
|
|
36212
36431
|
disable: o.disable
|
|
36213
36432
|
});
|
|
36214
36433
|
connectionOptions(trackers.command("list").description("List trackers")).option("--json", "JSON output").action((o) => trackersList(ctx, { ...connFlags(o), json: o.json }));
|
|
36215
|
-
connectionOptions(trackers.command("create <name>").description("Create a tracker")).option("--host <host>", "host whose gh login is used (required)").option("--owner <login>", "GitHub organization or user (required)").option("--repo <owner/name>", "limit to a repository (repeatable)", collect).option("--board <number>", "GitHub Projects board number in the owner").option("--status-field <name>", "board status field (default Status)").option("--on-start <column>", "column once the worktree exists (write-back)").option("--on-review <column>", "column once a pull request is open (write-back)").option("--write-back", "let Switchyard move board cards").option("--no-move-shared", "never move cards assigned to someone else too").action((name, o) => trackersCreate(ctx, name, trackerFlags(o)));
|
|
36216
|
-
connectionOptions(trackers.command("edit <tracker>").description("Change a tracker")).option("--name <name>", "new name").option("--host <host>", "host whose gh login is used").option("--owner <login>", "GitHub organization or user").option("--repo <owner/name>", "limit to a repository (repeatable)", collect).option("--all-repos", "remove the repository limit").option("--board <number>", "GitHub Projects board number").option("--no-board", "stop using a board").option("--status-field <name>", "board status field").option("--on-start <column>", "column once the worktree exists").option("--on-review <column>", "column once a pull request is open").option("--write-back", "let Switchyard move board cards").option("--no-write-back", "never move board cards").option("--move-shared", "also move cards assigned to someone else too").option("--no-move-shared", "never move cards assigned to someone else too").option("--enable", "sync this tracker").option("--disable", "stop syncing this tracker").action((ref, o) => trackersEdit(ctx, ref, trackerFlags(o)));
|
|
36434
|
+
connectionOptions(trackers.command("create <name>").description("Create a tracker")).option("--host <host>", "host whose gh login is used (required)").option("--owner <login>", "GitHub organization or user (required)").option("--repo <owner/name>", "limit to a repository (repeatable)", collect).option("--also <owner/name>", "also include a repository of another owner (repeatable)", collect).option("--board <number>", "GitHub Projects board number in the owner").option("--status-field <name>", "board status field (default Status)").option("--on-start <column>", "column once the worktree exists (write-back)").option("--on-review <column>", "column once a pull request is open (write-back)").option("--write-back", "let Switchyard move board cards").option("--no-move-shared", "never move cards assigned to someone else too").action((name, o) => trackersCreate(ctx, name, trackerFlags(o)));
|
|
36435
|
+
connectionOptions(trackers.command("edit <tracker>").description("Change a tracker")).option("--name <name>", "new name").option("--host <host>", "host whose gh login is used").option("--owner <login>", "GitHub organization or user").option("--repo <owner/name>", "limit to a repository (repeatable)", collect).option("--all-repos", "remove the repository limit").option("--also <owner/name>", "also include a repository of another owner (repeatable)", collect).option("--no-also", "remove the repositories of other owners").option("--board <number>", "GitHub Projects board number").option("--no-board", "stop using a board").option("--status-field <name>", "board status field").option("--on-start <column>", "column once the worktree exists").option("--on-review <column>", "column once a pull request is open").option("--write-back", "let Switchyard move board cards").option("--no-write-back", "never move board cards").option("--move-shared", "also move cards assigned to someone else too").option("--no-move-shared", "never move cards assigned to someone else too").option("--enable", "sync this tracker").option("--disable", "stop syncing this tracker").action((ref, o) => trackersEdit(ctx, ref, trackerFlags(o)));
|
|
36217
36436
|
connectionOptions(trackers.command("delete <tracker>").description("Delete a tracker")).action((ref, o) => trackersDelete(ctx, ref, connFlags(o)));
|
|
36218
36437
|
connectionOptions(trackers.command("sync <tracker>").description("Sync a tracker now")).action((ref, o) => trackersSync(ctx, ref, connFlags(o)));
|
|
36219
36438
|
const tasks = program.command("tasks").description("Tasks");
|
package/package.json
CHANGED