Skip to content

feat(cli): Add papi attach command for upgrading paper assets #7

@hummat

Description

@hummat

Problem or Motivation

Users cannot fix missing or low-quality assets after initial paper ingest. Common scenarios:

  • Downloaded PDF is corrupted or scan-only → need to attach better PDF
  • arXiv paper had no LaTeX source → want to attach .tex files later
  • Want to regenerate summaries/equations after attaching new source

Proposed Solution

Add papi attach command:

papi attach PAPER --pdf /path/to/better.pdf
papi attach PAPER --source /path/to/main.tex
papi attach PAPER --pdf new.pdf --regen auto

Options

  • --pdf PATH: Replace PDF file
  • --source PATH: Add/replace LaTeX source (file or directory)
  • --regen {auto,equations,summary,tags,tldr,all}: Regenerate artifacts after attachment
    • auto: regenerate only what the new attachment enables (e.g., equations from LaTeX)
    • Specific: regenerate only specified artifact
    • all: regenerate everything
  • --backup: Create backup before replacement (default: true)

Implementation

Complexity: LOW — straightforward file operations + meta.json updates

  1. Validate paper exists in index
  2. Backup existing files if --backup (default)
  3. Copy new files to ~/.paperpipe/papers/{name}/
  4. Update meta.json with new file paths/metadata
  5. Run regeneration if --regen specified
  6. Update index

Alternatives Considered

  • Re-run papi add with new files — would require delete + re-add, losing metadata
  • Manual file replacement — error-prone, doesn't update meta.json

Area

CLI commands

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions