@staff0rd/assist 0.105.0 → 0.106.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +107 -86
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.106.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -129,9 +129,7 @@ var assistConfigSchema = z.strictObject({
|
|
|
129
129
|
devlog: z.strictObject({
|
|
130
130
|
name: z.string().optional(),
|
|
131
131
|
ignore: z.array(z.string()).optional(),
|
|
132
|
-
skip: z.
|
|
133
|
-
days: z.array(z.string()).optional()
|
|
134
|
-
}).optional()
|
|
132
|
+
skip: z.record(z.string(), z.array(z.string())).optional()
|
|
135
133
|
}).optional(),
|
|
136
134
|
notify: z.strictObject({
|
|
137
135
|
enabled: z.boolean().default(true)
|
|
@@ -3717,15 +3715,25 @@ function registerDeploy(program2) {
|
|
|
3717
3715
|
import { execSync as execSync16 } from "child_process";
|
|
3718
3716
|
import { basename as basename3 } from "path";
|
|
3719
3717
|
|
|
3718
|
+
// src/commands/devlog/loadBlogSkipDays.ts
|
|
3719
|
+
import { homedir as homedir5 } from "os";
|
|
3720
|
+
import { join as join13 } from "path";
|
|
3721
|
+
var BLOG_REPO_ROOT = join13(homedir5(), "git/blog");
|
|
3722
|
+
function loadBlogSkipDays(repoName) {
|
|
3723
|
+
const config = loadRawYaml(join13(BLOG_REPO_ROOT, "assist.yml"));
|
|
3724
|
+
const devlog = config.devlog;
|
|
3725
|
+
const skip2 = devlog?.skip;
|
|
3726
|
+
return new Set(skip2?.[repoName] ?? []);
|
|
3727
|
+
}
|
|
3728
|
+
|
|
3720
3729
|
// src/commands/devlog/shared.ts
|
|
3721
3730
|
import { execSync as execSync15 } from "child_process";
|
|
3722
3731
|
import chalk38 from "chalk";
|
|
3723
3732
|
|
|
3724
3733
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
3725
3734
|
import { readdirSync, readFileSync as readFileSync17 } from "fs";
|
|
3726
|
-
import {
|
|
3727
|
-
|
|
3728
|
-
var DEVLOG_DIR = join13(homedir5(), "git/blog/src/content/devlog");
|
|
3735
|
+
import { join as join14 } from "path";
|
|
3736
|
+
var DEVLOG_DIR = join14(BLOG_REPO_ROOT, "src/content/devlog");
|
|
3729
3737
|
function extractFrontmatter(content) {
|
|
3730
3738
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
3731
3739
|
return fm?.[1] ?? null;
|
|
@@ -3753,7 +3761,7 @@ function readDevlogFiles(callback) {
|
|
|
3753
3761
|
try {
|
|
3754
3762
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
3755
3763
|
for (const file of files) {
|
|
3756
|
-
const content = readFileSync17(
|
|
3764
|
+
const content = readFileSync17(join14(DEVLOG_DIR, file), "utf-8");
|
|
3757
3765
|
const parsed = parseFrontmatter(content, file);
|
|
3758
3766
|
if (parsed) callback(parsed);
|
|
3759
3767
|
}
|
|
@@ -3855,8 +3863,8 @@ function list3(options2) {
|
|
|
3855
3863
|
const config = loadConfig();
|
|
3856
3864
|
const days = options2.days ?? 30;
|
|
3857
3865
|
const ignore2 = options2.ignore ?? config.devlog?.ignore ?? [];
|
|
3858
|
-
const skipDays = new Set(config.devlog?.skip?.days ?? []);
|
|
3859
3866
|
const repoName = basename3(process.cwd());
|
|
3867
|
+
const skipDays = loadBlogSkipDays(repoName);
|
|
3860
3868
|
const devlogEntries = loadDevlogEntries(repoName);
|
|
3861
3869
|
const reverseFlag = options2.reverse ? "--reverse " : "";
|
|
3862
3870
|
const limitFlag = options2.reverse ? "" : "-n 500 ";
|
|
@@ -4000,8 +4008,8 @@ function printVersionInfo(config, lastInfo, firstHash) {
|
|
|
4000
4008
|
function resolveIgnoreList(options2, config) {
|
|
4001
4009
|
return options2.ignore ?? config.devlog?.ignore ?? [];
|
|
4002
4010
|
}
|
|
4003
|
-
function resolveSkipDays(
|
|
4004
|
-
return
|
|
4011
|
+
function resolveSkipDays(repoName) {
|
|
4012
|
+
return loadBlogSkipDays(repoName);
|
|
4005
4013
|
}
|
|
4006
4014
|
function getLastDate(lastInfo) {
|
|
4007
4015
|
return lastInfo?.date ?? null;
|
|
@@ -4041,7 +4049,10 @@ function fetchNextCommits(ctx) {
|
|
|
4041
4049
|
ctx.ignore,
|
|
4042
4050
|
getLastDate(ctx.lastInfo)
|
|
4043
4051
|
);
|
|
4044
|
-
const targetDate = findTargetDate(
|
|
4052
|
+
const targetDate = findTargetDate(
|
|
4053
|
+
commitsByDate,
|
|
4054
|
+
resolveSkipDays(ctx.repoName)
|
|
4055
|
+
);
|
|
4045
4056
|
return targetDate ? { targetDate, commits: getCommitsForDate(commitsByDate, targetDate) } : null;
|
|
4046
4057
|
}
|
|
4047
4058
|
function showResult(ctx, found) {
|
|
@@ -4135,27 +4146,37 @@ function repos(options2) {
|
|
|
4135
4146
|
}
|
|
4136
4147
|
|
|
4137
4148
|
// src/commands/devlog/skip.ts
|
|
4149
|
+
import { writeFileSync as writeFileSync15 } from "fs";
|
|
4150
|
+
import { join as join15 } from "path";
|
|
4138
4151
|
import chalk43 from "chalk";
|
|
4152
|
+
import { stringify as stringifyYaml4 } from "yaml";
|
|
4153
|
+
function getBlogConfigPath() {
|
|
4154
|
+
return join15(BLOG_REPO_ROOT, "assist.yml");
|
|
4155
|
+
}
|
|
4139
4156
|
function skip(date) {
|
|
4140
4157
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
4141
4158
|
console.log(chalk43.red("Invalid date format. Use YYYY-MM-DD"));
|
|
4142
4159
|
process.exit(1);
|
|
4143
4160
|
}
|
|
4144
|
-
const
|
|
4161
|
+
const repoName = getRepoName();
|
|
4162
|
+
const configPath = getBlogConfigPath();
|
|
4163
|
+
const config = loadRawYaml(configPath);
|
|
4145
4164
|
const devlog = config.devlog ?? {};
|
|
4146
4165
|
const skip2 = devlog.skip ?? {};
|
|
4147
|
-
const skipDays = skip2
|
|
4166
|
+
const skipDays = skip2[repoName] ?? [];
|
|
4148
4167
|
if (skipDays.includes(date)) {
|
|
4149
|
-
console.log(
|
|
4168
|
+
console.log(
|
|
4169
|
+
chalk43.yellow(`${date} is already in skip list for ${repoName}`)
|
|
4170
|
+
);
|
|
4150
4171
|
return;
|
|
4151
4172
|
}
|
|
4152
4173
|
skipDays.push(date);
|
|
4153
4174
|
skipDays.sort();
|
|
4154
|
-
skip2
|
|
4175
|
+
skip2[repoName] = skipDays;
|
|
4155
4176
|
devlog.skip = skip2;
|
|
4156
4177
|
config.devlog = devlog;
|
|
4157
|
-
|
|
4158
|
-
console.log(chalk43.green(`Added ${date} to skip list`));
|
|
4178
|
+
writeFileSync15(configPath, stringifyYaml4(config, { lineWidth: 0 }));
|
|
4179
|
+
console.log(chalk43.green(`Added ${date} to skip list for ${repoName}`));
|
|
4159
4180
|
}
|
|
4160
4181
|
|
|
4161
4182
|
// src/commands/devlog/version.ts
|
|
@@ -4404,9 +4425,9 @@ function registerNetframework(program2) {
|
|
|
4404
4425
|
|
|
4405
4426
|
// src/commands/prs/comment.ts
|
|
4406
4427
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
4407
|
-
import { unlinkSync as unlinkSync3, writeFileSync as
|
|
4428
|
+
import { unlinkSync as unlinkSync3, writeFileSync as writeFileSync16 } from "fs";
|
|
4408
4429
|
import { tmpdir as tmpdir2 } from "os";
|
|
4409
|
-
import { join as
|
|
4430
|
+
import { join as join16 } from "path";
|
|
4410
4431
|
|
|
4411
4432
|
// src/commands/prs/shared.ts
|
|
4412
4433
|
import { execSync as execSync20 } from "child_process";
|
|
@@ -4478,8 +4499,8 @@ function comment(path35, line, body) {
|
|
|
4478
4499
|
validateLine(line);
|
|
4479
4500
|
try {
|
|
4480
4501
|
const prId = getCurrentPrNodeId();
|
|
4481
|
-
const queryFile =
|
|
4482
|
-
|
|
4502
|
+
const queryFile = join16(tmpdir2(), `gh-query-${Date.now()}.graphql`);
|
|
4503
|
+
writeFileSync16(queryFile, MUTATION);
|
|
4483
4504
|
try {
|
|
4484
4505
|
const result = spawnSync2(
|
|
4485
4506
|
"gh",
|
|
@@ -4521,16 +4542,16 @@ import { execSync as execSync22 } from "child_process";
|
|
|
4521
4542
|
|
|
4522
4543
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
4523
4544
|
import { execSync as execSync21 } from "child_process";
|
|
4524
|
-
import { unlinkSync as unlinkSync5, writeFileSync as
|
|
4545
|
+
import { unlinkSync as unlinkSync5, writeFileSync as writeFileSync17 } from "fs";
|
|
4525
4546
|
import { tmpdir as tmpdir3 } from "os";
|
|
4526
|
-
import { join as
|
|
4547
|
+
import { join as join18 } from "path";
|
|
4527
4548
|
|
|
4528
4549
|
// src/commands/prs/loadCommentsCache.ts
|
|
4529
4550
|
import { existsSync as existsSync22, readFileSync as readFileSync20, unlinkSync as unlinkSync4 } from "fs";
|
|
4530
|
-
import { join as
|
|
4551
|
+
import { join as join17 } from "path";
|
|
4531
4552
|
import { parse as parse2 } from "yaml";
|
|
4532
4553
|
function getCachePath(prNumber) {
|
|
4533
|
-
return
|
|
4554
|
+
return join17(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`);
|
|
4534
4555
|
}
|
|
4535
4556
|
function loadCommentsCache(prNumber) {
|
|
4536
4557
|
const cachePath = getCachePath(prNumber);
|
|
@@ -4552,17 +4573,17 @@ function deleteCommentsCache(prNumber) {
|
|
|
4552
4573
|
function replyToComment(org, repo, prNumber, commentId, message) {
|
|
4553
4574
|
execSync21(
|
|
4554
4575
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, '\\"')}" -F in_reply_to=${commentId}`,
|
|
4555
|
-
{ stdio: "inherit" }
|
|
4576
|
+
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
4556
4577
|
);
|
|
4557
4578
|
}
|
|
4558
4579
|
function resolveThread(threadId) {
|
|
4559
4580
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
4560
|
-
const queryFile =
|
|
4561
|
-
|
|
4581
|
+
const queryFile = join18(tmpdir3(), `gh-mutation-${Date.now()}.graphql`);
|
|
4582
|
+
writeFileSync17(queryFile, mutation);
|
|
4562
4583
|
try {
|
|
4563
4584
|
execSync21(
|
|
4564
4585
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
4565
|
-
{ stdio: "inherit" }
|
|
4586
|
+
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
4566
4587
|
);
|
|
4567
4588
|
} finally {
|
|
4568
4589
|
unlinkSync5(queryFile);
|
|
@@ -4638,19 +4659,19 @@ function fixed(commentId, sha) {
|
|
|
4638
4659
|
}
|
|
4639
4660
|
|
|
4640
4661
|
// src/commands/prs/listComments/index.ts
|
|
4641
|
-
import { existsSync as existsSync23, mkdirSync as mkdirSync5, writeFileSync as
|
|
4642
|
-
import { join as
|
|
4662
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync5, writeFileSync as writeFileSync19 } from "fs";
|
|
4663
|
+
import { join as join20 } from "path";
|
|
4643
4664
|
import { stringify } from "yaml";
|
|
4644
4665
|
|
|
4645
4666
|
// src/commands/prs/fetchThreadIds.ts
|
|
4646
4667
|
import { execSync as execSync23 } from "child_process";
|
|
4647
|
-
import { unlinkSync as unlinkSync6, writeFileSync as
|
|
4668
|
+
import { unlinkSync as unlinkSync6, writeFileSync as writeFileSync18 } from "fs";
|
|
4648
4669
|
import { tmpdir as tmpdir4 } from "os";
|
|
4649
|
-
import { join as
|
|
4670
|
+
import { join as join19 } from "path";
|
|
4650
4671
|
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 } } } } } } }`;
|
|
4651
4672
|
function fetchThreadIds(org, repo, prNumber) {
|
|
4652
|
-
const queryFile =
|
|
4653
|
-
|
|
4673
|
+
const queryFile = join19(tmpdir4(), `gh-query-${Date.now()}.graphql`);
|
|
4674
|
+
writeFileSync18(queryFile, THREAD_QUERY);
|
|
4654
4675
|
try {
|
|
4655
4676
|
const result = execSync23(
|
|
4656
4677
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
@@ -4763,7 +4784,7 @@ function printComments(result) {
|
|
|
4763
4784
|
|
|
4764
4785
|
// src/commands/prs/listComments/index.ts
|
|
4765
4786
|
function writeCommentsCache(prNumber, comments) {
|
|
4766
|
-
const assistDir =
|
|
4787
|
+
const assistDir = join20(process.cwd(), ".assist");
|
|
4767
4788
|
if (!existsSync23(assistDir)) {
|
|
4768
4789
|
mkdirSync5(assistDir, { recursive: true });
|
|
4769
4790
|
}
|
|
@@ -4772,8 +4793,8 @@ function writeCommentsCache(prNumber, comments) {
|
|
|
4772
4793
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4773
4794
|
comments
|
|
4774
4795
|
};
|
|
4775
|
-
const cachePath =
|
|
4776
|
-
|
|
4796
|
+
const cachePath = join20(assistDir, `pr-${prNumber}-comments.yaml`);
|
|
4797
|
+
writeFileSync19(cachePath, stringify(cacheData));
|
|
4777
4798
|
}
|
|
4778
4799
|
function handleKnownErrors(error) {
|
|
4779
4800
|
if (isGhNotInstalled(error)) {
|
|
@@ -4805,7 +4826,7 @@ async function listComments() {
|
|
|
4805
4826
|
];
|
|
4806
4827
|
updateCache(prNumber, allComments);
|
|
4807
4828
|
const hasLineComments = allComments.some((c) => c.type === "line");
|
|
4808
|
-
const cachePath = hasLineComments ?
|
|
4829
|
+
const cachePath = hasLineComments ? join20(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`) : null;
|
|
4809
4830
|
return { comments: allComments, cachePath };
|
|
4810
4831
|
} catch (error) {
|
|
4811
4832
|
const handled = handleKnownErrors(error);
|
|
@@ -5740,7 +5761,7 @@ function registerRefactor(program2) {
|
|
|
5740
5761
|
|
|
5741
5762
|
// src/commands/transcript/shared.ts
|
|
5742
5763
|
import { existsSync as existsSync24, readdirSync as readdirSync3, statSync as statSync2 } from "fs";
|
|
5743
|
-
import { basename as basename4, join as
|
|
5764
|
+
import { basename as basename4, join as join21, relative } from "path";
|
|
5744
5765
|
import * as readline2 from "readline";
|
|
5745
5766
|
var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
|
|
5746
5767
|
function getDatePrefix(daysOffset = 0) {
|
|
@@ -5758,7 +5779,7 @@ function collectFiles(dir, extension) {
|
|
|
5758
5779
|
if (!existsSync24(dir)) return [];
|
|
5759
5780
|
const results = [];
|
|
5760
5781
|
for (const entry of readdirSync3(dir)) {
|
|
5761
|
-
const fullPath =
|
|
5782
|
+
const fullPath = join21(dir, entry);
|
|
5762
5783
|
if (statSync2(fullPath).isDirectory()) {
|
|
5763
5784
|
results.push(...collectFiles(fullPath, extension));
|
|
5764
5785
|
} else if (entry.endsWith(extension)) {
|
|
@@ -5855,11 +5876,11 @@ async function configure() {
|
|
|
5855
5876
|
import { existsSync as existsSync26 } from "fs";
|
|
5856
5877
|
|
|
5857
5878
|
// src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
|
|
5858
|
-
import { dirname as dirname15, join as
|
|
5879
|
+
import { dirname as dirname15, join as join23 } from "path";
|
|
5859
5880
|
|
|
5860
5881
|
// src/commands/transcript/format/fixInvalidDatePrefixes/promptForDateFix.ts
|
|
5861
5882
|
import { renameSync } from "fs";
|
|
5862
|
-
import { join as
|
|
5883
|
+
import { join as join22 } from "path";
|
|
5863
5884
|
async function resolveDate(rl, choice) {
|
|
5864
5885
|
if (choice === "1") return getDatePrefix(0);
|
|
5865
5886
|
if (choice === "2") return getDatePrefix(-1);
|
|
@@ -5874,7 +5895,7 @@ async function resolveDate(rl, choice) {
|
|
|
5874
5895
|
}
|
|
5875
5896
|
function renameWithPrefix(vttDir, vttFile, prefix2) {
|
|
5876
5897
|
const newFilename = `${prefix2}.${vttFile}`;
|
|
5877
|
-
renameSync(
|
|
5898
|
+
renameSync(join22(vttDir, vttFile), join22(vttDir, newFilename));
|
|
5878
5899
|
console.log(`Renamed to: ${newFilename}`);
|
|
5879
5900
|
return newFilename;
|
|
5880
5901
|
}
|
|
@@ -5908,12 +5929,12 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
5908
5929
|
const vttFileDir = dirname15(vttFile.absolutePath);
|
|
5909
5930
|
const newFilename = await promptForDateFix(vttFile.filename, vttFileDir);
|
|
5910
5931
|
if (newFilename) {
|
|
5911
|
-
const newRelativePath =
|
|
5932
|
+
const newRelativePath = join23(
|
|
5912
5933
|
dirname15(vttFile.relativePath),
|
|
5913
5934
|
newFilename
|
|
5914
5935
|
);
|
|
5915
5936
|
vttFiles[i] = {
|
|
5916
|
-
absolutePath:
|
|
5937
|
+
absolutePath: join23(vttFileDir, newFilename),
|
|
5917
5938
|
relativePath: newRelativePath,
|
|
5918
5939
|
filename: newFilename
|
|
5919
5940
|
};
|
|
@@ -5926,8 +5947,8 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
5926
5947
|
}
|
|
5927
5948
|
|
|
5928
5949
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
5929
|
-
import { existsSync as existsSync25, mkdirSync as mkdirSync6, readFileSync as readFileSync21, writeFileSync as
|
|
5930
|
-
import { basename as basename5, dirname as dirname16, join as
|
|
5950
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync6, readFileSync as readFileSync21, writeFileSync as writeFileSync20 } from "fs";
|
|
5951
|
+
import { basename as basename5, dirname as dirname16, join as join24 } from "path";
|
|
5931
5952
|
|
|
5932
5953
|
// src/commands/transcript/cleanText.ts
|
|
5933
5954
|
function cleanText(text) {
|
|
@@ -6137,17 +6158,17 @@ function toMdFilename(vttFilename) {
|
|
|
6137
6158
|
return `${basename5(vttFilename, ".vtt").replace(/\s*Transcription\s*/g, " ").trim()}.md`;
|
|
6138
6159
|
}
|
|
6139
6160
|
function resolveOutputDir(relativeDir, transcriptsDir) {
|
|
6140
|
-
return relativeDir === "." ? transcriptsDir :
|
|
6161
|
+
return relativeDir === "." ? transcriptsDir : join24(transcriptsDir, relativeDir);
|
|
6141
6162
|
}
|
|
6142
6163
|
function buildOutputPaths(vttFile, transcriptsDir) {
|
|
6143
6164
|
const mdFile = toMdFilename(vttFile.filename);
|
|
6144
6165
|
const relativeDir = dirname16(vttFile.relativePath);
|
|
6145
6166
|
const outputDir = resolveOutputDir(relativeDir, transcriptsDir);
|
|
6146
|
-
const outputPath =
|
|
6167
|
+
const outputPath = join24(outputDir, mdFile);
|
|
6147
6168
|
return { outputDir, outputPath, mdFile, relativeDir };
|
|
6148
6169
|
}
|
|
6149
6170
|
function logSkipped(relativeDir, mdFile) {
|
|
6150
|
-
console.log(`Skipping (already exists): ${
|
|
6171
|
+
console.log(`Skipping (already exists): ${join24(relativeDir, mdFile)}`);
|
|
6151
6172
|
return "skipped";
|
|
6152
6173
|
}
|
|
6153
6174
|
function ensureDirectory(dir, label2) {
|
|
@@ -6177,7 +6198,7 @@ function readAndParseCues(inputPath) {
|
|
|
6177
6198
|
return processCues(readFileSync21(inputPath, "utf-8"));
|
|
6178
6199
|
}
|
|
6179
6200
|
function writeFormatted(outputPath, content) {
|
|
6180
|
-
|
|
6201
|
+
writeFileSync20(outputPath, content, "utf-8");
|
|
6181
6202
|
console.log(`Written: ${outputPath}`);
|
|
6182
6203
|
}
|
|
6183
6204
|
function convertVttToMarkdown(inputPath, outputPath) {
|
|
@@ -6246,7 +6267,7 @@ async function format() {
|
|
|
6246
6267
|
|
|
6247
6268
|
// src/commands/transcript/summarise/index.ts
|
|
6248
6269
|
import { existsSync as existsSync28 } from "fs";
|
|
6249
|
-
import { basename as basename6, dirname as dirname18, join as
|
|
6270
|
+
import { basename as basename6, dirname as dirname18, join as join26, relative as relative2 } from "path";
|
|
6250
6271
|
|
|
6251
6272
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
6252
6273
|
import {
|
|
@@ -6256,7 +6277,7 @@ import {
|
|
|
6256
6277
|
renameSync as renameSync2,
|
|
6257
6278
|
rmSync
|
|
6258
6279
|
} from "fs";
|
|
6259
|
-
import { dirname as dirname17, join as
|
|
6280
|
+
import { dirname as dirname17, join as join25 } from "path";
|
|
6260
6281
|
|
|
6261
6282
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
6262
6283
|
import chalk55 from "chalk";
|
|
@@ -6285,7 +6306,7 @@ function validateStagedContent(filename, content) {
|
|
|
6285
6306
|
}
|
|
6286
6307
|
|
|
6287
6308
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
6288
|
-
var STAGING_DIR =
|
|
6309
|
+
var STAGING_DIR = join25(process.cwd(), ".assist", "transcript");
|
|
6289
6310
|
function processStagedFile() {
|
|
6290
6311
|
if (!existsSync27(STAGING_DIR)) {
|
|
6291
6312
|
return false;
|
|
@@ -6309,7 +6330,7 @@ function processStagedFile() {
|
|
|
6309
6330
|
);
|
|
6310
6331
|
process.exit(1);
|
|
6311
6332
|
}
|
|
6312
|
-
const destPath =
|
|
6333
|
+
const destPath = join25(summaryDir, matchingTranscript.relativePath);
|
|
6313
6334
|
const destDir = dirname17(destPath);
|
|
6314
6335
|
if (!existsSync27(destDir)) {
|
|
6315
6336
|
mkdirSync7(destDir, { recursive: true });
|
|
@@ -6325,7 +6346,7 @@ function processStagedFile() {
|
|
|
6325
6346
|
// src/commands/transcript/summarise/index.ts
|
|
6326
6347
|
function buildRelativeKey(relativePath, baseName) {
|
|
6327
6348
|
const relDir = dirname18(relativePath);
|
|
6328
|
-
return relDir === "." ? baseName :
|
|
6349
|
+
return relDir === "." ? baseName : join26(relDir, baseName);
|
|
6329
6350
|
}
|
|
6330
6351
|
function buildSummaryIndex(summaryDir) {
|
|
6331
6352
|
const summaryFiles = findMdFilesRecursive(summaryDir);
|
|
@@ -6359,8 +6380,8 @@ function summarise2() {
|
|
|
6359
6380
|
}
|
|
6360
6381
|
const next2 = missing[0];
|
|
6361
6382
|
const outputFilename = `${getTranscriptBaseName(next2.filename)}.md`;
|
|
6362
|
-
const outputPath =
|
|
6363
|
-
const summaryFileDir =
|
|
6383
|
+
const outputPath = join26(STAGING_DIR, outputFilename);
|
|
6384
|
+
const summaryFileDir = join26(summaryDir, dirname18(next2.relativePath));
|
|
6364
6385
|
const relativeTranscriptPath = encodeURI(
|
|
6365
6386
|
relative2(summaryFileDir, next2.absolutePath).replace(/\\/g, "/")
|
|
6366
6387
|
);
|
|
@@ -6406,38 +6427,38 @@ function registerVerify(program2) {
|
|
|
6406
6427
|
|
|
6407
6428
|
// src/commands/voice/devices.ts
|
|
6408
6429
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
6409
|
-
import { join as
|
|
6430
|
+
import { join as join28 } from "path";
|
|
6410
6431
|
|
|
6411
6432
|
// src/commands/voice/shared.ts
|
|
6412
6433
|
import { homedir as homedir6 } from "os";
|
|
6413
|
-
import { dirname as dirname19, join as
|
|
6434
|
+
import { dirname as dirname19, join as join27 } from "path";
|
|
6414
6435
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
6415
6436
|
var __dirname7 = dirname19(fileURLToPath6(import.meta.url));
|
|
6416
|
-
var VOICE_DIR =
|
|
6437
|
+
var VOICE_DIR = join27(homedir6(), ".assist", "voice");
|
|
6417
6438
|
var voicePaths = {
|
|
6418
6439
|
dir: VOICE_DIR,
|
|
6419
|
-
pid:
|
|
6420
|
-
log:
|
|
6421
|
-
venv:
|
|
6422
|
-
lock:
|
|
6440
|
+
pid: join27(VOICE_DIR, "voice.pid"),
|
|
6441
|
+
log: join27(VOICE_DIR, "voice.log"),
|
|
6442
|
+
venv: join27(VOICE_DIR, ".venv"),
|
|
6443
|
+
lock: join27(VOICE_DIR, "voice.lock")
|
|
6423
6444
|
};
|
|
6424
6445
|
function getPythonDir() {
|
|
6425
|
-
return
|
|
6446
|
+
return join27(__dirname7, "commands", "voice", "python");
|
|
6426
6447
|
}
|
|
6427
6448
|
function getVenvPython() {
|
|
6428
|
-
return process.platform === "win32" ?
|
|
6449
|
+
return process.platform === "win32" ? join27(voicePaths.venv, "Scripts", "python.exe") : join27(voicePaths.venv, "bin", "python");
|
|
6429
6450
|
}
|
|
6430
6451
|
function getLockDir() {
|
|
6431
6452
|
const config = loadConfig();
|
|
6432
6453
|
return config.voice?.lockDir ?? VOICE_DIR;
|
|
6433
6454
|
}
|
|
6434
6455
|
function getLockFile() {
|
|
6435
|
-
return
|
|
6456
|
+
return join27(getLockDir(), "voice.lock");
|
|
6436
6457
|
}
|
|
6437
6458
|
|
|
6438
6459
|
// src/commands/voice/devices.ts
|
|
6439
6460
|
function devices() {
|
|
6440
|
-
const script =
|
|
6461
|
+
const script = join28(getPythonDir(), "list_devices.py");
|
|
6441
6462
|
spawnSync3(getVenvPython(), [script], { stdio: "inherit" });
|
|
6442
6463
|
}
|
|
6443
6464
|
|
|
@@ -6472,12 +6493,12 @@ function logs(options2) {
|
|
|
6472
6493
|
// src/commands/voice/setup.ts
|
|
6473
6494
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
6474
6495
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
6475
|
-
import { join as
|
|
6496
|
+
import { join as join30 } from "path";
|
|
6476
6497
|
|
|
6477
6498
|
// src/commands/voice/checkLockFile.ts
|
|
6478
6499
|
import { execSync as execSync28 } from "child_process";
|
|
6479
|
-
import { existsSync as existsSync30, mkdirSync as mkdirSync8, readFileSync as readFileSync24, writeFileSync as
|
|
6480
|
-
import { join as
|
|
6500
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync8, readFileSync as readFileSync24, writeFileSync as writeFileSync21 } from "fs";
|
|
6501
|
+
import { join as join29 } from "path";
|
|
6481
6502
|
function isProcessAlive(pid) {
|
|
6482
6503
|
try {
|
|
6483
6504
|
process.kill(pid, 0);
|
|
@@ -6514,8 +6535,8 @@ function bootstrapVenv() {
|
|
|
6514
6535
|
}
|
|
6515
6536
|
function writeLockFile(pid) {
|
|
6516
6537
|
const lockFile = getLockFile();
|
|
6517
|
-
mkdirSync8(
|
|
6518
|
-
|
|
6538
|
+
mkdirSync8(join29(lockFile, ".."), { recursive: true });
|
|
6539
|
+
writeFileSync21(
|
|
6519
6540
|
lockFile,
|
|
6520
6541
|
JSON.stringify({
|
|
6521
6542
|
pid,
|
|
@@ -6530,7 +6551,7 @@ function setup() {
|
|
|
6530
6551
|
mkdirSync9(voicePaths.dir, { recursive: true });
|
|
6531
6552
|
bootstrapVenv();
|
|
6532
6553
|
console.log("\nDownloading models...\n");
|
|
6533
|
-
const script =
|
|
6554
|
+
const script = join30(getPythonDir(), "setup_models.py");
|
|
6534
6555
|
const result = spawnSync4(getVenvPython(), [script], {
|
|
6535
6556
|
stdio: "inherit",
|
|
6536
6557
|
env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
|
|
@@ -6543,8 +6564,8 @@ function setup() {
|
|
|
6543
6564
|
|
|
6544
6565
|
// src/commands/voice/start.ts
|
|
6545
6566
|
import { spawn as spawn4 } from "child_process";
|
|
6546
|
-
import { mkdirSync as mkdirSync10, writeFileSync as
|
|
6547
|
-
import { join as
|
|
6567
|
+
import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync22 } from "fs";
|
|
6568
|
+
import { join as join31 } from "path";
|
|
6548
6569
|
|
|
6549
6570
|
// src/commands/voice/buildDaemonEnv.ts
|
|
6550
6571
|
function buildDaemonEnv(options2) {
|
|
@@ -6572,7 +6593,7 @@ function spawnBackground(python, script, env) {
|
|
|
6572
6593
|
console.error("Failed to start voice daemon");
|
|
6573
6594
|
process.exit(1);
|
|
6574
6595
|
}
|
|
6575
|
-
|
|
6596
|
+
writeFileSync22(voicePaths.pid, String(pid));
|
|
6576
6597
|
writeLockFile(pid);
|
|
6577
6598
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
6578
6599
|
}
|
|
@@ -6582,7 +6603,7 @@ function start2(options2) {
|
|
|
6582
6603
|
bootstrapVenv();
|
|
6583
6604
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
6584
6605
|
const env = buildDaemonEnv({ debug });
|
|
6585
|
-
const script =
|
|
6606
|
+
const script = join31(getPythonDir(), "voice_daemon.py");
|
|
6586
6607
|
const python = getVenvPython();
|
|
6587
6608
|
if (options2.foreground) {
|
|
6588
6609
|
spawnForeground(python, script, env);
|
|
@@ -6912,8 +6933,8 @@ function resolveParams(params, cliArgs) {
|
|
|
6912
6933
|
}
|
|
6913
6934
|
|
|
6914
6935
|
// src/commands/run/add.ts
|
|
6915
|
-
import { mkdirSync as mkdirSync11, writeFileSync as
|
|
6916
|
-
import { join as
|
|
6936
|
+
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync23 } from "fs";
|
|
6937
|
+
import { join as join32 } from "path";
|
|
6917
6938
|
function findAddIndex() {
|
|
6918
6939
|
const addIndex = process.argv.indexOf("add");
|
|
6919
6940
|
if (addIndex === -1 || addIndex + 2 >= process.argv.length) return -1;
|
|
@@ -6967,7 +6988,7 @@ function saveNewRunConfig(name, command, args) {
|
|
|
6967
6988
|
saveConfig(config);
|
|
6968
6989
|
}
|
|
6969
6990
|
function createCommandFile(name) {
|
|
6970
|
-
const dir =
|
|
6991
|
+
const dir = join32(".claude", "commands");
|
|
6971
6992
|
mkdirSync11(dir, { recursive: true });
|
|
6972
6993
|
const content = `---
|
|
6973
6994
|
description: Run ${name}
|
|
@@ -6975,8 +6996,8 @@ description: Run ${name}
|
|
|
6975
6996
|
|
|
6976
6997
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
6977
6998
|
`;
|
|
6978
|
-
const filePath =
|
|
6979
|
-
|
|
6999
|
+
const filePath = join32(dir, `${name}.md`);
|
|
7000
|
+
writeFileSync23(filePath, content);
|
|
6980
7001
|
console.log(`Created command file: ${filePath}`);
|
|
6981
7002
|
}
|
|
6982
7003
|
function add2() {
|