outfitter 0.2.6 → 0.3.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/README.md +53 -28
- package/dist/cli.js +3 -2
- package/dist/index.d.ts +95 -135
- package/dist/index.js +8 -15
- package/dist/shared/{chunk-k59f60cp.js → chunk-3pwh8ys4.js} +3092 -2625
- package/package.json +36 -22
- package/dist/actions.d.ts +0 -2
- package/dist/actions.js +0 -34
- package/dist/commands/add.d.ts +0 -54
- package/dist/commands/add.js +0 -16
- package/dist/commands/check.d.ts +0 -91
- package/dist/commands/check.js +0 -14
- package/dist/commands/demo.d.ts +0 -21
- package/dist/commands/demo.js +0 -8
- package/dist/commands/docs-module-loader.d.ts +0 -2
- package/dist/commands/docs-module-loader.js +0 -8
- package/dist/commands/doctor.d.ts +0 -2
- package/dist/commands/doctor.js +0 -13
- package/dist/commands/init.d.ts +0 -7
- package/dist/commands/init.js +0 -31
- package/dist/commands/migrate-kit.d.ts +0 -2
- package/dist/commands/migrate-kit.js +0 -15
- package/dist/commands/repo.d.ts +0 -3
- package/dist/commands/repo.js +0 -9
- package/dist/commands/scaffold.d.ts +0 -4
- package/dist/commands/scaffold.js +0 -31
- package/dist/commands/shared-deps.d.ts +0 -36
- package/dist/commands/shared-deps.js +0 -10
- package/dist/commands/upgrade-codemods.d.ts +0 -42
- package/dist/commands/upgrade-codemods.js +0 -15
- package/dist/commands/upgrade-planner.d.ts +0 -58
- package/dist/commands/upgrade-planner.js +0 -8
- package/dist/commands/upgrade-workspace.d.ts +0 -76
- package/dist/commands/upgrade-workspace.js +0 -16
- package/dist/commands/upgrade.d.ts +0 -214
- package/dist/commands/upgrade.js +0 -25
- package/dist/create/index.d.ts +0 -5
- package/dist/create/index.js +0 -29
- package/dist/create/planner.d.ts +0 -3
- package/dist/create/planner.js +0 -21
- package/dist/create/presets.d.ts +0 -3
- package/dist/create/presets.js +0 -12
- package/dist/create/types.d.ts +0 -2
- package/dist/create/types.js +0 -1
- package/dist/engine/blocks.d.ts +0 -3
- package/dist/engine/blocks.js +0 -12
- package/dist/engine/collector.d.ts +0 -2
- package/dist/engine/collector.js +0 -8
- package/dist/engine/config.d.ts +0 -3
- package/dist/engine/config.js +0 -12
- package/dist/engine/executor.d.ts +0 -3
- package/dist/engine/executor.js +0 -16
- package/dist/engine/index.d.ts +0 -8
- package/dist/engine/index.js +0 -59
- package/dist/engine/names.d.ts +0 -2
- package/dist/engine/names.js +0 -16
- package/dist/engine/post-scaffold.d.ts +0 -3
- package/dist/engine/post-scaffold.js +0 -8
- package/dist/engine/render-plan.d.ts +0 -7
- package/dist/engine/render-plan.js +0 -9
- package/dist/engine/template.d.ts +0 -3
- package/dist/engine/template.js +0 -17
- package/dist/engine/types.d.ts +0 -2
- package/dist/engine/types.js +0 -8
- package/dist/engine/workspace.d.ts +0 -3
- package/dist/engine/workspace.js +0 -13
- package/dist/manifest.d.ts +0 -71
- package/dist/manifest.js +0 -16
- package/dist/output-mode.d.ts +0 -2
- package/dist/output-mode.js +0 -10
- package/dist/shared/outfitter-193jvzg4.d.ts +0 -5
- package/dist/shared/outfitter-1dd0k853.js +0 -194
- package/dist/shared/outfitter-1dvma85c.js +0 -322
- package/dist/shared/outfitter-1h7k8xxt.js +0 -29
- package/dist/shared/outfitter-2ngep1h2.d.ts +0 -5
- package/dist/shared/outfitter-2np85etz.js +0 -95
- package/dist/shared/outfitter-33w361tc.d.ts +0 -18
- package/dist/shared/outfitter-344t1r38.js +0 -1
- package/dist/shared/outfitter-3weh61w7.d.ts +0 -25
- package/dist/shared/outfitter-4s9meh3j.js +0 -221
- package/dist/shared/outfitter-66b25bj8.js +0 -125
- package/dist/shared/outfitter-6bkqjk86.d.ts +0 -3
- package/dist/shared/outfitter-79vfxt6y.js +0 -269
- package/dist/shared/outfitter-7ha7p61k.d.ts +0 -6
- package/dist/shared/outfitter-7r12fj7f.js +0 -30
- package/dist/shared/outfitter-8y2dfx6n.js +0 -11
- package/dist/shared/outfitter-9x1brcmq.js +0 -184
- package/dist/shared/outfitter-9zqc2njf.js +0 -859
- package/dist/shared/outfitter-a79xrm12.d.ts +0 -17
- package/dist/shared/outfitter-amc4jbs1.d.ts +0 -50
- package/dist/shared/outfitter-ara3djt0.js +0 -73
- package/dist/shared/outfitter-avhm5z6w.js +0 -82
- package/dist/shared/outfitter-bkwpbkr9.d.ts +0 -63
- package/dist/shared/outfitter-bn9c8p2e.js +0 -204
- package/dist/shared/outfitter-bpr28y54.js +0 -70
- package/dist/shared/outfitter-cwq39bv4.d.ts +0 -48
- package/dist/shared/outfitter-d7pq7d0k.js +0 -196
- package/dist/shared/outfitter-dd0btgec.d.ts +0 -40
- package/dist/shared/outfitter-e2zz5wv7.d.ts +0 -51
- package/dist/shared/outfitter-ehp18x1n.js +0 -1
- package/dist/shared/outfitter-gdvm5c0b.d.ts +0 -4
- package/dist/shared/outfitter-h1mnzzd1.d.ts +0 -14
- package/dist/shared/outfitter-hvsaxgcp.js +0 -1
- package/dist/shared/outfitter-hws10ze7.js +0 -532
- package/dist/shared/outfitter-j833sxws.js +0 -61
- package/dist/shared/outfitter-j8yc7294.d.ts +0 -22
- package/dist/shared/outfitter-k112c427.js +0 -21
- package/dist/shared/outfitter-k56rmt24.d.ts +0 -30
- package/dist/shared/outfitter-ksa1pp4t.d.ts +0 -4
- package/dist/shared/outfitter-ksyvwmb5.js +0 -191
- package/dist/shared/outfitter-mdt37hqm.js +0 -4
- package/dist/shared/outfitter-mtbpabf3.js +0 -91
- package/dist/shared/outfitter-mxz69pgy.js +0 -713
- package/dist/shared/outfitter-npemy7ta.d.ts +0 -53
- package/dist/shared/outfitter-npyfbdmc.d.ts +0 -6
- package/dist/shared/outfitter-pyy1zkfh.d.ts +0 -133
- package/dist/shared/outfitter-q9agarmb.js +0 -42
- package/dist/shared/outfitter-qfh36ddg.d.ts +0 -66
- package/dist/shared/outfitter-qn864k6h.js +0 -581
- package/dist/shared/outfitter-rdc5v5ms.js +0 -746
- package/dist/shared/outfitter-sgtq57qr.d.ts +0 -5
- package/dist/shared/outfitter-ttjr95y9.js +0 -98
- package/dist/shared/outfitter-vh4xgb93.js +0 -35
- package/dist/shared/outfitter-yvksv5qb.js +0 -322
- package/dist/shared/outfitter-zwyvewr1.js +0 -36
- package/dist/targets/index.d.ts +0 -4
- package/dist/targets/index.js +0 -29
- package/dist/targets/registry.d.ts +0 -3
- package/dist/targets/registry.js +0 -28
- package/dist/targets/types.d.ts +0 -2
- package/dist/targets/types.js +0 -1
- package/templates/.gitkeep +0 -0
- package/templates/basic/.gitignore.template +0 -30
- package/templates/basic/.lefthook.yml.template +0 -26
- package/templates/basic/package.json.template +0 -46
- package/templates/basic/src/index.ts.template +0 -26
- package/templates/basic/tsconfig.json.template +0 -34
- package/templates/cli/.gitignore.template +0 -4
- package/templates/cli/.lefthook.yml.template +0 -26
- package/templates/cli/README.md.template +0 -35
- package/templates/cli/biome.json.template +0 -4
- package/templates/cli/package.json.template +0 -45
- package/templates/cli/src/cli.ts.template +0 -8
- package/templates/cli/src/index.ts.template +0 -7
- package/templates/cli/src/program.ts.template +0 -31
- package/templates/cli/tsconfig.json.template +0 -34
- package/templates/daemon/.gitignore.template +0 -4
- package/templates/daemon/.lefthook.yml.template +0 -26
- package/templates/daemon/README.md.template +0 -67
- package/templates/daemon/biome.json.template +0 -4
- package/templates/daemon/package.json.template +0 -48
- package/templates/daemon/src/cli.ts.template +0 -96
- package/templates/daemon/src/daemon-main.ts.template +0 -79
- package/templates/daemon/src/daemon.ts.template +0 -11
- package/templates/daemon/src/index.ts.template +0 -7
- package/templates/daemon/tsconfig.json.template +0 -23
- package/templates/mcp/.gitignore.template +0 -4
- package/templates/mcp/.lefthook.yml.template +0 -26
- package/templates/mcp/README.md.template +0 -54
- package/templates/mcp/biome.json.template +0 -4
- package/templates/mcp/package.json.template +0 -45
- package/templates/mcp/src/index.ts.template +0 -7
- package/templates/mcp/src/mcp.ts.template +0 -79
- package/templates/mcp/src/server.ts.template +0 -15
- package/templates/mcp/tsconfig.json.template +0 -23
- package/templates/minimal/.gitignore.template +0 -30
- package/templates/minimal/.lefthook.yml.template +0 -26
- package/templates/minimal/package.json.template +0 -46
- package/templates/minimal/src/index.ts.template +0 -26
- package/templates/minimal/tsconfig.json.template +0 -34
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { OperationCollector } from "../shared/outfitter-amc4jbs1";
|
|
2
|
-
import { OutputMode } from "@outfitter/cli/types";
|
|
3
|
-
declare function renderOperationPlan(collector: OperationCollector, options?: {
|
|
4
|
-
readonly mode?: OutputMode;
|
|
5
|
-
readonly rootDir?: string;
|
|
6
|
-
}): Promise<void>;
|
|
7
|
-
export { renderOperationPlan };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { copyTemplateFiles, getOutputFilename, getTemplatesDir, isBinaryFile, replacePlaceholders } from "../shared/outfitter-h1mnzzd1";
|
|
2
|
-
import "../shared/outfitter-qfh36ddg";
|
|
3
|
-
export { replacePlaceholders, isBinaryFile, getTemplatesDir, getOutputFilename, copyTemplateFiles };
|
package/dist/engine/template.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
copyTemplateFiles,
|
|
4
|
-
getOutputFilename,
|
|
5
|
-
getTemplatesDir,
|
|
6
|
-
isBinaryFile,
|
|
7
|
-
replacePlaceholders
|
|
8
|
-
} from "../shared/outfitter-9x1brcmq.js";
|
|
9
|
-
import"../shared/outfitter-8y2dfx6n.js";
|
|
10
|
-
import"../shared/outfitter-mdt37hqm.js";
|
|
11
|
-
export {
|
|
12
|
-
replacePlaceholders,
|
|
13
|
-
isBinaryFile,
|
|
14
|
-
getTemplatesDir,
|
|
15
|
-
getOutputFilename,
|
|
16
|
-
copyTemplateFiles
|
|
17
|
-
};
|
package/dist/engine/types.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { EngineCollector, EngineOptions, PlaceholderValues, ScaffoldChange, ScaffoldError, ScaffoldPlan, ScaffoldResult } from "../shared/outfitter-qfh36ddg";
|
|
2
|
-
export { ScaffoldResult, ScaffoldPlan, ScaffoldError, ScaffoldChange, PlaceholderValues, EngineOptions, EngineCollector };
|
package/dist/engine/types.js
DELETED
package/dist/engine/workspace.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
buildWorkspaceRootPackageJson,
|
|
4
|
-
detectWorkspaceRoot,
|
|
5
|
-
scaffoldWorkspaceRoot
|
|
6
|
-
} from "../shared/outfitter-2np85etz.js";
|
|
7
|
-
import"../shared/outfitter-8y2dfx6n.js";
|
|
8
|
-
import"../shared/outfitter-mdt37hqm.js";
|
|
9
|
-
export {
|
|
10
|
-
scaffoldWorkspaceRoot,
|
|
11
|
-
detectWorkspaceRoot,
|
|
12
|
-
buildWorkspaceRootPackageJson
|
|
13
|
-
};
|
package/dist/manifest.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { OutfitterError, Result } from "@outfitter/contracts";
|
|
2
|
-
import { ZodType } from "zod";
|
|
3
|
-
/** A single block entry in the manifest. */
|
|
4
|
-
interface BlockEntry {
|
|
5
|
-
/** Tooling version the block was installed from. */
|
|
6
|
-
installedFrom: string;
|
|
7
|
-
/** ISO 8601 timestamp of when the block was installed or last updated. */
|
|
8
|
-
installedAt: string;
|
|
9
|
-
}
|
|
10
|
-
/** The full manifest structure. */
|
|
11
|
-
interface Manifest {
|
|
12
|
-
/** Manifest format version. Currently always 1. */
|
|
13
|
-
version: 1;
|
|
14
|
-
/** Map of block name to install metadata. */
|
|
15
|
-
blocks: Record<string, BlockEntry>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Schema for a single block entry in the manifest.
|
|
19
|
-
*/
|
|
20
|
-
declare const BlockEntrySchema: ZodType<BlockEntry>;
|
|
21
|
-
/**
|
|
22
|
-
* Schema for the manifest file.
|
|
23
|
-
*/
|
|
24
|
-
declare const ManifestSchema: ZodType<Manifest>;
|
|
25
|
-
/**
|
|
26
|
-
* Reads and validates `.outfitter/manifest.json`.
|
|
27
|
-
*
|
|
28
|
-
* @param cwd - Working directory containing the `.outfitter/` folder
|
|
29
|
-
* @returns The parsed manifest, or `null` if the file does not exist
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* const result = await readManifest(process.cwd());
|
|
34
|
-
* if (result.isOk() && result.value) {
|
|
35
|
-
* console.log(result.value.blocks);
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
declare function readManifest(cwd: string): Promise<Result<Manifest | null, OutfitterError>>;
|
|
40
|
-
/**
|
|
41
|
-
* Writes a manifest to `.outfitter/manifest.json`.
|
|
42
|
-
*
|
|
43
|
-
* Creates the `.outfitter/` directory if it does not exist.
|
|
44
|
-
* Writes atomically via `Bun.write`.
|
|
45
|
-
*
|
|
46
|
-
* @param cwd - Working directory to write the manifest into
|
|
47
|
-
* @param manifest - The manifest data to write
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* await writeManifest(process.cwd(), { version: 1, blocks: {} });
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function writeManifest(cwd: string, manifest: Manifest): Promise<Result<void, OutfitterError>>;
|
|
55
|
-
/**
|
|
56
|
-
* Adds or updates a block entry in the manifest (read-modify-write).
|
|
57
|
-
*
|
|
58
|
-
* If no manifest exists, creates a new one. If the block already exists,
|
|
59
|
-
* updates its `installedFrom` and `installedAt` fields.
|
|
60
|
-
*
|
|
61
|
-
* @param cwd - Working directory containing the project
|
|
62
|
-
* @param blockName - Name of the block to stamp
|
|
63
|
-
* @param toolingVersion - Version of the tooling package the block was installed from
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* await stampBlock(process.cwd(), "biome", "0.2.1");
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
declare function stampBlock(cwd: string, blockName: string, toolingVersion: string): Promise<Result<void, OutfitterError>>;
|
|
71
|
-
export { writeManifest, stampBlock, readManifest, ManifestSchema, Manifest, BlockEntrySchema, BlockEntry };
|
package/dist/manifest.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
BlockEntrySchema,
|
|
4
|
-
ManifestSchema,
|
|
5
|
-
readManifest,
|
|
6
|
-
stampBlock,
|
|
7
|
-
writeManifest
|
|
8
|
-
} from "./shared/outfitter-mtbpabf3.js";
|
|
9
|
-
import"./shared/outfitter-mdt37hqm.js";
|
|
10
|
-
export {
|
|
11
|
-
writeManifest,
|
|
12
|
-
stampBlock,
|
|
13
|
-
readManifest,
|
|
14
|
-
ManifestSchema,
|
|
15
|
-
BlockEntrySchema
|
|
16
|
-
};
|
package/dist/output-mode.d.ts
DELETED
package/dist/output-mode.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { EngineOptions, ScaffoldError } from "./outfitter-qfh36ddg";
|
|
2
|
-
import { Result } from "@outfitter/contracts";
|
|
3
|
-
import { AddBlockResult } from "@outfitter/tooling";
|
|
4
|
-
declare function addBlocks(targetDir: string, blocks: readonly string[], options: EngineOptions): Promise<Result<AddBlockResult, ScaffoldError>>;
|
|
5
|
-
export { addBlocks };
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// apps/outfitter/src/targets/registry.ts
|
|
3
|
-
import { NotFoundError, Result, ValidationError } from "@outfitter/contracts";
|
|
4
|
-
var TARGET_ALIASES = new Map([
|
|
5
|
-
["basic", "minimal"]
|
|
6
|
-
]);
|
|
7
|
-
var TARGET_REGISTRY = new Map([
|
|
8
|
-
[
|
|
9
|
-
"minimal",
|
|
10
|
-
{
|
|
11
|
-
id: "minimal",
|
|
12
|
-
description: "Minimal Bun + TypeScript project",
|
|
13
|
-
category: "library",
|
|
14
|
-
placement: "packages",
|
|
15
|
-
templateDir: "minimal",
|
|
16
|
-
defaultBlocks: ["scaffolding"],
|
|
17
|
-
status: "ready",
|
|
18
|
-
scope: "init-only"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
[
|
|
22
|
-
"cli",
|
|
23
|
-
{
|
|
24
|
-
id: "cli",
|
|
25
|
-
description: "CLI application with Outfitter command ergonomics",
|
|
26
|
-
category: "runnable",
|
|
27
|
-
placement: "apps",
|
|
28
|
-
templateDir: "cli",
|
|
29
|
-
defaultBlocks: ["scaffolding"],
|
|
30
|
-
status: "ready",
|
|
31
|
-
scope: "both"
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
[
|
|
35
|
-
"mcp",
|
|
36
|
-
{
|
|
37
|
-
id: "mcp",
|
|
38
|
-
description: "MCP server with typed tools and action registry",
|
|
39
|
-
category: "runnable",
|
|
40
|
-
placement: "apps",
|
|
41
|
-
templateDir: "mcp",
|
|
42
|
-
defaultBlocks: ["scaffolding"],
|
|
43
|
-
status: "ready",
|
|
44
|
-
scope: "both"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
[
|
|
48
|
-
"daemon",
|
|
49
|
-
{
|
|
50
|
-
id: "daemon",
|
|
51
|
-
description: "Background daemon with control CLI",
|
|
52
|
-
category: "runnable",
|
|
53
|
-
placement: "apps",
|
|
54
|
-
templateDir: "daemon",
|
|
55
|
-
defaultBlocks: ["scaffolding"],
|
|
56
|
-
status: "ready",
|
|
57
|
-
scope: "both"
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
[
|
|
61
|
-
"api",
|
|
62
|
-
{
|
|
63
|
-
id: "api",
|
|
64
|
-
description: "HTTP API server (Hono)",
|
|
65
|
-
category: "runnable",
|
|
66
|
-
placement: "apps",
|
|
67
|
-
templateDir: "api",
|
|
68
|
-
defaultBlocks: ["scaffolding"],
|
|
69
|
-
status: "stub",
|
|
70
|
-
scope: "both"
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
"worker",
|
|
75
|
-
{
|
|
76
|
-
id: "worker",
|
|
77
|
-
description: "Background job worker",
|
|
78
|
-
category: "runnable",
|
|
79
|
-
placement: "apps",
|
|
80
|
-
templateDir: "worker",
|
|
81
|
-
defaultBlocks: ["scaffolding"],
|
|
82
|
-
status: "stub",
|
|
83
|
-
scope: "both"
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
[
|
|
87
|
-
"web",
|
|
88
|
-
{
|
|
89
|
-
id: "web",
|
|
90
|
-
description: "Web application (TanStack Start)",
|
|
91
|
-
category: "runnable",
|
|
92
|
-
placement: "apps",
|
|
93
|
-
templateDir: "web",
|
|
94
|
-
defaultBlocks: ["scaffolding"],
|
|
95
|
-
status: "stub",
|
|
96
|
-
scope: "both"
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
[
|
|
100
|
-
"lib",
|
|
101
|
-
{
|
|
102
|
-
id: "lib",
|
|
103
|
-
description: "Shared library package",
|
|
104
|
-
category: "library",
|
|
105
|
-
placement: "packages",
|
|
106
|
-
templateDir: "lib",
|
|
107
|
-
defaultBlocks: ["scaffolding"],
|
|
108
|
-
status: "stub",
|
|
109
|
-
scope: "both"
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
]);
|
|
113
|
-
var TARGET_IDS = [...TARGET_REGISTRY.keys()];
|
|
114
|
-
var READY_TARGET_IDS = TARGET_IDS.filter((id) => TARGET_REGISTRY.get(id)?.status === "ready");
|
|
115
|
-
var INIT_TARGET_IDS = TARGET_IDS.filter((id) => {
|
|
116
|
-
const target = TARGET_REGISTRY.get(id);
|
|
117
|
-
return target?.status === "ready" && target.scope !== "scaffold-only";
|
|
118
|
-
});
|
|
119
|
-
var SCAFFOLD_TARGET_IDS = TARGET_IDS.filter((id) => {
|
|
120
|
-
const target = TARGET_REGISTRY.get(id);
|
|
121
|
-
return target?.status === "ready" && target.scope !== "init-only";
|
|
122
|
-
});
|
|
123
|
-
function getTarget(id) {
|
|
124
|
-
const resolvedId = TARGET_ALIASES.get(id) ?? id;
|
|
125
|
-
const target = TARGET_REGISTRY.get(resolvedId);
|
|
126
|
-
if (!target) {
|
|
127
|
-
return Result.err(new NotFoundError({
|
|
128
|
-
message: `Unknown target '${id}'. Available targets: ${TARGET_IDS.join(", ")}`,
|
|
129
|
-
resourceType: "target",
|
|
130
|
-
resourceId: id
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
return Result.ok(target);
|
|
134
|
-
}
|
|
135
|
-
function getReadyTarget(id) {
|
|
136
|
-
const targetResult = getTarget(id);
|
|
137
|
-
if (targetResult.isErr()) {
|
|
138
|
-
return targetResult;
|
|
139
|
-
}
|
|
140
|
-
const target = targetResult.value;
|
|
141
|
-
if (target.status === "stub") {
|
|
142
|
-
return Result.err(new ValidationError({
|
|
143
|
-
message: `Target '${id}' is not yet available. ` + "It is planned but the template has not been implemented. " + `Ready targets: ${READY_TARGET_IDS.join(", ")}`,
|
|
144
|
-
field: "target"
|
|
145
|
-
}));
|
|
146
|
-
}
|
|
147
|
-
return Result.ok(target);
|
|
148
|
-
}
|
|
149
|
-
function getInitTarget(id) {
|
|
150
|
-
const targetResult = getReadyTarget(id);
|
|
151
|
-
if (targetResult.isErr()) {
|
|
152
|
-
return targetResult;
|
|
153
|
-
}
|
|
154
|
-
const target = targetResult.value;
|
|
155
|
-
if (target.scope === "scaffold-only") {
|
|
156
|
-
return Result.err(new ValidationError({
|
|
157
|
-
message: `Target '${id}' cannot be used with init. Use 'outfitter scaffold ${id}' instead.`,
|
|
158
|
-
field: "target"
|
|
159
|
-
}));
|
|
160
|
-
}
|
|
161
|
-
return Result.ok(target);
|
|
162
|
-
}
|
|
163
|
-
function getScaffoldTarget(id) {
|
|
164
|
-
const targetResult = getReadyTarget(id);
|
|
165
|
-
if (targetResult.isErr()) {
|
|
166
|
-
return targetResult;
|
|
167
|
-
}
|
|
168
|
-
const target = targetResult.value;
|
|
169
|
-
if (target.scope === "init-only") {
|
|
170
|
-
return Result.err(new ValidationError({
|
|
171
|
-
message: `Target '${id}' cannot be scaffolded into an existing project. ` + `It is only available for new project creation via 'outfitter init'.`,
|
|
172
|
-
field: "target"
|
|
173
|
-
}));
|
|
174
|
-
}
|
|
175
|
-
return Result.ok(target);
|
|
176
|
-
}
|
|
177
|
-
function resolvePlacement(target) {
|
|
178
|
-
return target.placement;
|
|
179
|
-
}
|
|
180
|
-
function listTargets(filter) {
|
|
181
|
-
let targets = [...TARGET_REGISTRY.values()];
|
|
182
|
-
if (filter?.status) {
|
|
183
|
-
targets = targets.filter((target) => target.status === filter.status);
|
|
184
|
-
}
|
|
185
|
-
if (filter?.scope) {
|
|
186
|
-
targets = targets.filter((target) => target.scope === filter.scope);
|
|
187
|
-
}
|
|
188
|
-
if (filter?.category) {
|
|
189
|
-
targets = targets.filter((target) => target.category === filter.category);
|
|
190
|
-
}
|
|
191
|
-
return targets;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export { TARGET_REGISTRY, TARGET_IDS, READY_TARGET_IDS, INIT_TARGET_IDS, SCAFFOLD_TARGET_IDS, getTarget, getReadyTarget, getInitTarget, getScaffoldTarget, resolvePlacement, listTargets };
|