aiwcli 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -35
- package/dist/lib/template-installer.js +38 -0
- package/dist/templates/_shared/.claude/commands/handoff.md +219 -7
- package/dist/templates/_shared/.codex/workflows/handoff.md +219 -7
- package/dist/templates/_shared/.windsurf/workflows/handoff.md +219 -7
- package/dist/templates/_shared/hooks/context_enforcer.py +9 -5
- package/dist/templates/_shared/hooks/context_monitor.py +28 -10
- package/dist/templates/_shared/hooks/file-suggestion.py +45 -15
- package/dist/templates/_shared/hooks/user_prompt_submit.py +0 -10
- package/dist/templates/_shared/lib/base/constants.py +45 -0
- package/dist/templates/_shared/lib/base/inference.py +44 -21
- package/dist/templates/_shared/lib/base/subprocess_utils.py +46 -0
- package/dist/templates/_shared/lib/base/utils.py +5 -3
- package/dist/templates/_shared/lib/context/__init__.py +0 -8
- package/dist/templates/_shared/lib/context/cache.py +2 -4
- package/dist/templates/_shared/lib/context/context_manager.py +1 -118
- package/dist/templates/_shared/lib/context/discovery.py +8 -50
- package/dist/templates/_shared/lib/handoff/document_generator.py +2 -5
- package/dist/templates/_shared/lib/templates/README.md +0 -1
- package/dist/templates/_shared/lib/templates/formatters.py +0 -1
- package/dist/templates/_shared/scripts/save_handoff.py +289 -43
- package/dist/templates/_shared/workflows/handoff.md +30 -16
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.py +41 -20
- package/dist/templates/cc-native/_cc-native/lib/orchestrator.py +9 -0
- package/dist/templates/cc-native/_cc-native/lib/reviewers/agent.py +9 -0
- package/dist/templates/cc-native/_cc-native/lib/utils.py +123 -10
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -711,6 +711,96 @@ def build_combined_json(result: CombinedReviewResult) -> Dict[str, Any]:
|
|
|
711
711
|
return output
|
|
712
712
|
|
|
713
713
|
|
|
714
|
+
def generate_review_index(
|
|
715
|
+
result: CombinedReviewResult,
|
|
716
|
+
iteration: Optional[int] = None,
|
|
717
|
+
settings: Optional[Dict[str, Any]] = None,
|
|
718
|
+
) -> str:
|
|
719
|
+
"""Generate index.md for a review folder.
|
|
720
|
+
|
|
721
|
+
Args:
|
|
722
|
+
result: Combined review result
|
|
723
|
+
iteration: Iteration number (1-based)
|
|
724
|
+
settings: Display settings
|
|
725
|
+
|
|
726
|
+
Returns:
|
|
727
|
+
Markdown content for index.md
|
|
728
|
+
"""
|
|
729
|
+
from datetime import datetime
|
|
730
|
+
now = datetime.now()
|
|
731
|
+
|
|
732
|
+
lines = [
|
|
733
|
+
"---",
|
|
734
|
+
"type: review",
|
|
735
|
+
f"plan_hash: {result.plan_hash}",
|
|
736
|
+
f"overall_verdict: {result.overall_verdict}",
|
|
737
|
+
f"created_at: {result.timestamp}",
|
|
738
|
+
]
|
|
739
|
+
if iteration:
|
|
740
|
+
lines.append(f"iteration: {iteration}")
|
|
741
|
+
lines.extend([
|
|
742
|
+
"---",
|
|
743
|
+
"",
|
|
744
|
+
f"# Plan Review - {now.strftime('%Y-%m-%d %H:%M')}",
|
|
745
|
+
"",
|
|
746
|
+
f"**Overall Verdict:** `{result.overall_verdict.upper()}`",
|
|
747
|
+
])
|
|
748
|
+
|
|
749
|
+
if iteration:
|
|
750
|
+
lines.append(f"**Iteration:** {iteration}")
|
|
751
|
+
|
|
752
|
+
lines.extend([
|
|
753
|
+
f"**Plan Hash:** `{result.plan_hash}`",
|
|
754
|
+
"",
|
|
755
|
+
])
|
|
756
|
+
|
|
757
|
+
# Summary from orchestrator
|
|
758
|
+
if result.orchestration:
|
|
759
|
+
lines.extend([
|
|
760
|
+
"## Analysis",
|
|
761
|
+
f"- **Complexity:** `{result.orchestration.complexity}`",
|
|
762
|
+
f"- **Category:** `{result.orchestration.category}`",
|
|
763
|
+
f"- **Reasoning:** {result.orchestration.reasoning}",
|
|
764
|
+
"",
|
|
765
|
+
])
|
|
766
|
+
|
|
767
|
+
# Navigation table
|
|
768
|
+
lines.extend([
|
|
769
|
+
"## Review Files",
|
|
770
|
+
"",
|
|
771
|
+
"| File | Description |",
|
|
772
|
+
"|------|-------------|",
|
|
773
|
+
"| [combined.md](./combined.md) | Full review details |",
|
|
774
|
+
"| [combined.json](./combined.json) | Structured review data |",
|
|
775
|
+
])
|
|
776
|
+
|
|
777
|
+
# CLI reviewers
|
|
778
|
+
for name in result.cli_reviewers.keys():
|
|
779
|
+
lines.append(f"| [{name}.json](./{name}.json) | {name.title()} reviewer output |")
|
|
780
|
+
|
|
781
|
+
# Agent reviewers
|
|
782
|
+
for name in result.agents.keys():
|
|
783
|
+
safe_name = sanitize_filename(name)
|
|
784
|
+
lines.append(f"| [{safe_name}.json](./{safe_name}.json) | {name} agent output |")
|
|
785
|
+
|
|
786
|
+
lines.extend([
|
|
787
|
+
"",
|
|
788
|
+
"## Verdicts Summary",
|
|
789
|
+
"",
|
|
790
|
+
"| Reviewer | Verdict |",
|
|
791
|
+
"|----------|---------|",
|
|
792
|
+
])
|
|
793
|
+
|
|
794
|
+
for name, r in result.cli_reviewers.items():
|
|
795
|
+
lines.append(f"| {name.title()} | `{r.verdict}` |")
|
|
796
|
+
for name, r in result.agents.items():
|
|
797
|
+
lines.append(f"| {name} | `{r.verdict}` |")
|
|
798
|
+
|
|
799
|
+
lines.append("")
|
|
800
|
+
|
|
801
|
+
return '\n'.join(lines)
|
|
802
|
+
|
|
803
|
+
|
|
714
804
|
def write_combined_artifacts(
|
|
715
805
|
base: Path,
|
|
716
806
|
plan: str,
|
|
@@ -718,6 +808,8 @@ def write_combined_artifacts(
|
|
|
718
808
|
payload: Dict[str, Any],
|
|
719
809
|
settings: Optional[Dict[str, Any]] = None,
|
|
720
810
|
context_reviews_dir: Optional[Path] = None,
|
|
811
|
+
review_folder: Optional[Path] = None,
|
|
812
|
+
iteration: Optional[int] = None,
|
|
721
813
|
) -> Path:
|
|
722
814
|
"""Write combined review artifacts to context reviews folder.
|
|
723
815
|
|
|
@@ -727,16 +819,19 @@ def write_combined_artifacts(
|
|
|
727
819
|
result: Combined review result
|
|
728
820
|
payload: Hook payload
|
|
729
821
|
settings: Display settings
|
|
730
|
-
context_reviews_dir: Reviews directory from context system (
|
|
822
|
+
context_reviews_dir: Reviews directory from context system (deprecated, use review_folder)
|
|
823
|
+
review_folder: Specific folder to write to (takes precedence)
|
|
824
|
+
iteration: Iteration number for index generation
|
|
731
825
|
|
|
732
826
|
Raises:
|
|
733
|
-
ValueError: If context_reviews_dir is
|
|
827
|
+
ValueError: If neither context_reviews_dir nor review_folder is provided
|
|
734
828
|
"""
|
|
735
|
-
|
|
736
|
-
|
|
829
|
+
# Support both old and new API
|
|
830
|
+
out_dir = review_folder or context_reviews_dir
|
|
831
|
+
if not out_dir:
|
|
832
|
+
raise ValueError("Either context_reviews_dir or review_folder is required")
|
|
737
833
|
|
|
738
|
-
|
|
739
|
-
eprint(f"[utils] Using context reviews dir: {out_dir}")
|
|
834
|
+
eprint(f"[utils] Using review folder: {out_dir}")
|
|
740
835
|
|
|
741
836
|
# Check directory creation explicitly
|
|
742
837
|
try:
|
|
@@ -745,8 +840,9 @@ def write_combined_artifacts(
|
|
|
745
840
|
eprint(f"[utils] FATAL: Cannot create directory {out_dir}: {e}")
|
|
746
841
|
raise
|
|
747
842
|
|
|
748
|
-
# JSON write with atomic operation
|
|
749
|
-
|
|
843
|
+
# JSON write with atomic operation - use combined.json for folder-based
|
|
844
|
+
json_filename = "combined.json" if review_folder else "review.json"
|
|
845
|
+
json_path = out_dir / json_filename
|
|
750
846
|
json_data = build_combined_json(result)
|
|
751
847
|
try:
|
|
752
848
|
if ENABLE_ROBUST_PLAN_WRITES:
|
|
@@ -759,8 +855,9 @@ def write_combined_artifacts(
|
|
|
759
855
|
eprint(f"[utils] FATAL: Failed to write {json_path.name}: {e}")
|
|
760
856
|
raise
|
|
761
857
|
|
|
762
|
-
# Markdown write with atomic operation
|
|
763
|
-
|
|
858
|
+
# Markdown write with atomic operation - use combined.md for folder-based
|
|
859
|
+
md_filename = "combined.md" if review_folder else "review.md"
|
|
860
|
+
md_path = out_dir / md_filename
|
|
764
861
|
md_content = format_combined_markdown(result, settings)
|
|
765
862
|
try:
|
|
766
863
|
if ENABLE_ROBUST_PLAN_WRITES:
|
|
@@ -803,6 +900,22 @@ def write_combined_artifacts(
|
|
|
803
900
|
eprint(f"[utils] WARNING: Failed to write {reviewer_path.name}: {e}")
|
|
804
901
|
# Continue - individual reviewer failures not critical
|
|
805
902
|
|
|
903
|
+
# Generate index.md for folder-based reviews
|
|
904
|
+
if review_folder:
|
|
905
|
+
index_content = generate_review_index(result, iteration, settings)
|
|
906
|
+
index_path = out_dir / "index.md"
|
|
907
|
+
try:
|
|
908
|
+
if ENABLE_ROBUST_PLAN_WRITES:
|
|
909
|
+
success, error = atomic_write(index_path, index_content)
|
|
910
|
+
if not success:
|
|
911
|
+
eprint(f"[utils] WARNING: Failed to write index.md: {error}")
|
|
912
|
+
else:
|
|
913
|
+
index_path.write_text(index_content, encoding="utf-8")
|
|
914
|
+
except Exception as e:
|
|
915
|
+
eprint(f"[utils] WARNING: Failed to write index.md: {e}")
|
|
916
|
+
|
|
917
|
+
return index_path
|
|
918
|
+
|
|
806
919
|
return md_path
|
|
807
920
|
|
|
808
921
|
|
package/oclif.manifest.json
CHANGED