feat: add CLI fallback for MCP calls in team commands

- Implemented CLI fallback using `ccw team` for various team command operations in `execute.md`, `plan.md`, `review.md`, `spec-analyst.md`, `spec-coordinate.md`, `spec-discuss.md`, `spec-reviewer.md`, `spec-writer.md`, and `test.md`.
- Updated command generation templates to include CLI fallback examples.
- Enhanced validation checks to ensure CLI fallback sections are present.
- Added quality standards for CLI fallback in team command design.
- Introduced a new `GlobalGraphExpander` class for expanding search results with cross-directory relationships.
- Added tests for `GlobalGraphExpander` to verify functionality and score decay factors.
This commit is contained in:
catlog22
2026-02-13 12:05:48 +08:00
parent ac32b28c7b
commit 6054a01b8f
19 changed files with 804 additions and 7 deletions

View File

@@ -517,6 +517,8 @@ class IndexTreeBuilder:
"supported_languages": self.config.supported_languages,
"parsing_rules": self.config.parsing_rules,
"global_symbol_index_enabled": self.config.global_symbol_index_enabled,
"static_graph_enabled": self.config.static_graph_enabled,
"static_graph_relationship_types": self.config.static_graph_relationship_types,
}
worker_args = [
@@ -627,6 +629,27 @@ class IndexTreeBuilder:
relationships=indexed_file.relationships,
)
# Write global relationships if enabled
if (
self.config.static_graph_enabled
and global_index is not None
and indexed_file.relationships
):
try:
filtered_rels = [
r for r in indexed_file.relationships
if r.relationship_type.value in self.config.static_graph_relationship_types
]
if filtered_rels:
global_index.update_file_relationships(
file_path, filtered_rels
)
except Exception as rel_exc:
self.logger.warning(
"Failed to write global relationships for %s: %s",
file_path, rel_exc,
)
files_count += 1
symbols_count += len(indexed_file.symbols)
@@ -959,6 +982,8 @@ def _build_dir_worker(args: tuple) -> DirBuildResult:
supported_languages=config_dict["supported_languages"],
parsing_rules=config_dict["parsing_rules"],
global_symbol_index_enabled=bool(config_dict.get("global_symbol_index_enabled", True)),
static_graph_enabled=bool(config_dict.get("static_graph_enabled", False)),
static_graph_relationship_types=list(config_dict.get("static_graph_relationship_types", ["imports", "inherits"])),
)
parser_factory = ParserFactory(config)
@@ -1008,6 +1033,25 @@ def _build_dir_worker(args: tuple) -> DirBuildResult:
relationships=indexed_file.relationships,
)
# Write global relationships if enabled
if (
config.static_graph_enabled
and global_index is not None
and indexed_file.relationships
):
try:
allowed_types = config.static_graph_relationship_types
filtered_rels = [
r for r in indexed_file.relationships
if r.relationship_type.value in allowed_types
]
if filtered_rels:
global_index.update_file_relationships(
item, filtered_rels
)
except Exception:
pass # Don't block indexing
files_count += 1
symbols_count += len(indexed_file.symbols)