@pmate/cli 0.29.7 → 0.29.8
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/index.d.ts +1 -7
- package/dist/index.js +0 -81
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ declare enum Command {
|
|
|
12
12
|
Delete = "delete",
|
|
13
13
|
Dev = "dev",
|
|
14
14
|
Env = "env",
|
|
15
|
-
Pr = "pr",
|
|
16
15
|
Commit = "commit",
|
|
17
16
|
Summary = "summary",
|
|
18
17
|
Linear = "linear",
|
|
@@ -124,11 +123,6 @@ type EnvCommandArgs = {
|
|
|
124
123
|
envVerbose?: boolean;
|
|
125
124
|
envCwd: string;
|
|
126
125
|
};
|
|
127
|
-
type PrCommandArgs = {
|
|
128
|
-
type: Command.Pr;
|
|
129
|
-
action: "create" | "merge";
|
|
130
|
-
prRef?: string;
|
|
131
|
-
};
|
|
132
126
|
type CommitCommandArgs = {
|
|
133
127
|
type: Command.Commit;
|
|
134
128
|
push: boolean;
|
|
@@ -1131,7 +1125,7 @@ type VercelDeploysCommandArgs = {
|
|
|
1131
1125
|
lastWeek: boolean;
|
|
1132
1126
|
};
|
|
1133
1127
|
type VercelCommandArgs = VercelProjectsCommandArgs | VercelDeploysCommandArgs;
|
|
1134
|
-
type CommandArgs = NoneCommandArgs | ListCommandArgs | LoginCommandArgs | AddDnsCommandArgs | StsCommandArgs | BucketCommandArgs | DeployCommandArgs | LogCommandArgs | InitCommandArgs | DeleteCommandArgs | DevCommandArgs | EnvCommandArgs |
|
|
1128
|
+
type CommandArgs = NoneCommandArgs | ListCommandArgs | LoginCommandArgs | AddDnsCommandArgs | StsCommandArgs | BucketCommandArgs | DeployCommandArgs | LogCommandArgs | InitCommandArgs | DeleteCommandArgs | DevCommandArgs | EnvCommandArgs | CommitCommandArgs | SummaryCommandArgs | QuizCommandArgs | ServiceCommandArgs | LinearCommandArgs | NotionCommandArgs | OssCommandArgs | QrcodeCommandArgs | RandomCommandArgs | CollectCommandArgs | ChatRoomCommandArgs | FunctionCommandArgs | WorkerCommandArgs | CallCommandArgs | NsCommandArgs | RoleCommandArgs | AccountCommandArgs | OrgCommandArgs | StoreCommandArgs | AppCommandArgs | VercelCommandArgs | HostCommandArgs;
|
|
1135
1129
|
|
|
1136
1130
|
interface ParsedArgs {
|
|
1137
1131
|
help: boolean;
|
package/dist/index.js
CHANGED
|
@@ -11512,54 +11512,6 @@ var PrCommandHandler = class {
|
|
|
11512
11512
|
constructor(cwd = process.cwd()) {
|
|
11513
11513
|
this.cwd = cwd;
|
|
11514
11514
|
}
|
|
11515
|
-
async handle(args) {
|
|
11516
|
-
if (args.action === "merge") {
|
|
11517
|
-
await this.handleMerge(args.prRef);
|
|
11518
|
-
return;
|
|
11519
|
-
}
|
|
11520
|
-
await this.ensureGitRepo();
|
|
11521
|
-
await this.ensureGhCli();
|
|
11522
|
-
await this.ensureGhAuth();
|
|
11523
|
-
const context = await this.getRepoContext();
|
|
11524
|
-
let existingPrUrl = await this.findExistingPrUrl(context.currentBranch);
|
|
11525
|
-
if (!this.hasLocalChanges(context)) {
|
|
11526
|
-
await this.handleNoLocalChanges(context, existingPrUrl);
|
|
11527
|
-
return;
|
|
11528
|
-
}
|
|
11529
|
-
const recentLog = await this.runCapture("git", [
|
|
11530
|
-
"log",
|
|
11531
|
-
"--oneline",
|
|
11532
|
-
"-n",
|
|
11533
|
-
"20"
|
|
11534
|
-
]);
|
|
11535
|
-
console.log("Generating PR metadata using a PMate Function...");
|
|
11536
|
-
const suggestion = await this.getAiSuggestion({
|
|
11537
|
-
status: context.status,
|
|
11538
|
-
diff: truncate(context.diff, 6e3),
|
|
11539
|
-
diffCached: truncate(context.diffCached, 6e3),
|
|
11540
|
-
recentLog: truncate(recentLog, 2e3),
|
|
11541
|
-
baseBranch: context.baseBranch
|
|
11542
|
-
});
|
|
11543
|
-
this.assertNonEmpty("PR title", suggestion.prTitle);
|
|
11544
|
-
this.assertNonEmpty("Commit message", suggestion.commitMessage);
|
|
11545
|
-
const prTitle = normalizePrTitle(suggestion.prTitle);
|
|
11546
|
-
if (prTitle !== suggestion.prTitle.trim()) {
|
|
11547
|
-
ui.info("Normalized PR title", prTitle);
|
|
11548
|
-
}
|
|
11549
|
-
const headBranch = await this.ensureWorkBranch(context, suggestion);
|
|
11550
|
-
if (headBranch !== context.currentBranch) {
|
|
11551
|
-
existingPrUrl = await this.findExistingPrUrl(headBranch);
|
|
11552
|
-
}
|
|
11553
|
-
await this.commitIfNeeded(suggestion.commitMessage);
|
|
11554
|
-
await this.rebaseOntoBase(context.baseBranch);
|
|
11555
|
-
await this.pushBranchIfNeeded(headBranch, context.baseBranch);
|
|
11556
|
-
await this.ensurePr(
|
|
11557
|
-
existingPrUrl,
|
|
11558
|
-
context.baseBranch,
|
|
11559
|
-
headBranch,
|
|
11560
|
-
prTitle
|
|
11561
|
-
);
|
|
11562
|
-
}
|
|
11563
11515
|
async handleCommit(push = false) {
|
|
11564
11516
|
await this.ensureGitRepo();
|
|
11565
11517
|
const context = await this.getRepoContext();
|
|
@@ -25956,8 +25908,6 @@ var HELP_TEXT = [
|
|
|
25956
25908
|
` ${import_chalk4.default.gray(" <app-name> [--cwd <dir>]")}`,
|
|
25957
25909
|
` ${import_chalk4.default.cyan("env")} Manage app env vars on the server`,
|
|
25958
25910
|
` ${import_chalk4.default.gray(" <app-name> --list|--set <key> --value <value> [--delete <key>] [--cwd <dir>] [--verbose|-v]")}`,
|
|
25959
|
-
` ${import_chalk4.default.cyan("pr")} Create or update GitHub PRs with AI assistance`,
|
|
25960
|
-
` ${import_chalk4.default.gray(" merge [<pr>] (defaults: --squash --delete-branch)")}`,
|
|
25961
25911
|
` ${import_chalk4.default.cyan("commit")} Create an AI-generated commit from local changes`,
|
|
25962
25912
|
` ${import_chalk4.default.gray(" [--push] [--cwd <dir>]")}`,
|
|
25963
25913
|
` ${import_chalk4.default.cyan("summary")} Summarize a GitHub PR with AI`,
|
|
@@ -26231,9 +26181,6 @@ function parseCommandArgs(args) {
|
|
|
26231
26181
|
if (args.rest[0] === "env") {
|
|
26232
26182
|
return parseEnvArgs(args.rest.slice(1));
|
|
26233
26183
|
}
|
|
26234
|
-
if (args.rest[0] === "pr") {
|
|
26235
|
-
return parsePrArgs(args.rest.slice(1));
|
|
26236
|
-
}
|
|
26237
26184
|
if (args.rest[0] === "commit") {
|
|
26238
26185
|
return parseCommitArgs(args.rest.slice(1));
|
|
26239
26186
|
}
|
|
@@ -26597,29 +26544,6 @@ function parseEnvArgs(tokens) {
|
|
|
26597
26544
|
envCwd: cwd
|
|
26598
26545
|
};
|
|
26599
26546
|
}
|
|
26600
|
-
function parsePrArgs(tokens) {
|
|
26601
|
-
const rest = [...tokens];
|
|
26602
|
-
if (rest[0] === "merge") {
|
|
26603
|
-
rest.shift();
|
|
26604
|
-
let prRef;
|
|
26605
|
-
while (rest.length > 0) {
|
|
26606
|
-
const token = rest.shift();
|
|
26607
|
-
if (token.startsWith("-")) {
|
|
26608
|
-
throw new Error(`Unknown pr merge option: ${token}`);
|
|
26609
|
-
}
|
|
26610
|
-
if (prRef) {
|
|
26611
|
-
throw new Error(`Unexpected extra argument for pr merge: ${token}`);
|
|
26612
|
-
}
|
|
26613
|
-
prRef = token;
|
|
26614
|
-
}
|
|
26615
|
-
return { type: "pr" /* Pr */, action: "merge", prRef };
|
|
26616
|
-
}
|
|
26617
|
-
while (rest.length > 0) {
|
|
26618
|
-
const token = rest.shift();
|
|
26619
|
-
throw new Error(`Unknown pr option: ${token}`);
|
|
26620
|
-
}
|
|
26621
|
-
return { type: "pr" /* Pr */, action: "create" };
|
|
26622
|
-
}
|
|
26623
26547
|
function parseCommitArgs(tokens) {
|
|
26624
26548
|
const rest = [...tokens];
|
|
26625
26549
|
let push = false;
|
|
@@ -27917,11 +27841,6 @@ async function main() {
|
|
|
27917
27841
|
await handler.handle(commandArgs);
|
|
27918
27842
|
return;
|
|
27919
27843
|
}
|
|
27920
|
-
case "pr" /* Pr */: {
|
|
27921
|
-
const handler = new PrCommandHandler();
|
|
27922
|
-
await handler.handle(commandArgs);
|
|
27923
|
-
return;
|
|
27924
|
-
}
|
|
27925
27844
|
case "commit" /* Commit */: {
|
|
27926
27845
|
const handler = new CommitCommandHandler();
|
|
27927
27846
|
await handler.handle(commandArgs);
|