@driftdev/cli 0.41.0 → 0.42.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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/drift.js +32 -30
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -95,7 +95,7 @@ Entry auto-detects from `package.json` (`types`, `exports`, `main`, `module`, `b
95
95
 
96
96
  ```bash
97
97
  # Machine-readable list of all commands + flags
98
- drift --capabilities
98
+ drift --tools
99
99
  ```
100
100
 
101
101
  ## Global Options
package/dist/drift.js CHANGED
@@ -1134,6 +1134,26 @@ function registerBreakingCommand(program) {
1134
1134
  });
1135
1135
  }
1136
1136
 
1137
+ // src/commands/commands.ts
1138
+ var GROUPS = {
1139
+ Composed: ["scan", "ci", "health"],
1140
+ Analysis: ["coverage", "lint", "examples"],
1141
+ Extraction: ["extract", "list", "get"],
1142
+ Comparison: ["diff", "breaking", "semver", "changelog"],
1143
+ Setup: ["init", "config", "context"],
1144
+ Plumbing: ["validate", "filter", "cache", "report", "release"]
1145
+ };
1146
+ function registerCommandsCommand(program) {
1147
+ program.command("commands").description("List all available commands grouped by category").action(() => {
1148
+ const maxGroup = Math.max(...Object.keys(GROUPS).map((g) => g.length));
1149
+ for (const [group, cmds] of Object.entries(GROUPS)) {
1150
+ const pad2 = " ".repeat(maxGroup - group.length);
1151
+ process.stdout.write(` ${group}${pad2} ${cmds.join(", ")}
1152
+ `);
1153
+ }
1154
+ });
1155
+ }
1156
+
1137
1157
  // src/formatters/cache.ts
1138
1158
  function renderCacheStatus(data) {
1139
1159
  const lines = [];
@@ -1392,11 +1412,11 @@ function renderContextMarkdown(data) {
1392
1412
  if (pkg.issues && pkg.issues.length > 0) {
1393
1413
  lines.push(`### ${pkg.name} — Issues`);
1394
1414
  lines.push("");
1395
- lines.push("| Export | Type | Location | Fixable |");
1396
- lines.push("|--------|------|----------|---------|");
1415
+ lines.push("| Export | Type | Location |");
1416
+ lines.push("|--------|------|----------|");
1397
1417
  for (const issue of pkg.issues) {
1398
1418
  const loc = issue.filePath ? `${issue.filePath}${issue.line ? `:${issue.line}` : ""}` : "—";
1399
- lines.push(`| ${issue.export} | ${issue.type} | ${loc} | ${issue.fixable ? "yes" : "no"} |`);
1419
+ lines.push(`| ${issue.export} | ${issue.type} | ${loc} |`);
1400
1420
  }
1401
1421
  lines.push("");
1402
1422
  }
@@ -2063,7 +2083,7 @@ function registerConfigCommand(program) {
2063
2083
  import { execSync as execSync3 } from "node:child_process";
2064
2084
  import { readFileSync as readFileSync12 } from "node:fs";
2065
2085
  import * as path14 from "node:path";
2066
- import { computeDrift as computeDrift2, isFixableDrift } from "@driftdev/sdk";
2086
+ import { computeDrift as computeDrift2 } from "@driftdev/sdk";
2067
2087
 
2068
2088
  // src/formatters/context.ts
2069
2089
  function renderContext(data) {
@@ -2116,8 +2136,7 @@ function buildPackageContext(name, spec) {
2116
2136
  type: drift.type,
2117
2137
  issue: drift.issue,
2118
2138
  filePath: drift.filePath ?? exp?.source?.file,
2119
- line: drift.line ?? exp?.source?.line,
2120
- fixable: isFixableDrift(drift)
2139
+ line: drift.line ?? exp?.source?.line
2121
2140
  });
2122
2141
  }
2123
2142
  }
@@ -3609,8 +3628,7 @@ import {
3609
3628
  buildExportRegistry,
3610
3629
  computeDrift as computeDrift4,
3611
3630
  detectProseDrift,
3612
- discoverMarkdownFiles,
3613
- isFixableDrift as isFixableDrift2
3631
+ discoverMarkdownFiles
3614
3632
  } from "@driftdev/sdk";
3615
3633
 
3616
3634
  // src/formatters/lint.ts
@@ -3723,16 +3741,9 @@ function registerLintCommand(program) {
3723
3741
  }
3724
3742
  } catch {}
3725
3743
  const data = { issues, count: issues.length };
3726
- let fixableCount = 0;
3727
- for (const [, drifts] of driftResult.exports) {
3728
- for (const d of drifts) {
3729
- if (isFixableDrift2(d))
3730
- fixableCount++;
3731
- }
3732
- }
3733
3744
  const next = issues.length > 0 ? {
3734
3745
  suggested: "drift-fix skill",
3735
- reason: `${fixableCount} of ${issues.length} issues are auto-fixable`
3746
+ reason: `${issues.length} issue${issues.length === 1 ? "" : "s"} found`
3736
3747
  } : undefined;
3737
3748
  formatOutput("lint", data, startTime, version, renderLint, next);
3738
3749
  if (issues.length > 0) {
@@ -4205,8 +4216,7 @@ import {
4205
4216
  buildExportRegistry as buildExportRegistry2,
4206
4217
  computeDrift as computeDrift8,
4207
4218
  detectProseDrift as detectProseDrift2,
4208
- discoverMarkdownFiles as discoverMarkdownFiles2,
4209
- isFixableDrift as isFixableDrift3
4219
+ discoverMarkdownFiles as discoverMarkdownFiles2
4210
4220
  } from "@driftdev/sdk";
4211
4221
 
4212
4222
  // src/formatters/scan.ts
@@ -4395,16 +4405,9 @@ function registerScanCommand(program) {
4395
4405
  };
4396
4406
  let next;
4397
4407
  if (issues.length > 0) {
4398
- let fixableCount = 0;
4399
- for (const [, drs] of driftResult.exports) {
4400
- for (const d of drs) {
4401
- if (isFixableDrift3(d))
4402
- fixableCount++;
4403
- }
4404
- }
4405
4408
  next = {
4406
4409
  suggested: "drift-fix skill",
4407
- reason: `${fixableCount} of ${issues.length} issues are auto-fixable`
4410
+ reason: `${issues.length} issue${issues.length === 1 ? "" : "s"} found`
4408
4411
  };
4409
4412
  } else if (total - documented > 0) {
4410
4413
  next = {
@@ -4644,7 +4647,8 @@ registerInitCommand(program);
4644
4647
  registerConfigCommand(program);
4645
4648
  registerContextCommand(program);
4646
4649
  registerCacheCommand(program);
4647
- var HUMAN_COMMANDS = new Set(["scan", "ci", "init"]);
4650
+ registerCommandsCommand(program);
4651
+ var HUMAN_COMMANDS = new Set(["scan", "ci", "init", "commands"]);
4648
4652
  for (const cmd of program.commands) {
4649
4653
  if (!HUMAN_COMMANDS.has(cmd.name())) {
4650
4654
  cmd._hidden = true;
@@ -4660,9 +4664,7 @@ var rawArgs = process.argv.slice(2);
4660
4664
  var hasHelpOrVersion = rawArgs.some((a) => ["-h", "--help", "-V", "--version", "--tools"].includes(a));
4661
4665
  var userArgs = rawArgs.filter((a) => !a.startsWith("-"));
4662
4666
  if (userArgs.length === 0 && !hasHelpOrVersion) {
4663
- const { configPath } = loadConfig();
4664
- const subcommand = configPath ? "scan" : "init";
4665
- process.argv.splice(2, 0, subcommand);
4667
+ process.argv.splice(2, 0, "scan");
4666
4668
  }
4667
4669
  program.parseAsync().catch(() => {
4668
4670
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftdev/cli",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "Drift CLI - Documentation coverage and drift detection for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",
@@ -43,7 +43,7 @@
43
43
  "dist"
44
44
  ],
45
45
  "dependencies": {
46
- "@driftdev/sdk": "^0.41.0",
46
+ "@driftdev/sdk": "^0.42.0",
47
47
  "@openpkg-ts/sdk": "^0.37.0",
48
48
  "@openpkg-ts/spec": "^0.37.0",
49
49
  "chalk": "^5.4.1",