@outfitter/tooling 0.3.3 → 0.3.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.
- package/.markdownlint-cli2.jsonc +55 -55
- package/README.md +21 -21
- package/dist/bun-version-compat.d.ts +2 -0
- package/dist/bun-version-compat.js +10 -0
- package/dist/cli/check-boundary-invocations.d.ts +34 -0
- package/dist/cli/check-boundary-invocations.js +14 -0
- package/dist/cli/check-bunup-registry.d.ts +36 -0
- package/dist/cli/check-bunup-registry.js +12 -0
- package/dist/cli/check-changeset.d.ts +66 -0
- package/dist/cli/check-changeset.js +20 -0
- package/dist/cli/check-clean-tree.d.ts +36 -0
- package/dist/cli/check-clean-tree.js +14 -0
- package/dist/cli/check-exports.d.ts +2 -0
- package/dist/cli/check-exports.js +14 -0
- package/dist/cli/check-markdown-links.d.ts +42 -0
- package/dist/cli/check-markdown-links.js +13 -0
- package/dist/cli/check-readme-imports.d.ts +60 -0
- package/dist/{shared/chunk-7tdgbqb0.js → cli/check-readme-imports.js} +7 -6
- package/dist/cli/check-tsdoc.d.ts +2 -0
- package/dist/cli/check-tsdoc.js +36 -0
- package/dist/cli/check.d.ts +19 -0
- package/dist/cli/check.js +10 -0
- package/dist/cli/fix.d.ts +19 -0
- package/dist/cli/fix.js +10 -0
- package/dist/cli/index.js +49 -1218
- package/dist/cli/init.d.ts +31 -0
- package/dist/cli/init.js +12 -0
- package/dist/cli/pre-push.d.ts +60 -0
- package/dist/cli/pre-push.js +27 -0
- package/dist/cli/upgrade-bun.d.ts +8 -0
- package/dist/cli/upgrade-bun.js +9 -0
- package/dist/index.d.ts +6 -186
- package/dist/index.js +4 -42
- package/dist/registry/build.d.ts +4 -0
- package/dist/registry/build.js +279 -0
- package/dist/registry/index.d.ts +3 -0
- package/dist/registry/index.js +1 -0
- package/dist/registry/schema.d.ts +2 -0
- package/dist/registry/schema.js +28 -0
- package/dist/shared/@outfitter/tooling-1hez6j9d.js +21 -0
- package/dist/shared/@outfitter/tooling-6cxfdx0q.js +187 -0
- package/dist/shared/{chunk-cmde0fwx.js → @outfitter/tooling-875svjnz.js} +16 -31
- package/dist/shared/@outfitter/tooling-9ram55dd.js +69 -0
- package/dist/shared/@outfitter/tooling-9vs606gq.d.ts +3 -0
- package/dist/shared/@outfitter/tooling-a4bfx4be.js +21 -0
- package/dist/shared/@outfitter/tooling-amrbp7cm.js +102 -0
- package/dist/shared/@outfitter/tooling-ctmgnap5.js +19 -0
- package/dist/shared/@outfitter/tooling-d363b88r.js +349 -0
- package/dist/shared/@outfitter/tooling-gcdvsqqp.js +73 -0
- package/dist/shared/@outfitter/tooling-h04te11c.js +231 -0
- package/dist/shared/@outfitter/tooling-ja1zg5yc.js +214 -0
- package/dist/shared/@outfitter/tooling-jnrs9rqd.js +4 -0
- package/dist/shared/@outfitter/tooling-mkynjra9.js +23 -0
- package/dist/shared/@outfitter/tooling-njw4z34x.d.ts +140 -0
- package/dist/shared/@outfitter/tooling-pq47jv6t.js +213 -0
- package/dist/shared/@outfitter/tooling-sjm8nebx.d.ts +109 -0
- package/dist/shared/@outfitter/tooling-vjmhvpjq.d.ts +29 -0
- package/dist/shared/@outfitter/tooling-wesswf21.d.ts +59 -0
- package/dist/shared/@outfitter/tooling-wwm97f47.js +81 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +8 -0
- package/package.json +134 -131
- package/registry/registry.json +17 -10
- package/tsconfig.preset.bun.json +5 -5
- package/tsconfig.preset.json +33 -33
- package/biome.json +0 -81
- package/dist/shared/chunk-3s189drz.js +0 -4
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI init command - Initialize tooling config in a project
|
|
3
|
+
*/
|
|
4
|
+
/** Package.json structure for framework detection */
|
|
5
|
+
interface PackageJson {
|
|
6
|
+
dependencies?: Record<string, string>;
|
|
7
|
+
devDependencies?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
/** Options for building the ultracite command */
|
|
10
|
+
interface UltraciteOptions {
|
|
11
|
+
frameworks?: string[];
|
|
12
|
+
quiet?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Detect frameworks from package.json dependencies
|
|
16
|
+
* @param pkg - Package.json contents
|
|
17
|
+
* @returns Array of CLI flags for detected frameworks
|
|
18
|
+
*/
|
|
19
|
+
declare function detectFrameworks(pkg: PackageJson): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Build the ultracite init command with appropriate flags
|
|
22
|
+
* @param options - Command options
|
|
23
|
+
* @returns Array of command arguments
|
|
24
|
+
*/
|
|
25
|
+
declare function buildUltraciteCommand(options: UltraciteOptions): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Run the init command
|
|
28
|
+
* @param cwd - Working directory
|
|
29
|
+
*/
|
|
30
|
+
declare function runInit(cwd?: string): Promise<void>;
|
|
31
|
+
export { runInit, detectFrameworks, buildUltraciteCommand };
|
package/dist/cli/init.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if branch is a TDD RED phase branch
|
|
3
|
+
*/
|
|
4
|
+
declare function isRedPhaseBranch(branch: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Check if branch is a scaffold branch
|
|
7
|
+
*/
|
|
8
|
+
declare function isScaffoldBranch(branch: string): boolean;
|
|
9
|
+
declare function isReleaseBranch(branch: string): boolean;
|
|
10
|
+
declare function isTestOnlyPath(path: string): boolean;
|
|
11
|
+
declare function areFilesTestOnly(paths: readonly string[]): boolean;
|
|
12
|
+
interface PushChangedFiles {
|
|
13
|
+
readonly files: readonly string[];
|
|
14
|
+
readonly deterministic: boolean;
|
|
15
|
+
readonly source: "upstream" | "baseRef" | "undetermined";
|
|
16
|
+
}
|
|
17
|
+
declare function canBypassRedPhaseByChangedFiles(changedFiles: PushChangedFiles): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Check whether any changed files are package source files.
|
|
20
|
+
*
|
|
21
|
+
* Matches files under "packages/PKGNAME/src/" (any depth).
|
|
22
|
+
*/
|
|
23
|
+
declare function hasPackageSourceChanges(changedFiles: PushChangedFiles): boolean;
|
|
24
|
+
type ScriptMap = Readonly<Record<string, string | undefined>>;
|
|
25
|
+
type VerificationPlan = {
|
|
26
|
+
readonly ok: true;
|
|
27
|
+
readonly scripts: readonly string[];
|
|
28
|
+
readonly source: "verify:ci" | "fallback";
|
|
29
|
+
} | {
|
|
30
|
+
readonly ok: false;
|
|
31
|
+
readonly error: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Derive strict pre-push verification from package scripts.
|
|
35
|
+
*
|
|
36
|
+
* Priority:
|
|
37
|
+
* 1) `verify:ci`
|
|
38
|
+
* 2) fallback sequence: `typecheck`, `check|lint`, `build`, `test`
|
|
39
|
+
*/
|
|
40
|
+
declare function createVerificationPlan(scripts: ScriptMap): VerificationPlan;
|
|
41
|
+
interface BunVersionCheckResult {
|
|
42
|
+
readonly matches: boolean;
|
|
43
|
+
readonly expected?: string;
|
|
44
|
+
readonly actual?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check that the local Bun version matches the pinned version in ".bun-version".
|
|
48
|
+
*
|
|
49
|
+
* @param projectRoot - Directory containing ".bun-version" (defaults to cwd)
|
|
50
|
+
* @returns Result indicating whether versions match
|
|
51
|
+
*/
|
|
52
|
+
declare function checkBunVersion(projectRoot?: string): BunVersionCheckResult;
|
|
53
|
+
interface PrePushOptions {
|
|
54
|
+
force?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Main pre-push command
|
|
58
|
+
*/
|
|
59
|
+
declare function runPrePush(options?: PrePushOptions): Promise<void>;
|
|
60
|
+
export { runPrePush, isTestOnlyPath, isScaffoldBranch, isReleaseBranch, isRedPhaseBranch, hasPackageSourceChanges, createVerificationPlan, checkBunVersion, canBypassRedPhaseByChangedFiles, areFilesTestOnly, VerificationPlan, PushChangedFiles, PrePushOptions, BunVersionCheckResult };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
areFilesTestOnly,
|
|
4
|
+
canBypassRedPhaseByChangedFiles,
|
|
5
|
+
checkBunVersion,
|
|
6
|
+
createVerificationPlan,
|
|
7
|
+
hasPackageSourceChanges,
|
|
8
|
+
isRedPhaseBranch,
|
|
9
|
+
isReleaseBranch,
|
|
10
|
+
isScaffoldBranch,
|
|
11
|
+
isTestOnlyPath,
|
|
12
|
+
runPrePush
|
|
13
|
+
} from "../shared/@outfitter/tooling-d363b88r.js";
|
|
14
|
+
import"../shared/@outfitter/tooling-875svjnz.js";
|
|
15
|
+
import"../shared/@outfitter/tooling-jnrs9rqd.js";
|
|
16
|
+
export {
|
|
17
|
+
runPrePush,
|
|
18
|
+
isTestOnlyPath,
|
|
19
|
+
isScaffoldBranch,
|
|
20
|
+
isReleaseBranch,
|
|
21
|
+
isRedPhaseBranch,
|
|
22
|
+
hasPackageSourceChanges,
|
|
23
|
+
createVerificationPlan,
|
|
24
|
+
checkBunVersion,
|
|
25
|
+
canBypassRedPhaseByChangedFiles,
|
|
26
|
+
areFilesTestOnly
|
|
27
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,186 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly kind: string;
|
|
8
|
-
readonly level: CoverageLevel;
|
|
9
|
-
readonly file: string;
|
|
10
|
-
readonly line: number;
|
|
11
|
-
}
|
|
12
|
-
/** Coverage summary statistics. */
|
|
13
|
-
interface CoverageSummary {
|
|
14
|
-
readonly documented: number;
|
|
15
|
-
readonly partial: number;
|
|
16
|
-
readonly undocumented: number;
|
|
17
|
-
readonly total: number;
|
|
18
|
-
readonly percentage: number;
|
|
19
|
-
}
|
|
20
|
-
/** Per-package TSDoc coverage stats. */
|
|
21
|
-
interface PackageCoverage {
|
|
22
|
-
readonly name: string;
|
|
23
|
-
readonly path: string;
|
|
24
|
-
readonly declarations: readonly DeclarationCoverage[];
|
|
25
|
-
readonly documented: number;
|
|
26
|
-
readonly partial: number;
|
|
27
|
-
readonly undocumented: number;
|
|
28
|
-
readonly total: number;
|
|
29
|
-
readonly percentage: number;
|
|
30
|
-
}
|
|
31
|
-
/** Aggregated result across all packages. */
|
|
32
|
-
interface TsDocCheckResult {
|
|
33
|
-
readonly ok: boolean;
|
|
34
|
-
readonly packages: readonly PackageCoverage[];
|
|
35
|
-
readonly summary: CoverageSummary;
|
|
36
|
-
}
|
|
37
|
-
/** Zod schema for {@link CoverageLevel}. */
|
|
38
|
-
declare const coverageLevelSchema: ZodType<CoverageLevel>;
|
|
39
|
-
/** Zod schema for {@link DeclarationCoverage}. */
|
|
40
|
-
declare const declarationCoverageSchema: ZodType<DeclarationCoverage>;
|
|
41
|
-
/** Zod schema for {@link PackageCoverage}. */
|
|
42
|
-
declare const packageCoverageSchema: ZodType<PackageCoverage>;
|
|
43
|
-
/** Zod schema for {@link TsDocCheckResult}. */
|
|
44
|
-
declare const tsDocCheckResultSchema: ZodType<TsDocCheckResult>;
|
|
45
|
-
/** Options for the check-tsdoc command. */
|
|
46
|
-
interface CheckTsDocOptions {
|
|
47
|
-
readonly strict?: boolean | undefined;
|
|
48
|
-
readonly json?: boolean | undefined;
|
|
49
|
-
readonly minCoverage?: number | undefined;
|
|
50
|
-
readonly cwd?: string | undefined;
|
|
51
|
-
readonly paths?: readonly string[] | undefined;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Analyze TSDoc coverage across workspace packages.
|
|
55
|
-
*
|
|
56
|
-
* Pure function that discovers packages, analyzes TSDoc coverage on exported
|
|
57
|
-
* declarations, and returns the aggregated result. Does not print output or
|
|
58
|
-
* call `process.exit()`.
|
|
59
|
-
*
|
|
60
|
-
* @param options - Analysis options (paths, strict mode, coverage threshold)
|
|
61
|
-
* @returns Aggregated coverage result across all packages, or `null` if no packages found
|
|
62
|
-
*/
|
|
63
|
-
declare function analyzeCheckTsdoc(options?: CheckTsDocOptions): TsDocCheckResult | null;
|
|
64
|
-
/**
|
|
65
|
-
* Print a TSDoc coverage result in human-readable format.
|
|
66
|
-
*
|
|
67
|
-
* Renders a bar chart per package with summary statistics. Writes to stdout/stderr.
|
|
68
|
-
*
|
|
69
|
-
* @param result - The coverage result to print
|
|
70
|
-
* @param options - Display options (strict mode, coverage threshold for warning)
|
|
71
|
-
*/
|
|
72
|
-
declare function printCheckTsdocHuman(result: TsDocCheckResult, options?: {
|
|
73
|
-
strict?: boolean | undefined;
|
|
74
|
-
minCoverage?: number | undefined;
|
|
75
|
-
}): void;
|
|
76
|
-
import { ZodType as ZodType2 } from "zod";
|
|
77
|
-
/**
|
|
78
|
-
* File entry in a block.
|
|
79
|
-
*/
|
|
80
|
-
interface FileEntry {
|
|
81
|
-
/** Destination path relative to project root */
|
|
82
|
-
path: string;
|
|
83
|
-
/** File contents (embedded in registry) */
|
|
84
|
-
content: string;
|
|
85
|
-
/** Whether to chmod +x after copying */
|
|
86
|
-
executable?: boolean | undefined;
|
|
87
|
-
/** Whether to process as a template (future) */
|
|
88
|
-
template?: boolean | undefined;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Schema for a file entry in a block.
|
|
92
|
-
* Represents a file that will be copied to the user's project.
|
|
93
|
-
*/
|
|
94
|
-
declare const FileEntrySchema: ZodType2<FileEntry>;
|
|
95
|
-
/**
|
|
96
|
-
* Block in the registry.
|
|
97
|
-
*/
|
|
98
|
-
interface Block {
|
|
99
|
-
/** Block name (matches the key in blocks record) */
|
|
100
|
-
name: string;
|
|
101
|
-
/** Human-readable description */
|
|
102
|
-
description: string;
|
|
103
|
-
/** Files included in this block */
|
|
104
|
-
files?: FileEntry[] | undefined;
|
|
105
|
-
/** npm dependencies to add to package.json */
|
|
106
|
-
dependencies?: Record<string, string> | undefined;
|
|
107
|
-
/** npm devDependencies to add to package.json */
|
|
108
|
-
devDependencies?: Record<string, string> | undefined;
|
|
109
|
-
/** Other blocks this block extends (for composite blocks) */
|
|
110
|
-
extends?: string[] | undefined;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Schema for a block in the registry.
|
|
114
|
-
* A block is a collection of related files that can be added together.
|
|
115
|
-
*/
|
|
116
|
-
declare const BlockSchema: ZodType2<Block>;
|
|
117
|
-
/**
|
|
118
|
-
* Complete registry structure.
|
|
119
|
-
*/
|
|
120
|
-
interface Registry {
|
|
121
|
-
/** Registry schema version */
|
|
122
|
-
version: string;
|
|
123
|
-
/** Map of block name to block definition */
|
|
124
|
-
blocks: Record<string, Block>;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Schema for the complete registry.
|
|
128
|
-
* Contains all available blocks with their files and metadata.
|
|
129
|
-
*/
|
|
130
|
-
declare const RegistrySchema: ZodType2<Registry>;
|
|
131
|
-
/**
|
|
132
|
-
* Block definition used in the build script.
|
|
133
|
-
* Specifies how to collect source files into a block.
|
|
134
|
-
*/
|
|
135
|
-
interface BlockDefinition {
|
|
136
|
-
/** Human-readable description */
|
|
137
|
-
description: string;
|
|
138
|
-
/** Source file paths (relative to repo root) */
|
|
139
|
-
files?: string[];
|
|
140
|
-
/** Remap source paths to destination paths */
|
|
141
|
-
remap?: Record<string, string>;
|
|
142
|
-
/** npm dependencies */
|
|
143
|
-
dependencies?: Record<string, string>;
|
|
144
|
-
/** npm devDependencies */
|
|
145
|
-
devDependencies?: Record<string, string>;
|
|
146
|
-
/** Other blocks this block extends */
|
|
147
|
-
extends?: string[];
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Configuration for the registry build.
|
|
151
|
-
*/
|
|
152
|
-
interface RegistryBuildConfig {
|
|
153
|
-
/** Registry schema version */
|
|
154
|
-
version: string;
|
|
155
|
-
/** Block definitions */
|
|
156
|
-
blocks: Record<string, BlockDefinition>;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Result of adding a block to a project.
|
|
160
|
-
*/
|
|
161
|
-
interface AddBlockResult {
|
|
162
|
-
/** Files that were created */
|
|
163
|
-
created: string[];
|
|
164
|
-
/** Files that were skipped (already exist) */
|
|
165
|
-
skipped: string[];
|
|
166
|
-
/** Files that were overwritten (with --force) */
|
|
167
|
-
overwritten: string[];
|
|
168
|
-
/** Dependencies added to package.json */
|
|
169
|
-
dependencies: Record<string, string>;
|
|
170
|
-
/** devDependencies added to package.json */
|
|
171
|
-
devDependencies: Record<string, string>;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Options for the add command.
|
|
175
|
-
*/
|
|
176
|
-
interface AddBlockOptions {
|
|
177
|
-
/** Overwrite existing files */
|
|
178
|
-
force?: boolean;
|
|
179
|
-
/** Show what would be added without making changes */
|
|
180
|
-
dryRun?: boolean;
|
|
181
|
-
/** Working directory (defaults to cwd) */
|
|
182
|
-
cwd?: string;
|
|
183
|
-
}
|
|
184
|
-
/** Package version, read from package.json at load time. */
|
|
185
|
-
declare const VERSION: string;
|
|
186
|
-
export { tsDocCheckResultSchema, printCheckTsdocHuman, packageCoverageSchema, declarationCoverageSchema, coverageLevelSchema, analyzeCheckTsdoc, VERSION, TsDocCheckResult, RegistrySchema, RegistryBuildConfig, Registry, PackageCoverage, FileEntrySchema, FileEntry, DeclarationCoverage, CoverageLevel, CheckTsDocOptions, BlockSchema, BlockDefinition, Block, AddBlockResult, AddBlockOptions };
|
|
1
|
+
import { CheckTsDocOptions, CoverageLevel, DeclarationCoverage, PackageCoverage, TsDocCheckResult, analyzeCheckTsdoc, coverageLevelSchema, declarationCoverageSchema, packageCoverageSchema, printCheckTsdocHuman, tsDocCheckResultSchema } from "./shared/@outfitter/tooling-njw4z34x.js";
|
|
2
|
+
import { ParsedSemver, isTypesBunVersionCompatible, parseSemver } from "./shared/@outfitter/tooling-vjmhvpjq.js";
|
|
3
|
+
import { VERSION } from "./shared/@outfitter/tooling-9vs606gq.js";
|
|
4
|
+
import "./shared/@outfitter/tooling-xqwn46sx.js";
|
|
5
|
+
import { AddBlockOptions, AddBlockResult, Block, BlockDefinition, BlockSchema, FileEntry, FileEntrySchema, Registry, RegistryBuildConfig, RegistrySchema } from "./shared/@outfitter/tooling-sjm8nebx.js";
|
|
6
|
+
export { tsDocCheckResultSchema, printCheckTsdocHuman, parseSemver, packageCoverageSchema, isTypesBunVersionCompatible, declarationCoverageSchema, coverageLevelSchema, analyzeCheckTsdoc, VERSION, TsDocCheckResult, RegistrySchema, RegistryBuildConfig, Registry, ParsedSemver, PackageCoverage, FileEntrySchema, FileEntry, DeclarationCoverage, CoverageLevel, CheckTsDocOptions, BlockSchema, BlockDefinition, Block, AddBlockResult, AddBlockOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declarationCoverageSchema,
|
|
6
|
-
packageCoverageSchema,
|
|
7
|
-
printCheckTsdocHuman,
|
|
8
|
-
tsDocCheckResultSchema
|
|
9
|
-
} from "./shared/chunk-cmde0fwx.js";
|
|
10
|
-
import"./shared/chunk-3s189drz.js";
|
|
11
|
-
// src/registry/schema.ts
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
var FileEntrySchema = z.object({
|
|
14
|
-
path: z.string().min(1),
|
|
15
|
-
content: z.string(),
|
|
16
|
-
executable: z.boolean().optional(),
|
|
17
|
-
template: z.boolean().optional()
|
|
18
|
-
});
|
|
19
|
-
var BlockSchema = z.object({
|
|
20
|
-
name: z.string().min(1),
|
|
21
|
-
description: z.string().min(1),
|
|
22
|
-
files: z.array(FileEntrySchema).optional(),
|
|
23
|
-
dependencies: z.record(z.string(), z.string()).optional(),
|
|
24
|
-
devDependencies: z.record(z.string(), z.string()).optional(),
|
|
25
|
-
extends: z.array(z.string()).optional()
|
|
26
|
-
});
|
|
27
|
-
var RegistrySchema = z.object({
|
|
28
|
-
version: z.string(),
|
|
29
|
-
blocks: z.record(z.string(), BlockSchema)
|
|
30
|
-
});
|
|
31
|
-
export {
|
|
32
|
-
tsDocCheckResultSchema,
|
|
33
|
-
printCheckTsdocHuman,
|
|
34
|
-
packageCoverageSchema,
|
|
35
|
-
declarationCoverageSchema,
|
|
36
|
-
coverageLevelSchema,
|
|
37
|
-
analyzeCheckTsdoc,
|
|
38
|
-
VERSION,
|
|
39
|
-
RegistrySchema,
|
|
40
|
-
FileEntrySchema,
|
|
41
|
-
BlockSchema
|
|
42
|
-
};
|
|
1
|
+
export { analyzeCheckTsdoc, coverageLevelSchema, declarationCoverageSchema, packageCoverageSchema, printCheckTsdocHuman, tsDocCheckResultSchema } from "./cli/check-tsdoc.js";
|
|
2
|
+
export { isTypesBunVersionCompatible, parseSemver } from "./bun-version-compat.js";
|
|
3
|
+
export { BlockSchema, FileEntrySchema, RegistrySchema } from "./registry/index.js";
|
|
4
|
+
export { VERSION } from "./version.js";
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
import"../shared/@outfitter/tooling-jnrs9rqd.js";
|
|
4
|
+
|
|
5
|
+
// packages/tooling/src/registry/build.ts
|
|
6
|
+
import {
|
|
7
|
+
existsSync as existsSync2,
|
|
8
|
+
mkdirSync,
|
|
9
|
+
readFileSync as readFileSync2,
|
|
10
|
+
statSync as statSync2,
|
|
11
|
+
writeFileSync
|
|
12
|
+
} from "fs";
|
|
13
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
14
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
15
|
+
|
|
16
|
+
// packages/presets/dist/index.js
|
|
17
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
|
|
18
|
+
import { dirname, isAbsolute, join, relative, resolve } from "path";
|
|
19
|
+
import { fileURLToPath } from "url";
|
|
20
|
+
var DEPENDENCY_SECTIONS = [
|
|
21
|
+
"dependencies",
|
|
22
|
+
"devDependencies",
|
|
23
|
+
"peerDependencies",
|
|
24
|
+
"optionalDependencies"
|
|
25
|
+
];
|
|
26
|
+
function isRecord(value) {
|
|
27
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28
|
+
}
|
|
29
|
+
function loadWorkspaceCatalog(packageDir) {
|
|
30
|
+
let dir = packageDir;
|
|
31
|
+
for (let i = 0;i < 10; i++) {
|
|
32
|
+
const rootPkgPath = join(dir, "package.json");
|
|
33
|
+
if (existsSync(rootPkgPath)) {
|
|
34
|
+
try {
|
|
35
|
+
const raw = JSON.parse(readFileSync(rootPkgPath, "utf-8"));
|
|
36
|
+
if (isRecord(raw) && isRecord(raw["catalog"])) {
|
|
37
|
+
const catalog = {};
|
|
38
|
+
for (const [name, version] of Object.entries(raw["catalog"])) {
|
|
39
|
+
if (typeof version === "string") {
|
|
40
|
+
catalog[name] = version;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return catalog;
|
|
44
|
+
}
|
|
45
|
+
} catch {}
|
|
46
|
+
}
|
|
47
|
+
const parent = dirname(dir);
|
|
48
|
+
if (parent === dir)
|
|
49
|
+
break;
|
|
50
|
+
dir = parent;
|
|
51
|
+
}
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
function getResolvedVersions() {
|
|
55
|
+
const packageDir = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
56
|
+
const packageJsonPath = join(packageDir, "package.json");
|
|
57
|
+
const raw = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
58
|
+
if (!isRecord(raw)) {
|
|
59
|
+
throw new Error("@outfitter/presets package.json must be a JSON object");
|
|
60
|
+
}
|
|
61
|
+
const all = {};
|
|
62
|
+
let hasCatalogRefs = false;
|
|
63
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
64
|
+
const deps = raw[section];
|
|
65
|
+
if (!isRecord(deps))
|
|
66
|
+
continue;
|
|
67
|
+
for (const [name, version] of Object.entries(deps)) {
|
|
68
|
+
if (typeof version === "string") {
|
|
69
|
+
if (version === "catalog:") {
|
|
70
|
+
hasCatalogRefs = true;
|
|
71
|
+
} else {
|
|
72
|
+
all[name] = version;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (hasCatalogRefs) {
|
|
78
|
+
const catalog = loadWorkspaceCatalog(packageDir);
|
|
79
|
+
const unresolved = [];
|
|
80
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
81
|
+
const deps = raw[section];
|
|
82
|
+
if (!isRecord(deps))
|
|
83
|
+
continue;
|
|
84
|
+
for (const [name, version] of Object.entries(deps)) {
|
|
85
|
+
if (version === "catalog:") {
|
|
86
|
+
if (catalog[name]) {
|
|
87
|
+
all[name] = catalog[name];
|
|
88
|
+
} else {
|
|
89
|
+
unresolved.push(name);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (unresolved.length > 0) {
|
|
95
|
+
throw new Error(`Unresolvable catalog: references (no catalog entry found): ${unresolved.join(", ")}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { all };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// packages/tooling/src/registry/build.ts
|
|
102
|
+
function log(message) {
|
|
103
|
+
process.stdout.write(`${message}
|
|
104
|
+
`);
|
|
105
|
+
}
|
|
106
|
+
function findRepoRoot(startDir) {
|
|
107
|
+
let dir = startDir;
|
|
108
|
+
while (dir !== "/") {
|
|
109
|
+
const pkgPath = join2(dir, "package.json");
|
|
110
|
+
if (existsSync2(pkgPath)) {
|
|
111
|
+
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
112
|
+
if (pkg.workspaces) {
|
|
113
|
+
return dir;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
dir = dirname2(dir);
|
|
117
|
+
}
|
|
118
|
+
throw new Error("Could not find repository root");
|
|
119
|
+
}
|
|
120
|
+
function isExecutable(filePath) {
|
|
121
|
+
try {
|
|
122
|
+
const stats = statSync2(filePath);
|
|
123
|
+
return (stats.mode & 64) !== 0;
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function readFileEntry(repoRoot, sourcePath, destPath) {
|
|
129
|
+
const fullPath = join2(repoRoot, sourcePath);
|
|
130
|
+
if (!existsSync2(fullPath)) {
|
|
131
|
+
throw new Error(`Source file not found: ${fullPath}`);
|
|
132
|
+
}
|
|
133
|
+
const content = readFileSync2(fullPath, "utf-8");
|
|
134
|
+
const executable = isExecutable(fullPath);
|
|
135
|
+
return {
|
|
136
|
+
path: destPath,
|
|
137
|
+
content,
|
|
138
|
+
...executable && { executable: true }
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function buildBlock(repoRoot, name, def) {
|
|
142
|
+
const block = {
|
|
143
|
+
name,
|
|
144
|
+
description: def.description
|
|
145
|
+
};
|
|
146
|
+
if (def.files && def.files.length > 0) {
|
|
147
|
+
block.files = def.files.map((sourcePath) => {
|
|
148
|
+
const destPath = def.remap?.[sourcePath] ?? sourcePath;
|
|
149
|
+
return readFileEntry(repoRoot, sourcePath, destPath);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (def.dependencies && Object.keys(def.dependencies).length > 0) {
|
|
153
|
+
block.dependencies = def.dependencies;
|
|
154
|
+
}
|
|
155
|
+
if (def.devDependencies && Object.keys(def.devDependencies).length > 0) {
|
|
156
|
+
block.devDependencies = def.devDependencies;
|
|
157
|
+
}
|
|
158
|
+
if (def.extends && def.extends.length > 0) {
|
|
159
|
+
block.extends = def.extends;
|
|
160
|
+
}
|
|
161
|
+
return block;
|
|
162
|
+
}
|
|
163
|
+
function buildRegistry(config, repoRoot) {
|
|
164
|
+
const blocks = {};
|
|
165
|
+
for (const [name, def] of Object.entries(config.blocks)) {
|
|
166
|
+
blocks[name] = buildBlock(repoRoot, name, def);
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
version: config.version,
|
|
170
|
+
blocks
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function resolveVersion(versions, name) {
|
|
174
|
+
const version = versions[name];
|
|
175
|
+
if (!version) {
|
|
176
|
+
throw new Error(`Missing resolved version for "${name}" in @outfitter/presets`);
|
|
177
|
+
}
|
|
178
|
+
return version;
|
|
179
|
+
}
|
|
180
|
+
function getWorkspacePackageVersion(relativePackageJsonPath) {
|
|
181
|
+
const pkgPath = join2(dirname2(fileURLToPath2(import.meta.url)), relativePackageJsonPath);
|
|
182
|
+
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
183
|
+
if (typeof pkg.version !== "string") {
|
|
184
|
+
throw new Error(`Expected version in package.json at ${pkgPath}`);
|
|
185
|
+
}
|
|
186
|
+
return `^${pkg.version}`;
|
|
187
|
+
}
|
|
188
|
+
function getToolingVersion() {
|
|
189
|
+
return getWorkspacePackageVersion("../../package.json");
|
|
190
|
+
}
|
|
191
|
+
function getOxlintPluginVersion() {
|
|
192
|
+
return getWorkspacePackageVersion("../../../oxlint-plugin/package.json");
|
|
193
|
+
}
|
|
194
|
+
function createRegistryConfig() {
|
|
195
|
+
const { all: versions } = getResolvedVersions();
|
|
196
|
+
const toolingVersion = getToolingVersion();
|
|
197
|
+
const oxlintPluginVersion = getOxlintPluginVersion();
|
|
198
|
+
return {
|
|
199
|
+
version: "1.0.0",
|
|
200
|
+
blocks: {
|
|
201
|
+
claude: {
|
|
202
|
+
description: "Claude Code settings and hooks for automated formatting",
|
|
203
|
+
files: [
|
|
204
|
+
".claude/settings.json",
|
|
205
|
+
".claude/hooks/format-code-on-stop.sh"
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
linter: {
|
|
209
|
+
description: "Linter and formatter configuration (oxlint/oxfmt) via Ultracite",
|
|
210
|
+
files: [
|
|
211
|
+
"packages/tooling/configs/.oxlintrc.json",
|
|
212
|
+
"packages/tooling/configs/.oxfmtrc.jsonc"
|
|
213
|
+
],
|
|
214
|
+
remap: {
|
|
215
|
+
"packages/tooling/configs/.oxlintrc.json": ".oxlintrc.json",
|
|
216
|
+
"packages/tooling/configs/.oxfmtrc.jsonc": ".oxfmtrc.jsonc"
|
|
217
|
+
},
|
|
218
|
+
devDependencies: {
|
|
219
|
+
"@outfitter/oxlint-plugin": oxlintPluginVersion,
|
|
220
|
+
ultracite: resolveVersion(versions, "ultracite"),
|
|
221
|
+
oxlint: resolveVersion(versions, "oxlint"),
|
|
222
|
+
oxfmt: resolveVersion(versions, "oxfmt")
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
lefthook: {
|
|
226
|
+
description: "Git hooks via Lefthook for pre-commit and pre-push",
|
|
227
|
+
files: ["packages/tooling/lefthook.yml"],
|
|
228
|
+
remap: { "packages/tooling/lefthook.yml": ".lefthook.yml" },
|
|
229
|
+
devDependencies: {
|
|
230
|
+
"@outfitter/tooling": toolingVersion,
|
|
231
|
+
lefthook: resolveVersion(versions, "lefthook"),
|
|
232
|
+
ultracite: resolveVersion(versions, "ultracite")
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
markdownlint: {
|
|
236
|
+
description: "Markdown linting configuration via markdownlint-cli2",
|
|
237
|
+
files: ["packages/tooling/.markdownlint-cli2.jsonc"],
|
|
238
|
+
remap: {
|
|
239
|
+
"packages/tooling/.markdownlint-cli2.jsonc": ".markdownlint-cli2.jsonc"
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
bootstrap: {
|
|
243
|
+
description: "Project bootstrap script for installing tools and dependencies",
|
|
244
|
+
files: ["packages/tooling/templates/bootstrap.sh"],
|
|
245
|
+
remap: {
|
|
246
|
+
"packages/tooling/templates/bootstrap.sh": "scripts/bootstrap.sh"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
scaffolding: {
|
|
250
|
+
description: "Full starter kit: Claude settings, oxlint/oxfmt, Lefthook, markdownlint, and bootstrap script",
|
|
251
|
+
extends: ["claude", "linter", "lefthook", "markdownlint", "bootstrap"]
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
var REGISTRY_CONFIG = createRegistryConfig();
|
|
257
|
+
function main() {
|
|
258
|
+
const scriptDir = dirname2(new URL(import.meta.url).pathname);
|
|
259
|
+
const repoRoot = findRepoRoot(scriptDir);
|
|
260
|
+
const outputDir = join2(repoRoot, "packages/tooling/registry");
|
|
261
|
+
const outputPath = join2(outputDir, "registry.json");
|
|
262
|
+
log(`Building registry from: ${repoRoot}`);
|
|
263
|
+
if (!existsSync2(outputDir)) {
|
|
264
|
+
mkdirSync(outputDir, { recursive: true });
|
|
265
|
+
}
|
|
266
|
+
const registry = buildRegistry(REGISTRY_CONFIG, repoRoot);
|
|
267
|
+
writeFileSync(outputPath, `${JSON.stringify(registry, null, "\t")}
|
|
268
|
+
`);
|
|
269
|
+
const blockCount = Object.keys(registry.blocks).length;
|
|
270
|
+
const fileCount = Object.values(registry.blocks).flatMap((b) => b.files ?? []).length;
|
|
271
|
+
log(`\u2713 Generated ${outputPath}`);
|
|
272
|
+
log(` ${blockCount} blocks, ${fileCount} files embedded`);
|
|
273
|
+
}
|
|
274
|
+
if (import.meta.main) {
|
|
275
|
+
main();
|
|
276
|
+
}
|
|
277
|
+
export {
|
|
278
|
+
REGISTRY_CONFIG
|
|
279
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "../shared/@outfitter/tooling-xqwn46sx.js";
|
|
2
|
+
import { AddBlockOptions, AddBlockResult, Block, BlockDefinition, BlockSchema, FileEntry, FileEntrySchema, Registry, RegistryBuildConfig, RegistrySchema } from "../shared/@outfitter/tooling-sjm8nebx.js";
|
|
3
|
+
export { RegistrySchema, RegistryBuildConfig, Registry, FileEntrySchema, FileEntry, BlockSchema, BlockDefinition, Block, AddBlockResult, AddBlockOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlockSchema, FileEntrySchema, RegistrySchema } from "./schema.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AddBlockOptions, AddBlockResult, Block, BlockDefinition, BlockSchema, FileEntry, FileEntrySchema, Registry, RegistryBuildConfig, RegistrySchema } from "../shared/@outfitter/tooling-sjm8nebx.js";
|
|
2
|
+
export { RegistrySchema, RegistryBuildConfig, Registry, FileEntrySchema, FileEntry, BlockSchema, BlockDefinition, Block, AddBlockResult, AddBlockOptions };
|