refactor: replace resume-ops API integration with CLI-based approach#644
refactor: replace resume-ops API integration with CLI-based approach#644Rat-S wants to merge 3 commits into
Conversation
- Replaced API-based resume-ops integration with direct CLI invocation in resume-ops.mjs - Removed start-resume-ops.mjs (no longer needed with CLI approach) - Updated package.json scripts to reflect CLI-based workflow - Updated modes/resume-ops.md documentation for CLI integration
|
Welcome to career-ops, @Rat-S! Thanks for your first PR. A few things to know:
We'll review your PR soon. Join our Discord if you have questions. |
📝 WalkthroughWalkthroughThis PR introduces a complete resume-ops feature: a CLI-driven workflow for tailored resume generation. The implementation adds npm script integration, a Node.js wrapper that orchestrates invocation of an underlying uv-based tool, comprehensive documentation, test fixtures, and artifact exclusion rules to maintain a clean repository. ChangesResume-Ops Feature
Sequence DiagramsequenceDiagram
participant User
participant npm
participant resume-ops.mjs
participant uv
participant FileSystem
User->>npm: npm run resume-ops --resume=cv.json --jd=job.txt --output=output.pdf
npm->>resume-ops.mjs: node resume-ops.mjs [args]
resume-ops.mjs->>FileSystem: validate resume file exists
resume-ops.mjs->>FileSystem: resolve JD (file or write temp text)
resume-ops.mjs->>FileSystem: ensure output directory exists
resume-ops.mjs->>uv: spawn uv run resume-ops --output output.pdf --output-json output.json
uv->>FileSystem: generate PDF and JSON resume
FileSystem-->>uv: output files
uv-->>resume-ops.mjs: exit code
resume-ops.mjs->>FileSystem: cleanup temp JD if created
resume-ops.mjs-->>User: resolved promise or error
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested Labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@modes/resume-ops.md`:
- Around line 21-23: The fenced code block containing the node command (```bash
... ``` around the node resume-ops.mjs invocation) lacks blank lines before and
after; to satisfy MD031 add a single blank line immediately above the opening
```bash and a single blank line immediately below the closing ``` so the code
block is separated from surrounding text.
In `@resume-ops.mjs`:
- Line 8: Add a preflight check that verifies RESUME_OPS_DIR exists and is a
directory before attempting to spawn processes; locate the RESUME_OPS_DIR
constant and the code that calls spawn (the spawn invocation around the
resume-ops usage) and, before calling spawn, use fs.existsSync or
fs.statSync/fs.accessSync to confirm the path exists and is a directory, and if
not throw or log a clear, actionable error (e.g., "resume-ops directory not
found: RESUME_OPS_DIR — ensure sibling resume-ops is present") so the script
fails fast with a helpful message.
- Around line 44-61: Validate that params.output/outputPath ends with a .pdf
before deriving jsonPath: check outputPath with /\.pdf$/i and if it does not
match, stop and surface a clear error (e.g., console.error or
processLogger.error + process.exit(1)) asking for a PDF output path, otherwise
compute jsonPath = outputPath.replace(/\.pdf$/i, '.json') and push
'--output-json' to cliArgs; update the code around outputPath, jsonPath, cliArgs
and the params.output handling accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 686a6b26-69a3-4d5f-816a-c73d2362a414
📒 Files selected for processing (5)
.gitignoremodes/resume-ops.mdpackage.jsonresume-ops.mjsscratch/test-jd.txt
| ```bash | ||
| node resume-ops.mjs --resume resume-ops/.local/master-resume.json --jd "{JD_TEXT}" --output output/cv-{candidate}-{company}-{YYYY-MM-DD}.pdf | ||
| ``` |
There was a problem hiding this comment.
Fix fenced code block spacing for markdownlint compliance.
Line 21 and Line 23 need blank lines around the fenced code block to satisfy MD031.
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 21-21: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
[warning] 23-23: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@modes/resume-ops.md` around lines 21 - 23, The fenced code block containing
the node command (```bash ... ``` around the node resume-ops.mjs invocation)
lacks blank lines before and after; to satisfy MD031 add a single blank line
immediately above the opening ```bash and a single blank line immediately below
the closing ``` so the code block is separated from surrounding text.
| import { fileURLToPath } from 'url'; | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
| const RESUME_OPS_DIR = path.resolve(__dirname, '..', 'resume-ops'); |
There was a problem hiding this comment.
Add an explicit preflight check for RESUME_OPS_DIR before spawning.
If the sibling resume-ops directory is missing, execution fails late with a spawn error instead of a clear setup message. Fail fast with an actionable error before spawn.
Proposed fix
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const RESUME_OPS_DIR = path.resolve(__dirname, '..', 'resume-ops');
async function main() {
+ if (!fs.existsSync(RESUME_OPS_DIR)) {
+ console.error(`❌ Required directory not found: ${RESUME_OPS_DIR}`);
+ console.error(' Expected a sibling `resume-ops` checkout. Run setup first (e.g., `uv sync`).');
+ process.exit(1);
+ }
+
const args = process.argv.slice(2);Also applies to: 69-74
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@resume-ops.mjs` at line 8, Add a preflight check that verifies RESUME_OPS_DIR
exists and is a directory before attempting to spawn processes; locate the
RESUME_OPS_DIR constant and the code that calls spawn (the spawn invocation
around the resume-ops usage) and, before calling spawn, use fs.existsSync or
fs.statSync/fs.accessSync to confirm the path exists and is a directory, and if
not throw or log a clear, actionable error (e.g., "resume-ops directory not
found: RESUME_OPS_DIR — ensure sibling resume-ops is present") so the script
fails fast with a helpful message.
| const outputPath = path.resolve(params.output); | ||
| fs.mkdirSync(path.dirname(outputPath), { recursive: true }); | ||
|
|
||
| // Build CLI arguments for resume-ops | ||
| const cliArgs = [ | ||
| 'run', 'resume-ops', | ||
| '--resume', resumePath, | ||
| '--jd', jdPath, | ||
| '--output', outputPath, | ||
| ]; | ||
|
|
||
| if (params.theme) { | ||
| cliArgs.push('--theme', params.theme); | ||
| } | ||
|
|
||
| // Also request the intermediate tailored JSON alongside the PDF | ||
| const jsonPath = outputPath.replace(/\.pdf$/i, '.json'); | ||
| cliArgs.push('--output-json', jsonPath); |
There was a problem hiding this comment.
Validate that --output is a PDF path before deriving --output-json.
Without a .pdf suffix, jsonPath can collapse to the same path as outputPath, which can produce conflicting outputs.
Proposed fix
const outputPath = path.resolve(params.output);
+ if (!/\.pdf$/i.test(outputPath)) {
+ console.error('❌ --output must be a .pdf path');
+ process.exit(1);
+ }
fs.mkdirSync(path.dirname(outputPath), { recursive: true });📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const outputPath = path.resolve(params.output); | |
| fs.mkdirSync(path.dirname(outputPath), { recursive: true }); | |
| // Build CLI arguments for resume-ops | |
| const cliArgs = [ | |
| 'run', 'resume-ops', | |
| '--resume', resumePath, | |
| '--jd', jdPath, | |
| '--output', outputPath, | |
| ]; | |
| if (params.theme) { | |
| cliArgs.push('--theme', params.theme); | |
| } | |
| // Also request the intermediate tailored JSON alongside the PDF | |
| const jsonPath = outputPath.replace(/\.pdf$/i, '.json'); | |
| cliArgs.push('--output-json', jsonPath); | |
| const outputPath = path.resolve(params.output); | |
| if (!/\.pdf$/i.test(outputPath)) { | |
| console.error('❌ --output must be a .pdf path'); | |
| process.exit(1); | |
| } | |
| fs.mkdirSync(path.dirname(outputPath), { recursive: true }); | |
| // Build CLI arguments for resume-ops | |
| const cliArgs = [ | |
| 'run', 'resume-ops', | |
| '--resume', resumePath, | |
| '--jd', jdPath, | |
| '--output', outputPath, | |
| ]; | |
| if (params.theme) { | |
| cliArgs.push('--theme', params.theme); | |
| } | |
| // Also request the intermediate tailored JSON alongside the PDF | |
| const jsonPath = outputPath.replace(/\.pdf$/i, '.json'); | |
| cliArgs.push('--output-json', jsonPath); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@resume-ops.mjs` around lines 44 - 61, Validate that params.output/outputPath
ends with a .pdf before deriving jsonPath: check outputPath with /\.pdf$/i and
if it does not match, stop and surface a clear error (e.g., console.error or
processLogger.error + process.exit(1)) asking for a PDF output path, otherwise
compute jsonPath = outputPath.replace(/\.pdf$/i, '.json') and push
'--output-json' to cliArgs; update the code around outputPath, jsonPath, cliArgs
and the params.output handling accordingly.
Summary
Replaced the API-based resume-ops integration with a direct CLI invocation approach for improved reliability and simplicity.
Changes
resume-ops.mjs: Refactored to invoke resume-ops via CLI instead of HTTP API callsstart-resume-ops.mjs: Removed — no longer needed with the CLI-based approachpackage.json: Updated scripts to reflect the CLI-based workflowmodes/resume-ops.md: Updated documentation for CLI integrationValidation
npm run doctor: Environment setup issues only (missing cv.md, profile.yml — pre-existing)node verify-pipeline.mjs: Passednode cv-sync-check.mjs: Environment setup issues only (missing cv.md, profile.yml — pre-existing)Related
N/A
Summary by CodeRabbit
Release Notes
New Features
Documentation
Chores
jsonresume-theme-stackoverflow,puppeteer, andresumed..gitignoreto exclude generated workspace and temporary files.