swallowkit 1.1.2 → 2.0.0-alpha.10

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 (262) hide show
  1. package/README.ja.md +61 -7
  2. package/README.md +61 -7
  3. package/dist/cli/commands/add-auth.d.ts.map +1 -1
  4. package/dist/cli/commands/add-auth.js +103 -27
  5. package/dist/cli/commands/add-auth.js.map +1 -1
  6. package/dist/cli/commands/configure-mcp.d.ts +12 -0
  7. package/dist/cli/commands/configure-mcp.d.ts.map +1 -0
  8. package/dist/cli/commands/configure-mcp.js +42 -0
  9. package/dist/cli/commands/configure-mcp.js.map +1 -0
  10. package/dist/cli/commands/dev.d.ts +5 -2
  11. package/dist/cli/commands/dev.d.ts.map +1 -1
  12. package/dist/cli/commands/dev.js +143 -67
  13. package/dist/cli/commands/dev.js.map +1 -1
  14. package/dist/cli/commands/init.d.ts +14 -7
  15. package/dist/cli/commands/init.d.ts.map +1 -1
  16. package/dist/cli/commands/init.js +149 -170
  17. package/dist/cli/commands/init.js.map +1 -1
  18. package/dist/cli/commands/migrations.d.ts.map +1 -1
  19. package/dist/cli/commands/migrations.js +25 -0
  20. package/dist/cli/commands/migrations.js.map +1 -1
  21. package/dist/cli/commands/provision.d.ts +5 -0
  22. package/dist/cli/commands/provision.d.ts.map +1 -1
  23. package/dist/cli/commands/provision.js +278 -55
  24. package/dist/cli/commands/provision.js.map +1 -1
  25. package/dist/cli/commands/scaffold.d.ts +5 -1
  26. package/dist/cli/commands/scaffold.d.ts.map +1 -1
  27. package/dist/cli/commands/scaffold.js +123 -18
  28. package/dist/cli/commands/scaffold.js.map +1 -1
  29. package/dist/cli/index.d.ts +2 -0
  30. package/dist/cli/index.d.ts.map +1 -1
  31. package/dist/cli/index.js +49 -8
  32. package/dist/cli/index.js.map +1 -1
  33. package/dist/core/config.d.ts +2 -1
  34. package/dist/core/config.d.ts.map +1 -1
  35. package/dist/core/config.js +19 -0
  36. package/dist/core/config.js.map +1 -1
  37. package/dist/core/operations/create-model.d.ts +2 -0
  38. package/dist/core/operations/create-model.d.ts.map +1 -1
  39. package/dist/core/operations/create-model.js +60 -8
  40. package/dist/core/operations/create-model.js.map +1 -1
  41. package/dist/core/operations/migration-generator.d.ts.map +1 -1
  42. package/dist/core/operations/migration-generator.js +12 -1
  43. package/dist/core/operations/migration-generator.js.map +1 -1
  44. package/dist/core/operations/model-migration.d.ts +22 -0
  45. package/dist/core/operations/model-migration.d.ts.map +1 -0
  46. package/dist/core/operations/model-migration.js +36 -0
  47. package/dist/core/operations/model-migration.js.map +1 -0
  48. package/dist/core/operations/provision-deployment.d.ts +52 -0
  49. package/dist/core/operations/provision-deployment.d.ts.map +1 -0
  50. package/dist/core/operations/provision-deployment.js +164 -0
  51. package/dist/core/operations/provision-deployment.js.map +1 -0
  52. package/dist/core/operations/provision-operations.d.ts +62 -6
  53. package/dist/core/operations/provision-operations.d.ts.map +1 -1
  54. package/dist/core/operations/provision-operations.js +653 -115
  55. package/dist/core/operations/provision-operations.js.map +1 -1
  56. package/dist/core/operations/scaffold-apply.d.ts +1 -0
  57. package/dist/core/operations/scaffold-apply.d.ts.map +1 -1
  58. package/dist/core/operations/scaffold-apply.js +1 -0
  59. package/dist/core/operations/scaffold-apply.js.map +1 -1
  60. package/dist/core/operations/scaffold-machine.d.ts +1 -0
  61. package/dist/core/operations/scaffold-machine.d.ts.map +1 -1
  62. package/dist/core/operations/scaffold-machine.js.map +1 -1
  63. package/dist/core/operations/scaffold-plan.d.ts +2 -0
  64. package/dist/core/operations/scaffold-plan.d.ts.map +1 -1
  65. package/dist/core/operations/scaffold-plan.js +3 -1
  66. package/dist/core/operations/scaffold-plan.js.map +1 -1
  67. package/dist/core/project/agent-instructions.d.ts +2 -1
  68. package/dist/core/project/agent-instructions.d.ts.map +1 -1
  69. package/dist/core/project/agent-instructions.js +15 -0
  70. package/dist/core/project/agent-instructions.js.map +1 -1
  71. package/dist/core/project/boundaries.d.ts +5 -2
  72. package/dist/core/project/boundaries.d.ts.map +1 -1
  73. package/dist/core/project/boundaries.js +51 -20
  74. package/dist/core/project/boundaries.js.map +1 -1
  75. package/dist/core/project/capabilities.d.ts +17 -0
  76. package/dist/core/project/capabilities.d.ts.map +1 -1
  77. package/dist/core/project/capabilities.js +45 -6
  78. package/dist/core/project/capabilities.js.map +1 -1
  79. package/dist/core/project/home-page.d.ts +4 -0
  80. package/dist/core/project/home-page.d.ts.map +1 -0
  81. package/dist/core/project/home-page.js +113 -0
  82. package/dist/core/project/home-page.js.map +1 -0
  83. package/dist/core/project/manifest.d.ts +3 -1
  84. package/dist/core/project/manifest.d.ts.map +1 -1
  85. package/dist/core/project/manifest.js +47 -25
  86. package/dist/core/project/manifest.js.map +1 -1
  87. package/dist/core/project/mcp-config.d.ts +26 -0
  88. package/dist/core/project/mcp-config.d.ts.map +1 -0
  89. package/dist/core/project/mcp-config.js +117 -0
  90. package/dist/core/project/mcp-config.js.map +1 -0
  91. package/dist/core/project/react-project.d.ts +26 -0
  92. package/dist/core/project/react-project.d.ts.map +1 -0
  93. package/dist/core/project/react-project.js +443 -0
  94. package/dist/core/project/react-project.js.map +1 -0
  95. package/dist/core/project/state.d.ts +7 -0
  96. package/dist/core/project/state.d.ts.map +1 -1
  97. package/dist/core/project/state.js +86 -0
  98. package/dist/core/project/state.js.map +1 -1
  99. package/dist/core/project/validation.d.ts.map +1 -1
  100. package/dist/core/project/validation.js +32 -10
  101. package/dist/core/project/validation.js.map +1 -1
  102. package/dist/core/project/workflows.d.ts.map +1 -1
  103. package/dist/core/project/workflows.js +53 -7
  104. package/dist/core/project/workflows.js.map +1 -1
  105. package/dist/core/scaffold/auth-generator.d.ts.map +1 -1
  106. package/dist/core/scaffold/auth-generator.js +26 -27
  107. package/dist/core/scaffold/auth-generator.js.map +1 -1
  108. package/dist/core/scaffold/model-parser.d.ts +23 -0
  109. package/dist/core/scaffold/model-parser.d.ts.map +1 -1
  110. package/dist/core/scaffold/model-parser.js +407 -137
  111. package/dist/core/scaffold/model-parser.js.map +1 -1
  112. package/dist/core/scaffold/native-schema-generator.d.ts +13 -0
  113. package/dist/core/scaffold/native-schema-generator.d.ts.map +1 -1
  114. package/dist/core/scaffold/native-schema-generator.js +294 -91
  115. package/dist/core/scaffold/native-schema-generator.js.map +1 -1
  116. package/dist/core/scaffold/openapi-generator.d.ts +5 -0
  117. package/dist/core/scaffold/openapi-generator.d.ts.map +1 -1
  118. package/dist/core/scaffold/openapi-generator.js +53 -3
  119. package/dist/core/scaffold/openapi-generator.js.map +1 -1
  120. package/dist/core/scaffold/react-bff-generator.d.ts +10 -0
  121. package/dist/core/scaffold/react-bff-generator.d.ts.map +1 -0
  122. package/dist/core/scaffold/react-bff-generator.js +252 -0
  123. package/dist/core/scaffold/react-bff-generator.js.map +1 -0
  124. package/dist/core/scaffold/react-ui-generator.d.ts +6 -0
  125. package/dist/core/scaffold/react-ui-generator.d.ts.map +1 -0
  126. package/dist/core/scaffold/react-ui-generator.js +41 -0
  127. package/dist/core/scaffold/react-ui-generator.js.map +1 -0
  128. package/dist/core/scaffold/ui-generator.d.ts +0 -3
  129. package/dist/core/scaffold/ui-generator.d.ts.map +1 -1
  130. package/dist/core/scaffold/ui-generator.js +68 -7
  131. package/dist/core/scaffold/ui-generator.js.map +1 -1
  132. package/dist/core/verify/index.d.ts +4 -3
  133. package/dist/core/verify/index.d.ts.map +1 -1
  134. package/dist/core/verify/index.js +122 -5
  135. package/dist/core/verify/index.js.map +1 -1
  136. package/dist/index.d.ts +3 -3
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +3 -2
  139. package/dist/index.js.map +1 -1
  140. package/dist/machine/contracts.d.ts +1 -0
  141. package/dist/machine/contracts.d.ts.map +1 -1
  142. package/dist/machine/errors.d.ts +3 -2
  143. package/dist/machine/errors.d.ts.map +1 -1
  144. package/dist/machine/errors.js +2 -1
  145. package/dist/machine/errors.js.map +1 -1
  146. package/dist/machine/index.d.ts.map +1 -1
  147. package/dist/machine/index.js +61 -30
  148. package/dist/machine/index.js.map +1 -1
  149. package/dist/mcp/index.d.ts +6 -4
  150. package/dist/mcp/index.d.ts.map +1 -1
  151. package/dist/mcp/index.js +210 -25
  152. package/dist/mcp/index.js.map +1 -1
  153. package/dist/mcp/version-selection.d.ts +55 -0
  154. package/dist/mcp/version-selection.d.ts.map +1 -0
  155. package/dist/mcp/version-selection.js +152 -0
  156. package/dist/mcp/version-selection.js.map +1 -0
  157. package/dist/types/index.d.ts +4 -0
  158. package/dist/types/index.d.ts.map +1 -1
  159. package/dist/utils/azure-cli.d.ts +56 -0
  160. package/dist/utils/azure-cli.d.ts.map +1 -0
  161. package/dist/utils/azure-cli.js +326 -0
  162. package/dist/utils/azure-cli.js.map +1 -0
  163. package/dist/utils/azure-diagnostics.d.ts +16 -0
  164. package/dist/utils/azure-diagnostics.d.ts.map +1 -0
  165. package/dist/utils/azure-diagnostics.js +68 -0
  166. package/dist/utils/azure-diagnostics.js.map +1 -0
  167. package/dist/utils/package-manager.d.ts +2 -2
  168. package/dist/utils/package-manager.d.ts.map +1 -1
  169. package/dist/utils/package-manager.js +6 -3
  170. package/dist/utils/package-manager.js.map +1 -1
  171. package/dist/utils/python-uv.d.ts +5 -7
  172. package/dist/utils/python-uv.d.ts.map +1 -1
  173. package/dist/utils/python-uv.js +50 -24
  174. package/dist/utils/python-uv.js.map +1 -1
  175. package/dist/utils/react-dev.d.ts +4 -0
  176. package/dist/utils/react-dev.d.ts.map +1 -0
  177. package/dist/utils/react-dev.js +35 -0
  178. package/dist/utils/react-dev.js.map +1 -0
  179. package/dist/utils/semver.d.ts +14 -0
  180. package/dist/utils/semver.d.ts.map +1 -0
  181. package/dist/utils/semver.js +61 -0
  182. package/dist/utils/semver.js.map +1 -0
  183. package/package.json +7 -4
  184. package/src/__tests__/__snapshots__/boundaries.test.ts.snap +154 -0
  185. package/src/__tests__/agent-instructions.test.ts +6 -1
  186. package/src/__tests__/agent-loop-phase34.test.ts +143 -8
  187. package/src/__tests__/auth.test.ts +9 -0
  188. package/src/__tests__/azure-cli.test.ts +202 -0
  189. package/src/__tests__/boundaries.test.ts +42 -0
  190. package/src/__tests__/csharp-schema.test.ts +261 -0
  191. package/src/__tests__/dev.test.ts +13 -6
  192. package/src/__tests__/fixtures/az wrapper.cmd +2 -0
  193. package/src/__tests__/fixtures/azure-cli.cjs +153 -0
  194. package/src/__tests__/fixtures/provision-runner.cjs +28 -0
  195. package/src/__tests__/generated-project-matrix.test.ts +789 -0
  196. package/src/__tests__/home-page.test.ts +50 -0
  197. package/src/__tests__/init.test.ts +145 -5
  198. package/src/__tests__/mcp-version.test.ts +262 -0
  199. package/src/__tests__/mcp.test.ts +120 -3
  200. package/src/__tests__/multi-auth.test.ts +115 -4
  201. package/src/__tests__/package-manager.test.ts +17 -2
  202. package/src/__tests__/plan-apply.test.ts +179 -0
  203. package/src/__tests__/provision-runtime.test.ts +722 -0
  204. package/src/__tests__/python-uv.test.ts +50 -14
  205. package/src/__tests__/python-venv.test.ts +48 -0
  206. package/src/__tests__/react-dev.test.ts +72 -0
  207. package/src/__tests__/react.test.ts +838 -0
  208. package/src/__tests__/release-metadata.test.ts +121 -0
  209. package/src/__tests__/schema-analysis.test.ts +329 -0
  210. package/src/cli/commands/add-auth.ts +103 -29
  211. package/src/cli/commands/configure-mcp.ts +54 -0
  212. package/src/cli/commands/dev.ts +145 -73
  213. package/src/cli/commands/init.ts +147 -172
  214. package/src/cli/commands/migrations.ts +22 -0
  215. package/src/cli/commands/provision.ts +294 -56
  216. package/src/cli/commands/scaffold.ts +145 -22
  217. package/src/cli/index.ts +46 -10
  218. package/src/core/config.ts +21 -1
  219. package/src/core/operations/create-model.ts +51 -13
  220. package/src/core/operations/migration-generator.ts +14 -1
  221. package/src/core/operations/model-migration.ts +52 -0
  222. package/src/core/operations/provision-deployment.ts +183 -0
  223. package/src/core/operations/provision-operations.ts +662 -154
  224. package/src/core/operations/scaffold-apply.ts +2 -0
  225. package/src/core/operations/scaffold-machine.ts +1 -0
  226. package/src/core/operations/scaffold-plan.ts +5 -1
  227. package/src/core/project/agent-instructions.ts +17 -1
  228. package/src/core/project/agent-templates/AGENTS.md +113 -15
  229. package/src/core/project/agent-templates/CLAUDE.md +14 -1
  230. package/src/core/project/agent-templates/bff-routes.instructions.md +5 -3
  231. package/src/core/project/agent-templates/copilot-instructions.md +15 -1
  232. package/src/core/project/agent-templates/shared-models.instructions.md +11 -3
  233. package/src/core/project/boundaries.ts +62 -20
  234. package/src/core/project/capabilities.ts +63 -6
  235. package/src/core/project/home-page.ts +114 -0
  236. package/src/core/project/manifest.ts +52 -27
  237. package/src/core/project/mcp-config.ts +84 -0
  238. package/src/core/project/react-project.ts +529 -0
  239. package/src/core/project/state.ts +70 -0
  240. package/src/core/project/validation.ts +32 -10
  241. package/src/core/project/workflows.ts +53 -7
  242. package/src/core/scaffold/auth-generator.ts +26 -27
  243. package/src/core/scaffold/model-parser.ts +413 -129
  244. package/src/core/scaffold/native-schema-generator.ts +319 -103
  245. package/src/core/scaffold/openapi-generator.ts +63 -5
  246. package/src/core/scaffold/react-bff-generator.ts +292 -0
  247. package/src/core/scaffold/react-ui-generator.ts +51 -0
  248. package/src/core/scaffold/ui-generator.ts +70 -8
  249. package/src/core/verify/index.ts +118 -6
  250. package/src/index.ts +3 -1
  251. package/src/machine/contracts.ts +1 -0
  252. package/src/machine/errors.ts +4 -2
  253. package/src/machine/index.ts +67 -36
  254. package/src/mcp/index.ts +221 -31
  255. package/src/mcp/version-selection.ts +163 -0
  256. package/src/types/index.ts +4 -0
  257. package/src/utils/azure-cli.ts +315 -0
  258. package/src/utils/azure-diagnostics.ts +75 -0
  259. package/src/utils/package-manager.ts +7 -4
  260. package/src/utils/python-uv.ts +53 -33
  261. package/src/utils/react-dev.ts +31 -0
  262. package/src/utils/semver.ts +59 -0
@@ -52,9 +52,23 @@ Goal: add a data model and derive CRUD/BFF/UI/infra deterministically.
52
52
  1. Create the model file (deterministic template):
53
53
  \`${runCmd} swallowkit machine generate model <name> --overwrite never\`
54
54
  2. Edit \`shared/models/<name>.ts\` — add domain fields (free-form authoring).
55
+ - Native C#/Python types follow Zod, not names: \`z.iso.datetime()\` for dates, \`z.number().int()\` for integers.
56
+ - \`<model>Id\` fields reference a model only when it exists in \`shared/models\`; otherwise declare
57
+ \`export const references = { fieldId: 'Model' }\` (or \`false\` to opt out).
55
58
  3. Compute the change plan (writes nothing):
56
59
  \`${runCmd} swallowkit machine plan scaffold <name>\`
57
60
  - \`status: "requires-human"\` → review \`data.conflicts\`; only proceed with \`--approve\` if overwriting is intended.
61
+ - Must not change Bicep/infrastructure? Add \`--skip-infra\` to plan and apply. Nothing under \`infra/\` changes and
62
+ the plan warns \`infra-skipped\`; later run \`${runCmd} swallowkit migrations add-model <name>\` to add only the container migration.
63
+ - Read \`data.warnings\`. \`user-scoped-data-without-auth\` means generated CRUD would expose every user's documents;
64
+ add auth (\`swallowkit-add-auth\`) and owner-scoped ai-authored endpoints before exposing the model.
65
+ - \`auth-policy-without-auth\` blocks generation before file writes: configure authentication with plan/apply auth,
66
+ then re-plan. Do not remove a required policy to bypass this prerequisite.
67
+ For named \`auth.schemes\`, define named authorization policies selecting schemes/roles and reference them from
68
+ \`authPolicy.policy\` or read/write names; role-only declarations block with \`auth-policy-requires-named-policy\`.
69
+ Single-provider \`auth.provider\` supports role lists only; named policies block with \`auth-named-policy-requires-named-scheme\`.
70
+ - Scaffold appends missing exports to \`shared/index.ts\` for hand-authored models too.
71
+ Manual exports are allowed; no managed markers exist in that file.
58
72
  4. Apply:
59
73
  \`${runCmd} swallowkit machine apply scaffold --plan <planId>\`
60
74
  5. Verify:
@@ -153,7 +167,7 @@ the scoping key from the verified principal, never from the request body.
153
167
  title: "Verify and repair loop",
154
168
  skillName: "swallowkit-verify-repair",
155
169
  skillDescription:
156
- "Converge a SwallowKit project to a verified state: run structure/drift/typecheck (and build/lint/test) checks, read evidence with explain failure, repair, and repeat. Use after any code or schema change, when verification fails, when the build/lint/tests are broken, or before finishing a task.",
170
+ "Converge a SwallowKit project to a verified state: run structure/drift/typecheck/backend-build (and build/lint/test) checks, read evidence with explain failure, repair, and repeat. Use after any code or schema change, when verification fails, when the build/lint/tests are broken, or before finishing a task.",
157
171
  content: `# Workflow: Verify and repair
158
172
 
159
173
  Goal: converge the project to a verified state after any change.
@@ -161,14 +175,16 @@ Goal: converge the project to a verified state after any change.
161
175
  ## Loop
162
176
 
163
177
  1. \`${runCmd} swallowkit machine verify project\`
164
- - default checks: structure, drift, typecheck (+ project-specific checks from swallowkit.config \`verify.checks\`)
165
- - opt-in heavier checks: \`--checks structure,drift,typecheck,build,lint,test\`
178
+ - default checks: structure, drift, typecheck, backend-build (+ project-specific checks from swallowkit.config \`verify.checks\`)
179
+ - backend-build: standalone C# \`dotnet build\`, TypeScript \`tsc --noEmit\`, Python 3 \`compileall\` (syntax only).
180
+ Missing toolchains are skipped with a reason, not proof of a working backend. Restore them and re-run.
181
+ - opt-in heavier checks: \`--checks "structure,drift,typecheck,backend-build,build,lint,test"\` (quote CSV in PowerShell)
166
182
  2. If \`summary.done\` is false:
167
183
  - \`${runCmd} swallowkit machine explain failure\` → evidence (logTail, findings, violations) and suggestedActions per check.
168
184
  - Repair:
169
185
  - \`drift\` failures → follow each finding's \`repairAction\` (usually re-run plan/apply scaffold).
170
186
  - \`structure\` failures → follow \`suggestedFix\` per violation.
171
- - \`typecheck\`/\`build\`/\`lint\`/\`test\` failures → fix the code in ai-authored files.
187
+ - \`typecheck\`/\`backend-build\`/\`build\`/\`lint\`/\`test\` failures → fix the source code, not generated artifacts.
172
188
  3. Repeat until \`summary.done: true\`.
173
189
 
174
190
  ## Exit criteria
@@ -195,9 +211,14 @@ Goal: bootstrap Azure once, then apply only pending versioned infrastructure mig
195
211
  \`status: "requires-human"\` and \`requiresApproval: true\` by design.
196
212
  - Never pass \`--approve\` to \`apply provision\` unless a human explicitly
197
213
  instructed you to provision in this session.
214
+ - This plan/apply workflow is for agents. Humans normally run \`swallowkit provision\`
215
+ directly; do not switch to that command to bypass the agent approval gate.
198
216
  - Inspect infra locally first — no \`az\` calls are needed for inspection.
199
217
  - Never edit an applied migration. Create a corrective migration instead.
200
218
  - Never use \`--reconcile\` for an ordinary model or resource addition.
219
+ - A local az error/timeout or Ctrl+C does not prove Azure failed. Never
220
+ re-submit, cancel, or delete a deployment to repair a wait or bookkeeping failure.
221
+ - Respect \`status\`, \`outcome\`, and \`nextActions\`, not just \`ok\`.
201
222
 
202
223
  ## Steps
203
224
 
@@ -205,7 +226,7 @@ Goal: bootstrap Azure once, then apply only pending versioned infrastructure mig
205
226
  \`${runCmd} swallowkit machine inspect infra\`
206
227
  - review parameters, modules, outputs, and container wiring warnings.
207
228
  2. Compute the provisioning plan (no resources are created):
208
- \`${runCmd} swallowkit machine plan provision -g <resource-group> --location <region>\`
229
+ \`${runCmd} swallowkit machine plan provision -g <resource-group> --location <region> --swa-location <swa-region>\`
209
230
  - the plan reports \`bootstrap\`, \`migrate\`, \`noop\`, or \`adoption-required\`.
210
231
  - it lists only pending migrations and the exact \`az\` commands that would run.
211
232
  - for an older untagged environment, first run \`${runCmd} swallowkit migrations init --legacy-baseline\`, then plan with \`--adopt-existing --baseline 0 --what-if\`.
@@ -213,12 +234,35 @@ Goal: bootstrap Azure once, then apply only pending versioned infrastructure mig
213
234
  3. Present the plan to the human and wait for explicit approval.
214
235
  4. Only after approval:
215
236
  \`${runCmd} swallowkit machine apply provision --plan <planId> --approve\`
216
- 5. Verify the deployment outputs and report them.
237
+ 5. If \`in-progress\`, \`unknown\`, or \`partial\`, retain the execution
238
+ checkpoint and read/wait for the original deployment:
239
+ \`${runCmd} swallowkit machine inspect provision --plan <runId> --wait-seconds 300\`.
240
+ Inspection never writes Azure tags or the local ledger.
241
+ 6. After fresh explicit human approval, resume:
242
+ \`${runCmd} swallowkit machine apply provision --plan <runId> --approve\`.
243
+ Attempted deployments are not re-submitted; remaining reviewed steps and
244
+ tags/ledger finish only after Azure \`Succeeded\`.
245
+ 7. Report completion only when \`status: "complete"\` and
246
+ \`outcome: "succeeded"\`. Never report deployment output secrets.
247
+
248
+ For an older untracked bootstrap, plan with \`--resume-deployment <name>\`
249
+ and the original RG, subscription and regions. Recovery compares its ARM
250
+ template and non-secure parameters to local Bicep before approval. Mismatch,
251
+ unreadable evidence or secure parameters block; do not work around this by
252
+ using reconcile/adoption or replacing the migration manifest.
217
253
 
218
254
  ## Terminal states
219
255
 
220
256
  \`apply provision\` without \`--approve\` fails with \`approval-required\` —
221
257
  this is the guardrail working as intended, not an error to work around.
258
+
259
+ Azure \`Running\`/\`Accepted\` means \`in-progress\`. An unreadable or missing
260
+ deployment means \`unknown\`, not Azure failure. Azure \`Failed\`/\`Canceled\`
261
+ returns sanitized Azure and operation causes. Azure \`Succeeded\` with incomplete
262
+ tag/ledger writes means \`partial\`; resume bookkeeping without redeploying.
263
+ The default wait is 300 seconds (0-3600 via \`--wait-seconds\`), not unlimited.
264
+ Warning-only stderr with exit 0 is accepted. Diagnostics report local exit,
265
+ signal, elapsed time and truncated/redacted output separately from Azure state.
222
266
  `,
223
267
  };
224
268
 
@@ -247,7 +291,9 @@ under \`.github/skills/\` so skills-aware agents load them automatically.
247
291
 
248
292
  - **ai-authored** (write freely): \`shared/models/\`, business logic, custom pages/components, tests.
249
293
  - **deterministic** (never hand-edit): artifacts generated by SwallowKit (see \`.swallowkit/artifacts.json\`) and \`.swallowkit/\` metadata. Change models/config and regenerate via plan/apply.
250
- - **shared** (edit outside markers): \`infra/main.bicep\`, \`functions/function_app.py\`, \`shared/index.ts\`.
294
+ - **shared**: \`shared/index.ts\` allows manual exports (no markers; SwallowKit appends missing entries).
295
+ For Python \`functions/function_app.py\`, edit outside the registration marker.
296
+ - **infrastructure**: baseline \`infra/\` files are checksum-locked by \`infra/migrations/manifest.json\`; add resources as new migrations (\`swallowkit create-migration <slug>\`, \`swallowkit migrations add-model <model>\`).
251
297
 
252
298
  Full machine-readable contract: \`${runCmd} swallowkit machine inspect boundaries\`
253
299
  `,
@@ -117,8 +117,7 @@ export function generateNamedAuthRouterCSharp(config: NormalizedAuthConfig): str
117
117
  using System.Text;
118
118
  using System.Text.Json;
119
119
  using Microsoft.Azure.Functions.Worker.Http;
120
- using Functions.Auth.Schemes;
121
- namespace Functions.Auth;
120
+ ${externalCases ? "using Functions.Auth.Schemes;\n" : ""}namespace Functions.Auth;
122
121
  public record AuthPrincipal(string Subject, string Scheme, string Issuer, string[] Roles, IReadOnlyDictionary<string, object?> Claims)
123
122
  {
124
123
  [Obsolete("Use Subject")] public string UserId => Subject;
@@ -171,15 +170,15 @@ ${externalCases}
171
170
  export function generateNamedAuthRouterPython(config: NormalizedAuthConfig): string {
172
171
  const external = Object.entries(config.schemes).filter(([,s])=>s.provider === "external-token");
173
172
  const imports = external.map(([n])=>`from auth.schemes.${schemeSlug(n).replace(/-/g,"_")}.verifier import verify_external_token as verify_${safeIdentifier(n)}, ExternalTokenVerificationError as Error_${safeIdentifier(n)}`).join("\n");
174
- const cases = external.map(([n], index)=>` ${index === 0 ? "if" : "elif"} scheme == ${JSON.stringify(n)}:
175
- try:
176
- value = verify_${safeIdentifier(n)}(bearer)
177
- except Error_${safeIdentifier(n)} as exc:
178
- raise AuthError(503 if exc.identity_provider_unavailable else 401, "Identity provider unavailable" if exc.identity_provider_unavailable else "Invalid token")
179
- except Exception:
180
- raise AuthError(503, "External token verifier unavailable")
181
- if not value.get("subject") or not isinstance(value.get("roles"), list): raise AuthError(401, "Invalid external principal")
182
- principal = {"subject": value["subject"], "scheme": scheme, "issuer": value.get("issuer", scheme), "roles": value["roles"], "claims": value.get("claims", {}), "userId": value["subject"]}`).join("\n");
173
+ const cases = external.map(([n], index)=>` ${index === 0 ? "if" : "elif"} scheme == ${JSON.stringify(n)}:
174
+ try:
175
+ value = verify_${safeIdentifier(n)}(bearer)
176
+ except Error_${safeIdentifier(n)} as exc:
177
+ raise AuthError(503 if exc.identity_provider_unavailable else 401, "Identity provider unavailable" if exc.identity_provider_unavailable else "Invalid token")
178
+ except Exception:
179
+ raise AuthError(503, "External token verifier unavailable")
180
+ if not value.get("subject") or not isinstance(value.get("roles"), list): raise AuthError(401, "Invalid external principal")
181
+ principal = {"subject": value["subject"], "scheme": scheme, "issuer": value.get("issuer", scheme), "roles": value["roles"], "claims": value.get("claims", {}), "userId": value["subject"]}`).join("\n");
183
182
  return `import base64
184
183
  import json
185
184
  import azure.functions as func
@@ -199,14 +198,14 @@ def require_auth(req: func.HttpRequest, policy_name: str):
199
198
  if len(candidates) != 1: raise AuthError(401, "Authentication required" if not candidates else "Ambiguous credentials")
200
199
  scheme = candidates[0]
201
200
  ${cases}
202
- ${external.length ? "elif" : "if"} PROVIDERS[scheme] == "swa":
203
- try:
204
- value=json.loads(base64.b64decode(swa).decode("utf-8")); roles=[r for r in value.get("userRoles",[]) if isinstance(r,str)]
205
- if not value.get("userId") or "authenticated" not in roles: raise ValueError()
206
- if ALLOWED_PROVIDERS[scheme] and value.get("identityProvider") not in ALLOWED_PROVIDERS[scheme]: raise ValueError()
207
- principal={"subject":value["userId"],"scheme":scheme,"issuer":"swa:"+value.get("identityProvider", "unknown"),"roles":roles,"claims":value,"userId":value["userId"]}
208
- except Exception: raise AuthError(401,"Invalid SWA client principal")
209
- else: raise AuthError(401,"Authentication adapter is not configured")
201
+ ${external.length ? "elif" : "if"} PROVIDERS[scheme] == "swa":
202
+ try:
203
+ value=json.loads(base64.b64decode(swa).decode("utf-8")); roles=[r for r in value.get("userRoles",[]) if isinstance(r,str)]
204
+ if not value.get("userId") or "authenticated" not in roles: raise ValueError()
205
+ if ALLOWED_PROVIDERS[scheme] and value.get("identityProvider") not in ALLOWED_PROVIDERS[scheme]: raise ValueError()
206
+ principal={"subject":value["userId"],"scheme":scheme,"issuer":"swa:"+value.get("identityProvider", "unknown"),"roles":roles,"claims":value,"userId":value["userId"]}
207
+ except Exception: raise AuthError(401,"Invalid SWA client principal")
208
+ else: raise AuthError(401,"Authentication adapter is not configured")
210
209
  require_roles(principal, policy.get("roles", [])); return principal
211
210
  def require_roles(principal, roles):
212
211
  if roles and not any(role in principal.get("roles",[]) for role in roles): raise AuthError(403,"Insufficient permissions")
@@ -1161,17 +1160,17 @@ export default function LoginPage() {
1161
1160
  };
1162
1161
 
1163
1162
  return (
1164
- <div className="min-h-screen flex items-center justify-center bg-gray-50">
1165
- <div className="w-full max-w-md p-8 bg-white rounded-lg shadow-md">
1166
- <h1 className="text-2xl font-bold text-center mb-6">ログイン</h1>
1163
+ <div className="min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900">
1164
+ <div className="w-full max-w-md p-8 bg-white dark:bg-gray-800 rounded-lg shadow-md">
1165
+ <h1 className="text-2xl font-bold text-center mb-6 text-gray-900 dark:text-gray-100">ログイン</h1>
1167
1166
  {error && (
1168
- <div className="mb-4 p-3 bg-red-50 border border-red-200 text-red-700 rounded text-sm">
1167
+ <div className="mb-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 rounded text-sm">
1169
1168
  {error}
1170
1169
  </div>
1171
1170
  )}
1172
1171
  <form onSubmit={handleSubmit} className="space-y-4">
1173
1172
  <div>
1174
- <label htmlFor="loginId" className="block text-sm font-medium text-gray-700 mb-1">
1173
+ <label htmlFor="loginId" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
1175
1174
  ログインID
1176
1175
  </label>
1177
1176
  <input
@@ -1179,13 +1178,13 @@ export default function LoginPage() {
1179
1178
  type="text"
1180
1179
  value={loginId}
1181
1180
  onChange={(e) => setLoginId(e.target.value)}
1182
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
1181
+ className="w-full px-3 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
1183
1182
  required
1184
1183
  autoFocus
1185
1184
  />
1186
1185
  </div>
1187
1186
  <div>
1188
- <label htmlFor="password" className="block text-sm font-medium text-gray-700 mb-1">
1187
+ <label htmlFor="password" className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
1189
1188
  パスワード
1190
1189
  </label>
1191
1190
  <input
@@ -1193,7 +1192,7 @@ export default function LoginPage() {
1193
1192
  type="password"
1194
1193
  value={password}
1195
1194
  onChange={(e) => setPassword(e.target.value)}
1196
- className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
1195
+ className="w-full px-3 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
1197
1196
  required
1198
1197
  />
1199
1198
  </div>