mockfactory-cli 0.1.0__tar.gz
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.
- mockfactory_cli-0.1.0/LICENSE +21 -0
- mockfactory_cli-0.1.0/MANIFEST.in +3 -0
- mockfactory_cli-0.1.0/PKG-INFO +362 -0
- mockfactory_cli-0.1.0/README.md +328 -0
- mockfactory_cli-0.1.0/mockfactory_cli/__init__.py +3 -0
- mockfactory_cli-0.1.0/mockfactory_cli/cli.py +378 -0
- mockfactory_cli-0.1.0/mockfactory_cli/client.py +112 -0
- mockfactory_cli-0.1.0/mockfactory_cli/config.py +75 -0
- mockfactory_cli-0.1.0/mockfactory_cli.egg-info/PKG-INFO +362 -0
- mockfactory_cli-0.1.0/mockfactory_cli.egg-info/SOURCES.txt +14 -0
- mockfactory_cli-0.1.0/mockfactory_cli.egg-info/dependency_links.txt +1 -0
- mockfactory_cli-0.1.0/mockfactory_cli.egg-info/entry_points.txt +3 -0
- mockfactory_cli-0.1.0/mockfactory_cli.egg-info/requires.txt +11 -0
- mockfactory_cli-0.1.0/mockfactory_cli.egg-info/top_level.txt +1 -0
- mockfactory_cli-0.1.0/pyproject.toml +63 -0
- mockfactory_cli-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 After Dark Systems
|
|
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.
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mockfactory-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Command-line interface for MockFactory code execution sandbox
|
|
5
|
+
Author-email: After Dark Systems <support@afterdarksystems.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://mockfactory.io
|
|
8
|
+
Project-URL: Documentation, https://github.com/afterdarksystems/mockfactory-cli
|
|
9
|
+
Project-URL: Repository, https://github.com/afterdarksystems/mockfactory-cli
|
|
10
|
+
Project-URL: Issues, https://github.com/afterdarksystems/mockfactory-cli/issues
|
|
11
|
+
Keywords: mockfactory,code-execution,sandbox,cli
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: click>=8.1.0
|
|
24
|
+
Requires-Dist: requests>=2.31.0
|
|
25
|
+
Requires-Dist: rich>=13.0.0
|
|
26
|
+
Requires-Dist: pydantic>=2.0.0
|
|
27
|
+
Requires-Dist: keyring>=24.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# MockFactory CLI
|
|
36
|
+
|
|
37
|
+
Command-line interface for [MockFactory](https://mockfactory.io) - a secure multi-language code execution sandbox.
|
|
38
|
+
|
|
39
|
+
Execute code in isolated Docker containers with comprehensive security controls, directly from your terminal.
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- **Multi-Language Support**: Python, JavaScript, PHP, Perl, Go, Shell, HTML
|
|
44
|
+
- **Secure Execution**: All code runs in isolated containers with no network access
|
|
45
|
+
- **Authentication**: Login to access your account and execution history
|
|
46
|
+
- **Usage Tracking**: Monitor your execution limits and tier status
|
|
47
|
+
- **Beautiful Output**: Rich terminal formatting with syntax highlighting
|
|
48
|
+
- **Easy to Use**: Simple commands for quick code execution
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install mockfactory-cli
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or install from source:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/afterdarksystems/mockfactory-cli.git
|
|
60
|
+
cd mockfactory-cli
|
|
61
|
+
pip install -e .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Quick Start
|
|
65
|
+
|
|
66
|
+
### Execute code inline
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
mockfactory run python -c "print('Hello from MockFactory!')"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Execute a file
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
mockfactory execute script.py
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Auto-detect language from file extension
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
mockfactory execute app.js
|
|
82
|
+
mockfactory execute script.php
|
|
83
|
+
mockfactory execute program.go
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Commands
|
|
87
|
+
|
|
88
|
+
### Authentication
|
|
89
|
+
|
|
90
|
+
#### Sign up for a free account
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
mockfactory signup
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Creates a new account with 10 free executions per day.
|
|
97
|
+
|
|
98
|
+
#### Login to your account
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
mockfactory login
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Check authentication status
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
mockfactory status
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### Logout
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
mockfactory logout
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Code Execution
|
|
117
|
+
|
|
118
|
+
#### Run code inline
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
mockfactory run <language> -c "<code>"
|
|
122
|
+
|
|
123
|
+
# Examples:
|
|
124
|
+
mockfactory run python -c "print('Hello World')"
|
|
125
|
+
mockfactory run javascript -c "console.log('Hello World')"
|
|
126
|
+
mockfactory run php -c "echo 'Hello World';"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### Run code from a file
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
mockfactory run <language> -f <file>
|
|
133
|
+
|
|
134
|
+
# Example:
|
|
135
|
+
mockfactory run python -f script.py
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### Execute a file (auto-detect language)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
mockfactory execute <file>
|
|
142
|
+
|
|
143
|
+
# Examples:
|
|
144
|
+
mockfactory execute script.py # Python
|
|
145
|
+
mockfactory execute app.js # JavaScript
|
|
146
|
+
mockfactory execute program.go # Go
|
|
147
|
+
mockfactory execute script.sh # Shell
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### Set execution timeout
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
mockfactory run python -c "import time; time.sleep(2); print('done')" --timeout 60
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### Raw output mode
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Useful for piping or scripting
|
|
160
|
+
mockfactory run python -c "print('result')" --raw
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Usage & Status
|
|
164
|
+
|
|
165
|
+
#### Check your usage
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
mockfactory usage
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Shows:
|
|
172
|
+
- Current tier (anonymous, free, pro)
|
|
173
|
+
- Executions used
|
|
174
|
+
- Remaining executions
|
|
175
|
+
|
|
176
|
+
#### View configuration
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
mockfactory config show
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Configuration
|
|
183
|
+
|
|
184
|
+
#### Set API URL
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
mockfactory config set api_url https://mockfactory.io
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Set timeout
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
mockfactory config set timeout 60
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Reset to defaults
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
mockfactory config reset
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Supported Languages
|
|
203
|
+
|
|
204
|
+
| Language | Extension | Example |
|
|
205
|
+
|------------|-----------|--------------------------------------|
|
|
206
|
+
| Python | `.py` | `mockfactory execute script.py` |
|
|
207
|
+
| JavaScript | `.js` | `mockfactory execute app.js` |
|
|
208
|
+
| PHP | `.php` | `mockfactory execute script.php` |
|
|
209
|
+
| Perl | `.pl` | `mockfactory execute script.pl` |
|
|
210
|
+
| Go | `.go` | `mockfactory execute program.go` |
|
|
211
|
+
| Shell | `.sh` | `mockfactory execute script.sh` |
|
|
212
|
+
| HTML | `.html` | `mockfactory execute page.html` |
|
|
213
|
+
|
|
214
|
+
## Usage Tiers
|
|
215
|
+
|
|
216
|
+
| Tier | Executions | Price | Features |
|
|
217
|
+
|----------------|------------|-----------|---------------------------|
|
|
218
|
+
| Anonymous | 5/day | Free | No account required |
|
|
219
|
+
| Free Account | 10/day | Free | Execution history |
|
|
220
|
+
| Pro | Unlimited | $9.99/mo | Priority support |
|
|
221
|
+
|
|
222
|
+
Sign up for a free account:
|
|
223
|
+
```bash
|
|
224
|
+
mockfactory signup
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Upgrade to Pro at [mockfactory.io/pricing](https://mockfactory.io/pricing)
|
|
228
|
+
|
|
229
|
+
## Examples
|
|
230
|
+
|
|
231
|
+
### Execute a Python script
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
mockfactory execute hello.py
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Run inline JavaScript
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
mockfactory run javascript -c "const x = [1,2,3]; console.log(x.reduce((a,b) => a+b, 0))"
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Execute with custom timeout
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
mockfactory execute long_running.py --timeout 120
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Check how many runs you have left
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
mockfactory usage
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Pipe output to another command
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
mockfactory run python -c "print('hello')" --raw | grep hello
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Use in shell scripts
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
#!/bin/bash
|
|
265
|
+
result=$(mockfactory run python -c "print(2+2)" --raw)
|
|
266
|
+
echo "The answer is: $result"
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Configuration Files
|
|
270
|
+
|
|
271
|
+
Configuration is stored in `~/.mockfactory/`:
|
|
272
|
+
|
|
273
|
+
- `config.json` - CLI configuration (API URL, timeout, etc.)
|
|
274
|
+
- `token` - Authentication token (automatically managed)
|
|
275
|
+
|
|
276
|
+
## Security
|
|
277
|
+
|
|
278
|
+
- All code executes in isolated Docker containers
|
|
279
|
+
- No network access for sandbox containers
|
|
280
|
+
- Read-only filesystem (except `/tmp`)
|
|
281
|
+
- Resource limits enforced (CPU, memory, time)
|
|
282
|
+
- Runs as unprivileged user (`nobody`)
|
|
283
|
+
|
|
284
|
+
## Troubleshooting
|
|
285
|
+
|
|
286
|
+
### Authentication errors
|
|
287
|
+
|
|
288
|
+
If you get authentication errors, try logging out and back in:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
mockfactory logout
|
|
292
|
+
mockfactory login
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Connection errors
|
|
296
|
+
|
|
297
|
+
Check your API URL configuration:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
mockfactory config show
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Reset to defaults if needed:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
mockfactory config reset
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Rate limiting
|
|
310
|
+
|
|
311
|
+
If you've exceeded your tier's execution limit:
|
|
312
|
+
|
|
313
|
+
1. Wait for the daily reset
|
|
314
|
+
2. Sign up for a free account (10 runs/day)
|
|
315
|
+
3. Upgrade to Pro (unlimited)
|
|
316
|
+
|
|
317
|
+
## Aliases
|
|
318
|
+
|
|
319
|
+
For convenience, you can use the short alias `mf`:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
mf run python -c "print('shorter!')"
|
|
323
|
+
mf execute script.py
|
|
324
|
+
mf status
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Development
|
|
328
|
+
|
|
329
|
+
### Setup development environment
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
git clone https://github.com/afterdarksystems/mockfactory-cli.git
|
|
333
|
+
cd mockfactory-cli
|
|
334
|
+
pip install -e ".[dev]"
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Run tests
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
pytest
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Code formatting
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
black .
|
|
347
|
+
ruff check .
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## Links
|
|
351
|
+
|
|
352
|
+
- Website: [mockfactory.io](https://mockfactory.io)
|
|
353
|
+
- Documentation: [github.com/afterdarksystems/mockfactory-cli](https://github.com/afterdarksystems/mockfactory-cli)
|
|
354
|
+
- Issues: [github.com/afterdarksystems/mockfactory-cli/issues](https://github.com/afterdarksystems/mockfactory-cli/issues)
|
|
355
|
+
|
|
356
|
+
## License
|
|
357
|
+
|
|
358
|
+
MIT License - see LICENSE file for details
|
|
359
|
+
|
|
360
|
+
## Support
|
|
361
|
+
|
|
362
|
+
For support, contact: support@afterdarksystems.com
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# MockFactory CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for [MockFactory](https://mockfactory.io) - a secure multi-language code execution sandbox.
|
|
4
|
+
|
|
5
|
+
Execute code in isolated Docker containers with comprehensive security controls, directly from your terminal.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Multi-Language Support**: Python, JavaScript, PHP, Perl, Go, Shell, HTML
|
|
10
|
+
- **Secure Execution**: All code runs in isolated containers with no network access
|
|
11
|
+
- **Authentication**: Login to access your account and execution history
|
|
12
|
+
- **Usage Tracking**: Monitor your execution limits and tier status
|
|
13
|
+
- **Beautiful Output**: Rich terminal formatting with syntax highlighting
|
|
14
|
+
- **Easy to Use**: Simple commands for quick code execution
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install mockfactory-cli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or install from source:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git clone https://github.com/afterdarksystems/mockfactory-cli.git
|
|
26
|
+
cd mockfactory-cli
|
|
27
|
+
pip install -e .
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Execute code inline
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
mockfactory run python -c "print('Hello from MockFactory!')"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Execute a file
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
mockfactory execute script.py
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Auto-detect language from file extension
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
mockfactory execute app.js
|
|
48
|
+
mockfactory execute script.php
|
|
49
|
+
mockfactory execute program.go
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Commands
|
|
53
|
+
|
|
54
|
+
### Authentication
|
|
55
|
+
|
|
56
|
+
#### Sign up for a free account
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
mockfactory signup
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Creates a new account with 10 free executions per day.
|
|
63
|
+
|
|
64
|
+
#### Login to your account
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
mockfactory login
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Check authentication status
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
mockfactory status
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Logout
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
mockfactory logout
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Code Execution
|
|
83
|
+
|
|
84
|
+
#### Run code inline
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
mockfactory run <language> -c "<code>"
|
|
88
|
+
|
|
89
|
+
# Examples:
|
|
90
|
+
mockfactory run python -c "print('Hello World')"
|
|
91
|
+
mockfactory run javascript -c "console.log('Hello World')"
|
|
92
|
+
mockfactory run php -c "echo 'Hello World';"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Run code from a file
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
mockfactory run <language> -f <file>
|
|
99
|
+
|
|
100
|
+
# Example:
|
|
101
|
+
mockfactory run python -f script.py
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Execute a file (auto-detect language)
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
mockfactory execute <file>
|
|
108
|
+
|
|
109
|
+
# Examples:
|
|
110
|
+
mockfactory execute script.py # Python
|
|
111
|
+
mockfactory execute app.js # JavaScript
|
|
112
|
+
mockfactory execute program.go # Go
|
|
113
|
+
mockfactory execute script.sh # Shell
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### Set execution timeout
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
mockfactory run python -c "import time; time.sleep(2); print('done')" --timeout 60
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Raw output mode
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Useful for piping or scripting
|
|
126
|
+
mockfactory run python -c "print('result')" --raw
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Usage & Status
|
|
130
|
+
|
|
131
|
+
#### Check your usage
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
mockfactory usage
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Shows:
|
|
138
|
+
- Current tier (anonymous, free, pro)
|
|
139
|
+
- Executions used
|
|
140
|
+
- Remaining executions
|
|
141
|
+
|
|
142
|
+
#### View configuration
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
mockfactory config show
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Configuration
|
|
149
|
+
|
|
150
|
+
#### Set API URL
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
mockfactory config set api_url https://mockfactory.io
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### Set timeout
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
mockfactory config set timeout 60
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Reset to defaults
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
mockfactory config reset
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Supported Languages
|
|
169
|
+
|
|
170
|
+
| Language | Extension | Example |
|
|
171
|
+
|------------|-----------|--------------------------------------|
|
|
172
|
+
| Python | `.py` | `mockfactory execute script.py` |
|
|
173
|
+
| JavaScript | `.js` | `mockfactory execute app.js` |
|
|
174
|
+
| PHP | `.php` | `mockfactory execute script.php` |
|
|
175
|
+
| Perl | `.pl` | `mockfactory execute script.pl` |
|
|
176
|
+
| Go | `.go` | `mockfactory execute program.go` |
|
|
177
|
+
| Shell | `.sh` | `mockfactory execute script.sh` |
|
|
178
|
+
| HTML | `.html` | `mockfactory execute page.html` |
|
|
179
|
+
|
|
180
|
+
## Usage Tiers
|
|
181
|
+
|
|
182
|
+
| Tier | Executions | Price | Features |
|
|
183
|
+
|----------------|------------|-----------|---------------------------|
|
|
184
|
+
| Anonymous | 5/day | Free | No account required |
|
|
185
|
+
| Free Account | 10/day | Free | Execution history |
|
|
186
|
+
| Pro | Unlimited | $9.99/mo | Priority support |
|
|
187
|
+
|
|
188
|
+
Sign up for a free account:
|
|
189
|
+
```bash
|
|
190
|
+
mockfactory signup
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Upgrade to Pro at [mockfactory.io/pricing](https://mockfactory.io/pricing)
|
|
194
|
+
|
|
195
|
+
## Examples
|
|
196
|
+
|
|
197
|
+
### Execute a Python script
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
mockfactory execute hello.py
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Run inline JavaScript
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
mockfactory run javascript -c "const x = [1,2,3]; console.log(x.reduce((a,b) => a+b, 0))"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Execute with custom timeout
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
mockfactory execute long_running.py --timeout 120
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Check how many runs you have left
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
mockfactory usage
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Pipe output to another command
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
mockfactory run python -c "print('hello')" --raw | grep hello
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Use in shell scripts
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
#!/bin/bash
|
|
231
|
+
result=$(mockfactory run python -c "print(2+2)" --raw)
|
|
232
|
+
echo "The answer is: $result"
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Configuration Files
|
|
236
|
+
|
|
237
|
+
Configuration is stored in `~/.mockfactory/`:
|
|
238
|
+
|
|
239
|
+
- `config.json` - CLI configuration (API URL, timeout, etc.)
|
|
240
|
+
- `token` - Authentication token (automatically managed)
|
|
241
|
+
|
|
242
|
+
## Security
|
|
243
|
+
|
|
244
|
+
- All code executes in isolated Docker containers
|
|
245
|
+
- No network access for sandbox containers
|
|
246
|
+
- Read-only filesystem (except `/tmp`)
|
|
247
|
+
- Resource limits enforced (CPU, memory, time)
|
|
248
|
+
- Runs as unprivileged user (`nobody`)
|
|
249
|
+
|
|
250
|
+
## Troubleshooting
|
|
251
|
+
|
|
252
|
+
### Authentication errors
|
|
253
|
+
|
|
254
|
+
If you get authentication errors, try logging out and back in:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
mockfactory logout
|
|
258
|
+
mockfactory login
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Connection errors
|
|
262
|
+
|
|
263
|
+
Check your API URL configuration:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
mockfactory config show
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Reset to defaults if needed:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
mockfactory config reset
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Rate limiting
|
|
276
|
+
|
|
277
|
+
If you've exceeded your tier's execution limit:
|
|
278
|
+
|
|
279
|
+
1. Wait for the daily reset
|
|
280
|
+
2. Sign up for a free account (10 runs/day)
|
|
281
|
+
3. Upgrade to Pro (unlimited)
|
|
282
|
+
|
|
283
|
+
## Aliases
|
|
284
|
+
|
|
285
|
+
For convenience, you can use the short alias `mf`:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
mf run python -c "print('shorter!')"
|
|
289
|
+
mf execute script.py
|
|
290
|
+
mf status
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Development
|
|
294
|
+
|
|
295
|
+
### Setup development environment
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
git clone https://github.com/afterdarksystems/mockfactory-cli.git
|
|
299
|
+
cd mockfactory-cli
|
|
300
|
+
pip install -e ".[dev]"
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Run tests
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
pytest
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Code formatting
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
black .
|
|
313
|
+
ruff check .
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Links
|
|
317
|
+
|
|
318
|
+
- Website: [mockfactory.io](https://mockfactory.io)
|
|
319
|
+
- Documentation: [github.com/afterdarksystems/mockfactory-cli](https://github.com/afterdarksystems/mockfactory-cli)
|
|
320
|
+
- Issues: [github.com/afterdarksystems/mockfactory-cli/issues](https://github.com/afterdarksystems/mockfactory-cli/issues)
|
|
321
|
+
|
|
322
|
+
## License
|
|
323
|
+
|
|
324
|
+
MIT License - see LICENSE file for details
|
|
325
|
+
|
|
326
|
+
## Support
|
|
327
|
+
|
|
328
|
+
For support, contact: support@afterdarksystems.com
|