Adds basic task management tools.
This commit is contained in:
@@ -1 +1 @@
|
||||
"""Shared automation library for PlanB task tooling."""
|
||||
"""Shared automation library for project task tooling."""
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
import argparse
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -8,6 +9,27 @@ from typing import Any, Dict, List, Optional
|
||||
from agents import BaseAgent, get_agent, get_default_agent, list_agents
|
||||
|
||||
|
||||
def load_project_config(config_path: Optional[Path] = None) -> Dict[str, Any]:
|
||||
path = config_path if config_path is not None else Path(__file__).resolve().parents[2] / "project-config.json"
|
||||
try:
|
||||
config = json.loads(path.read_text(encoding="utf-8"))
|
||||
except (OSError, json.JSONDecodeError) as error:
|
||||
raise ValueError(f"Cannot read project configuration {path}: {error}") from error
|
||||
if not isinstance(config, dict):
|
||||
raise ValueError(f"Project configuration {path} must be a JSON object")
|
||||
for field in ("name", "description"):
|
||||
if not isinstance(config.get(field), str) or not config[field].strip():
|
||||
raise ValueError(f"Project configuration {path} requires a non-empty '{field}' string")
|
||||
commands = config.get("commands")
|
||||
if not isinstance(commands, dict) or any(
|
||||
not isinstance(name, str) or not name.strip()
|
||||
or not isinstance(command, str) or not command.strip()
|
||||
for name, command in commands.items()
|
||||
):
|
||||
raise ValueError(f"Project configuration {path} requires 'commands' to map names to non-empty command strings")
|
||||
return config
|
||||
|
||||
|
||||
def load_get_task_module():
|
||||
"""Dynamically load scripts/get-task."""
|
||||
repo_root = Path(__file__).resolve().parent.parent.parent
|
||||
@@ -53,12 +75,19 @@ def build_workflow_prompt(
|
||||
extra_context: str = "",
|
||||
) -> str:
|
||||
"""Construct a standardized, high-fidelity prompt for an AI agent."""
|
||||
config = load_project_config()
|
||||
commands = "\n".join(f"- {name}: `{command}`" for name, command in config["commands"].items())
|
||||
if not commands:
|
||||
commands = "- No commands configured. Agree on relevant verification criteria with the user."
|
||||
desc = task["description"].strip() if task.get("description") else "(No description provided yet)"
|
||||
subproj_line = f"- Subproject: {task['subproject']}\n" if task.get("subproject") else ""
|
||||
epic_line = f"- Epic: {task.get('epic_label', task['epic'])} ({task['epic']})\n" if task.get("epic") else ""
|
||||
epic_arg = f" --epic={task['epic']}" if task.get("epic") else ""
|
||||
|
||||
prompt = f"""You are {workflow_name} task {task['id']} in the PlanBForGreatJustice repository.
|
||||
prompt = f"""You are {workflow_name} task {task['id']} for {config['name']}.
|
||||
|
||||
### Project:
|
||||
{config['description']}
|
||||
|
||||
### Target Task:
|
||||
- ID: {task['id']}
|
||||
@@ -71,23 +100,25 @@ def build_workflow_prompt(
|
||||
{desc}
|
||||
|
||||
### Repository Context & Guidelines:
|
||||
1. SSoT & Task Management (GEMINI.md):
|
||||
1. SSoT & Task Management (AGENTS.md):
|
||||
- You MUST use `./scripts/update-task {task['id']} ...` to update task metadata, description, title, or checklist items.
|
||||
- If this task needs to be split into subtasks, use `./scripts/add-task "Subtask Title" --project={task['project']} --type={task['type']}{epic_arg}`.
|
||||
- Do NOT edit docs/tasks.md manually.
|
||||
2. Architecture Overview:
|
||||
- C++ Story Engine: Engine/PlanB/Engine/ (Actions, Expressions, Sequences, GameState, StoryModel).
|
||||
- Desktop Editor: Editor/App/ (Tauri + Vite + React, Sequence Simulator, Expression Graph Canvas, XML converters).
|
||||
- Content: Content/Episode 1/Episode1/Episode.xml.
|
||||
- Specifications: docs/Schema/ (e.g., PBScript_Specification.md, grammar files).
|
||||
- Legacy Reference: Editor/Sources/ (WPF C# editor for comparison if applicable).
|
||||
2. Project Context:
|
||||
- Read AGENTS.md, README.md, and relevant project documents before starting.
|
||||
- Do not assume this is software or prescribe a language, platform, or architecture.
|
||||
- Use the project's agreed verification criteria, including human review when appropriate.
|
||||
|
||||
### Optional Project Commands (guidance, not automatically executed):
|
||||
{commands}
|
||||
|
||||
3. Objectives for this session:
|
||||
{workflow_objective}
|
||||
"""
|
||||
if extra_context:
|
||||
prompt += f"\n### Additional Context:\n{extra_context}\n"
|
||||
|
||||
prompt += f"\nBegin by reviewing the task, inspecting the relevant code, and collaborating interactively with the user.\n"
|
||||
prompt += "\nBegin by reviewing the task, inspecting the relevant project materials, and collaborating interactively with the user.\n"
|
||||
return prompt
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user