@staff0rd/assist 0.346.0 → 0.347.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/README.md +3 -0
- package/allowed.cli-writes +1 -0
- package/dist/allowed.cli-writes +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +180 -86
- 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.347.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -201,6 +201,9 @@ var assistConfigSchema = z2.strictObject({
|
|
|
201
201
|
push: z2.boolean().default(false),
|
|
202
202
|
expectedBranch: z2.string().optional()
|
|
203
203
|
}).default({ conventional: false, pull: false, push: false }),
|
|
204
|
+
branch: z2.strictObject({
|
|
205
|
+
prefix: z2.string().optional()
|
|
206
|
+
}).optional(),
|
|
204
207
|
devlog: z2.strictObject({
|
|
205
208
|
name: z2.string().optional(),
|
|
206
209
|
ignore: z2.array(z2.string()).optional(),
|
|
@@ -6146,8 +6149,8 @@ import { promisify } from "util";
|
|
|
6146
6149
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
6147
6150
|
import { existsSync as existsSync24, readdirSync, statSync as statSync2 } from "fs";
|
|
6148
6151
|
import { basename as basename2, dirname as dirname18, join as join21 } from "path";
|
|
6149
|
-
function findSynthesisForBranch(repoReviewsDir,
|
|
6150
|
-
const branchKeyPath = join21(repoReviewsDir, `${
|
|
6152
|
+
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
6153
|
+
const branchKeyPath = join21(repoReviewsDir, `${branch2}-`);
|
|
6151
6154
|
const parent = dirname18(branchKeyPath);
|
|
6152
6155
|
const branchPrefix = basename2(branchKeyPath);
|
|
6153
6156
|
if (!existsSync24(parent)) return null;
|
|
@@ -6184,7 +6187,7 @@ function runGit(cwd, args) {
|
|
|
6184
6187
|
}).then((r) => r.stdout.trim());
|
|
6185
6188
|
}
|
|
6186
6189
|
async function resolveSynthesisPath(cwd) {
|
|
6187
|
-
const [repoRoot,
|
|
6190
|
+
const [repoRoot, branch2] = await Promise.all([
|
|
6188
6191
|
runGit(cwd, ["rev-parse", "--show-toplevel"]),
|
|
6189
6192
|
runGit(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
6190
6193
|
]);
|
|
@@ -6194,7 +6197,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
6194
6197
|
"reviews",
|
|
6195
6198
|
basename3(repoRoot)
|
|
6196
6199
|
);
|
|
6197
|
-
return findSynthesisForBranch(repoReviewsDir,
|
|
6200
|
+
return findSynthesisForBranch(repoReviewsDir, branch2);
|
|
6198
6201
|
}
|
|
6199
6202
|
async function getReviewSynthesis(req, res) {
|
|
6200
6203
|
const cwd = getCwdParam(req, res);
|
|
@@ -8698,6 +8701,96 @@ function registerBacklog(program2) {
|
|
|
8698
8701
|
}
|
|
8699
8702
|
}
|
|
8700
8703
|
|
|
8704
|
+
// src/commands/branch/branch.ts
|
|
8705
|
+
import { execSync as execSync24 } from "child_process";
|
|
8706
|
+
|
|
8707
|
+
// src/commands/branch/buildBranchName.ts
|
|
8708
|
+
function buildBranchName({
|
|
8709
|
+
prefix: prefix2,
|
|
8710
|
+
jira,
|
|
8711
|
+
slug
|
|
8712
|
+
}) {
|
|
8713
|
+
const segments = [];
|
|
8714
|
+
if (prefix2) segments.push(`${prefix2}/`);
|
|
8715
|
+
if (jira) segments.push(`${jira}-`);
|
|
8716
|
+
segments.push(slug);
|
|
8717
|
+
return segments.join("");
|
|
8718
|
+
}
|
|
8719
|
+
|
|
8720
|
+
// src/commands/branch/resolveDefaultBranch.ts
|
|
8721
|
+
import { execSync as execSync23 } from "child_process";
|
|
8722
|
+
function resolveDefaultBranch(cwd) {
|
|
8723
|
+
const ref = execSync23("git symbolic-ref --short refs/remotes/origin/HEAD", {
|
|
8724
|
+
encoding: "utf8",
|
|
8725
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
8726
|
+
cwd
|
|
8727
|
+
}).trim();
|
|
8728
|
+
const [, ...rest] = ref.split("/");
|
|
8729
|
+
const branch2 = rest.join("/");
|
|
8730
|
+
if (!branch2) {
|
|
8731
|
+
throw new Error(`Could not resolve default branch from "${ref}"`);
|
|
8732
|
+
}
|
|
8733
|
+
return branch2;
|
|
8734
|
+
}
|
|
8735
|
+
|
|
8736
|
+
// src/commands/branch/validateSlug.ts
|
|
8737
|
+
var KEBAB_CASE_REGEX = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
8738
|
+
var HASH_REF_REGEX = /#\d+/;
|
|
8739
|
+
var BACKLOG_NUMBER_SEGMENT_REGEX = /(?:^|-)\d{1,4}(?:-|$)/;
|
|
8740
|
+
function validateSlug(slug) {
|
|
8741
|
+
if (!slug) {
|
|
8742
|
+
return "Slug is required";
|
|
8743
|
+
}
|
|
8744
|
+
if (HASH_REF_REGEX.test(slug)) {
|
|
8745
|
+
return `Slug "${slug}" contains a backlog reference (#<number>); remove it`;
|
|
8746
|
+
}
|
|
8747
|
+
if (!KEBAB_CASE_REGEX.test(slug)) {
|
|
8748
|
+
return `Slug "${slug}" must be kebab-case (lowercase letters, digits, and hyphens)`;
|
|
8749
|
+
}
|
|
8750
|
+
if (BACKLOG_NUMBER_SEGMENT_REGEX.test(slug)) {
|
|
8751
|
+
return `Slug "${slug}" contains a numeric token that looks like a backlog ID; remove or reword it`;
|
|
8752
|
+
}
|
|
8753
|
+
return null;
|
|
8754
|
+
}
|
|
8755
|
+
|
|
8756
|
+
// src/commands/branch/branch.ts
|
|
8757
|
+
function branch(slug, options2) {
|
|
8758
|
+
const slugError = validateSlug(slug);
|
|
8759
|
+
if (slugError) {
|
|
8760
|
+
console.error(`Error: ${slugError}`);
|
|
8761
|
+
process.exit(1);
|
|
8762
|
+
}
|
|
8763
|
+
const config = loadConfig();
|
|
8764
|
+
const branchName = buildBranchName({
|
|
8765
|
+
prefix: config.branch?.prefix,
|
|
8766
|
+
jira: options2.jira,
|
|
8767
|
+
slug
|
|
8768
|
+
});
|
|
8769
|
+
try {
|
|
8770
|
+
const defaultBranch = resolveDefaultBranch();
|
|
8771
|
+
execSync24("git fetch", { stdio: "inherit" });
|
|
8772
|
+
execSync24(
|
|
8773
|
+
`git switch -c ${shellQuote(branchName)} ${shellQuote(`origin/${defaultBranch}`)}`,
|
|
8774
|
+
{ stdio: "inherit" }
|
|
8775
|
+
);
|
|
8776
|
+
console.log(
|
|
8777
|
+
`Created and switched to ${branchName} (from origin/${defaultBranch})`
|
|
8778
|
+
);
|
|
8779
|
+
process.exit(0);
|
|
8780
|
+
} catch {
|
|
8781
|
+
process.exit(1);
|
|
8782
|
+
}
|
|
8783
|
+
}
|
|
8784
|
+
|
|
8785
|
+
// src/commands/registerBranch.ts
|
|
8786
|
+
function registerBranch(program2) {
|
|
8787
|
+
program2.command("branch <slug>").description(
|
|
8788
|
+
"Create and switch to a branch off the fresh remote default branch"
|
|
8789
|
+
).option("--jira <key>", "Jira issue key to include in the branch name").action(
|
|
8790
|
+
(slug, options2) => branch(slug, options2)
|
|
8791
|
+
);
|
|
8792
|
+
}
|
|
8793
|
+
|
|
8701
8794
|
// src/commands/cliHook/index.ts
|
|
8702
8795
|
import { basename as basename4 } from "path";
|
|
8703
8796
|
|
|
@@ -9336,7 +9429,7 @@ import { homedir as homedir12 } from "os";
|
|
|
9336
9429
|
import { join as join26 } from "path";
|
|
9337
9430
|
|
|
9338
9431
|
// src/shared/checkCliAvailable.ts
|
|
9339
|
-
import { execSync as
|
|
9432
|
+
import { execSync as execSync25 } from "child_process";
|
|
9340
9433
|
function checkCliAvailable(cli) {
|
|
9341
9434
|
const binary = cli.split(/\s+/)[0];
|
|
9342
9435
|
const opts = {
|
|
@@ -9344,11 +9437,11 @@ function checkCliAvailable(cli) {
|
|
|
9344
9437
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9345
9438
|
};
|
|
9346
9439
|
try {
|
|
9347
|
-
|
|
9440
|
+
execSync25(`command -v ${binary}`, opts);
|
|
9348
9441
|
return true;
|
|
9349
9442
|
} catch {
|
|
9350
9443
|
try {
|
|
9351
|
-
|
|
9444
|
+
execSync25(`where ${binary}`, opts);
|
|
9352
9445
|
return true;
|
|
9353
9446
|
} catch {
|
|
9354
9447
|
return false;
|
|
@@ -10724,7 +10817,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
10724
10817
|
}
|
|
10725
10818
|
|
|
10726
10819
|
// src/commands/devlog/shared.ts
|
|
10727
|
-
import { execSync as
|
|
10820
|
+
import { execSync as execSync26 } from "child_process";
|
|
10728
10821
|
import chalk109 from "chalk";
|
|
10729
10822
|
|
|
10730
10823
|
// src/shared/getRepoName.ts
|
|
@@ -10816,7 +10909,7 @@ function loadAllDevlogLatestDates() {
|
|
|
10816
10909
|
// src/commands/devlog/shared.ts
|
|
10817
10910
|
function getCommitFiles(hash) {
|
|
10818
10911
|
try {
|
|
10819
|
-
const output =
|
|
10912
|
+
const output = execSync26(`git show --name-only --format="" ${hash}`, {
|
|
10820
10913
|
encoding: "utf8"
|
|
10821
10914
|
});
|
|
10822
10915
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -10912,11 +11005,11 @@ function list3(options2) {
|
|
|
10912
11005
|
}
|
|
10913
11006
|
|
|
10914
11007
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
10915
|
-
import { execFileSync as execFileSync3, execSync as
|
|
11008
|
+
import { execFileSync as execFileSync3, execSync as execSync27 } from "child_process";
|
|
10916
11009
|
import semver from "semver";
|
|
10917
11010
|
function getVersionAtCommit(hash) {
|
|
10918
11011
|
try {
|
|
10919
|
-
const content =
|
|
11012
|
+
const content = execSync27(`git show ${hash}:package.json`, {
|
|
10920
11013
|
encoding: "utf8"
|
|
10921
11014
|
});
|
|
10922
11015
|
const pkg = JSON.parse(content);
|
|
@@ -11089,7 +11182,7 @@ function next2(options2) {
|
|
|
11089
11182
|
}
|
|
11090
11183
|
|
|
11091
11184
|
// src/commands/devlog/repos/index.ts
|
|
11092
|
-
import { execSync as
|
|
11185
|
+
import { execSync as execSync28 } from "child_process";
|
|
11093
11186
|
|
|
11094
11187
|
// src/commands/devlog/repos/printReposTable.ts
|
|
11095
11188
|
import chalk113 from "chalk";
|
|
@@ -11124,7 +11217,7 @@ function getStatus(lastPush, lastDevlog) {
|
|
|
11124
11217
|
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
11125
11218
|
}
|
|
11126
11219
|
function fetchRepos(days, all) {
|
|
11127
|
-
const json =
|
|
11220
|
+
const json = execSync28(
|
|
11128
11221
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
11129
11222
|
{ encoding: "utf8" }
|
|
11130
11223
|
);
|
|
@@ -11484,7 +11577,7 @@ async function deps(csprojPath, options2) {
|
|
|
11484
11577
|
}
|
|
11485
11578
|
|
|
11486
11579
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
11487
|
-
import { execSync as
|
|
11580
|
+
import { execSync as execSync29 } from "child_process";
|
|
11488
11581
|
var SCOPE_ALL = "all";
|
|
11489
11582
|
var SCOPE_BASE = "base:";
|
|
11490
11583
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -11508,7 +11601,7 @@ function getChangedCsFiles(scope) {
|
|
|
11508
11601
|
} else {
|
|
11509
11602
|
cmd = "git diff --name-only HEAD";
|
|
11510
11603
|
}
|
|
11511
|
-
const output =
|
|
11604
|
+
const output = execSync29(cmd, { encoding: "utf8" }).trim();
|
|
11512
11605
|
if (output === "") return [];
|
|
11513
11606
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
11514
11607
|
}
|
|
@@ -11706,14 +11799,14 @@ function parseInspectReport(json) {
|
|
|
11706
11799
|
}
|
|
11707
11800
|
|
|
11708
11801
|
// src/commands/dotnet/runInspectCode.ts
|
|
11709
|
-
import { execSync as
|
|
11802
|
+
import { execSync as execSync30 } from "child_process";
|
|
11710
11803
|
import { existsSync as existsSync35, readFileSync as readFileSync30, unlinkSync as unlinkSync9 } from "fs";
|
|
11711
11804
|
import { tmpdir as tmpdir3 } from "os";
|
|
11712
11805
|
import path27 from "path";
|
|
11713
11806
|
import chalk123 from "chalk";
|
|
11714
11807
|
function assertJbInstalled() {
|
|
11715
11808
|
try {
|
|
11716
|
-
|
|
11809
|
+
execSync30("jb inspectcode --version", { stdio: "pipe" });
|
|
11717
11810
|
} catch {
|
|
11718
11811
|
console.error(chalk123.red("jb is not installed. Install with:"));
|
|
11719
11812
|
console.error(
|
|
@@ -11727,7 +11820,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
11727
11820
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
11728
11821
|
const sweaFlag = swea ? " --swea" : "";
|
|
11729
11822
|
try {
|
|
11730
|
-
|
|
11823
|
+
execSync30(
|
|
11731
11824
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
11732
11825
|
{ stdio: "pipe" }
|
|
11733
11826
|
);
|
|
@@ -11748,7 +11841,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
11748
11841
|
}
|
|
11749
11842
|
|
|
11750
11843
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
11751
|
-
import { execSync as
|
|
11844
|
+
import { execSync as execSync31 } from "child_process";
|
|
11752
11845
|
import chalk124 from "chalk";
|
|
11753
11846
|
function resolveMsbuildPath() {
|
|
11754
11847
|
const { run: run4 } = loadConfig();
|
|
@@ -11759,7 +11852,7 @@ function resolveMsbuildPath() {
|
|
|
11759
11852
|
function assertMsbuildInstalled() {
|
|
11760
11853
|
const msbuild = resolveMsbuildPath();
|
|
11761
11854
|
try {
|
|
11762
|
-
|
|
11855
|
+
execSync31(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
11763
11856
|
} catch {
|
|
11764
11857
|
console.error(chalk124.red(`msbuild not found at: ${msbuild}`));
|
|
11765
11858
|
console.error(
|
|
@@ -11785,7 +11878,7 @@ function runRoslynInspect(slnPath) {
|
|
|
11785
11878
|
const msbuild = resolveMsbuildPath();
|
|
11786
11879
|
let output;
|
|
11787
11880
|
try {
|
|
11788
|
-
output =
|
|
11881
|
+
output = execSync31(
|
|
11789
11882
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
11790
11883
|
{ encoding: "utf8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
11791
11884
|
);
|
|
@@ -12574,7 +12667,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
12574
12667
|
}
|
|
12575
12668
|
|
|
12576
12669
|
// src/commands/jira/jiraAuth.ts
|
|
12577
|
-
import { execSync as
|
|
12670
|
+
import { execSync as execSync32 } from "child_process";
|
|
12578
12671
|
|
|
12579
12672
|
// src/shared/loadJson.ts
|
|
12580
12673
|
import { existsSync as existsSync37, mkdirSync as mkdirSync13, readFileSync as readFileSync32, writeFileSync as writeFileSync27 } from "fs";
|
|
@@ -12638,7 +12731,7 @@ async function jiraAuth() {
|
|
|
12638
12731
|
console.error("All fields are required.");
|
|
12639
12732
|
process.exit(1);
|
|
12640
12733
|
}
|
|
12641
|
-
|
|
12734
|
+
execSync32(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
12642
12735
|
encoding: "utf8",
|
|
12643
12736
|
input: token,
|
|
12644
12737
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -13640,7 +13733,7 @@ function registerPrompts(program2) {
|
|
|
13640
13733
|
}
|
|
13641
13734
|
|
|
13642
13735
|
// src/commands/prs/shared.ts
|
|
13643
|
-
import { execSync as
|
|
13736
|
+
import { execSync as execSync33 } from "child_process";
|
|
13644
13737
|
function isGhNotInstalled(error) {
|
|
13645
13738
|
if (error instanceof Error) {
|
|
13646
13739
|
const msg = error.message.toLowerCase();
|
|
@@ -13658,20 +13751,20 @@ function getRepoInfo() {
|
|
|
13658
13751
|
const preferred = getPreferredRemoteRepo();
|
|
13659
13752
|
if (preferred) return preferred;
|
|
13660
13753
|
const repoInfo = JSON.parse(
|
|
13661
|
-
|
|
13754
|
+
execSync33("gh repo view --json owner,name", { encoding: "utf8" })
|
|
13662
13755
|
);
|
|
13663
13756
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
13664
13757
|
}
|
|
13665
13758
|
function getCurrentBranch() {
|
|
13666
|
-
return
|
|
13759
|
+
return execSync33("git rev-parse --abbrev-ref HEAD", {
|
|
13667
13760
|
encoding: "utf8"
|
|
13668
13761
|
}).trim();
|
|
13669
13762
|
}
|
|
13670
13763
|
function viewCurrentPr(fields) {
|
|
13671
13764
|
const { org, repo } = getRepoInfo();
|
|
13672
|
-
const
|
|
13765
|
+
const branch2 = getCurrentBranch();
|
|
13673
13766
|
return JSON.parse(
|
|
13674
|
-
|
|
13767
|
+
execSync33(`gh pr view ${branch2} --json ${fields} -R ${org}/${repo}`, {
|
|
13675
13768
|
encoding: "utf8"
|
|
13676
13769
|
})
|
|
13677
13770
|
);
|
|
@@ -13775,7 +13868,7 @@ function comment2(path57, line, body, startLine) {
|
|
|
13775
13868
|
}
|
|
13776
13869
|
|
|
13777
13870
|
// src/commands/prs/edit.ts
|
|
13778
|
-
import { execSync as
|
|
13871
|
+
import { execSync as execSync34 } from "child_process";
|
|
13779
13872
|
|
|
13780
13873
|
// src/commands/prs/buildPrBody.ts
|
|
13781
13874
|
function jiraBrowseUrl(key) {
|
|
@@ -13948,17 +14041,17 @@ function edit(options2) {
|
|
|
13948
14041
|
if (options2.title) args.push(`--title ${shellQuote(options2.title)}`);
|
|
13949
14042
|
args.push(`--body ${shellQuote(newBody)}`);
|
|
13950
14043
|
try {
|
|
13951
|
-
|
|
14044
|
+
execSync34(args.join(" "), { stdio: "inherit" });
|
|
13952
14045
|
} catch {
|
|
13953
14046
|
process.exit(1);
|
|
13954
14047
|
}
|
|
13955
14048
|
}
|
|
13956
14049
|
|
|
13957
14050
|
// src/commands/prs/fixed.ts
|
|
13958
|
-
import { execSync as
|
|
14051
|
+
import { execSync as execSync37 } from "child_process";
|
|
13959
14052
|
|
|
13960
14053
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
13961
|
-
import { execSync as
|
|
14054
|
+
import { execSync as execSync36 } from "child_process";
|
|
13962
14055
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
13963
14056
|
import { tmpdir as tmpdir5 } from "os";
|
|
13964
14057
|
import { join as join46 } from "path";
|
|
@@ -13987,9 +14080,9 @@ function deleteCommentsCache(prNumber) {
|
|
|
13987
14080
|
}
|
|
13988
14081
|
|
|
13989
14082
|
// src/commands/prs/replyToComment.ts
|
|
13990
|
-
import { execSync as
|
|
14083
|
+
import { execSync as execSync35 } from "child_process";
|
|
13991
14084
|
function replyToComment(org, repo, prNumber, commentId, message) {
|
|
13992
|
-
|
|
14085
|
+
execSync35(
|
|
13993
14086
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, String.raw`\"`)}" -F in_reply_to=${commentId}`,
|
|
13994
14087
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
13995
14088
|
);
|
|
@@ -14001,7 +14094,7 @@ function resolveThread(threadId) {
|
|
|
14001
14094
|
const queryFile = join46(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
|
|
14002
14095
|
writeFileSync30(queryFile, mutation);
|
|
14003
14096
|
try {
|
|
14004
|
-
|
|
14097
|
+
execSync36(
|
|
14005
14098
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
14006
14099
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
14007
14100
|
);
|
|
@@ -14053,7 +14146,7 @@ function resolveCommentWithReply(commentId, message) {
|
|
|
14053
14146
|
// src/commands/prs/fixed.ts
|
|
14054
14147
|
function verifySha(sha) {
|
|
14055
14148
|
try {
|
|
14056
|
-
return
|
|
14149
|
+
return execSync37(`git rev-parse --verify ${sha}`, {
|
|
14057
14150
|
encoding: "utf8"
|
|
14058
14151
|
}).trim();
|
|
14059
14152
|
} catch {
|
|
@@ -14067,7 +14160,7 @@ function fixed(commentId, sha) {
|
|
|
14067
14160
|
const { org, repo } = getRepoInfo();
|
|
14068
14161
|
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
14069
14162
|
const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
14070
|
-
|
|
14163
|
+
execSync37("git push", { stdio: "inherit" });
|
|
14071
14164
|
resolveCommentWithReply(commentId, message);
|
|
14072
14165
|
} catch (error) {
|
|
14073
14166
|
if (isGhNotInstalled(error)) {
|
|
@@ -14085,7 +14178,7 @@ import { join as join48 } from "path";
|
|
|
14085
14178
|
import { stringify } from "yaml";
|
|
14086
14179
|
|
|
14087
14180
|
// src/commands/prs/fetchThreadIds.ts
|
|
14088
|
-
import { execSync as
|
|
14181
|
+
import { execSync as execSync38 } from "child_process";
|
|
14089
14182
|
import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync31 } from "fs";
|
|
14090
14183
|
import { tmpdir as tmpdir6 } from "os";
|
|
14091
14184
|
import { join as join47 } from "path";
|
|
@@ -14094,7 +14187,7 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
14094
14187
|
const queryFile = join47(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
14095
14188
|
writeFileSync31(queryFile, THREAD_QUERY);
|
|
14096
14189
|
try {
|
|
14097
|
-
const result =
|
|
14190
|
+
const result = execSync38(
|
|
14098
14191
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
14099
14192
|
{ encoding: "utf8" }
|
|
14100
14193
|
);
|
|
@@ -14116,9 +14209,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
14116
14209
|
}
|
|
14117
14210
|
|
|
14118
14211
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
14119
|
-
import { execSync as
|
|
14212
|
+
import { execSync as execSync39 } from "child_process";
|
|
14120
14213
|
function fetchJson(endpoint) {
|
|
14121
|
-
const result =
|
|
14214
|
+
const result = execSync39(`gh api --paginate ${endpoint}`, {
|
|
14122
14215
|
encoding: "utf8"
|
|
14123
14216
|
});
|
|
14124
14217
|
if (!result.trim()) return [];
|
|
@@ -14257,7 +14350,7 @@ async function listComments() {
|
|
|
14257
14350
|
}
|
|
14258
14351
|
|
|
14259
14352
|
// src/commands/prs/prs/index.ts
|
|
14260
|
-
import { execSync as
|
|
14353
|
+
import { execSync as execSync40 } from "child_process";
|
|
14261
14354
|
|
|
14262
14355
|
// src/commands/prs/prs/displayPaginated/index.ts
|
|
14263
14356
|
import enquirer9 from "enquirer";
|
|
@@ -14364,7 +14457,7 @@ async function prs(options2) {
|
|
|
14364
14457
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
14365
14458
|
try {
|
|
14366
14459
|
const { org, repo } = getRepoInfo();
|
|
14367
|
-
const result =
|
|
14460
|
+
const result = execSync40(
|
|
14368
14461
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
14369
14462
|
{ encoding: "utf8" }
|
|
14370
14463
|
);
|
|
@@ -14387,7 +14480,7 @@ async function prs(options2) {
|
|
|
14387
14480
|
}
|
|
14388
14481
|
|
|
14389
14482
|
// src/commands/prs/raise.ts
|
|
14390
|
-
import { execSync as
|
|
14483
|
+
import { execSync as execSync41 } from "child_process";
|
|
14391
14484
|
|
|
14392
14485
|
// src/commands/prs/buildCreateArgs.ts
|
|
14393
14486
|
function buildCreateArgs(title, body, options2) {
|
|
@@ -14447,7 +14540,7 @@ function raise(options2) {
|
|
|
14447
14540
|
`--body ${shellQuote(body)}`
|
|
14448
14541
|
] : buildCreateArgs(options2.title, body, options2);
|
|
14449
14542
|
try {
|
|
14450
|
-
|
|
14543
|
+
execSync41(args.join(" "), { stdio: "inherit" });
|
|
14451
14544
|
} catch {
|
|
14452
14545
|
process.exit(1);
|
|
14453
14546
|
}
|
|
@@ -14479,7 +14572,7 @@ function reply(commentId, body) {
|
|
|
14479
14572
|
}
|
|
14480
14573
|
|
|
14481
14574
|
// src/commands/prs/wontfix.ts
|
|
14482
|
-
import { execSync as
|
|
14575
|
+
import { execSync as execSync42 } from "child_process";
|
|
14483
14576
|
function validateReason(reason) {
|
|
14484
14577
|
const lowerReason = reason.toLowerCase();
|
|
14485
14578
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -14496,7 +14589,7 @@ function validateShaReferences(reason) {
|
|
|
14496
14589
|
const invalidShas = [];
|
|
14497
14590
|
for (const sha of shas) {
|
|
14498
14591
|
try {
|
|
14499
|
-
|
|
14592
|
+
execSync42(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
14500
14593
|
} catch {
|
|
14501
14594
|
invalidShas.push(sha);
|
|
14502
14595
|
}
|
|
@@ -14658,10 +14751,10 @@ import chalk143 from "chalk";
|
|
|
14658
14751
|
import Enquirer2 from "enquirer";
|
|
14659
14752
|
|
|
14660
14753
|
// src/commands/ravendb/searchItems.ts
|
|
14661
|
-
import { execSync as
|
|
14754
|
+
import { execSync as execSync43 } from "child_process";
|
|
14662
14755
|
import chalk142 from "chalk";
|
|
14663
14756
|
function opExec(args) {
|
|
14664
|
-
return
|
|
14757
|
+
return execSync43(`op ${args}`, {
|
|
14665
14758
|
encoding: "utf8",
|
|
14666
14759
|
stdio: ["pipe", "pipe", "pipe"]
|
|
14667
14760
|
}).trim();
|
|
@@ -14813,7 +14906,7 @@ ${errorText}`
|
|
|
14813
14906
|
}
|
|
14814
14907
|
|
|
14815
14908
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
14816
|
-
import { execSync as
|
|
14909
|
+
import { execSync as execSync44 } from "child_process";
|
|
14817
14910
|
import chalk147 from "chalk";
|
|
14818
14911
|
function resolveOpSecret(reference) {
|
|
14819
14912
|
if (!reference.startsWith("op://")) {
|
|
@@ -14821,7 +14914,7 @@ function resolveOpSecret(reference) {
|
|
|
14821
14914
|
process.exit(1);
|
|
14822
14915
|
}
|
|
14823
14916
|
try {
|
|
14824
|
-
return
|
|
14917
|
+
return execSync44(`op read "${reference}"`, {
|
|
14825
14918
|
encoding: "utf8",
|
|
14826
14919
|
stdio: ["pipe", "pipe", "pipe"]
|
|
14827
14920
|
}).trim();
|
|
@@ -15070,7 +15163,7 @@ Refactor check failed:
|
|
|
15070
15163
|
}
|
|
15071
15164
|
|
|
15072
15165
|
// src/commands/refactor/check/getViolations/index.ts
|
|
15073
|
-
import { execSync as
|
|
15166
|
+
import { execSync as execSync45 } from "child_process";
|
|
15074
15167
|
import fs22 from "fs";
|
|
15075
15168
|
import { minimatch as minimatch6 } from "minimatch";
|
|
15076
15169
|
|
|
@@ -15120,7 +15213,7 @@ function getGitFiles(options2) {
|
|
|
15120
15213
|
}
|
|
15121
15214
|
const files = /* @__PURE__ */ new Set();
|
|
15122
15215
|
if (options2.staged || options2.modified) {
|
|
15123
|
-
const staged =
|
|
15216
|
+
const staged = execSync45("git diff --cached --name-only", {
|
|
15124
15217
|
encoding: "utf8"
|
|
15125
15218
|
});
|
|
15126
15219
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -15128,7 +15221,7 @@ function getGitFiles(options2) {
|
|
|
15128
15221
|
}
|
|
15129
15222
|
}
|
|
15130
15223
|
if (options2.unstaged || options2.modified) {
|
|
15131
|
-
const unstaged =
|
|
15224
|
+
const unstaged = execSync45("git diff --name-only", { encoding: "utf8" });
|
|
15132
15225
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
15133
15226
|
files.add(file);
|
|
15134
15227
|
}
|
|
@@ -16772,9 +16865,9 @@ function buildReviewPaths(repoRoot, key) {
|
|
|
16772
16865
|
}
|
|
16773
16866
|
|
|
16774
16867
|
// src/commands/review/fetchExistingComments.ts
|
|
16775
|
-
import { execSync as
|
|
16868
|
+
import { execSync as execSync46 } from "child_process";
|
|
16776
16869
|
function fetchRawComments(org, repo, prNumber) {
|
|
16777
|
-
const out =
|
|
16870
|
+
const out = execSync46(
|
|
16778
16871
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
16779
16872
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
16780
16873
|
);
|
|
@@ -16805,14 +16898,14 @@ function fetchExistingComments() {
|
|
|
16805
16898
|
}
|
|
16806
16899
|
|
|
16807
16900
|
// src/commands/review/gatherContext.ts
|
|
16808
|
-
import { execSync as
|
|
16901
|
+
import { execSync as execSync49 } from "child_process";
|
|
16809
16902
|
|
|
16810
16903
|
// src/commands/review/fetchPrDiff.ts
|
|
16811
|
-
import { execSync as
|
|
16904
|
+
import { execSync as execSync47 } from "child_process";
|
|
16812
16905
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
16813
16906
|
const { org, repo } = getRepoInfo();
|
|
16814
16907
|
try {
|
|
16815
|
-
return
|
|
16908
|
+
return execSync47(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
16816
16909
|
encoding: "utf8",
|
|
16817
16910
|
maxBuffer: 256 * 1024 * 1024,
|
|
16818
16911
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -16827,36 +16920,36 @@ function isDiffTooLarge(error) {
|
|
|
16827
16920
|
}
|
|
16828
16921
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
16829
16922
|
try {
|
|
16830
|
-
|
|
16923
|
+
execSync47(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
16831
16924
|
} catch {
|
|
16832
16925
|
}
|
|
16833
|
-
return
|
|
16926
|
+
return execSync47(`git diff ${baseSha}...${headSha}`, {
|
|
16834
16927
|
encoding: "utf8",
|
|
16835
16928
|
maxBuffer: 256 * 1024 * 1024
|
|
16836
16929
|
});
|
|
16837
16930
|
}
|
|
16838
16931
|
|
|
16839
16932
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
16840
|
-
import { execSync as
|
|
16933
|
+
import { execSync as execSync48 } from "child_process";
|
|
16841
16934
|
function getCurrentBranch2() {
|
|
16842
|
-
return
|
|
16935
|
+
return execSync48("git rev-parse --abbrev-ref HEAD", {
|
|
16843
16936
|
encoding: "utf8"
|
|
16844
16937
|
}).trim();
|
|
16845
16938
|
}
|
|
16846
16939
|
function fetchPrDiffInfo() {
|
|
16847
16940
|
const { org, repo } = getRepoInfo();
|
|
16848
|
-
const
|
|
16941
|
+
const branch2 = getCurrentBranch2();
|
|
16849
16942
|
const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
16850
16943
|
let raw;
|
|
16851
16944
|
try {
|
|
16852
|
-
raw =
|
|
16945
|
+
raw = execSync48(`gh pr view ${branch2} --json ${fields} -R ${org}/${repo}`, {
|
|
16853
16946
|
encoding: "utf8",
|
|
16854
16947
|
stdio: ["ignore", "pipe", "pipe"]
|
|
16855
16948
|
});
|
|
16856
16949
|
} catch (error) {
|
|
16857
16950
|
if (error instanceof Error && error.message.includes("no pull requests")) {
|
|
16858
16951
|
console.error(
|
|
16859
|
-
`Error: No open pull request found for branch \`${
|
|
16952
|
+
`Error: No open pull request found for branch \`${branch2}\`. Open a PR for this branch before running \`assist review\`.`
|
|
16860
16953
|
);
|
|
16861
16954
|
process.exit(1);
|
|
16862
16955
|
}
|
|
@@ -16873,7 +16966,7 @@ function fetchPrDiffInfo() {
|
|
|
16873
16966
|
}
|
|
16874
16967
|
function fetchPrChangedFiles(prNumber) {
|
|
16875
16968
|
const { org, repo } = getRepoInfo();
|
|
16876
|
-
const out =
|
|
16969
|
+
const out = execSync48(
|
|
16877
16970
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
16878
16971
|
{
|
|
16879
16972
|
encoding: "utf8",
|
|
@@ -16885,18 +16978,18 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
16885
16978
|
|
|
16886
16979
|
// src/commands/review/gatherContext.ts
|
|
16887
16980
|
function gatherContext() {
|
|
16888
|
-
const
|
|
16981
|
+
const branch2 = execSync49("git rev-parse --abbrev-ref HEAD", {
|
|
16889
16982
|
encoding: "utf8"
|
|
16890
16983
|
}).trim();
|
|
16891
|
-
const sha =
|
|
16892
|
-
const shortSha =
|
|
16984
|
+
const sha = execSync49("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
16985
|
+
const shortSha = execSync49("git rev-parse --short=7 HEAD", {
|
|
16893
16986
|
encoding: "utf8"
|
|
16894
16987
|
}).trim();
|
|
16895
16988
|
const prInfo = fetchPrDiffInfo();
|
|
16896
16989
|
const changedFiles = fetchPrChangedFiles(prInfo.prNumber);
|
|
16897
16990
|
const diff2 = fetchPrDiff(prInfo.prNumber, prInfo.baseSha, prInfo.headSha);
|
|
16898
16991
|
return {
|
|
16899
|
-
branch,
|
|
16992
|
+
branch: branch2,
|
|
16900
16993
|
sha,
|
|
16901
16994
|
shortSha,
|
|
16902
16995
|
prNumber: prInfo.prNumber,
|
|
@@ -19437,7 +19530,7 @@ import { mkdirSync as mkdirSync19 } from "fs";
|
|
|
19437
19530
|
import { join as join55 } from "path";
|
|
19438
19531
|
|
|
19439
19532
|
// src/commands/voice/checkLockFile.ts
|
|
19440
|
-
import { execSync as
|
|
19533
|
+
import { execSync as execSync50 } from "child_process";
|
|
19441
19534
|
import { existsSync as existsSync46, mkdirSync as mkdirSync18, readFileSync as readFileSync40, writeFileSync as writeFileSync36 } from "fs";
|
|
19442
19535
|
import { join as join54 } from "path";
|
|
19443
19536
|
function isProcessAlive2(pid) {
|
|
@@ -19466,7 +19559,7 @@ function bootstrapVenv() {
|
|
|
19466
19559
|
if (existsSync46(getVenvPython())) return;
|
|
19467
19560
|
console.log("Setting up Python environment...");
|
|
19468
19561
|
const pythonDir = getPythonDir();
|
|
19469
|
-
|
|
19562
|
+
execSync50(
|
|
19470
19563
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
19471
19564
|
{
|
|
19472
19565
|
stdio: "inherit",
|
|
@@ -19943,11 +20036,11 @@ function resolveParams(params, cliArgs) {
|
|
|
19943
20036
|
}
|
|
19944
20037
|
|
|
19945
20038
|
// src/commands/run/runPreCommands.ts
|
|
19946
|
-
import { execSync as
|
|
20039
|
+
import { execSync as execSync51 } from "child_process";
|
|
19947
20040
|
function runPreCommands(pre, cwd) {
|
|
19948
20041
|
for (const cmd of pre) {
|
|
19949
20042
|
try {
|
|
19950
|
-
|
|
20043
|
+
execSync51(cmd, { stdio: "inherit", cwd });
|
|
19951
20044
|
} catch (error) {
|
|
19952
20045
|
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
19953
20046
|
process.exit(code);
|
|
@@ -20231,7 +20324,7 @@ function registerRun(program2) {
|
|
|
20231
20324
|
}
|
|
20232
20325
|
|
|
20233
20326
|
// src/commands/screenshot/index.ts
|
|
20234
|
-
import { execSync as
|
|
20327
|
+
import { execSync as execSync52 } from "child_process";
|
|
20235
20328
|
import { existsSync as existsSync51, mkdirSync as mkdirSync22, unlinkSync as unlinkSync19, writeFileSync as writeFileSync39 } from "fs";
|
|
20236
20329
|
import { tmpdir as tmpdir7 } from "os";
|
|
20237
20330
|
import { join as join61, resolve as resolve15 } from "path";
|
|
@@ -20374,7 +20467,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
20374
20467
|
const scriptPath = join61(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
20375
20468
|
writeFileSync39(scriptPath, captureWindowPs1, "utf8");
|
|
20376
20469
|
try {
|
|
20377
|
-
|
|
20470
|
+
execSync52(
|
|
20378
20471
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
20379
20472
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
20380
20473
|
);
|
|
@@ -23314,7 +23407,7 @@ function syncCommands(claudeDir, targetBase) {
|
|
|
23314
23407
|
}
|
|
23315
23408
|
|
|
23316
23409
|
// src/commands/update.ts
|
|
23317
|
-
import { execSync as
|
|
23410
|
+
import { execSync as execSync53 } from "child_process";
|
|
23318
23411
|
import * as path56 from "path";
|
|
23319
23412
|
|
|
23320
23413
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -23338,7 +23431,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
23338
23431
|
if (resolved.split(path56.sep).includes("node_modules")) {
|
|
23339
23432
|
return true;
|
|
23340
23433
|
}
|
|
23341
|
-
const globalPrefix =
|
|
23434
|
+
const globalPrefix = execSync53("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
23342
23435
|
return resolved.toLowerCase().startsWith(path56.resolve(globalPrefix).toLowerCase());
|
|
23343
23436
|
} catch {
|
|
23344
23437
|
return false;
|
|
@@ -23349,18 +23442,18 @@ async function update2() {
|
|
|
23349
23442
|
console.log(`Assist is installed at: ${installDir}`);
|
|
23350
23443
|
if (isGitRepo(installDir)) {
|
|
23351
23444
|
console.log("Detected git repo installation, pulling latest...");
|
|
23352
|
-
|
|
23445
|
+
execSync53("git pull", { cwd: installDir, stdio: "inherit" });
|
|
23353
23446
|
console.log("Installing dependencies...");
|
|
23354
|
-
|
|
23447
|
+
execSync53("npm i", { cwd: installDir, stdio: "inherit" });
|
|
23355
23448
|
console.log("Building...");
|
|
23356
|
-
|
|
23449
|
+
execSync53("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
23357
23450
|
console.log("Syncing commands...");
|
|
23358
|
-
|
|
23451
|
+
execSync53("assist sync", { stdio: "inherit" });
|
|
23359
23452
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
23360
23453
|
console.log("Detected global npm installation, updating...");
|
|
23361
|
-
|
|
23454
|
+
execSync53("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
23362
23455
|
console.log("Syncing commands...");
|
|
23363
|
-
|
|
23456
|
+
execSync53("assist sync", { stdio: "inherit" });
|
|
23364
23457
|
} else {
|
|
23365
23458
|
console.error(
|
|
23366
23459
|
"Could not determine installation method. Expected a git repo or global npm install."
|
|
@@ -23402,6 +23495,7 @@ registerMermaid(program);
|
|
|
23402
23495
|
registerPrs(program);
|
|
23403
23496
|
registerRoam(program);
|
|
23404
23497
|
registerBacklog(program);
|
|
23498
|
+
registerBranch(program);
|
|
23405
23499
|
registerList(program);
|
|
23406
23500
|
registerVerify(program);
|
|
23407
23501
|
registerRefactor(program);
|