@ahood/cli 0.4.0 → 0.4.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/dist/help.js +3 -1
- package/dist/index.js +9 -2
- package/package.json +2 -2
- package/dist/commands/list-mine.js +0 -16
package/dist/help.js
CHANGED
|
@@ -14,7 +14,9 @@ export const TOP_LEVEL_COMMANDS_HELP = [
|
|
|
14
14
|
{
|
|
15
15
|
usage: "ahood token create <name>|list [--json]|revoke <id> [--yes]",
|
|
16
16
|
summary: "Manage personal API tokens.",
|
|
17
|
-
desc: "Manage personal API tokens.
|
|
17
|
+
desc: "Manage personal API tokens. All three subcommands require an existing browser-backed session -- a CLI " +
|
|
18
|
+
"session authenticated with a bearer token can't manage tokens end-to-end; use /settings/tokens in the " +
|
|
19
|
+
"browser instead.",
|
|
18
20
|
flags: ["--yes (revoke only) Skip the confirmation prompt and revoke immediately."],
|
|
19
21
|
examples: ["ahood token create ci-runner", "ahood token list --json", "ahood token revoke <id>", "ahood token revoke <id> --yes"],
|
|
20
22
|
},
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
2
3
|
import { login } from "./commands/login.js";
|
|
3
4
|
import { logout } from "./commands/logout.js";
|
|
4
5
|
import { whoami } from "./commands/whoami.js";
|
|
@@ -176,8 +177,14 @@ async function main() {
|
|
|
176
177
|
// Only auto-run when this module is the actual entrypoint (i.e. invoked as
|
|
177
178
|
// `ahood ...` / `node dist/index.js ...`), not when it's imported by a test
|
|
178
179
|
// -- process.argv[1] is dist/index.js in the former case, something else
|
|
179
|
-
// (the test runner) in the latter.
|
|
180
|
-
|
|
180
|
+
// (the test runner) in the latter. Comparing realpaths (not raw argv[1])
|
|
181
|
+
// is required here: npm's installed `ahood` binary is a symlink to
|
|
182
|
+
// dist/index.js, so process.argv[1] is the symlink's path while
|
|
183
|
+
// import.meta.url resolves through the symlink to the real file -- a raw
|
|
184
|
+
// string comparison never matches for any real npm-installed invocation,
|
|
185
|
+
// which silently skipped main() entirely (every command exited 0 with no
|
|
186
|
+
// output, since nothing ever ran).
|
|
187
|
+
const isEntrypoint = process.argv[1] !== undefined && import.meta.url === `file://${realpathSync(process.argv[1])}`;
|
|
181
188
|
if (isEntrypoint) {
|
|
182
189
|
main();
|
|
183
190
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahood/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "CLI for ahood, a registry for installing and publishing Claude Code skills.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/AlexKay28/ahood-cli",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "tsc -p tsconfig.json",
|
|
29
|
+
"build": "rm -rf dist && tsc -p tsconfig.json",
|
|
30
30
|
"prepublishOnly": "npm run build",
|
|
31
31
|
"test": "vitest run",
|
|
32
32
|
"sync-readme": "node scripts/sync-readme.mjs"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { apiJson } from "../http.js";
|
|
2
|
-
export async function listMine(args = []) {
|
|
3
|
-
const jsonOutput = args.includes("--json");
|
|
4
|
-
const { skills } = await apiJson("/api/v1/skills?mine=true");
|
|
5
|
-
if (jsonOutput) {
|
|
6
|
-
console.log(JSON.stringify(skills));
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (skills.length === 0) {
|
|
10
|
-
console.log("You haven't published any skills yet.");
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
for (const skill of skills) {
|
|
14
|
-
console.log(`${skill.profiles.username}/${skill.slug} (${skill.visibility}) - ${skill.name}${skill.tagline ? `: ${skill.tagline}` : ""} (${skill.downloads_count} downloads, ${skill.stars_count} stars)`);
|
|
15
|
-
}
|
|
16
|
-
}
|