@usepipr/cli 0.1.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/main.d.mts +1 -0
- package/dist/main.mjs +368 -0
- package/dist/main.mjs.map +1 -0
- package/package.json +40 -0
package/dist/main.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/main.mjs
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { inspect } from "node:util";
|
|
3
|
+
import * as core from "@actions/core";
|
|
4
|
+
import { PublicationError, runActionCommand, runDryRunCommand, runInitCommand, runInspectCommand, runLocalReviewCommand, runValidateCommand, supportedOfficialInitAdapters, supportedOfficialInitRecipes } from "@usepipr/runtime";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
//#region src/main.ts
|
|
7
|
+
async function main() {
|
|
8
|
+
const program = createProgram();
|
|
9
|
+
if (process.argv.length <= 2) {
|
|
10
|
+
program.outputHelp();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
await program.parseAsync(process.argv);
|
|
14
|
+
}
|
|
15
|
+
function createProgram() {
|
|
16
|
+
const program = new Command();
|
|
17
|
+
program.name("pipr").showHelpAfterError();
|
|
18
|
+
program.command("init").description("Create editable TypeScript config").option("--config-dir <dir>", "Config directory", ".pipr").option("--adapters <adapters>", `Adapters to initialize (${supportedOfficialInitAdapters.join(", ")}; use 'none' to skip adapter files)`).option("--recipe <recipe>", `Starter recipe (${supportedOfficialInitRecipes.join(", ")})`).option("--no-types", "Skip local TypeScript support files").option("--types-only", "Add or refresh local TypeScript support files only").option("--force", "Overwrite existing pipr files").action(runInit);
|
|
19
|
+
program.command("action").description("Run inside GitHub Docker Action").option("--config-dir <dir>", "Config directory", ".pipr").action(runAction);
|
|
20
|
+
program.command("check").description("Type-load config and validate the runtime plan").option("--config-dir <dir>", "Config directory", ".pipr").option("--require-env", "Require configured provider env vars").action(runCheck);
|
|
21
|
+
program.command("dry-run").description("Load config and event without publishing").requiredOption("--event <path>", "GitHub event JSON path").option("--config-dir <dir>", "Config directory", ".pipr").action(runDryRun);
|
|
22
|
+
program.command("inspect").description("Print models, agents, tasks, commands, and tools").option("--config-dir <dir>", "Config directory", ".pipr").action(runInspect);
|
|
23
|
+
program.command("review").description("Run configured change-request review tasks locally without publishing").option("--base <sha>", "Base commit SHA").option("--head <sha>", "Head commit SHA or ref; omitted reviews the working tree").option("--config-dir <dir>", "Config directory", ".pipr").option("--pi-executable <path>", "Pi executable path").option("--json", "Print structured JSON output").action(runLocalReview);
|
|
24
|
+
return program;
|
|
25
|
+
}
|
|
26
|
+
async function runAction(options) {
|
|
27
|
+
writeActionResult(await runActionCommand(actionOptions(options)));
|
|
28
|
+
}
|
|
29
|
+
function actionOptions(options) {
|
|
30
|
+
const eventPath = process.env.GITHUB_EVENT_PATH;
|
|
31
|
+
if (!eventPath) throw new Error("GITHUB_EVENT_PATH is required for pipr action");
|
|
32
|
+
return {
|
|
33
|
+
rootDir: process.env.GITHUB_WORKSPACE ?? process.cwd(),
|
|
34
|
+
configDir: process.env["INPUT_CONFIG-DIR"] || options.configDir,
|
|
35
|
+
env: process.env,
|
|
36
|
+
eventPath,
|
|
37
|
+
dryRun: process.env.PIPR_DRY_RUN === "1",
|
|
38
|
+
logSink: githubActionsLogSink
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const githubActionsLogSink = {
|
|
42
|
+
info(message) {
|
|
43
|
+
core.info(message);
|
|
44
|
+
},
|
|
45
|
+
notice(message) {
|
|
46
|
+
core.notice(message);
|
|
47
|
+
},
|
|
48
|
+
warning(message) {
|
|
49
|
+
core.warning(message);
|
|
50
|
+
},
|
|
51
|
+
error(message) {
|
|
52
|
+
core.error(message);
|
|
53
|
+
},
|
|
54
|
+
debug(message) {
|
|
55
|
+
core.debug(message);
|
|
56
|
+
},
|
|
57
|
+
async group(name, run) {
|
|
58
|
+
return await core.group(name, run);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function writeActionResult(result) {
|
|
62
|
+
if (result.kind === "ignored") {
|
|
63
|
+
core.info(`pipr ignored event: ${result.reason}`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
writeLoadedActionResult(result);
|
|
67
|
+
}
|
|
68
|
+
const loadedActionResultWriters = {
|
|
69
|
+
"command-help": (result) => {
|
|
70
|
+
assertLoadedActionKind(result, "command-help");
|
|
71
|
+
writeCommandHelpActionResult(result);
|
|
72
|
+
},
|
|
73
|
+
"command-response": (result) => {
|
|
74
|
+
assertLoadedActionKind(result, "command-response");
|
|
75
|
+
writeCommandResponseActionResult(result);
|
|
76
|
+
},
|
|
77
|
+
"dry-run": (result) => {
|
|
78
|
+
assertLoadedActionKind(result, "dry-run");
|
|
79
|
+
writeDryRunActionResult(result);
|
|
80
|
+
},
|
|
81
|
+
review: (result) => {
|
|
82
|
+
assertLoadedActionKind(result, "review");
|
|
83
|
+
writeReviewActionResult(result);
|
|
84
|
+
},
|
|
85
|
+
verifier: (result) => {
|
|
86
|
+
assertLoadedActionKind(result, "verifier");
|
|
87
|
+
writeVerifierActionResult(result);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
function writeLoadedActionResult(result) {
|
|
91
|
+
core.info(`pipr loaded change #${result.event.change.number} for ${result.event.repository.slug}`);
|
|
92
|
+
core.info(`pipr config source: ${result.configSource}`);
|
|
93
|
+
loadedActionResultWriters[result.kind](result);
|
|
94
|
+
}
|
|
95
|
+
function assertLoadedActionKind(result, kind) {
|
|
96
|
+
if (result.kind !== kind) throw new Error(`Expected '${kind}' action result, got '${result.kind}'`);
|
|
97
|
+
}
|
|
98
|
+
function writeDryRunActionResult(result) {
|
|
99
|
+
core.info("PIPR_DRY_RUN=1; stopping before review runtime, model, or GitHub publishing calls");
|
|
100
|
+
}
|
|
101
|
+
function writeCommandHelpActionResult(result) {
|
|
102
|
+
core.info(`pipr command help: ${result.reason}`);
|
|
103
|
+
core.setOutput("main-comment", result.body);
|
|
104
|
+
}
|
|
105
|
+
function writeCommandResponseActionResult(result) {
|
|
106
|
+
core.info(`pipr command '${result.command}' published response comment (${result.publication.action})`);
|
|
107
|
+
core.setOutput("main-comment", result.response.body);
|
|
108
|
+
core.setOutput("publication", JSON.stringify(result.publication));
|
|
109
|
+
}
|
|
110
|
+
function writeVerifierActionResult(result) {
|
|
111
|
+
core.info(`pipr verifier processed review comment reply with ${result.errors.length} publication error(s)`);
|
|
112
|
+
warnInlineResolutionErrors(result.errors);
|
|
113
|
+
core.setOutput("publication", JSON.stringify({ inlineResolutionErrors: result.errors }));
|
|
114
|
+
}
|
|
115
|
+
function writeReviewActionResult(result) {
|
|
116
|
+
core.info(`pipr review produced ${result.review.validated.validFindings.length} valid inline finding(s), ${result.review.validated.droppedFindings.length} dropped finding(s)`);
|
|
117
|
+
core.info(`pipr published main comment (${result.publication.mainComment.action}) and ${result.publication.inlineComments.posted} inline comment(s); ${result.publication.inlineComments.skipped} skipped`);
|
|
118
|
+
warnInlineResolutionErrors(result.publication.metadata.inlineResolutionErrors);
|
|
119
|
+
if (result.review.repairAttempted) core.info("pipr repaired reviewer JSON once before validation");
|
|
120
|
+
core.setOutput("main-comment", result.review.mainComment);
|
|
121
|
+
core.setOutput("inline-comments", JSON.stringify(result.review.inlineCommentDrafts));
|
|
122
|
+
core.setOutput("dropped-findings", JSON.stringify(result.review.validated.droppedFindings));
|
|
123
|
+
core.setOutput("publication", JSON.stringify(result.publication));
|
|
124
|
+
}
|
|
125
|
+
function warnInlineResolutionErrors(errors) {
|
|
126
|
+
for (const error of errors) core.warning(`pipr inline resolution failed: ${error}`);
|
|
127
|
+
}
|
|
128
|
+
async function runInit(options) {
|
|
129
|
+
const typeSupport = initTypeSupportMode(options);
|
|
130
|
+
const result = await runInitCommand({
|
|
131
|
+
rootDir: process.cwd(),
|
|
132
|
+
configDir: options.configDir,
|
|
133
|
+
force: options.force === true,
|
|
134
|
+
adapters: parseInitAdapters(options.adapters),
|
|
135
|
+
recipe: options.recipe,
|
|
136
|
+
typeSupport
|
|
137
|
+
});
|
|
138
|
+
console.log(`created ${result.created.length} file(s)` + (result.overwritten.length > 0 ? `; overwrote ${result.overwritten.length}` : ""));
|
|
139
|
+
}
|
|
140
|
+
function initTypeSupportMode(options) {
|
|
141
|
+
const invalidMessage = invalidTypeSupportMessage(options);
|
|
142
|
+
if (invalidMessage) throw new Error(invalidMessage);
|
|
143
|
+
if (options.typesOnly === true) return "only";
|
|
144
|
+
return options.types === false ? "skip" : "include";
|
|
145
|
+
}
|
|
146
|
+
const invalidTypeSupportRules = [
|
|
147
|
+
{
|
|
148
|
+
matches: (options) => options.typesOnly === true && options.types === false,
|
|
149
|
+
message: "--types-only cannot be combined with --no-types"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
matches: (options) => options.typesOnly === true && options.recipe !== void 0,
|
|
153
|
+
message: "--types-only cannot be combined with --recipe"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
matches: (options) => options.typesOnly === true && options.adapters !== void 0,
|
|
157
|
+
message: "--types-only cannot be combined with --adapters"
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
function invalidTypeSupportMessage(options) {
|
|
161
|
+
return invalidTypeSupportRules.find((rule) => rule.matches(options))?.message;
|
|
162
|
+
}
|
|
163
|
+
function parseInitAdapters(adapters) {
|
|
164
|
+
return adapters?.split(",").map((adapter) => adapter.trim());
|
|
165
|
+
}
|
|
166
|
+
async function runCheck(options) {
|
|
167
|
+
const settings = await runValidateCommand({
|
|
168
|
+
rootDir: process.cwd(),
|
|
169
|
+
configDir: options.configDir,
|
|
170
|
+
env: process.env,
|
|
171
|
+
requireProviderEnv: options.requireEnv === true
|
|
172
|
+
});
|
|
173
|
+
console.log(`valid: ${settings.source}`);
|
|
174
|
+
for (const warning of settings.warnings) console.log(`warning: ${warning}`);
|
|
175
|
+
}
|
|
176
|
+
async function runInspect(options) {
|
|
177
|
+
const result = await runInspectCommand({
|
|
178
|
+
rootDir: process.cwd(),
|
|
179
|
+
configDir: options.configDir,
|
|
180
|
+
env: process.env
|
|
181
|
+
});
|
|
182
|
+
console.log(inspect(result, {
|
|
183
|
+
depth: 8,
|
|
184
|
+
colors: false
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
async function runLocalReview(options) {
|
|
188
|
+
if (!options.base) throw new Error("pipr review requires --base <sha>");
|
|
189
|
+
writeLocalReviewResult(await runLocalReviewCommand({
|
|
190
|
+
rootDir: process.cwd(),
|
|
191
|
+
configDir: options.configDir,
|
|
192
|
+
env: process.env,
|
|
193
|
+
baseSha: options.base,
|
|
194
|
+
headSha: options.head,
|
|
195
|
+
piExecutable: options.piExecutable,
|
|
196
|
+
logSink: localConsoleLogSink,
|
|
197
|
+
taskLog: stderrTaskLog
|
|
198
|
+
}), options.json === true);
|
|
199
|
+
}
|
|
200
|
+
const stderrTaskLog = {
|
|
201
|
+
info(message) {
|
|
202
|
+
console.error(`[info] ${message}`);
|
|
203
|
+
},
|
|
204
|
+
warn(message) {
|
|
205
|
+
console.error(`[warn] ${message}`);
|
|
206
|
+
},
|
|
207
|
+
error(message) {
|
|
208
|
+
console.error(`[error] ${message}`);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const localConsoleLogSink = {
|
|
212
|
+
info(message) {
|
|
213
|
+
console.error(formatLocalLogMessage(message));
|
|
214
|
+
},
|
|
215
|
+
notice(message) {
|
|
216
|
+
console.error(formatLocalLogMessage(message));
|
|
217
|
+
},
|
|
218
|
+
warning(message) {
|
|
219
|
+
console.error(formatLocalLogMessage(message));
|
|
220
|
+
},
|
|
221
|
+
error(message) {
|
|
222
|
+
console.error(formatLocalLogMessage(message));
|
|
223
|
+
},
|
|
224
|
+
debug(message) {
|
|
225
|
+
console.error(formatLocalLogMessage(message));
|
|
226
|
+
},
|
|
227
|
+
async group(_name, run) {
|
|
228
|
+
return await run();
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function formatLocalLogMessage(message) {
|
|
232
|
+
const [firstLine, ...rest] = message.split("\n");
|
|
233
|
+
const data = parseLocalLogLine(firstLine);
|
|
234
|
+
if (!data) return message;
|
|
235
|
+
const fields = Object.entries(data).map(([key, value]) => formatLocalLogField(key, value)).filter((field) => field !== void 0);
|
|
236
|
+
const formatted = [...formatLocalLogPrefix(data), ...fields].join(" ");
|
|
237
|
+
return rest.length === 0 ? formatted : [formatted, ...rest].join("\n");
|
|
238
|
+
}
|
|
239
|
+
function formatLocalLogPrefix(data) {
|
|
240
|
+
const level = typeof data.level === "string" ? data.level : "";
|
|
241
|
+
const event = typeof data.event === "string" ? data.event : "";
|
|
242
|
+
return [
|
|
243
|
+
"pipr",
|
|
244
|
+
localLogPlainLevels.has(level) ? "" : level,
|
|
245
|
+
event
|
|
246
|
+
].filter(Boolean);
|
|
247
|
+
}
|
|
248
|
+
function parseLocalLogLine(line) {
|
|
249
|
+
if (!line?.startsWith("{")) return;
|
|
250
|
+
try {
|
|
251
|
+
return JSON.parse(line);
|
|
252
|
+
} catch {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const localLogNumberFields = {
|
|
257
|
+
additions: (value) => `+${value}`,
|
|
258
|
+
deletions: (value) => `-${value}`,
|
|
259
|
+
durationMs: (value) => `duration=${value < 1e3 ? `${value}ms` : `${(value / 1e3).toFixed(1)}s`}`,
|
|
260
|
+
promptBytes: (value) => `prompt=${value}B`,
|
|
261
|
+
stderrBytes: (value) => `stderr=${value}B`,
|
|
262
|
+
stdoutBytes: (value) => `stdout=${value}B`
|
|
263
|
+
};
|
|
264
|
+
const localLogHiddenFields = new Set(["level", "event"]);
|
|
265
|
+
const localLogPlainLevels = new Set(["info", "notice"]);
|
|
266
|
+
function formatLocalLogField(key, value) {
|
|
267
|
+
if (localLogHiddenFields.has(key) || value == null) return;
|
|
268
|
+
return formatLocalLogFieldValue(key, value);
|
|
269
|
+
}
|
|
270
|
+
function formatLocalLogFieldValue(key, value) {
|
|
271
|
+
return (typeof value === "number" ? localLogNumberFields[key]?.(value) : void 0) ?? `${key}=${formatLocalLogValue(value)}`;
|
|
272
|
+
}
|
|
273
|
+
const localLogValueFormatters = {
|
|
274
|
+
boolean: String,
|
|
275
|
+
number: String,
|
|
276
|
+
object: (value) => Array.isArray(value) ? value.length === 0 ? "-" : value.map(formatLocalLogValue).join(",") : JSON.stringify(value),
|
|
277
|
+
string: (value) => {
|
|
278
|
+
const text = String(value);
|
|
279
|
+
return /\s/.test(text) ? JSON.stringify(text) : text;
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
function formatLocalLogValue(value) {
|
|
283
|
+
return (localLogValueFormatters[typeof value] ?? JSON.stringify)(value);
|
|
284
|
+
}
|
|
285
|
+
function writeLocalReviewResult(result, json) {
|
|
286
|
+
if (json) {
|
|
287
|
+
console.log(JSON.stringify(localReviewJson(result), null, 2));
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (result.kind === "skipped") {
|
|
291
|
+
console.log(`skipped: ${result.skipReason ?? "no task matched"}`);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
console.log(formatLocalReview(result));
|
|
295
|
+
}
|
|
296
|
+
function formatLocalReview(result) {
|
|
297
|
+
const mainComment = stripMainCommentMarker(result.mainComment);
|
|
298
|
+
const inlineFindings = result.inlineCommentDrafts.map((draft, index) => {
|
|
299
|
+
const range = draft.startLine === draft.endLine ? `${draft.path}:${draft.startLine}` : `${draft.path}:${draft.startLine}-${draft.endLine}`;
|
|
300
|
+
return [
|
|
301
|
+
`${index + 1}. ${range}`,
|
|
302
|
+
`Range: ${draft.finding.rangeId ?? "-"}`,
|
|
303
|
+
draft.finding.body
|
|
304
|
+
].join("\n");
|
|
305
|
+
});
|
|
306
|
+
return inlineFindings.length === 0 ? mainComment : [
|
|
307
|
+
mainComment.trimEnd(),
|
|
308
|
+
"",
|
|
309
|
+
"## Inline Findings",
|
|
310
|
+
"",
|
|
311
|
+
inlineFindings.join("\n\n")
|
|
312
|
+
].join("\n");
|
|
313
|
+
}
|
|
314
|
+
function stripMainCommentMarker(comment) {
|
|
315
|
+
return comment.split("\n").filter((line) => !line.startsWith("<!-- pipr:main-comment ")).join("\n").trimStart();
|
|
316
|
+
}
|
|
317
|
+
function localReviewJson(result) {
|
|
318
|
+
if (result.kind === "skipped") return {
|
|
319
|
+
kind: result.kind,
|
|
320
|
+
skipReason: result.skipReason,
|
|
321
|
+
mainComment: result.mainComment,
|
|
322
|
+
inlineFindings: result.inlineCommentDrafts,
|
|
323
|
+
droppedFindings: result.validated.droppedFindings,
|
|
324
|
+
taskChecks: result.taskChecks,
|
|
325
|
+
provider: result.provider,
|
|
326
|
+
providerModels: result.publicationPlan.metadata.providerModels ?? [result.provider.model],
|
|
327
|
+
repairAttempted: result.repairAttempted
|
|
328
|
+
};
|
|
329
|
+
return {
|
|
330
|
+
kind: result.kind,
|
|
331
|
+
mainComment: result.mainComment,
|
|
332
|
+
inlineFindings: result.inlineCommentDrafts,
|
|
333
|
+
droppedFindings: result.validated.droppedFindings,
|
|
334
|
+
taskChecks: result.taskChecks,
|
|
335
|
+
provider: result.provider,
|
|
336
|
+
providerModels: result.publicationPlan.metadata.providerModels ?? [result.provider.model],
|
|
337
|
+
repairAttempted: result.repairAttempted
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
async function runDryRun(options) {
|
|
341
|
+
if (!options.event) throw new Error("dry-run requires --event <path>");
|
|
342
|
+
const result = await runDryRunCommand({
|
|
343
|
+
rootDir: process.cwd(),
|
|
344
|
+
configDir: options.configDir,
|
|
345
|
+
env: process.env,
|
|
346
|
+
eventPath: options.event
|
|
347
|
+
});
|
|
348
|
+
console.log(inspect({
|
|
349
|
+
configSource: result.configSource,
|
|
350
|
+
event: result.event
|
|
351
|
+
}, {
|
|
352
|
+
depth: 6,
|
|
353
|
+
colors: false
|
|
354
|
+
}));
|
|
355
|
+
}
|
|
356
|
+
main().catch((error) => {
|
|
357
|
+
if (error instanceof PublicationError && error.result) {
|
|
358
|
+
core.setOutput("publication", JSON.stringify(error.result));
|
|
359
|
+
core.error(`pipr publication metadata: ${JSON.stringify(error.result)}`);
|
|
360
|
+
}
|
|
361
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
362
|
+
core.setFailed(message);
|
|
363
|
+
process.exitCode = 1;
|
|
364
|
+
});
|
|
365
|
+
//#endregion
|
|
366
|
+
export {};
|
|
367
|
+
|
|
368
|
+
//# sourceMappingURL=main.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.mjs","names":[],"sources":["../src/main.ts"],"sourcesContent":["#!/usr/bin/env bun\nimport { inspect } from \"node:util\";\nimport * as core from \"@actions/core\";\nimport {\n type ActionCommandResult,\n type ActionLogSink,\n type InitTypeSupportMode,\n PublicationError,\n runActionCommand,\n runDryRunCommand,\n runInitCommand,\n runInspectCommand,\n runLocalReviewCommand,\n runValidateCommand,\n supportedOfficialInitAdapters,\n supportedOfficialInitRecipes,\n} from \"@usepipr/runtime\";\nimport { Command } from \"commander\";\n\ntype ActionOptions = Parameters<typeof runActionCommand>[0];\n\ntype CliOptions = {\n configDir: string;\n event?: string;\n force?: boolean;\n adapters?: string;\n recipe?: string;\n types?: boolean;\n typesOnly?: boolean;\n requireEnv?: boolean;\n base?: string;\n head?: string;\n piExecutable?: string;\n json?: boolean;\n};\n\nasync function main(): Promise<void> {\n const program = createProgram();\n if (process.argv.length <= 2) {\n program.outputHelp();\n return;\n }\n await program.parseAsync(process.argv);\n}\n\nfunction createProgram(): Command {\n const program = new Command();\n program.name(\"pipr\").showHelpAfterError();\n\n program\n .command(\"init\")\n .description(\"Create editable TypeScript config\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\n \"--adapters <adapters>\",\n `Adapters to initialize (${supportedOfficialInitAdapters.join(\", \")}; use 'none' to skip adapter files)`,\n )\n .option(\"--recipe <recipe>\", `Starter recipe (${supportedOfficialInitRecipes.join(\", \")})`)\n .option(\"--no-types\", \"Skip local TypeScript support files\")\n .option(\"--types-only\", \"Add or refresh local TypeScript support files only\")\n .option(\"--force\", \"Overwrite existing pipr files\")\n .action(runInit);\n\n program\n .command(\"action\")\n .description(\"Run inside GitHub Docker Action\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runAction);\n\n program\n .command(\"check\")\n .description(\"Type-load config and validate the runtime plan\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\"--require-env\", \"Require configured provider env vars\")\n .action(runCheck);\n\n program\n .command(\"dry-run\")\n .description(\"Load config and event without publishing\")\n .requiredOption(\"--event <path>\", \"GitHub event JSON path\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runDryRun);\n\n program\n .command(\"inspect\")\n .description(\"Print models, agents, tasks, commands, and tools\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .action(runInspect);\n\n program\n .command(\"review\")\n .description(\"Run configured change-request review tasks locally without publishing\")\n .option(\"--base <sha>\", \"Base commit SHA\")\n .option(\"--head <sha>\", \"Head commit SHA or ref; omitted reviews the working tree\")\n .option(\"--config-dir <dir>\", \"Config directory\", \".pipr\")\n .option(\"--pi-executable <path>\", \"Pi executable path\")\n .option(\"--json\", \"Print structured JSON output\")\n .action(runLocalReview);\n\n return program;\n}\n\nasync function runAction(options: CliOptions): Promise<void> {\n writeActionResult(await runActionCommand(actionOptions(options)));\n}\n\nfunction actionOptions(options: CliOptions): ActionOptions {\n const eventPath = process.env.GITHUB_EVENT_PATH;\n if (!eventPath) {\n throw new Error(\"GITHUB_EVENT_PATH is required for pipr action\");\n }\n return {\n rootDir: process.env.GITHUB_WORKSPACE ?? process.cwd(),\n configDir: process.env[\"INPUT_CONFIG-DIR\"] || options.configDir,\n env: process.env,\n eventPath,\n dryRun: process.env.PIPR_DRY_RUN === \"1\",\n logSink: githubActionsLogSink,\n };\n}\n\nconst githubActionsLogSink: ActionLogSink = {\n info(message) {\n core.info(message);\n },\n notice(message) {\n core.notice(message);\n },\n warning(message) {\n core.warning(message);\n },\n error(message) {\n core.error(message);\n },\n debug(message) {\n core.debug(message);\n },\n async group(name, run) {\n return await core.group(name, run);\n },\n};\n\nfunction writeActionResult(result: ActionCommandResult): void {\n if (result.kind === \"ignored\") {\n core.info(`pipr ignored event: ${result.reason}`);\n return;\n }\n writeLoadedActionResult(result);\n}\n\ntype LoadedActionResult = Exclude<ActionCommandResult, { kind: \"ignored\" }>;\ntype LoadedActionResultWriter = (result: LoadedActionResult) => void;\n\nconst loadedActionResultWriters = {\n \"command-help\": (result) => {\n assertLoadedActionKind(result, \"command-help\");\n writeCommandHelpActionResult(result);\n },\n \"command-response\": (result) => {\n assertLoadedActionKind(result, \"command-response\");\n writeCommandResponseActionResult(result);\n },\n \"dry-run\": (result) => {\n assertLoadedActionKind(result, \"dry-run\");\n writeDryRunActionResult(result);\n },\n review: (result) => {\n assertLoadedActionKind(result, \"review\");\n writeReviewActionResult(result);\n },\n verifier: (result) => {\n assertLoadedActionKind(result, \"verifier\");\n writeVerifierActionResult(result);\n },\n} satisfies Record<LoadedActionResult[\"kind\"], LoadedActionResultWriter>;\n\nfunction writeLoadedActionResult(result: LoadedActionResult): void {\n core.info(\n `pipr loaded change #${result.event.change.number} for ${result.event.repository.slug}`,\n );\n core.info(`pipr config source: ${result.configSource}`);\n loadedActionResultWriters[result.kind](result);\n}\n\nfunction assertLoadedActionKind<K extends LoadedActionResult[\"kind\"]>(\n result: LoadedActionResult,\n kind: K,\n): asserts result is Extract<LoadedActionResult, { kind: K }> {\n if (result.kind !== kind) {\n throw new Error(`Expected '${kind}' action result, got '${result.kind}'`);\n }\n}\n\nfunction writeDryRunActionResult(result: Extract<ActionCommandResult, { kind: \"dry-run\" }>): void {\n void result;\n core.info(\"PIPR_DRY_RUN=1; stopping before review runtime, model, or GitHub publishing calls\");\n}\n\nfunction writeCommandHelpActionResult(\n result: Extract<ActionCommandResult, { kind: \"command-help\" }>,\n): void {\n core.info(`pipr command help: ${result.reason}`);\n core.setOutput(\"main-comment\", result.body);\n}\n\nfunction writeCommandResponseActionResult(\n result: Extract<ActionCommandResult, { kind: \"command-response\" }>,\n): void {\n core.info(\n `pipr command '${result.command}' published response comment (${result.publication.action})`,\n );\n core.setOutput(\"main-comment\", result.response.body);\n core.setOutput(\"publication\", JSON.stringify(result.publication));\n}\n\nfunction writeVerifierActionResult(\n result: Extract<ActionCommandResult, { kind: \"verifier\" }>,\n): void {\n core.info(\n `pipr verifier processed review comment reply with ${result.errors.length} publication error(s)`,\n );\n warnInlineResolutionErrors(result.errors);\n core.setOutput(\"publication\", JSON.stringify({ inlineResolutionErrors: result.errors }));\n}\n\nfunction writeReviewActionResult(result: Extract<ActionCommandResult, { kind: \"review\" }>): void {\n core.info(\n `pipr review produced ${result.review.validated.validFindings.length} valid inline finding(s), ` +\n `${result.review.validated.droppedFindings.length} dropped finding(s)`,\n );\n core.info(\n `pipr published main comment (${result.publication.mainComment.action}) and ` +\n `${result.publication.inlineComments.posted} inline comment(s); ` +\n `${result.publication.inlineComments.skipped} skipped`,\n );\n warnInlineResolutionErrors(result.publication.metadata.inlineResolutionErrors);\n if (result.review.repairAttempted) {\n core.info(\"pipr repaired reviewer JSON once before validation\");\n }\n core.setOutput(\"main-comment\", result.review.mainComment);\n core.setOutput(\"inline-comments\", JSON.stringify(result.review.inlineCommentDrafts));\n core.setOutput(\"dropped-findings\", JSON.stringify(result.review.validated.droppedFindings));\n core.setOutput(\"publication\", JSON.stringify(result.publication));\n}\n\nfunction warnInlineResolutionErrors(errors: string[]): void {\n for (const error of errors) {\n core.warning(`pipr inline resolution failed: ${error}`);\n }\n}\n\nasync function runInit(options: CliOptions): Promise<void> {\n const typeSupport = initTypeSupportMode(options);\n const result = await runInitCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n force: options.force === true,\n adapters: parseInitAdapters(options.adapters),\n recipe: options.recipe,\n typeSupport,\n });\n console.log(\n `created ${result.created.length} file(s)` +\n (result.overwritten.length > 0 ? `; overwrote ${result.overwritten.length}` : \"\"),\n );\n}\n\nfunction initTypeSupportMode(options: CliOptions): InitTypeSupportMode {\n const invalidMessage = invalidTypeSupportMessage(options);\n if (invalidMessage) {\n throw new Error(invalidMessage);\n }\n if (options.typesOnly === true) {\n return \"only\";\n }\n return options.types === false ? \"skip\" : \"include\";\n}\n\nconst invalidTypeSupportRules: Array<{\n matches(options: CliOptions): boolean;\n message: string;\n}> = [\n {\n matches: (options) => options.typesOnly === true && options.types === false,\n message: \"--types-only cannot be combined with --no-types\",\n },\n {\n matches: (options) => options.typesOnly === true && options.recipe !== undefined,\n message: \"--types-only cannot be combined with --recipe\",\n },\n {\n matches: (options) => options.typesOnly === true && options.adapters !== undefined,\n message: \"--types-only cannot be combined with --adapters\",\n },\n];\n\nfunction invalidTypeSupportMessage(options: CliOptions): string | undefined {\n return invalidTypeSupportRules.find((rule) => rule.matches(options))?.message;\n}\n\nfunction parseInitAdapters(adapters: string | undefined): string[] | undefined {\n return adapters?.split(\",\").map((adapter) => adapter.trim());\n}\n\nasync function runCheck(options: CliOptions): Promise<void> {\n const settings = await runValidateCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n requireProviderEnv: options.requireEnv === true,\n });\n console.log(`valid: ${settings.source}`);\n for (const warning of settings.warnings) {\n console.log(`warning: ${warning}`);\n }\n}\n\nasync function runInspect(options: CliOptions): Promise<void> {\n const result = await runInspectCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n });\n console.log(inspect(result, { depth: 8, colors: false }));\n}\n\nasync function runLocalReview(options: CliOptions): Promise<void> {\n if (!options.base) {\n throw new Error(\"pipr review requires --base <sha>\");\n }\n const result = await runLocalReviewCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n baseSha: options.base,\n headSha: options.head,\n piExecutable: options.piExecutable,\n logSink: localConsoleLogSink,\n taskLog: stderrTaskLog,\n });\n writeLocalReviewResult(result, options.json === true);\n}\n\ntype LocalReviewResult = Awaited<ReturnType<typeof runLocalReviewCommand>>;\n\nconst stderrTaskLog = {\n info(message: string) {\n console.error(`[info] ${message}`);\n },\n warn(message: string) {\n console.error(`[warn] ${message}`);\n },\n error(message: string) {\n console.error(`[error] ${message}`);\n },\n};\n\nconst localConsoleLogSink: ActionLogSink = {\n info(message) {\n console.error(formatLocalLogMessage(message));\n },\n notice(message) {\n console.error(formatLocalLogMessage(message));\n },\n warning(message) {\n console.error(formatLocalLogMessage(message));\n },\n error(message) {\n console.error(formatLocalLogMessage(message));\n },\n debug(message) {\n console.error(formatLocalLogMessage(message));\n },\n async group(_name, run) {\n return await run();\n },\n};\n\nfunction formatLocalLogMessage(message: string): string {\n const [firstLine, ...rest] = message.split(\"\\n\");\n const data = parseLocalLogLine(firstLine);\n if (!data) {\n return message;\n }\n\n const fields = Object.entries(data)\n .map(([key, value]) => formatLocalLogField(key, value))\n .filter((field): field is string => field !== undefined);\n const prefix = formatLocalLogPrefix(data);\n const formatted = [...prefix, ...fields].join(\" \");\n return rest.length === 0 ? formatted : [formatted, ...rest].join(\"\\n\");\n}\n\nfunction formatLocalLogPrefix(data: Record<string, unknown>): string[] {\n const level = typeof data.level === \"string\" ? data.level : \"\";\n const event = typeof data.event === \"string\" ? data.event : \"\";\n return [\"pipr\", localLogPlainLevels.has(level) ? \"\" : level, event].filter(Boolean);\n}\n\nfunction parseLocalLogLine(line: string | undefined): Record<string, unknown> | undefined {\n if (!line?.startsWith(\"{\")) {\n return undefined;\n }\n try {\n return JSON.parse(line) as Record<string, unknown>;\n } catch {\n return undefined;\n }\n}\n\nconst localLogNumberFields: Record<string, (value: number) => string> = {\n additions: (value) => `+${value}`,\n deletions: (value) => `-${value}`,\n durationMs: (value) =>\n `duration=${value < 1000 ? `${value}ms` : `${(value / 1000).toFixed(1)}s`}`,\n promptBytes: (value) => `prompt=${value}B`,\n stderrBytes: (value) => `stderr=${value}B`,\n stdoutBytes: (value) => `stdout=${value}B`,\n};\n\nconst localLogHiddenFields = new Set([\"level\", \"event\"]);\nconst localLogPlainLevels = new Set([\"info\", \"notice\"]);\n\nfunction formatLocalLogField(key: string, value: unknown): string | undefined {\n if (localLogHiddenFields.has(key) || value == null) {\n return undefined;\n }\n\n return formatLocalLogFieldValue(key, value);\n}\n\nfunction formatLocalLogFieldValue(key: string, value: unknown): string {\n const formattedNumber =\n typeof value === \"number\" ? localLogNumberFields[key]?.(value) : undefined;\n return formattedNumber ?? `${key}=${formatLocalLogValue(value)}`;\n}\n\nconst localLogValueFormatters: Record<string, (value: unknown) => string> = {\n boolean: String,\n number: String,\n object: (value) =>\n Array.isArray(value)\n ? value.length === 0\n ? \"-\"\n : value.map(formatLocalLogValue).join(\",\")\n : JSON.stringify(value),\n string: (value) => {\n const text = String(value);\n return /\\s/.test(text) ? JSON.stringify(text) : text;\n },\n};\n\nfunction formatLocalLogValue(value: unknown): string {\n return (localLogValueFormatters[typeof value] ?? JSON.stringify)(value);\n}\n\nfunction writeLocalReviewResult(result: LocalReviewResult, json: boolean): void {\n if (json) {\n console.log(JSON.stringify(localReviewJson(result), null, 2));\n return;\n }\n if (result.kind === \"skipped\") {\n console.log(`skipped: ${result.skipReason ?? \"no task matched\"}`);\n return;\n }\n console.log(formatLocalReview(result));\n}\n\nfunction formatLocalReview(result: Extract<LocalReviewResult, { kind: \"review\" }>): string {\n const mainComment = stripMainCommentMarker(result.mainComment);\n const inlineFindings = result.inlineCommentDrafts.map((draft, index) => {\n const range =\n draft.startLine === draft.endLine\n ? `${draft.path}:${draft.startLine}`\n : `${draft.path}:${draft.startLine}-${draft.endLine}`;\n return [\n `${index + 1}. ${range}`,\n `Range: ${draft.finding.rangeId ?? \"-\"}`,\n draft.finding.body,\n ].join(\"\\n\");\n });\n return inlineFindings.length === 0\n ? mainComment\n : [mainComment.trimEnd(), \"\", \"## Inline Findings\", \"\", inlineFindings.join(\"\\n\\n\")].join(\"\\n\");\n}\n\nfunction stripMainCommentMarker(comment: string): string {\n return comment\n .split(\"\\n\")\n .filter((line) => !line.startsWith(\"<!-- pipr:main-comment \"))\n .join(\"\\n\")\n .trimStart();\n}\n\nfunction localReviewJson(result: LocalReviewResult) {\n if (result.kind === \"skipped\") {\n return {\n kind: result.kind,\n skipReason: result.skipReason,\n mainComment: result.mainComment,\n inlineFindings: result.inlineCommentDrafts,\n droppedFindings: result.validated.droppedFindings,\n taskChecks: result.taskChecks,\n provider: result.provider,\n providerModels: result.publicationPlan.metadata.providerModels ?? [result.provider.model],\n repairAttempted: result.repairAttempted,\n };\n }\n return {\n kind: result.kind,\n mainComment: result.mainComment,\n inlineFindings: result.inlineCommentDrafts,\n droppedFindings: result.validated.droppedFindings,\n taskChecks: result.taskChecks,\n provider: result.provider,\n providerModels: result.publicationPlan.metadata.providerModels ?? [result.provider.model],\n repairAttempted: result.repairAttempted,\n };\n}\n\nasync function runDryRun(options: CliOptions): Promise<void> {\n if (!options.event) {\n throw new Error(\"dry-run requires --event <path>\");\n }\n const result = await runDryRunCommand({\n rootDir: process.cwd(),\n configDir: options.configDir,\n env: process.env,\n eventPath: options.event,\n });\n console.log(\n inspect(\n {\n configSource: result.configSource,\n event: result.event,\n },\n { depth: 6, colors: false },\n ),\n );\n}\n\nmain().catch((error: unknown) => {\n if (error instanceof PublicationError && error.result) {\n core.setOutput(\"publication\", JSON.stringify(error.result));\n core.error(`pipr publication metadata: ${JSON.stringify(error.result)}`);\n }\n const message = error instanceof Error ? error.message : String(error);\n core.setFailed(message);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;AAoCA,eAAe,OAAsB;CACnC,MAAM,UAAU,cAAc;CAC9B,IAAI,QAAQ,KAAK,UAAU,GAAG;EAC5B,QAAQ,WAAW;EACnB;CACF;CACA,MAAM,QAAQ,WAAW,QAAQ,IAAI;AACvC;AAEA,SAAS,gBAAyB;CAChC,MAAM,UAAU,IAAI,QAAQ;CAC5B,QAAQ,KAAK,MAAM,CAAC,CAAC,mBAAmB;CAExC,QACG,QAAQ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B,CAAC;CACD,QAAQ,IACN,QACE;EACE,cAAc,OAAO;EACrB,OAAO,OAAO;CAChB,GACA;EAAE,OAAO;EAAG,QAAQ;CAAM,CAC5B,CACF;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,IAAI,iBAAiB,oBAAoB,MAAM,QAAQ;EACrD,KAAK,UAAU,eAAe,KAAK,UAAU,MAAM,MAAM,CAAC;EAC1D,KAAK,MAAM,8BAA8B,KAAK,UAAU,MAAM,MAAM,GAAG;CACzE;CACA,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,KAAK,UAAU,OAAO;CACtB,QAAQ,WAAW;AACrB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@usepipr/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command line interface for pipr pull request review automation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/somus/pipr.git",
|
|
10
|
+
"directory": "packages/cli"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/somus/pipr/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/somus/pipr#readme",
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"pipr": "./dist/main.mjs"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsdown src/main.ts --dts --format esm --out-dir dist",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "bun test --timeout 30000",
|
|
29
|
+
"lint": "biome check src",
|
|
30
|
+
"format:check": "biome check src",
|
|
31
|
+
"prepack": "bun run build",
|
|
32
|
+
"check": "bun run lint && bun run typecheck && bun run test"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@actions/core": "3.0.1",
|
|
36
|
+
"@usepipr/runtime": "0.1.0",
|
|
37
|
+
"@usepipr/sdk": "0.1.0",
|
|
38
|
+
"commander": "15.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|