MCPcopy Create free account
hub / github.com/SethGammon/Citadel / fetchWithGh

Function fetchWithGh

scripts/codex-review-fetch.js:85–102  ·  view source on GitHub ↗
(commands, ghPath)

Source from the content-addressed store, hash-verified

83}
84
85function fetchWithGh(commands, ghPath) {
86 const batches = [];
87 for (const [_command, args] of commands) {
88 const result = spawnSync(ghPath, args, {
89 encoding: 'utf8',
90 stdio: ['pipe', 'pipe', 'pipe'],
91 maxBuffer: 16 * 1024 * 1024,
92 shell: process.platform === 'win32',
93 });
94 if (result.status !== 0) {
95 const detail = (result.stderr || result.stdout || result.error?.message || '').trim();
96 throw new Error(`gh api failed for ${args[1]}: ${detail}`);
97 }
98 const source = sourceForArgs(args);
99 batches.push(...parseJsonValues(result.stdout).map((item) => ({ source, ...item })));
100 }
101 return batches;
102}
103
104if (process.argv.includes('--help')) {
105 console.log('Usage: node scripts/codex-review-fetch.js --repo owner/name --pr N [--write]');

Callers 1

Calls 2

sourceForArgsFunction · 0.85
parseJsonValuesFunction · 0.85

Tested by

no test coverage detected