outfitter 0.2.0 → 0.2.2
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.js +27 -5
- package/dist/index.d.ts +148 -9
- package/dist/index.js +27 -3
- package/dist/shared/chunk-sak1tt33.js +3457 -0
- package/package.json +66 -24
- package/templates/basic/.lefthook.yml.template +4 -5
- package/templates/basic/package.json.template +10 -5
- package/templates/cli/.lefthook.yml.template +4 -5
- package/templates/cli/biome.json.template +2 -15
- package/templates/cli/package.json.template +11 -7
- package/templates/daemon/.lefthook.yml.template +4 -5
- package/templates/daemon/biome.json.template +2 -15
- package/templates/daemon/package.json.template +11 -7
- package/templates/mcp/.lefthook.yml.template +4 -5
- package/templates/mcp/biome.json.template +2 -15
- package/templates/mcp/package.json.template +11 -7
- package/dist/shared/chunk-fe7djmgg.js +0 -1604
package/dist/cli.js
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import {
|
|
3
3
|
outfitterActions
|
|
4
|
-
} from "./shared/chunk-
|
|
4
|
+
} from "./shared/chunk-sak1tt33.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
|
+
import { readFileSync } from "node:fs";
|
|
7
8
|
import { buildCliCommands } from "@outfitter/cli/actions";
|
|
8
9
|
import { createCLI } from "@outfitter/cli/command";
|
|
9
10
|
import { exitWithError } from "@outfitter/cli/output";
|
|
10
11
|
import { createContext, generateRequestId } from "@outfitter/contracts";
|
|
11
|
-
import {
|
|
12
|
+
import { createOutfitterLoggerFactory } from "@outfitter/logging";
|
|
12
13
|
function createProgram() {
|
|
13
|
-
const
|
|
14
|
+
const cliVersion = readCliVersion();
|
|
15
|
+
const loggerFactory = createOutfitterLoggerFactory();
|
|
16
|
+
const logger = loggerFactory.createLogger({
|
|
17
|
+
name: "outfitter",
|
|
18
|
+
context: { surface: "cli" }
|
|
19
|
+
});
|
|
14
20
|
const cli = createCLI({
|
|
15
21
|
name: "outfitter",
|
|
16
|
-
version:
|
|
22
|
+
version: cliVersion,
|
|
17
23
|
description: "Outfitter CLI for scaffolding and project management",
|
|
18
24
|
onError: (error) => {
|
|
19
25
|
const err = error instanceof Error ? error : new Error("An unexpected error occurred");
|
|
20
26
|
exitWithError(err);
|
|
21
27
|
},
|
|
22
|
-
onExit: (code) =>
|
|
28
|
+
onExit: async (code) => {
|
|
29
|
+
try {
|
|
30
|
+
await loggerFactory.flush();
|
|
31
|
+
} finally {
|
|
32
|
+
process.exit(code);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
23
35
|
});
|
|
24
36
|
for (const command of buildCliCommands(outfitterActions, {
|
|
25
37
|
createContext: ({ action }) => {
|
|
@@ -36,6 +48,16 @@ function createProgram() {
|
|
|
36
48
|
}
|
|
37
49
|
return cli;
|
|
38
50
|
}
|
|
51
|
+
var DEFAULT_CLI_VERSION = "0.0.0";
|
|
52
|
+
function readCliVersion() {
|
|
53
|
+
try {
|
|
54
|
+
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
55
|
+
if (typeof packageJson.version === "string" && packageJson.version.length > 0) {
|
|
56
|
+
return packageJson.version;
|
|
57
|
+
}
|
|
58
|
+
} catch {}
|
|
59
|
+
return DEFAULT_CLI_VERSION;
|
|
60
|
+
}
|
|
39
61
|
async function main() {
|
|
40
62
|
const cli = createProgram();
|
|
41
63
|
await cli.parse();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,96 @@
|
|
|
1
1
|
import { ActionRegistry } from "@outfitter/contracts";
|
|
2
2
|
declare const outfitterActions: ActionRegistry;
|
|
3
3
|
import { OutputMode } from "@outfitter/cli/types";
|
|
4
|
+
import { Result as Result2 } from "@outfitter/contracts";
|
|
5
|
+
import { AddBlockResult } from "@outfitter/tooling";
|
|
4
6
|
import { Command } from "commander";
|
|
7
|
+
import { Result, ValidationError } from "@outfitter/contracts";
|
|
8
|
+
/**
|
|
9
|
+
* Create planner types for kit-first project scaffolding.
|
|
10
|
+
*
|
|
11
|
+
* These types model preset intent separately from execution so future flows can
|
|
12
|
+
* consume a deterministic plan before mutating the filesystem.
|
|
13
|
+
*/
|
|
14
|
+
type CreatePresetId = "basic" | "cli" | "daemon" | "mcp";
|
|
15
|
+
interface CreatePresetDefinition {
|
|
16
|
+
readonly id: CreatePresetId;
|
|
17
|
+
readonly template: CreatePresetId;
|
|
18
|
+
readonly summary: string;
|
|
19
|
+
readonly defaultBlocks: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
interface CreateProjectInput {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly targetDir: string;
|
|
24
|
+
readonly preset: CreatePresetId;
|
|
25
|
+
readonly packageName?: string;
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
readonly version?: string;
|
|
28
|
+
readonly includeTooling?: boolean;
|
|
29
|
+
readonly local?: boolean;
|
|
30
|
+
readonly year?: string;
|
|
31
|
+
}
|
|
32
|
+
type CreatePlanChange = {
|
|
33
|
+
readonly type: "copy-template";
|
|
34
|
+
readonly template: string;
|
|
35
|
+
readonly targetDir: string;
|
|
36
|
+
readonly overlayBaseTemplate: boolean;
|
|
37
|
+
} | {
|
|
38
|
+
readonly type: "inject-shared-config";
|
|
39
|
+
} | {
|
|
40
|
+
readonly type: "rewrite-local-dependencies";
|
|
41
|
+
readonly mode: "workspace";
|
|
42
|
+
} | {
|
|
43
|
+
readonly type: "add-blocks";
|
|
44
|
+
readonly blocks: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
interface CreateProjectPlan {
|
|
47
|
+
readonly preset: CreatePresetDefinition;
|
|
48
|
+
readonly values: {
|
|
49
|
+
readonly packageName: string;
|
|
50
|
+
readonly projectName: string;
|
|
51
|
+
readonly version: string;
|
|
52
|
+
readonly description: string;
|
|
53
|
+
readonly binName: string;
|
|
54
|
+
readonly year: string;
|
|
55
|
+
};
|
|
56
|
+
readonly changes: readonly CreatePlanChange[];
|
|
57
|
+
}
|
|
58
|
+
declare function planCreateProject(input: CreateProjectInput): Result<CreateProjectPlan, ValidationError>;
|
|
59
|
+
declare const CREATE_PRESETS: Readonly<Record<CreatePresetId, CreatePresetDefinition>>;
|
|
60
|
+
declare const CREATE_PRESET_IDS: CreatePresetId[];
|
|
61
|
+
declare function getCreatePreset(id: string): CreatePresetDefinition | undefined;
|
|
62
|
+
type CreateStructure = "single" | "workspace";
|
|
63
|
+
interface CreateOptions {
|
|
64
|
+
readonly targetDir: string;
|
|
65
|
+
readonly name?: string | undefined;
|
|
66
|
+
readonly preset?: CreatePresetId | undefined;
|
|
67
|
+
readonly structure?: CreateStructure | undefined;
|
|
68
|
+
readonly workspaceName?: string | undefined;
|
|
69
|
+
readonly local?: boolean | undefined;
|
|
70
|
+
readonly force: boolean;
|
|
71
|
+
readonly with?: string | undefined;
|
|
72
|
+
readonly noTooling?: boolean | undefined;
|
|
73
|
+
readonly yes?: boolean | undefined;
|
|
74
|
+
}
|
|
75
|
+
interface CreateResult {
|
|
76
|
+
readonly structure: CreateStructure;
|
|
77
|
+
readonly rootDir: string;
|
|
78
|
+
readonly projectDir: string;
|
|
79
|
+
readonly preset: CreatePresetId;
|
|
80
|
+
readonly packageName: string;
|
|
81
|
+
readonly blocksAdded?: AddBlockResult | undefined;
|
|
82
|
+
}
|
|
83
|
+
declare class CreateError extends Error {
|
|
84
|
+
readonly _tag: "CreateError";
|
|
85
|
+
constructor(message: string);
|
|
86
|
+
}
|
|
87
|
+
declare function runCreate(options: CreateOptions): Promise<Result2<CreateResult, CreateError>>;
|
|
88
|
+
declare function printCreateResults(result: CreateResult, options?: {
|
|
89
|
+
mode?: OutputMode;
|
|
90
|
+
}): Promise<void>;
|
|
91
|
+
declare function createCommand(program: Command): void;
|
|
92
|
+
import { OutputMode as OutputMode2 } from "@outfitter/cli/types";
|
|
93
|
+
import { Command as Command2 } from "commander";
|
|
5
94
|
/**
|
|
6
95
|
* Options for the doctor command.
|
|
7
96
|
*/
|
|
@@ -113,7 +202,7 @@ declare function runDoctor(options: DoctorOptions): DoctorResult;
|
|
|
113
202
|
* Formats and outputs doctor results.
|
|
114
203
|
*/
|
|
115
204
|
declare function printDoctorResults(result: DoctorResult, options?: {
|
|
116
|
-
mode?:
|
|
205
|
+
mode?: OutputMode2;
|
|
117
206
|
}): Promise<void>;
|
|
118
207
|
/**
|
|
119
208
|
* Registers the doctor command with the CLI program.
|
|
@@ -129,10 +218,10 @@ declare function printDoctorResults(result: DoctorResult, options?: {
|
|
|
129
218
|
* doctorCommand(program);
|
|
130
219
|
* ```
|
|
131
220
|
*/
|
|
132
|
-
declare function doctorCommand(program:
|
|
133
|
-
import { Result } from "@outfitter/contracts";
|
|
134
|
-
import { AddBlockResult } from "@outfitter/tooling";
|
|
135
|
-
import { Command as
|
|
221
|
+
declare function doctorCommand(program: Command2): void;
|
|
222
|
+
import { Result as Result3 } from "@outfitter/contracts";
|
|
223
|
+
import { AddBlockResult as AddBlockResult2 } from "@outfitter/tooling";
|
|
224
|
+
import { Command as Command3 } from "commander";
|
|
136
225
|
/**
|
|
137
226
|
* Options for the init command.
|
|
138
227
|
*/
|
|
@@ -159,7 +248,7 @@ interface InitOptions {
|
|
|
159
248
|
*/
|
|
160
249
|
interface InitResult {
|
|
161
250
|
/** The blocks that were added, if any */
|
|
162
|
-
readonly blocksAdded?:
|
|
251
|
+
readonly blocksAdded?: AddBlockResult2 | undefined;
|
|
163
252
|
}
|
|
164
253
|
/**
|
|
165
254
|
* Error returned when initialization fails.
|
|
@@ -194,7 +283,7 @@ declare class InitError extends Error {
|
|
|
194
283
|
* }
|
|
195
284
|
* ```
|
|
196
285
|
*/
|
|
197
|
-
declare function runInit(options: InitOptions): Promise<
|
|
286
|
+
declare function runInit(options: InitOptions): Promise<Result3<InitResult, InitError>>;
|
|
198
287
|
/**
|
|
199
288
|
* Registers the init command with the CLI program.
|
|
200
289
|
*
|
|
@@ -209,5 +298,55 @@ declare function runInit(options: InitOptions): Promise<Result<InitResult, InitE
|
|
|
209
298
|
* initCommand(program);
|
|
210
299
|
* ```
|
|
211
300
|
*/
|
|
212
|
-
declare function initCommand(program:
|
|
213
|
-
|
|
301
|
+
declare function initCommand(program: Command3): void;
|
|
302
|
+
import { OutputMode as OutputMode4 } from "@outfitter/cli/types";
|
|
303
|
+
import { Result as Result4 } from "@outfitter/contracts";
|
|
304
|
+
import { Command as Command4 } from "commander";
|
|
305
|
+
interface DiffPreview {
|
|
306
|
+
readonly path: string;
|
|
307
|
+
readonly preview: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Options for the migrate-kit command.
|
|
311
|
+
*/
|
|
312
|
+
interface MigrateKitOptions {
|
|
313
|
+
/** Target directory to migrate (defaults to cwd). */
|
|
314
|
+
readonly targetDir?: string | undefined;
|
|
315
|
+
/** Run codemod without writing changes to disk. */
|
|
316
|
+
readonly dryRun?: boolean | undefined;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Result from migrate-kit execution.
|
|
320
|
+
*/
|
|
321
|
+
interface MigrateKitResult {
|
|
322
|
+
readonly targetDir: string;
|
|
323
|
+
readonly dryRun: boolean;
|
|
324
|
+
readonly packageJsonFiles: number;
|
|
325
|
+
readonly sourceFiles: number;
|
|
326
|
+
readonly manifestUpdates: number;
|
|
327
|
+
readonly importRewrites: number;
|
|
328
|
+
readonly changedFiles: readonly string[];
|
|
329
|
+
readonly diffs: readonly DiffPreview[];
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Error returned when migration fails.
|
|
333
|
+
*/
|
|
334
|
+
declare class MigrateKitError extends Error {
|
|
335
|
+
readonly _tag: "MigrateKitError";
|
|
336
|
+
constructor(message: string);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Runs the migrate-kit codemod programmatically.
|
|
340
|
+
*/
|
|
341
|
+
declare function runMigrateKit(options: MigrateKitOptions): Promise<Result4<MigrateKitResult, MigrateKitError>>;
|
|
342
|
+
/**
|
|
343
|
+
* Print migrate-kit results.
|
|
344
|
+
*/
|
|
345
|
+
declare function printMigrateKitResults(result: MigrateKitResult, options?: {
|
|
346
|
+
mode?: OutputMode4;
|
|
347
|
+
}): Promise<void>;
|
|
348
|
+
/**
|
|
349
|
+
* Register `migrate kit` command directly on Commander.
|
|
350
|
+
*/
|
|
351
|
+
declare function migrateKitCommand(program: Command4): void;
|
|
352
|
+
export { runMigrateKit, runInit, runDoctor, runCreate, printMigrateKitResults, printDoctorResults, printCreateResults, planCreateProject, outfitterActions, migrateKitCommand, initCommand, getCreatePreset, doctorCommand, createCommand, PackageJsonCheck, MigrateKitResult, MigrateKitOptions, MigrateKitError, InitOptions, InitError, DoctorSummary, DoctorResult, DoctorOptions, DirectoriesCheck, DependenciesCheck, CreateStructure, CreateResult, CreateProjectPlan, CreateProjectInput, CreatePresetId, CreatePresetDefinition, CreatePlanChange, CreateOptions, CreateError, ConfigFilesCheck, CheckResult, CREATE_PRESET_IDS, CREATE_PRESETS, BunVersionCheck };
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CREATE_PRESETS,
|
|
3
|
+
CREATE_PRESET_IDS,
|
|
4
|
+
CreateError,
|
|
2
5
|
InitError,
|
|
6
|
+
MigrateKitError,
|
|
7
|
+
createCommand,
|
|
3
8
|
doctorCommand,
|
|
9
|
+
getCreatePreset,
|
|
4
10
|
initCommand,
|
|
11
|
+
migrateKitCommand,
|
|
5
12
|
outfitterActions,
|
|
13
|
+
planCreateProject,
|
|
14
|
+
printCreateResults,
|
|
6
15
|
printDoctorResults,
|
|
16
|
+
printMigrateKitResults,
|
|
17
|
+
runCreate,
|
|
7
18
|
runDoctor,
|
|
8
|
-
runInit
|
|
9
|
-
|
|
19
|
+
runInit,
|
|
20
|
+
runMigrateKit
|
|
21
|
+
} from "./shared/chunk-sak1tt33.js";
|
|
10
22
|
export {
|
|
23
|
+
runMigrateKit,
|
|
11
24
|
runInit,
|
|
12
25
|
runDoctor,
|
|
26
|
+
runCreate,
|
|
27
|
+
printMigrateKitResults,
|
|
13
28
|
printDoctorResults,
|
|
29
|
+
printCreateResults,
|
|
30
|
+
planCreateProject,
|
|
14
31
|
outfitterActions,
|
|
32
|
+
migrateKitCommand,
|
|
15
33
|
initCommand,
|
|
34
|
+
getCreatePreset,
|
|
16
35
|
doctorCommand,
|
|
17
|
-
|
|
36
|
+
createCommand,
|
|
37
|
+
MigrateKitError,
|
|
38
|
+
InitError,
|
|
39
|
+
CreateError,
|
|
40
|
+
CREATE_PRESET_IDS,
|
|
41
|
+
CREATE_PRESETS
|
|
18
42
|
};
|