app-sdk-cli 0.0.10 → 0.0.14

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/bin/index.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ await import("../dist/index.js");
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- console.log("Hello, world!");
1
+ import{Command as C}from"commander";import{apiURL as P}from"app-sdk-util";import{createAuthClient as R}from"better-auth/client";import{readFile as A}from"node:fs/promises";import v from"node:path";import{homedir as y}from"node:os";import S from"node:path";var c=S.join(y(),".app-sdk");var s=v.join(c,"auth.json");import{z as d}from"zod";var h=d.object({token:d.string().optional()});async function f(){try{let e=await A(s,"utf8");return h.parse(JSON.parse(e))}catch{}}async function l(){return((await f())?.token??"")||void 0}import{mkdir as b,writeFile as x}from"node:fs/promises";async function p(e){let t={token:e};await b(c,{recursive:!0}),await x(s,JSON.stringify(t))}var a=R({baseURL:P,basePath:"/v1/auth",fetchOptions:{throw:!0,auth:{type:"Bearer",token:l},onSuccess:async({response:e})=>{let t=e.headers.get("set-auth-token");t&&await p(t)}}});import{rm as L}from"node:fs/promises";async function g(){await L(s,{force:!0})}import{consoleURL as w}from"app-sdk-util";import{createServer as U}from"node:http";import j from"open";async function D(e,t){let o=new URL(e.url??"","http://localhost").searchParams.get("token");o&&await p(o);let i=new URL(`${w}/continue`);i.searchParams.set("event","authorized-cli");let r=await a.getSession();return r||i.searchParams.set("error","Invalid auth token"),t.writeHead(302,{location:i.toString()}),t.end(),r}async function I(e){let t=e.address();if(typeof t!="object"||!t)throw new Error("Invalid server address");let n=new URL(`${w}/auth-cli`);n.searchParams.set("port",t.port.toString());let o=n.toString();await j(o),console.log(`Authorization URL: ${o}`)}async function k(){return new Promise((e,t)=>{let n=U((o,i)=>{o.method==="GET"?D(o,i).then(r=>{r&&(e(r),n.close())}).catch(r=>{t(r),n.close()}):(i.writeHead(405),i.end())});n.listen(0,"localhost",()=>{I(n).catch(o=>{t(o),n.close()})})})}var m={name:"app-sdk-cli",version:"0.0.14",description:"App SDK CLI",keywords:["app-sdk","vibe-coding","ai-coding","low-code","no-code"],homepage:"https://www.app-sdk.dev",bugs:{url:"https://github.com/app-sdk/apps/issues",email:"team@app-sdk.dev"},license:"MIT",author:{name:"App SDK",email:"team@app-sdk.dev"},type:"module",imports:{"#./*":"./*"},exports:{".":"./dist/index.js"},bin:"./bin/index.js",dependencies:{"app-sdk-util":"workspace:^","better-auth":"^1.4.10",commander:"^14.0.2",open:"^10.2.0",zod:"^4.3.4"},devDependencies:{"@types/node":"^24.10.4","eslint-config-base":"workspace:^","type-fest":"^5.3.1"}};var u=new C;u.name(m.name).description(m.description).version(m.version);u.command("sign-in").description("Sign in to App SDK").action(async()=>{let e=await a.getSession();if(e)console.log(`You're already signed in as ${e.user.email}`);else{let t=await k();console.log(`You've successfully signed in as ${t.user.email}`)}});u.command("sign-out").description("Sign out from App SDK").action(async()=>{let e=await a.getSession();e?(await a.signOut(),console.log(`You've successfully signed out as ${e.user.email}`)):console.log("You're already signed out"),await g()});await u.parseAsync();
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "app-sdk-cli",
3
- "version": "0.0.10",
3
+ "version": "0.0.14",
4
+ "description": "App SDK CLI",
4
5
  "keywords": [
5
6
  "app-sdk",
6
7
  "vibe-coding",
@@ -23,10 +24,15 @@
23
24
  "#./*": "./*"
24
25
  },
25
26
  "exports": {
26
- ".": {
27
- "types": "./dist/index.d.ts",
28
- "import": "./dist/index.js"
29
- }
27
+ ".": "./dist/index.js"
28
+ },
29
+ "bin": "./bin/index.js",
30
+ "dependencies": {
31
+ "better-auth": "^1.4.10",
32
+ "commander": "^14.0.2",
33
+ "open": "^10.2.0",
34
+ "zod": "^4.3.4",
35
+ "app-sdk-util": "^0.0.14"
30
36
  },
31
37
  "files": [
32
38
  "assets",