cyber-agentkit 0.7.1 → 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.
@@ -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`, or `<name>.default.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,93 +1,92 @@
1
1
  {
2
- "name": "cyber-agentkit",
3
- "version": "0.7.1",
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
- "keywords": [
6
- "agent-harness",
7
- "claude-code",
8
- "cursor",
9
- "codex",
10
- "copilot-cli",
11
- "opencode",
12
- "kilo-code",
13
- "gemini-cli",
14
- "qwen-code",
15
- "vscode",
16
- "cline",
17
- "crush",
18
- "openhands",
19
- "auggie"
20
- ],
21
- "homepage": "https://cyber-uni.github.io/cyber-agentkit/",
22
- "bugs": {
23
- "url": "https://github.com/cyber-uni/cyber-agentkit/issues"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/cyber-uni/cyber-agentkit.git",
28
- "directory": "packages/cyber-agentkit"
29
- },
30
- "license": "MIT",
31
- "author": "unional <homawong@gmail.com>",
32
- "type": "module",
33
- "sideEffects": [
34
- "./bin/*.mjs",
35
- "./dist/cli.js",
36
- "./skills/*/scripts/*.mjs"
37
- ],
38
- "exports": {
39
- ".": "./dist/index.js",
40
- "./commands": "./dist/commands.js",
41
- "./worktrees": "./dist/worktrees.js",
42
- "./package.json": "./package.json"
43
- },
44
- "bin": {
45
- "cyber-agentkit": "./bin/cyber-agentkit.mjs"
46
- },
47
- "files": [
48
- "LICENSE",
49
- "bin",
50
- "dist",
51
- "skills",
52
- "references",
53
- "plugin.json",
54
- ".claude-plugin",
55
- ".cursor-plugin",
56
- ".codex-plugin"
57
- ],
58
- "scripts": {
59
- "build": "tsdown",
60
- "generate:references": "tsx scripts/generate-references.ts",
61
- "dev": "tsx src/index.ts",
62
- "lint": "biome check .",
63
- "prepack": "pnpm build",
64
- "test": "pnpm build && vitest run src",
65
- "test:watch": "vitest",
66
- "typecheck": "tsc --noEmit",
67
- "verify": "pnpm typecheck && pnpm lint && pnpm test"
68
- },
69
- "peerDependencies": {
70
- "clibuilder": "^12.0.0"
71
- },
72
- "peerDependenciesMeta": {
73
- "clibuilder": {
74
- "optional": true
75
- }
76
- },
77
- "devDependencies": {
78
- "@types/node": "^24.10.1",
79
- "clibuilder": "^12.0.0",
80
- "tsdown": "^0.23.0",
81
- "tsx": "^4.22.3",
82
- "typescript": "^7.0.0",
83
- "vitest": "^5.0.0",
84
- "yaml": "^2.9.0"
85
- },
86
- "engines": {
87
- "node": ">=22"
88
- },
89
- "publishConfig": {
90
- "access": "public",
91
- "provenance": true
92
- }
93
- }
2
+ "name": "cyber-agentkit",
3
+ "version": "1.1.0",
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
+ "keywords": [
6
+ "agent-harness",
7
+ "claude-code",
8
+ "cursor",
9
+ "codex",
10
+ "copilot-cli",
11
+ "opencode",
12
+ "kilo-code",
13
+ "gemini-cli",
14
+ "qwen-code",
15
+ "vscode",
16
+ "cline",
17
+ "crush",
18
+ "openhands",
19
+ "auggie"
20
+ ],
21
+ "homepage": "https://cyber-uni.github.io/cyber-agentkit/",
22
+ "bugs": {
23
+ "url": "https://github.com/cyber-uni/cyber-agentkit/issues"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/cyber-uni/cyber-agentkit.git",
28
+ "directory": "packages/cyber-agentkit"
29
+ },
30
+ "license": "MIT",
31
+ "author": "unional <homawong@gmail.com>",
32
+ "type": "module",
33
+ "sideEffects": [
34
+ "./bin/*.mjs",
35
+ "./dist/cli.js",
36
+ "./skills/*/scripts/*.mjs"
37
+ ],
38
+ "exports": {
39
+ ".": "./dist/index.js",
40
+ "./commands": "./dist/commands.js",
41
+ "./worktrees": "./dist/worktrees.js",
42
+ "./package.json": "./package.json"
43
+ },
44
+ "bin": {
45
+ "cyber-agentkit": "bin/cyber-agentkit.mjs"
46
+ },
47
+ "files": [
48
+ "LICENSE",
49
+ "bin",
50
+ "dist",
51
+ "skills",
52
+ "references",
53
+ "plugin.json",
54
+ ".claude-plugin",
55
+ ".cursor-plugin",
56
+ ".codex-plugin"
57
+ ],
58
+ "peerDependencies": {
59
+ "clibuilder": "^12.0.0"
60
+ },
61
+ "peerDependenciesMeta": {
62
+ "clibuilder": {
63
+ "optional": true
64
+ }
65
+ },
66
+ "devDependencies": {
67
+ "@types/node": "^24.10.1",
68
+ "clibuilder": "^12.0.0",
69
+ "tsdown": "^0.23.0",
70
+ "tsx": "^4.22.3",
71
+ "typescript": "^7.0.0",
72
+ "vitest": "^5.0.0",
73
+ "yaml": "^2.9.0"
74
+ },
75
+ "engines": {
76
+ "node": ">=22"
77
+ },
78
+ "publishConfig": {
79
+ "access": "public",
80
+ "provenance": true
81
+ },
82
+ "scripts": {
83
+ "build": "tsdown",
84
+ "generate:references": "tsx scripts/generate-references.ts",
85
+ "dev": "tsx src/index.ts",
86
+ "lint": "biome check .",
87
+ "test": "pnpm build && vitest run src",
88
+ "test:watch": "vitest",
89
+ "typecheck": "tsc --noEmit",
90
+ "verify": "pnpm typecheck && pnpm lint && pnpm test"
91
+ }
92
+ }
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": "0.7.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
  }
package/readme.md CHANGED
@@ -204,7 +204,7 @@ harness keeps no readable install record). A dependency with no marketplace reso
204
204
  declaring plugin's own marketplace, as Claude Code does, and is `unknown` when that marketplace
205
205
  cannot be found.
206
206
 
207
- `readPluginDependencies(pluginRoot)` reads the list from `extensions["org.spikyuni.plugin-manager"]`
207
+ `readPluginDependencies(pluginRoot)` reads the list from `extensions["io.github.cyber-uni.plugin-manager"]`
208
208
  (or the older `extensions["org.cyberuni.universal-plugin"]`) in the root `plugin.json`, then from
209
209
  `.claude-plugin/plugin.json`. `declaredPluginDependencies(manifest)` parses a manifest you already
210
210
  hold. The how-to for a person or agent, `plugin-dependencies`, ships as a
@@ -377,8 +377,8 @@ you approve it. It runs the command from its bundled `scripts/reference.mjs`, wh
377
377
  `node_modules`.
378
378
 
379
379
  ```text
380
- /plugin marketplace add cyberuni/cyberplace
381
- /plugin install cyber-agentkit@cyberplace
380
+ /plugin marketplace add cyber-uni/marketplace
381
+ /plugin install cyber-agentkit@cyber-uni
382
382
  ```
383
383
 
384
384
  A skill that needs a reference names it in one line, as the skill's
@@ -5,7 +5,7 @@ tags: [plugin, dependencies, install]
5
5
 
6
6
  ## What a plugin declares
7
7
 
8
- Only Claude Code's manifest declares dependencies: a `dependencies` array in `.claude-plugin/plugin.json` whose entries are `"name"`, `"name@marketplace"`, or `{ "name", "marketplace", "version" }` (E-DEP-1). A bare name resolves in the declaring plugin's own marketplace. A plugin can author the same list once in its root `plugin.json`, at `extensions["org.spikyuni.plugin-manager"].dependencies` or, in plugins built before that key, `extensions["org.cyberuni.universal-plugin"].dependencies` (E-DEP-6, E-DEP-7). Read it from there first, then from `.claude-plugin/plugin.json`, whichever harness you run on.
8
+ Only Claude Code's manifest declares dependencies: a `dependencies` array in `.claude-plugin/plugin.json` whose entries are `"name"`, `"name@marketplace"`, or `{ "name", "marketplace", "version" }` (E-DEP-1). A bare name resolves in the declaring plugin's own marketplace. A plugin can author the same list once in its root `plugin.json`, at `extensions["io.github.cyber-uni.plugin-manager"].dependencies` or, in plugins built before that key, `extensions["org.cyberuni.universal-plugin"].dependencies` (E-DEP-6 to E-DEP-8). Read it from there first, then from `.claude-plugin/plugin.json`, whichever harness you run on.
9
9
 
10
10
  ## Check what is missing
11
11
 
@@ -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.