atomhouse-skill 0.1.0 → 0.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 +24 -10
- package/package.json +1 -1
- package/src/cli.js +14 -55
package/README.md
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
# atomhouse-skill
|
|
2
2
|
|
|
3
|
-
Install the AtomHouse skill for Claude Code and other agent runtimes:
|
|
3
|
+
Install the **AtomHouse China** skill for Claude Code and other agent runtimes:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npx atomhouse-skill add
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
(China), or a self-hosted instance, then downloads
|
|
11
|
-
`<instance>/api/v1/skill.zip` and installs it into `~/.claude/skills/<name>`.
|
|
9
|
+
This package is the domestic package. It downloads:
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
```text
|
|
12
|
+
https://atomhouse.cn/api/v1/skill.zip
|
|
13
|
+
→ atomhouse/SKILL.md
|
|
14
|
+
→ ~/.claude/skills/atomhouse/
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Project-local installation:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx atomhouse-skill add --project
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For the international hosted service, use the dedicated package:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx atomhouse-cloud-skill add
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For a self-hosted instance, use an explicit base URL:
|
|
14
30
|
|
|
15
31
|
```bash
|
|
16
|
-
npx atomhouse-skill add --
|
|
17
|
-
npx atomhouse-skill add --base-url https://atomhouse.example.com --yes
|
|
18
|
-
npx atomhouse-skill add --project --base-url https://atomhouse.example.com
|
|
32
|
+
npx atomhouse-skill add --base-url https://atomhouse.example.com
|
|
19
33
|
```
|
|
20
34
|
|
|
21
|
-
The
|
|
22
|
-
and
|
|
35
|
+
The package contains no token. The installed skill explains how to obtain one
|
|
36
|
+
and prefers a secret store over a home-directory file.
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
import { mkdir, readdir, rm, stat, writeFile } from 'node:fs/promises'
|
|
2
2
|
import { homedir } from 'node:os'
|
|
3
3
|
import path from 'node:path'
|
|
4
|
-
import { createInterface } from 'node:readline/promises'
|
|
5
|
-
import { stdin as input, stdout as output } from 'node:process'
|
|
6
4
|
import { unzipSync } from 'fflate'
|
|
7
5
|
|
|
8
|
-
const
|
|
9
|
-
global: 'https://atomhouse.cloud',
|
|
10
|
-
cn: 'https://atomhouse.cn',
|
|
11
|
-
}
|
|
6
|
+
const DEFAULT_BASE = 'https://atomhouse.cn'
|
|
12
7
|
|
|
13
|
-
const help = `atomhouse-skill — install the AtomHouse skill
|
|
8
|
+
const help = `atomhouse-skill — install the AtomHouse China skill
|
|
14
9
|
|
|
15
10
|
Usage:
|
|
16
11
|
npx atomhouse-skill add [options]
|
|
17
12
|
|
|
18
13
|
Options:
|
|
19
|
-
--
|
|
20
|
-
--
|
|
21
|
-
--
|
|
22
|
-
--
|
|
23
|
-
--
|
|
24
|
-
--
|
|
25
|
-
-h, --help Show this help
|
|
14
|
+
--project Install into ./.claude/skills instead of ~/.claude/skills
|
|
15
|
+
--dir PATH Install into an explicit skills directory
|
|
16
|
+
--base-url URL Advanced: install from a self-hosted AtomHouse instance
|
|
17
|
+
--force Replace an existing skill directory
|
|
18
|
+
--yes Accepted for non-interactive scripts
|
|
19
|
+
-h, --help Show this help
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
This package installs the China hosted skill from
|
|
22
|
+
https://atomhouse.cn/api/v1/skill.zip. Use atomhouse-cloud-skill for the
|
|
23
|
+
international service. No token is stored by this command.`
|
|
29
24
|
|
|
30
25
|
export function skillsDir({ project = false, dir } = {}) {
|
|
31
26
|
if (dir) return path.resolve(dir)
|
|
@@ -52,8 +47,6 @@ export function parseArgs(argv) {
|
|
|
52
47
|
}
|
|
53
48
|
if (arg === '--base-url') args.baseUrl = take()
|
|
54
49
|
else if (arg.startsWith('--base-url=')) args.baseUrl = arg.slice('--base-url='.length)
|
|
55
|
-
else if (arg === '--profile') args.profile = take()
|
|
56
|
-
else if (arg.startsWith('--profile=')) args.profile = arg.slice('--profile='.length)
|
|
57
50
|
else if (arg === '--dir') args.dir = take()
|
|
58
51
|
else if (arg.startsWith('--dir=')) args.dir = arg.slice('--dir='.length)
|
|
59
52
|
else if (arg === '--project') args.project = true
|
|
@@ -62,9 +55,6 @@ export function parseArgs(argv) {
|
|
|
62
55
|
else if (arg === '-h' || arg === '--help') args.command = 'help'
|
|
63
56
|
else throw new Error(`unknown option "${arg}"`)
|
|
64
57
|
}
|
|
65
|
-
if (args.profile && !(args.profile in choices)) {
|
|
66
|
-
throw new Error('--profile must be cn or global')
|
|
67
|
-
}
|
|
68
58
|
return args
|
|
69
59
|
}
|
|
70
60
|
|
|
@@ -137,27 +127,8 @@ async function install({ baseUrl, targetRoot, force }) {
|
|
|
137
127
|
return target
|
|
138
128
|
}
|
|
139
129
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (args.profile) return choices[args.profile]
|
|
143
|
-
if (!input.isTTY) {
|
|
144
|
-
throw new Error('pass --base-url (or --profile cn|global) when not running interactively')
|
|
145
|
-
}
|
|
146
|
-
const rl = createInterface({ input, output })
|
|
147
|
-
try {
|
|
148
|
-
const answer = (await rl.question(
|
|
149
|
-
'Which AtomHouse?\n 1) AtomHouse Cloud (global) https://atomhouse.cloud\n 2) AtomHouse Cloud (China) https://atomhouse.cn\n 3) Self-hosted\n> ',
|
|
150
|
-
)).trim()
|
|
151
|
-
if (answer === '1' || answer === '') return choices.global
|
|
152
|
-
if (answer === '2') return choices.cn
|
|
153
|
-
if (answer === '3') {
|
|
154
|
-
const url = (await rl.question('Base URL (https://…): ')).trim()
|
|
155
|
-
return validateBaseUrl(url)
|
|
156
|
-
}
|
|
157
|
-
throw new Error('choose 1, 2 or 3')
|
|
158
|
-
} finally {
|
|
159
|
-
rl.close()
|
|
160
|
-
}
|
|
130
|
+
function chooseBaseUrl(args) {
|
|
131
|
+
return args.baseUrl ? validateBaseUrl(args.baseUrl) : DEFAULT_BASE
|
|
161
132
|
}
|
|
162
133
|
|
|
163
134
|
async function list(args) {
|
|
@@ -178,20 +149,8 @@ export async function main(argv) {
|
|
|
178
149
|
await list(args)
|
|
179
150
|
return
|
|
180
151
|
}
|
|
181
|
-
const baseUrl =
|
|
152
|
+
const baseUrl = chooseBaseUrl(args)
|
|
182
153
|
const targetRoot = skillsDir(args)
|
|
183
|
-
if (!args.yes && input.isTTY) {
|
|
184
|
-
const rl = createInterface({ input, output })
|
|
185
|
-
try {
|
|
186
|
-
const answer = await rl.question(`Install the skill from ${baseUrl} into ${targetRoot}? [Y/n] `)
|
|
187
|
-
if (answer.trim().toLowerCase() === 'n') {
|
|
188
|
-
console.log('Nothing installed.')
|
|
189
|
-
return
|
|
190
|
-
}
|
|
191
|
-
} finally {
|
|
192
|
-
rl.close()
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
154
|
const target = await install({ baseUrl, targetRoot, force: args.force })
|
|
196
155
|
console.log(`Installed ${path.basename(target)} into ${target}`)
|
|
197
156
|
console.log('Restart your agent or reload skills; the skill explains how to authenticate.')
|