gyrus 0.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +273 -0
  3. package/package.json +78 -0
  4. package/src/commands/adr.ts +482 -0
  5. package/src/commands/doctor.ts +263 -0
  6. package/src/commands/init.ts +293 -0
  7. package/src/commands/knowledge.ts +446 -0
  8. package/src/commands/list.ts +51 -0
  9. package/src/commands/mcp.ts +94 -0
  10. package/src/commands/use.ts +65 -0
  11. package/src/config/index.ts +262 -0
  12. package/src/config/schema.ts +139 -0
  13. package/src/formatters/adr.ts +295 -0
  14. package/src/formatters/index.ts +44 -0
  15. package/src/formatters/knowledge.ts +282 -0
  16. package/src/formatters/workspace.ts +149 -0
  17. package/src/index.ts +153 -0
  18. package/src/operations/adr.ts +312 -0
  19. package/src/operations/index.ts +58 -0
  20. package/src/operations/knowledge.ts +324 -0
  21. package/src/operations/types.ts +199 -0
  22. package/src/operations/workspace.ts +108 -0
  23. package/src/server/mcp-stdio.ts +526 -0
  24. package/src/services/adr.ts +511 -0
  25. package/src/services/knowledge.ts +516 -0
  26. package/src/services/markdown.ts +155 -0
  27. package/src/services/workspace.ts +377 -0
  28. package/src/templates/knowledge/README.md +199 -0
  29. package/src/tools/adr-create.ts +99 -0
  30. package/src/tools/adr-list.ts +72 -0
  31. package/src/tools/adr-read.ts +54 -0
  32. package/src/tools/adr-search.ts +79 -0
  33. package/src/tools/adr-update.ts +95 -0
  34. package/src/tools/gyrus-list.ts +41 -0
  35. package/src/tools/gyrus-switch.ts +45 -0
  36. package/src/tools/index.ts +91 -0
  37. package/src/tools/knowledge-create.ts +75 -0
  38. package/src/tools/knowledge-list.ts +60 -0
  39. package/src/tools/knowledge-read.ts +62 -0
  40. package/src/tools/knowledge-search.ts +65 -0
  41. package/src/tools/knowledge-update.ts +76 -0
  42. package/src/types/index.ts +343 -0
  43. package/tsconfig.json +26 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Evgenii Khramkov
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,273 @@
1
+ # Gyrus
2
+
3
+ [![CI](https://github.com/evgenii-polyakun/gyrus/actions/workflows/ci.yml/badge.svg)](https://github.com/evgenii-polyakun/gyrus/actions/workflows/ci.yml)
4
+ [![Release](https://github.com/evgenii-polyakun/gyrus/actions/workflows/release.yml/badge.svg)](https://github.com/evgenii-polyakun/gyrus/actions/workflows/release.yml)
5
+ [![npm version](https://img.shields.io/npm/v/gyrus.svg)](https://www.npmjs.com/package/gyrus)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Bun](https://img.shields.io/badge/Bun-%3E%3D1.0.0-black)](https://bun.sh)
8
+
9
+ **Model-agnostic knowledge management CLI with MCP server support.**
10
+
11
+ Gyrus is a unified CLI tool for managing knowledge notes and Architecture Decision Records (ADRs) across multiple workspaces. It works with any AI agent, IDE, or workflow through the Model Context Protocol (MCP).
12
+
13
+ > *A gyrus is a ridge on the cerebral cortex — the folds that increase surface area for neural connections. Like a gyrus, this tool connects different regions (agents, IDEs, models) and processes signals regardless of source.*
14
+
15
+ ## Features
16
+
17
+ - 🧠 **Multi-Workspace Support** — Manage separate knowledge bases for personal, work, and project contexts
18
+ - 🔌 **MCP Server** — Expose knowledge and ADR tools to AI agents via stdio transport
19
+ - 📚 **Knowledge Notes** — Structured markdown notes with YAML frontmatter
20
+ - 📋 **ADR System** — Architecture Decision Records for spec-driven development
21
+ - ⚡ **Fast** — Built with Bun for instant startup
22
+
23
+ ## Quick Start
24
+
25
+ ### Installation
26
+
27
+ ```bash
28
+ # Clone the repository
29
+ git clone https://github.com/evgenii-polyakun/gyrus.git
30
+ cd gyrus
31
+
32
+ # Install dependencies
33
+ bun install
34
+
35
+ # Build (optional - for standalone binary)
36
+ bun run build
37
+ ```
38
+
39
+ ### First-Time Setup
40
+
41
+ ```bash
42
+ # Initialize your first workspace at ~/gyrus
43
+ gyrus init
44
+
45
+ # Or specify a custom path and name
46
+ gyrus init ~/my-brain --name personal --description "Personal knowledge"
47
+ ```
48
+
49
+ This creates:
50
+ - Config file at `~/.config/gyrus/config.json`
51
+ - Default workspace at `~/gyrus` with knowledge and ADR folders
52
+
53
+ ### Adding More Workspaces
54
+
55
+ ```bash
56
+ # Add a work workspace
57
+ gyrus init ~/work/brain --name work --description "Work projects"
58
+
59
+ # Add a project-specific workspace
60
+ gyrus init ./brain --name myproject --description "Project notes"
61
+
62
+ # List all workspaces
63
+ gyrus workspaces # or: gyrus ws
64
+
65
+ # Switch default workspace
66
+ gyrus use work
67
+ ```
68
+
69
+ ## Commands
70
+
71
+ | Command | Description |
72
+ |---------|-------------|
73
+ | `gyrus init [path]` | Initialize a new workspace |
74
+ | `gyrus workspaces` | List all registered workspaces (alias: `ws`) |
75
+ | `gyrus use <name>` | Set the default workspace |
76
+ | `gyrus doctor` | Run diagnostics and health check |
77
+ | `gyrus mcp` | Start the MCP server (stdio) |
78
+ | `gyrus serve` | Start the dashboard server (coming soon) |
79
+ | `gyrus daemon` | Start HTTP/SSE MCP server (coming soon) |
80
+
81
+ ### Command Options
82
+
83
+ ```bash
84
+ # Initialize with custom name and description
85
+ gyrus init ~/path --name work --description "Work projects"
86
+
87
+ # Run MCP server for specific workspace
88
+ gyrus mcp --workspace work
89
+
90
+ # Check specific workspace health
91
+ gyrus doctor --workspace work
92
+
93
+ # Check all workspaces
94
+ gyrus doctor --all
95
+ ```
96
+
97
+ ## MCP Integration
98
+
99
+ ### Claude Desktop Configuration
100
+
101
+ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
102
+
103
+ ```json
104
+ {
105
+ "mcpServers": {
106
+ "gyrus": {
107
+ "command": "bun",
108
+ "args": ["run", "/path/to/gyrus/src/index.ts", "mcp"]
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ Or using the compiled binary:
115
+
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "gyrus": {
120
+ "command": "/path/to/gyrus/dist/gyrus",
121
+ "args": ["mcp"]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ ### Available MCP Tools
128
+
129
+ #### Workspace Tools
130
+ - `gyrus_list` — List all registered workspaces
131
+ - `gyrus_switch` — Switch active workspace for the session
132
+
133
+ #### Knowledge Tools
134
+ - `knowledge_list` — List notes with optional filtering
135
+ - `knowledge_read` — Read a note by ID or path
136
+ - `knowledge_search` — Search notes by query, tags, or category
137
+ - `knowledge_create` — Create a new note
138
+ - `knowledge_update` — Update an existing note
139
+
140
+ #### ADR Tools
141
+ - `adr_list` — List ADRs with optional filtering
142
+ - `adr_read` — Read an ADR by name
143
+ - `adr_search` — Search ADRs by query, status, type, or tags
144
+ - `adr_create` — Create a new ADR
145
+ - `adr_update` — Update an existing ADR
146
+
147
+ ### Example Agent Workflow
148
+
149
+ ```
150
+ Agent: Let me check what workspaces are available.
151
+ [calls gyrus_list]
152
+
153
+ Agent: I see you have personal and work workspaces.
154
+ Which should I use for this task?
155
+
156
+ User: Use work, this is for my job.
157
+
158
+ Agent: Switching to work workspace.
159
+ [calls gyrus_switch with name="work"]
160
+
161
+ Agent: Now searching for relevant knowledge...
162
+ [calls knowledge_search with query="authentication"]
163
+ ```
164
+
165
+ ## Workspace Structure
166
+
167
+ When you run `gyrus init`, it creates:
168
+
169
+ ```
170
+ <workspace>/
171
+ ├── knowledge/
172
+ │ ├── README.md # Knowledge system guide
173
+ │ ├── index.md # Master index of notes
174
+ │ ├── instructions.md # AI agent instructions
175
+ │ ├── projects/ # Project-specific knowledge
176
+ │ ├── patterns/ # Reusable patterns
177
+ │ ├── tools/ # Tool and tech notes
178
+ │ ├── gotchas/ # Common pitfalls
179
+ │ └── decisions/ # Key decisions
180
+ └── adrs/
181
+ └── template.md # ADR template
182
+ ```
183
+
184
+ ## Configuration
185
+
186
+ Global config is stored at `~/.config/gyrus/config.json`:
187
+
188
+ ```json
189
+ {
190
+ "version": 1,
191
+ "default": "personal",
192
+ "workspaces": [
193
+ {
194
+ "name": "personal",
195
+ "path": "~/gyrus",
196
+ "description": "Personal knowledge and projects"
197
+ },
198
+ {
199
+ "name": "work",
200
+ "path": "~/work/brain",
201
+ "description": "Work projects"
202
+ }
203
+ ],
204
+ "settings": {
205
+ "serve": { "port": 3333 },
206
+ "daemon": { "port": 3334 }
207
+ }
208
+ }
209
+ ```
210
+
211
+ ## Development
212
+
213
+ ```bash
214
+ # Run in development mode (auto-reload)
215
+ bun run dev
216
+
217
+ # Type checking
218
+ bun run typecheck
219
+
220
+ # Run doctor diagnostics
221
+ bun run doctor
222
+
223
+ # Build standalone binary
224
+ bun run build
225
+ ```
226
+
227
+ ## Note Format
228
+
229
+ Knowledge notes use YAML frontmatter:
230
+
231
+ ```markdown
232
+ ---
233
+ id: pattern-example
234
+ title: Example Pattern
235
+ created: 2026-01-15
236
+ updated: 2026-01-15
237
+ tags: [example, pattern]
238
+ related: [other-note-id]
239
+ ---
240
+
241
+ # Content starts here
242
+ ```
243
+
244
+ ## ADR Format
245
+
246
+ ADRs use this frontmatter:
247
+
248
+ ```markdown
249
+ ---
250
+ title: Feature Name
251
+ description: Brief description
252
+ date_created: 2026-01-15
253
+ date_updated: 2026-01-15
254
+ status: todo | in-progress | in-review | blocked | completed | deprecated
255
+ type: enhancement | debug | research
256
+ tags: [optional, tags]
257
+ working_folder: /path/to/project
258
+ ---
259
+
260
+ # Content starts here
261
+ ```
262
+
263
+ ## Tech Stack
264
+
265
+ - **Runtime**: [Bun](https://bun.sh)
266
+ - **Language**: TypeScript
267
+ - **MCP SDK**: [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk)
268
+ - **Frontmatter**: [gray-matter](https://github.com/jonschlinkert/gray-matter)
269
+ - **Validation**: [Zod](https://zod.dev)
270
+
271
+ ## License
272
+
273
+ MIT
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "gyrus",
3
+ "version": "0.1.0",
4
+ "description": "Model-agnostic knowledge management CLI with MCP server support",
5
+ "type": "module",
6
+ "bin": {
7
+ "gyrus": "./src/index.ts"
8
+ },
9
+ "main": "./src/index.ts",
10
+ "files": [
11
+ "src/**/*.ts",
12
+ "!src/**/*.test.ts",
13
+ "tsconfig.json",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "scripts": {
18
+ "start": "bun run src/index.ts",
19
+ "dev": "bun --watch run src/index.ts",
20
+ "build": "bun build src/index.ts --compile --outfile dist/gyrus",
21
+ "build:all": "bun run build:macos && bun run build:linux",
22
+ "build:macos": "bun build src/index.ts --compile --target=bun-darwin-arm64 --outfile dist/gyrus-darwin-arm64 && bun build src/index.ts --compile --target=bun-darwin-x64 --outfile dist/gyrus-darwin-x64",
23
+ "build:linux": "bun build src/index.ts --compile --target=bun-linux-x64 --outfile dist/gyrus-linux-x64 && bun build src/index.ts --compile --target=bun-linux-arm64 --outfile dist/gyrus-linux-arm64",
24
+ "typecheck": "tsc --noEmit",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest",
27
+ "test:coverage": "vitest run --coverage",
28
+ "doctor": "bun run src/index.ts doctor",
29
+ "mcp": "bun run src/index.ts mcp",
30
+ "prepublishOnly": "bun run typecheck && bun run test"
31
+ },
32
+ "keywords": [
33
+ "knowledge-management",
34
+ "mcp",
35
+ "model-context-protocol",
36
+ "cli",
37
+ "ai",
38
+ "notes",
39
+ "adr",
40
+ "architecture-decision-records",
41
+ "brain",
42
+ "second-brain",
43
+ "pkm",
44
+ "personal-knowledge-management"
45
+ ],
46
+ "author": "Evgenii Polikutin",
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/evgenii-polyakun/gyrus.git"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/evgenii-polyakun/gyrus/issues"
54
+ },
55
+ "homepage": "https://github.com/evgenii-polyakun/gyrus#readme",
56
+ "engines": {
57
+ "bun": ">=1.0.0"
58
+ },
59
+ "os": [
60
+ "darwin",
61
+ "linux"
62
+ ],
63
+ "cpu": [
64
+ "x64",
65
+ "arm64"
66
+ ],
67
+ "dependencies": {
68
+ "@modelcontextprotocol/sdk": "^1.25.2",
69
+ "gray-matter": "^4.0.3",
70
+ "zod": "^3.24.0"
71
+ },
72
+ "devDependencies": {
73
+ "@types/bun": "latest",
74
+ "prettier": "^3.8.0",
75
+ "typescript": "^5",
76
+ "vitest": "^4.0.17"
77
+ }
78
+ }