Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Release

# Publishes citecue.zip — an archive that unpacks to citecue/ and contains only
# the runtime files — as a release asset, so that installing the plugin is
# "Plugins → Add New → Upload" rather than "download the source, rename the
# folder, delete the tests".
# Publishes citecue-ai-auto-fix.zip — an archive that unpacks to
# citecue-ai-auto-fix/ (the WordPress.org slug, so the two install channels
# share one directory) and contains only the runtime files — as a release
# asset, so that installing the plugin is "Plugins → Add New → Upload" rather
# than "download the source, rename the folder, delete the tests".

on:
push:
Expand Down Expand Up @@ -45,7 +46,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: citecue-plugin-zip
path: dist/citecue.zip
path: dist/citecue-ai-auto-fix.zip
if-no-files-found: error

- name: Attach the zip to the release
Expand All @@ -54,9 +55,9 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" dist/citecue.zip --clobber
gh release upload "$GITHUB_REF_NAME" dist/citecue-ai-auto-fix.zip --clobber
else
gh release create "$GITHUB_REF_NAME" dist/citecue.zip \
gh release create "$GITHUB_REF_NAME" dist/citecue-ai-auto-fix.zip \
--title "$GITHUB_REF_NAME" \
--generate-notes
fi
7 changes: 6 additions & 1 deletion .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="citecue"/>
<element value="citecue-ai-auto-fix"/>
</property>
</properties>
</rule>

<!--
The identifier prefix is not the text domain: the text domain has to
match the WordPress.org slug, hyphens and all, while a PHP class,
function or constant name cannot contain a hyphen.
-->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ AI crawler (GPTBot, ClaudeBot, …) Human visitor

## Setup

1. Download `citecue.zip` from the [latest release](https://github.com/citecue/wordpress-plugin/releases/latest), then install it under **Plugins → Add New → Upload Plugin** and activate it.
1. Download `citecue-ai-auto-fix.zip` from the [latest release](https://github.com/citecue/wordpress-plugin/releases/latest), then install it under **Plugins → Add New → Upload Plugin** and activate it.
2. Open **Settings → CiteCue** and click **Connect to CiteCue**.
3. Confirm the project for this site in CiteCue. You are redirected back, and the plugin checks itself.

Expand Down Expand Up @@ -228,12 +228,12 @@ Plain PHP ≥ 7.4, no build step. Repo root is the plugin root, so the checkout
GitHub's **Download ZIP** button is not an install path: it produces `wordpress-plugin-main.zip`, which unpacks to `wordpress-plugin-main/` and carries the tests and Composer files with it. WordPress keys a plugin by its directory name, so installs have to come from the release asset instead.

```bash
bin/build-plugin-zip.sh # writes dist/citecue.zip from HEAD
bin/build-plugin-zip.sh # writes dist/citecue-ai-auto-fix.zip from HEAD
```

The script archives tracked files only, honouring the `export-ignore` rules in `.gitattributes`, so nothing untracked (a `vendor/`, a stray `.env`) can be swept in. It refuses to build unless `citecue.php`'s `Version:` header, `CITECUE_VERSION` and `readme.txt`'s `Stable tag:` all agree, and it checks the result unpacks to a single `citecue/` directory. CI runs the same script on every pull request.
The script archives tracked files only, honouring the `export-ignore` rules in `.gitattributes`, so nothing untracked (a `vendor/`, a stray `.env`) can be swept in. It refuses to build unless `citecue.php`'s `Version:` header, `CITECUE_VERSION` and `readme.txt`'s `Stable tag:` all agree, and it checks the result unpacks to a single `citecue-ai-auto-fix/` directory — the WordPress.org slug, so a site that switches between the two install channels upgrades one plugin rather than ending up with two. CI runs the same script on every pull request.

To publish: bump those three version strings, then push a `vX.Y.Z` tag. The release workflow rebuilds the zip, fails if the tag disagrees with the plugin header, and attaches `citecue.zip` to the GitHub release.
To publish: bump those three version strings, then push a `vX.Y.Z` tag. The release workflow rebuilds the zip, fails if the tag disagrees with the plugin header, and attaches `citecue-ai-auto-fix.zip` to the GitHub release.

### Tests

Expand Down
9 changes: 8 additions & 1 deletion bin/build-plugin-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@
# in .gitattributes, so an untracked vendor/, .env or editor backup can never
# be swept into a release.
#
# SLUG must stay equal to the WordPress.org slug. WordPress.org derives that
# from the Plugin Name header and will not change it after approval, and it is
# what the directory installs into. If this zip used a different name, a site
# that installed from GitHub and later switched to the directory (or the
# reverse) would end up running two copies of the plugin from two directories
# rather than upgrading one.
#
# Usage: bin/build-plugin-zip.sh [ref] (ref defaults to HEAD)

set -euo pipefail

SLUG=citecue
SLUG=citecue-ai-auto-fix
REF=${1:-HEAD}

ROOT=$(git rev-parse --show-toplevel)
Expand Down
41 changes: 39 additions & 2 deletions citecue.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: CiteCue AI Auto-Fix
* Plugin URI: https://github.com/henry-mosh/citecue-wordpress-plugin
* Plugin URI: https://github.com/citecue/wordpress-plugin
* Description: Serves CiteCue-optimized versions of your pages to AI bots and crawlers, publishes your llms.txt, and lets CiteCue push brand-building draft content into WordPress.
* Version: 1.0.0
* Requires at least: 5.8
Expand All @@ -10,7 +10,7 @@
* Author URI: https://app.citecue.com
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: citecue
* Text Domain: citecue-ai-auto-fix
*
* @package Citecue
*/
Expand All @@ -19,6 +19,43 @@
exit;
}

/*
* Stand down if another copy of this plugin already loaded.
*
* Releases before the move to WordPress.org shipped an archive that unpacked
* to citecue/. The directory's copy installs as citecue-ai-auto-fix/, so a
* site carrying the old one gains a second plugin rather than an upgrade —
* and `require_once` does not save us, because the two copies are two paths.
* Both would run their requires, the second would redeclare every class, and
* the site would go down with a fatal error on the next request.
*
* The copy that loses the race does nothing and says so, which turns a white
* screen into an admin notice naming the directory to delete.
*/
if ( defined( 'CITECUE_VERSION' ) ) {
add_action(
'admin_notices',
static function () {
if ( ! current_user_can( 'activate_plugins' ) ) {
return;
}
printf(
'<div class="notice notice-error"><p>%s</p></div>',
esc_html(
sprintf(
/* translators: 1: plugin file that is running, e.g. citecue/citecue.php. 2: duplicate plugin file that did not load. */
__( 'CiteCue AI Auto-Fix is installed twice. WordPress is running %1$s, so the copy in %2$s did not load. Deactivate and delete whichever of the two you do not want to keep.', 'citecue-ai-auto-fix' ),
plugin_basename( CITECUE_PLUGIN_FILE ),
plugin_basename( __FILE__ )
)
)
);
}
);

return;
}

define( 'CITECUE_VERSION', '1.0.0' );
define( 'CITECUE_PLUGIN_FILE', __FILE__ );
define( 'CITECUE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"wp-coding-standards/wpcs": "^3.1",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-phpunit/wp-phpunit": "^7.0",
"roots/wordpress-no-content": "^6.8",
"roots/wordpress-no-content": "^7.0",
"composer/installers": "^2.2"
},
"repositories": [
Expand Down
Loading
Loading