@astrale-os/cli 0.8.1-alpha.4 → 0.8.1-alpha.5
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
CHANGED
|
@@ -110,7 +110,7 @@ Main command groups:
|
|
|
110
110
|
|
|
111
111
|
| Group | What it covers |
|
|
112
112
|
|-------|----------------|
|
|
113
|
-
| Kernel | `get`, `call`, `query`, `
|
|
113
|
+
| Kernel | `get`, `call`, `query`, `token` |
|
|
114
114
|
| Context | `status`, `whoami`, `use` |
|
|
115
115
|
| Management | `admin`, `instance`, `identity`, `auth`, `idp`, `update` |
|
|
116
116
|
| Agent | `browser` |
|
package/dist/astrale.js
CHANGED
|
@@ -2576,7 +2576,7 @@ var package_default;
|
|
|
2576
2576
|
var init_package = __esm(() => {
|
|
2577
2577
|
package_default = {
|
|
2578
2578
|
name: "@astrale-os/cli",
|
|
2579
|
-
version: "0.8.1-alpha.
|
|
2579
|
+
version: "0.8.1-alpha.5",
|
|
2580
2580
|
description: "Astrale CLI — connect to existing Astrale kernels",
|
|
2581
2581
|
keywords: [
|
|
2582
2582
|
"astrale",
|
|
@@ -90847,91 +90847,6 @@ Examples:
|
|
|
90847
90847
|
};
|
|
90848
90848
|
});
|
|
90849
90849
|
|
|
90850
|
-
// node_modules/.pnpm/@astrale-os+sdk@file+vendor+astrale-os-sdk-0.5.0-beta.1.tgz_@astrale-os+ox@0.1.2_oxfmt@_72b33f8043e5d121b8114f4a315f9796/node_modules/@astrale-os/sdk/dist/graph/class/index.js
|
|
90851
|
-
var init_class3 = __esm(() => {
|
|
90852
|
-
init_class();
|
|
90853
|
-
});
|
|
90854
|
-
|
|
90855
|
-
// src/commands/describe.ts
|
|
90856
|
-
var exports_describe = {};
|
|
90857
|
-
__export(exports_describe, {
|
|
90858
|
-
describeCommand: () => describeCommand,
|
|
90859
|
-
default: () => describe_default
|
|
90860
|
-
});
|
|
90861
|
-
async function describeCommand(target2, opts) {
|
|
90862
|
-
let path5;
|
|
90863
|
-
let meta3;
|
|
90864
|
-
try {
|
|
90865
|
-
({ path: path5, meta: meta3 } = await expandSelfInPath(target2, opts));
|
|
90866
|
-
} catch (error52) {
|
|
90867
|
-
log.error(error52 instanceof Error ? error52.message : "Invalid target");
|
|
90868
|
-
process.exit(1);
|
|
90869
|
-
}
|
|
90870
|
-
await runKernelCommand({
|
|
90871
|
-
opts,
|
|
90872
|
-
label: `Describe ${path5}`,
|
|
90873
|
-
fn: ({ graph }) => withSelfHint(() => graph.getOrThrow(Path.parse(path5)), meta3),
|
|
90874
|
-
format: (node4, format3, machine) => {
|
|
90875
|
-
const shown = opts.schema === false ? withoutSchema(node4) : node4;
|
|
90876
|
-
if (machine || format3.format !== undefined)
|
|
90877
|
-
output(shown, format3);
|
|
90878
|
-
else
|
|
90879
|
-
printDescription(path5, shown);
|
|
90880
|
-
}
|
|
90881
|
-
});
|
|
90882
|
-
}
|
|
90883
|
-
function withoutSchema(node4) {
|
|
90884
|
-
return {
|
|
90885
|
-
...node4,
|
|
90886
|
-
props: Object.fromEntries(Object.entries(node4.props).filter(([key]) => unqualifyProperty(key) !== "schema"))
|
|
90887
|
-
};
|
|
90888
|
-
}
|
|
90889
|
-
function printDescription(target2, node4) {
|
|
90890
|
-
console.log(` ${source_default.bold.cyan(target2)}`);
|
|
90891
|
-
console.log(` ${source_default.dim("id")} ${node4.id}`);
|
|
90892
|
-
console.log(` ${source_default.dim("class")} ${ClassPath.name(node4.class)} ${source_default.dim(`(${node4.class})`)}`);
|
|
90893
|
-
const properties = Object.entries(node4.props);
|
|
90894
|
-
if (properties.length === 0)
|
|
90895
|
-
return;
|
|
90896
|
-
console.log(`
|
|
90897
|
-
${source_default.bold("Properties:")}`);
|
|
90898
|
-
for (const [key, value2] of properties) {
|
|
90899
|
-
const rendered = typeof value2 === "string" ? value2 : JSON.stringify(value2);
|
|
90900
|
-
console.log(` ${source_default.cyan(unqualifyProperty(key))}: ${source_default.dim(rendered)}`);
|
|
90901
|
-
}
|
|
90902
|
-
}
|
|
90903
|
-
var describe_default;
|
|
90904
|
-
var init_describe = __esm(() => {
|
|
90905
|
-
init_class3();
|
|
90906
|
-
init_path5();
|
|
90907
|
-
init_source();
|
|
90908
|
-
init_connection2();
|
|
90909
|
-
init_graph6();
|
|
90910
|
-
init_log();
|
|
90911
|
-
init_output();
|
|
90912
|
-
describe_default = {
|
|
90913
|
-
name: "describe",
|
|
90914
|
-
description: "Describe the canonical facts of one node",
|
|
90915
|
-
afterHelpText: `
|
|
90916
|
-
Behavior:
|
|
90917
|
-
Reads one canonical Node and presents its ID, Class, and properties.
|
|
90918
|
-
It does not infer operations or children from path layout. --no-schema
|
|
90919
|
-
omits schema-valued properties from Domain-sized results.
|
|
90920
|
-
|
|
90921
|
-
Examples:
|
|
90922
|
-
$ astrale describe /:kernel.astrale.ai:class.Domain
|
|
90923
|
-
$ astrale describe @self --no-schema
|
|
90924
|
-
`,
|
|
90925
|
-
arguments: [{ name: "target", description: "Canonical Node Path or @id" }],
|
|
90926
|
-
options: [
|
|
90927
|
-
{ flags: "--no-schema", description: "Omit properties whose qualified leaf is schema" }
|
|
90928
|
-
],
|
|
90929
|
-
action: async (target2, opts) => {
|
|
90930
|
-
await describeCommand(target2, opts);
|
|
90931
|
-
}
|
|
90932
|
-
};
|
|
90933
|
-
});
|
|
90934
|
-
|
|
90935
90850
|
// src/commands/query.ts
|
|
90936
90851
|
var exports_query = {};
|
|
90937
90852
|
__export(exports_query, {
|
|
@@ -94065,6 +93980,11 @@ var init_create3 = __esm(() => {
|
|
|
94065
93980
|
};
|
|
94066
93981
|
});
|
|
94067
93982
|
|
|
93983
|
+
// node_modules/.pnpm/@astrale-os+sdk@file+vendor+astrale-os-sdk-0.5.0-beta.1.tgz_@astrale-os+ox@0.1.2_oxfmt@_72b33f8043e5d121b8114f4a315f9796/node_modules/@astrale-os/sdk/dist/graph/class/index.js
|
|
93984
|
+
var init_class3 = __esm(() => {
|
|
93985
|
+
init_class();
|
|
93986
|
+
});
|
|
93987
|
+
|
|
94068
93988
|
// node_modules/.pnpm/@astrale-os+sdk@file+vendor+astrale-os-sdk-0.5.0-beta.1.tgz_@astrale-os+ox@0.1.2_oxfmt@_72b33f8043e5d121b8114f4a315f9796/node_modules/@astrale-os/sdk/dist/graph/model/index.js
|
|
94069
93989
|
var init_model8 = __esm(() => {
|
|
94070
93990
|
init_graph2();
|
|
@@ -95796,7 +95716,8 @@ function renderCommanderError(program2, error, argv = process.argv.slice(2)) {
|
|
|
95796
95716
|
`);
|
|
95797
95717
|
}
|
|
95798
95718
|
var RETIRED_COMMANDS = {
|
|
95799
|
-
ls: "astrale query <source> --edge <class>"
|
|
95719
|
+
ls: "astrale query <source> --edge <class>",
|
|
95720
|
+
describe: "astrale get <target>"
|
|
95800
95721
|
};
|
|
95801
95722
|
function renderUnknownCommand(tokens, catalog) {
|
|
95802
95723
|
const command = tokens.join(" ");
|
|
@@ -96009,7 +95930,6 @@ async function buildProgram() {
|
|
|
96009
95930
|
registerCommand(program3, withKernelOptions((await Promise.resolve().then(() => (init_token(), exports_token))).default));
|
|
96010
95931
|
registerCommand(program3, withKernelOptions((await Promise.resolve().then(() => (init_get(), exports_get))).default));
|
|
96011
95932
|
registerCommand(program3, withKernelOptions((await Promise.resolve().then(() => (init_mutate4(), exports_mutate))).default));
|
|
96012
|
-
registerCommand(program3, withKernelOptions((await Promise.resolve().then(() => (init_describe(), exports_describe))).default));
|
|
96013
95933
|
registerCommand(program3, withKernelOptions((await Promise.resolve().then(() => (init_query7(), exports_query))).default));
|
|
96014
95934
|
registerCommand(program3, withKernelOptions((await Promise.resolve().then(() => (init_logs(), exports_logs))).default));
|
|
96015
95935
|
registerCommand(program3, withKernelOptions((await Promise.resolve().then(() => (init_view6(), exports_view2))).default));
|
|
@@ -96096,7 +96016,7 @@ async function buildProgram() {
|
|
|
96096
96016
|
program3.addHelpText("after", `
|
|
96097
96017
|
Command groups:
|
|
96098
96018
|
Getting started setup (sign in, pick an instance, equip your workspace)
|
|
96099
|
-
Kernel get, mutate, call, query,
|
|
96019
|
+
Kernel get, mutate, call, query, token
|
|
96100
96020
|
Management admin, instance, domain, identity, auth, idp, update
|
|
96101
96021
|
Agent browser (drive the GUI via agent-browser)
|
|
96102
96022
|
Studio studio (launch the local Domain Studio GUI for a workspace)
|
package/package.json
CHANGED
|
@@ -23,8 +23,10 @@ describe('command DX suggestions', () => {
|
|
|
23
23
|
expect(usages).toContain('use <name>')
|
|
24
24
|
expect(usages).toContain('update')
|
|
25
25
|
expect(usages).toContain('query [sources...]')
|
|
26
|
+
expect(usages).toContain('get <target>')
|
|
26
27
|
expect(usages).toContain('status')
|
|
27
28
|
expect(usages).not.toContain('ls <source>')
|
|
29
|
+
expect(usages).not.toContain('describe <target>')
|
|
28
30
|
})
|
|
29
31
|
|
|
30
32
|
test('explains shared verbs as namespaced commands, not arity errors', async () => {
|
|
@@ -43,6 +45,21 @@ describe('command DX suggestions', () => {
|
|
|
43
45
|
expect(rendered).not.toContain('too many arguments')
|
|
44
46
|
})
|
|
45
47
|
|
|
48
|
+
test('points retired describe at get', async () => {
|
|
49
|
+
const program = await buildProgram()
|
|
50
|
+
const error = new CommanderError(
|
|
51
|
+
1,
|
|
52
|
+
'commander.unknownCommand',
|
|
53
|
+
"error: unknown command 'describe'",
|
|
54
|
+
)
|
|
55
|
+
const rendered = stripAnsi(renderCommanderError(program, error, ['describe', '@note']))
|
|
56
|
+
|
|
57
|
+
expect(rendered).toContain('Unknown command: astrale describe @note')
|
|
58
|
+
expect(rendered).toContain('astrale describe` was removed')
|
|
59
|
+
expect(rendered).toContain('astrale get <target>')
|
|
60
|
+
expect(rendered).not.toContain('Did you mean:')
|
|
61
|
+
})
|
|
62
|
+
|
|
46
63
|
test('points retired ls at query', async () => {
|
|
47
64
|
const program = await buildProgram()
|
|
48
65
|
const error = new CommanderError(1, 'commander.unknownCommand', "error: unknown command 'ls'")
|
package/src/lib/command-dx.ts
CHANGED
|
@@ -74,6 +74,7 @@ export function renderCommanderError(
|
|
|
74
74
|
|
|
75
75
|
const RETIRED_COMMANDS: Record<string, string> = {
|
|
76
76
|
ls: 'astrale query <source> --edge <class>',
|
|
77
|
+
describe: 'astrale get <target>',
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
function renderUnknownCommand(tokens: string[], catalog: CommandCatalogEntry[]): string {
|
|
@@ -138,7 +138,6 @@ describe('program composition', () => {
|
|
|
138
138
|
'auth token',
|
|
139
139
|
'browser',
|
|
140
140
|
'call',
|
|
141
|
-
'describe',
|
|
142
141
|
'domain',
|
|
143
142
|
'domain install',
|
|
144
143
|
'domain list',
|
|
@@ -186,7 +185,7 @@ describe('program composition', () => {
|
|
|
186
185
|
'whoami',
|
|
187
186
|
])
|
|
188
187
|
expect(createHash('sha256').update(JSON.stringify(surface)).digest('hex')).toBe(
|
|
189
|
-
'
|
|
188
|
+
'369e7d1d51871f0ca1c6007d2a5c45023d093e70b85db07c1f58b06b7a0b17d4',
|
|
190
189
|
)
|
|
191
190
|
})
|
|
192
191
|
|
|
@@ -279,6 +278,7 @@ describe('help contract — connect-only command surface', () => {
|
|
|
279
278
|
'server',
|
|
280
279
|
'env',
|
|
281
280
|
'ls',
|
|
281
|
+
'describe',
|
|
282
282
|
]) {
|
|
283
283
|
expect(names).not.toContain(removed)
|
|
284
284
|
}
|
package/src/program/build.ts
CHANGED
|
@@ -61,7 +61,6 @@ export async function buildProgram(): Promise<Command> {
|
|
|
61
61
|
registerCommand(program, withKernelOptions((await import('../commands/token')).default))
|
|
62
62
|
registerCommand(program, withKernelOptions((await import('../commands/get')).default))
|
|
63
63
|
registerCommand(program, withKernelOptions((await import('../commands/mutate')).default))
|
|
64
|
-
registerCommand(program, withKernelOptions((await import('../commands/describe')).default))
|
|
65
64
|
registerCommand(program, withKernelOptions((await import('../commands/query')).default))
|
|
66
65
|
registerCommand(program, withKernelOptions((await import('../commands/logs')).default))
|
|
67
66
|
registerCommand(program, withKernelOptions((await import('../commands/view')).default))
|
|
@@ -158,7 +157,7 @@ export async function buildProgram(): Promise<Command> {
|
|
|
158
157
|
`
|
|
159
158
|
Command groups:
|
|
160
159
|
Getting started setup (sign in, pick an instance, equip your workspace)
|
|
161
|
-
Kernel get, mutate, call, query,
|
|
160
|
+
Kernel get, mutate, call, query, token
|
|
162
161
|
Management admin, instance, domain, identity, auth, idp, update
|
|
163
162
|
Agent browser (drive the GUI via agent-browser)
|
|
164
163
|
Studio studio (launch the local Domain Studio GUI for a workspace)
|
package/src/commands/describe.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@astrale-os/sdk/graph/node'
|
|
2
|
-
|
|
3
|
-
import { ClassPath } from '@astrale-os/sdk/graph/class'
|
|
4
|
-
import { Path } from '@astrale-os/sdk/graph/path'
|
|
5
|
-
import chalk from 'chalk'
|
|
6
|
-
|
|
7
|
-
import type { KernelCommandOpts } from '../connection'
|
|
8
|
-
import type { CommandDefinition } from '../program/index'
|
|
9
|
-
|
|
10
|
-
import { expandSelfInPath, runKernelCommand, withSelfHint } from '../connection'
|
|
11
|
-
import { unqualifyProperty } from '../graph/index'
|
|
12
|
-
import { log } from '../lib/log'
|
|
13
|
-
import { output } from '../lib/output'
|
|
14
|
-
|
|
15
|
-
type DescribeOpts = KernelCommandOpts & { schema?: boolean }
|
|
16
|
-
type DescribedNode = Omit<Node, 'props'> & { readonly props: Readonly<Record<string, unknown>> }
|
|
17
|
-
|
|
18
|
-
/** Describe only facts present on the canonical Node; no hierarchy is inferred from its Path. */
|
|
19
|
-
export async function describeCommand(target: string, opts: DescribeOpts): Promise<void> {
|
|
20
|
-
let path: string
|
|
21
|
-
let meta
|
|
22
|
-
try {
|
|
23
|
-
;({ path, meta } = await expandSelfInPath(target, opts))
|
|
24
|
-
} catch (error) {
|
|
25
|
-
log.error(error instanceof Error ? error.message : 'Invalid target')
|
|
26
|
-
process.exit(1)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
await runKernelCommand({
|
|
30
|
-
opts,
|
|
31
|
-
label: `Describe ${path}`,
|
|
32
|
-
fn: ({ graph }) => withSelfHint(() => graph.getOrThrow(Path.parse(path)), meta),
|
|
33
|
-
format: (node, format, machine) => {
|
|
34
|
-
const shown = opts.schema === false ? withoutSchema(node) : node
|
|
35
|
-
if (machine || format.format !== undefined) output(shown, format)
|
|
36
|
-
else printDescription(path, shown)
|
|
37
|
-
},
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function withoutSchema(node: Node): DescribedNode {
|
|
42
|
-
return {
|
|
43
|
-
...node,
|
|
44
|
-
props: Object.fromEntries(
|
|
45
|
-
Object.entries(node.props).filter(([key]) => unqualifyProperty(key) !== 'schema'),
|
|
46
|
-
),
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function printDescription(target: string, node: DescribedNode): void {
|
|
51
|
-
console.log(` ${chalk.bold.cyan(target)}`)
|
|
52
|
-
console.log(` ${chalk.dim('id')} ${node.id}`)
|
|
53
|
-
console.log(
|
|
54
|
-
` ${chalk.dim('class')} ${ClassPath.name(node.class)} ${chalk.dim(`(${node.class})`)}`,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
const properties = Object.entries(node.props)
|
|
58
|
-
if (properties.length === 0) return
|
|
59
|
-
console.log(`\n ${chalk.bold('Properties:')}`)
|
|
60
|
-
for (const [key, value] of properties) {
|
|
61
|
-
const rendered = typeof value === 'string' ? value : JSON.stringify(value)
|
|
62
|
-
console.log(` ${chalk.cyan(unqualifyProperty(key))}: ${chalk.dim(rendered)}`)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default {
|
|
67
|
-
name: 'describe',
|
|
68
|
-
description: 'Describe the canonical facts of one node',
|
|
69
|
-
afterHelpText: `
|
|
70
|
-
Behavior:
|
|
71
|
-
Reads one canonical Node and presents its ID, Class, and properties.
|
|
72
|
-
It does not infer operations or children from path layout. --no-schema
|
|
73
|
-
omits schema-valued properties from Domain-sized results.
|
|
74
|
-
|
|
75
|
-
Examples:
|
|
76
|
-
$ astrale describe /:kernel.astrale.ai:class.Domain
|
|
77
|
-
$ astrale describe @self --no-schema
|
|
78
|
-
`,
|
|
79
|
-
arguments: [{ name: 'target', description: 'Canonical Node Path or @id' }],
|
|
80
|
-
options: [
|
|
81
|
-
{ flags: '--no-schema', description: 'Omit properties whose qualified leaf is schema' },
|
|
82
|
-
],
|
|
83
|
-
action: async (target, opts) => {
|
|
84
|
-
await describeCommand(target as string, opts as DescribeOpts)
|
|
85
|
-
},
|
|
86
|
-
} satisfies CommandDefinition
|