@jelou/cli 0.1.0 → 0.2.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,25 @@
1
+ Copyright 2026 Jelou Inc. All rights reserved.
2
+
3
+ This software and associated documentation files (the "Software") are the
4
+ proprietary property of Jelou Inc. ("Jelou").
5
+
6
+ Permission is hereby granted to any person who obtains a copy of this Software
7
+ to use the Software solely for the purpose of interacting with services
8
+ provided by Jelou, subject to the following conditions:
9
+
10
+ 1. You may not modify, merge, publish, distribute, sublicense, or sell copies
11
+ of the Software.
12
+
13
+ 2. You may not reverse engineer, decompile, or disassemble the Software.
14
+
15
+ 3. You may not use the Software to build a competing product or service.
16
+
17
+ 4. The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL JELOU
23
+ INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # @jelou/cli
2
+
3
+ Command-line tool for [Jelou Functions](https://jelou.ai) — serverless
4
+ TypeScript functions on the edge.
5
+
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.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ # npm (recommended)
19
+ npm install -g @jelou/cli
20
+
21
+ # npx (no install)
22
+ npx @jelou/cli deploy
23
+
24
+ # Deno
25
+ deno install -A -n jelou jsr:@jelou/cli
26
+ ```
27
+
28
+ Verify the installation:
29
+
30
+ ```bash
31
+ jelou --version
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ```bash
37
+ # Authenticate
38
+ jelou login
39
+
40
+ # Create a new function
41
+ mkdir my-function && cd my-function
42
+ jelou init
43
+
44
+ # Start local dev server with hot reload
45
+ jelou dev
46
+ # → http://localhost:3000
47
+
48
+ # Deploy to production
49
+ jelou deploy
50
+ # → https://my-function.fn.jelou.ai
51
+ ```
52
+
53
+ ## Commands
54
+
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.
73
+
74
+ ## CI / Non-Interactive Mode
75
+
76
+ Every command works headlessly in CI pipelines.
77
+
78
+ ```bash
79
+ export JELOU_TOKEN=jfn_pat_your_token_here
80
+
81
+ jelou deploy --no-confirm --json | jq '.data.url'
82
+ ```
83
+
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
87
+
88
+ See the [full CI reference](../../docs/cli.md#ci--non-interactive-mode) for
89
+ per-command flags and GitHub Actions examples.
90
+
91
+ ## Configuration
92
+
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 |
99
+
100
+ See the
101
+ [full configuration reference](../../docs/cli.md#configuration-reference) for
102
+ details.
103
+
104
+ ## Documentation
105
+
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
110
+
111
+ ## License
112
+
113
+ Copyright 2026 Jelou Inc. All rights reserved.
114
+
115
+ See [LICENSE](./LICENSE) for details.
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 ext = process.platform === "win32" ? ".exe" : "";
8
- const bin = join(__dirname, `jelou${ext}`);
14
+ const key = `${process.platform}-${process.arch}`;
15
+ const pkg = PLATFORMS[key];
9
16
 
10
- if (!existsSync(bin)) {
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
- "jelou binary not found. Try reinstalling:\n\n" +
13
- " npm install -g @jelou/cli\n"
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(bin, process.argv.slice(2), { stdio: "inherit" });
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.1.0",
3
+ "version": "0.2.0",
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.0",
22
+ "@jelou/cli-darwin-x64": "0.2.0",
23
+ "@jelou/cli-linux-x64": "0.2.0",
24
+ "@jelou/cli-linux-arm64": "0.2.0",
25
+ "@jelou/cli-win32-x64": "0.2.0"
26
+ },
24
27
  "keywords": [
25
28
  "jelou",
26
29
  "serverless",
@@ -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();