@almyty/skills 1.2.0 → 1.3.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 +138 -56
- package/dist/auth.d.ts +10 -3
- package/dist/auth.js +10 -3
- package/dist/cli-args.d.ts +16 -0
- package/dist/cli-args.js +152 -0
- package/dist/exit-codes.d.ts +26 -0
- package/dist/exit-codes.js +32 -0
- package/dist/help.d.ts +2 -0
- package/dist/help.js +111 -0
- package/dist/index.js +282 -350
- package/dist/installer.d.ts +24 -1
- package/dist/installer.js +22 -3
- package/dist/meta-skill.d.ts +9 -0
- package/dist/meta-skill.js +46 -10
- package/dist/target-selector.d.ts +7 -0
- package/dist/target-selector.js +8 -6
- package/dist/tty.d.ts +22 -0
- package/dist/tty.js +35 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +22 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# @almyty/skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Turn any API in your almyty gateways into a `SKILL.md` your coding agent
|
|
4
|
+
reads on its next session. 30 agents are recognised — Claude Code,
|
|
5
|
+
Codex, Cursor, Windsurf, GitHub Copilot, Gemini CLI, Amp, Cline,
|
|
6
|
+
Continue, Goose, Junie, Roo Code, Trae, OpenHands, OpenCode, Augment and
|
|
7
|
+
more — plus the universal `.agents/skills/` convention.
|
|
4
8
|
|
|
5
9
|
## Quick start
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
12
|
$ npx @almyty/auth login
|
|
9
13
|
$ npx @almyty/skills gateways
|
|
14
|
+
$ npx @almyty/skills install org/gateway --dry-run # see the exact files
|
|
10
15
|
$ npx @almyty/skills install org/gateway
|
|
11
16
|
```
|
|
12
17
|
|
|
@@ -14,21 +19,28 @@ $ npx @almyty/skills install org/gateway
|
|
|
14
19
|
|
|
15
20
|
| Command | Description |
|
|
16
21
|
|---------|-------------|
|
|
17
|
-
| `gateways` |
|
|
18
|
-
| `list` |
|
|
19
|
-
| `list org/gateway` |
|
|
20
|
-
| `search <query>` | Search skills by keyword |
|
|
21
|
-
| `install org/gateway` | Install
|
|
22
|
-
| `install org/gateway/skill` | Install
|
|
23
|
-
| `installed` |
|
|
24
|
-
| `remove` | Remove
|
|
25
|
-
| `run org/gateway/skill [--key value]` | Execute
|
|
26
|
-
| `daemon [--interval 60]` |
|
|
27
|
-
| `watch org/gateway [--interval 60]` |
|
|
22
|
+
| `gateways` | Your gateways, and the ref to install each |
|
|
23
|
+
| `list` | Every skill available to you |
|
|
24
|
+
| `list org/gateway` | Skills from one gateway |
|
|
25
|
+
| `search <query>` | Search your gateways' skills by keyword |
|
|
26
|
+
| `install org/gateway` | Install every skill from a gateway |
|
|
27
|
+
| `install org/gateway/skill` | Install one skill |
|
|
28
|
+
| `installed` | Skills this CLI has installed in this directory |
|
|
29
|
+
| `remove` | Remove every skill this CLI installed here |
|
|
30
|
+
| `run org/gateway/skill [--key value]` | Execute one skill and print its result |
|
|
31
|
+
| `daemon [--interval 60]` | Re-sync every skill on a timer |
|
|
32
|
+
| `watch org/gateway [--interval 60]` | Re-sync one gateway on a timer |
|
|
33
|
+
|
|
34
|
+
`login`, `logout` and `whoami` moved to `@almyty/auth`; typing them here
|
|
35
|
+
prints where they went and exits `2`.
|
|
28
36
|
|
|
29
37
|
## References
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
A skill is `org/gateway/skill`, a whole gateway is `org/gateway`, and a
|
|
40
|
+
gateway UUID also works. A leading `@` is optional — `@acme/petstore`
|
|
41
|
+
and `acme/petstore` are the same. A bare name is treated as a search,
|
|
42
|
+
and installs only when it matches exactly one skill; an ambiguous name
|
|
43
|
+
lists the matches and exits `2` rather than guessing.
|
|
32
44
|
|
|
33
45
|
```bash
|
|
34
46
|
$ npx @almyty/skills install acme/petstore
|
|
@@ -37,84 +49,152 @@ $ npx @almyty/skills run acme/petstore/get-pet --id 123
|
|
|
37
49
|
|
|
38
50
|
## Where skills get installed
|
|
39
51
|
|
|
40
|
-
`install` writes
|
|
41
|
-
directories. The CLI detects
|
|
52
|
+
`install` writes one `SKILL.md` per skill into one or more agent
|
|
53
|
+
directories, at `<skillsDir>/<skill-name>/SKILL.md`. The CLI detects
|
|
54
|
+
agents at two scopes:
|
|
42
55
|
|
|
43
56
|
- **Project scope** — a config dir exists in the current project
|
|
44
|
-
(e.g. `./.codex/`). Skills install to `./.codex/skills/`, only
|
|
57
|
+
(e.g. `./.codex/`). Skills install to `./.codex/skills/`, so only
|
|
45
58
|
this checkout sees them.
|
|
46
59
|
- **Home scope** — a config dir exists in your home directory
|
|
47
|
-
(e.g. `~/.codex/`). Skills install to `~/.codex/skills/`, every
|
|
48
|
-
project
|
|
60
|
+
(e.g. `~/.codex/`). Skills install to `~/.codex/skills/`, so every
|
|
61
|
+
project that agent opens picks them up.
|
|
49
62
|
|
|
50
|
-
|
|
63
|
+
**Installing overwrites a `SKILL.md` of the same name** in the target
|
|
64
|
+
directory. Nothing else in those directories is touched, and `remove`
|
|
65
|
+
only deletes directories whose `SKILL.md` carries almyty's own
|
|
66
|
+
`metadata.author: almyty` marker. `install` prints the directories it is
|
|
67
|
+
about to write to before it writes anything, reports how many files it
|
|
68
|
+
replaced, and `--dry-run` lists every path and writes nothing:
|
|
51
69
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
```bash
|
|
71
|
+
$ npx @almyty/skills install acme/petstore --dry-run
|
|
72
|
+
|
|
73
|
+
acme/petstore (12 skill(s)) — dry run, nothing will be written:
|
|
74
|
+
Codex: /work/proj/.codex/skills
|
|
75
|
+
Universal (.agents/skills): /work/proj/.agents/skills
|
|
76
|
+
|
|
77
|
+
Codex: 12 skill file(s) would go to /work/proj/.codex/skills
|
|
78
|
+
/work/proj/.codex/skills/get-pet/SKILL.md
|
|
79
|
+
…
|
|
80
|
+
|
|
81
|
+
Dry run: 24 skill file(s) across 2 target(s), 3 of them replacing an existing file.
|
|
82
|
+
Re-run without --dry-run to write them.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Choosing targets
|
|
86
|
+
|
|
87
|
+
- **Interactive terminal, no target flag:** a multi-select picker lists
|
|
88
|
+
every detected agent at both scopes (labelled `(project)` or
|
|
89
|
+
`(home)`), every other supported agent as opt-in, the universal
|
|
90
|
+
`.agents/skills/` convention, and a custom-path option.
|
|
91
|
+
- **`--yes`, `--json`, CI, or a pipe:** the picker is skipped and
|
|
92
|
+
install writes to the project-detected agents plus `.agents/skills/`.
|
|
58
93
|
Home-detected agents are NOT installed automatically — pass
|
|
59
|
-
`--global
|
|
94
|
+
`--global`.
|
|
60
95
|
- **`--global` alone:** every home-detected agent. No project install.
|
|
61
|
-
- **`--all`:** every project-detected agent
|
|
62
|
-
|
|
63
|
-
- **`--agent <name>`:**
|
|
64
|
-
detected
|
|
65
|
-
|
|
66
|
-
|
|
96
|
+
- **`--all`:** every project-detected agent plus universal. Combine with
|
|
97
|
+
`--global` to include home-detected too.
|
|
98
|
+
- **`--agent <name>`:** the named agent at whichever scope it is
|
|
99
|
+
detected in (project preferred). With `--global`, prefers home. If it
|
|
100
|
+
is detected nowhere, creates the project-scope directory so the agent
|
|
101
|
+
picks it up on its next scan.
|
|
67
102
|
|
|
68
103
|
| Flag | Meaning |
|
|
69
104
|
|------|---------|
|
|
70
|
-
| `--agent <name>`, `-a` | Install to the named agent. Repeatable
|
|
105
|
+
| `--agent <name>`, `-a` | Install to the named agent. Repeatable, partial-match. |
|
|
71
106
|
| `--agent '*'` | Every known agent at project scope, regardless of detection. |
|
|
72
107
|
| `--path <dir>`, `-p` | Custom skills directory. Repeatable. Bypasses detection. |
|
|
73
108
|
| `--all` | Every project-detected agent + `.agents/skills/`. |
|
|
74
|
-
| `--global`, `-G` |
|
|
109
|
+
| `--global`, `-G` | Home scope (`~/.<agent>/skills/`). A modifier on `--agent`, or standalone for "every home-detected". |
|
|
75
110
|
| `--yes`, `-y` | Skip the picker; use the non-interactive defaults. |
|
|
76
|
-
|
|
77
|
-
Examples:
|
|
111
|
+
| `--dry-run` | Print every file `install` would write, and write nothing. |
|
|
78
112
|
|
|
79
113
|
```bash
|
|
80
|
-
$ npx @almyty/skills install acme/petstore
|
|
81
|
-
$ npx @almyty/skills install acme/petstore --all
|
|
82
|
-
$ npx @almyty/skills install acme/petstore --all --global
|
|
83
|
-
$ npx @almyty/skills install acme/petstore --global
|
|
84
|
-
$ npx @almyty/skills install acme/petstore -a codex
|
|
85
|
-
$ npx @almyty/skills install acme/petstore -a codex --global
|
|
86
|
-
$ npx @almyty/skills install acme/petstore --agent '*' -y
|
|
87
|
-
$ npx @almyty/skills install acme/petstore -p ./agents/skills
|
|
114
|
+
$ npx @almyty/skills install acme/petstore # interactive picker
|
|
115
|
+
$ npx @almyty/skills install acme/petstore --all # every project-detected
|
|
116
|
+
$ npx @almyty/skills install acme/petstore --all --global # project AND home detected
|
|
117
|
+
$ npx @almyty/skills install acme/petstore --global # only home-detected agents
|
|
118
|
+
$ npx @almyty/skills install acme/petstore -a codex # codex, at whichever scope it lives
|
|
119
|
+
$ npx @almyty/skills install acme/petstore -a codex --global # force ~/.codex/skills
|
|
120
|
+
$ npx @almyty/skills install acme/petstore --agent '*' -y # every known agent, project scope
|
|
121
|
+
$ npx @almyty/skills install acme/petstore -p ./agents/skills # a directory you name
|
|
88
122
|
```
|
|
89
123
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
124
|
+
`src/agents.ts` is the registry: each entry maps a detection directory
|
|
125
|
+
to the `<dir>/skills` path that agent reads on session start.
|
|
126
|
+
|
|
127
|
+
## Other options
|
|
128
|
+
|
|
129
|
+
| Flag | Description |
|
|
130
|
+
|------|-------------|
|
|
131
|
+
| `--interval <s>`, `-i` | `daemon`/`watch` poll interval (default `60`) |
|
|
132
|
+
| `--url <url>` | API URL (default `https://api.almyty.com`) |
|
|
133
|
+
| `--dir <path>` | Project directory (default: cwd) |
|
|
134
|
+
| `--json` | Machine-readable output on every read command |
|
|
135
|
+
| `--help`, `-h` | Show help |
|
|
136
|
+
| `--version`, `-v` | Print the version |
|
|
137
|
+
|
|
138
|
+
Both `--flag value` and `--flag=value` are accepted. `run` forwards
|
|
139
|
+
every flag the CLI does not own to the skill as a parameter, so
|
|
140
|
+
`run acme/pet/get-pet --petId 123` sends `{ petId: "123" }`.
|
|
141
|
+
|
|
142
|
+
`run` prints its result as JSON always — the result *is* data. Every
|
|
143
|
+
other read command prints for humans by default and takes `--json`.
|
|
144
|
+
|
|
145
|
+
## Exit codes
|
|
146
|
+
|
|
147
|
+
| Code | Meaning |
|
|
148
|
+
|------|---------|
|
|
149
|
+
| `0` | success |
|
|
150
|
+
| `1` | unexpected error |
|
|
151
|
+
| `2` | usage error (bad flags, unknown command, ambiguous ref) |
|
|
152
|
+
| `3` | not authenticated — run `npx @almyty/auth login` |
|
|
153
|
+
| `4` | no such gateway or skill |
|
|
154
|
+
| `5` | the skill ran and failed |
|
|
95
155
|
|
|
96
156
|
## Configuration
|
|
97
157
|
|
|
98
|
-
|
|
158
|
+
`.almytyrc`, JSON, in the project directory or `$HOME`:
|
|
99
159
|
|
|
100
160
|
```json
|
|
101
161
|
{
|
|
162
|
+
"skillsDir": ".agents/skills",
|
|
163
|
+
"agents": ["Codex", "Claude Code"],
|
|
102
164
|
"url": "https://api.almyty.com",
|
|
103
|
-
"
|
|
165
|
+
"interval": 60
|
|
104
166
|
}
|
|
105
167
|
```
|
|
106
168
|
|
|
169
|
+
| Key | Effect |
|
|
170
|
+
|-----|--------|
|
|
171
|
+
| `skillsDir` | Install here and skip agent detection entirely |
|
|
172
|
+
| `agents` | Whitelist of agent names (partial match) to install to |
|
|
173
|
+
| `url` | API URL |
|
|
174
|
+
| `interval` | `daemon`/`watch` poll interval, in seconds |
|
|
175
|
+
|
|
176
|
+
There is **no credential key**. The token lives only in
|
|
177
|
+
`~/.almyty/credentials.json` (written by `npx @almyty/auth login`) or in
|
|
178
|
+
`ALMYTY_TOKEN`.
|
|
179
|
+
|
|
107
180
|
## Environment variables
|
|
108
181
|
|
|
109
182
|
| Variable | Description |
|
|
110
183
|
|----------|-------------|
|
|
111
184
|
| `ALMYTY_TOKEN` | Auth token override |
|
|
112
185
|
| `ALMYTY_URL` | API URL override |
|
|
113
|
-
| `ALMYTY_SKILLS_DIR` |
|
|
186
|
+
| `ALMYTY_SKILLS_DIR` | Install directory override; wins over `.almytyrc` |
|
|
187
|
+
| `ALMYTY_NON_INTERACTIVE=1` | Never prompt, even in a terminal |
|
|
188
|
+
| `CI` | Any truthy value has the same effect |
|
|
189
|
+
| `NO_COLOR` | Drops colour from the interactive picker |
|
|
114
190
|
|
|
115
191
|
## Authentication
|
|
116
192
|
|
|
117
|
-
|
|
193
|
+
Run `npx @almyty/auth login` once. `search` and `list` are org-scoped —
|
|
194
|
+
they look through the gateways your account can see, so there is no
|
|
195
|
+
credential-free public index to search. With no credential, every
|
|
196
|
+
command that talks to the API prints the login instruction and exits
|
|
197
|
+
`3`; `installed` and `remove` are local and need none.
|
|
118
198
|
|
|
119
199
|
## About almyty
|
|
120
200
|
|
|
@@ -122,8 +202,10 @@ almyty is the full-stack platform for AI agents, agnostic by design: any LLM, an
|
|
|
122
202
|
API turned into tools, served over MCP, A2A, UTCP, and Agent Skills. Open source,
|
|
123
203
|
no lock-in.
|
|
124
204
|
|
|
125
|
-
- Website
|
|
126
|
-
- Docs
|
|
127
|
-
- Source
|
|
205
|
+
- Website: https://almyty.com
|
|
206
|
+
- Docs: https://docs.almyty.com
|
|
207
|
+
- Source: https://github.com/almyty-inc/almyty
|
|
208
|
+
|
|
209
|
+
This CLI is part of the `@almyty/*` suite (versioned together at 1.x) and works with the almyty platform 0.1 and later.
|
|
128
210
|
|
|
129
211
|
Apache-2.0 © Almyty Inc.
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Credential access for the skills CLI.
|
|
3
|
+
*
|
|
4
|
+
* Thin re-export of the shared resolver in @almyty/client, so there is
|
|
5
|
+
* one credential file and one way to read it.
|
|
6
|
+
*
|
|
7
|
+
* `resolveCredentialsOrExit` is not re-exported. index.ts does the check
|
|
8
|
+
* itself in `requireAuth` — it predates the shared helper exiting 3, and
|
|
9
|
+
* either route is correct now. Both answer a missing credential with 3,
|
|
10
|
+
* which is what a script branches on.
|
|
4
11
|
*/
|
|
5
|
-
export { resolveCredentials,
|
|
12
|
+
export { resolveCredentials, loadCredentials, CREDENTIALS_FILE, } from '@almyty/client';
|
|
6
13
|
export type { StoredCredentials } from '@almyty/client';
|
package/dist/auth.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Credential access for the skills CLI.
|
|
3
|
+
*
|
|
4
|
+
* Thin re-export of the shared resolver in @almyty/client, so there is
|
|
5
|
+
* one credential file and one way to read it.
|
|
6
|
+
*
|
|
7
|
+
* `resolveCredentialsOrExit` is not re-exported. index.ts does the check
|
|
8
|
+
* itself in `requireAuth` — it predates the shared helper exiting 3, and
|
|
9
|
+
* either route is correct now. Both answer a missing credential with 3,
|
|
10
|
+
* which is what a script branches on.
|
|
4
11
|
*/
|
|
5
|
-
export { resolveCredentials,
|
|
12
|
+
export { resolveCredentials, loadCredentials, CREDENTIALS_FILE, } from '@almyty/client';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command-line parsing for @almyty/skills.
|
|
3
|
+
*
|
|
4
|
+
* Its own module so the surface can be unit-tested without importing
|
|
5
|
+
* the entry point (which would need a credential store and would run
|
|
6
|
+
* main() on import).
|
|
7
|
+
*/
|
|
8
|
+
export interface ParsedArgs {
|
|
9
|
+
command?: string;
|
|
10
|
+
ref?: string;
|
|
11
|
+
positional: string[];
|
|
12
|
+
flags: Record<string, string | string[] | boolean>;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
15
|
+
export declare function getRef(args: ParsedArgs): string | null;
|
|
16
|
+
export declare function parseRunParams(args: ParsedArgs): Record<string, any>;
|
package/dist/cli-args.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repeatable flags accumulate into a string[] when supplied more
|
|
3
|
+
* than once. Used by `--agent` and `--path` so callers can pick
|
|
4
|
+
* multiple targets without inventing comma syntax (the selector
|
|
5
|
+
* also splits on comma/space, so both styles work).
|
|
6
|
+
*/
|
|
7
|
+
const REPEATABLE_FLAGS = new Set(['agent', 'path']);
|
|
8
|
+
/** Switches: never take a value, never swallow the next token. */
|
|
9
|
+
const BOOLEAN_FLAGS = new Set([
|
|
10
|
+
'all',
|
|
11
|
+
'yes',
|
|
12
|
+
'global',
|
|
13
|
+
'help',
|
|
14
|
+
'version',
|
|
15
|
+
'json',
|
|
16
|
+
'dry-run',
|
|
17
|
+
]);
|
|
18
|
+
/**
|
|
19
|
+
* Flags that belong to the CLI itself, so `run` does not forward them
|
|
20
|
+
* to the skill as parameters. `--json` and `--dry-run` were added
|
|
21
|
+
* later; without them here, `run x --json` would have sent the skill a
|
|
22
|
+
* parameter called `json`.
|
|
23
|
+
*/
|
|
24
|
+
const RESERVED_FLAGS = new Set([
|
|
25
|
+
'url',
|
|
26
|
+
'dir',
|
|
27
|
+
'help',
|
|
28
|
+
'version',
|
|
29
|
+
'interval',
|
|
30
|
+
'gateway',
|
|
31
|
+
'agent',
|
|
32
|
+
'path',
|
|
33
|
+
'all',
|
|
34
|
+
'yes',
|
|
35
|
+
'global',
|
|
36
|
+
'json',
|
|
37
|
+
'dry-run',
|
|
38
|
+
]);
|
|
39
|
+
function appendRepeatable(flags, key, value) {
|
|
40
|
+
const existing = flags[key];
|
|
41
|
+
if (existing === undefined || existing === true || existing === false) {
|
|
42
|
+
flags[key] = value;
|
|
43
|
+
}
|
|
44
|
+
else if (typeof existing === 'string') {
|
|
45
|
+
flags[key] = [existing, value];
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
existing.push(value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function setFlag(flags, key, value) {
|
|
52
|
+
if (REPEATABLE_FLAGS.has(key))
|
|
53
|
+
appendRepeatable(flags, key, value);
|
|
54
|
+
else
|
|
55
|
+
flags[key] = value;
|
|
56
|
+
}
|
|
57
|
+
export function parseArgs(argv) {
|
|
58
|
+
const result = { positional: [], flags: {} };
|
|
59
|
+
for (let i = 0; i < argv.length; i++) {
|
|
60
|
+
const arg = argv[i];
|
|
61
|
+
if (arg === '--') {
|
|
62
|
+
result.positional.push(...argv.slice(i + 1));
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
// Short aliases. `-g` stays on --gateway for back-compat; -G is
|
|
66
|
+
// --global.
|
|
67
|
+
if (arg === '-g') {
|
|
68
|
+
result.flags.gateway = argv[++i] ?? '';
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (arg === '-i') {
|
|
72
|
+
result.flags.interval = argv[++i] ?? '60';
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (arg === '-a') {
|
|
76
|
+
appendRepeatable(result.flags, 'agent', argv[++i] ?? '');
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (arg === '-p') {
|
|
80
|
+
appendRepeatable(result.flags, 'path', argv[++i] ?? '');
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (arg === '-y') {
|
|
84
|
+
result.flags.yes = true;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (arg === '-G') {
|
|
88
|
+
result.flags.global = true;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (arg === '-h') {
|
|
92
|
+
result.flags.help = true;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (arg === '-v') {
|
|
96
|
+
result.flags.version = true;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (arg.startsWith('--')) {
|
|
100
|
+
const body = arg.slice(2);
|
|
101
|
+
const eq = body.indexOf('=');
|
|
102
|
+
if (eq !== -1) {
|
|
103
|
+
// `--agent=codex` and `--input={"a":1}` both used to become a
|
|
104
|
+
// flag whose NAME was the whole `key=value` string.
|
|
105
|
+
setFlag(result.flags, body.slice(0, eq), body.slice(eq + 1));
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (BOOLEAN_FLAGS.has(body)) {
|
|
109
|
+
result.flags[body] = true;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const next = argv[i + 1];
|
|
113
|
+
if (next !== undefined && !next.startsWith('--')) {
|
|
114
|
+
setFlag(result.flags, body, next);
|
|
115
|
+
i++;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
result.flags[body] = true;
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
// A bare word containing a slash is a gateway/skill reference.
|
|
123
|
+
if (arg.includes('/')) {
|
|
124
|
+
result.ref = arg;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (!result.command)
|
|
128
|
+
result.command = arg;
|
|
129
|
+
else
|
|
130
|
+
result.positional.push(arg);
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
export function getRef(args) {
|
|
135
|
+
if (args.ref)
|
|
136
|
+
return args.ref;
|
|
137
|
+
if (typeof args.flags.gateway === 'string' && args.flags.gateway) {
|
|
138
|
+
return args.flags.gateway;
|
|
139
|
+
}
|
|
140
|
+
if (args.positional.length > 0)
|
|
141
|
+
return args.positional[0];
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
export function parseRunParams(args) {
|
|
145
|
+
const params = {};
|
|
146
|
+
for (const [key, value] of Object.entries(args.flags)) {
|
|
147
|
+
if (RESERVED_FLAGS.has(key))
|
|
148
|
+
continue;
|
|
149
|
+
params[key] = value;
|
|
150
|
+
}
|
|
151
|
+
return params;
|
|
152
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit codes shared by every almyty CLI.
|
|
3
|
+
*
|
|
4
|
+
* Scripts need to tell "you are not logged in" apart from "that agent
|
|
5
|
+
* does not exist" apart from "the run you asked for failed" without
|
|
6
|
+
* grepping stderr. Every almyty CLI uses this same table, so
|
|
7
|
+
* `almyty agents run x || case $? in 3) almyty login;; esac` behaves
|
|
8
|
+
* the same whichever binary produced the code.
|
|
9
|
+
*/
|
|
10
|
+
export declare const EXIT: {
|
|
11
|
+
/** Success. */
|
|
12
|
+
readonly OK: 0;
|
|
13
|
+
/** Unexpected failure (a thrown error with no better classification). */
|
|
14
|
+
readonly ERROR: 1;
|
|
15
|
+
/** Bad or missing arguments, or an unknown command. */
|
|
16
|
+
readonly USAGE: 2;
|
|
17
|
+
/** No stored credential, or the API rejected the one we had. */
|
|
18
|
+
readonly AUTH: 3;
|
|
19
|
+
/** The named agent / gateway / skill / run does not exist. */
|
|
20
|
+
readonly NOT_FOUND: 4;
|
|
21
|
+
/** The command ran; the operation it asked for failed. */
|
|
22
|
+
readonly FAILED: 5;
|
|
23
|
+
};
|
|
24
|
+
export type ExitCode = (typeof EXIT)[keyof typeof EXIT];
|
|
25
|
+
/** One line per code, for `--help` output and READMEs. */
|
|
26
|
+
export declare const EXIT_CODE_HELP: string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit codes shared by every almyty CLI.
|
|
3
|
+
*
|
|
4
|
+
* Scripts need to tell "you are not logged in" apart from "that agent
|
|
5
|
+
* does not exist" apart from "the run you asked for failed" without
|
|
6
|
+
* grepping stderr. Every almyty CLI uses this same table, so
|
|
7
|
+
* `almyty agents run x || case $? in 3) almyty login;; esac` behaves
|
|
8
|
+
* the same whichever binary produced the code.
|
|
9
|
+
*/
|
|
10
|
+
export const EXIT = {
|
|
11
|
+
/** Success. */
|
|
12
|
+
OK: 0,
|
|
13
|
+
/** Unexpected failure (a thrown error with no better classification). */
|
|
14
|
+
ERROR: 1,
|
|
15
|
+
/** Bad or missing arguments, or an unknown command. */
|
|
16
|
+
USAGE: 2,
|
|
17
|
+
/** No stored credential, or the API rejected the one we had. */
|
|
18
|
+
AUTH: 3,
|
|
19
|
+
/** The named agent / gateway / skill / run does not exist. */
|
|
20
|
+
NOT_FOUND: 4,
|
|
21
|
+
/** The command ran; the operation it asked for failed. */
|
|
22
|
+
FAILED: 5,
|
|
23
|
+
};
|
|
24
|
+
/** One line per code, for `--help` output and READMEs. */
|
|
25
|
+
export const EXIT_CODE_HELP = [
|
|
26
|
+
' 0 success',
|
|
27
|
+
' 1 unexpected error',
|
|
28
|
+
' 2 usage error (bad flags, unknown command)',
|
|
29
|
+
' 3 not authenticated — run `almyty login`',
|
|
30
|
+
' 4 not found (agent, gateway, skill, or run)',
|
|
31
|
+
' 5 the operation ran and failed',
|
|
32
|
+
].join('\n');
|
package/dist/help.d.ts
ADDED
package/dist/help.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--help` for @almyty/skills.
|
|
3
|
+
*
|
|
4
|
+
* Kept in its own module so the text can be asserted against the code's
|
|
5
|
+
* real surface: there are tests that every dispatched command, every
|
|
6
|
+
* parsed flag and every environment variable the code reads appears
|
|
7
|
+
* here. `watch` was implemented and dispatched while appearing nowhere
|
|
8
|
+
* in --help, which is how a command becomes source-only folklore.
|
|
9
|
+
*/
|
|
10
|
+
import { VERSION } from './version.js';
|
|
11
|
+
import { AGENT_CONFIGS } from './agents.js';
|
|
12
|
+
export function helpText() {
|
|
13
|
+
return `@almyty/skills v${VERSION}
|
|
14
|
+
|
|
15
|
+
Turn any API in your almyty gateways into a SKILL.md your coding agent
|
|
16
|
+
reads on its next session. ${AGENT_CONFIGS.length} agents are recognised, plus the universal
|
|
17
|
+
.agents/skills/ convention.
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
npx @almyty/skills <command> [options]
|
|
21
|
+
|
|
22
|
+
Commands:
|
|
23
|
+
install <ref> Write skills into local AI coding agents
|
|
24
|
+
list [ref] Skills available to you, all or per gateway
|
|
25
|
+
search <query> Search your gateways' skills by keyword
|
|
26
|
+
run <ref> [--key value ...] Execute one skill and print its result
|
|
27
|
+
installed Skills this CLI has installed here
|
|
28
|
+
remove Remove every skill this CLI installed here
|
|
29
|
+
gateways Your gateways, and the ref to install each
|
|
30
|
+
daemon Re-sync every skill on a timer
|
|
31
|
+
watch <ref> Re-sync one gateway on a timer
|
|
32
|
+
help Show this help
|
|
33
|
+
|
|
34
|
+
References:
|
|
35
|
+
org/gateway All skills from one gateway
|
|
36
|
+
org/gateway/skill One skill
|
|
37
|
+
skill-name Search by name, install if it is unambiguous
|
|
38
|
+
<uuid> A gateway by id
|
|
39
|
+
A leading @ is optional: @acme/petstore and acme/petstore are the same.
|
|
40
|
+
|
|
41
|
+
Install targets:
|
|
42
|
+
--agent, -a <name> Install to the named agent. Repeatable,
|
|
43
|
+
partial match ("-a codex -a claude").
|
|
44
|
+
'*' or 'all' means every known agent.
|
|
45
|
+
--path, -p <dir> Install to this directory. Repeatable.
|
|
46
|
+
Bypasses agent detection entirely.
|
|
47
|
+
--all Every PROJECT-detected agent, plus the
|
|
48
|
+
universal .agents/skills/. Skips the picker.
|
|
49
|
+
--global, -G Home scope (~/.codex/skills/ etc.) instead
|
|
50
|
+
of project scope. With --all, adds
|
|
51
|
+
home-detected agents to the project ones.
|
|
52
|
+
--yes, -y Skip the picker; use the non-interactive
|
|
53
|
+
defaults (project-detected + universal).
|
|
54
|
+
--dry-run Print every file install would write, and
|
|
55
|
+
write nothing.
|
|
56
|
+
|
|
57
|
+
Options:
|
|
58
|
+
--interval, -i <seconds> daemon/watch poll interval (default 60)
|
|
59
|
+
--url <url> API URL (default https://api.almyty.com)
|
|
60
|
+
--dir <path> Project directory (default: cwd)
|
|
61
|
+
--json Machine-readable output, no decoration
|
|
62
|
+
--help, -h Show this help
|
|
63
|
+
--version, -v Print the version
|
|
64
|
+
|
|
65
|
+
Config (.almytyrc, in the project dir or $HOME, JSON):
|
|
66
|
+
skillsDir Install here and skip detection
|
|
67
|
+
agents Whitelist of agent names to install to
|
|
68
|
+
url API URL
|
|
69
|
+
interval daemon/watch poll interval, in seconds
|
|
70
|
+
The credential is NOT read from here — it lives in
|
|
71
|
+
~/.almyty/credentials.json, written by \`npx @almyty/auth login\`.
|
|
72
|
+
|
|
73
|
+
Environment:
|
|
74
|
+
ALMYTY_TOKEN Token override
|
|
75
|
+
ALMYTY_URL API URL override
|
|
76
|
+
ALMYTY_SKILLS_DIR Install directory override
|
|
77
|
+
ALMYTY_NON_INTERACTIVE=1 Never prompt, even in a terminal
|
|
78
|
+
CI Same effect as ALMYTY_NON_INTERACTIVE
|
|
79
|
+
NO_COLOR Drop colour from the interactive picker
|
|
80
|
+
|
|
81
|
+
Target selection:
|
|
82
|
+
With no target flag in an interactive terminal, install shows a
|
|
83
|
+
multi-select picker: detected agents pre-checked, every other known
|
|
84
|
+
agent as opt-in, the universal directory, and a custom path. In CI or
|
|
85
|
+
a pipe the picker is skipped and install writes to the detected agents
|
|
86
|
+
plus .agents/skills/ — run --dry-run first to see exactly where.
|
|
87
|
+
|
|
88
|
+
Installing overwrites a SKILL.md of the same name in the target
|
|
89
|
+
directory. Nothing else in those directories is touched, and \`remove\`
|
|
90
|
+
only deletes skills carrying almyty's own frontmatter marker.
|
|
91
|
+
|
|
92
|
+
Exit codes:
|
|
93
|
+
0 success
|
|
94
|
+
1 unexpected error
|
|
95
|
+
2 usage error (bad flags, unknown command)
|
|
96
|
+
3 not authenticated — run \`npx @almyty/auth login\`
|
|
97
|
+
4 no such gateway or skill
|
|
98
|
+
5 the skill ran and failed
|
|
99
|
+
|
|
100
|
+
Examples:
|
|
101
|
+
npx @almyty/skills gateways
|
|
102
|
+
npx @almyty/skills install acme/petstore --dry-run
|
|
103
|
+
npx @almyty/skills install acme/petstore -a codex -a claude
|
|
104
|
+
npx @almyty/skills install acme/petstore --all --global
|
|
105
|
+
npx @almyty/skills search weather --json
|
|
106
|
+
npx @almyty/skills run acme/petstore/get-pet --petId 123
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
export function printHelp() {
|
|
110
|
+
console.log(helpText());
|
|
111
|
+
}
|