@instafy/cli 0.1.1 → 0.1.2
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 +20 -59
- package/bin/instafy.js +6 -2
- package/dist/index.js +9 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,68 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center"><code>npm i -g @instafy/cli</code></p>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Instafy CLI (Preview)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Run Instafy projects locally and connect them back to Instafy Studio — from any terminal.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- `instafy runtime:status` — report health of the last started runtime.
|
|
9
|
-
- `instafy runtime:stop` — stop the last started runtime.
|
|
10
|
-
- `instafy runtime:token` — mint a runtime access token with agent + origin scopes.
|
|
11
|
-
- `instafy project:init` — create a project via the controller and write `.instafy/project.json` in the chosen folder.
|
|
12
|
-
- `instafy project:list` — list projects for the orgs available to the current controller token.
|
|
13
|
-
- `instafy org:list` — list orgs available to the current controller token.
|
|
14
|
-
|
|
15
|
-
## Quick start
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
# From repo root (assumes runtime-agent is built): pnpm --filter @instafy/cli dev -- --help
|
|
19
|
-
pnpm --filter @instafy/cli dev -- runtime:start \
|
|
20
|
-
--project 00000000-0000-0000-0000-000000000000 \
|
|
21
|
-
--controller-url http://127.0.0.1:8788 \
|
|
22
|
-
--controller-access-token "$CONTROLLER_ACCESS_TOKEN"
|
|
23
|
-
|
|
24
|
-
# Inspect status
|
|
25
|
-
pnpm --filter @instafy/cli dev -- runtime:status
|
|
26
|
-
|
|
27
|
-
# Stop
|
|
28
|
-
pnpm --filter @instafy/cli dev -- runtime:stop
|
|
29
|
-
|
|
30
|
-
# Create a project manifest for the current directory
|
|
31
|
-
pnpm --filter @instafy/cli dev -- project:init --controller-url http://127.0.0.1:8788 --access-token "$SUPABASE_ACCESS_TOKEN"
|
|
7
|
+
## Quickstart
|
|
32
8
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
1. Link a folder to a project:
|
|
10
|
+
- VS Code: install the Instafy extension and run `Instafy: Link Workspace to Project`, or
|
|
11
|
+
- Terminal: `instafy project:init`
|
|
12
|
+
2. Start the runtime: `instafy runtime:start`
|
|
13
|
+
3. Check status / stop:
|
|
14
|
+
- `instafy runtime:status`
|
|
15
|
+
- `instafy runtime:stop`
|
|
36
16
|
|
|
37
|
-
##
|
|
17
|
+
## Common commands
|
|
38
18
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
## Important flags
|
|
45
|
-
|
|
46
|
-
- `--project` / `PROJECT_ID` — project UUID to associate the runtime with (defaults to `.instafy/project.json` if present).
|
|
47
|
-
- `--controller-url` / `CONTROLLER_BASE_URL` — controller base URL (defaults to `http://127.0.0.1:8788`).
|
|
48
|
-
- `--controller-access-token` — user/controller token used to mint the runtime token if `--runtime-token` is not provided.
|
|
49
|
-
- `--supabase-access-token` / `SUPABASE_ACCESS_TOKEN` — Supabase session token the CLI can exchange for controller and runtime tokens when you do not have a controller key handy.
|
|
50
|
-
- `--runtime-token` / `RUNTIME_ACCESS_TOKEN` — pre-minted runtime/origin token to bypass minting.
|
|
51
|
-
- `--origin-id` — optionally fix the origin id (otherwise auto-generated).
|
|
52
|
-
- `--origin-endpoint` — skip tunnels entirely and publish a fixed, reachable origin URL (useful for servers with a stable public endpoint).
|
|
53
|
-
- `--workspace` / `WORKSPACE_DIR` — workspace root for the runtime (default `./.instafy/workspace`).
|
|
54
|
-
- `--provider` / `RUNTIME_PROVIDER` — runtime provider label (defaults to the org in `.instafy/project.json`, otherwise `self-hosted`).
|
|
55
|
-
- `--detach` — background the runtime; pid/log state is recorded under `~/.instafy/cli-runtime-state.json`.
|
|
56
|
-
- `--org-id` — target an existing org when running `project:init` (otherwise the CLI creates or reuses a personal org).
|
|
57
|
-
|
|
58
|
-
## Tunnels (self-hosted)
|
|
59
|
-
|
|
60
|
-
Tunnels are controller-managed: the runtime-agent requests a tunnel assignment from the controller and then launches the appropriate client locally.
|
|
19
|
+
- `instafy runtime:start` — start a local runtime (agent + origin).
|
|
20
|
+
- `instafy runtime:status` — show health of the last started runtime.
|
|
21
|
+
- `instafy runtime:stop` — stop the last started runtime.
|
|
22
|
+
- `instafy tunnel` — request a tunnel and forward a local port.
|
|
23
|
+
- `instafy workspace:mount` — mount project files locally (SSHFS).
|
|
61
24
|
|
|
62
|
-
|
|
25
|
+
Run `instafy --help` for the full command list and options.
|
|
63
26
|
|
|
64
|
-
##
|
|
27
|
+
## Docs
|
|
65
28
|
|
|
66
|
-
-
|
|
67
|
-
- Runtime/origin tokens require the controller to be configured with the Ed25519 signing pair (`RUNTIME_SIGNING_PRIVATE_KEY` / `RUNTIME_SIGNING_PUBLIC_KEY`).
|
|
68
|
-
- Logs for detached runs are written to `~/.instafy/cli-runtime-logs/*`.
|
|
29
|
+
- CLI reference & troubleshooting: https://github.com/instafy-dev/instafy/blob/main/docs/CLI.md
|
package/bin/instafy.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
3
4
|
import kleur from "kleur";
|
|
4
5
|
import { runtimeStart, runtimeStatus, runtimeStop, runtimeToken, mountWorkspace, } from "./runtime.js";
|
|
5
6
|
import { projectInit } from "./project.js";
|
|
6
7
|
import { runTunnelCommand } from "./tunnel.js";
|
|
7
|
-
const program = new Command();
|
|
8
|
+
export const program = new Command();
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
const pkg = require("../package.json");
|
|
8
11
|
program
|
|
9
12
|
.name("instafy")
|
|
10
13
|
.description("Instafy CLI — manage local/self-hosted runtimes")
|
|
11
|
-
.version("0.1.0");
|
|
14
|
+
.version(pkg.version ?? "0.1.0");
|
|
12
15
|
program
|
|
13
16
|
.command("runtime:start")
|
|
14
17
|
.description("Start a local Instafy runtime (agent + origin)")
|
|
@@ -238,8 +241,11 @@ program
|
|
|
238
241
|
process.exit(1);
|
|
239
242
|
}
|
|
240
243
|
});
|
|
244
|
+
export async function runCli(argv = process.argv) {
|
|
245
|
+
await program.parseAsync(argv);
|
|
246
|
+
}
|
|
241
247
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
242
|
-
|
|
248
|
+
void runCli(process.argv);
|
|
243
249
|
}
|
|
244
250
|
// Re-export programmatic APIs for embedders (e.g., VS Code extension).
|
|
245
251
|
export { runtimeStart as startRuntime, runtimeStatus as getRuntimeStatus, runtimeStop as stopRuntime, runtimeToken as mintRuntimeToken, mintRuntimeAccessToken, findProjectManifest, mountWorkspace, } from "./runtime.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instafy/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Run Instafy projects locally, link folders to Studio, and share previews/webhooks via tunnels.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|