Files
paseo/packages/cli/src/commands/project/ls.ts
T
Mohamed Boudra ac4331456c Manage projects from the CLI (#3460)
* feat(cli): manage projects

Expose the existing project lifecycle through one CLI command group so projects can be managed without opening the app.

* fix(cli): preserve remote project paths

Project paths belong to the daemon when a target is explicit. Require that path instead of resolving the CLI machine's cwd, and keep local convenience resolution for the default connection.

* docs(cli): document project management

* docs(cli): remove repeated project reference
2026-08-16 20:32:08 +02:00

25 lines
822 B
TypeScript

import type { Command } from "commander";
import type { CommandOptions, ListResult } from "../../output/index.js";
import { buildDaemonConnectionCommandError, connectToDaemon } from "../../utils/client.js";
import { projectSchema, toProjectRow, type ProjectRow } from "./shared.js";
export async function runLsCommand(
options: CommandOptions,
_command: Command,
): Promise<ListResult<ProjectRow>> {
const client = await connectToDaemon({ host: options.host }).catch((error: unknown) => {
throw buildDaemonConnectionCommandError({ host: options.host, error });
});
try {
const payload = await client.listProjects();
return {
type: "list",
data: payload.projects.map(toProjectRow),
schema: projectSchema,
};
} finally {
await client.close().catch(() => undefined);
}
}