@pome-sh/cli 0.21.5 → 0.21.7
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-2AIHHQC2.js → checks-4GJB73YX.js} +1 -1
- package/dist/{chunk-CLGRZY53.js → chunk-4ILBTPO4.js} +4 -4
- package/dist/chunk-5ETJZJR6.js +590 -0
- package/dist/{chunk-MBM7LY7E.js → chunk-A3IDZXJY.js} +9 -9
- package/dist/chunk-FKZZWWYC.js +4 -0
- package/dist/{chunk-OMVRPIBP.js → chunk-JULH5ECU.js} +1 -1
- package/dist/{chunk-JQQPZQOJ.js → chunk-M3X6OT4N.js} +1 -1
- package/dist/chunk-NJ246QPJ.js +683 -0
- package/dist/chunk-SGDUD7KK.js +138 -0
- package/dist/{chunk-NWXONLFF.js → chunk-WR7KP3LE.js} +2 -2
- package/dist/chunk-XS66ZRBJ.js +537 -0
- package/dist/chunk-ZKID2HS3.js +628 -0
- package/dist/{runDemo-M3GEOJLT.js → runDemo-BCB6EDDN.js} +7 -8
- package/dist/{runTrialGroup-QQNDVHMR.js → runTrialGroup-YCSGW56C.js} +6 -7
- package/dist/src/cli/main.js +20 -16
- package/dist/{chunk-WVWV7DLA.js → src-FLTYWM6P.js} +500 -1761
- package/dist/{chunk-APAS34RJ.js → src-K3KTJTMG.js} +154 -1308
- package/dist/{chunk-OKDJRKJV.js → src-RVUEXCKN.js} +6 -135
- package/dist/twinHarness-KFZ2ZNAX.js +5 -0
- package/dist/{twinStart-E42H5CYD.js → twinStart-4OGP2GBY.js} +2 -2
- package/package.json +1 -1
- package/dist/src-JGOW5WYI.js +0 -5
- package/dist/src-KIHABGI5.js +0 -5
- package/dist/src-TUX5L2RC.js +0 -4
- package/dist/twinHarness-YTU4427G.js +0 -5
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// ../packages/twin-github/dist/src/seed.js
|
|
4
|
+
var seedSchema = z.object({
|
|
5
|
+
users: z.array(z.object({
|
|
6
|
+
login: z.string().min(1),
|
|
7
|
+
type: z.enum(["User", "Organization"]).default("User"),
|
|
8
|
+
name: z.string().default("")
|
|
9
|
+
})).default([]),
|
|
10
|
+
repositories: z.array(z.object({
|
|
11
|
+
owner: z.string().min(1),
|
|
12
|
+
name: z.string().min(1),
|
|
13
|
+
description: z.string().default(""),
|
|
14
|
+
private: z.boolean().default(false),
|
|
15
|
+
default_branch: z.string().min(1).default("main"),
|
|
16
|
+
collaborators: z.array(z.string().min(1)).default([]),
|
|
17
|
+
labels: z.array(z.object({
|
|
18
|
+
name: z.string().min(1),
|
|
19
|
+
color: z.string().default("ededed"),
|
|
20
|
+
description: z.string().default("")
|
|
21
|
+
})).default([]),
|
|
22
|
+
files: z.array(z.object({ path: z.string().min(1), content: z.string(), branch: z.string().optional() })).default([]),
|
|
23
|
+
issues: z.array(z.object({
|
|
24
|
+
number: z.number().int().positive().optional(),
|
|
25
|
+
title: z.string().min(1),
|
|
26
|
+
body: z.string().default(""),
|
|
27
|
+
state: z.enum(["open", "closed"]).default("open"),
|
|
28
|
+
labels: z.array(z.string().min(1)).default([]),
|
|
29
|
+
assignees: z.array(z.string().min(1)).default([])
|
|
30
|
+
})).default([]),
|
|
31
|
+
pull_requests: z.array(z.object({
|
|
32
|
+
number: z.number().int().positive().optional(),
|
|
33
|
+
title: z.string().min(1),
|
|
34
|
+
body: z.string().default(""),
|
|
35
|
+
head: z.string().min(1),
|
|
36
|
+
base: z.string().min(1).default("main"),
|
|
37
|
+
state: z.enum(["open", "closed"]).default("open"),
|
|
38
|
+
author: z.string().min(1).optional(),
|
|
39
|
+
// Reviews seeded on this PR. `state` mirrors GitHub's review
|
|
40
|
+
// state enum; `author` must exist in the user/collaborator set.
|
|
41
|
+
reviews: z.array(z.object({
|
|
42
|
+
author: z.string().min(1),
|
|
43
|
+
state: z.enum(["APPROVED", "CHANGES_REQUESTED", "COMMENTED"]).default("APPROVED"),
|
|
44
|
+
body: z.string().default("")
|
|
45
|
+
})).default([]),
|
|
46
|
+
// Commit statuses applied to this PR's head SHA. Wired into the
|
|
47
|
+
// commit_statuses table so get_pull_request_status and the merge
|
|
48
|
+
// path see them without needing a separate setup call.
|
|
49
|
+
statuses: z.array(z.object({
|
|
50
|
+
context: z.string().min(1).default("ci/build"),
|
|
51
|
+
state: z.enum(["error", "failure", "pending", "success"]).default("success"),
|
|
52
|
+
description: z.string().default("")
|
|
53
|
+
})).default([])
|
|
54
|
+
})).default([])
|
|
55
|
+
}))
|
|
56
|
+
});
|
|
57
|
+
function parseSeed(input) {
|
|
58
|
+
const seed = seedSchema.parse(normalizeLegacyGitHubSeed(input));
|
|
59
|
+
if (seed.repositories.length === 0) {
|
|
60
|
+
throw new Error("GitHub seed must contain at least one repository");
|
|
61
|
+
}
|
|
62
|
+
return seed;
|
|
63
|
+
}
|
|
64
|
+
function normalizeLegacyGitHubSeed(input) {
|
|
65
|
+
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
66
|
+
return input;
|
|
67
|
+
const seed = input;
|
|
68
|
+
if (!Array.isArray(seed.repositories))
|
|
69
|
+
return input;
|
|
70
|
+
return {
|
|
71
|
+
...seed,
|
|
72
|
+
repositories: seed.repositories.map((repo) => {
|
|
73
|
+
if (!repo || typeof repo !== "object" || Array.isArray(repo))
|
|
74
|
+
return repo;
|
|
75
|
+
const record = repo;
|
|
76
|
+
if (!Array.isArray(record.issues))
|
|
77
|
+
return repo;
|
|
78
|
+
return {
|
|
79
|
+
...record,
|
|
80
|
+
issues: record.issues.map((issue) => normalizeLegacyIssueAssignee(issue))
|
|
81
|
+
};
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function normalizeLegacyIssueAssignee(issue) {
|
|
86
|
+
if (!issue || typeof issue !== "object" || Array.isArray(issue))
|
|
87
|
+
return issue;
|
|
88
|
+
const record = issue;
|
|
89
|
+
if (!("assignee" in record) || "assignees" in record)
|
|
90
|
+
return issue;
|
|
91
|
+
const { assignee, ...rest } = record;
|
|
92
|
+
if (assignee === null || assignee === void 0 || assignee === "") {
|
|
93
|
+
return { ...rest, assignees: [] };
|
|
94
|
+
}
|
|
95
|
+
if (typeof assignee === "string") {
|
|
96
|
+
return { ...rest, assignees: [assignee] };
|
|
97
|
+
}
|
|
98
|
+
return issue;
|
|
99
|
+
}
|
|
100
|
+
function defaultSeedState() {
|
|
101
|
+
return {
|
|
102
|
+
users: [
|
|
103
|
+
{ login: "acme", type: "Organization", name: "Acme" },
|
|
104
|
+
{ login: "alice", type: "User", name: "Alice" },
|
|
105
|
+
{ login: "bob", type: "User", name: "Bob" },
|
|
106
|
+
{ login: "pome-agent", type: "User", name: "Pome Agent" }
|
|
107
|
+
],
|
|
108
|
+
repositories: [
|
|
109
|
+
{
|
|
110
|
+
owner: "acme",
|
|
111
|
+
name: "api",
|
|
112
|
+
description: "Example API service used by GitHub twin tests.",
|
|
113
|
+
default_branch: "main",
|
|
114
|
+
collaborators: ["alice", "bob", "pome-agent"],
|
|
115
|
+
labels: [
|
|
116
|
+
{ name: "bug", color: "d73a4a", description: "Something is not working" },
|
|
117
|
+
{ name: "feature", color: "a2eeef", description: "New feature or request" },
|
|
118
|
+
{ name: "question", color: "d876e3", description: "More information needed" }
|
|
119
|
+
],
|
|
120
|
+
files: [
|
|
121
|
+
{ path: "README.md", content: "# Acme API\n\nA seeded repository for local GitHub twin tests.\n" },
|
|
122
|
+
{ path: "src/index.ts", content: "export function handler() {\n return 'ok';\n}\n" }
|
|
123
|
+
],
|
|
124
|
+
issues: [
|
|
125
|
+
{
|
|
126
|
+
number: 1,
|
|
127
|
+
title: "500 error on POST /orders after deploy",
|
|
128
|
+
body: "Started failing right after the 14:00 deploy. Stack trace points to OrderController#create.",
|
|
129
|
+
labels: ["bug"],
|
|
130
|
+
assignees: []
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { defaultSeedState, parseSeed, seedSchema };
|
|
@@ -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-4ILBTPO4.js';
|
|
4
|
+
import { createRecorder, bootTwin } from './chunk-M3X6OT4N.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';
|