@shipd-ai/cli 0.1.0 → 0.1.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/README.md +6 -3
- package/dist/commands/quests.d.ts +13 -0
- package/dist/commands/quests.js +37 -0
- package/dist/index.js +2 -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
|
|
19
|
+
shipd login # opens the quest's login page (olympus by default); 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
|
|
@@ -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);
|