@topy-ai/maggie 0.7.53 → 0.7.55

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 (65) hide show
  1. package/README-zh-TW.md +28 -50
  2. package/README.md +80 -64
  3. package/bin/maggie.js +61 -9
  4. package/bundled-contracts/maggie-assistant-tools/booking-receptionist-example-v1.json +18 -2
  5. package/bundled-contracts/maggie-assistant-tools/report-v1.schema.json +43 -0
  6. package/bundled-contracts/maggie-assistant-tools/tool-registry-example-v1.json +249 -11
  7. package/bundled-contracts/maggie-assistant-tools/tool-registry-v1.schema.json +175 -0
  8. package/bundled-contracts/maggie-ops/agent-routines-v1.schema.json +48 -0
  9. package/bundled-references/maggiedash-booking/QA-TEST-PLAN.md +1 -1
  10. package/bundled-references/maggiedash-booking/RUNTIME-OPERATIONS.md +2 -2
  11. package/bundled-skills/catalog.json +1 -1
  12. package/bundled-skills/maggie-assistant-tools/SKILL.md +34 -1
  13. package/bundled-skills/maggie-assistant-tools/references/report-inbox.md +45 -0
  14. package/bundled-skills/maggie-assistant-tools/references/unattended-agents.md +70 -0
  15. package/bundled-skills/maggie-blog/SKILL.md +15 -0
  16. package/bundled-skills/maggie-booking/SKILL.md +20 -12
  17. package/bundled-skills/maggie-content-localization/SKILL.md +26 -0
  18. package/bundled-skills/maggie-dash/SKILL.md +37 -2
  19. package/bundled-skills/maggie-deployment/SKILL.md +104 -1
  20. package/bundled-skills/maggie-deployment/references/vps.md +5 -0
  21. package/bundled-skills/maggie-design/SKILL.md +81 -0
  22. package/bundled-skills/maggie-feedback/SKILL.md +10 -2
  23. package/bundled-skills/maggie-marketplace/SKILL.md +22 -2
  24. package/bundled-skills/maggie-marketplace/references/directory-search.md +1 -1
  25. package/bundled-skills/maggie-marketplace/references/directory.mjs +2 -2
  26. package/bundled-skills/maggie-mobile-app/SKILL.md +29 -0
  27. package/bundled-skills/maggie-ops/SKILL.md +28 -0
  28. package/bundled-skills/maggie-ops/references/agents-repository.md +108 -0
  29. package/bundled-skills/maggie-ops/references/ops-autopilot.md +65 -0
  30. package/bundled-skills/maggie-ops/references/routine-mode.md +92 -0
  31. package/bundled-skills/maggie-seo-geo/SKILL.md +9 -1
  32. package/bundled-skills/maggie-social-share/SKILL.md +50 -0
  33. package/bundled-tools/clis/maggie.py +63 -3
  34. package/bundled-tools/clis/maggie_assistant_tools.py +225 -1
  35. package/bundled-tools/clis/maggie_booking.py +9 -8
  36. package/bundled-tools/clis/maggie_dash.py +173 -3
  37. package/bundled-tools/clis/maggie_deployment_ops.py +64 -1
  38. package/bundled-tools/clis/maggie_design.py +7 -1
  39. package/bundled-tools/clis/maggie_design_bulk.py +290 -0
  40. package/bundled-tools/clis/maggie_design_lint.py +131 -1
  41. package/bundled-tools/clis/maggie_feedback.py +41 -13
  42. package/bundled-tools/clis/maggie_host_runtime.py +458 -0
  43. package/bundled-tools/clis/maggie_live_urls.py +147 -0
  44. package/bundled-tools/clis/maggie_localization.py +3 -0
  45. package/bundled-tools/clis/maggie_localization_keys.py +151 -0
  46. package/bundled-tools/clis/maggie_media_generate.py +174 -0
  47. package/bundled-tools/clis/maggie_mobile.py +84 -1
  48. package/bundled-tools/clis/maggie_ops.py +2 -0
  49. package/bundled-tools/clis/maggie_ops_routines.py +352 -0
  50. package/bundled-tools/clis/maggie_product_release.py +49 -1
  51. package/bundled-tools/clis/maggie_query_ideas.py +154 -0
  52. package/bundled-tools/clis/maggie_skill_catalog.py +16 -2
  53. package/bundled-tools/clis/maggie_social_share.py +223 -2
  54. package/bundled-tools/clis/maggie_version_sources.py +93 -0
  55. package/bundled-tools/integrations/maggie-api-pull.md +49 -0
  56. package/package.json +1 -1
  57. package/bundled-contracts/maggiedash/execution-board.json +0 -5463
  58. package/bundled-references/maggiedash-booking/CURRENT-STATE.md +0 -210
  59. package/bundled-references/maggiedash-booking/EXECUTION-BOARD.json +0 -5463
  60. package/bundled-references/maggiedash-booking/ORAWELLNESS-INTEGRATION-AUDIT.md +0 -270
  61. package/bundled-references/maggiedash-booking/PROGRESS.md +0 -279
  62. package/bundled-references/maggiedash-booking/README.md +0 -288
  63. package/bundled-references/maggiedash-booking/SKILLS-AND-CLI.md +0 -551
  64. package/bundled-references/maggiedash-booking/TASK-RUNBOOK.md +0 -107
  65. package/bundled-references/maggiedash-booking/TASKS.md +0 -178
@@ -1,551 +0,0 @@
1
- # ai-cmo-skills support for Booking
2
-
3
- This document turns the architecture into stable, repeatable checks for
4
- Maggie users and implementers. Commands marked implemented are shipped in
5
- `tools/clis/maggie_booking.py`; commands that need a real host runtime remain
6
- explicit host-evidence gates and fail closed when that evidence is absent.
7
-
8
- Current release baseline: MaggieDash `0.2.8`, commit `9d99de7` on
9
- `origin/main`; the working tree includes the BK-100 dashboard-managed Stripe
10
- connection slice and BK-099 cancellation-safe
11
- package-credit restoration
12
- extension. The local implementation and validators pass; the remaining
13
- runtime/browser/ops evidence is tracked as BK-030/BK-031/BK-032 in the
14
- [execution board](./EXECUTION-BOARD.json).
15
-
16
- The installer fetches MaggieDash from its public GitHub source by default. A
17
- fresh disposable Astro project was installed without `--source`, then passed
18
- the installed host validator and `maggie booking inspect`; the public install
19
- contains the 47-route Booking release, worker, schema, Astro host scaffold, and
20
- blank-host SSR adapter/config fallback.
21
-
22
- ## 1. Existing support
23
-
24
- ### `maggie-service-booking`
25
-
26
- Current support includes:
27
-
28
- - provider catalogue import and sync;
29
- - service, variant, price, duration, provider URL, and provenance validation;
30
- - provider capability audit using sanitized fixtures;
31
- - timezone-aware appointment input validation;
32
- - worker/resolver evidence checks;
33
- - booking-aware service-page generation gates;
34
- - retirement and notification lifecycle contracts.
35
-
36
- This is useful for catalog bootstrap and provider facts. It does not create a
37
- local transactional booking engine, native availability, payment webhooks, or
38
- manager booking screens.
39
-
40
- ### `maggie-dash`
41
-
42
- Current support includes:
43
-
44
- - dashboard installation and diff planning;
45
- - host adapter conformance evidence;
46
- - migration preflight;
47
- - UI/runtime evidence and panel audits;
48
- - provider-neutral MaggieDash schema and dashboard contracts.
49
- - manager-created multi-treatment appointments with per-segment service,
50
- time, price, staff/resource allocation, same-location/currency validation,
51
- transactional persistence, and idempotent replay.
52
- - public multi-treatment customer holds and checkout with combined-duration
53
- availability, safe segment DTOs, summed pricing, and segment-safe
54
- token-bound rescheduling.
55
- - blank-project location setup through the tenant-scoped Locations screen and
56
- `locations.json` route, before catalogue/staff/resource/schedule setup.
57
- - tenant-scoped prepaid treatment package catalogue management through the
58
- `packages.json` read/write routes and Packages screen, plus customer package
59
- entitlement grants, balance reads, and transactional manager/public-customer
60
- redemption through `customer-packages.json` and public hold/checkout. Public package checkout,
61
- Stripe reconciliation/webhook fulfillment, manager purchase listing, and
62
- guarded package refunds are now separate payment flows.
63
-
64
- The current installer keeps `_maggie/admin` as the dashboard target and can
65
- auto-detect an Astro host. Booking host bootstrap is non-destructive: it adds
66
- missing auth/routes/adapter/schema/worker files and idempotently merges the
67
- Booking/login/register/reset rewrite block into a conventional existing
68
- `src/middleware.ts` without replacing host auth or redirects.
69
-
70
- ### Related existing skills
71
-
72
- | Skill | Booking relationship |
73
- |---|---|
74
- | `maggie-project-context` | records project, domain, provider, and deployment decisions |
75
- | `maggie-auth-reference` | keeps email/password session and server-only provider credentials consistent |
76
- | `maggie-ops` | supplies operational dashboard, audit, health, and recovery patterns |
77
- | `maggie-deployment` | carries migration, runtime, and release evidence into deployment |
78
- | `maggie-qa-workflow` | validates browser behavior and host evidence |
79
- | `maggie-memory` | records durable implementation learnings only after confirmation |
80
- | `maggie-service-booking` | supplies catalogue/provider facts and booking-link fallback |
81
-
82
- ## 2. Implemented skill surface
83
-
84
- The general skill is:
85
-
86
- ```text
87
- maggie-booking
88
- ```
89
-
90
- Implemented responsibilities:
91
-
92
- 1. inspect the installed workspace, root artifacts, adapter, and schema;
93
- 2. validate the provider-neutral host contract and email/password boundary;
94
- 3. validate the administrator-only Booking access contract for staff roles,
95
- granular permissions, Resend invitations, password reset, and revocation;
96
- 4. validate sanitized runtime endpoint observations;
97
- 5. run a read-only release gate over the installed workspace and contract;
98
- 6. record failures through the existing feedback/memory workflow without
99
- writing active memory automatically.
100
-
101
- The skill must not auto-enable native booking or payment writes. Applying a
102
- migration, configuring a provider, or changing public booking behavior remains
103
- an explicit confirmation step.
104
-
105
- ## 3. Stable CLI
106
-
107
- The implementation lives under `tools/clis/maggie_booking.py` and is dispatched
108
- by `tools/clis/maggie.py`.
109
-
110
- ### Inspect and plan
111
-
112
- ```bash
113
- maggie booking install --project . --confirm
114
- maggie booking install --project . --host astro --dry-run
115
- maggie booking install --project . --confirm --install-dependencies
116
- maggie booking install --project . --confirm --bootstrap
117
- maggie booking install --project . --confirm --bootstrap --schedule systemd
118
- maggie booking worker-schedule --project . --scheduler cron --confirm
119
- maggie booking inspect --project .
120
- maggie booking setup --project .
121
- maggie booking access-contract
122
- maggie booking email-templates-contract
123
- maggie booking contract
124
- ```
125
-
126
- `maggie booking install` delegates to the MaggieDash distribution installer.
127
- For Astro it installs the manager/public pages, email/password login and
128
- first-owner registration, server-side PostgreSQL/Stripe adapter, middleware
129
- rewrite, schema command, Resend worker, and `.env.maggie-booking.example`.
130
- The default `--host auto` only selects Astro when `package.json` or `src/**/*.astro`
131
- proves it. Existing files are preserved; `--force` is required to replace
132
- them. A conventional existing middleware is merged automatically, including
133
- the common destructured `defineMiddleware(({ url, request }, next) => {})`
134
- form; an unsupported middleware shape is preserved, recorded in install state, and
135
- causes `maggie booking inspect` to fail until the rewrite is integrated.
136
- The command still does not apply SQL, create an account, send an email, or
137
- configure Stripe.
138
-
139
- `--install-dependencies` is an explicit host mutation for a fresh Astro
140
- project. It detects the existing npm/pnpm/yarn/bun lockfile and adds only the
141
- missing React, Phosphor, Tailwind, PostgreSQL, Stripe, and SSR adapter packages
142
- required by the Booking scaffold. A blank Astro host gets `@astrojs/node` and
143
- an `astro.config.mjs` server config; a host with an existing
144
- `astro.config.*`/deployment adapter keeps that host-owned choice. It is
145
- incompatible with `--dry-run`, `--diff`, and without `--confirm`; existing
146
- dependency versions are preserved.
147
-
148
- For a new host where the database migration has already been reviewed and
149
- approved, `--ready` is the convenience form of
150
- `--install-dependencies --bootstrap`:
151
-
152
- ```bash
153
- maggie booking install --project . --confirm --ready
154
- ```
155
-
156
- It installs missing host packages, creates the implementation-only booking
157
- token when the local environment permits it, and applies the idempotent
158
- Booking schema. It does not create the first owner, configure Stripe, send a
159
- Resend email, enable systemd/cron, or deploy. `--ready --schedule systemd`
160
- or `--ready --schedule cron` only writes reviewable scheduler artifacts.
161
-
162
- For a blank project, complete setup in this order after the schema and owner
163
- exist: create the first location in Booking → Locations, then add services and
164
- treatments, staff/resources, and schedule rules. The location form validates
165
- the IANA timezone and keeps the write idempotent; it does not depend on
166
- `location-1` or another fixture ID.
167
-
168
- `--bootstrap` is the explicit exception for a reviewed new host: after the
169
- files are installed, it runs the host-provided
170
- `scripts/maggie-booking-schema.mjs --apply --confirm` from the project with the
171
- existing environment. When the host uses a local `.env`, it generates the
172
- implementation-only `BOOKING_TOKEN_SECRET` if absent, never replaces an
173
- existing value, and refuses a configured value shorter than 32 characters.
174
- External secret stores must be provisioned separately. It still does not
175
- create an owner, configure Stripe, send email, or deploy. Do not use it before
176
- backup/migration approval.
177
-
178
- `--schedule systemd` generates a reviewed `deploy/maggie-booking-worker.service`
179
- and `.timer`; `maggie booking worker-schedule --scheduler cron` generates a
180
- cron artifact instead. These commands do not edit crontab, enable systemd, or
181
- start a worker. Review the service user and enable the scheduler only after
182
- schema, backup/restore, and host evidence gates pass.
183
-
184
- The installed host schema command also supports a safe permission preflight:
185
-
186
- ```bash
187
- node scripts/maggie-booking-schema.mjs --dry-run
188
- ```
189
-
190
- It runs the core schema and Booking schema first, then applies an optional
191
- `maggiedash/schema/host-extensions.sql` supplied by the host, all inside a
192
- transaction that is rolled back. This catches missing PostgreSQL permissions
193
- such as `btree_gist` without changing the host database; only
194
- `--apply --confirm` commits the migration.
195
-
196
- All commands in this section are read-only. `inspect` reports whether
197
- `_maggie/booking`, the installed manager and public customer contracts, the
198
- starter schema, runtime/customer-flow validators, and the installer state
199
- exist. `setup` adds a safe first-run checklist for required environment-key
200
- presence and explicit next steps for schema application, first-owner
201
- registration, Stripe webhooks, and the Resend worker. It never prints secret
202
- values and does not connect to PostgreSQL or mutate the host. It validates the
203
- 32-character minimum for `BOOKING_TOKEN_SECRET`, reports a partially
204
- configured Stripe key pair as degraded, and reports a complete pair as
205
- `online-payments-pending-verification` until the signed-in manager runs the
206
- server-side Verify Stripe connection action.
207
- `setup` reports a complete deployment Stripe key pair as
208
- `online-payments-pending-verification`; when no deployment Stripe keys are
209
- present it reports `dashboard-or-host-secret-pending` and points the signed-in
210
- owner/manager to the secure Booking Overview connection form. A partial
211
- deployment pair remains `degraded` because the dashboard form is intentionally
212
- not allowed to override deployment-managed credentials.
213
- For compatibility with the existing ORA host, `setup` also recognizes
214
- `ST_SECRECT_KEY` as a legacy alias for `STRIPE_SECRET_KEY`; a complete alias
215
- plus `STRIPE_WEBHOOK_SECRET` pair is still only
216
- `online-payments-pending-verification`. New deployments should use the
217
- canonical name, and only the authenticated Booking connection check can verify
218
- that the credentials connect to the intended Stripe account.
219
- `contract` accepts both the source contract JSON Schema and the compact
220
- ai-cmo-skills contract representation. It never reads secrets or customer data.
221
-
222
- `email-templates-contract` validates the tenant-scoped Resend template
223
- boundary: ten event keys, including package purchase confirmation/refund and
224
- no-show fee notification,
225
- event-specific `{{variable}}` allowlists,
226
- owner/admin/manager access, audited idempotent mutations, 50,000-character
227
- HTML limits, and the rule that provider credentials and recipient data remain
228
- server-only. It is a static contract check; it does not send email.
229
-
230
- Maintainers must also validate the artifact that npm users will receive, not
231
- only the source checkout:
232
-
233
- ```bash
234
- node scripts/validate-cli-package.mjs
235
- node scripts/validate-cli-package.mjs --project /home/balalior/Dev/clients/orawellness.uk
236
- ```
237
-
238
- After publishing, verify the package served by npm rather than relying only
239
- on the local tarball:
240
-
241
- ```bash
242
- node scripts/verify-published-cli.mjs --version 0.7.39
243
- ```
244
-
245
- `scripts/publish-npm.mjs` runs this registry verification automatically after
246
- `npm publish`; it fails the release if the published Booking contracts are
247
- stale or incomplete.
248
-
249
- This regenerates the bundled contracts/tools, packages the Booking runbook and
250
- sanitized runtime fixture, rewrites repository-only links, packs the exact npm
251
- tarball, and runs the packaged `booking contract`, access, email-template,
252
- task-board, and optional host-inspect checks. It is read-only with respect to
253
- hosts and never publishes the package.
254
-
255
- The installer inspector accepts both contract representations used by the
256
- distribution: the compact installed form and the JSON Schema source form with
257
- `properties` plus endpoint inventory. This keeps a fresh MaggieDash source
258
- install and an installed project on the same auth, endpoint, idempotency, and
259
- privacy checks.
260
-
261
- The installed Booking manager workspace includes an Email templates screen.
262
- Managers can edit a draft, inspect a sandboxed preview, publish a new version,
263
- and roll back a prior version. The worker resolves the latest published row by
264
- project and event, then falls back to the provider-neutral template when no
265
- tenant override exists. Template values are escaped before the Resend request;
266
- the outbox remains responsible for retry, dead-letter, and replay state.
267
-
268
- The worker cycle also runs `match-waitlist` between availability refresh and
269
- reminder enqueue. It requires explicit service/location scope in the worker
270
- availability snapshot; the Astro scaffold accepts
271
- `BOOKING_WAITLIST_SERVICE_VARIANT_ID`, `BOOKING_WAITLIST_LOCATION_ID`,
272
- `BOOKING_WAITLIST_SERVICE_NAME`, and `BOOKING_WAITLIST_LOCATION_NAME`. Matching
273
- is priority-first with FIFO tie-breaking, persists a one-time offered slot, and
274
- only queues `booking.waitlist.available`; it never auto-creates or reserves a
275
- booking.
276
-
277
- ### Runtime and release gates
278
-
279
- ```bash
280
- maggie booking runtime-validate --project . \
281
- --contract maggiedash/contracts/booking-host-adapter-v1.json \
282
- --evidence .maggie/booking-runtime.json
283
-
284
- maggie booking release-gate --project . --require-runtime \
285
- --contract maggiedash/contracts/booking-host-adapter-v1.json \
286
- --evidence .maggie/booking-runtime.json
287
- ```
288
-
289
- `runtime-validate` requires one sanitized 2xx observation for every declared
290
- endpoint, exact endpoint cardinality, an ISO timestamp, a dedicated tenant,
291
- and no sensitive evidence keys. `release-gate` verifies the contract,
292
- installed workspace, starter schema, and optional/required runtime evidence. It
293
- fails closed when `--require-runtime` is used. It does not run migrations,
294
- create bookings, capture/refund payments, or deploy.
295
-
296
- Before a host session is used, `npm run booking:runtime:plan:test` checks that
297
- the runtime plan covers every contract endpoint, uses concrete path parameters
298
- where needed, retains required query parameters, supplies mutation bodies, and
299
- rejects routes outside the `/api/maggie/booking` contract.
300
-
301
- The public customer contract has its own source/install validator:
302
-
303
- ```bash
304
- npm run booking:customer-flow:test
305
- ```
306
-
307
- It covers public DTO redaction, catalog/availability, hold input, pending
308
- payment-return recovery, notification intents, no-store/noindex responses,
309
- mutation idempotency, and fail-closed tenant binding. It does not claim that a
310
- host has configured rate limits, bot controls, a payment provider, or email
311
- delivery.
312
-
313
- The customer reference-host validator additionally exercises a two-treatment
314
- hold, combined-duration availability, summed checkout pricing, and a
315
- token-bound multi-treatment reschedule. PostgreSQL-core validation verifies
316
- that the manager repository shifts each segment and allocation independently;
317
- these are lifecycle regressions, not production-host evidence.
318
-
319
- The manager UI configuration gate also verifies install-time data binding:
320
- catalog reads expose tenant locations, schedule reads expose staff-visible
321
- locations, and staff/resource forms derive service/location defaults from those
322
- responses. It rejects the old fixture `location-1`/`service-1` fallbacks, which
323
- would make a fresh host appear installed while posting IDs that do not exist in
324
- the tenant database.
325
-
326
- Exercise the full public journey against the secret-free reference host:
327
-
328
- ```bash
329
- npm run booking:customer-reference-host:test
330
- ```
331
-
332
- This checks the public catalog, availability, hold replay, checkout pending
333
- state, payment-return recovery, token-bound cancel, manager-session isolation,
334
- and notification intents. It does not replace real host evidence.
335
-
336
- Validate the host-owned operational proof separately:
337
-
338
- ```bash
339
- maggie booking ops-validate --evidence .maggie/booking/ops-evidence.json
340
- ```
341
-
342
- The ops evidence contract requires sanitized proof for backup/restore,
343
- delivery of all seven stable health alert codes, and a recovery rehearsal
344
- (rollback write guard, worker restart, and outbox replay). The command checks
345
- the artifact only; it does not run a backup, page an operator, or mutate the
346
- host. Use `--require-host` for a release artifact; it rejects fixture, test,
347
- and local environments and requires every timestamp/boolean proof field.
348
- The installed MaggieDash package also ships the manual
349
- `.github/workflows/booking-ops-evidence.yml` workflow for validating a
350
- sanitized host artifact from an environment-scoped secret.
351
-
352
- For the final release gate, require that proof explicitly:
353
-
354
- ```bash
355
- maggie booking release-gate --project . --require-runtime \
356
- --evidence .maggie/booking/runtime-evidence.json \
357
- --require-browser \
358
- --browser-evidence .maggie/booking/browser/evidence.json \
359
- --require-ops \
360
- --ops-evidence .maggie/booking/ops-evidence.json \
361
- --require-board
362
- ```
363
-
364
- `--require-ops` fails closed until the sanitized operational artifact passes
365
- the versioned ops contract. This keeps BK-030 evidence in the same final
366
- decision as the runtime, browser, and execution-board gates.
367
-
368
- When an explicitly supplied runtime, browser, or ops artifact is missing or
369
- malformed, `release-gate` returns a structured `blocked` JSON result with the
370
- affected evidence status set to `failed` and an actionable read error. It does
371
- not crash before printing the release decision, which keeps CI artifacts and
372
- task progress machine-readable.
373
-
374
- The browser portion also requires the 390/768/1440 viewport set, safe
375
- screenshots, ready routes, empty console/request errors, and an empty
376
- `layoutErrors` array for horizontal overflow.
377
-
378
- The MaggieDash source repository also exposes the implementation gates used by
379
- the task board:
380
-
381
- ```bash
382
- npm run booking:ui:test
383
- npm run booking:security:test
384
- npm run booking:route-handler:test
385
- npm run booking:service-contract:test
386
- npm run booking:worker-adapter:test
387
- npm run booking:postgres-repository:test
388
- npm run booking:health:test
389
- ```
390
-
391
- With a disposable or approved staging PostgreSQL URL and a host-installed
392
- `pg` dependency, run the real repository cycle:
393
-
394
- ```bash
395
- npm run booking:postgres-repository:integration -- \
396
- --database-url "$DATABASE_URL" --confirm
397
- ```
398
-
399
- The integration gate creates and removes one uniquely-prefixed test tenant; it
400
- must never target an unapproved production database.
401
-
402
- The backup/restore rehearsal is a separate explicit two-database command. It
403
- requires an empty target database with no public application tables, rejects a
404
- non-empty target without modifying it, does not clean either database, and
405
- compares protected table row counts after a custom-format dump and restore.
406
- `pg_dump` and `pg_restore` must be the same major version and match or exceed
407
- both server major versions; use `--pg-bin-dir` when the matching client is not
408
- the first client on `PATH`:
409
-
410
- ```bash
411
- npm run booking:postgres-backup-restore:integration -- \
412
- --source-database-url "$DATABASE_URL" \
413
- --restore-database-url "$RESTORE_DATABASE_URL" \
414
- --pg-bin-dir "$PG_BIN_DIR" --confirm
415
- ```
416
-
417
- The route-handler gate covers the reusable host HTTP boundary. It dispatches
418
- all 47 contract routes while checking email/password session lookup,
419
- role/project scope, idempotency headers, JSON parsing, safe errors, and raw
420
- webhook forwarding. A host still injects its repository/service and provider
421
- verifier.
422
-
423
- The service-contract gate covers the installed host seam: every one of the 47
424
- manager endpoint IDs must map to one injected service method, the repository
425
- transaction surface must be declared, and the eleven public customer methods must
426
- remain separate from the manager session boundary. The installed manager
427
- method gate also protects the 29 database-backed PostgreSQL methods while
428
- keeping payment SDK and webhook methods injected. `maggie booking inspect` and
429
- `release-gate` fail when the installed type contract, service/manager
430
- validators, or PostgreSQL core repository artifact is missing.
431
-
432
- The source package also ships `npm run booking:postgres-payment-adapter:test`
433
- and `postgres-payment-adapter.mjs`. It persists normalized provider results
434
- without importing an SDK; the host still injects the gateway and verified
435
- webhook handler.
436
-
437
- The public persistence seam is `postgres-customer-adapter.mjs`; its validator
438
- protects sealed customer tokens, public DTOs, checkout/payment-return state,
439
- and token-bound cancellation. A host must still supply the token key and
440
- public abuse/security controls.
441
-
442
- After a protected host run, make browser evidence part of the release gate:
443
-
444
- ```bash
445
- maggie booking release-gate --project . --require-runtime \
446
- --evidence .maggie/booking/runtime-evidence.json \
447
- --require-browser \
448
- --browser-evidence .maggie/booking/browser/evidence.json \
449
- --require-ops \
450
- --ops-evidence .maggie/booking/ops-evidence.json \
451
- --require-board
452
- ```
453
-
454
- The browser gate checks all 17 screens at mobile/tablet/desktop widths, safe
455
- screenshot paths, PNG/JPEG content matching the file extension, exact viewport
456
- width and at least viewport height (host captures use `fullPage`), ready state,
457
- no console errors, and no failed requests. Screenshot artifacts are capped at
458
- 25 MiB each.
459
- The board gate additionally fails closed until every task in
460
- `docs/maggiedash-booking/EXECUTION-BOARD.json` is `passed`; use `--board` to
461
- inspect a different board.
462
-
463
- The installed MaggieDash package provides the host runtime commands separately:
464
-
465
- ```bash
466
- npm run booking:worker -- --job all
467
- node maggiedash/scripts/capture-booking-runtime-evidence.mjs \
468
- --base-url https://booking.example.test \
469
- --plan .secrets/booking-runtime-plan.json \
470
- --storage-state .secrets/booking-storage-state.json \
471
- --output .maggie/booking/runtime/evidence.json \
472
- --confirm
473
- node maggiedash/scripts/validate-booking-runtime-evidence.mjs \
474
- .maggie/booking/runtime/evidence.json
475
- node maggiedash/scripts/capture-booking-browser-evidence.mjs \
476
- --base-url https://booking.example.test \
477
- --storage-state .secrets/booking-storage-state.json \
478
- --output .maggie/booking/browser/evidence.json
479
- node maggiedash/scripts/validate-booking-browser-evidence.mjs \
480
- .maggie/booking/browser/evidence.json \
481
- .maggie/booking/browser
482
- ```
483
-
484
- The worker is fixture-safe and dry-run by default. Its report includes a
485
- correlation ID, `waitlistMatched`, and sanitized health codes for lock
486
- contention, stale worker or availability state, payment lag, notification
487
- retries, and dead letters. A real host must inject the PostgreSQL/provider/
488
- notification adapter and route the health result to its alerting system using
489
- the systemd, cron, or platform scheduler template from MaggieDash.
490
-
491
- The remaining host evidence is tracked in [`TASKS.md`](./TASKS.md): PostgreSQL
492
- transaction/lock integration, full host conformance, and protected browser
493
- release evidence. The local UI, security, payment, notification, and worker
494
- adapter gates are implemented; they do not replace real-host evidence.
495
-
496
- The runtime capture plan is host-owned and must cover all 47 contract endpoint
497
- IDs. It requires a dedicated test tenant, a traditional email/password session
498
- cookie, explicit mutation bodies, and `--confirm`. The generated evidence only
499
- contains canonical endpoint IDs/routes, status codes, and required-field
500
- booleans; it never stores response bodies, cookies, request bodies, or provider
501
- payloads. The protected workflow is
502
- `.github/workflows/booking-runtime-evidence.yml`.
503
-
504
- ## 4. Workflow phases
505
-
506
- The existing Maggie bootstrap phase model can be extended with booking-specific
507
- phases without changing the general bootstrap contract:
508
-
509
- ```text
510
- booking-discovery
511
- -> booking-contract
512
- -> booking-schema
513
- -> booking-availability
514
- -> booking-payments
515
- -> booking-dashboard
516
- -> booking-qa
517
- -> booking-release
518
- ```
519
-
520
- Each phase has `pending`, `running`, `passed`, or `failed`, a validation command,
521
- an owner, and a safe evidence path. A later phase cannot pass when an earlier
522
- required phase is pending or failed.
523
-
524
- ## 5. Feedback and memory integration
525
-
526
- When a booking skill run fails:
527
-
528
- 1. Generate a local feedback draft with skill, Maggie version, workflow/run ID,
529
- phase, fingerprint, expected/actual result, command, and safe evidence paths.
530
- 2. Let the user review and submit it through the existing feedback workflow.
531
- 3. After maintainer triage, add the confirmed general fix to a regression test,
532
- fixture, contract, or skill instruction.
533
- 4. Only then write a durable memory entry. Never write a project-specific
534
- preference or an unverified diagnosis directly to active memory.
535
-
536
- This keeps the Booking skill useful across projects without leaking one host's
537
- temporary configuration into another host.
538
-
539
- ## 6. CLI design rules
540
-
541
- - Read-only by default.
542
- - `--confirm` for migrations, provider configuration, publication, or any
543
- mutation.
544
- - `--project` defaults to `.` but all output paths are validated inside the
545
- project.
546
- - JSON reports use explicit schema versions.
547
- - Reports contain hashes and counts rather than raw provider responses.
548
- - No CLI accepts a token as an argument.
549
- - No CLI reads secrets into generated reports.
550
- - Every failed check names the phase, stable error code, and next action.
551
- - Every successful check prints the exact fixture/contract/revision it verified.
@@ -1,107 +0,0 @@
1
- # Booking task execution runbook
2
-
3
- This is the operating procedure for the Booking delivery board. The board is
4
- machine-readable in [`EXECUTION-BOARD.json`](./EXECUTION-BOARD.json), while
5
- this document defines what each status means.
6
-
7
- ## Task loop
8
-
9
- Every task follows the same six checkpoints:
10
-
11
- 1. **Task** — select one task whose dependencies are passed; record the task ID
12
- and current evidence in `PROGRESS.md`.
13
- 2. **Plan** — inspect the linked contracts and write the smallest complete
14
- implementation slice in the task's `plan` field or a linked design note.
15
- 3. **Implement** — change only the owning repository and preserve the host
16
- boundary; add fixtures before external integration where possible.
17
- 4. **Test** — run the task's listed commands and add a regression test for each
18
- defect found. A green source scan is not runtime evidence.
19
- 5. **Update docs** — update the contract, README, runbook, and affected
20
- product/data-flow documents in the same change.
21
- 6. **Record progress** — append commands, evidence paths, result, and remaining
22
- host dependencies to `PROGRESS.md`; only then change the board status.
23
-
24
- ## Status rules
25
-
26
- | Status | Meaning |
27
- |---|---|
28
- | `planned` | Dependencies are not all passed or implementation has not started |
29
- | `in_progress` | The current task has a recorded plan and an active implementation change |
30
- | `needs-evidence` | Code and local tests pass, but the required host/runtime evidence is missing |
31
- | `blocked` | The same external dependency has prevented progress for three consecutive delivery turns |
32
- | `passed` | Implementation, tests, docs, and acceptance evidence all pass |
33
-
34
- Never mark a task `passed` because files exist or a static validator finds a
35
- marker. Host authentication, PostgreSQL transactions, provider events, and
36
- browser evidence need evidence from the corresponding boundary.
37
-
38
- ## Stable commands
39
-
40
- From `ai-cmo-skills`:
41
-
42
- ```bash
43
- maggie booking tasks validate
44
- maggie booking tasks list
45
- maggie booking tasks show BK-019
46
- ```
47
-
48
- From `MaggieDash`:
49
-
50
- ```bash
51
- npm test
52
- npm run booking:worker -- --job all --now 2026-09-20T10:00:00Z
53
- npm run booking:stripe:validate
54
- npm run booking:runtime:evidence:test
55
- npm run booking:runtime:plan:test
56
- npm run booking:ops:evidence:test
57
- npm run booking:ops:evidence:regression:test
58
- npm run booking:customer-flow:test
59
- ```
60
-
61
- After a host is wired:
62
-
63
- ```bash
64
- npm run booking:runtime:plan:test
65
- npm run booking:runtime:evidence -- \
66
- --base-url https://booking-staging.example.test \
67
- --plan .secrets/booking-runtime-plan.json \
68
- --storage-state .secrets/booking-storage-state.json \
69
- --output .maggie/booking/runtime/evidence.json \
70
- --confirm
71
- node scripts/validate-booking-runtime-evidence.mjs \
72
- .maggie/booking/runtime/evidence.json
73
- maggie booking ops-validate --evidence .maggie/booking/ops-evidence.json
74
- maggie booking inspect --project .
75
- maggie booking runtime-validate --project . --evidence .maggie/booking/runtime-evidence.json
76
- maggie booking release-gate --project . --require-runtime \
77
- --evidence .maggie/booking/runtime-evidence.json \
78
- --require-browser --browser-evidence .maggie/booking/browser/evidence.json \
79
- --require-ops --ops-evidence .maggie/booking/ops-evidence.json
80
- ```
81
-
82
- `--require-browser` applies the same 17-screen × 3-viewport checks (51 screens) as the
83
- browser evidence validator, including safe screenshot paths, ready state,
84
- empty console errors, and empty failed-request reports.
85
-
86
- For a final delivery decision, also require the machine-readable board to be
87
- complete:
88
-
89
- ```bash
90
- maggie booking release-gate --project . --require-runtime \
91
- --evidence .maggie/booking/runtime-evidence.json \
92
- --require-browser --browser-evidence .maggie/booking/browser/evidence.json \
93
- --require-ops --ops-evidence .maggie/booking/ops-evidence.json \
94
- --require-board
95
- ```
96
-
97
- `--require-board` reads `docs/maggiedash-booking/EXECUTION-BOARD.json` (or the
98
- path supplied with `--board`) and fails closed while any task is `planned`,
99
- `in_progress`, `needs-evidence`, or `blocked`. `--board` without
100
- `--require-board` reports the board status without making it a release blocker.
101
-
102
- ## Evidence naming
103
-
104
- Use `.maggie/booking/` for local evidence. Evidence must contain schema
105
- versions, counts, statuses, timestamps, safe errors, and source revisions. It
106
- must not contain cookies, tokens, card/payment credentials, raw provider
107
- payloads, database URLs, or unredacted customer exports.