mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-07 17:04:42 +00:00
* 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
25 lines
822 B
TypeScript
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);
|
|
}
|
|
}
|