chatroom-cli 1.72.0 → 1.73.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 +93 -5
- package/dist/index.js.map +5 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -110428,6 +110428,38 @@ async function resolveSubWorkspaces(rootDir, pm) {
|
|
|
110428
110428
|
}
|
|
110429
110429
|
var init_workspace_resolver = () => {};
|
|
110430
110430
|
|
|
110431
|
+
// src/infrastructure/services/workspace/makefile-discovery.ts
|
|
110432
|
+
function parseMakefileTargets(content) {
|
|
110433
|
+
const phonyTargets = new Set;
|
|
110434
|
+
const ruleTargets = new Set;
|
|
110435
|
+
for (const line of content.split(`
|
|
110436
|
+
`)) {
|
|
110437
|
+
const trimmed = line.trimEnd();
|
|
110438
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
110439
|
+
continue;
|
|
110440
|
+
const phonyMatch = trimmed.match(/^\.PHONY:\s*(.+)/);
|
|
110441
|
+
if (phonyMatch) {
|
|
110442
|
+
for (const t of phonyMatch[1].split(/\s+/)) {
|
|
110443
|
+
if (t && t.length <= MAX_NAME_LENGTH && !t.includes("%"))
|
|
110444
|
+
phonyTargets.add(t);
|
|
110445
|
+
}
|
|
110446
|
+
continue;
|
|
110447
|
+
}
|
|
110448
|
+
if (line.startsWith("\t") || line.startsWith(" "))
|
|
110449
|
+
continue;
|
|
110450
|
+
const targetMatch = trimmed.match(/^([a-zA-Z][\w.-]*)\s*:/);
|
|
110451
|
+
if (!targetMatch)
|
|
110452
|
+
continue;
|
|
110453
|
+
const name = targetMatch[1];
|
|
110454
|
+
if (name.startsWith(".") || name.includes("%") || name.length > MAX_NAME_LENGTH)
|
|
110455
|
+
continue;
|
|
110456
|
+
ruleTargets.add(name);
|
|
110457
|
+
}
|
|
110458
|
+
const targets = phonyTargets.size > 0 ? phonyTargets : ruleTargets;
|
|
110459
|
+
return [...targets].sort();
|
|
110460
|
+
}
|
|
110461
|
+
var MAX_NAME_LENGTH = 256;
|
|
110462
|
+
|
|
110431
110463
|
// src/infrastructure/services/workspace/command-discovery.ts
|
|
110432
110464
|
import { access as access5, readFile as readFile11 } from "node:fs/promises";
|
|
110433
110465
|
import { join as join22, relative as relative4, basename as basename5 } from "node:path";
|
|
@@ -110474,7 +110506,7 @@ function getFilteredTurboCommand(pm, packageName, taskName) {
|
|
|
110474
110506
|
return `${prefix} ${taskName} --filter=${packageName}`;
|
|
110475
110507
|
}
|
|
110476
110508
|
function isValidScriptEntry(name, script) {
|
|
110477
|
-
return typeof script === "string" && name.length <=
|
|
110509
|
+
return typeof script === "string" && name.length <= MAX_NAME_LENGTH2 && script.length <= MAX_SCRIPT_LENGTH;
|
|
110478
110510
|
}
|
|
110479
110511
|
async function readJsonFile(filePath, label) {
|
|
110480
110512
|
try {
|
|
@@ -110523,12 +110555,64 @@ async function readTurboJson(workingDir, _turboPrefix, _rootSubWorkspace) {
|
|
|
110523
110555
|
if (!turbo?.tasks || typeof turbo.tasks !== "object")
|
|
110524
110556
|
return turboTaskNames;
|
|
110525
110557
|
for (const taskName of Object.keys(turbo.tasks)) {
|
|
110526
|
-
if (taskName.length <=
|
|
110558
|
+
if (taskName.length <= MAX_NAME_LENGTH2) {
|
|
110527
110559
|
turboTaskNames.push(taskName);
|
|
110528
110560
|
}
|
|
110529
110561
|
}
|
|
110530
110562
|
return turboTaskNames;
|
|
110531
110563
|
}
|
|
110564
|
+
async function readDenoJson(workingDir) {
|
|
110565
|
+
const commands = [];
|
|
110566
|
+
for (const fileName of ["deno.json", "deno.jsonc"]) {
|
|
110567
|
+
const deno = await readJsonFile(join22(workingDir, fileName), fileName);
|
|
110568
|
+
if (!deno?.tasks || typeof deno.tasks !== "object")
|
|
110569
|
+
continue;
|
|
110570
|
+
const pkgName = deno.name ?? basename5(workingDir);
|
|
110571
|
+
const subWorkspace = { type: "deno", path: ".", name: pkgName };
|
|
110572
|
+
for (const [taskName, taskCommand] of Object.entries(deno.tasks)) {
|
|
110573
|
+
if (!isValidScriptEntry(taskName, taskCommand))
|
|
110574
|
+
continue;
|
|
110575
|
+
commands.push({
|
|
110576
|
+
name: `deno: ${taskName}`,
|
|
110577
|
+
script: `deno task ${taskName}`,
|
|
110578
|
+
source: "deno.json",
|
|
110579
|
+
subWorkspace
|
|
110580
|
+
});
|
|
110581
|
+
}
|
|
110582
|
+
break;
|
|
110583
|
+
}
|
|
110584
|
+
return commands;
|
|
110585
|
+
}
|
|
110586
|
+
async function readMakefile(workingDir) {
|
|
110587
|
+
const commands = [];
|
|
110588
|
+
for (const fileName of ["Makefile", "makefile"]) {
|
|
110589
|
+
try {
|
|
110590
|
+
const content = await readFile11(join22(workingDir, fileName), "utf-8");
|
|
110591
|
+
const targets = parseMakefileTargets(content);
|
|
110592
|
+
if (targets.length === 0)
|
|
110593
|
+
continue;
|
|
110594
|
+
const subWorkspace = {
|
|
110595
|
+
type: "make",
|
|
110596
|
+
path: ".",
|
|
110597
|
+
name: basename5(workingDir)
|
|
110598
|
+
};
|
|
110599
|
+
for (const target of targets) {
|
|
110600
|
+
commands.push({
|
|
110601
|
+
name: `make: ${target}`,
|
|
110602
|
+
script: `make ${target}`,
|
|
110603
|
+
source: "Makefile",
|
|
110604
|
+
subWorkspace
|
|
110605
|
+
});
|
|
110606
|
+
}
|
|
110607
|
+
break;
|
|
110608
|
+
} catch (error51) {
|
|
110609
|
+
if (error51.code !== "ENOENT") {
|
|
110610
|
+
console.debug(`[command-discovery] skipping ${fileName}: ${error51.message}`);
|
|
110611
|
+
}
|
|
110612
|
+
}
|
|
110613
|
+
}
|
|
110614
|
+
return commands;
|
|
110615
|
+
}
|
|
110532
110616
|
async function discoverCommands(workingDir) {
|
|
110533
110617
|
const commands = [];
|
|
110534
110618
|
const pm = await detectPackageManager(workingDir);
|
|
@@ -110536,6 +110620,10 @@ async function discoverCommands(workingDir) {
|
|
|
110536
110620
|
const turboPrefix = getTurboRunPrefix(pm);
|
|
110537
110621
|
const { commands: rootCommands, rootPackageName } = await readRootPackageJson(workingDir, pm, scriptPrefix);
|
|
110538
110622
|
commands.push(...rootCommands);
|
|
110623
|
+
const denoCommands = await readDenoJson(workingDir);
|
|
110624
|
+
commands.push(...denoCommands);
|
|
110625
|
+
const makefileCommands = await readMakefile(workingDir);
|
|
110626
|
+
commands.push(...makefileCommands);
|
|
110539
110627
|
const rootSubWorkspace = { type: "npm", path: ".", name: rootPackageName };
|
|
110540
110628
|
const turboTaskNames = await readTurboJson(workingDir, turboPrefix, rootSubWorkspace);
|
|
110541
110629
|
for (const taskName of turboTaskNames) {
|
|
@@ -110564,7 +110652,7 @@ async function addSubWorkspaceCommands(commands, pm, pkg, wsPath, pkgSubWorkspac
|
|
|
110564
110652
|
});
|
|
110565
110653
|
}
|
|
110566
110654
|
for (const [scriptName, scriptValue] of Object.entries(pkg.scripts)) {
|
|
110567
|
-
if (typeof scriptValue === "string" && scriptName.length <=
|
|
110655
|
+
if (typeof scriptValue === "string" && scriptName.length <= MAX_NAME_LENGTH2 && scriptValue.length <= MAX_SCRIPT_LENGTH) {
|
|
110568
110656
|
commands.push({
|
|
110569
110657
|
name: `${pkg.name}: ${scriptName}`,
|
|
110570
110658
|
script: getFilteredScriptCommand(pm, pkg.name, scriptName),
|
|
@@ -110574,7 +110662,7 @@ async function addSubWorkspaceCommands(commands, pm, pkg, wsPath, pkgSubWorkspac
|
|
|
110574
110662
|
}
|
|
110575
110663
|
}
|
|
110576
110664
|
}
|
|
110577
|
-
var
|
|
110665
|
+
var MAX_NAME_LENGTH2 = 256, MAX_SCRIPT_LENGTH = 4096, LOCKFILE_MAP;
|
|
110578
110666
|
var init_command_discovery = __esm(() => {
|
|
110579
110667
|
init_jsonc();
|
|
110580
110668
|
init_workspace_resolver();
|
|
@@ -113453,4 +113541,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
113453
113541
|
});
|
|
113454
113542
|
program2.parse();
|
|
113455
113543
|
|
|
113456
|
-
//# debugId=
|
|
113544
|
+
//# debugId=5D81C0C1AF371BE564756E2164756E21
|