@staff0rd/assist 0.50.0 → 0.52.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/index.js +123 -97
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { execSync as
|
|
4
|
+
import { execSync as execSync23 } from "child_process";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "@staff0rd/assist",
|
|
10
|
-
version: "0.
|
|
10
|
+
version: "0.52.0",
|
|
11
11
|
type: "module",
|
|
12
12
|
main: "dist/index.js",
|
|
13
13
|
bin: {
|
|
@@ -802,7 +802,7 @@ function detectExistingSetup(pkg) {
|
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
804
|
|
|
805
|
-
// src/commands/verify/init/options.ts
|
|
805
|
+
// src/commands/verify/init/getAvailableOptions/options.ts
|
|
806
806
|
function getBuildDescription(setup) {
|
|
807
807
|
if (setup.hasVite && setup.hasTypescript)
|
|
808
808
|
return "TypeScript + Vite build verification";
|
|
@@ -863,7 +863,7 @@ var options = [
|
|
|
863
863
|
}
|
|
864
864
|
];
|
|
865
865
|
|
|
866
|
-
// src/commands/verify/init/getAvailableOptions.ts
|
|
866
|
+
// src/commands/verify/init/getAvailableOptions/index.ts
|
|
867
867
|
function resolveDescription(desc, setup) {
|
|
868
868
|
return typeof desc === "function" ? desc(setup) : desc;
|
|
869
869
|
}
|
|
@@ -962,15 +962,16 @@ function removeVscodeFromGitignore() {
|
|
|
962
962
|
console.log(chalk16.dim("Removed .vscode references from .gitignore"));
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
function createLaunchJson() {
|
|
965
|
+
function createLaunchJson(type) {
|
|
966
|
+
const command = type === "vite" ? "npm run dev -- --open" : "npm run start";
|
|
966
967
|
const launchConfig = {
|
|
967
968
|
version: "0.2.0",
|
|
968
969
|
configurations: [
|
|
969
970
|
{
|
|
970
|
-
name:
|
|
971
|
+
name: command,
|
|
971
972
|
type: "node-terminal",
|
|
972
973
|
request: "launch",
|
|
973
|
-
command
|
|
974
|
+
command
|
|
974
975
|
}
|
|
975
976
|
]
|
|
976
977
|
};
|
|
@@ -1014,25 +1015,26 @@ function detectVscodeSetup(pkg) {
|
|
|
1014
1015
|
hasVscodeFolder: fs4.existsSync(vscodeDir),
|
|
1015
1016
|
hasLaunchJson: fs4.existsSync(path10.join(vscodeDir, "launch.json")),
|
|
1016
1017
|
hasSettingsJson: fs4.existsSync(path10.join(vscodeDir, "settings.json")),
|
|
1017
|
-
hasVite: !!pkg.devDependencies?.vite || !!pkg.dependencies?.vite
|
|
1018
|
+
hasVite: !!pkg.devDependencies?.vite || !!pkg.dependencies?.vite,
|
|
1019
|
+
hasTsup: !!pkg.devDependencies?.tsup || !!pkg.dependencies?.tsup
|
|
1018
1020
|
};
|
|
1019
1021
|
}
|
|
1020
1022
|
|
|
1021
|
-
// src/commands/vscode/init/
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
};
|
|
1023
|
+
// src/commands/vscode/init/getAvailableOptions.ts
|
|
1024
|
+
function getLaunchDescription(setup) {
|
|
1025
|
+
if (setup.hasLaunchJson) return void 0;
|
|
1026
|
+
if (setup.hasVite) return "Debug configuration for Vite dev server";
|
|
1027
|
+
if (setup.hasTsup) return "Debug configuration for Node.js CLI";
|
|
1028
|
+
return void 0;
|
|
1029
|
+
}
|
|
1029
1030
|
function getAvailableOptions2(setup) {
|
|
1030
1031
|
const options2 = [];
|
|
1031
|
-
|
|
1032
|
+
const launchDescription = getLaunchDescription(setup);
|
|
1033
|
+
if (launchDescription)
|
|
1032
1034
|
options2.push({
|
|
1033
1035
|
name: "launch",
|
|
1034
1036
|
value: "launch",
|
|
1035
|
-
description:
|
|
1037
|
+
description: launchDescription
|
|
1036
1038
|
});
|
|
1037
1039
|
if (!setup.hasSettingsJson)
|
|
1038
1040
|
options2.push({
|
|
@@ -1042,26 +1044,39 @@ function getAvailableOptions2(setup) {
|
|
|
1042
1044
|
});
|
|
1043
1045
|
return options2;
|
|
1044
1046
|
}
|
|
1047
|
+
|
|
1048
|
+
// src/commands/vscode/init/index.ts
|
|
1049
|
+
function applySelections(selected, setup) {
|
|
1050
|
+
removeVscodeFromGitignore();
|
|
1051
|
+
ensureVscodeFolder();
|
|
1052
|
+
const launchType = setup.hasVite ? "vite" : "tsup";
|
|
1053
|
+
const handlers = {
|
|
1054
|
+
launch: () => createLaunchJson(launchType),
|
|
1055
|
+
settings: () => {
|
|
1056
|
+
createSettingsJson();
|
|
1057
|
+
createExtensionsJson();
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
for (const choice of selected) handlers[choice]?.();
|
|
1061
|
+
}
|
|
1062
|
+
async function promptForOptions(options2) {
|
|
1063
|
+
console.log(chalk17.bold("Available VS Code configurations to add:\n"));
|
|
1064
|
+
return promptMultiselect("Select configurations to add:", options2);
|
|
1065
|
+
}
|
|
1045
1066
|
async function init3() {
|
|
1046
1067
|
const { pkg } = requirePackageJson();
|
|
1047
1068
|
const setup = detectVscodeSetup(pkg);
|
|
1048
|
-
const
|
|
1049
|
-
if (
|
|
1069
|
+
const options2 = getAvailableOptions2(setup);
|
|
1070
|
+
if (options2.length === 0) {
|
|
1050
1071
|
console.log(chalk17.green("VS Code configuration already exists!"));
|
|
1051
1072
|
return;
|
|
1052
1073
|
}
|
|
1053
|
-
|
|
1054
|
-
const selected = await promptMultiselect(
|
|
1055
|
-
"Select configurations to add:",
|
|
1056
|
-
availableOptions
|
|
1057
|
-
);
|
|
1074
|
+
const selected = await promptForOptions(options2);
|
|
1058
1075
|
if (selected.length === 0) {
|
|
1059
1076
|
console.log(chalk17.yellow("No configurations selected"));
|
|
1060
1077
|
return;
|
|
1061
1078
|
}
|
|
1062
|
-
|
|
1063
|
-
ensureVscodeFolder();
|
|
1064
|
-
for (const choice of selected) SETUP_HANDLERS[choice]?.();
|
|
1079
|
+
applySelections(selected, setup);
|
|
1065
1080
|
console.log(
|
|
1066
1081
|
chalk17.green(`
|
|
1067
1082
|
Added ${selected.length} VS Code configuration(s)`)
|
|
@@ -1261,8 +1276,8 @@ function lint() {
|
|
|
1261
1276
|
}
|
|
1262
1277
|
}
|
|
1263
1278
|
|
|
1264
|
-
// src/commands/new/newCli.ts
|
|
1265
|
-
import { execSync as
|
|
1279
|
+
// src/commands/new/registerNew/newCli/index.ts
|
|
1280
|
+
import { execSync as execSync8 } from "child_process";
|
|
1266
1281
|
import { basename as basename2, resolve } from "path";
|
|
1267
1282
|
|
|
1268
1283
|
// src/commands/verify/hardcodedColors.ts
|
|
@@ -1417,26 +1432,35 @@ async function run(options2 = {}) {
|
|
|
1417
1432
|
await executeVerifyScripts(found, options2.timer ?? false);
|
|
1418
1433
|
}
|
|
1419
1434
|
|
|
1420
|
-
// src/commands/new/
|
|
1435
|
+
// src/commands/new/registerNew/initGit.ts
|
|
1421
1436
|
import { execSync as execSync6 } from "child_process";
|
|
1437
|
+
import { writeFileSync as writeFileSync6 } from "fs";
|
|
1438
|
+
function initGit() {
|
|
1439
|
+
console.log("Initializing git repository...");
|
|
1440
|
+
execSync6("git init", { stdio: "inherit" });
|
|
1441
|
+
writeFileSync6(".gitignore", "dist\nnode_modules\n");
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
// src/commands/new/registerNew/newCli/initPackageJson.ts
|
|
1445
|
+
import { execSync as execSync7 } from "child_process";
|
|
1422
1446
|
function initPackageJson(name) {
|
|
1423
1447
|
console.log("Initializing package.json...");
|
|
1424
|
-
|
|
1448
|
+
execSync7("npm init -y", { stdio: "inherit" });
|
|
1425
1449
|
console.log("Configuring package.json...");
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1450
|
+
execSync7("npm pkg delete main", { stdio: "inherit" });
|
|
1451
|
+
execSync7("npm pkg set type=module", { stdio: "inherit" });
|
|
1452
|
+
execSync7(`npm pkg set bin.${name}=./dist/index.js`, { stdio: "inherit" });
|
|
1453
|
+
execSync7("npm pkg set scripts.build=tsup", { stdio: "inherit" });
|
|
1454
|
+
execSync7('npm pkg set scripts.start="node dist/index.js"', {
|
|
1431
1455
|
stdio: "inherit"
|
|
1432
1456
|
});
|
|
1433
1457
|
}
|
|
1434
1458
|
|
|
1435
|
-
// src/commands/new/writeCliTemplate.ts
|
|
1436
|
-
import { mkdirSync as mkdirSync2, writeFileSync as
|
|
1459
|
+
// src/commands/new/registerNew/newCli/writeCliTemplate.ts
|
|
1460
|
+
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync7 } from "fs";
|
|
1437
1461
|
function writeCliTemplate(name) {
|
|
1438
1462
|
console.log("Writing tsconfig.json...");
|
|
1439
|
-
|
|
1463
|
+
writeFileSync7(
|
|
1440
1464
|
"tsconfig.json",
|
|
1441
1465
|
JSON.stringify(
|
|
1442
1466
|
{
|
|
@@ -1460,7 +1484,7 @@ function writeCliTemplate(name) {
|
|
|
1460
1484
|
)
|
|
1461
1485
|
);
|
|
1462
1486
|
console.log("Writing tsup.config.ts...");
|
|
1463
|
-
|
|
1487
|
+
writeFileSync7(
|
|
1464
1488
|
"tsup.config.ts",
|
|
1465
1489
|
`import { defineConfig } from "tsup";
|
|
1466
1490
|
export default defineConfig({
|
|
@@ -1475,7 +1499,7 @@ export default defineConfig({
|
|
|
1475
1499
|
);
|
|
1476
1500
|
console.log("Writing src/index.ts...");
|
|
1477
1501
|
mkdirSync2("src", { recursive: true });
|
|
1478
|
-
|
|
1502
|
+
writeFileSync7(
|
|
1479
1503
|
"src/index.ts",
|
|
1480
1504
|
`#!/usr/bin/env node
|
|
1481
1505
|
import { Command } from "commander";
|
|
@@ -1486,13 +1510,14 @@ program.parse();
|
|
|
1486
1510
|
);
|
|
1487
1511
|
}
|
|
1488
1512
|
|
|
1489
|
-
// src/commands/new/newCli.ts
|
|
1513
|
+
// src/commands/new/registerNew/newCli/index.ts
|
|
1490
1514
|
async function newCli() {
|
|
1491
1515
|
const name = basename2(resolve("."));
|
|
1516
|
+
initGit();
|
|
1492
1517
|
initPackageJson(name);
|
|
1493
1518
|
console.log("Installing dependencies...");
|
|
1494
|
-
|
|
1495
|
-
|
|
1519
|
+
execSync8("npm install commander", { stdio: "inherit" });
|
|
1520
|
+
execSync8("npm install -D tsup typescript @types/node", {
|
|
1496
1521
|
stdio: "inherit"
|
|
1497
1522
|
});
|
|
1498
1523
|
writeCliTemplate(name);
|
|
@@ -1500,17 +1525,17 @@ async function newCli() {
|
|
|
1500
1525
|
await run();
|
|
1501
1526
|
}
|
|
1502
1527
|
|
|
1503
|
-
// src/commands/new/newProject.ts
|
|
1504
|
-
import { execSync as
|
|
1505
|
-
import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as
|
|
1528
|
+
// src/commands/new/registerNew/newProject.ts
|
|
1529
|
+
import { execSync as execSync10 } from "child_process";
|
|
1530
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync9 } from "fs";
|
|
1506
1531
|
|
|
1507
1532
|
// src/commands/deploy/init/index.ts
|
|
1508
|
-
import { execSync as
|
|
1533
|
+
import { execSync as execSync9 } from "child_process";
|
|
1509
1534
|
import chalk21 from "chalk";
|
|
1510
1535
|
import enquirer3 from "enquirer";
|
|
1511
1536
|
|
|
1512
1537
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
1513
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as
|
|
1538
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync8 } from "fs";
|
|
1514
1539
|
import { dirname as dirname10, join as join7 } from "path";
|
|
1515
1540
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1516
1541
|
import chalk20 from "chalk";
|
|
@@ -1550,7 +1575,7 @@ async function updateWorkflow(siteId) {
|
|
|
1550
1575
|
return;
|
|
1551
1576
|
}
|
|
1552
1577
|
}
|
|
1553
|
-
|
|
1578
|
+
writeFileSync8(WORKFLOW_PATH, newContent);
|
|
1554
1579
|
console.log(chalk20.green(`
|
|
1555
1580
|
Created ${WORKFLOW_PATH}`));
|
|
1556
1581
|
}
|
|
@@ -1558,7 +1583,7 @@ Created ${WORKFLOW_PATH}`));
|
|
|
1558
1583
|
// src/commands/deploy/init/index.ts
|
|
1559
1584
|
async function ensureNetlifyCli() {
|
|
1560
1585
|
try {
|
|
1561
|
-
|
|
1586
|
+
execSync9("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
1562
1587
|
} catch (error) {
|
|
1563
1588
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
1564
1589
|
throw error;
|
|
@@ -1573,9 +1598,9 @@ async function ensureNetlifyCli() {
|
|
|
1573
1598
|
process.exit(1);
|
|
1574
1599
|
}
|
|
1575
1600
|
console.log(chalk21.dim("\nInstalling netlify-cli...\n"));
|
|
1576
|
-
|
|
1601
|
+
execSync9("npm install -g netlify-cli", { stdio: "inherit" });
|
|
1577
1602
|
console.log();
|
|
1578
|
-
|
|
1603
|
+
execSync9("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
1579
1604
|
}
|
|
1580
1605
|
}
|
|
1581
1606
|
function printSetupInstructions() {
|
|
@@ -1615,12 +1640,13 @@ async function init5() {
|
|
|
1615
1640
|
printSetupInstructions();
|
|
1616
1641
|
}
|
|
1617
1642
|
|
|
1618
|
-
// src/commands/new/newProject.ts
|
|
1643
|
+
// src/commands/new/registerNew/newProject.ts
|
|
1619
1644
|
async function newProject() {
|
|
1620
1645
|
console.log("Initializing Vite with react-ts template...");
|
|
1621
|
-
|
|
1646
|
+
execSync10("npm create vite@latest . -- --template react-ts", {
|
|
1622
1647
|
stdio: "inherit"
|
|
1623
1648
|
});
|
|
1649
|
+
initGit();
|
|
1624
1650
|
removeEslint({ removeLintScripts: true });
|
|
1625
1651
|
addViteBaseConfig();
|
|
1626
1652
|
await init4();
|
|
@@ -1642,12 +1668,12 @@ function addViteBaseConfig() {
|
|
|
1642
1668
|
'defineConfig({\n base: "./",'
|
|
1643
1669
|
);
|
|
1644
1670
|
if (updated !== content) {
|
|
1645
|
-
|
|
1671
|
+
writeFileSync9(viteConfigPath, updated);
|
|
1646
1672
|
console.log('Added base: "./" to vite.config.ts');
|
|
1647
1673
|
}
|
|
1648
1674
|
}
|
|
1649
1675
|
|
|
1650
|
-
// src/commands/new/registerNew.ts
|
|
1676
|
+
// src/commands/new/registerNew/index.ts
|
|
1651
1677
|
function registerNew(program2) {
|
|
1652
1678
|
const newCommand = program2.command("new").description("Scaffold a new project");
|
|
1653
1679
|
newCommand.command("vite").description("Initialize a new Vite React TypeScript project").action(newProject);
|
|
@@ -2268,7 +2294,7 @@ function registerComplexity(program2) {
|
|
|
2268
2294
|
}
|
|
2269
2295
|
|
|
2270
2296
|
// src/commands/deploy/redirect.ts
|
|
2271
|
-
import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as
|
|
2297
|
+
import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as writeFileSync10 } from "fs";
|
|
2272
2298
|
import chalk28 from "chalk";
|
|
2273
2299
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
2274
2300
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -2292,7 +2318,7 @@ function redirect() {
|
|
|
2292
2318
|
return;
|
|
2293
2319
|
}
|
|
2294
2320
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
2295
|
-
|
|
2321
|
+
writeFileSync10(indexPath, newContent);
|
|
2296
2322
|
console.log(chalk28.green("Added trailing slash redirect to index.html"));
|
|
2297
2323
|
}
|
|
2298
2324
|
|
|
@@ -2304,11 +2330,11 @@ function registerDeploy(program2) {
|
|
|
2304
2330
|
}
|
|
2305
2331
|
|
|
2306
2332
|
// src/commands/devlog/list/index.ts
|
|
2307
|
-
import { execSync as
|
|
2333
|
+
import { execSync as execSync12 } from "child_process";
|
|
2308
2334
|
import { basename as basename3 } from "path";
|
|
2309
2335
|
|
|
2310
2336
|
// src/commands/devlog/shared.ts
|
|
2311
|
-
import { execSync as
|
|
2337
|
+
import { execSync as execSync11 } from "child_process";
|
|
2312
2338
|
import chalk29 from "chalk";
|
|
2313
2339
|
|
|
2314
2340
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
@@ -2352,7 +2378,7 @@ function loadDevlogEntries(repoName) {
|
|
|
2352
2378
|
// src/commands/devlog/shared.ts
|
|
2353
2379
|
function getCommitFiles(hash) {
|
|
2354
2380
|
try {
|
|
2355
|
-
const output =
|
|
2381
|
+
const output = execSync11(`git show --name-only --format="" ${hash}`, {
|
|
2356
2382
|
encoding: "utf-8"
|
|
2357
2383
|
});
|
|
2358
2384
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -2423,7 +2449,7 @@ function list(options2) {
|
|
|
2423
2449
|
const devlogEntries = loadDevlogEntries(repoName);
|
|
2424
2450
|
const reverseFlag = options2.reverse ? "--reverse " : "";
|
|
2425
2451
|
const limitFlag = options2.reverse ? "" : "-n 500 ";
|
|
2426
|
-
const output =
|
|
2452
|
+
const output = execSync12(
|
|
2427
2453
|
`git log ${reverseFlag}${limitFlag}--pretty=format:'%ad|%h|%s' --date=short`,
|
|
2428
2454
|
{ encoding: "utf-8" }
|
|
2429
2455
|
);
|
|
@@ -2449,11 +2475,11 @@ function list(options2) {
|
|
|
2449
2475
|
}
|
|
2450
2476
|
|
|
2451
2477
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
2452
|
-
import { execSync as
|
|
2478
|
+
import { execSync as execSync13 } from "child_process";
|
|
2453
2479
|
import semver from "semver";
|
|
2454
2480
|
function getVersionAtCommit(hash) {
|
|
2455
2481
|
try {
|
|
2456
|
-
const content =
|
|
2482
|
+
const content = execSync13(`git show ${hash}:package.json`, {
|
|
2457
2483
|
encoding: "utf-8"
|
|
2458
2484
|
});
|
|
2459
2485
|
const pkg = JSON.parse(content);
|
|
@@ -2468,7 +2494,7 @@ function stripToMinor(version2) {
|
|
|
2468
2494
|
}
|
|
2469
2495
|
function getLastVersionInfoFromGit() {
|
|
2470
2496
|
try {
|
|
2471
|
-
const output =
|
|
2497
|
+
const output = execSync13(
|
|
2472
2498
|
"git log -1 --pretty=format:'%ad|%h' --date=short",
|
|
2473
2499
|
{
|
|
2474
2500
|
encoding: "utf-8"
|
|
@@ -2511,7 +2537,7 @@ function bumpVersion(version2, type) {
|
|
|
2511
2537
|
}
|
|
2512
2538
|
|
|
2513
2539
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
2514
|
-
import { execSync as
|
|
2540
|
+
import { execSync as execSync14 } from "child_process";
|
|
2515
2541
|
import chalk32 from "chalk";
|
|
2516
2542
|
|
|
2517
2543
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
@@ -2545,7 +2571,7 @@ function findTargetDate(commitsByDate, skipDays) {
|
|
|
2545
2571
|
return Array.from(commitsByDate.keys()).filter((d) => !skipDays.has(d)).sort()[0];
|
|
2546
2572
|
}
|
|
2547
2573
|
function fetchCommitsByDate(ignore2, lastDate) {
|
|
2548
|
-
const output =
|
|
2574
|
+
const output = execSync14(
|
|
2549
2575
|
"git log --pretty=format:'%ad|%h|%s' --date=short -n 500",
|
|
2550
2576
|
{ encoding: "utf-8" }
|
|
2551
2577
|
);
|
|
@@ -2672,11 +2698,11 @@ function registerDevlog(program2) {
|
|
|
2672
2698
|
}
|
|
2673
2699
|
|
|
2674
2700
|
// src/commands/prs/fixed.ts
|
|
2675
|
-
import { execSync as
|
|
2701
|
+
import { execSync as execSync17 } from "child_process";
|
|
2676
2702
|
|
|
2677
2703
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
2678
|
-
import { execSync as
|
|
2679
|
-
import { unlinkSync as unlinkSync3, writeFileSync as
|
|
2704
|
+
import { execSync as execSync16 } from "child_process";
|
|
2705
|
+
import { unlinkSync as unlinkSync3, writeFileSync as writeFileSync11 } from "fs";
|
|
2680
2706
|
import { tmpdir } from "os";
|
|
2681
2707
|
import { join as join10 } from "path";
|
|
2682
2708
|
|
|
@@ -2704,7 +2730,7 @@ function deleteCommentsCache(prNumber) {
|
|
|
2704
2730
|
}
|
|
2705
2731
|
|
|
2706
2732
|
// src/commands/prs/shared.ts
|
|
2707
|
-
import { execSync as
|
|
2733
|
+
import { execSync as execSync15 } from "child_process";
|
|
2708
2734
|
function isGhNotInstalled(error) {
|
|
2709
2735
|
if (error instanceof Error) {
|
|
2710
2736
|
const msg = error.message.toLowerCase();
|
|
@@ -2720,14 +2746,14 @@ function isNotFound(error) {
|
|
|
2720
2746
|
}
|
|
2721
2747
|
function getRepoInfo() {
|
|
2722
2748
|
const repoInfo = JSON.parse(
|
|
2723
|
-
|
|
2749
|
+
execSync15("gh repo view --json owner,name", { encoding: "utf-8" })
|
|
2724
2750
|
);
|
|
2725
2751
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
2726
2752
|
}
|
|
2727
2753
|
function getCurrentPrNumber() {
|
|
2728
2754
|
try {
|
|
2729
2755
|
const prInfo = JSON.parse(
|
|
2730
|
-
|
|
2756
|
+
execSync15("gh pr view --json number", { encoding: "utf-8" })
|
|
2731
2757
|
);
|
|
2732
2758
|
return prInfo.number;
|
|
2733
2759
|
} catch (error) {
|
|
@@ -2741,7 +2767,7 @@ function getCurrentPrNumber() {
|
|
|
2741
2767
|
|
|
2742
2768
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
2743
2769
|
function replyToComment(org, repo, prNumber, commentId, message) {
|
|
2744
|
-
|
|
2770
|
+
execSync16(
|
|
2745
2771
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, '\\"')}" -F in_reply_to=${commentId}`,
|
|
2746
2772
|
{ stdio: "inherit" }
|
|
2747
2773
|
);
|
|
@@ -2749,9 +2775,9 @@ function replyToComment(org, repo, prNumber, commentId, message) {
|
|
|
2749
2775
|
function resolveThread(threadId) {
|
|
2750
2776
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
2751
2777
|
const queryFile = join10(tmpdir(), `gh-mutation-${Date.now()}.graphql`);
|
|
2752
|
-
|
|
2778
|
+
writeFileSync11(queryFile, mutation);
|
|
2753
2779
|
try {
|
|
2754
|
-
|
|
2780
|
+
execSync16(
|
|
2755
2781
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
2756
2782
|
{ stdio: "inherit" }
|
|
2757
2783
|
);
|
|
@@ -2803,7 +2829,7 @@ function resolveCommentWithReply(commentId, message) {
|
|
|
2803
2829
|
// src/commands/prs/fixed.ts
|
|
2804
2830
|
function verifySha(sha) {
|
|
2805
2831
|
try {
|
|
2806
|
-
return
|
|
2832
|
+
return execSync17(`git rev-parse --verify ${sha}`, {
|
|
2807
2833
|
encoding: "utf-8"
|
|
2808
2834
|
}).trim();
|
|
2809
2835
|
} catch {
|
|
@@ -2829,7 +2855,7 @@ function fixed(commentId, sha) {
|
|
|
2829
2855
|
}
|
|
2830
2856
|
|
|
2831
2857
|
// src/commands/prs/listComments/index.ts
|
|
2832
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync4, writeFileSync as
|
|
2858
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync4, writeFileSync as writeFileSync13 } from "fs";
|
|
2833
2859
|
import { join as join12 } from "path";
|
|
2834
2860
|
import { stringify } from "yaml";
|
|
2835
2861
|
|
|
@@ -2839,16 +2865,16 @@ function isClaudeCode() {
|
|
|
2839
2865
|
}
|
|
2840
2866
|
|
|
2841
2867
|
// src/commands/prs/fetchThreadIds.ts
|
|
2842
|
-
import { execSync as
|
|
2843
|
-
import { unlinkSync as unlinkSync4, writeFileSync as
|
|
2868
|
+
import { execSync as execSync18 } from "child_process";
|
|
2869
|
+
import { unlinkSync as unlinkSync4, writeFileSync as writeFileSync12 } from "fs";
|
|
2844
2870
|
import { tmpdir as tmpdir2 } from "os";
|
|
2845
2871
|
import { join as join11 } from "path";
|
|
2846
2872
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
2847
2873
|
function fetchThreadIds(org, repo, prNumber) {
|
|
2848
2874
|
const queryFile = join11(tmpdir2(), `gh-query-${Date.now()}.graphql`);
|
|
2849
|
-
|
|
2875
|
+
writeFileSync12(queryFile, THREAD_QUERY);
|
|
2850
2876
|
try {
|
|
2851
|
-
const result =
|
|
2877
|
+
const result = execSync18(
|
|
2852
2878
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
2853
2879
|
{ encoding: "utf-8" }
|
|
2854
2880
|
);
|
|
@@ -2870,9 +2896,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
2870
2896
|
}
|
|
2871
2897
|
|
|
2872
2898
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
2873
|
-
import { execSync as
|
|
2899
|
+
import { execSync as execSync19 } from "child_process";
|
|
2874
2900
|
function fetchJson(endpoint) {
|
|
2875
|
-
const result =
|
|
2901
|
+
const result = execSync19(`gh api ${endpoint}`, { encoding: "utf-8" });
|
|
2876
2902
|
if (!result.trim()) return [];
|
|
2877
2903
|
return JSON.parse(result);
|
|
2878
2904
|
}
|
|
@@ -2958,7 +2984,7 @@ function writeCommentsCache(prNumber, comments) {
|
|
|
2958
2984
|
comments
|
|
2959
2985
|
};
|
|
2960
2986
|
const cachePath = join12(assistDir, `pr-${prNumber}-comments.yaml`);
|
|
2961
|
-
|
|
2987
|
+
writeFileSync13(cachePath, stringify(cacheData));
|
|
2962
2988
|
}
|
|
2963
2989
|
function handleKnownErrors(error) {
|
|
2964
2990
|
if (isGhNotInstalled(error)) {
|
|
@@ -2998,7 +3024,7 @@ async function listComments() {
|
|
|
2998
3024
|
}
|
|
2999
3025
|
|
|
3000
3026
|
// src/commands/prs/prs/index.ts
|
|
3001
|
-
import { execSync as
|
|
3027
|
+
import { execSync as execSync20 } from "child_process";
|
|
3002
3028
|
|
|
3003
3029
|
// src/commands/prs/prs/displayPaginated/index.ts
|
|
3004
3030
|
import enquirer4 from "enquirer";
|
|
@@ -3104,7 +3130,7 @@ async function displayPaginated(pullRequests) {
|
|
|
3104
3130
|
async function prs(options2) {
|
|
3105
3131
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
3106
3132
|
try {
|
|
3107
|
-
const result =
|
|
3133
|
+
const result = execSync20(
|
|
3108
3134
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100`,
|
|
3109
3135
|
{ encoding: "utf-8" }
|
|
3110
3136
|
);
|
|
@@ -3127,7 +3153,7 @@ async function prs(options2) {
|
|
|
3127
3153
|
}
|
|
3128
3154
|
|
|
3129
3155
|
// src/commands/prs/wontfix.ts
|
|
3130
|
-
import { execSync as
|
|
3156
|
+
import { execSync as execSync21 } from "child_process";
|
|
3131
3157
|
function validateReason(reason) {
|
|
3132
3158
|
const lowerReason = reason.toLowerCase();
|
|
3133
3159
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -3144,7 +3170,7 @@ function validateShaReferences(reason) {
|
|
|
3144
3170
|
const invalidShas = [];
|
|
3145
3171
|
for (const sha of shas) {
|
|
3146
3172
|
try {
|
|
3147
|
-
|
|
3173
|
+
execSync21(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
3148
3174
|
} catch {
|
|
3149
3175
|
invalidShas.push(sha);
|
|
3150
3176
|
}
|
|
@@ -3245,7 +3271,7 @@ Refactor check failed:
|
|
|
3245
3271
|
}
|
|
3246
3272
|
|
|
3247
3273
|
// src/commands/refactor/check/getViolations/index.ts
|
|
3248
|
-
import { execSync as
|
|
3274
|
+
import { execSync as execSync22 } from "child_process";
|
|
3249
3275
|
import fs15 from "fs";
|
|
3250
3276
|
import { minimatch as minimatch2 } from "minimatch";
|
|
3251
3277
|
|
|
@@ -3295,7 +3321,7 @@ function getGitFiles(options2) {
|
|
|
3295
3321
|
}
|
|
3296
3322
|
const files = /* @__PURE__ */ new Set();
|
|
3297
3323
|
if (options2.staged || options2.modified) {
|
|
3298
|
-
const staged =
|
|
3324
|
+
const staged = execSync22("git diff --cached --name-only", {
|
|
3299
3325
|
encoding: "utf-8"
|
|
3300
3326
|
});
|
|
3301
3327
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -3303,7 +3329,7 @@ function getGitFiles(options2) {
|
|
|
3303
3329
|
}
|
|
3304
3330
|
}
|
|
3305
3331
|
if (options2.unstaged || options2.modified) {
|
|
3306
|
-
const unstaged =
|
|
3332
|
+
const unstaged = execSync22("git diff --name-only", { encoding: "utf-8" });
|
|
3307
3333
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
3308
3334
|
files.add(file);
|
|
3309
3335
|
}
|
|
@@ -4106,7 +4132,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
4106
4132
|
}
|
|
4107
4133
|
|
|
4108
4134
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
4109
|
-
import { existsSync as existsSync15, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as
|
|
4135
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync14 } from "fs";
|
|
4110
4136
|
import { basename as basename5, dirname as dirname13, join as join16 } from "path";
|
|
4111
4137
|
|
|
4112
4138
|
// src/commands/transcript/cleanText.ts
|
|
@@ -4357,7 +4383,7 @@ function readAndParseCues(inputPath) {
|
|
|
4357
4383
|
return processCues(readFileSync12(inputPath, "utf-8"));
|
|
4358
4384
|
}
|
|
4359
4385
|
function writeFormatted(outputPath, content) {
|
|
4360
|
-
|
|
4386
|
+
writeFileSync14(outputPath, content, "utf-8");
|
|
4361
4387
|
console.log(`Written: ${outputPath}`);
|
|
4362
4388
|
}
|
|
4363
4389
|
function convertVttToMarkdown(inputPath, outputPath) {
|
|
@@ -4797,7 +4823,7 @@ program.command("init").description("Initialize VS Code and verify configuration
|
|
|
4797
4823
|
program.command("commit <message>").description("Create a git commit with validation").action(commit);
|
|
4798
4824
|
program.command("update").description("Update claude-code to the latest version").action(() => {
|
|
4799
4825
|
console.log("Updating claude-code...");
|
|
4800
|
-
|
|
4826
|
+
execSync23("npm install -g @anthropic-ai/claude-code", { stdio: "inherit" });
|
|
4801
4827
|
});
|
|
4802
4828
|
var configCommand = program.command("config").description("View and modify assist.yml configuration");
|
|
4803
4829
|
configCommand.command("set <key> <value>").description("Set a config value (e.g. commit.push true)").action(configSet);
|