@aipt/cli 0.1.0

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.
Files changed (69) hide show
  1. package/README.md +116 -0
  2. package/dist/catalog/foundation.standalone-npm-package/1.0.0/assets/package.json +4 -0
  3. package/dist/catalog/foundation.standalone-npm-package/1.0.0/assets/pnpm-workspace.yaml +1 -0
  4. package/dist/catalog/foundation.standalone-npm-package/1.0.0/assets/src/index.test.ts +8 -0
  5. package/dist/catalog/foundation.standalone-npm-package/1.0.0/assets/src/index.ts +3 -0
  6. package/dist/catalog/foundation.standalone-npm-package/1.0.0/assets/tsconfig.build.json +12 -0
  7. package/dist/catalog/foundation.standalone-npm-package/1.0.0/assets/tsconfig.json +14 -0
  8. package/dist/catalog/foundation.standalone-npm-package/1.0.0/release.json +29 -0
  9. package/dist/catalog/foundation.typescript-quality/1.0.0/assets/package.json +21 -0
  10. package/dist/catalog/foundation.typescript-quality/1.0.0/assets/pnpm-workspace.yaml +1 -0
  11. package/dist/catalog/foundation.typescript-quality/1.0.0/assets/src/index.test.ts +8 -0
  12. package/dist/catalog/foundation.typescript-quality/1.0.0/assets/src/index.ts +3 -0
  13. package/dist/catalog/foundation.typescript-quality/1.0.0/assets/tsconfig.json +14 -0
  14. package/dist/catalog/foundation.typescript-quality/1.0.0/release.json +57 -0
  15. package/dist/catalog/foundation.workspace-node-application/1.0.0/assets/package.json +4 -0
  16. package/dist/catalog/foundation.workspace-node-application/1.0.0/assets/src/app.test.ts +21 -0
  17. package/dist/catalog/foundation.workspace-node-application/1.0.0/assets/src/app.ts +14 -0
  18. package/dist/catalog/foundation.workspace-node-application/1.0.0/assets/src/index.test.ts +14 -0
  19. package/dist/catalog/foundation.workspace-node-application/1.0.0/assets/src/index.ts +53 -0
  20. package/dist/catalog/foundation.workspace-node-application/1.0.0/assets/tsconfig.build.json +12 -0
  21. package/dist/catalog/foundation.workspace-node-application/1.0.0/assets/tsconfig.json +7 -0
  22. package/dist/catalog/foundation.workspace-node-application/1.0.0/release.json +19 -0
  23. package/dist/catalog/foundation.workspace-npm-package/1.0.0/assets/package.json +4 -0
  24. package/dist/catalog/foundation.workspace-npm-package/1.0.0/assets/src/index.test.ts +8 -0
  25. package/dist/catalog/foundation.workspace-npm-package/1.0.0/assets/src/index.ts +3 -0
  26. package/dist/catalog/foundation.workspace-npm-package/1.0.0/assets/tsconfig.build.json +12 -0
  27. package/dist/catalog/foundation.workspace-npm-package/1.0.0/assets/tsconfig.json +7 -0
  28. package/dist/catalog/foundation.workspace-npm-package/1.0.0/release.json +17 -0
  29. package/dist/catalog/foundation.workspace-root/1.0.0/assets/package.json +16 -0
  30. package/dist/catalog/foundation.workspace-root/1.0.0/assets/packages/README.md +3 -0
  31. package/dist/catalog/foundation.workspace-root/1.0.0/assets/pnpm-workspace.yaml +3 -0
  32. package/dist/catalog/foundation.workspace-root/1.0.0/assets/tsconfig.base.json +12 -0
  33. package/dist/catalog/foundation.workspace-root/1.0.0/release.json +16 -0
  34. package/dist/catalog/foundation.workspace-root/1.1.0/assets/apps/README.md +3 -0
  35. package/dist/catalog/foundation.workspace-root/1.1.0/assets/package.json +16 -0
  36. package/dist/catalog/foundation.workspace-root/1.1.0/assets/packages/README.md +3 -0
  37. package/dist/catalog/foundation.workspace-root/1.1.0/assets/pnpm-workspace.yaml +3 -0
  38. package/dist/catalog/foundation.workspace-root/1.1.0/assets/tsconfig.base.json +12 -0
  39. package/dist/catalog/foundation.workspace-root/1.1.0/release.json +17 -0
  40. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/index.html +14 -0
  41. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/package.json +4 -0
  42. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/src/App.css +26 -0
  43. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/src/App.test.tsx +21 -0
  44. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/src/App.tsx +51 -0
  45. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/src/index.css +6 -0
  46. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/src/main.tsx +13 -0
  47. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/src/test/setup.ts +1 -0
  48. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/tsconfig.app.json +17 -0
  49. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/tsconfig.json +7 -0
  50. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/tsconfig.node.json +16 -0
  51. package/dist/catalog/foundation.workspace-web-application/1.0.0/assets/vite.config.ts +11 -0
  52. package/dist/catalog/foundation.workspace-web-application/1.0.0/release.json +24 -0
  53. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/index.html +14 -0
  54. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/package.json +4 -0
  55. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/src/App.css +26 -0
  56. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/src/App.test.tsx +21 -0
  57. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/src/App.tsx +51 -0
  58. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/src/index.css +6 -0
  59. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/src/main.tsx +16 -0
  60. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/src/runtime-error-reporter.test.ts +13 -0
  61. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/src/runtime-error-reporter.ts +30 -0
  62. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/src/test/setup.ts +1 -0
  63. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/tsconfig.app.json +17 -0
  64. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/tsconfig.json +7 -0
  65. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/tsconfig.node.json +16 -0
  66. package/dist/catalog/foundation.workspace-web-application/1.1.0/assets/vite.config.ts +11 -0
  67. package/dist/catalog/foundation.workspace-web-application/1.1.0/release.json +131 -0
  68. package/dist/cli.js +12027 -0
  69. package/package.json +25 -0
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # @aipt/cli
2
+
3
+ Dyyto Engineering Platform 的正式命令行 Composition Root。
4
+
5
+ 当前已实现稳定的 help、version、human/JSON renderer、错误退出码,以及正式 `create/plan/upgrade/apply/verify/inspect/recover`。领域规划、文件写入、验证提交与恢复必须委托给 `@aipt/platform-kernel`,不得在 CLI 内复制规则。
6
+
7
+ 安全升级已采用的 workspace root:
8
+
9
+ ```bash
10
+ dyyto upgrade --project ./my-workspace \
11
+ --to foundation.workspace-root@1.1.0
12
+ dyyto apply --project ./my-workspace --approve <planId>
13
+ dyyto verify --project ./my-workspace
14
+ ```
15
+
16
+ 升级 Plan 同时管理 Manifest 和 Release assets;用户修改产生 conflict,目标 Verify 成功前继续保留旧 Lock。
17
+
18
+ 工作区内运行:
19
+
20
+ ```bash
21
+ pnpm dyyto -- --help
22
+ pnpm dyyto -- --version --json
23
+ ```
24
+
25
+ 本地打包并在独立目录安装:
26
+
27
+ ```bash
28
+ pnpm --dir apps/cli run pack:artifact
29
+ corepack pnpm add --ignore-scripts /absolute/path/to/aipt-cli-0.1.0.tgz
30
+ ```
31
+
32
+ 发布包是自包含 CLI bundle,内置经过 integrity 校验的 Capability Catalog,不依赖 Dyyto workspace link。
33
+
34
+ 创建独立 npm 包:
35
+
36
+ ```bash
37
+ dyyto create ./my-package \
38
+ --profile standalone-npm-package \
39
+ --name @scope/my-package \
40
+ --version 0.1.0 \
41
+ --license MIT \
42
+ --publish-access public \
43
+ --capability foundation.standalone-npm-package@1.0.0
44
+ ```
45
+
46
+ `apply` 后由开发者显式安装依赖,`verify` 会依次执行 typecheck、test、build 与 npm pack dry-run,并在全部通过后提交 Evidence 与 Project Lock。
47
+
48
+ 创建 workspace 并新增 package:
49
+
50
+ ```bash
51
+ dyyto create ./my-workspace \
52
+ --profile workspace-root \
53
+ --capability foundation.workspace-root@1.1.0
54
+
55
+ dyyto add package \
56
+ --workspace ./my-workspace \
57
+ --path packages/shared \
58
+ --name @scope/shared \
59
+ --version 0.1.0 \
60
+ --license MIT \
61
+ --publish-access public \
62
+ --capability foundation.workspace-npm-package@1.0.0
63
+ ```
64
+
65
+ Root 和 Unit 各自审批 Plan、提交 Evidence/Lock;依赖只需在 workspace root 安装一次,Unit 不生成嵌套 workspace。
66
+
67
+ 新增可运行 Node Application:
68
+
69
+ ```bash
70
+ dyyto add application \
71
+ --workspace ./my-workspace \
72
+ --path apps/api \
73
+ --name api \
74
+ --capability foundation.workspace-node-application@1.0.0
75
+ ```
76
+
77
+ Application Verify 会执行 typecheck、HTTP contract tests、build 与随机端口进程 smoke。`workspace-root@1.0.0` 仍可继续管理 M7 package;新增 Application 要求 Root 1.1.0。
78
+
79
+ 新增 React Web Application:
80
+
81
+ ```bash
82
+ dyyto add application \
83
+ --workspace ./my-workspace \
84
+ --path apps/web \
85
+ --name web \
86
+ --profile workspace-web-application \
87
+ --capability foundation.workspace-web-application@1.1.0
88
+ ```
89
+
90
+ Web Application 锁定 React 19、Vite 8 和 TypeScript 6 的精确版本。Verify 会执行 typecheck、jsdom 组件测试、production build 与随机回环端口 preview smoke;人工验收使用 Unit 的 `dev` script。
91
+
92
+ Artifact Delivery:
93
+
94
+ ```bash
95
+ # public npm package:默认 npmjs.org
96
+ dyyto delivery plan --project ./my-package --kind npm-publish
97
+ dyyto delivery apply --project ./my-package --approve <planId>
98
+ dyyto delivery inspect --project ./my-package --plan <planId>
99
+
100
+ # Node Application:默认本地 Docker
101
+ dyyto delivery plan --project ./my-workspace/apps/api --kind application-deploy
102
+ dyyto delivery apply --project ./my-workspace/apps/api --approve <planId>
103
+ dyyto delivery inspect --project ./my-workspace/apps/api --plan <planId>
104
+
105
+ # 运行时错误(本地 Collector 只绑定 127.0.0.1)
106
+ dyyto observe serve --workspace ./my-workspace
107
+ dyyto observe release register --project ./my-workspace/apps/web
108
+ dyyto observe errors --workspace ./my-workspace --application web
109
+ dyyto observe error --workspace ./my-workspace --id <eventId>
110
+ ```
111
+
112
+ 本地 Collector 默认固定监听 `127.0.0.1:4318`。Web 交付必须先执行最终
113
+ `observe release register`;该命令私有登记 Source Map 并从公开 `dist/` 删除 `.map`,
114
+ 随后 `delivery plan` 会拒绝任何再次生成公开 `.map` 的 Web artifact。
115
+
116
+ 发布和部署使用独立、不可变 Delivery Plan;`apply` 会重新检查 Lock、artifact digest、target 与 expiry。npm token 和 Docker/企业平台凭据不进入 Plan、Receipt 或日志。
@@ -0,0 +1,4 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "renderer": "npm-package-json-v1"
4
+ }
@@ -0,0 +1,8 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { sum } from "./index.js";
3
+
4
+ describe("generated standalone npm package", () => {
5
+ it("runs through the adopted package baseline", () => {
6
+ expect(sum(2, 3)).toBe(5);
7
+ });
8
+ });
@@ -0,0 +1,3 @@
1
+ export function sum(left: number, right: number): number {
2
+ return left + right;
3
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "sourceMap": true,
7
+ "outDir": "dist",
8
+ "rootDir": "src",
9
+ "types": ["node"]
10
+ },
11
+ "include": ["src/index.ts"]
12
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2024",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "noUncheckedIndexedAccess": true,
8
+ "exactOptionalPropertyTypes": true,
9
+ "verbatimModuleSyntax": true,
10
+ "skipLibCheck": true,
11
+ "types": ["node", "vitest/globals"]
12
+ },
13
+ "include": ["src/**/*.ts"]
14
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "capabilityId": "foundation.standalone-npm-package",
4
+ "version": "1.0.0",
5
+ "integrity": "sha256:8f482c840292249d90a3a2a6e2656883c5c1ba689dfe3c3ffda069bcbc1f84ce",
6
+ "consumerProfile": "standalone-npm-package",
7
+ "compatibility": {
8
+ "node": ">=24.18.0 <25",
9
+ "pnpm": "11.21.0",
10
+ "typescript": "6.0.3"
11
+ },
12
+ "assets": [
13
+ { "path": "package.json", "ownership": "owned-file", "digest": "sha256:e3bdb26de65e71b397a22faf3c44162a54963394366b52bc5fcf2b85eb175988", "mode": 420, "renderer": "npm-package-json-v1" },
14
+ { "path": "pnpm-workspace.yaml", "ownership": "owned-file", "digest": "sha256:b379483d4293500af8e9d3e8d83b4b5a2ad1e844911cd7be7f7e274e4bb80666", "mode": 420 },
15
+ { "path": "src/index.test.ts", "ownership": "owned-file", "digest": "sha256:54fa4ee1b72f62c08aea1b8eea0bd823334594a4305829c0d2cf27fb03cd9989", "mode": 420 },
16
+ { "path": "src/index.ts", "ownership": "owned-file", "digest": "sha256:582749e4a750379e36280d7b4388396496f83421eeb06c0e3f67a3fb9be99c00", "mode": 420 },
17
+ { "path": "tsconfig.build.json", "ownership": "owned-file", "digest": "sha256:d5c283e7a846fd0670952aa7550b29171c4093e32f8ab1388fe1229161d5f9e0", "mode": 420 },
18
+ { "path": "tsconfig.json", "ownership": "owned-file", "digest": "sha256:0a54b8de24c711bf334ced24c5b95451610b834844def0d5d80b89cf12ed3b42", "mode": 420 }
19
+ ],
20
+ "verifiers": [
21
+ { "id": "typescript.typecheck" },
22
+ { "id": "vitest.run" },
23
+ { "id": "typescript.build" },
24
+ { "id": "npm.pack-dry-run" }
25
+ ],
26
+ "exit": {
27
+ "ownedAssets": ["package.json", "pnpm-workspace.yaml", "src/index.test.ts", "src/index.ts", "tsconfig.build.json", "tsconfig.json"]
28
+ }
29
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "dyyto-typescript-library",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=24.18.0 <25",
8
+ "pnpm": "11.21.0"
9
+ },
10
+ "packageManager": "pnpm@11.21.0",
11
+ "scripts": {
12
+ "typecheck": "tsc --noEmit -p tsconfig.json",
13
+ "test": "vitest run",
14
+ "check": "pnpm typecheck && pnpm test"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "24.10.13",
18
+ "typescript": "6.0.3",
19
+ "vitest": "4.1.10"
20
+ }
21
+ }
@@ -0,0 +1,8 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { sum } from "./index.js";
3
+
4
+ describe("generated TypeScript quality example", () => {
5
+ it("runs through the adopted test baseline", () => {
6
+ expect(sum(2, 3)).toBe(5);
7
+ });
8
+ });
@@ -0,0 +1,3 @@
1
+ export function sum(left: number, right: number): number {
2
+ return left + right;
3
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2024",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "noUncheckedIndexedAccess": true,
8
+ "exactOptionalPropertyTypes": true,
9
+ "verbatimModuleSyntax": true,
10
+ "skipLibCheck": true,
11
+ "types": ["node", "vitest/globals"]
12
+ },
13
+ "include": ["src/**/*.ts"]
14
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "capabilityId": "foundation.typescript-quality",
4
+ "version": "1.0.0",
5
+ "integrity": "sha256:22c0e598a356b4352cc431732d01397dd289bf36abeab95ad2a6829690fed0ce",
6
+ "consumerProfile": "blank-typescript-library",
7
+ "compatibility": {
8
+ "node": ">=24.18.0 <25",
9
+ "pnpm": "11.21.0",
10
+ "typescript": "6.0.3"
11
+ },
12
+ "assets": [
13
+ {
14
+ "path": "package.json",
15
+ "ownership": "owned-file",
16
+ "digest": "sha256:04ae94f4e5437a4b40fab79b8bd025ead73b0c3fdc38534dfb5d569e1e18777c",
17
+ "mode": 420
18
+ },
19
+ {
20
+ "path": "pnpm-workspace.yaml",
21
+ "ownership": "owned-file",
22
+ "digest": "sha256:b379483d4293500af8e9d3e8d83b4b5a2ad1e844911cd7be7f7e274e4bb80666",
23
+ "mode": 420
24
+ },
25
+ {
26
+ "path": "src/index.test.ts",
27
+ "ownership": "owned-file",
28
+ "digest": "sha256:e46eb96436918a3bc9cf498a664be4a137a6cc8dfdec14b647f9dfdffdd961cb",
29
+ "mode": 420
30
+ },
31
+ {
32
+ "path": "src/index.ts",
33
+ "ownership": "owned-file",
34
+ "digest": "sha256:582749e4a750379e36280d7b4388396496f83421eeb06c0e3f67a3fb9be99c00",
35
+ "mode": 420
36
+ },
37
+ {
38
+ "path": "tsconfig.json",
39
+ "ownership": "owned-file",
40
+ "digest": "sha256:0a54b8de24c711bf334ced24c5b95451610b834844def0d5d80b89cf12ed3b42",
41
+ "mode": 420
42
+ }
43
+ ],
44
+ "verifiers": [
45
+ { "id": "typescript.typecheck" },
46
+ { "id": "vitest.run" }
47
+ ],
48
+ "exit": {
49
+ "ownedAssets": [
50
+ "package.json",
51
+ "pnpm-workspace.yaml",
52
+ "src/index.test.ts",
53
+ "src/index.ts",
54
+ "tsconfig.json"
55
+ ]
56
+ }
57
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "renderer": "node-application-package-json-v1"
4
+ }
@@ -0,0 +1,21 @@
1
+ import { createServer } from "node:http";
2
+ import { afterEach, describe, expect, it } from "vitest";
3
+ import { handleRequest } from "./app.js";
4
+
5
+ const servers: ReturnType<typeof createServer>[] = [];
6
+ afterEach(async () => Promise.all(servers.splice(0).map((server) => new Promise<void>((resolve) => server.close(() => resolve())))));
7
+
8
+ async function request(path: string) {
9
+ const server = createServer(handleRequest);
10
+ servers.push(server);
11
+ await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
12
+ const address = server.address();
13
+ if (address === null || typeof address === "string") throw new Error("test server address unavailable");
14
+ const response = await fetch(`http://127.0.0.1:${address.port}${path}`);
15
+ return { status: response.status, body: await response.json() };
16
+ }
17
+
18
+ describe("node application HTTP contract", () => {
19
+ it("reports health", async () => expect(await request("/health")).toEqual({ status: 200, body: { status: "ok" } }));
20
+ it("returns a stable not found error", async () => expect(await request("/missing")).toEqual({ status: 404, body: { error: "not_found" } }));
21
+ });
@@ -0,0 +1,14 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+
3
+ function json(response: ServerResponse, statusCode: number, body: unknown): void {
4
+ response.writeHead(statusCode, { "content-type": "application/json; charset=utf-8" });
5
+ response.end(`${JSON.stringify(body)}\n`);
6
+ }
7
+
8
+ export function handleRequest(request: IncomingMessage, response: ServerResponse): void {
9
+ if (request.method === "GET" && request.url === "/health") {
10
+ json(response, 200, { status: "ok" });
11
+ return;
12
+ }
13
+ json(response, 404, { error: "not_found" });
14
+ }
@@ -0,0 +1,14 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { parsePort } from "./index.js";
3
+
4
+ describe("node application process configuration", () => {
5
+ it("uses the default and accepts an ephemeral port", () => {
6
+ expect(parsePort(undefined)).toBe(3000);
7
+ expect(parsePort("0")).toBe(0);
8
+ });
9
+
10
+ it("rejects invalid ports", () => {
11
+ expect(() => parsePort("abc")).toThrow("PORT must be an integer");
12
+ expect(() => parsePort("65536")).toThrow("PORT must be an integer");
13
+ });
14
+ });
@@ -0,0 +1,53 @@
1
+ import { createServer, type Server } from "node:http";
2
+ import process from "node:process";
3
+ import { pathToFileURL } from "node:url";
4
+ import { handleRequest } from "./app.js";
5
+
6
+ export function parsePort(value: string | undefined): number {
7
+ if (value === undefined || value === "") return 3000;
8
+ if (!/^\d+$/.test(value)) throw new Error("PORT must be an integer from 0 through 65535");
9
+ const port = Number(value);
10
+ if (port > 65535) throw new Error("PORT must be an integer from 0 through 65535");
11
+ return port;
12
+ }
13
+
14
+ export function startServer(port = parsePort(process.env.PORT)): Promise<Server> {
15
+ const server = createServer(handleRequest);
16
+ return new Promise((resolve, reject) => {
17
+ server.once("error", reject);
18
+ server.listen(port, "127.0.0.1", () => resolve(server));
19
+ });
20
+ }
21
+
22
+ async function close(server: Server): Promise<void> {
23
+ await new Promise<void>((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
24
+ }
25
+
26
+ async function smoke(): Promise<void> {
27
+ const server = await startServer(0);
28
+ try {
29
+ const address = server.address();
30
+ if (address === null || typeof address === "string") throw new Error("Smoke server address is unavailable");
31
+ const response = await fetch(`http://127.0.0.1:${address.port}/health`);
32
+ const body = await response.json() as { status?: string };
33
+ if (response.status !== 200 || body.status !== "ok") throw new Error("Health contract failed");
34
+ process.stdout.write(`${JSON.stringify({ smoke: "passed" })}\n`);
35
+ } finally {
36
+ await close(server);
37
+ }
38
+ }
39
+
40
+ async function main(): Promise<void> {
41
+ if (process.argv.includes("--smoke")) return smoke();
42
+ const server = await startServer();
43
+ const address = server.address();
44
+ if (address === null || typeof address === "string") throw new Error("Server address is unavailable");
45
+ process.stdout.write(`${JSON.stringify({ state: "ready", port: address.port })}\n`);
46
+ const shutdown = () => void close(server).then(() => process.exit(0));
47
+ process.once("SIGINT", shutdown);
48
+ process.once("SIGTERM", shutdown);
49
+ }
50
+
51
+ if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
52
+ await main();
53
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "sourceMap": true,
7
+ "outDir": "dist",
8
+ "rootDir": "src",
9
+ "types": ["node"]
10
+ },
11
+ "include": ["src/app.ts", "src/index.ts"]
12
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": ["node", "vitest/globals"]
5
+ },
6
+ "include": ["src/**/*.ts"]
7
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "capabilityId": "foundation.workspace-node-application",
4
+ "version": "1.0.0",
5
+ "integrity": "sha256:958efa3d8f2a4c767b571a36031bb846f32b95cd5e60979e093e521c0e83a583",
6
+ "consumerProfile": "workspace-node-application",
7
+ "compatibility": { "node": ">=24.18.0 <25", "pnpm": "11.21.0", "typescript": "6.0.3" },
8
+ "assets": [
9
+ { "path": "package.json", "ownership": "owned-file", "digest": "sha256:23bb673e159569be17349b5ee8143e90bcf0b5d29a3eb26ec2ee86dfd950b567", "mode": 420, "renderer": "node-application-package-json-v1" },
10
+ { "path": "src/app.test.ts", "ownership": "owned-file", "digest": "sha256:a96972152546e62f906f9ae213662b3a04c9c881ef0a85448900a76a1c966710", "mode": 420 },
11
+ { "path": "src/app.ts", "ownership": "owned-file", "digest": "sha256:29034c9f8222581e1d03e3ac1025f55aa484990878281155b47f94413efde78d", "mode": 420 },
12
+ { "path": "src/index.test.ts", "ownership": "owned-file", "digest": "sha256:000ac97598f6f52dc0bd7c7dd0ca0bccb9bc60578e3a362acf8e18a3f9823b13", "mode": 420 },
13
+ { "path": "src/index.ts", "ownership": "owned-file", "digest": "sha256:25f6a69a9cc7131778cd77c03f60ac17f3218c05521936aa0a12b255a5520a36", "mode": 420 },
14
+ { "path": "tsconfig.build.json", "ownership": "owned-file", "digest": "sha256:bb246608ad97ce04adb20dc0da36770d4858c301229b8f32db44da5960e5eb64", "mode": 420 },
15
+ { "path": "tsconfig.json", "ownership": "owned-file", "digest": "sha256:d38c25bd76efc8abab7cf154f44a0f78de3e421f898a93e73ac1756650deb977", "mode": 420 }
16
+ ],
17
+ "verifiers": [{ "id": "typescript.typecheck" }, { "id": "vitest.run" }, { "id": "typescript.build" }, { "id": "node.application-smoke" }],
18
+ "exit": { "ownedAssets": ["package.json", "src/app.test.ts", "src/app.ts", "src/index.test.ts", "src/index.ts", "tsconfig.build.json", "tsconfig.json"] }
19
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "renderer": "npm-package-json-v1"
4
+ }
@@ -0,0 +1,8 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { sum } from "./index.js";
3
+
4
+ describe("generated workspace npm package", () => {
5
+ it("runs through the workspace package baseline", () => {
6
+ expect(sum(2, 3)).toBe(5);
7
+ });
8
+ });
@@ -0,0 +1,3 @@
1
+ export function sum(left: number, right: number): number {
2
+ return left + right;
3
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "sourceMap": true,
7
+ "outDir": "dist",
8
+ "rootDir": "src",
9
+ "types": ["node"]
10
+ },
11
+ "include": ["src/index.ts"]
12
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": ["node", "vitest/globals"]
5
+ },
6
+ "include": ["src/**/*.ts"]
7
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "capabilityId": "foundation.workspace-npm-package",
4
+ "version": "1.0.0",
5
+ "integrity": "sha256:6de3d6f757cc3ae119c0b8cbd021b41409a8f94c0cea640407d31645e5ba0aa6",
6
+ "consumerProfile": "workspace-npm-package",
7
+ "compatibility": { "node": ">=24.18.0 <25", "pnpm": "11.21.0", "typescript": "6.0.3" },
8
+ "assets": [
9
+ { "path": "package.json", "ownership": "owned-file", "digest": "sha256:e3bdb26de65e71b397a22faf3c44162a54963394366b52bc5fcf2b85eb175988", "mode": 420, "renderer": "npm-package-json-v1" },
10
+ { "path": "src/index.test.ts", "ownership": "owned-file", "digest": "sha256:80689c5ef3271553e2036cea872fba82fec9326c1afeda7a81250be8fd74c87c", "mode": 420 },
11
+ { "path": "src/index.ts", "ownership": "owned-file", "digest": "sha256:582749e4a750379e36280d7b4388396496f83421eeb06c0e3f67a3fb9be99c00", "mode": 420 },
12
+ { "path": "tsconfig.build.json", "ownership": "owned-file", "digest": "sha256:d5c283e7a846fd0670952aa7550b29171c4093e32f8ab1388fe1229161d5f9e0", "mode": 420 },
13
+ { "path": "tsconfig.json", "ownership": "owned-file", "digest": "sha256:d38c25bd76efc8abab7cf154f44a0f78de3e421f898a93e73ac1756650deb977", "mode": 420 }
14
+ ],
15
+ "verifiers": [{ "id": "typescript.typecheck" }, { "id": "vitest.run" }, { "id": "typescript.build" }, { "id": "npm.pack-dry-run" }],
16
+ "exit": { "ownedAssets": ["package.json", "src/index.test.ts", "src/index.ts", "tsconfig.build.json", "tsconfig.json"] }
17
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "dyyto-workspace",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "engines": {
6
+ "node": ">=24.18.0 <25",
7
+ "pnpm": "11.21.0"
8
+ },
9
+ "packageManager": "pnpm@11.21.0",
10
+ "scripts": {
11
+ "build": "pnpm --recursive --if-present build",
12
+ "typecheck": "pnpm --recursive --if-present typecheck",
13
+ "test": "pnpm --recursive --if-present test",
14
+ "check": "pnpm typecheck && pnpm test && pnpm build"
15
+ }
16
+ }
@@ -0,0 +1,3 @@
1
+ # Workspace packages
2
+
3
+ Managed npm packages created by `dyyto add package` live in this directory.
@@ -0,0 +1,3 @@
1
+ packages:
2
+ - "packages/*"
3
+ - "apps/*"
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2024",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "noUncheckedIndexedAccess": true,
8
+ "exactOptionalPropertyTypes": true,
9
+ "verbatimModuleSyntax": true,
10
+ "skipLibCheck": true
11
+ }
12
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "capabilityId": "foundation.workspace-root",
4
+ "version": "1.0.0",
5
+ "integrity": "sha256:02f9f864712bc1a31737cd8e374d6bf3b687fa9509c4e0fa2763283272217cf7",
6
+ "consumerProfile": "workspace-root",
7
+ "compatibility": { "node": ">=24.18.0 <25", "pnpm": "11.21.0", "typescript": "6.0.3" },
8
+ "assets": [
9
+ { "path": "package.json", "ownership": "owned-file", "digest": "sha256:59420801655582958906c77d0b893498ccfc447462f693d2147ac74c24c4f4b1", "mode": 420 },
10
+ { "path": "packages/README.md", "ownership": "owned-file", "digest": "sha256:89ef48abb0e71878e4f8c267cf449e0356aeb467429a9897a4d51f22f94fc2fb", "mode": 420 },
11
+ { "path": "pnpm-workspace.yaml", "ownership": "owned-file", "digest": "sha256:316f2a0038d464f103abd64d7338dacefc35d0d09e57c8296defa0d5ddb898fe", "mode": 420 },
12
+ { "path": "tsconfig.base.json", "ownership": "owned-file", "digest": "sha256:075bf5c84e6dd6e0215084de39a4ce2ef96f083a1b19deb0e0f6586d98c8ac87", "mode": 420 }
13
+ ],
14
+ "verifiers": [{ "id": "workspace.structure" }],
15
+ "exit": { "ownedAssets": ["package.json", "packages/README.md", "pnpm-workspace.yaml", "tsconfig.base.json"] }
16
+ }
@@ -0,0 +1,3 @@
1
+ # Workspace applications
2
+
3
+ Managed applications created by `dyyto add application` live in this directory.
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "dyyto-workspace",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "engines": {
6
+ "node": ">=24.18.0 <25",
7
+ "pnpm": "11.21.0"
8
+ },
9
+ "packageManager": "pnpm@11.21.0",
10
+ "scripts": {
11
+ "build": "pnpm --recursive --if-present build",
12
+ "typecheck": "pnpm --recursive --if-present typecheck",
13
+ "test": "pnpm --recursive --if-present test",
14
+ "check": "pnpm typecheck && pnpm test && pnpm build"
15
+ }
16
+ }
@@ -0,0 +1,3 @@
1
+ # Workspace packages
2
+
3
+ Managed npm packages created by `dyyto add package` live in this directory.
@@ -0,0 +1,3 @@
1
+ packages:
2
+ - "packages/*"
3
+ - "apps/*"
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2024",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "noUncheckedIndexedAccess": true,
8
+ "exactOptionalPropertyTypes": true,
9
+ "verbatimModuleSyntax": true,
10
+ "skipLibCheck": true
11
+ }
12
+ }