feat: schedule init --engagement for customer bootstrap presets
Some checks failed
ci / test (push) Has been cancelled
Some checks failed
ci / test (push) Has been cancelled
Add --engagement, --agents, and --bootstrap-cadence flags to scaffold hourly/daily/weekly engagement schedules. Hourly bootstrap keeps cadence: daily with hourly cron overrides per coulomb-loop ADR-003. Document activity-core requirements in activity-core-handoff-engagement.md. Closes KAIZEN-WP-0008 T02 and T04.
This commit is contained in:
@@ -26,6 +26,7 @@ from .optimization import OptimizationLoop, MIN_SAMPLES_FOR_RECOMMENDATIONS
|
||||
from .schedule import (
|
||||
ScheduleError,
|
||||
default_schedule_yaml,
|
||||
engagement_schedule_yaml,
|
||||
load_schedule,
|
||||
schedule_path,
|
||||
validate_schedule,
|
||||
@@ -1455,8 +1456,39 @@ def schedule_validate(target: str):
|
||||
"--timezone", default="Europe/Berlin", show_default=True, help="Schedule timezone"
|
||||
)
|
||||
@click.option("--force", is_flag=True, help="Overwrite an existing schedule.yml")
|
||||
def schedule_init(target: str, timezone: str, force: bool):
|
||||
"""Scaffold a default .kaizen/schedule.yml (coach + optimization weekly)."""
|
||||
@click.option(
|
||||
"--engagement",
|
||||
default=None,
|
||||
help="Customer engagement slug (bootstrap schedule for target repos)",
|
||||
)
|
||||
@click.option(
|
||||
"--agents",
|
||||
default=None,
|
||||
help="Comma-separated agents for --engagement (default: coach,optimization)",
|
||||
)
|
||||
@click.option(
|
||||
"--bootstrap-cadence",
|
||||
type=click.Choice(["hourly", "daily", "weekly"]),
|
||||
default="hourly",
|
||||
show_default=True,
|
||||
help="Cadence preset for --engagement (hourly uses daily enum + hourly cron)",
|
||||
)
|
||||
def schedule_init(
|
||||
target: str,
|
||||
timezone: str,
|
||||
force: bool,
|
||||
engagement: Optional[str],
|
||||
agents: Optional[str],
|
||||
bootstrap_cadence: str,
|
||||
):
|
||||
"""Scaffold .kaizen/schedule.yml (weekly default or engagement bootstrap)."""
|
||||
if (agents or bootstrap_cadence != "hourly") and not engagement:
|
||||
click.echo(
|
||||
"Error: --agents and --bootstrap-cadence require --engagement",
|
||||
err=True,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
path = schedule_path(_project_root(target))
|
||||
|
||||
if path.exists() and not force:
|
||||
@@ -1464,9 +1496,41 @@ def schedule_init(target: str, timezone: str, force: bool):
|
||||
click.echo(" Use --force to overwrite.")
|
||||
return
|
||||
|
||||
if engagement:
|
||||
agent_list = (
|
||||
[item.strip() for item in agents.split(",") if item.strip()]
|
||||
if agents
|
||||
else None
|
||||
)
|
||||
known_agents = _get_registry().agent_names()
|
||||
if agent_list:
|
||||
unknown = [name for name in agent_list if name not in known_agents]
|
||||
if unknown:
|
||||
click.echo(
|
||||
f"Error: unknown agent(s) for engagement schedule: {', '.join(unknown)}",
|
||||
err=True,
|
||||
)
|
||||
sys.exit(1)
|
||||
try:
|
||||
yaml_text = engagement_schedule_yaml(
|
||||
engagement,
|
||||
agents=agent_list,
|
||||
bootstrap_cadence=bootstrap_cadence,
|
||||
timezone=timezone,
|
||||
)
|
||||
except ScheduleError as exc:
|
||||
click.echo(f"Error: {exc}", err=True)
|
||||
sys.exit(1)
|
||||
else:
|
||||
yaml_text = default_schedule_yaml(timezone=timezone)
|
||||
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(default_schedule_yaml(timezone=timezone), encoding="utf-8")
|
||||
path.write_text(yaml_text, encoding="utf-8")
|
||||
click.echo(f"Initialized schedule: {path}")
|
||||
if engagement:
|
||||
click.echo(
|
||||
f" Engagement: {engagement} (bootstrap-cadence={bootstrap_cadence})"
|
||||
)
|
||||
click.echo(" Validate with: kaizen-agentic schedule validate")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user