fix(sim-cli): keep unpublished groups in the Mothership command inven… · simstudioai/sim@6555b7e · GitHub
Skip to content

Commit 6555b7e

Browse files
committed
fix(sim-cli): keep unpublished groups in the Mothership command inventory
#9057 hid the projects group from --help and `sim cli` search until launch, and the inventory printer dropped every hidden command, so the Mothership worker lost the Project file commands it routes --project to. List a hidden top-level group that is only unpublished, marked `unpublished`, so the worker can route to it once Sim enables Projects for a turn; other hidden commands stay out, and --help is unchanged.
1 parent a3b3cc2 commit 6555b7e

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

‎packages/sim-cli/scripts/print-command-inventory.ts‎

Lines changed: 10 additions & 4 deletions

‎packages/sim-cli/src/contract/reference.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '#sim-cli/contract/reference'
99
import { runEmbeddedCli } from '#sim-cli/embed'
1010
import { V2_OPERATIONS } from '#sim-cli/generated/v2-api'
11+
import { buildProgram, UNPUBLISHED_GROUPS } from '#sim-cli/program'
1112
import { cursorSlot } from '#sim-cli/runtime/request'
1213

1314
const ROOT = fileURLToPath(new URL('../../../../', import.meta.url))
@@ -17,6 +18,7 @@ interface InventoryEntry {
1718
shape?: string
1819
body?: string
1920
mothershipUnavailable?: true
21+
unpublished?: true
2022
}
2123

2224
let produced: InventoryEntry[] | undefined
@@ -47,6 +49,19 @@ function document(schema: ReferenceSchema): ReferenceDocument {
4749
const operation = { method: 'POST', path: '/items/[id]' }
4850

4951
describe('CLI reference producer', () => {
52+
it('lists unpublished groups for the worker, marked, while --help keeps hiding them', () => {
53+
const commands = inventory()
54+
for (const group of UNPUBLISHED_GROUPS) {
55+
const members = commands.filter((entry) => entry.path[0] === group)
56+
expect(members.length).toBeGreaterThan(0)
57+
expect(members.every((entry) => entry.unpublished === true)).toBe(true)
58+
expect(buildProgram().helpInformation()).not.toMatch(new RegExp(`^\\s+${group}\\b`, 'm'))
59+
}
60+
expect(
61+
commands.filter((entry) => entry.unpublished && !UNPUBLISHED_GROUPS.has(entry.path[0] ?? ''))
62+
).toEqual([])
63+
})
64+
5065
it('publishes creation ids and preserves single/batch row choices from the real API', () => {
5166
const commands = inventory()
5267
const find = (path: string) => {

‎packages/sim-cli/src/program.ts‎

Lines changed: 6 additions & 2 deletions

0 commit comments

Comments
 (0)