@outfitter/tooling 0.2.3 → 0.2.4

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.
@@ -1,2 +1,2 @@
1
- import { CheckExportsOptions, CheckResult, CompareInput, ExportDrift, ExportMap, PackageResult, compareExports, entryToSubpath, runCheckExports } from "../shared/@outfitter/tooling-q0d60xb3";
2
- export { runCheckExports, entryToSubpath, compareExports, PackageResult, ExportMap, ExportDrift, CompareInput, CheckResult, CheckExportsOptions };
1
+ import { CheckExportsOptions, CheckResult, CompareInput, ExportDrift, ExportMap, PackageResult, compareExports, entryToSubpath, resolveJsonMode, runCheckExports } from "../shared/@outfitter/tooling-wesswf21";
2
+ export { runCheckExports, resolveJsonMode, entryToSubpath, compareExports, PackageResult, ExportMap, ExportDrift, CompareInput, CheckResult, CheckExportsOptions };
@@ -2,11 +2,13 @@
2
2
  import {
3
3
  compareExports,
4
4
  entryToSubpath,
5
+ resolveJsonMode,
5
6
  runCheckExports
6
- } from "../shared/@outfitter/tooling-tf22zt9p.js";
7
+ } from "../shared/@outfitter/tooling-enjcenja.js";
7
8
  import"../shared/@outfitter/tooling-dvwh9qve.js";
8
9
  export {
9
10
  runCheckExports,
11
+ resolveJsonMode,
10
12
  entryToSubpath,
11
13
  compareExports
12
14
  };
@@ -1,4 +1,4 @@
1
- import { ExportMap } from "../shared/@outfitter/tooling-q0d60xb3";
1
+ import { ExportMap } from "../shared/@outfitter/tooling-wesswf21";
2
2
  /** An import example extracted from a markdown code block */
3
3
  interface ImportExample {
4
4
  /** Package name, e.g. "@outfitter/cli" */
@@ -49,6 +49,7 @@ declare function isExportedSubpath(subpath: string, exports: ExportMap): boolean
49
49
  interface CheckReadmeImportsOptions {
50
50
  readonly json?: boolean;
51
51
  }
52
+ declare function resolveJsonMode(options?: CheckReadmeImportsOptions): boolean;
52
53
  /**
53
54
  * Run check-readme-imports across all workspace packages.
54
55
  *
@@ -57,4 +58,4 @@ interface CheckReadmeImportsOptions {
57
58
  * package.json exports.
58
59
  */
59
60
  declare function runCheckReadmeImports(options?: CheckReadmeImportsOptions): Promise<void>;
60
- export { runCheckReadmeImports, parseSpecifier, isExportedSubpath, extractImports, ImportExample, ImportCheckResult, ExportMap, CheckReadmeImportsOptions };
61
+ export { runCheckReadmeImports, resolveJsonMode, parseSpecifier, isExportedSubpath, extractImports, ImportExample, ImportCheckResult, ExportMap, CheckReadmeImportsOptions };
@@ -85,6 +85,9 @@ var COLORS = {
85
85
  blue: "\x1B[34m",
86
86
  dim: "\x1B[2m"
87
87
  };
88
+ function resolveJsonMode(options = {}) {
89
+ return options.json ?? process.env["OUTFITTER_JSON"] === "1";
90
+ }
88
91
  async function runCheckReadmeImports(options = {}) {
89
92
  const cwd = process.cwd();
90
93
  const readmeGlob = new Bun.Glob("**/README.md");
@@ -151,7 +154,7 @@ async function runCheckReadmeImports(options = {}) {
151
154
  hasInvalid = true;
152
155
  }
153
156
  }
154
- if (options.json) {
157
+ if (resolveJsonMode(options)) {
155
158
  const output = {
156
159
  ok: !hasInvalid,
157
160
  files: results
@@ -188,6 +191,7 @@ async function runCheckReadmeImports(options = {}) {
188
191
  }
189
192
  export {
190
193
  runCheckReadmeImports,
194
+ resolveJsonMode,
191
195
  parseSpecifier,
192
196
  isExportedSubpath,
193
197
  extractImports
package/dist/cli/index.js CHANGED
@@ -7,6 +7,8 @@ import {
7
7
  } from "../shared/chunk-3s189drz.js";
8
8
 
9
9
  // src/cli/index.ts
10
+ import { exitWithError } from "@outfitter/cli";
11
+ import { createCLI } from "@outfitter/cli/command";
10
12
  import { Command } from "commander";
11
13
 
12
14
  // src/cli/check.ts
@@ -501,6 +503,9 @@ var COLORS4 = {
501
503
  blue: "\x1B[34m",
502
504
  dim: "\x1B[2m"
503
505
  };
506
+ function resolveJsonMode(options = {}) {
507
+ return options.json ?? process.env["OUTFITTER_JSON"] === "1";
508
+ }
504
509
  async function runCheckExports(options = {}) {
505
510
  const cwd = process.cwd();
506
511
  const configPath = resolve3(cwd, "bunup.config.ts");
@@ -543,7 +548,7 @@ async function runCheckExports(options = {}) {
543
548
  ok: results.every((r) => r.status === "ok"),
544
549
  packages: results
545
550
  };
546
- if (options.json) {
551
+ if (resolveJsonMode(options)) {
547
552
  process.stdout.write(`${JSON.stringify(checkResult, null, 2)}
548
553
  `);
549
554
  } else {
@@ -1088,40 +1093,50 @@ async function runUpgradeBun(targetVersion, options = {}) {
1088
1093
  }
1089
1094
 
1090
1095
  // src/cli/index.ts
1091
- var program = new Command;
1092
- program.name("tooling").description("Dev tooling configuration management for Outfitter projects").version(VERSION);
1093
- program.command("init").description("Initialize tooling config in the current project").action(async () => {
1094
- await runInit();
1096
+ var cli = createCLI({
1097
+ name: "tooling",
1098
+ version: VERSION,
1099
+ description: "Dev tooling configuration management for Outfitter projects",
1100
+ onError: (error) => {
1101
+ const err = error instanceof Error ? error : new Error("An unexpected error occurred");
1102
+ exitWithError(err);
1103
+ }
1095
1104
  });
1096
- program.command("check").description("Run linting checks (wraps ultracite)").argument("[paths...]", "Paths to check").action(async (paths) => {
1105
+ function register(command) {
1106
+ cli.register(command);
1107
+ }
1108
+ register(new Command("init").description("Initialize tooling config in the current project").action(async () => {
1109
+ await runInit();
1110
+ }));
1111
+ register(new Command("check").description("Run linting checks (wraps ultracite)").argument("[paths...]", "Paths to check").action(async (paths) => {
1097
1112
  await runCheck(paths);
1098
- });
1099
- program.command("fix").description("Fix linting issues (wraps ultracite)").argument("[paths...]", "Paths to fix").action(async (paths) => {
1113
+ }));
1114
+ register(new Command("fix").description("Fix linting issues (wraps ultracite)").argument("[paths...]", "Paths to fix").action(async (paths) => {
1100
1115
  await runFix(paths);
1101
- });
1102
- program.command("upgrade-bun").description("Upgrade Bun version across the project").argument("[version]", "Target version (defaults to latest)").option("--no-install", "Skip installing Bun and updating lockfile").action(async (version, options) => {
1116
+ }));
1117
+ register(new Command("upgrade-bun").description("Upgrade Bun version across the project").argument("[version]", "Target version (defaults to latest)").option("--no-install", "Skip installing Bun and updating lockfile").action(async (version, options) => {
1103
1118
  await runUpgradeBun(version, options);
1104
- });
1105
- program.command("pre-push").description("TDD-aware pre-push strict verification hook").option("-f, --force", "Skip strict verification entirely").action(async (options) => {
1119
+ }));
1120
+ register(new Command("pre-push").description("TDD-aware pre-push strict verification hook").option("-f, --force", "Skip strict verification entirely").action(async (options) => {
1106
1121
  await runPrePush(options);
1107
- });
1108
- program.command("check-bunup-registry").description("Validate packages with bunup --filter are registered in bunup.config.ts").action(async () => {
1122
+ }));
1123
+ register(new Command("check-bunup-registry").description("Validate packages with bunup --filter are registered in bunup.config.ts").action(async () => {
1109
1124
  await runCheckBunupRegistry();
1110
- });
1111
- program.command("check-changeset").description("Validate PRs touching package source include a changeset").option("-s, --skip", "Skip changeset check").action(async (options) => {
1125
+ }));
1126
+ register(new Command("check-changeset").description("Validate PRs touching package source include a changeset").option("-s, --skip", "Skip changeset check").action(async (options) => {
1112
1127
  await runCheckChangeset(options);
1113
- });
1114
- program.command("check-exports").description("Validate package.json exports match source entry points").option("--json", "Output results as JSON").action(async (options) => {
1128
+ }));
1129
+ register(new Command("check-exports").description("Validate package.json exports match source entry points").option("--json", "Output results as JSON").action(async (options) => {
1115
1130
  await runCheckExports(options);
1116
- });
1117
- program.command("check-clean-tree").description("Assert working tree is clean (no modified or untracked files)").option("--paths <paths...>", "Limit check to specific paths").action(async (options) => {
1131
+ }));
1132
+ register(new Command("check-clean-tree").description("Assert working tree is clean (no modified or untracked files)").option("--paths <paths...>", "Limit check to specific paths").action(async (options) => {
1118
1133
  await runCheckCleanTree(options);
1119
- });
1120
- program.command("check-readme-imports").description("Validate README import examples match package exports").option("--json", "Output results as JSON").action(async (options) => {
1121
- const { runCheckReadmeImports } = await import("../shared/chunk-6a7tjcgm.js");
1134
+ }));
1135
+ register(new Command("check-readme-imports").description("Validate README import examples match package exports").option("--json", "Output results as JSON").action(async (options) => {
1136
+ const { runCheckReadmeImports } = await import("../shared/chunk-7tdgbqb0.js");
1122
1137
  await runCheckReadmeImports(options);
1123
- });
1124
- program.command("check-boundary-invocations").description("Validate root/app scripts do not execute packages/*/src entrypoints directly").action(async () => {
1138
+ }));
1139
+ register(new Command("check-boundary-invocations").description("Validate root/app scripts do not execute packages/*/src entrypoints directly").action(async () => {
1125
1140
  await runCheckBoundaryInvocations();
1126
- });
1127
- program.parse();
1141
+ }));
1142
+ await cli.parse();
@@ -141,6 +141,9 @@ var COLORS = {
141
141
  blue: "\x1B[34m",
142
142
  dim: "\x1B[2m"
143
143
  };
144
+ function resolveJsonMode(options = {}) {
145
+ return options.json ?? process.env["OUTFITTER_JSON"] === "1";
146
+ }
144
147
  async function runCheckExports(options = {}) {
145
148
  const cwd = process.cwd();
146
149
  const configPath = resolve(cwd, "bunup.config.ts");
@@ -183,7 +186,7 @@ async function runCheckExports(options = {}) {
183
186
  ok: results.every((r) => r.status === "ok"),
184
187
  packages: results
185
188
  };
186
- if (options.json) {
189
+ if (resolveJsonMode(options)) {
187
190
  process.stdout.write(`${JSON.stringify(checkResult, null, 2)}
188
191
  `);
189
192
  } else {
@@ -223,4 +226,4 @@ async function runCheckExports(options = {}) {
223
226
  process.exit(checkResult.ok ? 0 : 1);
224
227
  }
225
228
 
226
- export { entryToSubpath, compareExports, runCheckExports };
229
+ export { entryToSubpath, compareExports, resolveJsonMode, runCheckExports };
@@ -49,10 +49,11 @@ declare function compareExports(input: CompareInput): PackageResult;
49
49
  interface CheckExportsOptions {
50
50
  readonly json?: boolean;
51
51
  }
52
+ declare function resolveJsonMode(options?: CheckExportsOptions): boolean;
52
53
  /**
53
54
  * Run check-exports across all workspace packages.
54
55
  *
55
56
  * Reads the bunup workspace config to discover packages and their * settings, then compares expected vs actual exports in each package.json.
56
57
  */
57
58
  declare function runCheckExports(options?: CheckExportsOptions): Promise<void>;
58
- export { ExportMap, ExportDrift, PackageResult, CheckResult, CompareInput, entryToSubpath, compareExports, CheckExportsOptions, runCheckExports };
59
+ export { ExportMap, ExportDrift, PackageResult, CheckResult, CompareInput, entryToSubpath, compareExports, CheckExportsOptions, resolveJsonMode, runCheckExports };
@@ -84,6 +84,9 @@ var COLORS = {
84
84
  blue: "\x1B[34m",
85
85
  dim: "\x1B[2m"
86
86
  };
87
+ function resolveJsonMode(options = {}) {
88
+ return options.json ?? process.env["OUTFITTER_JSON"] === "1";
89
+ }
87
90
  async function runCheckReadmeImports(options = {}) {
88
91
  const cwd = process.cwd();
89
92
  const readmeGlob = new Bun.Glob("**/README.md");
@@ -150,7 +153,7 @@ async function runCheckReadmeImports(options = {}) {
150
153
  hasInvalid = true;
151
154
  }
152
155
  }
153
- if (options.json) {
156
+ if (resolveJsonMode(options)) {
154
157
  const output = {
155
158
  ok: !hasInvalid,
156
159
  files: results
@@ -187,6 +190,7 @@ async function runCheckReadmeImports(options = {}) {
187
190
  }
188
191
  export {
189
192
  runCheckReadmeImports,
193
+ resolveJsonMode,
190
194
  parseSpecifier,
191
195
  isExportedSubpath,
192
196
  extractImports
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outfitter/tooling",
3
3
  "description": "Dev tooling configuration presets for Outfitter projects (biome, typescript, lefthook, markdownlint)",
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -72,9 +72,11 @@
72
72
  "lint:fix": "biome lint --write ./src",
73
73
  "test": "bun test",
74
74
  "typecheck": "tsc --noEmit",
75
- "clean": "rm -rf dist registry"
75
+ "clean": "rm -rf dist registry",
76
+ "prepublishOnly": "bun ../../scripts/check-publish-manifest.ts"
76
77
  },
77
78
  "dependencies": {
79
+ "@outfitter/cli": "0.5.1",
78
80
  "commander": "^14.0.2",
79
81
  "zod": "^3.25.17"
80
82
  },