@jelou/cli 0.1.1 → 0.2.3
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 +60 -183
- package/bin/jelou +30 -8
- package/package.json +8 -5
- package/scripts/postinstall.js +0 -87
package/README.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# @jelou/cli
|
|
2
2
|
|
|
3
|
-
Command-line tool for
|
|
4
|
-
|
|
5
|
-
edge.
|
|
3
|
+
Command-line tool for [Jelou Functions](https://jelou.ai) — serverless
|
|
4
|
+
TypeScript functions on the edge.
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
One `define()` call gives you:
|
|
7
|
+
|
|
8
|
+
- An **HTTP endpoint** with Zod validation and CORS
|
|
9
|
+
- An **MCP tool** discoverable by AI agents
|
|
10
|
+
- **Cron schedules** for recurring tasks
|
|
11
|
+
|
|
12
|
+
Use it to build webhook handlers, chatbot integrations, scheduled cleanups, API
|
|
13
|
+
proxies, and AI agent tools.
|
|
13
14
|
|
|
14
15
|
## Install
|
|
15
16
|
|
|
@@ -24,212 +25,88 @@ npx @jelou/cli deploy
|
|
|
24
25
|
deno install -A -n jelou jsr:@jelou/cli
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## Authentication
|
|
28
|
+
Verify the installation:
|
|
30
29
|
|
|
31
30
|
```bash
|
|
32
|
-
jelou
|
|
33
|
-
# Paste your access token (starts with jfn_pat_)
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Or set the `JELOU_TOKEN` environment variable to skip interactive login:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
export JELOU_TOKEN=jfn_pat_your_token_here
|
|
40
|
-
jelou functions list
|
|
31
|
+
jelou --version
|
|
41
32
|
```
|
|
42
33
|
|
|
43
|
-
| Command | Description |
|
|
44
|
-
| -------------- | -------------------------------- |
|
|
45
|
-
| `jelou login` | Save access token to `~/.jelou/` |
|
|
46
|
-
| `jelou logout` | Remove stored credentials |
|
|
47
|
-
| `jelou whoami` | Show current identity and scopes |
|
|
48
|
-
|
|
49
34
|
## Quick Start
|
|
50
35
|
|
|
51
36
|
```bash
|
|
37
|
+
# Authenticate
|
|
38
|
+
jelou login
|
|
39
|
+
|
|
40
|
+
# Create a new function
|
|
52
41
|
mkdir my-function && cd my-function
|
|
53
42
|
jelou init
|
|
54
|
-
# Creates index.ts, jelou.json, .env, .gitignore
|
|
55
43
|
|
|
44
|
+
# Start local dev server with hot reload
|
|
56
45
|
jelou dev
|
|
57
|
-
#
|
|
46
|
+
# → http://localhost:3000
|
|
58
47
|
|
|
48
|
+
# Deploy to production
|
|
59
49
|
jelou deploy
|
|
60
|
-
#
|
|
50
|
+
# → https://my-function.fn.jelou.ai
|
|
61
51
|
```
|
|
62
52
|
|
|
63
53
|
## Commands
|
|
64
54
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
| `jelou
|
|
70
|
-
| `jelou
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
| -------------------------------------- | ------------------------------- |
|
|
84
|
-
| `jelou deploy` | Deploy current directory |
|
|
85
|
-
| `jelou rollback [slug] [deploymentId]` | Rollback to previous deployment |
|
|
86
|
-
|
|
87
|
-
**`jelou deploy` options:**
|
|
88
|
-
|
|
89
|
-
| Flag | Description |
|
|
90
|
-
| -------------- | ------------------------ |
|
|
91
|
-
| `--no-confirm` | Skip confirmation prompt |
|
|
92
|
-
| `--follow, -f` | Tail logs after deploy |
|
|
93
|
-
|
|
94
|
-
### Functions
|
|
95
|
-
|
|
96
|
-
| Command | Description |
|
|
97
|
-
| ------------------------ | --------------------- |
|
|
98
|
-
| `jelou functions list` | List all functions |
|
|
99
|
-
| `jelou functions info` | Show function details |
|
|
100
|
-
| `jelou functions create` | Create a new function |
|
|
101
|
-
| `jelou functions delete` | Delete a function |
|
|
102
|
-
|
|
103
|
-
### Secrets
|
|
104
|
-
|
|
105
|
-
| Command | Description |
|
|
106
|
-
| ----------------------------------------- | ---------------- |
|
|
107
|
-
| `jelou secrets list [slug]` | List secret keys |
|
|
108
|
-
| `jelou secrets set [slug] [...KEY=VALUE]` | Set secrets |
|
|
109
|
-
| `jelou secrets delete <slug> <key>` | Delete a secret |
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# Inline
|
|
113
|
-
jelou secrets set my-fn API_KEY=sk-123 DB_URL=postgres://...
|
|
114
|
-
|
|
115
|
-
# From file
|
|
116
|
-
jelou secrets set my-fn --from-env .env.production
|
|
117
|
-
|
|
118
|
-
# Interactive
|
|
119
|
-
jelou secrets set my-fn
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Tokens
|
|
123
|
-
|
|
124
|
-
| Command | Description |
|
|
125
|
-
| -------------------------- | ----------------------------------- |
|
|
126
|
-
| `jelou tokens list` | List all PAT tokens |
|
|
127
|
-
| `jelou tokens create` | Create a new token (admin required) |
|
|
128
|
-
| `jelou tokens revoke <id>` | Revoke a token |
|
|
129
|
-
|
|
130
|
-
### Monitoring
|
|
131
|
-
|
|
132
|
-
| Command | Description |
|
|
133
|
-
| ----------------------------- | ---------------------- |
|
|
134
|
-
| `jelou logs [slug]` | Stream live logs |
|
|
135
|
-
| `jelou logs [slug] --history` | Fetch historical logs |
|
|
136
|
-
| `jelou cron list [slug]` | List cron schedules |
|
|
137
|
-
| `jelou analytics` | View company analytics |
|
|
55
|
+
| Group | Command | Description |
|
|
56
|
+
| ------------ | ----------------- | ----------------------------------- |
|
|
57
|
+
| **Auth** | `jelou login` | Authenticate with your access token |
|
|
58
|
+
| | `jelou logout` | Remove stored credentials |
|
|
59
|
+
| | `jelou whoami` | Show current identity and scopes |
|
|
60
|
+
| **Workflow** | `jelou init` | Scaffold a new function project |
|
|
61
|
+
| | `jelou dev` | Local dev server with hot reload |
|
|
62
|
+
| | `jelou deploy` | Deploy to production |
|
|
63
|
+
| | `jelou rollback` | Roll back to a previous deployment |
|
|
64
|
+
| | `jelou logs` | Stream or fetch function logs |
|
|
65
|
+
| **Manage** | `jelou functions` | List, create, delete functions |
|
|
66
|
+
| | `jelou secrets` | Manage environment secrets |
|
|
67
|
+
| | `jelou tokens` | Manage access tokens |
|
|
68
|
+
| | `jelou cron` | View cron schedules |
|
|
69
|
+
| | `jelou analytics` | View request/latency metrics |
|
|
70
|
+
| **Setup** | `jelou skill` | Install Jelou Functions agent skill |
|
|
71
|
+
|
|
72
|
+
Run `jelou <command> --help` for flags and usage details.
|
|
138
73
|
|
|
139
74
|
## CI / Non-Interactive Mode
|
|
140
75
|
|
|
141
|
-
Every command works in CI pipelines
|
|
142
|
-
|
|
143
|
-
### Global Flags
|
|
144
|
-
|
|
145
|
-
| Flag | Description |
|
|
146
|
-
| ------------ | -------------------------------- |
|
|
147
|
-
| `--no-input` | Disable all interactive prompts |
|
|
148
|
-
| `--json` | Output structured JSON to stdout |
|
|
149
|
-
|
|
150
|
-
Non-interactive mode is **auto-detected** when:
|
|
151
|
-
|
|
152
|
-
- `CI=true` environment variable is set (GitHub Actions, GitLab CI, etc.)
|
|
153
|
-
- `JELOU_NO_INPUT=1` is set
|
|
154
|
-
- stdin is not a TTY (piped input)
|
|
155
|
-
|
|
156
|
-
### JSON Output
|
|
157
|
-
|
|
158
|
-
All data commands support `--json`. Output format: `{ "ok": true, "data": ... }`
|
|
76
|
+
Every command works headlessly in CI pipelines.
|
|
159
77
|
|
|
160
78
|
```bash
|
|
161
|
-
|
|
162
|
-
jelou whoami --json | jq '.data.scopes'
|
|
163
|
-
jelou deploy --no-confirm --json | jq '.data.url'
|
|
164
|
-
```
|
|
79
|
+
export JELOU_TOKEN=jfn_pat_your_token_here
|
|
165
80
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
| Command | Flags |
|
|
169
|
-
| ------------------ | ---------------------------------------------- |
|
|
170
|
-
| `login` | `--token <token>` |
|
|
171
|
-
| `init` | `--slug`, `--description`, `--mode`, `--force` |
|
|
172
|
-
| `functions create` | `--slug`, `--name`, `--description` |
|
|
173
|
-
| `functions delete` | `--yes, -y` |
|
|
174
|
-
| `tokens create` | `--name`, `--scopes` (comma-separated) |
|
|
175
|
-
| `tokens revoke` | `--yes, -y` |
|
|
176
|
-
| `deploy` | `--no-confirm` |
|
|
177
|
-
|
|
178
|
-
### GitHub Actions Example
|
|
179
|
-
|
|
180
|
-
```yaml
|
|
181
|
-
- name: Deploy function
|
|
182
|
-
env:
|
|
183
|
-
JELOU_TOKEN: ${{ secrets.JELOU_TOKEN }}
|
|
184
|
-
run: |
|
|
185
|
-
npx @jelou/cli secrets set my-fn API_KEY=${{ secrets.API_KEY }}
|
|
186
|
-
npx @jelou/cli deploy --no-confirm --json | jq '.data.url'
|
|
81
|
+
jelou deploy --no-confirm --json | jq '.data.url'
|
|
187
82
|
```
|
|
188
83
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
export JELOU_TOKEN=jfn_pat_...
|
|
193
|
-
|
|
194
|
-
# Create a token for CI
|
|
195
|
-
jelou tokens create --name ci-deploy --scopes functions:read,functions:deploy --json
|
|
196
|
-
|
|
197
|
-
# Init without prompts
|
|
198
|
-
jelou init --slug my-fn --mode create --force
|
|
84
|
+
- `--no-input` disables all prompts (auto-detected when `CI=true` or stdin is
|
|
85
|
+
not a TTY)
|
|
86
|
+
- `--json` outputs `{ "ok": true, "data": ... }` to stdout
|
|
199
87
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
echo "Deployed to $DEPLOY_URL"
|
|
203
|
-
```
|
|
88
|
+
See the [full CI reference](../../docs/cli.md#ci--non-interactive-mode) for
|
|
89
|
+
per-command flags and GitHub Actions examples.
|
|
204
90
|
|
|
205
91
|
## Configuration
|
|
206
92
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
"function": "my-function",
|
|
214
|
-
"entrypoint": "index.ts"
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### User — `~/.jelou/`
|
|
93
|
+
| Source | Purpose |
|
|
94
|
+
| --------------- | ------------------------------------------ |
|
|
95
|
+
| `jelou.json` | Project config (function slug, entrypoint) |
|
|
96
|
+
| `~/.jelou/` | User credentials and API URL override |
|
|
97
|
+
| `JELOU_TOKEN` | Access token (overrides saved credentials) |
|
|
98
|
+
| `JELOU_API_URL` | API base URL override |
|
|
219
99
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
| `config.json` | API URL override (optional) |
|
|
100
|
+
See the
|
|
101
|
+
[full configuration reference](../../docs/cli.md#configuration-reference) for
|
|
102
|
+
details.
|
|
224
103
|
|
|
225
|
-
|
|
104
|
+
## Documentation
|
|
226
105
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
| `CI` | Auto-enables non-interactive mode when `true` |
|
|
232
|
-
| `JELOU_NO_INPUT` | Disables interactive prompts when `1` |
|
|
106
|
+
- [CLI Reference](../../docs/cli.md) — full command docs, flags, CI usage,
|
|
107
|
+
troubleshooting
|
|
108
|
+
- [SDK Guide](../../docs/functions.md) — `define()` API, context, validation,
|
|
109
|
+
testing
|
|
233
110
|
|
|
234
111
|
## License
|
|
235
112
|
|
package/bin/jelou
CHANGED
|
@@ -1,22 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { existsSync } = require("fs");
|
|
4
|
-
const { join } = require("path");
|
|
5
3
|
const { execFileSync } = require("child_process");
|
|
4
|
+
const { join } = require("path");
|
|
5
|
+
|
|
6
|
+
const PLATFORMS = {
|
|
7
|
+
"darwin-arm64": "@jelou/cli-darwin-arm64",
|
|
8
|
+
"darwin-x64": "@jelou/cli-darwin-x64",
|
|
9
|
+
"linux-x64": "@jelou/cli-linux-x64",
|
|
10
|
+
"linux-arm64": "@jelou/cli-linux-arm64",
|
|
11
|
+
"win32-x64": "@jelou/cli-win32-x64",
|
|
12
|
+
};
|
|
6
13
|
|
|
7
|
-
const
|
|
8
|
-
const
|
|
14
|
+
const key = `${process.platform}-${process.arch}`;
|
|
15
|
+
const pkg = PLATFORMS[key];
|
|
9
16
|
|
|
10
|
-
if (!
|
|
17
|
+
if (!pkg) {
|
|
18
|
+
console.error(
|
|
19
|
+
`@jelou/cli: unsupported platform ${key}\n` +
|
|
20
|
+
`Supported: ${Object.keys(PLATFORMS).join(", ")}\n` +
|
|
21
|
+
`Download manually from https://github.com/JelouLatam/jelou-functions-api/releases`
|
|
22
|
+
);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let binPath;
|
|
27
|
+
try {
|
|
28
|
+
const pkgJson = require.resolve(`${pkg}/package.json`);
|
|
29
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
30
|
+
binPath = join(pkgJson, "..", "bin", `jelou${ext}`);
|
|
31
|
+
} catch {
|
|
11
32
|
console.error(
|
|
12
|
-
|
|
13
|
-
|
|
33
|
+
`@jelou/cli: platform package ${pkg} is not installed.\n\n` +
|
|
34
|
+
`This usually means npm was run with --no-optional. Reinstall with:\n\n` +
|
|
35
|
+
` npm install -g @jelou/cli\n`
|
|
14
36
|
);
|
|
15
37
|
process.exit(1);
|
|
16
38
|
}
|
|
17
39
|
|
|
18
40
|
try {
|
|
19
|
-
execFileSync(
|
|
41
|
+
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
20
42
|
} catch (err) {
|
|
21
43
|
if (err.status !== undefined) process.exit(err.status);
|
|
22
44
|
throw err;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jelou/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Jelou Functions CLI — deploy serverless TypeScript functions to the edge",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -12,15 +12,18 @@
|
|
|
12
12
|
"bin": {
|
|
13
13
|
"jelou": "bin/jelou"
|
|
14
14
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"postinstall": "node scripts/postinstall.js"
|
|
17
|
-
},
|
|
18
15
|
"files": [
|
|
19
16
|
"bin/",
|
|
20
|
-
"scripts/",
|
|
21
17
|
"README.md",
|
|
22
18
|
"LICENSE"
|
|
23
19
|
],
|
|
20
|
+
"optionalDependencies": {
|
|
21
|
+
"@jelou/cli-darwin-arm64": "0.2.3",
|
|
22
|
+
"@jelou/cli-darwin-x64": "0.2.3",
|
|
23
|
+
"@jelou/cli-linux-x64": "0.2.3",
|
|
24
|
+
"@jelou/cli-linux-arm64": "0.2.3",
|
|
25
|
+
"@jelou/cli-win32-x64": "0.2.3"
|
|
26
|
+
},
|
|
24
27
|
"keywords": [
|
|
25
28
|
"jelou",
|
|
26
29
|
"serverless",
|
package/scripts/postinstall.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const { existsSync, mkdirSync, chmodSync, createWriteStream, unlinkSync } = require("fs");
|
|
4
|
-
const { join } = require("path");
|
|
5
|
-
const https = require("https");
|
|
6
|
-
const { execSync } = require("child_process");
|
|
7
|
-
|
|
8
|
-
const pkg = require("../package.json");
|
|
9
|
-
const VERSION = pkg.version;
|
|
10
|
-
const REPO = "JelouLatam/jelou-functions-api";
|
|
11
|
-
const BIN_DIR = join(__dirname, "..", "bin");
|
|
12
|
-
const BIN_PATH = join(BIN_DIR, process.platform === "win32" ? "jelou.exe" : "jelou");
|
|
13
|
-
|
|
14
|
-
const PLATFORM_MAP = {
|
|
15
|
-
"darwin-arm64": "jelou-aarch64-apple-darwin",
|
|
16
|
-
"darwin-x64": "jelou-x86_64-apple-darwin",
|
|
17
|
-
"linux-x64": "jelou-x86_64-unknown-linux-gnu",
|
|
18
|
-
"linux-arm64": "jelou-aarch64-unknown-linux-gnu",
|
|
19
|
-
"win32-x64": "jelou-x86_64-pc-windows-msvc.exe",
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
function getAssetName() {
|
|
23
|
-
const key = `${process.platform}-${process.arch}`;
|
|
24
|
-
const name = PLATFORM_MAP[key];
|
|
25
|
-
if (!name) {
|
|
26
|
-
console.error(
|
|
27
|
-
`@jelou/cli: unsupported platform ${key}.\n` +
|
|
28
|
-
`Supported: ${Object.keys(PLATFORM_MAP).join(", ")}\n` +
|
|
29
|
-
`Install manually from https://github.com/${REPO}/releases`
|
|
30
|
-
);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
return name;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function download(url, dest) {
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
const follow = (url) => {
|
|
39
|
-
https.get(url, { headers: { "User-Agent": "jelou-cli-postinstall" } }, (res) => {
|
|
40
|
-
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
41
|
-
follow(res.headers.location);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (res.statusCode !== 200) {
|
|
45
|
-
reject(new Error(`Download failed: HTTP ${res.statusCode} from ${url}`));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const file = createWriteStream(dest);
|
|
49
|
-
res.pipe(file);
|
|
50
|
-
file.on("finish", () => file.close(resolve));
|
|
51
|
-
file.on("error", (err) => {
|
|
52
|
-
unlinkSync(dest);
|
|
53
|
-
reject(err);
|
|
54
|
-
});
|
|
55
|
-
}).on("error", reject);
|
|
56
|
-
};
|
|
57
|
-
follow(url);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function main() {
|
|
62
|
-
if (process.env.JELOU_CLI_SKIP_INSTALL) {
|
|
63
|
-
console.log("@jelou/cli: skipping binary download (JELOU_CLI_SKIP_INSTALL)");
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const asset = getAssetName();
|
|
68
|
-
const url = `https://github.com/${REPO}/releases/download/cli-v${VERSION}/${asset}`;
|
|
69
|
-
|
|
70
|
-
if (!existsSync(BIN_DIR)) mkdirSync(BIN_DIR, { recursive: true });
|
|
71
|
-
|
|
72
|
-
console.log(`@jelou/cli: downloading ${asset} v${VERSION}...`);
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
await download(url, BIN_PATH);
|
|
76
|
-
if (process.platform !== "win32") {
|
|
77
|
-
chmodSync(BIN_PATH, 0o755);
|
|
78
|
-
}
|
|
79
|
-
console.log("@jelou/cli: installed successfully");
|
|
80
|
-
} catch (err) {
|
|
81
|
-
console.error(`@jelou/cli: failed to download binary — ${err.message}`);
|
|
82
|
-
console.error(`Download manually from: https://github.com/${REPO}/releases/tag/cli-v${VERSION}`);
|
|
83
|
-
process.exit(0);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
main();
|