Commit 1: editorial image prompt + style-template setting (#146)

* Commit 1: editorial image prompt + style-template setting

Pivot the image pipeline from the single-panel comic style to a text-free
editorial scientific illustration, and replace the Style Suffix setting with
an editable Style Template setting. Commit 1 of the in-plugin editorial image
pipeline (no composer yet; pipeline otherwise unchanged).

- New constant PRAUTOBLOGGER_DEFAULT_IMAGE_STYLE_TEMPLATE (brief §7 editorial
  template with the single {{ topic_summary }} token).
- New setting prautoblogger_image_style_template (textarea) replaces the
  Style Suffix field; single-token validation on save (brief A5); old
  prautoblogger_image_style_suffix mirrored to _deprecated for one cycle and
  not deleted (one-time migration prautoblogger_migrated_style_template_v0160).
- REWRITER_SYSTEM_PROMPT now emits a 1-2 sentence editorial topic/mechanism
  summary as the SCENE (no comic gag), keeping the CAPTION line for the
  unchanged HTML-caption-below-image path; scene/caption parsing contract
  preserved.
- New PRAutoBlogger_Image_Template_Filler substitutes the scene into the
  template's {{ topic_summary }} slot across all three entry points; strips
  control chars + clamps length (A5); degrades safely on missing token or
  empty summary so a blank/token-only prompt is never sent to the provider
  (A5/A6).
- Version bump 0.15.1 -> 0.16.0 + CHANGELOG + ARCHITECTURE.md updates.

Agent-Session: image-editorial-commit1

* style: auto-fix PHPCS violations via phpcbf

---------

Co-authored-by: peptiderepo <peptiderepo@users.noreply.github.com>
This commit is contained in:
peptiderepo
2026-06-09 13:18:38 +07:00
committed by GitHub
parent a4f3b1832e
commit d00e746727
11 changed files with 335 additions and 60 deletions

View File

@@ -3,7 +3,7 @@
* Tests for PRAutoBlogger_Image_Prompt_Builder.
*
* Validates prompt generation from article content and source data,
* including style suffix appending and HTML stripping.
* including editorial-template substitution ({{ topic_summary }}) and HTML stripping.
*
* @package PRAutoBlogger\Tests\Core
*/
@@ -68,7 +68,9 @@ class ImagePromptBuilderTest extends BaseTestCase {
[ 'prompt' => $scene, 'caption' => $caption ] = $builder->build_article_prompt( $article_data );
$this->assertStringContainsString( 'How to Train Your Dragon', $scene );
// Style suffix should be appended.
// Editorial template wraps the topic summary; token must be substituted.
$this->assertStringNotContainsString( '{{ topic_summary }}', $scene );
$this->assertStringContainsString( 'Editorial scientific illustration', $scene );
$this->assertNotEmpty( $scene );
$this->assertGreaterThan( 50, strlen( $scene ) );
$this->assertIsString( $caption );