libaipm 0.18.2

Core library for AIPM — manifest parser, resolver, store, lockfile
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# AIPM — AI Plugin Manager

[![CI](https://github.com/TheLarkInn/aipm/actions/workflows/ci.yml/badge.svg)](https://github.com/TheLarkInn/aipm/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/TheLarkInn/aipm/graph/badge.svg)](https://codecov.io/gh/TheLarkInn/aipm)

A production-grade package manager for AI plugin primitives (skills, agents, MCP servers, hooks). Think npm/Cargo, but purpose-built for the AI plugin ecosystem.

AIPM ships as **two Rust binaries** with **zero runtime dependencies**:

| Binary | Role | Commands |
|--------|------|----------|
| **`aipm`** | Consumer CLI | `init`, `install`, `update`, `link`, `unlink`, `list`, `lint`, `migrate` |
| **`aipm-pack`** | Author CLI | `init` |

Both work across .NET, Python, Node.js, and Rust projects with no runtime dependency.

## Install

### Shell (Linux / macOS)

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/thelarkinn/aipm/releases/latest/download/aipm-installer.sh | sh
```

### PowerShell (Windows)

```powershell
powershell -ExecutionPolicy Bypass -c "irm https://github.com/thelarkinn/aipm/releases/latest/download/aipm-installer.ps1 | iex"
```

> Installers are provided by [cargo-dist]https://opensource.axo.dev/cargo-dist/. Run `aipm-update` to self-update.

### Build from Source

```bash
cargo build --workspace          # build all crates
cargo test --workspace           # run all tests
```

---

## `aipm` — Consumer CLI

Manages AI plugin workspaces: scaffolding, installing plugins from multiple sources, migrating existing configurations, and linting for quality issues.

### Global Flags

| Flag | Description |
|------|-------------|
| `-v, --verbose` | Increase verbosity (`-v` info, `-vv` debug, `-vvv` trace); default level is warn |
| `--log-format <FMT>` | Tracing output format on stderr: `text` (default) or `json` |

### `aipm init`

Scaffold a workspace with a `.ai/` local marketplace and tool-specific settings.

```
aipm init [OPTIONS] [DIR]
```

| Flag | Description |
|------|-------------|
| `-y, --yes` | Skip interactive prompts, use defaults |
| `--workspace` | Generate a workspace-level `aipm.toml` with `[workspace]` section |
| `--marketplace` | Create `.ai/` marketplace directory with tool settings |
| `--no-starter` | Skip the starter plugin (bare `.ai/` directory only) |
| `--manifest` | Generate `aipm.toml` manifests for each plugin (opt-in) |
| `--name <NAME>` | Custom marketplace name (default: `local-repo-plugins`) |

When run on a TTY without `--yes`, launches an interactive wizard.

**What it creates:**
- `.ai/<marketplace-name>/` — local marketplace directory
- `.ai/<marketplace-name>/starter-aipm-plugin/` — starter skill plugin (unless `--no-starter`)
- `.ai/.claude/settings.json` — Claude Code marketplace registration
- `.ai/.copilot/` — Copilot agent settings (if detected)
- `aipm.toml` — workspace manifest (with `--workspace`)

### `aipm migrate`

Migrate existing `.claude/` configurations into marketplace plugins. Detects skills, agents, MCP servers, hooks, commands, and output styles.

```
aipm migrate [OPTIONS] [DIR]
```

| Flag | Description |
|------|-------------|
| `--dry-run` | Preview migration without writing files (generates report) |
| `--destructive` | Remove migrated source files after successful migration (interactive prompt if omitted on TTY) |
| `--source <SRC>` | Source folder to scan (e.g., `.claude`). Omit to discover recursively |
| `--max-depth <N>` | Maximum depth for recursive discovery |
| `--manifest` | Generate `aipm.toml` manifests for migrated plugins |

**Detected artifact types:** skills (`SKILL.md`), agents (`*.md` in `agents/`), MCP servers (`.mcp.json`), hooks (`hooks.json`), commands (`commands/*.md`), output styles.

### `aipm install`

Install a plugin from the registry, a git repository, a GitHub shorthand, a local path, or a marketplace.

```
aipm install [OPTIONS] [PACKAGE]
```

| Flag | Description |
|------|-------------|
| `--locked` | CI mode: fail if lockfile doesn't match manifest |
| `--registry <REG>` | Use a specific registry |
| `--global` | Install globally (available to all projects) |
| `--engine <ENGINE>` | Restrict a global install to a specific engine (e.g., `claude`, `copilot`) |
| `--plugin-cache <POLICY>` | Download cache policy: `auto` (default), `cache-only`, `skip`, `force-refresh`, `no-refresh` |
| `--dir <DIR>` | Project directory (default: `.`) |

**Package spec formats:**

| Format | Example | Description |
|--------|---------|-------------|
| Registry name | `code-review@^1.0` | Semver range from the default registry |
| `github:` | `github:org/repo:plugin@main` | GitHub repo shorthand |
| `git:` | `git:https://example.com/repo.git:plugin@v1` | Arbitrary git URL |
| `local:` | `local:./path/to/plugin` | Local filesystem path |
| `marketplace:` | `marketplace:my-market:plugin-name` | Named marketplace |

Omit `PACKAGE` to install all dependencies from `aipm.toml`.

**Global installs** write to `~/.aipm/registry/` and are available across all projects. Use `--engine` to scope a plugin to a specific AI tool.

See also: [`docs/guides/global-plugins.md`](docs/guides/global-plugins.md), [`docs/guides/install-git-plugin.md`](docs/guides/install-git-plugin.md), [`docs/guides/cache-management.md`](docs/guides/cache-management.md).

### `aipm update`

Update packages to their latest compatible versions.

```
aipm update [OPTIONS] [PACKAGE]
```

| Flag | Description |
|------|-------------|
| `--dir <DIR>` | Project directory (default: `.`) |

Omit `PACKAGE` to update all dependencies. Unlike `install`, `update` resolves the latest version within the declared version range and rewrites the lockfile.

### `aipm uninstall`

Remove an installed plugin from the project or the global registry.

```
aipm uninstall [OPTIONS] <PACKAGE>
```

| Flag | Description |
|------|-------------|
| `--global` | Remove from the global registry |
| `--engine <ENGINE>` | Remove from a specific engine only (global installs) |
| `--dir <DIR>` | Project directory (default: `.`; ignored with `--global`) |

### `aipm link`

Link a local plugin directory for development, overriding the registry version.

```
aipm link [OPTIONS] <PATH>
```

| Flag | Description |
|------|-------------|
| `--dir <DIR>` | Project directory (default: `.`) |

The plugin at `PATH` shadows the installed version until unlinked. Changes to the local directory are reflected immediately without reinstalling.

### `aipm unlink`

Remove a development link override and restore the registry version.

```
aipm unlink [OPTIONS] <PACKAGE>
```

| Flag | Description |
|------|-------------|
| `--dir <DIR>` | Project directory (default: `.`) |

### `aipm list`

Show installed plugins or active development link overrides.

```
aipm list [OPTIONS]
```

| Flag | Description |
|------|-------------|
| `--linked` | Show only active dev link overrides |
| `--global` | Show globally installed plugins |
| `--dir <DIR>` | Project directory (default: `.`) |

### `aipm lint`

Check AI plugin configurations for quality issues across all detected source directories.

```
aipm lint [OPTIONS] [DIR]
```

| Flag | Description |
|------|-------------|
| `--source <SRC>` | Limit to a specific source type (`.claude`, `.github`, `.ai`) |
| `--reporter <FMT>` | Output format: `human` (default), `json`, `ci-github`, `ci-azure` |
| `--color <MODE>` | Color output: `auto` (default), `always`, `never` |
| `--max-depth <N>` | Maximum directory traversal depth |

Exits with a non-zero status code when violations are found, making it safe to use in CI pipelines. Use `--reporter ci-github` for GitHub Actions annotations or `--reporter ci-azure` for Azure Pipelines.

---

## `aipm-pack` — Author CLI

Scaffolds new plugin packages for publishing.

### `aipm-pack init`

Create a new AI plugin package with manifest and conventional directory layout.

```
aipm-pack init [OPTIONS] [DIR]
```

| Flag | Description |
|------|-------------|
| `-y, --yes` | Skip interactive prompts |
| `--name <NAME>` | Package name (defaults to directory name) |
| `--type <TYPE>` | Plugin type: `skill`, `agent`, `mcp`, `hook`, `lsp`, `composite` |

Generates an `aipm.toml` manifest and type-appropriate directory structure.

---

## `libaipm` — Core Library

Shared library powering both CLIs. All logic lives here; the binaries are thin wrappers.

### Modules

| Module | Purpose |
|--------|---------|
| `manifest` | Parse, validate, and load `aipm.toml` manifests |
| `manifest::types` | Schema types: `Manifest`, `Package`, `Workspace`, `Components`, `Environment`, `DependencySpec` |
| `manifest::validate` | Name format, semver, dependency version, component path validation |
| `init` | Plugin package scaffolding (`aipm-pack init`) |
| `workspace_init` | Workspace + `.ai/` marketplace scaffolding (`aipm init`) |
| `workspace_init::adaptors` | Tool-specific config writers (Claude Code; Copilot/Cursor planned) |
| `workspace` | Workspace root discovery and `[workspace].members` glob expansion |
| `migrate` | Tool config migration with recursive discovery, dry-run, and all artifact types |
| `lint` | Quality linting for AI plugin configurations, diagnostics, and reporting |
| `discovery` | Gitignore-aware recursive discovery of AI tool source directories (shared by `lint` and `migrate`) |
| `installer` | Package installation pipeline and manifest editing |
| `linker` | Local dev link overrides (`aipm link` / `unlink`) |
| `lockfile` | Deterministic `aipm.lock` creation and drift detection |
| `resolver` | Semver dependency resolution |
| `store` | Content-addressable global package store |
| `registry` | Registry client interface |
| `spec` | Plugin spec parser (`name@version`, `github:`, `git:`, `local:`, `marketplace:` formats) |
| `acquirer` | Local copy and git clone acquisition with source redirect support |
| `cache` | Download cache with 5 policies and per-entry TTL (`~/.aipm/cache/`) |
| `installed` | Global plugin registry with engine scoping and name conflict detection |
| `marketplace` | TOML marketplace manifest parsing (relative, git, and unsupported source types) |
| `engine` | Two-tier engine validation (`aipm.toml` `engines` field + marker file fallback) |
| `platform` | Runtime OS and architecture detection and compatibility checking |
| `path_security` | `ValidatedPath` — rejects traversal, URL-encoded, and absolute paths |
| `locked_file` | OS-level exclusive file locking for cache and registry writes |
| `security` | Configurable source allowlist with CI enforcement |
| `logging` | Layered `tracing` subscriber initialization (stderr verbosity + rotating file log) |
| `frontmatter` | YAML front-matter parsing for plugin files |
| `fs` | Trait-based filesystem abstraction (`Real` + test mocking) |
| `version` | Crate version constant |

### Manifest Format (`aipm.toml`)

```toml
[package]
name = "@company/ci-tools"
version = "1.2.3"
description = "CI automation skills"
type = "composite"
files = ["skills/", "hooks/", "README.md"]
engines = ["claude", "copilot"]   # optional — omit to support all engines

[package.source]                  # optional — marketplace stub redirect
type = "git"
url = "https://github.com/org/repo"
path = "plugins/ci-tools"

[dependencies]
shared-lint = "^1.0"
core-hooks = { workspace = "*" }
heavy-analyzer = { version = "^1.0", optional = true }
# Source dependency formats:
ui-toolkit   = { github = "org/repo", path = "plugins/ui", ref = "main" }
local-helper = { path = "../local-helper" }
my-market-dep = { marketplace = "my-registry", name = "dep-name", ref = "v2" }

[features]
default = ["basic"]
basic = []
deep = ["dep:heavy-analyzer"]

[components]
skills = ["skills/lint/SKILL.md"]
agents = ["agents/reviewer.md"]
hooks = ["hooks/hooks.json"]
mcp_servers = [".mcp.json"]
lsp_servers = [".lsp.json"]
scripts = ["scripts/format-code.sh"]
output_styles = ["styles/custom.css"]
settings = ["settings.json"]

[environment]
requires = ["git", "docker"]
aipm = ">=0.5.0"
platforms = ["linux-x64", "macos-arm64", "windows-x64"]
strict = true

[environment.runtime]
node = ">=18.0.0"

[install]
allowed_build_scripts = ["native-tool"]
```

**Plugin types:** `skill` · `agent` · `mcp` · `hook` · `lsp` · `composite`

### Workspace Root Manifest

```toml
[workspace]
members = ["plugins/*"]
plugins_dir = "plugins"

[workspace.dependencies]
common-skill = "^2.0"

[overrides]
"vulnerable-lib" = "^2.0.0"

[catalog]
lint-skill = "^1.5.0"

[catalogs.stable]
framework = "^1.0.0"

[catalogs.next]
framework = "^2.0.0-beta.1"
```

---

## Project Structure

```
crates/
  aipm/         Consumer CLI binary (init, install, update, link, unlink, list, lint, migrate)
  aipm-pack/    Author CLI binary (init)
  libaipm/      Core library (manifest, validation, migration, scaffolding, lint, install, link, resolve)
specs/          Technical design documents
tests/features/ Cucumber BDD feature files (31 files, 300+ scenarios)
research/       Competitive analysis and design research
```

---

## Roadmap

The following features are defined as BDD scenarios and tracked as open issues. They represent the full planned scope beyond what is currently implemented.

### Dependencies

- **Resolution** — semver solver with backtracking, version unification, conflict reporting, overrides ([#1]https://github.com/TheLarkInn/aipm/issues/1)
- **Lockfile** — deterministic `aipm.lock` creation, drift detection, `--locked` CI mode ([#2]https://github.com/TheLarkInn/aipm/issues/2)
- **Features** — default features, opt-out, additive feature unification across the graph ([#3]https://github.com/TheLarkInn/aipm/issues/3)
- **Patching**`aipm patch` workflow for editing transitive deps without forking ([#4]https://github.com/TheLarkInn/aipm/issues/4)

### Registry

- **Install**`aipm install` with semver resolution, content-addressable store, integrity verification, strict isolation ([#5]https://github.com/TheLarkInn/aipm/issues/5)
- **Publish**`aipm-pack pack` / `publish` with `.aipm` archives, dry-run, file allowlist, size limits ([#6]https://github.com/TheLarkInn/aipm/issues/6)
- **Security** — checksums, tamper detection, `aipm audit`, auth, scoped org permissions ([#7]https://github.com/TheLarkInn/aipm/issues/7)
- **Yank**`aipm-pack yank` / un-yank, deprecation messages ([#8]https://github.com/TheLarkInn/aipm/issues/8)
- **Link**`aipm link` / `unlink` for local dev overrides ([#9]https://github.com/TheLarkInn/aipm/issues/9)
- **Local + Registry Coexistence** — directory links, gitignore management, vendoring ([#10]https://github.com/TheLarkInn/aipm/issues/10)

### Monorepo

- **Orchestration** — workspace protocol, catalogs, filtering by name/path/changed/dependents, Rush/Turborepo integration ([#11]https://github.com/TheLarkInn/aipm/issues/11)

### Environment

- **Dependencies** — declare required tools, env vars, platforms, MCP runtimes; `aipm doctor` ([#12]https://github.com/TheLarkInn/aipm/issues/12)
- **Host Versioning**`[environment.hosts]` section for Claude/Copilot/Cursor version constraints ([#54]https://github.com/TheLarkInn/aipm/issues/54)

### Quality & Portability

- **Guardrails**`aipm lint`, auto-fix, quality scoring on publish ([#13]https://github.com/TheLarkInn/aipm/issues/13)
- **Compositional Reuse** — publish/consume standalone skills, agents, MCP configs, hooks as packages ([#14]https://github.com/TheLarkInn/aipm/issues/14)
- **Cross-Stack** — verified portability across Node.js, .NET, Python, Rust, CMake; offline resolution ([#15]https://github.com/TheLarkInn/aipm/issues/15)

---

## Why not `apm`?

[microsoft/apm](https://github.com/microsoft/apm) (`apm-cli` on PyPI) validates that AI plugin package management is a real problem. However, its architecture falls short for production use across several dimensions:

1. **Runtime dependency.** `apm` requires Python 3.9+ and 13 pip packages. This creates friction for .NET, Rust, Go, and Java teams, and adds version-management overhead. AIPM is a self-contained Rust binary — drop it in any repo regardless of tech stack.

2. **YAML manifest.** `apm.yml` uses YAML, which has the [Norway problem]https://hitchdev.com/strictyaml/why/implicit-typing-removed/ (`3.10``3.1`), implicit type coercion (`NO``false`), indentation sensitivity, and active security CVEs in parsers. AIPM uses TOML — no coercion, no indentation traps, safe for AI-generated manifests.

3. **No registry.** Packages are git repos. There is no publish lifecycle, no immutable versions, no scoped namespaces, no centralized search, and no way to yank a broken release without deleting git tags. AIPM has a dedicated API registry with publish, yank, scoped packages, and multi-registry routing.

4. **No semver resolution.** `apm` pins by git ref — no `^1.0` ranges, no backtracking, no version unification. Two packages depending on different versions of the same dep each get a full clone. AIPM uses Cargo-model semver with caret/tilde ranges, backtracking, and major-version coexistence.

5. **No integrity verification.** The lockfile records commit SHAs but no file-level hashes. Force-pushes or host compromises silently change what a "version" resolves to. AIPM stores SHA-512 checksums per file and verifies on install.

6. **Full git clones per project.** Every project downloads full copies of every dependency — no deduplication, no global cache. AIPM uses a content-addressable global store (pnpm model) with hard links for 70%+ disk savings.

7. **No dependency isolation.** Everything in `apm_modules/` is accessible to everything else. Phantom dependencies go undetected. AIPM enforces strict isolation — only declared dependencies are accessible.

8. **Minimal security.** No lifecycle script blocking (any package runs arbitrary code), no `audit` command, no principle-of-least-privilege binary split. AIPM blocks scripts by default, ships separate consumer/author binaries, and plans advisory-based auditing.

9. **No transfer format.** Packages are raw git repos — no archive format, no file allowlist, no secrets exclusion. AIPM uses deterministic `.aipm` archives (gzip tar) with sorted files, zeroed timestamps, and default secrets exclusion.

10. **No offline support.** Every install requires network access. AIPM supports `--offline` installation from the global cache.

11. **No CI lockfile mode.** `apm install` uses the lockfile if present, but there is no `--locked` mode that fails on drift. AIPM follows the Cargo model: `install` never upgrades, `update` explicitly resolves latest, `--locked` fails on any mismatch.

12. **No workspace features.** No workspace protocol, no catalogs, no dependency inheritance, no filtering. AIPM supports all of these for monorepo-scale plugin management.

13. **Compilation coupling.** `apm` tightly couples package management with `AGENTS.md` / `CLAUDE.md` generation. AIPM decouples packaging from host discovery — AI tools discover plugins naturally via directory scanning.

In short: `apm` is a useful prototype that proves the problem space. AIPM is designed to be the production-grade infrastructure for it.

---

## Contributing

Contributions and suggestions are welcome! Please open an issue or pull request on [GitHub](https://github.com/thelarkinn/aipm).

## License

This project is licensed under the [MIT License](LICENSE).