MCPcopy Create free account
hub / github.com/ResearAI/DeepReviewer-v2 / cmd_result

Function cmd_result

main.py:167–214  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

165
166
167def cmd_result(args: argparse.Namespace) -> int:
168 job = load_job_state(args.job_id)
169 if job is None:
170 _print_json({'status': 'error', 'message': f'Job not found: {args.job_id}'})
171 return 2
172
173 if job.status != JobStatus.completed:
174 _print_json(
175 {
176 'status': 'not_ready',
177 'job_id': str(job.id),
178 'current_status': job.status.value,
179 'message': job.message,
180 'usage': job.usage.model_dump(mode='json'),
181 }
182 )
183 return 0
184
185 md_path = Path(job.artifacts.final_markdown_path or '')
186 pdf_path = Path(job.artifacts.report_pdf_path or '')
187
188 if args.format == 'md':
189 if not md_path.exists():
190 _print_json({'status': 'error', 'message': f'Markdown report missing: {md_path}'})
191 return 2
192 print(md_path.read_text(encoding='utf-8'))
193 return 0
194
195 if args.format == 'pdf':
196 _print_json(
197 {
198 'job_id': str(job.id),
199 'report_pdf_path': str(pdf_path) if pdf_path.exists() else None,
200 'final_markdown_path': str(md_path) if md_path.exists() else None,
201 }
202 )
203 return 0
204
205 markdown = md_path.read_text(encoding='utf-8') if md_path.exists() else ''
206 _print_json(
207 {
208 'job_id': str(job.id),
209 'final_markdown_path': str(md_path) if md_path.exists() else None,
210 'report_pdf_path': str(pdf_path) if pdf_path.exists() else None,
211 'final_markdown': markdown,
212 }
213 )
214 return 0
215
216
217def cmd_watch(args: argparse.Namespace) -> int:

Callers

nothing calls this directly

Calls 2

load_job_stateFunction · 0.90
_print_jsonFunction · 0.85

Tested by

no test coverage detected