@shipd-ai/cli 0.1.0 → 0.1.2
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 +7 -3
- package/dist/commands/auth.d.ts +1 -2
- package/dist/commands/auth.js +3 -4
- package/dist/commands/quests.d.ts +13 -0
- package/dist/commands/quests.js +37 -0
- package/dist/index.js +2 -1
- package/dist/quests.d.ts +3 -1
- package/dist/quests.js +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
`shipd` is the admin command line for Shipd quests. Point it at a Harbor task
|
|
4
4
|
directory (or an existing task) and it runs the quest's checks on the quest's
|
|
5
5
|
own infrastructure, then returns the same structured output the product shows.
|
|
6
|
-
|
|
7
|
-
`adhocChecks:*` contract works the same way.
|
|
6
|
+
The CLI is quest-agnostic: every command takes `--quest <quest>`, and any
|
|
7
|
+
quest that implements the small `adhocChecks:*` contract works the same way.
|
|
8
|
+
`shipd quests` lists the quests available (olympus today, which is also the
|
|
9
|
+
default when `--quest` is omitted).
|
|
8
10
|
|
|
9
11
|
Admins only: every quest entrypoint checks the caller's effective admin role.
|
|
10
12
|
|
|
@@ -14,8 +16,9 @@ Admin docs, the supported checks, and a copy-paste setup prompt for coding agent
|
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
18
|
npm install -g @shipd-ai/cli
|
|
17
|
-
shipd login # opens https://shipd.ai/
|
|
19
|
+
shipd login # opens https://shipd.ai/cli-auth (one token for every quest); or: shipd login --token <jwt>
|
|
18
20
|
shipd whoami
|
|
21
|
+
shipd quests # which quests this CLI can talk to
|
|
19
22
|
```
|
|
20
23
|
|
|
21
24
|
`login` opens the token page in your browser; paste the token back into the
|
|
@@ -107,6 +110,7 @@ check with `status`, `verdict`, `output`, `error`, `durationMs`, and `steps`
|
|
|
107
110
|
|
|
108
111
|
| Variable | Effect |
|
|
109
112
|
| --- | --- |
|
|
113
|
+
| `SHIPD_AUTH_URL` | Override the platform login page `shipd login` opens (default `https://shipd.ai/cli-auth`). |
|
|
110
114
|
| `SHIPD_<QUEST>_URL` | Override the quest's base URL (for example `SHIPD_OLYMPUS_URL`). |
|
|
111
115
|
| `SHIPD_<QUEST>_CONVEX_URL` | Skip `/api/cli/config` and talk to this Convex deployment. |
|
|
112
116
|
| `SHIPD_HOME` | Credentials and caches directory (default `~/.shipd`). |
|
package/dist/commands/auth.d.ts
CHANGED
|
@@ -9,8 +9,7 @@ export declare const login: import("citty").CommandDef<{
|
|
|
9
9
|
};
|
|
10
10
|
readonly quest: {
|
|
11
11
|
readonly type: "string";
|
|
12
|
-
readonly description: "
|
|
13
|
-
readonly default: "olympus";
|
|
12
|
+
readonly description: "Open this quest's own login page instead of the platform page (the token works for every quest either way)";
|
|
14
13
|
};
|
|
15
14
|
}>;
|
|
16
15
|
export declare const logout: import("citty").CommandDef<import("citty").ArgsDef>;
|
package/dist/commands/auth.js
CHANGED
|
@@ -4,7 +4,7 @@ import { defineCommand } from "citty";
|
|
|
4
4
|
import { clearCredentials, loadCredentials, saveCredentials } from "../auth.js";
|
|
5
5
|
import { UsageError } from "../errors.js";
|
|
6
6
|
import { printJson } from "../format.js";
|
|
7
|
-
import {
|
|
7
|
+
import { platformAuthUrl, questAuthUrl } from "../quests.js";
|
|
8
8
|
function openBrowser(url) {
|
|
9
9
|
if (process.platform === "win32") {
|
|
10
10
|
// `start` is a cmd.exe built-in, not a standalone executable.
|
|
@@ -27,8 +27,7 @@ function prompt(question) {
|
|
|
27
27
|
const questArg = {
|
|
28
28
|
quest: {
|
|
29
29
|
type: "string",
|
|
30
|
-
description:
|
|
31
|
-
default: DEFAULT_QUEST,
|
|
30
|
+
description: "Open this quest's own login page instead of the platform page (the token works for every quest either way)",
|
|
32
31
|
},
|
|
33
32
|
};
|
|
34
33
|
export const login = defineCommand({
|
|
@@ -39,7 +38,7 @@ export const login = defineCommand({
|
|
|
39
38
|
"no-browser": { type: "boolean", description: "Print the login URL instead of opening it" },
|
|
40
39
|
},
|
|
41
40
|
run: async ({ args }) => {
|
|
42
|
-
const authUrl = questAuthUrl(args.quest);
|
|
41
|
+
const authUrl = args.quest ? questAuthUrl(args.quest) : platformAuthUrl();
|
|
43
42
|
let token = args.token?.trim();
|
|
44
43
|
if (!token) {
|
|
45
44
|
if (args["no-browser"]) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type QuestRow = {
|
|
2
|
+
quest: string;
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
default: boolean;
|
|
5
|
+
};
|
|
6
|
+
/** The quests this CLI knows how to talk to, with their resolved base URLs. */
|
|
7
|
+
export declare function listQuests(): QuestRow[];
|
|
8
|
+
export declare const quests: import("citty").CommandDef<{
|
|
9
|
+
readonly json: {
|
|
10
|
+
readonly type: "boolean";
|
|
11
|
+
readonly description: "Output as JSON";
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { printJson, printTable } from "../format.js";
|
|
3
|
+
import { DEFAULT_QUEST, knownQuests, questBaseUrl } from "../quests.js";
|
|
4
|
+
/** The quests this CLI knows how to talk to, with their resolved base URLs. */
|
|
5
|
+
export function listQuests() {
|
|
6
|
+
return knownQuests().map((quest) => ({
|
|
7
|
+
quest,
|
|
8
|
+
baseUrl: questBaseUrl(quest),
|
|
9
|
+
default: quest === DEFAULT_QUEST,
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
export const quests = defineCommand({
|
|
13
|
+
meta: {
|
|
14
|
+
name: "quests",
|
|
15
|
+
description: "List the quests this CLI can run checks for (and which one --quest defaults to)",
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
19
|
+
},
|
|
20
|
+
run: async ({ args }) => {
|
|
21
|
+
const rows = listQuests();
|
|
22
|
+
if (args.json) {
|
|
23
|
+
printJson(rows);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
printTable(rows.map((row) => ({
|
|
27
|
+
quest: row.quest,
|
|
28
|
+
baseUrl: row.baseUrl,
|
|
29
|
+
default: row.default ? "yes" : "",
|
|
30
|
+
})), [
|
|
31
|
+
{ key: "quest", label: "Quest" },
|
|
32
|
+
{ key: "baseUrl", label: "Base URL" },
|
|
33
|
+
{ key: "default", label: "Default" },
|
|
34
|
+
]);
|
|
35
|
+
console.log("\n Every command takes --quest <quest>; the default is used when omitted.\n");
|
|
36
|
+
},
|
|
37
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { execFileSync } from "node:child_process";
|
|
|
3
3
|
import { defineCommand, runCommand, showUsage } from "citty";
|
|
4
4
|
import { login, logout, whoami } from "./commands/auth.js";
|
|
5
5
|
import checks from "./commands/checks.js";
|
|
6
|
+
import { quests } from "./commands/quests.js";
|
|
6
7
|
import { EXIT_USAGE, errorMessage, exitCodeForError } from "./errors.js";
|
|
7
8
|
import { checkVersion, PACKAGE_NAME, VERSION } from "./quests.js";
|
|
8
9
|
const update = defineCommand({
|
|
@@ -35,7 +36,7 @@ const main = defineCommand({
|
|
|
35
36
|
version: VERSION,
|
|
36
37
|
description: "Shipd admin CLI: run quest checks on Harbor tasks or existing tasks",
|
|
37
38
|
},
|
|
38
|
-
subCommands: { login, logout, whoami, checks, update, version },
|
|
39
|
+
subCommands: { login, logout, whoami, quests, checks, update, version },
|
|
39
40
|
});
|
|
40
41
|
async function run() {
|
|
41
42
|
const rawArgs = process.argv.slice(2);
|
package/dist/quests.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export declare const DEFAULT_QUEST = "olympus";
|
|
|
4
4
|
export declare function knownQuests(): string[];
|
|
5
5
|
/** `SHIPD_<QUEST>_URL` override, or NODE_ENV=development → localhost. */
|
|
6
6
|
export declare function questBaseUrl(quest: string): string;
|
|
7
|
-
/**
|
|
7
|
+
/** `SHIPD_AUTH_URL` override, or NODE_ENV=development → localhost. */
|
|
8
|
+
export declare function platformAuthUrl(): string;
|
|
9
|
+
/** A quest's own copy of the token page (the platform page is the default). */
|
|
8
10
|
export declare function questAuthUrl(quest: string): string;
|
|
9
11
|
export interface QuestConfig {
|
|
10
12
|
convexUrl: string;
|
package/dist/quests.js
CHANGED
|
@@ -32,7 +32,21 @@ export function questBaseUrl(quest) {
|
|
|
32
32
|
}
|
|
33
33
|
return process.env.NODE_ENV === "development" ? entry.dev : entry.prod;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
// The platform-level token page. The shipd-cli token works for every quest,
|
|
36
|
+
// so the browser login lands here; `questAuthUrl` stays for a quest's own
|
|
37
|
+
// copy of the page (`shipd login --quest <quest>`).
|
|
38
|
+
const PLATFORM_AUTH_URL = {
|
|
39
|
+
prod: "https://shipd.ai/cli-auth",
|
|
40
|
+
dev: "http://localhost:3010/cli-auth",
|
|
41
|
+
};
|
|
42
|
+
/** `SHIPD_AUTH_URL` override, or NODE_ENV=development → localhost. */
|
|
43
|
+
export function platformAuthUrl() {
|
|
44
|
+
const override = process.env.SHIPD_AUTH_URL;
|
|
45
|
+
if (override)
|
|
46
|
+
return override;
|
|
47
|
+
return process.env.NODE_ENV === "development" ? PLATFORM_AUTH_URL.dev : PLATFORM_AUTH_URL.prod;
|
|
48
|
+
}
|
|
49
|
+
/** A quest's own copy of the token page (the platform page is the default). */
|
|
36
50
|
export function questAuthUrl(quest) {
|
|
37
51
|
return `${questBaseUrl(quest)}/cli-auth`;
|
|
38
52
|
}
|