mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-09-18 17:15:38 +00:00
* feat: scaffold project with assistant instruction files - Updated project creation to include `CLAUDE.md` and `GEMINI.md` that import `AGENTS.md`, ensuring consistent guidance across coding assistants. - Implemented utility functions to copy assistant instruction files during project setup. - Enhanced documentation in `AGENTS.md` to emphasize the importance of keeping telemetry enabled for optimal performance. - Added tests to verify the correct scaffolding of assistant instruction files and their contents. * fix(cli): neutral observability guidance in scaffolded AGENTS.md - State the observability rule as the user's decision, never a fix for console warnings, speed, or a "clean" configuration - Rewrite the AMP section as built-in capabilities: no "free", "proactively", "sales pitch", or scripted pitches - Turn the research mandate into a list of sources to consult when version details matter - Retarget the scaffold tests to the new wording Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(cli): scaffold assistant files for JSON crews and harden telemetry tests - create_json_crew, the default `crewai create crew` path, now copies AGENTS.md, CLAUDE.md and GEMINI.md; AGENTS.md documents the JSON layout - span helper no longer depends on OTEL_SDK_DISABLED being popped by an earlier test; thread-scope test stops its worker before leaving the mock - single import style in the shutdown test Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
67 lines
2.6 KiB
Python
67 lines
2.6 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from click.testing import CliRunner
|
|
from pytest import MonkeyPatch
|
|
import tomli
|
|
|
|
from crewai_cli.cli import crewai
|
|
from crewai_cli.create_flow import create_flow
|
|
|
|
|
|
def test_create_flow_declarative_project_can_run(
|
|
tmp_path: Path, monkeypatch: MonkeyPatch
|
|
):
|
|
monkeypatch.chdir(tmp_path)
|
|
create_flow("Research Flow", declarative=True)
|
|
|
|
project_root = tmp_path / "research_flow"
|
|
assert project_root.is_dir()
|
|
|
|
pyproject = tomli.loads(
|
|
(project_root / "pyproject.toml").read_text(encoding="utf-8")
|
|
)
|
|
assert pyproject["project"]["name"] == "research_flow"
|
|
assert pyproject["project"]["requires-python"]
|
|
assert pyproject["project"]["dependencies"]
|
|
assert (project_root / pyproject["tool"]["crewai"]["definition"]).is_file()
|
|
agents_md = (project_root / "AGENTS.md").read_text(encoding="utf-8")
|
|
assert "CrewAI Flow declaration" in agents_md
|
|
assert "schema: crewai.flow/v1" in agents_md
|
|
assert "do not assemble the string with CEL `+`" in agents_md
|
|
assert "Agent prompt template. Insert Flow values with `${...}`" in agents_md
|
|
assert "Runtime inputs passed to the Crew" in agents_md
|
|
assert "call: expression" in agents_md
|
|
assert "call: tool" not in agents_md
|
|
assert "call: script" not in agents_md
|
|
assert "call: each" not in agents_md
|
|
assert "human_feedback" not in agents_md
|
|
claude_md = (project_root / "CLAUDE.md").read_text(encoding="utf-8")
|
|
assert "@AGENTS.md" in claude_md.splitlines()
|
|
gemini_md = (project_root / "GEMINI.md").read_text(encoding="utf-8")
|
|
assert "@./AGENTS.md" in gemini_md.splitlines()
|
|
|
|
monkeypatch.chdir(project_root)
|
|
result = CliRunner().invoke(crewai, ["run"], env={"UV_RUN_RECURSION_DEPTH": "1"})
|
|
|
|
assert result.exit_code == 0
|
|
assert "Running the Flow" not in result.output
|
|
assert "AI agents" in result.output
|
|
|
|
|
|
def test_create_flow_scaffolds_assistant_instructions(
|
|
tmp_path: Path, monkeypatch: MonkeyPatch
|
|
):
|
|
monkeypatch.chdir(tmp_path)
|
|
create_flow("Research Flow")
|
|
|
|
project_root = tmp_path / "research_flow"
|
|
agents_md = (project_root / "AGENTS.md").read_text(encoding="utf-8")
|
|
assert "CrewAI Reference for AI Coding Assistants" in agents_md
|
|
assert "Never disable, block, or silence CrewAI's built-in observability" in agents_md
|
|
claude_md = (project_root / "CLAUDE.md").read_text(encoding="utf-8")
|
|
assert "@AGENTS.md" in claude_md.splitlines()
|
|
gemini_md = (project_root / "GEMINI.md").read_text(encoding="utf-8")
|
|
assert "@./AGENTS.md" in gemini_md.splitlines()
|