Skip to content

feat(content): send an opportunity or one of its assets to the Action Center - #943

Merged
gkhngyk merged 1 commit into
mainfrom
feature/opportunity-to-action-center
Oct 5, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/opportunity-to-action-center

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Last PR of Phase 2 in #857. Opportunities could only go out by webhook. They can now open an Action Center action, either for the whole opportunity or for a single recommended asset (#940). Until now, only the nightly signal engine created actions, so this is the first path that lets a person create one.

Server (lib/action-center/from-opportunity.js, POST /api/content/:id/action)

  • Creates an action of the new kind content_opportunity. Category is growth and impact comes from the opportunity. The dedup key is opportunity:<id>:<assetKey|all>.
  • The tasks come from the existing task library, planned from each asset with the existing planTasks, so they keep the library's mode, permission and dependencies:
Asset Tasks
owned, create create_content_brief, create_content_draft, add_internal_links, publish_content, validate_ai_visibility
owned, refresh refresh_content, publish_content, validate_ai_visibility
owned, optimize / expand / consolidate / defend optimize_content, add_internal_links, publish_content, validate_ai_visibility
earned, third-party article identify_target_sources, prepare_contribution, execute_outreach, track_third_party_status, validate_third_party_presence
earned, backlink identify_target_sources, prepare_outreach, execute_outreach, track_third_party_status, validate_third_party_citation
  • Several assets are combined into one plan: each task once, the work first, then the checks, and measure_action_outcome last.
  • kpi_keys are ai_visibility, citations and mentions, so a completed action gets the usual before/after validation.
  • The payload carries:
    • the opportunity and asset;
    • the title;
    • the assets and their pages;
    • the cluster's prompts as targets.
  • Sending the same thing again returns the open action instead of a duplicate.
  • The action id is kept in source_data.actions, and a new opportunity becomes sent.
  • Opportunities written before assets existed are sent as one asset built from their own type and decision.

Web

  • The opportunity detail page has a Send to Action Center button in the header, shown for cluster opportunities that are not dismissed, archived or done.
  • The Recommended Assets card has a Send button on each asset.
  • Once sent, both become Open in Action Center links to that action.
  • To avoid doing the work twice, sending the whole opportunity hides the per-asset buttons, and sending an asset hides the whole-opportunity button.
  • content_opportunity is added to the web's kind registry with its copy. Such an action is titled after the opportunity or asset it was sent for, rather than from a template.
  • The send server action returns { error } instead of throwing, because production masks thrown messages.

Tried on production data

On the main test brand, I sent a two-asset opportunity: a comparison page plus a third-party article. Results:

  • The action opened with 11 tasks in this order: brief → draft → internal links → publish, then sources → contribution → outreach → tracking, then the two checks, then the measurement.
  • Sending it again returned the same action.
  • The opportunity was marked sent, with the action id recorded.

Related issue

Part of #857. This completes Phase 2.

Type of change

  • feat — New feature
  • test — Adding or updating tests

How to test

  1. Open a cluster opportunity → Send to Action Center. The button becomes Open in Action Center and leads to the action, titled after the opportunity, with the tasks above.
  2. On another opportunity with supporting assets, press Send on one asset. Only that asset's tasks are planned, and the header button is hidden.
  3. Send the same asset again, for example through the API. The response is created: false with the same action id.

from-opportunity.test.js covers the task plans per asset, the combined order, that every planned task exists in the registry, and the single asset given to older opportunities. display.test.ts covers the new kind's copy and title.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint, yarn typecheck, yarn format:check, yarn test (410) and yarn build pass (run from web/)
  • yarn lint, yarn format:check and yarn test (984) pass (run from server/)

🤖 Generated with Claude Code

… Center

Opportunities could only go out by webhook. They now open an Action Center
action, for the whole opportunity or a single asset (#857, Phase 2).

- POST /api/content/:id/action creates a content_opportunity action. Its
  tasks are the library's own, planned from each asset: brief, draft,
  internal links and publish for new owned content; optimize or refresh for
  an existing page; sources, outreach and tracking for earned work. Several
  assets are combined into one plan, work first, checks next, the outcome
  measurement last.
- kpi_keys ai_visibility, citations and mentions, so the completed action
  is measured like any other.
- Sending the same thing again returns the action already open. The action
  id is kept on the opportunity, and a new opportunity is marked sent.
- The detail page has Send to Action Center in the header and Send on each
  asset, and shows Open in Action Center once sent. Sending the whole hides
  the per-asset buttons and the other way round.
- The web knows the new kind; such an action is titled after the
  opportunity or asset it was sent for.
@gkhngyk
gkhngyk merged commit 9611c7b into main Oct 5, 2026
6 checks passed
gkhngyk added a commit that referenced this pull request Oct 6, 2026
…ontent (#944)

An action sent from a content opportunity (#943) opened with an empty
"Primary signals" section and "0 signals": its prompts, fan-out queries,
pages and brief stayed on the opportunity, out of reach of whoever works
the action's tasks.

- The Overview tab of a content_opportunity action shows the opportunity
  instead: a link back, the decision and its pages, the brief and outline
  (or a link to generate one), the prompts to answer and the searches AI
  engines ran for them. It is read live, so a brief generated after
  sending shows too.
- The "0 signals" tag is gone for these actions, and the Signals tab says
  where their evidence is.
- When the opportunity already has a brief, the brief task opens
  completed. Every task row now states its status.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant