@playsthisgame/melon 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +239 -0
  2. package/package.json +3 -2
  3. package/postinstall.js +11 -7
package/README.md ADDED
@@ -0,0 +1,239 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/playsthisgame/melon/main/assets/melon-logo.png" alt="melon" width="300" />
3
+ </p>
4
+
5
+ <h1 align="center">melon</h1>
6
+
7
+ <p align="center">
8
+ A dependency manager for agentic markdown — skills, agents, and prompts for your AI tools.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="#installation">Installation</a> ·
13
+ <a href="#quick-start">Quick Start</a> ·
14
+ <a href="#why-melon">Why melon?</a> ·
15
+ <a href="#how-it-works">How it works</a> ·
16
+ <a href="#manifest-reference">Manifest Reference</a> ·
17
+ <a href="#commands">Commands</a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="https://github.com/playsthisgame/melon/actions/workflows/release.yml"><img src="https://github.com/playsthisgame/melon/actions/workflows/release.yml/badge.svg" alt="Release" /></a>
22
+ <a href="https://www.npmjs.com/package/@playsthisgame/melon"><img src="https://img.shields.io/npm/v/@playsthisgame/melon" alt="npm version" /></a>
23
+ <a href="https://pkg.go.dev/github.com/playsthisgame/melon"><img src="https://pkg.go.dev/badge/github.com/playsthisgame/melon.svg" alt="Go Reference" /></a>
24
+ <a href="LICENSE"><img src="https://img.shields.io/github/license/playsthisgame/melon" alt="License" /></a>
25
+ </p>
26
+
27
+ ---
28
+
29
+ ## What is melon?
30
+
31
+ Melon manages markdown-based packages that AI coding assistants read as context. It resolves dependencies from GitHub, fetches them into a local cache, and places them into your agent's expected directory (e.g. `.claude/skills/`) so they are available immediately.
32
+
33
+ ## Installation
34
+
35
+ **📦 Global install**
36
+
37
+ ```sh
38
+ npm install -g @playsthisgame/melon
39
+ ```
40
+
41
+ **🐹 Go**
42
+
43
+ ```sh
44
+ go install github.com/playsthisgame/melon/cmd/mln@latest
45
+ ```
46
+
47
+ Requires Git to be available on your `PATH`.
48
+
49
+ ## Quick Start
50
+
51
+ **1. Initialize a project**
52
+
53
+ ```sh
54
+ mln init
55
+ ```
56
+
57
+ This creates a `melon.yml` manifest and the `.melon/` cache directory. You'll be prompted for a package name, type, and which AI tools you use.
58
+
59
+ **2. Add a dependency**
60
+
61
+ Edit `melon.yml` directly:
62
+
63
+ ```yaml
64
+ dependencies:
65
+ github.com/playsthisgame/skills/agentic-spec-dev: "^1.0.0"
66
+ github.com/anthropics/skills/skills/skill-creator: "main"
67
+ ```
68
+
69
+ Dependency names are GitHub paths. You can use:
70
+ - A full repo: `github.com/owner/repo`
71
+ - A monorepo subdirectory: `github.com/owner/repo/path/to/skill`
72
+ - A GitHub web URL: `github.com/owner/repo/tree/main/path/to/skill` (the `tree/<branch>/` is stripped automatically)
73
+
74
+ Versions can be a semver constraint (`^1.2.0`, `~2.0.0`, `1.0.0`) or a branch name (`"main"`).
75
+
76
+ **3. Install**
77
+
78
+ ```sh
79
+ mln install
80
+ ```
81
+
82
+ Melon resolves each dependency, fetches it via sparse git checkout, writes `melon.lock`, and places skills into your tool directories.
83
+
84
+ ```
85
+ resolving github.com/playsthisgame/skills/agentic-spec-dev (^1.0.0)...
86
+ fetching github.com/playsthisgame/skills/agentic-spec-dev@1.0.0...
87
+ + github.com/playsthisgame/skills/agentic-spec-dev@1.0.0
88
+ linked github.com/playsthisgame/skills/agentic-spec-dev -> .claude/playsthisgame/agentic-spec-dev
89
+ ```
90
+
91
+ ## How it works
92
+
93
+ ```
94
+ melon.yml — declares your dependencies and target AI tools ← commit
95
+ melon.lock — pins exact versions, git tags, and content hashes ← commit
96
+ .melon/ — local cache; one directory per dep@version ← commit
97
+ .claude/skills/ — symlinks into .melon/ created by mln install ← commit
98
+ ```
99
+
100
+ Skills are fetched once into `.melon/` and symlinked into the configured tools directories.
101
+
102
+ ## Manifest Reference
103
+
104
+ ```yaml
105
+ # melon.yml
106
+
107
+ name: my-agent
108
+ version: 0.1.0
109
+
110
+ description: "My coding agent"
111
+
112
+ dependencies:
113
+ github.com/anthropics/skills/skills/skill-creator: "main"
114
+ github.com/playsthisgame/skills/agentic-spec-dev: "^1.0.0"
115
+
116
+ # tool_compat drives where mln install places skills.
117
+ # Melon knows the conventions for each agent automatically:
118
+ # claude-code -> .claude/skills/
119
+ # cursor -> .agents/skills/
120
+ # windsurf -> .windsurf/skills/
121
+ # roo -> .roo/skills/
122
+ # ... (and more)
123
+ tool_compat:
124
+ - claude-code
125
+
126
+ # outputs is optional. Use it to override the automatic placement paths.
127
+ # outputs:
128
+ # .claude/skills/: "*"
129
+
130
+ tags: []
131
+ ```
132
+
133
+ ### Supported AI tools
134
+
135
+ | AI tool | Project skills directory |
136
+ |---|---|
137
+ | `claude-code` | `.claude/skills/` |
138
+ | `cursor` | `.agents/skills/` |
139
+ | `windsurf` | `.windsurf/skills/` |
140
+ | `roo` | `.roo/skills/` |
141
+ | `codex` | `.agents/skills/` |
142
+ | `opencode` | `.agents/skills/` |
143
+ | `gemini-cli` | `.agents/skills/` |
144
+ | `github-copilot` | `.agents/skills/` |
145
+ | `cline` | `.agents/skills/` |
146
+ | `amp` | `.agents/skills/` |
147
+
148
+ ## Commands
149
+
150
+ ### `mln init`
151
+
152
+ Scaffold a new `melon.yml` and create the `.melon/` store directory.
153
+
154
+ ```sh
155
+ mln init
156
+ mln init --yes # accept all defaults (for scripting)
157
+ mln init --dir ./app # initialize in a different directory
158
+ ```
159
+
160
+ ### `mln install`
161
+
162
+ Resolve dependencies, fetch them into `.melon/`, write `melon.lock`, and symlink skills into tool directories.
163
+
164
+ ```sh
165
+ mln install
166
+ mln install --frozen # fail if melon.lock would change (useful in CI)
167
+ mln install --no-place # fetch and lock only — skip placement into agent dirs
168
+ ```
169
+
170
+ ### `mln add`
171
+
172
+ Add a dependency to `melon.yml` and run install. If no version is specified, the latest semver tag is resolved automatically.
173
+
174
+ ```sh
175
+ mln add github.com/playsthisgame/skills/agentic-spec-dev # resolves latest tag → ^1.2.0
176
+ mln add github.com/playsthisgame/skills/agentic-spec-dev@^1.0.0 # explicit constraint
177
+ mln add github.com/playsthisgame/skills/agentic-spec-dev@main # branch pin
178
+ ```
179
+
180
+ ### `mln remove`
181
+
182
+ Remove a dependency from `melon.yml`, unlink its agent symlinks, and delete its `.melon/` cache entry.
183
+
184
+ ```sh
185
+ mln remove github.com/playsthisgame/skills/agentic-spec-dev
186
+ ```
187
+
188
+ ## Lock file
189
+
190
+ `melon.lock` is generated by `mln install` and should be committed to version control. It pins the exact version, git tag, repo URL, subdirectory, and a SHA-256 tree hash for each dependency.
191
+
192
+ ```yaml
193
+ generated_at: "2025-03-31T12:00:00Z"
194
+ dependencies:
195
+ - name: github.com/playsthisgame/skills/agentic-spec-dev
196
+ version: "1.2.0"
197
+ git_tag: v1.2.0
198
+ repo_url: https://github.com/playsthisgame/skills/agentic-spec-dev
199
+ subdir: ""
200
+ entrypoint: SKILL.md
201
+ tree_hash: "sha256:abc123..."
202
+ files:
203
+ - SKILL.md
204
+ ```
205
+
206
+ Use `--frozen` in CI to ensure the lock file is always up to date:
207
+
208
+ ```sh
209
+ mln install --frozen
210
+ ```
211
+
212
+ ## Why melon?
213
+
214
+ As AI coding assistants become more capable, teams are building and sharing libraries of skills. Without a proper dependency manager, keeping these skills consistent across developers, environments, and CI becomes a manual, error-prone process.
215
+
216
+ **Melon gives you a single source of truth.** Define all the skills your project needs in one `melon.yml` file, commit it alongside your code, and every developer (and your CI pipeline) gets exactly the same set of skills with a single `mln install`.
217
+
218
+ **Skills are versioned, not just copied.** Melon pins exact versions, git tags, and SHA-256 content hashes in `melon.lock`. If a skill author publishes a breaking change, your team won't silently pick it up, you'll see the diff in the lock file and upgrade intentionally. This means you can trust that the skill running in CI today is the same one that ran last week.
219
+
220
+ **It works naturally with CI.** Run `mln install --frozen` in your pipeline to fail fast if the lock file is out of sync with the manifest. No surprises, no drift. Because `.melon/` and the generated symlinks are committed to the repo, CI doesn't even need network access to place skills, everything is already there.
221
+
222
+ **Works across your whole team and all your tools.** List the AI tools your project uses under `tool_compat` and melon places each skill into every agent's expected directory at once. One manifest, one install command, every agent ready to go.
223
+
224
+ ## Why melon instead of npx skill installers?
225
+
226
+ Many agent skill collections ship a one-liner like `npx install-skill <name>` that copies files into your project. Melon takes a different approach:
227
+
228
+ | | melon | npx installers |
229
+ | --- | --- | --- |
230
+ | **Reproducibility** | `melon.lock` pins exact versions and content hashes | Each run may fetch a different version |
231
+ | **Transitive deps** | Resolves the full dependency graph | Usually single-package only |
232
+ | **Multiple agents** | `tool_compat` places skills for all your tools at once | Typically one target agent |
233
+ | **Offline / CI** | Already-fetched deps are cached in `.melon/` | Always fetches from the network |
234
+ | **Node.js required** | No — pure Go binary, no runtime needed | Yes |
235
+ | **Removal** | `mln remove` unlinks symlinks and purges the cache | Usually manual |
236
+
237
+ ## License
238
+
239
+ [MIT](LICENSE)
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@playsthisgame/melon",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A dependency manager for agentic markdown — skills, agents, and prompts for your AI tools.",
5
5
  "bin": {
6
- "mln": "./bin/mln.js"
6
+ "mln": "./bin/mln.js",
7
+ "melon": "./bin/mln.js"
7
8
  },
8
9
  "scripts": {
9
10
  "postinstall": "node postinstall.js"
package/postinstall.js CHANGED
@@ -26,8 +26,10 @@ const ext = process.platform === 'win32' ? 'zip' : 'tar.gz'
26
26
  const archiveName = `mln_${version}_${goos}_${goarch}.${ext}`
27
27
  const downloadURL = `https://github.com/playsthisgame/melon/releases/download/v${version}/${archiveName}`
28
28
  const archivePath = path.join(os.tmpdir(), archiveName)
29
- const binaryName = process.platform === 'win32' ? 'mln.exe' : 'mln'
30
- const binaryDest = path.join(__dirname, binaryName)
29
+
30
+ const binaries = process.platform === 'win32'
31
+ ? [{ name: 'mln.exe', dest: path.join(__dirname, 'mln.exe') }, { name: 'melon.exe', dest: path.join(__dirname, 'melon.exe') }]
32
+ : [{ name: 'mln', dest: path.join(__dirname, 'mln') }, { name: 'melon', dest: path.join(__dirname, 'melon') }]
31
33
 
32
34
  function download(url, dest, cb) {
33
35
  const file = fs.createWriteStream(dest)
@@ -61,13 +63,15 @@ download(downloadURL, archivePath, err => {
61
63
  if (process.platform === 'win32') {
62
64
  execSync(`powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${os.tmpdir()}' -Force"`)
63
65
  } else {
64
- execSync(`tar -xzf "${archivePath}" -C "${os.tmpdir()}" mln`)
66
+ const names = binaries.map(b => b.name).join(' ')
67
+ execSync(`tar -xzf "${archivePath}" -C "${os.tmpdir()}" ${names}`)
65
68
  }
66
69
 
67
- fs.copyFileSync(path.join(os.tmpdir(), binaryName), binaryDest)
68
-
69
- if (process.platform !== 'win32') {
70
- fs.chmodSync(binaryDest, 0o755)
70
+ for (const binary of binaries) {
71
+ fs.copyFileSync(path.join(os.tmpdir(), binary.name), binary.dest)
72
+ if (process.platform !== 'win32') {
73
+ fs.chmodSync(binary.dest, 0o755)
74
+ }
71
75
  }
72
76
 
73
77
  fs.unlinkSync(archivePath)