@aishelf/service 1.0.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,10 @@
1
+ # AIShelf Software License
2
+
3
+ Copyright © 2026 AIShelf. All rights reserved.
4
+
5
+ This software is proprietary and confidential.
6
+
7
+ The full license agreement is available at:
8
+ https://aishelf.dev/license
9
+
10
+ By installing, accessing, or using this software, you agree to be bound by the terms and conditions specified in the license agreement.
package/README.md ADDED
@@ -0,0 +1,280 @@
1
+ # @aishelf/service
2
+
3
+ AIShelf local service for cross-platform file access. Provides a simple HTTP API to manage files in `~/.aishelf/`.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @aishelf/service
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Get help
14
+
15
+ ```bash
16
+ aishelf-service --help
17
+ aishelf-service help [command]
18
+ ```
19
+
20
+ ### Check version
21
+
22
+ ```bash
23
+ aishelf-service --version
24
+ ```
25
+
26
+ ### Start the service
27
+
28
+ ```bash
29
+ aishelf-service start
30
+ ```
31
+
32
+ ### Stop the service
33
+
34
+ ```bash
35
+ aishelf-service stop
36
+ ```
37
+
38
+ ### Restart the service
39
+
40
+ ```bash
41
+ aishelf-service restart
42
+ ```
43
+
44
+ ### Check status
45
+
46
+ ```bash
47
+ aishelf-service status
48
+ ```
49
+
50
+ ## API
51
+
52
+ The service runs on `http://localhost:5314` and provides a simple file API:
53
+
54
+ ### GET - Read file or list directory
55
+
56
+ ```bash
57
+ # List directory
58
+ curl http://localhost:5314/storage/registries
59
+
60
+ # Read file
61
+ curl http://localhost:5314/storage/registries/user-repo/workflow.md
62
+ ```
63
+
64
+ **Response for directory:**
65
+ ```json
66
+ {
67
+ "path": "/storage/registries",
68
+ "type": "directory",
69
+ "contents": [
70
+ {
71
+ "name": "user-repo",
72
+ "type": "directory",
73
+ "path": "/storage/registries/user-repo"
74
+ }
75
+ ]
76
+ }
77
+ ```
78
+
79
+ **Response for file:**
80
+ ```
81
+ # Workflow content here...
82
+ ```
83
+
84
+ ### POST - Create file
85
+
86
+ ```bash
87
+ curl -X POST http://localhost:5314/storage/registries/user-repo/test.md \
88
+ -H "Content-Type: application/json" \
89
+ -d '{"content": "# Test"}'
90
+ ```
91
+
92
+ **Response:**
93
+ ```json
94
+ {
95
+ "success": true,
96
+ "path": "/storage/registries/user-repo/test.md"
97
+ }
98
+ ```
99
+
100
+ ### PUT - Update file
101
+
102
+ ```bash
103
+ curl -X PUT http://localhost:5314/storage/registries/user-repo/test.md \
104
+ -H "Content-Type: application/json" \
105
+ -d '{"content": "# Updated"}'
106
+ ```
107
+
108
+ **Response:**
109
+ ```json
110
+ {
111
+ "success": true,
112
+ "path": "/storage/registries/user-repo/test.md"
113
+ }
114
+ ```
115
+
116
+ ### DELETE - Delete file or directory
117
+
118
+ ```bash
119
+ curl -X DELETE http://localhost:5314/storage/registries/user-repo/test.md
120
+ ```
121
+
122
+ **Response:**
123
+ ```json
124
+ {
125
+ "success": true,
126
+ "path": "/storage/registries/user-repo/test.md"
127
+ }
128
+ ```
129
+
130
+ ## Auto-Start on Login (Optional)
131
+
132
+ If you want the service to start automatically when you log in, follow the instructions for your platform:
133
+
134
+ ### macOS
135
+
136
+ Create `~/Library/LaunchAgents/com.aishelf.service.plist`:
137
+
138
+ ```xml
139
+ <?xml version="1.0" encoding="UTF-8"?>
140
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
141
+ <plist version="1.0">
142
+ <dict>
143
+ <key>Label</key>
144
+ <string>com.aishelf.service</string>
145
+ <key>ProgramArguments</key>
146
+ <array>
147
+ <string>/usr/local/bin/node</string>
148
+ <string>/usr/local/lib/node_modules/@aishelf/service/dist/cli.js</string>
149
+ <string>start</string>
150
+ </array>
151
+ <key>RunAtLoad</key>
152
+ <true/>
153
+ <key>KeepAlive</key>
154
+ <true/>
155
+ <key>StandardOutPath</key>
156
+ <string>/Users/YOUR_USERNAME/.aishelf/logs/service.log</string>
157
+ <key>StandardErrorPath</key>
158
+ <string>/Users/YOUR_USERNAME/.aishelf/logs/service.error.log</string>
159
+ </dict>
160
+ </plist>
161
+ ```
162
+
163
+ Replace `YOUR_USERNAME` with your actual username, then load the service:
164
+
165
+ ```bash
166
+ launchctl load ~/Library/LaunchAgents/com.aishelf.service.plist
167
+ ```
168
+
169
+ To unload:
170
+ ```bash
171
+ launchctl unload ~/Library/LaunchAgents/com.aishelf.service.plist
172
+ ```
173
+
174
+ ### Linux
175
+
176
+ Create `~/.config/systemd/user/aishelf-service.service`:
177
+
178
+ ```ini
179
+ [Unit]
180
+ Description=AIShelf Local Service
181
+ After=network.target
182
+
183
+ [Service]
184
+ Type=simple
185
+ ExecStart=/usr/bin/node /usr/local/lib/node_modules/@aishelf/service/dist/cli.js start
186
+ Restart=always
187
+ RestartSec=10
188
+ StandardOutput=append:/home/YOUR_USERNAME/.aishelf/logs/service.log
189
+ StandardError=append:/home/YOUR_USERNAME/.aishelf/logs/service.error.log
190
+
191
+ [Install]
192
+ WantedBy=default.target
193
+ ```
194
+
195
+ Replace `YOUR_USERNAME` with your actual username, then enable and start:
196
+
197
+ ```bash
198
+ systemctl --user daemon-reload
199
+ systemctl --user enable aishelf-service
200
+ systemctl --user start aishelf-service
201
+ ```
202
+
203
+ To check status:
204
+ ```bash
205
+ systemctl --user status aishelf-service
206
+ ```
207
+
208
+ To stop:
209
+ ```bash
210
+ systemctl --user stop aishelf-service
211
+ ```
212
+
213
+ ### Windows
214
+
215
+ Using NSSM (Non-Sucking Service Manager):
216
+
217
+ 1. Install NSSM:
218
+ ```powershell
219
+ choco install nssm
220
+ ```
221
+
222
+ 2. Install the service:
223
+ ```powershell
224
+ nssm install AIShelfService "C:\Program Files\nodejs\node.exe" "C:\Users\YOUR_USERNAME\AppData\Roaming\npm\node_modules\@aishelf\service\dist\cli.js" start
225
+ nssm set AIShelfService Start SERVICE_AUTO_START
226
+ nssm start AIShelfService
227
+ ```
228
+
229
+ Replace `YOUR_USERNAME` with your actual username.
230
+
231
+ To stop:
232
+ ```powershell
233
+ nssm stop AIShelfService
234
+ ```
235
+
236
+ To remove:
237
+ ```powershell
238
+ nssm remove AIShelfService confirm
239
+ ```
240
+
241
+ ## Security
242
+
243
+ - **Localhost only**: The service only accepts requests from `localhost` (not exposed to the internet)
244
+ - **Path traversal protection**: Prevents `..` in paths to avoid accessing files outside `~/.aishelf/`
245
+ - **CORS enabled**: Allows browser extensions to make requests
246
+
247
+ ## Environment Variables
248
+
249
+ - `AISHELF_PORT`: Change the port (default: 5314)
250
+ ```bash
251
+ AISHELF_PORT=8080 aishelf-service start
252
+ ```
253
+
254
+ ## Troubleshooting
255
+
256
+ ### Port already in use
257
+
258
+ If port 5314 is already in use, you can change it:
259
+
260
+ ```bash
261
+ AISHELF_PORT=8080 aishelf-service start
262
+ ```
263
+
264
+ ### Service won't start
265
+
266
+ Check the logs:
267
+ ```bash
268
+ cat ~/.aishelf/logs/service.log
269
+ ```
270
+
271
+ ### Permission denied
272
+
273
+ Make sure the CLI is executable:
274
+ ```bash
275
+ chmod +x /usr/local/lib/node_modules/@aishelf/service/dist/cli.js
276
+ ```
277
+
278
+ ## License
279
+
280
+ MIT