Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cli/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,24 @@ async function main() {
const args = process.argv.slice(2)
const command = args[0]

if (command === '--version' || command === '-v') {
const { readFileSync } = await import('node:fs')
const { fileURLToPath } = await import('node:url')
const { join, dirname } = await import('node:path')
const here = dirname(fileURLToPath(import.meta.url))
const pkg = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8'))
console.log(pkg.version)
return
}

if (!command || command === '--help' || command === '-h') {
console.log(`
Design Team CLI — your AI creative studio

Global flags:
--version, -v Print CLI version and exit
--help, -h Print this help and exit

Team Management:
designteam roster Show your team
designteam status Team health and moods
Expand Down
28 changes: 28 additions & 0 deletions evals/scenarios/version.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Scenario: version
*
* `designteam --version` / `-v` must print the CLI's package.json
* version and exit 0. Standard CLI convention; catches accidental
* regressions from future dispatch-order changes.
*/

import { readFileSync } from 'node:fs'
import { join, dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { withSandbox, assertEqual } from '../harness.mjs'

const slug = 'version'

const HERE = dirname(fileURLToPath(import.meta.url))
const ROOT_PKG = JSON.parse(readFileSync(join(HERE, '..', '..', 'package.json'), 'utf8'))

export async function run() {
await withSandbox(`${slug}-long-flag`, async ({ cli }) => {
assertEqual(cli('--version'), ROOT_PKG.version, '--version should print package.json version')
})
await withSandbox(`${slug}-short-flag`, async ({ cli }) => {
assertEqual(cli('-v'), ROOT_PKG.version, '-v should match --version')
})
}

run.slug = slug
Loading