@outfitter/tooling 0.3.0 → 0.3.3
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/dist/cli/index.js +3 -6
- package/package.json +3 -2
- package/registry/registry.json +3 -3
- package/dist/cli/check-boundary-invocations.d.ts +0 -34
- package/dist/cli/check-boundary-invocations.js +0 -14
- package/dist/cli/check-bunup-registry.d.ts +0 -36
- package/dist/cli/check-bunup-registry.js +0 -12
- package/dist/cli/check-changeset.d.ts +0 -66
- package/dist/cli/check-changeset.js +0 -20
- package/dist/cli/check-clean-tree.d.ts +0 -36
- package/dist/cli/check-clean-tree.js +0 -14
- package/dist/cli/check-exports.d.ts +0 -2
- package/dist/cli/check-exports.js +0 -14
- package/dist/cli/check-readme-imports.d.ts +0 -61
- package/dist/cli/check-readme-imports.js +0 -198
- package/dist/cli/check-tsdoc.d.ts +0 -2
- package/dist/cli/check-tsdoc.js +0 -36
- package/dist/cli/check.d.ts +0 -19
- package/dist/cli/check.js +0 -10
- package/dist/cli/fix.d.ts +0 -19
- package/dist/cli/fix.js +0 -10
- package/dist/cli/init.d.ts +0 -31
- package/dist/cli/init.js +0 -12
- package/dist/cli/pre-push.d.ts +0 -48
- package/dist/cli/pre-push.js +0 -25
- package/dist/cli/upgrade-bun.d.ts +0 -8
- package/dist/cli/upgrade-bun.js +0 -8
- package/dist/registry/build.d.ts +0 -6
- package/dist/registry/build.js +0 -150
- package/dist/registry/index.d.ts +0 -3
- package/dist/registry/index.js +0 -13
- package/dist/registry/schema.d.ts +0 -2
- package/dist/registry/schema.js +0 -12
- package/dist/shared/@outfitter/tooling-0x5q15ec.js +0 -21
- package/dist/shared/@outfitter/tooling-1y8w5ahg.js +0 -70
- package/dist/shared/@outfitter/tooling-2n2dpsaa.js +0 -323
- package/dist/shared/@outfitter/tooling-9errkcvk.js +0 -21
- package/dist/shared/@outfitter/tooling-9vs606gq.d.ts +0 -3
- package/dist/shared/@outfitter/tooling-9yzd08v1.js +0 -146
- package/dist/shared/@outfitter/tooling-cj5vsa9k.js +0 -184
- package/dist/shared/@outfitter/tooling-ctmgnap5.js +0 -19
- package/dist/shared/@outfitter/tooling-dvwh9qve.js +0 -4
- package/dist/shared/@outfitter/tooling-enjcenja.js +0 -229
- package/dist/shared/@outfitter/tooling-kcvs6mys.js +0 -1
- package/dist/shared/@outfitter/tooling-mxwc1n8w.js +0 -68
- package/dist/shared/@outfitter/tooling-njw4z34x.d.ts +0 -140
- package/dist/shared/@outfitter/tooling-qk5xgmxr.js +0 -405
- package/dist/shared/@outfitter/tooling-r9976n43.js +0 -100
- package/dist/shared/@outfitter/tooling-sjm8nebx.d.ts +0 -109
- package/dist/shared/@outfitter/tooling-t17gnh9b.js +0 -78
- package/dist/shared/@outfitter/tooling-wesswf21.d.ts +0 -59
- package/dist/shared/@outfitter/tooling-wv09k6hr.js +0 -23
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -8
package/dist/cli/fix.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI fix command - Fix linting issues (wraps ultracite)
|
|
3
|
-
*/
|
|
4
|
-
/** Options for the fix command */
|
|
5
|
-
interface FixOptions {
|
|
6
|
-
paths?: string[];
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Build the ultracite fix command
|
|
10
|
-
* @param options - Command options
|
|
11
|
-
* @returns Array of command arguments
|
|
12
|
-
*/
|
|
13
|
-
declare function buildFixCommand(options: FixOptions): string[];
|
|
14
|
-
/**
|
|
15
|
-
* Run the fix command
|
|
16
|
-
* @param paths - Paths to fix
|
|
17
|
-
*/
|
|
18
|
-
declare function runFix(paths?: string[]): Promise<void>;
|
|
19
|
-
export { runFix, buildFixCommand };
|
package/dist/cli/fix.js
DELETED
package/dist/cli/init.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
DELETED
package/dist/cli/pre-push.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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 PrePushOptions {
|
|
42
|
-
force?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Main pre-push command
|
|
46
|
-
*/
|
|
47
|
-
declare function runPrePush(options?: PrePushOptions): Promise<void>;
|
|
48
|
-
export { runPrePush, isTestOnlyPath, isScaffoldBranch, isReleaseBranch, isRedPhaseBranch, hasPackageSourceChanges, createVerificationPlan, canBypassRedPhaseByChangedFiles, areFilesTestOnly, VerificationPlan, PushChangedFiles, PrePushOptions };
|
package/dist/cli/pre-push.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
areFilesTestOnly,
|
|
4
|
-
canBypassRedPhaseByChangedFiles,
|
|
5
|
-
createVerificationPlan,
|
|
6
|
-
hasPackageSourceChanges,
|
|
7
|
-
isRedPhaseBranch,
|
|
8
|
-
isReleaseBranch,
|
|
9
|
-
isScaffoldBranch,
|
|
10
|
-
isTestOnlyPath,
|
|
11
|
-
runPrePush
|
|
12
|
-
} from "../shared/@outfitter/tooling-2n2dpsaa.js";
|
|
13
|
-
import"../shared/@outfitter/tooling-qk5xgmxr.js";
|
|
14
|
-
import"../shared/@outfitter/tooling-dvwh9qve.js";
|
|
15
|
-
export {
|
|
16
|
-
runPrePush,
|
|
17
|
-
isTestOnlyPath,
|
|
18
|
-
isScaffoldBranch,
|
|
19
|
-
isReleaseBranch,
|
|
20
|
-
isRedPhaseBranch,
|
|
21
|
-
hasPackageSourceChanges,
|
|
22
|
-
createVerificationPlan,
|
|
23
|
-
canBypassRedPhaseByChangedFiles,
|
|
24
|
-
areFilesTestOnly
|
|
25
|
-
};
|
package/dist/cli/upgrade-bun.js
DELETED
package/dist/registry/build.d.ts
DELETED
package/dist/registry/build.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
// @bun
|
|
3
|
-
import"../shared/@outfitter/tooling-dvwh9qve.js";
|
|
4
|
-
|
|
5
|
-
// packages/tooling/src/registry/build.ts
|
|
6
|
-
import {
|
|
7
|
-
existsSync,
|
|
8
|
-
mkdirSync,
|
|
9
|
-
readFileSync,
|
|
10
|
-
statSync,
|
|
11
|
-
writeFileSync
|
|
12
|
-
} from "fs";
|
|
13
|
-
import { dirname, join } from "path";
|
|
14
|
-
function log(message) {
|
|
15
|
-
process.stdout.write(`${message}
|
|
16
|
-
`);
|
|
17
|
-
}
|
|
18
|
-
function findRepoRoot(startDir) {
|
|
19
|
-
let dir = startDir;
|
|
20
|
-
while (dir !== "/") {
|
|
21
|
-
const pkgPath = join(dir, "package.json");
|
|
22
|
-
if (existsSync(pkgPath)) {
|
|
23
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
24
|
-
if (pkg.workspaces) {
|
|
25
|
-
return dir;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
dir = dirname(dir);
|
|
29
|
-
}
|
|
30
|
-
throw new Error("Could not find repository root");
|
|
31
|
-
}
|
|
32
|
-
function isExecutable(filePath) {
|
|
33
|
-
try {
|
|
34
|
-
const stats = statSync(filePath);
|
|
35
|
-
return (stats.mode & 64) !== 0;
|
|
36
|
-
} catch {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function readFileEntry(repoRoot, sourcePath, destPath) {
|
|
41
|
-
const fullPath = join(repoRoot, sourcePath);
|
|
42
|
-
if (!existsSync(fullPath)) {
|
|
43
|
-
throw new Error(`Source file not found: ${fullPath}`);
|
|
44
|
-
}
|
|
45
|
-
const content = readFileSync(fullPath, "utf-8");
|
|
46
|
-
const executable = isExecutable(fullPath);
|
|
47
|
-
return {
|
|
48
|
-
path: destPath,
|
|
49
|
-
content,
|
|
50
|
-
...executable && { executable: true }
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function buildBlock(repoRoot, name, def) {
|
|
54
|
-
const block = {
|
|
55
|
-
name,
|
|
56
|
-
description: def.description
|
|
57
|
-
};
|
|
58
|
-
if (def.files && def.files.length > 0) {
|
|
59
|
-
block.files = def.files.map((sourcePath) => {
|
|
60
|
-
const destPath = def.remap?.[sourcePath] ?? sourcePath;
|
|
61
|
-
return readFileEntry(repoRoot, sourcePath, destPath);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
if (def.dependencies && Object.keys(def.dependencies).length > 0) {
|
|
65
|
-
block.dependencies = def.dependencies;
|
|
66
|
-
}
|
|
67
|
-
if (def.devDependencies && Object.keys(def.devDependencies).length > 0) {
|
|
68
|
-
block.devDependencies = def.devDependencies;
|
|
69
|
-
}
|
|
70
|
-
if (def.extends && def.extends.length > 0) {
|
|
71
|
-
block.extends = def.extends;
|
|
72
|
-
}
|
|
73
|
-
return block;
|
|
74
|
-
}
|
|
75
|
-
function buildRegistry(config, repoRoot) {
|
|
76
|
-
const blocks = {};
|
|
77
|
-
for (const [name, def] of Object.entries(config.blocks)) {
|
|
78
|
-
blocks[name] = buildBlock(repoRoot, name, def);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
version: config.version,
|
|
82
|
-
blocks
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
var REGISTRY_CONFIG = {
|
|
86
|
-
version: "1.0.0",
|
|
87
|
-
blocks: {
|
|
88
|
-
claude: {
|
|
89
|
-
description: "Claude Code settings and hooks for automated formatting",
|
|
90
|
-
files: [".claude/settings.json", ".claude/hooks/format-code-on-stop.sh"]
|
|
91
|
-
},
|
|
92
|
-
biome: {
|
|
93
|
-
description: "Biome linter/formatter configuration via Ultracite",
|
|
94
|
-
files: ["packages/tooling/biome.json"],
|
|
95
|
-
remap: { "packages/tooling/biome.json": "biome.json" },
|
|
96
|
-
devDependencies: { ultracite: "^7.2.3" }
|
|
97
|
-
},
|
|
98
|
-
lefthook: {
|
|
99
|
-
description: "Git hooks via Lefthook for pre-commit and pre-push",
|
|
100
|
-
files: ["packages/tooling/lefthook.yml"],
|
|
101
|
-
remap: { "packages/tooling/lefthook.yml": ".lefthook.yml" },
|
|
102
|
-
devDependencies: {
|
|
103
|
-
"@outfitter/tooling": "^0.2.4",
|
|
104
|
-
lefthook: "^2.1.1",
|
|
105
|
-
ultracite: "^7.2.3"
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
markdownlint: {
|
|
109
|
-
description: "Markdown linting configuration via markdownlint-cli2",
|
|
110
|
-
files: ["packages/tooling/.markdownlint-cli2.jsonc"],
|
|
111
|
-
remap: {
|
|
112
|
-
"packages/tooling/.markdownlint-cli2.jsonc": ".markdownlint-cli2.jsonc"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
bootstrap: {
|
|
116
|
-
description: "Project bootstrap script for installing tools and dependencies",
|
|
117
|
-
files: ["packages/tooling/templates/bootstrap.sh"],
|
|
118
|
-
remap: {
|
|
119
|
-
"packages/tooling/templates/bootstrap.sh": "scripts/bootstrap.sh"
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
scaffolding: {
|
|
123
|
-
description: "Full starter kit: Claude settings, Biome, Lefthook, markdownlint, and bootstrap script",
|
|
124
|
-
extends: ["claude", "biome", "lefthook", "markdownlint", "bootstrap"]
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
function main() {
|
|
129
|
-
const scriptDir = dirname(new URL(import.meta.url).pathname);
|
|
130
|
-
const repoRoot = findRepoRoot(scriptDir);
|
|
131
|
-
const outputDir = join(repoRoot, "packages/tooling/registry");
|
|
132
|
-
const outputPath = join(outputDir, "registry.json");
|
|
133
|
-
log(`Building registry from: ${repoRoot}`);
|
|
134
|
-
if (!existsSync(outputDir)) {
|
|
135
|
-
mkdirSync(outputDir, { recursive: true });
|
|
136
|
-
}
|
|
137
|
-
const registry = buildRegistry(REGISTRY_CONFIG, repoRoot);
|
|
138
|
-
writeFileSync(outputPath, `${JSON.stringify(registry, null, "\t")}
|
|
139
|
-
`);
|
|
140
|
-
const blockCount = Object.keys(registry.blocks).length;
|
|
141
|
-
const fileCount = Object.values(registry.blocks).flatMap((b) => b.files ?? []).length;
|
|
142
|
-
log(`\u2713 Generated ${outputPath}`);
|
|
143
|
-
log(` ${blockCount} blocks, ${fileCount} files embedded`);
|
|
144
|
-
}
|
|
145
|
-
if (import.meta.main) {
|
|
146
|
-
main();
|
|
147
|
-
}
|
|
148
|
-
export {
|
|
149
|
-
REGISTRY_CONFIG
|
|
150
|
-
};
|
package/dist/registry/index.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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 };
|
package/dist/registry/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import"../shared/@outfitter/tooling-kcvs6mys.js";
|
|
3
|
-
import {
|
|
4
|
-
BlockSchema,
|
|
5
|
-
FileEntrySchema,
|
|
6
|
-
RegistrySchema
|
|
7
|
-
} from "../shared/@outfitter/tooling-wv09k6hr.js";
|
|
8
|
-
import"../shared/@outfitter/tooling-dvwh9qve.js";
|
|
9
|
-
export {
|
|
10
|
-
RegistrySchema,
|
|
11
|
-
FileEntrySchema,
|
|
12
|
-
BlockSchema
|
|
13
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
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 };
|
package/dist/registry/schema.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/tooling/src/cli/check.ts
|
|
3
|
-
function buildCheckCommand(options) {
|
|
4
|
-
const cmd = ["ultracite", "check"];
|
|
5
|
-
if (options.paths && options.paths.length > 0) {
|
|
6
|
-
cmd.push(...options.paths);
|
|
7
|
-
}
|
|
8
|
-
return cmd;
|
|
9
|
-
}
|
|
10
|
-
async function runCheck(paths = []) {
|
|
11
|
-
const cmd = buildCheckCommand({ paths });
|
|
12
|
-
process.stdout.write(`Running: bun x ${cmd.join(" ")}
|
|
13
|
-
`);
|
|
14
|
-
const proc = Bun.spawn(["bun", "x", ...cmd], {
|
|
15
|
-
stdio: ["inherit", "inherit", "inherit"]
|
|
16
|
-
});
|
|
17
|
-
const exitCode = await proc.exited;
|
|
18
|
-
process.exit(exitCode);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { buildCheckCommand, runCheck };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/tooling/src/cli/check-clean-tree.ts
|
|
3
|
-
function parseGitDiff(diffOutput) {
|
|
4
|
-
return diffOutput.split(`
|
|
5
|
-
`).map((line) => line.trim()).filter(Boolean);
|
|
6
|
-
}
|
|
7
|
-
function parseUntrackedFiles(lsOutput) {
|
|
8
|
-
return lsOutput.split(`
|
|
9
|
-
`).map((line) => line.trim()).filter(Boolean);
|
|
10
|
-
}
|
|
11
|
-
function isCleanTree(status) {
|
|
12
|
-
return status.modified.length === 0 && status.untracked.length === 0;
|
|
13
|
-
}
|
|
14
|
-
var COLORS = {
|
|
15
|
-
reset: "\x1B[0m",
|
|
16
|
-
red: "\x1B[31m",
|
|
17
|
-
green: "\x1B[32m",
|
|
18
|
-
dim: "\x1B[2m"
|
|
19
|
-
};
|
|
20
|
-
async function runCheckCleanTree(options = {}) {
|
|
21
|
-
const pathArgs = options.paths ?? [];
|
|
22
|
-
const diffResult = Bun.spawnSync(["git", "diff", "HEAD", "--name-only", "--", ...pathArgs], { stderr: "pipe" });
|
|
23
|
-
if (diffResult.exitCode !== 0) {
|
|
24
|
-
process.stderr.write(`Failed to run git diff
|
|
25
|
-
`);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
const modified = parseGitDiff(diffResult.stdout.toString());
|
|
29
|
-
const lsResult = Bun.spawnSync(["git", "ls-files", "--others", "--exclude-standard", "--", ...pathArgs], { stderr: "pipe" });
|
|
30
|
-
if (lsResult.exitCode !== 0) {
|
|
31
|
-
process.stderr.write(`Failed to run git ls-files
|
|
32
|
-
`);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
const untracked = parseUntrackedFiles(lsResult.stdout.toString());
|
|
36
|
-
const clean = modified.length === 0 && untracked.length === 0;
|
|
37
|
-
const status = { clean, modified, untracked };
|
|
38
|
-
if (status.clean) {
|
|
39
|
-
process.stdout.write(`${COLORS.green}Working tree is clean.${COLORS.reset}
|
|
40
|
-
`);
|
|
41
|
-
process.exit(0);
|
|
42
|
-
}
|
|
43
|
-
process.stderr.write(`${COLORS.red}Working tree is dirty after verification:${COLORS.reset}
|
|
44
|
-
|
|
45
|
-
`);
|
|
46
|
-
if (modified.length > 0) {
|
|
47
|
-
process.stderr.write(`Modified files:
|
|
48
|
-
`);
|
|
49
|
-
for (const file of modified) {
|
|
50
|
-
process.stderr.write(` ${COLORS.dim}M${COLORS.reset} ${file}
|
|
51
|
-
`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (untracked.length > 0) {
|
|
55
|
-
process.stderr.write(`Untracked files:
|
|
56
|
-
`);
|
|
57
|
-
for (const file of untracked) {
|
|
58
|
-
process.stderr.write(` ${COLORS.dim}?${COLORS.reset} ${file}
|
|
59
|
-
`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
process.stderr.write(`
|
|
63
|
-
This likely means a build step produced uncommitted changes.
|
|
64
|
-
`);
|
|
65
|
-
process.stderr.write(`Commit these changes or add them to .gitignore.
|
|
66
|
-
`);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { parseGitDiff, parseUntrackedFiles, isCleanTree, runCheckCleanTree };
|