@crewdhq/crewd-mcp 0.0.0-stage → 0.1.7
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 +21 -0
- package/README.md +176 -2
- package/dist-mcp/cli.d.ts +3 -0
- package/dist-mcp/cli.d.ts.map +1 -0
- package/dist-mcp/cli.js +9 -0
- package/dist-mcp/cli.js.map +1 -0
- package/dist-mcp/core/adapters.d.ts +29 -0
- package/dist-mcp/core/adapters.d.ts.map +1 -0
- package/dist-mcp/core/adapters.js +306 -0
- package/dist-mcp/core/adapters.js.map +1 -0
- package/dist-mcp/core/installer.d.ts +42 -0
- package/dist-mcp/core/installer.d.ts.map +1 -0
- package/dist-mcp/core/installer.js +236 -0
- package/dist-mcp/core/installer.js.map +1 -0
- package/dist-mcp/core/manifest.d.ts +17 -0
- package/dist-mcp/core/manifest.d.ts.map +1 -0
- package/dist-mcp/core/manifest.js +128 -0
- package/dist-mcp/core/manifest.js.map +1 -0
- package/dist-mcp/core/project.d.ts +11 -0
- package/dist-mcp/core/project.d.ts.map +1 -0
- package/dist-mcp/core/project.js +57 -0
- package/dist-mcp/core/project.js.map +1 -0
- package/dist-mcp/core/registry.d.ts +36 -0
- package/dist-mcp/core/registry.d.ts.map +1 -0
- package/dist-mcp/core/registry.js +224 -0
- package/dist-mcp/core/registry.js.map +1 -0
- package/dist-mcp/core/tar.d.ts +23 -0
- package/dist-mcp/core/tar.d.ts.map +1 -0
- package/dist-mcp/core/tar.js +145 -0
- package/dist-mcp/core/tar.js.map +1 -0
- package/dist-mcp/core/token.d.ts +23 -0
- package/dist-mcp/core/token.d.ts.map +1 -0
- package/dist-mcp/core/token.js +70 -0
- package/dist-mcp/core/token.js.map +1 -0
- package/dist-mcp/server.d.ts +14 -0
- package/dist-mcp/server.d.ts.map +1 -0
- package/dist-mcp/server.js +429 -0
- package/dist-mcp/server.js.map +1 -0
- package/dist-mcp/types.d.ts +141 -0
- package/dist-mcp/types.d.ts.map +1 -0
- package/dist-mcp/types.js +43 -0
- package/dist-mcp/types.js.map +1 -0
- package/package.json +52 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Crewd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,177 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Crewd CLI (`crewd`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The official package manager for prompt-defined AI agents, skills, and teams across **Claude Code**, **Cursor**, and **Gemini CLI**!!
|
|
4
|
+
|
|
5
|
+
[](https://pkg.go.dev/github.com/crewdhq/crewd-cli)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
### Homebrew (macOS / Linux)
|
|
13
|
+
```bash
|
|
14
|
+
brew install crewdhq/tap/crewd
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Standalone Shell Installer
|
|
18
|
+
```bash
|
|
19
|
+
curl -fsSL https://crewd.dev/install.sh | sh
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Build from Source
|
|
23
|
+
```bash
|
|
24
|
+
go install github.com/crewdhq/crewd-cli/cmd/crewd@latest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Quickstart
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 1. Initialize your repository with auto-detected hosts
|
|
33
|
+
crewd init
|
|
34
|
+
|
|
35
|
+
# 2. Hire an AI agent
|
|
36
|
+
crewd hire @alice/reviewer
|
|
37
|
+
|
|
38
|
+
# 3. Inspect your active crew
|
|
39
|
+
crewd roster
|
|
40
|
+
|
|
41
|
+
# 4. Check workspace health
|
|
42
|
+
crewd doctor
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Command Reference
|
|
48
|
+
|
|
49
|
+
| Command | Usage | Description |
|
|
50
|
+
| :--- | :--- | :--- |
|
|
51
|
+
| `init` | `crewd init` | Initialize `crewd.json` and configure host gitignore blocks |
|
|
52
|
+
| `hire` | `crewd hire <pkg>` | Hire an agent or skill into the workspace |
|
|
53
|
+
| `hire team` | `crewd hire team <team>` | Hire a full multi-agent squad |
|
|
54
|
+
| `fire` | `crewd fire <pkg>` | Remove an agent or skill from the workspace |
|
|
55
|
+
| `promote` | `crewd promote [pkg]` | Upgrade installed agents while preserving local learnings |
|
|
56
|
+
| `teach` | `crewd teach <agent> <skill>` | Teach an installed agent a repo-local skill |
|
|
57
|
+
| `forget` | `crewd forget <agent> <skill>` | Remove a taught skill from an agent |
|
|
58
|
+
| `install` | `crewd install [--frozen]` | Deterministically install all packages from `crewd.lock` |
|
|
59
|
+
| `roster` | `crewd roster` | List all active agents, squad members, and skills |
|
|
60
|
+
| `interview` | `crewd interview <pkg>` | Review prompt, tools, and scripts before hiring |
|
|
61
|
+
| `doctor` | `crewd doctor` | Validate workspace health, lock sync, and host configs |
|
|
62
|
+
| `search` | `crewd search <query>` | Search packages in the registry |
|
|
63
|
+
| `mcp` | `crewd mcp` | Start the Model Context Protocol (MCP) server over stdio |
|
|
64
|
+
| `cache clean` | `crewd cache clean` | Purge local blob and package caches |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Crewd MCP Server (`@crewdhq/crewd-mcp`)
|
|
69
|
+
|
|
70
|
+
Crewd provides a local stdio **Model Context Protocol (MCP)** server so coding agents (**Claude Code**, **Cursor**, **Gemini CLI**) can discover, inspect, plan, and hire agents directly inside active development sessions without switching away to terminal commands.
|
|
71
|
+
|
|
72
|
+
### Setup & Installation
|
|
73
|
+
|
|
74
|
+
#### 1. Claude Code
|
|
75
|
+
Add Crewd directly to your Claude Code MCP configuration:
|
|
76
|
+
```bash
|
|
77
|
+
claude mcp add crewd -- npx @crewdhq/crewd-mcp
|
|
78
|
+
```
|
|
79
|
+
*(Or use the installed CLI binary: `claude mcp add crewd -- crewd mcp`)*
|
|
80
|
+
|
|
81
|
+
#### 2. Cursor
|
|
82
|
+
Add Crewd to `.cursor/mcp.json` or your global Cursor MCP configuration:
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"mcpServers": {
|
|
86
|
+
"crewd": {
|
|
87
|
+
"command": "npx",
|
|
88
|
+
"args": ["-y", "@crewdhq/crewd-mcp"]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### 3. Gemini CLI & Antigravity IDE
|
|
95
|
+
Add Crewd to `settings.json` or your MCP server configuration:
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"crewd": {
|
|
100
|
+
"command": "npx",
|
|
101
|
+
"args": ["-y", "@crewdhq/crewd-mcp"]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### Exposed MCP Tools
|
|
110
|
+
|
|
111
|
+
| Tool | Parameters | Description |
|
|
112
|
+
| :--- | :--- | :--- |
|
|
113
|
+
| `search_packages` | `{ query, kind?, limit? }` | Discover agents, squads, and skills in the registry with publisher and tag metadata. |
|
|
114
|
+
| `inspect_package` | `{ name, version? }` | Read-only inspection of agent prompts, role specifications, tool permissions, and script previews. Never executes code. |
|
|
115
|
+
| `plan_hire` | `{ name, version?, targets? }` | Dry-run resolution returning exact files to be created/changed, SHA-256 integrity hashes, script warnings, and a single-use `confirm_token`. Writes nothing. |
|
|
116
|
+
| `hire` | `{ name, version?, targets?, confirm_token }` | Executes installation into the repository with user approval. Requires valid `confirm_token`. Installs scripts as inert files only. |
|
|
117
|
+
| `list_installed` | `{}` | Lists all active agents, teams, skills, versions, and configured hosts from `crewd.json` and `crewd.lock`. |
|
|
118
|
+
| `check_updates` | `{}` | Compares installed packages in `crewd.lock` against the registry and details available upgrades and added/removed skills. |
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### Security & Safety Model
|
|
123
|
+
|
|
124
|
+
Installing AI agents is a trust boundary. The Crewd MCP server implements strict defensive controls:
|
|
125
|
+
|
|
126
|
+
1. **Two-Phase Hire with Confirmation Tokens**:
|
|
127
|
+
- `hire` cannot execute without a prior `plan_hire` run.
|
|
128
|
+
- `plan_hire` returns an in-memory `confirm_token` (5-minute TTL, single-use, cryptographically bound to the package name and version).
|
|
129
|
+
- Calling agents are instructed to present the plan, changed files, and script warnings to the user and obtain explicit user approval before calling `hire`.
|
|
130
|
+
2. **File-Only Script Installation**:
|
|
131
|
+
- Package scripts (`.sh`, `scripts/`) are flagged prominently during planning.
|
|
132
|
+
- `hire` writes scripts to disk as standard files only. The MCP server **never** executes package scripts.
|
|
133
|
+
3. **Prompt-Injection Defense**:
|
|
134
|
+
- All registry data (descriptions, READMEs, prompts) is treated as untrusted input.
|
|
135
|
+
- Long fields are truncated and sanitized to prevent instruction override attacks.
|
|
136
|
+
4. **Path Traversal Protection**:
|
|
137
|
+
- File paths in downloaded tarballs are strictly validated against directory traversal attacks (`..`, absolute paths, symlink escapes).
|
|
138
|
+
- Writes are strictly contained within the detected workspace project root.
|
|
139
|
+
5. **Cryptographic Integrity**:
|
|
140
|
+
- Package archives are verified against SHA-256 integrity hashes declared by the registry before extraction or file generation.
|
|
141
|
+
6. **Zero Leaks**:
|
|
142
|
+
- No additional telemetry beyond what the CLI already sends. Configurable via `CREWD_NO_TELEMETRY=true`.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Using Hired Agents in Your AI Coding Environment
|
|
147
|
+
|
|
148
|
+
Once you run `crewd hire <agent>` or `crewd hire team <team>`, Crewd compiles the agent, its skills, and its durable memory directly into native configuration files for your environment.
|
|
149
|
+
|
|
150
|
+
### 1. Claude Code
|
|
151
|
+
Crewd generates `.claude/agents/<name>.md` subagents and `.claude/skills/<skill>/SKILL.md`:
|
|
152
|
+
- **Direct invocation:** `/agent <name> "Review changes in src/ against main"`
|
|
153
|
+
- **Natural language:** `"Delegate this diff review to our code-reviewer agent."`
|
|
154
|
+
- **Tool safety:** Safe enforcement of `tools.allow` and `tools.deny` restrictions.
|
|
155
|
+
- **Durable memory:** Claude checks and appends learnings to `.crewd/memory/<name>.md`.
|
|
156
|
+
|
|
157
|
+
### 2. Cursor
|
|
158
|
+
Crewd compiles rules to `.cursor/rules/crewd-<name>.mdc`:
|
|
159
|
+
- **In Chat (`Cmd+L`) / Composer (`Cmd+I`):** `@crewd-<name> please audit this file for security issues.`
|
|
160
|
+
- **Auto-context:** Rules activate automatically when opening files matching configured globs.
|
|
161
|
+
- **Skills:** Mention skills directly, e.g. `@crewd-skill-owasp-top10`.
|
|
162
|
+
|
|
163
|
+
### 3. Gemini CLI & Antigravity IDE
|
|
164
|
+
Crewd injects marker-delimited blocks into `GEMINI.md`:
|
|
165
|
+
- **Direct prompt:** `"As our code-reviewer, inspect git diff and provide blocking/should-fix feedback."`
|
|
166
|
+
- **Skills:** Loaded on demand from `.gemini/skills/<skill>/SKILL.md`.
|
|
167
|
+
- **Preserved content:** User custom rules outside `<!-- crewd:begin ... -->` markers are untouched.
|
|
168
|
+
|
|
169
|
+
### 4. Durable Agent Memory
|
|
170
|
+
- Each agent maintains persistent repository learnings in `.crewd/memory/<name>.md`.
|
|
171
|
+
- Memory is upgrade-safe: running `crewd promote` updates prompts without wiping project memories.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
[MIT](LICENSE) © Crewd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist-mcp/cli.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const server_js_1 = require("./server.js");
|
|
5
|
+
(0, server_js_1.startStdioServer)().catch((err) => {
|
|
6
|
+
console.error("Crewd MCP server error:", err);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AACA,2CAA+C;AAE/C,IAAA,4BAAgB,GAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC/B,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;IAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HostId } from "../types.js";
|
|
2
|
+
import { PackageFile } from "./tar.js";
|
|
3
|
+
export interface GeneratedFile {
|
|
4
|
+
path: string;
|
|
5
|
+
content: string | Buffer;
|
|
6
|
+
}
|
|
7
|
+
export declare const MEMORY_INSTRUCTION_PROMPT = "\n### Memory & Local Learnings\nCheck and update project-specific memory in `%s` if you learn reusable repository patterns or rules.";
|
|
8
|
+
export declare function parsePackageManifestFromFiles(files: Map<string, PackageFile>): Record<string, unknown> | null;
|
|
9
|
+
/**
|
|
10
|
+
* Renders Claude Code native files (.claude/agents/<name>.md and .claude/skills/<name>/SKILL.md)
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderClaude(pkgName: string, version: string, manifest: Record<string, unknown>, files: Map<string, PackageFile>): GeneratedFile[];
|
|
13
|
+
/**
|
|
14
|
+
* Renders Cursor native files (.cursor/rules/crewd-<name>.mdc)
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderCursor(pkgName: string, version: string, manifest: Record<string, unknown>, files: Map<string, PackageFile>): GeneratedFile[];
|
|
17
|
+
/**
|
|
18
|
+
* Renders Gemini CLI native files (GEMINI.md marker delimited block, .gemini/skills/)
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderGemini(pkgName: string, version: string, manifest: Record<string, unknown>, files: Map<string, PackageFile>, repoRoot: string): GeneratedFile[];
|
|
21
|
+
/**
|
|
22
|
+
* Compiles files across all selected host environments and returns generated files.
|
|
23
|
+
*/
|
|
24
|
+
export declare function compilePackageFiles(pkgName: string, version: string, manifest: Record<string, unknown>, files: Map<string, PackageFile>, hosts: HostId[], repoRoot: string): GeneratedFile[];
|
|
25
|
+
/**
|
|
26
|
+
* Updates .gitignore with marker blocks for active hosts.
|
|
27
|
+
*/
|
|
28
|
+
export declare function updateGitignoreBlocks(repoRoot: string, hosts: HostId[]): void;
|
|
29
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/core/adapters.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAWD,eAAO,MAAM,yBAAyB,yIAEiE,CAAC;AAWxG,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAoB7G;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAC9B,aAAa,EAAE,CAiEjB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAC9B,aAAa,EAAE,CA8CjB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAC/B,QAAQ,EAAE,MAAM,GACf,aAAa,EAAE,CA8EjB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAC/B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,MAAM,GACf,aAAa,EAAE,CA8BjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAsC7E"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MEMORY_INSTRUCTION_PROMPT = void 0;
|
|
7
|
+
exports.parsePackageManifestFromFiles = parsePackageManifestFromFiles;
|
|
8
|
+
exports.renderClaude = renderClaude;
|
|
9
|
+
exports.renderCursor = renderCursor;
|
|
10
|
+
exports.renderGemini = renderGemini;
|
|
11
|
+
exports.compilePackageFiles = compilePackageFiles;
|
|
12
|
+
exports.updateGitignoreBlocks = updateGitignoreBlocks;
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
|
+
const yaml_1 = __importDefault(require("yaml"));
|
|
16
|
+
const TOOL_MAP = {
|
|
17
|
+
read: "Read",
|
|
18
|
+
grep: "Grep",
|
|
19
|
+
glob: "Glob",
|
|
20
|
+
bash: "Bash",
|
|
21
|
+
edit: "Edit",
|
|
22
|
+
write: "Write",
|
|
23
|
+
};
|
|
24
|
+
exports.MEMORY_INSTRUCTION_PROMPT = `
|
|
25
|
+
### Memory & Local Learnings
|
|
26
|
+
Check and update project-specific memory in \`%s\` if you learn reusable repository patterns or rules.`;
|
|
27
|
+
function generatedHeader(pkgName, version) {
|
|
28
|
+
return `<!-- Generated by crewd ${pkgName}@${version} - DO NOT EDIT -->`;
|
|
29
|
+
}
|
|
30
|
+
function cleanPackageName(pkgName) {
|
|
31
|
+
const parts = pkgName.split("/");
|
|
32
|
+
return parts[parts.length - 1].replace(/^@/, "");
|
|
33
|
+
}
|
|
34
|
+
function parsePackageManifestFromFiles(files) {
|
|
35
|
+
const agentYaml = files.get("agent.yaml");
|
|
36
|
+
if (agentYaml) {
|
|
37
|
+
try {
|
|
38
|
+
return yaml_1.default.parse(agentYaml.content.toString("utf-8"));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const skillYaml = files.get("skill.yaml");
|
|
45
|
+
if (skillYaml) {
|
|
46
|
+
try {
|
|
47
|
+
return yaml_1.default.parse(skillYaml.content.toString("utf-8"));
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Renders Claude Code native files (.claude/agents/<name>.md and .claude/skills/<name>/SKILL.md)
|
|
57
|
+
*/
|
|
58
|
+
function renderClaude(pkgName, version, manifest, files) {
|
|
59
|
+
const cleanName = cleanPackageName(pkgName);
|
|
60
|
+
const pkgType = manifest.type || "agent";
|
|
61
|
+
const results = [];
|
|
62
|
+
if (pkgType === "agent") {
|
|
63
|
+
const promptRel = manifest.prompt || "PROMPT.md";
|
|
64
|
+
const promptFile = files.get(promptRel);
|
|
65
|
+
const promptText = promptFile ? promptFile.content.toString("utf-8") : "";
|
|
66
|
+
const role = manifest.role || {};
|
|
67
|
+
const toolsConfig = manifest.tools || {};
|
|
68
|
+
const allowTools = toolsConfig.allow || [];
|
|
69
|
+
const mappedTools = allowTools.map((t) => TOOL_MAP[t.toLowerCase()] || t);
|
|
70
|
+
const skills = manifest.skills || [];
|
|
71
|
+
const skillNames = skills.map((s) => cleanPackageName(s));
|
|
72
|
+
const frontmatterObj = {
|
|
73
|
+
name: cleanName,
|
|
74
|
+
description: role.when || manifest.description || "",
|
|
75
|
+
};
|
|
76
|
+
if (mappedTools.length > 0)
|
|
77
|
+
frontmatterObj.tools = mappedTools;
|
|
78
|
+
if (skillNames.length > 0)
|
|
79
|
+
frontmatterObj.skills = skillNames;
|
|
80
|
+
// Check claude-code override for model
|
|
81
|
+
const overrides = manifest.overrides || {};
|
|
82
|
+
const claudeOverride = overrides["claude-code"] || {};
|
|
83
|
+
const fmOverride = claudeOverride["frontmatter"] || {};
|
|
84
|
+
if (typeof fmOverride["model"] === "string") {
|
|
85
|
+
frontmatterObj.model = fmOverride["model"];
|
|
86
|
+
}
|
|
87
|
+
const fmYaml = yaml_1.default.stringify(frontmatterObj).trim();
|
|
88
|
+
const memPath = `.crewd/memory/${cleanName}.md`;
|
|
89
|
+
const memBlock = exports.MEMORY_INSTRUCTION_PROMPT.replace("%s", memPath);
|
|
90
|
+
const fullContent = `---\n${fmYaml}\n---\n${generatedHeader(pkgName, version)}\n\n${promptText}\n${memBlock}\n`;
|
|
91
|
+
results.push({
|
|
92
|
+
path: node_path_1.default.join(".claude", "agents", `${cleanName}.md`),
|
|
93
|
+
content: fullContent,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else if (pkgType === "skill") {
|
|
97
|
+
const entryRel = manifest.entry || "SKILL.md";
|
|
98
|
+
const entryFile = files.get(entryRel);
|
|
99
|
+
const entryText = entryFile ? entryFile.content.toString("utf-8") : "";
|
|
100
|
+
results.push({
|
|
101
|
+
path: node_path_1.default.join(".claude", "skills", cleanName, "SKILL.md"),
|
|
102
|
+
content: `${generatedHeader(pkgName, version)}\n\n${entryText}`,
|
|
103
|
+
});
|
|
104
|
+
const fileList = manifest.files || [];
|
|
105
|
+
for (const f of fileList) {
|
|
106
|
+
const fileData = files.get(f);
|
|
107
|
+
if (fileData) {
|
|
108
|
+
results.push({
|
|
109
|
+
path: node_path_1.default.join(".claude", "skills", cleanName, f),
|
|
110
|
+
content: fileData.content,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return results;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Renders Cursor native files (.cursor/rules/crewd-<name>.mdc)
|
|
119
|
+
*/
|
|
120
|
+
function renderCursor(pkgName, version, manifest, files) {
|
|
121
|
+
const cleanName = cleanPackageName(pkgName);
|
|
122
|
+
const pkgType = manifest.type || "agent";
|
|
123
|
+
const results = [];
|
|
124
|
+
if (pkgType === "agent") {
|
|
125
|
+
const promptRel = manifest.prompt || "PROMPT.md";
|
|
126
|
+
const promptFile = files.get(promptRel);
|
|
127
|
+
const promptText = promptFile ? promptFile.content.toString("utf-8") : "";
|
|
128
|
+
const role = manifest.role || {};
|
|
129
|
+
const description = role.when || manifest.description || "";
|
|
130
|
+
const memPath = `.crewd/memory/${cleanName}.md`;
|
|
131
|
+
const memBlock = exports.MEMORY_INSTRUCTION_PROMPT.replace("%s", memPath);
|
|
132
|
+
const frontmatter = `---
|
|
133
|
+
description: ${JSON.stringify(description)}
|
|
134
|
+
globs: ["**/*"]
|
|
135
|
+
alwaysApply: false
|
|
136
|
+
---`;
|
|
137
|
+
const fullContent = `${frontmatter}\n${generatedHeader(pkgName, version)}\n\n${promptText}\n${memBlock}\n`;
|
|
138
|
+
results.push({
|
|
139
|
+
path: node_path_1.default.join(".cursor", "rules", `crewd-${cleanName}.mdc`),
|
|
140
|
+
content: fullContent,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else if (pkgType === "skill") {
|
|
144
|
+
const entryRel = manifest.entry || "SKILL.md";
|
|
145
|
+
const entryFile = files.get(entryRel);
|
|
146
|
+
const entryText = entryFile ? entryFile.content.toString("utf-8") : "";
|
|
147
|
+
const description = manifest.description || "";
|
|
148
|
+
const frontmatter = `---
|
|
149
|
+
description: ${JSON.stringify(description)}
|
|
150
|
+
globs: ["**/*"]
|
|
151
|
+
alwaysApply: false
|
|
152
|
+
---`;
|
|
153
|
+
results.push({
|
|
154
|
+
path: node_path_1.default.join(".cursor", "rules", `crewd-skill-${cleanName}.mdc`),
|
|
155
|
+
content: `${frontmatter}\n${generatedHeader(pkgName, version)}\n\n${entryText}\n`,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return results;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Renders Gemini CLI native files (GEMINI.md marker delimited block, .gemini/skills/)
|
|
162
|
+
*/
|
|
163
|
+
function renderGemini(pkgName, version, manifest, files, repoRoot) {
|
|
164
|
+
const cleanName = cleanPackageName(pkgName);
|
|
165
|
+
const pkgType = manifest.type || "agent";
|
|
166
|
+
const results = [];
|
|
167
|
+
if (pkgType === "agent") {
|
|
168
|
+
const promptRel = manifest.prompt || "PROMPT.md";
|
|
169
|
+
const promptFile = files.get(promptRel);
|
|
170
|
+
const promptText = promptFile ? promptFile.content.toString("utf-8") : "";
|
|
171
|
+
const role = manifest.role || {};
|
|
172
|
+
const title = role.title || cleanName;
|
|
173
|
+
const when = role.when || manifest.description || "";
|
|
174
|
+
const memPath = `.crewd/memory/${cleanName}.md`;
|
|
175
|
+
const memBlock = exports.MEMORY_INSTRUCTION_PROMPT.replace("%s", memPath);
|
|
176
|
+
const beginMarker = `<!-- crewd:begin ${cleanName} -->`;
|
|
177
|
+
const endMarker = `<!-- crewd:end ${cleanName} -->`;
|
|
178
|
+
const sectionBody = `${beginMarker}
|
|
179
|
+
### Agent: ${title} (${pkgName}@${version})
|
|
180
|
+
> ${when}
|
|
181
|
+
|
|
182
|
+
${promptText}
|
|
183
|
+
${memBlock}
|
|
184
|
+
${endMarker}`;
|
|
185
|
+
// Read existing GEMINI.md if present
|
|
186
|
+
const geminiMdPath = node_path_1.default.join(repoRoot, "GEMINI.md");
|
|
187
|
+
let existingContent = "";
|
|
188
|
+
if (node_fs_1.default.existsSync(geminiMdPath)) {
|
|
189
|
+
try {
|
|
190
|
+
existingContent = node_fs_1.default.readFileSync(geminiMdPath, "utf-8");
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
existingContent = "";
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
let updatedContent = "";
|
|
197
|
+
if (existingContent.includes(beginMarker) && existingContent.includes(endMarker)) {
|
|
198
|
+
const startIndex = existingContent.indexOf(beginMarker);
|
|
199
|
+
const endIndex = existingContent.indexOf(endMarker) + endMarker.length;
|
|
200
|
+
updatedContent = existingContent.substring(0, startIndex) + sectionBody + existingContent.substring(endIndex);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
if (existingContent && !existingContent.endsWith("\n")) {
|
|
204
|
+
existingContent += "\n";
|
|
205
|
+
}
|
|
206
|
+
updatedContent = existingContent ? `${existingContent}\n${sectionBody}\n` : `${sectionBody}\n`;
|
|
207
|
+
}
|
|
208
|
+
results.push({
|
|
209
|
+
path: "GEMINI.md",
|
|
210
|
+
content: updatedContent,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
else if (pkgType === "skill") {
|
|
214
|
+
const entryRel = manifest.entry || "SKILL.md";
|
|
215
|
+
const entryFile = files.get(entryRel);
|
|
216
|
+
const entryText = entryFile ? entryFile.content.toString("utf-8") : "";
|
|
217
|
+
results.push({
|
|
218
|
+
path: node_path_1.default.join(".gemini", "skills", cleanName, "SKILL.md"),
|
|
219
|
+
content: `${generatedHeader(pkgName, version)}\n\n${entryText}`,
|
|
220
|
+
});
|
|
221
|
+
const fileList = manifest.files || [];
|
|
222
|
+
for (const f of fileList) {
|
|
223
|
+
const fileData = files.get(f);
|
|
224
|
+
if (fileData) {
|
|
225
|
+
results.push({
|
|
226
|
+
path: node_path_1.default.join(".gemini", "skills", cleanName, f),
|
|
227
|
+
content: fileData.content,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return results;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Compiles files across all selected host environments and returns generated files.
|
|
236
|
+
*/
|
|
237
|
+
function compilePackageFiles(pkgName, version, manifest, files, hosts, repoRoot) {
|
|
238
|
+
const generated = [];
|
|
239
|
+
for (const host of hosts) {
|
|
240
|
+
if (host === "claude-code") {
|
|
241
|
+
generated.push(...renderClaude(pkgName, version, manifest, files));
|
|
242
|
+
}
|
|
243
|
+
else if (host === "cursor") {
|
|
244
|
+
generated.push(...renderCursor(pkgName, version, manifest, files));
|
|
245
|
+
}
|
|
246
|
+
else if (host === "gemini-cli") {
|
|
247
|
+
generated.push(...renderGemini(pkgName, version, manifest, files, repoRoot));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// Memory file for agents
|
|
251
|
+
const pkgType = manifest.type || "agent";
|
|
252
|
+
if (pkgType === "agent") {
|
|
253
|
+
const cleanName = cleanPackageName(pkgName);
|
|
254
|
+
const memRelPath = node_path_1.default.join(".crewd", "memory", `${cleanName}.md`);
|
|
255
|
+
const fullMemPath = node_path_1.default.join(repoRoot, memRelPath);
|
|
256
|
+
if (!node_fs_1.default.existsSync(fullMemPath)) {
|
|
257
|
+
const memScaffold = `# Agent Memory: ${cleanName}\n\nLocal repository learnings and rules for ${pkgName}.\n`;
|
|
258
|
+
generated.push({
|
|
259
|
+
path: memRelPath,
|
|
260
|
+
content: memScaffold,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return generated;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Updates .gitignore with marker blocks for active hosts.
|
|
268
|
+
*/
|
|
269
|
+
function updateGitignoreBlocks(repoRoot, hosts) {
|
|
270
|
+
const gitignorePath = node_path_1.default.join(repoRoot, ".gitignore");
|
|
271
|
+
let content = "";
|
|
272
|
+
if (node_fs_1.default.existsSync(gitignorePath)) {
|
|
273
|
+
try {
|
|
274
|
+
content = node_fs_1.default.readFileSync(gitignorePath, "utf-8");
|
|
275
|
+
}
|
|
276
|
+
catch {
|
|
277
|
+
content = "";
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const hostIgnores = {
|
|
281
|
+
"claude-code": [".claude/agents/", ".claude/skills/"],
|
|
282
|
+
cursor: [".cursor/rules/crewd-*"],
|
|
283
|
+
"gemini-cli": [".gemini/skills/"],
|
|
284
|
+
};
|
|
285
|
+
for (const host of hosts) {
|
|
286
|
+
const patterns = hostIgnores[host] || [];
|
|
287
|
+
if (patterns.length === 0)
|
|
288
|
+
continue;
|
|
289
|
+
const beginMarker = `<!-- crewd:begin ${host} -->`;
|
|
290
|
+
const endMarker = `<!-- crewd:end ${host} -->`;
|
|
291
|
+
const block = `${beginMarker}\n${patterns.join("\n")}\n${endMarker}`;
|
|
292
|
+
if (content.includes(beginMarker) && content.includes(endMarker)) {
|
|
293
|
+
const start = content.indexOf(beginMarker);
|
|
294
|
+
const end = content.indexOf(endMarker) + endMarker.length;
|
|
295
|
+
content = content.substring(0, start) + block + content.substring(end);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
if (content && !content.endsWith("\n")) {
|
|
299
|
+
content += "\n";
|
|
300
|
+
}
|
|
301
|
+
content += `\n${block}\n`;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
node_fs_1.default.writeFileSync(gitignorePath, content, "utf-8");
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=adapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/core/adapters.ts"],"names":[],"mappings":";;;;;;AAiCA,sEAoBC;AAKD,oCAsEC;AAKD,oCAmDC;AAKD,oCAoFC;AAKD,kDAqCC;AAKD,sDAsCC;AAtWD,0DAA6B;AAC7B,sDAAyB;AACzB,gDAAwB;AASxB,MAAM,QAAQ,GAA2B;IACvC,IAAI,EAAE,MAAM;IACZ,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,IAAI,CAAC,EAAE,CAAC;gBACvC,OAAO,IAAI,IAAI,CAAC;YAClB,CAAC;YACD,OAAO,IAAI,KAAK,KAAK,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,iBAAE,CAAC,aAAa,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RegistryClient } from "./registry.js";
|
|
2
|
+
import { HostId, TargetHost } from "../types.js";
|
|
3
|
+
export interface PlanHireResult {
|
|
4
|
+
packageName: string;
|
|
5
|
+
requestedVersion: string;
|
|
6
|
+
resolvedVersion: string;
|
|
7
|
+
packageType: string;
|
|
8
|
+
targetHosts: HostId[];
|
|
9
|
+
plannedFiles: Array<{
|
|
10
|
+
path: string;
|
|
11
|
+
action: "create" | "update";
|
|
12
|
+
sha256: string;
|
|
13
|
+
}>;
|
|
14
|
+
flaggedScripts: Array<{
|
|
15
|
+
path: string;
|
|
16
|
+
warning: string;
|
|
17
|
+
preview?: string;
|
|
18
|
+
}>;
|
|
19
|
+
confirmToken: string;
|
|
20
|
+
expiresAt: string;
|
|
21
|
+
summary: string;
|
|
22
|
+
}
|
|
23
|
+
export interface HireResult {
|
|
24
|
+
packageName: string;
|
|
25
|
+
version: string;
|
|
26
|
+
installedFiles: string[];
|
|
27
|
+
manifestUpdated: boolean;
|
|
28
|
+
lockfileUpdated: boolean;
|
|
29
|
+
summary: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Plans a hire operation without writing anything to disk.
|
|
33
|
+
* Downloads tarball, verifies SHA-256 integrity, renders templates in memory,
|
|
34
|
+
* flags any executable scripts, and issues a short-lived confirm_token.
|
|
35
|
+
*/
|
|
36
|
+
export declare function planHire(packageRef: string, targetHosts?: TargetHost[], client?: RegistryClient, customRoot?: string): Promise<PlanHireResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Performs actual hire using a verified single-use confirm_token.
|
|
39
|
+
* Enforces security checks: valid token, directory safety, hash verification, file-only script installation.
|
|
40
|
+
*/
|
|
41
|
+
export declare function executeHire(packageRef: string, confirmToken: string, version?: string, targetHosts?: TargetHost[], client?: RegistryClient, customRoot?: string): Promise<HireResult>;
|
|
42
|
+
//# sourceMappingURL=installer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../src/core/installer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA0C,MAAM,eAAe,CAAC;AAIvF,OAAO,EAAE,MAAM,EAAE,UAAU,EAA2D,MAAM,aAAa,CAAC;AAE1G,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,KAAK,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;QAC5B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH,cAAc,EAAE,KAAK,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD;;;;GAIG;AACH,wBAAsB,QAAQ,CA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