skillora 1.0.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.
Files changed (3) hide show
  1. package/README.md +32 -0
  2. package/index.mjs +143 -0
  3. package/package.json +24 -0
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Skillora CLI
2
+
3
+ AIスキルをワンコマンドでインストールするCLIツール。
4
+
5
+ ## インストール
6
+
7
+ ```bash
8
+ npx skillora install <skillId> --key <licenseKey>
9
+ ```
10
+
11
+ ## 使い方
12
+
13
+ ```bash
14
+ # スキルをインストール
15
+ npx skillora install git-sensei --key sk_live_abc123...
16
+
17
+ # カスタムディレクトリに配置
18
+ npx skillora install git-sensei --key sk_live_abc123... --dir ./my-skills
19
+ ```
20
+
21
+ ## 動作の流れ
22
+
23
+ 1. Skillora API でライセンスキーを検証
24
+ 2. スキルファイル(SKILL.md)をダウンロード
25
+ 3. `~/.claude/skills/<skillId>/SKILL.md` に自動配置
26
+ 4. AIエージェントにスキル名を伝えると自動で読み込まれます
27
+
28
+ ## ライセンスキーの取得
29
+
30
+ Skilloraでスキルを購入すると、完了画面とメールでライセンスキーが届きます。
31
+
32
+ https://skillora.jp
package/index.mjs ADDED
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Skillora CLI — AIスキルのインストールツール
5
+ *
6
+ * Usage:
7
+ * npx skillora install <skillId> --key <licenseKey>
8
+ * npx skillora install <skillId> -k <licenseKey>
9
+ *
10
+ * What it does:
11
+ * 1. Skillora API でライセンスを検証
12
+ * 2. スキルファイル(SKILL.md)をダウンロード
13
+ * 3. ~/.claude/skills/<skillId>/SKILL.md に配置
14
+ */
15
+
16
+ import { writeFileSync, mkdirSync, existsSync } from "fs";
17
+ import { join } from "path";
18
+ import { homedir } from "os";
19
+
20
+ const API_BASE = "https://skillora.jp";
21
+ const SKILLS_DIR = join(homedir(), ".claude", "skills");
22
+
23
+ // ─── Argument Parsing ───────────────────────────────────
24
+
25
+ const args = process.argv.slice(2);
26
+
27
+ function printUsage() {
28
+ console.log(`
29
+ Skillora CLI — AIスキルのインストールツール
30
+
31
+ 使い方:
32
+ npx skillora install <skillId> --key <licenseKey>
33
+
34
+ 例:
35
+ npx skillora install git-sensei --key sk_live_abc123...
36
+
37
+ オプション:
38
+ --key, -k ライセンスキー(購入完了画面で取得)
39
+ --dir, -d インストール先(デフォルト: ~/.claude/skills/)
40
+ --help, -h このヘルプを表示
41
+ `);
42
+ }
43
+
44
+ if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
45
+ printUsage();
46
+ process.exit(0);
47
+ }
48
+
49
+ const command = args[0];
50
+
51
+ if (command !== "install") {
52
+ console.error(`❌ 不明なコマンド: ${command}`);
53
+ console.error(' "npx skillora install <skillId> --key <key>" を使ってください');
54
+ process.exit(1);
55
+ }
56
+
57
+ const skillId = args[1];
58
+ if (!skillId) {
59
+ console.error("❌ スキルIDを指定してください");
60
+ console.error(' 例: npx skillora install git-sensei --key sk_live_...');
61
+ process.exit(1);
62
+ }
63
+
64
+ // Parse flags
65
+ let licenseKey = null;
66
+ let targetDir = SKILLS_DIR;
67
+
68
+ for (let i = 2; i < args.length; i++) {
69
+ if ((args[i] === "--key" || args[i] === "-k") && args[i + 1]) {
70
+ licenseKey = args[++i];
71
+ } else if ((args[i] === "--dir" || args[i] === "-d") && args[i + 1]) {
72
+ targetDir = args[++i];
73
+ }
74
+ }
75
+
76
+ if (!licenseKey) {
77
+ console.error("❌ ライセンスキーが必要です");
78
+ console.error(' --key sk_live_... を指定してください');
79
+ process.exit(1);
80
+ }
81
+
82
+ // ─── Main Flow ──────────────────────────────────────────
83
+
84
+ async function main() {
85
+ console.log(`\n🔑 ライセンスを検証中... (${skillId})`);
86
+
87
+ // Step 1: Verify license & get download URL
88
+ const res = await fetch(`${API_BASE}/api/skills/download`, {
89
+ method: "POST",
90
+ headers: { "Content-Type": "application/json" },
91
+ body: JSON.stringify({ licenseKey, skillId }),
92
+ });
93
+
94
+ const data = await res.json();
95
+
96
+ if (!res.ok || !data.success) {
97
+ const errorMessages = {
98
+ "Invalid or inactive license": "ライセンスキーが無効または停止されています",
99
+ "License does not match skill": "このライセンスキーは別のスキル用です",
100
+ "License expired": "ライセンスの有効期限が切れています",
101
+ "Device limit reached": "デバイス数の上限(3台)に達しています",
102
+ "Skill file not available": "スキルファイルがまだアップロードされていません",
103
+ };
104
+ const msg = errorMessages[data.error] || data.error || "不明なエラー";
105
+ console.error(`\n❌ ${msg}`);
106
+ process.exit(1);
107
+ }
108
+
109
+ console.log("✅ ライセンス有効");
110
+
111
+ // Step 2: Download skill file
112
+ console.log("📥 スキルファイルをダウンロード中...");
113
+
114
+ const fileRes = await fetch(data.downloadUrl);
115
+ if (!fileRes.ok) {
116
+ console.error("❌ ファイルのダウンロードに失敗しました");
117
+ process.exit(1);
118
+ }
119
+
120
+ const content = await fileRes.text();
121
+
122
+ // Step 3: Write to skills directory
123
+ const skillDir = join(targetDir, skillId);
124
+ const filePath = join(skillDir, "SKILL.md");
125
+
126
+ if (!existsSync(targetDir)) {
127
+ mkdirSync(targetDir, { recursive: true });
128
+ }
129
+ if (!existsSync(skillDir)) {
130
+ mkdirSync(skillDir, { recursive: true });
131
+ }
132
+
133
+ writeFileSync(filePath, content, "utf-8");
134
+
135
+ console.log(`\n✅ インストール完了!`);
136
+ console.log(` ${filePath}`);
137
+ console.log(`\n💡 AIエージェントに「${skillId} スキルを使って」と伝えると自動で読み込みます。\n`);
138
+ }
139
+
140
+ main().catch((err) => {
141
+ console.error("❌ エラーが発生しました:", err.message);
142
+ process.exit(1);
143
+ });
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "skillora",
3
+ "version": "1.0.0",
4
+ "description": "Skillora CLI — AIスキルのインストールツール",
5
+ "bin": {
6
+ "skillora": "index.mjs"
7
+ },
8
+ "type": "module",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/tokyo-max345/skillora-cli.git"
13
+ },
14
+ "keywords": [
15
+ "skillora",
16
+ "ai-skills",
17
+ "cursor",
18
+ "claude-code"
19
+ ],
20
+ "files": [
21
+ "index.mjs",
22
+ "README.md"
23
+ ]
24
+ }