@staff0rd/assist 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +72 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3280,9 +3280,74 @@ Summary: ${processed} processed, ${skipped} skipped`);
|
|
|
3280
3280
|
}
|
|
3281
3281
|
|
|
3282
3282
|
// src/commands/transcript/summarise.ts
|
|
3283
|
-
import {
|
|
3284
|
-
|
|
3283
|
+
import {
|
|
3284
|
+
existsSync as existsSync16,
|
|
3285
|
+
mkdirSync as mkdirSync6,
|
|
3286
|
+
readFileSync as readFileSync14,
|
|
3287
|
+
renameSync as renameSync2,
|
|
3288
|
+
rmSync
|
|
3289
|
+
} from "fs";
|
|
3290
|
+
import { basename as basename5, dirname as dirname12, join as join16, relative as relative2 } from "path";
|
|
3291
|
+
import chalk35 from "chalk";
|
|
3292
|
+
var STAGING_DIR = join16(process.cwd(), ".assist", "transcript");
|
|
3293
|
+
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
3294
|
+
function processStagedFile() {
|
|
3295
|
+
if (!existsSync16(STAGING_DIR)) {
|
|
3296
|
+
return false;
|
|
3297
|
+
}
|
|
3298
|
+
const stagedFiles = findMdFilesRecursive(STAGING_DIR);
|
|
3299
|
+
if (stagedFiles.length === 0) {
|
|
3300
|
+
return false;
|
|
3301
|
+
}
|
|
3302
|
+
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
3303
|
+
const stagedFile = stagedFiles[0];
|
|
3304
|
+
const content = readFileSync14(stagedFile.absolutePath, "utf-8");
|
|
3305
|
+
const firstLine = content.split("\n")[0];
|
|
3306
|
+
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
3307
|
+
if (!match) {
|
|
3308
|
+
console.error(
|
|
3309
|
+
chalk35.red(
|
|
3310
|
+
`Staged file ${stagedFile.filename} missing [Full Transcript](<path>) link on first line.`
|
|
3311
|
+
)
|
|
3312
|
+
);
|
|
3313
|
+
process.exit(1);
|
|
3314
|
+
}
|
|
3315
|
+
const transcriptPath = match[1];
|
|
3316
|
+
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
3317
|
+
if (!contentAfterLink) {
|
|
3318
|
+
console.error(
|
|
3319
|
+
chalk35.red(
|
|
3320
|
+
`Staged file ${stagedFile.filename} has no summary content after the transcript link.`
|
|
3321
|
+
)
|
|
3322
|
+
);
|
|
3323
|
+
process.exit(1);
|
|
3324
|
+
}
|
|
3325
|
+
const relativePath = relative2(transcriptsDir, transcriptPath);
|
|
3326
|
+
if (relativePath.startsWith("..")) {
|
|
3327
|
+
console.error(
|
|
3328
|
+
chalk35.red(
|
|
3329
|
+
`Transcript path ${transcriptPath} is not within configured transcripts directory.`
|
|
3330
|
+
)
|
|
3331
|
+
);
|
|
3332
|
+
process.exit(1);
|
|
3333
|
+
}
|
|
3334
|
+
const destPath = join16(summaryDir, relativePath);
|
|
3335
|
+
const destDir = dirname12(destPath);
|
|
3336
|
+
if (!existsSync16(destDir)) {
|
|
3337
|
+
mkdirSync6(destDir, { recursive: true });
|
|
3338
|
+
}
|
|
3339
|
+
renameSync2(stagedFile.absolutePath, destPath);
|
|
3340
|
+
console.log(chalk35.green(`Moved summary to: ${destPath}`));
|
|
3341
|
+
const remaining = findMdFilesRecursive(STAGING_DIR);
|
|
3342
|
+
if (remaining.length === 0) {
|
|
3343
|
+
rmSync(STAGING_DIR, { recursive: true });
|
|
3344
|
+
}
|
|
3345
|
+
return true;
|
|
3346
|
+
}
|
|
3285
3347
|
function summarise() {
|
|
3348
|
+
if (processStagedFile()) {
|
|
3349
|
+
return;
|
|
3350
|
+
}
|
|
3286
3351
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
3287
3352
|
if (!existsSync16(transcriptsDir)) {
|
|
3288
3353
|
console.log("No transcripts directory found.");
|
|
@@ -3314,11 +3379,12 @@ function summarise() {
|
|
|
3314
3379
|
console.log("All transcripts have summaries.");
|
|
3315
3380
|
return;
|
|
3316
3381
|
}
|
|
3317
|
-
|
|
3382
|
+
const next2 = missing[0];
|
|
3383
|
+
const outputFilename = `${getTranscriptBaseName(next2.filename)}.md`;
|
|
3384
|
+
console.log(`Missing summaries: ${missing.length}
|
|
3318
3385
|
`);
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
}
|
|
3386
|
+
console.log(`Next transcript to summarise: ${next2.absolutePath}`);
|
|
3387
|
+
console.log(`Write summary to: ${join16(STAGING_DIR, outputFilename)}`);
|
|
3322
3388
|
}
|
|
3323
3389
|
|
|
3324
3390
|
// src/commands/verify/hardcodedColors.ts
|