MCPcopy Create free account
hub / github.com/ReviewStage/stage-cli / toDiffScopeOptions

Function toDiffScopeOptions

packages/cli/src/index.ts:36–51  ·  view source on GitHub ↗

* Build the diff scope from CLI input. `--pr` resolves the base/head from a * GitHub PR and so can't be combined with the local-ref selectors.

(refs: string[], opts: DiffCommandOptions)

Source from the content-addressed store, hash-verified

34 * GitHub PR and so can't be combined with the local-ref selectors.
35 */
36function toDiffScopeOptions(refs: string[], opts: DiffCommandOptions): DiffScopeOptions {
37 if (opts.pr !== undefined) {
38 if (
39 refs.length > 0 ||
40 opts.base !== undefined ||
41 opts.compare !== undefined ||
42 opts.ref !== undefined
43 ) {
44 throw new Error("--pr cannot be combined with git refs, --base, --compare, or --ref.");
45 }
46 return { pr: opts.pr };
47 }
48 const workingTreeRef =
49 opts.ref !== undefined ? z.enum(WORKING_TREE_REF).parse(opts.ref) : undefined;
50 return { base: opts.base, compare: opts.compare, refs, workingTreeRef };
51}
52
53program
54 .command("prep")

Callers 1

index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected