@@ -136,9 +136,13 @@ fi
# Create output directory
mkdir -p "$OUTPUT_DIR"
+echo "========================================"
+echo "Documentation Automation Test"
+echo "========================================"
echo "Output directory: $OUTPUT_DIR"
echo "Analysis model: $ANALYSIS_MODEL"
echo "Writing model: $WRITING_MODEL"
+echo "Started at: $(date '+%Y-%m-%d %H:%M:%S')"
echo ""
cd "$REPO_ROOT"
@@ -263,12 +267,17 @@ echo ""
# Combined Phase: Analyze + Plan (using fast model)
echo "=== Analyzing Changes & Planning Documentation Impact ==="
-echo "Using model: $ANALYSIS_MODEL"
+echo "Model: $ANALYSIS_MODEL"
+echo "Started at: $(date '+%H:%M:%S')"
+echo ""
CHANGED_FILES=$(tr '\n' ' ' < "$OUTPUT_DIR/changed_files.txt")
-# Embed AGENTS.md guidelines directly to avoid file read
-AGENTS_GUIDELINES='## Documentation Guidelines (from AGENTS.md)
+# Write prompt to temp file to avoid escaping issues
+cat > "$OUTPUT_DIR/analysis-prompt.txt" << 'PROMPT_EOF'
+Analyze these code changes and determine if documentation updates are needed.
+
+## Documentation Guidelines
### Requires Documentation Update
- New user-facing features or commands
@@ -287,46 +296,44 @@ AGENTS_GUIDELINES='## Documentation Guidelines (from AGENTS.md)
### Output Format Required
You MUST output a JSON object with this exact structure:
-```json
{
- "updates_required": true/false,
+ "updates_required": true or false,
"summary": "Brief description of changes",
"planned_changes": [
{
"file": "docs/src/path/to/file.md",
"section": "Section name",
- "change_type": "update|add|deprecate",
+ "change_type": "update or add or deprecate",
"description": "What to change"
}
],
"skipped_files": ["reason1", "reason2"]
}
-```
-'
-
-droid exec \
- -m "$ANALYSIS_MODEL" \
- --auto low \
- "Analyze these code changes and determine if documentation updates are needed.
-$AGENTS_GUIDELINES
+Be conservative - only flag documentation updates for user-visible changes.
## Changed Files
-$CHANGED_FILES
+PROMPT_EOF
+
+echo "$CHANGED_FILES" >> "$OUTPUT_DIR/analysis-prompt.txt"
-## Task
-1. Review the changed files (read them if needed to understand the changes)
-2. Determine if any user-facing behavior, settings, or features changed
-3. Output the JSON structure above with your assessment
+ANALYSIS_START=$(date +%s)
-Be conservative - only flag documentation updates for user-visible changes." \
+droid exec \
+ -m "$ANALYSIS_MODEL" \
+ --auto low \
+ -f "$OUTPUT_DIR/analysis-prompt.txt" \
> "$OUTPUT_DIR/analysis.json" 2>&1 || true
-if [[ "$VERBOSE" == "true" ]]; then
- cat "$OUTPUT_DIR/analysis.json"
-else
- echo "Output saved to: $OUTPUT_DIR/analysis.json"
-fi
+ANALYSIS_END=$(date +%s)
+ANALYSIS_DURATION=$((ANALYSIS_END - ANALYSIS_START))
+
+echo "Completed in ${ANALYSIS_DURATION}s"
+echo ""
+echo "--- Analysis Result ---"
+cat "$OUTPUT_DIR/analysis.json"
+echo ""
+echo "-----------------------"
echo ""
# Check if updates are required (parse JSON output)
@@ -348,12 +355,15 @@ ANALYSIS_OUTPUT=$(cat "$OUTPUT_DIR/analysis.json")
if [[ "$DRY_RUN" == "true" ]]; then
# Combined Preview Phase (dry-run): Show what would change
echo "=== Preview: Generating Proposed Changes ==="
- echo "Using model: $WRITING_MODEL"
+ echo "Model: $WRITING_MODEL"
+ echo "Started at: $(date '+%H:%M:%S')"
+ echo ""
- droid exec \
- -m "$WRITING_MODEL" \
- --auto low \
- "Generate a PREVIEW of the documentation changes. Do NOT modify any files.
+ PREVIEW_START=$(date +%s)
+
+ # Write preview prompt to temp file
+ cat > "$OUTPUT_DIR/preview-prompt.txt" << PREVIEW_EOF
+Generate a PREVIEW of the documentation changes. Do NOT modify any files.
Based on this analysis:
$ANALYSIS_OUTPUT
@@ -369,30 +379,36 @@ Output format:
## File: [path]
### Current:
-\`\`\`markdown
-[exact current content]
-\`\`\`
+(paste exact current content)
### Proposed:
-\`\`\`markdown
-[proposed new content]
-\`\`\`
+(paste proposed new content)
### Diff:
-\`\`\`diff
-[unified diff]
-\`\`\`
+(unified diff with - and + lines)
---
-Show the ACTUAL content, not summaries." \
+Show the ACTUAL content, not summaries.
+PREVIEW_EOF
+
+ droid exec \
+ -m "$WRITING_MODEL" \
+ --auto low \
+ -f "$OUTPUT_DIR/preview-prompt.txt" \
> "$OUTPUT_DIR/preview.md" 2>&1 || true
+ PREVIEW_END=$(date +%s)
+ PREVIEW_DURATION=$((PREVIEW_END - PREVIEW_START))
+
+ echo "Completed in ${PREVIEW_DURATION}s"
echo ""
- echo "=== Preview ==="
+ echo "--- Proposed Changes ---"
cat "$OUTPUT_DIR/preview.md"
+ echo "------------------------"
echo ""
echo "=== Dry run complete ==="
+ echo "Total time: Analysis ${ANALYSIS_DURATION}s + Preview ${PREVIEW_DURATION}s = $((ANALYSIS_DURATION + PREVIEW_DURATION))s"
echo "To apply changes, run without --dry-run flag."
echo "Output saved to: $OUTPUT_DIR/"
exit 0
@@ -400,12 +416,15 @@ fi
# Combined Phase: Apply Changes + Generate Summary (using writing model)
echo "=== Applying Documentation Changes ==="
-echo "Using model: $WRITING_MODEL"
+echo "Model: $WRITING_MODEL"
+echo "Started at: $(date '+%H:%M:%S')"
+echo ""
-droid exec \
- -m "$WRITING_MODEL" \
- --auto medium \
- "Apply the documentation changes specified in this analysis:
+APPLY_START=$(date +%s)
+
+# Write apply prompt to temp file
+cat > "$OUTPUT_DIR/apply-prompt.txt" << APPLY_EOF
+Apply the documentation changes specified in this analysis:
$ANALYSIS_OUTPUT
@@ -420,14 +439,23 @@ Output format:
- [file]: [what was changed]
## Summary for PR
-[2-3 sentence summary suitable for a PR description]" \
+[2-3 sentence summary suitable for a PR description]
+APPLY_EOF
+
+droid exec \
+ -m "$WRITING_MODEL" \
+ --auto medium \
+ -f "$OUTPUT_DIR/apply-prompt.txt" \
> "$OUTPUT_DIR/apply-report.md" 2>&1 || true
-if [[ "$VERBOSE" == "true" ]]; then
- cat "$OUTPUT_DIR/apply-report.md"
-else
- echo "Output saved to: $OUTPUT_DIR/apply-report.md"
-fi
+APPLY_END=$(date +%s)
+APPLY_DURATION=$((APPLY_END - APPLY_START))
+
+echo "Completed in ${APPLY_DURATION}s"
+echo ""
+echo "--- Apply Report ---"
+cat "$OUTPUT_DIR/apply-report.md"
+echo "--------------------"
echo ""
# Format with Prettier (only changed files)
@@ -596,4 +624,5 @@ fi
echo ""
echo "=== Test Complete ==="
-echo "All phase outputs saved to: $OUTPUT_DIR/"
+echo "Total time: Analysis ${ANALYSIS_DURATION}s + Apply ${APPLY_DURATION}s = $((ANALYSIS_DURATION + APPLY_DURATION))s"
+echo "All outputs saved to: $OUTPUT_DIR/"