@uplink-code/cli 0.0.1
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/lib/cli/index.js +13 -0
- package/lib/cli/src/commands/login.d.ts +11 -0
- package/lib/cli/src/commands/logout.d.ts +2 -0
- package/lib/cli/src/commands/session.d.ts +14 -0
- package/lib/cli/src/commands/whoami.d.ts +2 -0
- package/lib/cli/src/credentials.d.ts +10 -0
- package/lib/cli/src/index.d.ts +2 -0
- package/package.json +56 -0
package/lib/cli/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var C=Object.defineProperty;var i=(e,t)=>C(e,"name",{value:t,configurable:!0});import{Command as L}from"commander";import{homedir as K}from"node:os";import{join as l}from"node:path";import{mkdirSync as A,readFileSync as P,writeFileSync as S,unlinkSync as I,existsSync as d,chmodSync as b}from"node:fs";var c=l(K(),".uplink"),n=l(c,"credentials.json"),u="https://api.uplink.build";function m(){if(!d(n))return null;let e=P(n,"utf-8"),t=JSON.parse(e);if(t===null||typeof t!="object"||typeof t.apiKey!="string")return null;let p=t;return{apiKey:p.apiKey??"",apiUrl:p.apiUrl??u}}i(m,"readCredentials");function f(e){A(c,{recursive:!0,mode:448}),S(n,JSON.stringify(e,null,2),{mode:384}),b(n,384)}i(f,"writeCredentials");function y(){return d(n)?(I(n),!0):!1}i(y,"clearCredentials");function r(){return n}i(r,"credentialsPath");function g(){return u}i(g,"defaultApiUrl");function k(e){e.apiKey||(process.stderr.write(`Error: --api-key is required.
|
|
3
|
+
|
|
4
|
+
Generate an API key in console (https://console.uplink.build \u2192 Settings \u2192 API Keys) and run:
|
|
5
|
+
uplink login --api-key <key>
|
|
6
|
+
`),process.exit(1)),f({apiKey:e.apiKey,apiUrl:e.apiUrl??g()}),process.stdout.write(`\u2713 Credentials written to ${r()}
|
|
7
|
+
`)}i(k,"login");function w(){y()?process.stdout.write(`\u2713 Removed ${r()}
|
|
8
|
+
`):process.stdout.write(`Already logged out.
|
|
9
|
+
`)}i(w,"logout");function x(){let e=m();e||(process.stdout.write("Not logged in. Run `uplink login --api-key <key>`.\n"),process.exit(1));let t=e.apiKey.length>8?`${e.apiKey.slice(0,4)}\u2026${e.apiKey.slice(-4)}`:"****";process.stdout.write(`API key: ${t}
|
|
10
|
+
API URL: ${e.apiUrl}
|
|
11
|
+
Stored: ${r()}
|
|
12
|
+
`)}i(x,"whoami");function s(e){process.stderr.write(`\`uplink session ${e}\` is not implemented in v0.0.1. Stay tuned.
|
|
13
|
+
`),process.exit(1)}i(s,"stub");function v(){s("start")}i(v,"start");function h(){s("list")}i(h,"list");function U(){s("resume")}i(U,"resume");var o=new L;o.name("uplink").description("CLI for the Uplink browser automation platform").version("0.0.1");o.command("login").description("Store API credentials at ~/.uplink/credentials.json").requiredOption("--api-key <key>","API key generated in console").option("--api-url <url>","Override the Atomic API base URL").action(e=>{k(e)});o.command("logout").description("Remove stored credentials").action(w);o.command("whoami").description("Show stored credentials (masked)").action(x);var a=o.command("session").description("Manage Uplink sessions (stubbed in v0.0.1)");a.command("start").description("Create a new session").action(v);a.command("list").description("List recent sessions").action(h);a.command("resume <id>").description("Reattach to an existing session").action(U);o.parse();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface LoginOptions {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
apiUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* v0.0.1 supports paste-an-API-key only. Future: OAuth device flow
|
|
7
|
+
* (open browser, receive callback, store token). Doing the simpler
|
|
8
|
+
* thing first unblocks @uplink-code/mcp for developer-mode use.
|
|
9
|
+
*/
|
|
10
|
+
export declare function login(opts: LoginOptions): void;
|
|
11
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session commands — stubbed in v0.0.1.
|
|
3
|
+
*
|
|
4
|
+
* `start` will POST to the Atomic API to create a session and print
|
|
5
|
+
* an OTP + QR for device pairing. `list` will fetch the user's
|
|
6
|
+
* recent sessions. `resume` reattaches.
|
|
7
|
+
*
|
|
8
|
+
* Implementation lands once we have a shared Atomic API client
|
|
9
|
+
* (likely `@uplink-code/api-client` in this same monorepo).
|
|
10
|
+
*/
|
|
11
|
+
export declare function start(): void;
|
|
12
|
+
export declare function list(): void;
|
|
13
|
+
export declare function resume(): void;
|
|
14
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface Credentials {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function readCredentials(): Credentials | null;
|
|
6
|
+
export declare function writeCredentials(creds: Credentials): void;
|
|
7
|
+
export declare function clearCredentials(): boolean;
|
|
8
|
+
export declare function credentialsPath(): string;
|
|
9
|
+
export declare function defaultApiUrl(): string;
|
|
10
|
+
//# sourceMappingURL=credentials.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uplink-code/cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./lib/cli/src/index.d.ts",
|
|
8
|
+
"import": "./lib/cli/index.js",
|
|
9
|
+
"require": "./lib/cli/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"uplink": "./lib/cli/index.js"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"url": "git://github.com/uplink-code/uplink-ai.git"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"package.json",
|
|
23
|
+
"lib/cli/**/*.js",
|
|
24
|
+
"lib/cli/**/*.d.ts"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "npm run build:declarations && npm run build:transpile",
|
|
28
|
+
"build:transpile": "esbuild src/index.ts --bundle --keep-names --minify --format=esm --platform=node --external:commander --banner:js='#!/usr/bin/env node' --outfile=./lib/cli/index.js",
|
|
29
|
+
"build:declarations": "tsc -b",
|
|
30
|
+
"clean": "rm -rf lib",
|
|
31
|
+
"format:check": "prettier --check src/ package.json tsconfig.json",
|
|
32
|
+
"format:fix": "prettier --write src/ package.json tsconfig.json",
|
|
33
|
+
"lint": "eslint src/",
|
|
34
|
+
"lint:fix": "eslint --fix src/",
|
|
35
|
+
"prepare": "npm run build"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^24.3.1",
|
|
39
|
+
"esbuild": "^0.25.9",
|
|
40
|
+
"eslint-config-prettier": "^10.1.8",
|
|
41
|
+
"prettier": "^3.6.2",
|
|
42
|
+
"typescript": "^5.9.2",
|
|
43
|
+
"typescript-eslint": "^8.56.0"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"uplink",
|
|
47
|
+
"cli",
|
|
48
|
+
"automation"
|
|
49
|
+
],
|
|
50
|
+
"author": "scott@atomicfi.com",
|
|
51
|
+
"license": "proprietary",
|
|
52
|
+
"description": "CLI for the Uplink browser automation platform. Manages credentials and session lifecycle for use with @uplink-code/mcp and other developer tooling.",
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"commander": "^14.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|