@pome-sh/cli 0.21.11 → 0.21.13
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/build-info.json +3 -3
- package/dist/{checks-FLXH5OG3.js → checks-MM2OJJES.js} +1 -1
- package/dist/{chunk-6BCL7HYR.js → chunk-2TSYKRER.js} +1 -1
- package/dist/{chunk-563RZ7P3.js → chunk-BV35ZSB6.js} +3 -3
- package/dist/{chunk-OR4X4BIY.js → chunk-CC27LWIA.js} +1 -1
- package/dist/{chunk-EI5ECLLN.js → chunk-M7HRXBVU.js} +2 -2
- package/dist/{chunk-75SDBO3W.js → chunk-UCLRWEKB.js} +1 -1
- package/dist/{runDemo-7ZNVR4GX.js → runDemo-4ASIOIMV.js} +4 -4
- package/dist/{runTrialGroup-7KEOFQEU.js → runTrialGroup-UQKE6XQF.js} +3 -3
- package/dist/src/cli/main.js +12 -12
- package/dist/{src-RDRKZ4FM.js → src-5RPY72NF.js} +83 -12
- package/dist/twinHarness-BHSSYAEG.js +5 -0
- package/dist/{twinStart-Y525LQUR.js → twinStart-TTVUZ7PC.js} +2 -2
- package/package.json +1 -1
- package/dist/twinHarness-4RDIJIM7.js +0 -5
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "pome-sh",
|
|
3
|
-
"version": "0.21.
|
|
4
|
-
"git_sha": "
|
|
5
|
-
"build_time": "2026-08-
|
|
3
|
+
"version": "0.21.13",
|
|
4
|
+
"git_sha": "703150e1dcc8c14087b2eee0fb4e74d00794b85c",
|
|
5
|
+
"build_time": "2026-08-07T23:11:06.928Z"
|
|
6
6
|
}
|
|
@@ -183,7 +183,7 @@ async function checkTwinReachable(_configDir) {
|
|
|
183
183
|
});
|
|
184
184
|
let harness;
|
|
185
185
|
try {
|
|
186
|
-
const { bootTwin } = await import('./twinHarness-
|
|
186
|
+
const { bootTwin } = await import('./twinHarness-BHSSYAEG.js');
|
|
187
187
|
harness = await bootTwin({
|
|
188
188
|
twin: "github",
|
|
189
189
|
seedState: void 0,
|
|
@@ -2,7 +2,7 @@ import { criterionSchema, finalizeResponseSchema, HostedDiscardRefusedError, Hos
|
|
|
2
2
|
import { seedSchema, parseSeed, defaultSeedState as defaultSeedState$2 } from './chunk-SGDUD7KK.js';
|
|
3
3
|
import { gmailSeedSchema, defaultSeedState } from './chunk-NJ246QPJ.js';
|
|
4
4
|
import { linearSeedSchema, defaultSeedState as defaultSeedState$1 } from './chunk-ZKID2HS3.js';
|
|
5
|
-
import { isTwinName, TWIN_REGISTRY } from './chunk-
|
|
5
|
+
import { isTwinName, TWIN_REGISTRY } from './chunk-BV35ZSB6.js';
|
|
6
6
|
import { toTwinHttpEventRow } from './chunk-TV5S6WQV.js';
|
|
7
7
|
import { redactEvent, redactSecrets } from './chunk-SG6ZTIMT.js';
|
|
8
8
|
import { mkdir, appendFile, writeFile, readFile } from 'node:fs/promises';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ../packages/twin-github/package.json
|
|
2
2
|
var package_default = {
|
|
3
|
-
version: "0.9.
|
|
3
|
+
version: "0.9.3"};
|
|
4
4
|
|
|
5
5
|
// ../packages/twin-slack/package.json
|
|
6
6
|
var package_default2 = {
|
|
@@ -39,7 +39,7 @@ var TWIN_REGISTRY = {
|
|
|
39
39
|
defaultSeedState,
|
|
40
40
|
GitHubDomain,
|
|
41
41
|
openGitHubCloneDatabase
|
|
42
|
-
} = await import('./src-
|
|
42
|
+
} = await import('./src-5RPY72NF.js');
|
|
43
43
|
const db = openGitHubCloneDatabase();
|
|
44
44
|
const domain = new GitHubDomain(db);
|
|
45
45
|
domain.seed(seedState === void 0 ? defaultSeedState() : seedState);
|
|
@@ -173,7 +173,7 @@ var TWIN_REGISTRY = {
|
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
175
|
async function createGitHubSmokeApp() {
|
|
176
|
-
const { createGitHubCloneApp } = await import('./src-
|
|
176
|
+
const { createGitHubCloneApp } = await import('./src-5RPY72NF.js');
|
|
177
177
|
return createGitHubCloneApp();
|
|
178
178
|
}
|
|
179
179
|
function defaultPortFor(twin, env = process.env) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TWIN_NAMES, isTwinName, TWIN_REGISTRY } from './chunk-
|
|
1
|
+
import { TWIN_NAMES, isTwinName, TWIN_REGISTRY } from './chunk-BV35ZSB6.js';
|
|
2
2
|
import { createFileBackedRecorderStore, createRecorderStore } from './chunk-TV5S6WQV.js';
|
|
3
3
|
|
|
4
4
|
// src/recorder/recorder.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAvailablePort } from './chunk-XDU6TD4O.js';
|
|
2
2
|
import { buildEgressAllowlist, readBlockedEgress } from './chunk-CBFKZZBR.js';
|
|
3
|
-
import { parseTaskFile, seedStateForTwin, runAgentCommand, writeRunArtifactsCore } from './chunk-
|
|
4
|
-
import { createRecorder, bootTwin } from './chunk-
|
|
3
|
+
import { parseTaskFile, seedStateForTwin, runAgentCommand, writeRunArtifactsCore } from './chunk-2TSYKRER.js';
|
|
4
|
+
import { createRecorder, bootTwin } from './chunk-CC27LWIA.js';
|
|
5
5
|
import { eventSchema } from './chunk-VBATFCWR.js';
|
|
6
6
|
import { redactSecrets, redactEvent } from './chunk-SG6ZTIMT.js';
|
|
7
7
|
import { serve } from '@hono/node-server';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readManifest, normalizeManifestTwins } from './chunk-KUVTL4NZ.js';
|
|
2
|
-
import { createHostedClient, perTwinReturnedByCloud, parseTaskFile, runAgentCommand, writeRunArtifactsCore, toTwinHttpEvent, redactJsonl, uploadRunBlobs, scoreFromFinalizeResponse, scoreStatus } from './chunk-
|
|
2
|
+
import { createHostedClient, perTwinReturnedByCloud, parseTaskFile, runAgentCommand, writeRunArtifactsCore, toTwinHttpEvent, redactJsonl, uploadRunBlobs, scoreFromFinalizeResponse, scoreStatus } from './chunk-2TSYKRER.js';
|
|
3
3
|
import { MOUNTED_TWINS, HostedAuthError, HostedDiscardRefusedError, HostedQuotaError, HostedOrchError, HostedTrialError, agentResponseSchema } from './chunk-PQYIAA6K.js';
|
|
4
4
|
import { redactSecrets, redactEvent } from './chunk-SG6ZTIMT.js';
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { newGroupId, reassuranceBox, twinReadyLine, trialsHeaderLine, trialLine, summaryLines, evaluatingLine, criterionPhrase } from './chunk-RGZBC7NF.js';
|
|
2
2
|
import { DemoCapacityError, capacityLabel, parseCapacityMarker, capacityKindFrom } from './chunk-ZX4WNSZ5.js';
|
|
3
|
-
import { runTask, demoTaskPath, DEMO_TASK_NAME, DEMO_REPO } from './chunk-
|
|
3
|
+
import { runTask, demoTaskPath, DEMO_TASK_NAME, DEMO_REPO } from './chunk-M7HRXBVU.js';
|
|
4
4
|
import { getAvailablePort } from './chunk-XDU6TD4O.js';
|
|
5
5
|
import './chunk-CBFKZZBR.js';
|
|
6
|
-
import { createHostedClient, parseTaskFile, uploadRunBlobs, scoreFromFinalizeResponse, scoreStatus, outcomeOf } from './chunk-
|
|
6
|
+
import { createHostedClient, parseTaskFile, uploadRunBlobs, scoreFromFinalizeResponse, scoreStatus, outcomeOf } from './chunk-2TSYKRER.js';
|
|
7
7
|
import './chunk-NW7HGA2K.js';
|
|
8
8
|
import { HostedQuotaError, HostedOrchError } from './chunk-PQYIAA6K.js';
|
|
9
9
|
import './chunk-SGDUD7KK.js';
|
|
10
10
|
import './chunk-NJ246QPJ.js';
|
|
11
11
|
import './chunk-ZKID2HS3.js';
|
|
12
|
-
import { bootTwin } from './chunk-
|
|
13
|
-
import './chunk-
|
|
12
|
+
import { bootTwin } from './chunk-CC27LWIA.js';
|
|
13
|
+
import './chunk-BV35ZSB6.js';
|
|
14
14
|
import './chunk-TV5S6WQV.js';
|
|
15
15
|
import './chunk-VBATFCWR.js';
|
|
16
16
|
import './chunk-SG6ZTIMT.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { newGroupId, criterionPhrase } from './chunk-RGZBC7NF.js';
|
|
2
|
-
import { runTaskHosted, resolveRunAgentIdentity } from './chunk-
|
|
2
|
+
import { runTaskHosted, resolveRunAgentIdentity } from './chunk-UCLRWEKB.js';
|
|
3
3
|
import './chunk-KUVTL4NZ.js';
|
|
4
|
-
import { createHostedClient, parseTaskFile, outcomeOf } from './chunk-
|
|
4
|
+
import { createHostedClient, parseTaskFile, outcomeOf } from './chunk-2TSYKRER.js';
|
|
5
5
|
import './chunk-NW7HGA2K.js';
|
|
6
6
|
import { HostedQuotaError, HostedTrialError } from './chunk-PQYIAA6K.js';
|
|
7
7
|
import './chunk-SGDUD7KK.js';
|
|
8
8
|
import './chunk-NJ246QPJ.js';
|
|
9
9
|
import './chunk-ZKID2HS3.js';
|
|
10
|
-
import './chunk-
|
|
10
|
+
import './chunk-BV35ZSB6.js';
|
|
11
11
|
import './chunk-TV5S6WQV.js';
|
|
12
12
|
import './chunk-VBATFCWR.js';
|
|
13
13
|
import './chunk-SG6ZTIMT.js';
|
package/dist/src/cli/main.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { DEFAULT_CONTROL_PLANE_URL, DEFAULT_DASHBOARD_URL, clearLocalCredentials, friendlyHostedError, runSessionCreate, runSessionList, runSessionStop, resolveCredentials, runTaskHosted, discoverRunSet, loadTrialEvents, persistCredentialsAfterLogin, DEFAULT_DOCS_SITE_ORIGIN, resolveSeams, resolveCachedAgentId, readLinkCache, postAgentResolver, writeLinkCache, ensurePomeGitignored } from '../../chunk-
|
|
2
|
+
import { DEFAULT_CONTROL_PLANE_URL, DEFAULT_DASHBOARD_URL, clearLocalCredentials, friendlyHostedError, runSessionCreate, runSessionList, runSessionStop, resolveCredentials, runTaskHosted, discoverRunSet, loadTrialEvents, persistCredentialsAfterLogin, DEFAULT_DOCS_SITE_ORIGIN, resolveSeams, resolveCachedAgentId, readLinkCache, postAgentResolver, writeLinkCache, ensurePomeGitignored } from '../../chunk-UCLRWEKB.js';
|
|
3
3
|
import { readManifest, writeManifest, MANIFEST_JSON, readRequiredManifest, normalizeManifestTwins } from '../../chunk-KUVTL4NZ.js';
|
|
4
|
-
import { assetPath, runTask, resolvePackageRoot, DEMO_TASK_NAME, demoTaskPath } from '../../chunk-
|
|
4
|
+
import { assetPath, runTask, resolvePackageRoot, DEMO_TASK_NAME, demoTaskPath } from '../../chunk-M7HRXBVU.js';
|
|
5
5
|
import '../../chunk-XDU6TD4O.js';
|
|
6
6
|
import '../../chunk-CBFKZZBR.js';
|
|
7
|
-
import { parseTaskFile, scoreStatus, runScoreLine, readLatestRun, readMetaSummary, readConfigTwins, scoreCountsSummary, markerFor, outcomeOf, criterionMarkerLabel, twinSkipSuffix, readCodeCriteria, createHostedClient, toTwinHttpEvent, redactJsonl, scoreFromFinalizeResponse, parseGitHubSeedState, uploadRunBlobs } from '../../chunk-
|
|
7
|
+
import { parseTaskFile, scoreStatus, runScoreLine, readLatestRun, readMetaSummary, readConfigTwins, scoreCountsSummary, markerFor, outcomeOf, criterionMarkerLabel, twinSkipSuffix, readCodeCriteria, createHostedClient, toTwinHttpEvent, redactJsonl, scoreFromFinalizeResponse, parseGitHubSeedState, uploadRunBlobs } from '../../chunk-2TSYKRER.js';
|
|
8
8
|
import '../../chunk-NW7HGA2K.js';
|
|
9
9
|
import { MOUNTED_TWINS, deriveAgentSlug, exitCodeFor, HostedUsageError, HostedOrchError, HostedAuthError, HostedQuotaError } from '../../chunk-PQYIAA6K.js';
|
|
10
10
|
import { TAPE_ASSERTABLE_TOOLS } from '../../chunk-FKZZWWYC.js';
|
|
@@ -15,8 +15,8 @@ import '../../chunk-NJ246QPJ.js';
|
|
|
15
15
|
import { LINEAR_CHECKS } from '../../chunk-3QVSXFJI.js';
|
|
16
16
|
import '../../chunk-ZKID2HS3.js';
|
|
17
17
|
import { oneOf, defineCheck, repoRef, VACUITY_SENTINEL_NUMBER, childStatePath, VACUITY_SENTINEL, statePath, templateSlots, renderCheck, checksDigest, checkPattern, checkNearMissPattern } from '../../chunk-NY55QTVQ.js';
|
|
18
|
-
import '../../chunk-
|
|
19
|
-
import { TWIN_NAME_LIST, isTwinName, createGitHubSmokeApp } from '../../chunk-
|
|
18
|
+
import '../../chunk-CC27LWIA.js';
|
|
19
|
+
import { TWIN_NAME_LIST, isTwinName, createGitHubSmokeApp } from '../../chunk-BV35ZSB6.js';
|
|
20
20
|
import '../../chunk-TV5S6WQV.js';
|
|
21
21
|
import { isLegacyEventRow, eventSchema } from '../../chunk-VBATFCWR.js';
|
|
22
22
|
import { redactEvent, redactSecrets } from '../../chunk-SG6ZTIMT.js';
|
|
@@ -850,7 +850,7 @@ async function throwForStatus(res) {
|
|
|
850
850
|
|
|
851
851
|
// src/task/seed-verifier.ts
|
|
852
852
|
async function verifySeedWithTwin(seed) {
|
|
853
|
-
const { GitHubDomain, openGitHubCloneDatabase } = await import('../../src-
|
|
853
|
+
const { GitHubDomain, openGitHubCloneDatabase } = await import('../../src-5RPY72NF.js');
|
|
854
854
|
const db = openGitHubCloneDatabase(":memory:");
|
|
855
855
|
try {
|
|
856
856
|
new GitHubDomain(db).seed(seed);
|
|
@@ -4490,7 +4490,7 @@ var DEFAULT_AGENT_FILE = "examples/agents/scripted-triage-agent.ts";
|
|
|
4490
4490
|
var DEFAULT_AGENT_COMMAND = `node ${DEFAULT_AGENT_FILE}`;
|
|
4491
4491
|
var MANIFEST_SCHEMA_URL = "https://pome.sh/schemas/v1/pome.json";
|
|
4492
4492
|
function readPackageVersion() {
|
|
4493
|
-
if ("0.21.
|
|
4493
|
+
if ("0.21.13".length > 0) return "0.21.13";
|
|
4494
4494
|
try {
|
|
4495
4495
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
4496
4496
|
const candidates = [
|
|
@@ -4945,7 +4945,7 @@ function createProgram() {
|
|
|
4945
4945
|
return;
|
|
4946
4946
|
}
|
|
4947
4947
|
{
|
|
4948
|
-
const { runDoctorChecks } = await import('../../checks-
|
|
4948
|
+
const { runDoctorChecks } = await import('../../checks-MM2OJJES.js');
|
|
4949
4949
|
const { renderDoctorReport } = await import('../../render-ZQQ4UMNO.js');
|
|
4950
4950
|
const doctorReport = await runDoctorChecks({ mode: useLocal ? "full" : "hosted" });
|
|
4951
4951
|
if (!doctorReport.ok) {
|
|
@@ -4983,7 +4983,7 @@ function createProgram() {
|
|
|
4983
4983
|
taskForRuns.config.runs
|
|
4984
4984
|
);
|
|
4985
4985
|
if (k > 1) {
|
|
4986
|
-
const { runTrialGroup } = await import('../../runTrialGroup-
|
|
4986
|
+
const { runTrialGroup } = await import('../../runTrialGroup-UQKE6XQF.js');
|
|
4987
4987
|
const fileForRerun = relative(process.cwd(), file);
|
|
4988
4988
|
const rerunCommand = defaultTask ? options.trials !== void 0 ? `pome run -n ${k}` : "pome run" : `pome run ${fileForRerun && !fileForRerun.startsWith("..") ? fileForRerun : file} -n ${k}`;
|
|
4989
4989
|
const groupResult = await runTrialGroup({
|
|
@@ -5077,7 +5077,7 @@ function createProgram() {
|
|
|
5077
5077
|
process.exitCode = 5;
|
|
5078
5078
|
return;
|
|
5079
5079
|
}
|
|
5080
|
-
const { runDemo } = await import('../../runDemo-
|
|
5080
|
+
const { runDemo } = await import('../../runDemo-4ASIOIMV.js');
|
|
5081
5081
|
const result = await runDemo({
|
|
5082
5082
|
apiBase: opts.apiUrl.replace(/\/$/, ""),
|
|
5083
5083
|
dashboardBase: process.env.POME_DASHBOARD_URL ?? DEFAULT_DASHBOARD_URL,
|
|
@@ -5095,7 +5095,7 @@ function createProgram() {
|
|
|
5095
5095
|
program.command("doctor").description(
|
|
5096
5096
|
"Check the agent\u2194twin wiring: pome.json (or pome.yaml) present + valid, the local twin boots + serves, requests routed to the twin (not a hardcoded production host), egress floor active. On failure prints one named cause (file:line where knowable) + one concrete fix and exits non-zero."
|
|
5097
5097
|
).action(async () => {
|
|
5098
|
-
const { runDoctorChecks } = await import('../../checks-
|
|
5098
|
+
const { runDoctorChecks } = await import('../../checks-MM2OJJES.js');
|
|
5099
5099
|
const { renderDoctorReport } = await import('../../render-ZQQ4UMNO.js');
|
|
5100
5100
|
const report = await runDoctorChecks();
|
|
5101
5101
|
for (const line of renderDoctorReport(report, { passNote: true })) console.error(line);
|
|
@@ -5227,7 +5227,7 @@ function createProgram() {
|
|
|
5227
5227
|
).description(
|
|
5228
5228
|
"Start a standalone twin as a long-lived foreground server (Ctrl-C to stop)"
|
|
5229
5229
|
).action(async (name, options) => {
|
|
5230
|
-
const { runTwinStartCommand } = await import('../../twinStart-
|
|
5230
|
+
const { runTwinStartCommand } = await import('../../twinStart-TTVUZ7PC.js');
|
|
5231
5231
|
await runTwinStartCommand(name, options);
|
|
5232
5232
|
});
|
|
5233
5233
|
twin.command("reset").argument("[name]", "Twin name (default: github)", "github").description("Reset standalone twin state").action(async (name) => {
|
|
@@ -1569,7 +1569,7 @@ function issueCommentJson(comment, repo, target = "issue") {
|
|
|
1569
1569
|
updated_at: comment.updated_at
|
|
1570
1570
|
};
|
|
1571
1571
|
}
|
|
1572
|
-
function pullRequestSimpleJson(pr, baseRepo, headRepo, headSha = null, baseSha = null) {
|
|
1572
|
+
function pullRequestSimpleJson(pr, baseRepo, headRepo, headSha = null, baseSha = null, stack = null) {
|
|
1573
1573
|
return {
|
|
1574
1574
|
id: stableNumericId(`${baseRepo.full_name}/pull/${pr.number}`),
|
|
1575
1575
|
node_id: `PR_${stableNumericId(`${baseRepo.full_name}/pull/${pr.number}`)}`,
|
|
@@ -1611,14 +1611,15 @@ function pullRequestSimpleJson(pr, baseRepo, headRepo, headSha = null, baseSha =
|
|
|
1611
1611
|
created_at: pr.created_at,
|
|
1612
1612
|
updated_at: pr.updated_at,
|
|
1613
1613
|
closed_at: pr.closed_at,
|
|
1614
|
-
merged_at: pr.merged_at
|
|
1614
|
+
merged_at: pr.merged_at,
|
|
1615
|
+
stack
|
|
1615
1616
|
};
|
|
1616
1617
|
}
|
|
1617
|
-
function pullRequestListJson(pr, baseRepo, headRepo, headSha = null, baseSha = null) {
|
|
1618
|
-
return pullRequestSimpleJson(pr, baseRepo, headRepo, headSha, baseSha);
|
|
1618
|
+
function pullRequestListJson(pr, baseRepo, headRepo, headSha = null, baseSha = null, stack = null) {
|
|
1619
|
+
return pullRequestSimpleJson(pr, baseRepo, headRepo, headSha, baseSha, stack);
|
|
1619
1620
|
}
|
|
1620
|
-
function pullRequestJson(pr, baseRepo, headRepo, commits = 1, changedFiles = 0, headSha = null, baseSha = null) {
|
|
1621
|
-
const simple = pullRequestSimpleJson(pr, baseRepo, headRepo, headSha, baseSha);
|
|
1621
|
+
function pullRequestJson(pr, baseRepo, headRepo, commits = 1, changedFiles = 0, headSha = null, baseSha = null, stack = null) {
|
|
1622
|
+
const simple = pullRequestSimpleJson(pr, baseRepo, headRepo, headSha, baseSha, stack);
|
|
1622
1623
|
return {
|
|
1623
1624
|
...simple,
|
|
1624
1625
|
merged: Boolean(pr.merged),
|
|
@@ -2488,10 +2489,11 @@ function createPullRequest(domain, input, onDelta) {
|
|
|
2488
2489
|
}
|
|
2489
2490
|
function listPullRequests(domain, input) {
|
|
2490
2491
|
const repo = domain.requireRepo(input.owner, input.repo);
|
|
2491
|
-
|
|
2492
|
+
const all = domain.listPullRequestRows(repo.id);
|
|
2493
|
+
let rows = all;
|
|
2492
2494
|
if (input.state && input.state !== "all")
|
|
2493
2495
|
rows = rows.filter((pr) => pr.state === input.state);
|
|
2494
|
-
return paginate(rows, input.page, input.per_page ?? input.perPage).map((pr) => domain.serializePullSimple(pr));
|
|
2496
|
+
return paginate(rows, input.page, input.per_page ?? input.perPage).map((pr) => domain.serializePullSimple(pr, all));
|
|
2495
2497
|
}
|
|
2496
2498
|
function getPullRequest(domain, input) {
|
|
2497
2499
|
const repo = domain.requireRepo(input.owner, input.repo);
|
|
@@ -3613,6 +3615,73 @@ var GitHubDomain = class {
|
|
|
3613
3615
|
this.db.prepare("INSERT INTO pull_request_files (repo_id, pull_number, filename, status, additions, deletions, changes, blob_url, raw_url, contents_url, patch) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(repoId, pullNumber, file.filename, file.status, file.additions, file.deletions, file.changes, file.blob_url, file.raw_url, file.contents_url, file.patch);
|
|
3614
3616
|
}
|
|
3615
3617
|
}
|
|
3618
|
+
// F-1178 — the `stack` member of GitHub's `pull-request` / `pull-request-simple`
|
|
3619
|
+
// schemas. GitHub models a stack as its own entity with its own id and number;
|
|
3620
|
+
// the twin has no stack table, so it reads a stack off the state that DOES
|
|
3621
|
+
// encode one — pull requests linked `base_ref` -> `head_ref`, i.e. a PR whose
|
|
3622
|
+
// base branch is another PR's head branch is stacked on top of it.
|
|
3623
|
+
//
|
|
3624
|
+
// The identity this hands out (`id` / `number`) is shared by every member, so
|
|
3625
|
+
// the whole answer has to be a property of the CHAIN and not of the PR the
|
|
3626
|
+
// walk happened to start from. That is why this resolves the entire connected
|
|
3627
|
+
// component and then rejects anything that is not one unambiguous line:
|
|
3628
|
+
// handing two PRs the same `stack.id` while telling them different `size`s
|
|
3629
|
+
// would be worse than the missing field this ticket set out to fix. A
|
|
3630
|
+
// component that is not a simple path — a fork, a cycle — gets `null` from
|
|
3631
|
+
// EVERY member, which is what the schema's `nullable: true` is for.
|
|
3632
|
+
//
|
|
3633
|
+
// `rows` is every pull request in the repo. Passing it in lets the list
|
|
3634
|
+
// surface read the table once instead of once per serialized PR.
|
|
3635
|
+
pullRequestStack(pr, rows = this.listPullRequestRows(pr.repo_id)) {
|
|
3636
|
+
if (pr.state !== "open")
|
|
3637
|
+
return null;
|
|
3638
|
+
const parentsOf = (row) => rows.filter((other) => other.number !== row.number && other.head_repo_id === row.base_repo_id && other.head_ref === row.base_ref);
|
|
3639
|
+
const childrenOf = (row) => rows.filter((other) => other.number !== row.number && other.base_repo_id === row.head_repo_id && other.base_ref === row.head_ref);
|
|
3640
|
+
const component = /* @__PURE__ */ new Map();
|
|
3641
|
+
const queue = [pr];
|
|
3642
|
+
while (queue.length > 0) {
|
|
3643
|
+
const row = queue.shift();
|
|
3644
|
+
if (component.has(row.number))
|
|
3645
|
+
continue;
|
|
3646
|
+
component.set(row.number, row);
|
|
3647
|
+
for (const linked2 of [...parentsOf(row), ...childrenOf(row)]) {
|
|
3648
|
+
if (!component.has(linked2.number))
|
|
3649
|
+
queue.push(linked2);
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
const linked = [...component.values()];
|
|
3653
|
+
if (linked.some((row) => parentsOf(row).length > 1 || childrenOf(row).length > 1))
|
|
3654
|
+
return null;
|
|
3655
|
+
const bottoms = linked.filter((row) => parentsOf(row).length === 0);
|
|
3656
|
+
if (bottoms.length !== 1)
|
|
3657
|
+
return null;
|
|
3658
|
+
const chain = [];
|
|
3659
|
+
for (let row = bottoms[0]; row && chain.length < linked.length; row = childrenOf(row)[0]) {
|
|
3660
|
+
chain.push(row);
|
|
3661
|
+
}
|
|
3662
|
+
if (chain.length !== linked.length)
|
|
3663
|
+
return null;
|
|
3664
|
+
const members = chain.filter((row) => row.state === "open");
|
|
3665
|
+
if (members.length < 2)
|
|
3666
|
+
return null;
|
|
3667
|
+
const bottom = members[0];
|
|
3668
|
+
const bottomBaseRepo = this.requireRepoById(bottom.base_repo_id);
|
|
3669
|
+
const baseSha = this.getBranch(bottomBaseRepo.id, bottom.base_ref)?.head_sha ?? bottom.base_sha;
|
|
3670
|
+
if (baseSha === null)
|
|
3671
|
+
return null;
|
|
3672
|
+
return {
|
|
3673
|
+
base: { ref: bottom.base_ref, sha: baseSha },
|
|
3674
|
+
size: members.length,
|
|
3675
|
+
position: members.findIndex((row) => row.number === pr.number) + 1,
|
|
3676
|
+
// The twin has no stack row, so it has no stack id or number of its own.
|
|
3677
|
+
// Both derive from the bottom member, which every other member of the same
|
|
3678
|
+
// chain resolves to identically — that is what makes the identity agree
|
|
3679
|
+
// across the stack, and it is why the linearity check above has to reject
|
|
3680
|
+
// anything whose bottom member depends on where you started.
|
|
3681
|
+
id: stableNumericId(`${bottomBaseRepo.full_name}/stack/${bottom.number}`),
|
|
3682
|
+
number: bottom.number
|
|
3683
|
+
};
|
|
3684
|
+
}
|
|
3616
3685
|
// Single-PR GET (full PullRequest shape: keeps merged / commits / additions /
|
|
3617
3686
|
// deletions / changed_files).
|
|
3618
3687
|
serializePull(pr) {
|
|
@@ -3621,16 +3690,18 @@ var GitHubDomain = class {
|
|
|
3621
3690
|
const files = this.db.prepare("SELECT * FROM pull_request_files WHERE repo_id = ? AND pull_number = ?").all(pr.repo_id, pr.number);
|
|
3622
3691
|
const headSha = this.getBranch(headRepo.id, pr.head_ref)?.head_sha ?? pr.head_sha;
|
|
3623
3692
|
const baseSha = this.getBranch(baseRepo.id, pr.base_ref)?.head_sha ?? pr.base_sha;
|
|
3624
|
-
return pullRequestJson(pr, baseRepo, headRepo, 1, files.length, headSha, baseSha);
|
|
3693
|
+
return pullRequestJson(pr, baseRepo, headRepo, 1, files.length, headSha, baseSha, this.pullRequestStack(pr));
|
|
3625
3694
|
}
|
|
3626
3695
|
// LIST endpoint (leaner PullRequestSimple shape: drops the single-PR-only
|
|
3627
|
-
// diff-stat fields, matching real GitHub).
|
|
3628
|
-
|
|
3696
|
+
// diff-stat fields, matching real GitHub). `rows` is the caller's already-read
|
|
3697
|
+
// repo-wide pull request list, so serializing a page of N does not re-read the
|
|
3698
|
+
// table N times.
|
|
3699
|
+
serializePullSimple(pr, rows) {
|
|
3629
3700
|
const baseRepo = this.requireRepoById(pr.base_repo_id);
|
|
3630
3701
|
const headRepo = this.requireRepoById(pr.head_repo_id);
|
|
3631
3702
|
const headSha = this.getBranch(headRepo.id, pr.head_ref)?.head_sha ?? pr.head_sha;
|
|
3632
3703
|
const baseSha = this.getBranch(baseRepo.id, pr.base_ref)?.head_sha ?? pr.base_sha;
|
|
3633
|
-
return pullRequestListJson(pr, baseRepo, headRepo, headSha, baseSha);
|
|
3704
|
+
return pullRequestListJson(pr, baseRepo, headRepo, headSha, baseSha, this.pullRequestStack(pr, rows));
|
|
3634
3705
|
}
|
|
3635
3706
|
resolveHeadRef(baseRepo, head) {
|
|
3636
3707
|
const [owner, ref] = head.includes(":") ? head.split(":", 2) : [baseRepo.owner, head];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bootTwin } from './chunk-
|
|
2
|
-
import { isTwinName, TWIN_NAMES, defaultPortFor, TWIN_REGISTRY } from './chunk-
|
|
1
|
+
import { bootTwin } from './chunk-CC27LWIA.js';
|
|
2
|
+
import { isTwinName, TWIN_NAMES, defaultPortFor, TWIN_REGISTRY } from './chunk-BV35ZSB6.js';
|
|
3
3
|
import './chunk-TV5S6WQV.js';
|
|
4
4
|
import './chunk-VBATFCWR.js';
|
|
5
5
|
import './chunk-SG6ZTIMT.js';
|
package/package.json
CHANGED