@staff0rd/assist 0.159.0 → 0.160.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 +448 -417
- 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.160.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1178,6 +1178,9 @@ var assistConfigSchema = z2.strictObject({
|
|
|
1178
1178
|
screenshot: z2.strictObject({
|
|
1179
1179
|
outputDir: z2.string().default("./screenshots")
|
|
1180
1180
|
}).default({ outputDir: "./screenshots" }),
|
|
1181
|
+
sync: z2.strictObject({
|
|
1182
|
+
autoConfirm: z2.boolean().default(false)
|
|
1183
|
+
}).default({ autoConfirm: false }),
|
|
1181
1184
|
voice: z2.strictObject({
|
|
1182
1185
|
wakeWords: z2.array(z2.string()).default(DEFAULT_WAKE_WORDS),
|
|
1183
1186
|
mic: z2.string().optional(),
|
|
@@ -1349,19 +1352,6 @@ function commit(args) {
|
|
|
1349
1352
|
import chalk18 from "chalk";
|
|
1350
1353
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
1351
1354
|
|
|
1352
|
-
// src/commands/config/getNestedValue.ts
|
|
1353
|
-
function isTraversable(value) {
|
|
1354
|
-
return value !== null && value !== void 0 && typeof value === "object";
|
|
1355
|
-
}
|
|
1356
|
-
function stepInto(current, key) {
|
|
1357
|
-
return isTraversable(current) ? current[key] : void 0;
|
|
1358
|
-
}
|
|
1359
|
-
function getNestedValue(obj, path50) {
|
|
1360
|
-
let current = obj;
|
|
1361
|
-
for (const key of path50.split(".")) current = stepInto(current, key);
|
|
1362
|
-
return current;
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
1355
|
// src/commands/config/setNestedValue.ts
|
|
1366
1356
|
function isPlainObject(val) {
|
|
1367
1357
|
return val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -1435,27 +1425,58 @@ function validateConfig(updated, key) {
|
|
|
1435
1425
|
if (!result.success) return exitValidationFailed(result.error.issues, key);
|
|
1436
1426
|
return updated;
|
|
1437
1427
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1428
|
+
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
1429
|
+
function assertNotGlobalOnly(key, global) {
|
|
1430
|
+
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
1431
|
+
console.error(
|
|
1432
|
+
chalk18.red(
|
|
1433
|
+
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
1434
|
+
)
|
|
1435
|
+
);
|
|
1436
|
+
process.exit(1);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
function applyConfigSet(key, coerced, global) {
|
|
1440
|
+
assertNotGlobalOnly(key, global);
|
|
1441
|
+
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig();
|
|
1442
|
+
const updated = setNestedValue(raw, key, coerced);
|
|
1443
|
+
validateConfig(updated, key);
|
|
1444
|
+
if (global) {
|
|
1445
|
+
saveGlobalConfig(updated);
|
|
1446
|
+
} else {
|
|
1447
|
+
saveConfig(updated);
|
|
1448
|
+
}
|
|
1441
1449
|
}
|
|
1442
|
-
function configSet(key, value) {
|
|
1450
|
+
function configSet(key, value, options2 = {}) {
|
|
1443
1451
|
const coerced = coerceValue(value);
|
|
1444
|
-
applyConfigSet(key, coerced);
|
|
1445
|
-
|
|
1452
|
+
applyConfigSet(key, coerced, options2.global ?? false);
|
|
1453
|
+
const target = options2.global ? "global" : "project";
|
|
1454
|
+
console.log(
|
|
1455
|
+
chalk18.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
1456
|
+
);
|
|
1446
1457
|
}
|
|
1447
|
-
function
|
|
1448
|
-
|
|
1458
|
+
function configList() {
|
|
1459
|
+
const config = loadConfig();
|
|
1460
|
+
console.log(stringifyYaml3(config, { lineWidth: 0 }).trimEnd());
|
|
1449
1461
|
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1462
|
+
|
|
1463
|
+
// src/commands/config/configGet.ts
|
|
1464
|
+
import chalk19 from "chalk";
|
|
1465
|
+
|
|
1466
|
+
// src/commands/config/getNestedValue.ts
|
|
1467
|
+
function isTraversable(value) {
|
|
1468
|
+
return value !== null && value !== void 0 && typeof value === "object";
|
|
1453
1469
|
}
|
|
1454
|
-
function
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1470
|
+
function stepInto(current, key) {
|
|
1471
|
+
return isTraversable(current) ? current[key] : void 0;
|
|
1472
|
+
}
|
|
1473
|
+
function getNestedValue(obj, path50) {
|
|
1474
|
+
let current = obj;
|
|
1475
|
+
for (const key of path50.split(".")) current = stepInto(current, key);
|
|
1476
|
+
return current;
|
|
1458
1477
|
}
|
|
1478
|
+
|
|
1479
|
+
// src/commands/config/configGet.ts
|
|
1459
1480
|
function configGet(key) {
|
|
1460
1481
|
console.log(
|
|
1461
1482
|
formatOutput(
|
|
@@ -1463,9 +1484,17 @@ function configGet(key) {
|
|
|
1463
1484
|
)
|
|
1464
1485
|
);
|
|
1465
1486
|
}
|
|
1466
|
-
function
|
|
1467
|
-
|
|
1468
|
-
|
|
1487
|
+
function formatOutput(value) {
|
|
1488
|
+
return typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value);
|
|
1489
|
+
}
|
|
1490
|
+
function requireNestedValue(config, key) {
|
|
1491
|
+
const value = getNestedValue(config, key);
|
|
1492
|
+
if (value === void 0) return exitKeyNotSet(key);
|
|
1493
|
+
return value;
|
|
1494
|
+
}
|
|
1495
|
+
function exitKeyNotSet(key) {
|
|
1496
|
+
console.error(chalk19.red(`Key "${key}" is not set`));
|
|
1497
|
+
process.exit(1);
|
|
1469
1498
|
}
|
|
1470
1499
|
|
|
1471
1500
|
// src/commands/coverage.ts
|
|
@@ -1484,10 +1513,10 @@ function coverage() {
|
|
|
1484
1513
|
}
|
|
1485
1514
|
|
|
1486
1515
|
// src/commands/verify/init/index.ts
|
|
1487
|
-
import
|
|
1516
|
+
import chalk34 from "chalk";
|
|
1488
1517
|
|
|
1489
1518
|
// src/shared/promptMultiselect.ts
|
|
1490
|
-
import
|
|
1519
|
+
import chalk20 from "chalk";
|
|
1491
1520
|
import enquirer3 from "enquirer";
|
|
1492
1521
|
async function promptMultiselect(message, options2) {
|
|
1493
1522
|
const { selected } = await exitOnCancel(
|
|
@@ -1497,7 +1526,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1497
1526
|
message,
|
|
1498
1527
|
choices: options2.map((opt) => ({
|
|
1499
1528
|
name: opt.value,
|
|
1500
|
-
message: `${opt.name} - ${
|
|
1529
|
+
message: `${opt.name} - ${chalk20.dim(opt.description)}`
|
|
1501
1530
|
})),
|
|
1502
1531
|
// @ts-expect-error - enquirer types don't include symbols but it's supported
|
|
1503
1532
|
symbols: {
|
|
@@ -1514,7 +1543,7 @@ async function promptMultiselect(message, options2) {
|
|
|
1514
1543
|
// src/shared/readPackageJson.ts
|
|
1515
1544
|
import * as fs from "fs";
|
|
1516
1545
|
import * as path from "path";
|
|
1517
|
-
import
|
|
1546
|
+
import chalk21 from "chalk";
|
|
1518
1547
|
function findPackageJson() {
|
|
1519
1548
|
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
1520
1549
|
if (fs.existsSync(packageJsonPath)) {
|
|
@@ -1528,7 +1557,7 @@ function readPackageJson(filePath) {
|
|
|
1528
1557
|
function requirePackageJson() {
|
|
1529
1558
|
const packageJsonPath = findPackageJson();
|
|
1530
1559
|
if (!packageJsonPath) {
|
|
1531
|
-
console.error(
|
|
1560
|
+
console.error(chalk21.red("No package.json found in current directory"));
|
|
1532
1561
|
process.exit(1);
|
|
1533
1562
|
}
|
|
1534
1563
|
const pkg = readPackageJson(packageJsonPath);
|
|
@@ -1559,7 +1588,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
1559
1588
|
// src/commands/verify/installPackage.ts
|
|
1560
1589
|
import { execSync as execSync3 } from "child_process";
|
|
1561
1590
|
import { writeFileSync as writeFileSync5 } from "fs";
|
|
1562
|
-
import
|
|
1591
|
+
import chalk22 from "chalk";
|
|
1563
1592
|
function writePackageJson(filePath, pkg) {
|
|
1564
1593
|
writeFileSync5(filePath, `${JSON.stringify(pkg, null, 2)}
|
|
1565
1594
|
`);
|
|
@@ -1574,12 +1603,12 @@ function addScript(pkg, name, command) {
|
|
|
1574
1603
|
};
|
|
1575
1604
|
}
|
|
1576
1605
|
function installPackage(name, cwd) {
|
|
1577
|
-
console.log(
|
|
1606
|
+
console.log(chalk22.dim(`Installing ${name}...`));
|
|
1578
1607
|
try {
|
|
1579
1608
|
execSync3(`npm install -D ${name}`, { stdio: "inherit", cwd });
|
|
1580
1609
|
return true;
|
|
1581
1610
|
} catch {
|
|
1582
|
-
console.error(
|
|
1611
|
+
console.error(chalk22.red(`Failed to install ${name}`));
|
|
1583
1612
|
return false;
|
|
1584
1613
|
}
|
|
1585
1614
|
}
|
|
@@ -1626,9 +1655,9 @@ var expectedScripts = {
|
|
|
1626
1655
|
};
|
|
1627
1656
|
|
|
1628
1657
|
// src/commands/verify/setup/setupBuild.ts
|
|
1629
|
-
import
|
|
1658
|
+
import chalk23 from "chalk";
|
|
1630
1659
|
async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
1631
|
-
console.log(
|
|
1660
|
+
console.log(chalk23.blue("\nSetting up build verification..."));
|
|
1632
1661
|
let command;
|
|
1633
1662
|
if (hasVite && hasTypescript) {
|
|
1634
1663
|
command = "tsc -b && vite build --logLevel error";
|
|
@@ -1637,21 +1666,21 @@ async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
|
1637
1666
|
} else {
|
|
1638
1667
|
command = "npm run build";
|
|
1639
1668
|
}
|
|
1640
|
-
console.log(
|
|
1669
|
+
console.log(chalk23.dim(`Using: ${command}`));
|
|
1641
1670
|
writer("verify:build", command);
|
|
1642
1671
|
}
|
|
1643
1672
|
async function setupTypecheck(_packageJsonPath, writer) {
|
|
1644
|
-
console.log(
|
|
1673
|
+
console.log(chalk23.blue("\nSetting up typecheck verification..."));
|
|
1645
1674
|
const command = "tsc --noEmit";
|
|
1646
|
-
console.log(
|
|
1675
|
+
console.log(chalk23.dim(`Using: ${command}`));
|
|
1647
1676
|
writer("verify:typecheck", command);
|
|
1648
1677
|
}
|
|
1649
1678
|
|
|
1650
1679
|
// src/commands/verify/setup/setupDuplicateCode.ts
|
|
1651
1680
|
import * as path2 from "path";
|
|
1652
|
-
import
|
|
1681
|
+
import chalk24 from "chalk";
|
|
1653
1682
|
async function setupDuplicateCode(packageJsonPath, writer) {
|
|
1654
|
-
console.log(
|
|
1683
|
+
console.log(chalk24.blue("\nSetting up jscpd..."));
|
|
1655
1684
|
const cwd = path2.dirname(packageJsonPath);
|
|
1656
1685
|
const pkg = readPackageJson(packageJsonPath);
|
|
1657
1686
|
const hasJscpd = !!pkg.dependencies?.jscpd || !!pkg.devDependencies?.jscpd;
|
|
@@ -1663,12 +1692,12 @@ async function setupDuplicateCode(packageJsonPath, writer) {
|
|
|
1663
1692
|
|
|
1664
1693
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1665
1694
|
import * as path3 from "path";
|
|
1666
|
-
import
|
|
1695
|
+
import chalk26 from "chalk";
|
|
1667
1696
|
|
|
1668
1697
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
1669
1698
|
import { existsSync as existsSync9, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
1670
1699
|
import { join as join7 } from "path";
|
|
1671
|
-
import
|
|
1700
|
+
import chalk25 from "chalk";
|
|
1672
1701
|
function loadKnipConfig(knipJsonPath) {
|
|
1673
1702
|
if (existsSync9(knipJsonPath)) {
|
|
1674
1703
|
return JSON.parse(readFileSync8(knipJsonPath, "utf-8"));
|
|
@@ -1687,16 +1716,16 @@ function addToKnipIgnoreBinaries(cwd, binary) {
|
|
|
1687
1716
|
`${JSON.stringify(knipConfig, null, " ")}
|
|
1688
1717
|
`
|
|
1689
1718
|
);
|
|
1690
|
-
console.log(
|
|
1719
|
+
console.log(chalk25.dim(`Added '${binary}' to knip.json ignoreBinaries`));
|
|
1691
1720
|
}
|
|
1692
1721
|
} catch {
|
|
1693
|
-
console.log(
|
|
1722
|
+
console.log(chalk25.yellow("Warning: Could not update knip.json"));
|
|
1694
1723
|
}
|
|
1695
1724
|
}
|
|
1696
1725
|
|
|
1697
1726
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
1698
1727
|
async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
1699
|
-
console.log(
|
|
1728
|
+
console.log(chalk26.blue("\nSetting up hardcoded colors check..."));
|
|
1700
1729
|
const cwd = path3.dirname(packageJsonPath);
|
|
1701
1730
|
if (!hasOpenColor) {
|
|
1702
1731
|
installPackage("open-color", cwd);
|
|
@@ -1707,9 +1736,9 @@ async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
|
1707
1736
|
|
|
1708
1737
|
// src/commands/verify/setup/setupKnip.ts
|
|
1709
1738
|
import * as path4 from "path";
|
|
1710
|
-
import
|
|
1739
|
+
import chalk27 from "chalk";
|
|
1711
1740
|
async function setupKnip(packageJsonPath, writer) {
|
|
1712
|
-
console.log(
|
|
1741
|
+
console.log(chalk27.blue("\nSetting up knip..."));
|
|
1713
1742
|
const cwd = path4.dirname(packageJsonPath);
|
|
1714
1743
|
const pkg = readPackageJson(packageJsonPath);
|
|
1715
1744
|
if (!pkg.devDependencies?.knip && !installPackage("knip", cwd)) {
|
|
@@ -1720,14 +1749,14 @@ async function setupKnip(packageJsonPath, writer) {
|
|
|
1720
1749
|
|
|
1721
1750
|
// src/commands/verify/setup/setupLint.ts
|
|
1722
1751
|
import * as path5 from "path";
|
|
1723
|
-
import
|
|
1752
|
+
import chalk30 from "chalk";
|
|
1724
1753
|
|
|
1725
1754
|
// src/commands/lint/init.ts
|
|
1726
1755
|
import { execSync as execSync5 } from "child_process";
|
|
1727
1756
|
import { existsSync as existsSync12, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "fs";
|
|
1728
1757
|
import { dirname as dirname7, join as join8 } from "path";
|
|
1729
1758
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1730
|
-
import
|
|
1759
|
+
import chalk29 from "chalk";
|
|
1731
1760
|
|
|
1732
1761
|
// src/shared/promptConfirm.ts
|
|
1733
1762
|
import enquirer4 from "enquirer";
|
|
@@ -1831,7 +1860,7 @@ function removeEslintScripts(scripts, options2) {
|
|
|
1831
1860
|
}
|
|
1832
1861
|
|
|
1833
1862
|
// src/utils/printDiff.ts
|
|
1834
|
-
import
|
|
1863
|
+
import chalk28 from "chalk";
|
|
1835
1864
|
import * as diff from "diff";
|
|
1836
1865
|
function normalizeJson(content) {
|
|
1837
1866
|
try {
|
|
@@ -1849,11 +1878,11 @@ function printDiff(oldContent, newContent) {
|
|
|
1849
1878
|
const lines = change.value.replace(/\n$/, "").split("\n");
|
|
1850
1879
|
for (const line of lines) {
|
|
1851
1880
|
if (change.added) {
|
|
1852
|
-
console.log(
|
|
1881
|
+
console.log(chalk28.green(`+ ${line}`));
|
|
1853
1882
|
} else if (change.removed) {
|
|
1854
|
-
console.log(
|
|
1883
|
+
console.log(chalk28.red(`- ${line}`));
|
|
1855
1884
|
} else {
|
|
1856
|
-
console.log(
|
|
1885
|
+
console.log(chalk28.dim(` ${line}`));
|
|
1857
1886
|
}
|
|
1858
1887
|
}
|
|
1859
1888
|
}
|
|
@@ -1887,10 +1916,10 @@ async function init() {
|
|
|
1887
1916
|
console.log("biome.json already has the correct linter config");
|
|
1888
1917
|
return;
|
|
1889
1918
|
}
|
|
1890
|
-
console.log(
|
|
1919
|
+
console.log(chalk29.yellow("\n\u26A0\uFE0F biome.json will be updated:"));
|
|
1891
1920
|
console.log();
|
|
1892
1921
|
printDiff(oldContent, newContent);
|
|
1893
|
-
const confirm = await promptConfirm(
|
|
1922
|
+
const confirm = await promptConfirm(chalk29.red("Update biome.json?"));
|
|
1894
1923
|
if (!confirm) {
|
|
1895
1924
|
console.log("Skipped biome.json update");
|
|
1896
1925
|
return;
|
|
@@ -1901,7 +1930,7 @@ async function init() {
|
|
|
1901
1930
|
|
|
1902
1931
|
// src/commands/verify/setup/setupLint.ts
|
|
1903
1932
|
async function setupLint(packageJsonPath, writer) {
|
|
1904
|
-
console.log(
|
|
1933
|
+
console.log(chalk30.blue("\nSetting up biome..."));
|
|
1905
1934
|
const cwd = path5.dirname(packageJsonPath);
|
|
1906
1935
|
const pkg = readPackageJson(packageJsonPath);
|
|
1907
1936
|
if (!pkg.devDependencies?.["@biomejs/biome"]) {
|
|
@@ -1915,9 +1944,9 @@ async function setupLint(packageJsonPath, writer) {
|
|
|
1915
1944
|
|
|
1916
1945
|
// src/commands/verify/setup/setupMadge.ts
|
|
1917
1946
|
import * as path6 from "path";
|
|
1918
|
-
import
|
|
1947
|
+
import chalk31 from "chalk";
|
|
1919
1948
|
async function setupMadge(packageJsonPath, writer) {
|
|
1920
|
-
console.log(
|
|
1949
|
+
console.log(chalk31.blue("\nSetting up madge..."));
|
|
1921
1950
|
const cwd = path6.dirname(packageJsonPath);
|
|
1922
1951
|
const pkg = readPackageJson(packageJsonPath);
|
|
1923
1952
|
const hasMadge = !!pkg.dependencies?.madge || !!pkg.devDependencies?.madge;
|
|
@@ -1929,18 +1958,18 @@ async function setupMadge(packageJsonPath, writer) {
|
|
|
1929
1958
|
|
|
1930
1959
|
// src/commands/verify/setup/setupMaintainability.ts
|
|
1931
1960
|
import * as path7 from "path";
|
|
1932
|
-
import
|
|
1961
|
+
import chalk32 from "chalk";
|
|
1933
1962
|
async function setupMaintainability(packageJsonPath, writer) {
|
|
1934
|
-
console.log(
|
|
1963
|
+
console.log(chalk32.blue("\nSetting up maintainability check..."));
|
|
1935
1964
|
addToKnipIgnoreBinaries(path7.dirname(packageJsonPath), "assist");
|
|
1936
1965
|
writer("verify:maintainability", expectedScripts["verify:maintainability"]);
|
|
1937
1966
|
}
|
|
1938
1967
|
|
|
1939
1968
|
// src/commands/verify/setup/setupTest.ts
|
|
1940
1969
|
import * as path8 from "path";
|
|
1941
|
-
import
|
|
1970
|
+
import chalk33 from "chalk";
|
|
1942
1971
|
async function setupTest(packageJsonPath, writer) {
|
|
1943
|
-
console.log(
|
|
1972
|
+
console.log(chalk33.blue("\nSetting up vitest..."));
|
|
1944
1973
|
const cwd = path8.dirname(packageJsonPath);
|
|
1945
1974
|
const pkg = readPackageJson(packageJsonPath);
|
|
1946
1975
|
if (!pkg.devDependencies?.vitest && !installPackage("vitest", cwd)) {
|
|
@@ -2109,25 +2138,25 @@ async function runSelectedSetups(selected, packageJsonPath, writer, handlers) {
|
|
|
2109
2138
|
for (const choice of selected) {
|
|
2110
2139
|
await handlers[choice]?.(packageJsonPath, writer);
|
|
2111
2140
|
}
|
|
2112
|
-
console.log(
|
|
2141
|
+
console.log(chalk34.green(`
|
|
2113
2142
|
Added ${selected.length} verify script(s):`));
|
|
2114
2143
|
for (const choice of selected) {
|
|
2115
|
-
console.log(
|
|
2144
|
+
console.log(chalk34.green(` - verify:${choice}`));
|
|
2116
2145
|
}
|
|
2117
|
-
console.log(
|
|
2146
|
+
console.log(chalk34.dim("\nRun 'assist verify' to run all verify scripts"));
|
|
2118
2147
|
}
|
|
2119
2148
|
async function promptForScripts(availableOptions) {
|
|
2120
2149
|
if (availableOptions.length === 0) {
|
|
2121
|
-
console.log(
|
|
2150
|
+
console.log(chalk34.green("All verify scripts are already configured!"));
|
|
2122
2151
|
return null;
|
|
2123
2152
|
}
|
|
2124
|
-
console.log(
|
|
2153
|
+
console.log(chalk34.bold("Available verify scripts to add:\n"));
|
|
2125
2154
|
const selected = await promptMultiselect(
|
|
2126
2155
|
"Select verify scripts to add:",
|
|
2127
2156
|
availableOptions
|
|
2128
2157
|
);
|
|
2129
2158
|
if (selected.length === 0) {
|
|
2130
|
-
console.log(
|
|
2159
|
+
console.log(chalk34.yellow("No scripts selected"));
|
|
2131
2160
|
return null;
|
|
2132
2161
|
}
|
|
2133
2162
|
return selected;
|
|
@@ -2147,17 +2176,17 @@ async function init2() {
|
|
|
2147
2176
|
}
|
|
2148
2177
|
|
|
2149
2178
|
// src/commands/vscode/init/index.ts
|
|
2150
|
-
import
|
|
2179
|
+
import chalk36 from "chalk";
|
|
2151
2180
|
|
|
2152
2181
|
// src/commands/vscode/init/createLaunchJson.ts
|
|
2153
2182
|
import * as fs2 from "fs";
|
|
2154
2183
|
import * as path9 from "path";
|
|
2155
|
-
import
|
|
2184
|
+
import chalk35 from "chalk";
|
|
2156
2185
|
function ensureVscodeFolder() {
|
|
2157
2186
|
const vscodeDir = path9.join(process.cwd(), ".vscode");
|
|
2158
2187
|
if (!fs2.existsSync(vscodeDir)) {
|
|
2159
2188
|
fs2.mkdirSync(vscodeDir);
|
|
2160
|
-
console.log(
|
|
2189
|
+
console.log(chalk35.dim("Created .vscode folder"));
|
|
2161
2190
|
}
|
|
2162
2191
|
}
|
|
2163
2192
|
function removeVscodeFromGitignore() {
|
|
@@ -2172,7 +2201,7 @@ function removeVscodeFromGitignore() {
|
|
|
2172
2201
|
);
|
|
2173
2202
|
if (filteredLines.length !== lines.length) {
|
|
2174
2203
|
fs2.writeFileSync(gitignorePath, filteredLines.join("\n"));
|
|
2175
|
-
console.log(
|
|
2204
|
+
console.log(chalk35.dim("Removed .vscode references from .gitignore"));
|
|
2176
2205
|
}
|
|
2177
2206
|
}
|
|
2178
2207
|
function createLaunchJson(type) {
|
|
@@ -2191,7 +2220,7 @@ function createLaunchJson(type) {
|
|
|
2191
2220
|
const launchPath = path9.join(process.cwd(), ".vscode", "launch.json");
|
|
2192
2221
|
fs2.writeFileSync(launchPath, `${JSON.stringify(launchConfig, null, " ")}
|
|
2193
2222
|
`);
|
|
2194
|
-
console.log(
|
|
2223
|
+
console.log(chalk35.green("Created .vscode/launch.json"));
|
|
2195
2224
|
}
|
|
2196
2225
|
function createSettingsJson() {
|
|
2197
2226
|
const settings = {
|
|
@@ -2204,7 +2233,7 @@ function createSettingsJson() {
|
|
|
2204
2233
|
const settingsPath = path9.join(process.cwd(), ".vscode", "settings.json");
|
|
2205
2234
|
fs2.writeFileSync(settingsPath, `${JSON.stringify(settings, null, " ")}
|
|
2206
2235
|
`);
|
|
2207
|
-
console.log(
|
|
2236
|
+
console.log(chalk35.green("Created .vscode/settings.json"));
|
|
2208
2237
|
}
|
|
2209
2238
|
function createExtensionsJson() {
|
|
2210
2239
|
const extensions = {
|
|
@@ -2216,7 +2245,7 @@ function createExtensionsJson() {
|
|
|
2216
2245
|
`${JSON.stringify(extensions, null, " ")}
|
|
2217
2246
|
`
|
|
2218
2247
|
);
|
|
2219
|
-
console.log(
|
|
2248
|
+
console.log(chalk35.green("Created .vscode/extensions.json"));
|
|
2220
2249
|
}
|
|
2221
2250
|
|
|
2222
2251
|
// src/commands/vscode/init/detectVscodeSetup.ts
|
|
@@ -2273,7 +2302,7 @@ function applySelections(selected, setup2) {
|
|
|
2273
2302
|
for (const choice of selected) handlers[choice]?.();
|
|
2274
2303
|
}
|
|
2275
2304
|
async function promptForOptions(options2) {
|
|
2276
|
-
console.log(
|
|
2305
|
+
console.log(chalk36.bold("Available VS Code configurations to add:\n"));
|
|
2277
2306
|
return promptMultiselect("Select configurations to add:", options2);
|
|
2278
2307
|
}
|
|
2279
2308
|
async function init3({ all = false } = {}) {
|
|
@@ -2281,17 +2310,17 @@ async function init3({ all = false } = {}) {
|
|
|
2281
2310
|
const setup2 = detectVscodeSetup(pkg);
|
|
2282
2311
|
const options2 = getAvailableOptions2(setup2);
|
|
2283
2312
|
if (options2.length === 0) {
|
|
2284
|
-
console.log(
|
|
2313
|
+
console.log(chalk36.green("VS Code configuration already exists!"));
|
|
2285
2314
|
return;
|
|
2286
2315
|
}
|
|
2287
2316
|
const selected = all ? options2.map((o) => o.value) : await promptForOptions(options2);
|
|
2288
2317
|
if (selected.length === 0) {
|
|
2289
|
-
console.log(
|
|
2318
|
+
console.log(chalk36.yellow("No configurations selected"));
|
|
2290
2319
|
return;
|
|
2291
2320
|
}
|
|
2292
2321
|
applySelections(selected, setup2);
|
|
2293
2322
|
console.log(
|
|
2294
|
-
|
|
2323
|
+
chalk36.green(`
|
|
2295
2324
|
Added ${selected.length} VS Code configuration(s)`)
|
|
2296
2325
|
);
|
|
2297
2326
|
}
|
|
@@ -2304,7 +2333,7 @@ async function init4() {
|
|
|
2304
2333
|
|
|
2305
2334
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2306
2335
|
import path16 from "path";
|
|
2307
|
-
import
|
|
2336
|
+
import chalk38 from "chalk";
|
|
2308
2337
|
|
|
2309
2338
|
// src/commands/lint/lint/checkFileNames.ts
|
|
2310
2339
|
import fs5 from "fs";
|
|
@@ -2384,7 +2413,7 @@ function checkFileNames() {
|
|
|
2384
2413
|
}
|
|
2385
2414
|
|
|
2386
2415
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
2387
|
-
import
|
|
2416
|
+
import chalk37 from "chalk";
|
|
2388
2417
|
|
|
2389
2418
|
// src/commands/lint/lint/applyMoves.ts
|
|
2390
2419
|
import fs6 from "fs";
|
|
@@ -2469,25 +2498,25 @@ function fixFileNameViolations(moves) {
|
|
|
2469
2498
|
const start3 = performance.now();
|
|
2470
2499
|
const project = createLintProject();
|
|
2471
2500
|
const cwd = process.cwd();
|
|
2472
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
2501
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk37.green(line)));
|
|
2473
2502
|
const ms = (performance.now() - start3).toFixed(0);
|
|
2474
|
-
console.log(
|
|
2503
|
+
console.log(chalk37.dim(` Done in ${ms}ms`));
|
|
2475
2504
|
}
|
|
2476
2505
|
|
|
2477
2506
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
2478
2507
|
function reportViolations(violations) {
|
|
2479
|
-
console.error(
|
|
2508
|
+
console.error(chalk38.red("\nFile name check failed:\n"));
|
|
2480
2509
|
console.error(
|
|
2481
|
-
|
|
2510
|
+
chalk38.red(
|
|
2482
2511
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
2483
2512
|
)
|
|
2484
2513
|
);
|
|
2485
2514
|
for (const violation of violations) {
|
|
2486
|
-
console.error(
|
|
2487
|
-
console.error(
|
|
2515
|
+
console.error(chalk38.red(` ${violation.filePath}`));
|
|
2516
|
+
console.error(chalk38.gray(` Rename to: ${violation.suggestedName}
|
|
2488
2517
|
`));
|
|
2489
2518
|
}
|
|
2490
|
-
console.error(
|
|
2519
|
+
console.error(chalk38.dim(" Run with -f to auto-fix.\n"));
|
|
2491
2520
|
}
|
|
2492
2521
|
function runFileNameCheck(fix = false) {
|
|
2493
2522
|
const violations = checkFileNames();
|
|
@@ -2516,17 +2545,17 @@ function runFileNameCheck(fix = false) {
|
|
|
2516
2545
|
import fs8 from "fs";
|
|
2517
2546
|
|
|
2518
2547
|
// src/commands/lint/shared.ts
|
|
2519
|
-
import
|
|
2548
|
+
import chalk39 from "chalk";
|
|
2520
2549
|
function reportViolations2(violations, checkName, errorMessage, successMessage) {
|
|
2521
2550
|
if (violations.length > 0) {
|
|
2522
|
-
console.error(
|
|
2551
|
+
console.error(chalk39.red(`
|
|
2523
2552
|
${checkName} failed:
|
|
2524
2553
|
`));
|
|
2525
|
-
console.error(
|
|
2554
|
+
console.error(chalk39.red(` ${errorMessage}
|
|
2526
2555
|
`));
|
|
2527
2556
|
for (const violation of violations) {
|
|
2528
|
-
console.error(
|
|
2529
|
-
console.error(
|
|
2557
|
+
console.error(chalk39.red(` ${violation.filePath}:${violation.line}`));
|
|
2558
|
+
console.error(chalk39.gray(` ${violation.content}
|
|
2530
2559
|
`));
|
|
2531
2560
|
}
|
|
2532
2561
|
return false;
|
|
@@ -3006,14 +3035,14 @@ import { existsSync as existsSync16, readFileSync as readFileSync13, writeFileSy
|
|
|
3006
3035
|
|
|
3007
3036
|
// src/commands/deploy/init/index.ts
|
|
3008
3037
|
import { execSync as execSync12 } from "child_process";
|
|
3009
|
-
import
|
|
3038
|
+
import chalk41 from "chalk";
|
|
3010
3039
|
import enquirer5 from "enquirer";
|
|
3011
3040
|
|
|
3012
3041
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
3013
3042
|
import { existsSync as existsSync15, mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync12 } from "fs";
|
|
3014
3043
|
import { dirname as dirname13, join as join11 } from "path";
|
|
3015
3044
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3016
|
-
import
|
|
3045
|
+
import chalk40 from "chalk";
|
|
3017
3046
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
3018
3047
|
var __dirname3 = dirname13(fileURLToPath3(import.meta.url));
|
|
3019
3048
|
function getExistingSiteId() {
|
|
@@ -3038,20 +3067,20 @@ async function updateWorkflow(siteId) {
|
|
|
3038
3067
|
if (existsSync15(WORKFLOW_PATH)) {
|
|
3039
3068
|
const oldContent = readFileSync12(WORKFLOW_PATH, "utf-8");
|
|
3040
3069
|
if (oldContent === newContent) {
|
|
3041
|
-
console.log(
|
|
3070
|
+
console.log(chalk40.green("build.yml is already up to date"));
|
|
3042
3071
|
return;
|
|
3043
3072
|
}
|
|
3044
|
-
console.log(
|
|
3073
|
+
console.log(chalk40.yellow("\nbuild.yml will be updated:"));
|
|
3045
3074
|
console.log();
|
|
3046
3075
|
printDiff(oldContent, newContent);
|
|
3047
|
-
const confirm = await promptConfirm(
|
|
3076
|
+
const confirm = await promptConfirm(chalk40.red("Update build.yml?"));
|
|
3048
3077
|
if (!confirm) {
|
|
3049
3078
|
console.log("Skipped build.yml update");
|
|
3050
3079
|
return;
|
|
3051
3080
|
}
|
|
3052
3081
|
}
|
|
3053
3082
|
writeFileSync12(WORKFLOW_PATH, newContent);
|
|
3054
|
-
console.log(
|
|
3083
|
+
console.log(chalk40.green(`
|
|
3055
3084
|
Created ${WORKFLOW_PATH}`));
|
|
3056
3085
|
}
|
|
3057
3086
|
|
|
@@ -3062,43 +3091,43 @@ async function ensureNetlifyCli() {
|
|
|
3062
3091
|
} catch (error) {
|
|
3063
3092
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
3064
3093
|
throw error;
|
|
3065
|
-
console.error(
|
|
3094
|
+
console.error(chalk41.red("\nNetlify CLI is not installed.\n"));
|
|
3066
3095
|
const install = await promptConfirm("Would you like to install it now?");
|
|
3067
3096
|
if (!install) {
|
|
3068
3097
|
console.log(
|
|
3069
|
-
|
|
3098
|
+
chalk41.yellow(
|
|
3070
3099
|
"\nInstall it manually with: npm install -g netlify-cli\n"
|
|
3071
3100
|
)
|
|
3072
3101
|
);
|
|
3073
3102
|
process.exit(1);
|
|
3074
3103
|
}
|
|
3075
|
-
console.log(
|
|
3104
|
+
console.log(chalk41.dim("\nInstalling netlify-cli...\n"));
|
|
3076
3105
|
execSync12("npm install -g netlify-cli", { stdio: "inherit" });
|
|
3077
3106
|
console.log();
|
|
3078
3107
|
execSync12("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
3079
3108
|
}
|
|
3080
3109
|
}
|
|
3081
3110
|
function printSetupInstructions() {
|
|
3082
|
-
console.log(
|
|
3111
|
+
console.log(chalk41.bold("\nDeployment initialized successfully!"));
|
|
3083
3112
|
console.log(
|
|
3084
|
-
|
|
3113
|
+
chalk41.yellow("\nTo complete setup, create a personal access token at:")
|
|
3085
3114
|
);
|
|
3086
3115
|
console.log(
|
|
3087
|
-
|
|
3116
|
+
chalk41.cyan(
|
|
3088
3117
|
"https://app.netlify.com/user/applications#personal-access-tokens"
|
|
3089
3118
|
)
|
|
3090
3119
|
);
|
|
3091
3120
|
console.log(
|
|
3092
|
-
|
|
3121
|
+
chalk41.yellow(
|
|
3093
3122
|
"\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets."
|
|
3094
3123
|
)
|
|
3095
3124
|
);
|
|
3096
3125
|
}
|
|
3097
3126
|
async function init5() {
|
|
3098
|
-
console.log(
|
|
3127
|
+
console.log(chalk41.bold("Initializing Netlify deployment...\n"));
|
|
3099
3128
|
const existingSiteId = getExistingSiteId();
|
|
3100
3129
|
if (existingSiteId) {
|
|
3101
|
-
console.log(
|
|
3130
|
+
console.log(chalk41.dim(`Using existing site ID: ${existingSiteId}
|
|
3102
3131
|
`));
|
|
3103
3132
|
await updateWorkflow(existingSiteId);
|
|
3104
3133
|
return;
|
|
@@ -3277,27 +3306,27 @@ async function notify() {
|
|
|
3277
3306
|
}
|
|
3278
3307
|
|
|
3279
3308
|
// src/commands/backlog/comment/index.ts
|
|
3280
|
-
import
|
|
3309
|
+
import chalk42 from "chalk";
|
|
3281
3310
|
function comment(id, text) {
|
|
3282
3311
|
const result = loadAndFindItem(id);
|
|
3283
3312
|
if (!result) process.exit(1);
|
|
3284
3313
|
addComment(result.item, text);
|
|
3285
3314
|
saveBacklog(result.items);
|
|
3286
|
-
console.log(
|
|
3315
|
+
console.log(chalk42.green(`Comment added to item #${id}.`));
|
|
3287
3316
|
}
|
|
3288
3317
|
|
|
3289
3318
|
// src/commands/backlog/comments/index.ts
|
|
3290
|
-
import
|
|
3319
|
+
import chalk43 from "chalk";
|
|
3291
3320
|
function comments(id) {
|
|
3292
3321
|
const result = loadAndFindItem(id);
|
|
3293
3322
|
if (!result) process.exit(1);
|
|
3294
3323
|
const { item } = result;
|
|
3295
3324
|
const entries = item.comments ?? [];
|
|
3296
3325
|
if (entries.length === 0) {
|
|
3297
|
-
console.log(
|
|
3326
|
+
console.log(chalk43.dim(`No comments on item #${id}.`));
|
|
3298
3327
|
return;
|
|
3299
3328
|
}
|
|
3300
|
-
console.log(
|
|
3329
|
+
console.log(chalk43.bold(`Comments for #${id}: ${item.name}
|
|
3301
3330
|
`));
|
|
3302
3331
|
for (const entry of entries) {
|
|
3303
3332
|
console.log(`${formatComment(entry)}
|
|
@@ -3313,11 +3342,11 @@ function registerCommentCommands(cmd) {
|
|
|
3313
3342
|
|
|
3314
3343
|
// src/commands/backlog/add/index.ts
|
|
3315
3344
|
import { existsSync as existsSync17 } from "fs";
|
|
3316
|
-
import
|
|
3345
|
+
import chalk45 from "chalk";
|
|
3317
3346
|
|
|
3318
3347
|
// src/commands/backlog/commitBacklog.ts
|
|
3319
3348
|
import { execSync as execSync14 } from "child_process";
|
|
3320
|
-
import
|
|
3349
|
+
import chalk44 from "chalk";
|
|
3321
3350
|
function commitBacklog(id, name) {
|
|
3322
3351
|
try {
|
|
3323
3352
|
const backlogPath = getBacklogPath();
|
|
@@ -3325,7 +3354,7 @@ function commitBacklog(id, name) {
|
|
|
3325
3354
|
execSync14(`git add ${shellQuote(backlogPath)}`, { stdio: "ignore" });
|
|
3326
3355
|
execSync14(`git commit -m ${shellQuote(message)}`, { stdio: "ignore" });
|
|
3327
3356
|
} catch {
|
|
3328
|
-
console.log(
|
|
3357
|
+
console.log(chalk44.yellow("Warning: could not auto-commit backlog file."));
|
|
3329
3358
|
}
|
|
3330
3359
|
}
|
|
3331
3360
|
|
|
@@ -3403,7 +3432,7 @@ async function promptAcceptanceCriteria() {
|
|
|
3403
3432
|
var addItemSchema = backlogItemSchema.omit({ id: true, status: true });
|
|
3404
3433
|
async function addFromJson() {
|
|
3405
3434
|
if (process.stdin.isTTY) {
|
|
3406
|
-
console.log(
|
|
3435
|
+
console.log(chalk45.red("--json requires piped input on stdin."));
|
|
3407
3436
|
return;
|
|
3408
3437
|
}
|
|
3409
3438
|
const input = await readStdin();
|
|
@@ -3417,7 +3446,7 @@ async function addFromJson() {
|
|
|
3417
3446
|
items.push({ ...data, id, status: "todo" });
|
|
3418
3447
|
saveBacklog(items);
|
|
3419
3448
|
commitBacklog(id, data.name);
|
|
3420
|
-
console.log(
|
|
3449
|
+
console.log(chalk45.green(`Added item #${id}: ${data.name}`));
|
|
3421
3450
|
}
|
|
3422
3451
|
async function addInteractive() {
|
|
3423
3452
|
const type = await promptType();
|
|
@@ -3436,12 +3465,12 @@ async function addInteractive() {
|
|
|
3436
3465
|
});
|
|
3437
3466
|
saveBacklog(items);
|
|
3438
3467
|
commitBacklog(id, name);
|
|
3439
|
-
console.log(
|
|
3468
|
+
console.log(chalk45.green(`Added item #${id}: ${name}`));
|
|
3440
3469
|
}
|
|
3441
3470
|
async function add(options2) {
|
|
3442
3471
|
if (!existsSync17(getBacklogPath())) {
|
|
3443
3472
|
console.log(
|
|
3444
|
-
|
|
3473
|
+
chalk45.yellow(
|
|
3445
3474
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3446
3475
|
)
|
|
3447
3476
|
);
|
|
@@ -3456,20 +3485,20 @@ async function add(options2) {
|
|
|
3456
3485
|
|
|
3457
3486
|
// src/commands/backlog/init/index.ts
|
|
3458
3487
|
import { existsSync as existsSync18 } from "fs";
|
|
3459
|
-
import
|
|
3488
|
+
import chalk46 from "chalk";
|
|
3460
3489
|
async function init6() {
|
|
3461
3490
|
const backlogPath = getBacklogPath();
|
|
3462
3491
|
if (existsSync18(backlogPath)) {
|
|
3463
|
-
console.log(
|
|
3492
|
+
console.log(chalk46.yellow("assist.backlog.yml already exists."));
|
|
3464
3493
|
return;
|
|
3465
3494
|
}
|
|
3466
3495
|
saveBacklog([]);
|
|
3467
|
-
console.log(
|
|
3496
|
+
console.log(chalk46.green("Created assist.backlog.yml"));
|
|
3468
3497
|
}
|
|
3469
3498
|
|
|
3470
3499
|
// src/commands/backlog/list/index.ts
|
|
3471
3500
|
import { existsSync as existsSync19 } from "fs";
|
|
3472
|
-
import
|
|
3501
|
+
import chalk47 from "chalk";
|
|
3473
3502
|
function filterItems(items, options2) {
|
|
3474
3503
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3475
3504
|
if (!options2.all) return items.filter((i) => i.status !== "done");
|
|
@@ -3478,7 +3507,7 @@ function filterItems(items, options2) {
|
|
|
3478
3507
|
async function list2(options2) {
|
|
3479
3508
|
if (!existsSync19(getBacklogPath())) {
|
|
3480
3509
|
console.log(
|
|
3481
|
-
|
|
3510
|
+
chalk47.yellow(
|
|
3482
3511
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
3483
3512
|
)
|
|
3484
3513
|
);
|
|
@@ -3486,12 +3515,12 @@ async function list2(options2) {
|
|
|
3486
3515
|
}
|
|
3487
3516
|
const items = filterItems(loadBacklog(), options2);
|
|
3488
3517
|
if (items.length === 0) {
|
|
3489
|
-
console.log(
|
|
3518
|
+
console.log(chalk47.dim("Backlog is empty."));
|
|
3490
3519
|
return;
|
|
3491
3520
|
}
|
|
3492
3521
|
for (const item of items) {
|
|
3493
3522
|
console.log(
|
|
3494
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
3523
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk47.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}`
|
|
3495
3524
|
);
|
|
3496
3525
|
if (options2.verbose) {
|
|
3497
3526
|
printVerboseDetails(item);
|
|
@@ -3930,11 +3959,11 @@ function assertCliExists(cli) {
|
|
|
3930
3959
|
}
|
|
3931
3960
|
|
|
3932
3961
|
// src/commands/permitCliReads/colorize.ts
|
|
3933
|
-
import
|
|
3962
|
+
import chalk48 from "chalk";
|
|
3934
3963
|
function colorize(plainOutput) {
|
|
3935
3964
|
return plainOutput.split("\n").map((line) => {
|
|
3936
|
-
if (line.startsWith(" R ")) return
|
|
3937
|
-
if (line.startsWith(" W ")) return
|
|
3965
|
+
if (line.startsWith(" R ")) return chalk48.green(line);
|
|
3966
|
+
if (line.startsWith(" W ")) return chalk48.red(line);
|
|
3938
3967
|
return line;
|
|
3939
3968
|
}).join("\n");
|
|
3940
3969
|
}
|
|
@@ -4248,15 +4277,15 @@ function registerCliHook(program2) {
|
|
|
4248
4277
|
}
|
|
4249
4278
|
|
|
4250
4279
|
// src/commands/complexity/analyze.ts
|
|
4251
|
-
import
|
|
4280
|
+
import chalk54 from "chalk";
|
|
4252
4281
|
|
|
4253
4282
|
// src/commands/complexity/cyclomatic.ts
|
|
4254
|
-
import
|
|
4283
|
+
import chalk50 from "chalk";
|
|
4255
4284
|
|
|
4256
4285
|
// src/commands/complexity/shared/index.ts
|
|
4257
4286
|
import fs12 from "fs";
|
|
4258
4287
|
import path20 from "path";
|
|
4259
|
-
import
|
|
4288
|
+
import chalk49 from "chalk";
|
|
4260
4289
|
import ts5 from "typescript";
|
|
4261
4290
|
|
|
4262
4291
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -4502,7 +4531,7 @@ function createSourceFromFile(filePath) {
|
|
|
4502
4531
|
function withSourceFiles(pattern2, callback) {
|
|
4503
4532
|
const files = findSourceFiles2(pattern2);
|
|
4504
4533
|
if (files.length === 0) {
|
|
4505
|
-
console.log(
|
|
4534
|
+
console.log(chalk49.yellow("No files found matching pattern"));
|
|
4506
4535
|
return void 0;
|
|
4507
4536
|
}
|
|
4508
4537
|
return callback(files);
|
|
@@ -4535,11 +4564,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4535
4564
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
4536
4565
|
for (const { file, name, complexity } of results) {
|
|
4537
4566
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
4538
|
-
const color = exceedsThreshold ?
|
|
4539
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
4567
|
+
const color = exceedsThreshold ? chalk50.red : chalk50.white;
|
|
4568
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk50.cyan(complexity)}`);
|
|
4540
4569
|
}
|
|
4541
4570
|
console.log(
|
|
4542
|
-
|
|
4571
|
+
chalk50.dim(
|
|
4543
4572
|
`
|
|
4544
4573
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4545
4574
|
)
|
|
@@ -4551,7 +4580,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4551
4580
|
}
|
|
4552
4581
|
|
|
4553
4582
|
// src/commands/complexity/halstead.ts
|
|
4554
|
-
import
|
|
4583
|
+
import chalk51 from "chalk";
|
|
4555
4584
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
4556
4585
|
withSourceFiles(pattern2, (files) => {
|
|
4557
4586
|
const results = [];
|
|
@@ -4566,13 +4595,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4566
4595
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
4567
4596
|
for (const { file, name, metrics } of results) {
|
|
4568
4597
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
4569
|
-
const color = exceedsThreshold ?
|
|
4598
|
+
const color = exceedsThreshold ? chalk51.red : chalk51.white;
|
|
4570
4599
|
console.log(
|
|
4571
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
4600
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk51.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk51.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk51.magenta(metrics.effort.toFixed(1))}`
|
|
4572
4601
|
);
|
|
4573
4602
|
}
|
|
4574
4603
|
console.log(
|
|
4575
|
-
|
|
4604
|
+
chalk51.dim(
|
|
4576
4605
|
`
|
|
4577
4606
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4578
4607
|
)
|
|
@@ -4587,28 +4616,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4587
4616
|
import fs13 from "fs";
|
|
4588
4617
|
|
|
4589
4618
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
4590
|
-
import
|
|
4619
|
+
import chalk52 from "chalk";
|
|
4591
4620
|
function displayMaintainabilityResults(results, threshold) {
|
|
4592
4621
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
4593
4622
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
4594
|
-
console.log(
|
|
4623
|
+
console.log(chalk52.green("All files pass maintainability threshold"));
|
|
4595
4624
|
} else {
|
|
4596
4625
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
4597
|
-
const color = threshold !== void 0 ?
|
|
4626
|
+
const color = threshold !== void 0 ? chalk52.red : chalk52.white;
|
|
4598
4627
|
console.log(
|
|
4599
|
-
`${color(file)} \u2192 avg: ${
|
|
4628
|
+
`${color(file)} \u2192 avg: ${chalk52.cyan(avgMaintainability.toFixed(1))}, min: ${chalk52.yellow(minMaintainability.toFixed(1))}`
|
|
4600
4629
|
);
|
|
4601
4630
|
}
|
|
4602
4631
|
}
|
|
4603
|
-
console.log(
|
|
4632
|
+
console.log(chalk52.dim(`
|
|
4604
4633
|
Analyzed ${results.length} files`));
|
|
4605
4634
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
4606
4635
|
console.error(
|
|
4607
|
-
|
|
4636
|
+
chalk52.red(
|
|
4608
4637
|
`
|
|
4609
4638
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
4610
4639
|
|
|
4611
|
-
\u26A0\uFE0F ${
|
|
4640
|
+
\u26A0\uFE0F ${chalk52.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel. Run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
4612
4641
|
)
|
|
4613
4642
|
);
|
|
4614
4643
|
process.exit(1);
|
|
@@ -4665,7 +4694,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4665
4694
|
|
|
4666
4695
|
// src/commands/complexity/sloc.ts
|
|
4667
4696
|
import fs14 from "fs";
|
|
4668
|
-
import
|
|
4697
|
+
import chalk53 from "chalk";
|
|
4669
4698
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
4670
4699
|
withSourceFiles(pattern2, (files) => {
|
|
4671
4700
|
const results = [];
|
|
@@ -4681,12 +4710,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4681
4710
|
results.sort((a, b) => b.lines - a.lines);
|
|
4682
4711
|
for (const { file, lines } of results) {
|
|
4683
4712
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
4684
|
-
const color = exceedsThreshold ?
|
|
4685
|
-
console.log(`${color(file)} \u2192 ${
|
|
4713
|
+
const color = exceedsThreshold ? chalk53.red : chalk53.white;
|
|
4714
|
+
console.log(`${color(file)} \u2192 ${chalk53.cyan(lines)} lines`);
|
|
4686
4715
|
}
|
|
4687
4716
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
4688
4717
|
console.log(
|
|
4689
|
-
|
|
4718
|
+
chalk53.dim(`
|
|
4690
4719
|
Total: ${total} lines across ${files.length} files`)
|
|
4691
4720
|
);
|
|
4692
4721
|
if (hasViolation) {
|
|
@@ -4700,21 +4729,21 @@ async function analyze(pattern2) {
|
|
|
4700
4729
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
4701
4730
|
const files = findSourceFiles2(searchPattern);
|
|
4702
4731
|
if (files.length === 0) {
|
|
4703
|
-
console.log(
|
|
4732
|
+
console.log(chalk54.yellow("No files found matching pattern"));
|
|
4704
4733
|
return;
|
|
4705
4734
|
}
|
|
4706
4735
|
if (files.length === 1) {
|
|
4707
4736
|
const file = files[0];
|
|
4708
|
-
console.log(
|
|
4737
|
+
console.log(chalk54.bold.underline("SLOC"));
|
|
4709
4738
|
await sloc(file);
|
|
4710
4739
|
console.log();
|
|
4711
|
-
console.log(
|
|
4740
|
+
console.log(chalk54.bold.underline("Cyclomatic Complexity"));
|
|
4712
4741
|
await cyclomatic(file);
|
|
4713
4742
|
console.log();
|
|
4714
|
-
console.log(
|
|
4743
|
+
console.log(chalk54.bold.underline("Halstead Metrics"));
|
|
4715
4744
|
await halstead(file);
|
|
4716
4745
|
console.log();
|
|
4717
|
-
console.log(
|
|
4746
|
+
console.log(chalk54.bold.underline("Maintainability Index"));
|
|
4718
4747
|
await maintainability(file);
|
|
4719
4748
|
return;
|
|
4720
4749
|
}
|
|
@@ -4742,7 +4771,7 @@ function registerComplexity(program2) {
|
|
|
4742
4771
|
|
|
4743
4772
|
// src/commands/deploy/redirect.ts
|
|
4744
4773
|
import { existsSync as existsSync23, readFileSync as readFileSync18, writeFileSync as writeFileSync17 } from "fs";
|
|
4745
|
-
import
|
|
4774
|
+
import chalk55 from "chalk";
|
|
4746
4775
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
4747
4776
|
if (!window.location.pathname.endsWith('/')) {
|
|
4748
4777
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -4751,22 +4780,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
4751
4780
|
function redirect() {
|
|
4752
4781
|
const indexPath = "index.html";
|
|
4753
4782
|
if (!existsSync23(indexPath)) {
|
|
4754
|
-
console.log(
|
|
4783
|
+
console.log(chalk55.yellow("No index.html found"));
|
|
4755
4784
|
return;
|
|
4756
4785
|
}
|
|
4757
4786
|
const content = readFileSync18(indexPath, "utf-8");
|
|
4758
4787
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
4759
|
-
console.log(
|
|
4788
|
+
console.log(chalk55.dim("Trailing slash script already present"));
|
|
4760
4789
|
return;
|
|
4761
4790
|
}
|
|
4762
4791
|
const headCloseIndex = content.indexOf("</head>");
|
|
4763
4792
|
if (headCloseIndex === -1) {
|
|
4764
|
-
console.log(
|
|
4793
|
+
console.log(chalk55.red("Could not find </head> tag in index.html"));
|
|
4765
4794
|
return;
|
|
4766
4795
|
}
|
|
4767
4796
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
4768
4797
|
writeFileSync17(indexPath, newContent);
|
|
4769
|
-
console.log(
|
|
4798
|
+
console.log(chalk55.green("Added trailing slash redirect to index.html"));
|
|
4770
4799
|
}
|
|
4771
4800
|
|
|
4772
4801
|
// src/commands/registerDeploy.ts
|
|
@@ -4793,7 +4822,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
4793
4822
|
|
|
4794
4823
|
// src/commands/devlog/shared.ts
|
|
4795
4824
|
import { execSync as execSync17 } from "child_process";
|
|
4796
|
-
import
|
|
4825
|
+
import chalk56 from "chalk";
|
|
4797
4826
|
|
|
4798
4827
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
4799
4828
|
import { readdirSync, readFileSync as readFileSync19 } from "fs";
|
|
@@ -4880,13 +4909,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
4880
4909
|
}
|
|
4881
4910
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
4882
4911
|
for (const commit2 of commits) {
|
|
4883
|
-
console.log(` ${
|
|
4912
|
+
console.log(` ${chalk56.yellow(commit2.hash)} ${commit2.message}`);
|
|
4884
4913
|
if (verbose) {
|
|
4885
4914
|
const visibleFiles = commit2.files.filter(
|
|
4886
4915
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
4887
4916
|
);
|
|
4888
4917
|
for (const file of visibleFiles) {
|
|
4889
|
-
console.log(` ${
|
|
4918
|
+
console.log(` ${chalk56.dim(file)}`);
|
|
4890
4919
|
}
|
|
4891
4920
|
}
|
|
4892
4921
|
}
|
|
@@ -4911,15 +4940,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
4911
4940
|
}
|
|
4912
4941
|
|
|
4913
4942
|
// src/commands/devlog/list/printDateHeader.ts
|
|
4914
|
-
import
|
|
4943
|
+
import chalk57 from "chalk";
|
|
4915
4944
|
function printDateHeader(date, isSkipped, entries) {
|
|
4916
4945
|
if (isSkipped) {
|
|
4917
|
-
console.log(`${
|
|
4946
|
+
console.log(`${chalk57.bold.blue(date)} ${chalk57.dim("skipped")}`);
|
|
4918
4947
|
} else if (entries && entries.length > 0) {
|
|
4919
|
-
const entryInfo = entries.map((e) => `${
|
|
4920
|
-
console.log(`${
|
|
4948
|
+
const entryInfo = entries.map((e) => `${chalk57.green(e.version)} ${e.title}`).join(" | ");
|
|
4949
|
+
console.log(`${chalk57.bold.blue(date)} ${entryInfo}`);
|
|
4921
4950
|
} else {
|
|
4922
|
-
console.log(`${
|
|
4951
|
+
console.log(`${chalk57.bold.blue(date)} ${chalk57.red("\u26A0 devlog missing")}`);
|
|
4923
4952
|
}
|
|
4924
4953
|
}
|
|
4925
4954
|
|
|
@@ -5022,24 +5051,24 @@ function bumpVersion(version2, type) {
|
|
|
5022
5051
|
|
|
5023
5052
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5024
5053
|
import { execSync as execSync20 } from "child_process";
|
|
5025
|
-
import
|
|
5054
|
+
import chalk59 from "chalk";
|
|
5026
5055
|
|
|
5027
5056
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5028
|
-
import
|
|
5057
|
+
import chalk58 from "chalk";
|
|
5029
5058
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5030
5059
|
if (conventional && firstHash) {
|
|
5031
5060
|
const version2 = getVersionAtCommit(firstHash);
|
|
5032
5061
|
if (version2) {
|
|
5033
|
-
console.log(`${
|
|
5062
|
+
console.log(`${chalk58.bold("version:")} ${stripToMinor(version2)}`);
|
|
5034
5063
|
} else {
|
|
5035
|
-
console.log(`${
|
|
5064
|
+
console.log(`${chalk58.bold("version:")} ${chalk58.red("unknown")}`);
|
|
5036
5065
|
}
|
|
5037
5066
|
} else if (patchVersion && minorVersion) {
|
|
5038
5067
|
console.log(
|
|
5039
|
-
`${
|
|
5068
|
+
`${chalk58.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5040
5069
|
);
|
|
5041
5070
|
} else {
|
|
5042
|
-
console.log(`${
|
|
5071
|
+
console.log(`${chalk58.bold("version:")} v0.1 (initial)`);
|
|
5043
5072
|
}
|
|
5044
5073
|
}
|
|
5045
5074
|
|
|
@@ -5086,16 +5115,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5086
5115
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5087
5116
|
}
|
|
5088
5117
|
function logName(repoName) {
|
|
5089
|
-
console.log(`${
|
|
5118
|
+
console.log(`${chalk59.bold("name:")} ${repoName}`);
|
|
5090
5119
|
}
|
|
5091
5120
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5092
5121
|
logName(ctx.repoName);
|
|
5093
5122
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5094
|
-
console.log(
|
|
5123
|
+
console.log(chalk59.bold.blue(targetDate));
|
|
5095
5124
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5096
5125
|
}
|
|
5097
5126
|
function logNoCommits(lastInfo) {
|
|
5098
|
-
console.log(
|
|
5127
|
+
console.log(chalk59.dim(noCommitsMessage(!!lastInfo)));
|
|
5099
5128
|
}
|
|
5100
5129
|
|
|
5101
5130
|
// src/commands/devlog/next/index.ts
|
|
@@ -5136,11 +5165,11 @@ function next2(options2) {
|
|
|
5136
5165
|
import { execSync as execSync21 } from "child_process";
|
|
5137
5166
|
|
|
5138
5167
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5139
|
-
import
|
|
5168
|
+
import chalk60 from "chalk";
|
|
5140
5169
|
function colorStatus(status2) {
|
|
5141
|
-
if (status2 === "missing") return
|
|
5142
|
-
if (status2 === "outdated") return
|
|
5143
|
-
return
|
|
5170
|
+
if (status2 === "missing") return chalk60.red(status2);
|
|
5171
|
+
if (status2 === "outdated") return chalk60.yellow(status2);
|
|
5172
|
+
return chalk60.green(status2);
|
|
5144
5173
|
}
|
|
5145
5174
|
function formatRow(row, nameWidth) {
|
|
5146
5175
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5154,8 +5183,8 @@ function printReposTable(rows) {
|
|
|
5154
5183
|
"Last Devlog".padEnd(11),
|
|
5155
5184
|
"Status"
|
|
5156
5185
|
].join(" ");
|
|
5157
|
-
console.log(
|
|
5158
|
-
console.log(
|
|
5186
|
+
console.log(chalk60.dim(header));
|
|
5187
|
+
console.log(chalk60.dim("-".repeat(header.length)));
|
|
5159
5188
|
for (const row of rows) {
|
|
5160
5189
|
console.log(formatRow(row, nameWidth));
|
|
5161
5190
|
}
|
|
@@ -5213,14 +5242,14 @@ function repos(options2) {
|
|
|
5213
5242
|
// src/commands/devlog/skip.ts
|
|
5214
5243
|
import { writeFileSync as writeFileSync18 } from "fs";
|
|
5215
5244
|
import { join as join17 } from "path";
|
|
5216
|
-
import
|
|
5245
|
+
import chalk61 from "chalk";
|
|
5217
5246
|
import { stringify as stringifyYaml4 } from "yaml";
|
|
5218
5247
|
function getBlogConfigPath() {
|
|
5219
5248
|
return join17(BLOG_REPO_ROOT, "assist.yml");
|
|
5220
5249
|
}
|
|
5221
5250
|
function skip(date) {
|
|
5222
5251
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
5223
|
-
console.log(
|
|
5252
|
+
console.log(chalk61.red("Invalid date format. Use YYYY-MM-DD"));
|
|
5224
5253
|
process.exit(1);
|
|
5225
5254
|
}
|
|
5226
5255
|
const repoName = getRepoName();
|
|
@@ -5231,7 +5260,7 @@ function skip(date) {
|
|
|
5231
5260
|
const skipDays = skip2[repoName] ?? [];
|
|
5232
5261
|
if (skipDays.includes(date)) {
|
|
5233
5262
|
console.log(
|
|
5234
|
-
|
|
5263
|
+
chalk61.yellow(`${date} is already in skip list for ${repoName}`)
|
|
5235
5264
|
);
|
|
5236
5265
|
return;
|
|
5237
5266
|
}
|
|
@@ -5241,20 +5270,20 @@ function skip(date) {
|
|
|
5241
5270
|
devlog.skip = skip2;
|
|
5242
5271
|
config.devlog = devlog;
|
|
5243
5272
|
writeFileSync18(configPath, stringifyYaml4(config, { lineWidth: 0 }));
|
|
5244
|
-
console.log(
|
|
5273
|
+
console.log(chalk61.green(`Added ${date} to skip list for ${repoName}`));
|
|
5245
5274
|
}
|
|
5246
5275
|
|
|
5247
5276
|
// src/commands/devlog/version.ts
|
|
5248
|
-
import
|
|
5277
|
+
import chalk62 from "chalk";
|
|
5249
5278
|
function version() {
|
|
5250
5279
|
const config = loadConfig();
|
|
5251
5280
|
const name = getRepoName();
|
|
5252
5281
|
const lastInfo = getLastVersionInfo(name, config);
|
|
5253
5282
|
const lastVersion = lastInfo?.version ?? null;
|
|
5254
5283
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
5255
|
-
console.log(`${
|
|
5256
|
-
console.log(`${
|
|
5257
|
-
console.log(`${
|
|
5284
|
+
console.log(`${chalk62.bold("name:")} ${name}`);
|
|
5285
|
+
console.log(`${chalk62.bold("last:")} ${lastVersion ?? chalk62.dim("none")}`);
|
|
5286
|
+
console.log(`${chalk62.bold("next:")} ${nextVersion ?? chalk62.dim("none")}`);
|
|
5258
5287
|
}
|
|
5259
5288
|
|
|
5260
5289
|
// src/commands/registerDevlog.ts
|
|
@@ -5278,7 +5307,7 @@ function registerDevlog(program2) {
|
|
|
5278
5307
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
5279
5308
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
5280
5309
|
import { join as join18 } from "path";
|
|
5281
|
-
import
|
|
5310
|
+
import chalk63 from "chalk";
|
|
5282
5311
|
|
|
5283
5312
|
// src/shared/findRepoRoot.ts
|
|
5284
5313
|
import { existsSync as existsSync24 } from "fs";
|
|
@@ -5341,14 +5370,14 @@ function checkBuildLocks(startDir) {
|
|
|
5341
5370
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
5342
5371
|
if (locked) {
|
|
5343
5372
|
console.error(
|
|
5344
|
-
|
|
5373
|
+
chalk63.red("Build output locked (is VS debugging?): ") + locked
|
|
5345
5374
|
);
|
|
5346
5375
|
process.exit(1);
|
|
5347
5376
|
}
|
|
5348
5377
|
}
|
|
5349
5378
|
async function checkBuildLocksCommand() {
|
|
5350
5379
|
checkBuildLocks();
|
|
5351
|
-
console.log(
|
|
5380
|
+
console.log(chalk63.green("No build locks detected"));
|
|
5352
5381
|
}
|
|
5353
5382
|
|
|
5354
5383
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -5447,30 +5476,30 @@ function escapeRegex(s) {
|
|
|
5447
5476
|
}
|
|
5448
5477
|
|
|
5449
5478
|
// src/commands/dotnet/printTree.ts
|
|
5450
|
-
import
|
|
5479
|
+
import chalk64 from "chalk";
|
|
5451
5480
|
function printNodes(nodes, prefix2) {
|
|
5452
5481
|
for (let i = 0; i < nodes.length; i++) {
|
|
5453
5482
|
const isLast = i === nodes.length - 1;
|
|
5454
5483
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
5455
5484
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
5456
5485
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
5457
|
-
const label2 = isMissing ?
|
|
5486
|
+
const label2 = isMissing ? chalk64.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
5458
5487
|
console.log(`${prefix2}${connector}${label2}`);
|
|
5459
5488
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
5460
5489
|
}
|
|
5461
5490
|
}
|
|
5462
5491
|
function printTree(tree, totalCount, solutions) {
|
|
5463
|
-
console.log(
|
|
5464
|
-
console.log(
|
|
5492
|
+
console.log(chalk64.bold("\nProject Dependency Tree"));
|
|
5493
|
+
console.log(chalk64.cyan(tree.relativePath));
|
|
5465
5494
|
printNodes(tree.children, "");
|
|
5466
|
-
console.log(
|
|
5495
|
+
console.log(chalk64.dim(`
|
|
5467
5496
|
${totalCount} projects total (including root)`));
|
|
5468
|
-
console.log(
|
|
5497
|
+
console.log(chalk64.bold("\nSolution Membership"));
|
|
5469
5498
|
if (solutions.length === 0) {
|
|
5470
|
-
console.log(
|
|
5499
|
+
console.log(chalk64.yellow(" Not found in any .sln"));
|
|
5471
5500
|
} else {
|
|
5472
5501
|
for (const sln of solutions) {
|
|
5473
|
-
console.log(` ${
|
|
5502
|
+
console.log(` ${chalk64.green(sln)}`);
|
|
5474
5503
|
}
|
|
5475
5504
|
}
|
|
5476
5505
|
console.log();
|
|
@@ -5499,16 +5528,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
5499
5528
|
// src/commands/dotnet/resolveCsproj.ts
|
|
5500
5529
|
import { existsSync as existsSync25 } from "fs";
|
|
5501
5530
|
import path24 from "path";
|
|
5502
|
-
import
|
|
5531
|
+
import chalk65 from "chalk";
|
|
5503
5532
|
function resolveCsproj(csprojPath) {
|
|
5504
5533
|
const resolved = path24.resolve(csprojPath);
|
|
5505
5534
|
if (!existsSync25(resolved)) {
|
|
5506
|
-
console.error(
|
|
5535
|
+
console.error(chalk65.red(`File not found: ${resolved}`));
|
|
5507
5536
|
process.exit(1);
|
|
5508
5537
|
}
|
|
5509
5538
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
5510
5539
|
if (!repoRoot) {
|
|
5511
|
-
console.error(
|
|
5540
|
+
console.error(chalk65.red("Could not find git repository root"));
|
|
5512
5541
|
process.exit(1);
|
|
5513
5542
|
}
|
|
5514
5543
|
return { resolved, repoRoot };
|
|
@@ -5558,12 +5587,12 @@ function getChangedCsFiles(scope) {
|
|
|
5558
5587
|
}
|
|
5559
5588
|
|
|
5560
5589
|
// src/commands/dotnet/inSln.ts
|
|
5561
|
-
import
|
|
5590
|
+
import chalk66 from "chalk";
|
|
5562
5591
|
async function inSln(csprojPath) {
|
|
5563
5592
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
5564
5593
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
5565
5594
|
if (solutions.length === 0) {
|
|
5566
|
-
console.log(
|
|
5595
|
+
console.log(chalk66.yellow("Not found in any .sln file"));
|
|
5567
5596
|
process.exit(1);
|
|
5568
5597
|
}
|
|
5569
5598
|
for (const sln of solutions) {
|
|
@@ -5572,7 +5601,7 @@ async function inSln(csprojPath) {
|
|
|
5572
5601
|
}
|
|
5573
5602
|
|
|
5574
5603
|
// src/commands/dotnet/inspect.ts
|
|
5575
|
-
import
|
|
5604
|
+
import chalk72 from "chalk";
|
|
5576
5605
|
|
|
5577
5606
|
// src/shared/formatElapsed.ts
|
|
5578
5607
|
function formatElapsed(ms) {
|
|
@@ -5584,12 +5613,12 @@ function formatElapsed(ms) {
|
|
|
5584
5613
|
}
|
|
5585
5614
|
|
|
5586
5615
|
// src/commands/dotnet/displayIssues.ts
|
|
5587
|
-
import
|
|
5616
|
+
import chalk67 from "chalk";
|
|
5588
5617
|
var SEVERITY_COLOR = {
|
|
5589
|
-
ERROR:
|
|
5590
|
-
WARNING:
|
|
5591
|
-
SUGGESTION:
|
|
5592
|
-
HINT:
|
|
5618
|
+
ERROR: chalk67.red,
|
|
5619
|
+
WARNING: chalk67.yellow,
|
|
5620
|
+
SUGGESTION: chalk67.cyan,
|
|
5621
|
+
HINT: chalk67.dim
|
|
5593
5622
|
};
|
|
5594
5623
|
function groupByFile(issues) {
|
|
5595
5624
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -5605,15 +5634,15 @@ function groupByFile(issues) {
|
|
|
5605
5634
|
}
|
|
5606
5635
|
function displayIssues(issues) {
|
|
5607
5636
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
5608
|
-
console.log(
|
|
5637
|
+
console.log(chalk67.bold(file));
|
|
5609
5638
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
5610
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
5639
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk67.white;
|
|
5611
5640
|
console.log(
|
|
5612
|
-
` ${
|
|
5641
|
+
` ${chalk67.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
5613
5642
|
);
|
|
5614
5643
|
}
|
|
5615
5644
|
}
|
|
5616
|
-
console.log(
|
|
5645
|
+
console.log(chalk67.dim(`
|
|
5617
5646
|
${issues.length} issue(s) found`));
|
|
5618
5647
|
}
|
|
5619
5648
|
|
|
@@ -5672,12 +5701,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
5672
5701
|
// src/commands/dotnet/resolveSolution.ts
|
|
5673
5702
|
import { existsSync as existsSync26 } from "fs";
|
|
5674
5703
|
import path25 from "path";
|
|
5675
|
-
import
|
|
5704
|
+
import chalk69 from "chalk";
|
|
5676
5705
|
|
|
5677
5706
|
// src/commands/dotnet/findSolution.ts
|
|
5678
5707
|
import { readdirSync as readdirSync4 } from "fs";
|
|
5679
5708
|
import { dirname as dirname16, join as join19 } from "path";
|
|
5680
|
-
import
|
|
5709
|
+
import chalk68 from "chalk";
|
|
5681
5710
|
function findSlnInDir(dir) {
|
|
5682
5711
|
try {
|
|
5683
5712
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join19(dir, f));
|
|
@@ -5693,17 +5722,17 @@ function findSolution() {
|
|
|
5693
5722
|
const slnFiles = findSlnInDir(current);
|
|
5694
5723
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
5695
5724
|
if (slnFiles.length > 1) {
|
|
5696
|
-
console.error(
|
|
5725
|
+
console.error(chalk68.red(`Multiple .sln files found in ${current}:`));
|
|
5697
5726
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
5698
5727
|
console.error(
|
|
5699
|
-
|
|
5728
|
+
chalk68.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
5700
5729
|
);
|
|
5701
5730
|
process.exit(1);
|
|
5702
5731
|
}
|
|
5703
5732
|
if (current === ceiling) break;
|
|
5704
5733
|
current = dirname16(current);
|
|
5705
5734
|
}
|
|
5706
|
-
console.error(
|
|
5735
|
+
console.error(chalk68.red("No .sln file found between cwd and repo root"));
|
|
5707
5736
|
process.exit(1);
|
|
5708
5737
|
}
|
|
5709
5738
|
|
|
@@ -5712,7 +5741,7 @@ function resolveSolution(sln) {
|
|
|
5712
5741
|
if (sln) {
|
|
5713
5742
|
const resolved = path25.resolve(sln);
|
|
5714
5743
|
if (!existsSync26(resolved)) {
|
|
5715
|
-
console.error(
|
|
5744
|
+
console.error(chalk69.red(`Solution file not found: ${resolved}`));
|
|
5716
5745
|
process.exit(1);
|
|
5717
5746
|
}
|
|
5718
5747
|
return resolved;
|
|
@@ -5754,14 +5783,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
5754
5783
|
import { existsSync as existsSync27, readFileSync as readFileSync22, unlinkSync as unlinkSync5 } from "fs";
|
|
5755
5784
|
import { tmpdir as tmpdir2 } from "os";
|
|
5756
5785
|
import path26 from "path";
|
|
5757
|
-
import
|
|
5786
|
+
import chalk70 from "chalk";
|
|
5758
5787
|
function assertJbInstalled() {
|
|
5759
5788
|
try {
|
|
5760
5789
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
5761
5790
|
} catch {
|
|
5762
|
-
console.error(
|
|
5791
|
+
console.error(chalk70.red("jb is not installed. Install with:"));
|
|
5763
5792
|
console.error(
|
|
5764
|
-
|
|
5793
|
+
chalk70.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
5765
5794
|
);
|
|
5766
5795
|
process.exit(1);
|
|
5767
5796
|
}
|
|
@@ -5779,11 +5808,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5779
5808
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
5780
5809
|
process.stderr.write(err.stderr);
|
|
5781
5810
|
}
|
|
5782
|
-
console.error(
|
|
5811
|
+
console.error(chalk70.red("jb inspectcode failed"));
|
|
5783
5812
|
process.exit(1);
|
|
5784
5813
|
}
|
|
5785
5814
|
if (!existsSync27(reportPath)) {
|
|
5786
|
-
console.error(
|
|
5815
|
+
console.error(chalk70.red("Report file not generated"));
|
|
5787
5816
|
process.exit(1);
|
|
5788
5817
|
}
|
|
5789
5818
|
const xml = readFileSync22(reportPath, "utf-8");
|
|
@@ -5793,7 +5822,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5793
5822
|
|
|
5794
5823
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
5795
5824
|
import { execSync as execSync24 } from "child_process";
|
|
5796
|
-
import
|
|
5825
|
+
import chalk71 from "chalk";
|
|
5797
5826
|
function resolveMsbuildPath() {
|
|
5798
5827
|
const config = loadConfig();
|
|
5799
5828
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -5804,9 +5833,9 @@ function assertMsbuildInstalled() {
|
|
|
5804
5833
|
try {
|
|
5805
5834
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
5806
5835
|
} catch {
|
|
5807
|
-
console.error(
|
|
5836
|
+
console.error(chalk71.red(`msbuild not found at: ${msbuild}`));
|
|
5808
5837
|
console.error(
|
|
5809
|
-
|
|
5838
|
+
chalk71.yellow(
|
|
5810
5839
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
5811
5840
|
)
|
|
5812
5841
|
);
|
|
@@ -5853,17 +5882,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
5853
5882
|
// src/commands/dotnet/inspect.ts
|
|
5854
5883
|
function logScope(changedFiles) {
|
|
5855
5884
|
if (changedFiles === null) {
|
|
5856
|
-
console.log(
|
|
5885
|
+
console.log(chalk72.dim("Inspecting full solution..."));
|
|
5857
5886
|
} else {
|
|
5858
5887
|
console.log(
|
|
5859
|
-
|
|
5888
|
+
chalk72.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
5860
5889
|
);
|
|
5861
5890
|
}
|
|
5862
5891
|
}
|
|
5863
5892
|
function reportResults(issues, elapsed) {
|
|
5864
5893
|
if (issues.length > 0) displayIssues(issues);
|
|
5865
|
-
else console.log(
|
|
5866
|
-
console.log(
|
|
5894
|
+
else console.log(chalk72.green("No issues found"));
|
|
5895
|
+
console.log(chalk72.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
5867
5896
|
if (issues.length > 0) process.exit(1);
|
|
5868
5897
|
}
|
|
5869
5898
|
async function inspect(sln, options2) {
|
|
@@ -5874,7 +5903,7 @@ async function inspect(sln, options2) {
|
|
|
5874
5903
|
const scope = parseScope(options2.scope);
|
|
5875
5904
|
const changedFiles = getChangedCsFiles(scope);
|
|
5876
5905
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
5877
|
-
console.log(
|
|
5906
|
+
console.log(chalk72.green("No changed .cs files found"));
|
|
5878
5907
|
return;
|
|
5879
5908
|
}
|
|
5880
5909
|
logScope(changedFiles);
|
|
@@ -5900,7 +5929,7 @@ function registerDotnet(program2) {
|
|
|
5900
5929
|
}
|
|
5901
5930
|
|
|
5902
5931
|
// src/commands/jira/acceptanceCriteria.ts
|
|
5903
|
-
import
|
|
5932
|
+
import chalk74 from "chalk";
|
|
5904
5933
|
|
|
5905
5934
|
// src/commands/jira/adfToText.ts
|
|
5906
5935
|
function renderInline(node) {
|
|
@@ -5961,7 +5990,7 @@ function adfToText(doc) {
|
|
|
5961
5990
|
|
|
5962
5991
|
// src/commands/jira/fetchIssue.ts
|
|
5963
5992
|
import { execSync as execSync25 } from "child_process";
|
|
5964
|
-
import
|
|
5993
|
+
import chalk73 from "chalk";
|
|
5965
5994
|
function fetchIssue(issueKey, fields) {
|
|
5966
5995
|
let result;
|
|
5967
5996
|
try {
|
|
@@ -5974,15 +6003,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
5974
6003
|
const stderr = error.stderr;
|
|
5975
6004
|
if (stderr.includes("unauthorized")) {
|
|
5976
6005
|
console.error(
|
|
5977
|
-
|
|
6006
|
+
chalk73.red("Jira authentication expired."),
|
|
5978
6007
|
"Run",
|
|
5979
|
-
|
|
6008
|
+
chalk73.cyan("assist jira auth"),
|
|
5980
6009
|
"to re-authenticate."
|
|
5981
6010
|
);
|
|
5982
6011
|
process.exit(1);
|
|
5983
6012
|
}
|
|
5984
6013
|
}
|
|
5985
|
-
console.error(
|
|
6014
|
+
console.error(chalk73.red(`Failed to fetch ${issueKey}.`));
|
|
5986
6015
|
process.exit(1);
|
|
5987
6016
|
}
|
|
5988
6017
|
return JSON.parse(result);
|
|
@@ -5996,7 +6025,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
5996
6025
|
const parsed = fetchIssue(issueKey, field);
|
|
5997
6026
|
const acValue = parsed?.fields?.[field];
|
|
5998
6027
|
if (!acValue) {
|
|
5999
|
-
console.log(
|
|
6028
|
+
console.log(chalk74.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6000
6029
|
return;
|
|
6001
6030
|
}
|
|
6002
6031
|
if (typeof acValue === "string") {
|
|
@@ -6091,14 +6120,14 @@ async function jiraAuth() {
|
|
|
6091
6120
|
}
|
|
6092
6121
|
|
|
6093
6122
|
// src/commands/jira/viewIssue.ts
|
|
6094
|
-
import
|
|
6123
|
+
import chalk75 from "chalk";
|
|
6095
6124
|
function viewIssue(issueKey) {
|
|
6096
6125
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6097
6126
|
const fields = parsed?.fields;
|
|
6098
6127
|
const summary = fields?.summary;
|
|
6099
6128
|
const description = fields?.description;
|
|
6100
6129
|
if (summary) {
|
|
6101
|
-
console.log(
|
|
6130
|
+
console.log(chalk75.bold(summary));
|
|
6102
6131
|
}
|
|
6103
6132
|
if (description) {
|
|
6104
6133
|
if (summary) console.log();
|
|
@@ -6112,7 +6141,7 @@ function viewIssue(issueKey) {
|
|
|
6112
6141
|
}
|
|
6113
6142
|
if (!summary && !description) {
|
|
6114
6143
|
console.log(
|
|
6115
|
-
|
|
6144
|
+
chalk75.yellow(`No summary or description found on ${issueKey}.`)
|
|
6116
6145
|
);
|
|
6117
6146
|
}
|
|
6118
6147
|
}
|
|
@@ -6126,7 +6155,7 @@ function registerJira(program2) {
|
|
|
6126
6155
|
}
|
|
6127
6156
|
|
|
6128
6157
|
// src/commands/news/add/index.ts
|
|
6129
|
-
import
|
|
6158
|
+
import chalk76 from "chalk";
|
|
6130
6159
|
import enquirer7 from "enquirer";
|
|
6131
6160
|
async function add2(url) {
|
|
6132
6161
|
if (!url) {
|
|
@@ -6149,17 +6178,17 @@ async function add2(url) {
|
|
|
6149
6178
|
const news = config.news ?? {};
|
|
6150
6179
|
const feeds = news.feeds ?? [];
|
|
6151
6180
|
if (feeds.includes(url)) {
|
|
6152
|
-
console.log(
|
|
6181
|
+
console.log(chalk76.yellow("Feed already exists in config"));
|
|
6153
6182
|
return;
|
|
6154
6183
|
}
|
|
6155
6184
|
feeds.push(url);
|
|
6156
6185
|
config.news = { ...news, feeds };
|
|
6157
6186
|
saveGlobalConfig(config);
|
|
6158
|
-
console.log(
|
|
6187
|
+
console.log(chalk76.green(`Added feed: ${url}`));
|
|
6159
6188
|
}
|
|
6160
6189
|
|
|
6161
6190
|
// src/commands/news/web/handleRequest.ts
|
|
6162
|
-
import
|
|
6191
|
+
import chalk77 from "chalk";
|
|
6163
6192
|
|
|
6164
6193
|
// src/commands/news/web/shared.ts
|
|
6165
6194
|
import { decodeHTML } from "entities";
|
|
@@ -6295,17 +6324,17 @@ function prefetch() {
|
|
|
6295
6324
|
const config = loadConfig();
|
|
6296
6325
|
const total = config.news.feeds.length;
|
|
6297
6326
|
if (total === 0) return;
|
|
6298
|
-
process.stdout.write(
|
|
6327
|
+
process.stdout.write(chalk77.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
6299
6328
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
6300
6329
|
const width = 20;
|
|
6301
6330
|
const filled = Math.round(done2 / t * width);
|
|
6302
6331
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
6303
6332
|
process.stdout.write(
|
|
6304
|
-
`\r${
|
|
6333
|
+
`\r${chalk77.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
6305
6334
|
);
|
|
6306
6335
|
}).then((items) => {
|
|
6307
6336
|
process.stdout.write(
|
|
6308
|
-
`\r${
|
|
6337
|
+
`\r${chalk77.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
6309
6338
|
`
|
|
6310
6339
|
);
|
|
6311
6340
|
cachedItems = items;
|
|
@@ -6666,20 +6695,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
6666
6695
|
}
|
|
6667
6696
|
|
|
6668
6697
|
// src/commands/prs/listComments/printComments.ts
|
|
6669
|
-
import
|
|
6698
|
+
import chalk78 from "chalk";
|
|
6670
6699
|
function formatForHuman(comment3) {
|
|
6671
6700
|
if (comment3.type === "review") {
|
|
6672
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
6701
|
+
const stateColor = comment3.state === "APPROVED" ? chalk78.green : comment3.state === "CHANGES_REQUESTED" ? chalk78.red : chalk78.yellow;
|
|
6673
6702
|
return [
|
|
6674
|
-
`${
|
|
6703
|
+
`${chalk78.cyan("Review")} by ${chalk78.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
6675
6704
|
comment3.body,
|
|
6676
6705
|
""
|
|
6677
6706
|
].join("\n");
|
|
6678
6707
|
}
|
|
6679
6708
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
6680
6709
|
return [
|
|
6681
|
-
`${
|
|
6682
|
-
|
|
6710
|
+
`${chalk78.cyan("Line comment")} by ${chalk78.bold(comment3.user)} on ${chalk78.dim(`${comment3.path}${location}`)}`,
|
|
6711
|
+
chalk78.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
6683
6712
|
comment3.body,
|
|
6684
6713
|
""
|
|
6685
6714
|
].join("\n");
|
|
@@ -6769,13 +6798,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
6769
6798
|
import enquirer8 from "enquirer";
|
|
6770
6799
|
|
|
6771
6800
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
6772
|
-
import
|
|
6801
|
+
import chalk79 from "chalk";
|
|
6773
6802
|
var STATUS_MAP = {
|
|
6774
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
6775
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
6803
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk79.magenta("merged"), date: pr.mergedAt } : null,
|
|
6804
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk79.red("closed"), date: pr.closedAt } : null
|
|
6776
6805
|
};
|
|
6777
6806
|
function defaultStatus(pr) {
|
|
6778
|
-
return { label:
|
|
6807
|
+
return { label: chalk79.green("opened"), date: pr.createdAt };
|
|
6779
6808
|
}
|
|
6780
6809
|
function getStatus2(pr) {
|
|
6781
6810
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -6784,11 +6813,11 @@ function formatDate(dateStr) {
|
|
|
6784
6813
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
6785
6814
|
}
|
|
6786
6815
|
function formatPrHeader(pr, status2) {
|
|
6787
|
-
return `${
|
|
6816
|
+
return `${chalk79.cyan(`#${pr.number}`)} ${pr.title} ${chalk79.dim(`(${pr.author.login},`)} ${status2.label} ${chalk79.dim(`${formatDate(status2.date)})`)}`;
|
|
6788
6817
|
}
|
|
6789
6818
|
function logPrDetails(pr) {
|
|
6790
6819
|
console.log(
|
|
6791
|
-
|
|
6820
|
+
chalk79.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
6792
6821
|
);
|
|
6793
6822
|
console.log();
|
|
6794
6823
|
}
|
|
@@ -6954,10 +6983,10 @@ function registerPrs(program2) {
|
|
|
6954
6983
|
}
|
|
6955
6984
|
|
|
6956
6985
|
// src/commands/ravendb/ravendbAuth.ts
|
|
6957
|
-
import
|
|
6986
|
+
import chalk85 from "chalk";
|
|
6958
6987
|
|
|
6959
6988
|
// src/shared/createConnectionAuth.ts
|
|
6960
|
-
import
|
|
6989
|
+
import chalk80 from "chalk";
|
|
6961
6990
|
function listConnections(connections, format2) {
|
|
6962
6991
|
if (connections.length === 0) {
|
|
6963
6992
|
console.log("No connections configured.");
|
|
@@ -6970,7 +6999,7 @@ function listConnections(connections, format2) {
|
|
|
6970
6999
|
function removeConnection(connections, name, save) {
|
|
6971
7000
|
const filtered = connections.filter((c) => c.name !== name);
|
|
6972
7001
|
if (filtered.length === connections.length) {
|
|
6973
|
-
console.error(
|
|
7002
|
+
console.error(chalk80.red(`Connection "${name}" not found.`));
|
|
6974
7003
|
process.exit(1);
|
|
6975
7004
|
}
|
|
6976
7005
|
save(filtered);
|
|
@@ -7016,15 +7045,15 @@ function saveConnections(connections) {
|
|
|
7016
7045
|
}
|
|
7017
7046
|
|
|
7018
7047
|
// src/commands/ravendb/promptConnection.ts
|
|
7019
|
-
import
|
|
7048
|
+
import chalk83 from "chalk";
|
|
7020
7049
|
|
|
7021
7050
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7022
|
-
import
|
|
7051
|
+
import chalk82 from "chalk";
|
|
7023
7052
|
import Enquirer2 from "enquirer";
|
|
7024
7053
|
|
|
7025
7054
|
// src/commands/ravendb/searchItems.ts
|
|
7026
7055
|
import { execSync as execSync34 } from "child_process";
|
|
7027
|
-
import
|
|
7056
|
+
import chalk81 from "chalk";
|
|
7028
7057
|
function opExec(args) {
|
|
7029
7058
|
return execSync34(`op ${args}`, {
|
|
7030
7059
|
encoding: "utf-8",
|
|
@@ -7037,7 +7066,7 @@ function searchItems(search) {
|
|
|
7037
7066
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7038
7067
|
} catch {
|
|
7039
7068
|
console.error(
|
|
7040
|
-
|
|
7069
|
+
chalk81.red(
|
|
7041
7070
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7042
7071
|
)
|
|
7043
7072
|
);
|
|
@@ -7051,7 +7080,7 @@ function getItemFields(itemId) {
|
|
|
7051
7080
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7052
7081
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7053
7082
|
} catch {
|
|
7054
|
-
console.error(
|
|
7083
|
+
console.error(chalk81.red("Failed to get item details from 1Password."));
|
|
7055
7084
|
process.exit(1);
|
|
7056
7085
|
}
|
|
7057
7086
|
}
|
|
@@ -7070,7 +7099,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7070
7099
|
}).run();
|
|
7071
7100
|
const items = searchItems(search);
|
|
7072
7101
|
if (items.length === 0) {
|
|
7073
|
-
console.error(
|
|
7102
|
+
console.error(chalk82.red(`No items found matching "${search}".`));
|
|
7074
7103
|
process.exit(1);
|
|
7075
7104
|
}
|
|
7076
7105
|
const itemId = await selectOne(
|
|
@@ -7079,7 +7108,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7079
7108
|
);
|
|
7080
7109
|
const fields = getItemFields(itemId);
|
|
7081
7110
|
if (fields.length === 0) {
|
|
7082
|
-
console.error(
|
|
7111
|
+
console.error(chalk82.red("No fields with references found on this item."));
|
|
7083
7112
|
process.exit(1);
|
|
7084
7113
|
}
|
|
7085
7114
|
const ref = await selectOne(
|
|
@@ -7093,7 +7122,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7093
7122
|
async function promptConnection(existingNames) {
|
|
7094
7123
|
const name = await promptInput("name", "Connection name:");
|
|
7095
7124
|
if (existingNames.includes(name)) {
|
|
7096
|
-
console.error(
|
|
7125
|
+
console.error(chalk83.red(`Connection "${name}" already exists.`));
|
|
7097
7126
|
process.exit(1);
|
|
7098
7127
|
}
|
|
7099
7128
|
const url = await promptInput(
|
|
@@ -7102,22 +7131,22 @@ async function promptConnection(existingNames) {
|
|
|
7102
7131
|
);
|
|
7103
7132
|
const database = await promptInput("database", "Database name:");
|
|
7104
7133
|
if (!name || !url || !database) {
|
|
7105
|
-
console.error(
|
|
7134
|
+
console.error(chalk83.red("All fields are required."));
|
|
7106
7135
|
process.exit(1);
|
|
7107
7136
|
}
|
|
7108
7137
|
const apiKeyRef = await selectOpSecret();
|
|
7109
|
-
console.log(
|
|
7138
|
+
console.log(chalk83.dim(`Using: ${apiKeyRef}`));
|
|
7110
7139
|
return { name, url, database, apiKeyRef };
|
|
7111
7140
|
}
|
|
7112
7141
|
|
|
7113
7142
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7114
|
-
import
|
|
7143
|
+
import chalk84 from "chalk";
|
|
7115
7144
|
function ravendbSetConnection(name) {
|
|
7116
7145
|
const raw = loadGlobalConfigRaw();
|
|
7117
7146
|
const ravendb = raw.ravendb ?? {};
|
|
7118
7147
|
const connections = ravendb.connections ?? [];
|
|
7119
7148
|
if (!connections.some((c) => c.name === name)) {
|
|
7120
|
-
console.error(
|
|
7149
|
+
console.error(chalk84.red(`Connection "${name}" not found.`));
|
|
7121
7150
|
console.error(
|
|
7122
7151
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7123
7152
|
);
|
|
@@ -7133,16 +7162,16 @@ function ravendbSetConnection(name) {
|
|
|
7133
7162
|
var ravendbAuth = createConnectionAuth({
|
|
7134
7163
|
load: loadConnections,
|
|
7135
7164
|
save: saveConnections,
|
|
7136
|
-
format: (c) => `${
|
|
7165
|
+
format: (c) => `${chalk85.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7137
7166
|
promptNew: promptConnection,
|
|
7138
7167
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7139
7168
|
});
|
|
7140
7169
|
|
|
7141
7170
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7142
|
-
import
|
|
7171
|
+
import chalk89 from "chalk";
|
|
7143
7172
|
|
|
7144
7173
|
// src/commands/ravendb/ravenFetch.ts
|
|
7145
|
-
import
|
|
7174
|
+
import chalk87 from "chalk";
|
|
7146
7175
|
|
|
7147
7176
|
// src/commands/ravendb/getAccessToken.ts
|
|
7148
7177
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7179,10 +7208,10 @@ ${errorText}`
|
|
|
7179
7208
|
|
|
7180
7209
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7181
7210
|
import { execSync as execSync35 } from "child_process";
|
|
7182
|
-
import
|
|
7211
|
+
import chalk86 from "chalk";
|
|
7183
7212
|
function resolveOpSecret(reference) {
|
|
7184
7213
|
if (!reference.startsWith("op://")) {
|
|
7185
|
-
console.error(
|
|
7214
|
+
console.error(chalk86.red(`Invalid secret reference: must start with op://`));
|
|
7186
7215
|
process.exit(1);
|
|
7187
7216
|
}
|
|
7188
7217
|
try {
|
|
@@ -7192,7 +7221,7 @@ function resolveOpSecret(reference) {
|
|
|
7192
7221
|
}).trim();
|
|
7193
7222
|
} catch {
|
|
7194
7223
|
console.error(
|
|
7195
|
-
|
|
7224
|
+
chalk86.red(
|
|
7196
7225
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7197
7226
|
)
|
|
7198
7227
|
);
|
|
@@ -7219,7 +7248,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7219
7248
|
if (!response.ok) {
|
|
7220
7249
|
const body = await response.text();
|
|
7221
7250
|
console.error(
|
|
7222
|
-
|
|
7251
|
+
chalk87.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
7223
7252
|
);
|
|
7224
7253
|
console.error(body.substring(0, 500));
|
|
7225
7254
|
process.exit(1);
|
|
@@ -7228,7 +7257,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7228
7257
|
}
|
|
7229
7258
|
|
|
7230
7259
|
// src/commands/ravendb/resolveConnection.ts
|
|
7231
|
-
import
|
|
7260
|
+
import chalk88 from "chalk";
|
|
7232
7261
|
function loadRavendb() {
|
|
7233
7262
|
const raw = loadGlobalConfigRaw();
|
|
7234
7263
|
const ravendb = raw.ravendb;
|
|
@@ -7242,7 +7271,7 @@ function resolveConnection(name) {
|
|
|
7242
7271
|
const connectionName = name ?? defaultConnection;
|
|
7243
7272
|
if (!connectionName) {
|
|
7244
7273
|
console.error(
|
|
7245
|
-
|
|
7274
|
+
chalk88.red(
|
|
7246
7275
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
7247
7276
|
)
|
|
7248
7277
|
);
|
|
@@ -7250,7 +7279,7 @@ function resolveConnection(name) {
|
|
|
7250
7279
|
}
|
|
7251
7280
|
const connection = connections.find((c) => c.name === connectionName);
|
|
7252
7281
|
if (!connection) {
|
|
7253
|
-
console.error(
|
|
7282
|
+
console.error(chalk88.red(`Connection "${connectionName}" not found.`));
|
|
7254
7283
|
console.error(
|
|
7255
7284
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7256
7285
|
);
|
|
@@ -7281,15 +7310,15 @@ async function ravendbCollections(connectionName) {
|
|
|
7281
7310
|
return;
|
|
7282
7311
|
}
|
|
7283
7312
|
for (const c of collections) {
|
|
7284
|
-
console.log(`${
|
|
7313
|
+
console.log(`${chalk89.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
7285
7314
|
}
|
|
7286
7315
|
}
|
|
7287
7316
|
|
|
7288
7317
|
// src/commands/ravendb/ravendbQuery.ts
|
|
7289
|
-
import
|
|
7318
|
+
import chalk91 from "chalk";
|
|
7290
7319
|
|
|
7291
7320
|
// src/commands/ravendb/fetchAllPages.ts
|
|
7292
|
-
import
|
|
7321
|
+
import chalk90 from "chalk";
|
|
7293
7322
|
|
|
7294
7323
|
// src/commands/ravendb/buildQueryPath.ts
|
|
7295
7324
|
function buildQueryPath(opts) {
|
|
@@ -7327,7 +7356,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
7327
7356
|
allResults.push(...results);
|
|
7328
7357
|
start3 += results.length;
|
|
7329
7358
|
process.stderr.write(
|
|
7330
|
-
`\r${
|
|
7359
|
+
`\r${chalk90.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
7331
7360
|
);
|
|
7332
7361
|
if (start3 >= totalResults) break;
|
|
7333
7362
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -7342,7 +7371,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
7342
7371
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
7343
7372
|
const resolved = resolveArgs(connectionName, collection);
|
|
7344
7373
|
if (!resolved.collection && !options2.query) {
|
|
7345
|
-
console.error(
|
|
7374
|
+
console.error(chalk91.red("Provide a collection name or --query filter."));
|
|
7346
7375
|
process.exit(1);
|
|
7347
7376
|
}
|
|
7348
7377
|
const { collection: col } = resolved;
|
|
@@ -7380,7 +7409,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
7380
7409
|
import * as path27 from "path";
|
|
7381
7410
|
|
|
7382
7411
|
// src/commands/refactor/logViolations.ts
|
|
7383
|
-
import
|
|
7412
|
+
import chalk92 from "chalk";
|
|
7384
7413
|
var DEFAULT_MAX_LINES = 100;
|
|
7385
7414
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
7386
7415
|
if (violations.length === 0) {
|
|
@@ -7389,43 +7418,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
7389
7418
|
}
|
|
7390
7419
|
return;
|
|
7391
7420
|
}
|
|
7392
|
-
console.error(
|
|
7421
|
+
console.error(chalk92.red(`
|
|
7393
7422
|
Refactor check failed:
|
|
7394
7423
|
`));
|
|
7395
|
-
console.error(
|
|
7424
|
+
console.error(chalk92.red(` The following files exceed ${maxLines} lines:
|
|
7396
7425
|
`));
|
|
7397
7426
|
for (const violation of violations) {
|
|
7398
|
-
console.error(
|
|
7427
|
+
console.error(chalk92.red(` ${violation.file} (${violation.lines} lines)`));
|
|
7399
7428
|
}
|
|
7400
7429
|
console.error(
|
|
7401
|
-
|
|
7430
|
+
chalk92.yellow(
|
|
7402
7431
|
`
|
|
7403
7432
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
7404
7433
|
way to refactor it, ignore it with:
|
|
7405
7434
|
`
|
|
7406
7435
|
)
|
|
7407
7436
|
);
|
|
7408
|
-
console.error(
|
|
7437
|
+
console.error(chalk92.gray(` assist refactor ignore <file>
|
|
7409
7438
|
`));
|
|
7410
7439
|
if (process.env.CLAUDECODE) {
|
|
7411
|
-
console.error(
|
|
7440
|
+
console.error(chalk92.cyan(`
|
|
7412
7441
|
## Extracting Code to New Files
|
|
7413
7442
|
`));
|
|
7414
7443
|
console.error(
|
|
7415
|
-
|
|
7444
|
+
chalk92.cyan(
|
|
7416
7445
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
7417
7446
|
`
|
|
7418
7447
|
)
|
|
7419
7448
|
);
|
|
7420
7449
|
console.error(
|
|
7421
|
-
|
|
7450
|
+
chalk92.cyan(
|
|
7422
7451
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
7423
7452
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
7424
7453
|
`
|
|
7425
7454
|
)
|
|
7426
7455
|
);
|
|
7427
7456
|
console.error(
|
|
7428
|
-
|
|
7457
|
+
chalk92.cyan(
|
|
7429
7458
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
7430
7459
|
domains, move it to a common/shared folder.
|
|
7431
7460
|
`
|
|
@@ -7581,7 +7610,7 @@ async function check(pattern2, options2) {
|
|
|
7581
7610
|
|
|
7582
7611
|
// src/commands/refactor/extract/index.ts
|
|
7583
7612
|
import path33 from "path";
|
|
7584
|
-
import
|
|
7613
|
+
import chalk95 from "chalk";
|
|
7585
7614
|
|
|
7586
7615
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
7587
7616
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8107,23 +8136,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8107
8136
|
|
|
8108
8137
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8109
8138
|
import path31 from "path";
|
|
8110
|
-
import
|
|
8139
|
+
import chalk93 from "chalk";
|
|
8111
8140
|
function section(title) {
|
|
8112
8141
|
return `
|
|
8113
|
-
${
|
|
8142
|
+
${chalk93.cyan(title)}`;
|
|
8114
8143
|
}
|
|
8115
8144
|
function displayImporters(plan2, cwd) {
|
|
8116
8145
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8117
8146
|
console.log(section("Update importers:"));
|
|
8118
8147
|
for (const imp of plan2.importersToUpdate) {
|
|
8119
8148
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8120
|
-
console.log(` ${
|
|
8149
|
+
console.log(` ${chalk93.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8121
8150
|
}
|
|
8122
8151
|
}
|
|
8123
8152
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8124
|
-
console.log(
|
|
8153
|
+
console.log(chalk93.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8125
8154
|
`));
|
|
8126
|
-
console.log(` ${
|
|
8155
|
+
console.log(` ${chalk93.cyan("Functions to move:")}`);
|
|
8127
8156
|
for (const name of plan2.extractedNames) {
|
|
8128
8157
|
console.log(` ${name}`);
|
|
8129
8158
|
}
|
|
@@ -8158,7 +8187,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8158
8187
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8159
8188
|
import fs17 from "fs";
|
|
8160
8189
|
import path32 from "path";
|
|
8161
|
-
import
|
|
8190
|
+
import chalk94 from "chalk";
|
|
8162
8191
|
import { Project as Project2 } from "ts-morph";
|
|
8163
8192
|
function findTsConfig(sourcePath) {
|
|
8164
8193
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -8189,7 +8218,7 @@ function loadProjectFile(file) {
|
|
|
8189
8218
|
});
|
|
8190
8219
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
8191
8220
|
if (!sourceFile) {
|
|
8192
|
-
console.log(
|
|
8221
|
+
console.log(chalk94.red(`File not found in project: ${file}`));
|
|
8193
8222
|
process.exit(1);
|
|
8194
8223
|
}
|
|
8195
8224
|
return { project, sourceFile };
|
|
@@ -8212,19 +8241,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
8212
8241
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
8213
8242
|
if (options2.apply) {
|
|
8214
8243
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
8215
|
-
console.log(
|
|
8244
|
+
console.log(chalk95.green("\nExtraction complete"));
|
|
8216
8245
|
} else {
|
|
8217
|
-
console.log(
|
|
8246
|
+
console.log(chalk95.dim("\nDry run. Use --apply to execute."));
|
|
8218
8247
|
}
|
|
8219
8248
|
}
|
|
8220
8249
|
|
|
8221
8250
|
// src/commands/refactor/ignore.ts
|
|
8222
8251
|
import fs18 from "fs";
|
|
8223
|
-
import
|
|
8252
|
+
import chalk96 from "chalk";
|
|
8224
8253
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
8225
8254
|
function ignore(file) {
|
|
8226
8255
|
if (!fs18.existsSync(file)) {
|
|
8227
|
-
console.error(
|
|
8256
|
+
console.error(chalk96.red(`Error: File does not exist: ${file}`));
|
|
8228
8257
|
process.exit(1);
|
|
8229
8258
|
}
|
|
8230
8259
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -8240,7 +8269,7 @@ function ignore(file) {
|
|
|
8240
8269
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
8241
8270
|
}
|
|
8242
8271
|
console.log(
|
|
8243
|
-
|
|
8272
|
+
chalk96.green(
|
|
8244
8273
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
8245
8274
|
)
|
|
8246
8275
|
);
|
|
@@ -8248,26 +8277,26 @@ function ignore(file) {
|
|
|
8248
8277
|
|
|
8249
8278
|
// src/commands/refactor/rename/index.ts
|
|
8250
8279
|
import path34 from "path";
|
|
8251
|
-
import
|
|
8280
|
+
import chalk97 from "chalk";
|
|
8252
8281
|
async function rename(source, destination, options2 = {}) {
|
|
8253
8282
|
const destPath = path34.resolve(destination);
|
|
8254
8283
|
const cwd = process.cwd();
|
|
8255
8284
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
8256
8285
|
const relDest = path34.relative(cwd, destPath);
|
|
8257
8286
|
const { project, sourceFile } = loadProjectFile(source);
|
|
8258
|
-
console.log(
|
|
8287
|
+
console.log(chalk97.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
8259
8288
|
if (options2.apply) {
|
|
8260
8289
|
sourceFile.move(destPath);
|
|
8261
8290
|
await project.save();
|
|
8262
|
-
console.log(
|
|
8291
|
+
console.log(chalk97.green("Done"));
|
|
8263
8292
|
} else {
|
|
8264
|
-
console.log(
|
|
8293
|
+
console.log(chalk97.dim("Dry run. Use --apply to execute."));
|
|
8265
8294
|
}
|
|
8266
8295
|
}
|
|
8267
8296
|
|
|
8268
8297
|
// src/commands/refactor/renameSymbol/index.ts
|
|
8269
8298
|
import path36 from "path";
|
|
8270
|
-
import
|
|
8299
|
+
import chalk98 from "chalk";
|
|
8271
8300
|
import { Project as Project3 } from "ts-morph";
|
|
8272
8301
|
|
|
8273
8302
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -8316,38 +8345,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
8316
8345
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
8317
8346
|
const sourceFile = project.getSourceFile(filePath);
|
|
8318
8347
|
if (!sourceFile) {
|
|
8319
|
-
console.log(
|
|
8348
|
+
console.log(chalk98.red(`File not found in project: ${file}`));
|
|
8320
8349
|
process.exit(1);
|
|
8321
8350
|
}
|
|
8322
8351
|
const symbol = findSymbol(sourceFile, oldName);
|
|
8323
8352
|
if (!symbol) {
|
|
8324
|
-
console.log(
|
|
8353
|
+
console.log(chalk98.red(`Symbol "${oldName}" not found in ${file}`));
|
|
8325
8354
|
process.exit(1);
|
|
8326
8355
|
}
|
|
8327
8356
|
const grouped = groupReferences(symbol, cwd);
|
|
8328
8357
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
8329
8358
|
console.log(
|
|
8330
|
-
|
|
8359
|
+
chalk98.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
8331
8360
|
`)
|
|
8332
8361
|
);
|
|
8333
8362
|
for (const [refFile, lines] of grouped) {
|
|
8334
8363
|
console.log(
|
|
8335
|
-
` ${
|
|
8364
|
+
` ${chalk98.dim(refFile)}: lines ${chalk98.cyan(lines.join(", "))}`
|
|
8336
8365
|
);
|
|
8337
8366
|
}
|
|
8338
8367
|
if (options2.apply) {
|
|
8339
8368
|
symbol.rename(newName);
|
|
8340
8369
|
await project.save();
|
|
8341
|
-
console.log(
|
|
8370
|
+
console.log(chalk98.green(`
|
|
8342
8371
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
8343
8372
|
} else {
|
|
8344
|
-
console.log(
|
|
8373
|
+
console.log(chalk98.dim("\nDry run. Use --apply to execute."));
|
|
8345
8374
|
}
|
|
8346
8375
|
}
|
|
8347
8376
|
|
|
8348
8377
|
// src/commands/refactor/restructure/index.ts
|
|
8349
8378
|
import path45 from "path";
|
|
8350
|
-
import
|
|
8379
|
+
import chalk101 from "chalk";
|
|
8351
8380
|
|
|
8352
8381
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
8353
8382
|
import path37 from "path";
|
|
@@ -8590,50 +8619,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
8590
8619
|
|
|
8591
8620
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
8592
8621
|
import path41 from "path";
|
|
8593
|
-
import
|
|
8622
|
+
import chalk99 from "chalk";
|
|
8594
8623
|
function relPath(filePath) {
|
|
8595
8624
|
return path41.relative(process.cwd(), filePath);
|
|
8596
8625
|
}
|
|
8597
8626
|
function displayMoves(plan2) {
|
|
8598
8627
|
if (plan2.moves.length === 0) return;
|
|
8599
|
-
console.log(
|
|
8628
|
+
console.log(chalk99.bold("\nFile moves:"));
|
|
8600
8629
|
for (const move of plan2.moves) {
|
|
8601
8630
|
console.log(
|
|
8602
|
-
` ${
|
|
8631
|
+
` ${chalk99.red(relPath(move.from))} \u2192 ${chalk99.green(relPath(move.to))}`
|
|
8603
8632
|
);
|
|
8604
|
-
console.log(
|
|
8633
|
+
console.log(chalk99.dim(` ${move.reason}`));
|
|
8605
8634
|
}
|
|
8606
8635
|
}
|
|
8607
8636
|
function displayRewrites(rewrites) {
|
|
8608
8637
|
if (rewrites.length === 0) return;
|
|
8609
8638
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
8610
|
-
console.log(
|
|
8639
|
+
console.log(chalk99.bold(`
|
|
8611
8640
|
Import rewrites (${affectedFiles.size} files):`));
|
|
8612
8641
|
for (const file of affectedFiles) {
|
|
8613
|
-
console.log(` ${
|
|
8642
|
+
console.log(` ${chalk99.cyan(relPath(file))}:`);
|
|
8614
8643
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
8615
8644
|
(r) => r.file === file
|
|
8616
8645
|
)) {
|
|
8617
8646
|
console.log(
|
|
8618
|
-
` ${
|
|
8647
|
+
` ${chalk99.red(`"${oldSpecifier}"`)} \u2192 ${chalk99.green(`"${newSpecifier}"`)}`
|
|
8619
8648
|
);
|
|
8620
8649
|
}
|
|
8621
8650
|
}
|
|
8622
8651
|
}
|
|
8623
8652
|
function displayPlan2(plan2) {
|
|
8624
8653
|
if (plan2.warnings.length > 0) {
|
|
8625
|
-
console.log(
|
|
8626
|
-
for (const w of plan2.warnings) console.log(
|
|
8654
|
+
console.log(chalk99.yellow("\nWarnings:"));
|
|
8655
|
+
for (const w of plan2.warnings) console.log(chalk99.yellow(` ${w}`));
|
|
8627
8656
|
}
|
|
8628
8657
|
if (plan2.newDirectories.length > 0) {
|
|
8629
|
-
console.log(
|
|
8658
|
+
console.log(chalk99.bold("\nNew directories:"));
|
|
8630
8659
|
for (const dir of plan2.newDirectories)
|
|
8631
|
-
console.log(
|
|
8660
|
+
console.log(chalk99.green(` ${dir}/`));
|
|
8632
8661
|
}
|
|
8633
8662
|
displayMoves(plan2);
|
|
8634
8663
|
displayRewrites(plan2.rewrites);
|
|
8635
8664
|
console.log(
|
|
8636
|
-
|
|
8665
|
+
chalk99.dim(
|
|
8637
8666
|
`
|
|
8638
8667
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
8639
8668
|
)
|
|
@@ -8643,18 +8672,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
8643
8672
|
// src/commands/refactor/restructure/executePlan.ts
|
|
8644
8673
|
import fs20 from "fs";
|
|
8645
8674
|
import path42 from "path";
|
|
8646
|
-
import
|
|
8675
|
+
import chalk100 from "chalk";
|
|
8647
8676
|
function executePlan(plan2) {
|
|
8648
8677
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
8649
8678
|
for (const [file, content] of updatedContents) {
|
|
8650
8679
|
fs20.writeFileSync(file, content, "utf-8");
|
|
8651
8680
|
console.log(
|
|
8652
|
-
|
|
8681
|
+
chalk100.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
8653
8682
|
);
|
|
8654
8683
|
}
|
|
8655
8684
|
for (const dir of plan2.newDirectories) {
|
|
8656
8685
|
fs20.mkdirSync(dir, { recursive: true });
|
|
8657
|
-
console.log(
|
|
8686
|
+
console.log(chalk100.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
8658
8687
|
}
|
|
8659
8688
|
for (const move of plan2.moves) {
|
|
8660
8689
|
const targetDir = path42.dirname(move.to);
|
|
@@ -8663,7 +8692,7 @@ function executePlan(plan2) {
|
|
|
8663
8692
|
}
|
|
8664
8693
|
fs20.renameSync(move.from, move.to);
|
|
8665
8694
|
console.log(
|
|
8666
|
-
|
|
8695
|
+
chalk100.white(
|
|
8667
8696
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
8668
8697
|
)
|
|
8669
8698
|
);
|
|
@@ -8678,7 +8707,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
8678
8707
|
if (entries.length === 0) {
|
|
8679
8708
|
fs20.rmdirSync(dir);
|
|
8680
8709
|
console.log(
|
|
8681
|
-
|
|
8710
|
+
chalk100.dim(
|
|
8682
8711
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
8683
8712
|
)
|
|
8684
8713
|
);
|
|
@@ -8811,22 +8840,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
8811
8840
|
const targetPattern = pattern2 ?? "src";
|
|
8812
8841
|
const files = findSourceFiles2(targetPattern);
|
|
8813
8842
|
if (files.length === 0) {
|
|
8814
|
-
console.log(
|
|
8843
|
+
console.log(chalk101.yellow("No files found matching pattern"));
|
|
8815
8844
|
return;
|
|
8816
8845
|
}
|
|
8817
8846
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
8818
8847
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
8819
8848
|
if (plan2.moves.length === 0) {
|
|
8820
|
-
console.log(
|
|
8849
|
+
console.log(chalk101.green("No restructuring needed"));
|
|
8821
8850
|
return;
|
|
8822
8851
|
}
|
|
8823
8852
|
displayPlan2(plan2);
|
|
8824
8853
|
if (options2.apply) {
|
|
8825
|
-
console.log(
|
|
8854
|
+
console.log(chalk101.bold("\nApplying changes..."));
|
|
8826
8855
|
executePlan(plan2);
|
|
8827
|
-
console.log(
|
|
8856
|
+
console.log(chalk101.green("\nRestructuring complete"));
|
|
8828
8857
|
} else {
|
|
8829
|
-
console.log(
|
|
8858
|
+
console.log(chalk101.dim("\nDry run. Use --apply to execute."));
|
|
8830
8859
|
}
|
|
8831
8860
|
}
|
|
8832
8861
|
|
|
@@ -8866,7 +8895,7 @@ function registerRefactor(program2) {
|
|
|
8866
8895
|
}
|
|
8867
8896
|
|
|
8868
8897
|
// src/commands/seq/seqAuth.ts
|
|
8869
|
-
import
|
|
8898
|
+
import chalk103 from "chalk";
|
|
8870
8899
|
|
|
8871
8900
|
// src/commands/seq/loadConnections.ts
|
|
8872
8901
|
function loadConnections2() {
|
|
@@ -8895,11 +8924,11 @@ function setDefaultConnection(name) {
|
|
|
8895
8924
|
}
|
|
8896
8925
|
|
|
8897
8926
|
// src/commands/seq/promptConnection.ts
|
|
8898
|
-
import
|
|
8927
|
+
import chalk102 from "chalk";
|
|
8899
8928
|
async function promptConnection2(existingNames) {
|
|
8900
8929
|
const name = await promptInput("name", "Connection name:", "default");
|
|
8901
8930
|
if (existingNames.includes(name)) {
|
|
8902
|
-
console.error(
|
|
8931
|
+
console.error(chalk102.red(`Connection "${name}" already exists.`));
|
|
8903
8932
|
process.exit(1);
|
|
8904
8933
|
}
|
|
8905
8934
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -8911,32 +8940,32 @@ async function promptConnection2(existingNames) {
|
|
|
8911
8940
|
var seqAuth = createConnectionAuth({
|
|
8912
8941
|
load: loadConnections2,
|
|
8913
8942
|
save: saveConnections2,
|
|
8914
|
-
format: (c) => `${
|
|
8943
|
+
format: (c) => `${chalk103.bold(c.name)} ${c.url}`,
|
|
8915
8944
|
promptNew: promptConnection2,
|
|
8916
8945
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
8917
8946
|
});
|
|
8918
8947
|
|
|
8919
8948
|
// src/commands/seq/seqQuery.ts
|
|
8920
|
-
import
|
|
8949
|
+
import chalk106 from "chalk";
|
|
8921
8950
|
|
|
8922
8951
|
// src/commands/seq/formatEvent.ts
|
|
8923
|
-
import
|
|
8952
|
+
import chalk104 from "chalk";
|
|
8924
8953
|
function levelColor(level) {
|
|
8925
8954
|
switch (level) {
|
|
8926
8955
|
case "Fatal":
|
|
8927
|
-
return
|
|
8956
|
+
return chalk104.bgRed.white;
|
|
8928
8957
|
case "Error":
|
|
8929
|
-
return
|
|
8958
|
+
return chalk104.red;
|
|
8930
8959
|
case "Warning":
|
|
8931
|
-
return
|
|
8960
|
+
return chalk104.yellow;
|
|
8932
8961
|
case "Information":
|
|
8933
|
-
return
|
|
8962
|
+
return chalk104.cyan;
|
|
8934
8963
|
case "Debug":
|
|
8935
|
-
return
|
|
8964
|
+
return chalk104.gray;
|
|
8936
8965
|
case "Verbose":
|
|
8937
|
-
return
|
|
8966
|
+
return chalk104.dim;
|
|
8938
8967
|
default:
|
|
8939
|
-
return
|
|
8968
|
+
return chalk104.white;
|
|
8940
8969
|
}
|
|
8941
8970
|
}
|
|
8942
8971
|
function levelAbbrev(level) {
|
|
@@ -8977,31 +9006,31 @@ function formatTimestamp(iso) {
|
|
|
8977
9006
|
function formatEvent(event) {
|
|
8978
9007
|
const color = levelColor(event.Level);
|
|
8979
9008
|
const abbrev = levelAbbrev(event.Level);
|
|
8980
|
-
const ts8 =
|
|
9009
|
+
const ts8 = chalk104.dim(formatTimestamp(event.Timestamp));
|
|
8981
9010
|
const msg = renderMessage(event);
|
|
8982
9011
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
8983
9012
|
if (event.Exception) {
|
|
8984
9013
|
for (const line of event.Exception.split("\n")) {
|
|
8985
|
-
lines.push(
|
|
9014
|
+
lines.push(chalk104.red(` ${line}`));
|
|
8986
9015
|
}
|
|
8987
9016
|
}
|
|
8988
9017
|
return lines.join("\n");
|
|
8989
9018
|
}
|
|
8990
9019
|
|
|
8991
9020
|
// src/commands/seq/resolveConnection.ts
|
|
8992
|
-
import
|
|
9021
|
+
import chalk105 from "chalk";
|
|
8993
9022
|
function resolveConnection2(name) {
|
|
8994
9023
|
const connections = loadConnections2();
|
|
8995
9024
|
if (connections.length === 0) {
|
|
8996
9025
|
console.error(
|
|
8997
|
-
|
|
9026
|
+
chalk105.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
8998
9027
|
);
|
|
8999
9028
|
process.exit(1);
|
|
9000
9029
|
}
|
|
9001
9030
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9002
9031
|
const connection = connections.find((c) => c.name === target);
|
|
9003
9032
|
if (!connection) {
|
|
9004
|
-
console.error(
|
|
9033
|
+
console.error(chalk105.red(`Seq connection "${target}" not found.`));
|
|
9005
9034
|
process.exit(1);
|
|
9006
9035
|
}
|
|
9007
9036
|
return connection;
|
|
@@ -9021,12 +9050,12 @@ async function seqQuery(filter, options2) {
|
|
|
9021
9050
|
});
|
|
9022
9051
|
if (!response.ok) {
|
|
9023
9052
|
const body = await response.text();
|
|
9024
|
-
console.error(
|
|
9053
|
+
console.error(chalk106.red(`Seq returned ${response.status}: ${body}`));
|
|
9025
9054
|
process.exit(1);
|
|
9026
9055
|
}
|
|
9027
9056
|
const events = await response.json();
|
|
9028
9057
|
if (events.length === 0) {
|
|
9029
|
-
console.log(
|
|
9058
|
+
console.log(chalk106.yellow("No events found."));
|
|
9030
9059
|
return;
|
|
9031
9060
|
}
|
|
9032
9061
|
if (options2.json) {
|
|
@@ -9037,11 +9066,11 @@ async function seqQuery(filter, options2) {
|
|
|
9037
9066
|
for (const event of chronological) {
|
|
9038
9067
|
console.log(formatEvent(event));
|
|
9039
9068
|
}
|
|
9040
|
-
console.log(
|
|
9069
|
+
console.log(chalk106.dim(`
|
|
9041
9070
|
${events.length} events`));
|
|
9042
9071
|
if (events.length >= count) {
|
|
9043
9072
|
console.log(
|
|
9044
|
-
|
|
9073
|
+
chalk106.yellow(
|
|
9045
9074
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9046
9075
|
)
|
|
9047
9076
|
);
|
|
@@ -9049,11 +9078,11 @@ ${events.length} events`));
|
|
|
9049
9078
|
}
|
|
9050
9079
|
|
|
9051
9080
|
// src/commands/seq/seqSetConnection.ts
|
|
9052
|
-
import
|
|
9081
|
+
import chalk107 from "chalk";
|
|
9053
9082
|
function seqSetConnection(name) {
|
|
9054
9083
|
const connections = loadConnections2();
|
|
9055
9084
|
if (!connections.find((c) => c.name === name)) {
|
|
9056
|
-
console.error(
|
|
9085
|
+
console.error(chalk107.red(`Connection "${name}" not found.`));
|
|
9057
9086
|
process.exit(1);
|
|
9058
9087
|
}
|
|
9059
9088
|
setDefaultConnection(name);
|
|
@@ -9592,14 +9621,14 @@ import {
|
|
|
9592
9621
|
import { dirname as dirname20, join as join30 } from "path";
|
|
9593
9622
|
|
|
9594
9623
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
9595
|
-
import
|
|
9624
|
+
import chalk108 from "chalk";
|
|
9596
9625
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
9597
9626
|
function validateStagedContent(filename, content) {
|
|
9598
9627
|
const firstLine = content.split("\n")[0];
|
|
9599
9628
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
9600
9629
|
if (!match) {
|
|
9601
9630
|
console.error(
|
|
9602
|
-
|
|
9631
|
+
chalk108.red(
|
|
9603
9632
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
9604
9633
|
)
|
|
9605
9634
|
);
|
|
@@ -9608,7 +9637,7 @@ function validateStagedContent(filename, content) {
|
|
|
9608
9637
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
9609
9638
|
if (!contentAfterLink) {
|
|
9610
9639
|
console.error(
|
|
9611
|
-
|
|
9640
|
+
chalk108.red(
|
|
9612
9641
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
9613
9642
|
)
|
|
9614
9643
|
);
|
|
@@ -10001,7 +10030,7 @@ function registerVoice(program2) {
|
|
|
10001
10030
|
|
|
10002
10031
|
// src/commands/roam/auth.ts
|
|
10003
10032
|
import { randomBytes } from "crypto";
|
|
10004
|
-
import
|
|
10033
|
+
import chalk109 from "chalk";
|
|
10005
10034
|
|
|
10006
10035
|
// src/lib/openBrowser.ts
|
|
10007
10036
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -10176,13 +10205,13 @@ async function auth() {
|
|
|
10176
10205
|
saveGlobalConfig(config);
|
|
10177
10206
|
const state = randomBytes(16).toString("hex");
|
|
10178
10207
|
console.log(
|
|
10179
|
-
|
|
10208
|
+
chalk109.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
10180
10209
|
);
|
|
10181
|
-
console.log(
|
|
10182
|
-
console.log(
|
|
10183
|
-
console.log(
|
|
10210
|
+
console.log(chalk109.white("http://localhost:14523/callback\n"));
|
|
10211
|
+
console.log(chalk109.blue("Opening browser for authorization..."));
|
|
10212
|
+
console.log(chalk109.dim("Waiting for authorization callback..."));
|
|
10184
10213
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
10185
|
-
console.log(
|
|
10214
|
+
console.log(chalk109.dim("Exchanging code for tokens..."));
|
|
10186
10215
|
const tokens = await exchangeToken({
|
|
10187
10216
|
code,
|
|
10188
10217
|
clientId,
|
|
@@ -10198,7 +10227,7 @@ async function auth() {
|
|
|
10198
10227
|
};
|
|
10199
10228
|
saveGlobalConfig(config);
|
|
10200
10229
|
console.log(
|
|
10201
|
-
|
|
10230
|
+
chalk109.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
10202
10231
|
);
|
|
10203
10232
|
}
|
|
10204
10233
|
|
|
@@ -10411,7 +10440,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
10411
10440
|
import { existsSync as existsSync40, mkdirSync as mkdirSync13, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
10412
10441
|
import { tmpdir as tmpdir6 } from "os";
|
|
10413
10442
|
import { join as join39, resolve as resolve5 } from "path";
|
|
10414
|
-
import
|
|
10443
|
+
import chalk110 from "chalk";
|
|
10415
10444
|
|
|
10416
10445
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
10417
10446
|
var captureWindowPs1 = `
|
|
@@ -10562,22 +10591,22 @@ function screenshot(processName) {
|
|
|
10562
10591
|
const config = loadConfig();
|
|
10563
10592
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
10564
10593
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
10565
|
-
console.log(
|
|
10594
|
+
console.log(chalk110.gray(`Capturing window for process "${processName}" ...`));
|
|
10566
10595
|
try {
|
|
10567
10596
|
runPowerShellScript(processName, outputPath);
|
|
10568
|
-
console.log(
|
|
10597
|
+
console.log(chalk110.green(`Screenshot saved: ${outputPath}`));
|
|
10569
10598
|
} catch (error) {
|
|
10570
10599
|
const msg = error instanceof Error ? error.message : String(error);
|
|
10571
|
-
console.error(
|
|
10600
|
+
console.error(chalk110.red(`Failed to capture screenshot: ${msg}`));
|
|
10572
10601
|
process.exit(1);
|
|
10573
10602
|
}
|
|
10574
10603
|
}
|
|
10575
10604
|
|
|
10576
10605
|
// src/commands/statusLine.ts
|
|
10577
|
-
import
|
|
10606
|
+
import chalk112 from "chalk";
|
|
10578
10607
|
|
|
10579
10608
|
// src/commands/buildLimitsSegment.ts
|
|
10580
|
-
import
|
|
10609
|
+
import chalk111 from "chalk";
|
|
10581
10610
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
10582
10611
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
10583
10612
|
function formatTimeLeft(resetsAt) {
|
|
@@ -10600,10 +10629,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
10600
10629
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
10601
10630
|
const label2 = `${Math.round(pct)}%`;
|
|
10602
10631
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
10603
|
-
if (projected == null) return
|
|
10604
|
-
if (projected > 100) return
|
|
10605
|
-
if (projected > 75) return
|
|
10606
|
-
return
|
|
10632
|
+
if (projected == null) return chalk111.green(label2);
|
|
10633
|
+
if (projected > 100) return chalk111.red(label2);
|
|
10634
|
+
if (projected > 75) return chalk111.yellow(label2);
|
|
10635
|
+
return chalk111.green(label2);
|
|
10607
10636
|
}
|
|
10608
10637
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
10609
10638
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -10629,14 +10658,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
10629
10658
|
}
|
|
10630
10659
|
|
|
10631
10660
|
// src/commands/statusLine.ts
|
|
10632
|
-
|
|
10661
|
+
chalk112.level = 3;
|
|
10633
10662
|
function formatNumber(num) {
|
|
10634
10663
|
return num.toLocaleString("en-US");
|
|
10635
10664
|
}
|
|
10636
10665
|
function colorizePercent(pct) {
|
|
10637
10666
|
const label2 = `${Math.round(pct)}%`;
|
|
10638
|
-
if (pct > 80) return
|
|
10639
|
-
if (pct > 40) return
|
|
10667
|
+
if (pct > 80) return chalk112.red(label2);
|
|
10668
|
+
if (pct > 40) return chalk112.yellow(label2);
|
|
10640
10669
|
return label2;
|
|
10641
10670
|
}
|
|
10642
10671
|
async function statusLine() {
|
|
@@ -10659,7 +10688,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
10659
10688
|
// src/commands/sync/syncClaudeMd.ts
|
|
10660
10689
|
import * as fs23 from "fs";
|
|
10661
10690
|
import * as path46 from "path";
|
|
10662
|
-
import
|
|
10691
|
+
import chalk113 from "chalk";
|
|
10663
10692
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
10664
10693
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
10665
10694
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -10668,12 +10697,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10668
10697
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
10669
10698
|
if (sourceContent !== targetContent) {
|
|
10670
10699
|
console.log(
|
|
10671
|
-
|
|
10700
|
+
chalk113.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
10672
10701
|
);
|
|
10673
10702
|
console.log();
|
|
10674
10703
|
printDiff(targetContent, sourceContent);
|
|
10675
10704
|
const confirm = options2?.yes || await promptConfirm(
|
|
10676
|
-
|
|
10705
|
+
chalk113.red("Overwrite existing CLAUDE.md?"),
|
|
10677
10706
|
false
|
|
10678
10707
|
);
|
|
10679
10708
|
if (!confirm) {
|
|
@@ -10689,7 +10718,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10689
10718
|
// src/commands/sync/syncSettings.ts
|
|
10690
10719
|
import * as fs24 from "fs";
|
|
10691
10720
|
import * as path47 from "path";
|
|
10692
|
-
import
|
|
10721
|
+
import chalk114 from "chalk";
|
|
10693
10722
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
10694
10723
|
const source = path47.join(claudeDir, "settings.json");
|
|
10695
10724
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -10705,14 +10734,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
10705
10734
|
if (mergedContent !== normalizedTarget) {
|
|
10706
10735
|
if (!options2?.yes) {
|
|
10707
10736
|
console.log(
|
|
10708
|
-
|
|
10737
|
+
chalk114.yellow(
|
|
10709
10738
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
10710
10739
|
)
|
|
10711
10740
|
);
|
|
10712
10741
|
console.log();
|
|
10713
10742
|
printDiff(targetContent, mergedContent);
|
|
10714
10743
|
const confirm = await promptConfirm(
|
|
10715
|
-
|
|
10744
|
+
chalk114.red("Overwrite existing settings.json?"),
|
|
10716
10745
|
false
|
|
10717
10746
|
);
|
|
10718
10747
|
if (!confirm) {
|
|
@@ -10730,11 +10759,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
10730
10759
|
var __filename4 = fileURLToPath7(import.meta.url);
|
|
10731
10760
|
var __dirname7 = path48.dirname(__filename4);
|
|
10732
10761
|
async function sync(options2) {
|
|
10762
|
+
const config = loadConfig();
|
|
10763
|
+
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
10733
10764
|
const claudeDir = path48.join(__dirname7, "..", "claude");
|
|
10734
10765
|
const targetBase = path48.join(os.homedir(), ".claude");
|
|
10735
10766
|
syncCommands(claudeDir, targetBase);
|
|
10736
|
-
await syncSettings(claudeDir, targetBase, { yes
|
|
10737
|
-
await syncClaudeMd(claudeDir, targetBase, { yes
|
|
10767
|
+
await syncSettings(claudeDir, targetBase, { yes });
|
|
10768
|
+
await syncClaudeMd(claudeDir, targetBase, { yes });
|
|
10738
10769
|
}
|
|
10739
10770
|
function syncCommands(claudeDir, targetBase) {
|
|
10740
10771
|
const sourceDir = path48.join(claudeDir, "commands");
|
|
@@ -10774,12 +10805,12 @@ async function update() {
|
|
|
10774
10805
|
console.log("Building...");
|
|
10775
10806
|
execSync41("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
10776
10807
|
console.log("Syncing commands...");
|
|
10777
|
-
execSync41("assist sync
|
|
10808
|
+
execSync41("assist sync", { stdio: "inherit" });
|
|
10778
10809
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
10779
10810
|
console.log("Detected global npm installation, updating...");
|
|
10780
10811
|
execSync41("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
10781
10812
|
console.log("Syncing commands...");
|
|
10782
|
-
execSync41("assist sync
|
|
10813
|
+
execSync41("assist sync", { stdio: "inherit" });
|
|
10783
10814
|
} else {
|
|
10784
10815
|
console.error(
|
|
10785
10816
|
"Could not determine installation method. Expected a git repo or global npm install."
|
|
@@ -10795,7 +10826,7 @@ program.command("sync").description("Copy command files to ~/.claude/commands").
|
|
|
10795
10826
|
program.command("init").description("Initialize VS Code and verify configurations").action(init4);
|
|
10796
10827
|
program.command("commit").description("Create a git commit with validation").argument("<args...>", "status | <message> [files...]").action(commit);
|
|
10797
10828
|
var configCommand = program.command("config").description("View and modify assist.yml configuration");
|
|
10798
|
-
configCommand.command("set <key> <value>").description("Set a config value (e.g. commit.push true)").action(configSet);
|
|
10829
|
+
configCommand.command("set <key> <value>").description("Set a config value (e.g. commit.push true)").option("-g, --global", "Write to global ~/.assist.yml").action((key, value, options2) => configSet(key, value, options2));
|
|
10799
10830
|
configCommand.command("get <key>").description("Get a config value").action(configGet);
|
|
10800
10831
|
configCommand.command("list").description("List all config values").action(configList);
|
|
10801
10832
|
var runCommand = program.command("run").description("Run a configured command from assist.yml").argument("<name>", "Name of the configured command").argument("[args...]", "Arguments to pass to the command").allowUnknownOption().action((name, args) => {
|