@astrale-os/cli 0.4.0-alpha.13
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/.check-workspace.cjs +40 -0
- package/README.md +151 -0
- package/dist/astrale.js +59749 -0
- package/package.json +90 -0
- package/src/command.ts +40 -0
- package/src/commands/__tests__/admin-instance.test.ts +73 -0
- package/src/commands/__tests__/auth-login.test.ts +178 -0
- package/src/commands/__tests__/auth-token.test.ts +223 -0
- package/src/commands/__tests__/call.test.ts +72 -0
- package/src/commands/__tests__/domain-list.test.ts +74 -0
- package/src/commands/__tests__/help-contract.test.ts +136 -0
- package/src/commands/__tests__/install-identity-override.test.ts +65 -0
- package/src/commands/__tests__/instance-bookmark.test.ts +101 -0
- package/src/commands/__tests__/instance-create-hosts.test.ts +29 -0
- package/src/commands/__tests__/instance-list-rows.test.ts +63 -0
- package/src/commands/__tests__/logs.test.ts +117 -0
- package/src/commands/__tests__/ls.test.ts +25 -0
- package/src/commands/__tests__/setup-plan.test.ts +61 -0
- package/src/commands/admin/status.ts +61 -0
- package/src/commands/admin/use.ts +77 -0
- package/src/commands/auth/login.ts +82 -0
- package/src/commands/auth/logout.ts +50 -0
- package/src/commands/auth/status.ts +86 -0
- package/src/commands/auth/token.ts +162 -0
- package/src/commands/browser.ts +207 -0
- package/src/commands/call.ts +300 -0
- package/src/commands/describe.ts +182 -0
- package/src/commands/domain/install.ts +420 -0
- package/src/commands/domain/list.ts +154 -0
- package/src/commands/domain/publish.ts +155 -0
- package/src/commands/get.ts +60 -0
- package/src/commands/identity/create.ts +26 -0
- package/src/commands/identity/delete.ts +18 -0
- package/src/commands/identity/export.ts +66 -0
- package/src/commands/identity/import.ts +101 -0
- package/src/commands/identity/list.ts +56 -0
- package/src/commands/identity/register.ts +170 -0
- package/src/commands/identity/sync.ts +32 -0
- package/src/commands/identity/unsync.ts +24 -0
- package/src/commands/identity/use.ts +18 -0
- package/src/commands/identity/whoami.ts +34 -0
- package/src/commands/idp/add.ts +150 -0
- package/src/commands/idp/list.ts +57 -0
- package/src/commands/idp/refresh.ts +38 -0
- package/src/commands/idp/remove.ts +36 -0
- package/src/commands/idp/show.ts +29 -0
- package/src/commands/instance/active.ts +64 -0
- package/src/commands/instance/bookmark.ts +72 -0
- package/src/commands/instance/create.ts +69 -0
- package/src/commands/instance/delete.ts +72 -0
- package/src/commands/instance/forget.ts +26 -0
- package/src/commands/instance/list.ts +149 -0
- package/src/commands/instance/status.ts +42 -0
- package/src/commands/instance/use.ts +210 -0
- package/src/commands/logs.ts +347 -0
- package/src/commands/ls.ts +229 -0
- package/src/commands/query.ts +32 -0
- package/src/commands/setup.ts +54 -0
- package/src/commands/status.ts +60 -0
- package/src/commands/studio.ts +401 -0
- package/src/commands/token.ts +77 -0
- package/src/commands/update.ts +267 -0
- package/src/commands/use.ts +87 -0
- package/src/errors.ts +65 -0
- package/src/kernel/__tests__/auth.test.ts +77 -0
- package/src/kernel/__tests__/errors.test.ts +43 -0
- package/src/kernel/__tests__/remote-routing.test.ts +70 -0
- package/src/kernel/auth.ts +234 -0
- package/src/kernel/ca-fetch.ts +119 -0
- package/src/kernel/client.ts +191 -0
- package/src/kernel/errors.ts +280 -0
- package/src/kernel/expand.ts +217 -0
- package/src/kernel/index.ts +14 -0
- package/src/kernel/options.ts +22 -0
- package/src/kernel/remote-routing.ts +88 -0
- package/src/kernel/run.ts +63 -0
- package/src/kernel/types.ts +14 -0
- package/src/lib/__tests__/admin-target.test.ts +112 -0
- package/src/lib/__tests__/binary.test.ts +56 -0
- package/src/lib/__tests__/command-dx.test.ts +58 -0
- package/src/lib/__tests__/concurrency.test.ts +62 -0
- package/src/lib/__tests__/config.test.ts +53 -0
- package/src/lib/__tests__/design.test.ts +99 -0
- package/src/lib/__tests__/domain-identity.test.ts +60 -0
- package/src/lib/__tests__/format.test.ts +22 -0
- package/src/lib/__tests__/fs-atomic.test.ts +104 -0
- package/src/lib/__tests__/identity.test.ts +79 -0
- package/src/lib/__tests__/idp-session.driver.ts +53 -0
- package/src/lib/__tests__/idp-session.test.ts +357 -0
- package/src/lib/__tests__/idp.test.ts +385 -0
- package/src/lib/__tests__/instance-candidates.test.ts +73 -0
- package/src/lib/__tests__/instance-target.test.ts +183 -0
- package/src/lib/__tests__/instance.test.ts +136 -0
- package/src/lib/__tests__/keys.test.ts +129 -0
- package/src/lib/__tests__/local-status.test.ts +202 -0
- package/src/lib/__tests__/output.test.ts +150 -0
- package/src/lib/__tests__/panel.test.ts +40 -0
- package/src/lib/__tests__/port.test.ts +44 -0
- package/src/lib/__tests__/prompt.test.ts +25 -0
- package/src/lib/__tests__/sdk-deps.test.ts +68 -0
- package/src/lib/__tests__/self.test.ts +272 -0
- package/src/lib/__tests__/studio-server-deps.test.ts +74 -0
- package/src/lib/__tests__/table.test.ts +53 -0
- package/src/lib/__tests__/update.test.ts +246 -0
- package/src/lib/__tests__/use-target.test.ts +56 -0
- package/src/lib/__tests__/validation.test.ts +34 -0
- package/src/lib/admin-domain.ts +25 -0
- package/src/lib/admin-instance.ts +26 -0
- package/src/lib/admin-target.ts +217 -0
- package/src/lib/binary.ts +131 -0
- package/src/lib/browser.ts +150 -0
- package/src/lib/command-dx.ts +161 -0
- package/src/lib/concurrency.ts +31 -0
- package/src/lib/config.ts +45 -0
- package/src/lib/domain-identity.ts +49 -0
- package/src/lib/env.ts +49 -0
- package/src/lib/format.ts +4 -0
- package/src/lib/fs-atomic.ts +126 -0
- package/src/lib/identity.ts +256 -0
- package/src/lib/idp-session.ts +134 -0
- package/src/lib/idp.ts +876 -0
- package/src/lib/instance-candidates.ts +49 -0
- package/src/lib/instance-target.ts +182 -0
- package/src/lib/instance.ts +395 -0
- package/src/lib/keys.ts +294 -0
- package/src/lib/local-status.ts +152 -0
- package/src/lib/log.ts +116 -0
- package/src/lib/login-flow.ts +164 -0
- package/src/lib/meta.ts +86 -0
- package/src/lib/output.ts +222 -0
- package/src/lib/panel.ts +61 -0
- package/src/lib/paths.ts +11 -0
- package/src/lib/port.ts +41 -0
- package/src/lib/proc.ts +82 -0
- package/src/lib/prompt.ts +136 -0
- package/src/lib/provision-instance.ts +170 -0
- package/src/lib/sdk-deps.ts +104 -0
- package/src/lib/self.ts +166 -0
- package/src/lib/skills.ts +171 -0
- package/src/lib/table.ts +62 -0
- package/src/lib/update.ts +315 -0
- package/src/lib/use-target.ts +24 -0
- package/src/lib/validation.ts +59 -0
- package/src/program.ts +200 -0
- package/src/registry.ts +59 -0
- package/src/setup/__tests__/util.test.ts +29 -0
- package/src/setup/engine.ts +83 -0
- package/src/setup/render.ts +109 -0
- package/src/setup/steps/admin.ts +78 -0
- package/src/setup/steps/agent-browser.ts +81 -0
- package/src/setup/steps/auth.ts +54 -0
- package/src/setup/steps/domain.ts +68 -0
- package/src/setup/steps/index.ts +18 -0
- package/src/setup/steps/instance.ts +119 -0
- package/src/setup/steps/skills-bridge.ts +70 -0
- package/src/setup/steps/skills.ts +59 -0
- package/src/setup/types.ts +61 -0
- package/src/setup/util.ts +34 -0
- package/src/test-utils.ts +18 -0
- package/studio/client/dist/assets/index-DOwzZAEK.css +1 -0
- package/studio/client/dist/assets/index-wtU0Zxhy.js +183 -0
- package/studio/client/dist/index.html +13 -0
- package/studio/package.json +62 -0
- package/studio/server/agent/ask.ts +68 -0
- package/studio/server/agent/bridge-mcp.ts +182 -0
- package/studio/server/agent/bridge.ts +188 -0
- package/studio/server/agent/claude.ts +666 -0
- package/studio/server/agent/mock.ts +186 -0
- package/studio/server/agent/prompt.ts +202 -0
- package/studio/server/agent/registry.ts +29 -0
- package/studio/server/agent/runner.ts +484 -0
- package/studio/server/agent/schema-map.ts +112 -0
- package/studio/server/agent/types.ts +120 -0
- package/studio/server/api.ts +574 -0
- package/studio/server/cache.ts +138 -0
- package/studio/server/detect.ts +81 -0
- package/studio/server/domain.ts +70 -0
- package/studio/server/index.ts +136 -0
- package/studio/server/introspect/anatomy-extras.ts +398 -0
- package/studio/server/introspect/anatomy.ts +108 -0
- package/studio/server/introspect/bundle.ts +57 -0
- package/studio/server/introspect/core-extractor.ts +119 -0
- package/studio/server/introspect/core.ts +44 -0
- package/studio/server/introspect/diff.ts +133 -0
- package/studio/server/introspect/extractor.ts +102 -0
- package/studio/server/introspect/hash.ts +21 -0
- package/studio/server/introspect/overlay-tsmorph.ts +874 -0
- package/studio/server/introspect/overlay.ts +57 -0
- package/studio/server/introspect/runtime.ts +99 -0
- package/studio/server/introspect/schema-refs.ts +46 -0
- package/studio/server/lifecycle.ts +38 -0
- package/studio/server/sse.ts +57 -0
- package/studio/server/state/baseline.ts +211 -0
- package/studio/server/state/catalog.ts +117 -0
- package/studio/server/state/comments.ts +321 -0
- package/studio/server/state/context.ts +167 -0
- package/studio/server/state/copy.ts +156 -0
- package/studio/server/state/create.ts +156 -0
- package/studio/server/state/documents.ts +70 -0
- package/studio/server/state/env.ts +161 -0
- package/studio/server/state/git.ts +75 -0
- package/studio/server/state/handoff.ts +55 -0
- package/studio/server/state/harness-gateway.ts +181 -0
- package/studio/server/state/harness-token.ts +0 -0
- package/studio/server/state/instance.ts +244 -0
- package/studio/server/state/integrations.ts +55 -0
- package/studio/server/state/layout.ts +55 -0
- package/studio/server/state/settings.ts +39 -0
- package/studio/server/state/store.ts +97 -0
- package/studio/server/state/updates.ts +63 -0
- package/studio/server/state/usage.ts +37 -0
- package/studio/server/state/views.ts +138 -0
- package/studio/server/state/visibility.ts +33 -0
- package/studio/server/watch.ts +81 -0
- package/studio/server/workspace-state.ts +26 -0
- package/studio/server/workspace-watch.ts +101 -0
- package/studio/shared/types.ts +873 -0
- package/studio/tsconfig.json +23 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const p = require('path')
|
|
2
|
+
const f = require('fs')
|
|
3
|
+
|
|
4
|
+
// Guard against developers running `pnpm install` directly inside this submodule
|
|
5
|
+
// (which would resolve PUBLISHED packages instead of the workspace ones).
|
|
6
|
+
//
|
|
7
|
+
// IMPORTANT: this runs as a `preinstall` script, so it ALSO fires for end users
|
|
8
|
+
// who `npm i -g @astrale-os/astrale`. It must pass for them. The discriminator
|
|
9
|
+
// is the `.astrale-workspace` marker at the monorepo root: we only fail when the
|
|
10
|
+
// install originates from *inside* the monorepo but not at its root.
|
|
11
|
+
if (process.env.STANDALONE) process.exit(0)
|
|
12
|
+
|
|
13
|
+
const start = process.env.INIT_CWD || process.cwd()
|
|
14
|
+
|
|
15
|
+
let dir = start
|
|
16
|
+
let workspaceRoot = null
|
|
17
|
+
for (;;) {
|
|
18
|
+
if (f.existsSync(p.join(dir, '.astrale-workspace'))) {
|
|
19
|
+
workspaceRoot = dir
|
|
20
|
+
break
|
|
21
|
+
}
|
|
22
|
+
const parent = p.dirname(dir)
|
|
23
|
+
if (parent === dir) break
|
|
24
|
+
dir = parent
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Not inside the Astrale monorepo (e.g. an end user): allow.
|
|
28
|
+
if (!workspaceRoot) process.exit(0)
|
|
29
|
+
// Installing from the workspace root itself: correct.
|
|
30
|
+
if (workspaceRoot === start) process.exit(0)
|
|
31
|
+
|
|
32
|
+
console.error(`
|
|
33
|
+
⚠️ WARNING: Running pnpm install directly in this package will use PUBLISHED packages.
|
|
34
|
+
|
|
35
|
+
Run from workspace root instead:
|
|
36
|
+
cd <workspace-root> && pnpm install
|
|
37
|
+
|
|
38
|
+
To bypass: STANDALONE=true pnpm install
|
|
39
|
+
`)
|
|
40
|
+
process.exit(1)
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Astrale CLI
|
|
2
|
+
|
|
3
|
+
`astrale` is the CLI to manage and interact with Astrale instances.
|
|
4
|
+
|
|
5
|
+
- Default admin instance: `https://admin.eu.astrale.ai/api`
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
curl -fsSL https://raw.githubusercontent.com/astrale-os/cli/main/install.sh | sh
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The installer places a verified standalone binary at
|
|
14
|
+
`~/.astrale/bin/astrale` by default. No local runtime is installed.
|
|
15
|
+
|
|
16
|
+
Optional installer environment:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
ASTRALE_INSTALL_DIR=/usr/local/bin curl -fsSL https://raw.githubusercontent.com/astrale-os/cli/main/install.sh | sh
|
|
20
|
+
ASTRALE_VERSION=<version> curl -fsSL https://raw.githubusercontent.com/astrale-os/cli/main/install.sh | sh
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### npm (CLI + Domain Studio)
|
|
24
|
+
|
|
25
|
+
Alternatively, install from npm — this runs the CLI under Node and additionally
|
|
26
|
+
ships the [Domain Studio](studio/README.md) (`astrale studio`):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g @astrale-os/cli
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The npm build bundles all dependencies, so no private-registry access is needed.
|
|
33
|
+
`astrale studio` launches a local web GUI to author and inspect a domain; it runs
|
|
34
|
+
on [Bun](https://bun.sh), so install Bun and keep it on `PATH` to use that command
|
|
35
|
+
(the rest of the CLI needs only Node ≥ 20). The curl-installed standalone binary
|
|
36
|
+
above does not include the studio — use the npm install for `astrale studio`.
|
|
37
|
+
|
|
38
|
+
> Pre-1.0, `npm install -g @astrale-os/cli` installs the latest published
|
|
39
|
+
> build (currently an alpha). The curl installer's channels (alpha/beta/rc) are
|
|
40
|
+
> a binary-only concept.
|
|
41
|
+
|
|
42
|
+
## Quickstart
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# 1. Log in to your Astrale account.
|
|
46
|
+
astrale auth login
|
|
47
|
+
|
|
48
|
+
# 2. Create a managed alpha instance.
|
|
49
|
+
astrale instance create my-app
|
|
50
|
+
|
|
51
|
+
# 3. Check local CLI context.
|
|
52
|
+
astrale status
|
|
53
|
+
|
|
54
|
+
# 4. Call a function on the active instance.
|
|
55
|
+
astrale call /:dist.astrale.ai:class.Echo:echo message=hello
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If you already have a kernel URL, create a local bookmark:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
astrale instance bookmark staging --url https://kernel.example.com
|
|
62
|
+
astrale instance use staging
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Agent Browser
|
|
66
|
+
|
|
67
|
+
`astrale browser` prepares an authenticated GUI session for your coding agent.
|
|
68
|
+
It keeps a persistent per-instance browser profile, handles the one-time login,
|
|
69
|
+
and then lets `agent-browser` drive the live page.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
astrale browser --check
|
|
73
|
+
astrale browser
|
|
74
|
+
agent-browser --profile <profile-dir> snapshot
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Install the browser driver once:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install -g agent-browser && agent-browser install
|
|
81
|
+
npx skills add astrale-os/cli # installs both the astrale-cli (ops) and astrale-domain (authoring) skills
|
|
82
|
+
npx skills add vercel-labs/agent-browser
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
To install just one: `npx skills add astrale-os/cli@astrale-cli` or
|
|
86
|
+
`npx skills add astrale-os/cli@astrale-domain`.
|
|
87
|
+
|
|
88
|
+
## Updating
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
astrale update --check
|
|
92
|
+
astrale update
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`astrale update` upgrades official script installs. Use `--check`,
|
|
96
|
+
`--channel <channel>`, or `--version <version>` to control the target release.
|
|
97
|
+
|
|
98
|
+
## Commands
|
|
99
|
+
|
|
100
|
+
The authoritative command surface is generated from the code:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
astrale --help
|
|
104
|
+
astrale <command> --help
|
|
105
|
+
astrale instance --help
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Main command groups:
|
|
109
|
+
|
|
110
|
+
| Group | What it covers |
|
|
111
|
+
|-------|----------------|
|
|
112
|
+
| Kernel | `ls`, `get`, `call`, `query`, `describe`, `token` |
|
|
113
|
+
| Context | `status`, `whoami`, `use` |
|
|
114
|
+
| Management | `admin`, `instance`, `identity`, `auth`, `idp`, `update` |
|
|
115
|
+
| Agent | `browser` |
|
|
116
|
+
|
|
117
|
+
## Path Syntax
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
/domain Domain node
|
|
121
|
+
/domain/class.Name Class node, or /domain/interface.Name
|
|
122
|
+
/:domain:class.Name:method Static method (semantic domain path)
|
|
123
|
+
<nodePath>::method Instance method dispatch
|
|
124
|
+
@nodeId Reference a node by UID
|
|
125
|
+
@nodeId::method Instance method on a node by UID
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The full grammar and examples are in `astrale --help`.
|
|
129
|
+
|
|
130
|
+
## Configuration
|
|
131
|
+
|
|
132
|
+
CLI state lives under `~/.astrale/`:
|
|
133
|
+
|
|
134
|
+
- `config.json`
|
|
135
|
+
- `instances.json`
|
|
136
|
+
- `identities.json`
|
|
137
|
+
- keypairs
|
|
138
|
+
- cached IdP sessions
|
|
139
|
+
|
|
140
|
+
## Development
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# From the workspace root
|
|
144
|
+
pnpm install
|
|
145
|
+
|
|
146
|
+
# Run directly with Bun
|
|
147
|
+
bun cli/bin/astrale.ts <command>
|
|
148
|
+
|
|
149
|
+
# Build the CLI
|
|
150
|
+
pnpm -C cli build
|
|
151
|
+
```
|