Skip to content

Plan-Execute Phase 1: retrofit ghtraf create with plan-execute pattern #55

@djdarcy

Description

@djdarcy

Retrofit ghtraf create with plan-execute pattern

Problem

create.py has 6+ if dry_run: branches with separate logic for gist creation, variable setting, secret setup, file configuration, and config writing. Each branch is a potential divergence point between dry-run and real execution.

Proposed solution

Extract the decision logic from run() into plan_create(args, config) -> Plan, then implement execute_plan(plan, args, config) that iterates the plan's actions.

Key actions to model:

  • CREATE_GIST (badge, archive) — returns gist ID via ActionResult.output
  • SET_VARIABLE (TRAFFIC_GIST_ID, TRAFFIC_ARCHIVE_GIST_ID) — depends on gist creation
  • SET_SECRET (PAT) — requires_input=True
  • CONFIGURE_FILE (dashboard, readme, workflow) — regex replacements
  • WRITE_CONFIG (.ghtraf.json, global config)

Remove dry_run parameter from gist.create_badge_gist(), gist.create_archive_gist(), gh.set_repo_variable(). These become pure executors called only during plan execution.

Acceptance criteria

  • plan_create() returns a Plan with all actions
  • ghtraf create --dry-run and ghtraf create use the same plan_create()
  • gist.py functions no longer accept dry_run parameter
  • gh.py functions no longer accept dry_run parameter
  • Cascading gist IDs flow through plan.context
  • PAT setup action flagged with requires_input=True
  • Tests verify plan contents for various config scenarios

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    clightraf CLI tool and command-line interfaceenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions