@pplethai/cli 0.2.1 → 0.3.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 (38) hide show
  1. package/README.md +11 -6
  2. package/dist/api.js +62 -16
  3. package/dist/bin.js +1 -1
  4. package/dist/cli.js +64 -16
  5. package/dist/commands/auth.js +8 -8
  6. package/dist/commands/deploy.js +26 -19
  7. package/dist/commands/env.js +70 -0
  8. package/dist/commands/info.js +238 -0
  9. package/dist/commands/init.js +69 -16
  10. package/dist/commands/upgrade.js +5 -5
  11. package/dist/device-flow.js +4 -4
  12. package/dist/errors.js +2 -2
  13. package/dist/git.js +12 -12
  14. package/dist/link.js +12 -2
  15. package/dist/node-deps.js +23 -0
  16. package/dist/npm.js +1 -1
  17. package/dist/scaffold.js +1 -1
  18. package/dist/skills.js +2 -2
  19. package/dist/update.js +11 -11
  20. package/package.json +1 -1
  21. package/skills/pple-platform/SKILL.md +30 -21
  22. package/skills/pple-platform/evals/evals.json +1 -1
  23. package/skills/pple-platform/references/deployment.md +75 -7
  24. package/skills/pple-platform/references/mini-app.md +3 -2
  25. package/skills/pple-platform/references/pple-id-auth.md +22 -16
  26. package/skills/pple-platform/references/project-scaffold.md +6 -6
  27. package/templates/golden-path/.env.example +5 -3
  28. package/templates/golden-path/CLAUDE.md +6 -2
  29. package/templates/golden-path/README.md +4 -4
  30. package/templates/golden-path/package-lock.json +8 -7
  31. package/templates/golden-path/package.json +2 -1
  32. package/templates/golden-path/web/App.tsx +22 -4
  33. package/templates/golden-path/web/app.css +0 -20
  34. package/templates/golden-path/web/main.tsx +16 -5
  35. package/templates/golden-path/web/pple.ts +6 -9
  36. package/templates/golden-path/web/vite-env.d.ts +3 -3
  37. package/templates/golden-path/wrangler.jsonc +9 -0
  38. package/templates/golden-path/web/NotInApp.tsx +0 -23
@@ -5,14 +5,16 @@
5
5
  // the Worker accepts you as a fake user.
6
6
  // 2. Inside PPLE Today — the SDK captures the access token from the launch
7
7
  // URL; we attach it to every API call.
8
- // 3. A plain browser — not inside PPLE Today, so we show the NOT_IN_APP
9
- // screen instead of trying to sign in.
10
- import { isInMiniAppUserAgent } from "@pplethai/components";
8
+ // 3. A plain browser — the same SDK runs the PPLE ID OIDC sign-in (redirect
9
+ // / callback) and hands back an access token.
11
10
  import { PPLEMiniApp } from "@pplethai/pple-today-miniapp-sdk";
12
11
 
13
- // Provisioned per app, injected at build time. Only needed inside PPLE Today.
12
+ // Provisioned per app, injected at build time. Needed for the SDK in both
13
+ // PPLE Today and the browser (browser login uses the OIDC redirect flow).
14
14
  const OAUTH_URL = import.meta.env.VITE_OAUTH_URL ?? "";
15
15
  const OAUTH_CLIENT_ID = import.meta.env.VITE_OAUTH_CLIENT_ID ?? "";
16
+ // Must match a redirect URI on the app's PPLE ID OAuth client. Provisioning
17
+ // registers the mini-app URL; defaulting to this origin keeps them aligned.
16
18
  const OAUTH_REDIRECT_URI =
17
19
  import.meta.env.VITE_OAUTH_REDIRECT_URI ?? window.location.origin;
18
20
 
@@ -21,7 +23,6 @@ const DEV_TOKEN = "dev-token";
21
23
 
22
24
  export type Bootstrap =
23
25
  | { kind: "signed-in" }
24
- | { kind: "not-in-app" }
25
26
  | { kind: "error"; message: string };
26
27
 
27
28
  let token: string | null = null;
@@ -34,10 +35,6 @@ export async function bootstrap(): Promise<Bootstrap> {
34
35
  return { kind: "signed-in" };
35
36
  }
36
37
 
37
- if (!isInMiniAppUserAgent(navigator.userAgent)) {
38
- return { kind: "not-in-app" };
39
- }
40
-
41
38
  const sdk = new PPLEMiniApp({
42
39
  oauthUrl: OAUTH_URL,
43
40
  oauthClientId: OAUTH_CLIENT_ID,
@@ -1,8 +1,8 @@
1
1
  /// <reference types="vite/client" />
2
2
 
3
- // Build-time OIDC config for the mini-app SDK. These are public values (a
4
- // client id and public OAuth URLs), safe to ship in the bundle. The platform
5
- // injects them at deploy time; see .env.example.
3
+ // Build-time OIDC config for the mini-app SDK (PPLE Today + browser login).
4
+ // These are public values (a client id and public OAuth URLs), safe to ship
5
+ // in the bundle. The platform injects them at deploy time; see .env.example.
6
6
  interface ImportMetaEnv {
7
7
  readonly VITE_OAUTH_URL?: string;
8
8
  readonly VITE_OAUTH_CLIENT_ID?: string;
@@ -9,6 +9,15 @@
9
9
  "main": "src/index.ts",
10
10
  "compatibility_date": "2026-06-01",
11
11
 
12
+ // Workers Logs: `console.log` and uncaught exceptions are retained, so a
13
+ // 500 in production can be read back instead of guessed at.
14
+ //
15
+ // This setting governs local development only. Your deployed app does not
16
+ // ship this file — the platform uploads the Worker through the Cloudflare
17
+ // API and sets observability itself (workers/src/provisioner/tenant-worker.ts),
18
+ // so logging is on in production whether or not this line survives.
19
+ "observability": { "enabled": true, "head_sampling_rate": 1 },
20
+
12
21
  // The React SPA (built to dist/client by Vite) is served for any request
13
22
  // that isn't worker-first. "/api/*" is the app's API; "/.pple/*" is reserved
14
23
  // for the platform deploy probe. "single-page-application" makes every
@@ -1,23 +0,0 @@
1
- import { Card, CardContent, Logo } from "@pplethai/components";
2
-
3
- // Shown when the app is opened outside PPLE Today (a plain browser). There is
4
- // no sign-in here on purpose: mini-apps authenticate through PPLE Today.
5
- export function NotInApp() {
6
- return (
7
- <main className="screen screen--center">
8
- <Card className="card">
9
- <CardContent>
10
- <div className="notinapp">
11
- <Logo className="notinapp__logo" title="People's Party" />
12
- <h1 className="notinapp__title">เปิดในแอป PPLE Today</h1>
13
- <p>
14
- แอปนี้ทำงานภายในแอป PPLE Today เท่านั้น
15
- กรุณาเปิดจากแอป PPLE Today เพื่อเข้าสู่ระบบ
16
- </p>
17
- <p className="muted">Please open this mini-app from inside PPLE Today to sign in.</p>
18
- </div>
19
- </CardContent>
20
- </Card>
21
- </main>
22
- );
23
- }