Skip to content

[Change] Implement backlog refine --import-from-tmp #155

@djm81

Description

@djm81

Why

The specfact backlog refine command supports --export-to-tmp to export items to a markdown file for copilot processing and documents --import-from-tmp / --tmp-file to re-import refined content. Previously, running with --import-from-tmp only checked that the file existed and then printed "Import functionality pending implementation" and exited. Implementing the import path completes the round-trip: export → edit with copilot → import with --write, so teams can refine backlog items in bulk via their IDE without interactive prompts.

What Changes

  • Parser: Parse the refined export markdown format (same structure as --export-to-tmp: ## Item N:, ID, Body in ```markdown ... ````, Acceptance Criteria, optional title/metrics). Parser returns blocks keyed by item ID for matching against fetched items.
  • Import flow: When --import-from-tmp is set and the file exists, read and parse the file, match blocks to fetched items by ID, update each matched item's body_markdown and acceptance_criteria (and optionally title/metrics), then call the adapter's update_backlog_item when --write is set. Without --write, show a preview (e.g. "Would update N items").
  • Reuse: Same adapter/fetch as export; same update_fields logic as interactive refine (title, body_markdown, acceptance_criteria, story_points, business_value, priority).

Acceptance Criteria

  • specfact backlog refine --import-from-tmp --tmp-file <path> parses the file and matches items by ID
  • Without --write, prints "Would update N item(s)" and does not call the adapter
  • With --write, updates remote backlog via adapter and prints success summary
  • Import file not found prints clear error and suggests --tmp-file
  • No "Import functionality pending implementation" message

OpenSpec Change Proposal: implement-backlog-refine-import-from-tmp

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions