cyber-agentkit 1.0.0 → 1.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/dist/cli.js +680 -65
- package/dist/commands.d.ts +7 -1
- package/dist/commands.js +469 -48
- package/dist/index.d.ts +28 -15
- package/dist/index.js +31 -18
- package/dist/{reference-where-BhymfNgA.js → reference-where-C84J6MsR.js} +3839 -3649
- package/dist/{resolve-reference-Cis-Ye6T.d.ts → resolve-reference-D62VJZc0.d.ts} +17 -3
- package/package.json +1 -1
- package/plugin.json +3 -2
- package/skills/asset/README.md +14 -0
- package/skills/asset/SKILL.md +52 -0
- package/skills/asset/scripts/asset.mjs +199 -0
- package/skills/reference/README.md +1 -1
- package/skills/reference/SKILL.md +3 -3
- package/skills/reference/scripts/reference.mjs +56 -56
|
@@ -39,7 +39,7 @@ type ReferenceWarning = {
|
|
|
39
39
|
code: ReferenceWarningCode;
|
|
40
40
|
message: string;
|
|
41
41
|
};
|
|
42
|
-
type ReferenceWarningCode = 'frontmatter-invalid' | 'merge-unknown' | 'marker-unknown' | 'marker-unmatched' | 'heading-repeated' | 'remove-body-ignored' | 'extends-invalid' | 'extends-self' | 'extends-step-missing' | 'extends-all-missing' | 'extends-not-used' | 'default-not-selected' | 'default-folder-missing' | 'default-in-tier' | 'file-ignored' | 'interface-not-composed' | 'interface-check';
|
|
42
|
+
type ReferenceWarningCode = 'frontmatter-invalid' | 'merge-unknown' | 'marker-unknown' | 'marker-unmatched' | 'heading-repeated' | 'remove-body-ignored' | 'extends-invalid' | 'extends-self' | 'extends-step-missing' | 'extends-all-missing' | 'extends-not-used' | 'default-not-selected' | 'default-folder-missing' | 'default-in-tier' | 'file-ignored' | 'format-mismatch' | 'selection-invalid' | 'interface-not-composed' | 'interface-check';
|
|
43
43
|
/** The code of a name that is not `found`. */
|
|
44
44
|
type ReferenceCode = 'reference-missing' | 'reference-ambiguous' | 'reference-invalid';
|
|
45
45
|
//#endregion
|
|
@@ -56,9 +56,15 @@ type ReferenceLayer = {
|
|
|
56
56
|
skill?: string | undefined;
|
|
57
57
|
/** Set when the layer is never read, and why: policy held in MDM, a plugin with no install folder. */
|
|
58
58
|
skipped?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* An `assets/` layer: a file is `<name>.<ext>` with no `.default` marker, read as written. Nothing in it
|
|
61
|
+
* merges or extends; the highest layer holding the name answers whole.
|
|
62
|
+
*/
|
|
63
|
+
whole?: boolean | undefined;
|
|
59
64
|
/** Raised on every name resolved through this layer, such as a `--default` folder that does not exist. */
|
|
60
65
|
warning?: ReferenceWarning | undefined;
|
|
61
66
|
};
|
|
67
|
+
type ReferenceFolder = 'references' | 'assets';
|
|
62
68
|
type ReferenceLayerOptions = {
|
|
63
69
|
root: string;
|
|
64
70
|
home: string;
|
|
@@ -70,6 +76,8 @@ type ReferenceLayerOptions = {
|
|
|
70
76
|
plugin?: ReferencePlugin | undefined;
|
|
71
77
|
/** The calling skill's folder: its `references/<name>.default.md` forms the `default` tier. */
|
|
72
78
|
defaultSkill?: string | undefined;
|
|
79
|
+
/** The folder every tier reads: `references` (the default), or `assets` for an assets call. */
|
|
80
|
+
folder?: ReferenceFolder | undefined;
|
|
73
81
|
/** Detects the harness and reads its settings. Defaults to `process.env`. */
|
|
74
82
|
env?: Readonly<Record<string, string | undefined>>;
|
|
75
83
|
};
|
|
@@ -97,7 +105,7 @@ declare function projectReferencesDir(root: string): string;
|
|
|
97
105
|
declare function userReferencesDir(home: string): string;
|
|
98
106
|
/** The `default` tier for the skill at `folder`; a folder that does not exist warns and adds no contribution. */
|
|
99
107
|
declare function defaultLayer(folder: string): ReferenceLayer;
|
|
100
|
-
declare function referenceLayers({ root, home, platform, plugin, defaultSkill, env }: ReferenceLayerOptions): Promise<ReferenceLayers>;
|
|
108
|
+
declare function referenceLayers({ root, home, platform, plugin, defaultSkill, folder, env }: ReferenceLayerOptions): Promise<ReferenceLayers>;
|
|
101
109
|
//#endregion
|
|
102
110
|
//#region src/references/reference-document.d.ts
|
|
103
111
|
/**
|
|
@@ -113,6 +121,10 @@ type SectionSource = {
|
|
|
113
121
|
operation: MergeOperation;
|
|
114
122
|
};
|
|
115
123
|
//#endregion
|
|
124
|
+
//#region src/references/reference-format.d.ts
|
|
125
|
+
/** The format of a reference file: `markdown`, or the extension of a data file. */
|
|
126
|
+
type ReferenceFormat = 'markdown' | 'json' | 'yaml' | 'toml' | 'txt';
|
|
127
|
+
//#endregion
|
|
116
128
|
//#region src/references/reference-name.d.ts
|
|
117
129
|
type ReferenceName = {
|
|
118
130
|
/** As asked. */
|
|
@@ -144,7 +156,7 @@ type ReferenceTraceLayer = {
|
|
|
144
156
|
skill?: string;
|
|
145
157
|
/** The file matched, or the folder checked when none matched. */
|
|
146
158
|
path: string;
|
|
147
|
-
/** The file that answered, relative to the folder: `<name>.md`, `<name>/README.md`,
|
|
159
|
+
/** The file that answered, relative to the folder: `<name>.md`, `<name>/README.md`, `<name>.default.md`, or the same with a data extension. */
|
|
148
160
|
file?: string;
|
|
149
161
|
/** Its frontmatter as written. */
|
|
150
162
|
frontmatter?: Record<string, unknown>;
|
|
@@ -197,6 +209,8 @@ type ResolvedReference = {
|
|
|
197
209
|
/** Why it is not `found`, for a person. */
|
|
198
210
|
message?: string;
|
|
199
211
|
content?: string;
|
|
212
|
+
/** Set when `found`: `markdown`, or the format of the data file that answered whole. */
|
|
213
|
+
format?: ReferenceFormat;
|
|
200
214
|
/** The composed frontmatter, key by key with the higher contribution winning, without `merge` and `extends`. */
|
|
201
215
|
metadata?: Record<string, unknown>;
|
|
202
216
|
/** When `ambiguous`: each `<plugin>/<name>`, and `default` when the skill has one. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyber-agentkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "An agent-harness-agnostic toolkit: the fundamental features agent tools need, working the same on every harness. Detect the running harness, check plugin dependencies, resolve layered reference documents, and lease git worktrees.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-harness",
|
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "cyber-agentkit",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"description": "An agent-harness-agnostic toolkit: the fundamental features agent tools need, working the same on every harness. Detect the running harness, check plugin dependencies, resolve layered reference documents, and lease git worktrees.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "unional"
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"copilot-cli": {}
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
-
"skills/reference/scripts/reference.mjs": "src/references/reference.skill-script.ts"
|
|
23
|
+
"skills/reference/scripts/reference.mjs": "src/references/reference.skill-script.ts",
|
|
24
|
+
"skills/asset/scripts/asset.mjs": "src/assets/asset.skill-script.ts"
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Asset
|
|
2
|
+
|
|
3
|
+
Lists, shows, creates, updates, and deletes the static files in a skill's `assets/` folder, such as templates, schemas, and JSON data a skill points to by path. By path: plain file operations with no tiers and no merging. By name: loads a file through the managed, project, user, and plugin tiers (the skill's own file is the default), so a plugin, the project, or the user can override which one a skill uses by placing its own. Nothing merges or extends. It runs the `asset` command from a launcher bundled in `scripts/`, and writes or deletes only after the user approves. Type `/asset` to run it yourself. Installed as a Claude Code plugin, it is `/cyber-agentkit:asset` (pnpm install: `pnpm-cyber-agentkit-asset`).
|
|
4
|
+
|
|
5
|
+
| Mode | When |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| list | see every file under the skill's `assets/` with its size |
|
|
8
|
+
| show | read a text asset |
|
|
9
|
+
| create | add a new asset; never overwrites. With `--copy`, start an override in the project or user tier as a copy of a plugin's, the default, or another tier's file (never managed) |
|
|
10
|
+
| update | replace an existing asset |
|
|
11
|
+
| delete | remove an asset and any folder it leaves empty |
|
|
12
|
+
| load, names, where, select | resolve an asset by name through the tiers, list names, show where an override goes, and choose which plugin's file answers a name several hold |
|
|
13
|
+
|
|
14
|
+
For a document fetched by name and layered across the managed, project, user, and plugin tiers, use [`/reference`](../reference/README.md).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asset
|
|
3
|
+
description: Use this skill when listing, reading, adding, changing, or deleting the static files in a skill's assets/ folder, such as templates, schemas, or JSON data a skill points to by path.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Asset
|
|
7
|
+
|
|
8
|
+
An **asset** is a static file in a skill's `assets/` folder: a template, a schema, a lookup table, a JSON permission list. Two kinds of work:
|
|
9
|
+
|
|
10
|
+
- **By path**: manage the files themselves. No tiers, no merging.
|
|
11
|
+
- **By name**: load a file the way a reference loads, so a plugin, the project, or the user can override which file a skill uses by placing its own. The managed, project (`.agents/assets/`), user (`~/.agents/assets/`), and plugin tiers read `assets/` folders, and the skill's own `assets/<name>.<ext>` is the default. The highest tier holding the name answers with the file as written. Nothing merges or extends, Markdown included: frontmatter in an asset is just text. Choosing among plugins is a selection, a one-line `<name>.select` file.
|
|
12
|
+
|
|
13
|
+
For a Markdown document layered across tiers, use the `reference` skill.
|
|
14
|
+
|
|
15
|
+
## Route
|
|
16
|
+
|
|
17
|
+
| The request | Run |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| see which assets a skill holds | `list` |
|
|
20
|
+
| read a text asset | `show <path>` |
|
|
21
|
+
| add a new asset | `create <path>` |
|
|
22
|
+
| start an override from an existing asset, to edit | `create <name> --copy <plugin\|default\|project\|user> --scope project\|user --default <skill folder>` |
|
|
23
|
+
| change an existing asset | `update <path>` |
|
|
24
|
+
| remove an asset | `delete <path>` |
|
|
25
|
+
| read the asset a skill loads by name, after overrides | `load <name> --default <skill folder>` |
|
|
26
|
+
| see which asset names exist | `names --default <skill folder>` |
|
|
27
|
+
| see where an override of a name would go | `where <name> --default <skill folder>` |
|
|
28
|
+
| choose which plugin's file, or the skill's own, answers a name | `select <name> <option> --default <skill folder>` |
|
|
29
|
+
|
|
30
|
+
## Run
|
|
31
|
+
|
|
32
|
+
Find the skill's source folder in the repository (the directory its `SKILL.md` is in), then run from anywhere:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
node <this skill's folder>/scripts/asset.mjs <mode> [<path>] --skill <skill folder> --root <repository root>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- `<path>` is relative to `assets/`, with `/` separators and no `..`, such as `data/rules.json`.
|
|
39
|
+
- `create` and `update` take the text with `--content "<text>"` or a local file with `--from <file>`; pass exactly one.
|
|
40
|
+
- Never use `npx`, `pnpm dlx`, or any package runner, and never download anything.
|
|
41
|
+
|
|
42
|
+
`load`, `names`, and `where` read only. `create --copy` never copies from the managed tier: it is policy, a copy would leak it into the repository or home folder and read as in effect when the managed file still wins. If asked, refuse and offer `load` to read it.
|
|
43
|
+
|
|
44
|
+
Ask the user before `create`, `update`, `delete`, or `select`, and name the file.
|
|
45
|
+
|
|
46
|
+
To make a skill use a different file, place one of the same name in a higher tier: `.agents/assets/<name>.<ext>` for the project, `~/.agents/assets/<name>.<ext>` for the user. When two plugins hold a name and no tier does, `load` reports it ambiguous and lists the options: run `select <name> <option>` (a plugin name, or `default` for the skill's own file; `--scope user` for yourself, `--clear` to undo), ask for `<plugin>/<name>`, or place the file in a tier. `where <name>` shows the folders. `create` never overwrites and `update` needs the file to exist.
|
|
47
|
+
|
|
48
|
+
## Read the result
|
|
49
|
+
|
|
50
|
+
Exit 0 means it did what was asked. Exit 1 is a refusal, and stderr says `error: <code>: <message>`: `exists`, `no-file`, `binary`, or `folder-invalid` (the folder is not a skill folder, or is an installed copy or outside the repository). Exit 2 is misuse: a path that leaves `assets/`, or both or neither of `--content` and `--from`. Report the message; do not retry with a different path to get around it.
|
|
51
|
+
|
|
52
|
+
`show` prints text only. A binary asset is pointed to by path, not shown.
|