@astrale-os/cli 1.0.0-beta.26 → 1.0.0-beta.27
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 +5 -2
- package/dist/astrale.js +963 -287
- package/package.json +3 -2
- package/src/commands/update.ts +61 -40
- package/src/lib/__tests__/skills.test.ts +803 -0
- package/src/lib/skills/lock.ts +117 -0
- package/src/lib/skills/sync.ts +814 -0
- package/src/lib/skills.ts +1 -52
- package/src/program/__tests__/program.test.ts +1 -1
- package/src/setup/steps/skills.ts +40 -38
- package/studio/client/dist/assets/{index-OeJK1TjG.js → index-CpBed0V1.js} +3 -3
- package/studio/client/dist/assets/{schema-studio-DRdfu_cQ.js → schema-studio-DJm9guI8.js} +1 -1
- package/studio/client/dist/index.html +1 -1
- package/studio/server/cli-consumers.test.ts +31 -2
- package/studio/server/workspace/updates.ts +23 -1
- package/studio/shared/contracts/runtime.ts +4 -0
- package/tsconfig.json +1 -1
|
@@ -3,7 +3,7 @@ import { existsSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileS
|
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
5
|
|
|
6
|
-
import type { StudioSchemaBundle, ViewInfo } from '../shared/types'
|
|
6
|
+
import type { StaleReport, StudioSchemaBundle, ViewInfo } from '../shared/types'
|
|
7
7
|
|
|
8
8
|
import { STUDIO_CLI_DESCRIPTOR_ENV } from './cli'
|
|
9
9
|
import { activeInstanceName, listInstances, setActiveInstance } from './instances/active'
|
|
@@ -209,6 +209,7 @@ describe('workspace update CLI orchestration', () => {
|
|
|
209
209
|
latest: '0.8.0',
|
|
210
210
|
channel: 'latest',
|
|
211
211
|
},
|
|
212
|
+
skills: { status: 'update-available' },
|
|
212
213
|
sdk: {
|
|
213
214
|
stale: true,
|
|
214
215
|
inProject: true,
|
|
@@ -235,6 +236,7 @@ describe('workspace update CLI orchestration', () => {
|
|
|
235
236
|
latest: '0.8.0',
|
|
236
237
|
channel: 'latest',
|
|
237
238
|
},
|
|
239
|
+
skills: { status: 'update-available' },
|
|
238
240
|
sdk: {
|
|
239
241
|
stale: true,
|
|
240
242
|
inProject: true,
|
|
@@ -251,6 +253,31 @@ describe('workspace update CLI orchestration', () => {
|
|
|
251
253
|
])
|
|
252
254
|
})
|
|
253
255
|
|
|
256
|
+
test('accepts an older CLI report without a skills axis during binary replacement', async () => {
|
|
257
|
+
const checkArgs = ['update', '--check', '--json']
|
|
258
|
+
const fake = installFakeCli([
|
|
259
|
+
{
|
|
260
|
+
args: checkArgs,
|
|
261
|
+
responses: [
|
|
262
|
+
{
|
|
263
|
+
stdout: {
|
|
264
|
+
stale: false,
|
|
265
|
+
cli: { stale: false, managed: true },
|
|
266
|
+
sdk: { stale: false, inProject: false, outdated: [] },
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
},
|
|
271
|
+
])
|
|
272
|
+
|
|
273
|
+
expect(await getUpdates(fake.root)).toEqual({
|
|
274
|
+
stale: false,
|
|
275
|
+
cli: { stale: false, managed: true },
|
|
276
|
+
skills: { status: 'current' },
|
|
277
|
+
sdk: { stale: false, inProject: false, outdated: [] },
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
|
|
254
281
|
test('hides the badge when check output is malformed or fails', async () => {
|
|
255
282
|
const checkArgs = ['update', '--check', '--json']
|
|
256
283
|
const fake = installFakeCli([
|
|
@@ -262,6 +289,7 @@ describe('workspace update CLI orchestration', () => {
|
|
|
262
289
|
stdout: {
|
|
263
290
|
stale: true,
|
|
264
291
|
cli: { stale: true, managed: true },
|
|
292
|
+
skills: { status: 'current' },
|
|
265
293
|
sdk: {
|
|
266
294
|
stale: true,
|
|
267
295
|
inProject: true,
|
|
@@ -274,9 +302,10 @@ describe('workspace update CLI orchestration', () => {
|
|
|
274
302
|
],
|
|
275
303
|
},
|
|
276
304
|
])
|
|
277
|
-
const expected = {
|
|
305
|
+
const expected: StaleReport = {
|
|
278
306
|
stale: false,
|
|
279
307
|
cli: { stale: false, managed: true },
|
|
308
|
+
skills: { status: 'current' },
|
|
280
309
|
sdk: { stale: false, inProject: false, outdated: [] },
|
|
281
310
|
}
|
|
282
311
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* We don't reimplement staleness: the `astrale` CLI owns it. `astrale update
|
|
5
5
|
* --check --json`, run in the DOMAIN ROOT (so its @astrale-os/* SDK-dep axis sees
|
|
6
|
-
* THIS project), emits a unified `{ stale, cli, sdk }` report. We run it with
|
|
6
|
+
* THIS project), emits a unified `{ stale, cli, skills, sdk }` report. We run it with
|
|
7
7
|
* stdout piped and read it regardless of exit code — a stale result exits 10 by
|
|
8
8
|
* design, which is not an error here. Best-effort: anything unexpected (no
|
|
9
9
|
* bad output) collapses to "nothing stale" so the badge stays
|
|
@@ -16,6 +16,7 @@ import { decodeJsonObject, runStudioCliJson, runStudioCliText } from '../cli'
|
|
|
16
16
|
const NOT_STALE: StaleReport = {
|
|
17
17
|
stale: false,
|
|
18
18
|
cli: { stale: false, managed: true },
|
|
19
|
+
skills: { status: 'current' },
|
|
19
20
|
sdk: { stale: false, inProject: false, outdated: [] },
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -30,6 +31,7 @@ export async function getUpdates(root: string): Promise<StaleReport> {
|
|
|
30
31
|
function decodeStaleReport(value: unknown): StaleReport | null {
|
|
31
32
|
const report = decodeJsonObject(value)
|
|
32
33
|
const cli = decodeJsonObject(report?.cli)
|
|
34
|
+
const skills = decodeJsonObject(report?.skills)
|
|
33
35
|
const sdk = decodeJsonObject(report?.sdk)
|
|
34
36
|
if (
|
|
35
37
|
typeof report?.stale !== 'boolean' ||
|
|
@@ -50,6 +52,22 @@ function decodeStaleReport(value: unknown): StaleReport | null {
|
|
|
50
52
|
: []
|
|
51
53
|
})
|
|
52
54
|
if (outdated.length !== sdk.outdated.length) return null
|
|
55
|
+
const skillStatuses = new Set([
|
|
56
|
+
'current',
|
|
57
|
+
'update-available',
|
|
58
|
+
'repair-needed',
|
|
59
|
+
'unavailable',
|
|
60
|
+
'skipped',
|
|
61
|
+
])
|
|
62
|
+
// Additive compatibility: Studio can briefly run a newer server against an
|
|
63
|
+
// older CLI report while a binary update is being applied.
|
|
64
|
+
const skillStatus =
|
|
65
|
+
skills === null || skills === undefined
|
|
66
|
+
? 'current'
|
|
67
|
+
: typeof skills.status === 'string' && skillStatuses.has(skills.status)
|
|
68
|
+
? (skills.status as StaleReport['skills']['status'])
|
|
69
|
+
: null
|
|
70
|
+
if (skillStatus === null) return null
|
|
53
71
|
return {
|
|
54
72
|
stale: report.stale,
|
|
55
73
|
cli: {
|
|
@@ -59,6 +77,10 @@ function decodeStaleReport(value: unknown): StaleReport | null {
|
|
|
59
77
|
...(typeof cli.latest === 'string' ? { latest: cli.latest } : {}),
|
|
60
78
|
...(typeof cli.channel === 'string' ? { channel: cli.channel } : {}),
|
|
61
79
|
},
|
|
80
|
+
skills: {
|
|
81
|
+
status: skillStatus,
|
|
82
|
+
...(typeof skills?.error === 'string' ? { error: skills.error } : {}),
|
|
83
|
+
},
|
|
62
84
|
sdk: { stale: sdk.stale, inProject: sdk.inProject, outdated },
|
|
63
85
|
}
|
|
64
86
|
}
|
|
@@ -42,6 +42,10 @@ export interface StudioSettings {
|
|
|
42
42
|
export interface StaleReport {
|
|
43
43
|
stale: boolean
|
|
44
44
|
cli: { stale: boolean; managed: boolean; current?: string; latest?: string; channel?: string }
|
|
45
|
+
skills: {
|
|
46
|
+
status: 'current' | 'update-available' | 'repair-needed' | 'unavailable' | 'skipped'
|
|
47
|
+
error?: string
|
|
48
|
+
}
|
|
45
49
|
sdk: {
|
|
46
50
|
stale: boolean
|
|
47
51
|
inProject: boolean
|
package/tsconfig.json
CHANGED