Overview
End-to-end verification harness for the `occ` CLI that spawns the installed entry point as a child process against a throwaway library, exercising argv parsing, profile resolution, the store, the offline edit session, and the commit path.
Description
The CLI Verify module drives the CLI entry point (`cli/main.ts`) in a child process with a temporary HOME and data directory. It tests approximately 20 scenarios: empty library reporting, project creation, tool listing (headless vs browser-only), read/draft/apply flows, version snapshotting, batch edits, clip operations (move/trim/dup/split/rm), GL effects, template catalogs, media import with deduplication, render planning, and JianYing export. SQLite connections are closed before cleanup to avoid file-lock issues.
Usage
- CI pipeline: Run as part of the verify suite to validate the full offline edit session pipeline end-to-end.
- Regression detection: Execute after CLI changes to ensure no behavior breaks.
Code Reference
Source Location
- Repository: OpenChatCut
- File: cli/cli.verify.ts
- Lines: 1-531
Signature
function toneWav(): Buffer;
function occ(args: string[], opts?: { input?: string }): { status: number; stdout: string; stderr: string };
function occOk(args: string[], opts?: { input?: string }): { stdout: string; stderr: string };
function occJson(args: string[], opts?: { input?: string }): unknown;
function activeTimelineSize(library: string): number;
Import
// This is a test entry point, not imported by application code.
// Run via: npx tsx cli/cli.verify.ts
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| args |
string[] |
Yes |
CLI arguments to pass to the child process
|
| opts.input |
string |
No |
Optional stdin input for the child process
|
Outputs
| Name |
Type |
Description
|
| occ() returns |
{ status, stdout, stderr } |
Child process result with exit code and output streams
|
| occOk() returns |
{ stdout, stderr } |
Successful CLI output (throws on non-zero exit)
|
| occJson() returns |
unknown |
Parsed JSON from successful CLI output
|
| toneWav() returns |
Buffer |
Half-second silence WAV at 8 kHz for test fixtures
|
Usage Examples
Running the Verify Suite
// Execute the full CLI verification suite
// npx tsx cli/cli.verify.ts
// The suite spawns `cli/main.ts` as a child process with a
// throwaway HOME and OPENCHATCUT_DATA_DIR, then runs ~20
// assertion scenarios covering the full CLI surface.
Related Pages
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.