easyclaw-link 1.0.0 → 1.2.0
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 +35 -38
- package/dist/index.js +3146 -25
- package/package.json +14 -10
- package/dist/commands/list.d.ts +0 -2
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js +0 -51
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/login.d.ts +0 -2
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -82
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/publish.d.ts +0 -6
- package/dist/commands/publish.d.ts.map +0 -1
- package/dist/commands/publish.js +0 -118
- package/dist/commands/publish.js.map +0 -1
- package/dist/config.d.ts +0 -9
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -77
- package/dist/config.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/src/commands/list.ts +0 -66
- package/src/commands/login.ts +0 -53
- package/src/commands/publish.ts +0 -98
- package/src/config.ts +0 -45
- package/src/index.ts +0 -31
- package/tsconfig.json +0 -18
package/src/config.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import * as os from "os";
|
|
4
|
-
|
|
5
|
-
const CONFIG_DIR = path.join(os.homedir(), ".easyclaw");
|
|
6
|
-
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
7
|
-
|
|
8
|
-
export interface Config {
|
|
9
|
-
apiKey?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function readConfig(): Config {
|
|
13
|
-
try {
|
|
14
|
-
if (!fs.existsSync(CONFIG_FILE)) {
|
|
15
|
-
return {};
|
|
16
|
-
}
|
|
17
|
-
const raw = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
18
|
-
return JSON.parse(raw) as Config;
|
|
19
|
-
} catch {
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function writeConfig(config: Config): void {
|
|
25
|
-
if (!fs.existsSync(CONFIG_DIR)) {
|
|
26
|
-
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), "utf-8");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getApiKey(): string | null {
|
|
32
|
-
const config = readConfig();
|
|
33
|
-
return config.apiKey ?? null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function requireApiKey(): string {
|
|
37
|
-
const key = getApiKey();
|
|
38
|
-
if (!key) {
|
|
39
|
-
console.error("❌ 未登录,请先运行 npx easyclaw login");
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
return key;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const BASE_URL = "https://easyclaw.link";
|
package/src/index.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { loginAction } from "./commands/login";
|
|
5
|
-
import { publishAction } from "./commands/publish";
|
|
6
|
-
import { listAction } from "./commands/list";
|
|
7
|
-
|
|
8
|
-
const program = new Command();
|
|
9
|
-
|
|
10
|
-
program
|
|
11
|
-
.name("easyclaw")
|
|
12
|
-
.description("EasyClaw CLI - Publish and manage skills on easyclaw.link")
|
|
13
|
-
.version("1.0.0");
|
|
14
|
-
|
|
15
|
-
program
|
|
16
|
-
.command("login")
|
|
17
|
-
.description("登录 EasyClaw 平台,保存 API Key")
|
|
18
|
-
.action(loginAction);
|
|
19
|
-
|
|
20
|
-
program
|
|
21
|
-
.command("publish [dir]")
|
|
22
|
-
.description("发布或更新技能到 EasyClaw 平台")
|
|
23
|
-
.option("--id <id>", "指定技能 ID 进行更新")
|
|
24
|
-
.action(publishAction);
|
|
25
|
-
|
|
26
|
-
program
|
|
27
|
-
.command("list")
|
|
28
|
-
.description("查看我发布的所有技能")
|
|
29
|
-
.action(listAction);
|
|
30
|
-
|
|
31
|
-
program.parse();
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"declarationMap": true,
|
|
14
|
-
"sourceMap": true
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*"],
|
|
17
|
-
"exclude": ["node_modules", "dist"]
|
|
18
|
-
}
|