@staff0rd/assist 0.1076.2 → 0.1077.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/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +462 -461
- package/dist/index.js +424 -281
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.1077.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1172,7 +1172,7 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
1172
1172
|
globalRaw.deny,
|
|
1173
1173
|
projectRaw.deny
|
|
1174
1174
|
);
|
|
1175
|
-
const
|
|
1175
|
+
const run5 = mergeRunConfigs(
|
|
1176
1176
|
globalRaw.run,
|
|
1177
1177
|
projectRaw.run
|
|
1178
1178
|
);
|
|
@@ -1184,8 +1184,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
1184
1184
|
if (deny !== void 0) {
|
|
1185
1185
|
merged.deny = deny;
|
|
1186
1186
|
}
|
|
1187
|
-
if (
|
|
1188
|
-
merged.run =
|
|
1187
|
+
if (run5 !== void 0) {
|
|
1188
|
+
merged.run = run5;
|
|
1189
1189
|
}
|
|
1190
1190
|
return merged;
|
|
1191
1191
|
}
|
|
@@ -7440,8 +7440,8 @@ function runConfigBaseDir() {
|
|
|
7440
7440
|
// src/commands/sessions/web/handleServerRuns.ts
|
|
7441
7441
|
function getServerRuns(cwd) {
|
|
7442
7442
|
try {
|
|
7443
|
-
const { run:
|
|
7444
|
-
return resolveRunConfigs(
|
|
7443
|
+
const { run: run5 } = loadConfigFrom(cwd);
|
|
7444
|
+
return resolveRunConfigs(run5, runConfigBaseDirFrom(cwd)).filter((r) => r.server).map((r) => ({ name: r.name, port: r.port }));
|
|
7445
7445
|
} catch {
|
|
7446
7446
|
return [];
|
|
7447
7447
|
}
|
|
@@ -11482,7 +11482,7 @@ function kindOf(node) {
|
|
|
11482
11482
|
if (node.environment) return "environment";
|
|
11483
11483
|
return node.kind === "gate" ? "gate" : "build";
|
|
11484
11484
|
}
|
|
11485
|
-
function declaredNodeState(node, deployments, behindBySha2,
|
|
11485
|
+
function declaredNodeState(node, deployments, behindBySha2, run5) {
|
|
11486
11486
|
const environment = node.environment ?? null;
|
|
11487
11487
|
const deployment = environment ? deployments.live.get(environment) : void 0;
|
|
11488
11488
|
const queued = environment ? deployments.queued.get(environment) : void 0;
|
|
@@ -11496,7 +11496,7 @@ function declaredNodeState(node, deployments, behindBySha2, run4) {
|
|
|
11496
11496
|
behind: deployment ? behindBySha2.get(deployment.commit.sha) ?? null : null,
|
|
11497
11497
|
queued: queued?.commit ?? null,
|
|
11498
11498
|
queuedRunUrl: queued?.runUrl ?? null,
|
|
11499
|
-
run:
|
|
11499
|
+
run: run5
|
|
11500
11500
|
};
|
|
11501
11501
|
}
|
|
11502
11502
|
|
|
@@ -11603,15 +11603,15 @@ async function liveDeployments(cwd, repo, environments) {
|
|
|
11603
11603
|
async function latestRun(cwd, repo, workflow) {
|
|
11604
11604
|
const path109 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
|
|
11605
11605
|
const response = await ghJson(cwd, ["api", path109]);
|
|
11606
|
-
const
|
|
11607
|
-
if (!
|
|
11606
|
+
const run5 = response.workflow_runs?.[0];
|
|
11607
|
+
if (!run5) return null;
|
|
11608
11608
|
return {
|
|
11609
|
-
id:
|
|
11610
|
-
number:
|
|
11611
|
-
url:
|
|
11612
|
-
headSha:
|
|
11613
|
-
status:
|
|
11614
|
-
startedAt:
|
|
11609
|
+
id: run5.id,
|
|
11610
|
+
number: run5.run_number,
|
|
11611
|
+
url: run5.html_url,
|
|
11612
|
+
headSha: run5.head_sha,
|
|
11613
|
+
status: run5.status ?? "unknown",
|
|
11614
|
+
startedAt: run5.run_started_at ?? null
|
|
11615
11615
|
};
|
|
11616
11616
|
}
|
|
11617
11617
|
|
|
@@ -11707,9 +11707,9 @@ async function runJobs(cwd, repo, runId) {
|
|
|
11707
11707
|
|
|
11708
11708
|
// src/commands/sessions/web/releases/streamRunState.ts
|
|
11709
11709
|
async function streamRunState(cwd, stream) {
|
|
11710
|
-
const
|
|
11711
|
-
if (!
|
|
11712
|
-
const { id, ...state } =
|
|
11710
|
+
const run5 = await latestRun(cwd, stream.repo, stream.workflow);
|
|
11711
|
+
if (!run5) return { run: null, byNode: /* @__PURE__ */ new Map() };
|
|
11712
|
+
const { id, ...state } = run5;
|
|
11713
11713
|
const jobs = await runJobs(cwd, stream.repo, id);
|
|
11714
11714
|
return { run: state, byNode: matchRunJobs(stream.nodes, jobs) };
|
|
11715
11715
|
}
|
|
@@ -11727,7 +11727,7 @@ async function streamState(cwd, stream, repoEnvironments2 = streamEnvironments(s
|
|
|
11727
11727
|
edges: stream.edges
|
|
11728
11728
|
};
|
|
11729
11729
|
try {
|
|
11730
|
-
const [deployments, { run:
|
|
11730
|
+
const [deployments, { run: run5, byNode: byNode2 }] = await Promise.all([
|
|
11731
11731
|
liveDeployments(cwd, stream.repo, repoEnvironments2),
|
|
11732
11732
|
streamRunState(cwd, stream)
|
|
11733
11733
|
]);
|
|
@@ -11744,7 +11744,7 @@ async function streamState(cwd, stream, repoEnvironments2 = streamEnvironments(s
|
|
|
11744
11744
|
byNode2.get(node.id) ?? null
|
|
11745
11745
|
)
|
|
11746
11746
|
),
|
|
11747
|
-
run:
|
|
11747
|
+
run: run5
|
|
11748
11748
|
};
|
|
11749
11749
|
} catch (error) {
|
|
11750
11750
|
return {
|
|
@@ -13015,6 +13015,310 @@ function setConfig(req, res) {
|
|
|
13015
13015
|
});
|
|
13016
13016
|
}
|
|
13017
13017
|
|
|
13018
|
+
// src/commands/testflight/formatAscError.ts
|
|
13019
|
+
var statusHints = {
|
|
13020
|
+
401: "Check testflight.keyId, testflight.issuerId and that testflight.keyRef points at the matching .p8.",
|
|
13021
|
+
403: "The App Store Connect API key may lack the role this action needs (team invitations need Admin)."
|
|
13022
|
+
};
|
|
13023
|
+
function parseErrors(body) {
|
|
13024
|
+
try {
|
|
13025
|
+
const parsed = JSON.parse(body);
|
|
13026
|
+
return (parsed.errors ?? []).map(
|
|
13027
|
+
(error) => [error.title, error.detail].filter(Boolean).join(": ")
|
|
13028
|
+
);
|
|
13029
|
+
} catch {
|
|
13030
|
+
return body ? [body] : [];
|
|
13031
|
+
}
|
|
13032
|
+
}
|
|
13033
|
+
function formatAscError(method, path109, status2, body) {
|
|
13034
|
+
const lines2 = [
|
|
13035
|
+
`App Store Connect ${method} ${path109} failed (${status2})`,
|
|
13036
|
+
...parseErrors(body).map((line) => ` ${line}`)
|
|
13037
|
+
];
|
|
13038
|
+
const hint = statusHints[status2];
|
|
13039
|
+
if (hint) lines2.push(hint);
|
|
13040
|
+
return lines2.join("\n");
|
|
13041
|
+
}
|
|
13042
|
+
|
|
13043
|
+
// src/commands/testflight/TestflightError.ts
|
|
13044
|
+
var TestflightError = class extends Error {
|
|
13045
|
+
name = "TestflightError";
|
|
13046
|
+
};
|
|
13047
|
+
|
|
13048
|
+
// src/commands/testflight/ascRequest.ts
|
|
13049
|
+
var BASE_URL = "https://api.appstoreconnect.apple.com";
|
|
13050
|
+
async function send(fetchFn, token, method, path109, body) {
|
|
13051
|
+
try {
|
|
13052
|
+
return await fetchFn(`${BASE_URL}${path109}`, {
|
|
13053
|
+
method,
|
|
13054
|
+
headers: {
|
|
13055
|
+
Authorization: `Bearer ${token}`,
|
|
13056
|
+
Accept: "application/json",
|
|
13057
|
+
...body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
13058
|
+
},
|
|
13059
|
+
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
13060
|
+
});
|
|
13061
|
+
} catch (error) {
|
|
13062
|
+
const reason4 = error instanceof Error ? error.message : String(error);
|
|
13063
|
+
throw new TestflightError(`Failed to reach App Store Connect: ${reason4}`);
|
|
13064
|
+
}
|
|
13065
|
+
}
|
|
13066
|
+
async function ascRequest(fetchFn, token, method, path109, body) {
|
|
13067
|
+
const response = await send(fetchFn, token, method, path109, body);
|
|
13068
|
+
const text20 = await response.text();
|
|
13069
|
+
if (!response.ok) {
|
|
13070
|
+
throw new TestflightError(
|
|
13071
|
+
formatAscError(method, path109.split("?")[0], response.status, text20)
|
|
13072
|
+
);
|
|
13073
|
+
}
|
|
13074
|
+
return text20 ? JSON.parse(text20) : void 0;
|
|
13075
|
+
}
|
|
13076
|
+
|
|
13077
|
+
// src/commands/testflight/createAscClient.ts
|
|
13078
|
+
function createAscClient(token, fetchFn = fetch) {
|
|
13079
|
+
return {
|
|
13080
|
+
get: (path109, params) => {
|
|
13081
|
+
const query = params ? `?${new URLSearchParams(params)}` : "";
|
|
13082
|
+
return ascRequest(fetchFn, token, "GET", `${path109}${query}`);
|
|
13083
|
+
},
|
|
13084
|
+
post: (path109, body) => ascRequest(fetchFn, token, "POST", path109, body)
|
|
13085
|
+
};
|
|
13086
|
+
}
|
|
13087
|
+
|
|
13088
|
+
// src/commands/testflight/createAscToken.ts
|
|
13089
|
+
import { createPrivateKey, sign } from "crypto";
|
|
13090
|
+
var TOKEN_LIFETIME_SECONDS = 20 * 60;
|
|
13091
|
+
function base64url(value) {
|
|
13092
|
+
return Buffer.from(JSON.stringify(value)).toString("base64url");
|
|
13093
|
+
}
|
|
13094
|
+
function createAscToken(options2) {
|
|
13095
|
+
const iat = Math.floor((options2.now ?? Date.now()) / 1e3);
|
|
13096
|
+
const header = { alg: "ES256", kid: options2.keyId, typ: "JWT" };
|
|
13097
|
+
const payload = {
|
|
13098
|
+
iss: options2.issuerId,
|
|
13099
|
+
iat,
|
|
13100
|
+
exp: iat + TOKEN_LIFETIME_SECONDS,
|
|
13101
|
+
aud: "appstoreconnect-v1"
|
|
13102
|
+
};
|
|
13103
|
+
const signingInput = `${base64url(header)}.${base64url(payload)}`;
|
|
13104
|
+
const signature = sign("sha256", Buffer.from(signingInput), {
|
|
13105
|
+
key: createPrivateKey(options2.privateKey),
|
|
13106
|
+
dsaEncoding: "ieee-p1363"
|
|
13107
|
+
});
|
|
13108
|
+
return `${signingInput}.${signature.toString("base64url")}`;
|
|
13109
|
+
}
|
|
13110
|
+
|
|
13111
|
+
// src/commands/testflight/findAppId.ts
|
|
13112
|
+
async function findAppId(client, bundleId) {
|
|
13113
|
+
const { data } = await client.get("/v1/apps", {
|
|
13114
|
+
"filter[bundleId]": bundleId,
|
|
13115
|
+
"fields[apps]": "bundleId"
|
|
13116
|
+
});
|
|
13117
|
+
const app = data.find((item) => item.attributes?.bundleId === bundleId);
|
|
13118
|
+
if (!app) {
|
|
13119
|
+
throw new TestflightError(
|
|
13120
|
+
`No App Store Connect app has bundle id ${bundleId} (testflight.bundleId)`
|
|
13121
|
+
);
|
|
13122
|
+
}
|
|
13123
|
+
return app.id;
|
|
13124
|
+
}
|
|
13125
|
+
|
|
13126
|
+
// src/commands/testflight/readAscKey.ts
|
|
13127
|
+
import { execFile as execFile9 } from "child_process";
|
|
13128
|
+
import { promisify as promisify10 } from "util";
|
|
13129
|
+
var run = promisify10(execFile9);
|
|
13130
|
+
async function readAscKey(reference) {
|
|
13131
|
+
if (!reference.startsWith("op://"))
|
|
13132
|
+
throw new TestflightError(
|
|
13133
|
+
"testflight.keyRef must be a 1Password reference starting with op://"
|
|
13134
|
+
);
|
|
13135
|
+
try {
|
|
13136
|
+
const { stdout } = await run("op", ["read", reference]);
|
|
13137
|
+
return stdout.trim();
|
|
13138
|
+
} catch (error) {
|
|
13139
|
+
const reason4 = error.stderr?.trim() || (error instanceof Error ? error.message : String(error));
|
|
13140
|
+
throw new TestflightError(
|
|
13141
|
+
`Failed to read testflight.keyRef from 1Password (is op installed and signed in?): ${reason4}`
|
|
13142
|
+
);
|
|
13143
|
+
}
|
|
13144
|
+
}
|
|
13145
|
+
|
|
13146
|
+
// src/commands/testflight/connectAsc.ts
|
|
13147
|
+
async function connectAsc(config, options2 = {}) {
|
|
13148
|
+
const privateKey = await (options2.readKey ?? readAscKey)(config.keyRef);
|
|
13149
|
+
const token = createAscToken({
|
|
13150
|
+
keyId: config.keyId,
|
|
13151
|
+
issuerId: config.issuerId,
|
|
13152
|
+
privateKey
|
|
13153
|
+
});
|
|
13154
|
+
const client = createAscClient(token, options2.fetchFn);
|
|
13155
|
+
return { client, appId: await findAppId(client, config.bundleId) };
|
|
13156
|
+
}
|
|
13157
|
+
|
|
13158
|
+
// src/commands/testflight/findBetaGroupId.ts
|
|
13159
|
+
async function findBetaGroupId(client, appId, lookup) {
|
|
13160
|
+
const { data } = await client.get(`/v1/apps/${appId}/betaGroups`, {
|
|
13161
|
+
"fields[betaGroups]": "name,isInternalGroup",
|
|
13162
|
+
limit: "200"
|
|
13163
|
+
});
|
|
13164
|
+
const group = data.find((item) => item.attributes?.name === lookup.name);
|
|
13165
|
+
if (!group) {
|
|
13166
|
+
const available = data.map((item) => String(item.attributes?.name)).join(", ");
|
|
13167
|
+
throw new TestflightError(
|
|
13168
|
+
`No beta group named "${lookup.name}" (${lookup.configKey}). Available groups: ${available || "none"}`
|
|
13169
|
+
);
|
|
13170
|
+
}
|
|
13171
|
+
if (Boolean(group.attributes?.isInternalGroup) !== lookup.internal) {
|
|
13172
|
+
const kind = lookup.internal ? "an internal" : "an external";
|
|
13173
|
+
throw new TestflightError(
|
|
13174
|
+
`Beta group "${lookup.name}" (${lookup.configKey}) must be ${kind} group`
|
|
13175
|
+
);
|
|
13176
|
+
}
|
|
13177
|
+
return group.id;
|
|
13178
|
+
}
|
|
13179
|
+
|
|
13180
|
+
// src/commands/testflight/listAppTeam.ts
|
|
13181
|
+
function seesApp(item, appId) {
|
|
13182
|
+
if (item.attributes?.allAppsVisible) return true;
|
|
13183
|
+
const linked = item.relationships?.visibleApps?.data;
|
|
13184
|
+
return Array.isArray(linked) && linked.some((app) => app.id === appId);
|
|
13185
|
+
}
|
|
13186
|
+
async function listEmails(client, path109, type, emailAttribute, appId) {
|
|
13187
|
+
const { data } = await client.get(path109, {
|
|
13188
|
+
include: "visibleApps",
|
|
13189
|
+
[`fields[${type}]`]: `${emailAttribute},allAppsVisible,visibleApps`,
|
|
13190
|
+
"fields[apps]": "bundleId",
|
|
13191
|
+
limit: "200"
|
|
13192
|
+
});
|
|
13193
|
+
return data.filter((item) => seesApp(item, appId)).map((item) => String(item.attributes?.[emailAttribute]));
|
|
13194
|
+
}
|
|
13195
|
+
async function listAppTeam(client, appId) {
|
|
13196
|
+
const [members, invitees] = await Promise.all([
|
|
13197
|
+
listEmails(client, "/v1/users", "users", "username", appId),
|
|
13198
|
+
listEmails(
|
|
13199
|
+
client,
|
|
13200
|
+
"/v1/userInvitations",
|
|
13201
|
+
"userInvitations",
|
|
13202
|
+
"email",
|
|
13203
|
+
appId
|
|
13204
|
+
)
|
|
13205
|
+
]);
|
|
13206
|
+
return { members, invitees };
|
|
13207
|
+
}
|
|
13208
|
+
|
|
13209
|
+
// src/commands/testflight/toTesterState.ts
|
|
13210
|
+
var states = {
|
|
13211
|
+
NOT_INVITED: "not-invited",
|
|
13212
|
+
INVITED: "invited",
|
|
13213
|
+
ACCEPTED: "accepted",
|
|
13214
|
+
INSTALLED: "installed",
|
|
13215
|
+
REVOKED: "revoked"
|
|
13216
|
+
};
|
|
13217
|
+
function toTesterState(state) {
|
|
13218
|
+
return states[String(state)] ?? "not-invited";
|
|
13219
|
+
}
|
|
13220
|
+
|
|
13221
|
+
// src/commands/testflight/listGroupTesters.ts
|
|
13222
|
+
async function listGroupTesters(client, groupId) {
|
|
13223
|
+
const { data } = await client.get("/v1/betaTesters", {
|
|
13224
|
+
"filter[betaGroups]": groupId,
|
|
13225
|
+
"fields[betaTesters]": "email,state",
|
|
13226
|
+
limit: "200"
|
|
13227
|
+
});
|
|
13228
|
+
return data.map((item) => ({
|
|
13229
|
+
email: String(item.attributes?.email),
|
|
13230
|
+
testflight: toTesterState(item.attributes?.state)
|
|
13231
|
+
})).sort((a, b) => a.email.localeCompare(b.email));
|
|
13232
|
+
}
|
|
13233
|
+
|
|
13234
|
+
// src/commands/testflight/mergeInternalPeople.ts
|
|
13235
|
+
function mergeInternalPeople({
|
|
13236
|
+
members,
|
|
13237
|
+
invitees,
|
|
13238
|
+
groupTesters
|
|
13239
|
+
}) {
|
|
13240
|
+
const people = /* @__PURE__ */ new Map();
|
|
13241
|
+
const upsert = (email, person) => {
|
|
13242
|
+
const key = email.toLowerCase();
|
|
13243
|
+
const existing = people.get(key) ?? {
|
|
13244
|
+
email,
|
|
13245
|
+
team: "joined",
|
|
13246
|
+
testflight: "not-in-group"
|
|
13247
|
+
};
|
|
13248
|
+
people.set(key, { ...existing, ...person });
|
|
13249
|
+
};
|
|
13250
|
+
for (const email of invitees) upsert(email, { team: "pending" });
|
|
13251
|
+
for (const email of members) upsert(email, { team: "joined" });
|
|
13252
|
+
for (const tester of groupTesters)
|
|
13253
|
+
upsert(tester.email, { testflight: tester.testflight });
|
|
13254
|
+
return [...people.values()].sort((a, b) => a.email.localeCompare(b.email));
|
|
13255
|
+
}
|
|
13256
|
+
|
|
13257
|
+
// src/commands/testflight/listTesters.ts
|
|
13258
|
+
async function listInternal(client, appId, groupName) {
|
|
13259
|
+
if (!groupName) return [];
|
|
13260
|
+
const groupId = await findBetaGroupId(client, appId, {
|
|
13261
|
+
name: groupName,
|
|
13262
|
+
configKey: "testflight.internalGroup",
|
|
13263
|
+
internal: true
|
|
13264
|
+
});
|
|
13265
|
+
const [team, groupTesters] = await Promise.all([
|
|
13266
|
+
listAppTeam(client, appId),
|
|
13267
|
+
listGroupTesters(client, groupId)
|
|
13268
|
+
]);
|
|
13269
|
+
return mergeInternalPeople({ ...team, groupTesters });
|
|
13270
|
+
}
|
|
13271
|
+
async function listTesters(config, options2 = {}) {
|
|
13272
|
+
const { client, appId } = await connectAsc(config, options2);
|
|
13273
|
+
const externalGroupId = await findBetaGroupId(client, appId, {
|
|
13274
|
+
name: config.externalGroup,
|
|
13275
|
+
configKey: "testflight.externalGroup",
|
|
13276
|
+
internal: false
|
|
13277
|
+
});
|
|
13278
|
+
const [internal, external] = await Promise.all([
|
|
13279
|
+
listInternal(client, appId, config.internalGroup),
|
|
13280
|
+
listGroupTesters(client, externalGroupId)
|
|
13281
|
+
]);
|
|
13282
|
+
return { bundleId: config.bundleId, internal, external };
|
|
13283
|
+
}
|
|
13284
|
+
|
|
13285
|
+
// src/commands/testflight/readTestflightConfig.ts
|
|
13286
|
+
var requiredKeys = [
|
|
13287
|
+
"keyId",
|
|
13288
|
+
"issuerId",
|
|
13289
|
+
"keyRef",
|
|
13290
|
+
"bundleId",
|
|
13291
|
+
"externalGroup"
|
|
13292
|
+
];
|
|
13293
|
+
function readTestflightConfig(config) {
|
|
13294
|
+
const testflight = config.testflight ?? {};
|
|
13295
|
+
const missing = requiredKeys.filter((key) => !testflight[key]);
|
|
13296
|
+
if (missing.length > 0) {
|
|
13297
|
+
const lines2 = missing.map((key) => {
|
|
13298
|
+
const entry = testflightConfigHelp.find(
|
|
13299
|
+
(help) => help.key === `testflight.${key}`
|
|
13300
|
+
);
|
|
13301
|
+
return ` testflight.${key} is not set. Set it with: ${entry?.setter}`;
|
|
13302
|
+
});
|
|
13303
|
+
throw new TestflightError(
|
|
13304
|
+
["TestFlight is not configured", ...lines2].join("\n")
|
|
13305
|
+
);
|
|
13306
|
+
}
|
|
13307
|
+
return testflight;
|
|
13308
|
+
}
|
|
13309
|
+
|
|
13310
|
+
// src/commands/sessions/web/testflightTesters.ts
|
|
13311
|
+
async function testflightTesters(_req, res) {
|
|
13312
|
+
try {
|
|
13313
|
+
const config = readTestflightConfig(loadConfig());
|
|
13314
|
+
respondJson(res, 200, await listTesters(config));
|
|
13315
|
+
} catch (error) {
|
|
13316
|
+
respondJson(res, 500, {
|
|
13317
|
+
error: error instanceof Error ? error.message : "Failed to list testers"
|
|
13318
|
+
});
|
|
13319
|
+
}
|
|
13320
|
+
}
|
|
13321
|
+
|
|
13018
13322
|
// src/shared/enumerateConfigLeafKeys.ts
|
|
13019
13323
|
function enumerateConfigLeafKeys(schema2) {
|
|
13020
13324
|
return describeConfigLeaves(schema2).map((leaf) => leaf.key);
|
|
@@ -13653,11 +13957,11 @@ async function uploadPrImage(req, res) {
|
|
|
13653
13957
|
import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "fs/promises";
|
|
13654
13958
|
|
|
13655
13959
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
13656
|
-
import { execFile as
|
|
13960
|
+
import { execFile as execFile10 } from "child_process";
|
|
13657
13961
|
import { existsSync as existsSync27 } from "fs";
|
|
13658
13962
|
import { dirname as dirname15, join as join34 } from "path";
|
|
13659
|
-
import { promisify as
|
|
13660
|
-
var execFileAsync9 =
|
|
13963
|
+
import { promisify as promisify11 } from "util";
|
|
13964
|
+
var execFileAsync9 = promisify11(execFile10);
|
|
13661
13965
|
var TIMEOUT_MS = 15e3;
|
|
13662
13966
|
function findOxfmtScript(root2) {
|
|
13663
13967
|
let dir = root2;
|
|
@@ -13895,6 +14199,7 @@ var routes2 = {
|
|
|
13895
14199
|
"POST /api/config/set": setConfig,
|
|
13896
14200
|
"POST /api/config/unset": unsetConfig,
|
|
13897
14201
|
"GET /api/review/synthesis": getReviewSynthesis,
|
|
14202
|
+
"GET /api/testflight/testers": testflightTesters,
|
|
13898
14203
|
"GET /api/updates": updates,
|
|
13899
14204
|
"POST /api/updates/control": updatesControl
|
|
13900
14205
|
};
|
|
@@ -13930,7 +14235,7 @@ async function runRestartItem(item, { runRestartDaemon, reExec }) {
|
|
|
13930
14235
|
// src/commands/sessions/web/restartMenu/createActivate.ts
|
|
13931
14236
|
function createActivate(menu, actions) {
|
|
13932
14237
|
let busy = false;
|
|
13933
|
-
const
|
|
14238
|
+
const run5 = async () => {
|
|
13934
14239
|
const item = menu.selectedItem();
|
|
13935
14240
|
if (!item || item.disabled) return;
|
|
13936
14241
|
menu.close();
|
|
@@ -13941,7 +14246,7 @@ function createActivate(menu, actions) {
|
|
|
13941
14246
|
busy = false;
|
|
13942
14247
|
}
|
|
13943
14248
|
};
|
|
13944
|
-
return { isBusy: () => busy, activate: () => void
|
|
14249
|
+
return { isBusy: () => busy, activate: () => void run5() };
|
|
13945
14250
|
}
|
|
13946
14251
|
|
|
13947
14252
|
// src/commands/sessions/web/restartMenu/parseMenuKey.ts
|
|
@@ -14380,7 +14685,7 @@ function repoDirExists(cwd) {
|
|
|
14380
14685
|
}
|
|
14381
14686
|
|
|
14382
14687
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
14383
|
-
import { execFile as
|
|
14688
|
+
import { execFile as execFile11, execFileSync as execFileSync5 } from "child_process";
|
|
14384
14689
|
function isWindowsPath(cwd) {
|
|
14385
14690
|
return /^[A-Za-z]:[\\/]/.test(cwd);
|
|
14386
14691
|
}
|
|
@@ -14400,7 +14705,7 @@ function gitInvocation(cwd, args) {
|
|
|
14400
14705
|
function git2(cwd, args, timeout) {
|
|
14401
14706
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
14402
14707
|
return new Promise((resolve34, reject) => {
|
|
14403
|
-
|
|
14708
|
+
execFile11(file, argv, { ...options2, timeout }, (error, stdout) => {
|
|
14404
14709
|
if (error) reject(error);
|
|
14405
14710
|
else resolve34(stdout.toString());
|
|
14406
14711
|
});
|
|
@@ -15672,9 +15977,9 @@ function buildFullCommand(command, args) {
|
|
|
15672
15977
|
return [shellQuote(command), ...(args ?? []).map(shellQuote)].join(" ");
|
|
15673
15978
|
}
|
|
15674
15979
|
function getRunEntries() {
|
|
15675
|
-
const { run:
|
|
15980
|
+
const { run: run5 } = loadConfig();
|
|
15676
15981
|
const baseDir = runConfigBaseDir();
|
|
15677
|
-
const configs = resolveRunConfigs(
|
|
15982
|
+
const configs = resolveRunConfigs(run5, baseDir);
|
|
15678
15983
|
return configs.filter((r) => r.name.startsWith("verify:")).map((r) => ({
|
|
15679
15984
|
name: r.name,
|
|
15680
15985
|
fullCommand: buildFullCommand(r.command, r.args),
|
|
@@ -15796,7 +16101,7 @@ function printEntryList(entries) {
|
|
|
15796
16101
|
console.log(` - ${entry.name}`);
|
|
15797
16102
|
}
|
|
15798
16103
|
}
|
|
15799
|
-
async function
|
|
16104
|
+
async function run2(options2 = {}) {
|
|
15800
16105
|
setVerbose(!!options2.verbose);
|
|
15801
16106
|
const allEntries = resolveEntries();
|
|
15802
16107
|
const entries = options2.all ? allEntries : filterByChangedFiles(allEntries);
|
|
@@ -15911,7 +16216,7 @@ async function newCli() {
|
|
|
15911
16216
|
});
|
|
15912
16217
|
writeCliTemplate(name);
|
|
15913
16218
|
await init5();
|
|
15914
|
-
await
|
|
16219
|
+
await run2();
|
|
15915
16220
|
}
|
|
15916
16221
|
|
|
15917
16222
|
// src/commands/new/registerNew/newProject.ts
|
|
@@ -19691,8 +19996,8 @@ async function recordBranchActivity(branchName) {
|
|
|
19691
19996
|
}
|
|
19692
19997
|
|
|
19693
19998
|
// src/commands/branch/generateBranchSlug.ts
|
|
19694
|
-
import { execFile as
|
|
19695
|
-
import { promisify as
|
|
19999
|
+
import { execFile as execFile12 } from "child_process";
|
|
20000
|
+
import { promisify as promisify12 } from "util";
|
|
19696
20001
|
|
|
19697
20002
|
// src/shared/withSpinner.ts
|
|
19698
20003
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -19728,7 +20033,7 @@ function isConciseSlug(slug2) {
|
|
|
19728
20033
|
}
|
|
19729
20034
|
|
|
19730
20035
|
// src/commands/branch/generateBranchSlug.ts
|
|
19731
|
-
var execFileAsync10 =
|
|
20036
|
+
var execFileAsync10 = promisify12(execFile12);
|
|
19732
20037
|
async function generateBranchSlug(description) {
|
|
19733
20038
|
const fallback = deriveBranchSlug(description);
|
|
19734
20039
|
const suggestion = await requestSlug(description);
|
|
@@ -20827,7 +21132,7 @@ async function runPrepared(id, prepared, spawnOptions) {
|
|
|
20827
21132
|
}
|
|
20828
21133
|
|
|
20829
21134
|
// src/commands/backlog/run.ts
|
|
20830
|
-
async function
|
|
21135
|
+
async function run3(id, spawnOptions) {
|
|
20831
21136
|
const itemId2 = parseItemId(id);
|
|
20832
21137
|
const holder = foreignLockHolder(itemId2);
|
|
20833
21138
|
if (holder) {
|
|
@@ -20921,7 +21226,7 @@ async function next(options2, startId) {
|
|
|
20921
21226
|
pendingId = void 0;
|
|
20922
21227
|
firstPick = false;
|
|
20923
21228
|
if (id === void 0) return;
|
|
20924
|
-
const completed = await
|
|
21229
|
+
const completed = await run3(id, options2);
|
|
20925
21230
|
if (!completed || options2?.once) return;
|
|
20926
21231
|
}
|
|
20927
21232
|
}
|
|
@@ -21091,7 +21396,7 @@ async function tryRunById(id, options2) {
|
|
|
21091
21396
|
console.log(chalk85.bold(`
|
|
21092
21397
|
Running backlog item ${label}...
|
|
21093
21398
|
`));
|
|
21094
|
-
await
|
|
21399
|
+
await run3(id, options2);
|
|
21095
21400
|
return true;
|
|
21096
21401
|
}
|
|
21097
21402
|
|
|
@@ -21294,7 +21599,7 @@ function registerRunCommand(cmd) {
|
|
|
21294
21599
|
).action(
|
|
21295
21600
|
async (id, opts) => {
|
|
21296
21601
|
if (!opts.resumeSession) await pullIfConfigured();
|
|
21297
|
-
await
|
|
21602
|
+
await run3(id, {
|
|
21298
21603
|
allowEdits: opts.write !== false,
|
|
21299
21604
|
harness: resolveHarness2(opts.harness),
|
|
21300
21605
|
resumeSessionId: opts.resumeSession
|
|
@@ -26528,11 +26833,11 @@ import { readFileSync as readFileSync37 } from "fs";
|
|
|
26528
26833
|
import chalk149 from "chalk";
|
|
26529
26834
|
|
|
26530
26835
|
// src/commands/browser/formatRunOutcome.ts
|
|
26531
|
-
function formatRunOutcome(
|
|
26532
|
-
if (
|
|
26533
|
-
if (
|
|
26534
|
-
return { ok: false, message: `script threw: ${
|
|
26535
|
-
if (
|
|
26836
|
+
function formatRunOutcome(run5) {
|
|
26837
|
+
if (run5.outcome === "ran") return { ok: true, message: run5.value };
|
|
26838
|
+
if (run5.outcome === "error")
|
|
26839
|
+
return { ok: false, message: `script threw: ${run5.error}` };
|
|
26840
|
+
if (run5.outcome === "declined")
|
|
26536
26841
|
return { ok: false, message: "declined: the user dismissed the script" };
|
|
26537
26842
|
return {
|
|
26538
26843
|
ok: false,
|
|
@@ -28702,8 +29007,8 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
28702
29007
|
import { execSync as execSync41 } from "child_process";
|
|
28703
29008
|
import chalk181 from "chalk";
|
|
28704
29009
|
function resolveMsbuildPath() {
|
|
28705
|
-
const { run:
|
|
28706
|
-
const configs = resolveRunConfigs(
|
|
29010
|
+
const { run: run5 } = loadConfig();
|
|
29011
|
+
const configs = resolveRunConfigs(run5, runConfigBaseDir());
|
|
28707
29012
|
const buildConfig = configs.find((r) => r.name === "build");
|
|
28708
29013
|
return buildConfig?.command ?? "msbuild";
|
|
28709
29014
|
}
|
|
@@ -29053,10 +29358,10 @@ function skipCsharpRawString(content, quote, quoteRun) {
|
|
|
29053
29358
|
cursor++;
|
|
29054
29359
|
continue;
|
|
29055
29360
|
}
|
|
29056
|
-
let
|
|
29057
|
-
while (content[cursor +
|
|
29058
|
-
if (
|
|
29059
|
-
cursor +=
|
|
29361
|
+
let run5 = 0;
|
|
29362
|
+
while (content[cursor + run5] === '"') run5++;
|
|
29363
|
+
if (run5 >= quoteRun) return cursor + run5;
|
|
29364
|
+
cursor += run5;
|
|
29060
29365
|
}
|
|
29061
29366
|
return content.length;
|
|
29062
29367
|
}
|
|
@@ -31730,7 +32035,7 @@ async function scanUnopenedThreads(threadIds, scanThreads, onEvent = () => {
|
|
|
31730
32035
|
async function scanInboxWithCoverage(since, listener) {
|
|
31731
32036
|
const runs = [];
|
|
31732
32037
|
const total2 = () => runs.reduce(addScanUsage, emptyScanUsage());
|
|
31733
|
-
const
|
|
32038
|
+
const run5 = (pass) => {
|
|
31734
32039
|
const slot = runs.push(emptyScanUsage()) - 1;
|
|
31735
32040
|
return runInboxScanClaude(pass, {
|
|
31736
32041
|
...listener,
|
|
@@ -31740,14 +32045,14 @@ async function scanInboxWithCoverage(since, listener) {
|
|
|
31740
32045
|
}
|
|
31741
32046
|
});
|
|
31742
32047
|
};
|
|
31743
|
-
const main = await
|
|
32048
|
+
const main = await run5({
|
|
31744
32049
|
prompt: buildInboxScanPrompt(since),
|
|
31745
32050
|
allowedTools: inboxScanTools.allowed
|
|
31746
32051
|
});
|
|
31747
32052
|
const opened = new Set(main.threads.opened);
|
|
31748
32053
|
const followUp = await scanUnopenedThreads(
|
|
31749
32054
|
main.threads.found.filter((id) => !opened.has(id)),
|
|
31750
|
-
(threadIds) =>
|
|
32055
|
+
(threadIds) => run5({
|
|
31751
32056
|
prompt: buildInboxThreadsPrompt(threadIds),
|
|
31752
32057
|
allowedTools: [inboxScanTools.gmailGetThread]
|
|
31753
32058
|
}),
|
|
@@ -31763,8 +32068,8 @@ async function finishJobRun(db, id, result) {
|
|
|
31763
32068
|
}
|
|
31764
32069
|
|
|
31765
32070
|
// src/shared/db/startJobRun.ts
|
|
31766
|
-
async function startJobRun(db,
|
|
31767
|
-
const [row2] = await db.insert(jobRuns).values({ ...
|
|
32071
|
+
async function startJobRun(db, run5) {
|
|
32072
|
+
const [row2] = await db.insert(jobRuns).values({ ...run5, status: "running" }).returning({ id: jobRuns.id });
|
|
31768
32073
|
return row2.id;
|
|
31769
32074
|
}
|
|
31770
32075
|
|
|
@@ -31830,7 +32135,7 @@ function toRow2(message3) {
|
|
|
31830
32135
|
receivedAt: receivedAt && !Number.isNaN(receivedAt.getTime()) ? receivedAt : null
|
|
31831
32136
|
};
|
|
31832
32137
|
}
|
|
31833
|
-
async function runInboxScan(orm, { trigger, wrap = (_since,
|
|
32138
|
+
async function runInboxScan(orm, { trigger, wrap = (_since, run5) => run5(), ...listener }) {
|
|
31834
32139
|
return withInboxScanJob(orm, trigger, listener, async (tracked) => {
|
|
31835
32140
|
const startedAt = /* @__PURE__ */ new Date();
|
|
31836
32141
|
const since = await readInboxLastScan(orm) ?? new Date(startedAt.getTime() - FIRST_SCAN_LOOKBACK_MS);
|
|
@@ -31848,9 +32153,9 @@ async function runInboxScan(orm, { trigger, wrap = (_since, run4) => run4(), ...
|
|
|
31848
32153
|
async function scan() {
|
|
31849
32154
|
const { flagged, added, usage } = await runInboxScan(await getDb(), {
|
|
31850
32155
|
trigger: "manual",
|
|
31851
|
-
wrap: (since,
|
|
32156
|
+
wrap: (since, run5) => withSpinner(
|
|
31852
32157
|
`Scanning Gmail and Slack (Slack since ${since.toISOString()})`,
|
|
31853
|
-
|
|
32158
|
+
run5
|
|
31854
32159
|
)
|
|
31855
32160
|
});
|
|
31856
32161
|
console.log(
|
|
@@ -32402,14 +32707,14 @@ function enclosingPaths(dirs) {
|
|
|
32402
32707
|
}
|
|
32403
32708
|
|
|
32404
32709
|
// src/commands/sessions/daemon/worktree/pendingPathAction.ts
|
|
32405
|
-
function pendingPathAction(enclosing,
|
|
32710
|
+
function pendingPathAction(enclosing, states2, paths, stopped) {
|
|
32406
32711
|
if (stopped) return { kind: "skip", reason: "install stopped" };
|
|
32407
32712
|
const failed3 = enclosing.find(
|
|
32408
|
-
(j) =>
|
|
32713
|
+
(j) => states2[j] === "failed" || states2[j] === "skipped"
|
|
32409
32714
|
);
|
|
32410
32715
|
if (failed3 !== void 0)
|
|
32411
32716
|
return { kind: "skip", reason: `${paths[failed3]} failed` };
|
|
32412
|
-
if (enclosing.every((j) =>
|
|
32717
|
+
if (enclosing.every((j) => states2[j] === "ok")) return { kind: "start" };
|
|
32413
32718
|
return { kind: "wait" };
|
|
32414
32719
|
}
|
|
32415
32720
|
|
|
@@ -32452,7 +32757,7 @@ function quoteForPosixShell(value) {
|
|
|
32452
32757
|
}
|
|
32453
32758
|
|
|
32454
32759
|
// src/commands/sessions/daemon/worktree/stopInstall.ts
|
|
32455
|
-
import { execFile as
|
|
32760
|
+
import { execFile as execFile13 } from "child_process";
|
|
32456
32761
|
var running2 = /* @__PURE__ */ new Map();
|
|
32457
32762
|
function trackInstall(worktreePath, child) {
|
|
32458
32763
|
const children = running2.get(worktreePath) ?? /* @__PURE__ */ new Set();
|
|
@@ -32478,7 +32783,7 @@ function stopInstall(worktreePath) {
|
|
|
32478
32783
|
}
|
|
32479
32784
|
function killTree(pid) {
|
|
32480
32785
|
if (process.platform === "win32") {
|
|
32481
|
-
|
|
32786
|
+
execFile13(
|
|
32482
32787
|
"taskkill",
|
|
32483
32788
|
["/T", "/F", "/PID", String(pid)],
|
|
32484
32789
|
{ windowsHide: true },
|
|
@@ -32551,32 +32856,32 @@ function startPathInstall(worktreePath, rel, dir, onDone) {
|
|
|
32551
32856
|
function installPaths(worktreePath, paths, onSeeded, onInstalling) {
|
|
32552
32857
|
const dirs = paths.map((rel) => resolve22(worktreePath, rel));
|
|
32553
32858
|
const enclosing = enclosingPaths(dirs);
|
|
32554
|
-
const
|
|
32859
|
+
const states2 = paths.map(() => "pending");
|
|
32555
32860
|
let stopped = false;
|
|
32556
32861
|
const pump = () => {
|
|
32557
32862
|
for (let i = 0; i < paths.length; i++) {
|
|
32558
|
-
if (
|
|
32559
|
-
const action = pendingPathAction(enclosing[i],
|
|
32863
|
+
if (states2[i] !== "pending") continue;
|
|
32864
|
+
const action = pendingPathAction(enclosing[i], states2, paths, stopped);
|
|
32560
32865
|
if (action.kind === "start")
|
|
32561
|
-
|
|
32866
|
+
states2[i] = startPathInstall(
|
|
32562
32867
|
worktreePath,
|
|
32563
32868
|
paths[i],
|
|
32564
32869
|
dirs[i],
|
|
32565
32870
|
(ok, wasStopped) => {
|
|
32566
|
-
|
|
32871
|
+
states2[i] = ok ? "ok" : "failed";
|
|
32567
32872
|
stopped ||= wasStopped;
|
|
32568
32873
|
pump();
|
|
32569
32874
|
}
|
|
32570
32875
|
);
|
|
32571
32876
|
if (action.kind !== "skip") continue;
|
|
32572
|
-
|
|
32877
|
+
states2[i] = "skipped";
|
|
32573
32878
|
daemonLog(
|
|
32574
32879
|
`worktree ${worktreePath} install skipping ${paths[i]}: ${action.reason}`
|
|
32575
32880
|
);
|
|
32576
32881
|
}
|
|
32577
|
-
const running3 = paths.filter((_, i) =>
|
|
32882
|
+
const running3 = paths.filter((_, i) => states2[i] === "running");
|
|
32578
32883
|
if (running3.length > 0) onInstalling(running3.join(", "));
|
|
32579
|
-
else if (!
|
|
32884
|
+
else if (!states2.includes("pending")) onSeeded();
|
|
32580
32885
|
};
|
|
32581
32886
|
pump();
|
|
32582
32887
|
}
|
|
@@ -35326,9 +35631,9 @@ import { execSync as execSync46 } from "child_process";
|
|
|
35326
35631
|
import { execFileSync as execFileSync22 } from "child_process";
|
|
35327
35632
|
|
|
35328
35633
|
// src/commands/prs/azureDevops/azureDevopsThreadActions.ts
|
|
35329
|
-
function attempt(
|
|
35634
|
+
function attempt(run5) {
|
|
35330
35635
|
try {
|
|
35331
|
-
return
|
|
35636
|
+
return run5();
|
|
35332
35637
|
} catch (error) {
|
|
35333
35638
|
failAzureDevops(error);
|
|
35334
35639
|
}
|
|
@@ -42957,8 +43262,8 @@ The review request is at: ${requestPath}
|
|
|
42957
43262
|
}
|
|
42958
43263
|
|
|
42959
43264
|
// src/shared/db/recordJobRun.ts
|
|
42960
|
-
async function recordJobRun(db,
|
|
42961
|
-
await db.insert(jobRuns).values(
|
|
43265
|
+
async function recordJobRun(db, run5) {
|
|
43266
|
+
await db.insert(jobRuns).values(run5);
|
|
42962
43267
|
}
|
|
42963
43268
|
|
|
42964
43269
|
// src/commands/review/recordReviewerRuns.ts
|
|
@@ -46713,136 +47018,6 @@ async function addInternalTester(client, target, email) {
|
|
|
46713
47018
|
return "invited";
|
|
46714
47019
|
}
|
|
46715
47020
|
|
|
46716
|
-
// src/commands/testflight/formatAscError.ts
|
|
46717
|
-
var statusHints = {
|
|
46718
|
-
401: "Check testflight.keyId, testflight.issuerId and that testflight.keyRef points at the matching .p8.",
|
|
46719
|
-
403: "The App Store Connect API key may lack the role this action needs (team invitations need Admin)."
|
|
46720
|
-
};
|
|
46721
|
-
function parseErrors(body) {
|
|
46722
|
-
try {
|
|
46723
|
-
const parsed = JSON.parse(body);
|
|
46724
|
-
return (parsed.errors ?? []).map(
|
|
46725
|
-
(error) => [error.title, error.detail].filter(Boolean).join(": ")
|
|
46726
|
-
);
|
|
46727
|
-
} catch {
|
|
46728
|
-
return body ? [body] : [];
|
|
46729
|
-
}
|
|
46730
|
-
}
|
|
46731
|
-
function formatAscError(method, path109, status2, body) {
|
|
46732
|
-
const lines2 = [
|
|
46733
|
-
`App Store Connect ${method} ${path109} failed (${status2})`,
|
|
46734
|
-
...parseErrors(body).map((line) => ` ${line}`)
|
|
46735
|
-
];
|
|
46736
|
-
const hint = statusHints[status2];
|
|
46737
|
-
if (hint) lines2.push(hint);
|
|
46738
|
-
return lines2.join("\n");
|
|
46739
|
-
}
|
|
46740
|
-
|
|
46741
|
-
// src/commands/testflight/TestflightError.ts
|
|
46742
|
-
var TestflightError = class extends Error {
|
|
46743
|
-
name = "TestflightError";
|
|
46744
|
-
};
|
|
46745
|
-
|
|
46746
|
-
// src/commands/testflight/ascRequest.ts
|
|
46747
|
-
var BASE_URL = "https://api.appstoreconnect.apple.com";
|
|
46748
|
-
async function send(fetchFn, token, method, path109, body) {
|
|
46749
|
-
try {
|
|
46750
|
-
return await fetchFn(`${BASE_URL}${path109}`, {
|
|
46751
|
-
method,
|
|
46752
|
-
headers: {
|
|
46753
|
-
Authorization: `Bearer ${token}`,
|
|
46754
|
-
Accept: "application/json",
|
|
46755
|
-
...body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
46756
|
-
},
|
|
46757
|
-
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
46758
|
-
});
|
|
46759
|
-
} catch (error) {
|
|
46760
|
-
const reason4 = error instanceof Error ? error.message : String(error);
|
|
46761
|
-
throw new TestflightError(`Failed to reach App Store Connect: ${reason4}`);
|
|
46762
|
-
}
|
|
46763
|
-
}
|
|
46764
|
-
async function ascRequest(fetchFn, token, method, path109, body) {
|
|
46765
|
-
const response = await send(fetchFn, token, method, path109, body);
|
|
46766
|
-
const text20 = await response.text();
|
|
46767
|
-
if (!response.ok) {
|
|
46768
|
-
throw new TestflightError(
|
|
46769
|
-
formatAscError(method, path109.split("?")[0], response.status, text20)
|
|
46770
|
-
);
|
|
46771
|
-
}
|
|
46772
|
-
return text20 ? JSON.parse(text20) : void 0;
|
|
46773
|
-
}
|
|
46774
|
-
|
|
46775
|
-
// src/commands/testflight/createAscClient.ts
|
|
46776
|
-
function createAscClient(token, fetchFn = fetch) {
|
|
46777
|
-
return {
|
|
46778
|
-
get: (path109, params) => {
|
|
46779
|
-
const query = params ? `?${new URLSearchParams(params)}` : "";
|
|
46780
|
-
return ascRequest(fetchFn, token, "GET", `${path109}${query}`);
|
|
46781
|
-
},
|
|
46782
|
-
post: (path109, body) => ascRequest(fetchFn, token, "POST", path109, body)
|
|
46783
|
-
};
|
|
46784
|
-
}
|
|
46785
|
-
|
|
46786
|
-
// src/commands/testflight/createAscToken.ts
|
|
46787
|
-
import { createPrivateKey, sign } from "crypto";
|
|
46788
|
-
var TOKEN_LIFETIME_SECONDS = 20 * 60;
|
|
46789
|
-
function base64url(value) {
|
|
46790
|
-
return Buffer.from(JSON.stringify(value)).toString("base64url");
|
|
46791
|
-
}
|
|
46792
|
-
function createAscToken(options2) {
|
|
46793
|
-
const iat = Math.floor((options2.now ?? Date.now()) / 1e3);
|
|
46794
|
-
const header = { alg: "ES256", kid: options2.keyId, typ: "JWT" };
|
|
46795
|
-
const payload = {
|
|
46796
|
-
iss: options2.issuerId,
|
|
46797
|
-
iat,
|
|
46798
|
-
exp: iat + TOKEN_LIFETIME_SECONDS,
|
|
46799
|
-
aud: "appstoreconnect-v1"
|
|
46800
|
-
};
|
|
46801
|
-
const signingInput = `${base64url(header)}.${base64url(payload)}`;
|
|
46802
|
-
const signature = sign("sha256", Buffer.from(signingInput), {
|
|
46803
|
-
key: createPrivateKey(options2.privateKey),
|
|
46804
|
-
dsaEncoding: "ieee-p1363"
|
|
46805
|
-
});
|
|
46806
|
-
return `${signingInput}.${signature.toString("base64url")}`;
|
|
46807
|
-
}
|
|
46808
|
-
|
|
46809
|
-
// src/commands/testflight/findAppId.ts
|
|
46810
|
-
async function findAppId(client, bundleId) {
|
|
46811
|
-
const { data } = await client.get("/v1/apps", {
|
|
46812
|
-
"filter[bundleId]": bundleId,
|
|
46813
|
-
"fields[apps]": "bundleId"
|
|
46814
|
-
});
|
|
46815
|
-
const app = data.find((item) => item.attributes?.bundleId === bundleId);
|
|
46816
|
-
if (!app) {
|
|
46817
|
-
throw new TestflightError(
|
|
46818
|
-
`No App Store Connect app has bundle id ${bundleId} (testflight.bundleId)`
|
|
46819
|
-
);
|
|
46820
|
-
}
|
|
46821
|
-
return app.id;
|
|
46822
|
-
}
|
|
46823
|
-
|
|
46824
|
-
// src/commands/testflight/findBetaGroupId.ts
|
|
46825
|
-
async function findBetaGroupId(client, appId, lookup) {
|
|
46826
|
-
const { data } = await client.get(`/v1/apps/${appId}/betaGroups`, {
|
|
46827
|
-
"fields[betaGroups]": "name,isInternalGroup",
|
|
46828
|
-
limit: "200"
|
|
46829
|
-
});
|
|
46830
|
-
const group = data.find((item) => item.attributes?.name === lookup.name);
|
|
46831
|
-
if (!group) {
|
|
46832
|
-
const available = data.map((item) => String(item.attributes?.name)).join(", ");
|
|
46833
|
-
throw new TestflightError(
|
|
46834
|
-
`No beta group named "${lookup.name}" (${lookup.configKey}). Available groups: ${available || "none"}`
|
|
46835
|
-
);
|
|
46836
|
-
}
|
|
46837
|
-
if (Boolean(group.attributes?.isInternalGroup) !== lookup.internal) {
|
|
46838
|
-
const kind = lookup.internal ? "an internal" : "an external";
|
|
46839
|
-
throw new TestflightError(
|
|
46840
|
-
`Beta group "${lookup.name}" (${lookup.configKey}) must be ${kind} group`
|
|
46841
|
-
);
|
|
46842
|
-
}
|
|
46843
|
-
return group.id;
|
|
46844
|
-
}
|
|
46845
|
-
|
|
46846
47021
|
// src/commands/testflight/requireInternalGroup.ts
|
|
46847
47022
|
function requireInternalGroup(config) {
|
|
46848
47023
|
if (config.internalGroup) return config.internalGroup;
|
|
@@ -46857,14 +47032,7 @@ function requireInternalGroup(config) {
|
|
|
46857
47032
|
// src/commands/testflight/addTester.ts
|
|
46858
47033
|
async function addTester(config, email, options2 = {}) {
|
|
46859
47034
|
const internalGroup = options2.internal ? requireInternalGroup(config) : void 0;
|
|
46860
|
-
const
|
|
46861
|
-
const token = createAscToken({
|
|
46862
|
-
keyId: config.keyId,
|
|
46863
|
-
issuerId: config.issuerId,
|
|
46864
|
-
privateKey
|
|
46865
|
-
});
|
|
46866
|
-
const client = createAscClient(token, options2.fetchFn);
|
|
46867
|
-
const appId = await findAppId(client, config.bundleId);
|
|
47035
|
+
const { client, appId } = await connectAsc(config, options2);
|
|
46868
47036
|
const groupId = await findBetaGroupId(client, appId, {
|
|
46869
47037
|
name: internalGroup ?? config.externalGroup,
|
|
46870
47038
|
configKey: internalGroup ? "testflight.internalGroup" : "testflight.externalGroup",
|
|
@@ -46873,31 +47041,6 @@ async function addTester(config, email, options2 = {}) {
|
|
|
46873
47041
|
return internalGroup ? addInternalTester(client, { appId, groupId }, email) : addToBetaGroup(client, groupId, email);
|
|
46874
47042
|
}
|
|
46875
47043
|
|
|
46876
|
-
// src/commands/testflight/readTestflightConfig.ts
|
|
46877
|
-
var requiredKeys = [
|
|
46878
|
-
"keyId",
|
|
46879
|
-
"issuerId",
|
|
46880
|
-
"keyRef",
|
|
46881
|
-
"bundleId",
|
|
46882
|
-
"externalGroup"
|
|
46883
|
-
];
|
|
46884
|
-
function readTestflightConfig(config) {
|
|
46885
|
-
const testflight = config.testflight ?? {};
|
|
46886
|
-
const missing = requiredKeys.filter((key) => !testflight[key]);
|
|
46887
|
-
if (missing.length > 0) {
|
|
46888
|
-
const lines2 = missing.map((key) => {
|
|
46889
|
-
const entry = testflightConfigHelp.find(
|
|
46890
|
-
(help) => help.key === `testflight.${key}`
|
|
46891
|
-
);
|
|
46892
|
-
return ` testflight.${key} is not set. Set it with: ${entry?.setter}`;
|
|
46893
|
-
});
|
|
46894
|
-
throw new TestflightError(
|
|
46895
|
-
["TestFlight is not configured", ...lines2].join("\n")
|
|
46896
|
-
);
|
|
46897
|
-
}
|
|
46898
|
-
return testflight;
|
|
46899
|
-
}
|
|
46900
|
-
|
|
46901
47044
|
// src/commands/testflight/testflightAdd.ts
|
|
46902
47045
|
var messages = {
|
|
46903
47046
|
created: (email, group) => `Invited ${email} to TestFlight group "${group}"`,
|
|
@@ -48375,7 +48518,7 @@ function runScope(scope, options2) {
|
|
|
48375
48518
|
console.error(`Unknown scope: "${scope}". Use "all" to run all checks.`);
|
|
48376
48519
|
process.exit(1);
|
|
48377
48520
|
}
|
|
48378
|
-
|
|
48521
|
+
run2({ ...options2, all: scope === "all" });
|
|
48379
48522
|
}
|
|
48380
48523
|
function registerVerify(program) {
|
|
48381
48524
|
const verifyCommand = program.command("verify").description("Run all verify:* commands in parallel").argument(
|
|
@@ -48535,8 +48678,8 @@ function exitWithAmbiguousConfig(name, matches) {
|
|
|
48535
48678
|
process.exit(1);
|
|
48536
48679
|
}
|
|
48537
48680
|
function requireRunConfigs() {
|
|
48538
|
-
const { run:
|
|
48539
|
-
const configs = resolveRunConfigs(
|
|
48681
|
+
const { run: run5 } = loadConfig();
|
|
48682
|
+
const configs = resolveRunConfigs(run5, runConfigBaseDir());
|
|
48540
48683
|
if (configs.length === 0) return exitNoRunConfigs();
|
|
48541
48684
|
return configs;
|
|
48542
48685
|
}
|
|
@@ -49379,10 +49522,10 @@ async function tryBacklogRunAlias(name, args) {
|
|
|
49379
49522
|
if (!/^a?\d+$/.test(name)) return false;
|
|
49380
49523
|
if (lookupRunConfig(name).kind !== "not-found") return false;
|
|
49381
49524
|
await pullIfConfigured();
|
|
49382
|
-
await
|
|
49525
|
+
await run3(name, parseBacklogRunOptions(name, args));
|
|
49383
49526
|
return true;
|
|
49384
49527
|
}
|
|
49385
|
-
async function
|
|
49528
|
+
async function run4(name, args) {
|
|
49386
49529
|
if (!name) {
|
|
49387
49530
|
console.error("error: missing required argument 'name'");
|
|
49388
49531
|
console.error(formatConfiguredCommands());
|
|
@@ -49450,8 +49593,8 @@ import { dirname as dirname47 } from "path";
|
|
|
49450
49593
|
async function editRepoRunList(repoName, cwd, edit2) {
|
|
49451
49594
|
const orm = await getDb();
|
|
49452
49595
|
const { label, block } = await resolveSharedRepoBlock(orm, repoName, cwd);
|
|
49453
|
-
const
|
|
49454
|
-
const updated2 = { ...block, run:
|
|
49596
|
+
const run5 = edit2(block.run ?? [], label);
|
|
49597
|
+
const updated2 = { ...block, run: run5 };
|
|
49455
49598
|
const validation = validateConfig(updated2, "run", repoConfigSchema);
|
|
49456
49599
|
if (!validation.ok) exitWithConfigErrors(validation.errors);
|
|
49457
49600
|
await saveSharedRepoBlock(orm, label, updated2);
|
|
@@ -49813,7 +49956,7 @@ function registerRun(program) {
|
|
|
49813
49956
|
const runCommand = program.command("run").description("Run a configured command from assist.yml").argument("[name]", "Name of the configured command").argument("[args...]", "Arguments to pass to the command").allowUnknownOption().addHelpText(
|
|
49814
49957
|
"after",
|
|
49815
49958
|
"\nAn a-prefixed item id (e.g. a555) with no matching command is an alias for\n'assist backlog run <id>' (forwards --write/--no-write/-w)."
|
|
49816
|
-
).addHelpText("after", () => formatConfiguredCommands()).action((name, args) =>
|
|
49959
|
+
).addHelpText("after", () => formatConfiguredCommands()).action((name, args) => run4(name, args));
|
|
49817
49960
|
configHelp(runCommand, runConfigHelp);
|
|
49818
49961
|
registerRunSubcommands(runCommand);
|
|
49819
49962
|
}
|
|
@@ -50136,17 +50279,17 @@ function outcomeEvent(outcome) {
|
|
|
50136
50279
|
}
|
|
50137
50280
|
|
|
50138
50281
|
// src/shared/db/writeInboxLastRun.ts
|
|
50139
|
-
async function writeInboxLastRun(orm,
|
|
50140
|
-
const value = JSON.stringify(
|
|
50282
|
+
async function writeInboxLastRun(orm, run5) {
|
|
50283
|
+
const value = JSON.stringify(run5);
|
|
50141
50284
|
await orm.insert(metadata).values({ key: INBOX_LAST_RUN_KEY, value }).onConflictDoUpdate({ target: metadata.key, set: { value } });
|
|
50142
50285
|
}
|
|
50143
50286
|
|
|
50144
50287
|
// src/commands/sessions/daemon/inbox/saveScanRun.ts
|
|
50145
|
-
async function saveScanRun(
|
|
50288
|
+
async function saveScanRun(run5) {
|
|
50146
50289
|
try {
|
|
50147
|
-
await writeInboxLastRun(await getDb(),
|
|
50290
|
+
await writeInboxLastRun(await getDb(), run5);
|
|
50148
50291
|
daemonLog(
|
|
50149
|
-
`inbox: saved last scan run (${
|
|
50292
|
+
`inbox: saved last scan run (${run5.status}, ${run5.events.length} event(s))`
|
|
50150
50293
|
);
|
|
50151
50294
|
} catch (error) {
|
|
50152
50295
|
daemonLog(`inbox: saving the last scan run failed: ${String(error)}`);
|
|
@@ -50156,12 +50299,12 @@ async function saveScanRun(run4) {
|
|
|
50156
50299
|
// src/commands/sessions/daemon/inbox/createScanRunLog.ts
|
|
50157
50300
|
var MAX_EVENTS = 1e3;
|
|
50158
50301
|
function createScanRunLog(onActivity) {
|
|
50159
|
-
let
|
|
50302
|
+
let run5;
|
|
50160
50303
|
const throttle = createActivityThrottle(onActivity);
|
|
50161
50304
|
return {
|
|
50162
|
-
current: () =>
|
|
50305
|
+
current: () => run5,
|
|
50163
50306
|
begin() {
|
|
50164
|
-
|
|
50307
|
+
run5 = {
|
|
50165
50308
|
status: "scanning",
|
|
50166
50309
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
50167
50310
|
finishedAt: null,
|
|
@@ -50170,27 +50313,27 @@ function createScanRunLog(onActivity) {
|
|
|
50170
50313
|
};
|
|
50171
50314
|
},
|
|
50172
50315
|
onEvent(event) {
|
|
50173
|
-
if (!
|
|
50174
|
-
|
|
50316
|
+
if (!run5 || run5.events.length >= MAX_EVENTS) return;
|
|
50317
|
+
run5.events.push(event);
|
|
50175
50318
|
throttle.schedule();
|
|
50176
50319
|
},
|
|
50177
50320
|
onUsage(usage) {
|
|
50178
|
-
if (!
|
|
50179
|
-
|
|
50321
|
+
if (!run5) return;
|
|
50322
|
+
run5.usage = usage;
|
|
50180
50323
|
throttle.schedule();
|
|
50181
50324
|
},
|
|
50182
50325
|
async end(outcome) {
|
|
50183
50326
|
throttle.cancel();
|
|
50184
|
-
if (!
|
|
50185
|
-
|
|
50186
|
-
|
|
50187
|
-
|
|
50188
|
-
await saveScanRun(
|
|
50327
|
+
if (!run5) return;
|
|
50328
|
+
run5.events.push(outcomeEvent(outcome));
|
|
50329
|
+
run5.status = outcome.ok ? "finished" : "failed";
|
|
50330
|
+
run5.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
50331
|
+
await saveScanRun(run5);
|
|
50189
50332
|
},
|
|
50190
50333
|
async restore() {
|
|
50191
50334
|
const saved = await loadScanRun();
|
|
50192
|
-
if (
|
|
50193
|
-
|
|
50335
|
+
if (run5 || !saved) return;
|
|
50336
|
+
run5 = saved;
|
|
50194
50337
|
onActivity();
|
|
50195
50338
|
}
|
|
50196
50339
|
};
|
|
@@ -51419,8 +51562,8 @@ function createHarnessSession(id, harness, prompt, cwd, holdPty) {
|
|
|
51419
51562
|
// src/commands/sessions/daemon/resolveRunConfig.ts
|
|
51420
51563
|
function resolveRunConfig(name, cwd) {
|
|
51421
51564
|
try {
|
|
51422
|
-
const { run:
|
|
51423
|
-
const configs = resolveRunConfigs(
|
|
51565
|
+
const { run: run5 } = loadConfigFrom(cwd);
|
|
51566
|
+
const configs = resolveRunConfigs(run5, runConfigBaseDirFrom(cwd));
|
|
51424
51567
|
const exact = configs.find((r) => r.name === name);
|
|
51425
51568
|
if (exact) return exact;
|
|
51426
51569
|
const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
|
|
@@ -52780,14 +52923,14 @@ function flushPhaseActiveMs(session) {
|
|
|
52780
52923
|
if (!phase) return Promise.resolve();
|
|
52781
52924
|
const since = session.runningSince;
|
|
52782
52925
|
const elapsed = Date.now() - since;
|
|
52783
|
-
const
|
|
52926
|
+
const run5 = async () => {
|
|
52784
52927
|
const flushed = session.activeMsFlushedForStretch?.since === since ? session.activeMsFlushedForStretch.ms : 0;
|
|
52785
52928
|
const delta = elapsed - flushed;
|
|
52786
52929
|
if (delta <= 0) return;
|
|
52787
52930
|
if (await persistPhaseActiveMs(phase.itemId, phase.phaseIdx, delta))
|
|
52788
52931
|
session.activeMsFlushedForStretch = { since, ms: flushed + delta };
|
|
52789
52932
|
};
|
|
52790
|
-
const chain2 = (session.activeMsFlushChain ?? Promise.resolve()).then(
|
|
52933
|
+
const chain2 = (session.activeMsFlushChain ?? Promise.resolve()).then(run5);
|
|
52791
52934
|
session.activeMsFlushChain = chain2;
|
|
52792
52935
|
return chain2;
|
|
52793
52936
|
}
|
|
@@ -53158,9 +53301,9 @@ function isBacklogItemId(text20) {
|
|
|
53158
53301
|
}
|
|
53159
53302
|
|
|
53160
53303
|
// src/commands/sessions/daemon/generateSessionTitle.ts
|
|
53161
|
-
import { execFile as
|
|
53162
|
-
import { promisify as
|
|
53163
|
-
var execFileAsync11 =
|
|
53304
|
+
import { execFile as execFile14 } from "child_process";
|
|
53305
|
+
import { promisify as promisify13 } from "util";
|
|
53306
|
+
var execFileAsync11 = promisify13(execFile14);
|
|
53164
53307
|
var SESSION_TITLE_MAX_LENGTH = 48;
|
|
53165
53308
|
async function generateSessionTitle(prompt) {
|
|
53166
53309
|
try {
|
|
@@ -54046,7 +54189,7 @@ function watchTranscript(session, notify2, onStatusChange) {
|
|
|
54046
54189
|
session.transcriptFingerprint = void 0;
|
|
54047
54190
|
const fileName = `${session.claudeSessionId}.jsonl`;
|
|
54048
54191
|
let timer = null;
|
|
54049
|
-
const
|
|
54192
|
+
const run5 = () => {
|
|
54050
54193
|
timer = null;
|
|
54051
54194
|
void reconcileTranscriptStatus(session, onStatusChange, notify2);
|
|
54052
54195
|
startTranscriptTitleGeneration(session, notify2);
|
|
@@ -54055,7 +54198,7 @@ function watchTranscript(session, notify2, onStatusChange) {
|
|
|
54055
54198
|
session.transcriptWatcher = watch3(dir, (_event, changed) => {
|
|
54056
54199
|
if (changed && changed !== fileName) return;
|
|
54057
54200
|
if (timer) clearTimeout(timer);
|
|
54058
|
-
timer = setTimeout(
|
|
54201
|
+
timer = setTimeout(run5, DEBOUNCE_MS3);
|
|
54059
54202
|
});
|
|
54060
54203
|
} catch (error) {
|
|
54061
54204
|
daemonLog(
|
|
@@ -54065,7 +54208,7 @@ function watchTranscript(session, notify2, onStatusChange) {
|
|
|
54065
54208
|
}
|
|
54066
54209
|
session.watchedTranscriptId = session.claudeSessionId;
|
|
54067
54210
|
daemonLog(`session ${session.id} watching transcript ${fileName}`);
|
|
54068
|
-
|
|
54211
|
+
run5();
|
|
54069
54212
|
}
|
|
54070
54213
|
|
|
54071
54214
|
// src/commands/sessions/daemon/wireSessionWatchers.ts
|
|
@@ -58001,16 +58144,16 @@ function latestServerRun(sessions, origin, group) {
|
|
|
58001
58144
|
function resolveTarget3(m, d) {
|
|
58002
58145
|
const server = d.server;
|
|
58003
58146
|
if (!server) return { sessionId: d.sessionId };
|
|
58004
|
-
let
|
|
58147
|
+
let run5;
|
|
58005
58148
|
m.update((sessions) => {
|
|
58006
|
-
|
|
58149
|
+
run5 = latestServerRun(sessions, server.origin, server.group);
|
|
58007
58150
|
return false;
|
|
58008
58151
|
});
|
|
58009
|
-
if (!
|
|
58152
|
+
if (!run5)
|
|
58010
58153
|
return {
|
|
58011
58154
|
error: `No live server run for ${server.origin} (${server.group})`
|
|
58012
58155
|
};
|
|
58013
|
-
return
|
|
58156
|
+
return run5.status === "done" || run5.status === "error" ? { sessionId: run5.id, exited: run5.status } : { sessionId: run5.id };
|
|
58014
58157
|
}
|
|
58015
58158
|
var handleOutputRequest = (client, m, d) => {
|
|
58016
58159
|
const target = resolveTarget3(m, d);
|
|
@@ -58527,12 +58670,12 @@ function isPrCheckoutArgs(args) {
|
|
|
58527
58670
|
}
|
|
58528
58671
|
|
|
58529
58672
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
58530
|
-
import { execFile as
|
|
58673
|
+
import { execFile as execFile15 } from "child_process";
|
|
58531
58674
|
import { existsSync as existsSync108 } from "fs";
|
|
58532
58675
|
function prHeadBranch2(number, cwd) {
|
|
58533
58676
|
const { headBranch } = prCliCommands(number, cwd);
|
|
58534
58677
|
return new Promise((resolve34) => {
|
|
58535
|
-
|
|
58678
|
+
execFile15(
|
|
58536
58679
|
headBranch.file,
|
|
58537
58680
|
headBranch.args,
|
|
58538
58681
|
{ cwd, encoding: "utf8", windowsHide: true },
|