cntx-ui 2.0.3 → 2.0.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.
package/README.md CHANGED
@@ -1 +1,312 @@
1
- # Test Project
1
+ # cntx-ui
2
+
3
+ Minimal file bundling and tagging tool for AI development with web interface.
4
+
5
+ ## Features
6
+
7
+ - File bundling and organization for AI development workflows
8
+ - Web-based UI for managing bundles and configurations
9
+ - **Model Context Protocol (MCP) server** for AI integration
10
+ - Hidden files management
11
+ - Cursor rules integration
12
+ - WebSocket-based real-time updates
13
+ - CLI tools for automation
14
+
15
+ ## Installation
16
+
17
+ ### Global Installation (Recommended)
18
+
19
+ ```bash
20
+ npm install -g cntx-ui
21
+ ```
22
+
23
+ ### Local Development Installation
24
+
25
+ ```bash
26
+ git clone https://github.com/nothingdao/cntx-ui.git
27
+ cd cntx-ui
28
+ npm install
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ### Initialize a Project
34
+
35
+ ```bash
36
+ # Initialize cntx-ui in your project
37
+ cntx-ui init
38
+
39
+ # Start the web interface
40
+ cntx-ui watch
41
+
42
+ # Visit http://localhost:3333 to access the web UI
43
+ ```
44
+
45
+ ### CLI Commands
46
+
47
+ ```bash
48
+ # Generate bundles
49
+ cntx-ui bundle <name>
50
+
51
+ # Check project status
52
+ cntx-ui status
53
+
54
+ # Start web server on custom port
55
+ cntx-ui watch [port]
56
+
57
+ # Start MCP server for AI integration
58
+ cntx-ui mcp
59
+ ```
60
+
61
+ ### MCP Integration
62
+
63
+ cntx-ui can function as an MCP (Model Context Protocol) server, providing AI tools with direct access to your project bundles:
64
+
65
+ ```bash
66
+ # Start MCP server
67
+ cntx-ui mcp
68
+ ```
69
+
70
+ **Available MCP Resources:**
71
+ - `cntx://bundle/<name>` - Access any bundle as XML content
72
+ - `cntx://file/<path>` - Access individual project files
73
+
74
+ **Available MCP Tools:**
75
+ - `list_bundles` - List all available bundles
76
+ - `get_bundle` - Retrieve specific bundle content
77
+ - `generate_bundle` - Regenerate a bundle
78
+ - `get_file_tree` - Get project file structure
79
+ - `get_project_status` - Get current project status
80
+
81
+ ## Development
82
+
83
+ ### Prerequisites
84
+
85
+ - Node.js >= 18.0.0
86
+ - npm
87
+
88
+ ### Setup Development Environment
89
+
90
+ 1. **Clone and install dependencies:**
91
+ ```bash
92
+ git clone https://github.com/nothingdao/cntx-ui.git
93
+ cd cntx-ui
94
+ npm install
95
+ ```
96
+
97
+ 2. **Install web dependencies:**
98
+ ```bash
99
+ cd web
100
+ npm install
101
+ cd ..
102
+ ```
103
+
104
+ ### Development Workflow
105
+
106
+ #### Running in Development Mode
107
+
108
+ 1. **Start the backend server:**
109
+ ```bash
110
+ npm run dev
111
+ ```
112
+
113
+ 2. **Start the frontend development server:**
114
+ ```bash
115
+ npm run dev:web
116
+ ```
117
+
118
+ The web interface will be available at `http://localhost:5173` (Vite dev server)
119
+
120
+ #### Building the Project
121
+
122
+ 1. **Build web interface only:**
123
+ ```bash
124
+ npm run build:web
125
+ ```
126
+
127
+ 2. **Build entire project:**
128
+ ```bash
129
+ npm run build
130
+ ```
131
+
132
+ 3. **Automated build with validation:**
133
+ ```bash
134
+ ./build.sh
135
+ ```
136
+
137
+ ### Project Structure
138
+
139
+ ```
140
+ cntx-ui/
141
+ ├── bin/ # CLI executable
142
+ ├── web/ # React frontend
143
+ │ ├── src/
144
+ │ │ ├── components/ # React components
145
+ │ │ ├── hooks/ # Custom hooks
146
+ │ │ ├── utils/ # Utility functions
147
+ │ │ └── lib/ # Libraries and configurations
148
+ │ ├── dist/ # Built frontend (generated)
149
+ │ └── package.json # Frontend dependencies
150
+ ├── server.js # WebSocket server
151
+ ├── package.json # Main package configuration
152
+ ├── build.sh # Build automation script
153
+ └── test-local.sh # Local testing script
154
+ ```
155
+
156
+ ### Available Scripts
157
+
158
+ | Script | Description |
159
+ |--------|-------------|
160
+ | `npm run dev` | Start backend server |
161
+ | `npm run dev:web` | Start frontend dev server |
162
+ | `npm run build` | Build entire project |
163
+ | `npm run build:web` | Build frontend only |
164
+ | `npm test:local` | Install and test package locally |
165
+
166
+ ## MCP Server Setup
167
+
168
+ ### Claude Desktop Integration
169
+
170
+ Add to your Claude Desktop configuration (`~/.claude_desktop_config.json`):
171
+
172
+ ```json
173
+ {
174
+ "mcpServers": {
175
+ "cntx-ui": {
176
+ "command": "cntx-ui",
177
+ "args": ["mcp"],
178
+ "cwd": "/path/to/your/project"
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ ### Other MCP Clients
185
+
186
+ For other MCP-compatible clients, use:
187
+ - **Command**: `cntx-ui mcp`
188
+ - **Transport**: stdio
189
+ - **Working Directory**: Your project root
190
+
191
+ ### MCP Workflow
192
+
193
+ 1. **Visual Configuration**: Use `cntx-ui watch` to configure bundles via web UI
194
+ 2. **AI Integration**: AI clients connect via MCP to access bundles
195
+ 3. **Real-time Updates**: Changes in web UI immediately available to AI tools
196
+ 4. **Dual Mode**: Web UI and MCP server can run simultaneously
197
+
198
+ ## Testing
199
+
200
+ ### Local Testing
201
+
202
+ 1. **Run automated test suite:**
203
+ ```bash
204
+ ./test-local.sh
205
+ ```
206
+
207
+ 2. **Manual testing:**
208
+ ```bash
209
+ # Build and pack
210
+ npm run build
211
+ npm pack
212
+
213
+ # Install globally for testing
214
+ npm install -g ./cntx-ui-*.tgz
215
+
216
+ # Test in a new project
217
+ mkdir test-project && cd test-project
218
+ cntx-ui init
219
+ cntx-ui watch
220
+ ```
221
+
222
+ ### Test Coverage
223
+
224
+ The test suite covers:
225
+ - Project initialization
226
+ - Bundle generation
227
+ - Web server functionality
228
+ - API endpoints
229
+ - File management operations
230
+
231
+ ## Publishing
232
+
233
+ ### Prerequisites for Publishing
234
+
235
+ - npm account with publish permissions
236
+ - Clean git working directory
237
+ - All tests passing
238
+
239
+ ### Publishing Steps
240
+
241
+ 1. **Update version:**
242
+ ```bash
243
+ npm version patch # or minor/major
244
+ ```
245
+
246
+ 2. **Build and validate:**
247
+ ```bash
248
+ ./build.sh
249
+ ```
250
+
251
+ 3. **Test locally:**
252
+ ```bash
253
+ ./test-local.sh
254
+ ```
255
+
256
+ 4. **Publish to npm:**
257
+ ```bash
258
+ # Stable release
259
+ npm publish
260
+
261
+ # Beta release
262
+ npm publish --tag beta
263
+ ```
264
+
265
+ ### Automated Publishing Workflow
266
+
267
+ Use the build script for a complete workflow:
268
+
269
+ ```bash
270
+ ./build.sh
271
+ # Follow prompts for local testing
272
+ # If tests pass, run: npm publish
273
+ ```
274
+
275
+ ## Configuration
276
+
277
+ ### Environment Variables
278
+
279
+ - `PORT` - Override default server port (default: 3333)
280
+ - `NODE_ENV` - Set environment (development/production)
281
+
282
+ ### Project Configuration
283
+
284
+ cntx-ui creates these files in your project:
285
+ - `.cntx/config.json` - Main configuration
286
+ - `.cntxignore` - Files to ignore
287
+ - `.cursorrules` - Cursor editor rules
288
+
289
+ ## Contributing
290
+
291
+ 1. Fork the repository
292
+ 2. Create a feature branch
293
+ 3. Make changes following the existing code style
294
+ 4. Run tests: `./test-local.sh`
295
+ 5. Submit a pull request
296
+
297
+ ## Technology Stack
298
+
299
+ - **Backend:** Node.js, WebSocket (ws)
300
+ - **Frontend:** React 19, TypeScript, Vite
301
+ - **UI:** Tailwind CSS, Radix UI
302
+ - **State Management:** TanStack Query
303
+ - **Build Tools:** Vite, TypeScript compiler
304
+
305
+ ## License
306
+
307
+ MIT
308
+
309
+ ## Support
310
+
311
+ - GitHub Issues: [Report bugs or request features](https://github.com/nothingdao/cntx-ui/issues)
312
+ - Documentation: Check the web interface for detailed usage guides
package/bin/cntx-ui.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { startServer, generateBundle, initConfig, getStatus } from '../server.js';
3
+ import { startServer, startMCPServer, generateBundle, initConfig, getStatus } from '../server.js';
4
4
 
5
5
  const args = process.argv.slice(2);
6
6
  const command = args[0] || 'watch';
@@ -17,6 +17,11 @@ switch (command) {
17
17
  startServer({ port });
18
18
  break;
19
19
 
20
+ case 'mcp':
21
+ // MCP server mode - runs on stdio
22
+ startMCPServer({ cwd: process.cwd() });
23
+ break;
24
+
20
25
  case 'bundle':
21
26
  const bundleName = args[1] || 'master';
22
27
  try {
@@ -36,16 +41,24 @@ switch (command) {
36
41
  break;
37
42
 
38
43
  default:
39
- console.log(`cntx-ui v2.0.0
44
+ console.log(`cntx-ui v2.0.5
40
45
 
41
46
  Usage:
42
47
  cntx-ui init Initialize configuration
43
- cntx-ui watch [port] Start API server (default port: 3333)
48
+ cntx-ui watch [port] Start web server (default port: 3333)
49
+ cntx-ui mcp Start MCP server (stdio transport)
44
50
  cntx-ui bundle [name] Generate specific bundle (default: master)
45
51
  cntx-ui status Show current status
46
52
 
47
53
  Examples:
48
54
  cntx-ui init
49
55
  cntx-ui watch 8080
50
- cntx-ui bundle api`);
56
+ cntx-ui mcp
57
+ cntx-ui bundle api
58
+
59
+ MCP Usage:
60
+ The MCP server provides AI-accessible bundle management:
61
+ - Resources: Access bundles and files via cntx:// URIs
62
+ - Tools: List bundles, generate bundles, get project status
63
+ - Integration: Use with Claude Desktop, Cursor, or other MCP clients`);
51
64
  }