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.
- package/README.ja.md +61 -7
- package/README.md +61 -7
- package/dist/cli/commands/add-auth.d.ts.map +1 -1
- package/dist/cli/commands/add-auth.js +103 -27
- package/dist/cli/commands/add-auth.js.map +1 -1
- package/dist/cli/commands/configure-mcp.d.ts +12 -0
- package/dist/cli/commands/configure-mcp.d.ts.map +1 -0
- package/dist/cli/commands/configure-mcp.js +42 -0
- package/dist/cli/commands/configure-mcp.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +5 -2
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +143 -67
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/init.d.ts +14 -7
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +149 -170
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/migrations.d.ts.map +1 -1
- package/dist/cli/commands/migrations.js +25 -0
- package/dist/cli/commands/migrations.js.map +1 -1
- package/dist/cli/commands/provision.d.ts +5 -0
- package/dist/cli/commands/provision.d.ts.map +1 -1
- package/dist/cli/commands/provision.js +278 -55
- package/dist/cli/commands/provision.js.map +1 -1
- package/dist/cli/commands/scaffold.d.ts +5 -1
- package/dist/cli/commands/scaffold.d.ts.map +1 -1
- package/dist/cli/commands/scaffold.js +123 -18
- package/dist/cli/commands/scaffold.js.map +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +49 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/core/config.d.ts +2 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +19 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/operations/create-model.d.ts +2 -0
- package/dist/core/operations/create-model.d.ts.map +1 -1
- package/dist/core/operations/create-model.js +60 -8
- package/dist/core/operations/create-model.js.map +1 -1
- package/dist/core/operations/migration-generator.d.ts.map +1 -1
- package/dist/core/operations/migration-generator.js +12 -1
- package/dist/core/operations/migration-generator.js.map +1 -1
- package/dist/core/operations/model-migration.d.ts +22 -0
- package/dist/core/operations/model-migration.d.ts.map +1 -0
- package/dist/core/operations/model-migration.js +36 -0
- package/dist/core/operations/model-migration.js.map +1 -0
- package/dist/core/operations/provision-deployment.d.ts +52 -0
- package/dist/core/operations/provision-deployment.d.ts.map +1 -0
- package/dist/core/operations/provision-deployment.js +164 -0
- package/dist/core/operations/provision-deployment.js.map +1 -0
- package/dist/core/operations/provision-operations.d.ts +62 -6
- package/dist/core/operations/provision-operations.d.ts.map +1 -1
- package/dist/core/operations/provision-operations.js +653 -115
- package/dist/core/operations/provision-operations.js.map +1 -1
- package/dist/core/operations/scaffold-apply.d.ts +1 -0
- package/dist/core/operations/scaffold-apply.d.ts.map +1 -1
- package/dist/core/operations/scaffold-apply.js +1 -0
- package/dist/core/operations/scaffold-apply.js.map +1 -1
- package/dist/core/operations/scaffold-machine.d.ts +1 -0
- package/dist/core/operations/scaffold-machine.d.ts.map +1 -1
- package/dist/core/operations/scaffold-machine.js.map +1 -1
- package/dist/core/operations/scaffold-plan.d.ts +2 -0
- package/dist/core/operations/scaffold-plan.d.ts.map +1 -1
- package/dist/core/operations/scaffold-plan.js +3 -1
- package/dist/core/operations/scaffold-plan.js.map +1 -1
- package/dist/core/project/agent-instructions.d.ts +2 -1
- package/dist/core/project/agent-instructions.d.ts.map +1 -1
- package/dist/core/project/agent-instructions.js +15 -0
- package/dist/core/project/agent-instructions.js.map +1 -1
- package/dist/core/project/boundaries.d.ts +5 -2
- package/dist/core/project/boundaries.d.ts.map +1 -1
- package/dist/core/project/boundaries.js +51 -20
- package/dist/core/project/boundaries.js.map +1 -1
- package/dist/core/project/capabilities.d.ts +17 -0
- package/dist/core/project/capabilities.d.ts.map +1 -1
- package/dist/core/project/capabilities.js +45 -6
- package/dist/core/project/capabilities.js.map +1 -1
- package/dist/core/project/home-page.d.ts +4 -0
- package/dist/core/project/home-page.d.ts.map +1 -0
- package/dist/core/project/home-page.js +113 -0
- package/dist/core/project/home-page.js.map +1 -0
- package/dist/core/project/manifest.d.ts +3 -1
- package/dist/core/project/manifest.d.ts.map +1 -1
- package/dist/core/project/manifest.js +47 -25
- package/dist/core/project/manifest.js.map +1 -1
- package/dist/core/project/mcp-config.d.ts +26 -0
- package/dist/core/project/mcp-config.d.ts.map +1 -0
- package/dist/core/project/mcp-config.js +117 -0
- package/dist/core/project/mcp-config.js.map +1 -0
- package/dist/core/project/react-project.d.ts +26 -0
- package/dist/core/project/react-project.d.ts.map +1 -0
- package/dist/core/project/react-project.js +443 -0
- package/dist/core/project/react-project.js.map +1 -0
- package/dist/core/project/state.d.ts +7 -0
- package/dist/core/project/state.d.ts.map +1 -1
- package/dist/core/project/state.js +86 -0
- package/dist/core/project/state.js.map +1 -1
- package/dist/core/project/validation.d.ts.map +1 -1
- package/dist/core/project/validation.js +32 -10
- package/dist/core/project/validation.js.map +1 -1
- package/dist/core/project/workflows.d.ts.map +1 -1
- package/dist/core/project/workflows.js +53 -7
- package/dist/core/project/workflows.js.map +1 -1
- package/dist/core/scaffold/auth-generator.d.ts.map +1 -1
- package/dist/core/scaffold/auth-generator.js +26 -27
- package/dist/core/scaffold/auth-generator.js.map +1 -1
- package/dist/core/scaffold/model-parser.d.ts +23 -0
- package/dist/core/scaffold/model-parser.d.ts.map +1 -1
- package/dist/core/scaffold/model-parser.js +407 -137
- package/dist/core/scaffold/model-parser.js.map +1 -1
- package/dist/core/scaffold/native-schema-generator.d.ts +13 -0
- package/dist/core/scaffold/native-schema-generator.d.ts.map +1 -1
- package/dist/core/scaffold/native-schema-generator.js +294 -91
- package/dist/core/scaffold/native-schema-generator.js.map +1 -1
- package/dist/core/scaffold/openapi-generator.d.ts +5 -0
- package/dist/core/scaffold/openapi-generator.d.ts.map +1 -1
- package/dist/core/scaffold/openapi-generator.js +53 -3
- package/dist/core/scaffold/openapi-generator.js.map +1 -1
- package/dist/core/scaffold/react-bff-generator.d.ts +10 -0
- package/dist/core/scaffold/react-bff-generator.d.ts.map +1 -0
- package/dist/core/scaffold/react-bff-generator.js +252 -0
- package/dist/core/scaffold/react-bff-generator.js.map +1 -0
- package/dist/core/scaffold/react-ui-generator.d.ts +6 -0
- package/dist/core/scaffold/react-ui-generator.d.ts.map +1 -0
- package/dist/core/scaffold/react-ui-generator.js +41 -0
- package/dist/core/scaffold/react-ui-generator.js.map +1 -0
- package/dist/core/scaffold/ui-generator.d.ts +0 -3
- package/dist/core/scaffold/ui-generator.d.ts.map +1 -1
- package/dist/core/scaffold/ui-generator.js +68 -7
- package/dist/core/scaffold/ui-generator.js.map +1 -1
- package/dist/core/verify/index.d.ts +4 -3
- package/dist/core/verify/index.d.ts.map +1 -1
- package/dist/core/verify/index.js +122 -5
- package/dist/core/verify/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/machine/contracts.d.ts +1 -0
- package/dist/machine/contracts.d.ts.map +1 -1
- package/dist/machine/errors.d.ts +3 -2
- package/dist/machine/errors.d.ts.map +1 -1
- package/dist/machine/errors.js +2 -1
- package/dist/machine/errors.js.map +1 -1
- package/dist/machine/index.d.ts.map +1 -1
- package/dist/machine/index.js +61 -30
- package/dist/machine/index.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -4
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +210 -25
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/version-selection.d.ts +55 -0
- package/dist/mcp/version-selection.d.ts.map +1 -0
- package/dist/mcp/version-selection.js +152 -0
- package/dist/mcp/version-selection.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/azure-cli.d.ts +56 -0
- package/dist/utils/azure-cli.d.ts.map +1 -0
- package/dist/utils/azure-cli.js +326 -0
- package/dist/utils/azure-cli.js.map +1 -0
- package/dist/utils/azure-diagnostics.d.ts +16 -0
- package/dist/utils/azure-diagnostics.d.ts.map +1 -0
- package/dist/utils/azure-diagnostics.js +68 -0
- package/dist/utils/azure-diagnostics.js.map +1 -0
- package/dist/utils/package-manager.d.ts +2 -2
- package/dist/utils/package-manager.d.ts.map +1 -1
- package/dist/utils/package-manager.js +6 -3
- package/dist/utils/package-manager.js.map +1 -1
- package/dist/utils/python-uv.d.ts +5 -7
- package/dist/utils/python-uv.d.ts.map +1 -1
- package/dist/utils/python-uv.js +50 -24
- package/dist/utils/python-uv.js.map +1 -1
- package/dist/utils/react-dev.d.ts +4 -0
- package/dist/utils/react-dev.d.ts.map +1 -0
- package/dist/utils/react-dev.js +35 -0
- package/dist/utils/react-dev.js.map +1 -0
- package/dist/utils/semver.d.ts +14 -0
- package/dist/utils/semver.d.ts.map +1 -0
- package/dist/utils/semver.js +61 -0
- package/dist/utils/semver.js.map +1 -0
- package/package.json +7 -4
- package/src/__tests__/__snapshots__/boundaries.test.ts.snap +154 -0
- package/src/__tests__/agent-instructions.test.ts +6 -1
- package/src/__tests__/agent-loop-phase34.test.ts +143 -8
- package/src/__tests__/auth.test.ts +9 -0
- package/src/__tests__/azure-cli.test.ts +202 -0
- package/src/__tests__/boundaries.test.ts +42 -0
- package/src/__tests__/csharp-schema.test.ts +261 -0
- package/src/__tests__/dev.test.ts +13 -6
- package/src/__tests__/fixtures/az wrapper.cmd +2 -0
- package/src/__tests__/fixtures/azure-cli.cjs +153 -0
- package/src/__tests__/fixtures/provision-runner.cjs +28 -0
- package/src/__tests__/generated-project-matrix.test.ts +789 -0
- package/src/__tests__/home-page.test.ts +50 -0
- package/src/__tests__/init.test.ts +145 -5
- package/src/__tests__/mcp-version.test.ts +262 -0
- package/src/__tests__/mcp.test.ts +120 -3
- package/src/__tests__/multi-auth.test.ts +115 -4
- package/src/__tests__/package-manager.test.ts +17 -2
- package/src/__tests__/plan-apply.test.ts +179 -0
- package/src/__tests__/provision-runtime.test.ts +722 -0
- package/src/__tests__/python-uv.test.ts +50 -14
- package/src/__tests__/python-venv.test.ts +48 -0
- package/src/__tests__/react-dev.test.ts +72 -0
- package/src/__tests__/react.test.ts +838 -0
- package/src/__tests__/release-metadata.test.ts +121 -0
- package/src/__tests__/schema-analysis.test.ts +329 -0
- package/src/cli/commands/add-auth.ts +103 -29
- package/src/cli/commands/configure-mcp.ts +54 -0
- package/src/cli/commands/dev.ts +145 -73
- package/src/cli/commands/init.ts +147 -172
- package/src/cli/commands/migrations.ts +22 -0
- package/src/cli/commands/provision.ts +294 -56
- package/src/cli/commands/scaffold.ts +145 -22
- package/src/cli/index.ts +46 -10
- package/src/core/config.ts +21 -1
- package/src/core/operations/create-model.ts +51 -13
- package/src/core/operations/migration-generator.ts +14 -1
- package/src/core/operations/model-migration.ts +52 -0
- package/src/core/operations/provision-deployment.ts +183 -0
- package/src/core/operations/provision-operations.ts +662 -154
- package/src/core/operations/scaffold-apply.ts +2 -0
- package/src/core/operations/scaffold-machine.ts +1 -0
- package/src/core/operations/scaffold-plan.ts +5 -1
- package/src/core/project/agent-instructions.ts +17 -1
- package/src/core/project/agent-templates/AGENTS.md +113 -15
- package/src/core/project/agent-templates/CLAUDE.md +14 -1
- package/src/core/project/agent-templates/bff-routes.instructions.md +5 -3
- package/src/core/project/agent-templates/copilot-instructions.md +15 -1
- package/src/core/project/agent-templates/shared-models.instructions.md +11 -3
- package/src/core/project/boundaries.ts +62 -20
- package/src/core/project/capabilities.ts +63 -6
- package/src/core/project/home-page.ts +114 -0
- package/src/core/project/manifest.ts +52 -27
- package/src/core/project/mcp-config.ts +84 -0
- package/src/core/project/react-project.ts +529 -0
- package/src/core/project/state.ts +70 -0
- package/src/core/project/validation.ts +32 -10
- package/src/core/project/workflows.ts +53 -7
- package/src/core/scaffold/auth-generator.ts +26 -27
- package/src/core/scaffold/model-parser.ts +413 -129
- package/src/core/scaffold/native-schema-generator.ts +319 -103
- package/src/core/scaffold/openapi-generator.ts +63 -5
- package/src/core/scaffold/react-bff-generator.ts +292 -0
- package/src/core/scaffold/react-ui-generator.ts +51 -0
- package/src/core/scaffold/ui-generator.ts +70 -8
- package/src/core/verify/index.ts +118 -6
- package/src/index.ts +3 -1
- package/src/machine/contracts.ts +1 -0
- package/src/machine/errors.ts +4 -2
- package/src/machine/index.ts +67 -36
- package/src/mcp/index.ts +221 -31
- package/src/mcp/version-selection.ts +163 -0
- package/src/types/index.ts +4 -0
- package/src/utils/azure-cli.ts +315 -0
- package/src/utils/azure-diagnostics.ts +75 -0
- package/src/utils/package-manager.ts +7 -4
- package/src/utils/python-uv.ts +53 -33
- package/src/utils/react-dev.ts +31 -0
- 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
|
-
-
|
|
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
|
|
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.
|
|
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
|
|
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)=>`
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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>
|