@magpiecloud/mags 1.8.13 → 1.8.15
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 +95 -378
- package/bin/mags.js +196 -104
- package/index.js +6 -52
- package/package.json +22 -4
- package/API.md +0 -388
- package/Mags-API.postman_collection.json +0 -374
- package/QUICKSTART.md +0 -295
- package/deploy-page.sh +0 -171
- package/mags +0 -0
- package/mags.sh +0 -270
- package/nodejs/README.md +0 -197
- package/nodejs/bin/mags.js +0 -1146
- package/nodejs/index.js +0 -642
- package/nodejs/package.json +0 -42
- package/python/INTEGRATION.md +0 -800
- package/python/README.md +0 -161
- package/python/dist/magpie_mags-1.3.5-py3-none-any.whl +0 -0
- package/python/dist/magpie_mags-1.3.5.tar.gz +0 -0
- package/python/examples/demo.py +0 -181
- package/python/pyproject.toml +0 -39
- package/python/src/magpie_mags.egg-info/PKG-INFO +0 -182
- package/python/src/magpie_mags.egg-info/SOURCES.txt +0 -9
- package/python/src/magpie_mags.egg-info/dependency_links.txt +0 -1
- package/python/src/magpie_mags.egg-info/requires.txt +0 -1
- package/python/src/magpie_mags.egg-info/top_level.txt +0 -1
- package/python/src/mags/__init__.py +0 -6
- package/python/src/mags/client.py +0 -573
- package/python/test_sdk.py +0 -78
- package/skill.md +0 -153
- package/website/api.html +0 -1095
- package/website/claude-skill.html +0 -481
- package/website/cookbook/hn-marketing.html +0 -410
- package/website/cookbook/hn-marketing.sh +0 -42
- package/website/cookbook.html +0 -282
- package/website/env.js +0 -4
- package/website/index.html +0 -801
- package/website/llms.txt +0 -334
- package/website/login.html +0 -108
- package/website/mags.md +0 -210
- package/website/script.js +0 -453
- package/website/styles.css +0 -908
- package/website/tokens.html +0 -169
- package/website/usage.html +0 -185
package/website/cookbook.html
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>Mags Cookbook</title>
|
|
7
|
-
<meta
|
|
8
|
-
name="description"
|
|
9
|
-
content="Practical Mags recipes for running scripts, building workspaces, and exposing services."
|
|
10
|
-
/>
|
|
11
|
-
<meta name="api-base" content="https://api.magpiecloud.com" />
|
|
12
|
-
<meta name="auth-base" content="https://api.magpiecloud.com" />
|
|
13
|
-
<link rel="stylesheet" href="styles.css?v=6" />
|
|
14
|
-
<script src="env.js"></script>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<div class="backdrop"></div>
|
|
18
|
-
|
|
19
|
-
<header class="site-header">
|
|
20
|
-
<div class="container nav">
|
|
21
|
-
<div class="brand">
|
|
22
|
-
<span class="logo">Mags</span>
|
|
23
|
-
<span class="tag">Cookbook</span>
|
|
24
|
-
</div>
|
|
25
|
-
<nav class="nav-links">
|
|
26
|
-
<a href="index.html">Home</a>
|
|
27
|
-
<a href="index.html#quickstart">Docs</a>
|
|
28
|
-
<a href="api.html">API</a>
|
|
29
|
-
<a href="claude-skill.html">Claude Skill</a>
|
|
30
|
-
<a href="https://discord.gg/3avpC2nS" target="_blank" rel="noreferrer">Discord</a>
|
|
31
|
-
<a href="login.html">Login</a>
|
|
32
|
-
</nav>
|
|
33
|
-
<div class="nav-cta">
|
|
34
|
-
<a class="button ghost" href="index.html#quickstart">Get started</a>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</header>
|
|
38
|
-
|
|
39
|
-
<main>
|
|
40
|
-
<section class="hero">
|
|
41
|
-
<div class="container hero-grid">
|
|
42
|
-
<div class="hero-copy">
|
|
43
|
-
<span class="pill">Recipes</span>
|
|
44
|
-
<h1>Hands-on workflows for developers and hobbyists.</h1>
|
|
45
|
-
<p class="lead">
|
|
46
|
-
Copy these recipes to bootstrap a new workspace, run tests, or expose a
|
|
47
|
-
service. Each example is built around real Mags commands.
|
|
48
|
-
</p>
|
|
49
|
-
<div class="hero-actions">
|
|
50
|
-
<a class="button" href="#recipes">Browse recipes</a>
|
|
51
|
-
<a class="button ghost" href="claude-skill.html">Claude integration</a>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
<div class="hero-card">
|
|
55
|
-
<div class="card-header">
|
|
56
|
-
<span>Starter</span>
|
|
57
|
-
<span class="chip">Workflow</span>
|
|
58
|
-
</div>
|
|
59
|
-
<pre><code>mags new dev-env
|
|
60
|
-
mags ssh dev-env
|
|
61
|
-
|
|
62
|
-
# inside the VM
|
|
63
|
-
apk add git nodejs npm</code></pre>
|
|
64
|
-
<p class="card-note">Create a dev sandbox with one command. Add <code>-p</code> for S3 persistence.</p>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</section>
|
|
68
|
-
|
|
69
|
-
<section class="section" id="recipes">
|
|
70
|
-
<div class="container">
|
|
71
|
-
<div class="section-title">
|
|
72
|
-
<p>Cookbook</p>
|
|
73
|
-
<h2>Recipes you can reuse today.</h2>
|
|
74
|
-
</div>
|
|
75
|
-
<div class="recipe-list">
|
|
76
|
-
<article class="recipe-item" data-reveal>
|
|
77
|
-
<div class="recipe-header">
|
|
78
|
-
<h3>Quick script run</h3>
|
|
79
|
-
<span class="pill">Starter</span>
|
|
80
|
-
</div>
|
|
81
|
-
<pre><code>mags run 'echo Hello World'</code></pre>
|
|
82
|
-
</article>
|
|
83
|
-
<article class="recipe-item" data-reveal>
|
|
84
|
-
<div class="recipe-header">
|
|
85
|
-
<h3>Persistent Python workspace</h3>
|
|
86
|
-
<span class="pill">Workspace</span>
|
|
87
|
-
</div>
|
|
88
|
-
<pre><code>mags run -w ml-project \
|
|
89
|
-
'apk add python3 py3-pip && pip install numpy pandas'
|
|
90
|
-
|
|
91
|
-
mags run -w ml-project \
|
|
92
|
-
'python3 train.py'</code></pre>
|
|
93
|
-
</article>
|
|
94
|
-
<article class="recipe-item" data-reveal>
|
|
95
|
-
<div class="recipe-header">
|
|
96
|
-
<h3>Run tests with cached deps</h3>
|
|
97
|
-
<span class="pill">CI</span>
|
|
98
|
-
</div>
|
|
99
|
-
<pre><code>mags run -w myapp 'npm ci'
|
|
100
|
-
|
|
101
|
-
mags run -w myapp 'npm test'</code></pre>
|
|
102
|
-
</article>
|
|
103
|
-
<article class="recipe-item" data-reveal>
|
|
104
|
-
<div class="recipe-header">
|
|
105
|
-
<h3>Expose a simple web server</h3>
|
|
106
|
-
<span class="pill">URL</span>
|
|
107
|
-
</div>
|
|
108
|
-
<pre><code>mags run -p --url \
|
|
109
|
-
'python3 -m http.server 8080'</code></pre>
|
|
110
|
-
<p class="label">Remember: your app should listen on the same port.</p>
|
|
111
|
-
</article>
|
|
112
|
-
<article class="recipe-item" data-reveal>
|
|
113
|
-
<div class="recipe-header">
|
|
114
|
-
<h3>Node.js app with startup command</h3>
|
|
115
|
-
<span class="pill">Persistent</span>
|
|
116
|
-
</div>
|
|
117
|
-
<pre><code>mags run -w myapp -p --url --port 3000 \
|
|
118
|
-
--startup-command 'npm start' \
|
|
119
|
-
'npm install && npm start'</code></pre>
|
|
120
|
-
</article>
|
|
121
|
-
<article class="recipe-item" data-reveal>
|
|
122
|
-
<div class="recipe-header">
|
|
123
|
-
<h3>Upload files and run</h3>
|
|
124
|
-
<span class="pill">File</span>
|
|
125
|
-
</div>
|
|
126
|
-
<pre><code># Upload a script and a data file, then run
|
|
127
|
-
mags run -f analyze.py -f data.csv \
|
|
128
|
-
'python3 analyze.py'
|
|
129
|
-
|
|
130
|
-
# Upload into a workspace (files persist)
|
|
131
|
-
mags run -w analytics -f analyze.py -f data.csv \
|
|
132
|
-
'cp *.py *.csv /root/ && python3 /root/analyze.py'</code></pre>
|
|
133
|
-
<p class="label">Files land in <code>/root/</code> before your script runs.</p>
|
|
134
|
-
</article>
|
|
135
|
-
<article class="recipe-item" data-reveal>
|
|
136
|
-
<div class="recipe-header">
|
|
137
|
-
<h3>Ephemeral run (fastest)</h3>
|
|
138
|
-
<span class="pill">Speed</span>
|
|
139
|
-
</div>
|
|
140
|
-
<pre><code>mags run -e 'uname -a && df -h'</code></pre>
|
|
141
|
-
<p class="label">No workspace sync. Best for quick one-off commands.</p>
|
|
142
|
-
</article>
|
|
143
|
-
<article class="recipe-item" data-reveal>
|
|
144
|
-
<div class="recipe-header">
|
|
145
|
-
<h3>Manage cron jobs</h3>
|
|
146
|
-
<span class="pill">Cron</span>
|
|
147
|
-
</div>
|
|
148
|
-
<pre><code># Schedule a health check every 5 minutes
|
|
149
|
-
mags cron add --name "health-check" \
|
|
150
|
-
--schedule "*/5 * * * *" -w monitors \
|
|
151
|
-
'curl -sf https://myapp.com/health || echo FAIL >> /root/alerts.log'
|
|
152
|
-
|
|
153
|
-
# List all cron jobs
|
|
154
|
-
mags cron list
|
|
155
|
-
|
|
156
|
-
# Disable / enable / remove
|
|
157
|
-
mags cron disable <id>
|
|
158
|
-
mags cron enable <id>
|
|
159
|
-
mags cron remove <id></code></pre>
|
|
160
|
-
</article>
|
|
161
|
-
<article class="recipe-item" data-reveal>
|
|
162
|
-
<div class="recipe-header">
|
|
163
|
-
<h3>Inspect job output</h3>
|
|
164
|
-
<span class="pill">Debug</span>
|
|
165
|
-
</div>
|
|
166
|
-
<pre><code>mags list
|
|
167
|
-
mags status <job-id>
|
|
168
|
-
mags logs <job-id></code></pre>
|
|
169
|
-
</article>
|
|
170
|
-
<article class="recipe-item" data-reveal>
|
|
171
|
-
<div class="recipe-header">
|
|
172
|
-
<h3>HN Top 10 Digest</h3>
|
|
173
|
-
<span class="pill">Cron</span>
|
|
174
|
-
</div>
|
|
175
|
-
<pre><code># Upload script + install deps (file lands in /root/)
|
|
176
|
-
mags run -f hn-marketing.sh -w hn-digest \
|
|
177
|
-
'chmod +x /root/hn-marketing.sh && apk add -q curl jq'
|
|
178
|
-
|
|
179
|
-
# Run it once (saves to /root/hn-top10.csv)
|
|
180
|
-
mags run -w hn-digest 'HN_CSV=/root/hn-top10.csv sh /root/hn-marketing.sh'
|
|
181
|
-
|
|
182
|
-
# Schedule it (every 2 hours, results append to CSV)
|
|
183
|
-
mags cron add --name "hn-top10" \
|
|
184
|
-
--schedule "0 */2 * * *" -w hn-digest \
|
|
185
|
-
'HN_CSV=/root/hn-top10.csv sh /root/hn-marketing.sh'</code></pre>
|
|
186
|
-
<p class="label">
|
|
187
|
-
<a href="cookbook/hn-marketing.sh" download>Download hn-marketing.sh</a>
|
|
188
|
-
·
|
|
189
|
-
<a href="cookbook/hn-marketing.html">Full recipe + live demo →</a>
|
|
190
|
-
</p>
|
|
191
|
-
</article>
|
|
192
|
-
</div>
|
|
193
|
-
</div>
|
|
194
|
-
</section>
|
|
195
|
-
|
|
196
|
-
<section class="section">
|
|
197
|
-
<div class="container">
|
|
198
|
-
<div class="section-title">
|
|
199
|
-
<p>SDK + API</p>
|
|
200
|
-
<h2>Automate runs from code.</h2>
|
|
201
|
-
</div>
|
|
202
|
-
<div class="grid split">
|
|
203
|
-
<article class="panel" data-reveal>
|
|
204
|
-
<h3>Node.js SDK</h3>
|
|
205
|
-
<pre><code>const Mags = require('@magpiecloud/mags');
|
|
206
|
-
|
|
207
|
-
const mags = new Mags({
|
|
208
|
-
apiToken: process.env.MAGS_API_TOKEN
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
// Run a script
|
|
212
|
-
const result = await mags.runAndWait('echo Hello World');
|
|
213
|
-
console.log(result.logs);
|
|
214
|
-
|
|
215
|
-
// Upload files and run
|
|
216
|
-
const fileIds = await mags.uploadFiles(['script.py', 'data.csv']);
|
|
217
|
-
const res = await mags.run('python3 script.py', { fileIds });
|
|
218
|
-
|
|
219
|
-
// Schedule a cron job
|
|
220
|
-
await mags.cronCreate({
|
|
221
|
-
name: 'daily-backup',
|
|
222
|
-
cronExpression: '0 0 * * *',
|
|
223
|
-
script: 'tar czf backup.tar.gz /data',
|
|
224
|
-
workspaceId: 'my-workspace'
|
|
225
|
-
});
|
|
226
|
-
const { cron_jobs } = await mags.cronList();</code></pre>
|
|
227
|
-
</article>
|
|
228
|
-
<article class="panel" data-reveal>
|
|
229
|
-
<h3>REST API</h3>
|
|
230
|
-
<pre><code># Submit a job
|
|
231
|
-
curl -X POST https://api.magpiecloud.com/api/v1/mags-jobs \
|
|
232
|
-
-H "Authorization: Bearer $MAGS_API_TOKEN" \
|
|
233
|
-
-H "Content-Type: application/json" \
|
|
234
|
-
-d '{
|
|
235
|
-
"script": "echo Hello World",
|
|
236
|
-
"type": "inline",
|
|
237
|
-
"workspace_id": "myproject",
|
|
238
|
-
"persistent": true
|
|
239
|
-
}'
|
|
240
|
-
|
|
241
|
-
# Upload a file
|
|
242
|
-
curl -X POST https://api.magpiecloud.com/api/v1/mags-files \
|
|
243
|
-
-H "Authorization: Bearer $MAGS_API_TOKEN" \
|
|
244
|
-
-F "file=@script.py"
|
|
245
|
-
|
|
246
|
-
# Create a cron job
|
|
247
|
-
curl -X POST https://api.magpiecloud.com/api/v1/mags-cron \
|
|
248
|
-
-H "Authorization: Bearer $MAGS_API_TOKEN" \
|
|
249
|
-
-H "Content-Type: application/json" \
|
|
250
|
-
-d '{
|
|
251
|
-
"name": "health-check",
|
|
252
|
-
"cron_expression": "*/5 * * * *",
|
|
253
|
-
"script": "curl -sf https://myapp.com/health"
|
|
254
|
-
}'</code></pre>
|
|
255
|
-
</article>
|
|
256
|
-
</div>
|
|
257
|
-
</div>
|
|
258
|
-
</section>
|
|
259
|
-
</main>
|
|
260
|
-
|
|
261
|
-
<footer class="site-footer">
|
|
262
|
-
<div class="container footer-grid">
|
|
263
|
-
<div>
|
|
264
|
-
<div class="brand">
|
|
265
|
-
<span class="logo">Mags</span>
|
|
266
|
-
<span class="tag">Instant sandboxes and runtime environments</span>
|
|
267
|
-
</div>
|
|
268
|
-
<p>Build, test, and run from clean microVMs whenever you need them.</p>
|
|
269
|
-
</div>
|
|
270
|
-
<div class="footer-links">
|
|
271
|
-
<a href="index.html">Home</a>
|
|
272
|
-
<a href="api.html">API</a>
|
|
273
|
-
<a href="claude-skill.html">Claude Skill</a>
|
|
274
|
-
<a href="https://discord.gg/3avpC2nS" target="_blank" rel="noreferrer">Discord</a>
|
|
275
|
-
<a href="login.html">Login</a>
|
|
276
|
-
</div>
|
|
277
|
-
</div>
|
|
278
|
-
</footer>
|
|
279
|
-
|
|
280
|
-
<script src="script.js?v=7"></script>
|
|
281
|
-
</body>
|
|
282
|
-
</html>
|
package/website/env.js
DELETED