@aiready/cli 0.12.20 → 0.12.23

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.
Files changed (51) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +24 -5
  3. package/.turbo/turbo-test.log +66 -85
  4. package/coverage/base.css +224 -0
  5. package/coverage/block-navigation.js +87 -0
  6. package/coverage/clover.xml +865 -0
  7. package/coverage/coverage-final.json +15 -0
  8. package/coverage/favicon.png +0 -0
  9. package/coverage/index.html +146 -0
  10. package/coverage/prettify.css +1 -0
  11. package/coverage/prettify.js +2 -0
  12. package/coverage/sort-arrow-sprite.png +0 -0
  13. package/coverage/sorter.js +210 -0
  14. package/coverage/src/commands/agent-grounding.ts.html +271 -0
  15. package/coverage/src/commands/ai-signal-clarity.ts.html +253 -0
  16. package/coverage/src/commands/change-amplification.ts.html +94 -0
  17. package/coverage/src/commands/consistency.ts.html +781 -0
  18. package/coverage/src/commands/context.ts.html +871 -0
  19. package/coverage/src/commands/deps-health.ts.html +280 -0
  20. package/coverage/src/commands/doc-drift.ts.html +271 -0
  21. package/coverage/src/commands/index.html +281 -0
  22. package/coverage/src/commands/patterns.ts.html +745 -0
  23. package/coverage/src/commands/scan.ts.html +1393 -0
  24. package/coverage/src/commands/testability.ts.html +304 -0
  25. package/coverage/src/commands/upload.ts.html +466 -0
  26. package/coverage/src/commands/visualize.ts.html +1027 -0
  27. package/coverage/src/index.html +116 -0
  28. package/coverage/src/index.ts.html +1372 -0
  29. package/coverage/src/utils/helpers.ts.html +559 -0
  30. package/coverage/src/utils/index.html +116 -0
  31. package/dist/cli.js +249 -15
  32. package/dist/cli.mjs +247 -13
  33. package/package.json +13 -12
  34. package/src/.aiready/aiready-report-20260308-174006.json +29526 -0
  35. package/src/__tests__/unified.test.ts +95 -0
  36. package/src/cli.ts +86 -0
  37. package/src/commands/__tests__/agent-grounding.test.ts +24 -0
  38. package/src/commands/__tests__/ai-signal-clarity.test.ts +32 -0
  39. package/src/commands/__tests__/consistency.test.ts +97 -0
  40. package/src/commands/__tests__/deps-health.test.ts +26 -0
  41. package/src/commands/__tests__/doc-drift.test.ts +26 -0
  42. package/src/commands/__tests__/extra-commands.test.ts +177 -0
  43. package/src/commands/__tests__/scan.test.ts +147 -0
  44. package/src/commands/__tests__/testability.test.ts +36 -0
  45. package/src/commands/__tests__/upload.test.ts +51 -0
  46. package/src/commands/__tests__/visualize.test.ts +82 -0
  47. package/src/commands/clawmart.ts +162 -0
  48. package/src/commands/index.ts +8 -0
  49. package/src/commands/scan.ts +33 -11
  50. package/src/utils/__tests__/helpers.test.ts +35 -0
  51. package/vitest.config.ts +20 -0
package/dist/cli.mjs CHANGED
@@ -22,8 +22,6 @@ import {
22
22
  resolveOutputPath,
23
23
  formatScore,
24
24
  calculateTokenBudget,
25
- estimateCostFromBudget,
26
- getModelPreset,
27
25
  getRating,
28
26
  getRepoMetadata,
29
27
  Severity,
@@ -430,26 +428,46 @@ async function scanAction(directory, options) {
430
428
  wastedTokens: {
431
429
  duplication: totalWastedDuplication,
432
430
  fragmentation: totalWastedFragmentation,
433
- chattiness: 0
431
+ chattiness: totalContext * 0.1
432
+ // Default chattiness
434
433
  }
435
434
  });
436
- const modelPreset = getModelPreset(options.model || "claude-4.6");
437
- const costEstimate = estimateCostFromBudget(unifiedBudget, modelPreset);
438
- console.log(chalk3.bold("\n\u{1F4CA} AI Token Budget Analysis"));
435
+ const allIssues = [];
436
+ for (const toolId of results.summary.toolsRun) {
437
+ if (results[toolId]?.results) {
438
+ results[toolId].results.forEach((fileRes) => {
439
+ if (fileRes.issues) {
440
+ allIssues.push(...fileRes.issues);
441
+ }
442
+ });
443
+ }
444
+ }
445
+ const modelId = options.model || "claude-3-5-sonnet";
446
+ const roi = (await import("@aiready/core")).calculateBusinessROI({
447
+ tokenWaste: unifiedBudget.wastedTokens.total,
448
+ issues: allIssues,
449
+ modelId
450
+ });
451
+ console.log(chalk3.bold("\n\u{1F4B0} Business Impact Analysis (Monthly)"));
439
452
  console.log(
440
- ` Efficiency: ${(unifiedBudget.efficiencyRatio * 100).toFixed(0)}%`
453
+ ` Potential Savings: ${chalk3.green(chalk3.bold("$" + roi.monthlySavings.toLocaleString()))}`
441
454
  );
442
455
  console.log(
443
- ` Wasted Tokens: ${chalk3.red(unifiedBudget.wastedTokens.total.toLocaleString())}`
456
+ ` Productivity Gain: ${chalk3.cyan(chalk3.bold(roi.productivityGainHours + "h"))} (est. dev time)`
444
457
  );
445
458
  console.log(
446
- ` Est. Monthly Cost (${modelPreset.name}): ${chalk3.bold("$" + costEstimate.total)}`
459
+ ` Context Efficiency: ${chalk3.yellow((unifiedBudget.efficiencyRatio * 100).toFixed(0) + "%")}`
447
460
  );
448
- scoringResult.tokenBudget = unifiedBudget;
449
- scoringResult.costEstimate = {
450
- model: modelPreset.name,
451
- ...costEstimate
461
+ console.log(
462
+ ` Annual Value: ${chalk3.bold("$" + roi.annualValue.toLocaleString())} (ROI Prediction)`
463
+ );
464
+ results.summary.businessImpact = {
465
+ estimatedMonthlyWaste: roi.monthlySavings,
466
+ potentialSavings: roi.monthlySavings,
467
+ productivityHours: roi.productivityGainHours
452
468
  };
469
+ scoringResult.tokenBudget = unifiedBudget;
470
+ scoringResult.businessROI = roi;
453
471
  }
454
472
  if (scoringResult.breakdown) {
455
473
  console.log(chalk3.bold("\nTool breakdown:"));
@@ -1346,10 +1364,207 @@ import { loadConfig as loadConfig2, mergeConfigWithDefaults as mergeConfigWithDe
1346
1364
  // src/commands/testability.ts
1347
1365
  import chalk10 from "chalk";
1348
1366
  import { loadConfig as loadConfig3, mergeConfigWithDefaults as mergeConfigWithDefaults3 } from "@aiready/core";
1367
+ async function testabilityAction(directory, options) {
1368
+ const { analyzeTestability, calculateTestabilityScore } = await import("@aiready/testability");
1369
+ const config = await loadConfig3(directory);
1370
+ const merged = mergeConfigWithDefaults3(config, {
1371
+ minCoverageRatio: 0.3
1372
+ });
1373
+ const report = await analyzeTestability({
1374
+ rootDir: directory,
1375
+ minCoverageRatio: options.minCoverageRatio ?? merged.minCoverageRatio,
1376
+ include: options.include,
1377
+ exclude: options.exclude
1378
+ });
1379
+ const scoring = calculateTestabilityScore(report);
1380
+ if (options.output === "json") {
1381
+ return scoring;
1382
+ }
1383
+ const safetyIcons = {
1384
+ safe: "\u2705",
1385
+ "moderate-risk": "\u26A0\uFE0F ",
1386
+ "high-risk": "\u{1F534}",
1387
+ "blind-risk": "\u{1F480}"
1388
+ };
1389
+ const safetyColors = {
1390
+ safe: chalk10.green,
1391
+ "moderate-risk": chalk10.yellow,
1392
+ "high-risk": chalk10.red,
1393
+ "blind-risk": chalk10.bgRed.white
1394
+ };
1395
+ const safety = report.summary.aiChangeSafetyRating;
1396
+ const icon = safetyIcons[safety] ?? "\u2753";
1397
+ const color = safetyColors[safety] ?? chalk10.white;
1398
+ console.log(
1399
+ ` \u{1F9EA} Testability: ${chalk10.bold(scoring.score + "/100")} (${report.summary.rating})`
1400
+ );
1401
+ console.log(
1402
+ ` AI Change Safety: ${color(`${icon} ${safety.toUpperCase()}`)}`
1403
+ );
1404
+ console.log(
1405
+ chalk10.dim(
1406
+ ` Coverage: ${Math.round(report.summary.coverageRatio * 100)}% (${report.rawData.testFiles} test / ${report.rawData.sourceFiles} source files)`
1407
+ )
1408
+ );
1409
+ if (safety === "blind-risk") {
1410
+ console.log(
1411
+ chalk10.red.bold(
1412
+ "\n \u26A0\uFE0F NO TESTS \u2014 AI changes to this codebase are completely unverifiable!\n"
1413
+ )
1414
+ );
1415
+ }
1416
+ return scoring;
1417
+ }
1349
1418
 
1350
1419
  // src/commands/change-amplification.ts
1351
1420
  import { changeAmplificationAction } from "@aiready/change-amplification/dist/cli.js";
1352
1421
 
1422
+ // src/commands/clawmart.ts
1423
+ import chalk11 from "chalk";
1424
+ import fs2 from "fs";
1425
+ import { resolve as resolvePath8 } from "path";
1426
+ import {
1427
+ ClawMartClient
1428
+ } from "@aiready/clawmart";
1429
+ function getClient(options) {
1430
+ const apiKey = options.apiKey || process.env.CLAWMART_API_KEY;
1431
+ if (!apiKey) {
1432
+ console.error(chalk11.red("\u274C ClawMart API Key is required."));
1433
+ console.log(
1434
+ chalk11.dim(
1435
+ " Set CLAWMART_API_KEY environment variable or use --api-key flag."
1436
+ )
1437
+ );
1438
+ process.exit(1);
1439
+ }
1440
+ return new ClawMartClient(apiKey, options.server);
1441
+ }
1442
+ async function clawmartMeAction(options) {
1443
+ const client = getClient(options);
1444
+ try {
1445
+ const me = await client.getMe();
1446
+ console.log(chalk11.blue("\n\u{1F464} ClawMart Profile:"));
1447
+ console.log(` Name: ${chalk11.bold(me.name)}`);
1448
+ console.log(` Email: ${me.email}`);
1449
+ console.log(` Role: ${me.isCreator ? "Creator" : "User"}`);
1450
+ console.log(
1451
+ ` Sub: ${me.subscriptionActive ? chalk11.green("Active") : chalk11.red("Inactive")}`
1452
+ );
1453
+ } catch (error) {
1454
+ console.error(chalk11.red(`\u274C Failed to fetch profile: ${error.message}`));
1455
+ }
1456
+ }
1457
+ async function clawmartListingsAction(options) {
1458
+ const client = getClient(options);
1459
+ try {
1460
+ let listings;
1461
+ if (options.query) {
1462
+ listings = await client.searchListings(
1463
+ options.query,
1464
+ options.type,
1465
+ options.limit
1466
+ );
1467
+ } else {
1468
+ listings = await client.getListings();
1469
+ }
1470
+ if (listings.length === 0) {
1471
+ console.log(chalk11.yellow("\n\u{1F4ED} No listings found."));
1472
+ return;
1473
+ }
1474
+ console.log(chalk11.blue(`
1475
+ \u{1F3E0} ClawMart Listings (${listings.length}):`));
1476
+ listings.forEach((l) => {
1477
+ const status = l.published ? chalk11.green("Published") : chalk11.yellow("Draft");
1478
+ console.log(` - ${chalk11.bold(l.name)} (${chalk11.dim(l.id)})`);
1479
+ console.log(` ${chalk11.italic(l.tagline)}`);
1480
+ console.log(
1481
+ ` Price: $${l.price} | Type: ${l.productType} | Status: ${status}`
1482
+ );
1483
+ console.log("");
1484
+ });
1485
+ } catch (error) {
1486
+ console.error(chalk11.red(`\u274C Failed to fetch listings: ${error.message}`));
1487
+ }
1488
+ }
1489
+ async function clawmartCreateAction(options) {
1490
+ const client = getClient(options);
1491
+ try {
1492
+ const data = {
1493
+ name: options.name,
1494
+ tagline: options.tagline,
1495
+ about: options.about || "",
1496
+ category: options.category || "Utility",
1497
+ capabilities: options.capabilities ? options.capabilities.split(",") : [],
1498
+ price: parseFloat(options.price) || 0,
1499
+ productType: options.type
1500
+ };
1501
+ const listing = await client.createListing(data);
1502
+ console.log(chalk11.green(`
1503
+ \u2705 Listing created successfully!`));
1504
+ console.log(` ID: ${listing.id}`);
1505
+ console.log(` Name: ${listing.name}`);
1506
+ } catch (error) {
1507
+ console.error(chalk11.red(`\u274C Failed to create listing: ${error.message}`));
1508
+ }
1509
+ }
1510
+ async function clawmartUploadAction(id, files, options) {
1511
+ const client = getClient(options);
1512
+ try {
1513
+ const fileData = files.map((f) => {
1514
+ const path = resolvePath8(process.cwd(), f);
1515
+ if (!fs2.existsSync(path)) {
1516
+ throw new Error(`File not found: ${f}`);
1517
+ }
1518
+ return {
1519
+ path: f,
1520
+ content: fs2.readFileSync(path, "utf-8")
1521
+ };
1522
+ });
1523
+ await client.uploadVersion(id, fileData);
1524
+ console.log(
1525
+ chalk11.green(`
1526
+ \u2705 New version uploaded successfully to listing ${id}!`)
1527
+ );
1528
+ } catch (error) {
1529
+ console.error(chalk11.red(`\u274C Failed to upload version: ${error.message}`));
1530
+ }
1531
+ }
1532
+ async function clawmartDownloadAction(idOrSlug, options) {
1533
+ const client = getClient(options);
1534
+ try {
1535
+ const pkg = await client.downloadPackage(idOrSlug);
1536
+ const outDir = options.outDir || `./clawmart-${pkg.slug}`;
1537
+ if (!fs2.existsSync(outDir)) {
1538
+ fs2.mkdirSync(outDir, { recursive: true });
1539
+ }
1540
+ pkg.files.forEach((f) => {
1541
+ const filePath = resolvePath8(outDir, f.path);
1542
+ const dir = resolvePath8(filePath, "..");
1543
+ if (!fs2.existsSync(dir)) {
1544
+ fs2.mkdirSync(dir, { recursive: true });
1545
+ }
1546
+ fs2.writeFileSync(filePath, f.content);
1547
+ });
1548
+ console.log(
1549
+ chalk11.green(`
1550
+ \u2705 Package ${idOrSlug} downloaded to ${outDir}`)
1551
+ );
1552
+ } catch (error) {
1553
+ console.error(chalk11.red(`\u274C Failed to download package: ${error.message}`));
1554
+ }
1555
+ }
1556
+ var clawmartHelpText = `
1557
+ EXAMPLES:
1558
+ $ aiready clawmart me
1559
+ $ aiready clawmart listings --query "marketing"
1560
+ $ aiready clawmart create --name "SEO Booster" --tagline "Boost your SEO" --type skill --price 10
1561
+ $ aiready clawmart upload <listing-id> SKILL.md rules/
1562
+ $ aiready clawmart download <listing-id-or-slug> --outDir ./my-skill
1563
+
1564
+ ENVIRONMENT VARIABLES:
1565
+ CLAWMART_API_KEY Your ClawMart creator API key
1566
+ `;
1567
+
1353
1568
  // src/cli.ts
1354
1569
  var getDirname = () => {
1355
1570
  if (typeof __dirname !== "undefined") return __dirname;
@@ -1500,7 +1715,26 @@ program.command("visualize").description("Generate interactive visualization fro
1500
1715
  program.command("change-amplification").description("Analyze graph metrics for change amplification").argument("[directory]", "Directory to analyze", ".").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").action(async (directory, options) => {
1501
1716
  await changeAmplificationAction(directory, options);
1502
1717
  });
1718
+ program.command("testability").description("Analyze test coverage and AI readiness").argument("[directory]", "Directory to analyze", ".").option("--min-coverage <ratio>", "Minimum acceptable coverage ratio", "0.3").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").action(async (directory, options) => {
1719
+ await testabilityAction(directory, options);
1720
+ });
1503
1721
  program.command("upload").description("Upload an AIReady report JSON to the platform").argument("<file>", "Report JSON file to upload").option("--api-key <key>", "Platform API key").option("--repo-id <id>", "Platform repository ID (optional)").option("--server <url>", "Custom platform URL").addHelpText("after", uploadHelpText).action(async (file, options) => {
1504
1722
  await uploadAction(file, options);
1505
1723
  });
1724
+ var clawmart = program.command("clawmart").description("Manage ClawMart personas and skills").addHelpText("after", clawmartHelpText);
1725
+ clawmart.command("me").description("Show my ClawMart creator profile").option("--api-key <key>", "ClawMart API key").option("--server <url>", "Custom ClawMart API server").action(async (options) => {
1726
+ await clawmartMeAction(options);
1727
+ });
1728
+ clawmart.command("listings").description("Show my ClawMart listings").option("-q, --query <string>", "Search query").option("-t, --type <type>", "Filter by type: skill, persona").option("-l, --limit <number>", "Limit results", "10").option("--api-key <key>", "ClawMart API key").option("--server <url>", "Custom ClawMart API server").action(async (options) => {
1729
+ await clawmartListingsAction(options);
1730
+ });
1731
+ clawmart.command("create").description("Create a new listing on ClawMart").requiredOption("--name <string>", "Listing name").requiredOption("--tagline <string>", "Short tagline").option("--about <string>", "Full description").option("--category <string>", "Category", "Utility").option("--capabilities <string>", "Comma-separated list of capabilities").option("--price <number>", "Price in USD", "0").option("--type <type>", "Product type: skill, persona", "skill").option("--api-key <key>", "ClawMart API key").option("--server <url>", "Custom ClawMart API server").action(async (options) => {
1732
+ await clawmartCreateAction(options);
1733
+ });
1734
+ clawmart.command("upload").description("Upload content to a listing").argument("<id>", "Listing ID").argument("<files...>", "Files or directories to upload").option("--api-key <key>", "ClawMart API key").option("--server <url>", "Custom ClawMart API server").action(async (id, files, options) => {
1735
+ await clawmartUploadAction(id, files, options);
1736
+ });
1737
+ clawmart.command("download").description("Download a package from ClawMart").argument("<idOrSlug>", "Listing ID or Slug").option("--outDir <path>", "Output directory").option("--api-key <key>", "ClawMart API key").option("--server <url>", "Custom ClawMart API server").action(async (idOrSlug, options) => {
1738
+ await clawmartDownloadAction(idOrSlug, options);
1739
+ });
1506
1740
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/cli",
3
- "version": "0.12.20",
3
+ "version": "0.12.23",
4
4
  "description": "Unified CLI for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -11,17 +11,18 @@
11
11
  "dependencies": {
12
12
  "chalk": "^5.3.0",
13
13
  "commander": "^14.0.0",
14
- "@aiready/agent-grounding": "0.11.18",
15
- "@aiready/consistency": "0.18.18",
16
- "@aiready/context-analyzer": "0.19.18",
17
- "@aiready/deps": "0.11.18",
18
- "@aiready/change-amplification": "0.11.18",
19
- "@aiready/ai-signal-clarity": "0.11.18",
20
- "@aiready/testability": "0.4.18",
21
- "@aiready/visualizer": "0.4.19",
22
- "@aiready/pattern-detect": "0.14.18",
23
- "@aiready/doc-drift": "0.11.18",
24
- "@aiready/core": "0.21.18"
14
+ "@aiready/agent-grounding": "0.11.21",
15
+ "@aiready/clawmart": "0.1.2",
16
+ "@aiready/context-analyzer": "0.19.21",
17
+ "@aiready/core": "0.21.21",
18
+ "@aiready/consistency": "0.18.21",
19
+ "@aiready/doc-drift": "0.11.21",
20
+ "@aiready/ai-signal-clarity": "0.11.21",
21
+ "@aiready/pattern-detect": "0.14.21",
22
+ "@aiready/change-amplification": "0.11.21",
23
+ "@aiready/visualizer": "0.4.22",
24
+ "@aiready/deps": "0.11.21",
25
+ "@aiready/testability": "0.4.21"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/node": "^24.0.0",