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
22 changes: 22 additions & 0 deletions .changeset/environments-command-source-naming.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
---
"@objectstack/cli": patch
---

fix(cli): `environments/*.ts` command sources no longer spell `os projects` in live `--help` output (#10967)

`static override examples` is printed verbatim as part of oclif's `--help`, and all five
commands under `packages/cli/src/commands/environments/` (`bind`, `create`, `list`, `show`,
`switch`) still spelled the pre-v5.0-rename `os projects <cmd>` there — a user copy-pasting
straight from `os environments bind --help` hit `Error: Command projects:bind not found.`
(exit 2), the same dead command #10927 fixed in `packages/cli/README.md`, this time sourced
from the CLI binary itself.

`examples` arrays and JSDoc headers now say `os environments <cmd>`. The exported default
class on each file is renamed to match its real, file-path-derived command id
(`ProjectsBind` → `EnvironmentsBind`, etc.) — oclif's pattern-strategy loader derives a
command's id purely from its file path, never from the class name, so this rename changes
no runtime resolution; verified by building the CLI and running `--help` on all five
commands, plus one real invocation, after the rename. `environments.test.ts`'s imports and
`describe` title are updated to match, and gain a pin: every `examples` entry on these five
commands is checked against the CLI's actual file-tree-derived command-id set, so a future
topic rename that misses an `examples` string fails a test instead of shipping.
12 changes: 6 additions & 6 deletions packages/cli/src/commands/environments/bind.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@ import { createApiClient, requireAuth } from '../../utils/api-client.js';
import { formatOutput } from '../../utils/output-formatter.js';

/**
* `os projects bind` — bind a locally-compiled artifact to an existing
* `os environments bind` — bind a locally-compiled artifact to an existing
* multi-environment server project.
*
* Equivalent to `PATCH /api/v1/cloud/environments/<id>` with
Expand All@@ -20,13 +20,13 @@ import { formatOutput } from '../../utils/output-formatter.js';
* Use `--build` to compile `objectstack.config.ts` first so the artifact
* reflects the latest source.
*/
export default class ProjectsBind extends Command {
export default class EnvironmentsBind extends Command {
static override description = 'Bind a local objectstack artifact to an existing project';

static override examples = [
'$ os projects bind <project-id> --artifact ./dist/objectstack.json',
'$ os projects bind <project-id> --artifact ./dist/objectstack.json --build',
'$ os projects bind <project-id> --reseed',
'$ os environments bind <project-id> --artifact ./dist/objectstack.json',
'$ os environments bind <project-id> --artifact ./dist/objectstack.json --build',
'$ os environments bind <project-id> --reseed',
];

static override args = {
Expand DownExpand Up@@ -59,7 +59,7 @@ export default class ProjectsBind extends Command {
};

async run(): Promise<void> {
const { args, flags } = await this.parse(ProjectsBind);
const { args, flags } = await this.parse(EnvironmentsBind);

try {
const artifactRel = flags.artifact ?? './dist/objectstack.json';
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/src/commands/environments/create.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,21 +7,21 @@ import { formatOutput } from '../../utils/output-formatter.js';
import { readAuthConfig, writeAuthConfig } from '../../utils/auth-config.js';

/**
* `os projects create` — provision a new project.
* `os environments create` — provision a new project.
*
* Delegates to `ProjectProvisioningService.provisionProject` on the server.
* On success, optionally activates the new project for the current session
* and persists `activeEnvironmentId` into `~/.objectstack/credentials.json`
* (unless `--no-activate` is passed).
*/
export default class ProjectsCreate extends Command {
export default class EnvironmentsCreate extends Command {
static override description = 'Provision a new project';

static override examples = [
'$ os projects create --org 00000000-0000-0000-0000-000000000000 --name Staging',
'$ os projects create --org $ORG --name Dev --plan free',
'$ os projects create --org $ORG --name "Clone" --clone-from <source-id> --no-activate',
'$ os projects create --org $ORG --name CRM --artifact ./examples/app-crm/dist/objectstack.json',
'$ os environments create --org 00000000-0000-0000-0000-000000000000 --name Staging',
'$ os environments create --org $ORG --name Dev --plan free',
'$ os environments create --org $ORG --name "Clone" --clone-from <source-id> --no-activate',
'$ os environments create --org $ORG --name CRM --artifact ./examples/app-crm/dist/objectstack.json',
];

static override flags = {
Expand DownExpand Up@@ -56,7 +56,7 @@ export default class ProjectsCreate extends Command {
};

async run(): Promise<void> {
const { flags } = await this.parse(ProjectsCreate);
const { flags } = await this.parse(EnvironmentsCreate);

try {
const { client, token } = await createApiClient({ url: flags.url, token: flags.token });
Expand Down
Loading
Loading