Split the view command out of the entry point and make its failure a value rather than an exception. index.ts is now scaffolding plus dispatch; view.ts owns the behaviour, returning Result<string, ViewError> (a plain-data tagged union) via neverthrow, with try/catch confined to a readFile adapter. The entry point matches the Result at the boundary. Because viewFile is a pure in-process function it is now unit-tested directly (and counted by coverage), while the subprocess tests stay as the end-to-end check. ADR 0008 records the errors-as-values convention.
21 lines
417 B
JSON
21 lines
417 B
JSON
{
|
|
"name": "@kitchen-md/bin",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"bin": {
|
|
"kitchen": "./src/index.ts"
|
|
},
|
|
"scripts": {
|
|
"test": "bun test",
|
|
"build": "bun build --compile ./src/index.ts --outfile kitchen"
|
|
},
|
|
"dependencies": {
|
|
"@kitchen-md/core": "workspace:*",
|
|
"chalk": "^5.6.2",
|
|
"commander": "^15.0.0",
|
|
"neverthrow": "^8.2.0",
|
|
"yaml": "^2.9.0"
|
|
}
|
|
}
|