Overview
Read-side project library access for the CLI that lists, resolves, and reads projects using the same store entry points as the app and MCP server.
Description
The CLI Store module lists and resolves projects via `listExternalProjects` and `createExternalProject`. Resolves project references by exact id, unique prefix, or unique name (ambiguity is an error). Reads stored documents through `getStoredEntry` and runs project migrations for normalization. No edit session needed for reads.
Usage
- CLI project commands: Used by `occ project` and other CLI commands for project access.
Code Reference
Source Location
- Repository: OpenChatCut
- File: cli/store.ts
- Lines: 1-100
Signature
export function listProjects(): Promise<ProjectSummary[]>;
export function resolveProject(ref: string): Promise<ProjectSummary>;
export function readProjectDoc(projectId: string): Promise<ProjectDoc>;
export function createProject(name: string): Promise<ProjectSummary>;
Import
import { listProjects, resolveProject, readProjectDoc, createProject } from './store.ts';
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| ref |
string |
Yes |
Project reference (id, prefix, or name)
|
| projectId |
string |
Yes |
Project ID
|
| name |
string |
Yes |
New project name
|
Outputs
| Name |
Type |
Description
|
| listProjects() returns |
Promise<ProjectSummary[]> |
All projects
|
| resolveProject() returns |
Promise<ProjectSummary> |
Resolved project (throws on ambiguity)
|
| readProjectDoc() returns |
Promise<ProjectDoc> │ Project document
|
Usage Examples
Listing and Reading Projects
import { listProjects, readProjectDoc } from './store.ts';
const projects = await listProjects();
for (const p of projects) console.log(p.id, p.name);
const doc = await readProjectDoc(projects[0].id);
Related Pages
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.