outfitter 0.2.6 → 0.2.7
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 +52 -26
- package/dist/actions.d.ts +1 -1
- package/dist/actions.js +20 -19
- package/dist/cli.js +3 -2
- package/dist/commands/add.d.ts +4 -4
- package/dist/commands/check-tsdoc.d.ts +22 -0
- package/dist/commands/check-tsdoc.js +8 -0
- package/dist/commands/check.d.ts +12 -12
- package/dist/commands/check.js +1 -1
- package/dist/commands/demo.d.ts +3 -3
- package/dist/commands/docs-module-loader.d.ts +1 -1
- package/dist/commands/doctor.d.ts +2 -2
- package/dist/commands/doctor.js +13 -1
- package/dist/commands/init.d.ts +6 -6
- package/dist/commands/init.js +12 -11
- package/dist/commands/repo.d.ts +2 -2
- package/dist/commands/scaffold.d.ts +3 -3
- package/dist/commands/scaffold.js +12 -11
- package/dist/commands/shared-deps.d.ts +1 -16
- package/dist/commands/shared-deps.js +2 -1
- package/dist/commands/upgrade-codemods.d.ts +4 -4
- package/dist/commands/upgrade-codemods.js +2 -2
- package/dist/commands/upgrade-planner.d.ts +6 -6
- package/dist/commands/upgrade-workspace.d.ts +1 -75
- package/dist/commands/upgrade.d.ts +66 -59
- package/dist/commands/upgrade.js +2 -2
- package/dist/create/index.d.ts +4 -4
- package/dist/create/index.js +13 -12
- package/dist/create/planner.d.ts +2 -2
- package/dist/create/planner.js +9 -8
- package/dist/create/presets.d.ts +2 -2
- package/dist/create/types.d.ts +1 -1
- package/dist/engine/blocks.d.ts +2 -2
- package/dist/engine/blocks.js +1 -1
- package/dist/engine/collector.d.ts +1 -1
- package/dist/engine/config.d.ts +2 -2
- package/dist/engine/config.js +5 -2
- package/dist/engine/dependency-versions.d.ts +12 -0
- package/dist/engine/dependency-versions.js +12 -0
- package/dist/engine/executor.d.ts +2 -2
- package/dist/engine/executor.js +7 -4
- package/dist/engine/index.d.ts +8 -8
- package/dist/engine/index.js +28 -19
- package/dist/engine/names.d.ts +2 -2
- package/dist/engine/names.js +10 -2
- package/dist/engine/post-scaffold.d.ts +2 -2
- package/dist/engine/render-plan.d.ts +1 -1
- package/dist/engine/template.d.ts +2 -2
- package/dist/engine/types.d.ts +1 -1
- package/dist/engine/workspace.d.ts +3 -3
- package/dist/engine/workspace.js +8 -1
- package/dist/index.d.ts +93 -132
- package/dist/index.js +1 -9
- package/dist/manifest.d.ts +4 -4
- package/dist/output-mode.d.ts +1 -1
- package/dist/shared/{chunk-k59f60cp.js → chunk-x6644tk8.js} +3017 -2520
- package/dist/shared/outfitter-109s75x0.d.ts +76 -0
- package/dist/shared/{outfitter-2np85etz.js → outfitter-1fy7byz5.js} +76 -1
- package/dist/shared/outfitter-20f6a2n4.js +35 -0
- package/dist/shared/outfitter-4q1zfmvc.js +154 -0
- package/dist/shared/{outfitter-66b25bj8.js → outfitter-5akzvppx.js} +4 -4
- package/dist/shared/outfitter-5y646xzk.js +301 -0
- package/dist/shared/{outfitter-j8yc7294.d.ts → outfitter-5yjr404v.d.ts} +4 -4
- package/dist/shared/outfitter-63gse8fv.js +316 -0
- package/dist/shared/{outfitter-rdc5v5ms.js → outfitter-7ch26yq8.js} +210 -71
- package/dist/shared/{outfitter-ksa1pp4t.d.ts → outfitter-dpj9erew.d.ts} +1 -1
- package/dist/shared/{outfitter-sgtq57qr.d.ts → outfitter-f9znfhkn.d.ts} +1 -1
- package/dist/shared/outfitter-fhnjpjwc.d.ts +18 -0
- package/dist/shared/{outfitter-193jvzg4.d.ts → outfitter-fn20r49x.d.ts} +1 -1
- package/dist/shared/{outfitter-cwq39bv4.d.ts → outfitter-h3q6ae6d.d.ts} +17 -17
- package/dist/shared/outfitter-ha89qf8q.js +132 -0
- package/dist/shared/{outfitter-pyy1zkfh.d.ts → outfitter-hsp8vy5m.d.ts} +25 -12
- package/dist/shared/outfitter-m3ehh37q.d.ts +22 -0
- package/dist/shared/outfitter-m44n0qzw.js +161 -0
- package/dist/shared/{outfitter-qn864k6h.js → outfitter-mt7d1ek2.js} +152 -35
- package/dist/shared/{outfitter-avhm5z6w.js → outfitter-p71qb0f0.js} +4 -4
- package/dist/shared/{outfitter-9zqc2njf.js → outfitter-pcj9gg2g.js} +90 -40
- package/dist/shared/{outfitter-hws10ze7.js → outfitter-pj9vp00r.js} +87 -18
- package/dist/shared/{outfitter-gdvm5c0b.d.ts → outfitter-qakwgrrh.d.ts} +1 -1
- package/dist/shared/{outfitter-k56rmt24.d.ts → outfitter-r419zfgs.d.ts} +6 -6
- package/dist/shared/{outfitter-33w361tc.d.ts → outfitter-s7jetkge.d.ts} +1 -1
- package/dist/shared/{outfitter-1dvma85c.js → outfitter-w1j80j1r.js} +4 -0
- package/dist/shared/{outfitter-1dd0k853.js → outfitter-xe5mzgdc.js} +21 -7
- package/dist/shared/{outfitter-h1mnzzd1.d.ts → outfitter-ybbazsxq.d.ts} +1 -1
- package/dist/shared/{outfitter-2ngep1h2.d.ts → outfitter-yraebrmw.d.ts} +1 -1
- package/dist/shared/{outfitter-bkwpbkr9.d.ts → outfitter-z0we32cp.d.ts} +21 -21
- package/dist/shared/{outfitter-3weh61w7.d.ts → outfitter-z5sx06qe.d.ts} +12 -12
- package/dist/targets/index.d.ts +3 -3
- package/dist/targets/index.js +1 -1
- package/dist/targets/registry.d.ts +2 -2
- package/dist/targets/registry.js +1 -1
- package/dist/targets/types.d.ts +1 -1
- package/package.json +29 -19
- package/template-versions.json +22 -0
- package/templates/basic/package.json.template +6 -6
- package/templates/cli/biome.json.template +1 -1
- package/templates/cli/package.json.template +17 -9
- package/templates/daemon/biome.json.template +1 -1
- package/templates/daemon/package.json.template +18 -10
- package/templates/full-stack/.gitignore.template +30 -0
- package/templates/full-stack/README.md.template +30 -0
- package/templates/full-stack/apps/cli/package.json.template +39 -0
- package/templates/full-stack/apps/cli/src/cli.ts.template +24 -0
- package/templates/full-stack/apps/cli/src/index.test.ts.template +18 -0
- package/templates/full-stack/apps/cli/src/index.ts.template +5 -0
- package/templates/full-stack/apps/cli/tsconfig.json.template +37 -0
- package/templates/full-stack/apps/mcp/package.json.template +40 -0
- package/templates/full-stack/apps/mcp/src/index.test.ts.template +18 -0
- package/templates/full-stack/apps/mcp/src/index.ts.template +6 -0
- package/templates/full-stack/apps/mcp/src/mcp.ts.template +22 -0
- package/templates/full-stack/apps/mcp/src/server.ts.template +10 -0
- package/templates/full-stack/apps/mcp/tsconfig.json.template +37 -0
- package/templates/full-stack/package.json.template +16 -0
- package/templates/full-stack/packages/core/package.json.template +36 -0
- package/templates/full-stack/packages/core/src/handlers.ts.template +31 -0
- package/templates/full-stack/packages/core/src/index.test.ts.template +30 -0
- package/templates/full-stack/packages/core/src/index.ts.template +8 -0
- package/templates/full-stack/packages/core/src/types.ts.template +13 -0
- package/templates/full-stack/packages/core/tsconfig.json.template +34 -0
- package/templates/library/.gitignore.template +30 -0
- package/templates/library/README.md.template +29 -0
- package/templates/library/bunup.config.ts.template +20 -0
- package/templates/library/package.json.template +55 -0
- package/templates/library/src/handlers.ts.template +31 -0
- package/templates/library/src/index.test.ts.template +35 -0
- package/templates/library/src/index.ts.template +8 -0
- package/templates/library/src/types.ts.template +13 -0
- package/templates/library/tsconfig.json.template +34 -0
- package/templates/mcp/biome.json.template +1 -1
- package/templates/mcp/package.json.template +17 -9
- package/templates/mcp/src/index.ts.template +1 -1
- package/templates/mcp/src/mcp.ts.template +28 -74
- package/templates/mcp/src/server.ts.template +2 -9
- package/templates/minimal/package.json.template +13 -6
- package/dist/commands/migrate-kit.d.ts +0 -2
- package/dist/commands/migrate-kit.js +0 -15
- package/dist/shared/outfitter-7ha7p61k.d.ts +0 -6
- package/dist/shared/outfitter-ara3djt0.js +0 -73
- package/dist/shared/outfitter-d7pq7d0k.js +0 -196
- package/dist/shared/outfitter-k112c427.js +0 -21
- 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-q9agarmb.js +0 -42
- package/dist/shared/{outfitter-dd0btgec.d.ts → outfitter-6fgk6adm.d.ts} +5 -5
- package/dist/shared/{outfitter-e2zz5wv7.d.ts → outfitter-e9rrfekb.d.ts} +8 -8
- package/dist/shared/{outfitter-qfh36ddg.d.ts → outfitter-n9g1zk4x.d.ts} +7 -7
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { createContext } from "@outfitter/contracts";
|
|
3
|
+
import { createGreeting } from "./handlers.js";
|
|
4
|
+
|
|
5
|
+
describe("createGreeting", () => {
|
|
6
|
+
test("returns greeting for valid input", async () => {
|
|
7
|
+
const result = await createGreeting(
|
|
8
|
+
{ name: "Outfitter", excited: true },
|
|
9
|
+
createContext({ cwd: process.cwd(), env: process.env })
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
expect(result.isOk()).toBe(true);
|
|
13
|
+
if (result.isErr()) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
expect(result.value.message).toBe("Hello, Outfitter!");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("returns validation error for invalid input", async () => {
|
|
20
|
+
const result = await createGreeting(
|
|
21
|
+
{ name: "" },
|
|
22
|
+
createContext({ cwd: process.cwd(), env: process.env })
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(result.isErr()).toBe(true);
|
|
26
|
+
if (result.isErr()) {
|
|
27
|
+
expect(result.error.name).toBe("ValidationError");
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const greetingInputSchema = z.object({
|
|
4
|
+
name: z.string().min(1, "name is required"),
|
|
5
|
+
excited: z.boolean().default(false),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type GreetingInput = z.infer<typeof greetingInputSchema>;
|
|
9
|
+
|
|
10
|
+
export interface Greeting {
|
|
11
|
+
readonly message: string;
|
|
12
|
+
readonly issuedAt: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"lib": ["ESNext"],
|
|
8
|
+
"types": ["@types/bun"],
|
|
9
|
+
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"strictNullChecks": true,
|
|
13
|
+
"noUncheckedIndexedAccess": true,
|
|
14
|
+
"exactOptionalPropertyTypes": true,
|
|
15
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
16
|
+
"noImplicitReturns": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"declarationMap": true,
|
|
21
|
+
"sourceMap": true,
|
|
22
|
+
"outDir": "./dist",
|
|
23
|
+
"rootDir": "./src",
|
|
24
|
+
|
|
25
|
+
"esModuleInterop": true,
|
|
26
|
+
"forceConsistentCasingInFileNames": true,
|
|
27
|
+
"isolatedModules": true,
|
|
28
|
+
"verbatimModuleSyntax": true,
|
|
29
|
+
"skipLibCheck": true,
|
|
30
|
+
"resolveJsonModule": true
|
|
31
|
+
},
|
|
32
|
+
"include": ["src/**/*"],
|
|
33
|
+
"exclude": ["node_modules", "dist"]
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Build output
|
|
5
|
+
dist/
|
|
6
|
+
|
|
7
|
+
# IDE
|
|
8
|
+
.idea/
|
|
9
|
+
.vscode/
|
|
10
|
+
*.swp
|
|
11
|
+
*.swo
|
|
12
|
+
|
|
13
|
+
# OS
|
|
14
|
+
.DS_Store
|
|
15
|
+
Thumbs.db
|
|
16
|
+
|
|
17
|
+
# Logs
|
|
18
|
+
*.log
|
|
19
|
+
npm-debug.log*
|
|
20
|
+
|
|
21
|
+
# Environment
|
|
22
|
+
.env
|
|
23
|
+
.env.local
|
|
24
|
+
.env.*.local
|
|
25
|
+
|
|
26
|
+
# Test coverage
|
|
27
|
+
coverage/
|
|
28
|
+
|
|
29
|
+
# Bun
|
|
30
|
+
bun.lockb
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
{{description}}
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add {{packageName}}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Development
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Install dependencies
|
|
15
|
+
bun install
|
|
16
|
+
|
|
17
|
+
# Build CJS + ESM artifacts
|
|
18
|
+
bun run build
|
|
19
|
+
|
|
20
|
+
# Typecheck
|
|
21
|
+
bun run typecheck
|
|
22
|
+
|
|
23
|
+
# Run tests
|
|
24
|
+
bun run test
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineWorkspace } from "bunup";
|
|
2
|
+
|
|
3
|
+
export default defineWorkspace(
|
|
4
|
+
[
|
|
5
|
+
{
|
|
6
|
+
name: "{{packageName}}",
|
|
7
|
+
root: ".",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
{
|
|
11
|
+
entry: ["src/**/*.ts", "!src/**/*.test.ts", "!src/**/__tests__/**"],
|
|
12
|
+
sourceBase: "./src",
|
|
13
|
+
format: ["esm", "cjs"],
|
|
14
|
+
dts: true,
|
|
15
|
+
exports: true,
|
|
16
|
+
splitting: true,
|
|
17
|
+
clean: true,
|
|
18
|
+
target: "bun",
|
|
19
|
+
}
|
|
20
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"version": "{{version}}",
|
|
4
|
+
"description": "{{description}}",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "bunup",
|
|
22
|
+
"dev": "bun --watch src/index.ts",
|
|
23
|
+
"test": "bun test",
|
|
24
|
+
"test:watch": "bun test --watch",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"lint": "biome check .",
|
|
27
|
+
"lint:fix": "biome check . --write",
|
|
28
|
+
"format": "biome format --write .",
|
|
29
|
+
"clean:artifacts": "rm -rf dist .turbo",
|
|
30
|
+
"clean": "rm -rf dist"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@outfitter/contracts": "workspace:*",
|
|
34
|
+
"@outfitter/logging": "workspace:*",
|
|
35
|
+
"zod": "^4.3.5"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@biomejs/biome": "^2.4.4",
|
|
39
|
+
"@types/bun": "^1.3.9",
|
|
40
|
+
"bunup": "^0.16.29",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
42
|
+
},
|
|
43
|
+
"outfitter": {
|
|
44
|
+
"template": {
|
|
45
|
+
"kind": "library",
|
|
46
|
+
"placement": "packages",
|
|
47
|
+
"surfaces": []
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"bun": ">=1.3.9"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [],
|
|
54
|
+
"license": "MIT"
|
|
55
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Result, ValidationError, type Handler } from "@outfitter/contracts";
|
|
2
|
+
import { createLogger } from "@outfitter/logging";
|
|
3
|
+
import { greetingInputSchema, type Greeting } from "./types.js";
|
|
4
|
+
|
|
5
|
+
const logger = createLogger({ name: "{{projectName}}" });
|
|
6
|
+
|
|
7
|
+
export const createGreeting: Handler<unknown, Greeting, ValidationError> = async (
|
|
8
|
+
input,
|
|
9
|
+
ctx
|
|
10
|
+
) => {
|
|
11
|
+
const parsed = greetingInputSchema.safeParse(input);
|
|
12
|
+
if (!parsed.success) {
|
|
13
|
+
return Result.err(
|
|
14
|
+
new ValidationError({
|
|
15
|
+
message: "Invalid greeting input",
|
|
16
|
+
field: "name",
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const suffix = parsed.data.excited ? "!" : ".";
|
|
22
|
+
const greeting: Greeting = {
|
|
23
|
+
message: `Hello, ${parsed.data.name}${suffix}`,
|
|
24
|
+
issuedAt: new Date().toISOString(),
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
logger.info(`Created greeting for ${parsed.data.name}`, {
|
|
28
|
+
requestId: ctx.requestId,
|
|
29
|
+
});
|
|
30
|
+
return Result.ok(greeting);
|
|
31
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { createContext } from "@outfitter/contracts";
|
|
3
|
+
import { createGreeting } from "./handlers.js";
|
|
4
|
+
|
|
5
|
+
describe("createGreeting", () => {
|
|
6
|
+
test("returns greeting for valid input", async () => {
|
|
7
|
+
const ctx = createContext({
|
|
8
|
+
cwd: process.cwd(),
|
|
9
|
+
env: process.env,
|
|
10
|
+
});
|
|
11
|
+
const result = await createGreeting(
|
|
12
|
+
{ name: "Outfitter", excited: true },
|
|
13
|
+
ctx
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(result.isOk()).toBe(true);
|
|
17
|
+
if (result.isErr()) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
expect(result.value.message).toBe("Hello, Outfitter!");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("returns validation error for invalid input", async () => {
|
|
24
|
+
const ctx = createContext({
|
|
25
|
+
cwd: process.cwd(),
|
|
26
|
+
env: process.env,
|
|
27
|
+
});
|
|
28
|
+
const result = await createGreeting({ name: "" }, ctx);
|
|
29
|
+
|
|
30
|
+
expect(result.isErr()).toBe(true);
|
|
31
|
+
if (result.isErr()) {
|
|
32
|
+
expect(result.error.name).toBe("ValidationError");
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const greetingInputSchema = z.object({
|
|
4
|
+
name: z.string().min(1, "name is required"),
|
|
5
|
+
excited: z.boolean().default(false),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type GreetingInput = z.infer<typeof greetingInputSchema>;
|
|
9
|
+
|
|
10
|
+
export interface Greeting {
|
|
11
|
+
readonly message: string;
|
|
12
|
+
readonly issuedAt: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"lib": ["ESNext"],
|
|
8
|
+
"types": ["@types/bun"],
|
|
9
|
+
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"strictNullChecks": true,
|
|
13
|
+
"noUncheckedIndexedAccess": true,
|
|
14
|
+
"exactOptionalPropertyTypes": true,
|
|
15
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
16
|
+
"noImplicitReturns": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"declarationMap": true,
|
|
21
|
+
"sourceMap": true,
|
|
22
|
+
"outDir": "./dist",
|
|
23
|
+
"rootDir": "./src",
|
|
24
|
+
|
|
25
|
+
"esModuleInterop": true,
|
|
26
|
+
"forceConsistentCasingInFileNames": true,
|
|
27
|
+
"isolatedModules": true,
|
|
28
|
+
"verbatimModuleSyntax": true,
|
|
29
|
+
"skipLibCheck": true,
|
|
30
|
+
"resolveJsonModule": true
|
|
31
|
+
},
|
|
32
|
+
"include": ["src/**/*"],
|
|
33
|
+
"exclude": ["node_modules", "dist"]
|
|
34
|
+
}
|
|
@@ -28,18 +28,26 @@
|
|
|
28
28
|
"clean:artifacts": "rm -rf dist .turbo"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
32
|
-
"@outfitter/
|
|
33
|
-
"@outfitter/
|
|
34
|
-
"@outfitter/
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
32
|
+
"@outfitter/contracts": "workspace:*",
|
|
33
|
+
"@outfitter/types": "workspace:*",
|
|
34
|
+
"@outfitter/mcp": "workspace:*",
|
|
35
|
+
"@outfitter/logging": "workspace:*"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"@biomejs/biome": "^2.
|
|
38
|
-
"@outfitter/tooling": "
|
|
39
|
-
"@types/bun": "^1.3.
|
|
40
|
-
"lefthook": "^2.
|
|
38
|
+
"@biomejs/biome": "^2.4.4",
|
|
39
|
+
"@outfitter/tooling": "workspace:*",
|
|
40
|
+
"@types/bun": "^1.3.9",
|
|
41
|
+
"lefthook": "^2.1.1",
|
|
41
42
|
"typescript": "^5.9.3",
|
|
42
|
-
"ultracite": "^7.
|
|
43
|
+
"ultracite": "^7.2.3"
|
|
44
|
+
},
|
|
45
|
+
"outfitter": {
|
|
46
|
+
"template": {
|
|
47
|
+
"kind": "runnable",
|
|
48
|
+
"placement": "apps",
|
|
49
|
+
"surfaces": ["mcp"]
|
|
50
|
+
}
|
|
43
51
|
},
|
|
44
52
|
"license": "MIT"
|
|
45
53
|
}
|
|
@@ -2,78 +2,32 @@
|
|
|
2
2
|
* {{projectName}} - MCP server definition
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
description: "Say hello to someone",
|
|
34
|
-
inputSchema: {
|
|
35
|
-
type: "object" as const,
|
|
36
|
-
properties: {
|
|
37
|
-
name: {
|
|
38
|
-
type: "string",
|
|
39
|
-
description: "Name to greet",
|
|
40
|
-
default: "World",
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
// Handle tool calls
|
|
49
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
50
|
-
const { name, arguments: args } = request.params;
|
|
51
|
-
|
|
52
|
-
const handlers: Record<string, (input: HelloArgs) => { content: { type: "text"; text: string }[] }> = {
|
|
53
|
-
hello: (input) => {
|
|
54
|
-
const greeting =
|
|
55
|
-
typeof input.name === "string" && input.name.trim().length > 0 ? input.name : "World";
|
|
56
|
-
|
|
57
|
-
logger.info`Greeting ${greeting}`;
|
|
58
|
-
return {
|
|
59
|
-
content: [
|
|
60
|
-
{
|
|
61
|
-
type: "text" as const,
|
|
62
|
-
text: `Hello, ${greeting}!`,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const handler = handlers[name];
|
|
70
|
-
if (handler) {
|
|
71
|
-
return handler((args ?? {}) as HelloArgs);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
logger.warn`Unknown tool ${name}`;
|
|
75
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return server;
|
|
5
|
+
import { Result } from "@outfitter/contracts";
|
|
6
|
+
import { createMcpServer, defineTool, connectStdio } from "@outfitter/mcp";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
const server = createMcpServer({
|
|
10
|
+
name: "{{binName}}",
|
|
11
|
+
version: "{{version}}",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const helloTool = defineTool({
|
|
15
|
+
name: "hello",
|
|
16
|
+
description: "Say hello to someone",
|
|
17
|
+
inputSchema: z.object({
|
|
18
|
+
name: z.string().default("World").describe("Name to greet"),
|
|
19
|
+
}),
|
|
20
|
+
handler: async (input, ctx) => {
|
|
21
|
+
ctx.logger.info(`Greeting ${input.name}`);
|
|
22
|
+
return Result.ok({ greeting: `Hello, ${input.name}!` });
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
server.registerTool(helloTool);
|
|
27
|
+
|
|
28
|
+
export { server };
|
|
29
|
+
|
|
30
|
+
/** Start the MCP server over stdio transport. */
|
|
31
|
+
export async function startServer(): Promise<void> {
|
|
32
|
+
await connectStdio(server);
|
|
79
33
|
}
|
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
* {{projectName}} MCP server entry point
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { createMCPServer } from "./mcp.js";
|
|
6
|
+
import { startServer } from "./mcp.js";
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
const server = createMCPServer();
|
|
11
|
-
const transport = new StdioServerTransport();
|
|
12
|
-
await server.connect(transport);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
main().catch(console.error);
|
|
8
|
+
startServer().catch(console.error);
|
|
@@ -31,15 +31,22 @@
|
|
|
31
31
|
"clean": "rm -rf dist"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@biomejs/biome": "^2.
|
|
35
|
-
"@outfitter/tooling": "
|
|
36
|
-
"@types/bun": "^1.3.
|
|
37
|
-
"lefthook": "^2.
|
|
34
|
+
"@biomejs/biome": "^2.4.4",
|
|
35
|
+
"@outfitter/tooling": "workspace:*",
|
|
36
|
+
"@types/bun": "^1.3.9",
|
|
37
|
+
"lefthook": "^2.1.1",
|
|
38
38
|
"typescript": "^5.9.3",
|
|
39
|
-
"ultracite": "^7.
|
|
39
|
+
"ultracite": "^7.2.3"
|
|
40
|
+
},
|
|
41
|
+
"outfitter": {
|
|
42
|
+
"template": {
|
|
43
|
+
"kind": "library",
|
|
44
|
+
"placement": "packages",
|
|
45
|
+
"surfaces": []
|
|
46
|
+
}
|
|
40
47
|
},
|
|
41
48
|
"engines": {
|
|
42
|
-
"bun": ">=1.3.
|
|
49
|
+
"bun": ">=1.3.9"
|
|
43
50
|
},
|
|
44
51
|
"keywords": [],
|
|
45
52
|
"license": "MIT"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { MigrateKitError, MigrateKitOptions, MigrateKitResult, migrateKitCommand, printMigrateKitResults, runMigrateKit } from "../shared/outfitter-npemy7ta";
|
|
2
|
-
export { runMigrateKit, printMigrateKitResults, migrateKitCommand, MigrateKitResult, MigrateKitOptions, MigrateKitError };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
MigrateKitError,
|
|
4
|
-
migrateKitCommand,
|
|
5
|
-
printMigrateKitResults,
|
|
6
|
-
runMigrateKit
|
|
7
|
-
} from "../shared/outfitter-mxz69pgy.js";
|
|
8
|
-
import"../shared/outfitter-7r12fj7f.js";
|
|
9
|
-
import"../shared/outfitter-mdt37hqm.js";
|
|
10
|
-
export {
|
|
11
|
-
runMigrateKit,
|
|
12
|
-
printMigrateKitResults,
|
|
13
|
-
migrateKitCommand,
|
|
14
|
-
MigrateKitError
|
|
15
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ScaffoldError } from "./outfitter-qfh36ddg";
|
|
2
|
-
import { Result } from "@outfitter/contracts";
|
|
3
|
-
declare function buildWorkspaceRootPackageJson(workspaceName: string): string;
|
|
4
|
-
declare function scaffoldWorkspaceRoot(rootDir: string, workspaceName: string, force: boolean): Result<void, ScaffoldError>;
|
|
5
|
-
declare function detectWorkspaceRoot(cwd: string): Result<string | null, ScaffoldError>;
|
|
6
|
-
export { buildWorkspaceRootPackageJson, scaffoldWorkspaceRoot, detectWorkspaceRoot };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
SHARED_DEV_DEPS,
|
|
4
|
-
SHARED_SCRIPTS
|
|
5
|
-
} from "./outfitter-k112c427.js";
|
|
6
|
-
import {
|
|
7
|
-
ScaffoldError
|
|
8
|
-
} from "./outfitter-8y2dfx6n.js";
|
|
9
|
-
|
|
10
|
-
// apps/outfitter/src/engine/config.ts
|
|
11
|
-
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
12
|
-
import { join } from "path";
|
|
13
|
-
import { Result } from "@outfitter/contracts";
|
|
14
|
-
var DEPENDENCY_SECTIONS = [
|
|
15
|
-
"dependencies",
|
|
16
|
-
"devDependencies",
|
|
17
|
-
"peerDependencies",
|
|
18
|
-
"optionalDependencies"
|
|
19
|
-
];
|
|
20
|
-
function injectSharedConfig(targetDir) {
|
|
21
|
-
const packageJsonPath = join(targetDir, "package.json");
|
|
22
|
-
if (!existsSync(packageJsonPath)) {
|
|
23
|
-
return Result.ok(undefined);
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
const content = readFileSync(packageJsonPath, "utf-8");
|
|
27
|
-
const parsed = JSON.parse(content);
|
|
28
|
-
const existingDevDeps = parsed["devDependencies"] ?? {};
|
|
29
|
-
parsed["devDependencies"] = { ...SHARED_DEV_DEPS, ...existingDevDeps };
|
|
30
|
-
const existingScripts = parsed["scripts"] ?? {};
|
|
31
|
-
parsed["scripts"] = { ...SHARED_SCRIPTS, ...existingScripts };
|
|
32
|
-
writeFileSync(packageJsonPath, `${JSON.stringify(parsed, null, 2)}
|
|
33
|
-
`, "utf-8");
|
|
34
|
-
return Result.ok(undefined);
|
|
35
|
-
} catch (error) {
|
|
36
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
37
|
-
return Result.err(new ScaffoldError(`Failed to inject shared config: ${message}`));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function rewriteLocalDependencies(targetDir) {
|
|
41
|
-
const packageJsonPath = join(targetDir, "package.json");
|
|
42
|
-
if (!existsSync(packageJsonPath)) {
|
|
43
|
-
return Result.ok(undefined);
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
const content = readFileSync(packageJsonPath, "utf-8");
|
|
47
|
-
const parsed = JSON.parse(content);
|
|
48
|
-
let updated = false;
|
|
49
|
-
for (const section of DEPENDENCY_SECTIONS) {
|
|
50
|
-
const deps = parsed[section];
|
|
51
|
-
if (!deps || typeof deps !== "object" || Array.isArray(deps)) {
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
const entries = deps;
|
|
55
|
-
for (const [name, version] of Object.entries(entries)) {
|
|
56
|
-
if (typeof version === "string" && name.startsWith("@outfitter/") && version !== "workspace:*") {
|
|
57
|
-
entries[name] = "workspace:*";
|
|
58
|
-
updated = true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (updated) {
|
|
63
|
-
writeFileSync(packageJsonPath, `${JSON.stringify(parsed, null, 2)}
|
|
64
|
-
`, "utf-8");
|
|
65
|
-
}
|
|
66
|
-
return Result.ok(undefined);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
69
|
-
return Result.err(new ScaffoldError(`Failed to update local dependencies: ${message}`));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { injectSharedConfig, rewriteLocalDependencies };
|