@pplethai/cli 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +12 -14
  2. package/dist/bin.js +102 -102
  3. package/package.json +3 -6
  4. package/templates/golden-path/.dev.vars.example +0 -33
  5. package/templates/golden-path/.env.example +0 -10
  6. package/templates/golden-path/.github/workflows/ci.yml +0 -22
  7. package/templates/golden-path/AGENTS.md +0 -1
  8. package/templates/golden-path/CLAUDE.md +0 -191
  9. package/templates/golden-path/README.md +0 -121
  10. package/templates/golden-path/gitignore +0 -17
  11. package/templates/golden-path/index.html +0 -16
  12. package/templates/golden-path/migrations/0001_init.sql +0 -10
  13. package/templates/golden-path/overlay-mtime.mjs +0 -30
  14. package/templates/golden-path/package-lock.json +0 -4318
  15. package/templates/golden-path/package.json +0 -41
  16. package/templates/golden-path/scripts/assert-dev-compiled-out.mjs +0 -45
  17. package/templates/golden-path/shared/api.ts +0 -325
  18. package/templates/golden-path/src/auth.ts +0 -230
  19. package/templates/golden-path/src/call-service.ts +0 -147
  20. package/templates/golden-path/src/dataset-query.ts +0 -470
  21. package/templates/golden-path/src/dataset-schema.ts +0 -398
  22. package/templates/golden-path/src/db.ts +0 -32
  23. package/templates/golden-path/src/dev-call-service.ts +0 -392
  24. package/templates/golden-path/src/dev-personas.ts +0 -186
  25. package/templates/golden-path/src/dev-read-dataset.ts +0 -444
  26. package/templates/golden-path/src/dev-registry.ts +0 -294
  27. package/templates/golden-path/src/email.ts +0 -49
  28. package/templates/golden-path/src/entry-name.ts +0 -114
  29. package/templates/golden-path/src/env.ts +0 -38
  30. package/templates/golden-path/src/files.ts +0 -38
  31. package/templates/golden-path/src/identity-header.ts +0 -17
  32. package/templates/golden-path/src/index.ts +0 -282
  33. package/templates/golden-path/src/legal-identity.ts +0 -180
  34. package/templates/golden-path/src/levels.ts +0 -132
  35. package/templates/golden-path/src/notification-response.ts +0 -55
  36. package/templates/golden-path/src/notify.ts +0 -311
  37. package/templates/golden-path/src/party-email.ts +0 -183
  38. package/templates/golden-path/src/payment.ts +0 -676
  39. package/templates/golden-path/src/read-dataset.ts +0 -490
  40. package/templates/golden-path/src/registry.ts +0 -128
  41. package/templates/golden-path/src/vite-env.d.ts +0 -27
  42. package/templates/golden-path/test/apply-migrations.ts +0 -4
  43. package/templates/golden-path/test/call-service.test.ts +0 -288
  44. package/templates/golden-path/test/dev-call-service.test.ts +0 -455
  45. package/templates/golden-path/test/dev-read-dataset.test.ts +0 -379
  46. package/templates/golden-path/test/dev-registry.test.ts +0 -404
  47. package/templates/golden-path/test/effective-sub.test.ts +0 -101
  48. package/templates/golden-path/test/email-offline.test.ts +0 -51
  49. package/templates/golden-path/test/email.test.ts +0 -117
  50. package/templates/golden-path/test/env.d.ts +0 -17
  51. package/templates/golden-path/test/fixtures/overlay/branch-list/entry.md +0 -85
  52. package/templates/golden-path/test/fixtures/overlay/branch-list/mocks/audience.json +0 -3
  53. package/templates/golden-path/test/fixtures/overlay/branch-list/mocks/named.json +0 -3
  54. package/templates/golden-path/test/fixtures/overlay/branch-list/mocks/offices.json +0 -6
  55. package/templates/golden-path/test/fixtures/overlay/branch-list/mocks/roster.json +0 -3
  56. package/templates/golden-path/test/fixtures/overlay/branch-list/mocks/summary.json +0 -1
  57. package/templates/golden-path/test/fixtures/overlay/catalog/entry.md +0 -8
  58. package/templates/golden-path/test/fixtures/overlay/catalog/mocks/responses.json +0 -7
  59. package/templates/golden-path/test/fixtures/overlay/election/2027/score/entry.md +0 -11
  60. package/templates/golden-path/test/fixtures/overlay/election/2027/score/mocks/responses.json +0 -7
  61. package/templates/golden-path/test/fixtures/overlay/election/results/entry.md +0 -24
  62. package/templates/golden-path/test/fixtures/overlay/election/results/mocks/turnout.json +0 -1
  63. package/templates/golden-path/test/fixtures/overlay/orders/entry.md +0 -12
  64. package/templates/golden-path/test/fixtures/overlay/orders/mocks/responses.json +0 -36
  65. package/templates/golden-path/test/fixtures/overlay/platform/email/entry.md +0 -12
  66. package/templates/golden-path/test/fixtures/overlay/platform/email/mocks/responses.json +0 -11
  67. package/templates/golden-path/test/fixtures/overlay/platform/legal-identity/entry.md +0 -8
  68. package/templates/golden-path/test/fixtures/overlay/platform/legal-identity/mocks/responses.json +0 -13
  69. package/templates/golden-path/test/fixtures/overlay/platform/payments/entry.md +0 -12
  70. package/templates/golden-path/test/fixtures/overlay/platform/payments/mocks/responses.json +0 -98
  71. package/templates/golden-path/test/fixtures/overlay/platform/sms/entry.md +0 -10
  72. package/templates/golden-path/test/fixtures/overlay/platform/sms/mocks/responses.json +0 -7
  73. package/templates/golden-path/test/fixtures/overlay/score/entry.md +0 -10
  74. package/templates/golden-path/test/fixtures/overlay/score/mocks/responses.json +0 -7
  75. package/templates/golden-path/test/harness.ts +0 -153
  76. package/templates/golden-path/test/interaction.test.ts +0 -230
  77. package/templates/golden-path/test/legal-identity.test.ts +0 -323
  78. package/templates/golden-path/test/membership.test.ts +0 -105
  79. package/templates/golden-path/test/notification-response.test.ts +0 -79
  80. package/templates/golden-path/test/payment-app.test.ts +0 -211
  81. package/templates/golden-path/test/payment-offline.test.ts +0 -91
  82. package/templates/golden-path/test/payment.test.ts +0 -518
  83. package/templates/golden-path/test/payments-offline.ts +0 -33
  84. package/templates/golden-path/test/read-dataset.test.ts +0 -387
  85. package/templates/golden-path/test/service-call.test.ts +0 -166
  86. package/templates/golden-path/test/smoke.test.ts +0 -464
  87. package/templates/golden-path/tsconfig.json +0 -20
  88. package/templates/golden-path/tsconfig.worker.json +0 -21
  89. package/templates/golden-path/vite.config.ts +0 -12
  90. package/templates/golden-path/vitest.config.ts +0 -28
  91. package/templates/golden-path/web/App.tsx +0 -478
  92. package/templates/golden-path/web/app.css +0 -83
  93. package/templates/golden-path/web/main.tsx +0 -51
  94. package/templates/golden-path/web/pple.ts +0 -124
  95. package/templates/golden-path/web/vite-env.d.ts +0 -10
  96. package/templates/golden-path/wrangler.jsonc +0 -89
  97. package/templates/payment-bridge/.github/workflows/ci.yml +0 -21
  98. package/templates/payment-bridge/CLAUDE.md +0 -9
  99. package/templates/payment-bridge/README.md +0 -57
  100. package/templates/payment-bridge/docs/verify-webhook.md +0 -80
  101. package/templates/payment-bridge/docs/verify-webhook.ts +0 -29
  102. package/templates/payment-bridge/gitignore +0 -5
  103. package/templates/payment-bridge/package-lock.json +0 -4198
  104. package/templates/payment-bridge/package.json +0 -21
  105. package/templates/payment-bridge/src/bridge-key.ts +0 -18
  106. package/templates/payment-bridge/src/env.ts +0 -14
  107. package/templates/payment-bridge/src/index.ts +0 -39
  108. package/templates/payment-bridge/src/platform.ts +0 -49
  109. package/templates/payment-bridge/src/webhook.ts +0 -86
  110. package/templates/payment-bridge/test/docs.test.ts +0 -9
  111. package/templates/payment-bridge/test/fixtures/payments-responses.json +0 -98
  112. package/templates/payment-bridge/test/harness.ts +0 -78
  113. package/templates/payment-bridge/test/inbound.test.ts +0 -138
  114. package/templates/payment-bridge/test/webhook.test.ts +0 -174
  115. package/templates/payment-bridge/tsconfig.json +0 -22
  116. package/templates/payment-bridge/vitest.config.ts +0 -8
  117. package/templates/payment-bridge/wrangler.jsonc +0 -15
  118. package/templates/payment-bridge.version +0 -1
package/README.md CHANGED
@@ -105,8 +105,8 @@ owns. `pple whoami` renews an expiring token silently via the refresh token.
105
105
  **`pple init`** creates a Builder App (prompt for App Name, or `--name`) via
106
106
  the same Provisioner `POST /apps` the Console uses, waits until the app is
107
107
  ready, then scaffolds it — or, given an App Slug, scaffolds an app that
108
- already exists. Either way it fetches the app's code, copies the golden-path
109
- template under the app's own name, writes `.pple/app.json` linking the folder
108
+ already exists. Either way it fetches the app's code, writes the golden-path
109
+ template the platform serves now under the app's own name (ADR-0048), writes `.pple/app.json` linking the folder
110
110
  to the app, and installs the Skill and Platform Rules the Builder's AI coding
111
111
  agent reads (ADR-0001, ADR-0019). The App Slug stays platform-generated;
112
112
  bare `pple init` in a folder that already has an App Link is refused.
@@ -158,9 +158,8 @@ and name roles by key or Thai label, resolved against the Provisioner's
158
158
  `GET /role-options` (`pple roles`) — the list the Console's picker shows.
159
159
 
160
160
  **`pple upgrade`** asks npm what the latest `@pplethai/cli` is and, when
161
- this copy is one npm's global root holds, installs it — which is also how
162
- the golden-path template moves forward (ADR-0007; the Skill no longer
163
- travels with the CLI, ADR-0019). Any
161
+ this copy is one npm's global root holds, installs it (ADR-0007). Neither the
162
+ Skill nor the templates travel with the CLI any more (ADR-0019, ADR-0048). Any
164
163
  other install channel is told the manual `npm install -g @pplethai/cli`
165
164
  line rather than having a second copy installed over the first, and so is a
166
165
  failed install, carrying npm's own reason. The CLI never uses `sudo`: a global
@@ -200,11 +199,12 @@ echo '{ "updateCheck": false }' > ~/.config/pple/config.json # this machine
200
199
  | `src/target.ts` | which app a command acts on (`--app`, else the App Link) |
201
200
  | `src/commands/` | the commands, each taking `Deps` and what it was given |
202
201
  | `src/labels.ts`, `src/requests.ts` | the Thai a Builder reads for platform values and Requests |
203
- | `src/deps.ts` | every seam: fetch, clock, subprocesses, output, template dir |
202
+ | `src/deps.ts` | every seam: fetch, clock, subprocesses, output, local template override |
204
203
  | `src/device-flow.ts` | RFC 8628 against PPLE ID |
205
204
  | `src/api.ts` | the Provisioner API, and the only place that knows its error codes |
206
205
  | `src/git.ts` | git, and the only place that names it or holds the repo token |
207
- | `src/scaffold.ts` | copying the golden-path template |
206
+ | `src/template.ts` | fetching a template from the platform and checking it before it is written |
207
+ | `src/scaffold.ts` | writing a template into the app folder under the app's name |
208
208
  | `src/guidance.ts` | refreshing the Skill and Platform Rules into an app folder |
209
209
  | `src/npm.ts` | npm: the registry's latest version, and the install channel |
210
210
  | `src/update.ts` | the daily update check, its cadence state, and its opt-outs |
@@ -216,7 +216,7 @@ echo '{ "updateCheck": false }' > ~/.config/pple/config.json # this machine
216
216
  npm install
217
217
  npm test # drives whole commands against a fake Provisioner and real git
218
218
  npm run typecheck
219
- npm run build # bundles the template, then esbuild → dist/bin.js
219
+ npm run build # esbuild → dist/bin.js
220
220
  ```
221
221
 
222
222
  Tests run the real command path — real `git` in a temp directory, a fake
@@ -229,12 +229,10 @@ minted. A local path would let every clone and push succeed with no credential
229
229
  at all, and nothing would show that the platform's token is what opens a
230
230
  private repo.
231
231
 
232
- The published package carries its own copy of the golden-path template and of
233
- the Payment Bridge template (`npm run build:template` copies `../template` and
234
- `../payment-bridge-template`; `resolveTemplateDir(env, "payment-bridge")` finds
235
- the second, and `scaffold` copies either). Running from a checkout falls back to
236
- those repo paths directly. The Skill is not bundled: tests serve it from
237
- the fake platform. `PPLE_TEMPLATE_DIR`, `PPLE_API_BASE`, `PPLE_SSO_BASE`, `PPLE_CLIENT_ID`,
232
+ The published package carries no template (ADR-0048): `pple init` fetches the
233
+ golden path or the Payment Bridge from the Provisioner's `GET /templates`, which
234
+ CI fills on every Platform deploy (`scripts/publish-templates.mjs`). Tests serve
235
+ both from folders the fake platform reads, as they serve the Skill. `PPLE_TEMPLATE_DIR`, `PPLE_API_BASE`, `PPLE_SSO_BASE`, `PPLE_CLIENT_ID`,
238
236
  `PPLE_REPO_BASE`, and `PPLE_REGISTRY_BASE` override the defaults for staging
239
237
  work.
240
238