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

Function show

packages/cli/src/show.ts:29–61  ·  view source on GitHub ↗
(jsonPath: string, options: DiffScopeOptions)

Source from the content-addressed store, hash-verified

27import { LOOPBACK_HOST, startServer } from "./server.js";
28
29export async function show(jsonPath: string, options: DiffScopeOptions): Promise<void> {
30 const db = getDb();
31 const { chaptersFile, prNumber } = await buildChaptersFile(jsonPath, options);
32 const { runId } = insertChaptersFile(db, chaptersFile, readRepoContext(), prNumber);
33
34 const handle = await startServer({
35 routes: [
36 ...runRoutes(db),
37 ...viewStateRoutes(db),
38 ...commentRoutes(db),
39 ...viewerRoutes(),
40 ...diffRoutes(db),
41 ...pullRequestRoutes(db),
42 ...pullRequestMutationRoutes(db),
43 ],
44 });
45 const { port } = handle;
46 const url = `http://${LOOPBACK_HOST}:${port}/runs/${encodeURIComponent(runId)}`;
47
48 process.stdout.write(`Listening on ${url}\n`);
49 process.stdout.write("Press Ctrl+C to exit.\n");
50
51 try {
52 await open(url);
53 } catch {
54 // URL is on stdout — user can navigate manually.
55 }
56
57 await waitForShutdownSignal();
58
59 await handle.close();
60 closeDb();
61}
62
63interface BuiltChaptersFile {
64 chaptersFile: ChaptersFile;

Callers 1

index.tsFile · 0.85

Calls 14

getDbFunction · 0.85
buildChaptersFileFunction · 0.85
insertChaptersFileFunction · 0.85
readRepoContextFunction · 0.85
startServerFunction · 0.85
runRoutesFunction · 0.85
viewStateRoutesFunction · 0.85
commentRoutesFunction · 0.85
viewerRoutesFunction · 0.85
diffRoutesFunction · 0.85
pullRequestRoutesFunction · 0.85

Tested by

no test coverage detected