@lenso/cli 0.1.18
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 +142 -0
- package/bin/lenso.js +54 -0
- package/package.json +31 -0
- package/vendor/darwin-arm64/lenso +0 -0
- package/vendor/darwin-x64/lenso +0 -0
- package/vendor/linux-x64/lenso +0 -0
- package/vendor/win32-x64/lenso.exe +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# lenso-cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for the Lenso backend framework.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g @lenso/cli
|
|
9
|
+
# or
|
|
10
|
+
cargo install lenso-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Scaffold a host application
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
lenso host init my-app
|
|
17
|
+
cd my-app
|
|
18
|
+
cp .env.example .env
|
|
19
|
+
lenso serve
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The package name defaults to the target directory name and can be overridden with
|
|
23
|
+
`--name`. Pass `--force` to scaffold into a non-empty directory.
|
|
24
|
+
Release builds of `lenso-cli` also copy the bundled Runtime Console into the
|
|
25
|
+
new project, so the API serves it at `/console` without requiring Node.js or
|
|
26
|
+
pnpm in the host application.
|
|
27
|
+
|
|
28
|
+
Update the hosted console later by upgrading `lenso-cli` and running:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
lenso host update-console
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The generated host depends on the Git-pinned `lenso` crate with the `host`
|
|
35
|
+
feature, which is the current narrow host API for booting API, worker, and
|
|
36
|
+
migration entrypoints. See
|
|
37
|
+
[`docs/architecture/framework-public-surface.md`](https://github.com/LioRael/lenso/blob/main/docs/architecture/framework-public-surface.md)
|
|
38
|
+
for the host-facade roadmap.
|
|
39
|
+
|
|
40
|
+
`lenso serve` is a local development wrapper for the generated host. It starts
|
|
41
|
+
the template Postgres service, runs migrations, then keeps the API and worker
|
|
42
|
+
running until Ctrl-C. New hosts run them in one local process; pass
|
|
43
|
+
`--separate-worker` when you want two child processes. Use `--skip-db` or
|
|
44
|
+
`--skip-migrate` when you already have those steps covered.
|
|
45
|
+
|
|
46
|
+
## Scaffold a module
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
lenso module create billing
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Add `--with-console` when the linked module should also get a Runtime Console
|
|
53
|
+
workspace package:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
lenso module create billing --with-console
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For a standalone remote package:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
lenso module create billing --remote --output-dir ../module-packages
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The Runtime Console package generator is available directly as:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
lenso console-package create billing
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Install a module
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
lenso module install https://example.com/lenso/module/v1/manifest
|
|
75
|
+
lenso module install ./lenso.module.json
|
|
76
|
+
lenso module install auth
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`module install` reads `source` from the module descriptor when one is present.
|
|
80
|
+
Remote modules update `REMOTE_MODULES`, copy declared Runtime Console bundles to
|
|
81
|
+
`.lenso/console/extensions`, update `.lenso/console/extensions/registry.json`,
|
|
82
|
+
and record `.lenso/module-installs.json` in one step. Linked modules update the
|
|
83
|
+
host `Cargo.toml`, `src/lib.rs`, `.env` toggle, and the same install receipt
|
|
84
|
+
from the descriptor's `linked` section. `module add` remains a compatibility
|
|
85
|
+
alias for remote installs.
|
|
86
|
+
|
|
87
|
+
Install descriptor profiles let a module expose optional setup without baking
|
|
88
|
+
module-specific choices into the CLI. For Redis-backed auth sessions:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
lenso module install auth --profile redis-session-cache
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The `auth` descriptor applies that profile by enabling the
|
|
95
|
+
`lenso-module-auth` dependency's `redis` Cargo feature, writing
|
|
96
|
+
`REDIS_URL=redis://localhost:6379/0` to `.env`, and recording
|
|
97
|
+
`auth.session_cache=redis` in `.lenso/runtime-config-defaults.json`. Provide a
|
|
98
|
+
Redis service separately; the starter Docker Compose file only starts Postgres
|
|
99
|
+
by default.
|
|
100
|
+
|
|
101
|
+
Use `--no-console-extension` when you want to skip Runtime Console extension
|
|
102
|
+
registration.
|
|
103
|
+
|
|
104
|
+
Remote manifests may also declare `install.env` values and `install.commands`.
|
|
105
|
+
Env values are written to `.env`; commands are run only when you pass:
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
lenso module install https://example.com/lenso/module/v1/manifest --run-install-commands
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
For long-running remote module backends, declare `install.services`. These are
|
|
112
|
+
stored in `.lenso/module-services.json` and started before the host loads remote
|
|
113
|
+
modules on API/worker startup. Services started by the host are tracked with
|
|
114
|
+
`.lock`/`.pid` files and stopped when the owning API/worker process exits;
|
|
115
|
+
services that are already ready before startup are treated as external and are
|
|
116
|
+
not stopped by the host.
|
|
117
|
+
|
|
118
|
+
Diagnose installed remote-module service state with:
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
lenso module doctor
|
|
122
|
+
lenso module doctor billing
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The doctor reads `REMOTE_MODULES` and `.lenso/module-services.json`, checks
|
|
126
|
+
service `readyUrl` endpoints, and points to stale `.lock`/`.pid` files when a
|
|
127
|
+
host-started service did not become ready.
|
|
128
|
+
|
|
129
|
+
Remove the local remote-module source, install receipt, service state, Runtime
|
|
130
|
+
Console extension registry entry, and copied bundle files with:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
lenso module uninstall billing
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Use `--source linked` only when you need to force the loading source. Prefer
|
|
137
|
+
descriptors with a `source` field for new installs.
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
lenso module install auth --source linked
|
|
141
|
+
lenso module uninstall auth --source linked
|
|
142
|
+
```
|
package/bin/lenso.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { spawn } = require('node:child_process');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
|
|
7
|
+
function platformTag(platform = process.platform, arch = process.arch) {
|
|
8
|
+
const platforms = new Set(['darwin', 'linux', 'win32']);
|
|
9
|
+
const arches = new Set(['arm64', 'x64']);
|
|
10
|
+
if (!platforms.has(platform) || !arches.has(arch)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return `${platform}-${arch}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function binaryPath(baseDir = path.join(__dirname, '..'), platform = process.platform, arch = process.arch) {
|
|
17
|
+
const tag = platformTag(platform, arch);
|
|
18
|
+
if (!tag) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const exe = platform === 'win32' ? 'lenso.exe' : 'lenso';
|
|
22
|
+
return path.join(baseDir, 'vendor', tag, exe);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function run() {
|
|
26
|
+
const exe = binaryPath();
|
|
27
|
+
if (!exe) {
|
|
28
|
+
console.error(`lenso: unsupported platform ${process.platform}/${process.arch}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const child = spawn(exe, process.argv.slice(2), { stdio: 'inherit' });
|
|
33
|
+
child.on('error', (error) => {
|
|
34
|
+
if (error.code === 'ENOENT') {
|
|
35
|
+
console.error(`lenso: bundled binary is missing for ${process.platform}/${process.arch}`);
|
|
36
|
+
} else {
|
|
37
|
+
console.error(`lenso: ${error.message}`);
|
|
38
|
+
}
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|
|
41
|
+
child.on('exit', (code, signal) => {
|
|
42
|
+
if (signal) {
|
|
43
|
+
process.kill(process.pid, signal);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
process.exit(code ?? 1);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (require.main === module) {
|
|
51
|
+
run();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = { binaryPath, platformTag };
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lenso/cli",
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"description": "Lenso command-line interface for scaffolding and operating Lenso backend projects.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/LioRael/lenso-cli",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/LioRael/lenso-cli.git"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"lenso": "bin/lenso.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin",
|
|
16
|
+
"vendor"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"check:npm-publish": "node scripts/check-npm-publish.mjs",
|
|
20
|
+
"check:npm-shim": "node scripts/check-npm-shim.mjs",
|
|
21
|
+
"package:npm": "node scripts/package-npm.mjs",
|
|
22
|
+
"prepack": "node scripts/package-npm.mjs",
|
|
23
|
+
"prepublishOnly": "node scripts/check-npm-publish.mjs"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|