swallowkit 1.0.0-beta.9 → 1.0.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.
- package/README.ja.md +87 -181
- package/README.md +87 -238
- 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 +27 -0
- package/dist/cli/commands/dev-seeds.d.ts.map +1 -1
- package/dist/cli/commands/dev-seeds.js +188 -6
- package/dist/cli/commands/dev-seeds.js.map +1 -1
- package/dist/cli/commands/dev.d.ts +30 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +495 -129
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/init.d.ts +69 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +788 -766
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/scaffold.d.ts +24 -3
- package/dist/cli/commands/scaffold.d.ts.map +1 -1
- package/dist/cli/commands/scaffold.js +408 -189
- 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 -58
- package/dist/cli/index.js.map +1 -1
- package/dist/core/config.d.ts +13 -3
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +151 -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 +4 -3
- package/dist/core/scaffold/functions-generator.d.ts.map +1 -1
- package/dist/core/scaffold/functions-generator.js +405 -134
- package/dist/core/scaffold/functions-generator.js.map +1 -1
- package/dist/core/scaffold/model-parser.d.ts +20 -0
- package/dist/core/scaffold/model-parser.d.ts.map +1 -1
- package/dist/core/scaffold/model-parser.js +229 -78
- 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 +152 -8
- package/dist/core/scaffold/nextjs-generator.js.map +1 -1
- 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/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 +105 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/package-manager.d.ts +7 -11
- package/dist/utils/package-manager.d.ts.map +1 -1
- package/dist/utils/package-manager.js +42 -17
- 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 +15 -17
- package/src/__tests__/__snapshots__/functions-generator.test.ts.snap +716 -22
- package/src/__tests__/__snapshots__/nextjs-generator.test.ts.snap +19 -7
- package/src/__tests__/__snapshots__/ui-generator.test.ts.snap +20 -12
- 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 +176 -3
- 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 +124 -0
- package/src/__tests__/dev.test.ts +254 -0
- package/src/__tests__/file-session.test.ts +98 -0
- package/src/__tests__/fixtures.ts +101 -0
- package/src/__tests__/functions-generator.test.ts +137 -1
- package/src/__tests__/init.test.ts +366 -2
- 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 +8 -0
- package/src/__tests__/package-manager.test.ts +59 -4
- package/src/__tests__/plan-apply.test.ts +499 -0
- package/src/__tests__/python-uv.test.ts +48 -0
- package/src/__tests__/scaffold.test.ts +287 -24
- package/src/__tests__/tsconfig.json +15 -0
- package/src/__tests__/ui-generator.test.ts +104 -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 +21 -100
- package/src/cli/commands/dev-seeds.ts +278 -7
- package/src/cli/commands/dev.ts +607 -160
- package/src/cli/commands/init.ts +851 -786
- package/src/cli/commands/scaffold.ts +531 -236
- package/src/cli/index.ts +338 -60
- package/src/core/config.ts +145 -9
- 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 +432 -134
- package/src/core/scaffold/model-parser.ts +244 -90
- package/src/core/scaffold/native-schema-generator.ts +904 -0
- package/src/core/scaffold/nextjs-generator.ts +174 -9
- package/src/core/scaffold/ui-generator.ts +191 -36
- package/src/core/verify/index.ts +468 -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 +137 -0
- package/src/utils/package-manager.ts +41 -19
- package/src/utils/python-uv.ts +96 -0
- package/src/version.ts +13 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Artifact Ledger — `.swallowkit/artifacts.json`
|
|
4
|
+
*
|
|
5
|
+
* SwallowKit が生成・管理するファイルの所有権(Ownership)、内容ハッシュ、
|
|
6
|
+
* 生成元スキーマのハッシュ、Generator バージョンを記録する台帳。
|
|
7
|
+
* Git 管理を前提とし、Drift 検出と Plan の衝突判定の基礎データとなる。
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.SWALLOWKIT_ARTIFACTS_VERSION = exports.SWALLOWKIT_ARTIFACTS_PATH = void 0;
|
|
44
|
+
exports.loadArtifactLedger = loadArtifactLedger;
|
|
45
|
+
exports.saveArtifactLedger = saveArtifactLedger;
|
|
46
|
+
exports.findArtifactRecord = findArtifactRecord;
|
|
47
|
+
exports.recordSessionOperations = recordSessionOperations;
|
|
48
|
+
exports.inspectArtifacts = inspectArtifacts;
|
|
49
|
+
const fs = __importStar(require("fs"));
|
|
50
|
+
const path = __importStar(require("path"));
|
|
51
|
+
const version_1 = require("../../version");
|
|
52
|
+
const file_session_1 = require("../operations/file-session");
|
|
53
|
+
exports.SWALLOWKIT_ARTIFACTS_PATH = path.join(".swallowkit", "artifacts.json");
|
|
54
|
+
exports.SWALLOWKIT_ARTIFACTS_VERSION = 1;
|
|
55
|
+
function loadArtifactLedger(projectRoot = process.cwd()) {
|
|
56
|
+
const ledgerPath = path.join(projectRoot, exports.SWALLOWKIT_ARTIFACTS_PATH);
|
|
57
|
+
if (!fs.existsSync(ledgerPath)) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(fs.readFileSync(ledgerPath, "utf-8"));
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function saveArtifactLedger(ledger, projectRoot = process.cwd()) {
|
|
68
|
+
const ledgerPath = path.join(projectRoot, exports.SWALLOWKIT_ARTIFACTS_PATH);
|
|
69
|
+
fs.mkdirSync(path.dirname(ledgerPath), { recursive: true });
|
|
70
|
+
const sorted = {
|
|
71
|
+
...ledger,
|
|
72
|
+
swallowkitVersion: (0, version_1.getSwallowKitVersion)(),
|
|
73
|
+
artifacts: [...ledger.artifacts].sort((a, b) => a.path.localeCompare(b.path)),
|
|
74
|
+
};
|
|
75
|
+
fs.writeFileSync(ledgerPath, JSON.stringify(sorted, null, 2) + "\n", "utf-8");
|
|
76
|
+
}
|
|
77
|
+
function findArtifactRecord(ledger, relativePath) {
|
|
78
|
+
return ledger?.artifacts.find((record) => record.path === relativePath);
|
|
79
|
+
}
|
|
80
|
+
function toLastOperation(action) {
|
|
81
|
+
switch (action) {
|
|
82
|
+
case "create":
|
|
83
|
+
return "create";
|
|
84
|
+
case "modify":
|
|
85
|
+
return "update";
|
|
86
|
+
case "append":
|
|
87
|
+
return "append";
|
|
88
|
+
case "delete":
|
|
89
|
+
return "delete";
|
|
90
|
+
default:
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* セッションで記録された操作を台帳へ反映する。
|
|
96
|
+
* - skip は台帳更新しない(既存記録があれば schemaHash のみ更新)
|
|
97
|
+
* - delete は台帳からレコードを削除する
|
|
98
|
+
*/
|
|
99
|
+
function recordSessionOperations(operations, context = {}, projectRoot = process.cwd()) {
|
|
100
|
+
const ledger = loadArtifactLedger(projectRoot) ?? {
|
|
101
|
+
version: exports.SWALLOWKIT_ARTIFACTS_VERSION,
|
|
102
|
+
swallowkitVersion: (0, version_1.getSwallowKitVersion)(),
|
|
103
|
+
artifacts: [],
|
|
104
|
+
};
|
|
105
|
+
const byPath = new Map(ledger.artifacts.map((record) => [record.path, record]));
|
|
106
|
+
const now = new Date().toISOString();
|
|
107
|
+
const generatorVersion = (0, version_1.getSwallowKitVersion)();
|
|
108
|
+
for (const operation of operations) {
|
|
109
|
+
if (operation.action === "delete") {
|
|
110
|
+
byPath.delete(operation.path);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (operation.action === "skip") {
|
|
114
|
+
const existing = byPath.get(operation.path);
|
|
115
|
+
if (existing && context.schemaHash) {
|
|
116
|
+
existing.schemaHash = context.schemaHash;
|
|
117
|
+
existing.generatorVersion = generatorVersion;
|
|
118
|
+
}
|
|
119
|
+
else if (!existing && operation.newHash) {
|
|
120
|
+
// 内容一致でも台帳未登録なら記録し、以後の Drift 検出を可能にする
|
|
121
|
+
byPath.set(operation.path, {
|
|
122
|
+
path: operation.path,
|
|
123
|
+
ownership: operation.ownership,
|
|
124
|
+
generator: operation.generator,
|
|
125
|
+
generatorVersion,
|
|
126
|
+
sourceModel: operation.sourceModel ?? context.sourceModel,
|
|
127
|
+
schemaHash: context.schemaHash,
|
|
128
|
+
contentHash: operation.newHash,
|
|
129
|
+
generatedAt: now,
|
|
130
|
+
lastOperation: "update",
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const lastOperation = toLastOperation(operation.action);
|
|
136
|
+
if (!lastOperation || !operation.newHash) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
byPath.set(operation.path, {
|
|
140
|
+
path: operation.path,
|
|
141
|
+
ownership: operation.ownership,
|
|
142
|
+
generator: operation.generator,
|
|
143
|
+
generatorVersion,
|
|
144
|
+
sourceModel: operation.sourceModel ?? context.sourceModel,
|
|
145
|
+
schemaHash: context.schemaHash,
|
|
146
|
+
contentHash: operation.newHash,
|
|
147
|
+
generatedAt: now,
|
|
148
|
+
lastOperation,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
const updated = {
|
|
152
|
+
version: exports.SWALLOWKIT_ARTIFACTS_VERSION,
|
|
153
|
+
swallowkitVersion: generatorVersion,
|
|
154
|
+
artifacts: Array.from(byPath.values()),
|
|
155
|
+
};
|
|
156
|
+
saveArtifactLedger(updated, projectRoot);
|
|
157
|
+
return updated;
|
|
158
|
+
}
|
|
159
|
+
function inspectArtifacts(projectRoot = process.cwd()) {
|
|
160
|
+
const ledger = loadArtifactLedger(projectRoot);
|
|
161
|
+
if (!ledger) {
|
|
162
|
+
return { ledgerFound: false, swallowkitVersion: null, artifacts: [] };
|
|
163
|
+
}
|
|
164
|
+
const artifacts = ledger.artifacts.map((record) => {
|
|
165
|
+
const absolutePath = path.join(projectRoot, record.path);
|
|
166
|
+
const currentHash = (0, file_session_1.hashFileIfExists)(absolutePath);
|
|
167
|
+
return {
|
|
168
|
+
...record,
|
|
169
|
+
exists: currentHash !== null,
|
|
170
|
+
modified: currentHash !== null && currentHash !== record.contentHash,
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
return {
|
|
174
|
+
ledgerFound: true,
|
|
175
|
+
swallowkitVersion: ledger.swallowkitVersion,
|
|
176
|
+
artifacts: artifacts.sort((a, b) => a.path.localeCompare(b.path)),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../src/core/project/artifacts.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCH,gDAWC;AAED,gDASC;AAED,gDAKC;AA6BD,0DAoEC;AAQD,4CAyBC;AApMD,uCAAyB;AACzB,2CAA6B;AAC7B,2CAAqD;AACrD,6DAIoC;AAEvB,QAAA,yBAAyB,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AACvE,QAAA,4BAA4B,GAAG,CAAC,CAAC;AA2B9C,SAAgB,kBAAkB,CAAC,cAAsB,OAAO,CAAC,GAAG,EAAE;IACpE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,iCAAyB,CAAC,CAAC;IACrE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAmB,CAAC;IAC5E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAAC,MAAsB,EAAE,cAAsB,OAAO,CAAC,GAAG,EAAE;IAC5F,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,iCAAyB,CAAC,CAAC;IACrE,EAAE,CAAC,SAAS,CAAC,IAAI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C,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACzD,MAAM,WAAW,GAAG,IAAA,+BAAgB,EAAC,YAAY,CAAC,CAAC;QACnD,OAAO;YACL,GAAG,MAAM;YACT,MAAM,EAAE,WAAW,KAAK,IAAI;YAC5B,QAAQ,EAAE,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,MAAM,CAAC,WAAW;SACrE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,WAAW,EAAE,IAAI;QACjB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KAClE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsibility Boundaries — AI の自由生成と SwallowKit の決定論的処理の責任分界点。
|
|
3
|
+
*
|
|
4
|
+
* Coding Agent / 自律ループが「どこを自由に書いてよいか」「どこは SwallowKit の
|
|
5
|
+
* plan/apply に委ねるべきか」を機械可読な契約として取得できるようにする。
|
|
6
|
+
*
|
|
7
|
+
* zone:
|
|
8
|
+
* - deterministic: SwallowKit が決定論的に生成・再生成する領域。手編集しない。
|
|
9
|
+
* - ai-authored: AI / 開発者が自由に記述する領域。SwallowKit は上書きしない。
|
|
10
|
+
* - shared: マーカー区切りの共有領域。マーカー内は SwallowKit、外は自由。
|
|
11
|
+
*/
|
|
12
|
+
import { ArtifactOwnership } from "../operations/file-session";
|
|
13
|
+
export type BoundaryZone = "deterministic" | "ai-authored" | "shared";
|
|
14
|
+
export type BoundaryEditPolicy = "never-hand-edit" | "regenerate-via-plan-apply" | "free-edit" | "edit-outside-markers";
|
|
15
|
+
export interface OwnershipPolicy {
|
|
16
|
+
ownership: ArtifactOwnership;
|
|
17
|
+
zone: BoundaryZone;
|
|
18
|
+
editPolicy: BoundaryEditPolicy;
|
|
19
|
+
howToChange: string;
|
|
20
|
+
}
|
|
21
|
+
export interface BoundaryPathRule {
|
|
22
|
+
/** Path prefix or glob-like pattern (documentation purpose; matching is prefix-based) */
|
|
23
|
+
pattern: string;
|
|
24
|
+
zone: BoundaryZone;
|
|
25
|
+
editPolicy: BoundaryEditPolicy;
|
|
26
|
+
description: string;
|
|
27
|
+
}
|
|
28
|
+
export interface BoundaryArtifact {
|
|
29
|
+
path: string;
|
|
30
|
+
ownership: ArtifactOwnership;
|
|
31
|
+
zone: BoundaryZone;
|
|
32
|
+
editPolicy: BoundaryEditPolicy;
|
|
33
|
+
generator: string;
|
|
34
|
+
sourceModel?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface BoundariesContract {
|
|
37
|
+
contractVersion: number;
|
|
38
|
+
summary: string;
|
|
39
|
+
ownershipPolicies: OwnershipPolicy[];
|
|
40
|
+
/** 台帳に載っていないパスの既定規約 */
|
|
41
|
+
conventionRules: BoundaryPathRule[];
|
|
42
|
+
/** 台帳に記録された生成物ごとの解決結果 */
|
|
43
|
+
artifacts: BoundaryArtifact[];
|
|
44
|
+
guidance: string[];
|
|
45
|
+
}
|
|
46
|
+
export declare const OWNERSHIP_POLICIES: OwnershipPolicy[];
|
|
47
|
+
export declare const CONVENTION_RULES: BoundaryPathRule[];
|
|
48
|
+
export declare const BOUNDARY_GUIDANCE: string[];
|
|
49
|
+
export declare function inspectBoundaries(projectRoot?: string): BoundariesContract;
|
|
50
|
+
//# sourceMappingURL=boundaries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../../../src/core/project/boundaries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,aAAa,GAAG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
3
|
+
* Responsibility Boundaries — AI の自由生成と SwallowKit の決定論的処理の責任分界点。
|
|
4
|
+
*
|
|
5
|
+
* Coding Agent / 自律ループが「どこを自由に書いてよいか」「どこは SwallowKit の
|
|
6
|
+
* plan/apply に委ねるべきか」を機械可読な契約として取得できるようにする。
|
|
7
|
+
*
|
|
8
|
+
* zone:
|
|
9
|
+
* - deterministic: SwallowKit が決定論的に生成・再生成する領域。手編集しない。
|
|
10
|
+
* - ai-authored: AI / 開発者が自由に記述する領域。SwallowKit は上書きしない。
|
|
11
|
+
* - shared: マーカー区切りの共有領域。マーカー内は SwallowKit、外は自由。
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.BOUNDARY_GUIDANCE = exports.CONVENTION_RULES = exports.OWNERSHIP_POLICIES = void 0;
|
|
15
|
+
exports.inspectBoundaries = inspectBoundaries;
|
|
16
|
+
const artifacts_1 = require("./artifacts");
|
|
17
|
+
exports.OWNERSHIP_POLICIES = [
|
|
18
|
+
{
|
|
19
|
+
ownership: "managed",
|
|
20
|
+
zone: "deterministic",
|
|
21
|
+
editPolicy: "regenerate-via-plan-apply",
|
|
22
|
+
howToChange: "Edit the source model (shared/models/*.ts) or configuration, then run `swallowkit machine plan scaffold <model>` and `apply scaffold`. Hand-edits are detected as drift and require --approve to overwrite.",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
ownership: "generated-once",
|
|
26
|
+
zone: "ai-authored",
|
|
27
|
+
editPolicy: "free-edit",
|
|
28
|
+
howToChange: "Generated once as a starting point. Edit freely; SwallowKit never regenerates it.",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
ownership: "user-owned",
|
|
32
|
+
zone: "ai-authored",
|
|
33
|
+
editPolicy: "free-edit",
|
|
34
|
+
howToChange: "Owned by the developer/AI. SwallowKit only creates the initial version (e.g. model files). Edit freely; managed artifacts are regenerated from it.",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
ownership: "extension-point",
|
|
38
|
+
zone: "shared",
|
|
39
|
+
editPolicy: "edit-outside-markers",
|
|
40
|
+
howToChange: "SwallowKit appends only inside marked sections (e.g. `# SwallowKit scaffold registrations`). Edit anywhere outside the markers freely; do not remove the markers.",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
ownership: "metadata",
|
|
44
|
+
zone: "deterministic",
|
|
45
|
+
editPolicy: "never-hand-edit",
|
|
46
|
+
howToChange: "Managed entirely by SwallowKit tooling (.swallowkit/). Never hand-edit.",
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
exports.CONVENTION_RULES = [
|
|
50
|
+
{
|
|
51
|
+
pattern: ".swallowkit/",
|
|
52
|
+
zone: "deterministic",
|
|
53
|
+
editPolicy: "never-hand-edit",
|
|
54
|
+
description: "SwallowKit metadata (manifest, artifact ledger, plan state). Managed by tooling only.",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
pattern: "shared/models/",
|
|
58
|
+
zone: "ai-authored",
|
|
59
|
+
editPolicy: "free-edit",
|
|
60
|
+
description: "Zod model schemas — the single source of truth. AI/developers author these freely; deterministic generation derives everything else from them.",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
pattern: "infra/main.bicep",
|
|
64
|
+
zone: "shared",
|
|
65
|
+
editPolicy: "edit-outside-markers",
|
|
66
|
+
description: "SwallowKit inserts container modules; other infrastructure edits are free.",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
pattern: "functions/function_app.py",
|
|
70
|
+
zone: "shared",
|
|
71
|
+
editPolicy: "edit-outside-markers",
|
|
72
|
+
description: "SwallowKit appends blueprint registrations under its marker; other edits are free.",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
pattern: "shared/index.ts",
|
|
76
|
+
zone: "shared",
|
|
77
|
+
editPolicy: "edit-outside-markers",
|
|
78
|
+
description: "SwallowKit appends model exports; other exports may be added freely.",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
pattern: "*",
|
|
82
|
+
zone: "ai-authored",
|
|
83
|
+
editPolicy: "free-edit",
|
|
84
|
+
description: "Any path not recorded in the artifact ledger is AI/developer-authored. Business logic, custom pages, custom Functions, and tests belong here.",
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
const POLICY_BY_OWNERSHIP = new Map(exports.OWNERSHIP_POLICIES.map((policy) => [policy.ownership, policy]));
|
|
88
|
+
exports.BOUNDARY_GUIDANCE = [
|
|
89
|
+
"Author models and business logic freely (ai-authored zone), then let SwallowKit derive CRUD/BFF/UI/infra deterministically via plan/apply.",
|
|
90
|
+
"Never hand-edit deterministic-zone files; change the model or configuration and regenerate instead.",
|
|
91
|
+
"Use `swallowkit machine plan scaffold <model>` before applying; a plan with requiresApproval=true means a human (or explicit --approve) must confirm overwriting hand-edited files.",
|
|
92
|
+
"In shared-zone files, keep SwallowKit markers intact and edit outside them.",
|
|
93
|
+
"Run `swallowkit machine verify project` after applying changes; use `explain failure` to get repair evidence.",
|
|
94
|
+
];
|
|
95
|
+
function inspectBoundaries(projectRoot = process.cwd()) {
|
|
96
|
+
const inspected = (0, artifacts_1.inspectArtifacts)(projectRoot);
|
|
97
|
+
const artifacts = inspected.artifacts.map((artifact) => {
|
|
98
|
+
const policy = POLICY_BY_OWNERSHIP.get(artifact.ownership);
|
|
99
|
+
return {
|
|
100
|
+
path: artifact.path,
|
|
101
|
+
ownership: artifact.ownership,
|
|
102
|
+
zone: policy?.zone ?? "ai-authored",
|
|
103
|
+
editPolicy: policy?.editPolicy ?? "free-edit",
|
|
104
|
+
generator: artifact.generator,
|
|
105
|
+
...(artifact.sourceModel ? { sourceModel: artifact.sourceModel } : {}),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
contractVersion: 1,
|
|
110
|
+
summary: "SwallowKit separates deterministic generation (models → CRUD/BFF/UI/infra via plan/apply) from AI free-form authoring (models, business logic, custom code). This contract tells agents which files belong to which side.",
|
|
111
|
+
ownershipPolicies: exports.OWNERSHIP_POLICIES,
|
|
112
|
+
conventionRules: exports.CONVENTION_RULES,
|
|
113
|
+
artifacts,
|
|
114
|
+
guidance: exports.BOUNDARY_GUIDANCE,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=boundaries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundaries.js","sourceRoot":"","sources":["../../../src/core/project/boundaries.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAuIH,8CAwBC;AA5JD,2CAA+C;AA6ClC,QAAA,kBAAkB,GAAsB;IACnD;QACE,SAAS,EAAE,SAAS;QACpB,IAAI,EAAE,eAAe;QACrB,UAAU,EAAE,2BAA2B;QACvC,WAAW,EACT,6MAA6M;KAChN;IACD;QACE,SAAS,EAAE,gBAAgB;QAC3B,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,WAAW;QACvB,WAAW,EAAE,mFAAmF;KACjG;IACD;QACE,SAAS,EAAE,YAAY;QACvB,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,WAAW;QACvB,WAAW,EACT,oJAAoJ;KACvJ;IACD;QACE,SAAS,EAAE,iBAAiB;QAC5B,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,sBAAsB;QAClC,WAAW,EACT,mKAAmK;KACtK;IACD;QACE,SAAS,EAAE,UAAU;QACrB,IAAI,EAAE,eAAe;QACrB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,yEAAyE;KACvF;CACF,CAAC;AAEW,QAAA,gBAAgB,GAAuB;IAClD;QACE,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,eAAe;QACrB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,uFAAuF;KACrG;IACD;QACE,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,WAAW;QACvB,WAAW,EACT,gJAAgJ;KACnJ;IACD;QACE,OA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,SAAS;YAC7B,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,eAAe,EAAE,CAAC;QAClB,OAAO,EACL,2NAA2N;QAC7N,iBAAiB,EAAE,0BAAkB;QACrC,eAAe,EAAE,wBAAgB;QACjC,SAAS;QACT,QAAQ,EAAE,yBAAiB;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capabilities — 「SwallowKit に何ができるか」の機械可読な自己記述。
|
|
3
|
+
*
|
|
4
|
+
* inspect project/boundaries/infra が「今の状態」を返すのに対し、
|
|
5
|
+
* inspect capabilities は「モデルで宣言できるもの・認証の正しい導入手順・
|
|
6
|
+
* 生成 CRUD の守備範囲・シード適用方法」など、状態に依存しない
|
|
7
|
+
* フレームワーク仕様を返す。Coding Agent がドキュメント外の知識を
|
|
8
|
+
* 推測で埋めるのを構造的に防ぐことが目的。
|
|
9
|
+
*/
|
|
10
|
+
export interface CapabilityModelDeclaration {
|
|
11
|
+
name: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
description: string;
|
|
14
|
+
format: string;
|
|
15
|
+
notes?: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface CapabilityAuthProvider {
|
|
18
|
+
provider: string;
|
|
19
|
+
description: string;
|
|
20
|
+
postApplySteps: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface CapabilitiesContract {
|
|
23
|
+
contractVersion: number;
|
|
24
|
+
swallowkitVersion: string;
|
|
25
|
+
modelDeclarations: CapabilityModelDeclaration[];
|
|
26
|
+
authentication: {
|
|
27
|
+
correctWorkflow: string[];
|
|
28
|
+
rules: string[];
|
|
29
|
+
providers: CapabilityAuthProvider[];
|
|
30
|
+
authorizationPolicies: {
|
|
31
|
+
semantics: string;
|
|
32
|
+
configExample: string;
|
|
33
|
+
handEditAllowed: boolean;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
generatedCrud: {
|
|
37
|
+
guarantees: string[];
|
|
38
|
+
notGuaranteed: string[];
|
|
39
|
+
guidance: string[];
|
|
40
|
+
};
|
|
41
|
+
sharedModels: {
|
|
42
|
+
idFieldRule: string;
|
|
43
|
+
buildNote: string;
|
|
44
|
+
};
|
|
45
|
+
seeding: {
|
|
46
|
+
createTemplates: string;
|
|
47
|
+
applySeeds: string;
|
|
48
|
+
notes: string[];
|
|
49
|
+
};
|
|
50
|
+
machineCommands: string[];
|
|
51
|
+
verifyChecks: {
|
|
52
|
+
defaultChecks: string[];
|
|
53
|
+
optInChecks: string[];
|
|
54
|
+
customChecks: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export declare function inspectCapabilities(): CapabilitiesContract;
|
|
58
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/core/project/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,0BAA0B,EAAE,CAAC;IAChD,cAAc,EAAE;QACd,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,SAAS,EAAE,sBAAsB,EAAE,CAAC;QACpC,qBAAqB,EAAE;YACrB,SAAS,EAAE,MAAM,CAAC;YAClB,aAAa,EAAE,MAAM,CAAC;YACtB,eAAe,EAAE,OAAO,CAAC;SAC1B,CAAC;KACH,CAAC;IACF,aAAa,EAAE;QACb,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,YAAY,EAAE;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,OAAO,EAAE;QACP,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IACF,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,EAAE;QACZ,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,wBAAgB,mBAAmB,IAAI,oBAAoB,CAkI1D"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capabilities — 「SwallowKit に何ができるか」の機械可読な自己記述。
|
|
4
|
+
*
|
|
5
|
+
* inspect project/boundaries/infra が「今の状態」を返すのに対し、
|
|
6
|
+
* inspect capabilities は「モデルで宣言できるもの・認証の正しい導入手順・
|
|
7
|
+
* 生成 CRUD の守備範囲・シード適用方法」など、状態に依存しない
|
|
8
|
+
* フレームワーク仕様を返す。Coding Agent がドキュメント外の知識を
|
|
9
|
+
* 推測で埋めるのを構造的に防ぐことが目的。
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.inspectCapabilities = inspectCapabilities;
|
|
13
|
+
const version_1 = require("../../version");
|
|
14
|
+
function inspectCapabilities() {
|
|
15
|
+
return {
|
|
16
|
+
contractVersion: 1,
|
|
17
|
+
swallowkitVersion: (0, version_1.getSwallowKitVersion)(),
|
|
18
|
+
modelDeclarations: [
|
|
19
|
+
{
|
|
20
|
+
name: "schema",
|
|
21
|
+
required: true,
|
|
22
|
+
description: "Zod object schema; the schema constant and the inferred type share the same PascalCase name. `id` MUST be a required string — generated CRUD, UI, and repositories assume it is always present. Only `createdAt` / `updatedAt` are optional (backend-managed).",
|
|
23
|
+
format: "export const Todo = z.object({ id: z.string(), title: z.string().min(1), createdAt: z.string().optional(), updatedAt: z.string().optional() });\nexport type Todo = z.infer<typeof Todo>;",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "displayName",
|
|
27
|
+
required: false,
|
|
28
|
+
description: "Human-readable name used by generated UI. Defaults to the model name.",
|
|
29
|
+
format: "export const displayName = 'Todo';",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "partitionKey",
|
|
33
|
+
required: false,
|
|
34
|
+
description: "Cosmos DB partition key path for the generated container. Must start with '/' and reference a field that exists in the schema. Defaults to '/id'.",
|
|
35
|
+
format: "export const partitionKey = '/learnerId';",
|
|
36
|
+
notes: ["The referenced field (e.g. learnerId) must be declared in the Zod schema."],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "authPolicy",
|
|
40
|
+
required: false,
|
|
41
|
+
description: "Role-based access control metadata applied to the generated CRUD Functions. `roles` guards all operations; `read`/`write` guard per-operation; `policy` references a named authorization policy from swallowkit.config auth.authorization.policies.",
|
|
42
|
+
format: "export const authPolicy = { roles: ['admin'] };\n// or per-operation:\nexport const authPolicy = { read: ['user'], write: ['admin'] };\n// or a named policy:\nexport const authPolicy = { policy: 'adminOnly' };",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "connectorConfig",
|
|
46
|
+
required: false,
|
|
47
|
+
description: "Binds the model to a configured external connector (RDB / API) instead of Cosmos DB. The connector must exist in swallowkit.config connectors.",
|
|
48
|
+
format: "export const connectorConfig = {\n connector: 'mysql',\n table: 'todos',\n operations: ['list', 'get', 'create', 'update', 'delete'],\n};",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
authentication: {
|
|
52
|
+
correctWorkflow: [
|
|
53
|
+
"1. plan auth --provider <custom-jwt|swa|external-token> [--scheme <name>] [--allowed-providers <csv>] — computes the change plan; SwallowKit writes auth.schemes into swallowkit.config for you.",
|
|
54
|
+
"2. apply auth --plan <planId> — generates auth code and appends the scheme to swallowkit.config.",
|
|
55
|
+
"3. Hand-edit swallowkit.config auth.authorization.policies to define named policies (the config is an extension point; this edit is expected).",
|
|
56
|
+
"4. For swa schemes: set swa.allowedProviders via --allowed-providers at plan time, or hand-edit it in the config after apply.",
|
|
57
|
+
"5. For external-token schemes: implement the generated verifier stub — it fails closed (throws) until implemented.",
|
|
58
|
+
"6. Re-run plan/apply scaffold for models that need auth guards, then verify project.",
|
|
59
|
+
],
|
|
60
|
+
rules: [
|
|
61
|
+
"NEVER hand-write auth.schemes entries in swallowkit.config — plan/apply auth owns them and duplicate names abort with 'already exists'.",
|
|
62
|
+
"authorization.policies and swa.allowedProviders ARE hand-edited after apply (extension-point edits).",
|
|
63
|
+
"Verifier stubs pass typecheck and verify; a passing verify does NOT mean external-token auth works end-to-end.",
|
|
64
|
+
],
|
|
65
|
+
providers: [
|
|
66
|
+
{
|
|
67
|
+
provider: "custom-jwt",
|
|
68
|
+
description: "Login/logout/me endpoints backed by an RDB user table, bcrypt password check, HS256 JWT.",
|
|
69
|
+
postApplySteps: ["Set JWT_SECRET in functions/local.settings.json.", "Ensure the user table matches auth.customJwt config."],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
provider: "swa",
|
|
73
|
+
description: "Azure Static Web Apps built-in auth (EasyAuth). Principal arrives via x-ms-client-principal.",
|
|
74
|
+
postApplySteps: [
|
|
75
|
+
"Set swa.allowedProviders (e.g. ['github']) via --allowed-providers or by hand-editing the config; generated login URLs use the first entry.",
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
provider: "external-token",
|
|
80
|
+
description: "Bearer tokens issued by an external IdP (LINE, Auth0, ...). SwallowKit generates a fail-closed verifier stub.",
|
|
81
|
+
postApplySteps: [
|
|
82
|
+
"Implement the generated verifier (extension point / generated-once; edit freely).",
|
|
83
|
+
"Implement the frontend token adapter (lib/auth/**/token-adapter.ts).",
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
provider: "none",
|
|
88
|
+
description: "Disables authentication in the config.",
|
|
89
|
+
postApplySteps: [],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
authorizationPolicies: {
|
|
93
|
+
semantics: "A named policy lists which schemes may satisfy it and which roles are required. Generated guards call requireAuth(request, policyName). Exactly one scheme must match the presented credentials.",
|
|
94
|
+
configExample: "auth: {\n schemes: { admin: { provider: 'swa', swa: { allowedProviders: ['github'] } }, api: { provider: 'external-token' } },\n authorization: {\n defaultPolicy: 'anonymous',\n policies: {\n adminOnly: { schemes: ['admin'], roles: ['administrator'] },\n learner: { schemes: ['api'] },\n },\n },\n}",
|
|
95
|
+
handEditAllowed: true,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
generatedCrud: {
|
|
99
|
+
guarantees: [
|
|
100
|
+
"Generated CRUD endpoints enforce the model's authPolicy (authentication + role checks).",
|
|
101
|
+
"Zod validation runs before persistence.",
|
|
102
|
+
],
|
|
103
|
+
notGuaranteed: [
|
|
104
|
+
"Owner scoping: generated CRUD does NOT restrict rows to the authenticated principal. Any authenticated caller passing the policy can read/write any document.",
|
|
105
|
+
],
|
|
106
|
+
guidance: [
|
|
107
|
+
"For multi-user data where users may only touch their own records, add ai-authored custom endpoints that derive the scoping key (e.g. learnerId) from the verified principal — never from the request body — and restrict generated write endpoints to admin roles or disable them.",
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
sharedModels: {
|
|
111
|
+
idFieldRule: "id: z.string() (required). createdAt/updatedAt: z.string().optional(). The backend owns their values.",
|
|
112
|
+
buildNote: "verify typecheck resolves the shared package from its built dist/. SwallowKit rebuilds shared automatically during verify; when typechecking manually, build the shared package first (errors like \"no exported member\" usually mean a stale dist).",
|
|
113
|
+
},
|
|
114
|
+
seeding: {
|
|
115
|
+
createTemplates: "swallowkit create-dev-seeds <environment> — writes dev-seeds/<environment>/<model>.json templates.",
|
|
116
|
+
applySeeds: "swallowkit dev --seed-env <environment> — applies the seed JSON to the local Cosmos DB emulator at dev startup.",
|
|
117
|
+
notes: ["Editing dev-seeds/*.json alone does nothing; seeds are only applied via dev --seed-env."],
|
|
118
|
+
},
|
|
119
|
+
machineCommands: [
|
|
120
|
+
"inspect project | entities | routes | artifacts | boundaries | infra | drift | capabilities",
|
|
121
|
+
"validate project",
|
|
122
|
+
"generate model <names...> | generate scaffold <model>",
|
|
123
|
+
"plan scaffold <models...> | plan auth --provider <p> [--scheme <name>] [--allowed-providers <csv>] | plan provision -g <rg> --location <loc> --swa-location <loc>",
|
|
124
|
+
"apply scaffold [models...] --plan <id> [--approve] | apply auth --plan <id> [--approve] | apply provision --plan <id> --approve",
|
|
125
|
+
"verify project [--checks <ids>] [--compact]",
|
|
126
|
+
"explain failure [--check <id>]",
|
|
127
|
+
],
|
|
128
|
+
verifyChecks: {
|
|
129
|
+
defaultChecks: ["structure", "drift", "typecheck"],
|
|
130
|
+
optInChecks: ["build", "lint", "test"],
|
|
131
|
+
customChecks: "swallowkit.config verify.checks: [{ id, command, title?, timeoutMs? }]",
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/core/project/capabilities.ts"],"names":[],"mappings":";AAAA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6I;qBAC9I;iBACF;gBACD;oBACE,QAAQ,EAAE,gBAAgB;oBAC1B,WAAW,EAAE,+GAA+G;oBAC5H,cAAc,EAAE;wBACd,mFAAmF;wBACnF,sEAAsE;qBACvE;iBACF;gBACD;oBACE,QAAQ,EAAE,MAAM;oBAChB,WAAW,EAAE,wCAAwC;oBACrD,cAAc,EAAE,EAAE;iBACnB;aACF;YACD,qBAAqB,EAAE;gBACrB,SAAS,EACP,kMAAkM;gBACpM,aAAa,EACX,kUAAkU;gBACpU,eAAe,EAAE,IAAI;aACtB;SACF;QACD,aAAa,EAAE;YACb,UAAU,EAAE;gBACV,yFAAyF;gBACzF,yCAAyC;aAC1C;YACD,aAAa,EAAE;gBACb,+JAA+J;aAChK;YACD,QAAQ,EAAE;gBACR,oRAAoR;aACrR;SACF;QACD,YAAY,EAAE;YACZ,WAAW,EAAE,uGAAuG;YACpH,SAAS,EACP,uPAAuP;SAC1P;QACD,OAAO,EAAE;YACP,eAAe,EAAE,oGAAoG;YACrH,UAAU,EAAE,iHAAiH;YAC7H,KAAK,EAAE,CAAC,yFAAyF,CAAC;SACnG;QACD,eAAe,EAAE;YACf,6FAA6F;YAC7F,kBAAkB;YAClB,uDAAuD;YACvD,mKAAmK;YACnK,iIAAiI;YACjI,6CAA6C;YAC7C,gCAAgC;SACjC;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC;YAClD,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;YACtC,YAAY,EAAE,wEAAwE;SACvF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drift Detection — 生成物と現在のプロジェクト状態の乖離を検出する。
|
|
3
|
+
*
|
|
4
|
+
* 検出対象:
|
|
5
|
+
* - schema-drift: スキーマ変更後に生成物が再生成されていない
|
|
6
|
+
* - generator-drift: Generator (SwallowKit) のバージョンが生成時から変わっている
|
|
7
|
+
* - artifact-modified: 生成後にファイルが手動変更されている(再生成で失われる可能性)
|
|
8
|
+
* - artifact-missing: 台帳に記録された生成物が存在しない
|
|
9
|
+
* - manifest-drift: Manifest と実際のプロジェクト構造が一致していない
|
|
10
|
+
*/
|
|
11
|
+
export type DriftKind = "schema-drift" | "generator-drift" | "artifact-modified" | "artifact-missing" | "manifest-drift";
|
|
12
|
+
export type DriftSeverity = "error" | "warning" | "info";
|
|
13
|
+
export interface DriftFinding {
|
|
14
|
+
kind: DriftKind;
|
|
15
|
+
severity: DriftSeverity;
|
|
16
|
+
message: string;
|
|
17
|
+
path?: string;
|
|
18
|
+
entity?: string;
|
|
19
|
+
expected?: string;
|
|
20
|
+
actual?: string;
|
|
21
|
+
repairAction: string;
|
|
22
|
+
}
|
|
23
|
+
export interface DriftDetectionResult {
|
|
24
|
+
ledgerFound: boolean;
|
|
25
|
+
findings: DriftFinding[];
|
|
26
|
+
checkedArtifacts: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function detectDrift(projectRoot?: string): Promise<DriftDetectionResult>;
|
|
29
|
+
//# sourceMappingURL=drift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift.d.ts","sourceRoot":"","sources":["../../../src/core/project/drift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,MAAM,SAAS,GACjB,cAAc,GACd,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAsID,wBAAsB,WAAW,CAAC,WAAW,GAAE,MAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA0BpG"}
|