Compare commits

...

5 Commits

Author SHA1 Message Date
morgankrey
12c2c7c668 ci: stash changes before branch checkout in phase 7
Fixes conflict when daily branch already exists and local
changes from phase 5 would be overwritten.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-19 13:57:30 -06:00
morgankrey
9b45c04f9f ci: use full model name claude-opus-4-5-20251101
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-19 13:26:33 -06:00
morgankrey
b21b22e77e ci: fix droid exec flags to use correct syntax
- Use -m instead of --model
- Use -f instead of --prompt-file
- Use --auto instead of --autonomy
- Remove non-existent --output, --format, --context flags
- Redirect stdout to capture output

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-19 12:29:01 -06:00
morgankrey
e2f51e72a5 ci: fix droid CLI path to ~/.local/bin
The Factory CLI installer puts droid in ~/.local/bin, not ~/.factory/bin

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-19 12:17:54 -06:00
morgankrey
2e34fe66c1 ci: fix Factory CLI installation URL
Change from cli.factory.ai/install.sh to app.factory.ai/cli
per official Factory documentation.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-19 12:01:00 -06:00

View File

@@ -23,7 +23,7 @@ permissions:
env:
FACTORY_API_KEY: ${{ secrets.FACTORY_API_KEY }}
DROID_MODEL: claude-opus-4-5
DROID_MODEL: claude-opus-4-5-20251101
jobs:
docs-automation:
@@ -39,11 +39,11 @@ jobs:
- name: Install Droid CLI
id: install-droid
run: |
curl -fsSL https://cli.factory.ai/install.sh | bash
echo "${HOME}/.factory/bin" >> "$GITHUB_PATH"
echo "DROID_BIN=${HOME}/.factory/bin/droid" >> "$GITHUB_ENV"
curl -fsSL https://app.factory.ai/cli | sh
echo "${HOME}/.local/bin" >> "$GITHUB_PATH"
echo "DROID_BIN=${HOME}/.local/bin/droid" >> "$GITHUB_ENV"
# Verify installation
"${HOME}/.factory/bin/droid" --version
"${HOME}/.local/bin/droid" --version
- name: Setup Node.js (for Prettier)
uses: actions/setup-node@v4
@@ -85,71 +85,74 @@ jobs:
# Phase 0: Guardrails are loaded via AGENTS.md in each phase
# Phase 2: Explore Repository (Read-Only)
# Phase 2: Explore Repository (Read-Only - default)
- name: "Phase 2: Explore Repository"
id: phase2
run: |
"$DROID_BIN" exec \
--model "$DROID_MODEL" \
--autonomy read-only \
--prompt-file .factory/prompts/docs-automation/phase2-explore.md \
--output /tmp/phase2-output.json \
--format json
-m "$DROID_MODEL" \
-f .factory/prompts/docs-automation/phase2-explore.md \
> /tmp/phase2-output.txt 2>&1 || true
echo "Repository exploration complete"
cat /tmp/phase2-output.json
cat /tmp/phase2-output.txt
# Phase 3: Analyze Changes (Read-Only)
# Phase 3: Analyze Changes (Read-Only - default)
- name: "Phase 3: Analyze Changes"
id: phase3
run: |
CHANGED_FILES=$(tr '\n' ' ' < /tmp/changed_files.txt)
echo "Analyzing changes in: $CHANGED_FILES"
# Build prompt with context
cat > /tmp/phase3-prompt.md << 'EOF'
$(cat .factory/prompts/docs-automation/phase3-analyze.md)
## Context
### Changed Files
$CHANGED_FILES
### Phase 2 Output
$(cat /tmp/phase2-output.txt)
EOF
"$DROID_BIN" exec \
--model "$DROID_MODEL" \
--autonomy read-only \
--prompt-file .factory/prompts/docs-automation/phase3-analyze.md \
--context "Changed files: $CHANGED_FILES" \
--context-file /tmp/phase2-output.json \
--output /tmp/phase3-output.md \
--format markdown
-m "$DROID_MODEL" \
"$(cat .factory/prompts/docs-automation/phase3-analyze.md)
Changed files: $CHANGED_FILES" \
> /tmp/phase3-output.md 2>&1 || true
echo "Change analysis complete"
cat /tmp/phase3-output.md
# Phase 4: Plan Documentation Impact (Read-Only)
# Phase 4: Plan Documentation Impact (Read-Only - default)
- name: "Phase 4: Plan Documentation Impact"
id: phase4
run: |
"$DROID_BIN" exec \
--model "$DROID_MODEL" \
--autonomy read-only \
--prompt-file .factory/prompts/docs-automation/phase4-plan.md \
--context-file /tmp/phase3-output.md \
--context-file docs/AGENTS.md \
--output /tmp/phase4-plan.md \
--format markdown
-m "$DROID_MODEL" \
-f .factory/prompts/docs-automation/phase4-plan.md \
> /tmp/phase4-plan.md 2>&1 || true
echo "Documentation plan complete"
cat /tmp/phase4-plan.md
# Check if updates are required
if grep -q "Documentation Updates Required: No" /tmp/phase4-plan.md; then
if grep -q "NO_UPDATES_REQUIRED" /tmp/phase4-plan.md; then
echo "updates_required=false" >> "$GITHUB_OUTPUT"
else
echo "updates_required=true" >> "$GITHUB_OUTPUT"
fi
# Phase 5: Apply Plan (Write-Enabled)
# Phase 5: Apply Plan (Write-Enabled with --auto medium)
- name: "Phase 5: Apply Documentation Plan"
id: phase5
if: steps.phase4.outputs.updates_required == 'true'
run: |
"$DROID_BIN" exec \
--model "$DROID_MODEL" \
--autonomy medium \
--prompt-file .factory/prompts/docs-automation/phase5-apply.md \
--context-file /tmp/phase4-plan.md \
--context-file docs/AGENTS.md \
--context-file docs/.rules \
--output /tmp/phase5-report.md \
--format markdown
-m "$DROID_MODEL" \
--auto medium \
-f .factory/prompts/docs-automation/phase5-apply.md \
> /tmp/phase5-report.md 2>&1 || true
echo "Documentation updates applied"
cat /tmp/phase5-report.md
@@ -166,7 +169,7 @@ jobs:
echo "Prettier formatting complete"
# Phase 6: Summarize Changes
# Phase 6: Summarize Changes (Read-Only - default)
- name: "Phase 6: Summarize Changes"
id: phase6
if: steps.phase4.outputs.updates_required == 'true'
@@ -175,14 +178,9 @@ jobs:
git diff docs/src/ > /tmp/docs-diff.txt || true
"$DROID_BIN" exec \
--model "$DROID_MODEL" \
--autonomy read-only \
--prompt-file .factory/prompts/docs-automation/phase6-summarize.md \
--context-file /tmp/phase5-report.md \
--context-file /tmp/phase3-output.md \
--context "Trigger SHA: ${{ steps.changed.outputs.sha }}" \
--output /tmp/phase6-summary.md \
--format markdown
-m "$DROID_MODEL" \
-f .factory/prompts/docs-automation/phase6-summarize.md \
> /tmp/phase6-summary.md 2>&1 || true
echo "Summary generated"
cat /tmp/phase6-summary.md
@@ -204,6 +202,9 @@ jobs:
# Daily batch branch - one branch per day, multiple commits accumulate
BRANCH_NAME="docs/auto-update-$(date +%Y-%m-%d)"
# Stash local changes from phase 5
git stash push -m "docs-automation-changes" -- docs/src/
# Check if branch already exists on remote
if git ls-remote --exit-code --heads origin "$BRANCH_NAME" > /dev/null 2>&1; then
echo "Branch $BRANCH_NAME exists, checking out and updating..."
@@ -214,6 +215,9 @@ jobs:
git checkout -b "$BRANCH_NAME"
fi
# Apply stashed changes
git stash pop || true
# Stage and commit
git add docs/src/
SUMMARY=$(head -50 < /tmp/phase6-summary.md)