@staff0rd/assist 0.587.0 → 0.588.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 +11 -0
- package/allowed.cli-reads +1 -0
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/criteriaExtension/criteria-extension/content.js +266 -0
- package/dist/commands/criteriaExtension/criteria-extension/manifest.json +13 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +638 -586
- package/package.json +2 -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.588.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -80,6 +80,7 @@ var package_default = {
|
|
|
80
80
|
},
|
|
81
81
|
devDependencies: {
|
|
82
82
|
"@electric-sql/pglite": "^0.4.6",
|
|
83
|
+
"@emotion/cache": "^11.14.0",
|
|
83
84
|
"@emotion/react": "^11.14.0",
|
|
84
85
|
"@emotion/styled": "^11.14.1",
|
|
85
86
|
"@mui/icons-material": "^9.0.0",
|
|
@@ -18900,41 +18901,91 @@ function registerConfig(program2) {
|
|
|
18900
18901
|
).action((filter) => configKeys2(filter));
|
|
18901
18902
|
}
|
|
18902
18903
|
|
|
18903
|
-
// src/commands/
|
|
18904
|
+
// src/commands/criteriaExtension/criteriaExtension.ts
|
|
18905
|
+
import { cp } from "fs/promises";
|
|
18904
18906
|
import chalk139 from "chalk";
|
|
18907
|
+
|
|
18908
|
+
// src/commands/criteriaExtension/criteriaExtensionDir.ts
|
|
18909
|
+
import { existsSync as existsSync41 } from "fs";
|
|
18910
|
+
import { dirname as dirname24, join as join42 } from "path";
|
|
18911
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
18912
|
+
var moduleDir = dirname24(fileURLToPath6(import.meta.url));
|
|
18913
|
+
function criteriaExtensionDir() {
|
|
18914
|
+
const bundled = join42(
|
|
18915
|
+
moduleDir,
|
|
18916
|
+
"commands",
|
|
18917
|
+
"criteriaExtension",
|
|
18918
|
+
"criteria-extension"
|
|
18919
|
+
);
|
|
18920
|
+
if (existsSync41(bundled)) return bundled;
|
|
18921
|
+
return join42(moduleDir, "..", "..", "..", "criteria-extension");
|
|
18922
|
+
}
|
|
18923
|
+
|
|
18924
|
+
// src/commands/criteriaExtension/criteriaExtension.ts
|
|
18925
|
+
var WSL_WINDOWS_DIR = "/mnt/c/tools/criteria-extension";
|
|
18926
|
+
var WSL_WINDOWS_PATH = String.raw`C:\tools\criteria-extension`;
|
|
18927
|
+
async function loadPath(source) {
|
|
18928
|
+
if (detectPlatform() !== "wsl") return source;
|
|
18929
|
+
try {
|
|
18930
|
+
await cp(source, WSL_WINDOWS_DIR, { recursive: true });
|
|
18931
|
+
return WSL_WINDOWS_PATH;
|
|
18932
|
+
} catch {
|
|
18933
|
+
console.log(
|
|
18934
|
+
chalk139.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
18935
|
+
);
|
|
18936
|
+
return source;
|
|
18937
|
+
}
|
|
18938
|
+
}
|
|
18939
|
+
async function criteriaExtension() {
|
|
18940
|
+
const path80 = await loadPath(criteriaExtensionDir());
|
|
18941
|
+
console.log(
|
|
18942
|
+
chalk139.bold("acceptance criteria outliner \u2014 GitHub browser extension")
|
|
18943
|
+
);
|
|
18944
|
+
console.log(chalk139.dim(`load the unpacked extension from ${path80}`));
|
|
18945
|
+
}
|
|
18946
|
+
|
|
18947
|
+
// src/commands/registerCriteriaExtension.ts
|
|
18948
|
+
function registerCriteriaExtension(program2) {
|
|
18949
|
+
program2.command("criteria-extension").description(
|
|
18950
|
+
"Print the directory to load the acceptance criteria outliner browser extension from (load unpacked)"
|
|
18951
|
+
).action(() => criteriaExtension());
|
|
18952
|
+
}
|
|
18953
|
+
|
|
18954
|
+
// src/commands/db/reportMigrationStatus.ts
|
|
18955
|
+
import chalk140 from "chalk";
|
|
18905
18956
|
function reportApplied(applied) {
|
|
18906
18957
|
if (applied.length === 0) {
|
|
18907
|
-
console.error(
|
|
18958
|
+
console.error(chalk140.green("Database is up to date; nothing to apply."));
|
|
18908
18959
|
return;
|
|
18909
18960
|
}
|
|
18910
18961
|
for (const migration of applied) {
|
|
18911
18962
|
console.error(
|
|
18912
|
-
|
|
18963
|
+
chalk140.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
18913
18964
|
);
|
|
18914
18965
|
}
|
|
18915
18966
|
}
|
|
18916
18967
|
function reportMigrationStatus(status3) {
|
|
18917
18968
|
if (status3.state === "in-sync") {
|
|
18918
18969
|
console.error(
|
|
18919
|
-
|
|
18970
|
+
chalk140.green(`In sync at migration ${status3.version} (latest).`)
|
|
18920
18971
|
);
|
|
18921
18972
|
return;
|
|
18922
18973
|
}
|
|
18923
18974
|
if (status3.state === "behind") {
|
|
18924
18975
|
console.error(
|
|
18925
|
-
|
|
18976
|
+
chalk140.yellow(
|
|
18926
18977
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
18927
18978
|
)
|
|
18928
18979
|
);
|
|
18929
18980
|
console.error(
|
|
18930
|
-
|
|
18981
|
+
chalk140.yellow(
|
|
18931
18982
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
18932
18983
|
)
|
|
18933
18984
|
);
|
|
18934
18985
|
return;
|
|
18935
18986
|
}
|
|
18936
18987
|
console.error(
|
|
18937
|
-
|
|
18988
|
+
chalk140.red(
|
|
18938
18989
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
18939
18990
|
)
|
|
18940
18991
|
);
|
|
@@ -18969,22 +19020,22 @@ function registerDb(program2) {
|
|
|
18969
19020
|
|
|
18970
19021
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
18971
19022
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
18972
|
-
import
|
|
19023
|
+
import chalk141 from "chalk";
|
|
18973
19024
|
|
|
18974
19025
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
18975
|
-
import { join as
|
|
19026
|
+
import { join as join43 } from "path";
|
|
18976
19027
|
function getMigrationPinPath(pin) {
|
|
18977
|
-
return
|
|
19028
|
+
return join43(getRestrictedDir(), `db-migration-pin-${pin}.json`);
|
|
18978
19029
|
}
|
|
18979
19030
|
function getMigrationApprovalPath(migrationId) {
|
|
18980
|
-
return
|
|
19031
|
+
return join43(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
18981
19032
|
}
|
|
18982
19033
|
|
|
18983
19034
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
18984
|
-
import { existsSync as
|
|
19035
|
+
import { existsSync as existsSync42, readFileSync as readFileSync30 } from "fs";
|
|
18985
19036
|
function readMigrationPinState(pin) {
|
|
18986
19037
|
const path80 = getMigrationPinPath(pin);
|
|
18987
|
-
if (!
|
|
19038
|
+
if (!existsSync42(path80)) return void 0;
|
|
18988
19039
|
try {
|
|
18989
19040
|
const state = JSON.parse(readFileSync30(path80, "utf8"));
|
|
18990
19041
|
if (state.pin !== pin) return void 0;
|
|
@@ -19000,7 +19051,7 @@ function dbMigrationConfirm(pin) {
|
|
|
19000
19051
|
sweepRestrictedDir();
|
|
19001
19052
|
const state = readMigrationPinState(pin);
|
|
19002
19053
|
if (!state) {
|
|
19003
|
-
console.error(
|
|
19054
|
+
console.error(chalk141.red(`No pending migration unlock for pin: ${pin}`));
|
|
19004
19055
|
process.exitCode = 1;
|
|
19005
19056
|
return;
|
|
19006
19057
|
}
|
|
@@ -19010,7 +19061,7 @@ function dbMigrationConfirm(pin) {
|
|
|
19010
19061
|
);
|
|
19011
19062
|
unlinkSync9(getMigrationPinPath(pin));
|
|
19012
19063
|
console.log(
|
|
19013
|
-
|
|
19064
|
+
chalk141.green(
|
|
19014
19065
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
19015
19066
|
)
|
|
19016
19067
|
);
|
|
@@ -19019,7 +19070,7 @@ function dbMigrationConfirm(pin) {
|
|
|
19019
19070
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
19020
19071
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
19021
19072
|
import { randomInt as randomInt2 } from "crypto";
|
|
19022
|
-
import
|
|
19073
|
+
import chalk142 from "chalk";
|
|
19023
19074
|
|
|
19024
19075
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
19025
19076
|
function nextMigrationId() {
|
|
@@ -19034,7 +19085,7 @@ function dbMigrationUnlock() {
|
|
|
19034
19085
|
sweepRestrictedDir();
|
|
19035
19086
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
19036
19087
|
console.error(
|
|
19037
|
-
|
|
19088
|
+
chalk142.yellow.bold(
|
|
19038
19089
|
"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."
|
|
19039
19090
|
)
|
|
19040
19091
|
);
|
|
@@ -19044,7 +19095,7 @@ function dbMigrationUnlock() {
|
|
|
19044
19095
|
});
|
|
19045
19096
|
if (!delivered) {
|
|
19046
19097
|
console.error(
|
|
19047
|
-
|
|
19098
|
+
chalk142.red(
|
|
19048
19099
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
19049
19100
|
)
|
|
19050
19101
|
);
|
|
@@ -19054,7 +19105,7 @@ function dbMigrationUnlock() {
|
|
|
19054
19105
|
console.log(
|
|
19055
19106
|
`A confirmation pin was sent to your desktop notifications.
|
|
19056
19107
|
To approve creating migration ${migrationId}, run:
|
|
19057
|
-
${
|
|
19108
|
+
${chalk142.cyan(" assist db-migration confirm <PIN>")}
|
|
19058
19109
|
using the pin from that notification.`
|
|
19059
19110
|
);
|
|
19060
19111
|
}
|
|
@@ -19073,8 +19124,8 @@ function registerDbMigration(parent) {
|
|
|
19073
19124
|
}
|
|
19074
19125
|
|
|
19075
19126
|
// src/commands/deploy/redirect.ts
|
|
19076
|
-
import { existsSync as
|
|
19077
|
-
import
|
|
19127
|
+
import { existsSync as existsSync43, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
19128
|
+
import chalk143 from "chalk";
|
|
19078
19129
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
19079
19130
|
if (!window.location.pathname.endsWith('/')) {
|
|
19080
19131
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -19082,24 +19133,24 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
19082
19133
|
</script>`;
|
|
19083
19134
|
function redirect() {
|
|
19084
19135
|
const indexPath = "index.html";
|
|
19085
|
-
if (!
|
|
19086
|
-
console.log(
|
|
19136
|
+
if (!existsSync43(indexPath)) {
|
|
19137
|
+
console.log(chalk143.yellow("No index.html found"));
|
|
19087
19138
|
return;
|
|
19088
19139
|
}
|
|
19089
19140
|
const content = readFileSync31(indexPath, "utf8");
|
|
19090
19141
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
19091
|
-
console.log(
|
|
19142
|
+
console.log(chalk143.dim("Trailing slash script already present"));
|
|
19092
19143
|
return;
|
|
19093
19144
|
}
|
|
19094
19145
|
const headCloseIndex = content.indexOf("</head>");
|
|
19095
19146
|
if (headCloseIndex === -1) {
|
|
19096
|
-
console.log(
|
|
19147
|
+
console.log(chalk143.red("Could not find </head> tag in index.html"));
|
|
19097
19148
|
return;
|
|
19098
19149
|
}
|
|
19099
19150
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
19100
19151
|
${content.slice(headCloseIndex)}`;
|
|
19101
19152
|
writeFileSync28(indexPath, newContent);
|
|
19102
|
-
console.log(
|
|
19153
|
+
console.log(chalk143.green("Added trailing slash redirect to index.html"));
|
|
19103
19154
|
}
|
|
19104
19155
|
|
|
19105
19156
|
// src/commands/registerDeploy.ts
|
|
@@ -19115,10 +19166,10 @@ import { basename as basename13 } from "path";
|
|
|
19115
19166
|
|
|
19116
19167
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
19117
19168
|
import { homedir as homedir19 } from "os";
|
|
19118
|
-
import { join as
|
|
19119
|
-
var BLOG_REPO_ROOT =
|
|
19169
|
+
import { join as join44 } from "path";
|
|
19170
|
+
var BLOG_REPO_ROOT = join44(homedir19(), "git/blog");
|
|
19120
19171
|
function loadBlogSkipDays(repoName) {
|
|
19121
|
-
const config = loadRawYaml(
|
|
19172
|
+
const config = loadRawYaml(join44(BLOG_REPO_ROOT, "assist.yml"));
|
|
19122
19173
|
const devlog = config.devlog;
|
|
19123
19174
|
const skip2 = devlog?.skip;
|
|
19124
19175
|
return new Set(skip2?.[repoName]);
|
|
@@ -19126,18 +19177,18 @@ function loadBlogSkipDays(repoName) {
|
|
|
19126
19177
|
|
|
19127
19178
|
// src/commands/devlog/shared.ts
|
|
19128
19179
|
import { execSync as execSync36 } from "child_process";
|
|
19129
|
-
import
|
|
19180
|
+
import chalk144 from "chalk";
|
|
19130
19181
|
|
|
19131
19182
|
// src/shared/getRepoName.ts
|
|
19132
|
-
import { existsSync as
|
|
19133
|
-
import { basename as basename12, join as
|
|
19183
|
+
import { existsSync as existsSync44, readFileSync as readFileSync32 } from "fs";
|
|
19184
|
+
import { basename as basename12, join as join45 } from "path";
|
|
19134
19185
|
function getRepoName() {
|
|
19135
19186
|
const config = loadConfig();
|
|
19136
19187
|
if (config.devlog?.name) {
|
|
19137
19188
|
return config.devlog.name;
|
|
19138
19189
|
}
|
|
19139
|
-
const packageJsonPath =
|
|
19140
|
-
if (
|
|
19190
|
+
const packageJsonPath = join45(process.cwd(), "package.json");
|
|
19191
|
+
if (existsSync44(packageJsonPath)) {
|
|
19141
19192
|
try {
|
|
19142
19193
|
const content = readFileSync32(packageJsonPath, "utf8");
|
|
19143
19194
|
const pkg = JSON.parse(content);
|
|
@@ -19152,8 +19203,8 @@ function getRepoName() {
|
|
|
19152
19203
|
|
|
19153
19204
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
19154
19205
|
import { readdirSync as readdirSync6, readFileSync as readFileSync33 } from "fs";
|
|
19155
|
-
import { join as
|
|
19156
|
-
var DEVLOG_DIR =
|
|
19206
|
+
import { join as join46 } from "path";
|
|
19207
|
+
var DEVLOG_DIR = join46(BLOG_REPO_ROOT, "src/content/devlog");
|
|
19157
19208
|
function extractFrontmatter(content) {
|
|
19158
19209
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
19159
19210
|
return fm?.[1] ?? null;
|
|
@@ -19181,7 +19232,7 @@ function readDevlogFiles(callback) {
|
|
|
19181
19232
|
try {
|
|
19182
19233
|
const files = readdirSync6(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
19183
19234
|
for (const file of files) {
|
|
19184
|
-
const content = readFileSync33(
|
|
19235
|
+
const content = readFileSync33(join46(DEVLOG_DIR, file), "utf8");
|
|
19185
19236
|
const parsed = parseFrontmatter(content, file);
|
|
19186
19237
|
if (parsed) callback(parsed);
|
|
19187
19238
|
}
|
|
@@ -19235,13 +19286,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
19235
19286
|
}
|
|
19236
19287
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
19237
19288
|
for (const commit2 of commits2) {
|
|
19238
|
-
console.log(` ${
|
|
19289
|
+
console.log(` ${chalk144.yellow(commit2.hash)} ${commit2.message}`);
|
|
19239
19290
|
if (verbose) {
|
|
19240
19291
|
const visibleFiles = commit2.files.filter(
|
|
19241
19292
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
19242
19293
|
);
|
|
19243
19294
|
for (const file of visibleFiles) {
|
|
19244
|
-
console.log(` ${
|
|
19295
|
+
console.log(` ${chalk144.dim(file)}`);
|
|
19245
19296
|
}
|
|
19246
19297
|
}
|
|
19247
19298
|
}
|
|
@@ -19266,15 +19317,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
19266
19317
|
}
|
|
19267
19318
|
|
|
19268
19319
|
// src/commands/devlog/list/printDateHeader.ts
|
|
19269
|
-
import
|
|
19320
|
+
import chalk145 from "chalk";
|
|
19270
19321
|
function printDateHeader(date, isSkipped, entries) {
|
|
19271
19322
|
if (isSkipped) {
|
|
19272
|
-
console.log(`${
|
|
19323
|
+
console.log(`${chalk145.bold.blue(date)} ${chalk145.dim("skipped")}`);
|
|
19273
19324
|
} else if (entries && entries.length > 0) {
|
|
19274
|
-
const entryInfo = entries.map((e) => `${
|
|
19275
|
-
console.log(`${
|
|
19325
|
+
const entryInfo = entries.map((e) => `${chalk145.green(e.version)} ${e.title}`).join(" | ");
|
|
19326
|
+
console.log(`${chalk145.bold.blue(date)} ${entryInfo}`);
|
|
19276
19327
|
} else {
|
|
19277
|
-
console.log(`${
|
|
19328
|
+
console.log(`${chalk145.bold.blue(date)} ${chalk145.red("\u26A0 devlog missing")}`);
|
|
19278
19329
|
}
|
|
19279
19330
|
}
|
|
19280
19331
|
|
|
@@ -19378,24 +19429,24 @@ function bumpVersion(version2, type) {
|
|
|
19378
19429
|
|
|
19379
19430
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
19380
19431
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
19381
|
-
import
|
|
19432
|
+
import chalk147 from "chalk";
|
|
19382
19433
|
|
|
19383
19434
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
19384
|
-
import
|
|
19435
|
+
import chalk146 from "chalk";
|
|
19385
19436
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
19386
19437
|
if (conventional && firstHash) {
|
|
19387
19438
|
const version2 = getVersionAtCommit(firstHash);
|
|
19388
19439
|
if (version2) {
|
|
19389
|
-
console.log(`${
|
|
19440
|
+
console.log(`${chalk146.bold("version:")} ${stripToMinor(version2)}`);
|
|
19390
19441
|
} else {
|
|
19391
|
-
console.log(`${
|
|
19442
|
+
console.log(`${chalk146.bold("version:")} ${chalk146.red("unknown")}`);
|
|
19392
19443
|
}
|
|
19393
19444
|
} else if (patchVersion && minorVersion) {
|
|
19394
19445
|
console.log(
|
|
19395
|
-
`${
|
|
19446
|
+
`${chalk146.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
19396
19447
|
);
|
|
19397
19448
|
} else {
|
|
19398
|
-
console.log(`${
|
|
19449
|
+
console.log(`${chalk146.bold("version:")} v0.1 (initial)`);
|
|
19399
19450
|
}
|
|
19400
19451
|
}
|
|
19401
19452
|
|
|
@@ -19443,16 +19494,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
19443
19494
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
19444
19495
|
}
|
|
19445
19496
|
function logName(repoName) {
|
|
19446
|
-
console.log(`${
|
|
19497
|
+
console.log(`${chalk147.bold("name:")} ${repoName}`);
|
|
19447
19498
|
}
|
|
19448
19499
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
19449
19500
|
logName(ctx.repoName);
|
|
19450
19501
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
19451
|
-
console.log(
|
|
19502
|
+
console.log(chalk147.bold.blue(targetDate));
|
|
19452
19503
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
19453
19504
|
}
|
|
19454
19505
|
function logNoCommits(lastInfo) {
|
|
19455
|
-
console.log(
|
|
19506
|
+
console.log(chalk147.dim(noCommitsMessage(!!lastInfo)));
|
|
19456
19507
|
}
|
|
19457
19508
|
|
|
19458
19509
|
// src/commands/devlog/next/index.ts
|
|
@@ -19493,11 +19544,11 @@ function next2(options2) {
|
|
|
19493
19544
|
import { execSync as execSync38 } from "child_process";
|
|
19494
19545
|
|
|
19495
19546
|
// src/commands/devlog/repos/printReposTable.ts
|
|
19496
|
-
import
|
|
19547
|
+
import chalk148 from "chalk";
|
|
19497
19548
|
function colorStatus(status3) {
|
|
19498
|
-
if (status3 === "missing") return
|
|
19499
|
-
if (status3 === "outdated") return
|
|
19500
|
-
return
|
|
19549
|
+
if (status3 === "missing") return chalk148.red(status3);
|
|
19550
|
+
if (status3 === "outdated") return chalk148.yellow(status3);
|
|
19551
|
+
return chalk148.green(status3);
|
|
19501
19552
|
}
|
|
19502
19553
|
function formatRow(row, nameWidth) {
|
|
19503
19554
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -19511,8 +19562,8 @@ function printReposTable(rows) {
|
|
|
19511
19562
|
"Last Devlog".padEnd(11),
|
|
19512
19563
|
"Status"
|
|
19513
19564
|
].join(" ");
|
|
19514
|
-
console.log(
|
|
19515
|
-
console.log(
|
|
19565
|
+
console.log(chalk148.dim(header));
|
|
19566
|
+
console.log(chalk148.dim("-".repeat(header.length)));
|
|
19516
19567
|
for (const row of rows) {
|
|
19517
19568
|
console.log(formatRow(row, nameWidth));
|
|
19518
19569
|
}
|
|
@@ -19569,15 +19620,15 @@ function repos(options2) {
|
|
|
19569
19620
|
|
|
19570
19621
|
// src/commands/devlog/skip.ts
|
|
19571
19622
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
19572
|
-
import { join as
|
|
19573
|
-
import
|
|
19623
|
+
import { join as join47 } from "path";
|
|
19624
|
+
import chalk149 from "chalk";
|
|
19574
19625
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
19575
19626
|
function getBlogConfigPath() {
|
|
19576
|
-
return
|
|
19627
|
+
return join47(BLOG_REPO_ROOT, "assist.yml");
|
|
19577
19628
|
}
|
|
19578
19629
|
function skip(date) {
|
|
19579
19630
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
19580
|
-
console.log(
|
|
19631
|
+
console.log(chalk149.red("Invalid date format. Use YYYY-MM-DD"));
|
|
19581
19632
|
process.exit(1);
|
|
19582
19633
|
}
|
|
19583
19634
|
const repoName = getRepoName();
|
|
@@ -19588,7 +19639,7 @@ function skip(date) {
|
|
|
19588
19639
|
const skipDays = skip2[repoName] ?? [];
|
|
19589
19640
|
if (skipDays.includes(date)) {
|
|
19590
19641
|
console.log(
|
|
19591
|
-
|
|
19642
|
+
chalk149.yellow(`${date} is already in skip list for ${repoName}`)
|
|
19592
19643
|
);
|
|
19593
19644
|
return;
|
|
19594
19645
|
}
|
|
@@ -19598,20 +19649,20 @@ function skip(date) {
|
|
|
19598
19649
|
devlog.skip = skip2;
|
|
19599
19650
|
config.devlog = devlog;
|
|
19600
19651
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
19601
|
-
console.log(
|
|
19652
|
+
console.log(chalk149.green(`Added ${date} to skip list for ${repoName}`));
|
|
19602
19653
|
}
|
|
19603
19654
|
|
|
19604
19655
|
// src/commands/devlog/version.ts
|
|
19605
|
-
import
|
|
19656
|
+
import chalk150 from "chalk";
|
|
19606
19657
|
function version() {
|
|
19607
19658
|
const config = loadConfig();
|
|
19608
19659
|
const name = getRepoName();
|
|
19609
19660
|
const lastInfo = getLastVersionInfo(name, config);
|
|
19610
19661
|
const lastVersion = lastInfo?.version ?? null;
|
|
19611
19662
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
19612
|
-
console.log(`${
|
|
19613
|
-
console.log(`${
|
|
19614
|
-
console.log(`${
|
|
19663
|
+
console.log(`${chalk150.bold("name:")} ${name}`);
|
|
19664
|
+
console.log(`${chalk150.bold("last:")} ${lastVersion ?? chalk150.dim("none")}`);
|
|
19665
|
+
console.log(`${chalk150.bold("next:")} ${nextVersion ?? chalk150.dim("none")}`);
|
|
19615
19666
|
}
|
|
19616
19667
|
|
|
19617
19668
|
// src/commands/registerDevlog.ts
|
|
@@ -19635,8 +19686,8 @@ function registerDevlog(program2) {
|
|
|
19635
19686
|
|
|
19636
19687
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
19637
19688
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync7 } from "fs";
|
|
19638
|
-
import { join as
|
|
19639
|
-
import
|
|
19689
|
+
import { join as join48 } from "path";
|
|
19690
|
+
import chalk151 from "chalk";
|
|
19640
19691
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
19641
19692
|
function isLockedDll(debugDir) {
|
|
19642
19693
|
let files;
|
|
@@ -19647,7 +19698,7 @@ function isLockedDll(debugDir) {
|
|
|
19647
19698
|
}
|
|
19648
19699
|
for (const file of files) {
|
|
19649
19700
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
19650
|
-
const dllPath =
|
|
19701
|
+
const dllPath = join48(debugDir, file);
|
|
19651
19702
|
try {
|
|
19652
19703
|
const fd = openSync3(dllPath, "r+");
|
|
19653
19704
|
closeSync3(fd);
|
|
@@ -19665,13 +19716,13 @@ function findFirstLockedDll(dir) {
|
|
|
19665
19716
|
return null;
|
|
19666
19717
|
}
|
|
19667
19718
|
if (entries.includes("bin")) {
|
|
19668
|
-
const locked = isLockedDll(
|
|
19719
|
+
const locked = isLockedDll(join48(dir, "bin", "Debug"));
|
|
19669
19720
|
if (locked) return locked;
|
|
19670
19721
|
}
|
|
19671
19722
|
for (const entry of entries) {
|
|
19672
19723
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
19673
19724
|
continue;
|
|
19674
|
-
const found = findFirstLockedDll(
|
|
19725
|
+
const found = findFirstLockedDll(join48(dir, entry));
|
|
19675
19726
|
if (found) return found;
|
|
19676
19727
|
}
|
|
19677
19728
|
return null;
|
|
@@ -19683,14 +19734,14 @@ function checkBuildLocks(startDir) {
|
|
|
19683
19734
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
19684
19735
|
if (locked) {
|
|
19685
19736
|
console.error(
|
|
19686
|
-
|
|
19737
|
+
chalk151.red("Build output locked (is VS debugging?): ") + locked
|
|
19687
19738
|
);
|
|
19688
19739
|
process.exit(1);
|
|
19689
19740
|
}
|
|
19690
19741
|
}
|
|
19691
19742
|
async function checkBuildLocksCommand() {
|
|
19692
19743
|
checkBuildLocks();
|
|
19693
|
-
console.log(
|
|
19744
|
+
console.log(chalk151.green("No build locks detected"));
|
|
19694
19745
|
}
|
|
19695
19746
|
|
|
19696
19747
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -19789,30 +19840,30 @@ function escapeRegex(s) {
|
|
|
19789
19840
|
}
|
|
19790
19841
|
|
|
19791
19842
|
// src/commands/dotnet/printTree.ts
|
|
19792
|
-
import
|
|
19843
|
+
import chalk152 from "chalk";
|
|
19793
19844
|
function printNodes(nodes, prefix2) {
|
|
19794
19845
|
for (let i = 0; i < nodes.length; i++) {
|
|
19795
19846
|
const isLast = i === nodes.length - 1;
|
|
19796
19847
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
19797
19848
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
19798
19849
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
19799
|
-
const label2 = isMissing ?
|
|
19850
|
+
const label2 = isMissing ? chalk152.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
19800
19851
|
console.log(`${prefix2}${connector}${label2}`);
|
|
19801
19852
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
19802
19853
|
}
|
|
19803
19854
|
}
|
|
19804
19855
|
function printTree(tree, totalCount, solutions) {
|
|
19805
|
-
console.log(
|
|
19806
|
-
console.log(
|
|
19856
|
+
console.log(chalk152.bold("\nProject Dependency Tree"));
|
|
19857
|
+
console.log(chalk152.cyan(tree.relativePath));
|
|
19807
19858
|
printNodes(tree.children, "");
|
|
19808
|
-
console.log(
|
|
19859
|
+
console.log(chalk152.dim(`
|
|
19809
19860
|
${totalCount} projects total (including root)`));
|
|
19810
|
-
console.log(
|
|
19861
|
+
console.log(chalk152.bold("\nSolution Membership"));
|
|
19811
19862
|
if (solutions.length === 0) {
|
|
19812
|
-
console.log(
|
|
19863
|
+
console.log(chalk152.yellow(" Not found in any .sln"));
|
|
19813
19864
|
} else {
|
|
19814
19865
|
for (const sln of solutions) {
|
|
19815
|
-
console.log(` ${
|
|
19866
|
+
console.log(` ${chalk152.green(sln)}`);
|
|
19816
19867
|
}
|
|
19817
19868
|
}
|
|
19818
19869
|
console.log();
|
|
@@ -19839,18 +19890,18 @@ function printJson(tree, totalCount, solutions) {
|
|
|
19839
19890
|
}
|
|
19840
19891
|
|
|
19841
19892
|
// src/commands/dotnet/resolveCsproj.ts
|
|
19842
|
-
import { existsSync as
|
|
19893
|
+
import { existsSync as existsSync45 } from "fs";
|
|
19843
19894
|
import path39 from "path";
|
|
19844
|
-
import
|
|
19895
|
+
import chalk153 from "chalk";
|
|
19845
19896
|
function resolveCsproj(csprojPath) {
|
|
19846
19897
|
const resolved = path39.resolve(csprojPath);
|
|
19847
|
-
if (!
|
|
19848
|
-
console.error(
|
|
19898
|
+
if (!existsSync45(resolved)) {
|
|
19899
|
+
console.error(chalk153.red(`File not found: ${resolved}`));
|
|
19849
19900
|
process.exit(1);
|
|
19850
19901
|
}
|
|
19851
19902
|
const repoRoot2 = findRepoRoot(path39.dirname(resolved));
|
|
19852
19903
|
if (!repoRoot2) {
|
|
19853
|
-
console.error(
|
|
19904
|
+
console.error(chalk153.red("Could not find git repository root"));
|
|
19854
19905
|
process.exit(1);
|
|
19855
19906
|
}
|
|
19856
19907
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -19900,12 +19951,12 @@ function getChangedCsFiles(scope) {
|
|
|
19900
19951
|
}
|
|
19901
19952
|
|
|
19902
19953
|
// src/commands/dotnet/inSln.ts
|
|
19903
|
-
import
|
|
19954
|
+
import chalk154 from "chalk";
|
|
19904
19955
|
async function inSln(csprojPath) {
|
|
19905
19956
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
19906
19957
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
19907
19958
|
if (solutions.length === 0) {
|
|
19908
|
-
console.log(
|
|
19959
|
+
console.log(chalk154.yellow("Not found in any .sln file"));
|
|
19909
19960
|
process.exit(1);
|
|
19910
19961
|
}
|
|
19911
19962
|
for (const sln of solutions) {
|
|
@@ -19914,7 +19965,7 @@ async function inSln(csprojPath) {
|
|
|
19914
19965
|
}
|
|
19915
19966
|
|
|
19916
19967
|
// src/commands/dotnet/inspect.ts
|
|
19917
|
-
import
|
|
19968
|
+
import chalk160 from "chalk";
|
|
19918
19969
|
|
|
19919
19970
|
// src/shared/formatElapsed.ts
|
|
19920
19971
|
function formatElapsed(ms) {
|
|
@@ -19926,12 +19977,12 @@ function formatElapsed(ms) {
|
|
|
19926
19977
|
}
|
|
19927
19978
|
|
|
19928
19979
|
// src/commands/dotnet/displayIssues.ts
|
|
19929
|
-
import
|
|
19980
|
+
import chalk155 from "chalk";
|
|
19930
19981
|
var SEVERITY_COLOR = {
|
|
19931
|
-
ERROR:
|
|
19932
|
-
WARNING:
|
|
19933
|
-
SUGGESTION:
|
|
19934
|
-
HINT:
|
|
19982
|
+
ERROR: chalk155.red,
|
|
19983
|
+
WARNING: chalk155.yellow,
|
|
19984
|
+
SUGGESTION: chalk155.cyan,
|
|
19985
|
+
HINT: chalk155.dim
|
|
19935
19986
|
};
|
|
19936
19987
|
function groupByFile(issues) {
|
|
19937
19988
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -19947,15 +19998,15 @@ function groupByFile(issues) {
|
|
|
19947
19998
|
}
|
|
19948
19999
|
function displayIssues(issues) {
|
|
19949
20000
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
19950
|
-
console.log(
|
|
20001
|
+
console.log(chalk155.bold(file));
|
|
19951
20002
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
19952
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
20003
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk155.white;
|
|
19953
20004
|
console.log(
|
|
19954
|
-
` ${
|
|
20005
|
+
` ${chalk155.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
19955
20006
|
);
|
|
19956
20007
|
}
|
|
19957
20008
|
}
|
|
19958
|
-
console.log(
|
|
20009
|
+
console.log(chalk155.dim(`
|
|
19959
20010
|
${issues.length} issue(s) found`));
|
|
19960
20011
|
}
|
|
19961
20012
|
|
|
@@ -20012,17 +20063,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
20012
20063
|
}
|
|
20013
20064
|
|
|
20014
20065
|
// src/commands/dotnet/resolveSolution.ts
|
|
20015
|
-
import { existsSync as
|
|
20066
|
+
import { existsSync as existsSync46 } from "fs";
|
|
20016
20067
|
import path40 from "path";
|
|
20017
|
-
import
|
|
20068
|
+
import chalk157 from "chalk";
|
|
20018
20069
|
|
|
20019
20070
|
// src/commands/dotnet/findSolution.ts
|
|
20020
20071
|
import { readdirSync as readdirSync9 } from "fs";
|
|
20021
|
-
import { dirname as
|
|
20022
|
-
import
|
|
20072
|
+
import { dirname as dirname25, join as join49 } from "path";
|
|
20073
|
+
import chalk156 from "chalk";
|
|
20023
20074
|
function findSlnInDir(dir) {
|
|
20024
20075
|
try {
|
|
20025
|
-
return readdirSync9(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
20076
|
+
return readdirSync9(dir).filter((f) => f.endsWith(".sln")).map((f) => join49(dir, f));
|
|
20026
20077
|
} catch {
|
|
20027
20078
|
return [];
|
|
20028
20079
|
}
|
|
@@ -20035,17 +20086,17 @@ function findSolution() {
|
|
|
20035
20086
|
const slnFiles = findSlnInDir(current);
|
|
20036
20087
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
20037
20088
|
if (slnFiles.length > 1) {
|
|
20038
|
-
console.error(
|
|
20089
|
+
console.error(chalk156.red(`Multiple .sln files found in ${current}:`));
|
|
20039
20090
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
20040
20091
|
console.error(
|
|
20041
|
-
|
|
20092
|
+
chalk156.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
20042
20093
|
);
|
|
20043
20094
|
process.exit(1);
|
|
20044
20095
|
}
|
|
20045
20096
|
if (current === ceiling) break;
|
|
20046
|
-
current =
|
|
20097
|
+
current = dirname25(current);
|
|
20047
20098
|
}
|
|
20048
|
-
console.error(
|
|
20099
|
+
console.error(chalk156.red("No .sln file found between cwd and repo root"));
|
|
20049
20100
|
process.exit(1);
|
|
20050
20101
|
}
|
|
20051
20102
|
|
|
@@ -20053,8 +20104,8 @@ function findSolution() {
|
|
|
20053
20104
|
function resolveSolution(sln) {
|
|
20054
20105
|
if (sln) {
|
|
20055
20106
|
const resolved = path40.resolve(sln);
|
|
20056
|
-
if (!
|
|
20057
|
-
console.error(
|
|
20107
|
+
if (!existsSync46(resolved)) {
|
|
20108
|
+
console.error(chalk157.red(`Solution file not found: ${resolved}`));
|
|
20058
20109
|
process.exit(1);
|
|
20059
20110
|
}
|
|
20060
20111
|
return resolved;
|
|
@@ -20093,17 +20144,17 @@ function parseInspectReport(json) {
|
|
|
20093
20144
|
|
|
20094
20145
|
// src/commands/dotnet/runInspectCode.ts
|
|
20095
20146
|
import { execSync as execSync40 } from "child_process";
|
|
20096
|
-
import { existsSync as
|
|
20147
|
+
import { existsSync as existsSync47, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
20097
20148
|
import { tmpdir as tmpdir4 } from "os";
|
|
20098
20149
|
import path41 from "path";
|
|
20099
|
-
import
|
|
20150
|
+
import chalk158 from "chalk";
|
|
20100
20151
|
function assertJbInstalled() {
|
|
20101
20152
|
try {
|
|
20102
20153
|
execSync40("jb inspectcode --version", { stdio: "pipe" });
|
|
20103
20154
|
} catch {
|
|
20104
|
-
console.error(
|
|
20155
|
+
console.error(chalk158.red("jb is not installed. Install with:"));
|
|
20105
20156
|
console.error(
|
|
20106
|
-
|
|
20157
|
+
chalk158.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
20107
20158
|
);
|
|
20108
20159
|
process.exit(1);
|
|
20109
20160
|
}
|
|
@@ -20121,11 +20172,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
20121
20172
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
20122
20173
|
process.stderr.write(error.stderr);
|
|
20123
20174
|
}
|
|
20124
|
-
console.error(
|
|
20175
|
+
console.error(chalk158.red("jb inspectcode failed"));
|
|
20125
20176
|
process.exit(1);
|
|
20126
20177
|
}
|
|
20127
|
-
if (!
|
|
20128
|
-
console.error(
|
|
20178
|
+
if (!existsSync47(reportPath)) {
|
|
20179
|
+
console.error(chalk158.red("Report file not generated"));
|
|
20129
20180
|
process.exit(1);
|
|
20130
20181
|
}
|
|
20131
20182
|
const xml = readFileSync36(reportPath, "utf8");
|
|
@@ -20135,7 +20186,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
20135
20186
|
|
|
20136
20187
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
20137
20188
|
import { execSync as execSync41 } from "child_process";
|
|
20138
|
-
import
|
|
20189
|
+
import chalk159 from "chalk";
|
|
20139
20190
|
function resolveMsbuildPath() {
|
|
20140
20191
|
const { run: run4 } = loadConfig();
|
|
20141
20192
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -20147,9 +20198,9 @@ function assertMsbuildInstalled() {
|
|
|
20147
20198
|
try {
|
|
20148
20199
|
execSync41(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
20149
20200
|
} catch {
|
|
20150
|
-
console.error(
|
|
20201
|
+
console.error(chalk159.red(`msbuild not found at: ${msbuild}`));
|
|
20151
20202
|
console.error(
|
|
20152
|
-
|
|
20203
|
+
chalk159.yellow(
|
|
20153
20204
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
20154
20205
|
)
|
|
20155
20206
|
);
|
|
@@ -20196,17 +20247,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
20196
20247
|
// src/commands/dotnet/inspect.ts
|
|
20197
20248
|
function logScope(changedFiles2) {
|
|
20198
20249
|
if (changedFiles2 === null) {
|
|
20199
|
-
console.log(
|
|
20250
|
+
console.log(chalk160.dim("Inspecting full solution..."));
|
|
20200
20251
|
} else {
|
|
20201
20252
|
console.log(
|
|
20202
|
-
|
|
20253
|
+
chalk160.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
20203
20254
|
);
|
|
20204
20255
|
}
|
|
20205
20256
|
}
|
|
20206
20257
|
function reportResults(issues, elapsed) {
|
|
20207
20258
|
if (issues.length > 0) displayIssues(issues);
|
|
20208
|
-
else console.log(
|
|
20209
|
-
console.log(
|
|
20259
|
+
else console.log(chalk160.green("No issues found"));
|
|
20260
|
+
console.log(chalk160.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
20210
20261
|
if (issues.length > 0) process.exit(1);
|
|
20211
20262
|
}
|
|
20212
20263
|
async function inspect(sln, options2) {
|
|
@@ -20217,7 +20268,7 @@ async function inspect(sln, options2) {
|
|
|
20217
20268
|
const scope = parseScope(options2.scope);
|
|
20218
20269
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
20219
20270
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
20220
|
-
console.log(
|
|
20271
|
+
console.log(chalk160.green("No changed .cs files found"));
|
|
20221
20272
|
return;
|
|
20222
20273
|
}
|
|
20223
20274
|
logScope(changedFiles2);
|
|
@@ -20413,11 +20464,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
20413
20464
|
}
|
|
20414
20465
|
|
|
20415
20466
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
20416
|
-
import { existsSync as
|
|
20467
|
+
import { existsSync as existsSync48, unlinkSync as unlinkSync11 } from "fs";
|
|
20417
20468
|
function consumeMigrationApproval(migrationId) {
|
|
20418
20469
|
sweepRestrictedDir();
|
|
20419
20470
|
const path80 = getMigrationApprovalPath(migrationId);
|
|
20420
|
-
if (!
|
|
20471
|
+
if (!existsSync48(path80)) return false;
|
|
20421
20472
|
try {
|
|
20422
20473
|
unlinkSync11(path80);
|
|
20423
20474
|
return true;
|
|
@@ -20537,7 +20588,7 @@ function aggregateCommitters(authorLists) {
|
|
|
20537
20588
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
20538
20589
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync30 } from "fs";
|
|
20539
20590
|
import { tmpdir as tmpdir5 } from "os";
|
|
20540
|
-
import { join as
|
|
20591
|
+
import { join as join50 } from "path";
|
|
20541
20592
|
|
|
20542
20593
|
// src/shared/throwOnGraphqlErrors.ts
|
|
20543
20594
|
function throwOnGraphqlErrors(stdout) {
|
|
@@ -20566,7 +20617,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
20566
20617
|
return args;
|
|
20567
20618
|
}
|
|
20568
20619
|
function runGhGraphql(mutation, vars) {
|
|
20569
|
-
const queryFile =
|
|
20620
|
+
const queryFile = join50(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
20570
20621
|
writeFileSync30(queryFile, mutation);
|
|
20571
20622
|
try {
|
|
20572
20623
|
const result = spawnSync4("gh", buildArgs2(queryFile, vars), {
|
|
@@ -20631,25 +20682,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
20631
20682
|
}
|
|
20632
20683
|
|
|
20633
20684
|
// src/commands/github/printCountTable.ts
|
|
20634
|
-
import
|
|
20685
|
+
import chalk161 from "chalk";
|
|
20635
20686
|
function printCountTable(labelHeader, rows) {
|
|
20636
20687
|
const labelWidth = Math.max(
|
|
20637
20688
|
labelHeader.length,
|
|
20638
20689
|
...rows.map((row) => row.label.length)
|
|
20639
20690
|
);
|
|
20640
20691
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
20641
|
-
console.log(
|
|
20642
|
-
console.log(
|
|
20692
|
+
console.log(chalk161.dim(header));
|
|
20693
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
20643
20694
|
for (const row of rows) {
|
|
20644
20695
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
20645
20696
|
}
|
|
20646
20697
|
}
|
|
20647
20698
|
|
|
20648
20699
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
20649
|
-
import
|
|
20700
|
+
import chalk162 from "chalk";
|
|
20650
20701
|
function printRepoAuthorBreakdown(repos2) {
|
|
20651
20702
|
for (const repo of repos2) {
|
|
20652
|
-
console.log(
|
|
20703
|
+
console.log(chalk162.bold(repo.name));
|
|
20653
20704
|
const authorWidth = Math.max(
|
|
20654
20705
|
0,
|
|
20655
20706
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -20732,10 +20783,10 @@ function parseTopCount(value) {
|
|
|
20732
20783
|
}
|
|
20733
20784
|
|
|
20734
20785
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
20735
|
-
import
|
|
20786
|
+
import chalk164 from "chalk";
|
|
20736
20787
|
|
|
20737
20788
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
20738
|
-
import
|
|
20789
|
+
import chalk163 from "chalk";
|
|
20739
20790
|
|
|
20740
20791
|
// src/shared/runGhGraphqlJson.ts
|
|
20741
20792
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
@@ -20786,7 +20837,7 @@ function writeLineNow(line) {
|
|
|
20786
20837
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
20787
20838
|
function applyFixStructurePlan(plan2) {
|
|
20788
20839
|
for (const entry of plan2.entries) {
|
|
20789
|
-
const where =
|
|
20840
|
+
const where = chalk163.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
20790
20841
|
const { typeChange, labelRemovals } = entry;
|
|
20791
20842
|
if (typeChange) {
|
|
20792
20843
|
writeLineNow(
|
|
@@ -21056,12 +21107,12 @@ function planSubtree(root, context) {
|
|
|
21056
21107
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
21057
21108
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
21058
21109
|
applyFixStructurePlan(plan2);
|
|
21059
|
-
writeLineNow(
|
|
21110
|
+
writeLineNow(chalk164.dim("Re-walking the subtree to confirm"));
|
|
21060
21111
|
assertNoResidualDrift(
|
|
21061
21112
|
planSubtree(fetchRootIssue(target), context),
|
|
21062
21113
|
context.chain
|
|
21063
21114
|
);
|
|
21064
|
-
writeLineNow(
|
|
21115
|
+
writeLineNow(chalk164.green("Subtree normalised"));
|
|
21065
21116
|
}
|
|
21066
21117
|
|
|
21067
21118
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -21097,22 +21148,22 @@ function parseTypeChain(value) {
|
|
|
21097
21148
|
}
|
|
21098
21149
|
|
|
21099
21150
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
21100
|
-
import
|
|
21151
|
+
import chalk165 from "chalk";
|
|
21101
21152
|
function annotate(entry) {
|
|
21102
21153
|
const notes = [];
|
|
21103
21154
|
if (entry.level === null) {
|
|
21104
|
-
notes.push(
|
|
21155
|
+
notes.push(chalk165.red("deeper than the leaf level"));
|
|
21105
21156
|
} else if (entry.typeChange) {
|
|
21106
21157
|
notes.push(
|
|
21107
|
-
|
|
21158
|
+
chalk165.yellow(
|
|
21108
21159
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
21109
21160
|
)
|
|
21110
21161
|
);
|
|
21111
21162
|
} else {
|
|
21112
|
-
notes.push(
|
|
21163
|
+
notes.push(chalk165.dim(entry.issue.typeName ?? "no type"));
|
|
21113
21164
|
}
|
|
21114
21165
|
for (const label2 of entry.labelRemovals) {
|
|
21115
|
-
notes.push(
|
|
21166
|
+
notes.push(chalk165.yellow(`-${label2.name}`));
|
|
21116
21167
|
}
|
|
21117
21168
|
return notes;
|
|
21118
21169
|
}
|
|
@@ -21120,22 +21171,22 @@ function formatCount(count8, noun) {
|
|
|
21120
21171
|
return `${count8} ${noun}${count8 === 1 ? "" : "s"}`;
|
|
21121
21172
|
}
|
|
21122
21173
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
21123
|
-
writeLineNow(
|
|
21174
|
+
writeLineNow(chalk165.dim(`chain: ${chain2.join(" > ")}`));
|
|
21124
21175
|
for (const entry of plan2.entries) {
|
|
21125
21176
|
const indent3 = " ".repeat(entry.issue.depth);
|
|
21126
|
-
const name =
|
|
21177
|
+
const name = chalk165.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
21127
21178
|
writeLineNow(
|
|
21128
21179
|
`${indent3}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
21129
21180
|
);
|
|
21130
21181
|
}
|
|
21131
21182
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
21132
|
-
writeLineNow(
|
|
21183
|
+
writeLineNow(chalk165.green("Nothing to change"));
|
|
21133
21184
|
return;
|
|
21134
21185
|
}
|
|
21135
21186
|
writeLineNow(
|
|
21136
21187
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
21137
21188
|
);
|
|
21138
|
-
if (!apply) writeLineNow(
|
|
21189
|
+
if (!apply) writeLineNow(chalk165.dim("Dry run \u2014 nothing written"));
|
|
21139
21190
|
}
|
|
21140
21191
|
|
|
21141
21192
|
// src/commands/github/issue/fixStructure/resolveFixStructureTarget.ts
|
|
@@ -21473,24 +21524,24 @@ function fetchIssue2(number, repo) {
|
|
|
21473
21524
|
}
|
|
21474
21525
|
|
|
21475
21526
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
21476
|
-
import { existsSync as
|
|
21527
|
+
import { existsSync as existsSync49, readFileSync as readFileSync37 } from "fs";
|
|
21477
21528
|
|
|
21478
21529
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
21479
|
-
import { join as
|
|
21530
|
+
import { join as join51 } from "path";
|
|
21480
21531
|
function issueWorkingFile(slug, number) {
|
|
21481
21532
|
const [owner = "unknown", repo = "unknown"] = slug.split("/");
|
|
21482
|
-
const dir =
|
|
21533
|
+
const dir = join51(getStoreDir(), "github-issues", owner, repo);
|
|
21483
21534
|
return {
|
|
21484
21535
|
dir,
|
|
21485
|
-
bodyPath:
|
|
21486
|
-
metaPath:
|
|
21536
|
+
bodyPath: join51(dir, `${number}.md`),
|
|
21537
|
+
metaPath: join51(dir, `${number}.json`)
|
|
21487
21538
|
};
|
|
21488
21539
|
}
|
|
21489
21540
|
|
|
21490
21541
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
21491
21542
|
function resumeIssueBody(slug, number, updatedAt) {
|
|
21492
21543
|
const { bodyPath, metaPath } = issueWorkingFile(slug, number);
|
|
21493
|
-
if (!
|
|
21544
|
+
if (!existsSync49(bodyPath) || !existsSync49(metaPath)) return void 0;
|
|
21494
21545
|
try {
|
|
21495
21546
|
const meta = JSON.parse(readFileSync37(metaPath, "utf8"));
|
|
21496
21547
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -21683,24 +21734,24 @@ async function countPendingHandovers(orm, origin) {
|
|
|
21683
21734
|
|
|
21684
21735
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
21685
21736
|
import {
|
|
21686
|
-
existsSync as
|
|
21737
|
+
existsSync as existsSync50,
|
|
21687
21738
|
readdirSync as readdirSync10,
|
|
21688
21739
|
readFileSync as readFileSync38,
|
|
21689
21740
|
rmSync as rmSync3,
|
|
21690
21741
|
statSync as statSync8
|
|
21691
21742
|
} from "fs";
|
|
21692
|
-
import { basename as basename14, join as
|
|
21743
|
+
import { basename as basename14, join as join54 } from "path";
|
|
21693
21744
|
|
|
21694
21745
|
// src/commands/handover/getHandoverPath.ts
|
|
21695
|
-
import { join as
|
|
21746
|
+
import { join as join52 } from "path";
|
|
21696
21747
|
function getHandoverPath(cwd = process.cwd()) {
|
|
21697
|
-
return
|
|
21748
|
+
return join52(cwd, ".assist", "HANDOVER.md");
|
|
21698
21749
|
}
|
|
21699
21750
|
|
|
21700
21751
|
// src/commands/handover/getHandoversDir.ts
|
|
21701
|
-
import { join as
|
|
21752
|
+
import { join as join53 } from "path";
|
|
21702
21753
|
function getHandoversDir(cwd = process.cwd()) {
|
|
21703
|
-
return
|
|
21754
|
+
return join53(cwd, ".assist", "handovers");
|
|
21704
21755
|
}
|
|
21705
21756
|
|
|
21706
21757
|
// src/commands/handover/parseArchiveTimestamp.ts
|
|
@@ -21738,10 +21789,10 @@ function summariseHandoverContent(content) {
|
|
|
21738
21789
|
|
|
21739
21790
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
21740
21791
|
function collectMarkdown(dir) {
|
|
21741
|
-
if (!
|
|
21792
|
+
if (!existsSync50(dir)) return [];
|
|
21742
21793
|
const out = [];
|
|
21743
21794
|
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
21744
|
-
const full =
|
|
21795
|
+
const full = join54(dir, entry.name);
|
|
21745
21796
|
if (entry.isDirectory()) out.push(...collectMarkdown(full));
|
|
21746
21797
|
else if (entry.isFile() && entry.name.endsWith(".md")) out.push(full);
|
|
21747
21798
|
}
|
|
@@ -21765,7 +21816,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
21765
21816
|
migrated++;
|
|
21766
21817
|
}
|
|
21767
21818
|
const handoverPath = getHandoverPath(cwd);
|
|
21768
|
-
if (
|
|
21819
|
+
if (existsSync50(handoverPath)) {
|
|
21769
21820
|
await migrateFile(orm, origin, handoverPath, statSync8(handoverPath).mtime);
|
|
21770
21821
|
migrated++;
|
|
21771
21822
|
}
|
|
@@ -21896,7 +21947,7 @@ function registerHandover(program2) {
|
|
|
21896
21947
|
}
|
|
21897
21948
|
|
|
21898
21949
|
// src/commands/jira/acceptanceCriteria.ts
|
|
21899
|
-
import
|
|
21950
|
+
import chalk166 from "chalk";
|
|
21900
21951
|
|
|
21901
21952
|
// src/commands/jira/adfToText.ts
|
|
21902
21953
|
function renderInline(node) {
|
|
@@ -21963,7 +22014,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
21963
22014
|
const parsed = fetchIssue(issueKey, field);
|
|
21964
22015
|
const acValue = parsed?.fields?.[field];
|
|
21965
22016
|
if (!acValue) {
|
|
21966
|
-
console.log(
|
|
22017
|
+
console.log(chalk166.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
21967
22018
|
return;
|
|
21968
22019
|
}
|
|
21969
22020
|
if (typeof acValue === "string") {
|
|
@@ -22029,14 +22080,14 @@ async function jiraAuth() {
|
|
|
22029
22080
|
}
|
|
22030
22081
|
|
|
22031
22082
|
// src/commands/jira/viewIssue.ts
|
|
22032
|
-
import
|
|
22083
|
+
import chalk167 from "chalk";
|
|
22033
22084
|
function viewIssue2(issueKey) {
|
|
22034
22085
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
22035
22086
|
const fields = parsed?.fields;
|
|
22036
22087
|
const summary = fields?.summary;
|
|
22037
22088
|
const description = fields?.description;
|
|
22038
22089
|
if (summary) {
|
|
22039
|
-
console.log(
|
|
22090
|
+
console.log(chalk167.bold(summary));
|
|
22040
22091
|
}
|
|
22041
22092
|
if (description) {
|
|
22042
22093
|
if (summary) console.log();
|
|
@@ -22050,7 +22101,7 @@ function viewIssue2(issueKey) {
|
|
|
22050
22101
|
}
|
|
22051
22102
|
if (!summary && !description) {
|
|
22052
22103
|
console.log(
|
|
22053
|
-
|
|
22104
|
+
chalk167.yellow(`No summary or description found on ${issueKey}.`)
|
|
22054
22105
|
);
|
|
22055
22106
|
}
|
|
22056
22107
|
}
|
|
@@ -22085,7 +22136,7 @@ import { randomUUID as randomUUID10 } from "crypto";
|
|
|
22085
22136
|
|
|
22086
22137
|
// src/commands/review/checkoutPr.ts
|
|
22087
22138
|
import { execFileSync as execFileSync12 } from "child_process";
|
|
22088
|
-
import
|
|
22139
|
+
import chalk168 from "chalk";
|
|
22089
22140
|
|
|
22090
22141
|
// src/commands/sessions/daemon/daemonLog.ts
|
|
22091
22142
|
var RING_CAPACITY = 1e3;
|
|
@@ -22122,18 +22173,18 @@ function canonicalTreePath(path80) {
|
|
|
22122
22173
|
}
|
|
22123
22174
|
|
|
22124
22175
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
22125
|
-
import { existsSync as
|
|
22126
|
-
import { basename as basename16, dirname as
|
|
22176
|
+
import { existsSync as existsSync51 } from "fs";
|
|
22177
|
+
import { basename as basename16, dirname as dirname26 } from "path";
|
|
22127
22178
|
|
|
22128
22179
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
22129
|
-
import { basename as basename15, join as
|
|
22180
|
+
import { basename as basename15, join as join55 } from "path";
|
|
22130
22181
|
function planAllocation(clone, boundTreeRoots2) {
|
|
22131
22182
|
return boundTreeRoots2.has(clone) ? "spill" : "primary";
|
|
22132
22183
|
}
|
|
22133
22184
|
function nextWorktreePath(clone, base, isTaken) {
|
|
22134
22185
|
const name = basename15(clone);
|
|
22135
22186
|
for (let n = 2; n < 1e3; n++) {
|
|
22136
|
-
const candidate =
|
|
22187
|
+
const candidate = join55(base, `${name}-${n}`);
|
|
22137
22188
|
if (!isTaken(candidate)) return candidate;
|
|
22138
22189
|
}
|
|
22139
22190
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -22166,10 +22217,10 @@ function cloneHead(clone) {
|
|
|
22166
22217
|
|
|
22167
22218
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
22168
22219
|
function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
22169
|
-
const base = strategy.root ? expandTilde2(strategy.root) :
|
|
22220
|
+
const base = strategy.root ? expandTilde2(strategy.root) : dirname26(clone);
|
|
22170
22221
|
const registered = new Set(listWorktreePaths(clone));
|
|
22171
22222
|
const branches = new Set(listLocalBranches(clone));
|
|
22172
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
22223
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync51(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
|
|
22173
22224
|
const path80 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
22174
22225
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
22175
22226
|
gitSync(clone, [
|
|
@@ -22195,7 +22246,7 @@ function keptInTree(cwd, reason4) {
|
|
|
22195
22246
|
}
|
|
22196
22247
|
|
|
22197
22248
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
22198
|
-
import { existsSync as
|
|
22249
|
+
import { existsSync as existsSync52 } from "fs";
|
|
22199
22250
|
var treeIsGone = { durable: true, gone: true };
|
|
22200
22251
|
function treeDurability(state) {
|
|
22201
22252
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -22226,14 +22277,14 @@ function* durabilityProbes() {
|
|
|
22226
22277
|
});
|
|
22227
22278
|
}
|
|
22228
22279
|
async function checkDurability(cwd) {
|
|
22229
|
-
if (!
|
|
22280
|
+
if (!existsSync52(cwd)) return treeIsGone;
|
|
22230
22281
|
const probes = durabilityProbes();
|
|
22231
22282
|
let step2 = probes.next();
|
|
22232
22283
|
while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
|
|
22233
22284
|
return step2.value;
|
|
22234
22285
|
}
|
|
22235
22286
|
function checkDurabilitySync(cwd) {
|
|
22236
|
-
if (!
|
|
22287
|
+
if (!existsSync52(cwd)) return treeIsGone;
|
|
22237
22288
|
const probes = durabilityProbes();
|
|
22238
22289
|
let step2 = probes.next();
|
|
22239
22290
|
while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
|
|
@@ -22476,20 +22527,20 @@ function persistedTreeRoots() {
|
|
|
22476
22527
|
}
|
|
22477
22528
|
|
|
22478
22529
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
22479
|
-
import { copyFileSync, existsSync as
|
|
22480
|
-
import { dirname as
|
|
22530
|
+
import { copyFileSync, existsSync as existsSync54, mkdirSync as mkdirSync17 } from "fs";
|
|
22531
|
+
import { dirname as dirname27, join as join57 } from "path";
|
|
22481
22532
|
|
|
22482
22533
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
22483
22534
|
import { spawn as spawn5 } from "child_process";
|
|
22484
22535
|
|
|
22485
22536
|
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
22486
|
-
import { existsSync as
|
|
22487
|
-
import { join as
|
|
22537
|
+
import { existsSync as existsSync53 } from "fs";
|
|
22538
|
+
import { join as join56 } from "path";
|
|
22488
22539
|
function detectInstallCommand(repoRoot2) {
|
|
22489
|
-
if (!
|
|
22490
|
-
if (
|
|
22491
|
-
if (
|
|
22492
|
-
if (
|
|
22540
|
+
if (!existsSync53(join56(repoRoot2, "package.json"))) return null;
|
|
22541
|
+
if (existsSync53(join56(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
|
|
22542
|
+
if (existsSync53(join56(repoRoot2, "yarn.lock"))) return "yarn install";
|
|
22543
|
+
if (existsSync53(join56(repoRoot2, "bun.lockb"))) return "bun install";
|
|
22493
22544
|
return "npm install";
|
|
22494
22545
|
}
|
|
22495
22546
|
function resolveInstallCommand(repoRoot2, install) {
|
|
@@ -22601,11 +22652,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
22601
22652
|
}
|
|
22602
22653
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
22603
22654
|
for (const rel of copy) {
|
|
22604
|
-
const src =
|
|
22605
|
-
if (!
|
|
22606
|
-
const dest =
|
|
22655
|
+
const src = join57(clone, rel);
|
|
22656
|
+
if (!existsSync54(src)) continue;
|
|
22657
|
+
const dest = join57(worktreePath, rel);
|
|
22607
22658
|
try {
|
|
22608
|
-
mkdirSync17(
|
|
22659
|
+
mkdirSync17(dirname27(dest), { recursive: true });
|
|
22609
22660
|
copyFileSync(src, dest);
|
|
22610
22661
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
22611
22662
|
} catch (error) {
|
|
@@ -22697,7 +22748,7 @@ async function checkoutPr(number) {
|
|
|
22697
22748
|
try {
|
|
22698
22749
|
execFileSync12("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
22699
22750
|
} catch {
|
|
22700
|
-
console.error(
|
|
22751
|
+
console.error(chalk168.red(`gh pr checkout ${number} failed; aborting.`));
|
|
22701
22752
|
process.exit(1);
|
|
22702
22753
|
}
|
|
22703
22754
|
}
|
|
@@ -22834,15 +22885,15 @@ function registerList(program2) {
|
|
|
22834
22885
|
// src/commands/mermaid/index.ts
|
|
22835
22886
|
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
22836
22887
|
import { resolve as resolve16 } from "path";
|
|
22837
|
-
import
|
|
22888
|
+
import chalk171 from "chalk";
|
|
22838
22889
|
|
|
22839
22890
|
// src/commands/mermaid/exportFile.ts
|
|
22840
22891
|
import { readFileSync as readFileSync39, writeFileSync as writeFileSync32 } from "fs";
|
|
22841
22892
|
import { basename as basename17, extname as extname2, resolve as resolve15 } from "path";
|
|
22842
|
-
import
|
|
22893
|
+
import chalk170 from "chalk";
|
|
22843
22894
|
|
|
22844
22895
|
// src/commands/mermaid/renderBlock.ts
|
|
22845
|
-
import
|
|
22896
|
+
import chalk169 from "chalk";
|
|
22846
22897
|
async function renderBlock(krokiUrl, source) {
|
|
22847
22898
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
22848
22899
|
method: "POST",
|
|
@@ -22851,7 +22902,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
22851
22902
|
});
|
|
22852
22903
|
if (!response.ok) {
|
|
22853
22904
|
console.error(
|
|
22854
|
-
|
|
22905
|
+
chalk169.red(
|
|
22855
22906
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
22856
22907
|
)
|
|
22857
22908
|
);
|
|
@@ -22869,19 +22920,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
22869
22920
|
if (onlyIndex !== void 0) {
|
|
22870
22921
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
22871
22922
|
console.error(
|
|
22872
|
-
|
|
22923
|
+
chalk170.red(
|
|
22873
22924
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
22874
22925
|
)
|
|
22875
22926
|
);
|
|
22876
22927
|
process.exit(1);
|
|
22877
22928
|
}
|
|
22878
22929
|
console.log(
|
|
22879
|
-
|
|
22930
|
+
chalk170.gray(
|
|
22880
22931
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
22881
22932
|
)
|
|
22882
22933
|
);
|
|
22883
22934
|
} else {
|
|
22884
|
-
console.log(
|
|
22935
|
+
console.log(chalk170.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
22885
22936
|
}
|
|
22886
22937
|
for (const [i, source] of blocks.entries()) {
|
|
22887
22938
|
const idx = i + 1;
|
|
@@ -22889,7 +22940,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
22889
22940
|
const outPath = resolve15(outDir, `${stem}-${idx}.svg`);
|
|
22890
22941
|
const svg = await renderBlock(krokiUrl, source);
|
|
22891
22942
|
writeFileSync32(outPath, svg, "utf8");
|
|
22892
|
-
console.log(
|
|
22943
|
+
console.log(chalk170.green(` \u2192 ${outPath}`));
|
|
22893
22944
|
}
|
|
22894
22945
|
}
|
|
22895
22946
|
function extractMermaidBlocks(markdown) {
|
|
@@ -22905,18 +22956,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
22905
22956
|
if (options2.index !== void 0) {
|
|
22906
22957
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
22907
22958
|
console.error(
|
|
22908
|
-
|
|
22959
|
+
chalk171.red(`--index must be a positive integer (got ${options2.index})`)
|
|
22909
22960
|
);
|
|
22910
22961
|
process.exit(1);
|
|
22911
22962
|
}
|
|
22912
22963
|
if (!file) {
|
|
22913
|
-
console.error(
|
|
22964
|
+
console.error(chalk171.red("--index requires a file argument"));
|
|
22914
22965
|
process.exit(1);
|
|
22915
22966
|
}
|
|
22916
22967
|
}
|
|
22917
22968
|
const files = file ? [file] : readdirSync11(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
22918
22969
|
if (files.length === 0) {
|
|
22919
|
-
console.log(
|
|
22970
|
+
console.log(chalk171.gray("No markdown files found in current directory."));
|
|
22920
22971
|
return;
|
|
22921
22972
|
}
|
|
22922
22973
|
for (const f of files) {
|
|
@@ -22997,7 +23048,7 @@ import { stringify as stringify2 } from "yaml";
|
|
|
22997
23048
|
|
|
22998
23049
|
// src/commands/miro/writeExtract.ts
|
|
22999
23050
|
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync33 } from "fs";
|
|
23000
|
-
import { dirname as
|
|
23051
|
+
import { dirname as dirname28 } from "path";
|
|
23001
23052
|
import { stringify } from "yaml";
|
|
23002
23053
|
function headerLines(header) {
|
|
23003
23054
|
const { rect } = header;
|
|
@@ -23010,7 +23061,7 @@ function headerLines(header) {
|
|
|
23010
23061
|
];
|
|
23011
23062
|
}
|
|
23012
23063
|
function writeExtract(file, header, texts) {
|
|
23013
|
-
mkdirSync19(
|
|
23064
|
+
mkdirSync19(dirname28(file), { recursive: true });
|
|
23014
23065
|
writeFileSync33(file, `${headerLines(header).join("\n")}
|
|
23015
23066
|
${stringify(texts)}`);
|
|
23016
23067
|
}
|
|
@@ -23062,7 +23113,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
23062
23113
|
}
|
|
23063
23114
|
|
|
23064
23115
|
// src/commands/miro/keptTexts.ts
|
|
23065
|
-
import
|
|
23116
|
+
import chalk172 from "chalk";
|
|
23066
23117
|
|
|
23067
23118
|
// src/commands/miro/applyIgnore.ts
|
|
23068
23119
|
function applyIgnore(texts, ignore3) {
|
|
@@ -23075,10 +23126,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
23075
23126
|
}
|
|
23076
23127
|
|
|
23077
23128
|
// src/commands/miro/readIgnoreList.ts
|
|
23078
|
-
import { existsSync as
|
|
23129
|
+
import { existsSync as existsSync55, readFileSync as readFileSync40 } from "fs";
|
|
23079
23130
|
import { parse as parse2 } from "yaml";
|
|
23080
23131
|
function readIgnoreList(file) {
|
|
23081
|
-
if (!
|
|
23132
|
+
if (!existsSync55(file))
|
|
23082
23133
|
throw new MiroExtractError(
|
|
23083
23134
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
23084
23135
|
);
|
|
@@ -23101,7 +23152,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
23101
23152
|
if (unmatched.length === 0) return;
|
|
23102
23153
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
23103
23154
|
console.error(
|
|
23104
|
-
|
|
23155
|
+
chalk172.yellow(
|
|
23105
23156
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
23106
23157
|
${entries}`
|
|
23107
23158
|
)
|
|
@@ -23304,7 +23355,7 @@ function readMiroItems(file) {
|
|
|
23304
23355
|
}
|
|
23305
23356
|
|
|
23306
23357
|
// src/commands/miro/resolveExtractOptions.ts
|
|
23307
|
-
import
|
|
23358
|
+
import chalk173 from "chalk";
|
|
23308
23359
|
|
|
23309
23360
|
// src/commands/miro/extractLayers.ts
|
|
23310
23361
|
function extractsIn(layer) {
|
|
@@ -23382,7 +23433,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
23382
23433
|
paths.cwd,
|
|
23383
23434
|
paths.globalConfigPath
|
|
23384
23435
|
);
|
|
23385
|
-
console.error(
|
|
23436
|
+
console.error(chalk173.dim(`Extract "${name}" from ${resolved.from}`));
|
|
23386
23437
|
return resolved.options;
|
|
23387
23438
|
}
|
|
23388
23439
|
|
|
@@ -23483,8 +23534,8 @@ function registerMiro(program2) {
|
|
|
23483
23534
|
// src/commands/netcap/netcap.ts
|
|
23484
23535
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
23485
23536
|
import { createServer as createServer2 } from "http";
|
|
23486
|
-
import { dirname as
|
|
23487
|
-
import
|
|
23537
|
+
import { dirname as dirname30 } from "path";
|
|
23538
|
+
import chalk175 from "chalk";
|
|
23488
23539
|
|
|
23489
23540
|
// src/commands/netcap/corsHeaders.ts
|
|
23490
23541
|
var corsHeaders = {
|
|
@@ -23560,22 +23611,22 @@ function createNetcapHandler(options2) {
|
|
|
23560
23611
|
}
|
|
23561
23612
|
|
|
23562
23613
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
23563
|
-
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
23614
|
+
import { cp as cp2, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
23564
23615
|
import { networkInterfaces } from "os";
|
|
23565
|
-
import { join as
|
|
23566
|
-
import
|
|
23616
|
+
import { join as join59 } from "path";
|
|
23617
|
+
import chalk174 from "chalk";
|
|
23567
23618
|
|
|
23568
23619
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
23569
|
-
import { dirname as
|
|
23570
|
-
import { fileURLToPath as
|
|
23571
|
-
var
|
|
23620
|
+
import { dirname as dirname29, join as join58 } from "path";
|
|
23621
|
+
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
23622
|
+
var moduleDir2 = dirname29(fileURLToPath7(import.meta.url));
|
|
23572
23623
|
function netcapExtensionDir() {
|
|
23573
|
-
return
|
|
23624
|
+
return join58(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
23574
23625
|
}
|
|
23575
23626
|
|
|
23576
23627
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
23577
|
-
var
|
|
23578
|
-
var
|
|
23628
|
+
var WSL_WINDOWS_DIR2 = "/mnt/c/tools/netcap-extension";
|
|
23629
|
+
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\netcap-extension`;
|
|
23579
23630
|
function lanIPv4() {
|
|
23580
23631
|
for (const addrs of Object.values(networkInterfaces())) {
|
|
23581
23632
|
for (const addr of addrs ?? []) {
|
|
@@ -23585,7 +23636,7 @@ function lanIPv4() {
|
|
|
23585
23636
|
return void 0;
|
|
23586
23637
|
}
|
|
23587
23638
|
async function configureBackground(dir, host, port, filter) {
|
|
23588
|
-
const file =
|
|
23639
|
+
const file = join59(dir, "background.js");
|
|
23589
23640
|
const source = await readFile4(file, "utf8");
|
|
23590
23641
|
await writeFile4(
|
|
23591
23642
|
file,
|
|
@@ -23607,38 +23658,38 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
23607
23658
|
const host = lanIPv4();
|
|
23608
23659
|
if (!host) {
|
|
23609
23660
|
console.log(
|
|
23610
|
-
|
|
23661
|
+
chalk174.yellow("could not determine the WSL IP for the extension")
|
|
23611
23662
|
);
|
|
23612
23663
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
23613
23664
|
return source;
|
|
23614
23665
|
}
|
|
23615
23666
|
try {
|
|
23616
|
-
await
|
|
23617
|
-
await configureBackground(
|
|
23618
|
-
return
|
|
23667
|
+
await cp2(source, WSL_WINDOWS_DIR2, { recursive: true });
|
|
23668
|
+
await configureBackground(WSL_WINDOWS_DIR2, host, port, filter);
|
|
23669
|
+
return WSL_WINDOWS_PATH2;
|
|
23619
23670
|
} catch {
|
|
23620
23671
|
console.log(
|
|
23621
|
-
|
|
23672
|
+
chalk174.yellow(`could not copy extension to ${WSL_WINDOWS_PATH2}`)
|
|
23622
23673
|
);
|
|
23623
23674
|
return source;
|
|
23624
23675
|
}
|
|
23625
23676
|
}
|
|
23626
23677
|
|
|
23627
23678
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
23628
|
-
import { isAbsolute as isAbsolute4, join as
|
|
23679
|
+
import { isAbsolute as isAbsolute4, join as join61, resolve as resolve18 } from "path";
|
|
23629
23680
|
|
|
23630
23681
|
// src/commands/netcap/defaultCapturePath.ts
|
|
23631
23682
|
import { homedir as homedir20 } from "os";
|
|
23632
|
-
import { join as
|
|
23683
|
+
import { join as join60 } from "path";
|
|
23633
23684
|
function defaultCapturePath() {
|
|
23634
|
-
return
|
|
23685
|
+
return join60(homedir20(), ".assist", "netcap", "capture.jsonl");
|
|
23635
23686
|
}
|
|
23636
23687
|
|
|
23637
23688
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
23638
23689
|
function resolveNetcapOutPath(out) {
|
|
23639
23690
|
if (!out) return defaultCapturePath();
|
|
23640
23691
|
const dir = isAbsolute4(out) ? out : resolve18(process.cwd(), out);
|
|
23641
|
-
return
|
|
23692
|
+
return join61(dir, "capture.jsonl");
|
|
23642
23693
|
}
|
|
23643
23694
|
|
|
23644
23695
|
// src/commands/netcap/netcap.ts
|
|
@@ -23646,35 +23697,35 @@ async function netcap(options2) {
|
|
|
23646
23697
|
const port = Number(options2.port);
|
|
23647
23698
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
23648
23699
|
const filter = options2.filter ?? "";
|
|
23649
|
-
await mkdir4(
|
|
23700
|
+
await mkdir4(dirname30(outPath), { recursive: true });
|
|
23650
23701
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
23651
23702
|
let count8 = 0;
|
|
23652
23703
|
const handler = createNetcapHandler({
|
|
23653
23704
|
outPath,
|
|
23654
|
-
onPing: () => console.log(
|
|
23705
|
+
onPing: () => console.log(chalk175.dim("ping from extension")),
|
|
23655
23706
|
onCapture: (entry) => {
|
|
23656
23707
|
count8 += 1;
|
|
23657
23708
|
console.log(
|
|
23658
|
-
|
|
23659
|
-
|
|
23709
|
+
chalk175.green(`captured #${count8}`),
|
|
23710
|
+
chalk175.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
23660
23711
|
);
|
|
23661
23712
|
}
|
|
23662
23713
|
});
|
|
23663
23714
|
const server = createServer2(handler);
|
|
23664
23715
|
server.listen(port, () => {
|
|
23665
23716
|
console.log(
|
|
23666
|
-
|
|
23717
|
+
chalk175.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
23667
23718
|
);
|
|
23668
|
-
console.log(
|
|
23719
|
+
console.log(chalk175.dim(`appending captures to ${outPath}`));
|
|
23669
23720
|
if (filter)
|
|
23670
|
-
console.log(
|
|
23671
|
-
console.log(
|
|
23672
|
-
console.log(
|
|
23721
|
+
console.log(chalk175.dim(`forwarding only URLs matching "${filter}"`));
|
|
23722
|
+
console.log(chalk175.dim(`load the unpacked extension from ${extensionPath}`));
|
|
23723
|
+
console.log(chalk175.dim("press Ctrl-C to stop"));
|
|
23673
23724
|
});
|
|
23674
23725
|
process.on("SIGINT", () => {
|
|
23675
23726
|
server.close();
|
|
23676
23727
|
console.log(
|
|
23677
|
-
|
|
23728
|
+
chalk175.bold(
|
|
23678
23729
|
`
|
|
23679
23730
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
23680
23731
|
)
|
|
@@ -23685,8 +23736,8 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
23685
23736
|
|
|
23686
23737
|
// src/commands/netcap/netcapExtract.ts
|
|
23687
23738
|
import { writeFileSync as writeFileSync34 } from "fs";
|
|
23688
|
-
import { join as
|
|
23689
|
-
import
|
|
23739
|
+
import { join as join62 } from "path";
|
|
23740
|
+
import chalk176 from "chalk";
|
|
23690
23741
|
|
|
23691
23742
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
23692
23743
|
import { readFileSync as readFileSync42 } from "fs";
|
|
@@ -24130,12 +24181,12 @@ function extractPostsFromCapture(captureFile) {
|
|
|
24130
24181
|
function netcapExtract(file) {
|
|
24131
24182
|
const captureFile = file ?? defaultCapturePath();
|
|
24132
24183
|
const posts = extractPostsFromCapture(captureFile);
|
|
24133
|
-
const outFile =
|
|
24184
|
+
const outFile = join62(captureFile, "..", "posts.json");
|
|
24134
24185
|
writeFileSync34(outFile, `${JSON.stringify(posts, null, 2)}
|
|
24135
24186
|
`);
|
|
24136
24187
|
console.log(
|
|
24137
|
-
|
|
24138
|
-
|
|
24188
|
+
chalk176.green(`extracted ${posts.length} posts`),
|
|
24189
|
+
chalk176.dim(`-> ${outFile}`)
|
|
24139
24190
|
);
|
|
24140
24191
|
}
|
|
24141
24192
|
|
|
@@ -24156,7 +24207,7 @@ function registerNetcap(program2) {
|
|
|
24156
24207
|
}
|
|
24157
24208
|
|
|
24158
24209
|
// src/commands/news/add/index.ts
|
|
24159
|
-
import
|
|
24210
|
+
import chalk177 from "chalk";
|
|
24160
24211
|
import enquirer8 from "enquirer";
|
|
24161
24212
|
async function add2(url) {
|
|
24162
24213
|
if (!url) {
|
|
@@ -24178,10 +24229,10 @@ async function add2(url) {
|
|
|
24178
24229
|
const { orm } = await getReady();
|
|
24179
24230
|
const added = await addFeed(orm, url);
|
|
24180
24231
|
if (!added) {
|
|
24181
|
-
console.log(
|
|
24232
|
+
console.log(chalk177.yellow("Feed already exists"));
|
|
24182
24233
|
return;
|
|
24183
24234
|
}
|
|
24184
|
-
console.log(
|
|
24235
|
+
console.log(chalk177.green(`Added feed: ${url}`));
|
|
24185
24236
|
}
|
|
24186
24237
|
|
|
24187
24238
|
// src/commands/registerNews.ts
|
|
@@ -24228,7 +24279,7 @@ function registerPiHook(program2) {
|
|
|
24228
24279
|
}
|
|
24229
24280
|
|
|
24230
24281
|
// src/commands/prompts/printPromptsTable.ts
|
|
24231
|
-
import
|
|
24282
|
+
import chalk178 from "chalk";
|
|
24232
24283
|
function truncate(str, max) {
|
|
24233
24284
|
if (str.length <= max) return str;
|
|
24234
24285
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -24246,14 +24297,14 @@ function printPromptsTable(rows) {
|
|
|
24246
24297
|
"Command".padEnd(commandWidth),
|
|
24247
24298
|
"Repos"
|
|
24248
24299
|
].join(" ");
|
|
24249
|
-
console.log(
|
|
24250
|
-
console.log(
|
|
24300
|
+
console.log(chalk178.dim(header));
|
|
24301
|
+
console.log(chalk178.dim("-".repeat(header.length)));
|
|
24251
24302
|
for (const row of rows) {
|
|
24252
24303
|
const count8 = String(row.count).padStart(countWidth);
|
|
24253
24304
|
const tool = row.tool.padEnd(toolWidth);
|
|
24254
24305
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
24255
24306
|
console.log(
|
|
24256
|
-
`${
|
|
24307
|
+
`${chalk178.yellow(count8)} ${tool} ${command} ${chalk178.dim(row.repos)}`
|
|
24257
24308
|
);
|
|
24258
24309
|
}
|
|
24259
24310
|
}
|
|
@@ -24656,17 +24707,17 @@ import { execSync as execSync45 } from "child_process";
|
|
|
24656
24707
|
import { execSync as execSync44 } from "child_process";
|
|
24657
24708
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync35 } from "fs";
|
|
24658
24709
|
import { tmpdir as tmpdir6 } from "os";
|
|
24659
|
-
import { join as
|
|
24710
|
+
import { join as join64 } from "path";
|
|
24660
24711
|
|
|
24661
24712
|
// src/commands/prs/loadCommentsCache.ts
|
|
24662
|
-
import { existsSync as
|
|
24713
|
+
import { existsSync as existsSync56, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
|
|
24663
24714
|
import { parse as parse3 } from "yaml";
|
|
24664
24715
|
|
|
24665
24716
|
// src/commands/prs/commentsCachePath.ts
|
|
24666
24717
|
import { homedir as homedir21 } from "os";
|
|
24667
|
-
import { join as
|
|
24718
|
+
import { join as join63 } from "path";
|
|
24668
24719
|
function commentsCachePath(org, repo, prNumber) {
|
|
24669
|
-
return
|
|
24720
|
+
return join63(
|
|
24670
24721
|
homedir21(),
|
|
24671
24722
|
".assist",
|
|
24672
24723
|
"pr-comments",
|
|
@@ -24679,7 +24730,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
24679
24730
|
// src/commands/prs/loadCommentsCache.ts
|
|
24680
24731
|
function loadCommentsCache(org, repo, prNumber) {
|
|
24681
24732
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
24682
|
-
if (!
|
|
24733
|
+
if (!existsSync56(cachePath)) {
|
|
24683
24734
|
return null;
|
|
24684
24735
|
}
|
|
24685
24736
|
const content = readFileSync43(cachePath, "utf8");
|
|
@@ -24687,7 +24738,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
24687
24738
|
}
|
|
24688
24739
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
24689
24740
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
24690
|
-
if (
|
|
24741
|
+
if (existsSync56(cachePath)) {
|
|
24691
24742
|
unlinkSync13(cachePath);
|
|
24692
24743
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
24693
24744
|
}
|
|
@@ -24715,7 +24766,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
24715
24766
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
24716
24767
|
function resolveThread(threadId) {
|
|
24717
24768
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
24718
|
-
const queryFile =
|
|
24769
|
+
const queryFile = join64(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
24719
24770
|
writeFileSync35(queryFile, mutation);
|
|
24720
24771
|
try {
|
|
24721
24772
|
execSync44(
|
|
@@ -24800,10 +24851,10 @@ function fixed(commentId, sha) {
|
|
|
24800
24851
|
import { execSync as execSync46 } from "child_process";
|
|
24801
24852
|
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync36 } from "fs";
|
|
24802
24853
|
import { tmpdir as tmpdir7 } from "os";
|
|
24803
|
-
import { join as
|
|
24854
|
+
import { join as join65 } from "path";
|
|
24804
24855
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
24805
24856
|
function fetchThreadIds(org, repo, prNumber) {
|
|
24806
|
-
const queryFile =
|
|
24857
|
+
const queryFile = join65(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
24807
24858
|
writeFileSync36(queryFile, THREAD_QUERY);
|
|
24808
24859
|
try {
|
|
24809
24860
|
const result = execSync46(
|
|
@@ -24873,15 +24924,15 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
24873
24924
|
|
|
24874
24925
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
24875
24926
|
import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync37 } from "fs";
|
|
24876
|
-
import { dirname as
|
|
24927
|
+
import { dirname as dirname31 } from "path";
|
|
24877
24928
|
import { stringify as stringify3 } from "yaml";
|
|
24878
24929
|
|
|
24879
24930
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
24880
24931
|
import { readdirSync as readdirSync12, unlinkSync as unlinkSync16 } from "fs";
|
|
24881
|
-
import { join as
|
|
24932
|
+
import { join as join66 } from "path";
|
|
24882
24933
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
24883
24934
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
24884
|
-
const dir =
|
|
24935
|
+
const dir = join66(cwd, ".assist");
|
|
24885
24936
|
let entries;
|
|
24886
24937
|
try {
|
|
24887
24938
|
entries = readdirSync12(dir);
|
|
@@ -24889,14 +24940,14 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
24889
24940
|
return;
|
|
24890
24941
|
}
|
|
24891
24942
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
24892
|
-
unlinkSync16(
|
|
24943
|
+
unlinkSync16(join66(dir, entry));
|
|
24893
24944
|
}
|
|
24894
24945
|
}
|
|
24895
24946
|
|
|
24896
24947
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
24897
24948
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
24898
24949
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
24899
|
-
mkdirSync20(
|
|
24950
|
+
mkdirSync20(dirname31(cachePath), { recursive: true });
|
|
24900
24951
|
const cacheData = {
|
|
24901
24952
|
prNumber,
|
|
24902
24953
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -24920,13 +24971,13 @@ function agentFooter(unresolvedCount) {
|
|
|
24920
24971
|
}
|
|
24921
24972
|
|
|
24922
24973
|
// src/commands/prs/listComments/commentStyle.ts
|
|
24923
|
-
import
|
|
24974
|
+
import chalk179 from "chalk";
|
|
24924
24975
|
var plain = (text18) => text18;
|
|
24925
24976
|
function colouredState(state) {
|
|
24926
24977
|
const label2 = `[${state}]`;
|
|
24927
|
-
if (state === "APPROVED") return
|
|
24928
|
-
if (state === "CHANGES_REQUESTED") return
|
|
24929
|
-
return
|
|
24978
|
+
if (state === "APPROVED") return chalk179.green(label2);
|
|
24979
|
+
if (state === "CHANGES_REQUESTED") return chalk179.red(label2);
|
|
24980
|
+
return chalk179.yellow(label2);
|
|
24930
24981
|
}
|
|
24931
24982
|
function commentStyle() {
|
|
24932
24983
|
if (isClaudeCode()) {
|
|
@@ -24940,9 +24991,9 @@ function commentStyle() {
|
|
|
24940
24991
|
};
|
|
24941
24992
|
}
|
|
24942
24993
|
return {
|
|
24943
|
-
cyan:
|
|
24944
|
-
bold:
|
|
24945
|
-
dim:
|
|
24994
|
+
cyan: chalk179.cyan,
|
|
24995
|
+
bold: chalk179.bold,
|
|
24996
|
+
dim: chalk179.dim,
|
|
24946
24997
|
state: colouredState,
|
|
24947
24998
|
diffHunk: true,
|
|
24948
24999
|
agent: false
|
|
@@ -25112,13 +25163,13 @@ import { execSync as execSync48 } from "child_process";
|
|
|
25112
25163
|
import enquirer9 from "enquirer";
|
|
25113
25164
|
|
|
25114
25165
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
25115
|
-
import
|
|
25166
|
+
import chalk180 from "chalk";
|
|
25116
25167
|
var STATUS_MAP = {
|
|
25117
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
25118
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
25168
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk180.magenta("merged"), date: pr.mergedAt } : null,
|
|
25169
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk180.red("closed"), date: pr.closedAt } : null
|
|
25119
25170
|
};
|
|
25120
25171
|
function defaultStatus(pr) {
|
|
25121
|
-
return { label:
|
|
25172
|
+
return { label: chalk180.green("opened"), date: pr.createdAt };
|
|
25122
25173
|
}
|
|
25123
25174
|
function getStatus2(pr) {
|
|
25124
25175
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -25127,11 +25178,11 @@ function formatDate(dateStr) {
|
|
|
25127
25178
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
25128
25179
|
}
|
|
25129
25180
|
function formatPrHeader(pr, status3) {
|
|
25130
|
-
return `${
|
|
25181
|
+
return `${chalk180.cyan(`#${pr.number}`)} ${pr.title} ${chalk180.dim(`(${pr.author.login},`)} ${status3.label} ${chalk180.dim(`${formatDate(status3.date)})`)}`;
|
|
25131
25182
|
}
|
|
25132
25183
|
function logPrDetails(pr) {
|
|
25133
25184
|
console.log(
|
|
25134
|
-
|
|
25185
|
+
chalk180.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
25135
25186
|
);
|
|
25136
25187
|
console.log();
|
|
25137
25188
|
}
|
|
@@ -25846,10 +25897,10 @@ function registerPrs(program2) {
|
|
|
25846
25897
|
}
|
|
25847
25898
|
|
|
25848
25899
|
// src/commands/ravendb/ravendbAuth.ts
|
|
25849
|
-
import
|
|
25900
|
+
import chalk186 from "chalk";
|
|
25850
25901
|
|
|
25851
25902
|
// src/shared/createConnectionAuth.ts
|
|
25852
|
-
import
|
|
25903
|
+
import chalk181 from "chalk";
|
|
25853
25904
|
function listConnections(connections, format) {
|
|
25854
25905
|
if (connections.length === 0) {
|
|
25855
25906
|
console.log("No connections configured.");
|
|
@@ -25862,7 +25913,7 @@ function listConnections(connections, format) {
|
|
|
25862
25913
|
function removeConnection(connections, name, save) {
|
|
25863
25914
|
const filtered = connections.filter((c) => c.name !== name);
|
|
25864
25915
|
if (filtered.length === connections.length) {
|
|
25865
|
-
console.error(
|
|
25916
|
+
console.error(chalk181.red(`Connection "${name}" not found.`));
|
|
25866
25917
|
process.exit(1);
|
|
25867
25918
|
}
|
|
25868
25919
|
save(filtered);
|
|
@@ -25908,15 +25959,15 @@ function saveConnections(connections) {
|
|
|
25908
25959
|
}
|
|
25909
25960
|
|
|
25910
25961
|
// src/commands/ravendb/promptConnection.ts
|
|
25911
|
-
import
|
|
25962
|
+
import chalk184 from "chalk";
|
|
25912
25963
|
|
|
25913
25964
|
// src/commands/ravendb/selectOpSecret.ts
|
|
25914
|
-
import
|
|
25965
|
+
import chalk183 from "chalk";
|
|
25915
25966
|
import Enquirer2 from "enquirer";
|
|
25916
25967
|
|
|
25917
25968
|
// src/commands/ravendb/searchItems.ts
|
|
25918
25969
|
import { execSync as execSync51 } from "child_process";
|
|
25919
|
-
import
|
|
25970
|
+
import chalk182 from "chalk";
|
|
25920
25971
|
function opExec(args) {
|
|
25921
25972
|
return execSync51(`op ${args}`, {
|
|
25922
25973
|
encoding: "utf8",
|
|
@@ -25929,7 +25980,7 @@ function searchItems(search2) {
|
|
|
25929
25980
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
25930
25981
|
} catch {
|
|
25931
25982
|
console.error(
|
|
25932
|
-
|
|
25983
|
+
chalk182.red(
|
|
25933
25984
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
25934
25985
|
)
|
|
25935
25986
|
);
|
|
@@ -25943,7 +25994,7 @@ function getItemFields(itemId2) {
|
|
|
25943
25994
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
25944
25995
|
return item.fields.filter((f) => f.reference && f.label);
|
|
25945
25996
|
} catch {
|
|
25946
|
-
console.error(
|
|
25997
|
+
console.error(chalk182.red("Failed to get item details from 1Password."));
|
|
25947
25998
|
process.exit(1);
|
|
25948
25999
|
}
|
|
25949
26000
|
}
|
|
@@ -25962,7 +26013,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
25962
26013
|
}).run();
|
|
25963
26014
|
const items2 = searchItems(search2);
|
|
25964
26015
|
if (items2.length === 0) {
|
|
25965
|
-
console.error(
|
|
26016
|
+
console.error(chalk183.red(`No items found matching "${search2}".`));
|
|
25966
26017
|
process.exit(1);
|
|
25967
26018
|
}
|
|
25968
26019
|
const itemId2 = await selectOne(
|
|
@@ -25971,7 +26022,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
25971
26022
|
);
|
|
25972
26023
|
const fields = getItemFields(itemId2);
|
|
25973
26024
|
if (fields.length === 0) {
|
|
25974
|
-
console.error(
|
|
26025
|
+
console.error(chalk183.red("No fields with references found on this item."));
|
|
25975
26026
|
process.exit(1);
|
|
25976
26027
|
}
|
|
25977
26028
|
const ref = await selectOne(
|
|
@@ -25985,7 +26036,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
25985
26036
|
async function promptConnection(existingNames) {
|
|
25986
26037
|
const name = await promptInput("name", "Connection name:");
|
|
25987
26038
|
if (existingNames.includes(name)) {
|
|
25988
|
-
console.error(
|
|
26039
|
+
console.error(chalk184.red(`Connection "${name}" already exists.`));
|
|
25989
26040
|
process.exit(1);
|
|
25990
26041
|
}
|
|
25991
26042
|
const url = await promptInput(
|
|
@@ -25994,22 +26045,22 @@ async function promptConnection(existingNames) {
|
|
|
25994
26045
|
);
|
|
25995
26046
|
const database = await promptInput("database", "Database name:");
|
|
25996
26047
|
if (!name || !url || !database) {
|
|
25997
|
-
console.error(
|
|
26048
|
+
console.error(chalk184.red("All fields are required."));
|
|
25998
26049
|
process.exit(1);
|
|
25999
26050
|
}
|
|
26000
26051
|
const apiKeyRef = await selectOpSecret();
|
|
26001
|
-
console.log(
|
|
26052
|
+
console.log(chalk184.dim(`Using: ${apiKeyRef}`));
|
|
26002
26053
|
return { name, url, database, apiKeyRef };
|
|
26003
26054
|
}
|
|
26004
26055
|
|
|
26005
26056
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
26006
|
-
import
|
|
26057
|
+
import chalk185 from "chalk";
|
|
26007
26058
|
function ravendbSetConnection(name) {
|
|
26008
26059
|
const raw = loadGlobalConfigRaw();
|
|
26009
26060
|
const ravendb = raw.ravendb ?? {};
|
|
26010
26061
|
const connections = ravendb.connections ?? [];
|
|
26011
26062
|
if (!connections.some((c) => c.name === name)) {
|
|
26012
|
-
console.error(
|
|
26063
|
+
console.error(chalk185.red(`Connection "${name}" not found.`));
|
|
26013
26064
|
console.error(
|
|
26014
26065
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
26015
26066
|
);
|
|
@@ -26025,16 +26076,16 @@ function ravendbSetConnection(name) {
|
|
|
26025
26076
|
var ravendbAuth = createConnectionAuth({
|
|
26026
26077
|
load: loadConnections,
|
|
26027
26078
|
save: saveConnections,
|
|
26028
|
-
format: (c) => `${
|
|
26079
|
+
format: (c) => `${chalk186.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
26029
26080
|
promptNew: promptConnection,
|
|
26030
26081
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
26031
26082
|
});
|
|
26032
26083
|
|
|
26033
26084
|
// src/commands/ravendb/ravendbCollections.ts
|
|
26034
|
-
import
|
|
26085
|
+
import chalk190 from "chalk";
|
|
26035
26086
|
|
|
26036
26087
|
// src/commands/ravendb/ravenFetch.ts
|
|
26037
|
-
import
|
|
26088
|
+
import chalk188 from "chalk";
|
|
26038
26089
|
|
|
26039
26090
|
// src/commands/ravendb/getAccessToken.ts
|
|
26040
26091
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -26071,10 +26122,10 @@ ${errorText}`
|
|
|
26071
26122
|
|
|
26072
26123
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
26073
26124
|
import { execSync as execSync52 } from "child_process";
|
|
26074
|
-
import
|
|
26125
|
+
import chalk187 from "chalk";
|
|
26075
26126
|
function resolveOpSecret(reference) {
|
|
26076
26127
|
if (!reference.startsWith("op://")) {
|
|
26077
|
-
console.error(
|
|
26128
|
+
console.error(chalk187.red(`Invalid secret reference: must start with op://`));
|
|
26078
26129
|
process.exit(1);
|
|
26079
26130
|
}
|
|
26080
26131
|
try {
|
|
@@ -26084,7 +26135,7 @@ function resolveOpSecret(reference) {
|
|
|
26084
26135
|
}).trim();
|
|
26085
26136
|
} catch {
|
|
26086
26137
|
console.error(
|
|
26087
|
-
|
|
26138
|
+
chalk187.red(
|
|
26088
26139
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
26089
26140
|
)
|
|
26090
26141
|
);
|
|
@@ -26111,7 +26162,7 @@ async function ravenFetch(connection, path80) {
|
|
|
26111
26162
|
if (!response.ok) {
|
|
26112
26163
|
const body = await response.text();
|
|
26113
26164
|
console.error(
|
|
26114
|
-
|
|
26165
|
+
chalk188.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
26115
26166
|
);
|
|
26116
26167
|
console.error(body.substring(0, 500));
|
|
26117
26168
|
process.exit(1);
|
|
@@ -26120,7 +26171,7 @@ async function ravenFetch(connection, path80) {
|
|
|
26120
26171
|
}
|
|
26121
26172
|
|
|
26122
26173
|
// src/commands/ravendb/resolveConnection.ts
|
|
26123
|
-
import
|
|
26174
|
+
import chalk189 from "chalk";
|
|
26124
26175
|
function loadRavendb() {
|
|
26125
26176
|
const raw = loadGlobalConfigRaw();
|
|
26126
26177
|
const ravendb = raw.ravendb;
|
|
@@ -26134,7 +26185,7 @@ function resolveConnection(name) {
|
|
|
26134
26185
|
const connectionName = name ?? defaultConnection;
|
|
26135
26186
|
if (!connectionName) {
|
|
26136
26187
|
console.error(
|
|
26137
|
-
|
|
26188
|
+
chalk189.red(
|
|
26138
26189
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
26139
26190
|
)
|
|
26140
26191
|
);
|
|
@@ -26142,7 +26193,7 @@ function resolveConnection(name) {
|
|
|
26142
26193
|
}
|
|
26143
26194
|
const connection = connections.find((c) => c.name === connectionName);
|
|
26144
26195
|
if (!connection) {
|
|
26145
|
-
console.error(
|
|
26196
|
+
console.error(chalk189.red(`Connection "${connectionName}" not found.`));
|
|
26146
26197
|
console.error(
|
|
26147
26198
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
26148
26199
|
);
|
|
@@ -26173,15 +26224,15 @@ async function ravendbCollections(connectionName) {
|
|
|
26173
26224
|
return;
|
|
26174
26225
|
}
|
|
26175
26226
|
for (const c of collections) {
|
|
26176
|
-
console.log(`${
|
|
26227
|
+
console.log(`${chalk190.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
26177
26228
|
}
|
|
26178
26229
|
}
|
|
26179
26230
|
|
|
26180
26231
|
// src/commands/ravendb/ravendbQuery.ts
|
|
26181
|
-
import
|
|
26232
|
+
import chalk192 from "chalk";
|
|
26182
26233
|
|
|
26183
26234
|
// src/commands/ravendb/fetchAllPages.ts
|
|
26184
|
-
import
|
|
26235
|
+
import chalk191 from "chalk";
|
|
26185
26236
|
|
|
26186
26237
|
// src/commands/ravendb/buildQueryPath.ts
|
|
26187
26238
|
function buildQueryPath(opts) {
|
|
@@ -26219,7 +26270,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
26219
26270
|
allResults.push(...results);
|
|
26220
26271
|
start3 += results.length;
|
|
26221
26272
|
process.stderr.write(
|
|
26222
|
-
`\r${
|
|
26273
|
+
`\r${chalk191.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
26223
26274
|
);
|
|
26224
26275
|
if (start3 >= totalResults) break;
|
|
26225
26276
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -26234,7 +26285,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
26234
26285
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
26235
26286
|
const resolved = resolveArgs(connectionName, collection);
|
|
26236
26287
|
if (!resolved.collection && !options2.query) {
|
|
26237
|
-
console.error(
|
|
26288
|
+
console.error(chalk192.red("Provide a collection name or --query filter."));
|
|
26238
26289
|
process.exit(1);
|
|
26239
26290
|
}
|
|
26240
26291
|
const { collection: col } = resolved;
|
|
@@ -26273,7 +26324,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
26273
26324
|
import * as path42 from "path";
|
|
26274
26325
|
|
|
26275
26326
|
// src/commands/refactor/logViolations.ts
|
|
26276
|
-
import
|
|
26327
|
+
import chalk193 from "chalk";
|
|
26277
26328
|
var DEFAULT_MAX_LINES2 = 100;
|
|
26278
26329
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
26279
26330
|
if (violations.length === 0) {
|
|
@@ -26282,43 +26333,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
26282
26333
|
}
|
|
26283
26334
|
return;
|
|
26284
26335
|
}
|
|
26285
|
-
console.error(
|
|
26336
|
+
console.error(chalk193.red(`
|
|
26286
26337
|
Refactor check failed:
|
|
26287
26338
|
`));
|
|
26288
|
-
console.error(
|
|
26339
|
+
console.error(chalk193.red(` The following files exceed ${maxLines} lines:
|
|
26289
26340
|
`));
|
|
26290
26341
|
for (const violation of violations) {
|
|
26291
|
-
console.error(
|
|
26342
|
+
console.error(chalk193.red(` ${violation.file} (${violation.lines} lines)`));
|
|
26292
26343
|
}
|
|
26293
26344
|
console.error(
|
|
26294
|
-
|
|
26345
|
+
chalk193.yellow(
|
|
26295
26346
|
`
|
|
26296
26347
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
26297
26348
|
way to refactor it, ignore it with:
|
|
26298
26349
|
`
|
|
26299
26350
|
)
|
|
26300
26351
|
);
|
|
26301
|
-
console.error(
|
|
26352
|
+
console.error(chalk193.gray(` assist refactor ignore <file>
|
|
26302
26353
|
`));
|
|
26303
26354
|
if (process.env.CLAUDECODE) {
|
|
26304
|
-
console.error(
|
|
26355
|
+
console.error(chalk193.cyan(`
|
|
26305
26356
|
## Extracting Code to New Files
|
|
26306
26357
|
`));
|
|
26307
26358
|
console.error(
|
|
26308
|
-
|
|
26359
|
+
chalk193.cyan(
|
|
26309
26360
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
26310
26361
|
`
|
|
26311
26362
|
)
|
|
26312
26363
|
);
|
|
26313
26364
|
console.error(
|
|
26314
|
-
|
|
26365
|
+
chalk193.cyan(
|
|
26315
26366
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
26316
26367
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
26317
26368
|
`
|
|
26318
26369
|
)
|
|
26319
26370
|
);
|
|
26320
26371
|
console.error(
|
|
26321
|
-
|
|
26372
|
+
chalk193.cyan(
|
|
26322
26373
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
26323
26374
|
domains, move it to a common/shared folder.
|
|
26324
26375
|
`
|
|
@@ -26474,7 +26525,7 @@ async function check(pattern2, options2) {
|
|
|
26474
26525
|
|
|
26475
26526
|
// src/commands/refactor/extract/index.ts
|
|
26476
26527
|
import path50 from "path";
|
|
26477
|
-
import
|
|
26528
|
+
import chalk196 from "chalk";
|
|
26478
26529
|
|
|
26479
26530
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
26480
26531
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -27073,23 +27124,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
27073
27124
|
|
|
27074
27125
|
// src/commands/refactor/extract/displayPlan.ts
|
|
27075
27126
|
import path46 from "path";
|
|
27076
|
-
import
|
|
27127
|
+
import chalk194 from "chalk";
|
|
27077
27128
|
function section2(title) {
|
|
27078
27129
|
return `
|
|
27079
|
-
${
|
|
27130
|
+
${chalk194.cyan(title)}`;
|
|
27080
27131
|
}
|
|
27081
27132
|
function displayImporters(plan2, cwd) {
|
|
27082
27133
|
if (plan2.importersToUpdate.length === 0) return;
|
|
27083
27134
|
console.log(section2("Update importers:"));
|
|
27084
27135
|
for (const imp of plan2.importersToUpdate) {
|
|
27085
27136
|
const rel = path46.relative(cwd, imp.file.getFilePath());
|
|
27086
|
-
console.log(` ${
|
|
27137
|
+
console.log(` ${chalk194.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
27087
27138
|
}
|
|
27088
27139
|
}
|
|
27089
27140
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
27090
|
-
console.log(
|
|
27141
|
+
console.log(chalk194.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
27091
27142
|
`));
|
|
27092
|
-
console.log(` ${
|
|
27143
|
+
console.log(` ${chalk194.cyan("Functions to move:")}`);
|
|
27093
27144
|
for (const name of plan2.extractedNames) {
|
|
27094
27145
|
console.log(` ${name}`);
|
|
27095
27146
|
}
|
|
@@ -27123,7 +27174,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
27123
27174
|
|
|
27124
27175
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
27125
27176
|
import path49 from "path";
|
|
27126
|
-
import
|
|
27177
|
+
import chalk195 from "chalk";
|
|
27127
27178
|
import { Project as Project4 } from "ts-morph";
|
|
27128
27179
|
|
|
27129
27180
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -27215,7 +27266,7 @@ function loadProjectFile(file) {
|
|
|
27215
27266
|
});
|
|
27216
27267
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
27217
27268
|
if (!sourceFile) {
|
|
27218
|
-
console.log(
|
|
27269
|
+
console.log(chalk195.red(`File not found in project: ${file}`));
|
|
27219
27270
|
process.exit(1);
|
|
27220
27271
|
}
|
|
27221
27272
|
return { project, sourceFile };
|
|
@@ -27238,19 +27289,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
27238
27289
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
27239
27290
|
if (options2.apply) {
|
|
27240
27291
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
27241
|
-
console.log(
|
|
27292
|
+
console.log(chalk196.green("\nExtraction complete"));
|
|
27242
27293
|
} else {
|
|
27243
|
-
console.log(
|
|
27294
|
+
console.log(chalk196.dim("\nDry run. Use --apply to execute."));
|
|
27244
27295
|
}
|
|
27245
27296
|
}
|
|
27246
27297
|
|
|
27247
27298
|
// src/commands/refactor/ignore.ts
|
|
27248
27299
|
import fs33 from "fs";
|
|
27249
|
-
import
|
|
27300
|
+
import chalk197 from "chalk";
|
|
27250
27301
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
27251
27302
|
function ignore2(file) {
|
|
27252
27303
|
if (!fs33.existsSync(file)) {
|
|
27253
|
-
console.error(
|
|
27304
|
+
console.error(chalk197.red(`Error: File does not exist: ${file}`));
|
|
27254
27305
|
process.exit(1);
|
|
27255
27306
|
}
|
|
27256
27307
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -27266,7 +27317,7 @@ function ignore2(file) {
|
|
|
27266
27317
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
27267
27318
|
}
|
|
27268
27319
|
console.log(
|
|
27269
|
-
|
|
27320
|
+
chalk197.green(
|
|
27270
27321
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
27271
27322
|
)
|
|
27272
27323
|
);
|
|
@@ -27275,12 +27326,12 @@ function ignore2(file) {
|
|
|
27275
27326
|
// src/commands/refactor/rename/index.ts
|
|
27276
27327
|
import fs36 from "fs";
|
|
27277
27328
|
import path55 from "path";
|
|
27278
|
-
import
|
|
27329
|
+
import chalk200 from "chalk";
|
|
27279
27330
|
|
|
27280
27331
|
// src/commands/refactor/rename/applyRename.ts
|
|
27281
27332
|
import fs35 from "fs";
|
|
27282
27333
|
import path52 from "path";
|
|
27283
|
-
import
|
|
27334
|
+
import chalk198 from "chalk";
|
|
27284
27335
|
|
|
27285
27336
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
27286
27337
|
import path51 from "path";
|
|
@@ -27385,13 +27436,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
27385
27436
|
const updatedContents = applyRewrites(rewrites);
|
|
27386
27437
|
for (const [file, content] of updatedContents) {
|
|
27387
27438
|
fs35.writeFileSync(file, content, "utf8");
|
|
27388
|
-
console.log(
|
|
27439
|
+
console.log(chalk198.cyan(` Updated imports in ${path52.relative(cwd, file)}`));
|
|
27389
27440
|
}
|
|
27390
27441
|
const destDir = path52.dirname(destPath);
|
|
27391
27442
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
27392
27443
|
fs35.renameSync(sourcePath, destPath);
|
|
27393
27444
|
console.log(
|
|
27394
|
-
|
|
27445
|
+
chalk198.white(
|
|
27395
27446
|
` Moved ${path52.relative(cwd, sourcePath)} \u2192 ${path52.relative(cwd, destPath)}`
|
|
27396
27447
|
)
|
|
27397
27448
|
);
|
|
@@ -27478,16 +27529,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
27478
27529
|
|
|
27479
27530
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
27480
27531
|
import path54 from "path";
|
|
27481
|
-
import
|
|
27532
|
+
import chalk199 from "chalk";
|
|
27482
27533
|
function printRenamePreview(rewrites, cwd) {
|
|
27483
27534
|
for (const rewrite of rewrites) {
|
|
27484
27535
|
console.log(
|
|
27485
|
-
|
|
27536
|
+
chalk199.dim(
|
|
27486
27537
|
` ${path54.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
27487
27538
|
)
|
|
27488
27539
|
);
|
|
27489
27540
|
}
|
|
27490
|
-
console.log(
|
|
27541
|
+
console.log(chalk199.dim("Dry run. Use --apply to execute."));
|
|
27491
27542
|
}
|
|
27492
27543
|
|
|
27493
27544
|
// src/commands/refactor/rename/index.ts
|
|
@@ -27498,20 +27549,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
27498
27549
|
const relSource = path55.relative(cwd, sourcePath);
|
|
27499
27550
|
const relDest = path55.relative(cwd, destPath);
|
|
27500
27551
|
if (!fs36.existsSync(sourcePath)) {
|
|
27501
|
-
console.log(
|
|
27552
|
+
console.log(chalk200.red(`File not found: ${source}`));
|
|
27502
27553
|
process.exit(1);
|
|
27503
27554
|
}
|
|
27504
27555
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
27505
|
-
console.log(
|
|
27556
|
+
console.log(chalk200.red(`Destination already exists: ${destination}`));
|
|
27506
27557
|
process.exit(1);
|
|
27507
27558
|
}
|
|
27508
|
-
console.log(
|
|
27509
|
-
console.log(
|
|
27510
|
-
console.log(
|
|
27559
|
+
console.log(chalk200.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
27560
|
+
console.log(chalk200.dim("Loading project..."));
|
|
27561
|
+
console.log(chalk200.dim("Scanning imports across the project..."));
|
|
27511
27562
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
27512
27563
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
27513
27564
|
console.log(
|
|
27514
|
-
|
|
27565
|
+
chalk200.dim(
|
|
27515
27566
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
27516
27567
|
)
|
|
27517
27568
|
);
|
|
@@ -27520,11 +27571,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
27520
27571
|
return;
|
|
27521
27572
|
}
|
|
27522
27573
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
27523
|
-
console.log(
|
|
27574
|
+
console.log(chalk200.green("Done"));
|
|
27524
27575
|
}
|
|
27525
27576
|
|
|
27526
27577
|
// src/commands/refactor/renameSymbol/index.ts
|
|
27527
|
-
import
|
|
27578
|
+
import chalk201 from "chalk";
|
|
27528
27579
|
|
|
27529
27580
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
27530
27581
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -27570,33 +27621,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
27570
27621
|
const { project, sourceFile } = loadProjectFile(file);
|
|
27571
27622
|
const symbol = findSymbol(sourceFile, oldName);
|
|
27572
27623
|
if (!symbol) {
|
|
27573
|
-
console.log(
|
|
27624
|
+
console.log(chalk201.red(`Symbol "${oldName}" not found in ${file}`));
|
|
27574
27625
|
process.exit(1);
|
|
27575
27626
|
}
|
|
27576
27627
|
const grouped = groupReferences(symbol, cwd);
|
|
27577
27628
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
27578
27629
|
console.log(
|
|
27579
|
-
|
|
27630
|
+
chalk201.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
27580
27631
|
`)
|
|
27581
27632
|
);
|
|
27582
27633
|
for (const [refFile, lines2] of grouped) {
|
|
27583
27634
|
console.log(
|
|
27584
|
-
` ${
|
|
27635
|
+
` ${chalk201.dim(refFile)}: lines ${chalk201.cyan(lines2.join(", "))}`
|
|
27585
27636
|
);
|
|
27586
27637
|
}
|
|
27587
27638
|
if (options2.apply) {
|
|
27588
27639
|
symbol.rename(newName);
|
|
27589
27640
|
await project.save();
|
|
27590
|
-
console.log(
|
|
27641
|
+
console.log(chalk201.green(`
|
|
27591
27642
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
27592
27643
|
} else {
|
|
27593
|
-
console.log(
|
|
27644
|
+
console.log(chalk201.dim("\nDry run. Use --apply to execute."));
|
|
27594
27645
|
}
|
|
27595
27646
|
}
|
|
27596
27647
|
|
|
27597
27648
|
// src/commands/refactor/restructure/index.ts
|
|
27598
27649
|
import path63 from "path";
|
|
27599
|
-
import
|
|
27650
|
+
import chalk204 from "chalk";
|
|
27600
27651
|
|
|
27601
27652
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
27602
27653
|
import path57 from "path";
|
|
@@ -27675,50 +27726,50 @@ function clusterFiles(graph) {
|
|
|
27675
27726
|
|
|
27676
27727
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
27677
27728
|
import path59 from "path";
|
|
27678
|
-
import
|
|
27729
|
+
import chalk202 from "chalk";
|
|
27679
27730
|
function relPath(filePath) {
|
|
27680
27731
|
return path59.relative(process.cwd(), filePath);
|
|
27681
27732
|
}
|
|
27682
27733
|
function displayMoves(plan2) {
|
|
27683
27734
|
if (plan2.moves.length === 0) return;
|
|
27684
|
-
console.log(
|
|
27735
|
+
console.log(chalk202.bold("\nFile moves:"));
|
|
27685
27736
|
for (const move2 of plan2.moves) {
|
|
27686
27737
|
console.log(
|
|
27687
|
-
` ${
|
|
27738
|
+
` ${chalk202.red(relPath(move2.from))} \u2192 ${chalk202.green(relPath(move2.to))}`
|
|
27688
27739
|
);
|
|
27689
|
-
console.log(
|
|
27740
|
+
console.log(chalk202.dim(` ${move2.reason}`));
|
|
27690
27741
|
}
|
|
27691
27742
|
}
|
|
27692
27743
|
function displayRewrites(rewrites) {
|
|
27693
27744
|
if (rewrites.length === 0) return;
|
|
27694
27745
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
27695
|
-
console.log(
|
|
27746
|
+
console.log(chalk202.bold(`
|
|
27696
27747
|
Import rewrites (${affectedFiles.size} files):`));
|
|
27697
27748
|
for (const file of affectedFiles) {
|
|
27698
|
-
console.log(` ${
|
|
27749
|
+
console.log(` ${chalk202.cyan(relPath(file))}:`);
|
|
27699
27750
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
27700
27751
|
(r) => r.file === file
|
|
27701
27752
|
)) {
|
|
27702
27753
|
console.log(
|
|
27703
|
-
` ${
|
|
27754
|
+
` ${chalk202.red(`"${oldSpecifier}"`)} \u2192 ${chalk202.green(`"${newSpecifier}"`)}`
|
|
27704
27755
|
);
|
|
27705
27756
|
}
|
|
27706
27757
|
}
|
|
27707
27758
|
}
|
|
27708
27759
|
function displayPlan2(plan2) {
|
|
27709
27760
|
if (plan2.warnings.length > 0) {
|
|
27710
|
-
console.log(
|
|
27711
|
-
for (const w of plan2.warnings) console.log(
|
|
27761
|
+
console.log(chalk202.yellow("\nWarnings:"));
|
|
27762
|
+
for (const w of plan2.warnings) console.log(chalk202.yellow(` ${w}`));
|
|
27712
27763
|
}
|
|
27713
27764
|
if (plan2.newDirectories.length > 0) {
|
|
27714
|
-
console.log(
|
|
27765
|
+
console.log(chalk202.bold("\nNew directories:"));
|
|
27715
27766
|
for (const dir of plan2.newDirectories)
|
|
27716
|
-
console.log(
|
|
27767
|
+
console.log(chalk202.green(` ${dir}/`));
|
|
27717
27768
|
}
|
|
27718
27769
|
displayMoves(plan2);
|
|
27719
27770
|
displayRewrites(plan2.rewrites);
|
|
27720
27771
|
console.log(
|
|
27721
|
-
|
|
27772
|
+
chalk202.dim(
|
|
27722
27773
|
`
|
|
27723
27774
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
27724
27775
|
)
|
|
@@ -27728,18 +27779,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
27728
27779
|
// src/commands/refactor/restructure/executePlan.ts
|
|
27729
27780
|
import fs37 from "fs";
|
|
27730
27781
|
import path60 from "path";
|
|
27731
|
-
import
|
|
27782
|
+
import chalk203 from "chalk";
|
|
27732
27783
|
function executePlan(plan2) {
|
|
27733
27784
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
27734
27785
|
for (const [file, content] of updatedContents) {
|
|
27735
27786
|
fs37.writeFileSync(file, content, "utf8");
|
|
27736
27787
|
console.log(
|
|
27737
|
-
|
|
27788
|
+
chalk203.cyan(` Rewrote imports in ${path60.relative(process.cwd(), file)}`)
|
|
27738
27789
|
);
|
|
27739
27790
|
}
|
|
27740
27791
|
for (const dir of plan2.newDirectories) {
|
|
27741
27792
|
fs37.mkdirSync(dir, { recursive: true });
|
|
27742
|
-
console.log(
|
|
27793
|
+
console.log(chalk203.green(` Created ${path60.relative(process.cwd(), dir)}/`));
|
|
27743
27794
|
}
|
|
27744
27795
|
for (const move2 of plan2.moves) {
|
|
27745
27796
|
const targetDir = path60.dirname(move2.to);
|
|
@@ -27748,7 +27799,7 @@ function executePlan(plan2) {
|
|
|
27748
27799
|
}
|
|
27749
27800
|
fs37.renameSync(move2.from, move2.to);
|
|
27750
27801
|
console.log(
|
|
27751
|
-
|
|
27802
|
+
chalk203.white(
|
|
27752
27803
|
` Moved ${path60.relative(process.cwd(), move2.from)} \u2192 ${path60.relative(process.cwd(), move2.to)}`
|
|
27753
27804
|
)
|
|
27754
27805
|
);
|
|
@@ -27763,7 +27814,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
27763
27814
|
if (entries.length === 0) {
|
|
27764
27815
|
fs37.rmdirSync(dir);
|
|
27765
27816
|
console.log(
|
|
27766
|
-
|
|
27817
|
+
chalk203.dim(
|
|
27767
27818
|
` Removed empty directory ${path60.relative(process.cwd(), dir)}`
|
|
27768
27819
|
)
|
|
27769
27820
|
);
|
|
@@ -27896,22 +27947,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
27896
27947
|
const targetPattern = pattern2 ?? "src";
|
|
27897
27948
|
const files = findSourceFiles2(targetPattern);
|
|
27898
27949
|
if (files.length === 0) {
|
|
27899
|
-
console.log(
|
|
27950
|
+
console.log(chalk204.yellow("No files found matching pattern"));
|
|
27900
27951
|
return;
|
|
27901
27952
|
}
|
|
27902
27953
|
const tsConfigPath = findTsConfig(path63.resolve(files[0]));
|
|
27903
27954
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
27904
27955
|
if (plan2.moves.length === 0) {
|
|
27905
|
-
console.log(
|
|
27956
|
+
console.log(chalk204.green("No restructuring needed"));
|
|
27906
27957
|
return;
|
|
27907
27958
|
}
|
|
27908
27959
|
displayPlan2(plan2);
|
|
27909
27960
|
if (options2.apply) {
|
|
27910
|
-
console.log(
|
|
27961
|
+
console.log(chalk204.bold("\nApplying changes..."));
|
|
27911
27962
|
executePlan(plan2);
|
|
27912
|
-
console.log(
|
|
27963
|
+
console.log(chalk204.green("\nRestructuring complete"));
|
|
27913
27964
|
} else {
|
|
27914
|
-
console.log(
|
|
27965
|
+
console.log(chalk204.dim("\nDry run. Use --apply to execute."));
|
|
27915
27966
|
}
|
|
27916
27967
|
}
|
|
27917
27968
|
|
|
@@ -28078,9 +28129,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
28078
28129
|
|
|
28079
28130
|
// src/commands/review/buildReviewPaths.ts
|
|
28080
28131
|
import { homedir as homedir22 } from "os";
|
|
28081
|
-
import { basename as basename18, join as
|
|
28132
|
+
import { basename as basename18, join as join67 } from "path";
|
|
28082
28133
|
function buildReviewPaths(repoRoot2, key) {
|
|
28083
|
-
const reviewDir =
|
|
28134
|
+
const reviewDir = join67(
|
|
28084
28135
|
homedir22(),
|
|
28085
28136
|
".assist",
|
|
28086
28137
|
"reviews",
|
|
@@ -28089,10 +28140,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
28089
28140
|
);
|
|
28090
28141
|
return {
|
|
28091
28142
|
reviewDir,
|
|
28092
|
-
requestPath:
|
|
28093
|
-
claudePath:
|
|
28094
|
-
codexPath:
|
|
28095
|
-
synthesisPath:
|
|
28143
|
+
requestPath: join67(reviewDir, "request.md"),
|
|
28144
|
+
claudePath: join67(reviewDir, "claude.md"),
|
|
28145
|
+
codexPath: join67(reviewDir, "codex.md"),
|
|
28146
|
+
synthesisPath: join67(reviewDir, "synthesis.md")
|
|
28096
28147
|
};
|
|
28097
28148
|
}
|
|
28098
28149
|
|
|
@@ -28569,18 +28620,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
28569
28620
|
}
|
|
28570
28621
|
|
|
28571
28622
|
// src/commands/review/warnOutOfDiff.ts
|
|
28572
|
-
import
|
|
28623
|
+
import chalk205 from "chalk";
|
|
28573
28624
|
function warnOutOfDiff(outOfDiff) {
|
|
28574
28625
|
if (outOfDiff.length === 0) return;
|
|
28575
28626
|
console.warn(
|
|
28576
|
-
|
|
28627
|
+
chalk205.yellow(
|
|
28577
28628
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
28578
28629
|
)
|
|
28579
28630
|
);
|
|
28580
28631
|
for (const finding of outOfDiff) {
|
|
28581
28632
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
28582
28633
|
console.warn(
|
|
28583
|
-
` ${
|
|
28634
|
+
` ${chalk205.yellow("\xB7")} ${finding.title} ${chalk205.dim(
|
|
28584
28635
|
`(${finding.file}:${range})`
|
|
28585
28636
|
)}`
|
|
28586
28637
|
);
|
|
@@ -28604,18 +28655,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
28604
28655
|
}
|
|
28605
28656
|
|
|
28606
28657
|
// src/commands/review/warnUnlocated.ts
|
|
28607
|
-
import
|
|
28658
|
+
import chalk206 from "chalk";
|
|
28608
28659
|
function warnUnlocated(unlocated) {
|
|
28609
28660
|
if (unlocated.length === 0) return;
|
|
28610
28661
|
console.warn(
|
|
28611
|
-
|
|
28662
|
+
chalk206.yellow(
|
|
28612
28663
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
28613
28664
|
)
|
|
28614
28665
|
);
|
|
28615
28666
|
for (const finding of unlocated) {
|
|
28616
|
-
const where = finding.location ||
|
|
28667
|
+
const where = finding.location || chalk206.dim("missing");
|
|
28617
28668
|
console.warn(
|
|
28618
|
-
` ${
|
|
28669
|
+
` ${chalk206.yellow("\xB7")} ${finding.title} ${chalk206.dim(`(${where})`)}`
|
|
28619
28670
|
);
|
|
28620
28671
|
}
|
|
28621
28672
|
}
|
|
@@ -28818,10 +28869,10 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
28818
28869
|
}
|
|
28819
28870
|
|
|
28820
28871
|
// src/commands/review/prepareReviewDir.ts
|
|
28821
|
-
import { existsSync as
|
|
28872
|
+
import { existsSync as existsSync57, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
28822
28873
|
function clearReviewFiles(paths) {
|
|
28823
28874
|
for (const path80 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
28824
|
-
if (
|
|
28875
|
+
if (existsSync57(path80)) unlinkSync17(path80);
|
|
28825
28876
|
}
|
|
28826
28877
|
}
|
|
28827
28878
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -29048,7 +29099,7 @@ function printReviewerFailures(results) {
|
|
|
29048
29099
|
}
|
|
29049
29100
|
|
|
29050
29101
|
// src/commands/review/runAndSynthesise.ts
|
|
29051
|
-
import { existsSync as
|
|
29102
|
+
import { existsSync as existsSync59, unlinkSync as unlinkSync19 } from "fs";
|
|
29052
29103
|
|
|
29053
29104
|
// src/commands/review/buildReviewerStdin.ts
|
|
29054
29105
|
var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
|
|
@@ -29477,7 +29528,7 @@ function resolveClaude(args) {
|
|
|
29477
29528
|
}
|
|
29478
29529
|
|
|
29479
29530
|
// src/commands/review/runCodexReviewer.ts
|
|
29480
|
-
import { existsSync as
|
|
29531
|
+
import { existsSync as existsSync58, unlinkSync as unlinkSync18 } from "fs";
|
|
29481
29532
|
|
|
29482
29533
|
// src/commands/review/parseCodexEvent.ts
|
|
29483
29534
|
function isItemStarted(value) {
|
|
@@ -29529,7 +29580,7 @@ async function runCodexReviewer(spec) {
|
|
|
29529
29580
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
29530
29581
|
}
|
|
29531
29582
|
});
|
|
29532
|
-
if (result.exitCode !== 0 &&
|
|
29583
|
+
if (result.exitCode !== 0 && existsSync58(spec.outputPath)) {
|
|
29533
29584
|
unlinkSync18(spec.outputPath);
|
|
29534
29585
|
}
|
|
29535
29586
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -29684,7 +29735,7 @@ async function runAndSynthesise(args) {
|
|
|
29684
29735
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
29685
29736
|
return { ok: false, failures };
|
|
29686
29737
|
}
|
|
29687
|
-
if (anyFresh &&
|
|
29738
|
+
if (anyFresh && existsSync59(paths.synthesisPath)) {
|
|
29688
29739
|
unlinkSync19(paths.synthesisPath);
|
|
29689
29740
|
}
|
|
29690
29741
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -29870,7 +29921,7 @@ function registerReview(program2) {
|
|
|
29870
29921
|
}
|
|
29871
29922
|
|
|
29872
29923
|
// src/commands/seq/seqAuth.ts
|
|
29873
|
-
import
|
|
29924
|
+
import chalk208 from "chalk";
|
|
29874
29925
|
|
|
29875
29926
|
// src/commands/seq/loadConnections.ts
|
|
29876
29927
|
function loadConnections2() {
|
|
@@ -29899,10 +29950,10 @@ function setDefaultConnection(name) {
|
|
|
29899
29950
|
}
|
|
29900
29951
|
|
|
29901
29952
|
// src/shared/assertUniqueName.ts
|
|
29902
|
-
import
|
|
29953
|
+
import chalk207 from "chalk";
|
|
29903
29954
|
function assertUniqueName(existingNames, name) {
|
|
29904
29955
|
if (existingNames.includes(name)) {
|
|
29905
|
-
console.error(
|
|
29956
|
+
console.error(chalk207.red(`Connection "${name}" already exists.`));
|
|
29906
29957
|
process.exit(1);
|
|
29907
29958
|
}
|
|
29908
29959
|
}
|
|
@@ -29920,16 +29971,16 @@ async function promptConnection2(existingNames) {
|
|
|
29920
29971
|
var seqAuth = createConnectionAuth({
|
|
29921
29972
|
load: loadConnections2,
|
|
29922
29973
|
save: saveConnections2,
|
|
29923
|
-
format: (c) => `${
|
|
29974
|
+
format: (c) => `${chalk208.bold(c.name)} ${c.url}`,
|
|
29924
29975
|
promptNew: promptConnection2,
|
|
29925
29976
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
29926
29977
|
});
|
|
29927
29978
|
|
|
29928
29979
|
// src/commands/seq/seqQuery.ts
|
|
29929
|
-
import
|
|
29980
|
+
import chalk212 from "chalk";
|
|
29930
29981
|
|
|
29931
29982
|
// src/commands/seq/fetchSeq.ts
|
|
29932
|
-
import
|
|
29983
|
+
import chalk209 from "chalk";
|
|
29933
29984
|
async function fetchSeq(conn, path80, params) {
|
|
29934
29985
|
const url = `${conn.url}${path80}?${params}`;
|
|
29935
29986
|
const response = await fetch(url, {
|
|
@@ -29940,7 +29991,7 @@ async function fetchSeq(conn, path80, params) {
|
|
|
29940
29991
|
});
|
|
29941
29992
|
if (!response.ok) {
|
|
29942
29993
|
const body = await response.text();
|
|
29943
|
-
console.error(
|
|
29994
|
+
console.error(chalk209.red(`Seq returned ${response.status}: ${body}`));
|
|
29944
29995
|
process.exit(1);
|
|
29945
29996
|
}
|
|
29946
29997
|
return response;
|
|
@@ -29999,23 +30050,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
29999
30050
|
}
|
|
30000
30051
|
|
|
30001
30052
|
// src/commands/seq/formatEvent.ts
|
|
30002
|
-
import
|
|
30053
|
+
import chalk210 from "chalk";
|
|
30003
30054
|
function levelColor(level) {
|
|
30004
30055
|
switch (level) {
|
|
30005
30056
|
case "Fatal":
|
|
30006
|
-
return
|
|
30057
|
+
return chalk210.bgRed.white;
|
|
30007
30058
|
case "Error":
|
|
30008
|
-
return
|
|
30059
|
+
return chalk210.red;
|
|
30009
30060
|
case "Warning":
|
|
30010
|
-
return
|
|
30061
|
+
return chalk210.yellow;
|
|
30011
30062
|
case "Information":
|
|
30012
|
-
return
|
|
30063
|
+
return chalk210.cyan;
|
|
30013
30064
|
case "Debug":
|
|
30014
|
-
return
|
|
30065
|
+
return chalk210.gray;
|
|
30015
30066
|
case "Verbose":
|
|
30016
|
-
return
|
|
30067
|
+
return chalk210.dim;
|
|
30017
30068
|
default:
|
|
30018
|
-
return
|
|
30069
|
+
return chalk210.white;
|
|
30019
30070
|
}
|
|
30020
30071
|
}
|
|
30021
30072
|
function levelAbbrev(level) {
|
|
@@ -30056,12 +30107,12 @@ function formatTimestamp(iso) {
|
|
|
30056
30107
|
function formatEvent(event) {
|
|
30057
30108
|
const color = levelColor(event.Level);
|
|
30058
30109
|
const abbrev = levelAbbrev(event.Level);
|
|
30059
|
-
const ts8 =
|
|
30110
|
+
const ts8 = chalk210.dim(formatTimestamp(event.Timestamp));
|
|
30060
30111
|
const msg = renderMessage(event);
|
|
30061
30112
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
30062
30113
|
if (event.Exception) {
|
|
30063
30114
|
for (const line of event.Exception.split("\n")) {
|
|
30064
|
-
lines2.push(
|
|
30115
|
+
lines2.push(chalk210.red(` ${line}`));
|
|
30065
30116
|
}
|
|
30066
30117
|
}
|
|
30067
30118
|
return lines2.join("\n");
|
|
@@ -30094,11 +30145,11 @@ function rejectTimestampFilter(filter) {
|
|
|
30094
30145
|
}
|
|
30095
30146
|
|
|
30096
30147
|
// src/shared/resolveNamedConnection.ts
|
|
30097
|
-
import
|
|
30148
|
+
import chalk211 from "chalk";
|
|
30098
30149
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
30099
30150
|
if (connections.length === 0) {
|
|
30100
30151
|
console.error(
|
|
30101
|
-
|
|
30152
|
+
chalk211.red(
|
|
30102
30153
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
30103
30154
|
)
|
|
30104
30155
|
);
|
|
@@ -30107,7 +30158,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
30107
30158
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
30108
30159
|
const connection = connections.find((c) => c.name === target);
|
|
30109
30160
|
if (!connection) {
|
|
30110
|
-
console.error(
|
|
30161
|
+
console.error(chalk211.red(`${kind} connection "${target}" not found.`));
|
|
30111
30162
|
process.exit(1);
|
|
30112
30163
|
}
|
|
30113
30164
|
return connection;
|
|
@@ -30136,7 +30187,7 @@ async function seqQuery(filter, options2) {
|
|
|
30136
30187
|
new URLSearchParams({ filter, count: String(count8) })
|
|
30137
30188
|
);
|
|
30138
30189
|
if (events.length === 0) {
|
|
30139
|
-
console.log(
|
|
30190
|
+
console.log(chalk212.yellow("No events found."));
|
|
30140
30191
|
return;
|
|
30141
30192
|
}
|
|
30142
30193
|
if (options2.json) {
|
|
@@ -30147,11 +30198,11 @@ async function seqQuery(filter, options2) {
|
|
|
30147
30198
|
for (const event of chronological) {
|
|
30148
30199
|
console.log(formatEvent(event));
|
|
30149
30200
|
}
|
|
30150
|
-
console.log(
|
|
30201
|
+
console.log(chalk212.dim(`
|
|
30151
30202
|
${events.length} events`));
|
|
30152
30203
|
if (events.length >= count8) {
|
|
30153
30204
|
console.log(
|
|
30154
|
-
|
|
30205
|
+
chalk212.yellow(
|
|
30155
30206
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
30156
30207
|
)
|
|
30157
30208
|
);
|
|
@@ -30159,10 +30210,10 @@ ${events.length} events`));
|
|
|
30159
30210
|
}
|
|
30160
30211
|
|
|
30161
30212
|
// src/shared/setNamedDefaultConnection.ts
|
|
30162
|
-
import
|
|
30213
|
+
import chalk213 from "chalk";
|
|
30163
30214
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
30164
30215
|
if (!connections.find((c) => c.name === name)) {
|
|
30165
|
-
console.error(
|
|
30216
|
+
console.error(chalk213.red(`Connection "${name}" not found.`));
|
|
30166
30217
|
process.exit(1);
|
|
30167
30218
|
}
|
|
30168
30219
|
setDefault(name);
|
|
@@ -30211,7 +30262,7 @@ function registerSignal(program2) {
|
|
|
30211
30262
|
}
|
|
30212
30263
|
|
|
30213
30264
|
// src/commands/sql/sqlAuth.ts
|
|
30214
|
-
import
|
|
30265
|
+
import chalk215 from "chalk";
|
|
30215
30266
|
|
|
30216
30267
|
// src/commands/sql/loadConnections.ts
|
|
30217
30268
|
function loadConnections3() {
|
|
@@ -30240,7 +30291,7 @@ function setDefaultConnection2(name) {
|
|
|
30240
30291
|
}
|
|
30241
30292
|
|
|
30242
30293
|
// src/commands/sql/promptConnection.ts
|
|
30243
|
-
import
|
|
30294
|
+
import chalk214 from "chalk";
|
|
30244
30295
|
async function promptConnection3(existingNames) {
|
|
30245
30296
|
const name = await promptInput("name", "Connection name:", "default");
|
|
30246
30297
|
assertUniqueName(existingNames, name);
|
|
@@ -30248,7 +30299,7 @@ async function promptConnection3(existingNames) {
|
|
|
30248
30299
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
30249
30300
|
const port = Number.parseInt(portStr, 10);
|
|
30250
30301
|
if (!Number.isFinite(port)) {
|
|
30251
|
-
console.error(
|
|
30302
|
+
console.error(chalk214.red(`Invalid port "${portStr}".`));
|
|
30252
30303
|
process.exit(1);
|
|
30253
30304
|
}
|
|
30254
30305
|
const user = await promptInput("user", "User:");
|
|
@@ -30261,13 +30312,13 @@ async function promptConnection3(existingNames) {
|
|
|
30261
30312
|
var sqlAuth = createConnectionAuth({
|
|
30262
30313
|
load: loadConnections3,
|
|
30263
30314
|
save: saveConnections3,
|
|
30264
|
-
format: (c) => `${
|
|
30315
|
+
format: (c) => `${chalk215.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
30265
30316
|
promptNew: promptConnection3,
|
|
30266
30317
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
30267
30318
|
});
|
|
30268
30319
|
|
|
30269
30320
|
// src/commands/sql/printTable.ts
|
|
30270
|
-
import
|
|
30321
|
+
import chalk216 from "chalk";
|
|
30271
30322
|
function formatCell(value) {
|
|
30272
30323
|
if (value === null || value === void 0) return "";
|
|
30273
30324
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -30276,7 +30327,7 @@ function formatCell(value) {
|
|
|
30276
30327
|
}
|
|
30277
30328
|
function printTable(rows) {
|
|
30278
30329
|
if (rows.length === 0) {
|
|
30279
|
-
console.log(
|
|
30330
|
+
console.log(chalk216.yellow("(no rows)"));
|
|
30280
30331
|
return;
|
|
30281
30332
|
}
|
|
30282
30333
|
const columns = Object.keys(rows[0]);
|
|
@@ -30284,13 +30335,13 @@ function printTable(rows) {
|
|
|
30284
30335
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
30285
30336
|
);
|
|
30286
30337
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
30287
|
-
console.log(
|
|
30288
|
-
console.log(
|
|
30338
|
+
console.log(chalk216.dim(header));
|
|
30339
|
+
console.log(chalk216.dim("-".repeat(header.length)));
|
|
30289
30340
|
for (const row of rows) {
|
|
30290
30341
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
30291
30342
|
console.log(line);
|
|
30292
30343
|
}
|
|
30293
|
-
console.log(
|
|
30344
|
+
console.log(chalk216.dim(`
|
|
30294
30345
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
30295
30346
|
}
|
|
30296
30347
|
|
|
@@ -30350,7 +30401,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
30350
30401
|
}
|
|
30351
30402
|
|
|
30352
30403
|
// src/commands/sql/sqlMutate.ts
|
|
30353
|
-
import
|
|
30404
|
+
import chalk217 from "chalk";
|
|
30354
30405
|
|
|
30355
30406
|
// src/commands/sql/isMutation.ts
|
|
30356
30407
|
var MUTATION_KEYWORDS = [
|
|
@@ -30384,7 +30435,7 @@ function isMutation(sql25) {
|
|
|
30384
30435
|
async function sqlMutate(query, connectionName) {
|
|
30385
30436
|
if (!isMutation(query)) {
|
|
30386
30437
|
console.error(
|
|
30387
|
-
|
|
30438
|
+
chalk217.red(
|
|
30388
30439
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
30389
30440
|
)
|
|
30390
30441
|
);
|
|
@@ -30394,18 +30445,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
30394
30445
|
const pool = await sqlConnect(conn);
|
|
30395
30446
|
try {
|
|
30396
30447
|
const result = await pool.request().query(query);
|
|
30397
|
-
console.log(
|
|
30448
|
+
console.log(chalk217.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
30398
30449
|
} finally {
|
|
30399
30450
|
await pool.close();
|
|
30400
30451
|
}
|
|
30401
30452
|
}
|
|
30402
30453
|
|
|
30403
30454
|
// src/commands/sql/sqlQuery.ts
|
|
30404
|
-
import
|
|
30455
|
+
import chalk218 from "chalk";
|
|
30405
30456
|
async function sqlQuery(query, connectionName) {
|
|
30406
30457
|
if (isMutation(query)) {
|
|
30407
30458
|
console.error(
|
|
30408
|
-
|
|
30459
|
+
chalk218.red(
|
|
30409
30460
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
30410
30461
|
)
|
|
30411
30462
|
);
|
|
@@ -30420,7 +30471,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
30420
30471
|
printTable(rows);
|
|
30421
30472
|
} else {
|
|
30422
30473
|
console.log(
|
|
30423
|
-
|
|
30474
|
+
chalk218.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
30424
30475
|
);
|
|
30425
30476
|
}
|
|
30426
30477
|
} finally {
|
|
@@ -30484,7 +30535,7 @@ function registerSql(program2) {
|
|
|
30484
30535
|
import * as fs48 from "fs";
|
|
30485
30536
|
import * as os5 from "os";
|
|
30486
30537
|
import * as path74 from "path";
|
|
30487
|
-
import { fileURLToPath as
|
|
30538
|
+
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
30488
30539
|
|
|
30489
30540
|
// src/commands/sync/pruneCommands.ts
|
|
30490
30541
|
import * as path65 from "path";
|
|
@@ -30565,7 +30616,7 @@ function reportPrune(label2, result, force) {
|
|
|
30565
30616
|
// src/commands/sync/syncClaudeMd.ts
|
|
30566
30617
|
import * as fs41 from "fs";
|
|
30567
30618
|
import * as path66 from "path";
|
|
30568
|
-
import
|
|
30619
|
+
import chalk219 from "chalk";
|
|
30569
30620
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
30570
30621
|
const source = path66.join(claudeDir, "CLAUDE.md");
|
|
30571
30622
|
const target = path66.join(targetBase, "CLAUDE.md");
|
|
@@ -30574,14 +30625,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
30574
30625
|
const targetContent = fs41.readFileSync(target, "utf8");
|
|
30575
30626
|
if (sourceContent !== targetContent) {
|
|
30576
30627
|
console.log(
|
|
30577
|
-
|
|
30628
|
+
chalk219.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
30578
30629
|
);
|
|
30579
30630
|
console.log();
|
|
30580
30631
|
printDiff(targetContent, sourceContent);
|
|
30581
30632
|
if (!options2?.yes) {
|
|
30582
30633
|
printAutoConfirmHint();
|
|
30583
30634
|
const confirm = await promptConfirm(
|
|
30584
|
-
|
|
30635
|
+
chalk219.red("Overwrite existing CLAUDE.md?"),
|
|
30585
30636
|
false
|
|
30586
30637
|
);
|
|
30587
30638
|
if (!confirm) {
|
|
@@ -30814,7 +30865,7 @@ function syncPi(claudeDir, options2) {
|
|
|
30814
30865
|
// src/commands/sync/syncSettings.ts
|
|
30815
30866
|
import * as fs47 from "fs";
|
|
30816
30867
|
import * as path73 from "path";
|
|
30817
|
-
import
|
|
30868
|
+
import chalk220 from "chalk";
|
|
30818
30869
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
30819
30870
|
const source = path73.join(claudeDir, "settings.json");
|
|
30820
30871
|
const target = path73.join(targetBase, "settings.json");
|
|
@@ -30833,7 +30884,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30833
30884
|
if (mergedContent !== normalizedTarget) {
|
|
30834
30885
|
if (!options2?.yes) {
|
|
30835
30886
|
console.log(
|
|
30836
|
-
|
|
30887
|
+
chalk220.yellow(
|
|
30837
30888
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
30838
30889
|
)
|
|
30839
30890
|
);
|
|
@@ -30841,7 +30892,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30841
30892
|
printDiff(targetContent, mergedContent);
|
|
30842
30893
|
printAutoConfirmHint();
|
|
30843
30894
|
const confirm = await promptConfirm(
|
|
30844
|
-
|
|
30895
|
+
chalk220.red("Overwrite existing settings.json?"),
|
|
30845
30896
|
false
|
|
30846
30897
|
);
|
|
30847
30898
|
if (!confirm) {
|
|
@@ -30856,7 +30907,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30856
30907
|
}
|
|
30857
30908
|
|
|
30858
30909
|
// src/commands/sync.ts
|
|
30859
|
-
var __filename4 =
|
|
30910
|
+
var __filename4 = fileURLToPath8(import.meta.url);
|
|
30860
30911
|
var __dirname5 = path74.dirname(__filename4);
|
|
30861
30912
|
async function sync(options2) {
|
|
30862
30913
|
const config = loadConfig();
|
|
@@ -30983,27 +31034,27 @@ async function configure() {
|
|
|
30983
31034
|
}
|
|
30984
31035
|
|
|
30985
31036
|
// src/commands/transcript/list.ts
|
|
30986
|
-
import { existsSync as
|
|
30987
|
-
import { join as
|
|
31037
|
+
import { existsSync as existsSync64, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
31038
|
+
import { join as join78 } from "path";
|
|
30988
31039
|
function list4() {
|
|
30989
31040
|
const { vttDir } = getTranscriptConfig();
|
|
30990
|
-
if (!
|
|
31041
|
+
if (!existsSync64(vttDir)) return;
|
|
30991
31042
|
for (const entry of readdirSync19(vttDir)) {
|
|
30992
31043
|
if (!entry.endsWith(".vtt")) continue;
|
|
30993
|
-
if (statSync10(
|
|
31044
|
+
if (statSync10(join78(vttDir, entry)).isDirectory()) continue;
|
|
30994
31045
|
console.log(entry);
|
|
30995
31046
|
}
|
|
30996
31047
|
}
|
|
30997
31048
|
|
|
30998
31049
|
// src/commands/transcript/move.ts
|
|
30999
31050
|
import {
|
|
31000
|
-
existsSync as
|
|
31051
|
+
existsSync as existsSync65,
|
|
31001
31052
|
mkdirSync as mkdirSync27,
|
|
31002
31053
|
readFileSync as readFileSync50,
|
|
31003
31054
|
renameSync as renameSync2,
|
|
31004
31055
|
writeFileSync as writeFileSync43
|
|
31005
31056
|
} from "fs";
|
|
31006
|
-
import { basename as basename21, join as
|
|
31057
|
+
import { basename as basename21, join as join79 } from "path";
|
|
31007
31058
|
|
|
31008
31059
|
// src/commands/transcript/cleanText.ts
|
|
31009
31060
|
function cleanText(text18) {
|
|
@@ -31216,9 +31267,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
31216
31267
|
return formatChatLog(messages);
|
|
31217
31268
|
}
|
|
31218
31269
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
31219
|
-
const processedDir =
|
|
31270
|
+
const processedDir = join79(vttDir, "processed");
|
|
31220
31271
|
mkdirSync27(processedDir, { recursive: true });
|
|
31221
|
-
renameSync2(sourcePath,
|
|
31272
|
+
renameSync2(sourcePath, join79(processedDir, filename));
|
|
31222
31273
|
}
|
|
31223
31274
|
function move(file, options2) {
|
|
31224
31275
|
const { date, client } = options2;
|
|
@@ -31228,19 +31279,19 @@ function move(file, options2) {
|
|
|
31228
31279
|
}
|
|
31229
31280
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
31230
31281
|
const filename = basename21(file);
|
|
31231
|
-
const sourcePath =
|
|
31232
|
-
if (!
|
|
31282
|
+
const sourcePath = join79(vttDir, filename);
|
|
31283
|
+
if (!existsSync65(sourcePath)) {
|
|
31233
31284
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
31234
31285
|
process.exit(1);
|
|
31235
31286
|
}
|
|
31236
31287
|
const base = basename21(filename, ".vtt").replace(/ Transcription$/, "");
|
|
31237
31288
|
const outputName = `${date} ${base}.md`;
|
|
31238
|
-
const formattedDir =
|
|
31289
|
+
const formattedDir = join79(transcriptsDir, client);
|
|
31239
31290
|
mkdirSync27(formattedDir, { recursive: true });
|
|
31240
|
-
const formattedPath =
|
|
31291
|
+
const formattedPath = join79(formattedDir, outputName);
|
|
31241
31292
|
writeFileSync43(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
31242
31293
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
31243
|
-
const summaryPath =
|
|
31294
|
+
const summaryPath = join79(summaryDir, client, outputName);
|
|
31244
31295
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
31245
31296
|
console.log(`Summary target: ${summaryPath}`);
|
|
31246
31297
|
}
|
|
@@ -31322,45 +31373,45 @@ function registerVerify(program2) {
|
|
|
31322
31373
|
|
|
31323
31374
|
// src/commands/voice/devices.ts
|
|
31324
31375
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
31325
|
-
import { join as
|
|
31376
|
+
import { join as join81 } from "path";
|
|
31326
31377
|
|
|
31327
31378
|
// src/commands/voice/shared.ts
|
|
31328
31379
|
import { homedir as homedir24 } from "os";
|
|
31329
|
-
import { dirname as
|
|
31330
|
-
import { fileURLToPath as
|
|
31331
|
-
var __dirname6 =
|
|
31332
|
-
var VOICE_DIR =
|
|
31380
|
+
import { dirname as dirname36, join as join80 } from "path";
|
|
31381
|
+
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
31382
|
+
var __dirname6 = dirname36(fileURLToPath9(import.meta.url));
|
|
31383
|
+
var VOICE_DIR = join80(homedir24(), ".assist", "voice");
|
|
31333
31384
|
var voicePaths = {
|
|
31334
31385
|
dir: VOICE_DIR,
|
|
31335
|
-
pid:
|
|
31336
|
-
log:
|
|
31337
|
-
venv:
|
|
31338
|
-
lock:
|
|
31386
|
+
pid: join80(VOICE_DIR, "voice.pid"),
|
|
31387
|
+
log: join80(VOICE_DIR, "voice.log"),
|
|
31388
|
+
venv: join80(VOICE_DIR, ".venv"),
|
|
31389
|
+
lock: join80(VOICE_DIR, "voice.lock")
|
|
31339
31390
|
};
|
|
31340
31391
|
function getPythonDir() {
|
|
31341
|
-
return
|
|
31392
|
+
return join80(__dirname6, "commands", "voice", "python");
|
|
31342
31393
|
}
|
|
31343
31394
|
function getVenvPython() {
|
|
31344
|
-
return process.platform === "win32" ?
|
|
31395
|
+
return process.platform === "win32" ? join80(voicePaths.venv, "Scripts", "python.exe") : join80(voicePaths.venv, "bin", "python");
|
|
31345
31396
|
}
|
|
31346
31397
|
function getLockDir() {
|
|
31347
31398
|
const config = loadConfig();
|
|
31348
31399
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
31349
31400
|
}
|
|
31350
31401
|
function getLockFile() {
|
|
31351
|
-
return
|
|
31402
|
+
return join80(getLockDir(), "voice.lock");
|
|
31352
31403
|
}
|
|
31353
31404
|
|
|
31354
31405
|
// src/commands/voice/devices.ts
|
|
31355
31406
|
function devices() {
|
|
31356
|
-
const script =
|
|
31407
|
+
const script = join81(getPythonDir(), "list_devices.py");
|
|
31357
31408
|
spawnSync8(getVenvPython(), [script], { stdio: "inherit" });
|
|
31358
31409
|
}
|
|
31359
31410
|
|
|
31360
31411
|
// src/commands/voice/logs.ts
|
|
31361
|
-
import { existsSync as
|
|
31412
|
+
import { existsSync as existsSync66, readFileSync as readFileSync51 } from "fs";
|
|
31362
31413
|
function logs(options2) {
|
|
31363
|
-
if (!
|
|
31414
|
+
if (!existsSync66(voicePaths.log)) {
|
|
31364
31415
|
console.log("No voice log file found");
|
|
31365
31416
|
return;
|
|
31366
31417
|
}
|
|
@@ -31388,12 +31439,12 @@ function logs(options2) {
|
|
|
31388
31439
|
// src/commands/voice/setup.ts
|
|
31389
31440
|
import { spawnSync as spawnSync9 } from "child_process";
|
|
31390
31441
|
import { mkdirSync as mkdirSync29 } from "fs";
|
|
31391
|
-
import { join as
|
|
31442
|
+
import { join as join83 } from "path";
|
|
31392
31443
|
|
|
31393
31444
|
// src/commands/voice/checkLockFile.ts
|
|
31394
31445
|
import { execSync as execSync58 } from "child_process";
|
|
31395
|
-
import { existsSync as
|
|
31396
|
-
import { join as
|
|
31446
|
+
import { existsSync as existsSync67, mkdirSync as mkdirSync28, readFileSync as readFileSync52, writeFileSync as writeFileSync44 } from "fs";
|
|
31447
|
+
import { join as join82 } from "path";
|
|
31397
31448
|
function isProcessAlive2(pid) {
|
|
31398
31449
|
try {
|
|
31399
31450
|
process.kill(pid, 0);
|
|
@@ -31404,7 +31455,7 @@ function isProcessAlive2(pid) {
|
|
|
31404
31455
|
}
|
|
31405
31456
|
function checkLockFile() {
|
|
31406
31457
|
const lockFile = getLockFile();
|
|
31407
|
-
if (!
|
|
31458
|
+
if (!existsSync67(lockFile)) return;
|
|
31408
31459
|
try {
|
|
31409
31460
|
const lock2 = JSON.parse(readFileSync52(lockFile, "utf8"));
|
|
31410
31461
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -31417,7 +31468,7 @@ function checkLockFile() {
|
|
|
31417
31468
|
}
|
|
31418
31469
|
}
|
|
31419
31470
|
function bootstrapVenv() {
|
|
31420
|
-
if (
|
|
31471
|
+
if (existsSync67(getVenvPython())) return;
|
|
31421
31472
|
console.log("Setting up Python environment...");
|
|
31422
31473
|
const pythonDir = getPythonDir();
|
|
31423
31474
|
execSync58(
|
|
@@ -31430,7 +31481,7 @@ function bootstrapVenv() {
|
|
|
31430
31481
|
}
|
|
31431
31482
|
function writeLockFile(pid) {
|
|
31432
31483
|
const lockFile = getLockFile();
|
|
31433
|
-
mkdirSync28(
|
|
31484
|
+
mkdirSync28(join82(lockFile, ".."), { recursive: true });
|
|
31434
31485
|
writeFileSync44(
|
|
31435
31486
|
lockFile,
|
|
31436
31487
|
JSON.stringify({
|
|
@@ -31446,7 +31497,7 @@ function setup() {
|
|
|
31446
31497
|
mkdirSync29(voicePaths.dir, { recursive: true });
|
|
31447
31498
|
bootstrapVenv();
|
|
31448
31499
|
console.log("\nDownloading models...\n");
|
|
31449
|
-
const script =
|
|
31500
|
+
const script = join83(getPythonDir(), "setup_models.py");
|
|
31450
31501
|
const result = spawnSync9(getVenvPython(), [script], {
|
|
31451
31502
|
stdio: "inherit",
|
|
31452
31503
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -31460,7 +31511,7 @@ function setup() {
|
|
|
31460
31511
|
// src/commands/voice/start.ts
|
|
31461
31512
|
import { spawn as spawn8 } from "child_process";
|
|
31462
31513
|
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync45 } from "fs";
|
|
31463
|
-
import { join as
|
|
31514
|
+
import { join as join84 } from "path";
|
|
31464
31515
|
|
|
31465
31516
|
// src/commands/voice/buildDaemonEnv.ts
|
|
31466
31517
|
function buildDaemonEnv(options2) {
|
|
@@ -31498,7 +31549,7 @@ function start2(options2) {
|
|
|
31498
31549
|
bootstrapVenv();
|
|
31499
31550
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
31500
31551
|
const env = buildDaemonEnv({ debug });
|
|
31501
|
-
const script =
|
|
31552
|
+
const script = join84(getPythonDir(), "voice_daemon.py");
|
|
31502
31553
|
const python = getVenvPython();
|
|
31503
31554
|
if (options2.foreground) {
|
|
31504
31555
|
spawnForeground(python, script, env);
|
|
@@ -31508,7 +31559,7 @@ function start2(options2) {
|
|
|
31508
31559
|
}
|
|
31509
31560
|
|
|
31510
31561
|
// src/commands/voice/status.ts
|
|
31511
|
-
import { existsSync as
|
|
31562
|
+
import { existsSync as existsSync68, readFileSync as readFileSync53 } from "fs";
|
|
31512
31563
|
function isProcessAlive3(pid) {
|
|
31513
31564
|
try {
|
|
31514
31565
|
process.kill(pid, 0);
|
|
@@ -31518,12 +31569,12 @@ function isProcessAlive3(pid) {
|
|
|
31518
31569
|
}
|
|
31519
31570
|
}
|
|
31520
31571
|
function readRecentLogs(count8) {
|
|
31521
|
-
if (!
|
|
31572
|
+
if (!existsSync68(voicePaths.log)) return [];
|
|
31522
31573
|
const lines2 = readFileSync53(voicePaths.log, "utf8").trim().split("\n");
|
|
31523
31574
|
return lines2.slice(-count8);
|
|
31524
31575
|
}
|
|
31525
31576
|
function status2() {
|
|
31526
|
-
if (!
|
|
31577
|
+
if (!existsSync68(voicePaths.pid)) {
|
|
31527
31578
|
console.log("Voice daemon: not running (no PID file)");
|
|
31528
31579
|
return;
|
|
31529
31580
|
}
|
|
@@ -31546,9 +31597,9 @@ function status2() {
|
|
|
31546
31597
|
}
|
|
31547
31598
|
|
|
31548
31599
|
// src/commands/voice/stop.ts
|
|
31549
|
-
import { existsSync as
|
|
31600
|
+
import { existsSync as existsSync69, readFileSync as readFileSync54, unlinkSync as unlinkSync20 } from "fs";
|
|
31550
31601
|
function stop2() {
|
|
31551
|
-
if (!
|
|
31602
|
+
if (!existsSync69(voicePaths.pid)) {
|
|
31552
31603
|
console.log("Voice daemon is not running (no PID file)");
|
|
31553
31604
|
return;
|
|
31554
31605
|
}
|
|
@@ -31565,7 +31616,7 @@ function stop2() {
|
|
|
31565
31616
|
}
|
|
31566
31617
|
try {
|
|
31567
31618
|
const lockFile = getLockFile();
|
|
31568
|
-
if (
|
|
31619
|
+
if (existsSync69(lockFile)) unlinkSync20(lockFile);
|
|
31569
31620
|
} catch {
|
|
31570
31621
|
}
|
|
31571
31622
|
console.log("Voice daemon stopped");
|
|
@@ -31629,11 +31680,11 @@ function changedPaths(from, cwd) {
|
|
|
31629
31680
|
}
|
|
31630
31681
|
|
|
31631
31682
|
// src/commands/watch/readBuiltVersion.ts
|
|
31632
|
-
import { join as
|
|
31683
|
+
import { join as join85 } from "path";
|
|
31633
31684
|
function readBuiltVersion(cwd) {
|
|
31634
31685
|
try {
|
|
31635
31686
|
const root = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
31636
|
-
return readPackageJson(
|
|
31687
|
+
return readPackageJson(join85(root, "package.json")).version ?? "unknown";
|
|
31637
31688
|
} catch {
|
|
31638
31689
|
return "unknown";
|
|
31639
31690
|
}
|
|
@@ -31970,7 +32021,7 @@ function resolveParams(params, cliArgs) {
|
|
|
31970
32021
|
}
|
|
31971
32022
|
|
|
31972
32023
|
// src/commands/run/resolveRunCwd.ts
|
|
31973
|
-
import { existsSync as
|
|
32024
|
+
import { existsSync as existsSync70 } from "fs";
|
|
31974
32025
|
import { resolve as resolve19 } from "path";
|
|
31975
32026
|
var MissingRunCwdError = class extends Error {
|
|
31976
32027
|
constructor(runName, cwd) {
|
|
@@ -31983,25 +32034,25 @@ var MissingRunCwdError = class extends Error {
|
|
|
31983
32034
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
31984
32035
|
if (!config.cwd) return void 0;
|
|
31985
32036
|
const cwd = resolve19(baseDir, config.cwd);
|
|
31986
|
-
if (!
|
|
32037
|
+
if (!existsSync70(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
31987
32038
|
return cwd;
|
|
31988
32039
|
}
|
|
31989
32040
|
|
|
31990
32041
|
// src/commands/run/runCommandToCompletion.ts
|
|
31991
32042
|
import { spawn as spawn9 } from "child_process";
|
|
31992
|
-
import { existsSync as
|
|
32043
|
+
import { existsSync as existsSync72 } from "fs";
|
|
31993
32044
|
|
|
31994
32045
|
// src/commands/run/resolveCommand.ts
|
|
31995
32046
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
31996
|
-
import { existsSync as
|
|
31997
|
-
import { dirname as
|
|
32047
|
+
import { existsSync as existsSync71 } from "fs";
|
|
32048
|
+
import { dirname as dirname37, join as join86, resolve as resolve20 } from "path";
|
|
31998
32049
|
function resolveCommand2(command) {
|
|
31999
32050
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
32000
32051
|
try {
|
|
32001
32052
|
const gitPath = execFileSync16("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
32002
|
-
const gitRoot = resolve20(
|
|
32003
|
-
const gitBash =
|
|
32004
|
-
if (
|
|
32053
|
+
const gitRoot = resolve20(dirname37(gitPath), "..");
|
|
32054
|
+
const gitBash = join86(gitRoot, "bin", "bash.exe");
|
|
32055
|
+
if (existsSync71(gitBash)) return gitBash;
|
|
32005
32056
|
} catch {
|
|
32006
32057
|
return command;
|
|
32007
32058
|
}
|
|
@@ -32011,7 +32062,7 @@ function resolveCommand2(command) {
|
|
|
32011
32062
|
// src/commands/run/runCommandToCompletion.ts
|
|
32012
32063
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
32013
32064
|
return new Promise((resolveResult) => {
|
|
32014
|
-
if (cwd && !
|
|
32065
|
+
if (cwd && !existsSync72(cwd)) {
|
|
32015
32066
|
resolveResult({
|
|
32016
32067
|
kind: "failed",
|
|
32017
32068
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -32268,7 +32319,7 @@ function registerWatch(program2) {
|
|
|
32268
32319
|
|
|
32269
32320
|
// src/commands/roam/auth.ts
|
|
32270
32321
|
import { randomBytes } from "crypto";
|
|
32271
|
-
import
|
|
32322
|
+
import chalk221 from "chalk";
|
|
32272
32323
|
|
|
32273
32324
|
// src/commands/roam/waitForCallback.ts
|
|
32274
32325
|
import { createServer as createServer3 } from "http";
|
|
@@ -32399,13 +32450,13 @@ async function auth() {
|
|
|
32399
32450
|
saveGlobalConfig(config);
|
|
32400
32451
|
const state = randomBytes(16).toString("hex");
|
|
32401
32452
|
console.log(
|
|
32402
|
-
|
|
32453
|
+
chalk221.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
32403
32454
|
);
|
|
32404
|
-
console.log(
|
|
32405
|
-
console.log(
|
|
32406
|
-
console.log(
|
|
32455
|
+
console.log(chalk221.white("http://localhost:14523/callback\n"));
|
|
32456
|
+
console.log(chalk221.blue("Opening browser for authorization..."));
|
|
32457
|
+
console.log(chalk221.dim("Waiting for authorization callback..."));
|
|
32407
32458
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
32408
|
-
console.log(
|
|
32459
|
+
console.log(chalk221.dim("Exchanging code for tokens..."));
|
|
32409
32460
|
const tokens = await exchangeToken({
|
|
32410
32461
|
code,
|
|
32411
32462
|
clientId,
|
|
@@ -32421,14 +32472,14 @@ async function auth() {
|
|
|
32421
32472
|
};
|
|
32422
32473
|
saveGlobalConfig(config);
|
|
32423
32474
|
console.log(
|
|
32424
|
-
|
|
32475
|
+
chalk221.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
32425
32476
|
);
|
|
32426
32477
|
}
|
|
32427
32478
|
|
|
32428
32479
|
// src/commands/roam/postRoamActivity.ts
|
|
32429
32480
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
32430
32481
|
import { readdirSync as readdirSync20, readFileSync as readFileSync55, statSync as statSync11 } from "fs";
|
|
32431
|
-
import { join as
|
|
32482
|
+
import { join as join87 } from "path";
|
|
32432
32483
|
function findPortFile(roamDir) {
|
|
32433
32484
|
let entries;
|
|
32434
32485
|
try {
|
|
@@ -32437,7 +32488,7 @@ function findPortFile(roamDir) {
|
|
|
32437
32488
|
return void 0;
|
|
32438
32489
|
}
|
|
32439
32490
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
32440
|
-
const path80 =
|
|
32491
|
+
const path80 = join87(roamDir, name);
|
|
32441
32492
|
try {
|
|
32442
32493
|
return { path: path80, mtimeMs: statSync11(path80).mtimeMs };
|
|
32443
32494
|
} catch {
|
|
@@ -32449,7 +32500,7 @@ function findPortFile(roamDir) {
|
|
|
32449
32500
|
function postRoamActivity(app, event) {
|
|
32450
32501
|
const appData = process.env.APPDATA;
|
|
32451
32502
|
if (!appData) return;
|
|
32452
|
-
const portFile = findPortFile(
|
|
32503
|
+
const portFile = findPortFile(join87(appData, "Roam"));
|
|
32453
32504
|
if (!portFile) return;
|
|
32454
32505
|
let port;
|
|
32455
32506
|
try {
|
|
@@ -32582,7 +32633,7 @@ async function run3(name, args) {
|
|
|
32582
32633
|
|
|
32583
32634
|
// src/commands/run/add.ts
|
|
32584
32635
|
import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync46 } from "fs";
|
|
32585
|
-
import { join as
|
|
32636
|
+
import { join as join88 } from "path";
|
|
32586
32637
|
|
|
32587
32638
|
// src/commands/run/extractOption.ts
|
|
32588
32639
|
function extractOption(args, flag) {
|
|
@@ -32643,7 +32694,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
32643
32694
|
saveConfig(config);
|
|
32644
32695
|
}
|
|
32645
32696
|
function createCommandFile(name) {
|
|
32646
|
-
const dir =
|
|
32697
|
+
const dir = join88(".claude", "commands");
|
|
32647
32698
|
mkdirSync31(dir, { recursive: true });
|
|
32648
32699
|
const content = `---
|
|
32649
32700
|
description: Run ${name}
|
|
@@ -32651,7 +32702,7 @@ description: Run ${name}
|
|
|
32651
32702
|
|
|
32652
32703
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
32653
32704
|
`;
|
|
32654
|
-
const filePath =
|
|
32705
|
+
const filePath = join88(dir, `${name}.md`);
|
|
32655
32706
|
writeFileSync46(filePath, content);
|
|
32656
32707
|
console.log(`Created command file: ${filePath}`);
|
|
32657
32708
|
}
|
|
@@ -32707,8 +32758,8 @@ function link2() {
|
|
|
32707
32758
|
}
|
|
32708
32759
|
|
|
32709
32760
|
// src/commands/run/remove.ts
|
|
32710
|
-
import { existsSync as
|
|
32711
|
-
import { join as
|
|
32761
|
+
import { existsSync as existsSync73, unlinkSync as unlinkSync21 } from "fs";
|
|
32762
|
+
import { join as join89 } from "path";
|
|
32712
32763
|
function findRemoveIndex() {
|
|
32713
32764
|
const idx = process.argv.indexOf("remove");
|
|
32714
32765
|
if (idx === -1 || idx + 1 >= process.argv.length) return -1;
|
|
@@ -32723,8 +32774,8 @@ function parseRemoveName() {
|
|
|
32723
32774
|
return process.argv[idx + 1];
|
|
32724
32775
|
}
|
|
32725
32776
|
function deleteCommandFile(name) {
|
|
32726
|
-
const filePath =
|
|
32727
|
-
if (
|
|
32777
|
+
const filePath = join89(".claude", "commands", `${name}.md`);
|
|
32778
|
+
if (existsSync73(filePath)) {
|
|
32728
32779
|
unlinkSync21(filePath);
|
|
32729
32780
|
console.log(`Deleted command file: ${filePath}`);
|
|
32730
32781
|
}
|
|
@@ -32769,10 +32820,10 @@ function registerRun(program2) {
|
|
|
32769
32820
|
|
|
32770
32821
|
// src/commands/screenshot/index.ts
|
|
32771
32822
|
import { execSync as execSync60 } from "child_process";
|
|
32772
|
-
import { existsSync as
|
|
32823
|
+
import { existsSync as existsSync74, mkdirSync as mkdirSync32, unlinkSync as unlinkSync22, writeFileSync as writeFileSync47 } from "fs";
|
|
32773
32824
|
import { tmpdir as tmpdir8 } from "os";
|
|
32774
|
-
import { join as
|
|
32775
|
-
import
|
|
32825
|
+
import { join as join90, resolve as resolve21 } from "path";
|
|
32826
|
+
import chalk222 from "chalk";
|
|
32776
32827
|
|
|
32777
32828
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
32778
32829
|
var captureWindowPs1 = `
|
|
@@ -32901,14 +32952,14 @@ Write-Output $OutputPath
|
|
|
32901
32952
|
|
|
32902
32953
|
// src/commands/screenshot/index.ts
|
|
32903
32954
|
function buildOutputPath(outputDir, processName) {
|
|
32904
|
-
if (!
|
|
32955
|
+
if (!existsSync74(outputDir)) {
|
|
32905
32956
|
mkdirSync32(outputDir, { recursive: true });
|
|
32906
32957
|
}
|
|
32907
32958
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
32908
32959
|
return resolve21(outputDir, `${processName}-${timestamp6}.png`);
|
|
32909
32960
|
}
|
|
32910
32961
|
function runPowerShellScript(processName, outputPath) {
|
|
32911
|
-
const scriptPath =
|
|
32962
|
+
const scriptPath = join90(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
32912
32963
|
writeFileSync47(scriptPath, captureWindowPs1, "utf8");
|
|
32913
32964
|
try {
|
|
32914
32965
|
execSync60(
|
|
@@ -32923,13 +32974,13 @@ function screenshot(processName) {
|
|
|
32923
32974
|
const config = loadConfig();
|
|
32924
32975
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
32925
32976
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
32926
|
-
console.log(
|
|
32977
|
+
console.log(chalk222.gray(`Capturing window for process "${processName}" ...`));
|
|
32927
32978
|
try {
|
|
32928
32979
|
runPowerShellScript(processName, outputPath);
|
|
32929
|
-
console.log(
|
|
32980
|
+
console.log(chalk222.green(`Screenshot saved: ${outputPath}`));
|
|
32930
32981
|
} catch (error) {
|
|
32931
32982
|
const msg = error instanceof Error ? error.message : String(error);
|
|
32932
|
-
console.error(
|
|
32983
|
+
console.error(chalk222.red(`Failed to capture screenshot: ${msg}`));
|
|
32933
32984
|
process.exit(1);
|
|
32934
32985
|
}
|
|
32935
32986
|
}
|
|
@@ -33246,12 +33297,12 @@ function toSessionRunInfo({
|
|
|
33246
33297
|
}
|
|
33247
33298
|
|
|
33248
33299
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
33249
|
-
import { existsSync as
|
|
33300
|
+
import { existsSync as existsSync75 } from "fs";
|
|
33250
33301
|
function joinRefusal(session) {
|
|
33251
33302
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
33252
33303
|
if (session.closing === true) return "the session is closing";
|
|
33253
33304
|
if (!session.cwd) return "the session has no working directory";
|
|
33254
|
-
if (!
|
|
33305
|
+
if (!existsSync75(session.cwd))
|
|
33255
33306
|
return "the session's workspace no longer exists";
|
|
33256
33307
|
return void 0;
|
|
33257
33308
|
}
|
|
@@ -33415,11 +33466,11 @@ function sessionBase(id, status3) {
|
|
|
33415
33466
|
}
|
|
33416
33467
|
|
|
33417
33468
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
33418
|
-
import { existsSync as
|
|
33469
|
+
import { existsSync as existsSync77 } from "fs";
|
|
33419
33470
|
import * as pty from "node-pty";
|
|
33420
33471
|
|
|
33421
33472
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
33422
|
-
import { chmodSync, existsSync as
|
|
33473
|
+
import { chmodSync, existsSync as existsSync76, statSync as statSync12 } from "fs";
|
|
33423
33474
|
import { createRequire as createRequire3 } from "module";
|
|
33424
33475
|
import path75 from "path";
|
|
33425
33476
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -33434,7 +33485,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
33434
33485
|
`${process.platform}-${process.arch}`,
|
|
33435
33486
|
"spawn-helper"
|
|
33436
33487
|
);
|
|
33437
|
-
if (!
|
|
33488
|
+
if (!existsSync76(helper)) return;
|
|
33438
33489
|
const mode = statSync12(helper).mode;
|
|
33439
33490
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
33440
33491
|
}
|
|
@@ -33470,7 +33521,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
33470
33521
|
});
|
|
33471
33522
|
}
|
|
33472
33523
|
function refuseMissingCwd(cwd, sessionId) {
|
|
33473
|
-
if (!cwd ||
|
|
33524
|
+
if (!cwd || existsSync77(cwd)) return;
|
|
33474
33525
|
daemonLog(
|
|
33475
33526
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
33476
33527
|
);
|
|
@@ -33550,8 +33601,8 @@ function serverRunMeta(runName, cwd) {
|
|
|
33550
33601
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
33551
33602
|
import * as fs49 from "fs";
|
|
33552
33603
|
import * as path76 from "path";
|
|
33553
|
-
import { fileURLToPath as
|
|
33554
|
-
var __filename5 =
|
|
33604
|
+
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
33605
|
+
var __filename5 = fileURLToPath10(import.meta.url);
|
|
33555
33606
|
var __dirname7 = path76.dirname(__filename5);
|
|
33556
33607
|
function readDesignSystemPrompt() {
|
|
33557
33608
|
const promptPath = path76.join(
|
|
@@ -33652,17 +33703,17 @@ function setStatus2(session, newStatus) {
|
|
|
33652
33703
|
}
|
|
33653
33704
|
|
|
33654
33705
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33655
|
-
import { existsSync as
|
|
33706
|
+
import { existsSync as existsSync79 } from "fs";
|
|
33656
33707
|
import { basename as basename22 } from "path";
|
|
33657
33708
|
|
|
33658
33709
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
33659
|
-
import { existsSync as
|
|
33660
|
-
import { join as
|
|
33710
|
+
import { existsSync as existsSync78 } from "fs";
|
|
33711
|
+
import { join as join93 } from "path";
|
|
33661
33712
|
|
|
33662
33713
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
33663
33714
|
import { statSync as statSync13 } from "fs";
|
|
33664
33715
|
import { rm as rm2 } from "fs/promises";
|
|
33665
|
-
import { join as
|
|
33716
|
+
import { join as join92 } from "path";
|
|
33666
33717
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
33667
33718
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
33668
33719
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -33690,7 +33741,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
33690
33741
|
return { removed: true };
|
|
33691
33742
|
}
|
|
33692
33743
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
33693
|
-
return statSync13(
|
|
33744
|
+
return statSync13(join92(worktreePath, ".git"), {
|
|
33694
33745
|
throwIfNoEntry: false
|
|
33695
33746
|
})?.isDirectory() === true;
|
|
33696
33747
|
}
|
|
@@ -33726,7 +33777,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
33726
33777
|
);
|
|
33727
33778
|
}
|
|
33728
33779
|
function strandedReason(worktreePath, cause) {
|
|
33729
|
-
if (!
|
|
33780
|
+
if (!existsSync78(join93(worktreePath, ".git")))
|
|
33730
33781
|
return "its .git link is already gone";
|
|
33731
33782
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
33732
33783
|
return "git no longer recognises it as a working tree";
|
|
@@ -33778,7 +33829,7 @@ function reason3(error) {
|
|
|
33778
33829
|
|
|
33779
33830
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33780
33831
|
async function reapWorktree(worktreePath, force = false) {
|
|
33781
|
-
if (!
|
|
33832
|
+
if (!existsSync79(worktreePath)) {
|
|
33782
33833
|
forgetWorktree(worktreePath);
|
|
33783
33834
|
daemonLog(
|
|
33784
33835
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -33803,7 +33854,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
33803
33854
|
}
|
|
33804
33855
|
function owningClone(worktreePath) {
|
|
33805
33856
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
33806
|
-
if (recorded &&
|
|
33857
|
+
if (recorded && existsSync79(recorded)) return recorded;
|
|
33807
33858
|
const detected = mainWorktree(worktreePath);
|
|
33808
33859
|
if (detected) return detected;
|
|
33809
33860
|
daemonLog(
|
|
@@ -33934,12 +33985,12 @@ function closeGateApplies(sessions, session) {
|
|
|
33934
33985
|
}
|
|
33935
33986
|
|
|
33936
33987
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
33937
|
-
import { existsSync as
|
|
33988
|
+
import { existsSync as existsSync80, watch } from "fs";
|
|
33938
33989
|
var DEBOUNCE_MS = 500;
|
|
33939
33990
|
var POLL_MS = 3e4;
|
|
33940
33991
|
function watchGitState(cwd, onChange) {
|
|
33941
33992
|
const common = gitCommonDir(cwd);
|
|
33942
|
-
if (!common || !
|
|
33993
|
+
if (!common || !existsSync80(common)) return void 0;
|
|
33943
33994
|
const watchers = [
|
|
33944
33995
|
watchGitDir(common, onChange),
|
|
33945
33996
|
pollGitState(cwd, onChange)
|
|
@@ -34416,10 +34467,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
34416
34467
|
}
|
|
34417
34468
|
|
|
34418
34469
|
// src/commands/sessions/daemon/exitReason.ts
|
|
34419
|
-
import { existsSync as
|
|
34470
|
+
import { existsSync as existsSync81 } from "fs";
|
|
34420
34471
|
import { resolve as resolve22 } from "path";
|
|
34421
34472
|
function exitDetail(session) {
|
|
34422
|
-
if (session.cwd && !
|
|
34473
|
+
if (session.cwd && !existsSync81(session.cwd))
|
|
34423
34474
|
return `working directory ${session.cwd} no longer exists`;
|
|
34424
34475
|
return missingRunConfigCwd(session);
|
|
34425
34476
|
}
|
|
@@ -34433,7 +34484,7 @@ function missingRunConfigCwd(session) {
|
|
|
34433
34484
|
const config = resolveRunConfig(session.runName, dir);
|
|
34434
34485
|
if (!config?.cwd) return void 0;
|
|
34435
34486
|
const configured = resolve22(runConfigBaseDirFrom(dir), config.cwd);
|
|
34436
|
-
if (
|
|
34487
|
+
if (existsSync81(configured)) return void 0;
|
|
34437
34488
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
34438
34489
|
}
|
|
34439
34490
|
|
|
@@ -34474,8 +34525,8 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
34474
34525
|
}
|
|
34475
34526
|
|
|
34476
34527
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
34477
|
-
import { existsSync as
|
|
34478
|
-
import { dirname as
|
|
34528
|
+
import { existsSync as existsSync82, mkdirSync as mkdirSync33, watch as watch2 } from "fs";
|
|
34529
|
+
import { dirname as dirname39 } from "path";
|
|
34479
34530
|
|
|
34480
34531
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
34481
34532
|
function applyActivityToSession(session, activity2) {
|
|
@@ -34537,7 +34588,7 @@ var DEBOUNCE_MS2 = 50;
|
|
|
34537
34588
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
34538
34589
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
34539
34590
|
const path80 = activityPath(session.id);
|
|
34540
|
-
const dir =
|
|
34591
|
+
const dir = dirname39(path80);
|
|
34541
34592
|
try {
|
|
34542
34593
|
mkdirSync33(dir, { recursive: true });
|
|
34543
34594
|
} catch {
|
|
@@ -34560,7 +34611,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34560
34611
|
if (timer) clearTimeout(timer);
|
|
34561
34612
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
34562
34613
|
});
|
|
34563
|
-
if (
|
|
34614
|
+
if (existsSync82(path80)) read2();
|
|
34564
34615
|
}
|
|
34565
34616
|
function refreshActivity(session) {
|
|
34566
34617
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -36182,7 +36233,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
36182
36233
|
}
|
|
36183
36234
|
|
|
36184
36235
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
36185
|
-
import { existsSync as
|
|
36236
|
+
import { existsSync as existsSync85 } from "fs";
|
|
36186
36237
|
import { basename as basename24 } from "path";
|
|
36187
36238
|
|
|
36188
36239
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -36237,9 +36288,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
36237
36288
|
}
|
|
36238
36289
|
|
|
36239
36290
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
36240
|
-
import { existsSync as
|
|
36291
|
+
import { existsSync as existsSync84 } from "fs";
|
|
36241
36292
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
36242
|
-
if (!
|
|
36293
|
+
if (!existsSync84(clone)) {
|
|
36243
36294
|
for (const { path: path80 } of paths) forgetWorktree(path80);
|
|
36244
36295
|
daemonLog(
|
|
36245
36296
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -36405,7 +36456,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
36405
36456
|
);
|
|
36406
36457
|
continue;
|
|
36407
36458
|
}
|
|
36408
|
-
if (!
|
|
36459
|
+
if (!existsSync85(path80)) {
|
|
36409
36460
|
logVanishedTree(sessions, path80);
|
|
36410
36461
|
vanished.set(clone, [
|
|
36411
36462
|
...vanished.get(clone) ?? [],
|
|
@@ -37022,13 +37073,13 @@ async function defaultConnect() {
|
|
|
37022
37073
|
}
|
|
37023
37074
|
|
|
37024
37075
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
37025
|
-
import { existsSync as
|
|
37076
|
+
import { existsSync as existsSync86, readFileSync as readFileSync58 } from "fs";
|
|
37026
37077
|
import { posix as posix3 } from "path";
|
|
37027
37078
|
function hasPersistedWindowsSessions() {
|
|
37028
37079
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
37029
37080
|
if (!sessionsFile) return false;
|
|
37030
37081
|
try {
|
|
37031
|
-
if (!
|
|
37082
|
+
if (!existsSync86(sessionsFile)) return false;
|
|
37032
37083
|
const data = JSON.parse(readFileSync58(sessionsFile, "utf8"));
|
|
37033
37084
|
return Array.isArray(data) && data.length > 0;
|
|
37034
37085
|
} catch (error) {
|
|
@@ -37763,7 +37814,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
37763
37814
|
}
|
|
37764
37815
|
|
|
37765
37816
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37766
|
-
import { existsSync as
|
|
37817
|
+
import { existsSync as existsSync89 } from "fs";
|
|
37767
37818
|
|
|
37768
37819
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
37769
37820
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -37794,11 +37845,11 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
37794
37845
|
}
|
|
37795
37846
|
|
|
37796
37847
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
37797
|
-
import { existsSync as
|
|
37848
|
+
import { existsSync as existsSync88 } from "fs";
|
|
37798
37849
|
|
|
37799
37850
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
37800
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
37801
|
-
import { join as
|
|
37851
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync87, mkdirSync as mkdirSync35 } from "fs";
|
|
37852
|
+
import { join as join95 } from "path";
|
|
37802
37853
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
37803
37854
|
const dir = projectDirForCwd(toCwd);
|
|
37804
37855
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -37807,8 +37858,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
37807
37858
|
);
|
|
37808
37859
|
return;
|
|
37809
37860
|
}
|
|
37810
|
-
const dest =
|
|
37811
|
-
if (
|
|
37861
|
+
const dest = join95(dir, `${claudeSessionId}.jsonl`);
|
|
37862
|
+
if (existsSync87(dest)) {
|
|
37812
37863
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
37813
37864
|
return;
|
|
37814
37865
|
}
|
|
@@ -37859,7 +37910,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
37859
37910
|
}
|
|
37860
37911
|
function cloneForReapedTree(missingCwd) {
|
|
37861
37912
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
37862
|
-
if (!clone || !
|
|
37913
|
+
if (!clone || !existsSync88(clone))
|
|
37863
37914
|
throw new Error(
|
|
37864
37915
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
37865
37916
|
);
|
|
@@ -37868,7 +37919,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
37868
37919
|
|
|
37869
37920
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37870
37921
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
37871
|
-
if (!
|
|
37922
|
+
if (!existsSync89(cwd))
|
|
37872
37923
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
37873
37924
|
const id = ctx.spawnWith(
|
|
37874
37925
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -38708,7 +38759,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
38708
38759
|
|
|
38709
38760
|
// src/commands/sessions/summarise/index.ts
|
|
38710
38761
|
import * as fs56 from "fs";
|
|
38711
|
-
import
|
|
38762
|
+
import chalk223 from "chalk";
|
|
38712
38763
|
|
|
38713
38764
|
// src/commands/sessions/summarise/shared.ts
|
|
38714
38765
|
import * as fs55 from "fs";
|
|
@@ -38767,22 +38818,22 @@ ${firstMessage}`);
|
|
|
38767
38818
|
async function summarise2(options2) {
|
|
38768
38819
|
const files = await discoverSessionFiles();
|
|
38769
38820
|
if (files.length === 0) {
|
|
38770
|
-
console.log(
|
|
38821
|
+
console.log(chalk223.yellow("No sessions found."));
|
|
38771
38822
|
return;
|
|
38772
38823
|
}
|
|
38773
38824
|
const toProcess = selectCandidates(files, options2);
|
|
38774
38825
|
if (toProcess.length === 0) {
|
|
38775
|
-
console.log(
|
|
38826
|
+
console.log(chalk223.green("All sessions already summarised."));
|
|
38776
38827
|
return;
|
|
38777
38828
|
}
|
|
38778
38829
|
console.log(
|
|
38779
|
-
|
|
38830
|
+
chalk223.cyan(
|
|
38780
38831
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
38781
38832
|
)
|
|
38782
38833
|
);
|
|
38783
38834
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
38784
38835
|
console.log(
|
|
38785
|
-
|
|
38836
|
+
chalk223.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk223.yellow(`, ${failed2} skipped`) : "")
|
|
38786
38837
|
);
|
|
38787
38838
|
}
|
|
38788
38839
|
function selectCandidates(files, options2) {
|
|
@@ -38802,16 +38853,16 @@ function processSessions(files) {
|
|
|
38802
38853
|
let failed2 = 0;
|
|
38803
38854
|
for (let i = 0; i < files.length; i++) {
|
|
38804
38855
|
const file = files[i];
|
|
38805
|
-
process.stdout.write(
|
|
38856
|
+
process.stdout.write(chalk223.dim(` [${i + 1}/${files.length}] `));
|
|
38806
38857
|
const summary = summariseSession(file);
|
|
38807
38858
|
if (summary) {
|
|
38808
38859
|
writeSummary(file, summary);
|
|
38809
38860
|
succeeded++;
|
|
38810
|
-
process.stdout.write(`${
|
|
38861
|
+
process.stdout.write(`${chalk223.green("\u2713")} ${summary}
|
|
38811
38862
|
`);
|
|
38812
38863
|
} else {
|
|
38813
38864
|
failed2++;
|
|
38814
|
-
process.stdout.write(` ${
|
|
38865
|
+
process.stdout.write(` ${chalk223.yellow("skip")}
|
|
38815
38866
|
`);
|
|
38816
38867
|
}
|
|
38817
38868
|
}
|
|
@@ -38832,7 +38883,7 @@ function registerSessions(program2) {
|
|
|
38832
38883
|
}
|
|
38833
38884
|
|
|
38834
38885
|
// src/commands/statusLine.ts
|
|
38835
|
-
import
|
|
38886
|
+
import chalk225 from "chalk";
|
|
38836
38887
|
|
|
38837
38888
|
// src/shared/contextLevel.ts
|
|
38838
38889
|
function contextLevel(pct) {
|
|
@@ -38842,7 +38893,7 @@ function contextLevel(pct) {
|
|
|
38842
38893
|
}
|
|
38843
38894
|
|
|
38844
38895
|
// src/commands/buildLimitsSegment.ts
|
|
38845
|
-
import
|
|
38896
|
+
import chalk224 from "chalk";
|
|
38846
38897
|
|
|
38847
38898
|
// src/shared/rateLimitLevel.ts
|
|
38848
38899
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -38880,9 +38931,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
38880
38931
|
|
|
38881
38932
|
// src/commands/buildLimitsSegment.ts
|
|
38882
38933
|
var LEVEL_COLOR = {
|
|
38883
|
-
ok:
|
|
38884
|
-
warn:
|
|
38885
|
-
over:
|
|
38934
|
+
ok: chalk224.green,
|
|
38935
|
+
warn: chalk224.yellow,
|
|
38936
|
+
over: chalk224.red
|
|
38886
38937
|
};
|
|
38887
38938
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
38888
38939
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -38914,9 +38965,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
38914
38965
|
|
|
38915
38966
|
// src/commands/readGitBranch.ts
|
|
38916
38967
|
import { readFileSync as readFileSync61, statSync as statSync15 } from "fs";
|
|
38917
|
-
import { isAbsolute as isAbsolute5, join as
|
|
38968
|
+
import { isAbsolute as isAbsolute5, join as join96, resolve as resolve23 } from "path";
|
|
38918
38969
|
function resolveGitDir(cwd) {
|
|
38919
|
-
const dotGit =
|
|
38970
|
+
const dotGit = join96(cwd, ".git");
|
|
38920
38971
|
let stat4;
|
|
38921
38972
|
try {
|
|
38922
38973
|
stat4 = statSync15(dotGit);
|
|
@@ -38946,7 +38997,7 @@ function readGitBranch(cwd) {
|
|
|
38946
38997
|
}
|
|
38947
38998
|
let head;
|
|
38948
38999
|
try {
|
|
38949
|
-
head = readFileSync61(
|
|
39000
|
+
head = readFileSync61(join96(gitDir, "HEAD"), "utf8");
|
|
38950
39001
|
} catch {
|
|
38951
39002
|
return null;
|
|
38952
39003
|
}
|
|
@@ -38978,7 +39029,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
38978
39029
|
}
|
|
38979
39030
|
|
|
38980
39031
|
// src/commands/statusLine.ts
|
|
38981
|
-
|
|
39032
|
+
chalk225.level = 3;
|
|
38982
39033
|
function formatNumber(num) {
|
|
38983
39034
|
return num.toLocaleString("en-US");
|
|
38984
39035
|
}
|
|
@@ -38986,9 +39037,9 @@ function colorizePercent(pct) {
|
|
|
38986
39037
|
const label2 = `${Math.round(pct)}%`;
|
|
38987
39038
|
switch (contextLevel(pct)) {
|
|
38988
39039
|
case "red":
|
|
38989
|
-
return
|
|
39040
|
+
return chalk225.red(label2);
|
|
38990
39041
|
case "yellow":
|
|
38991
|
-
return
|
|
39042
|
+
return chalk225.yellow(label2);
|
|
38992
39043
|
default:
|
|
38993
39044
|
return label2;
|
|
38994
39045
|
}
|
|
@@ -39001,7 +39052,7 @@ async function statusLine() {
|
|
|
39001
39052
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
39002
39053
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
39003
39054
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
39004
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
39055
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk225.cyan(branch2)} | ` : "";
|
|
39005
39056
|
console.log(
|
|
39006
39057
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
39007
39058
|
);
|
|
@@ -39071,10 +39122,10 @@ async function update2() {
|
|
|
39071
39122
|
}
|
|
39072
39123
|
|
|
39073
39124
|
// src/reportCliError.ts
|
|
39074
|
-
import
|
|
39125
|
+
import chalk226 from "chalk";
|
|
39075
39126
|
function reportCliError(error) {
|
|
39076
39127
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
39077
|
-
console.error(
|
|
39128
|
+
console.error(chalk226.red(error.message));
|
|
39078
39129
|
} else {
|
|
39079
39130
|
console.error(error);
|
|
39080
39131
|
}
|
|
@@ -39132,6 +39183,7 @@ registerComplexity(program);
|
|
|
39132
39183
|
registerDotnet(program);
|
|
39133
39184
|
registerNews(program);
|
|
39134
39185
|
registerNetcap(program);
|
|
39186
|
+
registerCriteriaExtension(program);
|
|
39135
39187
|
registerRavendb(program);
|
|
39136
39188
|
registerSeq(program);
|
|
39137
39189
|
registerSql(program);
|