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,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* {{projectName}}
|
|
3
|
-
*
|
|
4
|
-
* {{description}}
|
|
5
|
-
*
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Main entry point for {{projectName}}.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { main } from "{{packageName}}";
|
|
15
|
-
*
|
|
16
|
-
* main();
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export function main(): void {
|
|
20
|
-
console.log("Hello from {{projectName}}!");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Run if executed directly
|
|
24
|
-
if (import.meta.main) {
|
|
25
|
-
main();
|
|
26
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Lefthook configuration
|
|
2
|
-
# https://github.com/evilmartians/lefthook
|
|
3
|
-
|
|
4
|
-
pre-commit:
|
|
5
|
-
parallel: true
|
|
6
|
-
commands:
|
|
7
|
-
format:
|
|
8
|
-
glob: "*.{js,ts,tsx,json,md}"
|
|
9
|
-
run: bunx biome format --no-errors-on-unmatched {staged_files}
|
|
10
|
-
stage_fixed: true
|
|
11
|
-
|
|
12
|
-
lint:
|
|
13
|
-
glob: "*.{js,ts,tsx}"
|
|
14
|
-
run: bunx biome lint --no-errors-on-unmatched {staged_files}
|
|
15
|
-
|
|
16
|
-
typecheck:
|
|
17
|
-
glob: "*.{ts,tsx}"
|
|
18
|
-
run: bun run typecheck
|
|
19
|
-
|
|
20
|
-
pre-push:
|
|
21
|
-
parallel: false
|
|
22
|
-
commands:
|
|
23
|
-
verify:
|
|
24
|
-
# TDD-aware strict verification with RED-phase branch carveout
|
|
25
|
-
# (*-tests, */tests, *_tests).
|
|
26
|
-
run: bunx @outfitter/tooling pre-push
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
{{description}}
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
bun add {{packageName}}
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
{{binName}} hello [name]
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Development
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Install dependencies
|
|
21
|
-
bun install
|
|
22
|
-
|
|
23
|
-
# Run in development
|
|
24
|
-
bun run dev
|
|
25
|
-
|
|
26
|
-
# Build
|
|
27
|
-
bun run build
|
|
28
|
-
|
|
29
|
-
# Run tests
|
|
30
|
-
bun run test
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## License
|
|
34
|
-
|
|
35
|
-
MIT
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{packageName}}",
|
|
3
|
-
"version": "{{version}}",
|
|
4
|
-
"description": "{{description}}",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"{{binName}}": "./dist/cli.js"
|
|
8
|
-
},
|
|
9
|
-
"main": "./dist/index.js",
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.js"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "bun build src/cli.ts --outdir dist --target bun && bun build src/index.ts --outdir dist --target bun --sourcemap",
|
|
19
|
-
"dev": "bun --watch src/cli.ts",
|
|
20
|
-
"typecheck": "tsc --noEmit",
|
|
21
|
-
"check": "ultracite check",
|
|
22
|
-
"verify:ci": "bun run typecheck && bun run check && bun run build && bun run test",
|
|
23
|
-
"test": "bun test",
|
|
24
|
-
"test:watch": "bun test --watch",
|
|
25
|
-
"lint": "biome check .",
|
|
26
|
-
"lint:fix": "biome check . --write",
|
|
27
|
-
"format": "biome format --write .",
|
|
28
|
-
"clean:artifacts": "rm -rf dist .turbo"
|
|
29
|
-
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@outfitter/kit": "^0.1.0-rc.0",
|
|
32
|
-
"@outfitter/cli": "^0.4.0",
|
|
33
|
-
"@outfitter/logging": "^0.1.0-rc.0",
|
|
34
|
-
"commander": "^12.0.0"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@biomejs/biome": "^2.3.12",
|
|
38
|
-
"@outfitter/tooling": "^0.2.1",
|
|
39
|
-
"@types/bun": "^1.3.7",
|
|
40
|
-
"lefthook": "^2.0.16",
|
|
41
|
-
"typescript": "^5.9.3",
|
|
42
|
-
"ultracite": "^7.1.1"
|
|
43
|
-
},
|
|
44
|
-
"license": "MIT"
|
|
45
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* {{projectName}} - CLI program definition
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { command, createCLI } from "@outfitter/cli/command";
|
|
6
|
-
import { verbosePreset } from "@outfitter/cli/flags";
|
|
7
|
-
import { createLogger } from "@outfitter/logging";
|
|
8
|
-
|
|
9
|
-
const logger = createLogger({ name: "{{binName}}" });
|
|
10
|
-
|
|
11
|
-
export const program = createCLI({
|
|
12
|
-
name: "{{binName}}",
|
|
13
|
-
version: "{{version}}",
|
|
14
|
-
description: "{{description}}",
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const verbose = verbosePreset();
|
|
18
|
-
|
|
19
|
-
program.register(
|
|
20
|
-
command("hello [name]")
|
|
21
|
-
.description("Say hello")
|
|
22
|
-
.preset(verbose)
|
|
23
|
-
.action<{ verbose: boolean }>(async ({ args, flags }) => {
|
|
24
|
-
const { verbose: isVerbose } = verbose.resolve(flags);
|
|
25
|
-
const name = args[0] ?? "World";
|
|
26
|
-
logger.info(`Hello, ${name}!`);
|
|
27
|
-
if (isVerbose) {
|
|
28
|
-
logger.debug("Running in verbose mode");
|
|
29
|
-
}
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Lefthook configuration
|
|
2
|
-
# https://github.com/evilmartians/lefthook
|
|
3
|
-
|
|
4
|
-
pre-commit:
|
|
5
|
-
parallel: true
|
|
6
|
-
commands:
|
|
7
|
-
format:
|
|
8
|
-
glob: "*.{js,ts,tsx,json,md}"
|
|
9
|
-
run: bunx biome format --no-errors-on-unmatched {staged_files}
|
|
10
|
-
stage_fixed: true
|
|
11
|
-
|
|
12
|
-
lint:
|
|
13
|
-
glob: "*.{js,ts,tsx}"
|
|
14
|
-
run: bunx biome lint --no-errors-on-unmatched {staged_files}
|
|
15
|
-
|
|
16
|
-
typecheck:
|
|
17
|
-
glob: "*.{ts,tsx}"
|
|
18
|
-
run: bun run typecheck
|
|
19
|
-
|
|
20
|
-
pre-push:
|
|
21
|
-
parallel: false
|
|
22
|
-
commands:
|
|
23
|
-
verify:
|
|
24
|
-
# TDD-aware strict verification with RED-phase branch carveout
|
|
25
|
-
# (*-tests, */tests, *_tests).
|
|
26
|
-
run: bunx @outfitter/tooling pre-push
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
{{description}}
|
|
4
|
-
|
|
5
|
-
A background daemon with CLI control interface.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
bun add {{packageName}}
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# Start daemon in background
|
|
17
|
-
{{binName}} start
|
|
18
|
-
|
|
19
|
-
# Start daemon in foreground (for debugging)
|
|
20
|
-
{{binName}} start --foreground
|
|
21
|
-
|
|
22
|
-
# Check status
|
|
23
|
-
{{binName}} status
|
|
24
|
-
|
|
25
|
-
# Stop daemon
|
|
26
|
-
{{binName}} stop
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Endpoints
|
|
30
|
-
|
|
31
|
-
The daemon exposes a Unix socket with the following endpoints:
|
|
32
|
-
|
|
33
|
-
### GET /health
|
|
34
|
-
|
|
35
|
-
Returns daemon health information:
|
|
36
|
-
|
|
37
|
-
```json
|
|
38
|
-
{
|
|
39
|
-
"status": "ok",
|
|
40
|
-
"uptime": 12345,
|
|
41
|
-
"version": "{{version}}"
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### POST /shutdown
|
|
46
|
-
|
|
47
|
-
Gracefully shuts down the daemon.
|
|
48
|
-
|
|
49
|
-
## Development
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
# Install dependencies
|
|
53
|
-
bun install
|
|
54
|
-
|
|
55
|
-
# Run daemon in foreground
|
|
56
|
-
bun run dev
|
|
57
|
-
|
|
58
|
-
# Build
|
|
59
|
-
bun run build
|
|
60
|
-
|
|
61
|
-
# Run tests
|
|
62
|
-
bun run test
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## License
|
|
66
|
-
|
|
67
|
-
MIT
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{packageName}}",
|
|
3
|
-
"version": "{{version}}",
|
|
4
|
-
"description": "{{description}}",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"{{binName}}": "./dist/cli.js",
|
|
8
|
-
"{{binName}}d": "./dist/daemon.js"
|
|
9
|
-
},
|
|
10
|
-
"main": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
|
-
"import": "./dist/index.js"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "bun build src/cli.ts src/daemon.ts --outdir dist --target bun && bun build src/index.ts --outdir dist --target bun --sourcemap",
|
|
20
|
-
"dev": "bun --watch src/daemon.ts -- --foreground",
|
|
21
|
-
"dev:daemon": "bun --watch src/daemon.ts -- --foreground",
|
|
22
|
-
"typecheck": "tsc --noEmit",
|
|
23
|
-
"check": "ultracite check",
|
|
24
|
-
"verify:ci": "bun run typecheck && bun run check && bun run build && bun run test",
|
|
25
|
-
"test": "bun test",
|
|
26
|
-
"test:watch": "bun test --watch",
|
|
27
|
-
"lint": "biome check .",
|
|
28
|
-
"lint:fix": "biome check . --write",
|
|
29
|
-
"format": "biome format --write .",
|
|
30
|
-
"clean:artifacts": "rm -rf dist .turbo"
|
|
31
|
-
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@outfitter/kit": "^0.1.0-rc.0",
|
|
34
|
-
"@outfitter/daemon": "^0.1.0-rc.0",
|
|
35
|
-
"@outfitter/cli": "^0.1.0-rc.0",
|
|
36
|
-
"@outfitter/logging": "^0.1.0-rc.0",
|
|
37
|
-
"commander": "^12.0.0"
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@biomejs/biome": "^2.3.12",
|
|
41
|
-
"@outfitter/tooling": "^0.2.1",
|
|
42
|
-
"@types/bun": "^1.3.7",
|
|
43
|
-
"lefthook": "^2.0.16",
|
|
44
|
-
"typescript": "^5.9.3",
|
|
45
|
-
"ultracite": "^7.1.1"
|
|
46
|
-
},
|
|
47
|
-
"license": "MIT"
|
|
48
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* {{projectName}} CLI entry point
|
|
4
|
-
*
|
|
5
|
-
* Commands: start, stop, restart, status
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { createCLI, command } from "@outfitter/cli";
|
|
9
|
-
import { createLogger } from "@outfitter/logging";
|
|
10
|
-
import { spawn } from "node:child_process";
|
|
11
|
-
import { getSocketPath, getLockPath, isDaemonAlive } from "@outfitter/daemon";
|
|
12
|
-
|
|
13
|
-
const logger = createLogger({ name: "{{binName}}" });
|
|
14
|
-
|
|
15
|
-
const TOOL_NAME = "{{binName}}";
|
|
16
|
-
const socketPath = getSocketPath(TOOL_NAME);
|
|
17
|
-
const lockPath = getLockPath(TOOL_NAME);
|
|
18
|
-
|
|
19
|
-
const program = createCLI({
|
|
20
|
-
name: "{{binName}}",
|
|
21
|
-
version: "{{version}}",
|
|
22
|
-
description: "{{description}}",
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
program.register(
|
|
26
|
-
command("start")
|
|
27
|
-
.description("Start the daemon")
|
|
28
|
-
.option("-f, --foreground", "Run in foreground")
|
|
29
|
-
.action(async ({ flags }) => {
|
|
30
|
-
const foreground = Boolean((flags as { foreground?: boolean }).foreground);
|
|
31
|
-
|
|
32
|
-
if (await isDaemonAlive(lockPath)) {
|
|
33
|
-
logger.warn`Daemon is already running`;
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (foreground) {
|
|
38
|
-
// Run in foreground - import and run daemon directly
|
|
39
|
-
const { runDaemon } = await import("./daemon-main.js");
|
|
40
|
-
await runDaemon();
|
|
41
|
-
} else {
|
|
42
|
-
// Spawn daemon in background
|
|
43
|
-
const daemon = spawn(process.execPath, [import.meta.dir + "/daemon.js"], {
|
|
44
|
-
detached: true,
|
|
45
|
-
stdio: "ignore",
|
|
46
|
-
});
|
|
47
|
-
daemon.unref();
|
|
48
|
-
logger.info`Daemon started with PID ${daemon.pid}`;
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
program.register(
|
|
54
|
-
command("stop")
|
|
55
|
-
.description("Stop the daemon")
|
|
56
|
-
.action(async () => {
|
|
57
|
-
if (!(await isDaemonAlive(lockPath))) {
|
|
58
|
-
logger.warn`Daemon is not running`;
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
// Signal daemon to stop via HTTP
|
|
62
|
-
try {
|
|
63
|
-
const response = await fetch(`http://unix:${socketPath}:/shutdown`, {
|
|
64
|
-
method: "POST",
|
|
65
|
-
});
|
|
66
|
-
if (response.ok) {
|
|
67
|
-
logger.info`Daemon stopped`;
|
|
68
|
-
}
|
|
69
|
-
} catch {
|
|
70
|
-
logger.error`Failed to stop daemon`;
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
program.register(
|
|
77
|
-
command("status")
|
|
78
|
-
.description("Check daemon status")
|
|
79
|
-
.action(async () => {
|
|
80
|
-
if (await isDaemonAlive(lockPath)) {
|
|
81
|
-
logger.info`Daemon is running`;
|
|
82
|
-
// Fetch health info
|
|
83
|
-
try {
|
|
84
|
-
const response = await fetch(`http://unix:${socketPath}:/health`);
|
|
85
|
-
const health = await response.json();
|
|
86
|
-
console.log(JSON.stringify(health, null, 2));
|
|
87
|
-
} catch {
|
|
88
|
-
logger.warn`Could not fetch health info`;
|
|
89
|
-
}
|
|
90
|
-
} else {
|
|
91
|
-
logger.info`Daemon is not running`;
|
|
92
|
-
}
|
|
93
|
-
}),
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
program.parse(process.argv);
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* {{projectName}} daemon main logic
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createLogger } from "@outfitter/logging";
|
|
6
|
-
import {
|
|
7
|
-
getSocketPath,
|
|
8
|
-
getLockPath,
|
|
9
|
-
getDaemonDir,
|
|
10
|
-
acquireDaemonLock,
|
|
11
|
-
releaseDaemonLock,
|
|
12
|
-
} from "@outfitter/daemon";
|
|
13
|
-
import { mkdir } from "node:fs/promises";
|
|
14
|
-
|
|
15
|
-
const logger = createLogger({ name: "{{binName}}d" });
|
|
16
|
-
|
|
17
|
-
const TOOL_NAME = "{{binName}}";
|
|
18
|
-
const startTime = Date.now();
|
|
19
|
-
|
|
20
|
-
export async function runDaemon(): Promise<void> {
|
|
21
|
-
const socketPath = getSocketPath(TOOL_NAME);
|
|
22
|
-
const lockPath = getLockPath(TOOL_NAME);
|
|
23
|
-
const daemonDir = getDaemonDir(TOOL_NAME);
|
|
24
|
-
|
|
25
|
-
// Ensure daemon directory exists
|
|
26
|
-
await mkdir(daemonDir, { recursive: true });
|
|
27
|
-
|
|
28
|
-
// Acquire lock
|
|
29
|
-
const lockResult = await acquireDaemonLock(lockPath);
|
|
30
|
-
if (!lockResult.isOk()) {
|
|
31
|
-
logger.error`Failed to acquire lock: ${lockResult.error.message}`;
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
const lock = lockResult.value;
|
|
35
|
-
|
|
36
|
-
logger.info`Daemon starting on ${socketPath}`;
|
|
37
|
-
|
|
38
|
-
// Create HTTP server on Unix socket
|
|
39
|
-
const server = Bun.serve({
|
|
40
|
-
unix: socketPath,
|
|
41
|
-
fetch(request) {
|
|
42
|
-
const url = new URL(request.url);
|
|
43
|
-
|
|
44
|
-
if (url.pathname === "/health") {
|
|
45
|
-
return Response.json({
|
|
46
|
-
status: "ok",
|
|
47
|
-
uptime: Date.now() - startTime,
|
|
48
|
-
version: "{{version}}",
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (url.pathname === "/shutdown" && request.method === "POST") {
|
|
53
|
-
logger.info`Shutdown requested`;
|
|
54
|
-
// Schedule shutdown
|
|
55
|
-
setTimeout(async () => {
|
|
56
|
-
await releaseDaemonLock(lock);
|
|
57
|
-
server.stop();
|
|
58
|
-
process.exit(0);
|
|
59
|
-
}, 100);
|
|
60
|
-
return new Response("Shutting down");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return new Response("Not found", { status: 404 });
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Handle signals
|
|
68
|
-
const shutdown = async () => {
|
|
69
|
-
logger.info`Received shutdown signal`;
|
|
70
|
-
await releaseDaemonLock(lock);
|
|
71
|
-
server.stop();
|
|
72
|
-
process.exit(0);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
process.on("SIGTERM", shutdown);
|
|
76
|
-
process.on("SIGINT", shutdown);
|
|
77
|
-
|
|
78
|
-
logger.info`Daemon running`;
|
|
79
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"verbatimModuleSyntax": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"declarationDir": "dist",
|
|
12
|
-
"outDir": "dist",
|
|
13
|
-
"rootDir": "src",
|
|
14
|
-
"types": ["bun-types"],
|
|
15
|
-
"noImplicitAny": true,
|
|
16
|
-
"strictNullChecks": true,
|
|
17
|
-
"noUncheckedIndexedAccess": true,
|
|
18
|
-
"exactOptionalPropertyTypes": true,
|
|
19
|
-
"noPropertyAccessFromIndexSignature": true
|
|
20
|
-
},
|
|
21
|
-
"include": ["src"],
|
|
22
|
-
"exclude": ["node_modules", "dist"]
|
|
23
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Lefthook configuration
|
|
2
|
-
# https://github.com/evilmartians/lefthook
|
|
3
|
-
|
|
4
|
-
pre-commit:
|
|
5
|
-
parallel: true
|
|
6
|
-
commands:
|
|
7
|
-
format:
|
|
8
|
-
glob: "*.{js,ts,tsx,json,md}"
|
|
9
|
-
run: bunx biome format --no-errors-on-unmatched {staged_files}
|
|
10
|
-
stage_fixed: true
|
|
11
|
-
|
|
12
|
-
lint:
|
|
13
|
-
glob: "*.{js,ts,tsx}"
|
|
14
|
-
run: bunx biome lint --no-errors-on-unmatched {staged_files}
|
|
15
|
-
|
|
16
|
-
typecheck:
|
|
17
|
-
glob: "*.{ts,tsx}"
|
|
18
|
-
run: bun run typecheck
|
|
19
|
-
|
|
20
|
-
pre-push:
|
|
21
|
-
parallel: false
|
|
22
|
-
commands:
|
|
23
|
-
verify:
|
|
24
|
-
# TDD-aware strict verification with RED-phase branch carveout
|
|
25
|
-
# (*-tests, */tests, *_tests).
|
|
26
|
-
run: bunx @outfitter/tooling pre-push
|