@staff0rd/assist 0.547.1 → 0.548.1
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/README.md +2 -1
- package/dist/commands/sessions/web/bundle.js +64 -64
- package/dist/index.js +56 -24
- 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.548.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -517,7 +517,8 @@ var assistConfigShape = {
|
|
|
517
517
|
prs: z3.strictObject({
|
|
518
518
|
slack: z3.string().optional(),
|
|
519
519
|
required: z3.boolean().default(false),
|
|
520
|
-
promptJira: z3.boolean().default(false)
|
|
520
|
+
promptJira: z3.boolean().default(false),
|
|
521
|
+
draft: z3.boolean().default(false)
|
|
521
522
|
}).optional(),
|
|
522
523
|
worktree: z3.strictObject({
|
|
523
524
|
enabled: z3.boolean().default(false),
|
|
@@ -4049,6 +4050,18 @@ var mermaidConfigHelp = [
|
|
|
4049
4050
|
];
|
|
4050
4051
|
|
|
4051
4052
|
// src/commands/prs/prsConfigHelp.ts
|
|
4053
|
+
var prsRaiseConfigHelp = [
|
|
4054
|
+
{
|
|
4055
|
+
key: "prs.promptJira",
|
|
4056
|
+
setter: "assist config set prs.promptJira true",
|
|
4057
|
+
note: "'assist prs raise' help asks the user for a Jira key to --resolves (default false)"
|
|
4058
|
+
},
|
|
4059
|
+
{
|
|
4060
|
+
key: "prs.draft",
|
|
4061
|
+
setter: "assist config set prs.draft true",
|
|
4062
|
+
note: "'assist prs raise' creates a draft PR when neither --draft nor --no-draft is passed (default false)"
|
|
4063
|
+
}
|
|
4064
|
+
];
|
|
4052
4065
|
var prsConfigHelp = [
|
|
4053
4066
|
{
|
|
4054
4067
|
key: "prs.slack",
|
|
@@ -4060,11 +4073,7 @@ var prsConfigHelp = [
|
|
|
4060
4073
|
setter: "assist config set prs.required true",
|
|
4061
4074
|
note: "require a branch when running a backlog item"
|
|
4062
4075
|
},
|
|
4063
|
-
|
|
4064
|
-
key: "prs.promptJira",
|
|
4065
|
-
setter: "assist config set prs.promptJira true",
|
|
4066
|
-
note: "'assist prs raise' help asks the user for a Jira key to --resolves (default false)"
|
|
4067
|
-
}
|
|
4076
|
+
...prsRaiseConfigHelp
|
|
4068
4077
|
];
|
|
4069
4078
|
|
|
4070
4079
|
// src/commands/ravendb/ravendbConfigHelp.ts
|
|
@@ -22848,17 +22857,26 @@ async function previewAndPlace(args) {
|
|
|
22848
22857
|
requestId: randomUUID9(),
|
|
22849
22858
|
title: args.title,
|
|
22850
22859
|
body: args.body,
|
|
22851
|
-
prNumber: args.prNumber
|
|
22860
|
+
prNumber: args.prNumber,
|
|
22861
|
+
draft: args.options.draft === true
|
|
22852
22862
|
});
|
|
22853
22863
|
const body = appendScreenshots(args.body, decision.screenshots ?? []);
|
|
22854
22864
|
await placePr(args.prNumber, args.title, body, args.options);
|
|
22855
22865
|
await chainAfterRaise(args.prNumber, decision);
|
|
22856
22866
|
}
|
|
22857
22867
|
|
|
22868
|
+
// src/commands/prs/resolveDraftState.ts
|
|
22869
|
+
function resolveDraftState(options2, command) {
|
|
22870
|
+
const source = command?.getOptionValueSource?.("draft");
|
|
22871
|
+
if (source === "cli" || source === "env") return options2.draft === true;
|
|
22872
|
+
return loadConfig().prs?.draft ?? false;
|
|
22873
|
+
}
|
|
22874
|
+
|
|
22858
22875
|
// src/commands/prs/raise.ts
|
|
22859
22876
|
var USAGE = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--force]";
|
|
22860
|
-
async function raise(options2) {
|
|
22877
|
+
async function raise(options2, command) {
|
|
22861
22878
|
const { title, body } = buildValidatedBody(options2, USAGE);
|
|
22879
|
+
const resolved = { ...options2, draft: resolveDraftState(options2, command) };
|
|
22862
22880
|
const existing = findCurrentPrNumber();
|
|
22863
22881
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
22864
22882
|
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
@@ -22867,7 +22885,7 @@ async function raise(options2) {
|
|
|
22867
22885
|
title,
|
|
22868
22886
|
body,
|
|
22869
22887
|
prNumber: existing,
|
|
22870
|
-
options:
|
|
22888
|
+
options: resolved
|
|
22871
22889
|
});
|
|
22872
22890
|
return;
|
|
22873
22891
|
}
|
|
@@ -22877,7 +22895,7 @@ async function raise(options2) {
|
|
|
22877
22895
|
);
|
|
22878
22896
|
process.exit(1);
|
|
22879
22897
|
}
|
|
22880
|
-
await placePr(existing, title, body,
|
|
22898
|
+
await placePr(existing, title, body, resolved);
|
|
22881
22899
|
}
|
|
22882
22900
|
|
|
22883
22901
|
// src/commands/prs/reply.ts
|
|
@@ -23034,11 +23052,18 @@ var RESOLVES_NO_PROMPT = ` --resolves <key> Jira issue key resolved by this PR
|
|
|
23034
23052
|
browse URL is appended inline to ## Why. Pass it when a Jira
|
|
23035
23053
|
key is known from the session or supplied by the user; omit
|
|
23036
23054
|
it otherwise.`;
|
|
23037
|
-
|
|
23055
|
+
var DRAFT_DEFAULT_ON = `This repo has prs.draft set, so a raise creates a draft pull request unless
|
|
23056
|
+
--no-draft is passed.`;
|
|
23057
|
+
var DRAFT_DEFAULT_OFF = `This repo leaves prs.draft off, so a raise creates a ready-for-review pull
|
|
23058
|
+
request unless --draft is passed.`;
|
|
23059
|
+
function guidance(promptJira, draft) {
|
|
23038
23060
|
const resolves = promptJira ? RESOLVES_WITH_PROMPT : RESOLVES_NO_PROMPT;
|
|
23061
|
+
const draftDefault = draft ? DRAFT_DEFAULT_ON : DRAFT_DEFAULT_OFF;
|
|
23039
23062
|
return `Raise a pull request for the current branch. Use a concise description with no
|
|
23040
23063
|
headers, and do not reference Claude or any AI assistance in the title or body.
|
|
23041
23064
|
|
|
23065
|
+
${draftDefault}
|
|
23066
|
+
|
|
23042
23067
|
The body is assembled from discrete section options; supply at minimum --title,
|
|
23043
23068
|
--what, and --why:
|
|
23044
23069
|
|
|
@@ -23099,11 +23124,13 @@ is approved. The reviewer may also drop or paste screenshots into the pane; on
|
|
|
23099
23124
|
approval these are appended to the PR body under a ## Screenshots section
|
|
23100
23125
|
automatically (they are discarded on rejection), so you never author that section
|
|
23101
23126
|
yourself. Just compose the sections and run the command.`;
|
|
23102
|
-
function raiseHelpText(promptJira) {
|
|
23103
|
-
const
|
|
23127
|
+
function raiseHelpText(promptJira, draft) {
|
|
23128
|
+
const config = loadConfig().prs;
|
|
23129
|
+
const prompt = promptJira ?? config?.promptJira ?? false;
|
|
23130
|
+
const draftDefault = draft ?? config?.draft ?? false;
|
|
23104
23131
|
const confirm = process.env.ASSIST_SESSION === "1" ? WEB_CONFIRM : TERMINAL_CONFIRM;
|
|
23105
23132
|
return `
|
|
23106
|
-
${guidance(prompt)}
|
|
23133
|
+
${guidance(prompt, draftDefault)}
|
|
23107
23134
|
|
|
23108
23135
|
${confirm}
|
|
23109
23136
|
`;
|
|
@@ -23114,7 +23141,7 @@ function collect4(value, previous) {
|
|
|
23114
23141
|
return previous.concat([value]);
|
|
23115
23142
|
}
|
|
23116
23143
|
function registerPrsRaise(prsCommand) {
|
|
23117
|
-
prsCommand.command("raise").description(
|
|
23144
|
+
const raiseCommand = prsCommand.command("raise").description(
|
|
23118
23145
|
"Raise a pull request, assembling the body from discrete sections"
|
|
23119
23146
|
).option("-t, --title <title>", "Title for the pull request").option("--what <what>", "What the change does (## What section)").option("--why <why>", "Why the change is needed (## Why section)").option("--how <how>", "How the change works (optional ## How section)").option(
|
|
23120
23147
|
"--resolves <key>",
|
|
@@ -23124,7 +23151,10 @@ function registerPrsRaise(prsCommand) {
|
|
|
23124
23151
|
).option(
|
|
23125
23152
|
"--force",
|
|
23126
23153
|
"Overwrite the title and body of an existing pull request"
|
|
23127
|
-
).option("-B, --base <branch>", "Branch into which the pull request merges").option("-H, --head <branch>", "Branch that contains the commits").option("-d, --draft", "Mark the pull request as a draft").option(
|
|
23154
|
+
).option("-B, --base <branch>", "Branch into which the pull request merges").option("-H, --head <branch>", "Branch that contains the commits").option("-d, --draft", "Mark the pull request as a draft").option(
|
|
23155
|
+
"--no-draft",
|
|
23156
|
+
"Create a ready-for-review pull request, overriding prs.draft"
|
|
23157
|
+
).option("-w, --web", "Open the browser to create the pull request").option("-l, --label <label>", "Add a label (repeatable)", collect4, []).option(
|
|
23128
23158
|
"-a, --assignee <login>",
|
|
23129
23159
|
"Assign a person by login (repeatable)",
|
|
23130
23160
|
collect4,
|
|
@@ -23135,6 +23165,7 @@ function registerPrsRaise(prsCommand) {
|
|
|
23135
23165
|
collect4,
|
|
23136
23166
|
[]
|
|
23137
23167
|
).option("-m, --milestone <name>", "Add the pull request to a milestone").addHelpText("after", () => raiseHelpText()).action(raise);
|
|
23168
|
+
configHelp(raiseCommand, prsRaiseConfigHelp);
|
|
23138
23169
|
}
|
|
23139
23170
|
|
|
23140
23171
|
// src/commands/registerPrs.ts
|
|
@@ -31380,16 +31411,18 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
|
31380
31411
|
const prNumber = typeof d.prNumber === "number" ? d.prNumber : null;
|
|
31381
31412
|
const kind = d.kind === "backlog-item" ? "backlog-item" : "pr";
|
|
31382
31413
|
const itemType = d.itemType === "bug" ? "bug" : "story";
|
|
31414
|
+
const draft = d.draft === true;
|
|
31383
31415
|
session.pendingPrPreview = {
|
|
31384
31416
|
requestId: d.requestId,
|
|
31385
31417
|
title: d.title,
|
|
31386
31418
|
body: d.body,
|
|
31387
31419
|
prNumber,
|
|
31388
31420
|
kind,
|
|
31389
|
-
itemType: kind === "backlog-item" ? itemType : void 0
|
|
31421
|
+
itemType: kind === "backlog-item" ? itemType : void 0,
|
|
31422
|
+
draft: kind === "pr" && prNumber === null ? draft : void 0
|
|
31390
31423
|
};
|
|
31391
31424
|
waiters.set(id, client);
|
|
31392
|
-
const target = kind === "backlog-item" ? `backlog ${itemType}` : prNumber === null ? "create" : `edit #${prNumber}`;
|
|
31425
|
+
const target = kind === "backlog-item" ? `backlog ${itemType}` : prNumber === null ? draft ? "create draft" : "create" : `edit #${prNumber}`;
|
|
31393
31426
|
daemonLog(
|
|
31394
31427
|
`pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target}`
|
|
31395
31428
|
);
|
|
@@ -33540,7 +33573,7 @@ function allocateAndBind(ctx, cwd, create, options2 = {}, context) {
|
|
|
33540
33573
|
}
|
|
33541
33574
|
|
|
33542
33575
|
// src/commands/sessions/daemon/worktree/ensureWatcher.ts
|
|
33543
|
-
function ensureWatcher(ctx, cwd
|
|
33576
|
+
function ensureWatcher(ctx, cwd) {
|
|
33544
33577
|
if (!cwd) return void 0;
|
|
33545
33578
|
const repoRoot2 = findRepoRoot(cwd) ?? cwd;
|
|
33546
33579
|
const cfg = worktreeConfigFor(repoRoot2);
|
|
@@ -33557,8 +33590,7 @@ function ensureWatcher(ctx, cwd, launchedFrom) {
|
|
|
33557
33590
|
ctx,
|
|
33558
33591
|
clone,
|
|
33559
33592
|
(sid, resolvedCwd) => createWatcherSession(sid, resolvedCwd ?? clone),
|
|
33560
|
-
{ inPlace: true }
|
|
33561
|
-
{ launchedFrom }
|
|
33593
|
+
{ inPlace: true }
|
|
33562
33594
|
);
|
|
33563
33595
|
daemonLog(
|
|
33564
33596
|
`spawned watcher session ${id} running /watch in the clone ${clone}`
|
|
@@ -33656,7 +33688,7 @@ function reuseSessionForRun(session, itemId2, clients, onStatusChange, tree) {
|
|
|
33656
33688
|
onStatusChange
|
|
33657
33689
|
);
|
|
33658
33690
|
if (!started) return;
|
|
33659
|
-
if (tree) ensureWatcher(tree, originCwd
|
|
33691
|
+
if (tree) ensureWatcher(tree, originCwd);
|
|
33660
33692
|
attachReusedRun(session, alloc, clients, onStatusChange, tree);
|
|
33661
33693
|
daemonLog(
|
|
33662
33694
|
`session ${session.id} reused for backlog run ${itemId2}: ${session.name}`
|
|
@@ -34614,7 +34646,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
34614
34646
|
},
|
|
34615
34647
|
context
|
|
34616
34648
|
);
|
|
34617
|
-
if (isBacklogRunArgs(assistArgs)) ensureWatcher(ctx, cwd
|
|
34649
|
+
if (isBacklogRunArgs(assistArgs)) ensureWatcher(ctx, cwd);
|
|
34618
34650
|
return id;
|
|
34619
34651
|
}
|
|
34620
34652
|
function resumeInTree(ctx, sessionId, cwd, name) {
|