@pplethai/cli 0.2.2 → 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.
- package/README.md +11 -6
- package/dist/api.js +62 -16
- package/dist/bin.js +1 -1
- package/dist/cli.js +64 -16
- package/dist/commands/auth.js +8 -8
- package/dist/commands/deploy.js +20 -21
- package/dist/commands/env.js +70 -0
- package/dist/commands/info.js +238 -0
- package/dist/commands/init.js +69 -16
- package/dist/commands/upgrade.js +5 -5
- package/dist/device-flow.js +4 -4
- package/dist/errors.js +2 -2
- package/dist/git.js +12 -12
- package/dist/link.js +12 -2
- package/dist/node-deps.js +23 -0
- package/dist/npm.js +1 -1
- package/dist/scaffold.js +1 -1
- package/dist/skills.js +2 -2
- package/dist/update.js +11 -11
- package/package.json +1 -1
- package/skills/pple-platform/SKILL.md +30 -21
- package/skills/pple-platform/evals/evals.json +1 -1
- package/skills/pple-platform/references/deployment.md +75 -7
- package/skills/pple-platform/references/mini-app.md +3 -2
- package/skills/pple-platform/references/pple-id-auth.md +22 -16
- package/skills/pple-platform/references/project-scaffold.md +6 -6
- package/templates/golden-path/.env.example +5 -3
- package/templates/golden-path/CLAUDE.md +6 -2
- package/templates/golden-path/README.md +4 -4
- package/templates/golden-path/package-lock.json +8 -7
- package/templates/golden-path/package.json +2 -1
- package/templates/golden-path/web/App.tsx +22 -4
- package/templates/golden-path/web/app.css +0 -20
- package/templates/golden-path/web/main.tsx +16 -5
- package/templates/golden-path/web/pple.ts +6 -9
- package/templates/golden-path/web/vite-env.d.ts +3 -3
- 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 —
|
|
9
|
-
//
|
|
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.
|
|
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
|
|
4
|
-
// client id and public OAuth URLs), safe to ship
|
|
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;
|
|
@@ -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
|
-
}
|