@aiready/cli 0.12.20 → 0.13.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.
Files changed (55) hide show
  1. package/.turbo/turbo-build.log +10 -10
  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 +259 -16
  32. package/dist/cli.mjs +259 -15
  33. package/package.json +13 -12
  34. package/src/.aiready/aiready-report-20260308-174006.json +29526 -0
  35. package/src/.aiready/aiready-report-20260310-153526.json +34441 -0
  36. package/src/.aiready/aiready-report-20260310-155555.json +34441 -0
  37. package/src/.aiready/aiready-report-20260310-162403.json +34441 -0
  38. package/src/.aiready/aiready-report-20260310-183821.json +34448 -0
  39. package/src/__tests__/unified.test.ts +95 -0
  40. package/src/cli.ts +86 -0
  41. package/src/commands/__tests__/agent-grounding.test.ts +24 -0
  42. package/src/commands/__tests__/ai-signal-clarity.test.ts +32 -0
  43. package/src/commands/__tests__/consistency.test.ts +97 -0
  44. package/src/commands/__tests__/deps-health.test.ts +26 -0
  45. package/src/commands/__tests__/doc-drift.test.ts +26 -0
  46. package/src/commands/__tests__/extra-commands.test.ts +177 -0
  47. package/src/commands/__tests__/scan.test.ts +151 -0
  48. package/src/commands/__tests__/testability.test.ts +36 -0
  49. package/src/commands/__tests__/upload.test.ts +51 -0
  50. package/src/commands/__tests__/visualize.test.ts +82 -0
  51. package/src/commands/clawmart.ts +162 -0
  52. package/src/commands/index.ts +8 -0
  53. package/src/commands/scan.ts +45 -13
  54. package/src/utils/__tests__/helpers.test.ts +35 -0
  55. package/vitest.config.ts +20 -0
package/dist/cli.mjs CHANGED
@@ -22,12 +22,11 @@ import {
22
22
  resolveOutputPath,
23
23
  formatScore,
24
24
  calculateTokenBudget,
25
- estimateCostFromBudget,
26
- getModelPreset,
27
25
  getRating,
28
26
  getRepoMetadata,
29
27
  Severity,
30
- ToolName
28
+ ToolName,
29
+ emitIssuesAsAnnotations
31
30
  } from "@aiready/core";
32
31
 
33
32
  // src/utils/helpers.ts
@@ -430,26 +429,46 @@ async function scanAction(directory, options) {
430
429
  wastedTokens: {
431
430
  duplication: totalWastedDuplication,
432
431
  fragmentation: totalWastedFragmentation,
433
- chattiness: 0
432
+ chattiness: totalContext * 0.1
433
+ // Default chattiness
434
434
  }
435
435
  });
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"));
436
+ const allIssues = [];
437
+ for (const toolId of results.summary.toolsRun) {
438
+ if (results[toolId]?.results) {
439
+ results[toolId].results.forEach((fileRes) => {
440
+ if (fileRes.issues) {
441
+ allIssues.push(...fileRes.issues);
442
+ }
443
+ });
444
+ }
445
+ }
446
+ const modelId = options.model || "claude-3-5-sonnet";
447
+ const roi = (await import("@aiready/core")).calculateBusinessROI({
448
+ tokenWaste: unifiedBudget.wastedTokens.total,
449
+ issues: allIssues,
450
+ modelId
451
+ });
452
+ console.log(chalk3.bold("\n\u{1F4B0} Business Impact Analysis (Monthly)"));
439
453
  console.log(
440
- ` Efficiency: ${(unifiedBudget.efficiencyRatio * 100).toFixed(0)}%`
454
+ ` Potential Savings: ${chalk3.green(chalk3.bold("$" + roi.monthlySavings.toLocaleString()))}`
441
455
  );
442
456
  console.log(
443
- ` Wasted Tokens: ${chalk3.red(unifiedBudget.wastedTokens.total.toLocaleString())}`
457
+ ` Productivity Gain: ${chalk3.cyan(chalk3.bold(roi.productivityGainHours + "h"))} (est. dev time)`
444
458
  );
445
459
  console.log(
446
- ` Est. Monthly Cost (${modelPreset.name}): ${chalk3.bold("$" + costEstimate.total)}`
460
+ ` Context Efficiency: ${chalk3.yellow((unifiedBudget.efficiencyRatio * 100).toFixed(0) + "%")}`
447
461
  );
448
- scoringResult.tokenBudget = unifiedBudget;
449
- scoringResult.costEstimate = {
450
- model: modelPreset.name,
451
- ...costEstimate
462
+ console.log(
463
+ ` Annual Value: ${chalk3.bold("$" + roi.annualValue.toLocaleString())} (ROI Prediction)`
464
+ );
465
+ results.summary.businessImpact = {
466
+ estimatedMonthlyWaste: roi.monthlySavings,
467
+ potentialSavings: roi.monthlySavings,
468
+ productivityHours: roi.productivityGainHours
452
469
  };
470
+ scoringResult.tokenBudget = unifiedBudget;
471
+ scoringResult.businessROI = roi;
453
472
  }
454
473
  if (scoringResult.breakdown) {
455
474
  console.log(chalk3.bold("\nTool breakdown:"));
@@ -525,11 +544,20 @@ async function scanAction(directory, options) {
525
544
  const failOnLevel = options.failOn || "critical";
526
545
  let shouldFail = false;
527
546
  let failReason = "";
547
+ const report = mapToUnifiedReport(results, scoringResult);
548
+ if (report.results && report.results.length > 0) {
549
+ console.log(
550
+ chalk3.cyan(
551
+ `
552
+ \u{1F4DD} Emitting GitHub Action annotations for ${report.results.length} issues...`
553
+ )
554
+ );
555
+ emitIssuesAsAnnotations(report.results);
556
+ }
528
557
  if (threshold && scoringResult.overall < threshold) {
529
558
  shouldFail = true;
530
559
  failReason = `Score ${scoringResult.overall} < threshold ${threshold}`;
531
560
  }
532
- const report = mapToUnifiedReport(results, scoringResult);
533
561
  if (failOnLevel !== "none") {
534
562
  if (failOnLevel === "critical" && report.summary.criticalIssues > 0) {
535
563
  shouldFail = true;
@@ -1346,10 +1374,207 @@ import { loadConfig as loadConfig2, mergeConfigWithDefaults as mergeConfigWithDe
1346
1374
  // src/commands/testability.ts
1347
1375
  import chalk10 from "chalk";
1348
1376
  import { loadConfig as loadConfig3, mergeConfigWithDefaults as mergeConfigWithDefaults3 } from "@aiready/core";
1377
+ async function testabilityAction(directory, options) {
1378
+ const { analyzeTestability, calculateTestabilityScore } = await import("@aiready/testability");
1379
+ const config = await loadConfig3(directory);
1380
+ const merged = mergeConfigWithDefaults3(config, {
1381
+ minCoverageRatio: 0.3
1382
+ });
1383
+ const report = await analyzeTestability({
1384
+ rootDir: directory,
1385
+ minCoverageRatio: options.minCoverageRatio ?? merged.minCoverageRatio,
1386
+ include: options.include,
1387
+ exclude: options.exclude
1388
+ });
1389
+ const scoring = calculateTestabilityScore(report);
1390
+ if (options.output === "json") {
1391
+ return scoring;
1392
+ }
1393
+ const safetyIcons = {
1394
+ safe: "\u2705",
1395
+ "moderate-risk": "\u26A0\uFE0F ",
1396
+ "high-risk": "\u{1F534}",
1397
+ "blind-risk": "\u{1F480}"
1398
+ };
1399
+ const safetyColors = {
1400
+ safe: chalk10.green,
1401
+ "moderate-risk": chalk10.yellow,
1402
+ "high-risk": chalk10.red,
1403
+ "blind-risk": chalk10.bgRed.white
1404
+ };
1405
+ const safety = report.summary.aiChangeSafetyRating;
1406
+ const icon = safetyIcons[safety] ?? "\u2753";
1407
+ const color = safetyColors[safety] ?? chalk10.white;
1408
+ console.log(
1409
+ ` \u{1F9EA} Testability: ${chalk10.bold(scoring.score + "/100")} (${report.summary.rating})`
1410
+ );
1411
+ console.log(
1412
+ ` AI Change Safety: ${color(`${icon} ${safety.toUpperCase()}`)}`
1413
+ );
1414
+ console.log(
1415
+ chalk10.dim(
1416
+ ` Coverage: ${Math.round(report.summary.coverageRatio * 100)}% (${report.rawData.testFiles} test / ${report.rawData.sourceFiles} source files)`
1417
+ )
1418
+ );
1419
+ if (safety === "blind-risk") {
1420
+ console.log(
1421
+ chalk10.red.bold(
1422
+ "\n \u26A0\uFE0F NO TESTS \u2014 AI changes to this codebase are completely unverifiable!\n"
1423
+ )
1424
+ );
1425
+ }
1426
+ return scoring;
1427
+ }
1349
1428
 
1350
1429
  // src/commands/change-amplification.ts
1351
1430
  import { changeAmplificationAction } from "@aiready/change-amplification/dist/cli.js";
1352
1431
 
1432
+ // src/commands/clawmart.ts
1433
+ import chalk11 from "chalk";
1434
+ import fs2 from "fs";
1435
+ import { resolve as resolvePath8 } from "path";
1436
+ import {
1437
+ ClawMartClient
1438
+ } from "@aiready/clawmart";
1439
+ function getClient(options) {
1440
+ const apiKey = options.apiKey || process.env.CLAWMART_API_KEY;
1441
+ if (!apiKey) {
1442
+ console.error(chalk11.red("\u274C ClawMart API Key is required."));
1443
+ console.log(
1444
+ chalk11.dim(
1445
+ " Set CLAWMART_API_KEY environment variable or use --api-key flag."
1446
+ )
1447
+ );
1448
+ process.exit(1);
1449
+ }
1450
+ return new ClawMartClient(apiKey, options.server);
1451
+ }
1452
+ async function clawmartMeAction(options) {
1453
+ const client = getClient(options);
1454
+ try {
1455
+ const me = await client.getMe();
1456
+ console.log(chalk11.blue("\n\u{1F464} ClawMart Profile:"));
1457
+ console.log(` Name: ${chalk11.bold(me.name)}`);
1458
+ console.log(` Email: ${me.email}`);
1459
+ console.log(` Role: ${me.isCreator ? "Creator" : "User"}`);
1460
+ console.log(
1461
+ ` Sub: ${me.subscriptionActive ? chalk11.green("Active") : chalk11.red("Inactive")}`
1462
+ );
1463
+ } catch (error) {
1464
+ console.error(chalk11.red(`\u274C Failed to fetch profile: ${error.message}`));
1465
+ }
1466
+ }
1467
+ async function clawmartListingsAction(options) {
1468
+ const client = getClient(options);
1469
+ try {
1470
+ let listings;
1471
+ if (options.query) {
1472
+ listings = await client.searchListings(
1473
+ options.query,
1474
+ options.type,
1475
+ options.limit
1476
+ );
1477
+ } else {
1478
+ listings = await client.getListings();
1479
+ }
1480
+ if (listings.length === 0) {
1481
+ console.log(chalk11.yellow("\n\u{1F4ED} No listings found."));
1482
+ return;
1483
+ }
1484
+ console.log(chalk11.blue(`
1485
+ \u{1F3E0} ClawMart Listings (${listings.length}):`));
1486
+ listings.forEach((l) => {
1487
+ const status = l.published ? chalk11.green("Published") : chalk11.yellow("Draft");
1488
+ console.log(` - ${chalk11.bold(l.name)} (${chalk11.dim(l.id)})`);
1489
+ console.log(` ${chalk11.italic(l.tagline)}`);
1490
+ console.log(
1491
+ ` Price: $${l.price} | Type: ${l.productType} | Status: ${status}`
1492
+ );
1493
+ console.log("");
1494
+ });
1495
+ } catch (error) {
1496
+ console.error(chalk11.red(`\u274C Failed to fetch listings: ${error.message}`));
1497
+ }
1498
+ }
1499
+ async function clawmartCreateAction(options) {
1500
+ const client = getClient(options);
1501
+ try {
1502
+ const data = {
1503
+ name: options.name,
1504
+ tagline: options.tagline,
1505
+ about: options.about || "",
1506
+ category: options.category || "Utility",
1507
+ capabilities: options.capabilities ? options.capabilities.split(",") : [],
1508
+ price: parseFloat(options.price) || 0,
1509
+ productType: options.type
1510
+ };
1511
+ const listing = await client.createListing(data);
1512
+ console.log(chalk11.green(`
1513
+ \u2705 Listing created successfully!`));
1514
+ console.log(` ID: ${listing.id}`);
1515
+ console.log(` Name: ${listing.name}`);
1516
+ } catch (error) {
1517
+ console.error(chalk11.red(`\u274C Failed to create listing: ${error.message}`));
1518
+ }
1519
+ }
1520
+ async function clawmartUploadAction(id, files, options) {
1521
+ const client = getClient(options);
1522
+ try {
1523
+ const fileData = files.map((f) => {
1524
+ const path = resolvePath8(process.cwd(), f);
1525
+ if (!fs2.existsSync(path)) {
1526
+ throw new Error(`File not found: ${f}`);
1527
+ }
1528
+ return {
1529
+ path: f,
1530
+ content: fs2.readFileSync(path, "utf-8")
1531
+ };
1532
+ });
1533
+ await client.uploadVersion(id, fileData);
1534
+ console.log(
1535
+ chalk11.green(`
1536
+ \u2705 New version uploaded successfully to listing ${id}!`)
1537
+ );
1538
+ } catch (error) {
1539
+ console.error(chalk11.red(`\u274C Failed to upload version: ${error.message}`));
1540
+ }
1541
+ }
1542
+ async function clawmartDownloadAction(idOrSlug, options) {
1543
+ const client = getClient(options);
1544
+ try {
1545
+ const pkg = await client.downloadPackage(idOrSlug);
1546
+ const outDir = options.outDir || `./clawmart-${pkg.slug}`;
1547
+ if (!fs2.existsSync(outDir)) {
1548
+ fs2.mkdirSync(outDir, { recursive: true });
1549
+ }
1550
+ pkg.files.forEach((f) => {
1551
+ const filePath = resolvePath8(outDir, f.path);
1552
+ const dir = resolvePath8(filePath, "..");
1553
+ if (!fs2.existsSync(dir)) {
1554
+ fs2.mkdirSync(dir, { recursive: true });
1555
+ }
1556
+ fs2.writeFileSync(filePath, f.content);
1557
+ });
1558
+ console.log(
1559
+ chalk11.green(`
1560
+ \u2705 Package ${idOrSlug} downloaded to ${outDir}`)
1561
+ );
1562
+ } catch (error) {
1563
+ console.error(chalk11.red(`\u274C Failed to download package: ${error.message}`));
1564
+ }
1565
+ }
1566
+ var clawmartHelpText = `
1567
+ EXAMPLES:
1568
+ $ aiready clawmart me
1569
+ $ aiready clawmart listings --query "marketing"
1570
+ $ aiready clawmart create --name "SEO Booster" --tagline "Boost your SEO" --type skill --price 10
1571
+ $ aiready clawmart upload <listing-id> SKILL.md rules/
1572
+ $ aiready clawmart download <listing-id-or-slug> --outDir ./my-skill
1573
+
1574
+ ENVIRONMENT VARIABLES:
1575
+ CLAWMART_API_KEY Your ClawMart creator API key
1576
+ `;
1577
+
1353
1578
  // src/cli.ts
1354
1579
  var getDirname = () => {
1355
1580
  if (typeof __dirname !== "undefined") return __dirname;
@@ -1500,7 +1725,26 @@ program.command("visualize").description("Generate interactive visualization fro
1500
1725
  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
1726
  await changeAmplificationAction(directory, options);
1502
1727
  });
1728
+ 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) => {
1729
+ await testabilityAction(directory, options);
1730
+ });
1503
1731
  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
1732
  await uploadAction(file, options);
1505
1733
  });
1734
+ var clawmart = program.command("clawmart").description("Manage ClawMart personas and skills").addHelpText("after", clawmartHelpText);
1735
+ 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) => {
1736
+ await clawmartMeAction(options);
1737
+ });
1738
+ 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) => {
1739
+ await clawmartListingsAction(options);
1740
+ });
1741
+ 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) => {
1742
+ await clawmartCreateAction(options);
1743
+ });
1744
+ 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) => {
1745
+ await clawmartUploadAction(id, files, options);
1746
+ });
1747
+ 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) => {
1748
+ await clawmartDownloadAction(idOrSlug, options);
1749
+ });
1506
1750
  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.13.0",
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/clawmart": "0.1.2",
15
+ "@aiready/context-analyzer": "0.20.0",
16
+ "@aiready/agent-grounding": "0.12.0",
17
+ "@aiready/consistency": "0.19.0",
18
+ "@aiready/core": "0.22.0",
19
+ "@aiready/deps": "0.12.0",
20
+ "@aiready/doc-drift": "0.12.0",
21
+ "@aiready/change-amplification": "0.12.0",
22
+ "@aiready/ai-signal-clarity": "0.12.0",
23
+ "@aiready/pattern-detect": "0.15.0",
24
+ "@aiready/visualizer": "0.5.0",
25
+ "@aiready/testability": "0.5.0"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/node": "^24.0.0",