@memlink/cli 1.0.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 rblez
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 ADDED
@@ -0,0 +1,198 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/rblez/memlink/main/public/memlink.png" alt="Memlink Logo" width="200" />
3
+ </p>
4
+
5
+ <h1 align="center">Memlink</h1>
6
+
7
+ <p align="center">
8
+ <strong>Universal Memory for AI Agents</strong><br/>
9
+ Self-hosted · Fast · Organized
10
+ </p>
11
+
12
+ ---
13
+
14
+ Memlink is a self-hosted MCP (Model Context Protocol) server that gives AI agents persistent, organized memory. One memory, one URL, any agent connects.
15
+
16
+ No tokens. No headers. No OAuth. Just the URL.
17
+
18
+ ## Installation
19
+
20
+ [![npm](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)](#npm)
21
+ [![pnpm](https://img.shields.io/badge/pnpm-F69220?style=for-the-badge&logo=pnpm&logoColor=white)](#pnpm)
22
+ [![yarn](https://img.shields.io/badge/yarn-2C8EBB?style=for-the-badge&logo=yarn&logoColor=white)](#yarn)
23
+ [![bun](https://img.shields.io/badge/bun-000000?style=for-the-badge&logo=bun&logoColor=white)](#bun)
24
+
25
+ ### npm
26
+
27
+ ```bash
28
+ npm install -g @memlink/cli
29
+ ```
30
+
31
+ ### pnpm
32
+
33
+ ```bash
34
+ pnpm install -g @memlink/cli
35
+ ```
36
+
37
+ ### Yarn
38
+
39
+ ```bash
40
+ yarn global add @memlink/cli
41
+ ```
42
+
43
+ ### bun
44
+
45
+ ```bash
46
+ bun install -g @memlink/cli
47
+ ```
48
+
49
+ ### From source
50
+
51
+ ```bash
52
+ git clone https://github.com/rblez/memlink.git
53
+ cd memlink
54
+ bun install
55
+ npm run build
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ ```bash
61
+ memlink # Show system overview
62
+ memlink init my-project # Create a memory
63
+ memlink serve # Start MCP server
64
+ ```
65
+
66
+ ## Commands
67
+
68
+ | Command | Description |
69
+ |---------|-------------|
70
+ | `memlink` | System overview: server, memories, entries, size |
71
+ | `memlink init <name>` | Create a memory. `--serve` auto-start server |
72
+ | `memlink create <name>` | Alias for `init` |
73
+ | `memlink delete <id>` | Permanently delete a memory and its data |
74
+ | `memlink ls` | List all memories (name, ID, size) |
75
+ | `memlink show <id>` | Show full memory as consolidated Markdown |
76
+ | `memlink serve` | Start MCP server. `--port`, `--host` |
77
+ | `memlink connect <id>` | Get MCP connection details |
78
+ | `memlink skill` | Install agent skill. `--global` or `-g` for all projects |
79
+ | `memlink bug` | Open GitHub issue with pre-filled template |
80
+
81
+ ## Documentation
82
+
83
+ Full documentation in [/docs](/docs):
84
+
85
+ | Document | Description |
86
+ |----------|-------------|
87
+ | [Installation](/docs/installation.md) | npm, pnpm, yarn, bun, from source |
88
+ | [Quick Start](/docs/quickstart.md) | Get running in 2 minutes |
89
+ | [CLI Reference](/docs/cli.md) | All commands and flags |
90
+ | [MCP Server](/docs/server.md) | Server configuration |
91
+ | [MCP Tools](/docs/mcp-tools.md) | All MCP tool details |
92
+ | [Agent Setup](/docs/agent-setup.md) | Connect Claude, Cursor, Windsurf, etc. |
93
+ | [Skill](/docs/skill.md) | Agent skill installation |
94
+ | [Backups](/docs/backups.md) | Backup and restore |
95
+ | [Architecture](/docs/architecture.md) | How it works |
96
+
97
+ ### Global flags
98
+
99
+ | Flag | Description |
100
+ |------|-------------|
101
+ | `--version` | Show version |
102
+ | `-h, --help` | Show help |
103
+ | `--json` | Scriptable JSON output (all commands) |
104
+
105
+ ## Environment Variables
106
+
107
+ | Variable | Description | Default |
108
+ |----------|-------------|---------|
109
+ | `MEMLINK_DIR` | Data directory | `~/.memlink` |
110
+ | `MEMLINK_PORT` / `PORT` | Server port | `4444` |
111
+ | `MEMLINK_HOST` / `HOST` | Server host | `localhost` |
112
+
113
+ ## Architecture
114
+
115
+ ```
116
+ ~/.memlink/
117
+ ├── config.json # Global config
118
+ └── abc123def456.memory.json # Universal memory (JSON)
119
+ ```
120
+
121
+ Agents connect via MCP:
122
+
123
+ ```
124
+ http://localhost:4444/mcp?id=MEMORY_ID
125
+ ```
126
+
127
+ Data flow:
128
+
129
+ ```
130
+ User → CLI → Core → Memory Files
131
+ Agent → MCP Server → Core → Memory Files
132
+ ```
133
+
134
+ ## MCP Tools
135
+
136
+ | Tool | Description |
137
+ |------|-------------|
138
+ | `memory_read` | Read all entries or by title |
139
+ | `memory_edit` | Create or update an entry |
140
+ | `memory_delete` | Delete an entry by title |
141
+ | `memory_search` | Search by query |
142
+ | `memory_sync` | Validate memory integrity |
143
+ | `memory_batch` | Bulk create/update |
144
+ | `bulk_delete` | Delete by titles/tags/pattern |
145
+ | `backup_create` | Create backup |
146
+ | `backup_restore` | Restore from backup |
147
+ | `backup_list` | List backups |
148
+ | `backup_delete` | Delete a backup |
149
+ | `backup_cleanup` | Clean old backups |
150
+
151
+ Full details: [MCP Tools Reference](/docs/mcp-tools.md)
152
+
153
+ ## Robustness
154
+
155
+ - **Atomic writes**: files written to `.tmp` then renamed — no corruption on crash
156
+ - **Auto-backups**: backups created automatically on every mutation, keeping last 3
157
+ - **TTY detection**: ASCII art and clipboard disabled in non-TTY (CI, Docker, pipes)
158
+ - **Safe clipboard**: clipboard failures handled silently
159
+
160
+ ## Development
161
+
162
+ ```bash
163
+ bun install # Install deps
164
+ npm run build # Build + type check
165
+ npm run dev:server # Server with hot reload
166
+ npm run dev:cli # CLI dev mode
167
+ npm run test # Run tests
168
+ npm run lint # ESLint
169
+ npm run format # Prettier
170
+ ```
171
+
172
+ ## Project Structure
173
+
174
+ ```
175
+ src/
176
+ ├── cli/index.ts # CLI entrypoint (commands)
177
+ ├── cli/output.ts # Output formatting, colors, branding
178
+ ├── server/index.ts # MCP server (Express + @modelcontextprotocol/sdk)
179
+ ├── core/
180
+ │ ├── memory.ts # File I/O, CRUD, search, backup, bulk ops
181
+ │ └── types.ts # Types, constants
182
+ tests/
183
+ ├── memory.test.ts # Core memory unit tests
184
+ ├── server.test.ts # MCP server integration tests
185
+ └── unit.test.ts # Additional unit tests
186
+ ```
187
+
188
+ ## CI/CD
189
+
190
+ ```
191
+ bun test → bun run build → bun run format:check → bun run lint
192
+ ```
193
+
194
+ Releases trigger on `v*` tags → publishes to npm.
195
+
196
+ ## License
197
+
198
+ MIT License. See [LICENSE](LICENSE) for details.