swallowkit 1.0.0-beta.8 → 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.
Files changed (272) hide show
  1. package/README.ja.md +87 -181
  2. package/README.md +87 -238
  3. package/dist/__tests__/fixtures.d.ts +12 -0
  4. package/dist/__tests__/fixtures.d.ts.map +1 -1
  5. package/dist/__tests__/fixtures.js +101 -0
  6. package/dist/__tests__/fixtures.js.map +1 -1
  7. package/dist/cli/commands/add-auth.d.ts +15 -0
  8. package/dist/cli/commands/add-auth.d.ts.map +1 -0
  9. package/dist/cli/commands/add-auth.js +790 -0
  10. package/dist/cli/commands/add-auth.js.map +1 -0
  11. package/dist/cli/commands/add-connector.d.ts +20 -0
  12. package/dist/cli/commands/add-connector.d.ts.map +1 -0
  13. package/dist/cli/commands/add-connector.js +164 -0
  14. package/dist/cli/commands/add-connector.js.map +1 -0
  15. package/dist/cli/commands/cosmos-worktree-isolation.d.ts +25 -0
  16. package/dist/cli/commands/cosmos-worktree-isolation.d.ts.map +1 -0
  17. package/dist/cli/commands/cosmos-worktree-isolation.js +124 -0
  18. package/dist/cli/commands/cosmos-worktree-isolation.js.map +1 -0
  19. package/dist/cli/commands/create-model.d.ts +1 -4
  20. package/dist/cli/commands/create-model.d.ts.map +1 -1
  21. package/dist/cli/commands/create-model.js +20 -82
  22. package/dist/cli/commands/create-model.js.map +1 -1
  23. package/dist/cli/commands/dev-seeds.d.ts +27 -0
  24. package/dist/cli/commands/dev-seeds.d.ts.map +1 -1
  25. package/dist/cli/commands/dev-seeds.js +188 -6
  26. package/dist/cli/commands/dev-seeds.js.map +1 -1
  27. package/dist/cli/commands/dev.d.ts +30 -0
  28. package/dist/cli/commands/dev.d.ts.map +1 -1
  29. package/dist/cli/commands/dev.js +495 -129
  30. package/dist/cli/commands/dev.js.map +1 -1
  31. package/dist/cli/commands/init.d.ts +70 -0
  32. package/dist/cli/commands/init.d.ts.map +1 -1
  33. package/dist/cli/commands/init.js +797 -768
  34. package/dist/cli/commands/init.js.map +1 -1
  35. package/dist/cli/commands/scaffold.d.ts +24 -3
  36. package/dist/cli/commands/scaffold.d.ts.map +1 -1
  37. package/dist/cli/commands/scaffold.js +408 -189
  38. package/dist/cli/commands/scaffold.js.map +1 -1
  39. package/dist/cli/index.d.ts +5 -1
  40. package/dist/cli/index.d.ts.map +1 -1
  41. package/dist/cli/index.js +335 -58
  42. package/dist/cli/index.js.map +1 -1
  43. package/dist/core/config.d.ts +13 -3
  44. package/dist/core/config.d.ts.map +1 -1
  45. package/dist/core/config.js +151 -8
  46. package/dist/core/config.js.map +1 -1
  47. package/dist/core/mock/connector-mock-server.d.ts +101 -0
  48. package/dist/core/mock/connector-mock-server.d.ts.map +1 -0
  49. package/dist/core/mock/connector-mock-server.js +480 -0
  50. package/dist/core/mock/connector-mock-server.js.map +1 -0
  51. package/dist/core/mock/zod-mock-generator.d.ts +14 -0
  52. package/dist/core/mock/zod-mock-generator.d.ts.map +1 -0
  53. package/dist/core/mock/zod-mock-generator.js +163 -0
  54. package/dist/core/mock/zod-mock-generator.js.map +1 -0
  55. package/dist/core/operations/auth-operations.d.ts +61 -0
  56. package/dist/core/operations/auth-operations.d.ts.map +1 -0
  57. package/dist/core/operations/auth-operations.js +272 -0
  58. package/dist/core/operations/auth-operations.js.map +1 -0
  59. package/dist/core/operations/create-model.d.ts +15 -0
  60. package/dist/core/operations/create-model.d.ts.map +1 -0
  61. package/dist/core/operations/create-model.js +185 -0
  62. package/dist/core/operations/create-model.js.map +1 -0
  63. package/dist/core/operations/file-session.d.ts +56 -0
  64. package/dist/core/operations/file-session.d.ts.map +1 -0
  65. package/dist/core/operations/file-session.js +203 -0
  66. package/dist/core/operations/file-session.js.map +1 -0
  67. package/dist/core/operations/provision-operations.d.ts +52 -0
  68. package/dist/core/operations/provision-operations.d.ts.map +1 -0
  69. package/dist/core/operations/provision-operations.js +211 -0
  70. package/dist/core/operations/provision-operations.js.map +1 -0
  71. package/dist/core/operations/runtime.d.ts +37 -0
  72. package/dist/core/operations/runtime.d.ts.map +1 -0
  73. package/dist/core/operations/runtime.js +248 -0
  74. package/dist/core/operations/runtime.js.map +1 -0
  75. package/dist/core/operations/scaffold-apply.d.ts +21 -0
  76. package/dist/core/operations/scaffold-apply.d.ts.map +1 -0
  77. package/dist/core/operations/scaffold-apply.js +57 -0
  78. package/dist/core/operations/scaffold-apply.js.map +1 -0
  79. package/dist/core/operations/scaffold-machine.d.ts +16 -0
  80. package/dist/core/operations/scaffold-machine.d.ts.map +1 -0
  81. package/dist/core/operations/scaffold-machine.js +51 -0
  82. package/dist/core/operations/scaffold-machine.js.map +1 -0
  83. package/dist/core/operations/scaffold-plan.d.ts +43 -0
  84. package/dist/core/operations/scaffold-plan.d.ts.map +1 -0
  85. package/dist/core/operations/scaffold-plan.js +187 -0
  86. package/dist/core/operations/scaffold-plan.js.map +1 -0
  87. package/dist/core/project/agent-instructions.d.ts +29 -0
  88. package/dist/core/project/agent-instructions.d.ts.map +1 -0
  89. package/dist/core/project/agent-instructions.js +160 -0
  90. package/dist/core/project/agent-instructions.js.map +1 -0
  91. package/dist/core/project/artifacts.d.ts +58 -0
  92. package/dist/core/project/artifacts.d.ts.map +1 -0
  93. package/dist/core/project/artifacts.js +179 -0
  94. package/dist/core/project/artifacts.js.map +1 -0
  95. package/dist/core/project/boundaries.d.ts +50 -0
  96. package/dist/core/project/boundaries.d.ts.map +1 -0
  97. package/dist/core/project/boundaries.js +117 -0
  98. package/dist/core/project/boundaries.js.map +1 -0
  99. package/dist/core/project/capabilities.d.ts +58 -0
  100. package/dist/core/project/capabilities.d.ts.map +1 -0
  101. package/dist/core/project/capabilities.js +135 -0
  102. package/dist/core/project/capabilities.js.map +1 -0
  103. package/dist/core/project/drift.d.ts +29 -0
  104. package/dist/core/project/drift.d.ts.map +1 -0
  105. package/dist/core/project/drift.js +188 -0
  106. package/dist/core/project/drift.js.map +1 -0
  107. package/dist/core/project/infra.d.ts +49 -0
  108. package/dist/core/project/infra.d.ts.map +1 -0
  109. package/dist/core/project/infra.js +167 -0
  110. package/dist/core/project/infra.js.map +1 -0
  111. package/dist/core/project/manifest.d.ts +92 -0
  112. package/dist/core/project/manifest.d.ts.map +1 -0
  113. package/dist/core/project/manifest.js +321 -0
  114. package/dist/core/project/manifest.js.map +1 -0
  115. package/dist/core/project/state.d.ts +15 -0
  116. package/dist/core/project/state.d.ts.map +1 -0
  117. package/dist/core/project/state.js +106 -0
  118. package/dist/core/project/state.js.map +1 -0
  119. package/dist/core/project/validation.d.ts +20 -0
  120. package/dist/core/project/validation.d.ts.map +1 -0
  121. package/dist/core/project/validation.js +274 -0
  122. package/dist/core/project/validation.js.map +1 -0
  123. package/dist/core/project/workflows.d.ts +43 -0
  124. package/dist/core/project/workflows.d.ts.map +1 -0
  125. package/dist/core/project/workflows.js +299 -0
  126. package/dist/core/project/workflows.js.map +1 -0
  127. package/dist/core/scaffold/auth-generator.d.ts +63 -0
  128. package/dist/core/scaffold/auth-generator.d.ts.map +1 -0
  129. package/dist/core/scaffold/auth-generator.js +1774 -0
  130. package/dist/core/scaffold/auth-generator.js.map +1 -0
  131. package/dist/core/scaffold/connector-functions-generator.d.ts +41 -0
  132. package/dist/core/scaffold/connector-functions-generator.d.ts.map +1 -0
  133. package/dist/core/scaffold/connector-functions-generator.js +1029 -0
  134. package/dist/core/scaffold/connector-functions-generator.js.map +1 -0
  135. package/dist/core/scaffold/functions-generator.d.ts +4 -3
  136. package/dist/core/scaffold/functions-generator.d.ts.map +1 -1
  137. package/dist/core/scaffold/functions-generator.js +405 -134
  138. package/dist/core/scaffold/functions-generator.js.map +1 -1
  139. package/dist/core/scaffold/model-parser.d.ts +20 -0
  140. package/dist/core/scaffold/model-parser.d.ts.map +1 -1
  141. package/dist/core/scaffold/model-parser.js +229 -78
  142. package/dist/core/scaffold/model-parser.js.map +1 -1
  143. package/dist/core/scaffold/native-schema-generator.d.ts +19 -0
  144. package/dist/core/scaffold/native-schema-generator.d.ts.map +1 -0
  145. package/dist/core/scaffold/native-schema-generator.js +753 -0
  146. package/dist/core/scaffold/native-schema-generator.js.map +1 -0
  147. package/dist/core/scaffold/nextjs-generator.d.ts +8 -0
  148. package/dist/core/scaffold/nextjs-generator.d.ts.map +1 -1
  149. package/dist/core/scaffold/nextjs-generator.js +152 -8
  150. package/dist/core/scaffold/nextjs-generator.js.map +1 -1
  151. package/dist/core/scaffold/ui-generator.d.ts +17 -4
  152. package/dist/core/scaffold/ui-generator.d.ts.map +1 -1
  153. package/dist/core/scaffold/ui-generator.js +174 -34
  154. package/dist/core/scaffold/ui-generator.js.map +1 -1
  155. package/dist/core/verify/index.d.ts +69 -0
  156. package/dist/core/verify/index.d.ts.map +1 -0
  157. package/dist/core/verify/index.js +412 -0
  158. package/dist/core/verify/index.js.map +1 -0
  159. package/dist/machine/contracts.d.ts +24 -0
  160. package/dist/machine/contracts.d.ts.map +1 -0
  161. package/dist/machine/contracts.js +3 -0
  162. package/dist/machine/contracts.js.map +1 -0
  163. package/dist/machine/errors.d.ts +14 -0
  164. package/dist/machine/errors.d.ts.map +1 -0
  165. package/dist/machine/errors.js +42 -0
  166. package/dist/machine/errors.js.map +1 -0
  167. package/dist/machine/index.d.ts +3 -0
  168. package/dist/machine/index.d.ts.map +1 -0
  169. package/dist/machine/index.js +566 -0
  170. package/dist/machine/index.js.map +1 -0
  171. package/dist/mcp/index.d.ts +25 -0
  172. package/dist/mcp/index.d.ts.map +1 -0
  173. package/dist/mcp/index.js +425 -0
  174. package/dist/mcp/index.js.map +1 -0
  175. package/dist/types/index.d.ts +105 -0
  176. package/dist/types/index.d.ts.map +1 -1
  177. package/dist/utils/package-manager.d.ts +7 -11
  178. package/dist/utils/package-manager.d.ts.map +1 -1
  179. package/dist/utils/package-manager.js +42 -17
  180. package/dist/utils/package-manager.js.map +1 -1
  181. package/dist/utils/python-uv.d.ts +21 -0
  182. package/dist/utils/python-uv.d.ts.map +1 -0
  183. package/dist/utils/python-uv.js +111 -0
  184. package/dist/utils/python-uv.js.map +1 -0
  185. package/dist/version.d.ts +2 -0
  186. package/dist/version.d.ts.map +1 -0
  187. package/dist/version.js +49 -0
  188. package/dist/version.js.map +1 -0
  189. package/package.json +15 -17
  190. package/src/__tests__/__snapshots__/functions-generator.test.ts.snap +716 -22
  191. package/src/__tests__/__snapshots__/nextjs-generator.test.ts.snap +19 -7
  192. package/src/__tests__/__snapshots__/ui-generator.test.ts.snap +20 -12
  193. package/src/__tests__/agent-instructions.test.ts +237 -0
  194. package/src/__tests__/agent-loop-phase34.test.ts +513 -0
  195. package/src/__tests__/auth.test.ts +770 -0
  196. package/src/__tests__/bff-swa-auth.test.ts +275 -0
  197. package/src/__tests__/config.test.ts +176 -3
  198. package/src/__tests__/connector-functions-generator.test.ts +288 -0
  199. package/src/__tests__/connector-mock-server.test.ts +459 -0
  200. package/src/__tests__/connector-model-bff.test.ts +162 -0
  201. package/src/__tests__/cosmos-worktree-isolation.test.ts +149 -0
  202. package/src/__tests__/dev-seeds.test.ts +124 -0
  203. package/src/__tests__/dev.test.ts +254 -0
  204. package/src/__tests__/file-session.test.ts +98 -0
  205. package/src/__tests__/fixtures.ts +101 -0
  206. package/src/__tests__/functions-generator.test.ts +137 -1
  207. package/src/__tests__/init.test.ts +386 -1
  208. package/src/__tests__/jest-globals.d.ts +8 -0
  209. package/src/__tests__/machine.test.ts +371 -0
  210. package/src/__tests__/mcp.test.ts +253 -0
  211. package/src/__tests__/model-parser.test.ts +142 -0
  212. package/src/__tests__/multi-auth.test.ts +160 -0
  213. package/src/__tests__/nextjs-generator.test.ts +8 -0
  214. package/src/__tests__/package-manager.test.ts +59 -4
  215. package/src/__tests__/plan-apply.test.ts +499 -0
  216. package/src/__tests__/python-uv.test.ts +48 -0
  217. package/src/__tests__/scaffold.test.ts +287 -24
  218. package/src/__tests__/tsconfig.json +15 -0
  219. package/src/__tests__/ui-generator.test.ts +104 -0
  220. package/src/__tests__/zod-mock-generator.test.ts +132 -0
  221. package/src/cli/commands/add-auth.ts +853 -0
  222. package/src/cli/commands/add-connector.ts +159 -0
  223. package/src/cli/commands/cosmos-worktree-isolation.ts +130 -0
  224. package/src/cli/commands/create-model.ts +21 -100
  225. package/src/cli/commands/dev-seeds.ts +278 -7
  226. package/src/cli/commands/dev.ts +607 -160
  227. package/src/cli/commands/init.ts +880 -808
  228. package/src/cli/commands/scaffold.ts +531 -236
  229. package/src/cli/index.ts +338 -60
  230. package/src/core/config.ts +145 -9
  231. package/src/core/mock/connector-mock-server.ts +555 -0
  232. package/src/core/mock/zod-mock-generator.ts +205 -0
  233. package/src/core/operations/auth-operations.ts +360 -0
  234. package/src/core/operations/create-model.ts +191 -0
  235. package/src/core/operations/file-session.ts +222 -0
  236. package/src/core/operations/provision-operations.ts +297 -0
  237. package/src/core/operations/runtime.ts +258 -0
  238. package/src/core/operations/scaffold-apply.ts +106 -0
  239. package/src/core/operations/scaffold-machine.ts +77 -0
  240. package/src/core/operations/scaffold-plan.ts +215 -0
  241. package/src/core/project/agent-instructions.ts +167 -0
  242. package/src/core/project/agent-templates/AGENTS.md +504 -0
  243. package/src/core/project/agent-templates/CLAUDE.md +31 -0
  244. package/src/core/project/agent-templates/azure-functions.instructions.md +22 -0
  245. package/src/core/project/agent-templates/bff-routes.instructions.md +18 -0
  246. package/src/core/project/agent-templates/copilot-instructions.md +27 -0
  247. package/src/core/project/agent-templates/shared-models.instructions.md +72 -0
  248. package/src/core/project/artifacts.ts +205 -0
  249. package/src/core/project/boundaries.ts +170 -0
  250. package/src/core/project/capabilities.ts +193 -0
  251. package/src/core/project/drift.ts +202 -0
  252. package/src/core/project/infra.ts +196 -0
  253. package/src/core/project/manifest.ts +402 -0
  254. package/src/core/project/state.ts +77 -0
  255. package/src/core/project/validation.ts +295 -0
  256. package/src/core/project/workflows.ts +295 -0
  257. package/src/core/scaffold/auth-generator.ts +1824 -0
  258. package/src/core/scaffold/connector-functions-generator.ts +1133 -0
  259. package/src/core/scaffold/functions-generator.ts +432 -134
  260. package/src/core/scaffold/model-parser.ts +244 -90
  261. package/src/core/scaffold/native-schema-generator.ts +904 -0
  262. package/src/core/scaffold/nextjs-generator.ts +174 -9
  263. package/src/core/scaffold/ui-generator.ts +191 -36
  264. package/src/core/verify/index.ts +468 -0
  265. package/src/machine/contracts.ts +33 -0
  266. package/src/machine/errors.ts +45 -0
  267. package/src/machine/index.ts +690 -0
  268. package/src/mcp/index.ts +423 -0
  269. package/src/types/index.ts +137 -0
  270. package/src/utils/package-manager.ts +41 -19
  271. package/src/utils/python-uv.ts +96 -0
  272. package/src/version.ts +13 -0
package/README.md CHANGED
@@ -2,108 +2,115 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/swallowkit.svg)](https://www.npmjs.com/package/swallowkit)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/swallowkit.svg)](https://www.npmjs.com/package/swallowkit)
5
+ [![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/himanago.swallowkit-vscode?label=VS%20Code%20Extension)](https://marketplace.visualstudio.com/items?itemName=himanago.swallowkit-vscode)
5
6
  [![license](https://img.shields.io/npm/l/swallowkit.svg)](./LICENSE)
6
7
 
7
8
  English | [日本語](./README.ja.md)
8
9
 
9
- **Type-safe schema-driven development toolkit for Next.js applications on Azure**
10
+ Schema-driven application scaffolding for Next.js and Azure.
10
11
 
11
- SwallowKit enables developers to build full-stack Next.js applications with external Azure Functions backends while maintaining end-to-end type safety through shared Zod schemas.
12
+ SwallowKit helps you build maintainable full-stack applications on Azure by using shared Zod schemas as the source of truth. From one schema definition, it can generate frontend forms, BFF routes, Azure Functions backends, OpenAPI contracts, infrastructure templates, and AI-agent-friendly project metadata.
12
13
 
13
- Deploy your Next.js app to Azure Static Web Apps using standalone mode, and connect to independent Azure Functions for backend operations.
14
+ It is designed for developers who want to build Next.js applications on Azure without letting the frontend, backend, database model, validation rules, and deployment configuration drift apart.
14
15
 
15
- Next.js API routes are restricted to use only as BFF (Backend For Frontend), offloading business logic to Azure Functions to provide clear separation between client and server.
16
+ ## 🎯 Why SwallowKit?
16
17
 
17
- Featuring Scaffold functionality to automatically generate CRUD operations from Zod schemas, achieving type-safe integration with Cosmos DB and consistent type definitions and validation.
18
+ AI can generate application code quickly. Frameworks can hide complexity nicely. But production applications still need explicit architecture.
18
19
 
19
- > **Note**: This project is in active development. APIs may change in future versions.
20
+ In a typical full-stack application, the same domain model is repeated across many places:
20
21
 
21
- ## ✨ Key Features
22
+ - frontend form types
23
+ - client-side validation
24
+ - BFF request and response models
25
+ - backend DTOs
26
+ - API contracts
27
+ - database entities
28
+ - seed data
29
+ - infrastructure and deployment configuration
22
30
 
23
- - **🔄 Zod Schema Sharing** - Keep Zod as the source of truth across frontend, BFF, Azure Functions, and Cosmos DB
24
- - **⚡ CRUD Code Generation** - Auto-generate Azure Functions + Next.js code with `swallowkit scaffold`
25
- - **🌐 Multi-language Functions Backends** - Choose TypeScript, C#, or Python for Azure Functions during `init`
26
- - **🧬 OpenAPI Schema Bridge** - For C#/Python backends, `scaffold` exports OpenAPI from Zod and generates backend schema assets
27
- - **🛡️ Contract Safety** - Keep frontend/BFF contracts aligned with backend implementations through shared Zod or generated OpenAPI-derived models
28
- - **🎯 BFF Pattern** - Next.js API Routes as BFF layer with auto-validation and resource inference
29
- - **☁️ Azure Optimized** - Minimal-cost architecture with Static Web Apps + Functions + Cosmos DB
30
- - **🚀 Easy Deployment** - Auto-generated Bicep IaC + CI/CD workflows
31
- - **🤖 AI-Friendly** - Auto-generated instruction files (`AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md`) and layer-specific rules help GitHub Copilot, Claude Code, and OpenAI Codex follow project conventions
31
+ As the application grows, these layers often drift apart. SwallowKit reduces that drift by making the schema explicit and using it to generate the surrounding application structure.
32
32
 
33
- ## 📚 Documentation
33
+ **SwallowKit is not a full-stack framework that hides everything behind magic. It is a scaffolding toolkit that generates readable, editable, and replaceable code.**
34
34
 
35
- Visit the **[SwallowKit Documentation](https://himanago.github.io/swallowkit/)** for the full docs (also available in [日本語](https://himanago.github.io/swallowkit/ja/)).
35
+ ## ✨ What it gives you
36
36
 
37
- - **[CLI Reference](https://himanago.github.io/swallowkit/en/cli-reference)** - All commands in detail
38
- - **[Scaffold Guide](https://himanago.github.io/swallowkit/en/scaffold-guide)** - CRUD code generation
39
- - **[Zod Schema Sharing Guide](https://himanago.github.io/swallowkit/en/zod-schema-sharing-guide)** - Schema design
40
- - **[Deployment Guide](https://himanago.github.io/swallowkit/en/deployment-guide)** - Deploy to Azure
37
+ - **Shared Zod schemas** as the source of truth
38
+ - **CRUD scaffolding** for Next.js, BFF routes, Azure Functions, and UI components
39
+ - **Azure-ready infrastructure** using Bicep
40
+ - **Multi-language Azure Functions** backends (TypeScript, C#, Python)
41
+ - **Local development helpers** and seed data
42
+ - **AI/MCP-friendly** project metadata and commands
43
+ - **VS Code extension** support
41
44
 
42
- ## 🚀 Quick Start
45
+ ## 🏗️ Typical architecture
43
46
 
44
- ### 1. Create Project
47
+ SwallowKit is optimized for applications built with:
45
48
 
46
- ```bash
47
- npx swallowkit init my-app
48
- # or
49
- pnpm dlx swallowkit init my-app
50
- cd my-app
51
- ```
49
+ - Next.js
50
+ - Azure Static Web Apps
51
+ - Azure Functions
52
+ - Azure Cosmos DB
53
+ - Azure Bicep
54
+ - GitHub Actions or Azure Pipelines
52
55
 
53
- The interactive prompts ask for CI/CD provider, Azure Functions backend language, Cosmos DB mode, and network settings. You can also specify them as flags to skip prompts entirely:
56
+ The default architecture follows a BFF pattern:
54
57
 
55
- ```bash
56
- # Non-interactive mode (useful for VS Code extensions or automation)
57
- npx swallowkit init my-app --cicd github --backend-language python --cosmos-db-mode serverless --vnet outbound
58
58
  ```
59
+ Browser
60
+ |
61
+ Next.js frontend
62
+ |
63
+ Next.js BFF routes
64
+ |
65
+ Azure Functions API
66
+ |
67
+ Azure Cosmos DB
68
+ ```
69
+
70
+ The BFF layer keeps frontend code simple while allowing backend services, authentication, authorization, and cloud resources to evolve independently.
59
71
 
60
- | Flag | Values | Description |
61
- |------|--------|-------------|
62
- | `--cicd <provider>` | `github`, `azure`, `skip` | CI/CD provider |
63
- | `--backend-language <language>` | `typescript`, `csharp`, `python` | Azure Functions backend language |
64
- | `--cosmos-db-mode <mode>` | `freetier`, `serverless` | Cosmos DB pricing mode |
65
- | `--vnet <option>` | `outbound`, `none` | Network security |
72
+ > **Note**: This project is in active development. APIs may change in future versions.
73
+
74
+ ## 📚 Documentation
66
75
 
67
- Omit any flag to be prompted for that value interactively.
76
+ Visit the **[SwallowKit Documentation](https://himanago.github.io/swallowkit/)** for the full docs (also available in [日本語](https://himanago.github.io/swallowkit/ja/)).
77
+
78
+ - **[Getting Started](https://himanago.github.io/swallowkit/en/getting-started)** - First project setup
79
+ - **[Core Concepts](https://himanago.github.io/swallowkit/en/concepts)** - Schema-centric architecture
80
+ - **[Scaffold Guide](https://himanago.github.io/swallowkit/en/scaffold-guide)** - CRUD code generation
81
+ - **[Local Development](https://himanago.github.io/swallowkit/en/dev-guide)** - Dev server, seeds, mock connectors
82
+ - **[Deployment Guide](https://himanago.github.io/swallowkit/en/deployment-guide)** - Deploy to Azure
83
+ - **[AI / MCP Guide](https://himanago.github.io/swallowkit/en/ai-mcp-guide)** - AI-agent integration
84
+ - **[Coding Agent Guide](https://himanago.github.io/swallowkit/en/coding-agent-guide)** - Lifecycle integration, ownership, and external process composition
85
+ - **[Authentication](https://himanago.github.io/swallowkit/en/auth-guide)** - Auth and authorization
86
+ - **[Connectors](https://himanago.github.io/swallowkit/en/connector-guide)** - External data sources
68
87
 
69
- ### 2. Create Models
88
+ ## 🚀 Quick start
70
89
 
71
- You can create multiple models at once:
90
+ Create a new project:
72
91
 
73
92
  ```bash
74
- npx swallowkit create-model category todo
75
- # or
76
- pnpm dlx swallowkit create-model category todo
93
+ npx swallowkit init my-app
94
+ cd my-app
77
95
  ```
78
96
 
79
- This generates `shared/models/category.ts` and `shared/models/todo.ts`. Customize them by adding your required fields:
97
+ For pnpm 11/12: bootstrap with `pnpm dlx swallowkit init my-app`, then use `pnpm exec swallowkit …` inside the project. `npx` selects npm; `--package-manager npm|pnpm` overrides detection. Node.js 22.14+ is required. MCP intentionally uses `latest` with the selected package manager. See [commands, workspace setup, and security troubleshooting](docs/en/package-managers.md).
80
98
 
81
- ```typescript
82
- // shared/models/category.ts
83
- import { z } from 'zod';
84
99
 
85
- export const category = z.object({
86
- id: z.string(),
87
- name: z.string().min(1).max(50),
88
- createdAt: z.string().optional(),
89
- updatedAt: z.string().optional(),
90
- });
100
+ Create a model and customize the schema:
91
101
 
92
- export type Category = z.infer<typeof category>;
102
+ ```bash
103
+ npx swallowkit create-model todo
93
104
  ```
94
105
 
95
- For parent-child relationships, use **nested schemas** instead of ID references:
96
-
97
106
  ```typescript
98
107
  // shared/models/todo.ts
99
108
  import { z } from 'zod';
100
- import { category } from './category';
101
109
 
102
110
  export const todo = z.object({
103
111
  id: z.string(),
104
112
  text: z.string().min(1).max(200),
105
113
  completed: z.boolean().default(false),
106
- category: category.optional(), // Nested object (not categoryId)
107
114
  createdAt: z.string().optional(),
108
115
  updatedAt: z.string().optional(),
109
116
  });
@@ -111,198 +118,40 @@ export const todo = z.object({
111
118
  export type Todo = z.infer<typeof todo>;
112
119
  ```
113
120
 
114
- > **Tip**: Nesting preserves type safety and stores related data together in the document, which is natural for Cosmos DB's document model.
115
-
116
- ### 3. Generate CRUD Code
117
-
118
- ```bash
119
- npx swallowkit scaffold shared/models/todo.ts
120
- # or
121
- pnpm dlx swallowkit scaffold shared/models/todo.ts
122
- ```
123
-
124
- This auto-generates:
125
- - ✅ Azure Functions (CRUD endpoints + Cosmos DB bindings)
126
- - ✅ Next.js BFF API Routes (auto-validation + resource inference)
127
- - ✅ React Components (type-safe forms)
128
-
129
- If you selected `csharp` or `python` at `init` time, `swallowkit scaffold` also writes an OpenAPI document under `functions/openapi/` and generates backend schema assets under `functions/generated/`.
130
-
131
- ### 4. Start Development Server
121
+ Generate CRUD code and start the dev server:
132
122
 
133
123
  ```bash
124
+ npx swallowkit scaffold todo
134
125
  npx swallowkit dev
135
- # or
136
- pnpm dlx swallowkit dev
137
- ```
138
-
139
- - Next.js: http://localhost:3000
140
- - Azure Functions: http://localhost:7071
141
-
142
- If you want to replace Cosmos DB Emulator data before startup, generate an environment template and then launch `dev` with that environment:
143
-
144
- ```bash
145
- npx swallowkit create-dev-seeds local
146
- # edit dev-seeds/local/*.json
147
- npx swallowkit dev --seed-env local
148
- ```
149
-
150
- This workflow is designed for local debugging against the Cosmos DB Emulator:
151
-
152
- - `create-dev-seeds <environment>` generates one JSON template per schema under `dev-seeds/<environment>/`
153
- - each file name maps to a schema/container, for example `shared/models/todo.ts` -> `dev-seeds/local/todo.json` -> `Todos`
154
- - when you start `dev --seed-env <environment>`, SwallowKit replaces the existing data for each matching container with the JSON documents from that environment
155
- - containers without a matching JSON file are left untouched
156
- - if `--seed-env` is omitted, or `dev-seeds/<environment>/` does not exist, current emulator data is preserved
157
-
158
- Example file layout:
159
-
160
- ```text
161
- dev-seeds/
162
- local/
163
- todo.json
164
- category.json
165
- staging-debug/
166
- todo.json
167
- ```
168
-
169
- Each `{schema}.json` file can contain either a single JSON object or an array of JSON objects. Every document must include an `id`:
170
-
171
- ```json
172
- [
173
- {
174
- "id": "seed-todo-001",
175
- "name": "Seed todo one",
176
- "createdAt": "2026-03-21T00:00:00.000Z",
177
- "updatedAt": "2026-03-21T00:00:00.000Z"
178
- },
179
- {
180
- "id": "seed-todo-002",
181
- "name": "Seed todo two",
182
- "createdAt": "2026-03-21T00:00:01.000Z",
183
- "updatedAt": "2026-03-21T00:00:01.000Z"
184
- }
185
- ]
186
- ```
187
-
188
- Recommended workflow:
189
-
190
- ```bash
191
- npx swallowkit create-model todo
192
- npx swallowkit scaffold shared/models/todo.ts
193
- npx swallowkit create-dev-seeds local
194
- # edit dev-seeds/local/todo.json
195
- npx swallowkit dev --seed-env local
196
- ```
197
-
198
- ### 5. Use from Frontend
199
-
200
- ```typescript
201
- import { api } from '@/lib/api/backend';
202
- import type { Todo } from '@/shared/models/todo';
203
-
204
- // Get all - call BFF endpoint
205
- const todos = await api.get<Todo[]>('/api/todos');
206
-
207
- // Create - validated by backend
208
- const created = await api.post<Todo>('/api/todos', {
209
- text: 'Buy milk',
210
- completed: false
211
- });
212
-
213
- // Update - validated by backend
214
- const updated = await api.put<Todo>('/api/todos/123', { completed: true });
215
-
216
- // Delete
217
- await api.delete('/api/todos/123');
218
- ```
219
-
220
- ## 🏗️ Architecture
221
-
222
- ```
223
- ┌─────────────────────────────────────────────────────────────┐
224
- │ Frontend (React) │
225
- │ - Client Components │
226
- │ - Server Components (SSR) │
227
- └──────────────────────────┬───────────────────────────────────┘
228
- │ api.post('/api/todos', data)
229
- ▼
230
- ┌─────────────────────────────────────────────────────────────┐
231
- │ BFF Layer (Next.js API Routes) │
232
- │ - Auto Schema Validation (Zod) │
233
- │ - Error Handling │
234
- └──────────────────────────┬───────────────────────────────────┘
235
- │ HTTP Request
236
- ▼
237
- ┌─────────────────────────────────────────────────────────────┐
238
- │ Azure Functions (Backend) │
239
- │ - HTTP Triggers (CRUD) │
240
- │ - Zod Validation (Re-check) │
241
- │ - Business Logic │
242
- │ - Cosmos DB Bindings │
243
- └──────────────────────────┬───────────────────────────────────┘
244
- │
245
- ▼
246
- ┌─────────────────────────────────────────────────────────────┐
247
- │ Azure Cosmos DB │
248
- │ - NoSQL Database │
249
- │ - Zod Schema Validation │
250
- └─────────────────────────────────────────────────────────────┘
251
126
  ```
252
127
 
253
- **Key Patterns:**
254
- - **BFF (Backend For Frontend)**: Next.js API Routes proxy to Azure Functions
255
- - **Shared Schemas**: Zod schemas stay in `shared/models/` as the source of truth
256
- - **OpenAPI Bridge for C#/Python**: Non-TypeScript Functions consume generated assets under `functions/generated/`
257
- - **Contract Safety**: BFF and backend stay aligned through shared Zod or generated backend models
258
- - **Managed Identity**: Secure service connections (no connection strings)
128
+ This generates Azure Functions, Next.js BFF routes, and React UI components — all typed from the shared schema.
259
129
 
260
- ## 📦 Prerequisites
130
+ ## 🤖 AI-agent-friendly development
261
131
 
262
- - Node.js 22.x
263
- - **pnpm** (recommended): `corepack enable` or `npm install -g pnpm`
264
- - npm also works — SwallowKit auto-detects the package manager (if pnpm is installed, it is always preferred)
265
- - Azure Cosmos DB Emulator (local development)
266
- - [Official documentation (vNext recommended)](https://learn.microsoft.com/en-us/azure/cosmos-db/emulator-linux)
267
- - Windows: [Download](https://aka.ms/cosmosdb-emulator)
268
- - Docker: `docker run -p 8081:8081 mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator`
132
+ SwallowKit provides machine-readable project metadata and command interfaces so coding agents can inspect the project structure, generate code through official commands, and validate changes without directly rewriting unrelated files.
269
133
 
270
- ## 🚀 Deploy to Azure
134
+ The goal is to make AI-assisted development safer by giving agents explicit architectural boundaries.
271
135
 
272
- Deploy your Next.js app to Azure Static Web Apps using standalone mode, and connect to independent Azure Functions for backend operations.
136
+ ## 📦 Generated project structure
273
137
 
274
- **1. Provision resources (Bicep IaC)**
275
-
276
- ```bash
277
- npx swallowkit provision --resource-group my-app-rg --location japaneast
278
- # or
279
- pnpm dlx swallowkit provision --resource-group my-app-rg --location japaneast
280
138
  ```
281
-
282
- After provisioning, the required CI/CD secret values are displayed in the terminal. Copy them.
283
-
284
- **2. Push code**
285
-
286
- ```bash
287
- git push origin main
139
+ .
140
+ ├── app/ # Next.js pages and BFF API routes
141
+ ├── shared/
142
+ │ └── models/ # Shared Zod schemas (source of truth)
143
+ ├── functions/ # Azure Functions backend
144
+ ├── infra/ # Bicep templates
145
+ ├── lib/ # BFF helpers and scaffold config
146
+ └── .swallowkit/ # SwallowKit project metadata
288
147
  ```
289
148
 
290
- **3. Cancel the auto-triggered CI/CD run** — it will fail because secrets are not registered yet.
291
-
292
- **4. Register the displayed secret values** in GitHub (Settings → Secrets) or Azure DevOps (Pipelines → Library).
149
+ ## 🔗 Status
293
150
 
294
- **5. Manually re-run the CI/CD workflow.**
151
+ SwallowKit is under active development. The API, project structure, and generated output may change.
295
152
 
296
- See **[Deployment Guide](https://himanago.github.io/swallowkit/en/deployment-guide)** for details.
153
+ Feedback, issues, and small example use cases are welcome.
297
154
 
298
- ## License
155
+ ## 📄 License
299
156
 
300
157
  MIT
301
-
302
- ## 🔗 Related Links
303
-
304
- - [Azure Static Web Apps](https://learn.microsoft.com/en-us/azure/static-web-apps/)
305
- - [Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/)
306
- - [Azure Cosmos DB](https://learn.microsoft.com/en-us/azure/cosmos-db/)
307
- - [Next.js](https://nextjs.org/)
308
- - [Zod](https://zod.dev/)
@@ -3,10 +3,22 @@ import { ModelInfo } from "../core/scaffold/model-parser";
3
3
  * テスト用の基本的な ModelInfo フィクスチャ
4
4
  */
5
5
  export declare function createBasicModelInfo(overrides?: Partial<ModelInfo>): ModelInfo;
6
+ /**
7
+ * RDB コネクタ (read-only) 付きの ModelInfo フィクスチャ
8
+ */
9
+ export declare function createRdbConnectorModelInfo(overrides?: Partial<ModelInfo>): ModelInfo;
10
+ /**
11
+ * API コネクタ (read-write) 付きの ModelInfo フィクスチャ
12
+ */
13
+ export declare function createApiConnectorModelInfo(overrides?: Partial<ModelInfo>): ModelInfo;
6
14
  /**
7
15
  * 外部キーを含む ModelInfo フィクスチャ
8
16
  */
9
17
  export declare function createModelInfoWithForeignKey(): ModelInfo;
18
+ /**
19
+ * 必須・optional・nullable の外部キーを含む ModelInfo フィクスチャ
20
+ */
21
+ export declare function createModelInfoWithNullableForeignKeys(): ModelInfo;
10
22
  /**
11
23
  * enum フィールドを含む ModelInfo フィクスチャ
12
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/__tests__/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAoB9E;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,SAAS,CAqBzD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,SAAS,CA0BnD"}
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/__tests__/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAqB9E;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAuBrF;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CA2BrF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,SAAS,CAqBzD;AAED;;GAEG;AACH,wBAAgB,sCAAsC,IAAI,SAAS,CAmClE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,SAAS,CA0BnD"}
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createBasicModelInfo = createBasicModelInfo;
4
+ exports.createRdbConnectorModelInfo = createRdbConnectorModelInfo;
5
+ exports.createApiConnectorModelInfo = createApiConnectorModelInfo;
4
6
  exports.createModelInfoWithForeignKey = createModelInfoWithForeignKey;
7
+ exports.createModelInfoWithNullableForeignKeys = createModelInfoWithNullableForeignKeys;
5
8
  exports.createModelInfoWithEnum = createModelInfoWithEnum;
6
9
  /**
7
10
  * テスト用の基本的な ModelInfo フィクスチャ
@@ -24,9 +27,68 @@ function createBasicModelInfo(overrides) {
24
27
  hasCreatedAt: true,
25
28
  hasUpdatedAt: true,
26
29
  nestedSchemaRefs: [],
30
+ partitionKey: '/id',
27
31
  ...overrides,
28
32
  };
29
33
  }
34
+ /**
35
+ * RDB コネクタ (read-only) 付きの ModelInfo フィクスチャ
36
+ */
37
+ function createRdbConnectorModelInfo(overrides) {
38
+ return createBasicModelInfo({
39
+ name: "User",
40
+ displayName: "User",
41
+ schemaName: "userSchema",
42
+ filePath: "/models/user.ts",
43
+ fields: [
44
+ { name: "id", type: "string", isOptional: false, isArray: false },
45
+ { name: "employeeCode", type: "string", isOptional: false, isArray: false },
46
+ { name: "name", type: "string", isOptional: false, isArray: false },
47
+ { name: "email", type: "string", isOptional: false, isArray: false },
48
+ { name: "department", type: "string", isOptional: true, isArray: false },
49
+ { name: "createdAt", type: "string", isOptional: true, isArray: false },
50
+ { name: "updatedAt", type: "string", isOptional: true, isArray: false },
51
+ ],
52
+ connectorConfig: {
53
+ connector: "mysql",
54
+ operations: ["getAll", "getById"],
55
+ table: "users",
56
+ idColumn: "id",
57
+ },
58
+ ...overrides,
59
+ });
60
+ }
61
+ /**
62
+ * API コネクタ (read-write) 付きの ModelInfo フィクスチャ
63
+ */
64
+ function createApiConnectorModelInfo(overrides) {
65
+ return createBasicModelInfo({
66
+ name: "BacklogIssue",
67
+ displayName: "BacklogIssue",
68
+ schemaName: "backlogIssueSchema",
69
+ filePath: "/models/backlog-issue.ts",
70
+ fields: [
71
+ { name: "id", type: "string", isOptional: false, isArray: false },
72
+ { name: "projectId", type: "string", isOptional: false, isArray: false },
73
+ { name: "issueKey", type: "string", isOptional: false, isArray: false },
74
+ { name: "summary", type: "string", isOptional: false, isArray: false },
75
+ { name: "description", type: "string", isOptional: true, isArray: false },
76
+ { name: "createdAt", type: "string", isOptional: true, isArray: false },
77
+ { name: "updatedAt", type: "string", isOptional: true, isArray: false },
78
+ ],
79
+ connectorConfig: {
80
+ connector: "backlog",
81
+ operations: ["getAll", "getById", "create", "update"],
82
+ endpoints: {
83
+ getAll: "GET /issues",
84
+ getById: "GET /issues/{id}",
85
+ create: "POST /issues",
86
+ update: "PATCH /issues/{id}",
87
+ },
88
+ },
89
+ ...overrides,
90
+ });
91
+ }
30
92
  /**
31
93
  * 外部キーを含む ModelInfo フィクスチャ
32
94
  */
@@ -52,6 +114,45 @@ function createModelInfoWithForeignKey() {
52
114
  ],
53
115
  });
54
116
  }
117
+ /**
118
+ * 必須・optional・nullable の外部キーを含む ModelInfo フィクスチャ
119
+ */
120
+ function createModelInfoWithNullableForeignKeys() {
121
+ return createBasicModelInfo({
122
+ name: "Coupon",
123
+ displayName: "Coupon",
124
+ schemaName: "couponSchema",
125
+ filePath: "/models/coupon.ts",
126
+ fields: [
127
+ { name: "id", type: "string", isOptional: false, isArray: false },
128
+ {
129
+ name: "requiredUserId",
130
+ type: "string",
131
+ isOptional: false,
132
+ isArray: false,
133
+ isForeignKey: true,
134
+ referencedModel: "RequiredUser",
135
+ },
136
+ {
137
+ name: "optionalUserId",
138
+ type: "string",
139
+ isOptional: true,
140
+ isArray: false,
141
+ isForeignKey: true,
142
+ referencedModel: "OptionalUser",
143
+ },
144
+ {
145
+ name: "nullableUserId",
146
+ type: "string",
147
+ isOptional: false,
148
+ isNullable: true,
149
+ isArray: false,
150
+ isForeignKey: true,
151
+ referencedModel: "NullableUser",
152
+ },
153
+ ],
154
+ });
155
+ }
55
156
  /**
56
157
  * enum フィールドを含む ModelInfo フィクスチャ
57
158
  */
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../src/__tests__/fixtures.ts"],"names":[],"mappings":";;AAKA,oDAoBC;AAKD,sEAqBC;AAKD,0DA0BC;AAhFD;;GAEG;AACH,SAAgB,oBAAoB,CAAC,SAA8B;IACjE,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,YAAY;QACxB,QAAQ,EAAE,iBAAiB;QAC3B,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;YACjE,EAAE,IAAI,EAA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
3
+ * 認証認可基盤ファイルを生成する
4
+ */
5
+ interface AddAuthOptions {
6
+ provider?: string;
7
+ scheme?: string;
8
+ /** SWA の許可する identity provider (例: ['github'])。未指定時は ['aad']。 */
9
+ allowedProviders?: string[];
10
+ }
11
+ export declare function generateSwaAuthContext(allowedProviders?: string[]): string;
12
+ export declare function addAuthProviderToRootLayout(layout: string): string;
13
+ export declare function addAuthCommand(options: AddAuthOptions): Promise<void>;
14
+ export {};
15
+ //# sourceMappingURL=add-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add-auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+CH,UAAU,cAAc;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AA8HD,wBAAgB,sBAAsB,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CA0C1E;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAclE;AAwBD,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,iBAoJ3D"}