Skip to content

feat: write resume file specified by flag#6616

Merged
Mzack9999 merged 2 commits intoprojectdiscovery:devfrom
circleous:feat-resume-file
Nov 18, 2025
Merged

feat: write resume file specified by flag#6616
Mzack9999 merged 2 commits intoprojectdiscovery:devfrom
circleous:feat-resume-file

Conversation

@circleous
Copy link
Contributor

@circleous circleous commented Nov 17, 2025

Proposed changes

-resume will use the provided flag as path to save the resume config, instead of only used as loading. Possibly a breaking changes.

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • Bug Fixes

    • Resume functionality now supports configurable file path with automatic fallback to default location for improved flexibility.
  • Documentation

    • Updated resume flag help text to clarify resume data saving and loading behavior.

@auto-assign auto-assign bot requested a review from Mzack9999 November 17, 2025 06:17
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Walkthrough

The resume file handling in nuclei's main entry point is refactored. The resumeFileName now prioritizes the configurable options.Resume parameter before falling back to a default path. The help text for the resume flag is also updated to clarify the behavior.

Changes

Cohort / File(s) Change Summary
Resume Configuration Enhancement
cmd/nuclei/main.go
Modified resume file path resolution to check options.Resume first with fallback to default path; updated help text to clarify resume behavior as "resume from and save to specified file"

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Single file modification with straightforward fallback logic
  • Help text update is cosmetic with no functional impact
  • Minimal surface area for potential issues

Poem

🐰 Resume now bends to config's will,
With fallback paths to save the skill,
A flexible hop, from default to choice,
The rabbit hops with clearer voice! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: the resume flag now specifies where the resume file is written, matching the core functionality modification in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 141f34a and 7877341.

📒 Files selected for processing (1)
  • cmd/nuclei/main.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Lint
🔇 Additional comments (2)
cmd/nuclei/main.go (2)

261-261: Add a changelog entry documenting this breaking change.

The updated help text accurately describes the new behavior. However, web search confirms there is no dedicated migration guide for breaking changes—Project Discovery documents changes in GitHub release notes and CLI/docs. For a breaking change to the resume flag behavior, add an entry to the project's changelog (typically in CHANGELOG.md or GitHub release notes) explicitly documenting:

  • The old behavior (resume via resume.cfg)
  • The new behavior (resume from and save to specified file)
  • The side effect (clustering disabled)
  • Migration guidance for affected users

198-201: Remove directory creation suggestion—it's already implemented in SaveResumeConfig().

The code at lines 198-201 correctly implements the feature. The concern about missing directory creation is invalid: the SaveResumeConfig method already handles this at internal/runner/runner.go lines 918-920 with os.MkdirAll(). Path validation for resume file loading is also handled via ShouldLoadResume(), which checks file existence before attempting to read. The implementation properly integrates with existing resume infrastructure across the codebase.

Likely an incorrect or invalid review comment.

Comment on lines 198 to 201
resumeFileName := options.Resume
if resumeFileName == "" {
resumeFileName = types.DefaultResumeFilePath()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add tests for the new resume file behavior.

As noted in the PR objectives, tests proving the feature are not yet completed. Given this is a breaking change, comprehensive testing is essential to ensure:

  1. Resume file is created at the user-specified path when -resume flag is provided.
  2. Resume file falls back to default path when flag is not provided.
  3. Error handling works correctly for invalid paths.
  4. Successful cleanup removes the correct resume file.
🤖 Prompt for AI Agents
In cmd/nuclei/main.go around lines 198 to 201, tests are missing for the new
resume file behavior; add unit/integration tests that (1) invoke the CLI or call
the underlying resume-file logic with the -resume flag set and assert the resume
file is created at the provided path, (2) call the logic without the flag and
assert the resume file is created at types.DefaultResumeFilePath(), (3) pass an
invalid/unwritable path and assert the code returns an error (and that no file
is created), and (4) simulate successful cleanup and assert the correct resume
file is removed; ensure tests create and teardown temporary directories/files to
avoid side effects and run reliably in CI.

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Now it should behave like nmap resume

@Mzack9999
Copy link
Member

GH actions errors eeems unrelated to this PR - merging

@Mzack9999 Mzack9999 merged commit d20240b into projectdiscovery:dev Nov 18, 2025
11 of 14 checks passed
@dwisiswant0 dwisiswant0 mentioned this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants