atomhouse-skill 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,139 @@
1
+ Copyright 2026 AtomHouse
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work.
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. Derivative Works
45
+ shall not include works that remain separable from, or merely link (or
46
+ bind by name) to the interfaces of, the Work and Derivative Works.
47
+
48
+ "Contribution" shall mean any work of authorship, including the
49
+ original version of the Work and any modifications or additions to
50
+ that Work or Derivative Works thereof, that is intentionally submitted
51
+ to Licensor for inclusion in the Work by the copyright owner or by an
52
+ individual or Legal Entity authorized to submit on behalf of the
53
+ copyright owner. "Submitted" means any form of electronic, verbal, or
54
+ written communication sent to the Licensor or its representatives,
55
+ including but not limited to communication on electronic mailing lists,
56
+ source code control systems, and issue tracking systems that are
57
+ managed by, or on behalf of, the Licensor for the purpose of discussing
58
+ and improving the Work, but excluding communication that is
59
+ conspicuously marked or otherwise designated in writing by the
60
+ copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+ (c) You must retain, in the Source form of any Derivative Works
99
+ that You distribute, all copyright, patent, trademark, and
100
+ attribution notices from the Source form of the Work; and
101
+ (d) If the Work includes a "NOTICE" text file, any Derivative
102
+ Works that You distribute must include a readable copy of the
103
+ attribution notices contained within such NOTICE file.
104
+
105
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
106
+ any Contribution intentionally submitted for inclusion in the Work
107
+ by You to the Licensor shall be under the terms and conditions of
108
+ this License, without any additional terms or conditions.
109
+
110
+ 6. Trademarks. This License does not grant permission to use the trade
111
+ names, trademarks, service marks, or product names of the Licensor,
112
+ except as required for reasonable and customary use in describing the
113
+ origin of the Work and reproducing the content of the NOTICE file.
114
+
115
+ 7. Disclaimer of Warranty. Unless required by applicable law or
116
+ agreed to in writing, Licensor provides the Work (and each
117
+ Contributor provides its Contributions) on an "AS IS" BASIS,
118
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
119
+ implied, including, without limitation, any warranties or conditions
120
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
121
+ PARTICULAR PURPOSE. You are solely responsible for determining the
122
+ appropriateness of using or redistributing the Work and assume any
123
+ risks associated with Your exercise of permissions under this License.
124
+
125
+ 8. Limitation of Liability. In no event and under no legal theory,
126
+ whether in tort (including negligence), contract, or otherwise,
127
+ unless required by applicable law, shall any Contributor be liable to
128
+ You for damages, including any direct, indirect, special, incidental,
129
+ or consequential damages arising as a result of this License or out
130
+ of the use or inability to use the Work.
131
+
132
+ 9. Accepting Warranty or Additional Liability. While redistributing
133
+ the Work or Derivative Works thereof, You may choose to offer support,
134
+ warranty, indemnity, or other liability obligations and/or rights
135
+ consistent with this License. In accepting such obligations, You may
136
+ act only on Your own behalf and on Your sole responsibility, not on
137
+ behalf of any other Contributor.
138
+
139
+ END OF TERMS AND CONDITIONS
package/README.md CHANGED
@@ -1,3 +1,22 @@
1
- # Temporary Holding Version
1
+ # atomhouse-skill
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Install the AtomHouse skill for Claude Code and other agent runtimes:
4
+
5
+ ```bash
6
+ npx atomhouse-skill add
7
+ ```
8
+
9
+ The command asks whether you use AtomHouse Cloud (global), AtomHouse Cloud
10
+ (China), or a self-hosted instance, then downloads
11
+ `<instance>/api/v1/skill.zip` and installs it into `~/.claude/skills/<name>`.
12
+
13
+ For scripts, choose the instance explicitly:
14
+
15
+ ```bash
16
+ npx atomhouse-skill add --profile global --yes
17
+ npx atomhouse-skill add --base-url https://atomhouse.example.com --yes
18
+ npx atomhouse-skill add --project --base-url https://atomhouse.example.com
19
+ ```
20
+
21
+ The archive contains no token. The installed skill explains how to obtain one
22
+ and to prefer a secret store over a home-directory file.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { main } from '../src/cli.js'
3
+
4
+ main(process.argv.slice(2)).catch((error) => {
5
+ console.error(`atomhouse-skill: ${error.message}`)
6
+ process.exit(1)
7
+ })
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "atomhouse-skill",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Install the AtomHouse skill for Claude Code and other agent runtimes",
5
+ "type": "module",
6
+ "bin": {
7
+ "atomhouse-skill": "bin/atomhouse-skill.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "src",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "test": "node --test"
17
+ },
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "keywords": [
22
+ "atomhouse",
23
+ "claude",
24
+ "claude-code",
25
+ "agent",
26
+ "skill"
27
+ ],
28
+ "license": "Apache-2.0",
29
+ "dependencies": {
30
+ "fflate": "^0.8.2"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
35
+ }
package/src/cli.js ADDED
@@ -0,0 +1,198 @@
1
+ import { mkdir, readdir, rm, stat, writeFile } from 'node:fs/promises'
2
+ import { homedir } from 'node:os'
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
+ import { unzipSync } from 'fflate'
7
+
8
+ const choices = {
9
+ global: 'https://atomhouse.cloud',
10
+ cn: 'https://atomhouse.cn',
11
+ }
12
+
13
+ const help = `atomhouse-skill — install the AtomHouse skill
14
+
15
+ Usage:
16
+ npx atomhouse-skill add [options]
17
+
18
+ Options:
19
+ --base-url URL AtomHouse instance, e.g. https://atomhouse.cloud
20
+ --profile cn|global Shortcut for atomhouse.cn or atomhouse.cloud
21
+ --project Install into ./.claude/skills instead of ~/.claude/skills
22
+ --dir PATH Install into an explicit skills directory
23
+ --force Replace an existing skill directory
24
+ --yes Do not ask for confirmation
25
+ -h, --help Show this help
26
+
27
+ The skill is downloaded from <base-url>/api/v1/skill.zip. No token is stored by
28
+ this command; the installed skill explains how to obtain and secure one.`
29
+
30
+ export function skillsDir({ project = false, dir } = {}) {
31
+ if (dir) return path.resolve(dir)
32
+ const root = project
33
+ ? path.join(process.cwd(), '.claude')
34
+ : process.env.CLAUDE_CONFIG_DIR || path.join(homedir(), '.claude')
35
+ return path.join(root, 'skills')
36
+ }
37
+
38
+ export function parseArgs(argv) {
39
+ const args = { command: argv[0] || 'add', force: false, yes: false, project: false }
40
+ if (args.command === '-h' || args.command === '--help' || args.command === 'help') {
41
+ args.command = 'help'
42
+ return args
43
+ }
44
+ if (args.command !== 'add' && args.command !== 'list') {
45
+ throw new Error(`unknown command "${args.command}"; try \`npx atomhouse-skill --help\``)
46
+ }
47
+ for (let i = 1; i < argv.length; i++) {
48
+ const arg = argv[i]
49
+ const take = () => {
50
+ if (i + 1 >= argv.length) throw new Error(`${arg} needs a value`)
51
+ return argv[++i]
52
+ }
53
+ if (arg === '--base-url') args.baseUrl = take()
54
+ 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
+ else if (arg === '--dir') args.dir = take()
58
+ else if (arg.startsWith('--dir=')) args.dir = arg.slice('--dir='.length)
59
+ else if (arg === '--project') args.project = true
60
+ else if (arg === '--force') args.force = true
61
+ else if (arg === '--yes' || arg === '-y') args.yes = true
62
+ else if (arg === '-h' || arg === '--help') args.command = 'help'
63
+ else throw new Error(`unknown option "${arg}"`)
64
+ }
65
+ if (args.profile && !(args.profile in choices)) {
66
+ throw new Error('--profile must be cn or global')
67
+ }
68
+ return args
69
+ }
70
+
71
+ function validateBaseUrl(raw) {
72
+ let url
73
+ try {
74
+ url = new URL(raw)
75
+ } catch {
76
+ throw new Error(`not a URL: ${raw}`)
77
+ }
78
+ if (url.protocol !== 'http:' && url.protocol !== 'https:') {
79
+ throw new Error('base URL must be http:// or https://')
80
+ }
81
+ if (url.username || url.password) {
82
+ throw new Error('base URL must not contain credentials')
83
+ }
84
+ url.pathname = url.pathname.replace(/\/+$/, '')
85
+ return url.toString().replace(/\/$/, '')
86
+ }
87
+
88
+ function safeEntries(files) {
89
+ const names = Object.keys(files)
90
+ if (names.length === 0) throw new Error('the archive is empty')
91
+ const normalized = names.map((name) => {
92
+ if (name.includes('\\') || name.includes('\0')) throw new Error(`unsafe archive entry: ${name}`)
93
+ const parts = name.split('/')
94
+ if (parts.some((part) => part === '..' || part === '')) {
95
+ throw new Error(`unsafe archive entry: ${name}`)
96
+ }
97
+ return name
98
+ })
99
+ const roots = new Set(normalized.map((name) => name.split('/')[0]))
100
+ if (roots.size !== 1) throw new Error('the archive must contain exactly one skill folder')
101
+ const [root] = roots
102
+ if (!root || !normalized.includes(`${root}/SKILL.md`)) {
103
+ throw new Error('the archive does not contain SKILL.md')
104
+ }
105
+ return { root, names: normalized }
106
+ }
107
+
108
+ export function extractSkill(files) {
109
+ const { root, names } = safeEntries(files)
110
+ return { name: root, files: names.map((name) => [name, files[name]]) }
111
+ }
112
+
113
+ async function install({ baseUrl, targetRoot, force }) {
114
+ const response = await fetch(`${baseUrl}/api/v1/skill.zip`, {
115
+ headers: { accept: 'application/zip' },
116
+ signal: AbortSignal.timeout(60_000),
117
+ })
118
+ if (!response.ok) {
119
+ throw new Error(`download failed: ${response.status} ${response.statusText}`)
120
+ }
121
+ const bytes = new Uint8Array(await response.arrayBuffer())
122
+ if (bytes.byteLength === 0 || bytes.byteLength > 20 * 1024 * 1024) {
123
+ throw new Error('the downloaded archive is empty or too large')
124
+ }
125
+ const archive = unzipSync(bytes)
126
+ const skill = extractSkill(archive)
127
+ const target = path.join(targetRoot, skill.name)
128
+ if ((await stat(target).catch(() => null)) && !force) {
129
+ throw new Error(`${target} already exists; pass --force to replace it`)
130
+ }
131
+ await rm(target, { recursive: true, force: true })
132
+ for (const [entry, body] of skill.files) {
133
+ const destination = path.join(targetRoot, entry)
134
+ await mkdir(path.dirname(destination), { recursive: true })
135
+ await writeFile(destination, body, { mode: 0o644 })
136
+ }
137
+ return target
138
+ }
139
+
140
+ async function chooseBaseUrl(args) {
141
+ if (args.baseUrl) return validateBaseUrl(args.baseUrl)
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
+ }
161
+ }
162
+
163
+ async function list(args) {
164
+ const root = skillsDir(args)
165
+ const entries = await readdir(root, { withFileTypes: true }).catch(() => [])
166
+ const skills = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name)
167
+ if (skills.length === 0) console.log(`No skills in ${root}`)
168
+ else console.log(`Skills in ${root}:\n${skills.map((name) => ` ${name}`).join('\n')}`)
169
+ }
170
+
171
+ export async function main(argv) {
172
+ const args = parseArgs(argv)
173
+ if (args.command === 'help') {
174
+ console.log(help)
175
+ return
176
+ }
177
+ if (args.command === 'list') {
178
+ await list(args)
179
+ return
180
+ }
181
+ const baseUrl = await chooseBaseUrl(args)
182
+ 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
+ const target = await install({ baseUrl, targetRoot, force: args.force })
196
+ console.log(`Installed ${path.basename(target)} into ${target}`)
197
+ console.log('Restart your agent or reload skills; the skill explains how to authenticate.')
198
+ }