@aishelf/service 1.0.0 → 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/README.md +31 -250
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,279 +1,60 @@
|
|
|
1
1
|
# @aishelf/service
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A lightweight background service that powers AIShelf clients - including the VS Code extension and other future clients. It acts as a centralized source of workflows, skills, prompts, and rules for all your AI tools across your local machine, handling authentication and registry management so that AIShelf tools can securely access your shared AI resources.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
|
5
|
+
For full installation instructions and documentation, visit [aishelf.dev/docs/installation](https://aishelf.dev/docs/installation).
|
|
101
6
|
|
|
102
|
-
|
|
103
|
-
curl -X PUT http://localhost:5314/storage/registries/user-repo/test.md \
|
|
104
|
-
-H "Content-Type: application/json" \
|
|
105
|
-
-d '{"content": "# Updated"}'
|
|
106
|
-
```
|
|
7
|
+
## Installation
|
|
107
8
|
|
|
108
|
-
|
|
109
|
-
```json
|
|
110
|
-
{
|
|
111
|
-
"success": true,
|
|
112
|
-
"path": "/storage/registries/user-repo/test.md"
|
|
113
|
-
}
|
|
114
|
-
```
|
|
9
|
+
### Docker (Recommended)
|
|
115
10
|
|
|
116
|
-
|
|
11
|
+
Docker is the recommended way to run the AIShelf service. It handles auto-updates and restarts automatically when Docker starts.
|
|
117
12
|
|
|
118
13
|
```bash
|
|
119
|
-
|
|
14
|
+
docker run -d \
|
|
15
|
+
--name aishelf-service \
|
|
16
|
+
--restart=unless-stopped \
|
|
17
|
+
-p 5314:5314 \
|
|
18
|
+
-v ~/.aishelf:/root/.aishelf \
|
|
19
|
+
aishelf/service:latest
|
|
120
20
|
```
|
|
121
21
|
|
|
122
|
-
|
|
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:
|
|
22
|
+
See [aishelf.dev/docs/installation#docker](https://aishelf.dev/docs/installation#docker) for more details.
|
|
133
23
|
|
|
134
|
-
###
|
|
24
|
+
### npm global install (Beta)
|
|
135
25
|
|
|
136
|
-
|
|
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
|
-
```
|
|
26
|
+
> **Note:** This installation method is currently in beta. Docker is recommended if available.
|
|
168
27
|
|
|
169
|
-
To unload:
|
|
170
28
|
```bash
|
|
171
|
-
|
|
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
|
|
29
|
+
npm install -g @aishelf/service
|
|
30
|
+
aishelf service install
|
|
193
31
|
```
|
|
194
32
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
systemctl --user daemon-reload
|
|
199
|
-
systemctl --user enable aishelf-service
|
|
200
|
-
systemctl --user start aishelf-service
|
|
201
|
-
```
|
|
33
|
+
See [aishelf.dev/docs/installation#npm](https://aishelf.dev/docs/installation#npm) for more details.
|
|
202
34
|
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
systemctl --user status aishelf-service
|
|
206
|
-
```
|
|
35
|
+
## Usage
|
|
207
36
|
|
|
208
|
-
To stop:
|
|
209
37
|
```bash
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
|
38
|
+
aishelf service start # start the service
|
|
39
|
+
aishelf service stop # stop the service
|
|
40
|
+
aishelf service restart # restart the service
|
|
41
|
+
aishelf --version # check version
|
|
42
|
+
aishelf --help # get help
|
|
227
43
|
```
|
|
228
44
|
|
|
229
|
-
|
|
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
|
|
45
|
+
## How it works
|
|
246
46
|
|
|
247
|
-
|
|
47
|
+
Once running, `@aishelf/service` exposes a local HTTP API on `localhost:5314`. AIShelf clients (IDE extensions, browser extensions, etc.) communicate with it to:
|
|
248
48
|
|
|
249
|
-
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
```
|
|
49
|
+
- Authenticate with your GitHub account
|
|
50
|
+
- Connect and sync AIShelf registries
|
|
51
|
+
- Read and manage your shared AI resources locally
|
|
253
52
|
|
|
254
|
-
|
|
53
|
+
You typically don't need to interact with this service directly — it's managed automatically by the AIShelf clients you use.
|
|
255
54
|
|
|
256
|
-
|
|
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
|
|
55
|
+
## API
|
|
272
56
|
|
|
273
|
-
|
|
274
|
-
```bash
|
|
275
|
-
chmod +x /usr/local/lib/node_modules/@aishelf/service/dist/cli.js
|
|
276
|
-
```
|
|
57
|
+
API documentation coming soon. Visit [aishelf.dev](https://aishelf.dev) for updates.
|
|
277
58
|
|
|
278
59
|
## License
|
|
279
60
|
|