@staff0rd/assist 0.43.0 → 0.44.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/claude/CLAUDE.md +1 -1
- package/dist/commands/deploy/{init.ts → init/index.ts} +1 -1
- package/dist/commands/deploy/{updateWorkflow.ts → init/updateWorkflow.ts} +2 -2
- package/dist/commands/lint/{runFileNameCheck.ts → lint/runFileNameCheck.ts} +1 -1
- package/dist/commands/lint/{runImportExtensionCheck.ts → lint/runImportExtensionCheck.ts} +2 -2
- package/dist/commands/lint/{runStaticImportCheck.ts → lint/runStaticImportCheck.ts} +2 -2
- package/dist/index.js +119 -119
- package/package.json +1 -1
- /package/dist/commands/lint/{lint.ts → lint/index.ts} +0 -0
package/claude/CLAUDE.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
After any code change, run `/verify` to ensure all checks pass.
|
|
2
2
|
|
|
3
|
-
The tool is invoked using the `assist` command and is installed globally.
|
|
3
|
+
The tool is invoked using the `assist` command and is installed globally. Use it directly (e.g., `assist commit "message"`). Do NOT try to invoke it via `npx tsx src/index.ts` or guess at the entry point.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execSync } from "node:child_process";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import enquirer from "enquirer";
|
|
4
|
-
import { promptConfirm } from "
|
|
4
|
+
import { promptConfirm } from "../../../shared/promptConfirm";
|
|
5
5
|
import { getExistingSiteId, updateWorkflow } from "./updateWorkflow";
|
|
6
6
|
|
|
7
7
|
export async function init(): Promise<void> {
|
|
@@ -2,8 +2,8 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import chalk from "chalk";
|
|
5
|
-
import { promptConfirm } from "
|
|
6
|
-
import { printDiff } from "
|
|
5
|
+
import { promptConfirm } from "../../../shared/promptConfirm";
|
|
6
|
+
import { printDiff } from "../../../utils/printDiff";
|
|
7
7
|
|
|
8
8
|
const WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
9
9
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
-
import { findSourceFiles } from "
|
|
4
|
+
import { findSourceFiles } from "../../../shared/findSourceFiles";
|
|
5
5
|
|
|
6
6
|
type FileNameViolation = {
|
|
7
7
|
filePath: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import { findSourceFiles } from "
|
|
3
|
-
import { type LintViolation, reportViolations } from "
|
|
2
|
+
import { findSourceFiles } from "../../../shared/findSourceFiles";
|
|
3
|
+
import { type LintViolation, reportViolations } from "../shared";
|
|
4
4
|
|
|
5
5
|
function checkForImportExtensions(filePath: string): LintViolation[] {
|
|
6
6
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import { findSourceFiles } from "
|
|
3
|
-
import { type LintViolation, reportViolations } from "
|
|
2
|
+
import { findSourceFiles } from "../../../shared/findSourceFiles";
|
|
3
|
+
import { type LintViolation, reportViolations } from "../shared";
|
|
4
4
|
|
|
5
5
|
function checkForDynamicImports(filePath: string): LintViolation[] {
|
|
6
6
|
const content = fs.readFileSync(filePath, "utf-8");
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Command } from "commander";
|
|
|
7
7
|
// package.json
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "@staff0rd/assist",
|
|
10
|
-
version: "0.
|
|
10
|
+
version: "0.44.0",
|
|
11
11
|
type: "module",
|
|
12
12
|
main: "dist/index.js",
|
|
13
13
|
bin: {
|
|
@@ -214,7 +214,7 @@ function commit(message) {
|
|
|
214
214
|
// src/commands/complexity/cyclomatic.ts
|
|
215
215
|
import chalk3 from "chalk";
|
|
216
216
|
|
|
217
|
-
// src/commands/complexity/shared.ts
|
|
217
|
+
// src/commands/complexity/shared/index.ts
|
|
218
218
|
import fs2 from "fs";
|
|
219
219
|
import path2 from "path";
|
|
220
220
|
import chalk2 from "chalk";
|
|
@@ -264,7 +264,7 @@ function findSourceFiles(pattern2, baseDir = ".") {
|
|
|
264
264
|
return applyIgnoreGlobs(results.filter((f) => minimatch(f, pattern2)));
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
// src/commands/complexity/getNodeName.ts
|
|
267
|
+
// src/commands/complexity/shared/getNodeName.ts
|
|
268
268
|
import ts from "typescript";
|
|
269
269
|
function getNodeName(node) {
|
|
270
270
|
if (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node)) {
|
|
@@ -308,7 +308,7 @@ function hasFunctionBody(node) {
|
|
|
308
308
|
return false;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
// src/commands/complexity/calculateCyclomaticComplexity.ts
|
|
311
|
+
// src/commands/complexity/shared/calculateCyclomaticComplexity.ts
|
|
312
312
|
import ts2 from "typescript";
|
|
313
313
|
var complexityKinds = /* @__PURE__ */ new Set([
|
|
314
314
|
ts2.SyntaxKind.IfStatement,
|
|
@@ -340,7 +340,7 @@ function calculateCyclomaticComplexity(node) {
|
|
|
340
340
|
return complexity;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
// src/commands/complexity/calculateHalstead.ts
|
|
343
|
+
// src/commands/complexity/shared/calculateHalstead.ts
|
|
344
344
|
import ts3 from "typescript";
|
|
345
345
|
var operatorChecks = [
|
|
346
346
|
(n) => ts3.isBinaryExpression(n) ? n.operatorToken.getText() : void 0,
|
|
@@ -410,7 +410,7 @@ function calculateHalstead(node) {
|
|
|
410
410
|
return computeHalsteadMetrics(operators, operands);
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
// src/commands/complexity/countSloc.ts
|
|
413
|
+
// src/commands/complexity/shared/countSloc.ts
|
|
414
414
|
function countSloc(content) {
|
|
415
415
|
let inMultiLineComment = false;
|
|
416
416
|
let count = 0;
|
|
@@ -447,7 +447,7 @@ function countSloc(content) {
|
|
|
447
447
|
return count;
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
-
// src/commands/complexity/shared.ts
|
|
450
|
+
// src/commands/complexity/shared/index.ts
|
|
451
451
|
function createSourceFromFile(filePath) {
|
|
452
452
|
const content = fs2.readFileSync(filePath, "utf-8");
|
|
453
453
|
return ts4.createSourceFile(
|
|
@@ -716,7 +716,7 @@ function configList() {
|
|
|
716
716
|
console.log(stringifyYaml2(config, { lineWidth: 0 }).trimEnd());
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
-
// src/commands/deploy/init.ts
|
|
719
|
+
// src/commands/deploy/init/index.ts
|
|
720
720
|
import { execSync as execSync2 } from "child_process";
|
|
721
721
|
import chalk10 from "chalk";
|
|
722
722
|
import enquirer2 from "enquirer";
|
|
@@ -738,7 +738,7 @@ async function promptConfirm(message, initial = true) {
|
|
|
738
738
|
return confirmed;
|
|
739
739
|
}
|
|
740
740
|
|
|
741
|
-
// src/commands/deploy/updateWorkflow.ts
|
|
741
|
+
// src/commands/deploy/init/updateWorkflow.ts
|
|
742
742
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
743
743
|
import { dirname, join as join2 } from "path";
|
|
744
744
|
import { fileURLToPath } from "url";
|
|
@@ -773,7 +773,7 @@ function printDiff(oldContent, newContent) {
|
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
|
|
776
|
-
// src/commands/deploy/updateWorkflow.ts
|
|
776
|
+
// src/commands/deploy/init/updateWorkflow.ts
|
|
777
777
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
778
778
|
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
779
779
|
function getExistingSiteId() {
|
|
@@ -815,7 +815,7 @@ async function updateWorkflow(siteId) {
|
|
|
815
815
|
Created ${WORKFLOW_PATH}`));
|
|
816
816
|
}
|
|
817
817
|
|
|
818
|
-
// src/commands/deploy/init.ts
|
|
818
|
+
// src/commands/deploy/init/index.ts
|
|
819
819
|
async function init() {
|
|
820
820
|
console.log(chalk10.bold("Initializing Netlify deployment...\n"));
|
|
821
821
|
const existingSiteId = getExistingSiteId();
|
|
@@ -1216,7 +1216,7 @@ function version() {
|
|
|
1216
1216
|
console.log(`${chalk16.bold("next:")} ${nextVersion ?? chalk16.dim("none")}`);
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
1219
|
-
// src/commands/verify/init.ts
|
|
1219
|
+
// src/commands/verify/init/index.ts
|
|
1220
1220
|
import chalk27 from "chalk";
|
|
1221
1221
|
|
|
1222
1222
|
// src/shared/promptMultiselect.ts
|
|
@@ -1587,7 +1587,7 @@ async function setupTest(packageJsonPath) {
|
|
|
1587
1587
|
);
|
|
1588
1588
|
}
|
|
1589
1589
|
|
|
1590
|
-
// src/commands/verify/needsSetup.ts
|
|
1590
|
+
// src/commands/verify/init/detectExistingSetup/needsSetup.ts
|
|
1591
1591
|
function needsSetup(status) {
|
|
1592
1592
|
return !status.hasScript || !status.hasPackage || status.isOutdated;
|
|
1593
1593
|
}
|
|
@@ -1598,7 +1598,7 @@ function getStatusLabel(status) {
|
|
|
1598
1598
|
return "";
|
|
1599
1599
|
}
|
|
1600
1600
|
|
|
1601
|
-
// src/commands/verify/detectExistingSetup.ts
|
|
1601
|
+
// src/commands/verify/init/detectExistingSetup/index.ts
|
|
1602
1602
|
function isScriptOutdated(pkg, scriptName, expectedCommand) {
|
|
1603
1603
|
const currentScript = pkg.scripts?.[scriptName];
|
|
1604
1604
|
if (!currentScript || !expectedCommand) return false;
|
|
@@ -1662,7 +1662,7 @@ function detectExistingSetup(pkg) {
|
|
|
1662
1662
|
};
|
|
1663
1663
|
}
|
|
1664
1664
|
|
|
1665
|
-
// src/commands/verify/getAvailableOptions.ts
|
|
1665
|
+
// src/commands/verify/init/getAvailableOptions.ts
|
|
1666
1666
|
function getAvailableOptions(setup) {
|
|
1667
1667
|
const options = [];
|
|
1668
1668
|
if (needsSetup(setup.knip)) {
|
|
@@ -1711,7 +1711,7 @@ function getAvailableOptions(setup) {
|
|
|
1711
1711
|
return options;
|
|
1712
1712
|
}
|
|
1713
1713
|
|
|
1714
|
-
// src/commands/verify/init.ts
|
|
1714
|
+
// src/commands/verify/init/index.ts
|
|
1715
1715
|
async function init3() {
|
|
1716
1716
|
const { packageJsonPath, pkg } = requirePackageJson();
|
|
1717
1717
|
const setup = detectExistingSetup(pkg);
|
|
@@ -1759,12 +1759,12 @@ Added ${selected.length} verify script(s):`));
|
|
|
1759
1759
|
console.log(chalk27.dim("\nRun 'assist verify' to run all verify scripts"));
|
|
1760
1760
|
}
|
|
1761
1761
|
|
|
1762
|
-
// src/commands/vscode/init.ts
|
|
1762
|
+
// src/commands/vscode/init/index.ts
|
|
1763
1763
|
import * as fs8 from "fs";
|
|
1764
1764
|
import * as path11 from "path";
|
|
1765
1765
|
import chalk29 from "chalk";
|
|
1766
1766
|
|
|
1767
|
-
// src/commands/vscode/createLaunchJson.ts
|
|
1767
|
+
// src/commands/vscode/init/createLaunchJson.ts
|
|
1768
1768
|
import * as fs7 from "fs";
|
|
1769
1769
|
import * as path10 from "path";
|
|
1770
1770
|
import chalk28 from "chalk";
|
|
@@ -1833,7 +1833,7 @@ function createExtensionsJson() {
|
|
|
1833
1833
|
console.log(chalk28.green("Created .vscode/extensions.json"));
|
|
1834
1834
|
}
|
|
1835
1835
|
|
|
1836
|
-
// src/commands/vscode/init.ts
|
|
1836
|
+
// src/commands/vscode/init/index.ts
|
|
1837
1837
|
function detectExistingSetup2(pkg) {
|
|
1838
1838
|
const vscodeDir = path11.join(process.cwd(), ".vscode");
|
|
1839
1839
|
return {
|
|
@@ -1899,7 +1899,7 @@ async function init5() {
|
|
|
1899
1899
|
await init3();
|
|
1900
1900
|
}
|
|
1901
1901
|
|
|
1902
|
-
// src/commands/lint/runFileNameCheck.ts
|
|
1902
|
+
// src/commands/lint/lint/runFileNameCheck.ts
|
|
1903
1903
|
import fs10 from "fs";
|
|
1904
1904
|
import path13 from "path";
|
|
1905
1905
|
import chalk30 from "chalk";
|
|
@@ -1929,7 +1929,7 @@ function findSourceFiles2(dir, options = {}) {
|
|
|
1929
1929
|
return results;
|
|
1930
1930
|
}
|
|
1931
1931
|
|
|
1932
|
-
// src/commands/lint/runFileNameCheck.ts
|
|
1932
|
+
// src/commands/lint/lint/runFileNameCheck.ts
|
|
1933
1933
|
function hasClassOrComponent(content) {
|
|
1934
1934
|
const classPattern = /^(export\s+)?(abstract\s+)?class\s+\w+/m;
|
|
1935
1935
|
const functionComponentPattern = /^(export\s+)?(default\s+)?function\s+[A-Z]\w*\s*\(/m;
|
|
@@ -1979,7 +1979,7 @@ function runFileNameCheck() {
|
|
|
1979
1979
|
return true;
|
|
1980
1980
|
}
|
|
1981
1981
|
|
|
1982
|
-
// src/commands/lint/runImportExtensionCheck.ts
|
|
1982
|
+
// src/commands/lint/lint/runImportExtensionCheck.ts
|
|
1983
1983
|
import fs11 from "fs";
|
|
1984
1984
|
|
|
1985
1985
|
// src/commands/lint/shared.ts
|
|
@@ -2004,7 +2004,7 @@ ${checkName} failed:
|
|
|
2004
2004
|
return true;
|
|
2005
2005
|
}
|
|
2006
2006
|
|
|
2007
|
-
// src/commands/lint/runImportExtensionCheck.ts
|
|
2007
|
+
// src/commands/lint/lint/runImportExtensionCheck.ts
|
|
2008
2008
|
function checkForImportExtensions(filePath) {
|
|
2009
2009
|
const content = fs11.readFileSync(filePath, "utf-8");
|
|
2010
2010
|
const lines = content.split("\n");
|
|
@@ -2039,7 +2039,7 @@ function runImportExtensionCheck() {
|
|
|
2039
2039
|
);
|
|
2040
2040
|
}
|
|
2041
2041
|
|
|
2042
|
-
// src/commands/lint/runStaticImportCheck.ts
|
|
2042
|
+
// src/commands/lint/lint/runStaticImportCheck.ts
|
|
2043
2043
|
import fs12 from "fs";
|
|
2044
2044
|
function checkForDynamicImports(filePath) {
|
|
2045
2045
|
const content = fs12.readFileSync(filePath, "utf-8");
|
|
@@ -2076,7 +2076,7 @@ function runStaticImportCheck() {
|
|
|
2076
2076
|
);
|
|
2077
2077
|
}
|
|
2078
2078
|
|
|
2079
|
-
// src/commands/lint/lint.ts
|
|
2079
|
+
// src/commands/lint/lint/index.ts
|
|
2080
2080
|
function lint() {
|
|
2081
2081
|
const fileNamePassed = runFileNameCheck();
|
|
2082
2082
|
const staticImportPassed = runStaticImportCheck();
|
|
@@ -2135,7 +2135,7 @@ async function readStdin() {
|
|
|
2135
2135
|
return inputData;
|
|
2136
2136
|
}
|
|
2137
2137
|
|
|
2138
|
-
// src/commands/notify/showNotification.ts
|
|
2138
|
+
// src/commands/notify/showNotification/index.ts
|
|
2139
2139
|
import notifier from "node-notifier";
|
|
2140
2140
|
|
|
2141
2141
|
// src/lib/detectPlatform.ts
|
|
@@ -2154,7 +2154,7 @@ function detectPlatform() {
|
|
|
2154
2154
|
}
|
|
2155
2155
|
}
|
|
2156
2156
|
|
|
2157
|
-
// src/commands/notify/showWindowsNotificationFromWsl.ts
|
|
2157
|
+
// src/commands/notify/showNotification/showWindowsNotificationFromWsl.ts
|
|
2158
2158
|
import { spawn } from "child_process";
|
|
2159
2159
|
import fs13 from "fs";
|
|
2160
2160
|
import { createRequire } from "module";
|
|
@@ -2185,7 +2185,7 @@ function showWindowsNotificationFromWsl(options) {
|
|
|
2185
2185
|
return true;
|
|
2186
2186
|
}
|
|
2187
2187
|
|
|
2188
|
-
// src/commands/notify/showNotification.ts
|
|
2188
|
+
// src/commands/notify/showNotification/index.ts
|
|
2189
2189
|
function showNotification(options) {
|
|
2190
2190
|
const { title, message, sound } = options;
|
|
2191
2191
|
const platform = detectPlatform();
|
|
@@ -2373,7 +2373,7 @@ function fixed(commentId, sha) {
|
|
|
2373
2373
|
}
|
|
2374
2374
|
}
|
|
2375
2375
|
|
|
2376
|
-
// src/commands/prs/listComments.ts
|
|
2376
|
+
// src/commands/prs/listComments/index.ts
|
|
2377
2377
|
import { existsSync as existsSync12, mkdirSync as mkdirSync3, writeFileSync as writeFileSync11 } from "fs";
|
|
2378
2378
|
import { join as join11 } from "path";
|
|
2379
2379
|
import chalk32 from "chalk";
|
|
@@ -2384,10 +2384,41 @@ function isClaudeCode() {
|
|
|
2384
2384
|
return process.env.CLAUDECODE !== void 0;
|
|
2385
2385
|
}
|
|
2386
2386
|
|
|
2387
|
-
// src/commands/prs/
|
|
2387
|
+
// src/commands/prs/fetchThreadIds.ts
|
|
2388
2388
|
import { execSync as execSync13 } from "child_process";
|
|
2389
|
+
import { unlinkSync as unlinkSync3, writeFileSync as writeFileSync10 } from "fs";
|
|
2390
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
2391
|
+
import { join as join10 } from "path";
|
|
2392
|
+
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 } } } } } } }`;
|
|
2393
|
+
function fetchThreadIds(org, repo, prNumber) {
|
|
2394
|
+
const queryFile = join10(tmpdir2(), `gh-query-${Date.now()}.graphql`);
|
|
2395
|
+
writeFileSync10(queryFile, THREAD_QUERY);
|
|
2396
|
+
try {
|
|
2397
|
+
const result = execSync13(
|
|
2398
|
+
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
2399
|
+
{ encoding: "utf-8" }
|
|
2400
|
+
);
|
|
2401
|
+
const response = JSON.parse(result);
|
|
2402
|
+
const threadMap = /* @__PURE__ */ new Map();
|
|
2403
|
+
const resolvedThreadIds = /* @__PURE__ */ new Set();
|
|
2404
|
+
for (const thread of response.data.repository.pullRequest.reviewThreads.nodes) {
|
|
2405
|
+
if (thread.isResolved) {
|
|
2406
|
+
resolvedThreadIds.add(thread.id);
|
|
2407
|
+
}
|
|
2408
|
+
for (const comment of thread.comments.nodes) {
|
|
2409
|
+
threadMap.set(comment.databaseId, thread.id);
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
return { threadMap, resolvedThreadIds };
|
|
2413
|
+
} finally {
|
|
2414
|
+
unlinkSync3(queryFile);
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
2419
|
+
import { execSync as execSync14 } from "child_process";
|
|
2389
2420
|
function fetchReviewComments(org, repo, prNumber) {
|
|
2390
|
-
const result =
|
|
2421
|
+
const result = execSync14(
|
|
2391
2422
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/reviews`,
|
|
2392
2423
|
{ encoding: "utf-8" }
|
|
2393
2424
|
);
|
|
@@ -2404,7 +2435,7 @@ function fetchReviewComments(org, repo, prNumber) {
|
|
|
2404
2435
|
);
|
|
2405
2436
|
}
|
|
2406
2437
|
function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
2407
|
-
const result =
|
|
2438
|
+
const result = execSync14(
|
|
2408
2439
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
2409
2440
|
{ encoding: "utf-8" }
|
|
2410
2441
|
);
|
|
@@ -2429,38 +2460,7 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
2429
2460
|
);
|
|
2430
2461
|
}
|
|
2431
2462
|
|
|
2432
|
-
// src/commands/prs/
|
|
2433
|
-
import { execSync as execSync14 } from "child_process";
|
|
2434
|
-
import { unlinkSync as unlinkSync3, writeFileSync as writeFileSync10 } from "fs";
|
|
2435
|
-
import { tmpdir as tmpdir2 } from "os";
|
|
2436
|
-
import { join as join10 } from "path";
|
|
2437
|
-
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 } } } } } } }`;
|
|
2438
|
-
function fetchThreadIds(org, repo, prNumber) {
|
|
2439
|
-
const queryFile = join10(tmpdir2(), `gh-query-${Date.now()}.graphql`);
|
|
2440
|
-
writeFileSync10(queryFile, THREAD_QUERY);
|
|
2441
|
-
try {
|
|
2442
|
-
const result = execSync14(
|
|
2443
|
-
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
2444
|
-
{ encoding: "utf-8" }
|
|
2445
|
-
);
|
|
2446
|
-
const response = JSON.parse(result);
|
|
2447
|
-
const threadMap = /* @__PURE__ */ new Map();
|
|
2448
|
-
const resolvedThreadIds = /* @__PURE__ */ new Set();
|
|
2449
|
-
for (const thread of response.data.repository.pullRequest.reviewThreads.nodes) {
|
|
2450
|
-
if (thread.isResolved) {
|
|
2451
|
-
resolvedThreadIds.add(thread.id);
|
|
2452
|
-
}
|
|
2453
|
-
for (const comment of thread.comments.nodes) {
|
|
2454
|
-
threadMap.set(comment.databaseId, thread.id);
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
return { threadMap, resolvedThreadIds };
|
|
2458
|
-
} finally {
|
|
2459
|
-
unlinkSync3(queryFile);
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
|
-
// src/commands/prs/listComments.ts
|
|
2463
|
+
// src/commands/prs/listComments/index.ts
|
|
2464
2464
|
function formatForHuman(comment) {
|
|
2465
2465
|
if (comment.type === "review") {
|
|
2466
2466
|
const stateColor = comment.state === "APPROVED" ? chalk32.green : comment.state === "CHANGES_REQUESTED" ? chalk32.red : chalk32.yellow;
|
|
@@ -2539,10 +2539,10 @@ async function listComments() {
|
|
|
2539
2539
|
}
|
|
2540
2540
|
}
|
|
2541
2541
|
|
|
2542
|
-
// src/commands/prs/prs.ts
|
|
2542
|
+
// src/commands/prs/prs/index.ts
|
|
2543
2543
|
import { execSync as execSync15 } from "child_process";
|
|
2544
2544
|
|
|
2545
|
-
// src/commands/prs/displayPaginated.ts
|
|
2545
|
+
// src/commands/prs/prs/displayPaginated.ts
|
|
2546
2546
|
import chalk33 from "chalk";
|
|
2547
2547
|
import enquirer4 from "enquirer";
|
|
2548
2548
|
var PAGE_SIZE = 10;
|
|
@@ -2607,7 +2607,7 @@ async function displayPaginated(pullRequests) {
|
|
|
2607
2607
|
}
|
|
2608
2608
|
}
|
|
2609
2609
|
|
|
2610
|
-
// src/commands/prs/prs.ts
|
|
2610
|
+
// src/commands/prs/prs/index.ts
|
|
2611
2611
|
async function prs(options) {
|
|
2612
2612
|
const state = options.open ? "open" : options.closed ? "closed" : "all";
|
|
2613
2613
|
try {
|
|
@@ -2678,50 +2678,10 @@ function wontfix(commentId, reason) {
|
|
|
2678
2678
|
}
|
|
2679
2679
|
}
|
|
2680
2680
|
|
|
2681
|
-
// src/commands/refactor/check.ts
|
|
2681
|
+
// src/commands/refactor/check/index.ts
|
|
2682
2682
|
import { spawn as spawn2 } from "child_process";
|
|
2683
2683
|
import * as path15 from "path";
|
|
2684
2684
|
|
|
2685
|
-
// src/commands/refactor/getViolations.ts
|
|
2686
|
-
import { execSync as execSync17 } from "child_process";
|
|
2687
|
-
import fs15 from "fs";
|
|
2688
|
-
import { minimatch as minimatch2 } from "minimatch";
|
|
2689
|
-
|
|
2690
|
-
// src/commands/refactor/getIgnoredFiles.ts
|
|
2691
|
-
import fs14 from "fs";
|
|
2692
|
-
var REFACTOR_YML_PATH = "refactor.yml";
|
|
2693
|
-
function parseRefactorYml() {
|
|
2694
|
-
if (!fs14.existsSync(REFACTOR_YML_PATH)) {
|
|
2695
|
-
return [];
|
|
2696
|
-
}
|
|
2697
|
-
const content = fs14.readFileSync(REFACTOR_YML_PATH, "utf-8");
|
|
2698
|
-
const entries = [];
|
|
2699
|
-
const lines = content.split("\n");
|
|
2700
|
-
let currentEntry = {};
|
|
2701
|
-
for (const line of lines) {
|
|
2702
|
-
const trimmed = line.trim();
|
|
2703
|
-
if (trimmed.startsWith("- file:")) {
|
|
2704
|
-
if (currentEntry.file) {
|
|
2705
|
-
entries.push(currentEntry);
|
|
2706
|
-
}
|
|
2707
|
-
currentEntry = { file: trimmed.replace("- file:", "").trim() };
|
|
2708
|
-
} else if (trimmed.startsWith("maxLines:")) {
|
|
2709
|
-
currentEntry.maxLines = parseInt(
|
|
2710
|
-
trimmed.replace("maxLines:", "").trim(),
|
|
2711
|
-
10
|
|
2712
|
-
);
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
if (currentEntry.file) {
|
|
2716
|
-
entries.push(currentEntry);
|
|
2717
|
-
}
|
|
2718
|
-
return entries;
|
|
2719
|
-
}
|
|
2720
|
-
function getIgnoredFiles() {
|
|
2721
|
-
const entries = parseRefactorYml();
|
|
2722
|
-
return new Map(entries.map((e) => [e.file, e.maxLines]));
|
|
2723
|
-
}
|
|
2724
|
-
|
|
2725
2685
|
// src/commands/refactor/logViolations.ts
|
|
2726
2686
|
import chalk34 from "chalk";
|
|
2727
2687
|
var DEFAULT_MAX_LINES = 100;
|
|
@@ -2777,7 +2737,47 @@ Refactor check failed:
|
|
|
2777
2737
|
}
|
|
2778
2738
|
}
|
|
2779
2739
|
|
|
2780
|
-
// src/commands/refactor/getViolations.ts
|
|
2740
|
+
// src/commands/refactor/check/getViolations/index.ts
|
|
2741
|
+
import { execSync as execSync17 } from "child_process";
|
|
2742
|
+
import fs15 from "fs";
|
|
2743
|
+
import { minimatch as minimatch2 } from "minimatch";
|
|
2744
|
+
|
|
2745
|
+
// src/commands/refactor/check/getViolations/getIgnoredFiles.ts
|
|
2746
|
+
import fs14 from "fs";
|
|
2747
|
+
var REFACTOR_YML_PATH = "refactor.yml";
|
|
2748
|
+
function parseRefactorYml() {
|
|
2749
|
+
if (!fs14.existsSync(REFACTOR_YML_PATH)) {
|
|
2750
|
+
return [];
|
|
2751
|
+
}
|
|
2752
|
+
const content = fs14.readFileSync(REFACTOR_YML_PATH, "utf-8");
|
|
2753
|
+
const entries = [];
|
|
2754
|
+
const lines = content.split("\n");
|
|
2755
|
+
let currentEntry = {};
|
|
2756
|
+
for (const line of lines) {
|
|
2757
|
+
const trimmed = line.trim();
|
|
2758
|
+
if (trimmed.startsWith("- file:")) {
|
|
2759
|
+
if (currentEntry.file) {
|
|
2760
|
+
entries.push(currentEntry);
|
|
2761
|
+
}
|
|
2762
|
+
currentEntry = { file: trimmed.replace("- file:", "").trim() };
|
|
2763
|
+
} else if (trimmed.startsWith("maxLines:")) {
|
|
2764
|
+
currentEntry.maxLines = parseInt(
|
|
2765
|
+
trimmed.replace("maxLines:", "").trim(),
|
|
2766
|
+
10
|
|
2767
|
+
);
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
if (currentEntry.file) {
|
|
2771
|
+
entries.push(currentEntry);
|
|
2772
|
+
}
|
|
2773
|
+
return entries;
|
|
2774
|
+
}
|
|
2775
|
+
function getIgnoredFiles() {
|
|
2776
|
+
const entries = parseRefactorYml();
|
|
2777
|
+
return new Map(entries.map((e) => [e.file, e.maxLines]));
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
// src/commands/refactor/check/getViolations/index.ts
|
|
2781
2781
|
function countLines(filePath) {
|
|
2782
2782
|
const content = fs15.readFileSync(filePath, "utf-8");
|
|
2783
2783
|
return content.split("\n").length;
|
|
@@ -2824,7 +2824,7 @@ function getViolations(pattern2, options = {}, maxLines = DEFAULT_MAX_LINES) {
|
|
|
2824
2824
|
return violations;
|
|
2825
2825
|
}
|
|
2826
2826
|
|
|
2827
|
-
// src/commands/refactor/check.ts
|
|
2827
|
+
// src/commands/refactor/check/index.ts
|
|
2828
2828
|
async function runVerifyQuietly() {
|
|
2829
2829
|
const result = findPackageJsonWithVerifyScripts(process.cwd());
|
|
2830
2830
|
if (!result) {
|
|
@@ -3615,7 +3615,7 @@ async function configure() {
|
|
|
3615
3615
|
}
|
|
3616
3616
|
}
|
|
3617
3617
|
|
|
3618
|
-
// src/commands/transcript/format.ts
|
|
3618
|
+
// src/commands/transcript/format/index.ts
|
|
3619
3619
|
import { existsSync as existsSync16, mkdirSync as mkdirSync5, readFileSync as readFileSync14, writeFileSync as writeFileSync12 } from "fs";
|
|
3620
3620
|
import { basename as basename4, dirname as dirname11, join as join17 } from "path";
|
|
3621
3621
|
|
|
@@ -3640,7 +3640,7 @@ function cleanText(text) {
|
|
|
3640
3640
|
return cleaned.join(" ").replace(/\s+/g, " ").trim();
|
|
3641
3641
|
}
|
|
3642
3642
|
|
|
3643
|
-
// src/commands/transcript/deduplicateCues.ts
|
|
3643
|
+
// src/commands/transcript/format/parseVtt/deduplicateCues.ts
|
|
3644
3644
|
function removeSubstringDuplicates(cues) {
|
|
3645
3645
|
const toRemove = /* @__PURE__ */ new Set();
|
|
3646
3646
|
for (let i = 0; i < cues.length; i++) {
|
|
@@ -3709,7 +3709,7 @@ function deduplicateCues(cues) {
|
|
|
3709
3709
|
}));
|
|
3710
3710
|
}
|
|
3711
3711
|
|
|
3712
|
-
// src/commands/transcript/parseVtt.ts
|
|
3712
|
+
// src/commands/transcript/format/parseVtt/index.ts
|
|
3713
3713
|
function parseTimestamp(ts6) {
|
|
3714
3714
|
const parts = ts6.split(":");
|
|
3715
3715
|
let hours = 0;
|
|
@@ -3762,7 +3762,7 @@ function parseVtt(content) {
|
|
|
3762
3762
|
return cues;
|
|
3763
3763
|
}
|
|
3764
3764
|
|
|
3765
|
-
// src/commands/transcript/formatChatLog.ts
|
|
3765
|
+
// src/commands/transcript/format/formatChatLog.ts
|
|
3766
3766
|
function cuesToChatMessages(cues) {
|
|
3767
3767
|
const messages = [];
|
|
3768
3768
|
for (const cue of cues) {
|
|
@@ -3783,7 +3783,7 @@ function formatChatLog(messages) {
|
|
|
3783
3783
|
return messages.map((msg) => `${msg.speaker}: ${msg.text}`).join("\n\n");
|
|
3784
3784
|
}
|
|
3785
3785
|
|
|
3786
|
-
// src/commands/transcript/promptForDateFix.ts
|
|
3786
|
+
// src/commands/transcript/format/promptForDateFix.ts
|
|
3787
3787
|
import { renameSync } from "fs";
|
|
3788
3788
|
import { join as join16 } from "path";
|
|
3789
3789
|
async function promptForDateFix(vttFile, vttDir) {
|
|
@@ -3839,7 +3839,7 @@ Error: File "${vttFile}" does not start with YYYY-MM-DD format.`
|
|
|
3839
3839
|
}
|
|
3840
3840
|
}
|
|
3841
3841
|
|
|
3842
|
-
// src/commands/transcript/format.ts
|
|
3842
|
+
// src/commands/transcript/format/index.ts
|
|
3843
3843
|
function processFile(inputPath, outputPath) {
|
|
3844
3844
|
console.log(`Reading: ${inputPath}`);
|
|
3845
3845
|
const content = readFileSync14(inputPath, "utf-8");
|
|
@@ -3923,11 +3923,11 @@ async function format() {
|
|
|
3923
3923
|
Summary: ${processed} processed, ${skipped} skipped`);
|
|
3924
3924
|
}
|
|
3925
3925
|
|
|
3926
|
-
// src/commands/transcript/summarise.ts
|
|
3926
|
+
// src/commands/transcript/summarise/index.ts
|
|
3927
3927
|
import { existsSync as existsSync18 } from "fs";
|
|
3928
3928
|
import { basename as basename5, dirname as dirname13, join as join19, relative as relative2 } from "path";
|
|
3929
3929
|
|
|
3930
|
-
// src/commands/transcript/processStagedFile.ts
|
|
3930
|
+
// src/commands/transcript/summarise/processStagedFile.ts
|
|
3931
3931
|
import {
|
|
3932
3932
|
existsSync as existsSync17,
|
|
3933
3933
|
mkdirSync as mkdirSync6,
|
|
@@ -3996,7 +3996,7 @@ function processStagedFile() {
|
|
|
3996
3996
|
return true;
|
|
3997
3997
|
}
|
|
3998
3998
|
|
|
3999
|
-
// src/commands/transcript/summarise.ts
|
|
3999
|
+
// src/commands/transcript/summarise/index.ts
|
|
4000
4000
|
function summarise() {
|
|
4001
4001
|
processStagedFile();
|
|
4002
4002
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
package/package.json
CHANGED
|
File without changes
|