@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.
Files changed (219) hide show
  1. package/.check-workspace.cjs +40 -0
  2. package/README.md +151 -0
  3. package/dist/astrale.js +59749 -0
  4. package/package.json +90 -0
  5. package/src/command.ts +40 -0
  6. package/src/commands/__tests__/admin-instance.test.ts +73 -0
  7. package/src/commands/__tests__/auth-login.test.ts +178 -0
  8. package/src/commands/__tests__/auth-token.test.ts +223 -0
  9. package/src/commands/__tests__/call.test.ts +72 -0
  10. package/src/commands/__tests__/domain-list.test.ts +74 -0
  11. package/src/commands/__tests__/help-contract.test.ts +136 -0
  12. package/src/commands/__tests__/install-identity-override.test.ts +65 -0
  13. package/src/commands/__tests__/instance-bookmark.test.ts +101 -0
  14. package/src/commands/__tests__/instance-create-hosts.test.ts +29 -0
  15. package/src/commands/__tests__/instance-list-rows.test.ts +63 -0
  16. package/src/commands/__tests__/logs.test.ts +117 -0
  17. package/src/commands/__tests__/ls.test.ts +25 -0
  18. package/src/commands/__tests__/setup-plan.test.ts +61 -0
  19. package/src/commands/admin/status.ts +61 -0
  20. package/src/commands/admin/use.ts +77 -0
  21. package/src/commands/auth/login.ts +82 -0
  22. package/src/commands/auth/logout.ts +50 -0
  23. package/src/commands/auth/status.ts +86 -0
  24. package/src/commands/auth/token.ts +162 -0
  25. package/src/commands/browser.ts +207 -0
  26. package/src/commands/call.ts +300 -0
  27. package/src/commands/describe.ts +182 -0
  28. package/src/commands/domain/install.ts +420 -0
  29. package/src/commands/domain/list.ts +154 -0
  30. package/src/commands/domain/publish.ts +155 -0
  31. package/src/commands/get.ts +60 -0
  32. package/src/commands/identity/create.ts +26 -0
  33. package/src/commands/identity/delete.ts +18 -0
  34. package/src/commands/identity/export.ts +66 -0
  35. package/src/commands/identity/import.ts +101 -0
  36. package/src/commands/identity/list.ts +56 -0
  37. package/src/commands/identity/register.ts +170 -0
  38. package/src/commands/identity/sync.ts +32 -0
  39. package/src/commands/identity/unsync.ts +24 -0
  40. package/src/commands/identity/use.ts +18 -0
  41. package/src/commands/identity/whoami.ts +34 -0
  42. package/src/commands/idp/add.ts +150 -0
  43. package/src/commands/idp/list.ts +57 -0
  44. package/src/commands/idp/refresh.ts +38 -0
  45. package/src/commands/idp/remove.ts +36 -0
  46. package/src/commands/idp/show.ts +29 -0
  47. package/src/commands/instance/active.ts +64 -0
  48. package/src/commands/instance/bookmark.ts +72 -0
  49. package/src/commands/instance/create.ts +69 -0
  50. package/src/commands/instance/delete.ts +72 -0
  51. package/src/commands/instance/forget.ts +26 -0
  52. package/src/commands/instance/list.ts +149 -0
  53. package/src/commands/instance/status.ts +42 -0
  54. package/src/commands/instance/use.ts +210 -0
  55. package/src/commands/logs.ts +347 -0
  56. package/src/commands/ls.ts +229 -0
  57. package/src/commands/query.ts +32 -0
  58. package/src/commands/setup.ts +54 -0
  59. package/src/commands/status.ts +60 -0
  60. package/src/commands/studio.ts +401 -0
  61. package/src/commands/token.ts +77 -0
  62. package/src/commands/update.ts +267 -0
  63. package/src/commands/use.ts +87 -0
  64. package/src/errors.ts +65 -0
  65. package/src/kernel/__tests__/auth.test.ts +77 -0
  66. package/src/kernel/__tests__/errors.test.ts +43 -0
  67. package/src/kernel/__tests__/remote-routing.test.ts +70 -0
  68. package/src/kernel/auth.ts +234 -0
  69. package/src/kernel/ca-fetch.ts +119 -0
  70. package/src/kernel/client.ts +191 -0
  71. package/src/kernel/errors.ts +280 -0
  72. package/src/kernel/expand.ts +217 -0
  73. package/src/kernel/index.ts +14 -0
  74. package/src/kernel/options.ts +22 -0
  75. package/src/kernel/remote-routing.ts +88 -0
  76. package/src/kernel/run.ts +63 -0
  77. package/src/kernel/types.ts +14 -0
  78. package/src/lib/__tests__/admin-target.test.ts +112 -0
  79. package/src/lib/__tests__/binary.test.ts +56 -0
  80. package/src/lib/__tests__/command-dx.test.ts +58 -0
  81. package/src/lib/__tests__/concurrency.test.ts +62 -0
  82. package/src/lib/__tests__/config.test.ts +53 -0
  83. package/src/lib/__tests__/design.test.ts +99 -0
  84. package/src/lib/__tests__/domain-identity.test.ts +60 -0
  85. package/src/lib/__tests__/format.test.ts +22 -0
  86. package/src/lib/__tests__/fs-atomic.test.ts +104 -0
  87. package/src/lib/__tests__/identity.test.ts +79 -0
  88. package/src/lib/__tests__/idp-session.driver.ts +53 -0
  89. package/src/lib/__tests__/idp-session.test.ts +357 -0
  90. package/src/lib/__tests__/idp.test.ts +385 -0
  91. package/src/lib/__tests__/instance-candidates.test.ts +73 -0
  92. package/src/lib/__tests__/instance-target.test.ts +183 -0
  93. package/src/lib/__tests__/instance.test.ts +136 -0
  94. package/src/lib/__tests__/keys.test.ts +129 -0
  95. package/src/lib/__tests__/local-status.test.ts +202 -0
  96. package/src/lib/__tests__/output.test.ts +150 -0
  97. package/src/lib/__tests__/panel.test.ts +40 -0
  98. package/src/lib/__tests__/port.test.ts +44 -0
  99. package/src/lib/__tests__/prompt.test.ts +25 -0
  100. package/src/lib/__tests__/sdk-deps.test.ts +68 -0
  101. package/src/lib/__tests__/self.test.ts +272 -0
  102. package/src/lib/__tests__/studio-server-deps.test.ts +74 -0
  103. package/src/lib/__tests__/table.test.ts +53 -0
  104. package/src/lib/__tests__/update.test.ts +246 -0
  105. package/src/lib/__tests__/use-target.test.ts +56 -0
  106. package/src/lib/__tests__/validation.test.ts +34 -0
  107. package/src/lib/admin-domain.ts +25 -0
  108. package/src/lib/admin-instance.ts +26 -0
  109. package/src/lib/admin-target.ts +217 -0
  110. package/src/lib/binary.ts +131 -0
  111. package/src/lib/browser.ts +150 -0
  112. package/src/lib/command-dx.ts +161 -0
  113. package/src/lib/concurrency.ts +31 -0
  114. package/src/lib/config.ts +45 -0
  115. package/src/lib/domain-identity.ts +49 -0
  116. package/src/lib/env.ts +49 -0
  117. package/src/lib/format.ts +4 -0
  118. package/src/lib/fs-atomic.ts +126 -0
  119. package/src/lib/identity.ts +256 -0
  120. package/src/lib/idp-session.ts +134 -0
  121. package/src/lib/idp.ts +876 -0
  122. package/src/lib/instance-candidates.ts +49 -0
  123. package/src/lib/instance-target.ts +182 -0
  124. package/src/lib/instance.ts +395 -0
  125. package/src/lib/keys.ts +294 -0
  126. package/src/lib/local-status.ts +152 -0
  127. package/src/lib/log.ts +116 -0
  128. package/src/lib/login-flow.ts +164 -0
  129. package/src/lib/meta.ts +86 -0
  130. package/src/lib/output.ts +222 -0
  131. package/src/lib/panel.ts +61 -0
  132. package/src/lib/paths.ts +11 -0
  133. package/src/lib/port.ts +41 -0
  134. package/src/lib/proc.ts +82 -0
  135. package/src/lib/prompt.ts +136 -0
  136. package/src/lib/provision-instance.ts +170 -0
  137. package/src/lib/sdk-deps.ts +104 -0
  138. package/src/lib/self.ts +166 -0
  139. package/src/lib/skills.ts +171 -0
  140. package/src/lib/table.ts +62 -0
  141. package/src/lib/update.ts +315 -0
  142. package/src/lib/use-target.ts +24 -0
  143. package/src/lib/validation.ts +59 -0
  144. package/src/program.ts +200 -0
  145. package/src/registry.ts +59 -0
  146. package/src/setup/__tests__/util.test.ts +29 -0
  147. package/src/setup/engine.ts +83 -0
  148. package/src/setup/render.ts +109 -0
  149. package/src/setup/steps/admin.ts +78 -0
  150. package/src/setup/steps/agent-browser.ts +81 -0
  151. package/src/setup/steps/auth.ts +54 -0
  152. package/src/setup/steps/domain.ts +68 -0
  153. package/src/setup/steps/index.ts +18 -0
  154. package/src/setup/steps/instance.ts +119 -0
  155. package/src/setup/steps/skills-bridge.ts +70 -0
  156. package/src/setup/steps/skills.ts +59 -0
  157. package/src/setup/types.ts +61 -0
  158. package/src/setup/util.ts +34 -0
  159. package/src/test-utils.ts +18 -0
  160. package/studio/client/dist/assets/index-DOwzZAEK.css +1 -0
  161. package/studio/client/dist/assets/index-wtU0Zxhy.js +183 -0
  162. package/studio/client/dist/index.html +13 -0
  163. package/studio/package.json +62 -0
  164. package/studio/server/agent/ask.ts +68 -0
  165. package/studio/server/agent/bridge-mcp.ts +182 -0
  166. package/studio/server/agent/bridge.ts +188 -0
  167. package/studio/server/agent/claude.ts +666 -0
  168. package/studio/server/agent/mock.ts +186 -0
  169. package/studio/server/agent/prompt.ts +202 -0
  170. package/studio/server/agent/registry.ts +29 -0
  171. package/studio/server/agent/runner.ts +484 -0
  172. package/studio/server/agent/schema-map.ts +112 -0
  173. package/studio/server/agent/types.ts +120 -0
  174. package/studio/server/api.ts +574 -0
  175. package/studio/server/cache.ts +138 -0
  176. package/studio/server/detect.ts +81 -0
  177. package/studio/server/domain.ts +70 -0
  178. package/studio/server/index.ts +136 -0
  179. package/studio/server/introspect/anatomy-extras.ts +398 -0
  180. package/studio/server/introspect/anatomy.ts +108 -0
  181. package/studio/server/introspect/bundle.ts +57 -0
  182. package/studio/server/introspect/core-extractor.ts +119 -0
  183. package/studio/server/introspect/core.ts +44 -0
  184. package/studio/server/introspect/diff.ts +133 -0
  185. package/studio/server/introspect/extractor.ts +102 -0
  186. package/studio/server/introspect/hash.ts +21 -0
  187. package/studio/server/introspect/overlay-tsmorph.ts +874 -0
  188. package/studio/server/introspect/overlay.ts +57 -0
  189. package/studio/server/introspect/runtime.ts +99 -0
  190. package/studio/server/introspect/schema-refs.ts +46 -0
  191. package/studio/server/lifecycle.ts +38 -0
  192. package/studio/server/sse.ts +57 -0
  193. package/studio/server/state/baseline.ts +211 -0
  194. package/studio/server/state/catalog.ts +117 -0
  195. package/studio/server/state/comments.ts +321 -0
  196. package/studio/server/state/context.ts +167 -0
  197. package/studio/server/state/copy.ts +156 -0
  198. package/studio/server/state/create.ts +156 -0
  199. package/studio/server/state/documents.ts +70 -0
  200. package/studio/server/state/env.ts +161 -0
  201. package/studio/server/state/git.ts +75 -0
  202. package/studio/server/state/handoff.ts +55 -0
  203. package/studio/server/state/harness-gateway.ts +181 -0
  204. package/studio/server/state/harness-token.ts +0 -0
  205. package/studio/server/state/instance.ts +244 -0
  206. package/studio/server/state/integrations.ts +55 -0
  207. package/studio/server/state/layout.ts +55 -0
  208. package/studio/server/state/settings.ts +39 -0
  209. package/studio/server/state/store.ts +97 -0
  210. package/studio/server/state/updates.ts +63 -0
  211. package/studio/server/state/usage.ts +37 -0
  212. package/studio/server/state/views.ts +138 -0
  213. package/studio/server/state/visibility.ts +33 -0
  214. package/studio/server/watch.ts +81 -0
  215. package/studio/server/workspace-state.ts +26 -0
  216. package/studio/server/workspace-watch.ts +101 -0
  217. package/studio/shared/types.ts +873 -0
  218. package/studio/tsconfig.json +23 -0
  219. 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
+ ```