contextloop-cli 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ContextLoop
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,223 @@
1
+ # ContextLoop CLI
2
+
3
+ The official command-line interface for [ContextLoop](https://contextloop.io) - upload, download, and manage documents efficiently.
4
+
5
+ > **Important**: The correct domain is **contextloop.io** (NOT contextloop.ai)
6
+
7
+ ## Features
8
+
9
+ - **Token-efficient uploads**: Read files directly from disk without generating tokens
10
+ - **Pipe support**: Stream content from stdin for AI agent integration
11
+ - **Batch operations**: Upload multiple files with glob patterns
12
+ - **Cross-platform**: Works on macOS, Windows, and Linux
13
+ - **Secure**: Credentials stored in OS keychain
14
+ - **Local development**: Easy localhost support for testing
15
+
16
+ ## Installation
17
+
18
+ ### From npm (once published)
19
+ ```bash
20
+ npm install -g contextloop-cli
21
+ # or
22
+ pnpm add -g contextloop-cli
23
+ ```
24
+
25
+ ### Local Development
26
+ ```bash
27
+ # Clone and install
28
+ cd ~/Git/contextloop-cli
29
+ pnpm install
30
+ pnpm build
31
+
32
+ # Option 1: Run directly
33
+ node ./dist/index.js --help
34
+
35
+ # Option 2: Link globally
36
+ pnpm link --global
37
+ contextloop --help
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ```bash
43
+ # Login with API key
44
+ contextloop auth login --api-key YOUR_API_KEY
45
+
46
+ # Or interactive login (opens browser)
47
+ contextloop auth login
48
+
49
+ # Set default project
50
+ contextloop project use my-project
51
+
52
+ # Upload a document
53
+ contextloop document upload ./docs/readme.md
54
+
55
+ # Upload from stdin
56
+ cat file.md | contextloop document upload - --title "My Doc"
57
+
58
+ # Download a document
59
+ contextloop document download <document-id>
60
+
61
+ # List documents
62
+ contextloop document list --tree
63
+ ```
64
+
65
+ ## Commands
66
+
67
+ ### Authentication
68
+
69
+ ```bash
70
+ contextloop auth login # Interactive login
71
+ contextloop auth login --api-key # Login with API key
72
+ contextloop auth logout # Clear credentials
73
+ contextloop auth whoami # Show current user
74
+ ```
75
+
76
+ ### Projects
77
+
78
+ ```bash
79
+ contextloop project list # List projects
80
+ contextloop project use <id|slug> # Set default project
81
+ contextloop project info # Show project details
82
+ contextloop project current # Show default project
83
+ ```
84
+
85
+ ### Documents
86
+
87
+ ```bash
88
+ contextloop document list [--tree] # List documents
89
+ contextloop document upload <file> [--path <path>] # Upload document
90
+ contextloop document download <id> [-o file] # Download document
91
+ contextloop document update <id> <file> # Update document
92
+ contextloop document delete <id> # Delete document
93
+ contextloop document info <id> # Show metadata
94
+ contextloop document versions <id> # List versions
95
+ ```
96
+
97
+ ### Context
98
+
99
+ ```bash
100
+ contextloop context list # List context items
101
+ contextloop context upload <file> # Upload context
102
+ contextloop context download <id> [-o file] # Download context
103
+ contextloop context delete <id> # Delete context
104
+ ```
105
+
106
+ ### Comments
107
+
108
+ ```bash
109
+ contextloop comment list <document-id> # List comments
110
+ contextloop comment add <document-id> --body "text" # Add comment
111
+ contextloop comment resolve <comment-id> # Resolve comment
112
+ ```
113
+
114
+ ## Global Options
115
+
116
+ ```
117
+ -V, --version Output version number
118
+ -p, --project <id|slug> Project ID or slug (overrides default)
119
+ -f, --format <format> Output format: text, json (default: text)
120
+ -q, --quiet Suppress non-essential output
121
+ -v, --verbose Enable verbose logging
122
+ --no-color Disable colored output
123
+ -h, --help Display help
124
+ ```
125
+
126
+ ## Environment Variables
127
+
128
+ ```bash
129
+ # Production (default)
130
+ CONTEXTLOOP_API_URL=https://contextloop.io/api
131
+
132
+ # Local development - use any of these:
133
+ CONTEXTLOOP_API_URL=local # Shorthand for localhost:3000
134
+ CONTEXTLOOP_API_URL=localhost # Shorthand for localhost:3000
135
+ CONTEXTLOOP_API_URL=http://localhost:3000/api # Explicit localhost
136
+
137
+ # Authentication
138
+ CONTEXTLOOP_API_KEY=cl_key_xxxxx # API key
139
+
140
+ # Default project (optional)
141
+ CONTEXTLOOP_PROJECT_ID=uuid-here
142
+ ```
143
+
144
+ ## Local Development Testing
145
+
146
+ To test the CLI against a local ContextLoop instance:
147
+
148
+ ```bash
149
+ # Option 1: Set environment variable
150
+ export CONTEXTLOOP_API_URL=local
151
+ contextloop auth whoami
152
+
153
+ # Option 2: Use explicit URL
154
+ CONTEXTLOOP_API_URL=http://localhost:3000/api contextloop project list
155
+
156
+ # Option 3: One-liner
157
+ CONTEXTLOOP_API_URL=local contextloop document list
158
+ ```
159
+
160
+ ## Configuration
161
+
162
+ Configuration is stored in:
163
+ - **macOS**: `~/Library/Preferences/contextloop-cli-nodejs/config.json`
164
+ - **Linux**: `~/.config/contextloop-cli-nodejs/config.json`
165
+ - **Windows**: `%APPDATA%/contextloop-cli-nodejs/Config/config.json`
166
+
167
+ Credentials are stored securely in your OS keychain.
168
+
169
+ ## AI Agent Usage
170
+
171
+ The CLI is designed for AI agent integration (Claude Code, Cline, Cursor):
172
+
173
+ ```bash
174
+ # Upload file without generating tokens
175
+ contextloop document upload ./spec.md --title "Feature Spec"
176
+
177
+ # Pipe content directly
178
+ echo "# New Doc" | contextloop document upload - --title "Quick Note"
179
+
180
+ # Batch upload
181
+ contextloop document upload "./docs/**/*.md" --dry-run
182
+ ```
183
+
184
+ ## Exit Codes
185
+
186
+ | Code | Meaning |
187
+ |------|---------|
188
+ | 0 | Success |
189
+ | 1 | General error |
190
+ | 2 | Authentication error |
191
+ | 3 | Permission denied |
192
+ | 4 | Resource not found |
193
+ | 5 | Validation error |
194
+ | 6 | Configuration error |
195
+ | 10 | File system error |
196
+ | 11 | Rate limit exceeded |
197
+ | 12 | Timeout |
198
+ | 13 | File too large |
199
+
200
+ ## Development
201
+
202
+ ```bash
203
+ # Clone and install
204
+ git clone https://github.com/contextloop/contextloop-cli.git
205
+ cd contextloop-cli
206
+ pnpm install
207
+
208
+ # Build
209
+ pnpm build
210
+
211
+ # Run tests
212
+ pnpm test
213
+
214
+ # Run locally
215
+ node ./dist/index.js <command>
216
+
217
+ # Test against local server
218
+ CONTEXTLOOP_API_URL=local node ./dist/index.js auth whoami
219
+ ```
220
+
221
+ ## License
222
+
223
+ MIT
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node