@staff0rd/assist 0.778.0 → 0.780.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/claude/skills/review-ci/scripts/review.mjs +1 -1
- package/dist/commands/sessions/web/bundle.js +264 -264
- package/dist/index.js +818 -699
- 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.780.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -619,7 +619,7 @@ function warnYmlRepoOverride(key) {
|
|
|
619
619
|
warnedYmlKeys.add(key);
|
|
620
620
|
console.error(
|
|
621
621
|
chalk4.yellow(
|
|
622
|
-
`repos.${key} in ~/.assist.yml is not in the shared db, so other nodes don't see it.
|
|
622
|
+
`repos.${key} in ~/.assist.yml is not in the shared db, so other nodes don't see it. Run 'assist config import-repos' to share it.`
|
|
623
623
|
)
|
|
624
624
|
);
|
|
625
625
|
}
|
|
@@ -12488,7 +12488,8 @@ function readRawConfigLayers(cwd, globalConfigPath = getGlobalConfigPath()) {
|
|
|
12488
12488
|
project: loadRawYaml(projectConfigPathFrom(cwd)),
|
|
12489
12489
|
global,
|
|
12490
12490
|
repoOverride: repo.override,
|
|
12491
|
-
...repo.key === void 0 ? {} : { repoKey: repo.key }
|
|
12491
|
+
...repo.key === void 0 ? {} : { repoKey: repo.key },
|
|
12492
|
+
...repo.source === void 0 ? {} : { repoSource: repo.source }
|
|
12492
12493
|
};
|
|
12493
12494
|
}
|
|
12494
12495
|
|
|
@@ -12757,7 +12758,7 @@ var configConfigHelp = [
|
|
|
12757
12758
|
{
|
|
12758
12759
|
key: "repos",
|
|
12759
12760
|
setter: "assist config set worktree.enabled true -g --repo",
|
|
12760
|
-
note: "per-repo
|
|
12761
|
+
note: "per-repo overrides stored in the shared db, keyed by repo identity and seen by every node that uses it; written by 'config set -g --repo [name]' or the web /config repo scope, and a yml repos: entry applies only until 'config import-repos' moves it"
|
|
12761
12762
|
}
|
|
12762
12763
|
];
|
|
12763
12764
|
|
|
@@ -13388,6 +13389,7 @@ function configEntryFor(leaf, { config, layers, globalConfigFile, schema: schema
|
|
|
13388
13389
|
sources,
|
|
13389
13390
|
layers: configEntryLayers(leaf.key, layers, node),
|
|
13390
13391
|
...layers.repoKey ? { repoKey: layers.repoKey } : {},
|
|
13392
|
+
...layers.repoSource ? { repoSource: layers.repoSource } : {},
|
|
13391
13393
|
globalConfigFile,
|
|
13392
13394
|
globalOnly: isGlobalOnlyConfigKey(leaf.key),
|
|
13393
13395
|
node
|
|
@@ -16819,6 +16821,12 @@ function globalOnlyRepoKeyError(key, verb) {
|
|
|
16819
16821
|
};
|
|
16820
16822
|
}
|
|
16821
16823
|
|
|
16824
|
+
// src/shared/db/listRepoConfigs.ts
|
|
16825
|
+
async function listRepoConfigs(orm) {
|
|
16826
|
+
const rows = await orm.select().from(repoConfigs);
|
|
16827
|
+
return Object.fromEntries(rows.map((row) => [row.repoKey, row.config]));
|
|
16828
|
+
}
|
|
16829
|
+
|
|
16822
16830
|
// src/shared/resolveNamedRepoWriteLabel.ts
|
|
16823
16831
|
var UnknownRepoConfigError = class extends Error {
|
|
16824
16832
|
name = "UnknownRepoConfigError";
|
|
@@ -16841,45 +16849,74 @@ function resolveNamedRepoWriteLabel(globalRaw, name, source = "~/.assist.yml") {
|
|
|
16841
16849
|
return matches[0];
|
|
16842
16850
|
}
|
|
16843
16851
|
|
|
16844
|
-
// src/commands/config/
|
|
16845
|
-
function
|
|
16846
|
-
const
|
|
16847
|
-
const label2 = repoName === void 0 ?
|
|
16848
|
-
|
|
16849
|
-
const block = isPlainObject3(repos2[label2]) ? repos2[label2] : {};
|
|
16850
|
-
return { globalRaw, repos: repos2, label: label2, block };
|
|
16852
|
+
// src/commands/config/resolveSharedRepoBlock.ts
|
|
16853
|
+
async function resolveSharedRepoBlock(orm, repoName, cwd) {
|
|
16854
|
+
const shared = { repos: await listRepoConfigs(orm) };
|
|
16855
|
+
const label2 = repoName === void 0 ? currentRepoLabel(shared, getCurrentOrigin(cwd)) : resolveNamedRepoWriteLabel(shared, repoName, SHARED_REPO_CONFIG_SOURCE);
|
|
16856
|
+
return { label: label2, block: shared.repos[label2] ?? {} };
|
|
16851
16857
|
}
|
|
16852
|
-
function
|
|
16853
|
-
return
|
|
16858
|
+
function currentRepoLabel(shared, origin) {
|
|
16859
|
+
return matchRepoConfigKey(shared, origin, SHARED_REPO_CONFIG_SOURCE) ?? origin;
|
|
16854
16860
|
}
|
|
16855
16861
|
|
|
16856
|
-
// src/
|
|
16857
|
-
|
|
16862
|
+
// src/shared/db/saveRepoConfig.ts
|
|
16863
|
+
import { eq as eq45 } from "drizzle-orm";
|
|
16864
|
+
async function saveRepoConfig(orm, repoKey, config) {
|
|
16865
|
+
if (Object.keys(config).length === 0) {
|
|
16866
|
+
await orm.delete(repoConfigs).where(eq45(repoConfigs.repoKey, repoKey));
|
|
16867
|
+
return;
|
|
16868
|
+
}
|
|
16869
|
+
await orm.insert(repoConfigs).values({ repoKey, config }).onConflictDoUpdate({
|
|
16870
|
+
target: repoConfigs.repoKey,
|
|
16871
|
+
set: { config, updatedAt: /* @__PURE__ */ new Date() }
|
|
16872
|
+
});
|
|
16873
|
+
}
|
|
16874
|
+
|
|
16875
|
+
// src/shared/writeRepoConfigCache.ts
|
|
16876
|
+
import { mkdirSync as mkdirSync12, renameSync as renameSync2, writeFileSync as writeFileSync22 } from "fs";
|
|
16877
|
+
import { dirname as dirname24 } from "path";
|
|
16878
|
+
function writeRepoConfigCache(repos2) {
|
|
16879
|
+
const path106 = repoConfigCachePath();
|
|
16880
|
+
mkdirSync12(dirname24(path106), { recursive: true });
|
|
16881
|
+
const cache6 = {
|
|
16882
|
+
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16883
|
+
repos: repos2
|
|
16884
|
+
};
|
|
16885
|
+
const tmp = `${path106}.${process.pid}.tmp`;
|
|
16886
|
+
writeFileSync22(tmp, JSON.stringify(cache6, null, 2));
|
|
16887
|
+
renameSync2(tmp, path106);
|
|
16888
|
+
}
|
|
16889
|
+
|
|
16890
|
+
// src/shared/refreshRepoConfigCache.ts
|
|
16891
|
+
async function refreshRepoConfigCache(orm) {
|
|
16892
|
+
const repos2 = await listRepoConfigs(orm ?? await getDb());
|
|
16893
|
+
writeRepoConfigCache(repos2);
|
|
16894
|
+
return Object.keys(repos2).length;
|
|
16895
|
+
}
|
|
16896
|
+
|
|
16897
|
+
// src/commands/config/saveSharedRepoBlock.ts
|
|
16898
|
+
async function saveSharedRepoBlock(orm, label2, block) {
|
|
16899
|
+
await saveRepoConfig(orm, label2, block);
|
|
16900
|
+
await refreshRepoConfigCache(orm);
|
|
16901
|
+
}
|
|
16902
|
+
|
|
16903
|
+
// src/commands/config/applySharedRepoConfigSet.ts
|
|
16904
|
+
async function applySharedRepoConfigSet(key, coerced, repoName, cwd = process.cwd()) {
|
|
16858
16905
|
const globalOnly = globalOnlyRepoKeyError(key, "Set");
|
|
16859
16906
|
if (globalOnly) return globalOnly;
|
|
16860
|
-
const
|
|
16861
|
-
|
|
16862
|
-
cwd,
|
|
16863
|
-
globalConfigPath
|
|
16864
|
-
);
|
|
16907
|
+
const orm = await getDb();
|
|
16908
|
+
const { label: label2, block } = await resolveSharedRepoBlock(orm, repoName, cwd);
|
|
16865
16909
|
const updatedBlock = setNestedValue(block, key, coerced);
|
|
16866
16910
|
const validation = validateConfig(updatedBlock, key, repoConfigSchema);
|
|
16867
16911
|
if (!validation.ok) return validation;
|
|
16868
|
-
|
|
16869
|
-
saveGlobalConfig({ ...globalRaw, repos: repos2 }, globalConfigPath);
|
|
16912
|
+
await saveSharedRepoBlock(orm, label2, updatedBlock);
|
|
16870
16913
|
return { ok: true, target: "repo", label: label2 };
|
|
16871
16914
|
}
|
|
16872
16915
|
|
|
16873
16916
|
// src/commands/sessions/web/applyScopedConfigSet.ts
|
|
16874
|
-
function applyScopedConfigSet(key, value, cwd, scope, globalConfigPath) {
|
|
16917
|
+
async function applyScopedConfigSet(key, value, cwd, scope, globalConfigPath) {
|
|
16875
16918
|
if (scope === "repo") {
|
|
16876
|
-
const result2 =
|
|
16877
|
-
key,
|
|
16878
|
-
value,
|
|
16879
|
-
void 0,
|
|
16880
|
-
cwd,
|
|
16881
|
-
globalConfigPath
|
|
16882
|
-
);
|
|
16919
|
+
const result2 = await applySharedRepoConfigSet(key, value, void 0, cwd);
|
|
16883
16920
|
return result2.ok ? { ok: true, payload: { target: result2.target, repoKey: result2.label } } : result2;
|
|
16884
16921
|
}
|
|
16885
16922
|
const result = applyConfigSet(
|
|
@@ -16923,7 +16960,7 @@ async function handleConfigWrite(req, res, apply) {
|
|
|
16923
16960
|
return;
|
|
16924
16961
|
}
|
|
16925
16962
|
try {
|
|
16926
|
-
const result = apply(parsed);
|
|
16963
|
+
const result = await apply(parsed);
|
|
16927
16964
|
if (!result.ok) {
|
|
16928
16965
|
respondJson(res, 400, {
|
|
16929
16966
|
error: result.errors.join("\n"),
|
|
@@ -16967,11 +17004,11 @@ function isKnownConfigKey(key) {
|
|
|
16967
17004
|
}
|
|
16968
17005
|
|
|
16969
17006
|
// src/commands/config/unsetNestedValue.ts
|
|
16970
|
-
function
|
|
17007
|
+
function isPlainObject3(val) {
|
|
16971
17008
|
return val !== null && typeof val === "object" && !Array.isArray(val);
|
|
16972
17009
|
}
|
|
16973
17010
|
function isContainer(val) {
|
|
16974
|
-
return Array.isArray(val) ||
|
|
17011
|
+
return Array.isArray(val) || isPlainObject3(val);
|
|
16975
17012
|
}
|
|
16976
17013
|
function isNumericKey2(key) {
|
|
16977
17014
|
return /^\d+$/.test(key);
|
|
@@ -17007,7 +17044,7 @@ function withChild(container, key, child) {
|
|
|
17007
17044
|
return { ...container, [key]: child };
|
|
17008
17045
|
}
|
|
17009
17046
|
function isPrunable(container) {
|
|
17010
|
-
return
|
|
17047
|
+
return isPlainObject3(container) && Object.keys(container).length === 0;
|
|
17011
17048
|
}
|
|
17012
17049
|
function replaceOrPrune(container, key, child) {
|
|
17013
17050
|
return isPrunable(child) ? withoutKey(container, key) : withChild(container, key, child);
|
|
@@ -17065,33 +17102,22 @@ function unsetRepoBlockKey(block, key) {
|
|
|
17065
17102
|
return { ok: true, removed: true, block: updatedBlock };
|
|
17066
17103
|
}
|
|
17067
17104
|
|
|
17068
|
-
// src/commands/config/
|
|
17069
|
-
function
|
|
17105
|
+
// src/commands/config/applySharedRepoConfigUnset.ts
|
|
17106
|
+
async function applySharedRepoConfigUnset(key, repoName, cwd = process.cwd()) {
|
|
17070
17107
|
const globalOnly = globalOnlyRepoKeyError(key, "Unset");
|
|
17071
17108
|
if (globalOnly) return globalOnly;
|
|
17072
|
-
const
|
|
17073
|
-
|
|
17074
|
-
cwd,
|
|
17075
|
-
globalConfigPath
|
|
17076
|
-
);
|
|
17109
|
+
const orm = await getDb();
|
|
17110
|
+
const { label: label2, block } = await resolveSharedRepoBlock(orm, repoName, cwd);
|
|
17077
17111
|
const unset = unsetRepoBlockKey(block, key);
|
|
17078
17112
|
if (!unset.ok) return unset;
|
|
17079
|
-
if (
|
|
17080
|
-
|
|
17081
|
-
const updatedBlock = unset.block;
|
|
17082
|
-
if (Object.keys(updatedBlock).length === 0) delete repos2[label2];
|
|
17083
|
-
else repos2[label2] = updatedBlock;
|
|
17084
|
-
const next3 = { ...globalRaw };
|
|
17085
|
-
if (Object.keys(repos2).length === 0) delete next3.repos;
|
|
17086
|
-
else next3.repos = repos2;
|
|
17087
|
-
saveGlobalConfig(next3, globalConfigPath);
|
|
17088
|
-
return { ok: true, target: "repo", label: label2, removed: true };
|
|
17113
|
+
if (unset.removed) await saveSharedRepoBlock(orm, label2, unset.block);
|
|
17114
|
+
return { ok: true, target: "repo", label: label2, removed: unset.removed };
|
|
17089
17115
|
}
|
|
17090
17116
|
|
|
17091
17117
|
// src/commands/sessions/web/applyScopedConfigUnset.ts
|
|
17092
|
-
function applyScopedConfigUnset(key, cwd, scope, globalConfigPath) {
|
|
17118
|
+
async function applyScopedConfigUnset(key, cwd, scope, globalConfigPath) {
|
|
17093
17119
|
if (scope === "repo") {
|
|
17094
|
-
const result2 =
|
|
17120
|
+
const result2 = await applySharedRepoConfigUnset(key, void 0, cwd);
|
|
17095
17121
|
return result2.ok ? {
|
|
17096
17122
|
ok: true,
|
|
17097
17123
|
payload: {
|
|
@@ -17435,7 +17461,7 @@ import { readFile as readFile3, stat as stat4, writeFile as writeFile3 } from "f
|
|
|
17435
17461
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
17436
17462
|
import { execFile as execFile9 } from "child_process";
|
|
17437
17463
|
import { existsSync as existsSync40 } from "fs";
|
|
17438
|
-
import { dirname as
|
|
17464
|
+
import { dirname as dirname25, join as join45 } from "path";
|
|
17439
17465
|
import { promisify as promisify10 } from "util";
|
|
17440
17466
|
var execFileAsync9 = promisify10(execFile9);
|
|
17441
17467
|
var TIMEOUT_MS = 15e3;
|
|
@@ -17444,7 +17470,7 @@ function findOxfmtScript(root2) {
|
|
|
17444
17470
|
for (; ; ) {
|
|
17445
17471
|
const candidate = join45(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
17446
17472
|
if (existsSync40(candidate)) return candidate;
|
|
17447
|
-
const parent =
|
|
17473
|
+
const parent = dirname25(dir);
|
|
17448
17474
|
if (parent === dir) return void 0;
|
|
17449
17475
|
dir = parent;
|
|
17450
17476
|
}
|
|
@@ -19088,11 +19114,11 @@ function extractGraphqlQuery(args) {
|
|
|
19088
19114
|
}
|
|
19089
19115
|
|
|
19090
19116
|
// src/shared/loadCliReads.ts
|
|
19091
|
-
import { existsSync as existsSync42, readFileSync as readFileSync27, writeFileSync as
|
|
19092
|
-
import { dirname as
|
|
19117
|
+
import { existsSync as existsSync42, readFileSync as readFileSync27, writeFileSync as writeFileSync23 } from "fs";
|
|
19118
|
+
import { dirname as dirname26, resolve as resolve15 } from "path";
|
|
19093
19119
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
19094
19120
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
19095
|
-
var __dirname4 =
|
|
19121
|
+
var __dirname4 = dirname26(__filename3);
|
|
19096
19122
|
function packageRoot() {
|
|
19097
19123
|
return __dirname4;
|
|
19098
19124
|
}
|
|
@@ -19118,7 +19144,7 @@ function loadCliReads() {
|
|
|
19118
19144
|
return getCliReadsLines();
|
|
19119
19145
|
}
|
|
19120
19146
|
function saveCliReads(commands) {
|
|
19121
|
-
|
|
19147
|
+
writeFileSync23(
|
|
19122
19148
|
resolve15(packageRoot(), "allowed.cli-reads"),
|
|
19123
19149
|
`${commands.join("\n")}
|
|
19124
19150
|
`
|
|
@@ -19373,7 +19399,7 @@ function decideCommand(toolName, rawCommand) {
|
|
|
19373
19399
|
}
|
|
19374
19400
|
|
|
19375
19401
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
19376
|
-
import { mkdirSync as
|
|
19402
|
+
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19377
19403
|
import { homedir as homedir18 } from "os";
|
|
19378
19404
|
import { join as join47 } from "path";
|
|
19379
19405
|
import Database from "better-sqlite3";
|
|
@@ -19397,7 +19423,7 @@ function initSchema(db) {
|
|
|
19397
19423
|
function openPromptsDb(dir) {
|
|
19398
19424
|
if (_db) return _db;
|
|
19399
19425
|
const dbDir = dir ?? getDbDir();
|
|
19400
|
-
|
|
19426
|
+
mkdirSync13(dbDir, { recursive: true });
|
|
19401
19427
|
const db = new Database(join47(dbDir, "assist.db"));
|
|
19402
19428
|
db.pragma("journal_mode = WAL");
|
|
19403
19429
|
initSchema(db);
|
|
@@ -19517,7 +19543,7 @@ ${reasons.join("\n")}`);
|
|
|
19517
19543
|
}
|
|
19518
19544
|
|
|
19519
19545
|
// src/commands/permitCliReads.ts
|
|
19520
|
-
import { existsSync as existsSync44, mkdirSync as
|
|
19546
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync14, readFileSync as readFileSync29, writeFileSync as writeFileSync24 } from "fs";
|
|
19521
19547
|
import { homedir as homedir19 } from "os";
|
|
19522
19548
|
import { join as join48 } from "path";
|
|
19523
19549
|
|
|
@@ -19791,8 +19817,8 @@ function readCache(cli) {
|
|
|
19791
19817
|
}
|
|
19792
19818
|
function writeCache(cli, output) {
|
|
19793
19819
|
const dir = join48(homedir19(), ".assist");
|
|
19794
|
-
|
|
19795
|
-
|
|
19820
|
+
mkdirSync14(dir, { recursive: true });
|
|
19821
|
+
writeFileSync24(logPath(cli), output);
|
|
19796
19822
|
}
|
|
19797
19823
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
19798
19824
|
if (!cli) {
|
|
@@ -19921,7 +19947,7 @@ function registerCliHook(program2) {
|
|
|
19921
19947
|
}
|
|
19922
19948
|
|
|
19923
19949
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
19924
|
-
import { existsSync as existsSync46, readFileSync as readFileSync31, unlinkSync as unlinkSync8, writeFileSync as
|
|
19950
|
+
import { existsSync as existsSync46, readFileSync as readFileSync31, unlinkSync as unlinkSync8, writeFileSync as writeFileSync25 } from "fs";
|
|
19925
19951
|
import chalk120 from "chalk";
|
|
19926
19952
|
|
|
19927
19953
|
// src/shared/isHashCommentFile.ts
|
|
@@ -20029,7 +20055,7 @@ function codeCommentConfirm(pin2) {
|
|
|
20029
20055
|
const indentSource = lines2[index2] ?? "";
|
|
20030
20056
|
const indent3 = indentSource.match(/^\s*/)?.[0] ?? "";
|
|
20031
20057
|
lines2.splice(index2, 0, `${indent3}${marker2} ${state.text}`);
|
|
20032
|
-
|
|
20058
|
+
writeFileSync25(state.file, lines2.join("\n"));
|
|
20033
20059
|
unlinkSync8(getPinStatePath(pin2));
|
|
20034
20060
|
console.log(
|
|
20035
20061
|
chalk120.green(
|
|
@@ -20067,7 +20093,7 @@ function validateCommentText(raw, isHash = false) {
|
|
|
20067
20093
|
}
|
|
20068
20094
|
|
|
20069
20095
|
// src/commands/codeComment/issuePin.ts
|
|
20070
|
-
import { mkdirSync as
|
|
20096
|
+
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync26 } from "fs";
|
|
20071
20097
|
import { randomInt } from "crypto";
|
|
20072
20098
|
|
|
20073
20099
|
// src/commands/notify/showNotification.ts
|
|
@@ -20128,9 +20154,9 @@ function showNotification(options2) {
|
|
|
20128
20154
|
// src/commands/codeComment/issuePin.ts
|
|
20129
20155
|
function issuePin(file, lineNumber, text18) {
|
|
20130
20156
|
const pin2 = generatePin();
|
|
20131
|
-
|
|
20157
|
+
mkdirSync15(getRestrictedDir(), { recursive: true });
|
|
20132
20158
|
sweepRestrictedDir();
|
|
20133
|
-
|
|
20159
|
+
writeFileSync26(
|
|
20134
20160
|
getPinStatePath(pin2),
|
|
20135
20161
|
JSON.stringify({ pin: pin2, file, line: lineNumber, text: text18 })
|
|
20136
20162
|
);
|
|
@@ -21441,18 +21467,137 @@ function unsetLines(key) {
|
|
|
21441
21467
|
return lines2;
|
|
21442
21468
|
}
|
|
21443
21469
|
|
|
21444
|
-
// src/commands/config/
|
|
21470
|
+
// src/commands/config/configImportRepos.ts
|
|
21471
|
+
import chalk136 from "chalk";
|
|
21472
|
+
|
|
21473
|
+
// src/commands/config/exitWithConfigErrors.ts
|
|
21445
21474
|
import chalk134 from "chalk";
|
|
21475
|
+
function exitWithConfigErrors(errors) {
|
|
21476
|
+
for (const error of errors) console.error(chalk134.red(error));
|
|
21477
|
+
process.exit(1);
|
|
21478
|
+
}
|
|
21479
|
+
|
|
21480
|
+
// src/commands/config/diffRepoConfigLeaves.ts
|
|
21481
|
+
import { isDeepStrictEqual } from "util";
|
|
21482
|
+
function diffRepoConfigLeaves(current, incoming) {
|
|
21483
|
+
const existing = new Map(leaves(current));
|
|
21484
|
+
return leaves(incoming).flatMap(([key, to]) => {
|
|
21485
|
+
if (!existing.has(key)) return [{ key, to }];
|
|
21486
|
+
const from = existing.get(key);
|
|
21487
|
+
return isDeepStrictEqual(from, to) ? [] : [{ key, from, to }];
|
|
21488
|
+
});
|
|
21489
|
+
}
|
|
21490
|
+
function leaves(node, prefix2 = "") {
|
|
21491
|
+
return Object.entries(node).flatMap(([key, value]) => {
|
|
21492
|
+
const path106 = prefix2 ? `${prefix2}.${key}` : key;
|
|
21493
|
+
return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value, path106) : [[path106, value]];
|
|
21494
|
+
});
|
|
21495
|
+
}
|
|
21496
|
+
function isPlainObject4(value) {
|
|
21497
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
21498
|
+
}
|
|
21499
|
+
|
|
21500
|
+
// src/commands/config/planRepoConfigImport.ts
|
|
21501
|
+
function planRepoConfigImport(ymlRepos, dbRepos) {
|
|
21502
|
+
return Object.entries(ymlRepos).map(([ymlKey, block]) => {
|
|
21503
|
+
const dbKey = matchDbKey(dbRepos, ymlKey) ?? ymlKey;
|
|
21504
|
+
const current = dbRepos[dbKey] ?? {};
|
|
21505
|
+
const incoming = isPlainObject5(block) ? block : {};
|
|
21506
|
+
const changes = diffRepoConfigLeaves(current, incoming);
|
|
21507
|
+
const merged = changes.reduce(
|
|
21508
|
+
(acc, change) => setNestedValue(acc, change.key, change.to),
|
|
21509
|
+
current
|
|
21510
|
+
);
|
|
21511
|
+
const validation = validateConfig(merged, ymlKey, repoConfigSchema);
|
|
21512
|
+
const errors = validation.ok ? [] : validation.errors.map((error) => `repos.${ymlKey}.${error}`);
|
|
21513
|
+
return { ymlKey, dbKey, changes, merged, errors };
|
|
21514
|
+
});
|
|
21515
|
+
}
|
|
21516
|
+
function matchDbKey(dbRepos, ymlKey) {
|
|
21517
|
+
const ymlCandidates = originKeyCandidates(ymlKey);
|
|
21518
|
+
const matches = Object.keys(dbRepos).filter(
|
|
21519
|
+
(key) => ymlCandidates.has(key) || originKeyCandidates(key).has(ymlKey)
|
|
21520
|
+
);
|
|
21521
|
+
if (matches.length > 1)
|
|
21522
|
+
throw new AmbiguousRepoConfigError(
|
|
21523
|
+
`Ambiguous repos config in ${SHARED_REPO_CONFIG_SOURCE}: keys ${matches.map((m) => `"${m}"`).join(", ")} all match "${ymlKey}". Keep a single key per repository.`
|
|
21524
|
+
);
|
|
21525
|
+
return matches[0];
|
|
21526
|
+
}
|
|
21527
|
+
function isPlainObject5(value) {
|
|
21528
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
21529
|
+
}
|
|
21530
|
+
|
|
21531
|
+
// src/commands/config/printRepoConfigImportPlan.ts
|
|
21532
|
+
import chalk135 from "chalk";
|
|
21533
|
+
function printRepoConfigImportPlan(plans) {
|
|
21534
|
+
for (const plan2 of plans) {
|
|
21535
|
+
const target = plan2.dbKey === plan2.ymlKey ? "" : chalk135.dim(` \u2192 ${plan2.dbKey}`);
|
|
21536
|
+
console.log(chalk135.bold(`repos.${plan2.ymlKey}${target}`));
|
|
21537
|
+
if (plan2.changes.length === 0)
|
|
21538
|
+
console.log(chalk135.dim(" already in the shared db"));
|
|
21539
|
+
for (const change of plan2.changes) {
|
|
21540
|
+
const to = show2(change.key, change.to);
|
|
21541
|
+
console.log(
|
|
21542
|
+
"from" in change ? chalk135.yellow(
|
|
21543
|
+
` ~ ${change.key}: ${show2(change.key, change.from)} \u2192 ${to}`
|
|
21544
|
+
) : chalk135.green(` + ${change.key}: ${to}`)
|
|
21545
|
+
);
|
|
21546
|
+
}
|
|
21547
|
+
}
|
|
21548
|
+
}
|
|
21549
|
+
function show2(key, value) {
|
|
21550
|
+
return JSON.stringify(maskConfigKeySecrets(key, value));
|
|
21551
|
+
}
|
|
21552
|
+
|
|
21553
|
+
// src/commands/config/configImportRepos.ts
|
|
21554
|
+
async function configImportRepos() {
|
|
21555
|
+
const { repos: ymlRepos, ...rest } = loadGlobalConfigRaw();
|
|
21556
|
+
if (!isPlainObject6(ymlRepos) || Object.keys(ymlRepos).length === 0) {
|
|
21557
|
+
console.log("No repos: in ~/.assist.yml to import.");
|
|
21558
|
+
return;
|
|
21559
|
+
}
|
|
21560
|
+
const orm = await getDb();
|
|
21561
|
+
const plans = planRepoConfigImport(ymlRepos, await listRepoConfigs(orm));
|
|
21562
|
+
printRepoConfigImportPlan(plans);
|
|
21563
|
+
const errors = plans.flatMap((plan2) => plan2.errors);
|
|
21564
|
+
if (errors.length > 0) exitWithConfigErrors(errors);
|
|
21565
|
+
const confirmed = await promptConfirm(
|
|
21566
|
+
"Write these keys to the shared db and remove repos: from ~/.assist.yml?",
|
|
21567
|
+
false
|
|
21568
|
+
);
|
|
21569
|
+
if (!confirmed) {
|
|
21570
|
+
console.log("Nothing imported.");
|
|
21571
|
+
return;
|
|
21572
|
+
}
|
|
21573
|
+
const changed = plans.filter((plan2) => plan2.changes.length > 0);
|
|
21574
|
+
for (const plan2 of changed)
|
|
21575
|
+
await saveRepoConfig(orm, plan2.dbKey, plan2.merged);
|
|
21576
|
+
await refreshRepoConfigCache(orm);
|
|
21577
|
+
saveGlobalConfig(rest);
|
|
21578
|
+
const keys = changed.reduce((n, plan2) => n + plan2.changes.length, 0);
|
|
21579
|
+
console.log(
|
|
21580
|
+
chalk136.green(
|
|
21581
|
+
`Imported ${keys} key(s) across ${changed.length} repo(s) and removed repos: from ~/.assist.yml`
|
|
21582
|
+
)
|
|
21583
|
+
);
|
|
21584
|
+
}
|
|
21585
|
+
function isPlainObject6(value) {
|
|
21586
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
21587
|
+
}
|
|
21588
|
+
|
|
21589
|
+
// src/commands/config/configKeys.ts
|
|
21590
|
+
import chalk137 from "chalk";
|
|
21446
21591
|
function configKeys(filter) {
|
|
21447
|
-
const
|
|
21448
|
-
const matches = filter ?
|
|
21592
|
+
const leaves2 = describeConfigLeaves(assistConfigSchema);
|
|
21593
|
+
const matches = filter ? leaves2.filter(matching(filter)) : leaves2;
|
|
21449
21594
|
if (matches.length === 0) {
|
|
21450
|
-
console.error(
|
|
21595
|
+
console.error(chalk137.red(`No config key matches "${filter}"`));
|
|
21451
21596
|
process.exit(1);
|
|
21452
21597
|
}
|
|
21453
|
-
console.log(headline(matches.length,
|
|
21598
|
+
console.log(headline(matches.length, leaves2.length, filter));
|
|
21454
21599
|
console.log(
|
|
21455
|
-
|
|
21600
|
+
chalk137.dim(
|
|
21456
21601
|
"Defaults come from the schema; assist config list shows what is set."
|
|
21457
21602
|
)
|
|
21458
21603
|
);
|
|
@@ -21468,13 +21613,13 @@ function matching(filter) {
|
|
|
21468
21613
|
return (leaf) => leaf.key.toLowerCase().includes(needle);
|
|
21469
21614
|
}
|
|
21470
21615
|
function headline(shown, total, filter) {
|
|
21471
|
-
return filter ?
|
|
21616
|
+
return filter ? chalk137.bold(`${shown} of ${total} config keys matching "${filter}"`) : chalk137.bold(`${total} config keys`);
|
|
21472
21617
|
}
|
|
21473
21618
|
function formatLeaf(leaf, help) {
|
|
21474
21619
|
const meta = [typeText(leaf), `default: ${formatConfigDefault(leaf)}`];
|
|
21475
21620
|
if (leaf.secret) meta.push("secret");
|
|
21476
|
-
const lines2 = [`${
|
|
21477
|
-
if (help) lines2.push(` ${help.note}`, ` ${
|
|
21621
|
+
const lines2 = [`${chalk137.cyan(leaf.key)} ${chalk137.dim(meta.join(" "))}`];
|
|
21622
|
+
if (help) lines2.push(` ${help.note}`, ` ${chalk137.green(help.setter)}`);
|
|
21478
21623
|
return lines2;
|
|
21479
21624
|
}
|
|
21480
21625
|
function typeText(leaf) {
|
|
@@ -21485,77 +21630,7 @@ function typeText(leaf) {
|
|
|
21485
21630
|
}
|
|
21486
21631
|
|
|
21487
21632
|
// src/commands/config/configSet.ts
|
|
21488
|
-
import
|
|
21489
|
-
|
|
21490
|
-
// src/shared/db/listRepoConfigs.ts
|
|
21491
|
-
async function listRepoConfigs(orm) {
|
|
21492
|
-
const rows = await orm.select().from(repoConfigs);
|
|
21493
|
-
return Object.fromEntries(rows.map((row) => [row.repoKey, row.config]));
|
|
21494
|
-
}
|
|
21495
|
-
|
|
21496
|
-
// src/commands/config/resolveSharedRepoBlock.ts
|
|
21497
|
-
async function resolveSharedRepoBlock(orm, repoName, cwd) {
|
|
21498
|
-
const shared = { repos: await listRepoConfigs(orm) };
|
|
21499
|
-
const label2 = repoName === void 0 ? currentRepoLabel(shared, getCurrentOrigin(cwd)) : resolveNamedRepoWriteLabel(shared, repoName, SHARED_REPO_CONFIG_SOURCE);
|
|
21500
|
-
return { label: label2, block: shared.repos[label2] ?? {} };
|
|
21501
|
-
}
|
|
21502
|
-
function currentRepoLabel(shared, origin) {
|
|
21503
|
-
return matchRepoConfigKey(shared, origin, SHARED_REPO_CONFIG_SOURCE) ?? origin;
|
|
21504
|
-
}
|
|
21505
|
-
|
|
21506
|
-
// src/shared/db/saveRepoConfig.ts
|
|
21507
|
-
import { eq as eq45 } from "drizzle-orm";
|
|
21508
|
-
async function saveRepoConfig(orm, repoKey, config) {
|
|
21509
|
-
if (Object.keys(config).length === 0) {
|
|
21510
|
-
await orm.delete(repoConfigs).where(eq45(repoConfigs.repoKey, repoKey));
|
|
21511
|
-
return;
|
|
21512
|
-
}
|
|
21513
|
-
await orm.insert(repoConfigs).values({ repoKey, config }).onConflictDoUpdate({
|
|
21514
|
-
target: repoConfigs.repoKey,
|
|
21515
|
-
set: { config, updatedAt: /* @__PURE__ */ new Date() }
|
|
21516
|
-
});
|
|
21517
|
-
}
|
|
21518
|
-
|
|
21519
|
-
// src/shared/writeRepoConfigCache.ts
|
|
21520
|
-
import { mkdirSync as mkdirSync15, renameSync as renameSync2, writeFileSync as writeFileSync26 } from "fs";
|
|
21521
|
-
import { dirname as dirname26 } from "path";
|
|
21522
|
-
function writeRepoConfigCache(repos2) {
|
|
21523
|
-
const path106 = repoConfigCachePath();
|
|
21524
|
-
mkdirSync15(dirname26(path106), { recursive: true });
|
|
21525
|
-
const cache6 = {
|
|
21526
|
-
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
21527
|
-
repos: repos2
|
|
21528
|
-
};
|
|
21529
|
-
const tmp = `${path106}.${process.pid}.tmp`;
|
|
21530
|
-
writeFileSync26(tmp, JSON.stringify(cache6, null, 2));
|
|
21531
|
-
renameSync2(tmp, path106);
|
|
21532
|
-
}
|
|
21533
|
-
|
|
21534
|
-
// src/shared/refreshRepoConfigCache.ts
|
|
21535
|
-
async function refreshRepoConfigCache(orm) {
|
|
21536
|
-
const repos2 = await listRepoConfigs(orm ?? await getDb());
|
|
21537
|
-
writeRepoConfigCache(repos2);
|
|
21538
|
-
return Object.keys(repos2).length;
|
|
21539
|
-
}
|
|
21540
|
-
|
|
21541
|
-
// src/commands/config/saveSharedRepoBlock.ts
|
|
21542
|
-
async function saveSharedRepoBlock(orm, label2, block) {
|
|
21543
|
-
await saveRepoConfig(orm, label2, block);
|
|
21544
|
-
await refreshRepoConfigCache(orm);
|
|
21545
|
-
}
|
|
21546
|
-
|
|
21547
|
-
// src/commands/config/applySharedRepoConfigSet.ts
|
|
21548
|
-
async function applySharedRepoConfigSet(key, coerced, repoName, cwd = process.cwd()) {
|
|
21549
|
-
const globalOnly = globalOnlyRepoKeyError(key, "Set");
|
|
21550
|
-
if (globalOnly) return globalOnly;
|
|
21551
|
-
const orm = await getDb();
|
|
21552
|
-
const { label: label2, block } = await resolveSharedRepoBlock(orm, repoName, cwd);
|
|
21553
|
-
const updatedBlock = setNestedValue(block, key, coerced);
|
|
21554
|
-
const validation = validateConfig(updatedBlock, key, repoConfigSchema);
|
|
21555
|
-
if (!validation.ok) return validation;
|
|
21556
|
-
await saveSharedRepoBlock(orm, label2, updatedBlock);
|
|
21557
|
-
return { ok: true, target: "repo", label: label2 };
|
|
21558
|
-
}
|
|
21633
|
+
import chalk138 from "chalk";
|
|
21559
21634
|
|
|
21560
21635
|
// src/commands/config/coerceCliConfigValue.ts
|
|
21561
21636
|
function coerceCliConfigValue(key, raw) {
|
|
@@ -21575,13 +21650,6 @@ function coerceWithoutSchemaLeaf(raw) {
|
|
|
21575
21650
|
return raw;
|
|
21576
21651
|
}
|
|
21577
21652
|
|
|
21578
|
-
// src/commands/config/exitWithConfigErrors.ts
|
|
21579
|
-
import chalk135 from "chalk";
|
|
21580
|
-
function exitWithConfigErrors(errors) {
|
|
21581
|
-
for (const error of errors) console.error(chalk135.red(error));
|
|
21582
|
-
process.exit(1);
|
|
21583
|
-
}
|
|
21584
|
-
|
|
21585
21653
|
// src/commands/config/resolveRepoTarget.ts
|
|
21586
21654
|
function resolveRepoTarget(key, value, repo) {
|
|
21587
21655
|
if (typeof repo === "string") {
|
|
@@ -21597,13 +21665,13 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
21597
21665
|
async function configSet(key, value, options2 = {}) {
|
|
21598
21666
|
if (options2.repo !== void 0 && !options2.global) {
|
|
21599
21667
|
console.error(
|
|
21600
|
-
|
|
21668
|
+
chalk138.red("--repo writes to the global config; add -g (e.g. -g --repo)")
|
|
21601
21669
|
);
|
|
21602
21670
|
process.exit(1);
|
|
21603
21671
|
}
|
|
21604
21672
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
21605
21673
|
if (resolved.value === void 0) {
|
|
21606
|
-
console.error(
|
|
21674
|
+
console.error(chalk138.red(`Missing required argument for '${resolved.key}'`));
|
|
21607
21675
|
process.exit(1);
|
|
21608
21676
|
}
|
|
21609
21677
|
const coercion = coerceCliConfigValue(resolved.key, resolved.value);
|
|
@@ -21611,7 +21679,7 @@ async function configSet(key, value, options2 = {}) {
|
|
|
21611
21679
|
const coerced = coercion.value;
|
|
21612
21680
|
const target = resolved.useRepo ? `repo: ${await applyRepoOrExit(resolved.key, coerced, resolved.repoName)}` : applyOrExit(resolved.key, coerced, options2.global ?? false);
|
|
21613
21681
|
const shown = JSON.stringify(maskConfigKeySecrets(resolved.key, coerced));
|
|
21614
|
-
console.log(
|
|
21682
|
+
console.log(chalk138.green(`Set ${resolved.key} = ${shown} (${target})`));
|
|
21615
21683
|
}
|
|
21616
21684
|
function applyOrExit(key, coerced, global) {
|
|
21617
21685
|
const result = applyConfigSet(key, coerced, global);
|
|
@@ -21625,19 +21693,7 @@ async function applyRepoOrExit(key, coerced, repoName) {
|
|
|
21625
21693
|
}
|
|
21626
21694
|
|
|
21627
21695
|
// src/commands/config/configUnset.ts
|
|
21628
|
-
import
|
|
21629
|
-
|
|
21630
|
-
// src/commands/config/applySharedRepoConfigUnset.ts
|
|
21631
|
-
async function applySharedRepoConfigUnset(key, repoName, cwd = process.cwd()) {
|
|
21632
|
-
const globalOnly = globalOnlyRepoKeyError(key, "Unset");
|
|
21633
|
-
if (globalOnly) return globalOnly;
|
|
21634
|
-
const orm = await getDb();
|
|
21635
|
-
const { label: label2, block } = await resolveSharedRepoBlock(orm, repoName, cwd);
|
|
21636
|
-
const unset = unsetRepoBlockKey(block, key);
|
|
21637
|
-
if (!unset.ok) return unset;
|
|
21638
|
-
if (unset.removed) await saveSharedRepoBlock(orm, label2, unset.block);
|
|
21639
|
-
return { ok: true, target: "repo", label: label2, removed: unset.removed };
|
|
21640
|
-
}
|
|
21696
|
+
import chalk139 from "chalk";
|
|
21641
21697
|
|
|
21642
21698
|
// src/commands/config/resolveRepoUnsetTarget.ts
|
|
21643
21699
|
function resolveRepoUnsetTarget(key, repo) {
|
|
@@ -21653,7 +21709,7 @@ function resolveRepoUnsetTarget(key, repo) {
|
|
|
21653
21709
|
async function configUnset(key, options2 = {}) {
|
|
21654
21710
|
if (options2.repo !== void 0 && !options2.global) {
|
|
21655
21711
|
console.error(
|
|
21656
|
-
|
|
21712
|
+
chalk139.red(
|
|
21657
21713
|
"--repo removes from the global config; add -g (e.g. -g --repo)"
|
|
21658
21714
|
)
|
|
21659
21715
|
);
|
|
@@ -21661,7 +21717,7 @@ async function configUnset(key, options2 = {}) {
|
|
|
21661
21717
|
}
|
|
21662
21718
|
const resolved = resolveRepoUnsetTarget(key, options2.repo);
|
|
21663
21719
|
if (resolved.key === void 0) {
|
|
21664
|
-
console.error(
|
|
21720
|
+
console.error(chalk139.red("Missing required argument 'key'"));
|
|
21665
21721
|
process.exit(1);
|
|
21666
21722
|
return;
|
|
21667
21723
|
}
|
|
@@ -21669,11 +21725,11 @@ async function configUnset(key, options2 = {}) {
|
|
|
21669
21725
|
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
21670
21726
|
if (!result.removed) {
|
|
21671
21727
|
console.log(
|
|
21672
|
-
|
|
21728
|
+
chalk139.yellow(`${resolved.key} is not set in ${whereLabel(result)}`)
|
|
21673
21729
|
);
|
|
21674
21730
|
return;
|
|
21675
21731
|
}
|
|
21676
|
-
console.log(
|
|
21732
|
+
console.log(chalk139.green(`Unset ${resolved.key} (${targetLabel(result)})`));
|
|
21677
21733
|
}
|
|
21678
21734
|
function whereLabel(result) {
|
|
21679
21735
|
return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
|
|
@@ -21697,6 +21753,9 @@ function registerConfig(program2) {
|
|
|
21697
21753
|
"-r, --repo [name]",
|
|
21698
21754
|
"Requires -g: remove the key from a repo's shared db override (defaults to the current repo)"
|
|
21699
21755
|
).action((key, options2) => configUnset(key, options2));
|
|
21756
|
+
configCommand.command("import-repos").description(
|
|
21757
|
+
"Move this machine's ~/.assist.yml repos: overrides into the shared db, showing a per-key diff and asking first"
|
|
21758
|
+
).action(configImportRepos);
|
|
21700
21759
|
configCommand.command("get <key>").description("Get a config value (secrets print as <hidden>)").option("--reveal", "Print the raw value of a secret, undecorated").action((key, options2) => configGet(key, options2));
|
|
21701
21760
|
configCommand.command("list").description(
|
|
21702
21761
|
"List the config values that are set (secrets print as <hidden>); see 'config keys' for every key"
|
|
@@ -21708,7 +21767,7 @@ function registerConfig(program2) {
|
|
|
21708
21767
|
|
|
21709
21768
|
// src/commands/criteriaExtension/criteriaExtension.ts
|
|
21710
21769
|
import { cp } from "fs/promises";
|
|
21711
|
-
import
|
|
21770
|
+
import chalk140 from "chalk";
|
|
21712
21771
|
|
|
21713
21772
|
// src/commands/criteriaExtension/criteriaExtensionDir.ts
|
|
21714
21773
|
import { existsSync as existsSync47 } from "fs";
|
|
@@ -21736,7 +21795,7 @@ async function loadPath(source) {
|
|
|
21736
21795
|
return WSL_WINDOWS_PATH;
|
|
21737
21796
|
} catch {
|
|
21738
21797
|
console.log(
|
|
21739
|
-
|
|
21798
|
+
chalk140.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
21740
21799
|
);
|
|
21741
21800
|
return source;
|
|
21742
21801
|
}
|
|
@@ -21744,15 +21803,15 @@ async function loadPath(source) {
|
|
|
21744
21803
|
async function criteriaExtension() {
|
|
21745
21804
|
const path106 = await loadPath(criteriaExtensionDir());
|
|
21746
21805
|
console.log(
|
|
21747
|
-
|
|
21806
|
+
chalk140.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
21748
21807
|
);
|
|
21749
|
-
console.log(
|
|
21808
|
+
console.log(chalk140.dim(`load the unpacked extension from ${path106}`));
|
|
21750
21809
|
}
|
|
21751
21810
|
|
|
21752
21811
|
// src/commands/criteriaExtension/printCriteriaExtensionUrl.ts
|
|
21753
21812
|
import { readFile as readFile4 } from "fs/promises";
|
|
21754
21813
|
import { join as join52 } from "path";
|
|
21755
|
-
import
|
|
21814
|
+
import chalk141 from "chalk";
|
|
21756
21815
|
|
|
21757
21816
|
// src/commands/criteriaExtension/latestUpdate.ts
|
|
21758
21817
|
function latestUpdate(manifest, updates2) {
|
|
@@ -21775,7 +21834,7 @@ async function printCriteriaExtensionUrl() {
|
|
|
21775
21834
|
const response = await fetch(update_url);
|
|
21776
21835
|
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
21777
21836
|
if (!link3) {
|
|
21778
|
-
console.log(
|
|
21837
|
+
console.log(chalk141.red(`no signed build found in ${update_url}`));
|
|
21779
21838
|
process.exitCode = 1;
|
|
21780
21839
|
return;
|
|
21781
21840
|
}
|
|
@@ -21786,7 +21845,7 @@ async function printCriteriaExtensionUrl() {
|
|
|
21786
21845
|
import { rm as rm2 } from "fs/promises";
|
|
21787
21846
|
import { homedir as homedir21, tmpdir as tmpdir3 } from "os";
|
|
21788
21847
|
import { join as join58 } from "path";
|
|
21789
|
-
import
|
|
21848
|
+
import chalk143 from "chalk";
|
|
21790
21849
|
|
|
21791
21850
|
// src/commands/criteriaExtension/copySignedXpi.ts
|
|
21792
21851
|
import { copyFile } from "fs/promises";
|
|
@@ -21811,7 +21870,7 @@ async function findSignedXpi(dir) {
|
|
|
21811
21870
|
|
|
21812
21871
|
// src/commands/criteriaExtension/signedAddonInstallPath.ts
|
|
21813
21872
|
import { cp as cp2 } from "fs/promises";
|
|
21814
|
-
import
|
|
21873
|
+
import chalk142 from "chalk";
|
|
21815
21874
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/criteria-extension.xpi";
|
|
21816
21875
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\criteria-extension.xpi`;
|
|
21817
21876
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -21821,7 +21880,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
21821
21880
|
return WSL_WINDOWS_PATH2;
|
|
21822
21881
|
} catch {
|
|
21823
21882
|
console.log(
|
|
21824
|
-
|
|
21883
|
+
chalk142.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
21825
21884
|
);
|
|
21826
21885
|
return xpi;
|
|
21827
21886
|
}
|
|
@@ -21914,15 +21973,15 @@ async function signCriteriaExtension() {
|
|
|
21914
21973
|
const source = criteriaExtensionDir();
|
|
21915
21974
|
const problem = signPreflightProblem(source);
|
|
21916
21975
|
if (problem) {
|
|
21917
|
-
console.log(
|
|
21918
|
-
console.log(
|
|
21976
|
+
console.log(chalk143.red(problem.message));
|
|
21977
|
+
console.log(chalk143.dim(problem.hint));
|
|
21919
21978
|
process.exitCode = 1;
|
|
21920
21979
|
return;
|
|
21921
21980
|
}
|
|
21922
21981
|
const { version: version2 } = package_default;
|
|
21923
21982
|
await stageCriteriaExtension(source, STAGING_DIR, version2);
|
|
21924
21983
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
21925
|
-
console.log(
|
|
21984
|
+
console.log(chalk143.bold(`signing version ${version2} for self-distribution`));
|
|
21926
21985
|
const { done: done2 } = spawnInherit("npx", [
|
|
21927
21986
|
"--yes",
|
|
21928
21987
|
"web-ext",
|
|
@@ -21932,13 +21991,13 @@ async function signCriteriaExtension() {
|
|
|
21932
21991
|
"--channel=unlisted"
|
|
21933
21992
|
]);
|
|
21934
21993
|
if (await done2 !== 0) {
|
|
21935
|
-
console.log(
|
|
21994
|
+
console.log(chalk143.red("web-ext sign failed"));
|
|
21936
21995
|
process.exitCode = 1;
|
|
21937
21996
|
return;
|
|
21938
21997
|
}
|
|
21939
21998
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
21940
21999
|
if (!xpi) {
|
|
21941
|
-
console.log(
|
|
22000
|
+
console.log(chalk143.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
21942
22001
|
process.exitCode = 1;
|
|
21943
22002
|
return;
|
|
21944
22003
|
}
|
|
@@ -21946,7 +22005,7 @@ async function signCriteriaExtension() {
|
|
|
21946
22005
|
const path106 = await signedAddonInstallPath(
|
|
21947
22006
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
21948
22007
|
);
|
|
21949
|
-
console.log(
|
|
22008
|
+
console.log(chalk143.dim(`install the signed add-on from ${path106}`));
|
|
21950
22009
|
}
|
|
21951
22010
|
|
|
21952
22011
|
// src/commands/registerCriteriaExtension.ts
|
|
@@ -22007,11 +22066,11 @@ async function dropRetiredTables(exec3) {
|
|
|
22007
22066
|
}
|
|
22008
22067
|
|
|
22009
22068
|
// src/commands/db/reportRetiredTables.ts
|
|
22010
|
-
import
|
|
22069
|
+
import chalk144 from "chalk";
|
|
22011
22070
|
function reportRetiredTables(tables) {
|
|
22012
22071
|
for (const table of tables) {
|
|
22013
22072
|
console.error(
|
|
22014
|
-
|
|
22073
|
+
chalk144.yellow(
|
|
22015
22074
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
22016
22075
|
)
|
|
22017
22076
|
);
|
|
@@ -22019,40 +22078,40 @@ function reportRetiredTables(tables) {
|
|
|
22019
22078
|
}
|
|
22020
22079
|
|
|
22021
22080
|
// src/commands/db/reportMigrationStatus.ts
|
|
22022
|
-
import
|
|
22081
|
+
import chalk145 from "chalk";
|
|
22023
22082
|
function reportApplied(applied) {
|
|
22024
22083
|
if (applied.length === 0) {
|
|
22025
|
-
console.error(
|
|
22084
|
+
console.error(chalk145.green("Database is up to date; nothing to apply."));
|
|
22026
22085
|
return;
|
|
22027
22086
|
}
|
|
22028
22087
|
for (const migration of applied) {
|
|
22029
22088
|
console.error(
|
|
22030
|
-
|
|
22089
|
+
chalk145.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
22031
22090
|
);
|
|
22032
22091
|
}
|
|
22033
22092
|
}
|
|
22034
22093
|
function reportMigrationStatus(status2) {
|
|
22035
22094
|
if (status2.state === "in-sync") {
|
|
22036
22095
|
console.error(
|
|
22037
|
-
|
|
22096
|
+
chalk145.green(`In sync at migration ${status2.version} (latest).`)
|
|
22038
22097
|
);
|
|
22039
22098
|
return;
|
|
22040
22099
|
}
|
|
22041
22100
|
if (status2.state === "behind") {
|
|
22042
22101
|
console.error(
|
|
22043
|
-
|
|
22102
|
+
chalk145.yellow(
|
|
22044
22103
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
22045
22104
|
)
|
|
22046
22105
|
);
|
|
22047
22106
|
console.error(
|
|
22048
|
-
|
|
22107
|
+
chalk145.yellow(
|
|
22049
22108
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
22050
22109
|
)
|
|
22051
22110
|
);
|
|
22052
22111
|
return;
|
|
22053
22112
|
}
|
|
22054
22113
|
console.error(
|
|
22055
|
-
|
|
22114
|
+
chalk145.red(
|
|
22056
22115
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
22057
22116
|
)
|
|
22058
22117
|
);
|
|
@@ -22094,7 +22153,7 @@ function registerDb(program2) {
|
|
|
22094
22153
|
|
|
22095
22154
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
22096
22155
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync27 } from "fs";
|
|
22097
|
-
import
|
|
22156
|
+
import chalk146 from "chalk";
|
|
22098
22157
|
|
|
22099
22158
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
22100
22159
|
import { join as join59 } from "path";
|
|
@@ -22125,7 +22184,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
22125
22184
|
sweepRestrictedDir();
|
|
22126
22185
|
const state = readMigrationPinState(pin2);
|
|
22127
22186
|
if (!state) {
|
|
22128
|
-
console.error(
|
|
22187
|
+
console.error(chalk146.red(`No pending migration unlock for pin: ${pin2}`));
|
|
22129
22188
|
process.exitCode = 1;
|
|
22130
22189
|
return;
|
|
22131
22190
|
}
|
|
@@ -22135,7 +22194,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
22135
22194
|
);
|
|
22136
22195
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
22137
22196
|
console.log(
|
|
22138
|
-
|
|
22197
|
+
chalk146.green(
|
|
22139
22198
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
22140
22199
|
)
|
|
22141
22200
|
);
|
|
@@ -22144,7 +22203,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
22144
22203
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
22145
22204
|
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync28 } from "fs";
|
|
22146
22205
|
import { randomInt as randomInt2 } from "crypto";
|
|
22147
|
-
import
|
|
22206
|
+
import chalk147 from "chalk";
|
|
22148
22207
|
|
|
22149
22208
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
22150
22209
|
function nextMigrationId() {
|
|
@@ -22159,7 +22218,7 @@ function dbMigrationUnlock() {
|
|
|
22159
22218
|
sweepRestrictedDir();
|
|
22160
22219
|
writeFileSync28(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
22161
22220
|
console.error(
|
|
22162
|
-
|
|
22221
|
+
chalk147.yellow.bold(
|
|
22163
22222
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
22164
22223
|
)
|
|
22165
22224
|
);
|
|
@@ -22169,7 +22228,7 @@ function dbMigrationUnlock() {
|
|
|
22169
22228
|
});
|
|
22170
22229
|
if (!delivered) {
|
|
22171
22230
|
console.error(
|
|
22172
|
-
|
|
22231
|
+
chalk147.red(
|
|
22173
22232
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
22174
22233
|
)
|
|
22175
22234
|
);
|
|
@@ -22179,7 +22238,7 @@ function dbMigrationUnlock() {
|
|
|
22179
22238
|
console.log(
|
|
22180
22239
|
`A confirmation pin was sent to your desktop notifications.
|
|
22181
22240
|
To approve creating migration ${migrationId}, run:
|
|
22182
|
-
${
|
|
22241
|
+
${chalk147.cyan(" assist db-migration confirm <PIN>")}
|
|
22183
22242
|
using the pin from that notification.`
|
|
22184
22243
|
);
|
|
22185
22244
|
}
|
|
@@ -22199,7 +22258,7 @@ function registerDbMigration(parent) {
|
|
|
22199
22258
|
|
|
22200
22259
|
// src/commands/deploy/redirect.ts
|
|
22201
22260
|
import { existsSync as existsSync51, readFileSync as readFileSync33, writeFileSync as writeFileSync29 } from "fs";
|
|
22202
|
-
import
|
|
22261
|
+
import chalk148 from "chalk";
|
|
22203
22262
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
22204
22263
|
if (!window.location.pathname.endsWith('/')) {
|
|
22205
22264
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -22208,23 +22267,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
22208
22267
|
function redirect() {
|
|
22209
22268
|
const indexPath = "index.html";
|
|
22210
22269
|
if (!existsSync51(indexPath)) {
|
|
22211
|
-
console.log(
|
|
22270
|
+
console.log(chalk148.yellow("No index.html found"));
|
|
22212
22271
|
return;
|
|
22213
22272
|
}
|
|
22214
22273
|
const content = readFileSync33(indexPath, "utf8");
|
|
22215
22274
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
22216
|
-
console.log(
|
|
22275
|
+
console.log(chalk148.dim("Trailing slash script already present"));
|
|
22217
22276
|
return;
|
|
22218
22277
|
}
|
|
22219
22278
|
const headCloseIndex = content.indexOf("</head>");
|
|
22220
22279
|
if (headCloseIndex === -1) {
|
|
22221
|
-
console.log(
|
|
22280
|
+
console.log(chalk148.red("Could not find </head> tag in index.html"));
|
|
22222
22281
|
return;
|
|
22223
22282
|
}
|
|
22224
22283
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
22225
22284
|
${content.slice(headCloseIndex)}`;
|
|
22226
22285
|
writeFileSync29(indexPath, newContent);
|
|
22227
|
-
console.log(
|
|
22286
|
+
console.log(chalk148.green("Added trailing slash redirect to index.html"));
|
|
22228
22287
|
}
|
|
22229
22288
|
|
|
22230
22289
|
// src/commands/registerDeploy.ts
|
|
@@ -22251,7 +22310,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
22251
22310
|
|
|
22252
22311
|
// src/commands/devlog/shared.ts
|
|
22253
22312
|
import { execSync as execSync31 } from "child_process";
|
|
22254
|
-
import
|
|
22313
|
+
import chalk149 from "chalk";
|
|
22255
22314
|
|
|
22256
22315
|
// src/shared/getRepoName.ts
|
|
22257
22316
|
import { existsSync as existsSync52, readFileSync as readFileSync34 } from "fs";
|
|
@@ -22360,13 +22419,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
22360
22419
|
}
|
|
22361
22420
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
22362
22421
|
for (const commit2 of commits2) {
|
|
22363
|
-
console.log(` ${
|
|
22422
|
+
console.log(` ${chalk149.yellow(commit2.hash)} ${commit2.message}`);
|
|
22364
22423
|
if (verbose) {
|
|
22365
22424
|
const visibleFiles = commit2.files.filter(
|
|
22366
22425
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
22367
22426
|
);
|
|
22368
22427
|
for (const file of visibleFiles) {
|
|
22369
|
-
console.log(` ${
|
|
22428
|
+
console.log(` ${chalk149.dim(file)}`);
|
|
22370
22429
|
}
|
|
22371
22430
|
}
|
|
22372
22431
|
}
|
|
@@ -22391,15 +22450,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
22391
22450
|
}
|
|
22392
22451
|
|
|
22393
22452
|
// src/commands/devlog/list/printDateHeader.ts
|
|
22394
|
-
import
|
|
22453
|
+
import chalk150 from "chalk";
|
|
22395
22454
|
function printDateHeader(date, isSkipped, entries) {
|
|
22396
22455
|
if (isSkipped) {
|
|
22397
|
-
console.log(`${
|
|
22456
|
+
console.log(`${chalk150.bold.blue(date)} ${chalk150.dim("skipped")}`);
|
|
22398
22457
|
} else if (entries && entries.length > 0) {
|
|
22399
|
-
const entryInfo = entries.map((e) => `${
|
|
22400
|
-
console.log(`${
|
|
22458
|
+
const entryInfo = entries.map((e) => `${chalk150.green(e.version)} ${e.title}`).join(" | ");
|
|
22459
|
+
console.log(`${chalk150.bold.blue(date)} ${entryInfo}`);
|
|
22401
22460
|
} else {
|
|
22402
|
-
console.log(`${
|
|
22461
|
+
console.log(`${chalk150.bold.blue(date)} ${chalk150.red("\u26A0 devlog missing")}`);
|
|
22403
22462
|
}
|
|
22404
22463
|
}
|
|
22405
22464
|
|
|
@@ -22503,24 +22562,24 @@ function bumpVersion(version2, type) {
|
|
|
22503
22562
|
|
|
22504
22563
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
22505
22564
|
import { execFileSync as execFileSync8 } from "child_process";
|
|
22506
|
-
import
|
|
22565
|
+
import chalk152 from "chalk";
|
|
22507
22566
|
|
|
22508
22567
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
22509
|
-
import
|
|
22568
|
+
import chalk151 from "chalk";
|
|
22510
22569
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
22511
22570
|
if (conventional && firstHash) {
|
|
22512
22571
|
const version2 = getVersionAtCommit(firstHash);
|
|
22513
22572
|
if (version2) {
|
|
22514
|
-
console.log(`${
|
|
22573
|
+
console.log(`${chalk151.bold("version:")} ${stripToMinor(version2)}`);
|
|
22515
22574
|
} else {
|
|
22516
|
-
console.log(`${
|
|
22575
|
+
console.log(`${chalk151.bold("version:")} ${chalk151.red("unknown")}`);
|
|
22517
22576
|
}
|
|
22518
22577
|
} else if (patchVersion && minorVersion) {
|
|
22519
22578
|
console.log(
|
|
22520
|
-
`${
|
|
22579
|
+
`${chalk151.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
22521
22580
|
);
|
|
22522
22581
|
} else {
|
|
22523
|
-
console.log(`${
|
|
22582
|
+
console.log(`${chalk151.bold("version:")} v0.1 (initial)`);
|
|
22524
22583
|
}
|
|
22525
22584
|
}
|
|
22526
22585
|
|
|
@@ -22568,16 +22627,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
22568
22627
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
22569
22628
|
}
|
|
22570
22629
|
function logName(repoName) {
|
|
22571
|
-
console.log(`${
|
|
22630
|
+
console.log(`${chalk152.bold("name:")} ${repoName}`);
|
|
22572
22631
|
}
|
|
22573
22632
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
22574
22633
|
logName(ctx.repoName);
|
|
22575
22634
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
22576
|
-
console.log(
|
|
22635
|
+
console.log(chalk152.bold.blue(targetDate));
|
|
22577
22636
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
22578
22637
|
}
|
|
22579
22638
|
function logNoCommits(lastInfo) {
|
|
22580
|
-
console.log(
|
|
22639
|
+
console.log(chalk152.dim(noCommitsMessage(!!lastInfo)));
|
|
22581
22640
|
}
|
|
22582
22641
|
|
|
22583
22642
|
// src/commands/devlog/next.ts
|
|
@@ -22618,11 +22677,11 @@ function next2(options2) {
|
|
|
22618
22677
|
import { execSync as execSync33 } from "child_process";
|
|
22619
22678
|
|
|
22620
22679
|
// src/commands/devlog/repos/printReposTable.ts
|
|
22621
|
-
import
|
|
22680
|
+
import chalk153 from "chalk";
|
|
22622
22681
|
function colorStatus(status2) {
|
|
22623
|
-
if (status2 === "missing") return
|
|
22624
|
-
if (status2 === "outdated") return
|
|
22625
|
-
return
|
|
22682
|
+
if (status2 === "missing") return chalk153.red(status2);
|
|
22683
|
+
if (status2 === "outdated") return chalk153.yellow(status2);
|
|
22684
|
+
return chalk153.green(status2);
|
|
22626
22685
|
}
|
|
22627
22686
|
function formatRow(row, nameWidth) {
|
|
22628
22687
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -22636,8 +22695,8 @@ function printReposTable(rows) {
|
|
|
22636
22695
|
"Last Devlog".padEnd(11),
|
|
22637
22696
|
"Status"
|
|
22638
22697
|
].join(" ");
|
|
22639
|
-
console.log(
|
|
22640
|
-
console.log(
|
|
22698
|
+
console.log(chalk153.dim(header));
|
|
22699
|
+
console.log(chalk153.dim("-".repeat(header.length)));
|
|
22641
22700
|
for (const row of rows) {
|
|
22642
22701
|
console.log(formatRow(row, nameWidth));
|
|
22643
22702
|
}
|
|
@@ -22695,14 +22754,14 @@ function repos(options2) {
|
|
|
22695
22754
|
// src/commands/devlog/skip.ts
|
|
22696
22755
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
22697
22756
|
import { join as join63 } from "path";
|
|
22698
|
-
import
|
|
22757
|
+
import chalk154 from "chalk";
|
|
22699
22758
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
22700
22759
|
function getBlogConfigPath() {
|
|
22701
22760
|
return join63(BLOG_REPO_ROOT, "assist.yml");
|
|
22702
22761
|
}
|
|
22703
22762
|
function skip(date) {
|
|
22704
22763
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
22705
|
-
console.log(
|
|
22764
|
+
console.log(chalk154.red("Invalid date format. Use YYYY-MM-DD"));
|
|
22706
22765
|
process.exit(1);
|
|
22707
22766
|
}
|
|
22708
22767
|
const repoName = getRepoName();
|
|
@@ -22713,7 +22772,7 @@ function skip(date) {
|
|
|
22713
22772
|
const skipDays = skip2[repoName] ?? [];
|
|
22714
22773
|
if (skipDays.includes(date)) {
|
|
22715
22774
|
console.log(
|
|
22716
|
-
|
|
22775
|
+
chalk154.yellow(`${date} is already in skip list for ${repoName}`)
|
|
22717
22776
|
);
|
|
22718
22777
|
return;
|
|
22719
22778
|
}
|
|
@@ -22723,20 +22782,20 @@ function skip(date) {
|
|
|
22723
22782
|
devlog.skip = skip2;
|
|
22724
22783
|
config.devlog = devlog;
|
|
22725
22784
|
writeFileSync30(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
22726
|
-
console.log(
|
|
22785
|
+
console.log(chalk154.green(`Added ${date} to skip list for ${repoName}`));
|
|
22727
22786
|
}
|
|
22728
22787
|
|
|
22729
22788
|
// src/commands/devlog/version.ts
|
|
22730
|
-
import
|
|
22789
|
+
import chalk155 from "chalk";
|
|
22731
22790
|
function version() {
|
|
22732
22791
|
const config = loadConfig();
|
|
22733
22792
|
const name = getRepoName();
|
|
22734
22793
|
const lastInfo = getLastVersionInfo(name, config);
|
|
22735
22794
|
const lastVersion = lastInfo?.version ?? null;
|
|
22736
22795
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
22737
|
-
console.log(`${
|
|
22738
|
-
console.log(`${
|
|
22739
|
-
console.log(`${
|
|
22796
|
+
console.log(`${chalk155.bold("name:")} ${name}`);
|
|
22797
|
+
console.log(`${chalk155.bold("last:")} ${lastVersion ?? chalk155.dim("none")}`);
|
|
22798
|
+
console.log(`${chalk155.bold("next:")} ${nextVersion ?? chalk155.dim("none")}`);
|
|
22740
22799
|
}
|
|
22741
22800
|
|
|
22742
22801
|
// src/commands/registerDevlog.ts
|
|
@@ -22761,7 +22820,7 @@ function registerDevlog(program2) {
|
|
|
22761
22820
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
22762
22821
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync8 } from "fs";
|
|
22763
22822
|
import { join as join64 } from "path";
|
|
22764
|
-
import
|
|
22823
|
+
import chalk156 from "chalk";
|
|
22765
22824
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
22766
22825
|
function isLockedDll(debugDir) {
|
|
22767
22826
|
let files;
|
|
@@ -22808,14 +22867,14 @@ function checkBuildLocks(startDir) {
|
|
|
22808
22867
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
22809
22868
|
if (locked) {
|
|
22810
22869
|
console.error(
|
|
22811
|
-
|
|
22870
|
+
chalk156.red("Build output locked (is VS debugging?): ") + locked
|
|
22812
22871
|
);
|
|
22813
22872
|
process.exit(1);
|
|
22814
22873
|
}
|
|
22815
22874
|
}
|
|
22816
22875
|
async function checkBuildLocksCommand() {
|
|
22817
22876
|
checkBuildLocks();
|
|
22818
|
-
console.log(
|
|
22877
|
+
console.log(chalk156.green("No build locks detected"));
|
|
22819
22878
|
}
|
|
22820
22879
|
|
|
22821
22880
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -22914,30 +22973,30 @@ function escapeRegex(s) {
|
|
|
22914
22973
|
}
|
|
22915
22974
|
|
|
22916
22975
|
// src/commands/dotnet/printTree.ts
|
|
22917
|
-
import
|
|
22976
|
+
import chalk157 from "chalk";
|
|
22918
22977
|
function printNodes(nodes, prefix2) {
|
|
22919
22978
|
for (let i = 0; i < nodes.length; i++) {
|
|
22920
22979
|
const isLast = i === nodes.length - 1;
|
|
22921
22980
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
22922
22981
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
22923
22982
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
22924
|
-
const label2 = isMissing ?
|
|
22983
|
+
const label2 = isMissing ? chalk157.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
22925
22984
|
console.log(`${prefix2}${connector}${label2}`);
|
|
22926
22985
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
22927
22986
|
}
|
|
22928
22987
|
}
|
|
22929
22988
|
function printTree(tree, totalCount, solutions) {
|
|
22930
|
-
console.log(
|
|
22931
|
-
console.log(
|
|
22989
|
+
console.log(chalk157.bold("\nProject Dependency Tree"));
|
|
22990
|
+
console.log(chalk157.cyan(tree.relativePath));
|
|
22932
22991
|
printNodes(tree.children, "");
|
|
22933
|
-
console.log(
|
|
22992
|
+
console.log(chalk157.dim(`
|
|
22934
22993
|
${totalCount} projects total (including root)`));
|
|
22935
|
-
console.log(
|
|
22994
|
+
console.log(chalk157.bold("\nSolution Membership"));
|
|
22936
22995
|
if (solutions.length === 0) {
|
|
22937
|
-
console.log(
|
|
22996
|
+
console.log(chalk157.yellow(" Not found in any .sln"));
|
|
22938
22997
|
} else {
|
|
22939
22998
|
for (const sln of solutions) {
|
|
22940
|
-
console.log(` ${
|
|
22999
|
+
console.log(` ${chalk157.green(sln)}`);
|
|
22941
23000
|
}
|
|
22942
23001
|
}
|
|
22943
23002
|
console.log();
|
|
@@ -22966,16 +23025,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
22966
23025
|
// src/commands/dotnet/resolveCsproj.ts
|
|
22967
23026
|
import { existsSync as existsSync53 } from "fs";
|
|
22968
23027
|
import path36 from "path";
|
|
22969
|
-
import
|
|
23028
|
+
import chalk158 from "chalk";
|
|
22970
23029
|
function resolveCsproj(csprojPath) {
|
|
22971
23030
|
const resolved = path36.resolve(csprojPath);
|
|
22972
23031
|
if (!existsSync53(resolved)) {
|
|
22973
|
-
console.error(
|
|
23032
|
+
console.error(chalk158.red(`File not found: ${resolved}`));
|
|
22974
23033
|
process.exit(1);
|
|
22975
23034
|
}
|
|
22976
23035
|
const repoRoot2 = findRepoRoot(path36.dirname(resolved));
|
|
22977
23036
|
if (!repoRoot2) {
|
|
22978
|
-
console.error(
|
|
23037
|
+
console.error(chalk158.red("Could not find git repository root"));
|
|
22979
23038
|
process.exit(1);
|
|
22980
23039
|
}
|
|
22981
23040
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -23025,12 +23084,12 @@ function getChangedCsFiles(scope) {
|
|
|
23025
23084
|
}
|
|
23026
23085
|
|
|
23027
23086
|
// src/commands/dotnet/inSln.ts
|
|
23028
|
-
import
|
|
23087
|
+
import chalk159 from "chalk";
|
|
23029
23088
|
async function inSln(csprojPath) {
|
|
23030
23089
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
23031
23090
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
23032
23091
|
if (solutions.length === 0) {
|
|
23033
|
-
console.log(
|
|
23092
|
+
console.log(chalk159.yellow("Not found in any .sln file"));
|
|
23034
23093
|
process.exit(1);
|
|
23035
23094
|
}
|
|
23036
23095
|
for (const sln of solutions) {
|
|
@@ -23039,7 +23098,7 @@ async function inSln(csprojPath) {
|
|
|
23039
23098
|
}
|
|
23040
23099
|
|
|
23041
23100
|
// src/commands/dotnet/inspect.ts
|
|
23042
|
-
import
|
|
23101
|
+
import chalk165 from "chalk";
|
|
23043
23102
|
|
|
23044
23103
|
// src/shared/formatElapsed.ts
|
|
23045
23104
|
function formatElapsed(ms) {
|
|
@@ -23051,12 +23110,12 @@ function formatElapsed(ms) {
|
|
|
23051
23110
|
}
|
|
23052
23111
|
|
|
23053
23112
|
// src/commands/dotnet/displayIssues.ts
|
|
23054
|
-
import
|
|
23113
|
+
import chalk160 from "chalk";
|
|
23055
23114
|
var SEVERITY_COLOR = {
|
|
23056
|
-
ERROR:
|
|
23057
|
-
WARNING:
|
|
23058
|
-
SUGGESTION:
|
|
23059
|
-
HINT:
|
|
23115
|
+
ERROR: chalk160.red,
|
|
23116
|
+
WARNING: chalk160.yellow,
|
|
23117
|
+
SUGGESTION: chalk160.cyan,
|
|
23118
|
+
HINT: chalk160.dim
|
|
23060
23119
|
};
|
|
23061
23120
|
function groupByFile(issues) {
|
|
23062
23121
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -23072,15 +23131,15 @@ function groupByFile(issues) {
|
|
|
23072
23131
|
}
|
|
23073
23132
|
function displayIssues(issues) {
|
|
23074
23133
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
23075
|
-
console.log(
|
|
23134
|
+
console.log(chalk160.bold(file));
|
|
23076
23135
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
23077
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
23136
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk160.white;
|
|
23078
23137
|
console.log(
|
|
23079
|
-
` ${
|
|
23138
|
+
` ${chalk160.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
23080
23139
|
);
|
|
23081
23140
|
}
|
|
23082
23141
|
}
|
|
23083
|
-
console.log(
|
|
23142
|
+
console.log(chalk160.dim(`
|
|
23084
23143
|
${issues.length} issue(s) found`));
|
|
23085
23144
|
}
|
|
23086
23145
|
|
|
@@ -23139,12 +23198,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
23139
23198
|
// src/commands/dotnet/resolveSolution.ts
|
|
23140
23199
|
import { existsSync as existsSync54 } from "fs";
|
|
23141
23200
|
import path37 from "path";
|
|
23142
|
-
import
|
|
23201
|
+
import chalk162 from "chalk";
|
|
23143
23202
|
|
|
23144
23203
|
// src/commands/dotnet/findSolution.ts
|
|
23145
23204
|
import { readdirSync as readdirSync10 } from "fs";
|
|
23146
23205
|
import { dirname as dirname28, join as join65 } from "path";
|
|
23147
|
-
import
|
|
23206
|
+
import chalk161 from "chalk";
|
|
23148
23207
|
function findSlnInDir(dir) {
|
|
23149
23208
|
try {
|
|
23150
23209
|
return readdirSync10(dir).filter((f) => f.endsWith(".sln")).map((f) => join65(dir, f));
|
|
@@ -23160,17 +23219,17 @@ function findSolution() {
|
|
|
23160
23219
|
const slnFiles = findSlnInDir(current);
|
|
23161
23220
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
23162
23221
|
if (slnFiles.length > 1) {
|
|
23163
|
-
console.error(
|
|
23222
|
+
console.error(chalk161.red(`Multiple .sln files found in ${current}:`));
|
|
23164
23223
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
23165
23224
|
console.error(
|
|
23166
|
-
|
|
23225
|
+
chalk161.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
23167
23226
|
);
|
|
23168
23227
|
process.exit(1);
|
|
23169
23228
|
}
|
|
23170
23229
|
if (current === ceiling) break;
|
|
23171
23230
|
current = dirname28(current);
|
|
23172
23231
|
}
|
|
23173
|
-
console.error(
|
|
23232
|
+
console.error(chalk161.red("No .sln file found between cwd and repo root"));
|
|
23174
23233
|
process.exit(1);
|
|
23175
23234
|
}
|
|
23176
23235
|
|
|
@@ -23179,7 +23238,7 @@ function resolveSolution(sln) {
|
|
|
23179
23238
|
if (sln) {
|
|
23180
23239
|
const resolved = path37.resolve(sln);
|
|
23181
23240
|
if (!existsSync54(resolved)) {
|
|
23182
|
-
console.error(
|
|
23241
|
+
console.error(chalk162.red(`Solution file not found: ${resolved}`));
|
|
23183
23242
|
process.exit(1);
|
|
23184
23243
|
}
|
|
23185
23244
|
return resolved;
|
|
@@ -23221,14 +23280,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
23221
23280
|
import { existsSync as existsSync55, readFileSync as readFileSync38, unlinkSync as unlinkSync10 } from "fs";
|
|
23222
23281
|
import { tmpdir as tmpdir4 } from "os";
|
|
23223
23282
|
import path38 from "path";
|
|
23224
|
-
import
|
|
23283
|
+
import chalk163 from "chalk";
|
|
23225
23284
|
function assertJbInstalled() {
|
|
23226
23285
|
try {
|
|
23227
23286
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
23228
23287
|
} catch {
|
|
23229
|
-
console.error(
|
|
23288
|
+
console.error(chalk163.red("jb is not installed. Install with:"));
|
|
23230
23289
|
console.error(
|
|
23231
|
-
|
|
23290
|
+
chalk163.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
23232
23291
|
);
|
|
23233
23292
|
process.exit(1);
|
|
23234
23293
|
}
|
|
@@ -23246,11 +23305,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
23246
23305
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
23247
23306
|
process.stderr.write(error.stderr);
|
|
23248
23307
|
}
|
|
23249
|
-
console.error(
|
|
23308
|
+
console.error(chalk163.red("jb inspectcode failed"));
|
|
23250
23309
|
process.exit(1);
|
|
23251
23310
|
}
|
|
23252
23311
|
if (!existsSync55(reportPath)) {
|
|
23253
|
-
console.error(
|
|
23312
|
+
console.error(chalk163.red("Report file not generated"));
|
|
23254
23313
|
process.exit(1);
|
|
23255
23314
|
}
|
|
23256
23315
|
const xml = readFileSync38(reportPath, "utf8");
|
|
@@ -23260,7 +23319,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
23260
23319
|
|
|
23261
23320
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
23262
23321
|
import { execSync as execSync36 } from "child_process";
|
|
23263
|
-
import
|
|
23322
|
+
import chalk164 from "chalk";
|
|
23264
23323
|
function resolveMsbuildPath() {
|
|
23265
23324
|
const { run: run4 } = loadConfig();
|
|
23266
23325
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -23272,9 +23331,9 @@ function assertMsbuildInstalled() {
|
|
|
23272
23331
|
try {
|
|
23273
23332
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
23274
23333
|
} catch {
|
|
23275
|
-
console.error(
|
|
23334
|
+
console.error(chalk164.red(`msbuild not found at: ${msbuild}`));
|
|
23276
23335
|
console.error(
|
|
23277
|
-
|
|
23336
|
+
chalk164.yellow(
|
|
23278
23337
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
23279
23338
|
)
|
|
23280
23339
|
);
|
|
@@ -23321,17 +23380,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
23321
23380
|
// src/commands/dotnet/inspect.ts
|
|
23322
23381
|
function logScope(changedFiles2) {
|
|
23323
23382
|
if (changedFiles2 === null) {
|
|
23324
|
-
console.log(
|
|
23383
|
+
console.log(chalk165.dim("Inspecting full solution..."));
|
|
23325
23384
|
} else {
|
|
23326
23385
|
console.log(
|
|
23327
|
-
|
|
23386
|
+
chalk165.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
23328
23387
|
);
|
|
23329
23388
|
}
|
|
23330
23389
|
}
|
|
23331
23390
|
function reportResults(issues, elapsed) {
|
|
23332
23391
|
if (issues.length > 0) displayIssues(issues);
|
|
23333
|
-
else console.log(
|
|
23334
|
-
console.log(
|
|
23392
|
+
else console.log(chalk165.green("No issues found"));
|
|
23393
|
+
console.log(chalk165.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
23335
23394
|
if (issues.length > 0) process.exit(1);
|
|
23336
23395
|
}
|
|
23337
23396
|
async function inspect(sln, options2) {
|
|
@@ -23342,7 +23401,7 @@ async function inspect(sln, options2) {
|
|
|
23342
23401
|
const scope = parseScope(options2.scope);
|
|
23343
23402
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
23344
23403
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
23345
|
-
console.log(
|
|
23404
|
+
console.log(chalk165.green("No changed .cs files found"));
|
|
23346
23405
|
return;
|
|
23347
23406
|
}
|
|
23348
23407
|
logScope(changedFiles2);
|
|
@@ -24217,25 +24276,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
24217
24276
|
}
|
|
24218
24277
|
|
|
24219
24278
|
// src/commands/github/printCountTable.ts
|
|
24220
|
-
import
|
|
24279
|
+
import chalk166 from "chalk";
|
|
24221
24280
|
function printCountTable(labelHeader, rows) {
|
|
24222
24281
|
const labelWidth = Math.max(
|
|
24223
24282
|
labelHeader.length,
|
|
24224
24283
|
...rows.map((row) => row.label.length)
|
|
24225
24284
|
);
|
|
24226
24285
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
24227
|
-
console.log(
|
|
24228
|
-
console.log(
|
|
24286
|
+
console.log(chalk166.dim(header));
|
|
24287
|
+
console.log(chalk166.dim("-".repeat(header.length)));
|
|
24229
24288
|
for (const row of rows) {
|
|
24230
24289
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
24231
24290
|
}
|
|
24232
24291
|
}
|
|
24233
24292
|
|
|
24234
24293
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
24235
|
-
import
|
|
24294
|
+
import chalk167 from "chalk";
|
|
24236
24295
|
function printRepoAuthorBreakdown(repos2) {
|
|
24237
24296
|
for (const repo of repos2) {
|
|
24238
|
-
console.log(
|
|
24297
|
+
console.log(chalk167.bold(repo.name));
|
|
24239
24298
|
const authorWidth = Math.max(
|
|
24240
24299
|
0,
|
|
24241
24300
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -24318,10 +24377,10 @@ function parseTopCount(value) {
|
|
|
24318
24377
|
}
|
|
24319
24378
|
|
|
24320
24379
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
24321
|
-
import
|
|
24380
|
+
import chalk169 from "chalk";
|
|
24322
24381
|
|
|
24323
24382
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
24324
|
-
import
|
|
24383
|
+
import chalk168 from "chalk";
|
|
24325
24384
|
|
|
24326
24385
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
24327
24386
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -24358,7 +24417,7 @@ function writeLineNow(line) {
|
|
|
24358
24417
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
24359
24418
|
function applyFixStructurePlan(plan2) {
|
|
24360
24419
|
for (const entry of plan2.entries) {
|
|
24361
|
-
const where =
|
|
24420
|
+
const where = chalk168.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
24362
24421
|
const { typeChange, labelRemovals } = entry;
|
|
24363
24422
|
if (typeChange) {
|
|
24364
24423
|
writeLineNow(
|
|
@@ -24628,12 +24687,12 @@ function planSubtree(root2, context) {
|
|
|
24628
24687
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
24629
24688
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
24630
24689
|
applyFixStructurePlan(plan2);
|
|
24631
|
-
writeLineNow(
|
|
24690
|
+
writeLineNow(chalk169.dim("Re-walking the subtree to confirm"));
|
|
24632
24691
|
assertNoResidualDrift(
|
|
24633
24692
|
planSubtree(fetchRootIssue(target), context),
|
|
24634
24693
|
context.chain
|
|
24635
24694
|
);
|
|
24636
|
-
writeLineNow(
|
|
24695
|
+
writeLineNow(chalk169.green("Subtree normalised"));
|
|
24637
24696
|
}
|
|
24638
24697
|
|
|
24639
24698
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -24669,22 +24728,22 @@ function parseTypeChain(value) {
|
|
|
24669
24728
|
}
|
|
24670
24729
|
|
|
24671
24730
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
24672
|
-
import
|
|
24731
|
+
import chalk170 from "chalk";
|
|
24673
24732
|
function annotate(entry) {
|
|
24674
24733
|
const notes = [];
|
|
24675
24734
|
if (entry.level === null) {
|
|
24676
|
-
notes.push(
|
|
24735
|
+
notes.push(chalk170.red("deeper than the leaf level"));
|
|
24677
24736
|
} else if (entry.typeChange) {
|
|
24678
24737
|
notes.push(
|
|
24679
|
-
|
|
24738
|
+
chalk170.yellow(
|
|
24680
24739
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
24681
24740
|
)
|
|
24682
24741
|
);
|
|
24683
24742
|
} else {
|
|
24684
|
-
notes.push(
|
|
24743
|
+
notes.push(chalk170.dim(entry.issue.typeName ?? "no type"));
|
|
24685
24744
|
}
|
|
24686
24745
|
for (const label2 of entry.labelRemovals) {
|
|
24687
|
-
notes.push(
|
|
24746
|
+
notes.push(chalk170.yellow(`-${label2.name}`));
|
|
24688
24747
|
}
|
|
24689
24748
|
return notes;
|
|
24690
24749
|
}
|
|
@@ -24692,22 +24751,22 @@ function formatCount(count8, noun) {
|
|
|
24692
24751
|
return `${count8} ${noun}${count8 === 1 ? "" : "s"}`;
|
|
24693
24752
|
}
|
|
24694
24753
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
24695
|
-
writeLineNow(
|
|
24754
|
+
writeLineNow(chalk170.dim(`chain: ${chain2.join(" > ")}`));
|
|
24696
24755
|
for (const entry of plan2.entries) {
|
|
24697
24756
|
const indent3 = " ".repeat(entry.issue.depth);
|
|
24698
|
-
const name =
|
|
24757
|
+
const name = chalk170.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
24699
24758
|
writeLineNow(
|
|
24700
24759
|
`${indent3}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
24701
24760
|
);
|
|
24702
24761
|
}
|
|
24703
24762
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
24704
|
-
writeLineNow(
|
|
24763
|
+
writeLineNow(chalk170.green("Nothing to change"));
|
|
24705
24764
|
return;
|
|
24706
24765
|
}
|
|
24707
24766
|
writeLineNow(
|
|
24708
24767
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
24709
24768
|
);
|
|
24710
|
-
if (!apply) writeLineNow(
|
|
24769
|
+
if (!apply) writeLineNow(chalk170.dim("Dry run \u2014 nothing written"));
|
|
24711
24770
|
}
|
|
24712
24771
|
|
|
24713
24772
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -25917,7 +25976,7 @@ function registerGithub(program2) {
|
|
|
25917
25976
|
}
|
|
25918
25977
|
|
|
25919
25978
|
// src/commands/jira/acceptanceCriteria.ts
|
|
25920
|
-
import
|
|
25979
|
+
import chalk171 from "chalk";
|
|
25921
25980
|
|
|
25922
25981
|
// src/commands/jira/adfToText.ts
|
|
25923
25982
|
function renderInline(node) {
|
|
@@ -25984,7 +26043,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
25984
26043
|
const parsed = fetchIssue(issueKey, field);
|
|
25985
26044
|
const acValue = parsed?.fields?.[field];
|
|
25986
26045
|
if (!acValue) {
|
|
25987
|
-
console.log(
|
|
26046
|
+
console.log(chalk171.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
25988
26047
|
return;
|
|
25989
26048
|
}
|
|
25990
26049
|
if (typeof acValue === "string") {
|
|
@@ -26050,14 +26109,14 @@ async function jiraAuth() {
|
|
|
26050
26109
|
}
|
|
26051
26110
|
|
|
26052
26111
|
// src/commands/jira/viewIssue.ts
|
|
26053
|
-
import
|
|
26112
|
+
import chalk172 from "chalk";
|
|
26054
26113
|
function viewIssue2(issueKey) {
|
|
26055
26114
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
26056
26115
|
const fields = parsed?.fields;
|
|
26057
26116
|
const summary = fields?.summary;
|
|
26058
26117
|
const description = fields?.description;
|
|
26059
26118
|
if (summary) {
|
|
26060
|
-
console.log(
|
|
26119
|
+
console.log(chalk172.bold(summary));
|
|
26061
26120
|
}
|
|
26062
26121
|
if (description) {
|
|
26063
26122
|
if (summary) console.log();
|
|
@@ -26071,7 +26130,7 @@ function viewIssue2(issueKey) {
|
|
|
26071
26130
|
}
|
|
26072
26131
|
if (!summary && !description) {
|
|
26073
26132
|
console.log(
|
|
26074
|
-
|
|
26133
|
+
chalk172.yellow(`No summary or description found on ${issueKey}.`)
|
|
26075
26134
|
);
|
|
26076
26135
|
}
|
|
26077
26136
|
}
|
|
@@ -26106,7 +26165,7 @@ import { randomUUID as randomUUID12 } from "crypto";
|
|
|
26106
26165
|
|
|
26107
26166
|
// src/commands/review/checkoutPr.ts
|
|
26108
26167
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
26109
|
-
import
|
|
26168
|
+
import chalk173 from "chalk";
|
|
26110
26169
|
|
|
26111
26170
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
26112
26171
|
var RING_CAPACITY = 1e3;
|
|
@@ -26779,7 +26838,7 @@ async function checkoutPr(number) {
|
|
|
26779
26838
|
try {
|
|
26780
26839
|
execFileSync16("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
26781
26840
|
} catch {
|
|
26782
|
-
console.error(
|
|
26841
|
+
console.error(chalk173.red(`gh pr checkout ${number} failed; aborting.`));
|
|
26783
26842
|
process.exit(1);
|
|
26784
26843
|
}
|
|
26785
26844
|
}
|
|
@@ -26914,18 +26973,18 @@ function registerList(program2) {
|
|
|
26914
26973
|
}
|
|
26915
26974
|
|
|
26916
26975
|
// src/commands/litellm/listModels.ts
|
|
26917
|
-
import
|
|
26976
|
+
import chalk175 from "chalk";
|
|
26918
26977
|
|
|
26919
26978
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
26920
|
-
import
|
|
26979
|
+
import chalk174 from "chalk";
|
|
26921
26980
|
function resolveLitellmConfig() {
|
|
26922
26981
|
const { config, missing } = readLitellmConfig();
|
|
26923
26982
|
if (!config) {
|
|
26924
|
-
console.error(
|
|
26983
|
+
console.error(chalk174.red("LiteLLM is not configured"));
|
|
26925
26984
|
for (const key of missing) {
|
|
26926
26985
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
26927
26986
|
console.error(
|
|
26928
|
-
|
|
26987
|
+
chalk174.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
26929
26988
|
);
|
|
26930
26989
|
}
|
|
26931
26990
|
process.exit(1);
|
|
@@ -26951,13 +27010,13 @@ async function listModels(options2) {
|
|
|
26951
27010
|
} catch (error) {
|
|
26952
27011
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
26953
27012
|
console.error(
|
|
26954
|
-
|
|
27013
|
+
chalk175.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
26955
27014
|
);
|
|
26956
27015
|
process.exit(1);
|
|
26957
27016
|
}
|
|
26958
27017
|
const body = await response.text();
|
|
26959
27018
|
if (!response.ok) {
|
|
26960
|
-
console.error(
|
|
27019
|
+
console.error(chalk175.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
26961
27020
|
process.exit(1);
|
|
26962
27021
|
}
|
|
26963
27022
|
if (options2.json) {
|
|
@@ -26977,15 +27036,15 @@ function registerLitellm(program2) {
|
|
|
26977
27036
|
// src/commands/mermaidExport.ts
|
|
26978
27037
|
import { mkdirSync as mkdirSync19, readdirSync as readdirSync11 } from "fs";
|
|
26979
27038
|
import { resolve as resolve19 } from "path";
|
|
26980
|
-
import
|
|
27039
|
+
import chalk178 from "chalk";
|
|
26981
27040
|
|
|
26982
27041
|
// src/commands/mermaid/exportFile.ts
|
|
26983
27042
|
import { readFileSync as readFileSync40, writeFileSync as writeFileSync33 } from "fs";
|
|
26984
27043
|
import { basename as basename21, extname as extname3, resolve as resolve18 } from "path";
|
|
26985
|
-
import
|
|
27044
|
+
import chalk177 from "chalk";
|
|
26986
27045
|
|
|
26987
27046
|
// src/commands/mermaid/renderBlock.ts
|
|
26988
|
-
import
|
|
27047
|
+
import chalk176 from "chalk";
|
|
26989
27048
|
async function renderBlock(krokiUrl, source) {
|
|
26990
27049
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
26991
27050
|
method: "POST",
|
|
@@ -26994,7 +27053,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
26994
27053
|
});
|
|
26995
27054
|
if (!response.ok) {
|
|
26996
27055
|
console.error(
|
|
26997
|
-
|
|
27056
|
+
chalk176.red(
|
|
26998
27057
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
26999
27058
|
)
|
|
27000
27059
|
);
|
|
@@ -27012,19 +27071,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
27012
27071
|
if (onlyIndex !== void 0) {
|
|
27013
27072
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
27014
27073
|
console.error(
|
|
27015
|
-
|
|
27074
|
+
chalk177.red(
|
|
27016
27075
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
27017
27076
|
)
|
|
27018
27077
|
);
|
|
27019
27078
|
process.exit(1);
|
|
27020
27079
|
}
|
|
27021
27080
|
console.log(
|
|
27022
|
-
|
|
27081
|
+
chalk177.gray(
|
|
27023
27082
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
27024
27083
|
)
|
|
27025
27084
|
);
|
|
27026
27085
|
} else {
|
|
27027
|
-
console.log(
|
|
27086
|
+
console.log(chalk177.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
27028
27087
|
}
|
|
27029
27088
|
for (const [i, source] of blocks.entries()) {
|
|
27030
27089
|
const idx = i + 1;
|
|
@@ -27032,7 +27091,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
27032
27091
|
const outPath = resolve18(outDir, `${stem}-${idx}.svg`);
|
|
27033
27092
|
const svg = await renderBlock(krokiUrl, source);
|
|
27034
27093
|
writeFileSync33(outPath, svg, "utf8");
|
|
27035
|
-
console.log(
|
|
27094
|
+
console.log(chalk177.green(` \u2192 ${outPath}`));
|
|
27036
27095
|
}
|
|
27037
27096
|
}
|
|
27038
27097
|
function extractMermaidBlocks(markdown) {
|
|
@@ -27048,18 +27107,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
27048
27107
|
if (options2.index !== void 0) {
|
|
27049
27108
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
27050
27109
|
console.error(
|
|
27051
|
-
|
|
27110
|
+
chalk178.red(`--index must be a positive integer (got ${options2.index})`)
|
|
27052
27111
|
);
|
|
27053
27112
|
process.exit(1);
|
|
27054
27113
|
}
|
|
27055
27114
|
if (!file) {
|
|
27056
|
-
console.error(
|
|
27115
|
+
console.error(chalk178.red("--index requires a file argument"));
|
|
27057
27116
|
process.exit(1);
|
|
27058
27117
|
}
|
|
27059
27118
|
}
|
|
27060
27119
|
const files = file ? [file] : readdirSync11(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
27061
27120
|
if (files.length === 0) {
|
|
27062
|
-
console.log(
|
|
27121
|
+
console.log(chalk178.gray("No markdown files found in current directory."));
|
|
27063
27122
|
return;
|
|
27064
27123
|
}
|
|
27065
27124
|
for (const f of files) {
|
|
@@ -27205,7 +27264,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
27205
27264
|
}
|
|
27206
27265
|
|
|
27207
27266
|
// src/commands/miro/keptTexts.ts
|
|
27208
|
-
import
|
|
27267
|
+
import chalk179 from "chalk";
|
|
27209
27268
|
|
|
27210
27269
|
// src/commands/miro/applyIgnore.ts
|
|
27211
27270
|
function applyIgnore(texts, ignore3) {
|
|
@@ -27244,7 +27303,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
27244
27303
|
if (unmatched.length === 0) return;
|
|
27245
27304
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
27246
27305
|
console.error(
|
|
27247
|
-
|
|
27306
|
+
chalk179.yellow(
|
|
27248
27307
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
27249
27308
|
${entries}`
|
|
27250
27309
|
)
|
|
@@ -27315,6 +27374,35 @@ function normaliseItems(items2) {
|
|
|
27315
27374
|
return items2.map(toItem);
|
|
27316
27375
|
}
|
|
27317
27376
|
|
|
27377
|
+
// src/commands/config/resolveRepoConfigBlock.ts
|
|
27378
|
+
function resolveRepoConfigBlock(repoName, cwd, globalConfigPath) {
|
|
27379
|
+
const globalRaw = loadGlobalConfigRaw(globalConfigPath);
|
|
27380
|
+
const label2 = repoName === void 0 ? resolveRepoWriteLabel(globalRaw, getCurrentOrigin(cwd)) : resolveNamedRepoWriteLabel(globalRaw, repoName);
|
|
27381
|
+
const repos2 = isPlainObject7(globalRaw.repos) ? { ...globalRaw.repos } : {};
|
|
27382
|
+
const block = isPlainObject7(repos2[label2]) ? repos2[label2] : {};
|
|
27383
|
+
return { globalRaw, repos: repos2, label: label2, block };
|
|
27384
|
+
}
|
|
27385
|
+
function isPlainObject7(value) {
|
|
27386
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
27387
|
+
}
|
|
27388
|
+
|
|
27389
|
+
// src/commands/config/applyRepoConfigSet.ts
|
|
27390
|
+
function applyRepoConfigSet(key, coerced, repoName, cwd = process.cwd(), globalConfigPath) {
|
|
27391
|
+
const globalOnly = globalOnlyRepoKeyError(key, "Set");
|
|
27392
|
+
if (globalOnly) return globalOnly;
|
|
27393
|
+
const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
|
|
27394
|
+
repoName,
|
|
27395
|
+
cwd,
|
|
27396
|
+
globalConfigPath
|
|
27397
|
+
);
|
|
27398
|
+
const updatedBlock = setNestedValue(block, key, coerced);
|
|
27399
|
+
const validation = validateConfig(updatedBlock, key, repoConfigSchema);
|
|
27400
|
+
if (!validation.ok) return validation;
|
|
27401
|
+
repos2[label2] = updatedBlock;
|
|
27402
|
+
saveGlobalConfig({ ...globalRaw, repos: repos2 }, globalConfigPath);
|
|
27403
|
+
return { ok: true, target: "repo", label: label2 };
|
|
27404
|
+
}
|
|
27405
|
+
|
|
27318
27406
|
// src/commands/miro/saveMiroExtract.ts
|
|
27319
27407
|
function saveToRepo(key, extract2, repo, { cwd, globalConfigPath }) {
|
|
27320
27408
|
const result = applyRepoConfigSet(
|
|
@@ -27447,7 +27535,7 @@ function readMiroItems(file) {
|
|
|
27447
27535
|
}
|
|
27448
27536
|
|
|
27449
27537
|
// src/commands/miro/resolveExtractOptions.ts
|
|
27450
|
-
import
|
|
27538
|
+
import chalk180 from "chalk";
|
|
27451
27539
|
|
|
27452
27540
|
// src/commands/miro/extractLayers.ts
|
|
27453
27541
|
function extractsIn(layer) {
|
|
@@ -27525,7 +27613,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
27525
27613
|
paths.cwd,
|
|
27526
27614
|
paths.globalConfigPath
|
|
27527
27615
|
);
|
|
27528
|
-
console.error(
|
|
27616
|
+
console.error(chalk180.dim(`Extract "${name}" from ${resolved.from}`));
|
|
27529
27617
|
return resolved.options;
|
|
27530
27618
|
}
|
|
27531
27619
|
|
|
@@ -27627,7 +27715,7 @@ function registerMiro(program2) {
|
|
|
27627
27715
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
27628
27716
|
import { createServer as createServer2 } from "http";
|
|
27629
27717
|
import { dirname as dirname34 } from "path";
|
|
27630
|
-
import
|
|
27718
|
+
import chalk182 from "chalk";
|
|
27631
27719
|
|
|
27632
27720
|
// src/commands/netcap/corsHeaders.ts
|
|
27633
27721
|
var corsHeaders = {
|
|
@@ -27706,7 +27794,7 @@ function createNetcapHandler(options2) {
|
|
|
27706
27794
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
27707
27795
|
import { networkInterfaces } from "os";
|
|
27708
27796
|
import { join as join72 } from "path";
|
|
27709
|
-
import
|
|
27797
|
+
import chalk181 from "chalk";
|
|
27710
27798
|
|
|
27711
27799
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
27712
27800
|
import { dirname as dirname33, join as join71 } from "path";
|
|
@@ -27750,7 +27838,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
27750
27838
|
const host = lanIPv4();
|
|
27751
27839
|
if (!host) {
|
|
27752
27840
|
console.log(
|
|
27753
|
-
|
|
27841
|
+
chalk181.yellow("could not determine the WSL IP for the extension")
|
|
27754
27842
|
);
|
|
27755
27843
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
27756
27844
|
return source;
|
|
@@ -27761,7 +27849,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
27761
27849
|
return WSL_WINDOWS_PATH3;
|
|
27762
27850
|
} catch {
|
|
27763
27851
|
console.log(
|
|
27764
|
-
|
|
27852
|
+
chalk181.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
27765
27853
|
);
|
|
27766
27854
|
return source;
|
|
27767
27855
|
}
|
|
@@ -27794,30 +27882,30 @@ async function netcap(options2) {
|
|
|
27794
27882
|
let count8 = 0;
|
|
27795
27883
|
const handler = createNetcapHandler({
|
|
27796
27884
|
outPath,
|
|
27797
|
-
onPing: () => console.log(
|
|
27885
|
+
onPing: () => console.log(chalk182.dim("ping from extension")),
|
|
27798
27886
|
onCapture: (entry) => {
|
|
27799
27887
|
count8 += 1;
|
|
27800
27888
|
console.log(
|
|
27801
|
-
|
|
27802
|
-
|
|
27889
|
+
chalk182.green(`captured #${count8}`),
|
|
27890
|
+
chalk182.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
27803
27891
|
);
|
|
27804
27892
|
}
|
|
27805
27893
|
});
|
|
27806
27894
|
const server = createServer2(handler);
|
|
27807
27895
|
server.listen(port, () => {
|
|
27808
27896
|
console.log(
|
|
27809
|
-
|
|
27897
|
+
chalk182.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
27810
27898
|
);
|
|
27811
|
-
console.log(
|
|
27899
|
+
console.log(chalk182.dim(`appending captures to ${outPath}`));
|
|
27812
27900
|
if (filter)
|
|
27813
|
-
console.log(
|
|
27814
|
-
console.log(
|
|
27815
|
-
console.log(
|
|
27901
|
+
console.log(chalk182.dim(`forwarding only URLs matching "${filter}"`));
|
|
27902
|
+
console.log(chalk182.dim(`load the unpacked extension from ${extensionPath}`));
|
|
27903
|
+
console.log(chalk182.dim("press Ctrl-C to stop"));
|
|
27816
27904
|
});
|
|
27817
27905
|
process.on("SIGINT", () => {
|
|
27818
27906
|
server.close();
|
|
27819
27907
|
console.log(
|
|
27820
|
-
|
|
27908
|
+
chalk182.bold(
|
|
27821
27909
|
`
|
|
27822
27910
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
27823
27911
|
)
|
|
@@ -27829,7 +27917,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
27829
27917
|
// src/commands/netcap/netcapExtract.ts
|
|
27830
27918
|
import { writeFileSync as writeFileSync35 } from "fs";
|
|
27831
27919
|
import { join as join75 } from "path";
|
|
27832
|
-
import
|
|
27920
|
+
import chalk183 from "chalk";
|
|
27833
27921
|
|
|
27834
27922
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
27835
27923
|
import { readFileSync as readFileSync43 } from "fs";
|
|
@@ -28277,8 +28365,8 @@ function netcapExtract(file) {
|
|
|
28277
28365
|
writeFileSync35(outFile, `${JSON.stringify(posts, null, 2)}
|
|
28278
28366
|
`);
|
|
28279
28367
|
console.log(
|
|
28280
|
-
|
|
28281
|
-
|
|
28368
|
+
chalk183.green(`extracted ${posts.length} posts`),
|
|
28369
|
+
chalk183.dim(`-> ${outFile}`)
|
|
28282
28370
|
);
|
|
28283
28371
|
}
|
|
28284
28372
|
|
|
@@ -28299,7 +28387,7 @@ function registerNetcap(program2) {
|
|
|
28299
28387
|
}
|
|
28300
28388
|
|
|
28301
28389
|
// src/commands/news/add.ts
|
|
28302
|
-
import
|
|
28390
|
+
import chalk184 from "chalk";
|
|
28303
28391
|
import enquirer8 from "enquirer";
|
|
28304
28392
|
async function add2(url) {
|
|
28305
28393
|
if (!url) {
|
|
@@ -28321,10 +28409,10 @@ async function add2(url) {
|
|
|
28321
28409
|
const { orm } = await getReady();
|
|
28322
28410
|
const added = await addFeed(orm, url);
|
|
28323
28411
|
if (!added) {
|
|
28324
|
-
console.log(
|
|
28412
|
+
console.log(chalk184.yellow("Feed already exists"));
|
|
28325
28413
|
return;
|
|
28326
28414
|
}
|
|
28327
|
-
console.log(
|
|
28415
|
+
console.log(chalk184.green(`Added feed: ${url}`));
|
|
28328
28416
|
}
|
|
28329
28417
|
|
|
28330
28418
|
// src/commands/registerNews.ts
|
|
@@ -28372,7 +28460,7 @@ function registerPiHook(program2) {
|
|
|
28372
28460
|
}
|
|
28373
28461
|
|
|
28374
28462
|
// src/commands/prompts/printPromptsTable.ts
|
|
28375
|
-
import
|
|
28463
|
+
import chalk185 from "chalk";
|
|
28376
28464
|
function truncate(str, max) {
|
|
28377
28465
|
if (str.length <= max) return str;
|
|
28378
28466
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -28390,14 +28478,14 @@ function printPromptsTable(rows) {
|
|
|
28390
28478
|
"Command".padEnd(commandWidth),
|
|
28391
28479
|
"Repos"
|
|
28392
28480
|
].join(" ");
|
|
28393
|
-
console.log(
|
|
28394
|
-
console.log(
|
|
28481
|
+
console.log(chalk185.dim(header));
|
|
28482
|
+
console.log(chalk185.dim("-".repeat(header.length)));
|
|
28395
28483
|
for (const row of rows) {
|
|
28396
28484
|
const count8 = String(row.count).padStart(countWidth);
|
|
28397
28485
|
const tool = row.tool.padEnd(toolWidth);
|
|
28398
28486
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
28399
28487
|
console.log(
|
|
28400
|
-
`${
|
|
28488
|
+
`${chalk185.yellow(count8)} ${tool} ${command} ${chalk185.dim(row.repos)}`
|
|
28401
28489
|
);
|
|
28402
28490
|
}
|
|
28403
28491
|
}
|
|
@@ -28432,13 +28520,13 @@ import { execSync as execSync39 } from "child_process";
|
|
|
28432
28520
|
import enquirer9 from "enquirer";
|
|
28433
28521
|
|
|
28434
28522
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
28435
|
-
import
|
|
28523
|
+
import chalk186 from "chalk";
|
|
28436
28524
|
var STATUS_MAP = {
|
|
28437
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
28438
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
28525
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk186.magenta("merged"), date: pr.mergedAt } : null,
|
|
28526
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk186.red("closed"), date: pr.closedAt } : null
|
|
28439
28527
|
};
|
|
28440
28528
|
function defaultStatus(pr) {
|
|
28441
|
-
return { label:
|
|
28529
|
+
return { label: chalk186.green("opened"), date: pr.createdAt };
|
|
28442
28530
|
}
|
|
28443
28531
|
function getStatus2(pr) {
|
|
28444
28532
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -28447,11 +28535,11 @@ function formatDate(dateStr) {
|
|
|
28447
28535
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
28448
28536
|
}
|
|
28449
28537
|
function formatPrHeader(pr, status2) {
|
|
28450
|
-
return `${
|
|
28538
|
+
return `${chalk186.cyan(`#${pr.number}`)} ${pr.title} ${chalk186.dim(`(${pr.author.login},`)} ${status2.label} ${chalk186.dim(`${formatDate(status2.date)})`)}`;
|
|
28451
28539
|
}
|
|
28452
28540
|
function logPrDetails(pr) {
|
|
28453
28541
|
console.log(
|
|
28454
|
-
|
|
28542
|
+
chalk186.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
28455
28543
|
);
|
|
28456
28544
|
console.log();
|
|
28457
28545
|
}
|
|
@@ -28941,13 +29029,13 @@ function agentFooter(unresolvedCount) {
|
|
|
28941
29029
|
}
|
|
28942
29030
|
|
|
28943
29031
|
// src/commands/prs/listComments/commentStyle.ts
|
|
28944
|
-
import
|
|
29032
|
+
import chalk187 from "chalk";
|
|
28945
29033
|
var plain = (text18) => text18;
|
|
28946
29034
|
function colouredState(state) {
|
|
28947
29035
|
const label2 = `[${state}]`;
|
|
28948
|
-
if (state === "APPROVED") return
|
|
28949
|
-
if (state === "CHANGES_REQUESTED") return
|
|
28950
|
-
return
|
|
29036
|
+
if (state === "APPROVED") return chalk187.green(label2);
|
|
29037
|
+
if (state === "CHANGES_REQUESTED") return chalk187.red(label2);
|
|
29038
|
+
return chalk187.yellow(label2);
|
|
28951
29039
|
}
|
|
28952
29040
|
function commentStyle() {
|
|
28953
29041
|
if (isClaudeCode()) {
|
|
@@ -28961,9 +29049,9 @@ function commentStyle() {
|
|
|
28961
29049
|
};
|
|
28962
29050
|
}
|
|
28963
29051
|
return {
|
|
28964
|
-
cyan:
|
|
28965
|
-
bold:
|
|
28966
|
-
dim:
|
|
29052
|
+
cyan: chalk187.cyan,
|
|
29053
|
+
bold: chalk187.bold,
|
|
29054
|
+
dim: chalk187.dim,
|
|
28967
29055
|
state: colouredState,
|
|
28968
29056
|
diffHunk: true,
|
|
28969
29057
|
agent: false
|
|
@@ -30175,16 +30263,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
30175
30263
|
}
|
|
30176
30264
|
|
|
30177
30265
|
// src/commands/prs/status/printPrsStatus.ts
|
|
30178
|
-
import
|
|
30266
|
+
import chalk189 from "chalk";
|
|
30179
30267
|
|
|
30180
30268
|
// src/commands/prs/status/printPrStatus.ts
|
|
30181
|
-
import
|
|
30269
|
+
import chalk188 from "chalk";
|
|
30182
30270
|
function flags(pr) {
|
|
30183
30271
|
const markers = [];
|
|
30184
30272
|
if (pr.isDraft) markers.push("draft");
|
|
30185
30273
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
30186
30274
|
if (pr.isBot) markers.push("bot");
|
|
30187
|
-
return markers.length ? ` ${
|
|
30275
|
+
return markers.length ? ` ${chalk188.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
30188
30276
|
}
|
|
30189
30277
|
function updated(pr) {
|
|
30190
30278
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -30198,35 +30286,35 @@ function reviewLine(pr) {
|
|
|
30198
30286
|
function checkLines(pr) {
|
|
30199
30287
|
const lines2 = [];
|
|
30200
30288
|
if (pr.checks.failing.length) {
|
|
30201
|
-
lines2.push(
|
|
30289
|
+
lines2.push(chalk188.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
30202
30290
|
}
|
|
30203
30291
|
if (pr.checks.pending.length) {
|
|
30204
|
-
lines2.push(
|
|
30292
|
+
lines2.push(chalk188.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
30205
30293
|
}
|
|
30206
30294
|
return lines2;
|
|
30207
30295
|
}
|
|
30208
30296
|
function threadsLine(pr) {
|
|
30209
30297
|
if (pr.unresolvedThreads === null) {
|
|
30210
|
-
return
|
|
30298
|
+
return chalk188.dim("unresolved comments: unknown");
|
|
30211
30299
|
}
|
|
30212
30300
|
if (pr.unresolvedThreads === 0) return null;
|
|
30213
|
-
return
|
|
30301
|
+
return chalk188.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
30214
30302
|
}
|
|
30215
30303
|
function mergeableLine(pr) {
|
|
30216
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
30304
|
+
if (pr.mergeable === "CONFLICTING") return chalk188.red("conflicting");
|
|
30217
30305
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
30218
|
-
return
|
|
30306
|
+
return chalk188.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
30219
30307
|
}
|
|
30220
30308
|
function printPrStatus(pr) {
|
|
30221
30309
|
console.log(
|
|
30222
|
-
` ${
|
|
30310
|
+
` ${chalk188.cyan(`#${pr.number}`)} ${pr.title} ${chalk188.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
30223
30311
|
);
|
|
30224
30312
|
const details = [
|
|
30225
30313
|
reviewLine(pr),
|
|
30226
30314
|
...checkLines(pr),
|
|
30227
30315
|
threadsLine(pr),
|
|
30228
30316
|
mergeableLine(pr),
|
|
30229
|
-
|
|
30317
|
+
chalk188.dim(pr.url)
|
|
30230
30318
|
];
|
|
30231
30319
|
for (const detail of details) {
|
|
30232
30320
|
if (detail) console.log(` ${detail}`);
|
|
@@ -30237,17 +30325,17 @@ function printPrStatus(pr) {
|
|
|
30237
30325
|
function printPrsStatus(report) {
|
|
30238
30326
|
for (const repo of report.repos) {
|
|
30239
30327
|
const count8 = repo.pullRequests.length;
|
|
30240
|
-
console.log(`${
|
|
30328
|
+
console.log(`${chalk189.bold(repo.repo)} ${chalk189.dim(`(${count8} open)`)}`);
|
|
30241
30329
|
for (const pr of repo.pullRequests) {
|
|
30242
30330
|
printPrStatus(pr);
|
|
30243
30331
|
}
|
|
30244
|
-
if (count8 === 0) console.log(
|
|
30332
|
+
if (count8 === 0) console.log(chalk189.dim(" no open pull requests"));
|
|
30245
30333
|
console.log();
|
|
30246
30334
|
}
|
|
30247
30335
|
if (report.errors.length === 0) return;
|
|
30248
|
-
console.log(
|
|
30336
|
+
console.log(chalk189.bold("Errors"));
|
|
30249
30337
|
for (const failure of report.errors) {
|
|
30250
|
-
console.log(` ${
|
|
30338
|
+
console.log(` ${chalk189.red(failure.repo)}: ${failure.error}`);
|
|
30251
30339
|
}
|
|
30252
30340
|
console.log();
|
|
30253
30341
|
}
|
|
@@ -30466,10 +30554,10 @@ function registerPrs(program2) {
|
|
|
30466
30554
|
}
|
|
30467
30555
|
|
|
30468
30556
|
// src/commands/ravendb/ravendbAuth.ts
|
|
30469
|
-
import
|
|
30557
|
+
import chalk195 from "chalk";
|
|
30470
30558
|
|
|
30471
30559
|
// src/shared/createConnectionAuth.ts
|
|
30472
|
-
import
|
|
30560
|
+
import chalk190 from "chalk";
|
|
30473
30561
|
function listConnections(connections, format2) {
|
|
30474
30562
|
if (connections.length === 0) {
|
|
30475
30563
|
console.log("No connections configured.");
|
|
@@ -30482,7 +30570,7 @@ function listConnections(connections, format2) {
|
|
|
30482
30570
|
function removeConnection(connections, name, save) {
|
|
30483
30571
|
const filtered = connections.filter((c) => c.name !== name);
|
|
30484
30572
|
if (filtered.length === connections.length) {
|
|
30485
|
-
console.error(
|
|
30573
|
+
console.error(chalk190.red(`Connection "${name}" not found.`));
|
|
30486
30574
|
process.exit(1);
|
|
30487
30575
|
}
|
|
30488
30576
|
save(filtered);
|
|
@@ -30528,15 +30616,15 @@ function saveConnections(connections) {
|
|
|
30528
30616
|
}
|
|
30529
30617
|
|
|
30530
30618
|
// src/commands/ravendb/promptConnection.ts
|
|
30531
|
-
import
|
|
30619
|
+
import chalk193 from "chalk";
|
|
30532
30620
|
|
|
30533
30621
|
// src/commands/ravendb/selectOpSecret.ts
|
|
30534
|
-
import
|
|
30622
|
+
import chalk192 from "chalk";
|
|
30535
30623
|
import Enquirer2 from "enquirer";
|
|
30536
30624
|
|
|
30537
30625
|
// src/commands/ravendb/searchItems.ts
|
|
30538
30626
|
import { execSync as execSync49 } from "child_process";
|
|
30539
|
-
import
|
|
30627
|
+
import chalk191 from "chalk";
|
|
30540
30628
|
function opExec(args) {
|
|
30541
30629
|
return execSync49(`op ${args}`, {
|
|
30542
30630
|
encoding: "utf8",
|
|
@@ -30549,7 +30637,7 @@ function searchItems(search2) {
|
|
|
30549
30637
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
30550
30638
|
} catch {
|
|
30551
30639
|
console.error(
|
|
30552
|
-
|
|
30640
|
+
chalk191.red(
|
|
30553
30641
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
30554
30642
|
)
|
|
30555
30643
|
);
|
|
@@ -30563,7 +30651,7 @@ function getItemFields(itemId2) {
|
|
|
30563
30651
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
30564
30652
|
return item.fields.filter((f) => f.reference && f.label);
|
|
30565
30653
|
} catch {
|
|
30566
|
-
console.error(
|
|
30654
|
+
console.error(chalk191.red("Failed to get item details from 1Password."));
|
|
30567
30655
|
process.exit(1);
|
|
30568
30656
|
}
|
|
30569
30657
|
}
|
|
@@ -30582,7 +30670,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
30582
30670
|
}).run();
|
|
30583
30671
|
const items2 = searchItems(search2);
|
|
30584
30672
|
if (items2.length === 0) {
|
|
30585
|
-
console.error(
|
|
30673
|
+
console.error(chalk192.red(`No items found matching "${search2}".`));
|
|
30586
30674
|
process.exit(1);
|
|
30587
30675
|
}
|
|
30588
30676
|
const itemId2 = await selectOne(
|
|
@@ -30591,7 +30679,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
30591
30679
|
);
|
|
30592
30680
|
const fields = getItemFields(itemId2);
|
|
30593
30681
|
if (fields.length === 0) {
|
|
30594
|
-
console.error(
|
|
30682
|
+
console.error(chalk192.red("No fields with references found on this item."));
|
|
30595
30683
|
process.exit(1);
|
|
30596
30684
|
}
|
|
30597
30685
|
const ref = await selectOne(
|
|
@@ -30605,7 +30693,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
30605
30693
|
async function promptConnection(existingNames) {
|
|
30606
30694
|
const name = await promptInput("name", "Connection name:");
|
|
30607
30695
|
if (existingNames.includes(name)) {
|
|
30608
|
-
console.error(
|
|
30696
|
+
console.error(chalk193.red(`Connection "${name}" already exists.`));
|
|
30609
30697
|
process.exit(1);
|
|
30610
30698
|
}
|
|
30611
30699
|
const url = await promptInput(
|
|
@@ -30614,22 +30702,22 @@ async function promptConnection(existingNames) {
|
|
|
30614
30702
|
);
|
|
30615
30703
|
const database = await promptInput("database", "Database name:");
|
|
30616
30704
|
if (!name || !url || !database) {
|
|
30617
|
-
console.error(
|
|
30705
|
+
console.error(chalk193.red("All fields are required."));
|
|
30618
30706
|
process.exit(1);
|
|
30619
30707
|
}
|
|
30620
30708
|
const apiKeyRef = await selectOpSecret();
|
|
30621
|
-
console.log(
|
|
30709
|
+
console.log(chalk193.dim(`Using: ${apiKeyRef}`));
|
|
30622
30710
|
return { name, url, database, apiKeyRef };
|
|
30623
30711
|
}
|
|
30624
30712
|
|
|
30625
30713
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
30626
|
-
import
|
|
30714
|
+
import chalk194 from "chalk";
|
|
30627
30715
|
function ravendbSetConnection(name) {
|
|
30628
30716
|
const raw = loadGlobalConfigRaw();
|
|
30629
30717
|
const ravendb = raw.ravendb ?? {};
|
|
30630
30718
|
const connections = ravendb.connections ?? [];
|
|
30631
30719
|
if (!connections.some((c) => c.name === name)) {
|
|
30632
|
-
console.error(
|
|
30720
|
+
console.error(chalk194.red(`Connection "${name}" not found.`));
|
|
30633
30721
|
console.error(
|
|
30634
30722
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
30635
30723
|
);
|
|
@@ -30645,16 +30733,16 @@ function ravendbSetConnection(name) {
|
|
|
30645
30733
|
var ravendbAuth = createConnectionAuth({
|
|
30646
30734
|
load: loadConnections,
|
|
30647
30735
|
save: saveConnections,
|
|
30648
|
-
format: (c) => `${
|
|
30736
|
+
format: (c) => `${chalk195.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
30649
30737
|
promptNew: promptConnection,
|
|
30650
30738
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
30651
30739
|
});
|
|
30652
30740
|
|
|
30653
30741
|
// src/commands/ravendb/ravendbCollections.ts
|
|
30654
|
-
import
|
|
30742
|
+
import chalk199 from "chalk";
|
|
30655
30743
|
|
|
30656
30744
|
// src/commands/ravendb/ravenFetch.ts
|
|
30657
|
-
import
|
|
30745
|
+
import chalk197 from "chalk";
|
|
30658
30746
|
|
|
30659
30747
|
// src/commands/ravendb/getAccessToken.ts
|
|
30660
30748
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -30691,10 +30779,10 @@ ${errorText}`
|
|
|
30691
30779
|
|
|
30692
30780
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
30693
30781
|
import { execSync as execSync50 } from "child_process";
|
|
30694
|
-
import
|
|
30782
|
+
import chalk196 from "chalk";
|
|
30695
30783
|
function resolveOpSecret(reference2) {
|
|
30696
30784
|
if (!reference2.startsWith("op://")) {
|
|
30697
|
-
console.error(
|
|
30785
|
+
console.error(chalk196.red(`Invalid secret reference: must start with op://`));
|
|
30698
30786
|
process.exit(1);
|
|
30699
30787
|
}
|
|
30700
30788
|
try {
|
|
@@ -30704,7 +30792,7 @@ function resolveOpSecret(reference2) {
|
|
|
30704
30792
|
}).trim();
|
|
30705
30793
|
} catch {
|
|
30706
30794
|
console.error(
|
|
30707
|
-
|
|
30795
|
+
chalk196.red(
|
|
30708
30796
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
30709
30797
|
)
|
|
30710
30798
|
);
|
|
@@ -30731,7 +30819,7 @@ async function ravenFetch(connection, path106) {
|
|
|
30731
30819
|
if (!response.ok) {
|
|
30732
30820
|
const body = await response.text();
|
|
30733
30821
|
console.error(
|
|
30734
|
-
|
|
30822
|
+
chalk197.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
30735
30823
|
);
|
|
30736
30824
|
console.error(body.substring(0, 500));
|
|
30737
30825
|
process.exit(1);
|
|
@@ -30740,7 +30828,7 @@ async function ravenFetch(connection, path106) {
|
|
|
30740
30828
|
}
|
|
30741
30829
|
|
|
30742
30830
|
// src/commands/ravendb/resolveConnection.ts
|
|
30743
|
-
import
|
|
30831
|
+
import chalk198 from "chalk";
|
|
30744
30832
|
function loadRavendb() {
|
|
30745
30833
|
const raw = loadGlobalConfigRaw();
|
|
30746
30834
|
const ravendb = raw.ravendb;
|
|
@@ -30754,7 +30842,7 @@ function resolveConnection(name) {
|
|
|
30754
30842
|
const connectionName = name ?? defaultConnection;
|
|
30755
30843
|
if (!connectionName) {
|
|
30756
30844
|
console.error(
|
|
30757
|
-
|
|
30845
|
+
chalk198.red(
|
|
30758
30846
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
30759
30847
|
)
|
|
30760
30848
|
);
|
|
@@ -30762,7 +30850,7 @@ function resolveConnection(name) {
|
|
|
30762
30850
|
}
|
|
30763
30851
|
const connection = connections.find((c) => c.name === connectionName);
|
|
30764
30852
|
if (!connection) {
|
|
30765
|
-
console.error(
|
|
30853
|
+
console.error(chalk198.red(`Connection "${connectionName}" not found.`));
|
|
30766
30854
|
console.error(
|
|
30767
30855
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
30768
30856
|
);
|
|
@@ -30793,15 +30881,15 @@ async function ravendbCollections(connectionName) {
|
|
|
30793
30881
|
return;
|
|
30794
30882
|
}
|
|
30795
30883
|
for (const c of collections) {
|
|
30796
|
-
console.log(`${
|
|
30884
|
+
console.log(`${chalk199.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
30797
30885
|
}
|
|
30798
30886
|
}
|
|
30799
30887
|
|
|
30800
30888
|
// src/commands/ravendb/ravendbQuery.ts
|
|
30801
|
-
import
|
|
30889
|
+
import chalk201 from "chalk";
|
|
30802
30890
|
|
|
30803
30891
|
// src/commands/ravendb/fetchAllPages.ts
|
|
30804
|
-
import
|
|
30892
|
+
import chalk200 from "chalk";
|
|
30805
30893
|
|
|
30806
30894
|
// src/commands/ravendb/buildQueryPath.ts
|
|
30807
30895
|
function buildQueryPath(opts) {
|
|
@@ -30839,7 +30927,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
30839
30927
|
allResults.push(...results);
|
|
30840
30928
|
start2 += results.length;
|
|
30841
30929
|
process.stderr.write(
|
|
30842
|
-
`\r${
|
|
30930
|
+
`\r${chalk200.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
30843
30931
|
);
|
|
30844
30932
|
if (start2 >= totalResults) break;
|
|
30845
30933
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -30854,7 +30942,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
30854
30942
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
30855
30943
|
const resolved = resolveArgs(connectionName, collection);
|
|
30856
30944
|
if (!resolved.collection && !options2.query) {
|
|
30857
|
-
console.error(
|
|
30945
|
+
console.error(chalk201.red("Provide a collection name or --query filter."));
|
|
30858
30946
|
process.exit(1);
|
|
30859
30947
|
}
|
|
30860
30948
|
const { collection: col } = resolved;
|
|
@@ -30889,7 +30977,7 @@ function registerRavendb(program2) {
|
|
|
30889
30977
|
}
|
|
30890
30978
|
|
|
30891
30979
|
// src/commands/releases/releasesConfigure.ts
|
|
30892
|
-
import
|
|
30980
|
+
import chalk203 from "chalk";
|
|
30893
30981
|
|
|
30894
30982
|
// src/commands/releases/checkStreamGraph.ts
|
|
30895
30983
|
function nodeIds(stream) {
|
|
@@ -30951,26 +31039,26 @@ function readStreamsInput(source) {
|
|
|
30951
31039
|
}
|
|
30952
31040
|
|
|
30953
31041
|
// src/commands/releases/reportDerivedStreams.ts
|
|
30954
|
-
import
|
|
31042
|
+
import chalk202 from "chalk";
|
|
30955
31043
|
function printDerived(stream) {
|
|
30956
31044
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
30957
31045
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
30958
31046
|
console.log(
|
|
30959
|
-
`${
|
|
31047
|
+
`${chalk202.bold(stream.name)} ${chalk202.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
30960
31048
|
);
|
|
30961
31049
|
console.log(
|
|
30962
|
-
` environments: ${environments.join(", ") ||
|
|
31050
|
+
` environments: ${environments.join(", ") || chalk202.dim("none")}`
|
|
30963
31051
|
);
|
|
30964
31052
|
if (steps.length > 0)
|
|
30965
31053
|
console.log(
|
|
30966
31054
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
30967
31055
|
);
|
|
30968
31056
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
30969
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
31057
|
+
console.log(` edges: ${edges.join(", ") || chalk202.dim("none")}`);
|
|
30970
31058
|
}
|
|
30971
31059
|
function reportDerivedStreams(streams, target) {
|
|
30972
31060
|
for (const stream of streams) printDerived(stream);
|
|
30973
|
-
console.log(
|
|
31061
|
+
console.log(chalk202.dim(`Written to ${target}`));
|
|
30974
31062
|
}
|
|
30975
31063
|
|
|
30976
31064
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -31062,8 +31150,8 @@ function writeReleaseStreams(incoming, scope) {
|
|
|
31062
31150
|
|
|
31063
31151
|
// src/commands/releases/releasesConfigure.ts
|
|
31064
31152
|
function fail6(message3, details = []) {
|
|
31065
|
-
console.error(
|
|
31066
|
-
for (const detail of details) console.error(
|
|
31153
|
+
console.error(chalk203.red(message3));
|
|
31154
|
+
for (const detail of details) console.error(chalk203.red(` ${detail}`));
|
|
31067
31155
|
process.exitCode = 1;
|
|
31068
31156
|
}
|
|
31069
31157
|
function reportWritten(incoming, target) {
|
|
@@ -31095,23 +31183,23 @@ function releasesConfigure(options2 = {}) {
|
|
|
31095
31183
|
}
|
|
31096
31184
|
|
|
31097
31185
|
// src/commands/releases/releasesList.ts
|
|
31098
|
-
import
|
|
31186
|
+
import chalk204 from "chalk";
|
|
31099
31187
|
function describeNode(node) {
|
|
31100
31188
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
31101
31189
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
31102
31190
|
}
|
|
31103
31191
|
function printStream(stream) {
|
|
31104
|
-
console.log(`${
|
|
31105
|
-
console.log(
|
|
31192
|
+
console.log(`${chalk204.bold(stream.name)} ${chalk204.dim(stream.repo)}`);
|
|
31193
|
+
console.log(chalk204.dim(` workflow: ${stream.workflow}`));
|
|
31106
31194
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
31107
31195
|
for (const [from, to] of stream.edges)
|
|
31108
|
-
console.log(
|
|
31196
|
+
console.log(chalk204.dim(` ${from} \u2192 ${to}`));
|
|
31109
31197
|
}
|
|
31110
31198
|
function releasesList() {
|
|
31111
31199
|
const streams = loadConfig().releases?.streams ?? [];
|
|
31112
31200
|
if (streams.length === 0) {
|
|
31113
31201
|
console.log(
|
|
31114
|
-
|
|
31202
|
+
chalk204.dim("No release streams configured under releases.streams.")
|
|
31115
31203
|
);
|
|
31116
31204
|
return;
|
|
31117
31205
|
}
|
|
@@ -31156,7 +31244,7 @@ function coverage() {
|
|
|
31156
31244
|
|
|
31157
31245
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
31158
31246
|
import path44 from "path";
|
|
31159
|
-
import
|
|
31247
|
+
import chalk206 from "chalk";
|
|
31160
31248
|
|
|
31161
31249
|
// src/commands/lint/lint/checkFileNames.ts
|
|
31162
31250
|
import fs24 from "fs";
|
|
@@ -31236,7 +31324,7 @@ function checkFileNames() {
|
|
|
31236
31324
|
}
|
|
31237
31325
|
|
|
31238
31326
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
31239
|
-
import
|
|
31327
|
+
import chalk205 from "chalk";
|
|
31240
31328
|
|
|
31241
31329
|
// src/commands/lint/lint/applyMoves.ts
|
|
31242
31330
|
import fs25 from "fs";
|
|
@@ -31321,25 +31409,25 @@ function fixFileNameViolations(moves) {
|
|
|
31321
31409
|
const start2 = performance.now();
|
|
31322
31410
|
const project = createLintProject();
|
|
31323
31411
|
const cwd = process.cwd();
|
|
31324
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
31412
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk205.green(line)));
|
|
31325
31413
|
const ms = (performance.now() - start2).toFixed(0);
|
|
31326
|
-
console.log(
|
|
31414
|
+
console.log(chalk205.dim(` Done in ${ms}ms`));
|
|
31327
31415
|
}
|
|
31328
31416
|
|
|
31329
31417
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
31330
31418
|
function reportViolations(violations) {
|
|
31331
|
-
console.error(
|
|
31419
|
+
console.error(chalk206.red("\nFile name check failed:\n"));
|
|
31332
31420
|
console.error(
|
|
31333
|
-
|
|
31421
|
+
chalk206.red(
|
|
31334
31422
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
31335
31423
|
)
|
|
31336
31424
|
);
|
|
31337
31425
|
for (const violation of violations) {
|
|
31338
|
-
console.error(
|
|
31339
|
-
console.error(
|
|
31426
|
+
console.error(chalk206.red(` ${violation.filePath}`));
|
|
31427
|
+
console.error(chalk206.gray(` Rename to: ${violation.suggestedName}
|
|
31340
31428
|
`));
|
|
31341
31429
|
}
|
|
31342
|
-
console.error(
|
|
31430
|
+
console.error(chalk206.dim(" Run with -f to auto-fix.\n"));
|
|
31343
31431
|
}
|
|
31344
31432
|
function runFileNameCheck(fix = false) {
|
|
31345
31433
|
const violations = checkFileNames();
|
|
@@ -31368,17 +31456,17 @@ function runFileNameCheck(fix = false) {
|
|
|
31368
31456
|
import fs27 from "fs";
|
|
31369
31457
|
|
|
31370
31458
|
// src/commands/lint/shared.ts
|
|
31371
|
-
import
|
|
31459
|
+
import chalk207 from "chalk";
|
|
31372
31460
|
function reportViolations2(violations, checkName2, errorMessage2, successMessage) {
|
|
31373
31461
|
if (violations.length > 0) {
|
|
31374
|
-
console.error(
|
|
31462
|
+
console.error(chalk207.red(`
|
|
31375
31463
|
${checkName2} failed:
|
|
31376
31464
|
`));
|
|
31377
|
-
console.error(
|
|
31465
|
+
console.error(chalk207.red(` ${errorMessage2}
|
|
31378
31466
|
`));
|
|
31379
31467
|
for (const violation of violations) {
|
|
31380
|
-
console.error(
|
|
31381
|
-
console.error(
|
|
31468
|
+
console.error(chalk207.red(` ${violation.filePath}:${violation.line}`));
|
|
31469
|
+
console.error(chalk207.gray(` ${violation.content}
|
|
31382
31470
|
`));
|
|
31383
31471
|
}
|
|
31384
31472
|
return false;
|
|
@@ -31509,7 +31597,7 @@ import { execSync as execSync52 } from "child_process";
|
|
|
31509
31597
|
import { existsSync as existsSync64, mkdirSync as mkdirSync22, unlinkSync as unlinkSync17, writeFileSync as writeFileSync39 } from "fs";
|
|
31510
31598
|
import { tmpdir as tmpdir8 } from "os";
|
|
31511
31599
|
import { join as join80, resolve as resolve22 } from "path";
|
|
31512
|
-
import
|
|
31600
|
+
import chalk208 from "chalk";
|
|
31513
31601
|
|
|
31514
31602
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
31515
31603
|
var captureWindowPs1 = `
|
|
@@ -31660,19 +31748,19 @@ function screenshot(processName) {
|
|
|
31660
31748
|
const config = loadConfig();
|
|
31661
31749
|
const outputDir = resolve22(config.screenshot.outputDir);
|
|
31662
31750
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
31663
|
-
console.log(
|
|
31751
|
+
console.log(chalk208.gray(`Capturing window for process "${processName}" ...`));
|
|
31664
31752
|
try {
|
|
31665
31753
|
runPowerShellScript(processName, outputPath);
|
|
31666
|
-
console.log(
|
|
31754
|
+
console.log(chalk208.green(`Screenshot saved: ${outputPath}`));
|
|
31667
31755
|
} catch (error) {
|
|
31668
31756
|
const msg = error instanceof Error ? error.message : String(error);
|
|
31669
|
-
console.error(
|
|
31757
|
+
console.error(chalk208.red(`Failed to capture screenshot: ${msg}`));
|
|
31670
31758
|
process.exit(1);
|
|
31671
31759
|
}
|
|
31672
31760
|
}
|
|
31673
31761
|
|
|
31674
31762
|
// src/commands/statusLine.ts
|
|
31675
|
-
import
|
|
31763
|
+
import chalk210 from "chalk";
|
|
31676
31764
|
|
|
31677
31765
|
// src/shared/contextLevel.ts
|
|
31678
31766
|
var THRESHOLDS = {
|
|
@@ -31688,7 +31776,7 @@ function contextLevel(pct, harness) {
|
|
|
31688
31776
|
}
|
|
31689
31777
|
|
|
31690
31778
|
// src/commands/buildLimitsSegment.ts
|
|
31691
|
-
import
|
|
31779
|
+
import chalk209 from "chalk";
|
|
31692
31780
|
|
|
31693
31781
|
// src/shared/rateLimitLevel.ts
|
|
31694
31782
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -31726,9 +31814,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
31726
31814
|
|
|
31727
31815
|
// src/commands/buildLimitsSegment.ts
|
|
31728
31816
|
var LEVEL_COLOR = {
|
|
31729
|
-
ok:
|
|
31730
|
-
warn:
|
|
31731
|
-
over:
|
|
31817
|
+
ok: chalk209.green,
|
|
31818
|
+
warn: chalk209.yellow,
|
|
31819
|
+
over: chalk209.red
|
|
31732
31820
|
};
|
|
31733
31821
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
31734
31822
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -31824,7 +31912,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
31824
31912
|
}
|
|
31825
31913
|
|
|
31826
31914
|
// src/commands/statusLine.ts
|
|
31827
|
-
|
|
31915
|
+
chalk210.level = 3;
|
|
31828
31916
|
function formatNumber(num) {
|
|
31829
31917
|
return num.toLocaleString("en-US");
|
|
31830
31918
|
}
|
|
@@ -31832,9 +31920,9 @@ function colorizePercent(pct) {
|
|
|
31832
31920
|
const label2 = `${Math.round(pct)}%`;
|
|
31833
31921
|
switch (contextLevel(pct)) {
|
|
31834
31922
|
case "red":
|
|
31835
|
-
return
|
|
31923
|
+
return chalk210.red(label2);
|
|
31836
31924
|
case "yellow":
|
|
31837
|
-
return
|
|
31925
|
+
return chalk210.yellow(label2);
|
|
31838
31926
|
default:
|
|
31839
31927
|
return label2;
|
|
31840
31928
|
}
|
|
@@ -31847,7 +31935,7 @@ async function statusLine() {
|
|
|
31847
31935
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
31848
31936
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
31849
31937
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
31850
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
31938
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk210.cyan(branch2)} | ` : "";
|
|
31851
31939
|
console.log(
|
|
31852
31940
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
31853
31941
|
);
|
|
@@ -31950,7 +32038,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
31950
32038
|
import * as path46 from "path";
|
|
31951
32039
|
|
|
31952
32040
|
// src/commands/refactor/logViolations.ts
|
|
31953
|
-
import
|
|
32041
|
+
import chalk211 from "chalk";
|
|
31954
32042
|
var DEFAULT_MAX_LINES2 = 100;
|
|
31955
32043
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
31956
32044
|
if (violations.length === 0) {
|
|
@@ -31959,43 +32047,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
31959
32047
|
}
|
|
31960
32048
|
return;
|
|
31961
32049
|
}
|
|
31962
|
-
console.error(
|
|
32050
|
+
console.error(chalk211.red(`
|
|
31963
32051
|
Refactor check failed:
|
|
31964
32052
|
`));
|
|
31965
|
-
console.error(
|
|
32053
|
+
console.error(chalk211.red(` The following files exceed ${maxLines} lines:
|
|
31966
32054
|
`));
|
|
31967
32055
|
for (const violation of violations) {
|
|
31968
|
-
console.error(
|
|
32056
|
+
console.error(chalk211.red(` ${violation.file} (${violation.lines} lines)`));
|
|
31969
32057
|
}
|
|
31970
32058
|
console.error(
|
|
31971
|
-
|
|
32059
|
+
chalk211.yellow(
|
|
31972
32060
|
`
|
|
31973
32061
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
31974
32062
|
way to refactor it, ignore it with:
|
|
31975
32063
|
`
|
|
31976
32064
|
)
|
|
31977
32065
|
);
|
|
31978
|
-
console.error(
|
|
32066
|
+
console.error(chalk211.gray(` assist refactor ignore <file>
|
|
31979
32067
|
`));
|
|
31980
32068
|
if (process.env.CLAUDECODE) {
|
|
31981
|
-
console.error(
|
|
32069
|
+
console.error(chalk211.cyan(`
|
|
31982
32070
|
## Extracting Code to New Files
|
|
31983
32071
|
`));
|
|
31984
32072
|
console.error(
|
|
31985
|
-
|
|
32073
|
+
chalk211.cyan(
|
|
31986
32074
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
31987
32075
|
`
|
|
31988
32076
|
)
|
|
31989
32077
|
);
|
|
31990
32078
|
console.error(
|
|
31991
|
-
|
|
32079
|
+
chalk211.cyan(
|
|
31992
32080
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
31993
32081
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
31994
32082
|
`
|
|
31995
32083
|
)
|
|
31996
32084
|
);
|
|
31997
32085
|
console.error(
|
|
31998
|
-
|
|
32086
|
+
chalk211.cyan(
|
|
31999
32087
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
32000
32088
|
domains, move it to a common/shared folder.
|
|
32001
32089
|
`
|
|
@@ -32151,7 +32239,7 @@ async function check(pattern2, options2) {
|
|
|
32151
32239
|
|
|
32152
32240
|
// src/commands/refactor/extract.ts
|
|
32153
32241
|
import path54 from "path";
|
|
32154
|
-
import
|
|
32242
|
+
import chalk214 from "chalk";
|
|
32155
32243
|
|
|
32156
32244
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
32157
32245
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -32759,23 +32847,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
32759
32847
|
|
|
32760
32848
|
// src/commands/refactor/extract/displayPlan.ts
|
|
32761
32849
|
import path50 from "path";
|
|
32762
|
-
import
|
|
32850
|
+
import chalk212 from "chalk";
|
|
32763
32851
|
function section(title) {
|
|
32764
32852
|
return `
|
|
32765
|
-
${
|
|
32853
|
+
${chalk212.cyan(title)}`;
|
|
32766
32854
|
}
|
|
32767
32855
|
function displayImporters(plan2, cwd) {
|
|
32768
32856
|
if (plan2.importersToUpdate.length === 0) return;
|
|
32769
32857
|
console.log(section("Update importers:"));
|
|
32770
32858
|
for (const imp of plan2.importersToUpdate) {
|
|
32771
32859
|
const rel = path50.relative(cwd, imp.file.getFilePath());
|
|
32772
|
-
console.log(` ${
|
|
32860
|
+
console.log(` ${chalk212.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
32773
32861
|
}
|
|
32774
32862
|
}
|
|
32775
32863
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
32776
|
-
console.log(
|
|
32864
|
+
console.log(chalk212.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
32777
32865
|
`));
|
|
32778
|
-
console.log(` ${
|
|
32866
|
+
console.log(` ${chalk212.cyan("Functions to move:")}`);
|
|
32779
32867
|
for (const name of plan2.extractedNames) {
|
|
32780
32868
|
console.log(` ${name}`);
|
|
32781
32869
|
}
|
|
@@ -32809,7 +32897,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
32809
32897
|
|
|
32810
32898
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
32811
32899
|
import path53 from "path";
|
|
32812
|
-
import
|
|
32900
|
+
import chalk213 from "chalk";
|
|
32813
32901
|
import { Project as Project3 } from "ts-morph";
|
|
32814
32902
|
|
|
32815
32903
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -32901,7 +32989,7 @@ function loadProjectFile(file) {
|
|
|
32901
32989
|
});
|
|
32902
32990
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
32903
32991
|
if (!sourceFile) {
|
|
32904
|
-
console.log(
|
|
32992
|
+
console.log(chalk213.red(`File not found in project: ${file}`));
|
|
32905
32993
|
process.exit(1);
|
|
32906
32994
|
}
|
|
32907
32995
|
return { project, sourceFile };
|
|
@@ -32924,19 +33012,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
32924
33012
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
32925
33013
|
if (options2.apply) {
|
|
32926
33014
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
32927
|
-
console.log(
|
|
33015
|
+
console.log(chalk214.green("\nExtraction complete"));
|
|
32928
33016
|
} else {
|
|
32929
|
-
console.log(
|
|
33017
|
+
console.log(chalk214.dim("\nDry run. Use --apply to execute."));
|
|
32930
33018
|
}
|
|
32931
33019
|
}
|
|
32932
33020
|
|
|
32933
33021
|
// src/commands/refactor/ignore.ts
|
|
32934
33022
|
import fs33 from "fs";
|
|
32935
|
-
import
|
|
33023
|
+
import chalk215 from "chalk";
|
|
32936
33024
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
32937
33025
|
function ignore2(file) {
|
|
32938
33026
|
if (!fs33.existsSync(file)) {
|
|
32939
|
-
console.error(
|
|
33027
|
+
console.error(chalk215.red(`Error: File does not exist: ${file}`));
|
|
32940
33028
|
process.exit(1);
|
|
32941
33029
|
}
|
|
32942
33030
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -32952,7 +33040,7 @@ function ignore2(file) {
|
|
|
32952
33040
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
32953
33041
|
}
|
|
32954
33042
|
console.log(
|
|
32955
|
-
|
|
33043
|
+
chalk215.green(
|
|
32956
33044
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
32957
33045
|
)
|
|
32958
33046
|
);
|
|
@@ -32961,12 +33049,12 @@ function ignore2(file) {
|
|
|
32961
33049
|
// src/commands/refactor/rename.ts
|
|
32962
33050
|
import fs36 from "fs";
|
|
32963
33051
|
import path60 from "path";
|
|
32964
|
-
import
|
|
33052
|
+
import chalk218 from "chalk";
|
|
32965
33053
|
|
|
32966
33054
|
// src/commands/refactor/rename/applyRename.ts
|
|
32967
33055
|
import fs35 from "fs";
|
|
32968
33056
|
import path56 from "path";
|
|
32969
|
-
import
|
|
33057
|
+
import chalk216 from "chalk";
|
|
32970
33058
|
|
|
32971
33059
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
32972
33060
|
import path55 from "path";
|
|
@@ -33072,13 +33160,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
33072
33160
|
const updatedContents = applyRewrites(rewrites);
|
|
33073
33161
|
for (const [file, content] of updatedContents) {
|
|
33074
33162
|
fs35.writeFileSync(file, content, "utf8");
|
|
33075
|
-
console.log(
|
|
33163
|
+
console.log(chalk216.cyan(` Updated imports in ${path56.relative(cwd, file)}`));
|
|
33076
33164
|
}
|
|
33077
33165
|
const destDir = path56.dirname(destPath);
|
|
33078
33166
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
33079
33167
|
fs35.renameSync(sourcePath, destPath);
|
|
33080
33168
|
console.log(
|
|
33081
|
-
|
|
33169
|
+
chalk216.white(
|
|
33082
33170
|
` Moved ${path56.relative(cwd, sourcePath)} \u2192 ${path56.relative(cwd, destPath)}`
|
|
33083
33171
|
)
|
|
33084
33172
|
);
|
|
@@ -33228,16 +33316,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
33228
33316
|
|
|
33229
33317
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
33230
33318
|
import path59 from "path";
|
|
33231
|
-
import
|
|
33319
|
+
import chalk217 from "chalk";
|
|
33232
33320
|
function printRenamePreview(rewrites, cwd) {
|
|
33233
33321
|
for (const rewrite of rewrites) {
|
|
33234
33322
|
console.log(
|
|
33235
|
-
|
|
33323
|
+
chalk217.dim(
|
|
33236
33324
|
` ${path59.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
33237
33325
|
)
|
|
33238
33326
|
);
|
|
33239
33327
|
}
|
|
33240
|
-
console.log(
|
|
33328
|
+
console.log(chalk217.dim("Dry run. Use --apply to execute."));
|
|
33241
33329
|
}
|
|
33242
33330
|
|
|
33243
33331
|
// src/commands/refactor/rename.ts
|
|
@@ -33248,20 +33336,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
33248
33336
|
const relSource = path60.relative(cwd, sourcePath);
|
|
33249
33337
|
const relDest = path60.relative(cwd, destPath);
|
|
33250
33338
|
if (!fs36.existsSync(sourcePath)) {
|
|
33251
|
-
console.log(
|
|
33339
|
+
console.log(chalk218.red(`File not found: ${source}`));
|
|
33252
33340
|
process.exit(1);
|
|
33253
33341
|
}
|
|
33254
33342
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
33255
|
-
console.log(
|
|
33343
|
+
console.log(chalk218.red(`Destination already exists: ${destination}`));
|
|
33256
33344
|
process.exit(1);
|
|
33257
33345
|
}
|
|
33258
|
-
console.log(
|
|
33259
|
-
console.log(
|
|
33260
|
-
console.log(
|
|
33346
|
+
console.log(chalk218.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
33347
|
+
console.log(chalk218.dim("Loading project..."));
|
|
33348
|
+
console.log(chalk218.dim("Scanning imports across the project..."));
|
|
33261
33349
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
33262
33350
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
33263
33351
|
console.log(
|
|
33264
|
-
|
|
33352
|
+
chalk218.dim(
|
|
33265
33353
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
33266
33354
|
)
|
|
33267
33355
|
);
|
|
@@ -33270,11 +33358,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
33270
33358
|
return;
|
|
33271
33359
|
}
|
|
33272
33360
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
33273
|
-
console.log(
|
|
33361
|
+
console.log(chalk218.green("Done"));
|
|
33274
33362
|
}
|
|
33275
33363
|
|
|
33276
33364
|
// src/commands/refactor/renameSymbol.ts
|
|
33277
|
-
import
|
|
33365
|
+
import chalk219 from "chalk";
|
|
33278
33366
|
|
|
33279
33367
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
33280
33368
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -33320,34 +33408,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
33320
33408
|
const { project, sourceFile } = loadProjectFile(file);
|
|
33321
33409
|
const symbol = findSymbol(sourceFile, oldName);
|
|
33322
33410
|
if (!symbol) {
|
|
33323
|
-
console.log(
|
|
33411
|
+
console.log(chalk219.red(`Symbol "${oldName}" not found in ${file}`));
|
|
33324
33412
|
process.exit(1);
|
|
33325
33413
|
}
|
|
33326
33414
|
const grouped = groupReferences(symbol, cwd);
|
|
33327
33415
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
33328
33416
|
console.log(
|
|
33329
|
-
|
|
33417
|
+
chalk219.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
33330
33418
|
`)
|
|
33331
33419
|
);
|
|
33332
33420
|
for (const [refFile, lines2] of grouped) {
|
|
33333
33421
|
console.log(
|
|
33334
|
-
` ${
|
|
33422
|
+
` ${chalk219.dim(refFile)}: lines ${chalk219.cyan(lines2.join(", "))}`
|
|
33335
33423
|
);
|
|
33336
33424
|
}
|
|
33337
33425
|
if (options2.apply) {
|
|
33338
33426
|
symbol.rename(newName);
|
|
33339
33427
|
await project.save();
|
|
33340
|
-
console.log(
|
|
33428
|
+
console.log(chalk219.green(`
|
|
33341
33429
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
33342
33430
|
} else {
|
|
33343
|
-
console.log(
|
|
33431
|
+
console.log(chalk219.dim("\nDry run. Use --apply to execute."));
|
|
33344
33432
|
}
|
|
33345
33433
|
}
|
|
33346
33434
|
|
|
33347
33435
|
// src/commands/refactor/restructure.ts
|
|
33348
33436
|
import fs38 from "fs";
|
|
33349
33437
|
import path80 from "path";
|
|
33350
|
-
import
|
|
33438
|
+
import chalk228 from "chalk";
|
|
33351
33439
|
|
|
33352
33440
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
33353
33441
|
import path71 from "path";
|
|
@@ -33684,7 +33772,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
33684
33772
|
}
|
|
33685
33773
|
|
|
33686
33774
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
33687
|
-
import
|
|
33775
|
+
import chalk223 from "chalk";
|
|
33688
33776
|
|
|
33689
33777
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
33690
33778
|
import path72 from "path";
|
|
@@ -33695,13 +33783,13 @@ function applyCommand(scopeRoot) {
|
|
|
33695
33783
|
|
|
33696
33784
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
33697
33785
|
import path73 from "path";
|
|
33698
|
-
import
|
|
33786
|
+
import chalk220 from "chalk";
|
|
33699
33787
|
var shownMoves = 20;
|
|
33700
33788
|
function displayDrift(plan2, listMoves) {
|
|
33701
33789
|
const rel = (file) => path73.relative(process.cwd(), file);
|
|
33702
33790
|
if (plan2.moves.length > 0) {
|
|
33703
33791
|
console.log(
|
|
33704
|
-
|
|
33792
|
+
chalk220.red(
|
|
33705
33793
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
33706
33794
|
)
|
|
33707
33795
|
);
|
|
@@ -33709,17 +33797,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
33709
33797
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
33710
33798
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
33711
33799
|
if (plan2.moves.length > shownMoves)
|
|
33712
|
-
console.log(
|
|
33800
|
+
console.log(chalk220.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
33713
33801
|
}
|
|
33714
33802
|
}
|
|
33715
|
-
for (const error of plan2.errors) console.log(
|
|
33803
|
+
for (const error of plan2.errors) console.log(chalk220.red(error));
|
|
33716
33804
|
}
|
|
33717
33805
|
|
|
33718
33806
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
33719
|
-
import
|
|
33807
|
+
import chalk222 from "chalk";
|
|
33720
33808
|
|
|
33721
33809
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
33722
|
-
import
|
|
33810
|
+
import chalk221 from "chalk";
|
|
33723
33811
|
var shownChains = 10;
|
|
33724
33812
|
function formatChain(chain2) {
|
|
33725
33813
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -33729,20 +33817,20 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
33729
33817
|
if (chains.length === 0) return;
|
|
33730
33818
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
33731
33819
|
console.log(
|
|
33732
|
-
|
|
33820
|
+
chalk221.red(
|
|
33733
33821
|
`
|
|
33734
33822
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
33735
33823
|
)
|
|
33736
33824
|
);
|
|
33737
33825
|
console.log(
|
|
33738
|
-
|
|
33826
|
+
chalk221.bold(
|
|
33739
33827
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
33740
33828
|
)
|
|
33741
33829
|
);
|
|
33742
33830
|
for (const chain2 of chains.slice(0, shownChains))
|
|
33743
33831
|
console.log(formatChain(chain2));
|
|
33744
33832
|
if (chains.length > shownChains)
|
|
33745
|
-
console.log(
|
|
33833
|
+
console.log(chalk221.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
33746
33834
|
}
|
|
33747
33835
|
|
|
33748
33836
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
@@ -33763,7 +33851,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
33763
33851
|
if (!exceedsLayoutLimits(limits)) return;
|
|
33764
33852
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
33765
33853
|
console.log("");
|
|
33766
|
-
for (const line of pinSteps(apply)) console.log(
|
|
33854
|
+
for (const line of pinSteps(apply)) console.log(chalk222.yellow(line));
|
|
33767
33855
|
}
|
|
33768
33856
|
|
|
33769
33857
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -33775,14 +33863,14 @@ function checkPlan(plan2, limits) {
|
|
|
33775
33863
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
33776
33864
|
if (plan2.moves.length > 0) {
|
|
33777
33865
|
console.log(
|
|
33778
|
-
|
|
33866
|
+
chalk223.yellow(
|
|
33779
33867
|
`
|
|
33780
33868
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
33781
33869
|
)
|
|
33782
33870
|
);
|
|
33783
33871
|
process.exit(1);
|
|
33784
33872
|
}
|
|
33785
|
-
console.log(
|
|
33873
|
+
console.log(chalk223.green("Layout matches the restructure plan"));
|
|
33786
33874
|
}
|
|
33787
33875
|
|
|
33788
33876
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -33844,15 +33932,15 @@ function partitionIgnored(files) {
|
|
|
33844
33932
|
}
|
|
33845
33933
|
|
|
33846
33934
|
// src/commands/refactor/restructure/runPlan.ts
|
|
33847
|
-
import
|
|
33935
|
+
import chalk227 from "chalk";
|
|
33848
33936
|
|
|
33849
33937
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
33850
|
-
import
|
|
33938
|
+
import chalk225 from "chalk";
|
|
33851
33939
|
|
|
33852
33940
|
// src/commands/refactor/restructure/executePlan.ts
|
|
33853
33941
|
import fs37 from "fs";
|
|
33854
33942
|
import path76 from "path";
|
|
33855
|
-
import
|
|
33943
|
+
import chalk224 from "chalk";
|
|
33856
33944
|
function relPath(file) {
|
|
33857
33945
|
return path76.relative(process.cwd(), file);
|
|
33858
33946
|
}
|
|
@@ -33869,14 +33957,14 @@ function moveFiles(moves) {
|
|
|
33869
33957
|
fs37.mkdirSync(path76.dirname(move2.to), { recursive: true });
|
|
33870
33958
|
fs37.renameSync(staging, move2.to);
|
|
33871
33959
|
console.log(
|
|
33872
|
-
|
|
33960
|
+
chalk224.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
33873
33961
|
);
|
|
33874
33962
|
}
|
|
33875
33963
|
}
|
|
33876
33964
|
function removeIfEmpty(dir) {
|
|
33877
33965
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
33878
33966
|
fs37.rmdirSync(dir);
|
|
33879
|
-
console.log(
|
|
33967
|
+
console.log(chalk224.dim(` Removed empty directory ${relPath(dir)}`));
|
|
33880
33968
|
return true;
|
|
33881
33969
|
}
|
|
33882
33970
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -33889,7 +33977,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
33889
33977
|
function executePlan(plan2) {
|
|
33890
33978
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
33891
33979
|
fs37.writeFileSync(file, content, "utf8");
|
|
33892
|
-
console.log(
|
|
33980
|
+
console.log(chalk224.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
33893
33981
|
}
|
|
33894
33982
|
moveFiles(plan2.moves);
|
|
33895
33983
|
removeEmptyDirectories(
|
|
@@ -33901,17 +33989,17 @@ function executePlan(plan2) {
|
|
|
33901
33989
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
33902
33990
|
function applyPlan(plan2) {
|
|
33903
33991
|
if (plan2.errors.length > 0) {
|
|
33904
|
-
console.log(
|
|
33992
|
+
console.log(chalk225.red("\nResolve the errors above before applying."));
|
|
33905
33993
|
process.exit(1);
|
|
33906
33994
|
}
|
|
33907
|
-
console.log(
|
|
33995
|
+
console.log(chalk225.bold("\nApplying changes..."));
|
|
33908
33996
|
executePlan(plan2);
|
|
33909
|
-
console.log(
|
|
33997
|
+
console.log(chalk225.green("\nRestructuring complete"));
|
|
33910
33998
|
}
|
|
33911
33999
|
|
|
33912
34000
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
33913
34001
|
import path79 from "path";
|
|
33914
|
-
import
|
|
34002
|
+
import chalk226 from "chalk";
|
|
33915
34003
|
|
|
33916
34004
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
33917
34005
|
import path77 from "path";
|
|
@@ -33962,17 +34050,17 @@ function relPath2(filePath) {
|
|
|
33962
34050
|
}
|
|
33963
34051
|
function displayMoves(plan2) {
|
|
33964
34052
|
if (plan2.moves.length === 0) return;
|
|
33965
|
-
console.log(
|
|
34053
|
+
console.log(chalk226.bold("\nFile moves:"));
|
|
33966
34054
|
for (const move2 of plan2.moves) {
|
|
33967
34055
|
console.log(
|
|
33968
|
-
` ${
|
|
34056
|
+
` ${chalk226.red(relPath2(move2.from))} \u2192 ${chalk226.green(relPath2(move2.to))}`
|
|
33969
34057
|
);
|
|
33970
|
-
console.log(
|
|
34058
|
+
console.log(chalk226.dim(` ${move2.reason}`));
|
|
33971
34059
|
}
|
|
33972
34060
|
}
|
|
33973
34061
|
function displayTree(plan2) {
|
|
33974
34062
|
console.log(
|
|
33975
|
-
|
|
34063
|
+
chalk226.bold(`
|
|
33976
34064
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
33977
34065
|
);
|
|
33978
34066
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -33983,15 +34071,15 @@ function displayDepthStats(plan2) {
|
|
|
33983
34071
|
plan2.targets.values(),
|
|
33984
34072
|
plan2.scopeRoot
|
|
33985
34073
|
);
|
|
33986
|
-
console.log(
|
|
34074
|
+
console.log(chalk226.bold(`
|
|
33987
34075
|
Depth (max ${max}):`));
|
|
33988
34076
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
33989
34077
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
33990
34078
|
}
|
|
33991
34079
|
function displayErrors(errors) {
|
|
33992
34080
|
if (errors.length === 0) return;
|
|
33993
|
-
console.log(
|
|
33994
|
-
for (const error of errors) console.log(
|
|
34081
|
+
console.log(chalk226.red("\nErrors:"));
|
|
34082
|
+
for (const error of errors) console.log(chalk226.red(` ${error}`));
|
|
33995
34083
|
}
|
|
33996
34084
|
function displayPlan2(plan2) {
|
|
33997
34085
|
displayMoves(plan2);
|
|
@@ -34000,7 +34088,7 @@ function displayPlan2(plan2) {
|
|
|
34000
34088
|
displayErrors(plan2.errors);
|
|
34001
34089
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
34002
34090
|
console.log(
|
|
34003
|
-
|
|
34091
|
+
chalk226.dim(
|
|
34004
34092
|
`
|
|
34005
34093
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
34006
34094
|
)
|
|
@@ -34012,11 +34100,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
34012
34100
|
displayPlan2(plan2);
|
|
34013
34101
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
34014
34102
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
34015
|
-
console.log(
|
|
34103
|
+
console.log(chalk227.green("No restructuring needed"));
|
|
34016
34104
|
return;
|
|
34017
34105
|
}
|
|
34018
34106
|
if (!apply) {
|
|
34019
|
-
console.log(
|
|
34107
|
+
console.log(chalk227.dim("\nDry run. Use --apply to execute."));
|
|
34020
34108
|
return;
|
|
34021
34109
|
}
|
|
34022
34110
|
applyPlan(plan2);
|
|
@@ -34026,14 +34114,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
34026
34114
|
async function restructure(root2, options2 = {}) {
|
|
34027
34115
|
const scopeRoot = path80.resolve(root2 ?? "src");
|
|
34028
34116
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
34029
|
-
console.log(
|
|
34117
|
+
console.log(chalk228.red(`Not a directory: ${root2 ?? "src"}`));
|
|
34030
34118
|
process.exit(1);
|
|
34031
34119
|
}
|
|
34032
34120
|
const found = [];
|
|
34033
34121
|
walkSourceFiles(scopeRoot, found);
|
|
34034
34122
|
const { scoped, ignored } = partitionIgnored(found);
|
|
34035
34123
|
if (scoped.length === 0) {
|
|
34036
|
-
console.log(
|
|
34124
|
+
console.log(chalk228.yellow("No files found under root"));
|
|
34037
34125
|
return;
|
|
34038
34126
|
}
|
|
34039
34127
|
const { pin: pin2 = [], maxDepth = 10 } = loadConfig().restructure ?? {};
|
|
@@ -34095,7 +34183,7 @@ async function checkoutOnlySession(number) {
|
|
|
34095
34183
|
}
|
|
34096
34184
|
|
|
34097
34185
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
34098
|
-
import
|
|
34186
|
+
import chalk232 from "chalk";
|
|
34099
34187
|
|
|
34100
34188
|
// src/commands/config/promptConfigScope.ts
|
|
34101
34189
|
import Enquirer3 from "enquirer";
|
|
@@ -34121,7 +34209,7 @@ async function promptConfigScope() {
|
|
|
34121
34209
|
}
|
|
34122
34210
|
|
|
34123
34211
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
34124
|
-
import
|
|
34212
|
+
import chalk229 from "chalk";
|
|
34125
34213
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
34126
34214
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
34127
34215
|
for (; ; ) {
|
|
@@ -34129,7 +34217,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
34129
34217
|
if (answer === "") return void 0;
|
|
34130
34218
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
34131
34219
|
if (coercion.ok) return coercion.value;
|
|
34132
|
-
console.error(
|
|
34220
|
+
console.error(chalk229.red(coercion.error));
|
|
34133
34221
|
}
|
|
34134
34222
|
}
|
|
34135
34223
|
function coerceSupplied(key, supplied) {
|
|
@@ -34190,7 +34278,7 @@ function suggestGlobs(current, proposed) {
|
|
|
34190
34278
|
}
|
|
34191
34279
|
|
|
34192
34280
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
34193
|
-
import
|
|
34281
|
+
import chalk230 from "chalk";
|
|
34194
34282
|
function parseConfigureAnswers(answers) {
|
|
34195
34283
|
const known = Object.values(highLevelConfigKeys);
|
|
34196
34284
|
const parsed = {};
|
|
@@ -34208,13 +34296,13 @@ function answersCoverEveryKey(answers) {
|
|
|
34208
34296
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
34209
34297
|
}
|
|
34210
34298
|
function exitWith(message3) {
|
|
34211
|
-
console.error(
|
|
34299
|
+
console.error(chalk230.red(`Error: ${message3}.`));
|
|
34212
34300
|
process.exit(1);
|
|
34213
34301
|
}
|
|
34214
34302
|
|
|
34215
34303
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
34216
34304
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
34217
|
-
import
|
|
34305
|
+
import chalk231 from "chalk";
|
|
34218
34306
|
|
|
34219
34307
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
34220
34308
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -34307,12 +34395,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
34307
34395
|
const tree = summariseRepoTree(cwd);
|
|
34308
34396
|
if (tree === "") return NOTHING_PROPOSED;
|
|
34309
34397
|
console.log(
|
|
34310
|
-
|
|
34398
|
+
chalk231.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
34311
34399
|
);
|
|
34312
34400
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
34313
34401
|
if (output === void 0) {
|
|
34314
34402
|
console.log(
|
|
34315
|
-
|
|
34403
|
+
chalk231.yellow(
|
|
34316
34404
|
"Claude proposed nothing; answer each key from its current value."
|
|
34317
34405
|
)
|
|
34318
34406
|
);
|
|
@@ -34368,25 +34456,25 @@ function asConfigKeyScope(value) {
|
|
|
34368
34456
|
function reportConfigured(result) {
|
|
34369
34457
|
for (const write of result.written)
|
|
34370
34458
|
console.log(
|
|
34371
|
-
|
|
34459
|
+
chalk232.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
34372
34460
|
);
|
|
34373
|
-
for (const key of result.skipped) console.log(
|
|
34374
|
-
console.log(
|
|
34461
|
+
for (const key of result.skipped) console.log(chalk232.dim(`Left ${key} unset`));
|
|
34462
|
+
console.log(chalk232.dim(`Written to ${result.target}`));
|
|
34375
34463
|
}
|
|
34376
34464
|
|
|
34377
34465
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
34378
|
-
import
|
|
34466
|
+
import chalk233 from "chalk";
|
|
34379
34467
|
function announceSavedReview(subject, force) {
|
|
34380
34468
|
const head = subject.headSha.slice(0, 7);
|
|
34381
34469
|
if (subject.saved)
|
|
34382
34470
|
console.log(
|
|
34383
|
-
|
|
34471
|
+
chalk233.dim(
|
|
34384
34472
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
34385
34473
|
)
|
|
34386
34474
|
);
|
|
34387
34475
|
else if (force)
|
|
34388
34476
|
console.log(
|
|
34389
|
-
|
|
34477
|
+
chalk233.dim(
|
|
34390
34478
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
34391
34479
|
)
|
|
34392
34480
|
);
|
|
@@ -34927,55 +35015,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
34927
35015
|
}
|
|
34928
35016
|
|
|
34929
35017
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
34930
|
-
import
|
|
35018
|
+
import chalk237 from "chalk";
|
|
34931
35019
|
|
|
34932
35020
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
34933
|
-
import
|
|
35021
|
+
import chalk234 from "chalk";
|
|
34934
35022
|
var PATCH_LINE_COLOURS = {
|
|
34935
|
-
"+":
|
|
34936
|
-
"-":
|
|
34937
|
-
"@":
|
|
35023
|
+
"+": chalk234.green,
|
|
35024
|
+
"-": chalk234.red,
|
|
35025
|
+
"@": chalk234.cyan
|
|
34938
35026
|
};
|
|
34939
35027
|
function formatPatch(patch2) {
|
|
34940
35028
|
return patch2.split("\n").map(
|
|
34941
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
35029
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk234.dim)(line)}`
|
|
34942
35030
|
);
|
|
34943
35031
|
}
|
|
34944
35032
|
function formatDiff(diff3) {
|
|
34945
35033
|
return [
|
|
34946
35034
|
"",
|
|
34947
|
-
` ${
|
|
34948
|
-
...diff3.patch === null ? [` ${
|
|
35035
|
+
` ${chalk234.bold(diff3.path)} ${chalk234.dim(`(${diff3.status})`)} ${chalk234.green(`+${diff3.additions}`)} ${chalk234.red(`-${diff3.deletions}`)}`,
|
|
35036
|
+
...diff3.patch === null ? [` ${chalk234.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
34949
35037
|
];
|
|
34950
35038
|
}
|
|
34951
35039
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
34952
35040
|
if (criticalPaths.length === 0)
|
|
34953
|
-
return `${
|
|
34954
|
-
${
|
|
35041
|
+
return `${chalk234.bold.underline("Critical diffs")}
|
|
35042
|
+
${chalk234.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
34955
35043
|
if (diffs.length === 0)
|
|
34956
|
-
return `${
|
|
34957
|
-
${
|
|
35044
|
+
return `${chalk234.bold.underline("Critical diffs")}
|
|
35045
|
+
${chalk234.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
34958
35046
|
return [
|
|
34959
|
-
|
|
35047
|
+
chalk234.bold.underline("Critical diffs"),
|
|
34960
35048
|
...diffs.flatMap(formatDiff)
|
|
34961
35049
|
].join("\n");
|
|
34962
35050
|
}
|
|
34963
35051
|
|
|
34964
35052
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
34965
|
-
import
|
|
35053
|
+
import chalk235 from "chalk";
|
|
34966
35054
|
var MARKERS = {
|
|
34967
|
-
pass: () =>
|
|
34968
|
-
fail: () =>
|
|
34969
|
-
manual: () =>
|
|
35055
|
+
pass: () => chalk235.green("\u2714"),
|
|
35056
|
+
fail: () => chalk235.red("\u2718"),
|
|
35057
|
+
manual: () => chalk235.yellow("\u25A1")
|
|
34970
35058
|
};
|
|
34971
35059
|
function formatCheck(check2) {
|
|
34972
|
-
const title = check2.status === "fail" ?
|
|
35060
|
+
const title = check2.status === "fail" ? chalk235.red(check2.title) : chalk235.bold(check2.title);
|
|
34973
35061
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
34974
|
-
${
|
|
35062
|
+
${chalk235.dim(check2.reason)}`;
|
|
34975
35063
|
}
|
|
34976
35064
|
function formatGroup(heading2, checks2) {
|
|
34977
35065
|
if (checks2.length === 0) return [];
|
|
34978
|
-
return ["",
|
|
35066
|
+
return ["", chalk235.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
34979
35067
|
}
|
|
34980
35068
|
function formatHighLevelChecklist(checks2) {
|
|
34981
35069
|
const deterministic = checks2.filter(
|
|
@@ -34984,7 +35072,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
34984
35072
|
const failed3 = deterministic.filter(
|
|
34985
35073
|
(check2) => check2.status === "fail"
|
|
34986
35074
|
).length;
|
|
34987
|
-
const summary = failed3 === 0 ?
|
|
35075
|
+
const summary = failed3 === 0 ? chalk235.green(`All ${deterministic.length} deterministic checks pass`) : chalk235.red(
|
|
34988
35076
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
34989
35077
|
);
|
|
34990
35078
|
return [
|
|
@@ -34999,30 +35087,30 @@ function formatHighLevelChecklist(checks2) {
|
|
|
34999
35087
|
}
|
|
35000
35088
|
|
|
35001
35089
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
35002
|
-
import
|
|
35090
|
+
import chalk236 from "chalk";
|
|
35003
35091
|
var STATUS_MARKERS = {
|
|
35004
|
-
added: () =>
|
|
35005
|
-
removed: () =>
|
|
35006
|
-
modified: () =>
|
|
35092
|
+
added: () => chalk236.green("A"),
|
|
35093
|
+
removed: () => chalk236.red("D"),
|
|
35094
|
+
modified: () => chalk236.yellow("M")
|
|
35007
35095
|
};
|
|
35008
35096
|
function counts(additions, deletions) {
|
|
35009
|
-
return `${
|
|
35097
|
+
return `${chalk236.green(`+${additions}`)} ${chalk236.red(`-${deletions}`)}`;
|
|
35010
35098
|
}
|
|
35011
35099
|
function formatNode(node, indent3) {
|
|
35012
35100
|
if (node.kind === "file")
|
|
35013
35101
|
return [
|
|
35014
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
35102
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk236.dim(counts(node.additions, node.deletions))}`
|
|
35015
35103
|
];
|
|
35016
35104
|
const dir = node;
|
|
35017
35105
|
return [
|
|
35018
|
-
`${indent3}${
|
|
35106
|
+
`${indent3}${chalk236.bold(`${dir.name}/`)} ${chalk236.dim(counts(dir.additions, dir.deletions))}`,
|
|
35019
35107
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
35020
35108
|
];
|
|
35021
35109
|
}
|
|
35022
35110
|
function formatHighLevelStructure(structure) {
|
|
35023
35111
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
35024
35112
|
return [
|
|
35025
|
-
|
|
35113
|
+
chalk236.bold.underline("Structure"),
|
|
35026
35114
|
` ${summary}`,
|
|
35027
35115
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
35028
35116
|
].join("\n");
|
|
@@ -35031,10 +35119,10 @@ function formatHighLevelStructure(structure) {
|
|
|
35031
35119
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
35032
35120
|
function printHighLevelChecklist(subject) {
|
|
35033
35121
|
console.log(
|
|
35034
|
-
|
|
35122
|
+
chalk237.bold(
|
|
35035
35123
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
35036
35124
|
),
|
|
35037
|
-
|
|
35125
|
+
chalk237.dim(
|
|
35038
35126
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
35039
35127
|
)
|
|
35040
35128
|
);
|
|
@@ -35046,12 +35134,12 @@ function printHighLevelChecklist(subject) {
|
|
|
35046
35134
|
formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
|
|
35047
35135
|
);
|
|
35048
35136
|
console.log(
|
|
35049
|
-
|
|
35137
|
+
chalk237.dim(
|
|
35050
35138
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
35051
35139
|
)
|
|
35052
35140
|
);
|
|
35053
35141
|
console.log(
|
|
35054
|
-
|
|
35142
|
+
chalk237.dim(
|
|
35055
35143
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
35056
35144
|
)
|
|
35057
35145
|
);
|
|
@@ -35531,18 +35619,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
35531
35619
|
}
|
|
35532
35620
|
|
|
35533
35621
|
// src/commands/review/warnOutOfDiff.ts
|
|
35534
|
-
import
|
|
35622
|
+
import chalk238 from "chalk";
|
|
35535
35623
|
function warnOutOfDiff(outOfDiff) {
|
|
35536
35624
|
if (outOfDiff.length === 0) return;
|
|
35537
35625
|
console.warn(
|
|
35538
|
-
|
|
35626
|
+
chalk238.yellow(
|
|
35539
35627
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
35540
35628
|
)
|
|
35541
35629
|
);
|
|
35542
35630
|
for (const finding of outOfDiff) {
|
|
35543
35631
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
35544
35632
|
console.warn(
|
|
35545
|
-
` ${
|
|
35633
|
+
` ${chalk238.yellow("\xB7")} ${finding.title} ${chalk238.dim(
|
|
35546
35634
|
`(${finding.file}:${range})`
|
|
35547
35635
|
)}`
|
|
35548
35636
|
);
|
|
@@ -35566,18 +35654,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
35566
35654
|
}
|
|
35567
35655
|
|
|
35568
35656
|
// src/commands/review/warnUnlocated.ts
|
|
35569
|
-
import
|
|
35657
|
+
import chalk239 from "chalk";
|
|
35570
35658
|
function warnUnlocated(unlocated) {
|
|
35571
35659
|
if (unlocated.length === 0) return;
|
|
35572
35660
|
console.warn(
|
|
35573
|
-
|
|
35661
|
+
chalk239.yellow(
|
|
35574
35662
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
35575
35663
|
)
|
|
35576
35664
|
);
|
|
35577
35665
|
for (const finding of unlocated) {
|
|
35578
|
-
const where = finding.location ||
|
|
35666
|
+
const where = finding.location || chalk239.dim("missing");
|
|
35579
35667
|
console.warn(
|
|
35580
|
-
` ${
|
|
35668
|
+
` ${chalk239.yellow("\xB7")} ${finding.title} ${chalk239.dim(`(${where})`)}`
|
|
35581
35669
|
);
|
|
35582
35670
|
}
|
|
35583
35671
|
}
|
|
@@ -37217,7 +37305,7 @@ function registerReview(program2) {
|
|
|
37217
37305
|
// src/commands/rules/addRule.ts
|
|
37218
37306
|
import { existsSync as existsSync71, readFileSync as readFileSync54, writeFileSync as writeFileSync44 } from "fs";
|
|
37219
37307
|
import path85 from "path";
|
|
37220
|
-
import
|
|
37308
|
+
import chalk240 from "chalk";
|
|
37221
37309
|
|
|
37222
37310
|
// src/commands/rules/insertRuleBullet.ts
|
|
37223
37311
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -37353,7 +37441,7 @@ function read2(file) {
|
|
|
37353
37441
|
function addRule(text18, options2) {
|
|
37354
37442
|
const rule = text18.trim();
|
|
37355
37443
|
if (rule === "") {
|
|
37356
|
-
console.error(
|
|
37444
|
+
console.error(chalk240.red("Rule text is required"));
|
|
37357
37445
|
process.exitCode = 1;
|
|
37358
37446
|
return;
|
|
37359
37447
|
}
|
|
@@ -37371,13 +37459,13 @@ function addRule(text18, options2) {
|
|
|
37371
37459
|
);
|
|
37372
37460
|
updateScopedRulesIndex(root2);
|
|
37373
37461
|
console.log(
|
|
37374
|
-
`Added ${
|
|
37462
|
+
`Added ${chalk240.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
|
|
37375
37463
|
);
|
|
37376
37464
|
}
|
|
37377
37465
|
|
|
37378
37466
|
// src/commands/rules/indexRules.ts
|
|
37379
37467
|
import path86 from "path";
|
|
37380
|
-
import
|
|
37468
|
+
import chalk241 from "chalk";
|
|
37381
37469
|
function indexRules() {
|
|
37382
37470
|
const startDir = scopeDirectory(process.cwd());
|
|
37383
37471
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -37385,24 +37473,24 @@ function indexRules() {
|
|
|
37385
37473
|
const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
|
|
37386
37474
|
if (directories.length === 0) {
|
|
37387
37475
|
console.log(
|
|
37388
|
-
|
|
37476
|
+
chalk241.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
37389
37477
|
);
|
|
37390
37478
|
return;
|
|
37391
37479
|
}
|
|
37392
37480
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
37393
37481
|
for (const directory of directories)
|
|
37394
|
-
console.log(` ${
|
|
37482
|
+
console.log(` ${chalk241.cyan(directory)}`);
|
|
37395
37483
|
}
|
|
37396
37484
|
|
|
37397
37485
|
// src/commands/rules/listRules.ts
|
|
37398
37486
|
import path87 from "path";
|
|
37399
|
-
import
|
|
37487
|
+
import chalk242 from "chalk";
|
|
37400
37488
|
function listRules(target, options2 = {}) {
|
|
37401
37489
|
const resolved = path87.resolve(target ?? process.cwd());
|
|
37402
37490
|
const rules2 = readScopedRules(resolved);
|
|
37403
37491
|
if (rules2.length === 0) {
|
|
37404
37492
|
const label2 = path87.relative(process.cwd(), resolved) || ".";
|
|
37405
|
-
console.log(
|
|
37493
|
+
console.log(chalk242.gray(`No rules in scope for ${label2}`));
|
|
37406
37494
|
return;
|
|
37407
37495
|
}
|
|
37408
37496
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -37412,14 +37500,14 @@ function listRules(target, options2 = {}) {
|
|
|
37412
37500
|
if (rule.source !== shown) {
|
|
37413
37501
|
shown = rule.source;
|
|
37414
37502
|
console.log(
|
|
37415
|
-
|
|
37503
|
+
chalk242.dim(base ? path87.relative(base, rule.source) : rule.source)
|
|
37416
37504
|
);
|
|
37417
37505
|
}
|
|
37418
37506
|
console.log(
|
|
37419
|
-
` ${
|
|
37507
|
+
` ${chalk242.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
37420
37508
|
);
|
|
37421
37509
|
if (options2.full && rule.title)
|
|
37422
|
-
console.log(` ${" ".repeat(width)} ${
|
|
37510
|
+
console.log(` ${" ".repeat(width)} ${chalk242.dim(rule.text)}`);
|
|
37423
37511
|
}
|
|
37424
37512
|
}
|
|
37425
37513
|
|
|
@@ -37448,7 +37536,7 @@ function registerRules(program2) {
|
|
|
37448
37536
|
}
|
|
37449
37537
|
|
|
37450
37538
|
// src/commands/seq/seqAuth.ts
|
|
37451
|
-
import
|
|
37539
|
+
import chalk244 from "chalk";
|
|
37452
37540
|
|
|
37453
37541
|
// src/commands/seq/loadConnections.ts
|
|
37454
37542
|
function loadConnections2() {
|
|
@@ -37477,10 +37565,10 @@ function setDefaultConnection(name) {
|
|
|
37477
37565
|
}
|
|
37478
37566
|
|
|
37479
37567
|
// src/shared/assertUniqueName.ts
|
|
37480
|
-
import
|
|
37568
|
+
import chalk243 from "chalk";
|
|
37481
37569
|
function assertUniqueName(existingNames, name) {
|
|
37482
37570
|
if (existingNames.includes(name)) {
|
|
37483
|
-
console.error(
|
|
37571
|
+
console.error(chalk243.red(`Connection "${name}" already exists.`));
|
|
37484
37572
|
process.exit(1);
|
|
37485
37573
|
}
|
|
37486
37574
|
}
|
|
@@ -37498,16 +37586,16 @@ async function promptConnection2(existingNames) {
|
|
|
37498
37586
|
var seqAuth = createConnectionAuth({
|
|
37499
37587
|
load: loadConnections2,
|
|
37500
37588
|
save: saveConnections2,
|
|
37501
|
-
format: (c) => `${
|
|
37589
|
+
format: (c) => `${chalk244.bold(c.name)} ${c.url}`,
|
|
37502
37590
|
promptNew: promptConnection2,
|
|
37503
37591
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
37504
37592
|
});
|
|
37505
37593
|
|
|
37506
37594
|
// src/commands/seq/seqQuery.ts
|
|
37507
|
-
import
|
|
37595
|
+
import chalk248 from "chalk";
|
|
37508
37596
|
|
|
37509
37597
|
// src/commands/seq/fetchSeq.ts
|
|
37510
|
-
import
|
|
37598
|
+
import chalk245 from "chalk";
|
|
37511
37599
|
async function fetchSeq(conn, path106, params) {
|
|
37512
37600
|
const url = `${conn.url}${path106}?${params}`;
|
|
37513
37601
|
const response = await fetch(url, {
|
|
@@ -37518,7 +37606,7 @@ async function fetchSeq(conn, path106, params) {
|
|
|
37518
37606
|
});
|
|
37519
37607
|
if (!response.ok) {
|
|
37520
37608
|
const body = await response.text();
|
|
37521
|
-
console.error(
|
|
37609
|
+
console.error(chalk245.red(`Seq returned ${response.status}: ${body}`));
|
|
37522
37610
|
process.exit(1);
|
|
37523
37611
|
}
|
|
37524
37612
|
return response;
|
|
@@ -37577,23 +37665,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
37577
37665
|
}
|
|
37578
37666
|
|
|
37579
37667
|
// src/commands/seq/formatEvent.ts
|
|
37580
|
-
import
|
|
37668
|
+
import chalk246 from "chalk";
|
|
37581
37669
|
function levelColor(level) {
|
|
37582
37670
|
switch (level) {
|
|
37583
37671
|
case "Fatal":
|
|
37584
|
-
return
|
|
37672
|
+
return chalk246.bgRed.white;
|
|
37585
37673
|
case "Error":
|
|
37586
|
-
return
|
|
37674
|
+
return chalk246.red;
|
|
37587
37675
|
case "Warning":
|
|
37588
|
-
return
|
|
37676
|
+
return chalk246.yellow;
|
|
37589
37677
|
case "Information":
|
|
37590
|
-
return
|
|
37678
|
+
return chalk246.cyan;
|
|
37591
37679
|
case "Debug":
|
|
37592
|
-
return
|
|
37680
|
+
return chalk246.gray;
|
|
37593
37681
|
case "Verbose":
|
|
37594
|
-
return
|
|
37682
|
+
return chalk246.dim;
|
|
37595
37683
|
default:
|
|
37596
|
-
return
|
|
37684
|
+
return chalk246.white;
|
|
37597
37685
|
}
|
|
37598
37686
|
}
|
|
37599
37687
|
function levelAbbrev(level) {
|
|
@@ -37634,12 +37722,12 @@ function formatTimestamp(iso) {
|
|
|
37634
37722
|
function formatEvent(event) {
|
|
37635
37723
|
const color = levelColor(event.Level);
|
|
37636
37724
|
const abbrev = levelAbbrev(event.Level);
|
|
37637
|
-
const ts10 =
|
|
37725
|
+
const ts10 = chalk246.dim(formatTimestamp(event.Timestamp));
|
|
37638
37726
|
const msg = renderMessage(event);
|
|
37639
37727
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
37640
37728
|
if (event.Exception) {
|
|
37641
37729
|
for (const line of event.Exception.split("\n")) {
|
|
37642
|
-
lines2.push(
|
|
37730
|
+
lines2.push(chalk246.red(` ${line}`));
|
|
37643
37731
|
}
|
|
37644
37732
|
}
|
|
37645
37733
|
return lines2.join("\n");
|
|
@@ -37672,11 +37760,11 @@ function rejectTimestampFilter(filter) {
|
|
|
37672
37760
|
}
|
|
37673
37761
|
|
|
37674
37762
|
// src/shared/resolveNamedConnection.ts
|
|
37675
|
-
import
|
|
37763
|
+
import chalk247 from "chalk";
|
|
37676
37764
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
37677
37765
|
if (connections.length === 0) {
|
|
37678
37766
|
console.error(
|
|
37679
|
-
|
|
37767
|
+
chalk247.red(
|
|
37680
37768
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
37681
37769
|
)
|
|
37682
37770
|
);
|
|
@@ -37685,7 +37773,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
37685
37773
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
37686
37774
|
const connection = connections.find((c) => c.name === target);
|
|
37687
37775
|
if (!connection) {
|
|
37688
|
-
console.error(
|
|
37776
|
+
console.error(chalk247.red(`${kind} connection "${target}" not found.`));
|
|
37689
37777
|
process.exit(1);
|
|
37690
37778
|
}
|
|
37691
37779
|
return connection;
|
|
@@ -37714,7 +37802,7 @@ async function seqQuery(filter, options2) {
|
|
|
37714
37802
|
new URLSearchParams({ filter, count: String(count8) })
|
|
37715
37803
|
);
|
|
37716
37804
|
if (events.length === 0) {
|
|
37717
|
-
console.log(
|
|
37805
|
+
console.log(chalk248.yellow("No events found."));
|
|
37718
37806
|
return;
|
|
37719
37807
|
}
|
|
37720
37808
|
if (options2.json) {
|
|
@@ -37725,11 +37813,11 @@ async function seqQuery(filter, options2) {
|
|
|
37725
37813
|
for (const event of chronological) {
|
|
37726
37814
|
console.log(formatEvent(event));
|
|
37727
37815
|
}
|
|
37728
|
-
console.log(
|
|
37816
|
+
console.log(chalk248.dim(`
|
|
37729
37817
|
${events.length} events`));
|
|
37730
37818
|
if (events.length >= count8) {
|
|
37731
37819
|
console.log(
|
|
37732
|
-
|
|
37820
|
+
chalk248.yellow(
|
|
37733
37821
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
37734
37822
|
)
|
|
37735
37823
|
);
|
|
@@ -37737,10 +37825,10 @@ ${events.length} events`));
|
|
|
37737
37825
|
}
|
|
37738
37826
|
|
|
37739
37827
|
// src/shared/setNamedDefaultConnection.ts
|
|
37740
|
-
import
|
|
37828
|
+
import chalk249 from "chalk";
|
|
37741
37829
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
37742
37830
|
if (!connections.find((c) => c.name === name)) {
|
|
37743
|
-
console.error(
|
|
37831
|
+
console.error(chalk249.red(`Connection "${name}" not found.`));
|
|
37744
37832
|
process.exit(1);
|
|
37745
37833
|
}
|
|
37746
37834
|
setDefault(name);
|
|
@@ -37814,7 +37902,7 @@ function parseReply(line) {
|
|
|
37814
37902
|
}
|
|
37815
37903
|
|
|
37816
37904
|
// src/commands/show.ts
|
|
37817
|
-
async function
|
|
37905
|
+
async function show3(options2) {
|
|
37818
37906
|
const body = await readBodyArgument(options2.body);
|
|
37819
37907
|
if (body.trim().length === 0) {
|
|
37820
37908
|
console.error("Error: --body is empty; there is nothing to show.");
|
|
@@ -37843,7 +37931,7 @@ async function show2(options2) {
|
|
|
37843
37931
|
function registerShow(program2) {
|
|
37844
37932
|
program2.command("show").description(
|
|
37845
37933
|
"Open markdown in the session's web preview pane so long links, paths and snippets can be clicked and copied unbroken; prints it outside a web session"
|
|
37846
|
-
).option("--title <title>", "Pane title").requiredOption("--body <markdown|->", "Markdown to show, or - for stdin").action(
|
|
37934
|
+
).option("--title <title>", "Pane title").requiredOption("--body <markdown|->", "Markdown to show, or - for stdin").action(show3);
|
|
37847
37935
|
}
|
|
37848
37936
|
|
|
37849
37937
|
// src/commands/registerSignal.ts
|
|
@@ -38032,7 +38120,7 @@ function registerSlack(program2) {
|
|
|
38032
38120
|
}
|
|
38033
38121
|
|
|
38034
38122
|
// src/commands/sql/sqlAuth.ts
|
|
38035
|
-
import
|
|
38123
|
+
import chalk251 from "chalk";
|
|
38036
38124
|
|
|
38037
38125
|
// src/commands/sql/loadConnections.ts
|
|
38038
38126
|
function loadConnections3() {
|
|
@@ -38061,7 +38149,7 @@ function setDefaultConnection2(name) {
|
|
|
38061
38149
|
}
|
|
38062
38150
|
|
|
38063
38151
|
// src/commands/sql/promptConnection.ts
|
|
38064
|
-
import
|
|
38152
|
+
import chalk250 from "chalk";
|
|
38065
38153
|
async function promptConnection3(existingNames) {
|
|
38066
38154
|
const name = await promptInput("name", "Connection name:", "default");
|
|
38067
38155
|
assertUniqueName(existingNames, name);
|
|
@@ -38069,7 +38157,7 @@ async function promptConnection3(existingNames) {
|
|
|
38069
38157
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
38070
38158
|
const port = Number.parseInt(portStr, 10);
|
|
38071
38159
|
if (!Number.isFinite(port)) {
|
|
38072
|
-
console.error(
|
|
38160
|
+
console.error(chalk250.red(`Invalid port "${portStr}".`));
|
|
38073
38161
|
process.exit(1);
|
|
38074
38162
|
}
|
|
38075
38163
|
const user = await promptInput("user", "User:");
|
|
@@ -38082,13 +38170,13 @@ async function promptConnection3(existingNames) {
|
|
|
38082
38170
|
var sqlAuth = createConnectionAuth({
|
|
38083
38171
|
load: loadConnections3,
|
|
38084
38172
|
save: saveConnections3,
|
|
38085
|
-
format: (c) => `${
|
|
38173
|
+
format: (c) => `${chalk251.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
38086
38174
|
promptNew: promptConnection3,
|
|
38087
38175
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
38088
38176
|
});
|
|
38089
38177
|
|
|
38090
38178
|
// src/commands/sql/printTable.ts
|
|
38091
|
-
import
|
|
38179
|
+
import chalk252 from "chalk";
|
|
38092
38180
|
function formatCell(value) {
|
|
38093
38181
|
if (value === null || value === void 0) return "";
|
|
38094
38182
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -38097,7 +38185,7 @@ function formatCell(value) {
|
|
|
38097
38185
|
}
|
|
38098
38186
|
function printTable(rows) {
|
|
38099
38187
|
if (rows.length === 0) {
|
|
38100
|
-
console.log(
|
|
38188
|
+
console.log(chalk252.yellow("(no rows)"));
|
|
38101
38189
|
return;
|
|
38102
38190
|
}
|
|
38103
38191
|
const columns = Object.keys(rows[0]);
|
|
@@ -38105,13 +38193,13 @@ function printTable(rows) {
|
|
|
38105
38193
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
38106
38194
|
);
|
|
38107
38195
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
38108
|
-
console.log(
|
|
38109
|
-
console.log(
|
|
38196
|
+
console.log(chalk252.dim(header));
|
|
38197
|
+
console.log(chalk252.dim("-".repeat(header.length)));
|
|
38110
38198
|
for (const row of rows) {
|
|
38111
38199
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
38112
38200
|
console.log(line);
|
|
38113
38201
|
}
|
|
38114
|
-
console.log(
|
|
38202
|
+
console.log(chalk252.dim(`
|
|
38115
38203
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
38116
38204
|
}
|
|
38117
38205
|
|
|
@@ -38171,7 +38259,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
38171
38259
|
}
|
|
38172
38260
|
|
|
38173
38261
|
// src/commands/sql/sqlMutate.ts
|
|
38174
|
-
import
|
|
38262
|
+
import chalk253 from "chalk";
|
|
38175
38263
|
|
|
38176
38264
|
// src/commands/sql/isMutation.ts
|
|
38177
38265
|
var MUTATION_KEYWORDS = [
|
|
@@ -38205,7 +38293,7 @@ function isMutation(sql29) {
|
|
|
38205
38293
|
async function sqlMutate(query, connectionName) {
|
|
38206
38294
|
if (!isMutation(query)) {
|
|
38207
38295
|
console.error(
|
|
38208
|
-
|
|
38296
|
+
chalk253.red(
|
|
38209
38297
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
38210
38298
|
)
|
|
38211
38299
|
);
|
|
@@ -38215,18 +38303,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
38215
38303
|
const pool = await sqlConnect(conn);
|
|
38216
38304
|
try {
|
|
38217
38305
|
const result = await pool.request().query(query);
|
|
38218
|
-
console.log(
|
|
38306
|
+
console.log(chalk253.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
38219
38307
|
} finally {
|
|
38220
38308
|
await pool.close();
|
|
38221
38309
|
}
|
|
38222
38310
|
}
|
|
38223
38311
|
|
|
38224
38312
|
// src/commands/sql/sqlQuery.ts
|
|
38225
|
-
import
|
|
38313
|
+
import chalk254 from "chalk";
|
|
38226
38314
|
async function sqlQuery(query, connectionName) {
|
|
38227
38315
|
if (isMutation(query)) {
|
|
38228
38316
|
console.error(
|
|
38229
|
-
|
|
38317
|
+
chalk254.red(
|
|
38230
38318
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
38231
38319
|
)
|
|
38232
38320
|
);
|
|
@@ -38241,7 +38329,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
38241
38329
|
printTable(rows);
|
|
38242
38330
|
} else {
|
|
38243
38331
|
console.log(
|
|
38244
|
-
|
|
38332
|
+
chalk254.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
38245
38333
|
);
|
|
38246
38334
|
}
|
|
38247
38335
|
} finally {
|
|
@@ -38662,7 +38750,7 @@ function syncPi(claudeDir, options2) {
|
|
|
38662
38750
|
// src/commands/sync/syncSettings.ts
|
|
38663
38751
|
import * as fs47 from "fs";
|
|
38664
38752
|
import * as path98 from "path";
|
|
38665
|
-
import
|
|
38753
|
+
import chalk255 from "chalk";
|
|
38666
38754
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
38667
38755
|
const source = path98.join(claudeDir, "settings.json");
|
|
38668
38756
|
const target = path98.join(targetBase, "settings.json");
|
|
@@ -38681,7 +38769,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
38681
38769
|
if (mergedContent !== normalizedTarget) {
|
|
38682
38770
|
if (!options2?.yes) {
|
|
38683
38771
|
console.log(
|
|
38684
|
-
|
|
38772
|
+
chalk255.yellow(
|
|
38685
38773
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
38686
38774
|
)
|
|
38687
38775
|
);
|
|
@@ -38689,7 +38777,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
38689
38777
|
printDiff(targetContent, mergedContent);
|
|
38690
38778
|
printAutoConfirmHint();
|
|
38691
38779
|
const confirm = await promptConfirm(
|
|
38692
|
-
|
|
38780
|
+
chalk255.red("Overwrite existing settings.json?"),
|
|
38693
38781
|
false
|
|
38694
38782
|
);
|
|
38695
38783
|
if (!confirm) {
|
|
@@ -40920,7 +41008,7 @@ function registerWatch(program2) {
|
|
|
40920
41008
|
|
|
40921
41009
|
// src/commands/roam/auth.ts
|
|
40922
41010
|
import { randomBytes } from "crypto";
|
|
40923
|
-
import
|
|
41011
|
+
import chalk256 from "chalk";
|
|
40924
41012
|
|
|
40925
41013
|
// src/commands/roam/waitForCallback.ts
|
|
40926
41014
|
import { createServer as createServer3 } from "http";
|
|
@@ -41051,13 +41139,13 @@ async function auth() {
|
|
|
41051
41139
|
saveGlobalConfig(config);
|
|
41052
41140
|
const state = randomBytes(16).toString("hex");
|
|
41053
41141
|
console.log(
|
|
41054
|
-
|
|
41142
|
+
chalk256.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
41055
41143
|
);
|
|
41056
|
-
console.log(
|
|
41057
|
-
console.log(
|
|
41058
|
-
console.log(
|
|
41144
|
+
console.log(chalk256.white("http://localhost:14523/callback\n"));
|
|
41145
|
+
console.log(chalk256.blue("Opening browser for authorization..."));
|
|
41146
|
+
console.log(chalk256.dim("Waiting for authorization callback..."));
|
|
41059
41147
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
41060
|
-
console.log(
|
|
41148
|
+
console.log(chalk256.dim("Exchanging code for tokens..."));
|
|
41061
41149
|
const tokens = await exchangeToken({
|
|
41062
41150
|
code,
|
|
41063
41151
|
clientId,
|
|
@@ -41073,7 +41161,7 @@ async function auth() {
|
|
|
41073
41161
|
};
|
|
41074
41162
|
saveGlobalConfig(config);
|
|
41075
41163
|
console.log(
|
|
41076
|
-
|
|
41164
|
+
chalk256.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
41077
41165
|
);
|
|
41078
41166
|
}
|
|
41079
41167
|
|
|
@@ -41428,18 +41516,18 @@ function registerRun(program2) {
|
|
|
41428
41516
|
}
|
|
41429
41517
|
|
|
41430
41518
|
// src/commands/sessions/nodes/formatLink.ts
|
|
41431
|
-
import
|
|
41519
|
+
import chalk257 from "chalk";
|
|
41432
41520
|
var STATE_COLOURS = {
|
|
41433
|
-
connected:
|
|
41434
|
-
connecting:
|
|
41435
|
-
disconnected:
|
|
41436
|
-
"version-blocked":
|
|
41521
|
+
connected: chalk257.green,
|
|
41522
|
+
connecting: chalk257.yellow,
|
|
41523
|
+
disconnected: chalk257.red,
|
|
41524
|
+
"version-blocked": chalk257.red
|
|
41437
41525
|
};
|
|
41438
41526
|
function formatLink(link3) {
|
|
41439
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
41527
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk257.white;
|
|
41440
41528
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
41441
41529
|
const error = link3.error ? `
|
|
41442
|
-
${
|
|
41530
|
+
${chalk257.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
41443
41531
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
41444
41532
|
}
|
|
41445
41533
|
|
|
@@ -41671,6 +41759,36 @@ function createAutoExit(exit, graceMs = DEFAULT_GRACE_MS) {
|
|
|
41671
41759
|
};
|
|
41672
41760
|
}
|
|
41673
41761
|
|
|
41762
|
+
// src/commands/sessions/daemon/pollRepoConfigCache.ts
|
|
41763
|
+
var POLL_MS = 6e4;
|
|
41764
|
+
function pollRepoConfigCache(intervalMs = POLL_MS) {
|
|
41765
|
+
let inFlight2 = false;
|
|
41766
|
+
let failing = false;
|
|
41767
|
+
const tick = async () => {
|
|
41768
|
+
if (inFlight2) return;
|
|
41769
|
+
inFlight2 = true;
|
|
41770
|
+
try {
|
|
41771
|
+
const before = JSON.stringify(readRepoConfigCache());
|
|
41772
|
+
const count8 = await refreshRepoConfigCache();
|
|
41773
|
+
if (failing) daemonLog("repo config cache poll recovered");
|
|
41774
|
+
failing = false;
|
|
41775
|
+
if (JSON.stringify(readRepoConfigCache()) !== before)
|
|
41776
|
+
daemonLog(`repo config cache updated (${count8} repos)`);
|
|
41777
|
+
} catch (error) {
|
|
41778
|
+
if (!failing)
|
|
41779
|
+
daemonLog(
|
|
41780
|
+
`repo config cache poll failed; keeping the last snapshot: ${String(error)}`
|
|
41781
|
+
);
|
|
41782
|
+
failing = true;
|
|
41783
|
+
} finally {
|
|
41784
|
+
inFlight2 = false;
|
|
41785
|
+
}
|
|
41786
|
+
};
|
|
41787
|
+
const timer = setInterval(() => void tick(), intervalMs);
|
|
41788
|
+
timer.unref();
|
|
41789
|
+
return () => clearInterval(timer);
|
|
41790
|
+
}
|
|
41791
|
+
|
|
41674
41792
|
// src/commands/sessions/daemon/refreshRepoConfigCacheOnStart.ts
|
|
41675
41793
|
async function refreshRepoConfigCacheOnStart() {
|
|
41676
41794
|
try {
|
|
@@ -43136,11 +43254,11 @@ function processCwd(link3) {
|
|
|
43136
43254
|
}
|
|
43137
43255
|
|
|
43138
43256
|
// src/commands/sessions/daemon/worktree/awaitTreeVacated.ts
|
|
43139
|
-
var
|
|
43257
|
+
var POLL_MS2 = 500;
|
|
43140
43258
|
var GRACE_MS = 5e3;
|
|
43141
43259
|
function awaitTreeVacated(session, treePath) {
|
|
43142
43260
|
return new Promise((resolve28) => {
|
|
43143
|
-
let ticks = GRACE_MS /
|
|
43261
|
+
let ticks = GRACE_MS / POLL_MS2;
|
|
43144
43262
|
const settle = (outcome) => {
|
|
43145
43263
|
clearTimeout(timer);
|
|
43146
43264
|
session.closeGrace = void 0;
|
|
@@ -43149,9 +43267,9 @@ function awaitTreeVacated(session, treePath) {
|
|
|
43149
43267
|
const tick = () => {
|
|
43150
43268
|
if (liveProcessesInTree(treePath).length === 0) settle("vacated");
|
|
43151
43269
|
else if (--ticks <= 0) settle("occupied");
|
|
43152
|
-
else timer = setTimeout(tick,
|
|
43270
|
+
else timer = setTimeout(tick, POLL_MS2);
|
|
43153
43271
|
};
|
|
43154
|
-
let timer = setTimeout(tick,
|
|
43272
|
+
let timer = setTimeout(tick, POLL_MS2);
|
|
43155
43273
|
session.closeGrace?.cancel();
|
|
43156
43274
|
session.closeGrace = { cancel: () => settle("cancelled") };
|
|
43157
43275
|
});
|
|
@@ -43182,7 +43300,7 @@ async function closeBlockReason(sessionId, tree) {
|
|
|
43182
43300
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
43183
43301
|
import { existsSync as existsSync90, watch } from "fs";
|
|
43184
43302
|
var DEBOUNCE_MS = 500;
|
|
43185
|
-
var
|
|
43303
|
+
var POLL_MS3 = 3e4;
|
|
43186
43304
|
function watchGitState(cwd, onChange) {
|
|
43187
43305
|
const common = gitCommonDir(cwd);
|
|
43188
43306
|
if (!common || !existsSync90(common)) return void 0;
|
|
@@ -43213,9 +43331,9 @@ function watchGitDir(common, onChange) {
|
|
|
43213
43331
|
}
|
|
43214
43332
|
}
|
|
43215
43333
|
function pollGitState(cwd, onChange) {
|
|
43216
|
-
const timer = setInterval(onChange,
|
|
43334
|
+
const timer = setInterval(onChange, POLL_MS3);
|
|
43217
43335
|
timer.unref?.();
|
|
43218
|
-
daemonLog(`git-state polled every ${
|
|
43336
|
+
daemonLog(`git-state polled every ${POLL_MS3 / 1e3}s for ${cwd}`);
|
|
43219
43337
|
return { close: () => clearInterval(timer) };
|
|
43220
43338
|
}
|
|
43221
43339
|
|
|
@@ -43999,7 +44117,7 @@ async function touchedSince(file, sinceMs) {
|
|
|
43999
44117
|
}
|
|
44000
44118
|
|
|
44001
44119
|
// src/commands/sessions/daemon/bindCodexSession.ts
|
|
44002
|
-
var
|
|
44120
|
+
var POLL_MS4 = 1e3;
|
|
44003
44121
|
var MAX_ATTEMPTS = 120;
|
|
44004
44122
|
var START_SLACK_MS = 5e3;
|
|
44005
44123
|
function bindCodexSession(session, notify2) {
|
|
@@ -44007,7 +44125,7 @@ function bindCodexSession(session, notify2) {
|
|
|
44007
44125
|
if (session.harness !== "codex" || !cwd || session.harnessSessionId) return;
|
|
44008
44126
|
const since = session.startedAt - START_SLACK_MS;
|
|
44009
44127
|
let attemptsLeft = MAX_ATTEMPTS;
|
|
44010
|
-
const schedule = () => setTimeout(() => void poll(),
|
|
44128
|
+
const schedule = () => setTimeout(() => void poll(), POLL_MS4).unref();
|
|
44011
44129
|
const poll = async () => {
|
|
44012
44130
|
if (session.harnessSessionId) return;
|
|
44013
44131
|
const sessionId = await resolveCodexSessionId(cwd, since);
|
|
@@ -48230,6 +48348,7 @@ async function runDaemon() {
|
|
|
48230
48348
|
const manager = new SessionManager(checkAutoExit);
|
|
48231
48349
|
setDaemonLogSink(manager.clients.emitLog);
|
|
48232
48350
|
void refreshRepoConfigCacheOnStart();
|
|
48351
|
+
pollRepoConfigCache();
|
|
48233
48352
|
await startDaemonServer(manager, checkAutoExit);
|
|
48234
48353
|
}
|
|
48235
48354
|
|
|
@@ -48288,7 +48407,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
48288
48407
|
}
|
|
48289
48408
|
|
|
48290
48409
|
// src/commands/sessions/nodes/printReport.ts
|
|
48291
|
-
import
|
|
48410
|
+
import chalk258 from "chalk";
|
|
48292
48411
|
function printReport(report) {
|
|
48293
48412
|
if (report.links.length === 0) {
|
|
48294
48413
|
console.log(`${report.local} has no links`);
|
|
@@ -48302,11 +48421,11 @@ function printReport(report) {
|
|
|
48302
48421
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
48303
48422
|
}
|
|
48304
48423
|
function printDiagnosis(diagnosis) {
|
|
48305
|
-
console.log(`${
|
|
48424
|
+
console.log(`${chalk258.bold(diagnosis.name)} ${chalk258.dim(diagnosis.url)}`);
|
|
48306
48425
|
for (const hop of diagnosis.hops) {
|
|
48307
|
-
const mark = hop.ok ?
|
|
48426
|
+
const mark = hop.ok ? chalk258.green("\u2713") : chalk258.red("\u2717");
|
|
48308
48427
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
48309
|
-
if (hop.remediation) console.log(` ${
|
|
48428
|
+
if (hop.remediation) console.log(` ${chalk258.yellow(hop.remediation)}`);
|
|
48310
48429
|
}
|
|
48311
48430
|
}
|
|
48312
48431
|
|
|
@@ -48326,7 +48445,7 @@ async function doctorNodes(name, options2) {
|
|
|
48326
48445
|
}
|
|
48327
48446
|
|
|
48328
48447
|
// src/commands/sessions/nodes/listNodes.ts
|
|
48329
|
-
import
|
|
48448
|
+
import chalk259 from "chalk";
|
|
48330
48449
|
async function nodesReport() {
|
|
48331
48450
|
const live = await queryNodes();
|
|
48332
48451
|
if (live)
|
|
@@ -48343,10 +48462,10 @@ async function listNodes(options2) {
|
|
|
48343
48462
|
console.log(JSON.stringify(report, null, 2));
|
|
48344
48463
|
return;
|
|
48345
48464
|
}
|
|
48346
|
-
console.log(`${report.local} ${
|
|
48465
|
+
console.log(`${report.local} ${chalk259.dim("(this node)")}`);
|
|
48347
48466
|
if (!report.daemonRunning)
|
|
48348
|
-
console.log(
|
|
48349
|
-
if (report.links.length === 0) console.log(
|
|
48467
|
+
console.log(chalk259.dim(" daemon not running; showing configured links"));
|
|
48468
|
+
if (report.links.length === 0) console.log(chalk259.dim(" no links"));
|
|
48350
48469
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
48351
48470
|
}
|
|
48352
48471
|
|
|
@@ -48385,14 +48504,14 @@ async function nodeLogs(name, options2) {
|
|
|
48385
48504
|
}
|
|
48386
48505
|
|
|
48387
48506
|
// src/commands/sessions/nodes/linkNode.ts
|
|
48388
|
-
import
|
|
48507
|
+
import chalk262 from "chalk";
|
|
48389
48508
|
|
|
48390
48509
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
48391
|
-
import
|
|
48510
|
+
import chalk260 from "chalk";
|
|
48392
48511
|
async function notifyDaemonLinks() {
|
|
48393
48512
|
if (!await isDaemonRunning()) {
|
|
48394
48513
|
console.log(
|
|
48395
|
-
|
|
48514
|
+
chalk260.yellow(
|
|
48396
48515
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
48397
48516
|
)
|
|
48398
48517
|
);
|
|
@@ -48400,11 +48519,11 @@ async function notifyDaemonLinks() {
|
|
|
48400
48519
|
}
|
|
48401
48520
|
try {
|
|
48402
48521
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
48403
|
-
console.log(
|
|
48522
|
+
console.log(chalk260.dim("The sessions daemon reloaded its links."));
|
|
48404
48523
|
} catch (error) {
|
|
48405
48524
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
48406
48525
|
console.log(
|
|
48407
|
-
|
|
48526
|
+
chalk260.yellow(
|
|
48408
48527
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
48409
48528
|
)
|
|
48410
48529
|
);
|
|
@@ -48412,7 +48531,7 @@ async function notifyDaemonLinks() {
|
|
|
48412
48531
|
}
|
|
48413
48532
|
|
|
48414
48533
|
// src/commands/sessions/nodes/readLinks.ts
|
|
48415
|
-
import
|
|
48534
|
+
import chalk261 from "chalk";
|
|
48416
48535
|
|
|
48417
48536
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
48418
48537
|
async function writeLinks(links2) {
|
|
@@ -48435,7 +48554,7 @@ async function readLinks() {
|
|
|
48435
48554
|
await writeLinks(links2);
|
|
48436
48555
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
48437
48556
|
console.log(
|
|
48438
|
-
|
|
48557
|
+
chalk261.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
48439
48558
|
);
|
|
48440
48559
|
return links2;
|
|
48441
48560
|
}
|
|
@@ -48491,7 +48610,7 @@ async function linkNode(name, url, options2) {
|
|
|
48491
48610
|
throw new Error(`${name} is this node; link to a different node`);
|
|
48492
48611
|
const link3 = await buildLink(name, url, options2);
|
|
48493
48612
|
await writeLinks([...others, link3]);
|
|
48494
|
-
console.log(
|
|
48613
|
+
console.log(chalk262.green(`Linked ${name} (${link3.url})`));
|
|
48495
48614
|
await notifyDaemonLinks();
|
|
48496
48615
|
}
|
|
48497
48616
|
|
|
@@ -48506,7 +48625,7 @@ function registerLinkCommand(nodes) {
|
|
|
48506
48625
|
}
|
|
48507
48626
|
|
|
48508
48627
|
// src/commands/sessions/nodes/awaitLinkReturn.ts
|
|
48509
|
-
var
|
|
48628
|
+
var POLL_MS5 = 1e3;
|
|
48510
48629
|
var wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
48511
48630
|
async function linkStatus(name, query = queryNodes) {
|
|
48512
48631
|
return (await query())?.links.find((l) => l.name === name);
|
|
@@ -48519,7 +48638,7 @@ async function awaitLinkReturn(name, options2, deps2 = {}) {
|
|
|
48519
48638
|
const link3 = await linkStatus(name, query);
|
|
48520
48639
|
if (link3?.state !== "connected") sawDown = true;
|
|
48521
48640
|
else if (sawDown) return link3;
|
|
48522
|
-
await sleep2(
|
|
48641
|
+
await sleep2(POLL_MS5);
|
|
48523
48642
|
}
|
|
48524
48643
|
return void 0;
|
|
48525
48644
|
}
|
|
@@ -48596,16 +48715,16 @@ async function restartNode(name, options2) {
|
|
|
48596
48715
|
}
|
|
48597
48716
|
|
|
48598
48717
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
48599
|
-
import
|
|
48718
|
+
import chalk263 from "chalk";
|
|
48600
48719
|
async function unlinkNode(name) {
|
|
48601
48720
|
const links2 = await readLinks();
|
|
48602
48721
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
48603
48722
|
if (remaining.length === links2.length) {
|
|
48604
|
-
console.log(
|
|
48723
|
+
console.log(chalk263.yellow(`No link named ${name}`));
|
|
48605
48724
|
return;
|
|
48606
48725
|
}
|
|
48607
48726
|
await writeLinks(remaining);
|
|
48608
|
-
console.log(
|
|
48727
|
+
console.log(chalk263.green(`Unlinked ${name}`));
|
|
48609
48728
|
await notifyDaemonLinks();
|
|
48610
48729
|
}
|
|
48611
48730
|
|
|
@@ -48804,7 +48923,7 @@ async function renameSession(title) {
|
|
|
48804
48923
|
|
|
48805
48924
|
// src/commands/sessions/summarise.ts
|
|
48806
48925
|
import * as fs58 from "fs";
|
|
48807
|
-
import
|
|
48926
|
+
import chalk264 from "chalk";
|
|
48808
48927
|
|
|
48809
48928
|
// src/commands/sessions/summarise/shared.ts
|
|
48810
48929
|
import * as fs57 from "fs";
|
|
@@ -48863,22 +48982,22 @@ ${firstMessage}`);
|
|
|
48863
48982
|
async function summarise2(options2) {
|
|
48864
48983
|
const files = await discoverSessionFiles();
|
|
48865
48984
|
if (files.length === 0) {
|
|
48866
|
-
console.log(
|
|
48985
|
+
console.log(chalk264.yellow("No sessions found."));
|
|
48867
48986
|
return;
|
|
48868
48987
|
}
|
|
48869
48988
|
const toProcess = selectCandidates(files, options2);
|
|
48870
48989
|
if (toProcess.length === 0) {
|
|
48871
|
-
console.log(
|
|
48990
|
+
console.log(chalk264.green("All sessions already summarised."));
|
|
48872
48991
|
return;
|
|
48873
48992
|
}
|
|
48874
48993
|
console.log(
|
|
48875
|
-
|
|
48994
|
+
chalk264.cyan(
|
|
48876
48995
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
48877
48996
|
)
|
|
48878
48997
|
);
|
|
48879
48998
|
const { succeeded, failed: failed3 } = processSessions(toProcess);
|
|
48880
48999
|
console.log(
|
|
48881
|
-
|
|
49000
|
+
chalk264.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk264.yellow(`, ${failed3} skipped`) : "")
|
|
48882
49001
|
);
|
|
48883
49002
|
}
|
|
48884
49003
|
function selectCandidates(files, options2) {
|
|
@@ -48898,16 +49017,16 @@ function processSessions(files) {
|
|
|
48898
49017
|
let failed3 = 0;
|
|
48899
49018
|
for (let i = 0; i < files.length; i++) {
|
|
48900
49019
|
const file = files[i];
|
|
48901
|
-
process.stdout.write(
|
|
49020
|
+
process.stdout.write(chalk264.dim(` [${i + 1}/${files.length}] `));
|
|
48902
49021
|
const summary = summariseSession(file);
|
|
48903
49022
|
if (summary) {
|
|
48904
49023
|
writeSummary(file, summary);
|
|
48905
49024
|
succeeded++;
|
|
48906
|
-
process.stdout.write(`${
|
|
49025
|
+
process.stdout.write(`${chalk264.green("\u2713")} ${summary}
|
|
48907
49026
|
`);
|
|
48908
49027
|
} else {
|
|
48909
49028
|
failed3++;
|
|
48910
|
-
process.stdout.write(` ${
|
|
49029
|
+
process.stdout.write(` ${chalk264.yellow("skip")}
|
|
48911
49030
|
`);
|
|
48912
49031
|
}
|
|
48913
49032
|
}
|
|
@@ -48941,10 +49060,10 @@ function registerSessions(program2) {
|
|
|
48941
49060
|
}
|
|
48942
49061
|
|
|
48943
49062
|
// src/reportCliError.ts
|
|
48944
|
-
import
|
|
49063
|
+
import chalk265 from "chalk";
|
|
48945
49064
|
function reportCliError(error) {
|
|
48946
49065
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
48947
|
-
console.error(
|
|
49066
|
+
console.error(chalk265.red(error.message));
|
|
48948
49067
|
} else {
|
|
48949
49068
|
console.error(error);
|
|
48950
49069
|
}
|