@xylabs/ts-scripts-yarn3 7.4.18 → 7.4.19
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.body.md +86 -0
- package/README.md +108 -0
- package/dist/actions/claude-commands.mjs +1 -1
- package/dist/actions/claude-commands.mjs.map +1 -1
- package/dist/actions/claude-rules.mjs +1 -1
- package/dist/actions/claude-rules.mjs.map +1 -1
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/index.mjs +146 -41
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/publish.mjs.map +1 -1
- package/dist/actions/readme-gen.mjs +136 -20
- package/dist/actions/readme-gen.mjs.map +1 -1
- package/dist/actions/readme-init.mjs +83 -0
- package/dist/actions/readme-init.mjs.map +1 -0
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +2 -2
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/bin/xy.mjs +817 -576
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +42 -13
- package/dist/index.mjs +820 -573
- package/dist/index.mjs.map +1 -1
- package/dist/lib/claudeMdTemplate.mjs +1 -1
- package/dist/lib/claudeMdTemplate.mjs.map +1 -1
- package/dist/lib/generateReadmeFiles.mjs +118 -21
- package/dist/lib/generateReadmeFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +120 -23
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/xy/build/buildCommand.mjs +161 -0
- package/dist/xy/build/buildCommand.mjs.map +1 -0
- package/dist/xy/build/compileCommand.mjs +174 -0
- package/dist/xy/build/compileCommand.mjs.map +1 -0
- package/dist/xy/build/compileOnlyCommand.mjs +175 -0
- package/dist/xy/build/compileOnlyCommand.mjs.map +1 -0
- package/dist/xy/build/copyAssetsCommand.mjs +84 -0
- package/dist/xy/build/copyAssetsCommand.mjs.map +1 -0
- package/dist/xy/{xyBuildCommands.mjs → build/index.mjs} +111 -93
- package/dist/xy/build/index.mjs.map +1 -0
- package/dist/xy/build/rebuildCommand.mjs +114 -0
- package/dist/xy/build/rebuildCommand.mjs.map +1 -0
- package/dist/xy/build/recompileCommand.mjs +204 -0
- package/dist/xy/build/recompileCommand.mjs.map +1 -0
- package/dist/xy/common/claude/commandsCommand.mjs +107 -0
- package/dist/xy/common/claude/commandsCommand.mjs.map +1 -0
- package/dist/xy/common/claude/index.mjs +332 -0
- package/dist/xy/common/claude/index.mjs.map +1 -0
- package/dist/xy/common/claude/initCommand.mjs +283 -0
- package/dist/xy/common/claude/initCommand.mjs.map +1 -0
- package/dist/xy/common/claude/rulesCommand.mjs +129 -0
- package/dist/xy/common/claude/rulesCommand.mjs.map +1 -0
- package/dist/xy/common/claude/settingsCommand.mjs +90 -0
- package/dist/xy/common/claude/settingsCommand.mjs.map +1 -0
- package/dist/xy/common/cleanDocsCommand.mjs +45 -0
- package/dist/xy/common/cleanDocsCommand.mjs.map +1 -0
- package/dist/xy/common/deadCommand.mjs +116 -0
- package/dist/xy/common/deadCommand.mjs.map +1 -0
- package/dist/xy/common/genDocsCommand.mjs +125 -0
- package/dist/xy/common/genDocsCommand.mjs.map +1 -0
- package/dist/xy/common/gitignoreGenCommand.mjs +98 -0
- package/dist/xy/common/gitignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/gitlintCommand.mjs +82 -0
- package/dist/xy/common/gitlintCommand.mjs.map +1 -0
- package/dist/xy/{xyCommonCommands.mjs → common/index.mjs} +451 -241
- package/dist/xy/common/index.mjs.map +1 -0
- package/dist/xy/common/licenseCommand.mjs +100 -0
- package/dist/xy/common/licenseCommand.mjs.map +1 -0
- package/dist/xy/common/npmignoreGenCommand.mjs +98 -0
- package/dist/xy/common/npmignoreGenCommand.mjs.map +1 -0
- package/dist/xy/common/readme/genCommand.mjs +321 -0
- package/dist/xy/common/readme/genCommand.mjs.map +1 -0
- package/dist/xy/common/readme/index.mjs +361 -0
- package/dist/xy/common/readme/index.mjs.map +1 -0
- package/dist/xy/common/readme/initCommand.mjs +103 -0
- package/dist/xy/common/readme/initCommand.mjs.map +1 -0
- package/dist/xy/common/retestCommand.mjs +111 -0
- package/dist/xy/common/retestCommand.mjs.map +1 -0
- package/dist/xy/common/testCommand.mjs +108 -0
- package/dist/xy/common/testCommand.mjs.map +1 -0
- package/dist/xy/common/upplugCommand.mjs +113 -0
- package/dist/xy/common/upplugCommand.mjs.map +1 -0
- package/dist/xy/common/upyarnCommand.mjs +108 -0
- package/dist/xy/common/upyarnCommand.mjs.map +1 -0
- package/dist/xy/common/yarn3OnlyCommand.mjs +70 -0
- package/dist/xy/common/yarn3OnlyCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployCommand.mjs +139 -0
- package/dist/xy/deploy/deployCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployMajorCommand.mjs +139 -0
- package/dist/xy/deploy/deployMajorCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployMinorCommand.mjs +139 -0
- package/dist/xy/deploy/deployMinorCommand.mjs.map +1 -0
- package/dist/xy/deploy/deployNextCommand.mjs +139 -0
- package/dist/xy/deploy/deployNextCommand.mjs.map +1 -0
- package/dist/xy/{xyDeployCommands.mjs → deploy/index.mjs} +53 -53
- package/dist/xy/deploy/index.mjs.map +1 -0
- package/dist/xy/deploy/publishCommand.mjs +108 -0
- package/dist/xy/deploy/publishCommand.mjs.map +1 -0
- package/dist/xy/index.mjs +817 -576
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/install/cleanCommand.mjs +140 -0
- package/dist/xy/install/cleanCommand.mjs.map +1 -0
- package/dist/xy/install/dupdepsCommand.mjs +191 -0
- package/dist/xy/install/dupdepsCommand.mjs.map +1 -0
- package/dist/xy/{xyInstallCommands.mjs → install/index.mjs} +71 -68
- package/dist/xy/install/index.mjs.map +1 -0
- package/dist/xy/install/reinstallCommand.mjs +140 -0
- package/dist/xy/install/reinstallCommand.mjs.map +1 -0
- package/dist/xy/install/staticsCommand.mjs +191 -0
- package/dist/xy/install/staticsCommand.mjs.map +1 -0
- package/dist/{actions/clean-jest.mjs → xy/install/upCommand.mjs} +15 -6
- package/dist/xy/install/upCommand.mjs.map +1 -0
- package/dist/xy/install/updoCommand.mjs +112 -0
- package/dist/xy/install/updoCommand.mjs.map +1 -0
- package/dist/xy/lint/cycleCommand.mjs +163 -0
- package/dist/xy/lint/cycleCommand.mjs.map +1 -0
- package/dist/xy/lint/deplintCommand.mjs +814 -0
- package/dist/xy/lint/deplintCommand.mjs.map +1 -0
- package/dist/xy/lint/fixCommand.mjs +168 -0
- package/dist/xy/lint/fixCommand.mjs.map +1 -0
- package/dist/xy/{xyLintCommands.mjs → lint/index.mjs} +176 -145
- package/dist/xy/lint/index.mjs.map +1 -0
- package/dist/xy/lint/knipCommand.mjs +121 -0
- package/dist/xy/lint/knipCommand.mjs.map +1 -0
- package/dist/xy/lint/lintCommand.mjs +186 -0
- package/dist/xy/lint/lintCommand.mjs.map +1 -0
- package/dist/xy/lint/publintCommand.mjs +187 -0
- package/dist/xy/lint/publintCommand.mjs.map +1 -0
- package/dist/xy/lint/relintCommand.mjs +163 -0
- package/dist/xy/lint/relintCommand.mjs.map +1 -0
- package/dist/xy/lint/sonarCommand.mjs +121 -0
- package/dist/xy/lint/sonarCommand.mjs.map +1 -0
- package/dist/xy/xy.mjs +815 -574
- package/dist/xy/xy.mjs.map +1 -1
- package/package.json +2 -2
- package/templates/readme/README.body.md +11 -0
- package/templates/readme/README.template.md +22 -0
- package/dist/actions/clean-jest.mjs.map +0 -1
- package/dist/xy/xyBuildCommands.mjs.map +0 -1
- package/dist/xy/xyCommonCommands.mjs.map +0 -1
- package/dist/xy/xyDeployCommands.mjs.map +0 -1
- package/dist/xy/xyInstallCommands.mjs.map +0 -1
- package/dist/xy/xyLintCommands.mjs.map +0 -1
- /package/templates/{CLAUDE-project.md → claude/CLAUDE-project.md} +0 -0
- /package/templates/{commands → claude/commands}/xylabs-build.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-clean.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-compile.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-cycle.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deplint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy-major.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy-minor.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-deploy.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-fix.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-knip.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-lint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-publint.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-rebuild.md +0 -0
- /package/templates/{commands → claude/commands}/xylabs-test.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-architecture.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-build.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-dependencies.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-error-handling.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-frameworks.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-git-workflow.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-linting.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-naming.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-style.md +0 -0
- /package/templates/{rules → claude/rules}/xylabs-typescript.md +0 -0
|
@@ -17,7 +17,7 @@ import { createRequire } from "module";
|
|
|
17
17
|
import PATH from "path";
|
|
18
18
|
var require2 = createRequire(import.meta.url);
|
|
19
19
|
var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
20
|
-
var templatesDir = PATH.resolve(packageRoot, "templates");
|
|
20
|
+
var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
|
|
21
21
|
var XYLABS_RULES_PREFIX = "xylabs-";
|
|
22
22
|
var XYLABS_COMMANDS_PREFIX = "xylabs-";
|
|
23
23
|
var claudeMdRuleTemplates = () => {
|
|
@@ -194,10 +194,19 @@ var generateIgnoreFiles = (filename3, pkg) => {
|
|
|
194
194
|
|
|
195
195
|
// src/lib/generateReadmeFiles.ts
|
|
196
196
|
import { execSync } from "child_process";
|
|
197
|
-
import FS from "fs";
|
|
198
|
-
import {
|
|
197
|
+
import FS, { readFileSync as readFileSync3 } from "fs";
|
|
198
|
+
import {
|
|
199
|
+
mkdir,
|
|
200
|
+
readFile,
|
|
201
|
+
writeFile
|
|
202
|
+
} from "fs/promises";
|
|
203
|
+
import { createRequire as createRequire2 } from "module";
|
|
199
204
|
import PATH2 from "path";
|
|
205
|
+
import { createInterface } from "readline";
|
|
200
206
|
import chalk4 from "chalk";
|
|
207
|
+
var require3 = createRequire2(import.meta.url);
|
|
208
|
+
var packageRoot2 = PATH2.dirname(require3.resolve("@xylabs/ts-scripts-yarn3/package.json"));
|
|
209
|
+
var readmeTemplatesDir = PATH2.resolve(packageRoot2, "templates", "readme");
|
|
201
210
|
function fillTemplate(template, data) {
|
|
202
211
|
const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
|
|
203
212
|
return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
|
|
@@ -287,60 +296,164 @@ ${indent}### ${item.name}
|
|
|
287
296
|
}
|
|
288
297
|
return content;
|
|
289
298
|
}
|
|
299
|
+
function askConfirmation(question) {
|
|
300
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
301
|
+
return new Promise((resolve) => {
|
|
302
|
+
rl.question(question, (answer) => {
|
|
303
|
+
rl.close();
|
|
304
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
var DEFAULT_README_TEMPLATE = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.template.md"), "utf8");
|
|
309
|
+
var DEFAULT_README_BODY = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.body.md"), "utf8");
|
|
310
|
+
function applyLogoConfig(template, logoUrl, logoLinkUrl) {
|
|
311
|
+
let result = template;
|
|
312
|
+
if (logoUrl) {
|
|
313
|
+
result = result.replace(/\[logo]: .+/, `[logo]: ${logoUrl}`);
|
|
314
|
+
if (logoLinkUrl) {
|
|
315
|
+
result = result.replace(/\[!\[logo]\[]][^)]*\)/, `[![logo][]](${logoLinkUrl})`);
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
result = result.replace(/\[!\[logo]\[]][^\n]*\n*/, "");
|
|
319
|
+
result = result.replace(/\[logo]: [^\n]*\n?/, "");
|
|
320
|
+
}
|
|
321
|
+
return result;
|
|
322
|
+
}
|
|
323
|
+
function resolveTemplatePath(templatePath) {
|
|
324
|
+
const cwd = INIT_CWD() ?? ".";
|
|
325
|
+
return templatePath ?? PATH2.join(cwd, ".xy", "README.template.md");
|
|
326
|
+
}
|
|
327
|
+
async function loadOrCreateTemplate(resolvedTemplatePath) {
|
|
328
|
+
try {
|
|
329
|
+
const template = await readFile(resolvedTemplatePath, "utf8");
|
|
330
|
+
return { created: false, template };
|
|
331
|
+
} catch {
|
|
332
|
+
console.log(chalk4.yellow(`Template not found: ${resolvedTemplatePath}`));
|
|
333
|
+
const shouldCreate = await askConfirmation("Would you like to create a stock template? (y/N) ");
|
|
334
|
+
if (!shouldCreate) {
|
|
335
|
+
throw new Error("Template creation declined");
|
|
336
|
+
}
|
|
337
|
+
const template = DEFAULT_README_TEMPLATE;
|
|
338
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
339
|
+
return { created: true, template };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
async function scaffoldTemplate(resolvedTemplatePath, template) {
|
|
343
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
344
|
+
await mkdir(xyDir, { recursive: true });
|
|
345
|
+
await writeFile(resolvedTemplatePath, template);
|
|
346
|
+
console.log(chalk4.green(`Created template: ${resolvedTemplatePath}`));
|
|
347
|
+
const bodyPath = PATH2.join(xyDir, "README.body.md");
|
|
348
|
+
await writeFile(bodyPath, DEFAULT_README_BODY);
|
|
349
|
+
console.log(chalk4.green(`Created body template: ${bodyPath}`));
|
|
350
|
+
}
|
|
351
|
+
async function resolveBody(location, defaultBody) {
|
|
352
|
+
const localBodyPath = PATH2.join(location, "README.body.md");
|
|
353
|
+
try {
|
|
354
|
+
return await readFile(localBodyPath, "utf8");
|
|
355
|
+
} catch {
|
|
356
|
+
return defaultBody;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
async function generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose) {
|
|
360
|
+
try {
|
|
361
|
+
const pkgJsonPath = PATH2.join(location, "package.json");
|
|
362
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
363
|
+
const body = await resolveBody(location, defaultBody);
|
|
364
|
+
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
365
|
+
const readmeContent = fillTemplate(template, {
|
|
366
|
+
...pkgJson,
|
|
367
|
+
body,
|
|
368
|
+
typedoc: typedocContent
|
|
369
|
+
});
|
|
370
|
+
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
371
|
+
if (verbose) console.log(chalk4.green(` ${name}`));
|
|
372
|
+
return true;
|
|
373
|
+
} catch (ex) {
|
|
374
|
+
const error = ex;
|
|
375
|
+
console.warn(chalk4.yellow(` Skipped ${location}: ${error.message}`));
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
290
379
|
async function generateReadmeFiles({
|
|
380
|
+
logoLinkUrl,
|
|
381
|
+
logoUrl,
|
|
291
382
|
pkg,
|
|
292
383
|
templatePath,
|
|
293
384
|
typedoc = false,
|
|
294
|
-
verbose
|
|
385
|
+
verbose = false
|
|
295
386
|
}) {
|
|
296
387
|
console.log(chalk4.green("Generate README Files"));
|
|
297
|
-
const
|
|
298
|
-
const resolvedTemplatePath = templatePath ?? PATH2.join(cwd, "scripts", "README.template.md");
|
|
388
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
299
389
|
let template;
|
|
390
|
+
let templateCreated;
|
|
300
391
|
try {
|
|
301
|
-
template = await
|
|
392
|
+
({ template, created: templateCreated } = await loadOrCreateTemplate(resolvedTemplatePath));
|
|
302
393
|
} catch {
|
|
303
|
-
console.error(chalk4.red(`Template not found: ${resolvedTemplatePath}`));
|
|
304
394
|
return 1;
|
|
305
395
|
}
|
|
306
|
-
|
|
396
|
+
template = applyLogoConfig(template, logoUrl, logoLinkUrl);
|
|
397
|
+
if (templateCreated) {
|
|
398
|
+
console.log(chalk4.green("Generating README files for all packages..."));
|
|
399
|
+
}
|
|
400
|
+
const xyDir = PATH2.dirname(resolvedTemplatePath);
|
|
401
|
+
const xyBodyPath = PATH2.join(xyDir, "README.body.md");
|
|
402
|
+
let defaultBody;
|
|
403
|
+
try {
|
|
404
|
+
defaultBody = await readFile(xyBodyPath, "utf8");
|
|
405
|
+
} catch {
|
|
406
|
+
defaultBody = DEFAULT_README_BODY;
|
|
407
|
+
}
|
|
408
|
+
const workspaces = pkg && !templateCreated ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
307
409
|
let failed = false;
|
|
308
410
|
for (const { location, name } of workspaces) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
312
|
-
const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
|
|
313
|
-
const readmeContent = fillTemplate(template, { ...pkgJson, typedoc: typedocContent });
|
|
314
|
-
await writeFile(PATH2.join(location, "README.md"), readmeContent);
|
|
315
|
-
if (verbose) console.log(chalk4.green(` ${name}`));
|
|
316
|
-
} catch (ex) {
|
|
317
|
-
const error = ex;
|
|
318
|
-
console.warn(chalk4.yellow(` Skipped ${location}: ${error.message}`));
|
|
319
|
-
failed = true;
|
|
320
|
-
}
|
|
411
|
+
const success = await generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose);
|
|
412
|
+
if (!success) failed = true;
|
|
321
413
|
}
|
|
322
414
|
return failed ? 1 : 0;
|
|
323
415
|
}
|
|
324
416
|
|
|
417
|
+
// src/lib/loadConfig.ts
|
|
418
|
+
import chalk5 from "chalk";
|
|
419
|
+
import { cosmiconfig } from "cosmiconfig";
|
|
420
|
+
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
421
|
+
import deepmerge from "deepmerge";
|
|
422
|
+
var config;
|
|
423
|
+
var loadConfig = async (params) => {
|
|
424
|
+
if (config === void 0) {
|
|
425
|
+
const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
|
|
426
|
+
config = cosmicConfigResult?.config;
|
|
427
|
+
const configFilePath = cosmicConfigResult?.filepath;
|
|
428
|
+
if (configFilePath !== void 0) {
|
|
429
|
+
console.log(chalk5.green(`Loaded config from ${configFilePath}`));
|
|
430
|
+
if (config.verbose) {
|
|
431
|
+
console.log(chalk5.gray(`${JSON.stringify(config, null, 2)}`));
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return deepmerge(config, params ?? {});
|
|
436
|
+
};
|
|
437
|
+
|
|
325
438
|
// src/lib/runSteps.ts
|
|
326
439
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
327
440
|
import { existsSync as existsSync2 } from "fs";
|
|
328
|
-
import
|
|
441
|
+
import chalk6 from "chalk";
|
|
329
442
|
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
330
443
|
return safeExit(() => {
|
|
331
444
|
const pkgName = process.env.npm_package_name;
|
|
332
|
-
console.log(
|
|
445
|
+
console.log(chalk6.green(`${name} [${pkgName}]`));
|
|
333
446
|
let totalStatus = 0;
|
|
334
|
-
for (const [i, [command, args,
|
|
447
|
+
for (const [i, [command, args, config2]] of steps.entries()) {
|
|
335
448
|
if (messages?.[i]) {
|
|
336
|
-
console.log(
|
|
449
|
+
console.log(chalk6.gray(messages?.[i]));
|
|
337
450
|
}
|
|
338
451
|
const argList = Array.isArray(args) ? args : args.split(" ");
|
|
339
452
|
if (command === "node" && !existsSync2(argList[0])) {
|
|
340
453
|
throw new Error(`File not found [${argList[0]}]`);
|
|
341
454
|
}
|
|
342
455
|
const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
|
|
343
|
-
...
|
|
456
|
+
...config2,
|
|
344
457
|
encoding: "utf8",
|
|
345
458
|
env: { FORCE_COLOR: "3", ...process.env },
|
|
346
459
|
shell: true,
|
|
@@ -358,12 +471,12 @@ import {
|
|
|
358
471
|
existsSync as existsSync3,
|
|
359
472
|
mkdirSync,
|
|
360
473
|
readdirSync as readdirSync2,
|
|
361
|
-
readFileSync as
|
|
474
|
+
readFileSync as readFileSync4,
|
|
362
475
|
unlinkSync,
|
|
363
476
|
writeFileSync as writeFileSync2
|
|
364
477
|
} from "fs";
|
|
365
478
|
import PATH3 from "path";
|
|
366
|
-
import
|
|
479
|
+
import chalk7 from "chalk";
|
|
367
480
|
var syncCommandFiles = (commandsDir) => {
|
|
368
481
|
const templates = claudeCommandTemplates();
|
|
369
482
|
const templateNames = new Set(Object.keys(templates));
|
|
@@ -371,7 +484,7 @@ var syncCommandFiles = (commandsDir) => {
|
|
|
371
484
|
let created = 0;
|
|
372
485
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
373
486
|
const targetPath = PATH3.resolve(commandsDir, filename3);
|
|
374
|
-
const existing = existsSync3(targetPath) ?
|
|
487
|
+
const existing = existsSync3(targetPath) ? readFileSync4(targetPath, "utf8") : void 0;
|
|
375
488
|
if (existing === content) continue;
|
|
376
489
|
writeFileSync2(targetPath, content, "utf8");
|
|
377
490
|
if (existing) {
|
|
@@ -404,9 +517,9 @@ var logCommandsResult = (created, updated, removed) => {
|
|
|
404
517
|
updated ? `${updated} updated` : "",
|
|
405
518
|
removed ? `${removed} removed` : ""
|
|
406
519
|
].filter(Boolean);
|
|
407
|
-
console.log(
|
|
520
|
+
console.log(chalk7.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
|
|
408
521
|
} else {
|
|
409
|
-
console.log(
|
|
522
|
+
console.log(chalk7.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
|
|
410
523
|
}
|
|
411
524
|
};
|
|
412
525
|
var claudeCommands = () => {
|
|
@@ -428,12 +541,12 @@ import {
|
|
|
428
541
|
existsSync as existsSync4,
|
|
429
542
|
mkdirSync as mkdirSync2,
|
|
430
543
|
readdirSync as readdirSync3,
|
|
431
|
-
readFileSync as
|
|
544
|
+
readFileSync as readFileSync5,
|
|
432
545
|
unlinkSync as unlinkSync2,
|
|
433
546
|
writeFileSync as writeFileSync3
|
|
434
547
|
} from "fs";
|
|
435
548
|
import PATH4 from "path";
|
|
436
|
-
import
|
|
549
|
+
import chalk8 from "chalk";
|
|
437
550
|
var syncRuleFiles = (rulesDir) => {
|
|
438
551
|
const templates = claudeMdRuleTemplates();
|
|
439
552
|
const templateNames = new Set(Object.keys(templates));
|
|
@@ -441,7 +554,7 @@ var syncRuleFiles = (rulesDir) => {
|
|
|
441
554
|
let created = 0;
|
|
442
555
|
for (const [filename3, content] of Object.entries(templates)) {
|
|
443
556
|
const targetPath = PATH4.resolve(rulesDir, filename3);
|
|
444
|
-
const existing = existsSync4(targetPath) ?
|
|
557
|
+
const existing = existsSync4(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
|
|
445
558
|
if (existing === content) continue;
|
|
446
559
|
writeFileSync3(targetPath, content, "utf8");
|
|
447
560
|
if (existing) {
|
|
@@ -474,21 +587,21 @@ var logRulesResult = (created, updated, removed) => {
|
|
|
474
587
|
updated ? `${updated} updated` : "",
|
|
475
588
|
removed ? `${removed} removed` : ""
|
|
476
589
|
].filter(Boolean);
|
|
477
|
-
console.log(
|
|
590
|
+
console.log(chalk8.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
|
|
478
591
|
} else {
|
|
479
|
-
console.log(
|
|
592
|
+
console.log(chalk8.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
|
|
480
593
|
}
|
|
481
594
|
};
|
|
482
595
|
var ensureProjectClaudeMd = (cwd, force) => {
|
|
483
596
|
const projectPath = PATH4.resolve(cwd, "CLAUDE.md");
|
|
484
597
|
if (!existsSync4(projectPath) || force) {
|
|
485
598
|
if (force && existsSync4(projectPath)) {
|
|
486
|
-
console.log(
|
|
599
|
+
console.log(chalk8.yellow("Overwriting existing CLAUDE.md"));
|
|
487
600
|
}
|
|
488
601
|
writeFileSync3(projectPath, claudeMdProjectTemplate(), "utf8");
|
|
489
|
-
console.log(
|
|
602
|
+
console.log(chalk8.green("Generated CLAUDE.md"));
|
|
490
603
|
} else {
|
|
491
|
-
console.log(
|
|
604
|
+
console.log(chalk8.gray("CLAUDE.md already exists (skipped)"));
|
|
492
605
|
}
|
|
493
606
|
};
|
|
494
607
|
var claudeRules = ({ force } = {}) => {
|
|
@@ -513,8 +626,8 @@ import {
|
|
|
513
626
|
writeFileSync as writeFileSync4
|
|
514
627
|
} from "fs";
|
|
515
628
|
import PATH5 from "path";
|
|
516
|
-
import { createInterface } from "readline";
|
|
517
|
-
import
|
|
629
|
+
import { createInterface as createInterface2 } from "readline";
|
|
630
|
+
import chalk9 from "chalk";
|
|
518
631
|
var DEFAULT_SETTINGS = {
|
|
519
632
|
permissions: {
|
|
520
633
|
allow: [
|
|
@@ -548,8 +661,8 @@ var DEFAULT_SETTINGS = {
|
|
|
548
661
|
]
|
|
549
662
|
}
|
|
550
663
|
};
|
|
551
|
-
function
|
|
552
|
-
const rl =
|
|
664
|
+
function askConfirmation2(question) {
|
|
665
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
553
666
|
return new Promise((resolve) => {
|
|
554
667
|
rl.question(question, (answer) => {
|
|
555
668
|
rl.close();
|
|
@@ -563,26 +676,26 @@ async function claudeSettings() {
|
|
|
563
676
|
const settingsPath = PATH5.resolve(claudeDir, "settings.local.json");
|
|
564
677
|
mkdirSync3(claudeDir, { recursive: true });
|
|
565
678
|
if (existsSync5(settingsPath)) {
|
|
566
|
-
const confirmed = await
|
|
567
|
-
|
|
679
|
+
const confirmed = await askConfirmation2(
|
|
680
|
+
chalk9.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
|
|
568
681
|
);
|
|
569
682
|
if (!confirmed) {
|
|
570
|
-
console.log(
|
|
683
|
+
console.log(chalk9.gray("Skipped \u2014 existing settings.local.json preserved"));
|
|
571
684
|
return 0;
|
|
572
685
|
}
|
|
573
686
|
}
|
|
574
687
|
writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
|
|
575
688
|
`, "utf8");
|
|
576
|
-
console.log(
|
|
689
|
+
console.log(chalk9.green("Generated .claude/settings.local.json"));
|
|
577
690
|
return 0;
|
|
578
691
|
}
|
|
579
692
|
|
|
580
693
|
// src/actions/clean-docs.ts
|
|
581
694
|
import path from "path";
|
|
582
|
-
import
|
|
695
|
+
import chalk10 from "chalk";
|
|
583
696
|
var cleanDocs = () => {
|
|
584
697
|
const pkgName = process.env.npm_package_name;
|
|
585
|
-
console.log(
|
|
698
|
+
console.log(chalk10.green(`Cleaning Docs [${pkgName}]`));
|
|
586
699
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
587
700
|
return 0;
|
|
588
701
|
};
|
|
@@ -611,7 +724,7 @@ var filename = ".gitignore";
|
|
|
611
724
|
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
612
725
|
|
|
613
726
|
// src/actions/gitlint.ts
|
|
614
|
-
import
|
|
727
|
+
import chalk11 from "chalk";
|
|
615
728
|
import ParseGitConfig from "parse-git-config";
|
|
616
729
|
var gitlint = () => {
|
|
617
730
|
console.log(`
|
|
@@ -622,7 +735,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
622
735
|
const errors = 0;
|
|
623
736
|
const gitConfig = ParseGitConfig.sync();
|
|
624
737
|
const warn = (message) => {
|
|
625
|
-
console.warn(
|
|
738
|
+
console.warn(chalk11.yellow(`Warning: ${message}`));
|
|
626
739
|
warnings++;
|
|
627
740
|
};
|
|
628
741
|
if (gitConfig.core.ignorecase) {
|
|
@@ -642,13 +755,13 @@ Gitlint Start [${process.cwd()}]
|
|
|
642
755
|
}
|
|
643
756
|
const resultMessages = [];
|
|
644
757
|
if (valid > 0) {
|
|
645
|
-
resultMessages.push(
|
|
758
|
+
resultMessages.push(chalk11.green(`Passed: ${valid}`));
|
|
646
759
|
}
|
|
647
760
|
if (warnings > 0) {
|
|
648
|
-
resultMessages.push(
|
|
761
|
+
resultMessages.push(chalk11.yellow(`Warnings: ${warnings}`));
|
|
649
762
|
}
|
|
650
763
|
if (errors > 0) {
|
|
651
|
-
resultMessages.push(
|
|
764
|
+
resultMessages.push(chalk11.red(` Errors: ${errors}`));
|
|
652
765
|
}
|
|
653
766
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
654
767
|
`);
|
|
@@ -657,7 +770,7 @@ Gitlint Start [${process.cwd()}]
|
|
|
657
770
|
|
|
658
771
|
// src/actions/gitlint-fix.ts
|
|
659
772
|
import { execSync as execSync2 } from "child_process";
|
|
660
|
-
import
|
|
773
|
+
import chalk12 from "chalk";
|
|
661
774
|
import ParseGitConfig2 from "parse-git-config";
|
|
662
775
|
var gitlintFix = () => {
|
|
663
776
|
console.log(`
|
|
@@ -666,21 +779,21 @@ Gitlint Fix Start [${process.cwd()}]
|
|
|
666
779
|
const gitConfig = ParseGitConfig2.sync();
|
|
667
780
|
if (gitConfig.core.ignorecase) {
|
|
668
781
|
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
669
|
-
console.warn(
|
|
782
|
+
console.warn(chalk12.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
670
783
|
}
|
|
671
784
|
if (gitConfig.core.autocrlf !== false) {
|
|
672
785
|
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
673
|
-
console.warn(
|
|
786
|
+
console.warn(chalk12.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
674
787
|
}
|
|
675
788
|
if (gitConfig.core.eol !== "lf") {
|
|
676
789
|
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
677
|
-
console.warn(
|
|
790
|
+
console.warn(chalk12.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
678
791
|
}
|
|
679
792
|
return 1;
|
|
680
793
|
};
|
|
681
794
|
|
|
682
795
|
// src/actions/license.ts
|
|
683
|
-
import
|
|
796
|
+
import chalk13 from "chalk";
|
|
684
797
|
import { init } from "license-checker";
|
|
685
798
|
var license = async (pkg) => {
|
|
686
799
|
const workspaces = yarnWorkspaces();
|
|
@@ -705,18 +818,18 @@ var license = async (pkg) => {
|
|
|
705
818
|
"LGPL-3.0-or-later",
|
|
706
819
|
"Python-2.0"
|
|
707
820
|
]);
|
|
708
|
-
console.log(
|
|
821
|
+
console.log(chalk13.green("License Checker"));
|
|
709
822
|
return (await Promise.all(
|
|
710
823
|
workspaceList.map(({ location, name }) => {
|
|
711
824
|
return new Promise((resolve) => {
|
|
712
825
|
init({ production: true, start: location }, (error, packages) => {
|
|
713
826
|
if (error) {
|
|
714
|
-
console.error(
|
|
715
|
-
console.error(
|
|
827
|
+
console.error(chalk13.red(`License Checker [${name}] Error`));
|
|
828
|
+
console.error(chalk13.gray(error));
|
|
716
829
|
console.log("\n");
|
|
717
830
|
resolve(1);
|
|
718
831
|
} else {
|
|
719
|
-
console.log(
|
|
832
|
+
console.log(chalk13.green(`License Checker [${name}]`));
|
|
720
833
|
let count = 0;
|
|
721
834
|
for (const [name2, info] of Object.entries(packages)) {
|
|
722
835
|
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
@@ -732,7 +845,7 @@ var license = async (pkg) => {
|
|
|
732
845
|
}
|
|
733
846
|
if (!orLicenseFound) {
|
|
734
847
|
count++;
|
|
735
|
-
console.warn(
|
|
848
|
+
console.warn(chalk13.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
736
849
|
}
|
|
737
850
|
}
|
|
738
851
|
}
|
|
@@ -757,7 +870,10 @@ async function readmeGen({
|
|
|
757
870
|
typedoc,
|
|
758
871
|
verbose
|
|
759
872
|
}) {
|
|
873
|
+
const config2 = await loadConfig();
|
|
760
874
|
return await generateReadmeFiles({
|
|
875
|
+
logoLinkUrl: config2.readme?.logoLinkUrl,
|
|
876
|
+
logoUrl: config2.readme?.logoUrl,
|
|
761
877
|
pkg,
|
|
762
878
|
templatePath,
|
|
763
879
|
typedoc,
|
|
@@ -765,11 +881,20 @@ async function readmeGen({
|
|
|
765
881
|
});
|
|
766
882
|
}
|
|
767
883
|
|
|
884
|
+
// src/actions/readme-init.ts
|
|
885
|
+
async function readmeInit({ templatePath }) {
|
|
886
|
+
const config2 = await loadConfig();
|
|
887
|
+
const template = applyLogoConfig(DEFAULT_README_TEMPLATE, config2.readme?.logoUrl, config2.readme?.logoLinkUrl);
|
|
888
|
+
const resolvedTemplatePath = resolveTemplatePath(templatePath);
|
|
889
|
+
await scaffoldTemplate(resolvedTemplatePath, template);
|
|
890
|
+
return 0;
|
|
891
|
+
}
|
|
892
|
+
|
|
768
893
|
// src/actions/retest.ts
|
|
769
894
|
var retest = () => {
|
|
770
895
|
return runSteps("Test", [
|
|
771
|
-
["yarn", ["
|
|
772
|
-
["yarn", ["
|
|
896
|
+
["yarn", ["vitest", "--clearCache"]],
|
|
897
|
+
["yarn", ["vitest", "."]]
|
|
773
898
|
]);
|
|
774
899
|
};
|
|
775
900
|
|
|
@@ -802,188 +927,273 @@ var yarn3Only = () => {
|
|
|
802
927
|
return 0;
|
|
803
928
|
};
|
|
804
929
|
|
|
930
|
+
// src/xy/common/claude/commandsCommand.ts
|
|
931
|
+
var commandsCommand = {
|
|
932
|
+
command: "commands",
|
|
933
|
+
describe: "Sync XY Labs standard Claude slash commands to .claude/commands/",
|
|
934
|
+
handler: (argv) => {
|
|
935
|
+
if (argv.verbose) console.log("Claude Commands");
|
|
936
|
+
process.exitCode = claudeCommands();
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
// src/xy/common/claude/initCommand.ts
|
|
941
|
+
var initCommand = {
|
|
942
|
+
builder: (yargs) => {
|
|
943
|
+
return yargs.option("force", {
|
|
944
|
+
alias: "f",
|
|
945
|
+
default: false,
|
|
946
|
+
description: "Overwrite existing CLAUDE.md",
|
|
947
|
+
type: "boolean"
|
|
948
|
+
});
|
|
949
|
+
},
|
|
950
|
+
command: "init",
|
|
951
|
+
describe: "Initialize all Claude configuration (commands, rules, settings)",
|
|
952
|
+
handler: async (argv) => {
|
|
953
|
+
if (argv.verbose) console.log("Claude Init");
|
|
954
|
+
const commandsResult = claudeCommands();
|
|
955
|
+
const rulesResult = claudeRules({ force: argv.force });
|
|
956
|
+
const settingsResult = await claudeSettings();
|
|
957
|
+
process.exitCode = commandsResult || rulesResult || settingsResult;
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
|
|
961
|
+
// src/xy/common/claude/rulesCommand.ts
|
|
962
|
+
var rulesCommand = {
|
|
963
|
+
builder: (yargs) => {
|
|
964
|
+
return yargs.option("force", {
|
|
965
|
+
alias: "f",
|
|
966
|
+
default: false,
|
|
967
|
+
description: "Overwrite existing CLAUDE.md",
|
|
968
|
+
type: "boolean"
|
|
969
|
+
});
|
|
970
|
+
},
|
|
971
|
+
command: "rules",
|
|
972
|
+
describe: "Sync XY Labs standard Claude rules to .claude/rules/",
|
|
973
|
+
handler: (argv) => {
|
|
974
|
+
if (argv.verbose) console.log("Claude Rules");
|
|
975
|
+
process.exitCode = claudeRules({ force: argv.force });
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
// src/xy/common/claude/settingsCommand.ts
|
|
980
|
+
var settingsCommand = {
|
|
981
|
+
command: "settings",
|
|
982
|
+
describe: "Initialize .claude/settings.local.json with XY Labs defaults",
|
|
983
|
+
handler: async (argv) => {
|
|
984
|
+
if (argv.verbose) console.log("Claude Settings");
|
|
985
|
+
process.exitCode = await claudeSettings();
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
// src/xy/common/claude/index.ts
|
|
990
|
+
var claudeCommand = {
|
|
991
|
+
builder: (yargs) => {
|
|
992
|
+
return yargs.command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).demandCommand(1, "Please specify a claude subcommand");
|
|
993
|
+
},
|
|
994
|
+
command: "claude",
|
|
995
|
+
describe: "Claude - Claude Code configuration utilities",
|
|
996
|
+
handler: () => {
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
// src/xy/common/cleanDocsCommand.ts
|
|
1001
|
+
var cleanDocsCommand = {
|
|
1002
|
+
command: "clean-docs",
|
|
1003
|
+
describe: "CleanDocs - Clean TypeDocs",
|
|
1004
|
+
handler: (argv) => {
|
|
1005
|
+
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
1006
|
+
process.exitCode = cleanDocs();
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
|
|
805
1010
|
// src/xy/param.ts
|
|
806
1011
|
var packagePositionalParam = (yargs) => {
|
|
807
1012
|
return yargs.positional("package", { describe: "Specific package to target", type: "string" });
|
|
808
1013
|
};
|
|
809
1014
|
|
|
810
|
-
// src/xy/
|
|
1015
|
+
// src/xy/common/deadCommand.ts
|
|
1016
|
+
var deadCommand = {
|
|
1017
|
+
builder: (yargs) => {
|
|
1018
|
+
return packagePositionalParam(yargs);
|
|
1019
|
+
},
|
|
1020
|
+
command: "dead [package]",
|
|
1021
|
+
describe: "Dead - Check for dead code",
|
|
1022
|
+
handler: (argv) => {
|
|
1023
|
+
if (argv.verbose) console.log("Dead");
|
|
1024
|
+
process.exitCode = dead();
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1028
|
+
// src/xy/common/genDocsCommand.ts
|
|
1029
|
+
var genDocsCommand = {
|
|
1030
|
+
builder: (yargs) => {
|
|
1031
|
+
return packagePositionalParam(yargs);
|
|
1032
|
+
},
|
|
1033
|
+
command: "gen-docs [package]",
|
|
1034
|
+
describe: "GenDocs - Generate TypeDocs",
|
|
1035
|
+
handler: (argv) => {
|
|
1036
|
+
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
1037
|
+
process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
// src/xy/common/gitignoreGenCommand.ts
|
|
1042
|
+
var gitignoreGenCommand = {
|
|
1043
|
+
command: "gitignore-gen",
|
|
1044
|
+
describe: "GitIgnore Gen - Generate .gitignore files",
|
|
1045
|
+
handler: (argv) => {
|
|
1046
|
+
if (argv.verbose) console.log("GitIgnore Gen");
|
|
1047
|
+
process.exitCode = gitignoreGen();
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
// src/xy/common/gitlintCommand.ts
|
|
1052
|
+
var gitlintCommand = {
|
|
1053
|
+
command: "gitlint [package]",
|
|
1054
|
+
describe: "Gitlint - Lint your git config",
|
|
1055
|
+
handler: (argv) => {
|
|
1056
|
+
if (argv.verbose) console.log("Gitlint");
|
|
1057
|
+
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
|
|
1061
|
+
// src/xy/common/licenseCommand.ts
|
|
1062
|
+
var licenseCommand = {
|
|
1063
|
+
builder: (yargs) => {
|
|
1064
|
+
return packagePositionalParam(yargs);
|
|
1065
|
+
},
|
|
1066
|
+
command: "license [package]",
|
|
1067
|
+
describe: "License - Check licenses of dependencies",
|
|
1068
|
+
handler: async (argv) => {
|
|
1069
|
+
if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
|
|
1070
|
+
process.exitCode = await license();
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
// src/xy/common/npmignoreGenCommand.ts
|
|
1075
|
+
var npmignoreGenCommand = {
|
|
1076
|
+
command: "npmignore-gen",
|
|
1077
|
+
describe: "NpmIgnore Gen - Generate .npmignore files",
|
|
1078
|
+
handler: (argv) => {
|
|
1079
|
+
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
1080
|
+
process.exitCode = npmignoreGen();
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
// src/xy/common/readme/genCommand.ts
|
|
1085
|
+
var genCommand = {
|
|
1086
|
+
builder: (yargs) => {
|
|
1087
|
+
return packagePositionalParam(yargs).option("template", {
|
|
1088
|
+
alias: "t",
|
|
1089
|
+
description: "Path to README.template.md",
|
|
1090
|
+
type: "string"
|
|
1091
|
+
}).option("typedoc", {
|
|
1092
|
+
default: false,
|
|
1093
|
+
description: "Generate TypeDoc reference sections",
|
|
1094
|
+
type: "boolean"
|
|
1095
|
+
});
|
|
1096
|
+
},
|
|
1097
|
+
aliases: ["$0"],
|
|
1098
|
+
command: "gen [package]",
|
|
1099
|
+
describe: "Generate README.md files from template",
|
|
1100
|
+
handler: async (argv) => {
|
|
1101
|
+
if (argv.verbose) console.log("Readme Gen");
|
|
1102
|
+
process.exitCode = await readmeGen({
|
|
1103
|
+
pkg: argv.package,
|
|
1104
|
+
templatePath: argv.template,
|
|
1105
|
+
typedoc: argv.typedoc,
|
|
1106
|
+
verbose: !!argv.verbose
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
// src/xy/common/readme/initCommand.ts
|
|
1112
|
+
var initCommand2 = {
|
|
1113
|
+
builder: (yargs) => {
|
|
1114
|
+
return yargs.option("template", {
|
|
1115
|
+
alias: "t",
|
|
1116
|
+
description: "Path to README.template.md",
|
|
1117
|
+
type: "string"
|
|
1118
|
+
});
|
|
1119
|
+
},
|
|
1120
|
+
command: "init",
|
|
1121
|
+
describe: "Initialize README template and logo files",
|
|
1122
|
+
handler: async (argv) => {
|
|
1123
|
+
if (argv.verbose) console.log("Readme Init");
|
|
1124
|
+
process.exitCode = await readmeInit({
|
|
1125
|
+
templatePath: argv.template,
|
|
1126
|
+
verbose: !!argv.verbose
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
|
|
1131
|
+
// src/xy/common/readme/index.ts
|
|
1132
|
+
var readmeCommand = {
|
|
1133
|
+
builder: (yargs) => {
|
|
1134
|
+
return yargs.command(genCommand).command(initCommand2);
|
|
1135
|
+
},
|
|
1136
|
+
command: "readme",
|
|
1137
|
+
describe: "Readme - README file utilities",
|
|
1138
|
+
handler: () => {
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
// src/xy/common/retestCommand.ts
|
|
1143
|
+
var retestCommand = {
|
|
1144
|
+
command: "retest",
|
|
1145
|
+
describe: "Re-Test - Run Jest Tests with cleaned cache",
|
|
1146
|
+
handler: (argv) => {
|
|
1147
|
+
if (argv.verbose) console.log("Re-Testing");
|
|
1148
|
+
process.exitCode = retest();
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
// src/xy/common/testCommand.ts
|
|
1153
|
+
var testCommand = {
|
|
1154
|
+
command: "test",
|
|
1155
|
+
describe: "Test - Run Jest Tests",
|
|
1156
|
+
handler: (argv) => {
|
|
1157
|
+
if (argv.verbose) console.log("Testing");
|
|
1158
|
+
process.exitCode = test();
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
// src/xy/common/upplugCommand.ts
|
|
1163
|
+
var upplugCommand = {
|
|
1164
|
+
command: "upplug",
|
|
1165
|
+
describe: "UpPlug - Update Yarn Plugins",
|
|
1166
|
+
handler: (argv) => {
|
|
1167
|
+
if (argv.verbose) console.log("UpPlug");
|
|
1168
|
+
process.exitCode = updateYarnPlugins();
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
// src/xy/common/upyarnCommand.ts
|
|
1173
|
+
var upyarnCommand = {
|
|
1174
|
+
command: "upyarn",
|
|
1175
|
+
describe: "UpYarn - Update Yarn Version",
|
|
1176
|
+
handler: (argv) => {
|
|
1177
|
+
if (argv.verbose) console.log("UpYarn");
|
|
1178
|
+
process.exitCode = updateYarnVersion();
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
// src/xy/common/yarn3OnlyCommand.ts
|
|
1183
|
+
var yarn3OnlyCommand = {
|
|
1184
|
+
command: "yarn3only",
|
|
1185
|
+
describe: "Yarn3Only - Check if using Yarn v3",
|
|
1186
|
+
handler: (argv) => {
|
|
1187
|
+
if (argv.verbose) console.log("Yarn 3 Check");
|
|
1188
|
+
process.exitCode = yarn3Only();
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
// src/xy/common/index.ts
|
|
811
1193
|
var xyCommonCommands = (args) => {
|
|
812
|
-
return args.command(
|
|
813
|
-
"claude-commands",
|
|
814
|
-
"Claude Commands - Sync XY Labs standard Claude slash commands to .claude/commands/",
|
|
815
|
-
(yargs) => yargs,
|
|
816
|
-
(argv) => {
|
|
817
|
-
if (argv.verbose) console.log("Claude Commands");
|
|
818
|
-
process.exitCode = claudeCommands();
|
|
819
|
-
}
|
|
820
|
-
).command(
|
|
821
|
-
"claude-settings",
|
|
822
|
-
"Claude Settings - Initialize .claude/settings.local.json with XY Labs defaults",
|
|
823
|
-
(yargs) => yargs,
|
|
824
|
-
async (argv) => {
|
|
825
|
-
if (argv.verbose) console.log("Claude Settings");
|
|
826
|
-
process.exitCode = await claudeSettings();
|
|
827
|
-
}
|
|
828
|
-
).command(
|
|
829
|
-
"claude-rules",
|
|
830
|
-
"Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
|
|
831
|
-
(yargs) => {
|
|
832
|
-
return yargs.option("force", {
|
|
833
|
-
alias: "f",
|
|
834
|
-
default: false,
|
|
835
|
-
description: "Overwrite existing CLAUDE.md",
|
|
836
|
-
type: "boolean"
|
|
837
|
-
});
|
|
838
|
-
},
|
|
839
|
-
(argv) => {
|
|
840
|
-
if (argv.verbose) console.log("Claude Rules");
|
|
841
|
-
process.exitCode = claudeRules({ force: argv.force });
|
|
842
|
-
}
|
|
843
|
-
).command(
|
|
844
|
-
"license [package]",
|
|
845
|
-
"License - Check licenses of dependencies",
|
|
846
|
-
(yargs) => {
|
|
847
|
-
return packagePositionalParam(yargs);
|
|
848
|
-
},
|
|
849
|
-
async (argv) => {
|
|
850
|
-
if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
|
|
851
|
-
process.exitCode = await license();
|
|
852
|
-
}
|
|
853
|
-
).command(
|
|
854
|
-
"dead [package]",
|
|
855
|
-
"Dead - Check for dead code",
|
|
856
|
-
(yargs) => {
|
|
857
|
-
return packagePositionalParam(yargs);
|
|
858
|
-
},
|
|
859
|
-
(argv) => {
|
|
860
|
-
if (argv.verbose) console.log("Dead");
|
|
861
|
-
process.exitCode = dead();
|
|
862
|
-
}
|
|
863
|
-
).command(
|
|
864
|
-
"gen-docs [package]",
|
|
865
|
-
"GenDocs - Generate TypeDocs",
|
|
866
|
-
(yargs) => {
|
|
867
|
-
return packagePositionalParam(yargs);
|
|
868
|
-
},
|
|
869
|
-
(argv) => {
|
|
870
|
-
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
871
|
-
process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
|
|
872
|
-
}
|
|
873
|
-
).command(
|
|
874
|
-
"clean-docs",
|
|
875
|
-
"CleanDocs - Clean TypeDocs",
|
|
876
|
-
(yargs) => yargs,
|
|
877
|
-
(argv) => {
|
|
878
|
-
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
879
|
-
process.exitCode = cleanDocs();
|
|
880
|
-
}
|
|
881
|
-
).command(
|
|
882
|
-
"gitlint [package]",
|
|
883
|
-
"Gitlint - Lint your git config",
|
|
884
|
-
(yargs) => {
|
|
885
|
-
return yargs;
|
|
886
|
-
},
|
|
887
|
-
(argv) => {
|
|
888
|
-
if (argv.verbose) console.log("Gitlint");
|
|
889
|
-
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
890
|
-
}
|
|
891
|
-
).command(
|
|
892
|
-
"gitignore-gen",
|
|
893
|
-
"GitIgnore Gen - Generate .gitignore files",
|
|
894
|
-
(yargs) => {
|
|
895
|
-
return yargs;
|
|
896
|
-
},
|
|
897
|
-
(argv) => {
|
|
898
|
-
if (argv.verbose) console.log("GitIgnore Gen");
|
|
899
|
-
process.exitCode = gitignoreGen();
|
|
900
|
-
}
|
|
901
|
-
).command(
|
|
902
|
-
"npmignore-gen",
|
|
903
|
-
"NpmIgnore Gen - Generate .npmignore files",
|
|
904
|
-
(yargs) => {
|
|
905
|
-
return yargs;
|
|
906
|
-
},
|
|
907
|
-
(argv) => {
|
|
908
|
-
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
909
|
-
process.exitCode = npmignoreGen();
|
|
910
|
-
}
|
|
911
|
-
).command(
|
|
912
|
-
"readme-gen [package]",
|
|
913
|
-
"Readme Gen - Generate README.md files from template",
|
|
914
|
-
(yargs) => {
|
|
915
|
-
return packagePositionalParam(yargs).option("template", {
|
|
916
|
-
alias: "t",
|
|
917
|
-
description: "Path to README.template.md",
|
|
918
|
-
type: "string"
|
|
919
|
-
}).option("typedoc", {
|
|
920
|
-
default: false,
|
|
921
|
-
description: "Generate TypeDoc reference sections",
|
|
922
|
-
type: "boolean"
|
|
923
|
-
});
|
|
924
|
-
},
|
|
925
|
-
async (argv) => {
|
|
926
|
-
if (argv.verbose) console.log("Readme Gen");
|
|
927
|
-
process.exitCode = await readmeGen({
|
|
928
|
-
pkg: argv.package,
|
|
929
|
-
templatePath: argv.template,
|
|
930
|
-
typedoc: argv.typedoc,
|
|
931
|
-
verbose: !!argv.verbose
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
).command(
|
|
935
|
-
"retest",
|
|
936
|
-
"Re-Test - Run Jest Tests with cleaned cache",
|
|
937
|
-
(yargs) => {
|
|
938
|
-
return yargs;
|
|
939
|
-
},
|
|
940
|
-
(argv) => {
|
|
941
|
-
if (argv.verbose) console.log("Re-Testing");
|
|
942
|
-
process.exitCode = retest();
|
|
943
|
-
}
|
|
944
|
-
).command(
|
|
945
|
-
"test",
|
|
946
|
-
"Test - Run Jest Tests",
|
|
947
|
-
(yargs) => {
|
|
948
|
-
return yargs;
|
|
949
|
-
},
|
|
950
|
-
(argv) => {
|
|
951
|
-
if (argv.verbose) console.log("Testing");
|
|
952
|
-
process.exitCode = test();
|
|
953
|
-
}
|
|
954
|
-
).command(
|
|
955
|
-
"upplug",
|
|
956
|
-
"UpPlug - Update Yarn Plugins",
|
|
957
|
-
(yargs) => {
|
|
958
|
-
return yargs;
|
|
959
|
-
},
|
|
960
|
-
(argv) => {
|
|
961
|
-
if (argv.verbose) console.log("UpPlug");
|
|
962
|
-
process.exitCode = updateYarnPlugins();
|
|
963
|
-
}
|
|
964
|
-
).command(
|
|
965
|
-
"upyarn",
|
|
966
|
-
"UpYarn - Update Yarn Version",
|
|
967
|
-
(yargs) => {
|
|
968
|
-
return yargs;
|
|
969
|
-
},
|
|
970
|
-
(argv) => {
|
|
971
|
-
if (argv.verbose) console.log("UpYarn");
|
|
972
|
-
process.exitCode = updateYarnVersion();
|
|
973
|
-
}
|
|
974
|
-
).command(
|
|
975
|
-
"yarn3only",
|
|
976
|
-
"Yarn3Only - Check if using Yarn v3",
|
|
977
|
-
(yargs) => {
|
|
978
|
-
return yargs;
|
|
979
|
-
},
|
|
980
|
-
(argv) => {
|
|
981
|
-
if (argv.verbose) console.log("Yarn 3 Check");
|
|
982
|
-
process.exitCode = yarn3Only();
|
|
983
|
-
}
|
|
984
|
-
);
|
|
1194
|
+
return args.command(claudeCommand).command(licenseCommand).command(deadCommand).command(genDocsCommand).command(cleanDocsCommand).command(gitlintCommand).command(gitignoreGenCommand).command(npmignoreGenCommand).command(readmeCommand).command(retestCommand).command(testCommand).command(upplugCommand).command(upyarnCommand).command(yarn3OnlyCommand);
|
|
985
1195
|
};
|
|
986
1196
|
export {
|
|
987
1197
|
xyCommonCommands
|
|
988
1198
|
};
|
|
989
|
-
//# sourceMappingURL=
|
|
1199
|
+
//# sourceMappingURL=index.mjs.map
|