API Reference¶
Complete API documentation for plan-view, generated from source code docstrings.
CLI Entry Point¶
The main CLI module that dispatches to view and edit commands.
CLI for viewing and editing plan.json files.
- plan_view.cli.load_plan(path, *, auto_migrate=False)[source]¶
Load and parse plan.json, ensuring special phases exist.
- plan_view.cli.save_plan(path, plan)[source]¶
Save plan.json with updated timestamp and sorted phases.
- plan_view.cli.resolve_plan_path(explicit_path=None)[source]¶
Resolve the plan.json path using config files if no explicit path given.
Resolution order: 1. If explicit_path is provided and not the default, use it directly 2. Search for .pv.toml or pyproject.toml [tool.pv] walking up from cwd 3. If config found with plan_file setting, resolve relative to config location 4. Fall back to ./plan.json
- Config file format (.pv.toml or pyproject.toml [tool.pv]):
plan_file = “path/to/plan.json” # Relative to config file location
- plan_view.cli.get_current_phase(plan)[source]¶
Find the current in_progress or first pending phase (skips special phases).
- plan_view.cli.get_next_task(plan)[source]¶
Find the next actionable task with all dependencies met (skips special phases).
- plan_view.cli.find_task(plan, task_id)[source]¶
Find a task by ID (exact or prefix match), return (phase, task) or None.
- plan_view.cli.cmd_overview(plan, *, as_json=False, show_all=False)[source]¶
Display full plan overview with all phases and tasks.
By default, completed phases are hidden. Use –all to show everything.
- plan_view.cli.cmd_current(plan, *, as_json=False)[source]¶
Display completed phases summary, current phase, and next task.
- plan_view.cli.cmd_phase(plan, *, as_json=False)[source]¶
Display current phase details with all tasks and dependencies.
- plan_view.cli.cmd_get(plan, task_id, *, as_json=False)[source]¶
Display a specific task or phase by ID.
- plan_view.cli.cmd_future(plan, count=5, *, as_json=False)[source]¶
Display upcoming tasks (pending/in_progress), actionable first.
- plan_view.cli.cmd_table(plan, phase_id=None, *, as_json=False)[source]¶
Display plan or phase tasks in table format.
- plan_view.cli.cmd_validate(plan, path, *, as_json=False)[source]¶
Validate plan against JSON schema.
- plan_view.cli.cmd_ai_context(plan)[source]¶
Output minimal context for AI agents: next task + current phase + key info.
- plan_view.cli.cmd_ai_actionable(plan)[source]¶
Output only actionable tasks (pending with deps met) for AI agents.
- plan_view.cli.cmd_defer(plan, args)[source]¶
Move task to deferred phase, or create a new deferred task if input is not an existing task ID.
- plan_view.cli.cmd_bug(plan, args)[source]¶
Move task to bugs phase, or create a new bug if input is not an existing task ID.
- plan_view.cli.cmd_idea(plan, args)[source]¶
Move task to ideas phase, or create a new idea if input is not an existing task ID.
- plan_view.cli.cmd_compact(plan, args)[source]¶
Backup plan and compact completed tasks to minimal fields.
View Commands¶
Commands for reading and displaying plan data.
View commands for displaying plan information.
- plan_view.commands.view.cmd_ai_context(plan)[source]¶
Output minimal context for AI agents: next task + current phase + key info.
- plan_view.commands.view.cmd_ai_actionable(plan)[source]¶
Output only actionable tasks (pending with deps met) for AI agents.
- plan_view.commands.view.cmd_ai_files(plan, task_id=None)[source]¶
Output files for a task or current task.
- plan_view.commands.view.cmd_overview(plan, *, as_json=False, show_all=False)[source]¶
Display full plan overview with all phases and tasks.
By default, completed phases are hidden. Use –all to show everything.
- plan_view.commands.view.cmd_current(plan, *, as_json=False)[source]¶
Display completed phases summary, current phase, and next task.
- plan_view.commands.view.cmd_phase(plan, *, as_json=False)[source]¶
Display current phase details with all tasks and dependencies.
- plan_view.commands.view.cmd_get(plan, task_id, *, as_json=False)[source]¶
Display a specific task or phase by ID.
- plan_view.commands.view.cmd_last(plan, count=5, *, as_json=False)[source]¶
Display recently completed tasks.
- plan_view.commands.view.cmd_future(plan, count=5, *, as_json=False)[source]¶
Display upcoming tasks (pending/in_progress), actionable first.
- plan_view.commands.view.cmd_summary(plan, *, as_json=False)[source]¶
Display summary of plan progress.
- plan_view.commands.view.cmd_validate(plan, path, *, as_json=False)[source]¶
Validate plan against JSON schema.
- plan_view.commands.view.cmd_bugs(plan, *, as_json=False)[source]¶
Display bugs phase with all tasks.
- plan_view.commands.view.cmd_deferred(plan, *, as_json=False)[source]¶
Display deferred phase with all tasks.
Edit Commands¶
Commands for modifying plan data.
Edit commands for modifying plan data.
- plan_view.commands.edit.cmd_defer(plan, args)[source]¶
Move task to deferred phase, or create a new deferred task if input is not an existing task ID.
- plan_view.commands.edit.cmd_bug(plan, args)[source]¶
Move task to bugs phase, or create a new bug if input is not an existing task ID.
- plan_view.commands.edit.cmd_idea(plan, args)[source]¶
Move task to ideas phase, or create a new idea if input is not an existing task ID.
- plan_view.commands.edit.cmd_compact(plan, args)[source]¶
Backup plan and compact completed tasks to minimal fields.
I/O¶
Plan loading, saving, and validation.
Plan file I/O operations.
- plan_view.io.resolve_plan_path(explicit_path=None)[source]¶
Resolve the plan.json path using config files if no explicit path given.
Resolution order: 1. If explicit_path is provided and not the default, use it directly 2. Search for .pv.toml or pyproject.toml [tool.pv] walking up from cwd 3. If config found with plan_file setting, resolve relative to config location 4. Fall back to ./plan.json
- Config file format (.pv.toml or pyproject.toml [tool.pv]):
plan_file = “path/to/plan.json” # Relative to config file location
- plan_view.io.load_plan(path, *, auto_migrate=False)[source]¶
Load and parse plan.json, ensuring special phases exist.
- plan_view.io.save_plan(path, plan)[source]¶
Save plan.json with updated timestamp and sorted phases.
State¶
Plan state management and task lookup.
Plan state calculations and lookup operations.
- plan_view.state.get_current_phase(plan)[source]¶
Find the current in_progress or first pending phase (skips special phases).
- plan_view.state.get_next_task(plan)[source]¶
Find the next actionable task with all dependencies met (skips special phases).
- plan_view.state.find_task(plan, task_id)[source]¶
Find a task by ID (exact or prefix match), return (phase, task) or None.
- plan_view.state.get_all_task_ids(plan, limit=5)[source]¶
Get task IDs with titles and phase names (limited for display).
Formatting¶
Terminal output formatting and styling.
ANSI terminal formatting utilities for pv-tool.
Decorators¶
CLI decorator utilities.
Decorators for command functions.
- plan_view.decorators.require_plan(func)[source]¶
Decorator to load plan from args.file and inject it as first argument.
This eliminates the boilerplate of loading plan, checking for None, and asserting for the type checker. The wrapped function receives the loaded plan dict as its first positional argument.
- Parameters:
func (
Callable[[Concatenate[dict,Namespace,ParamSpec(P)]],TypeVar(R)]) – Command function that takes (plan: dict, args: Namespace, …) -> R- Returns:
Namespace, …) -> R
- Return type:
Wrapped function that takes (args
Example:
@require_plan def cmd_add_task(plan: dict, args: argparse.Namespace) -> None: phase = find_phase(plan, args.phase) ...