feat: agent authoring & doc generation (WP-0007, v1.4.0)
New authoring tooling and a fix for the doc-regeneration defect it exposed. Added: - src/kaizen_agentic/agent_docs.py — render + idempotent upsert of the CLAUDE.md "## Installed Agents" section (shared by installer and CLI) - `kaizen-agentic docs generate [--check]` — idempotent doc refresh / CI gate - `kaizen-agentic create-agent` — scaffold a schema-valid agent - Frontmatter schema validation in `kaizen-agentic validate` (required name/description/category, known category, valid memory/model) - tests: test_agent_docs, test_validate_schema, test_create_agent Fixed: - _update_documentation regex duplicated the Installed Agents block on every run (stopped at the first ### subheading) — now idempotent - declared frontmatter `category` is authoritative (heuristic is fallback) - list_installed_agents reads the frontmatter name, not the filename - renamed agent-project-management.md -> agent-project-assistant.md to satisfy the agent-<name>.md convention (eliminates a name/filename collision that caused install/update to write a divergent duplicate) - test_cli_error_handling no longer installs into the repo root (uses tmp) Version 1.4.0; CHANGELOG, CLI cheat sheet, agency-framework, TODO updated. Workplan KAIZEN-WP-0007 closed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -40,10 +40,15 @@ class TestClickWorkaround:
|
||||
assert "Got unexpected extra argument" not in stdout_content
|
||||
assert "Got unexpected extra argument" not in stderr_content
|
||||
|
||||
def test_update_command_error_suppression(self):
|
||||
def test_update_command_error_suppression(self, tmp_path):
|
||||
"""Test that spurious 'unexpected extra argument' errors are suppressed for update commands."""
|
||||
# Seed a temp project so `update` does not rewrite the repo's own agents/
|
||||
(tmp_path / "agents").mkdir()
|
||||
(tmp_path / "agents" / "agent-tdd-workflow.md").write_text(
|
||||
"---\nname: tdd-workflow\ndescription: d\ncategory: testing\n---\nx\n"
|
||||
)
|
||||
# Test the update command that also shows spurious errors
|
||||
with patch("sys.argv", ["kaizen-agentic", "update"]):
|
||||
with patch("sys.argv", ["kaizen-agentic", "update", "--target", str(tmp_path)]):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
try:
|
||||
@@ -116,9 +121,12 @@ class TestClickWorkaround:
|
||||
class TestInstallCommandSpecifics:
|
||||
"""Test specific install command scenarios."""
|
||||
|
||||
def test_install_with_valid_agent(self):
|
||||
def test_install_with_valid_agent(self, tmp_path):
|
||||
"""Test install command with a valid agent name."""
|
||||
with patch("sys.argv", ["kaizen-agentic", "install", "tdd-workflow"]):
|
||||
with patch(
|
||||
"sys.argv",
|
||||
["kaizen-agentic", "install", "tdd-workflow", "--target", str(tmp_path)],
|
||||
):
|
||||
with patch("sys.stdout", new_callable=StringIO) as mock_stdout:
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user