swallowkit 1.0.0-beta.6 → 1.0.0-beta.61
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.ja.md +87 -175
- package/README.md +87 -176
- package/dist/__tests__/fixtures.d.ts +12 -0
- package/dist/__tests__/fixtures.d.ts.map +1 -1
- package/dist/__tests__/fixtures.js +101 -0
- package/dist/__tests__/fixtures.js.map +1 -1
- package/dist/cli/commands/add-auth.d.ts +15 -0
- package/dist/cli/commands/add-auth.d.ts.map +1 -0
- package/dist/cli/commands/add-auth.js +790 -0
- package/dist/cli/commands/add-auth.js.map +1 -0
- package/dist/cli/commands/add-connector.d.ts +20 -0
- package/dist/cli/commands/add-connector.d.ts.map +1 -0
- package/dist/cli/commands/add-connector.js +164 -0
- package/dist/cli/commands/add-connector.js.map +1 -0
- package/dist/cli/commands/cosmos-worktree-isolation.d.ts +25 -0
- package/dist/cli/commands/cosmos-worktree-isolation.d.ts.map +1 -0
- package/dist/cli/commands/cosmos-worktree-isolation.js +124 -0
- package/dist/cli/commands/cosmos-worktree-isolation.js.map +1 -0
- package/dist/cli/commands/create-model.d.ts +1 -4
- package/dist/cli/commands/create-model.d.ts.map +1 -1
- package/dist/cli/commands/create-model.js +20 -82
- package/dist/cli/commands/create-model.js.map +1 -1
- package/dist/cli/commands/dev-seeds.d.ts +62 -0
- package/dist/cli/commands/dev-seeds.d.ts.map +1 -0
- package/dist/cli/commands/dev-seeds.js +474 -0
- package/dist/cli/commands/dev-seeds.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +38 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +733 -155
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +3 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +74 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +1376 -930
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/scaffold.d.ts +24 -0
- package/dist/cli/commands/scaffold.d.ts.map +1 -1
- package/dist/cli/commands/scaffold.js +473 -90
- package/dist/cli/commands/scaffold.js.map +1 -1
- package/dist/cli/index.d.ts +5 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +335 -55
- package/dist/cli/index.js.map +1 -1
- package/dist/core/config.d.ts +14 -3
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +179 -8
- package/dist/core/config.js.map +1 -1
- package/dist/core/mock/connector-mock-server.d.ts +101 -0
- package/dist/core/mock/connector-mock-server.d.ts.map +1 -0
- package/dist/core/mock/connector-mock-server.js +480 -0
- package/dist/core/mock/connector-mock-server.js.map +1 -0
- package/dist/core/mock/zod-mock-generator.d.ts +14 -0
- package/dist/core/mock/zod-mock-generator.d.ts.map +1 -0
- package/dist/core/mock/zod-mock-generator.js +163 -0
- package/dist/core/mock/zod-mock-generator.js.map +1 -0
- package/dist/core/operations/auth-operations.d.ts +61 -0
- package/dist/core/operations/auth-operations.d.ts.map +1 -0
- package/dist/core/operations/auth-operations.js +272 -0
- package/dist/core/operations/auth-operations.js.map +1 -0
- package/dist/core/operations/create-model.d.ts +15 -0
- package/dist/core/operations/create-model.d.ts.map +1 -0
- package/dist/core/operations/create-model.js +185 -0
- package/dist/core/operations/create-model.js.map +1 -0
- package/dist/core/operations/file-session.d.ts +56 -0
- package/dist/core/operations/file-session.d.ts.map +1 -0
- package/dist/core/operations/file-session.js +203 -0
- package/dist/core/operations/file-session.js.map +1 -0
- package/dist/core/operations/provision-operations.d.ts +52 -0
- package/dist/core/operations/provision-operations.d.ts.map +1 -0
- package/dist/core/operations/provision-operations.js +211 -0
- package/dist/core/operations/provision-operations.js.map +1 -0
- package/dist/core/operations/runtime.d.ts +37 -0
- package/dist/core/operations/runtime.d.ts.map +1 -0
- package/dist/core/operations/runtime.js +248 -0
- package/dist/core/operations/runtime.js.map +1 -0
- package/dist/core/operations/scaffold-apply.d.ts +21 -0
- package/dist/core/operations/scaffold-apply.d.ts.map +1 -0
- package/dist/core/operations/scaffold-apply.js +57 -0
- package/dist/core/operations/scaffold-apply.js.map +1 -0
- package/dist/core/operations/scaffold-machine.d.ts +16 -0
- package/dist/core/operations/scaffold-machine.d.ts.map +1 -0
- package/dist/core/operations/scaffold-machine.js +51 -0
- package/dist/core/operations/scaffold-machine.js.map +1 -0
- package/dist/core/operations/scaffold-plan.d.ts +43 -0
- package/dist/core/operations/scaffold-plan.d.ts.map +1 -0
- package/dist/core/operations/scaffold-plan.js +187 -0
- package/dist/core/operations/scaffold-plan.js.map +1 -0
- package/dist/core/project/agent-instructions.d.ts +29 -0
- package/dist/core/project/agent-instructions.d.ts.map +1 -0
- package/dist/core/project/agent-instructions.js +160 -0
- package/dist/core/project/agent-instructions.js.map +1 -0
- package/dist/core/project/artifacts.d.ts +58 -0
- package/dist/core/project/artifacts.d.ts.map +1 -0
- package/dist/core/project/artifacts.js +179 -0
- package/dist/core/project/artifacts.js.map +1 -0
- package/dist/core/project/boundaries.d.ts +50 -0
- package/dist/core/project/boundaries.d.ts.map +1 -0
- package/dist/core/project/boundaries.js +117 -0
- package/dist/core/project/boundaries.js.map +1 -0
- package/dist/core/project/capabilities.d.ts +58 -0
- package/dist/core/project/capabilities.d.ts.map +1 -0
- package/dist/core/project/capabilities.js +135 -0
- package/dist/core/project/capabilities.js.map +1 -0
- package/dist/core/project/drift.d.ts +29 -0
- package/dist/core/project/drift.d.ts.map +1 -0
- package/dist/core/project/drift.js +188 -0
- package/dist/core/project/drift.js.map +1 -0
- package/dist/core/project/infra.d.ts +49 -0
- package/dist/core/project/infra.d.ts.map +1 -0
- package/dist/core/project/infra.js +167 -0
- package/dist/core/project/infra.js.map +1 -0
- package/dist/core/project/manifest.d.ts +92 -0
- package/dist/core/project/manifest.d.ts.map +1 -0
- package/dist/core/project/manifest.js +321 -0
- package/dist/core/project/manifest.js.map +1 -0
- package/dist/core/project/state.d.ts +15 -0
- package/dist/core/project/state.d.ts.map +1 -0
- package/dist/core/project/state.js +106 -0
- package/dist/core/project/state.js.map +1 -0
- package/dist/core/project/validation.d.ts +20 -0
- package/dist/core/project/validation.d.ts.map +1 -0
- package/dist/core/project/validation.js +274 -0
- package/dist/core/project/validation.js.map +1 -0
- package/dist/core/project/workflows.d.ts +43 -0
- package/dist/core/project/workflows.d.ts.map +1 -0
- package/dist/core/project/workflows.js +299 -0
- package/dist/core/project/workflows.js.map +1 -0
- package/dist/core/scaffold/auth-generator.d.ts +63 -0
- package/dist/core/scaffold/auth-generator.d.ts.map +1 -0
- package/dist/core/scaffold/auth-generator.js +1774 -0
- package/dist/core/scaffold/auth-generator.js.map +1 -0
- package/dist/core/scaffold/connector-functions-generator.d.ts +41 -0
- package/dist/core/scaffold/connector-functions-generator.d.ts.map +1 -0
- package/dist/core/scaffold/connector-functions-generator.js +1029 -0
- package/dist/core/scaffold/connector-functions-generator.js.map +1 -0
- package/dist/core/scaffold/functions-generator.d.ts +7 -1
- package/dist/core/scaffold/functions-generator.d.ts.map +1 -1
- package/dist/core/scaffold/functions-generator.js +771 -69
- package/dist/core/scaffold/functions-generator.js.map +1 -1
- package/dist/core/scaffold/model-parser.d.ts +21 -1
- package/dist/core/scaffold/model-parser.d.ts.map +1 -1
- package/dist/core/scaffold/model-parser.js +230 -79
- package/dist/core/scaffold/model-parser.js.map +1 -1
- package/dist/core/scaffold/native-schema-generator.d.ts +19 -0
- package/dist/core/scaffold/native-schema-generator.d.ts.map +1 -0
- package/dist/core/scaffold/native-schema-generator.js +753 -0
- package/dist/core/scaffold/native-schema-generator.js.map +1 -0
- package/dist/core/scaffold/nextjs-generator.d.ts +8 -0
- package/dist/core/scaffold/nextjs-generator.d.ts.map +1 -1
- package/dist/core/scaffold/nextjs-generator.js +153 -9
- package/dist/core/scaffold/nextjs-generator.js.map +1 -1
- package/dist/core/scaffold/openapi-generator.d.ts +3 -0
- package/dist/core/scaffold/openapi-generator.d.ts.map +1 -0
- package/dist/core/scaffold/openapi-generator.js +190 -0
- package/dist/core/scaffold/openapi-generator.js.map +1 -0
- package/dist/core/scaffold/ui-generator.d.ts +17 -4
- package/dist/core/scaffold/ui-generator.d.ts.map +1 -1
- package/dist/core/scaffold/ui-generator.js +174 -34
- package/dist/core/scaffold/ui-generator.js.map +1 -1
- package/dist/core/verify/index.d.ts +69 -0
- package/dist/core/verify/index.d.ts.map +1 -0
- package/dist/core/verify/index.js +412 -0
- package/dist/core/verify/index.js.map +1 -0
- package/dist/database/base-model.d.ts +3 -3
- package/dist/database/base-model.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/machine/contracts.d.ts +24 -0
- package/dist/machine/contracts.d.ts.map +1 -0
- package/dist/machine/contracts.js +3 -0
- package/dist/machine/contracts.js.map +1 -0
- package/dist/machine/errors.d.ts +14 -0
- package/dist/machine/errors.d.ts.map +1 -0
- package/dist/machine/errors.js +42 -0
- package/dist/machine/errors.js.map +1 -0
- package/dist/machine/index.d.ts +3 -0
- package/dist/machine/index.d.ts.map +1 -0
- package/dist/machine/index.js +566 -0
- package/dist/machine/index.js.map +1 -0
- package/dist/mcp/index.d.ts +25 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +425 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/types/index.d.ts +109 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/package-manager.d.ts +9 -12
- package/dist/utils/package-manager.d.ts.map +1 -1
- package/dist/utils/package-manager.js +51 -22
- package/dist/utils/package-manager.js.map +1 -1
- package/dist/utils/python-uv.d.ts +21 -0
- package/dist/utils/python-uv.d.ts.map +1 -0
- package/dist/utils/python-uv.js +111 -0
- package/dist/utils/python-uv.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +49 -0
- package/dist/version.js.map +1 -0
- package/package.json +16 -17
- package/src/__tests__/__snapshots__/functions-generator.test.ts.snap +1139 -0
- package/src/__tests__/__snapshots__/nextjs-generator.test.ts.snap +206 -0
- package/src/__tests__/__snapshots__/ui-generator.test.ts.snap +532 -0
- package/src/__tests__/agent-instructions.test.ts +237 -0
- package/src/__tests__/agent-loop-phase34.test.ts +513 -0
- package/src/__tests__/auth.test.ts +770 -0
- package/src/__tests__/bff-swa-auth.test.ts +275 -0
- package/src/__tests__/config.test.ts +295 -0
- package/src/__tests__/connector-functions-generator.test.ts +288 -0
- package/src/__tests__/connector-mock-server.test.ts +459 -0
- package/src/__tests__/connector-model-bff.test.ts +162 -0
- package/src/__tests__/cosmos-worktree-isolation.test.ts +149 -0
- package/src/__tests__/dev-seeds.test.ts +236 -0
- package/src/__tests__/dev.test.ts +296 -0
- package/src/__tests__/file-session.test.ts +98 -0
- package/src/__tests__/fixtures.ts +184 -0
- package/src/__tests__/functions-generator.test.ts +237 -0
- package/src/__tests__/init.test.ts +363 -0
- package/src/__tests__/jest-globals.d.ts +8 -0
- package/src/__tests__/machine.test.ts +371 -0
- package/src/__tests__/mcp.test.ts +253 -0
- package/src/__tests__/model-parser.test.ts +142 -0
- package/src/__tests__/multi-auth.test.ts +160 -0
- package/src/__tests__/nextjs-generator.test.ts +105 -0
- package/src/__tests__/openapi-generator.test.ts +43 -0
- package/src/__tests__/package-manager.test.ts +244 -0
- package/src/__tests__/plan-apply.test.ts +499 -0
- package/src/__tests__/python-uv.test.ts +48 -0
- package/src/__tests__/scaffold.test.ts +302 -0
- package/src/__tests__/string-utils.test.ts +75 -0
- package/src/__tests__/tsconfig.json +15 -0
- package/src/__tests__/ui-generator.test.ts +248 -0
- package/src/__tests__/zod-mock-generator.test.ts +132 -0
- package/src/cli/commands/add-auth.ts +853 -0
- package/src/cli/commands/add-connector.ts +159 -0
- package/src/cli/commands/cosmos-worktree-isolation.ts +130 -0
- package/src/cli/commands/create-model.ts +62 -0
- package/src/cli/commands/dev-seeds.ts +629 -0
- package/src/cli/commands/dev.ts +1252 -0
- package/src/cli/commands/index.ts +9 -0
- package/src/cli/commands/init.ts +3414 -0
- package/src/cli/commands/provision.ts +193 -0
- package/src/cli/commands/scaffold.ts +1081 -0
- package/src/cli/index.ts +352 -0
- package/src/core/config.ts +380 -0
- package/src/core/mock/connector-mock-server.ts +555 -0
- package/src/core/mock/zod-mock-generator.ts +205 -0
- package/src/core/operations/auth-operations.ts +360 -0
- package/src/core/operations/create-model.ts +191 -0
- package/src/core/operations/file-session.ts +222 -0
- package/src/core/operations/provision-operations.ts +297 -0
- package/src/core/operations/runtime.ts +258 -0
- package/src/core/operations/scaffold-apply.ts +106 -0
- package/src/core/operations/scaffold-machine.ts +77 -0
- package/src/core/operations/scaffold-plan.ts +215 -0
- package/src/core/project/agent-instructions.ts +167 -0
- package/src/core/project/agent-templates/AGENTS.md +504 -0
- package/src/core/project/agent-templates/CLAUDE.md +31 -0
- package/src/core/project/agent-templates/azure-functions.instructions.md +22 -0
- package/src/core/project/agent-templates/bff-routes.instructions.md +18 -0
- package/src/core/project/agent-templates/copilot-instructions.md +27 -0
- package/src/core/project/agent-templates/shared-models.instructions.md +72 -0
- package/src/core/project/artifacts.ts +205 -0
- package/src/core/project/boundaries.ts +170 -0
- package/src/core/project/capabilities.ts +193 -0
- package/src/core/project/drift.ts +202 -0
- package/src/core/project/infra.ts +196 -0
- package/src/core/project/manifest.ts +402 -0
- package/src/core/project/state.ts +77 -0
- package/src/core/project/validation.ts +295 -0
- package/src/core/project/workflows.ts +295 -0
- package/src/core/scaffold/auth-generator.ts +1824 -0
- package/src/core/scaffold/connector-functions-generator.ts +1133 -0
- package/src/core/scaffold/functions-generator.ts +972 -0
- package/src/core/scaffold/model-parser.ts +781 -0
- package/src/core/scaffold/native-schema-generator.ts +904 -0
- package/src/core/scaffold/nextjs-generator.ts +382 -0
- package/src/core/scaffold/openapi-generator.ts +212 -0
- package/src/core/scaffold/ui-generator.ts +1100 -0
- package/src/core/verify/index.ts +468 -0
- package/src/database/base-model.ts +184 -0
- package/src/database/client.ts +140 -0
- package/src/database/repository.ts +104 -0
- package/src/database/runtime-check.ts +25 -0
- package/src/index.ts +27 -0
- package/src/machine/contracts.ts +33 -0
- package/src/machine/errors.ts +45 -0
- package/src/machine/index.ts +690 -0
- package/src/mcp/index.ts +423 -0
- package/src/types/index.ts +182 -0
- package/src/utils/package-manager.ts +251 -0
- package/src/utils/python-uv.ts +96 -0
- package/src/version.ts +13 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Verify — 生成後の検証チェックを実行し、機械可読な結果を返す。
|
|
4
|
+
*
|
|
5
|
+
* 提供チェック:
|
|
6
|
+
* - structure: プロジェクト構造規約 (validateProject)
|
|
7
|
+
* - drift: 生成物と現在状態の乖離 (detectDrift)
|
|
8
|
+
* - typecheck: TypeScript 型チェック (tsc --noEmit / typecheck script)
|
|
9
|
+
* - build/lint/test: package.json scripts に同名 script がある場合のみ実行 (なければ skip)
|
|
10
|
+
* - custom: swallowkit.config の verify.checks で定義されたプロジェクト固有チェック
|
|
11
|
+
*
|
|
12
|
+
* 既定実行セットは structure/drift/typecheck + custom。build/lint/test は --checks で明示指定。
|
|
13
|
+
*/
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.DEFAULT_VERIFY_CHECKS = exports.AVAILABLE_VERIFY_CHECKS = void 0;
|
|
49
|
+
exports.loadCustomVerifyChecks = loadCustomVerifyChecks;
|
|
50
|
+
exports.runVerify = runVerify;
|
|
51
|
+
exports.compactVerifyResult = compactVerifyResult;
|
|
52
|
+
exports.explainVerifyFailure = explainVerifyFailure;
|
|
53
|
+
const fs = __importStar(require("fs"));
|
|
54
|
+
const path = __importStar(require("path"));
|
|
55
|
+
const child_process_1 = require("child_process");
|
|
56
|
+
const config_1 = require("../config");
|
|
57
|
+
const drift_1 = require("../project/drift");
|
|
58
|
+
const state_1 = require("../project/state");
|
|
59
|
+
const validation_1 = require("../project/validation");
|
|
60
|
+
const package_manager_1 = require("../../utils/package-manager");
|
|
61
|
+
exports.AVAILABLE_VERIFY_CHECKS = ["structure", "drift", "typecheck", "build", "lint", "test"];
|
|
62
|
+
/** 既定で実行される built-in チェック。build/lint/test は明示指定時のみ。 */
|
|
63
|
+
exports.DEFAULT_VERIFY_CHECKS = ["structure", "drift", "typecheck"];
|
|
64
|
+
async function runStructureCheck(projectRoot) {
|
|
65
|
+
const startedAt = Date.now();
|
|
66
|
+
try {
|
|
67
|
+
const result = await (0, validation_1.validateProject)(projectRoot);
|
|
68
|
+
const errors = result.violations.filter((violation) => violation.severity === "error");
|
|
69
|
+
return {
|
|
70
|
+
id: "structure",
|
|
71
|
+
title: "Project structure conventions",
|
|
72
|
+
status: errors.length === 0 ? "pass" : "fail",
|
|
73
|
+
durationMs: Date.now() - startedAt,
|
|
74
|
+
fixable: true,
|
|
75
|
+
evidence: { violations: result.violations },
|
|
76
|
+
suggestedActions: errors.length === 0
|
|
77
|
+
? []
|
|
78
|
+
: errors.map((violation) => violation.suggestedFix ?? violation.message),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return {
|
|
83
|
+
id: "structure",
|
|
84
|
+
title: "Project structure conventions",
|
|
85
|
+
status: "error",
|
|
86
|
+
durationMs: Date.now() - startedAt,
|
|
87
|
+
fixable: false,
|
|
88
|
+
evidence: { logTail: [error instanceof Error ? error.message : String(error)] },
|
|
89
|
+
suggestedActions: ["Run this command inside a SwallowKit project root."],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function runDriftCheck(projectRoot) {
|
|
94
|
+
const startedAt = Date.now();
|
|
95
|
+
try {
|
|
96
|
+
const result = await (0, drift_1.detectDrift)(projectRoot);
|
|
97
|
+
const errors = result.findings.filter((finding) => finding.severity === "error");
|
|
98
|
+
return {
|
|
99
|
+
id: "drift",
|
|
100
|
+
title: "Generated artifact drift",
|
|
101
|
+
status: errors.length === 0 ? "pass" : "fail",
|
|
102
|
+
durationMs: Date.now() - startedAt,
|
|
103
|
+
fixable: true,
|
|
104
|
+
evidence: { findings: result.findings },
|
|
105
|
+
suggestedActions: errors.map((finding) => finding.repairAction),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
return {
|
|
110
|
+
id: "drift",
|
|
111
|
+
title: "Generated artifact drift",
|
|
112
|
+
status: "error",
|
|
113
|
+
durationMs: Date.now() - startedAt,
|
|
114
|
+
fixable: false,
|
|
115
|
+
evidence: { logTail: [error instanceof Error ? error.message : String(error)] },
|
|
116
|
+
suggestedActions: [],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function tailLines(text, count) {
|
|
121
|
+
return text
|
|
122
|
+
.split(/\r?\n/)
|
|
123
|
+
.filter((line) => line.trim().length > 0)
|
|
124
|
+
.slice(-count);
|
|
125
|
+
}
|
|
126
|
+
function runCommandCheck(projectRoot, spec) {
|
|
127
|
+
const startedAt = Date.now();
|
|
128
|
+
const commandLabel = [spec.command, ...spec.args].join(" ").trim();
|
|
129
|
+
try {
|
|
130
|
+
const result = (0, child_process_1.spawnSync)(spec.command, spec.args, {
|
|
131
|
+
cwd: projectRoot,
|
|
132
|
+
shell: true,
|
|
133
|
+
encoding: "utf-8",
|
|
134
|
+
timeout: spec.timeoutMs ?? 5 * 60 * 1000,
|
|
135
|
+
});
|
|
136
|
+
const output = `${result.stdout ?? ""}\n${result.stderr ?? ""}`;
|
|
137
|
+
const exitCode = typeof result.status === "number" ? result.status : -1;
|
|
138
|
+
if (result.error) {
|
|
139
|
+
return {
|
|
140
|
+
id: spec.id,
|
|
141
|
+
title: spec.title,
|
|
142
|
+
status: "error",
|
|
143
|
+
durationMs: Date.now() - startedAt,
|
|
144
|
+
fixable: false,
|
|
145
|
+
evidence: { command: commandLabel, logTail: [result.error.message] },
|
|
146
|
+
suggestedActions: [`Ensure "${commandLabel}" can run in this project.`],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
id: spec.id,
|
|
151
|
+
title: spec.title,
|
|
152
|
+
status: exitCode === 0 ? "pass" : "fail",
|
|
153
|
+
durationMs: Date.now() - startedAt,
|
|
154
|
+
fixable: true,
|
|
155
|
+
evidence: {
|
|
156
|
+
command: commandLabel,
|
|
157
|
+
exitCode,
|
|
158
|
+
logTail: tailLines(output, 50),
|
|
159
|
+
},
|
|
160
|
+
suggestedActions: exitCode === 0 ? [] : [spec.failAction],
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
return {
|
|
165
|
+
id: spec.id,
|
|
166
|
+
title: spec.title,
|
|
167
|
+
status: "error",
|
|
168
|
+
durationMs: Date.now() - startedAt,
|
|
169
|
+
fixable: false,
|
|
170
|
+
evidence: { command: commandLabel, logTail: [error instanceof Error ? error.message : String(error)] },
|
|
171
|
+
suggestedActions: [],
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function readPackageScripts(projectRoot) {
|
|
176
|
+
const packageJsonPath = path.join(projectRoot, "package.json");
|
|
177
|
+
if (!fs.existsSync(packageJsonPath))
|
|
178
|
+
return {};
|
|
179
|
+
try {
|
|
180
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
181
|
+
return pkg.scripts ?? {};
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
return {};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function runTypecheckCheck(projectRoot) {
|
|
188
|
+
const startedAt = Date.now();
|
|
189
|
+
if (!fs.existsSync(path.join(projectRoot, "tsconfig.json"))) {
|
|
190
|
+
return {
|
|
191
|
+
id: "typecheck",
|
|
192
|
+
title: "TypeScript type check",
|
|
193
|
+
status: "skip",
|
|
194
|
+
durationMs: Date.now() - startedAt,
|
|
195
|
+
fixable: false,
|
|
196
|
+
evidence: { logTail: ["tsconfig.json not found; skipping typecheck."] },
|
|
197
|
+
suggestedActions: [],
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
// typecheck は shared のビルド済み dist/ を参照する。古い dist による
|
|
201
|
+
// 「no exported member」誤検知を防ぐため、先に shared をビルドする。
|
|
202
|
+
const sharedBuild = runSharedBuildIfPresent(projectRoot);
|
|
203
|
+
if (sharedBuild.ran && !sharedBuild.ok) {
|
|
204
|
+
return {
|
|
205
|
+
id: "typecheck",
|
|
206
|
+
title: "TypeScript type check",
|
|
207
|
+
status: "fail",
|
|
208
|
+
durationMs: Date.now() - startedAt,
|
|
209
|
+
fixable: true,
|
|
210
|
+
evidence: { command: sharedBuild.command, logTail: sharedBuild.logTail },
|
|
211
|
+
suggestedActions: [
|
|
212
|
+
"Fix the shared package build errors first; typecheck resolves the shared package from its built dist/.",
|
|
213
|
+
],
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const scripts = readPackageScripts(projectRoot);
|
|
217
|
+
let command;
|
|
218
|
+
let args;
|
|
219
|
+
if (typeof scripts.typecheck === "string") {
|
|
220
|
+
const pm = (0, package_manager_1.detectFromProject)(projectRoot);
|
|
221
|
+
command = (0, package_manager_1.getCommands)(pm).name;
|
|
222
|
+
args = ["run", "typecheck"];
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
command = "npx";
|
|
226
|
+
args = ["tsc", "--noEmit"];
|
|
227
|
+
}
|
|
228
|
+
return runCommandCheck(projectRoot, {
|
|
229
|
+
id: "typecheck",
|
|
230
|
+
title: "TypeScript type check",
|
|
231
|
+
command,
|
|
232
|
+
args,
|
|
233
|
+
failAction: "Fix the TypeScript errors listed in evidence.logTail, then re-run verify.",
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
const SCRIPT_CHECK_TITLES = {
|
|
237
|
+
build: "Project build",
|
|
238
|
+
lint: "Lint",
|
|
239
|
+
test: "Test suite",
|
|
240
|
+
};
|
|
241
|
+
/** shared/package.json に build script があれば実行する (なければ no-op)。 */
|
|
242
|
+
function runSharedBuildIfPresent(projectRoot) {
|
|
243
|
+
const sharedPackageJsonPath = path.join(projectRoot, "shared", "package.json");
|
|
244
|
+
if (!fs.existsSync(sharedPackageJsonPath))
|
|
245
|
+
return { ran: false, ok: true };
|
|
246
|
+
try {
|
|
247
|
+
const pkg = JSON.parse(fs.readFileSync(sharedPackageJsonPath, "utf-8"));
|
|
248
|
+
if (typeof pkg.scripts?.build !== "string")
|
|
249
|
+
return { ran: false, ok: true };
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
return { ran: false, ok: true };
|
|
253
|
+
}
|
|
254
|
+
const pm = (0, package_manager_1.detectFromProject)(projectRoot);
|
|
255
|
+
const command = (0, package_manager_1.getCommands)(pm).name;
|
|
256
|
+
const result = (0, child_process_1.spawnSync)(command, ["run", "build"], {
|
|
257
|
+
cwd: path.join(projectRoot, "shared"),
|
|
258
|
+
shell: true,
|
|
259
|
+
encoding: "utf-8",
|
|
260
|
+
timeout: 5 * 60 * 1000,
|
|
261
|
+
});
|
|
262
|
+
const output = `${result.stdout ?? ""}\n${result.stderr ?? ""}`;
|
|
263
|
+
const ok = result.status === 0 && !result.error;
|
|
264
|
+
return {
|
|
265
|
+
ran: true,
|
|
266
|
+
ok,
|
|
267
|
+
command: `${command} run build (in shared/)`,
|
|
268
|
+
logTail: ok ? undefined : tailLines(result.error ? `${output}\n${result.error.message}` : output, 50),
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function runScriptCheck(projectRoot, scriptName) {
|
|
272
|
+
const startedAt = Date.now();
|
|
273
|
+
const scripts = readPackageScripts(projectRoot);
|
|
274
|
+
const title = SCRIPT_CHECK_TITLES[scriptName];
|
|
275
|
+
if (typeof scripts[scriptName] !== "string") {
|
|
276
|
+
return {
|
|
277
|
+
id: scriptName,
|
|
278
|
+
title,
|
|
279
|
+
status: "skip",
|
|
280
|
+
durationMs: Date.now() - startedAt,
|
|
281
|
+
fixable: false,
|
|
282
|
+
evidence: { logTail: [`No "${scriptName}" script in package.json; skipping.`] },
|
|
283
|
+
suggestedActions: [],
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
const pm = (0, package_manager_1.detectFromProject)(projectRoot);
|
|
287
|
+
return runCommandCheck(projectRoot, {
|
|
288
|
+
id: scriptName,
|
|
289
|
+
title,
|
|
290
|
+
command: (0, package_manager_1.getCommands)(pm).name,
|
|
291
|
+
args: ["run", scriptName],
|
|
292
|
+
timeoutMs: 10 * 60 * 1000,
|
|
293
|
+
failAction: `Fix the ${scriptName} failures listed in evidence.logTail, then re-run verify.`,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
const CUSTOM_CHECK_ID = /^[a-z][a-z0-9-]*$/;
|
|
297
|
+
/** swallowkit.config の verify.checks を projectRoot 基準で静かに読み込む。 */
|
|
298
|
+
function loadCustomVerifyChecks(projectRoot) {
|
|
299
|
+
const configNames = ["swallowkit.config.json", "swallowkit.config.js", ".swallowkitrc.json"];
|
|
300
|
+
for (const name of configNames) {
|
|
301
|
+
const configPath = path.join(projectRoot, name);
|
|
302
|
+
if (!fs.existsSync(configPath))
|
|
303
|
+
continue;
|
|
304
|
+
try {
|
|
305
|
+
const checks = (0, config_1.loadConfig)(configPath, false, true).verify?.checks ?? [];
|
|
306
|
+
return checks.filter((check) => typeof check?.id === "string" &&
|
|
307
|
+
CUSTOM_CHECK_ID.test(check.id) &&
|
|
308
|
+
!exports.AVAILABLE_VERIFY_CHECKS.includes(check.id) &&
|
|
309
|
+
typeof check.command === "string" &&
|
|
310
|
+
check.command.trim().length > 0);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
return [];
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return [];
|
|
317
|
+
}
|
|
318
|
+
function runCustomCheck(projectRoot, check) {
|
|
319
|
+
return runCommandCheck(projectRoot, {
|
|
320
|
+
id: check.id,
|
|
321
|
+
title: check.title ?? `Custom check: ${check.id}`,
|
|
322
|
+
command: check.command,
|
|
323
|
+
args: [],
|
|
324
|
+
timeoutMs: check.timeoutMs,
|
|
325
|
+
failAction: `Fix the failures reported by "${check.command}", then re-run verify.`,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
async function runVerify(checkIds, projectRoot = process.cwd()) {
|
|
329
|
+
const customChecks = loadCustomVerifyChecks(projectRoot);
|
|
330
|
+
const customIds = customChecks.map((check) => check.id);
|
|
331
|
+
const availableIds = [...exports.AVAILABLE_VERIFY_CHECKS, ...customIds];
|
|
332
|
+
const requested = (checkIds && checkIds.length > 0
|
|
333
|
+
? checkIds
|
|
334
|
+
: [...exports.DEFAULT_VERIFY_CHECKS, ...customIds]).map((id) => id.trim()).filter(Boolean);
|
|
335
|
+
const unknown = requested.filter((id) => !availableIds.includes(id));
|
|
336
|
+
if (unknown.length > 0) {
|
|
337
|
+
throw new Error(`Unknown verify check(s): ${unknown.join(", ")}. Available checks: ${availableIds.join(", ")}`);
|
|
338
|
+
}
|
|
339
|
+
const checks = [];
|
|
340
|
+
for (const id of requested) {
|
|
341
|
+
if (id === "structure") {
|
|
342
|
+
checks.push(await runStructureCheck(projectRoot));
|
|
343
|
+
}
|
|
344
|
+
else if (id === "drift") {
|
|
345
|
+
checks.push(await runDriftCheck(projectRoot));
|
|
346
|
+
}
|
|
347
|
+
else if (id === "typecheck") {
|
|
348
|
+
checks.push(runTypecheckCheck(projectRoot));
|
|
349
|
+
}
|
|
350
|
+
else if (id === "build" || id === "lint" || id === "test") {
|
|
351
|
+
checks.push(runScriptCheck(projectRoot, id));
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
const custom = customChecks.find((check) => check.id === id);
|
|
355
|
+
if (custom)
|
|
356
|
+
checks.push(runCustomCheck(projectRoot, custom));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const summary = {
|
|
360
|
+
passed: checks.filter((check) => check.status === "pass").length,
|
|
361
|
+
failed: checks.filter((check) => check.status === "fail").length,
|
|
362
|
+
skipped: checks.filter((check) => check.status === "skip").length,
|
|
363
|
+
errors: checks.filter((check) => check.status === "error").length,
|
|
364
|
+
done: checks.every((check) => check.status === "pass" || check.status === "skip"),
|
|
365
|
+
};
|
|
366
|
+
const result = {
|
|
367
|
+
checks,
|
|
368
|
+
summary,
|
|
369
|
+
verifiedAt: new Date().toISOString(),
|
|
370
|
+
};
|
|
371
|
+
(0, state_1.saveLastVerifyState)(result, projectRoot);
|
|
372
|
+
return result;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Agent 消費向けに info-severity の drift findings (「user-owned が編集されたが想定内」等)
|
|
376
|
+
* を除去したコンパクトな結果を返す。判定 (summary) は変わらない。
|
|
377
|
+
*/
|
|
378
|
+
function compactVerifyResult(result) {
|
|
379
|
+
return {
|
|
380
|
+
...result,
|
|
381
|
+
checks: result.checks.map((check) => {
|
|
382
|
+
const findings = check.evidence.findings;
|
|
383
|
+
if (!findings || findings.length === 0)
|
|
384
|
+
return check;
|
|
385
|
+
const kept = findings.filter((finding) => finding.severity !== "info");
|
|
386
|
+
const suppressed = findings.length - kept.length;
|
|
387
|
+
if (suppressed === 0)
|
|
388
|
+
return check;
|
|
389
|
+
return {
|
|
390
|
+
...check,
|
|
391
|
+
evidence: { ...check.evidence, findings: kept, suppressedInfoFindings: suppressed },
|
|
392
|
+
};
|
|
393
|
+
}),
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
function explainVerifyFailure(lastVerify, checkId) {
|
|
397
|
+
const targets = checkId
|
|
398
|
+
? lastVerify.checks.filter((check) => check.id === checkId)
|
|
399
|
+
: lastVerify.checks.filter((check) => check.status === "fail" || check.status === "error");
|
|
400
|
+
if (checkId && targets.length === 0) {
|
|
401
|
+
throw new Error(`Unknown check "${checkId}" in the last verify result. Available: ${lastVerify.checks.map((check) => check.id).join(", ")}`);
|
|
402
|
+
}
|
|
403
|
+
return targets.map((check) => ({
|
|
404
|
+
checkId: check.id,
|
|
405
|
+
title: check.title,
|
|
406
|
+
status: check.status,
|
|
407
|
+
verifiedAt: lastVerify.verifiedAt,
|
|
408
|
+
evidence: check.evidence,
|
|
409
|
+
suggestedActions: check.suggestedActions,
|
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SAAgB,oBAAoB,CAClC,UAAwB,EACxB,OAAgB;IAEhB,MAAM,OAAO,GAAG,OAAO;QACrB,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,OAAO,CAAC;QAC3D,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC;IAE7F,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,kBAAkB,OAAO,2CAA2C,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC5H,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7B,OAAO,EAAE,KAAK,CAAC,EAAE;QACjB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;KACzC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
* //
|
|
9
|
+
* // shared/models/user.ts
|
|
10
10
|
* import { z } from 'zod';
|
|
11
11
|
*
|
|
12
12
|
* export const userSchema = z.object({
|
|
@@ -20,7 +20,7 @@ import { z } from "zod";
|
|
|
20
20
|
*
|
|
21
21
|
* Then use the scaffold command to generate CRUD operations:
|
|
22
22
|
* ```bash
|
|
23
|
-
* npx swallowkit scaffold
|
|
23
|
+
* npx swallowkit scaffold shared/models/user.ts
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
26
26
|
* This will generate:
|
|
@@ -31,7 +31,7 @@ import { z } from "zod";
|
|
|
31
31
|
* Use the generated API from frontend:
|
|
32
32
|
* ```typescript
|
|
33
33
|
* import { api } from '@/lib/api/backend';
|
|
34
|
-
* import type { UserType } from '
|
|
34
|
+
* import type { UserType } from '@myapp/shared';
|
|
35
35
|
*
|
|
36
36
|
* const users = await api.get<UserType[]>('/api/users');
|
|
37
37
|
* await api.post<UserType>('/api/users', { email: 'test@example.com', name: 'Test' });
|
|
@@ -10,7 +10,7 @@ const runtime_check_js_1 = require("./runtime-check.js");
|
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
|
-
* //
|
|
13
|
+
* // shared/models/user.ts
|
|
14
14
|
* import { z } from 'zod';
|
|
15
15
|
*
|
|
16
16
|
* export const userSchema = z.object({
|
|
@@ -24,7 +24,7 @@ const runtime_check_js_1 = require("./runtime-check.js");
|
|
|
24
24
|
*
|
|
25
25
|
* Then use the scaffold command to generate CRUD operations:
|
|
26
26
|
* ```bash
|
|
27
|
-
* npx swallowkit scaffold
|
|
27
|
+
* npx swallowkit scaffold shared/models/user.ts
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
30
30
|
* This will generate:
|
|
@@ -35,7 +35,7 @@ const runtime_check_js_1 = require("./runtime-check.js");
|
|
|
35
35
|
* Use the generated API from frontend:
|
|
36
36
|
* ```typescript
|
|
37
37
|
* import { api } from '@/lib/api/backend';
|
|
38
|
-
* import type { UserType } from '
|
|
38
|
+
* import type { UserType } from '@myapp/shared';
|
|
39
39
|
*
|
|
40
40
|
* const users = await api.get<UserType[]>('/api/users');
|
|
41
41
|
* await api.post<UserType>('/api/users', { email: 'test@example.com', name: 'Test' });
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* SwallowKit - Next.js framework optimized for Azure deployment
|
|
3
3
|
* Main exports
|
|
4
4
|
*/
|
|
5
|
-
export type { UseServerFnOptions, UseServerFnResult, ServerFnMode, SwallowKitConfig, } from "./types";
|
|
6
|
-
export { loadConfig, generateConfig, getFullConfig, validateConfig } from "./core/config";
|
|
5
|
+
export type { UseServerFnOptions, UseServerFnResult, ServerFnMode, BackendLanguage, SwallowKitConfig, } from "./types";
|
|
6
|
+
export { loadConfig, generateConfig, getBackendLanguage, getFullConfig, validateConfig, } from "./core/config";
|
|
7
7
|
export { DatabaseClient, getDatabaseClient } from "./database/client";
|
|
8
8
|
export { SchemaRepository, createRepository, TodoSchema, TodoRepository } from "./database/repository";
|
|
9
9
|
export type { Todo } from "./database/repository";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvG,YAAY,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Main exports
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TodoRepository = exports.TodoSchema = exports.createRepository = exports.SchemaRepository = exports.getDatabaseClient = exports.DatabaseClient = exports.validateConfig = exports.getFullConfig = exports.generateConfig = exports.loadConfig = void 0;
|
|
7
|
+
exports.TodoRepository = exports.TodoSchema = exports.createRepository = exports.SchemaRepository = exports.getDatabaseClient = exports.DatabaseClient = exports.validateConfig = exports.getFullConfig = exports.getBackendLanguage = exports.generateConfig = exports.loadConfig = void 0;
|
|
8
8
|
// Configuration
|
|
9
9
|
var config_1 = require("./core/config");
|
|
10
10
|
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_1.loadConfig; } });
|
|
11
11
|
Object.defineProperty(exports, "generateConfig", { enumerable: true, get: function () { return config_1.generateConfig; } });
|
|
12
|
+
Object.defineProperty(exports, "getBackendLanguage", { enumerable: true, get: function () { return config_1.getBackendLanguage; } });
|
|
12
13
|
Object.defineProperty(exports, "getFullConfig", { enumerable: true, get: function () { return config_1.getFullConfig; } });
|
|
13
14
|
Object.defineProperty(exports, "validateConfig", { enumerable: true, get: function () { return config_1.validateConfig; } });
|
|
14
15
|
// Database - Zod-based schema sharing between frontend, backend, and Cosmos DB
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,gBAAgB;AAChB,wCAMuB;AALrB,oGAAA,UAAU,OAAA;AACV,wGAAA,cAAc,OAAA;AACd,4GAAA,kBAAkB,OAAA;AAClB,uGAAA,aAAa,OAAA;AACb,wGAAA,cAAc,OAAA;AAGhB,+EAA+E;AAC/E,4CAAsE;AAA7D,wGAAA,cAAc,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAC1C,oDAAuG;AAA9F,8GAAA,gBAAgB,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAAE,wGAAA,UAAU,OAAA;AAAE,4GAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type MachineOperationStatus = "complete" | "in-progress" | "blocked" | "requires-human" | "unsafe" | "failed";
|
|
2
|
+
export interface MachineNextAction {
|
|
3
|
+
command: string;
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MachineSuccessResponse<TData> {
|
|
7
|
+
ok: true;
|
|
8
|
+
command: string;
|
|
9
|
+
status?: MachineOperationStatus;
|
|
10
|
+
nextActions?: MachineNextAction[];
|
|
11
|
+
data: TData;
|
|
12
|
+
}
|
|
13
|
+
export interface MachineErrorResponse {
|
|
14
|
+
ok: false;
|
|
15
|
+
command: string;
|
|
16
|
+
status?: MachineOperationStatus;
|
|
17
|
+
error: {
|
|
18
|
+
code: string;
|
|
19
|
+
message: string;
|
|
20
|
+
details?: unknown;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export type MachineResponse<TData> = MachineSuccessResponse<TData> | MachineErrorResponse;
|
|
24
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/machine/contracts.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAC9B,UAAU,GACV,aAAa,GACb,SAAS,GACT,gBAAgB,GAChB,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB,CAAC,KAAK;IAC3C,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,IAAI,EAAE,KAAK,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,KAAK,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI,sBAAsB,CAAC,KAAK,CAAC,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/machine/contracts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MachineOperationStatus } from "./contracts";
|
|
2
|
+
export declare class MachineCommandError extends Error {
|
|
3
|
+
readonly code: string;
|
|
4
|
+
readonly details?: unknown;
|
|
5
|
+
readonly status?: MachineOperationStatus;
|
|
6
|
+
constructor(code: string, message: string, details?: unknown, status?: MachineOperationStatus);
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveMachineErrorStatus(error: unknown): MachineOperationStatus;
|
|
9
|
+
export declare function toMachineError(error: unknown): {
|
|
10
|
+
code: string;
|
|
11
|
+
message: string;
|
|
12
|
+
details?: unknown;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/machine/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,sBAAsB,CAAC;gBAE7B,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,sBAAsB;CAO9F;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAKhF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAqBnG"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MachineCommandError = void 0;
|
|
4
|
+
exports.resolveMachineErrorStatus = resolveMachineErrorStatus;
|
|
5
|
+
exports.toMachineError = toMachineError;
|
|
6
|
+
class MachineCommandError extends Error {
|
|
7
|
+
constructor(code, message, details, status) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "MachineCommandError";
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.details = details;
|
|
12
|
+
this.status = status;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.MachineCommandError = MachineCommandError;
|
|
16
|
+
function resolveMachineErrorStatus(error) {
|
|
17
|
+
if (error instanceof MachineCommandError && error.status) {
|
|
18
|
+
return error.status;
|
|
19
|
+
}
|
|
20
|
+
return "failed";
|
|
21
|
+
}
|
|
22
|
+
function toMachineError(error) {
|
|
23
|
+
if (error instanceof MachineCommandError) {
|
|
24
|
+
return {
|
|
25
|
+
code: error.code,
|
|
26
|
+
message: error.message,
|
|
27
|
+
...(error.details === undefined ? {} : { details: error.details }),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (error instanceof Error) {
|
|
31
|
+
return {
|
|
32
|
+
code: "internal-error",
|
|
33
|
+
message: error.message,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
code: "internal-error",
|
|
38
|
+
message: "Unknown error",
|
|
39
|
+
details: error,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/machine/errors.ts"],"names":[],"mappings":";;;AAgBA,8DAKC;AAED,wCAqBC;AA1CD,MAAa,mBAAoB,SAAQ,KAAK;IAK5C,YAAY,IAAY,EAAE,OAAe,EAAE,OAAiB,EAAE,MAA+B;QAC3F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAZD,kDAYC;AAED,SAAgB,yBAAyB,CAAC,KAAc;IACtD,IAAI,KAAK,YAAY,mBAAmB,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC,MAAM,CAAC;IACtB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAgB,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;QACzC,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;SACnE,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,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