Direct Phase 2 content saves to network share instead of working/

Compute the final-content.html save path upfront (network share with
local fallback) and pass it in the Phase 2 prompt so the execution
brain writes directly to the share. Summary still saved separately
as final-content.md via _save_content.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix/customer-field-migration
PeninsulaInd 2026-03-08 19:52:55 -05:00
parent 7344781e73
commit 3ed7f2bbdd
1 changed files with 26 additions and 1 deletions

View File

@ -310,6 +310,7 @@ def _build_phase2_prompt(
cora_path: str, cora_path: str,
is_service_page: bool = False, is_service_page: bool = False,
capabilities_default: str = "", capabilities_default: str = "",
content_path: str = "",
) -> str: ) -> str:
"""Build the Phase 2 prompt for writing full content from an approved outline. """Build the Phase 2 prompt for writing full content from an approved outline.
@ -359,6 +360,14 @@ def _build_phase2_prompt(
"\nWrite publication-ready content following the outline structure. " "\nWrite publication-ready content following the outline structure. "
"Include all entity targets and keyword placements as noted in the outline." "Include all entity targets and keyword placements as noted in the outline."
) )
if content_path:
parts.append(
f"\n**IMPORTANT — Save the final content as HTML to this exact path:**\n"
f"`{content_path}`\n"
f"Do NOT save to the local project directory or working/ folder."
)
return "\n".join(parts) return "\n".join(parts)
@ -1025,12 +1034,28 @@ def _run_phase2(
if not cora_path: if not cora_path:
cora_path = existing_state.get("cora_path", "") cora_path = existing_state.get("cora_path", "")
# Compute save path for the final content HTML (network share with local fallback)
slug = _slugify(keyword) or "unknown"
content_path = ""
if config.content.outline_dir:
primary = Path(config.content.outline_dir) / slug
try:
primary.mkdir(parents=True, exist_ok=True)
content_path = str(primary / "final-content.html")
except OSError as e:
log.warning("Network path unavailable (%s), falling back to local: %s", primary, e)
if not content_path:
local = _LOCAL_CONTENT_DIR / slug
local.mkdir(parents=True, exist_ok=True)
content_path = str(local / "final-content.html")
# ClickUp: move to automation underway # ClickUp: move to automation underway
if task_id: if task_id:
_sync_clickup_start(ctx, task_id) _sync_clickup_start(ctx, task_id)
prompt = _build_phase2_prompt( prompt = _build_phase2_prompt(
url, keyword, outline_text, cora_path, is_service_page, capabilities_default url, keyword, outline_text, cora_path, is_service_page, capabilities_default,
content_path=content_path,
) )
log.info("Phase 2 — writing full content for '%s' (%s)", keyword, url) log.info("Phase 2 — writing full content for '%s' (%s)", keyword, url)