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
14 changes: 14 additions & 0 deletions .github/agent-ci.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ghcr.io/actions/actions-runner:latest

RUN sudo apt-get update \
&& sudo apt-get install -y --no-install-recommends \
composer \
docker.io \
php-cli \
php-curl \
php-mbstring \
php-sqlite3 \
php-xml \
php-zip \
xz-utils \
&& sudo rm -rf /var/lib/apt/lists/*
52 changes: 36 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: composer:v2
- name: Ensure PHP toolchain
run: |
php -r "exit( version_compare( PHP_VERSION, '8.1', '>=' ) ? 0 : 1 );"
php -v
composer --version
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist
- name: Run PHP Unit tests
Expand All @@ -31,14 +32,30 @@ jobs:
with:
fetch-depth: 0
- id: changed-js
uses: dorny/paths-filter@v3
with:
filters: |
js:
- '**/*.js'
- '**/*.jsx'
- '**/*.mjs'
- '**/*.cjs'
name: Detect JS changes
run: |
if [ "${AGENT_CI_LOCAL:-}" = "true" ]; then
echo "js=true" >> "$GITHUB_OUTPUT"
exit 0
fi

base_ref="${GITHUB_BASE_REF:-}"
if [ -n "$base_ref" ]; then
git fetch --no-tags --depth=1 origin "$base_ref"
base="origin/$base_ref"
elif git rev-parse --verify HEAD^ >/dev/null 2>&1; then
base="HEAD^"
else
base="$(git rev-list --max-parents=0 HEAD)"
fi

merge_base="$(git merge-base "$base" HEAD 2>/dev/null || echo "$base")"

if git diff --name-only "$merge_base" HEAD | grep -Eq '\.(js|jsx|mjs|cjs)$'; then
echo "js=true" >> "$GITHUB_OUTPUT"
else
echo "js=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/setup-node@v4
if: steps.changed-js.outputs.js == 'true'
with:
Expand All @@ -59,6 +76,8 @@ jobs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.base_ref == 'main'
timeout-minutes: 20
env:
WP_ENV_CORE: WordPress/WordPress#7.0-branch
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -67,10 +86,11 @@ jobs:
cache: npm
- name: Install dependencies
run: npm ci
- uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: composer:v2
- name: Ensure PHP toolchain
run: |
php -r "exit( version_compare( PHP_VERSION, '8.1', '>=' ) ? 0 : 1 );"
php -v
composer --version
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --no-progress
- name: Run dist plugin standards check
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
.DS_Store
vendor/
dist/
dist/
.env.agent-ci
7 changes: 7 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ When writing or refactoring PHPUnit tests:
- Run the full PHPUnit suite when shared test support files (like `WordPressStubs.php`) are changed.
- Prefer assertions that verify integration calls and state transitions happened (for example submenu registration/removal and metadata checks).

## Local CI With Agent CI

- Install the `agent-ci` skill one time with `npx skills add redwoodjs/agent-ci --skill agent-ci`.
- Before completing substantial work, run `npm run ci:agent:ci` or `npm run ci:agent` and fix any failures before reporting the work as done.
- If Agent CI pauses on a failed step, fix the issue and resume with `npm run ci:agent:retry -- --name <runner-name>`.
- Keep local Agent CI secrets in `.env.agent-ci`. Never commit that file.

## Important Notes

- Asset files (`build/scripts/*.asset.php`) are auto-generated - never edit manually
Expand Down
74 changes: 53 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
=== ClawPress ===
Contributors: bradvin
Tags: ai, assistant, admin
Requires at least: 6.9
Tested up to: 6.9
Requires PHP: 8.1
Stable tag: 0.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
# ClawPress

AI assistant for WordPress admins.

== Description ==
## The AI Agent for WordPress that actually does things.

![ClawPress Logo](img/clawpress-logo-500x500.png)

ClawPress is the AI for WordPress that actually does things.

[Preview in WordPress Playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/bradvin/clawpress/refs/heads/main/blueprint.json)
[Preview in WordPress Playground](https://playground.wordpress.net/?wp=beta&blueprint-url=https://raw.githubusercontent.com/bradvin/clawpress/refs/heads/main/blueprint.json)

## Quick Start

Expand All @@ -32,8 +20,35 @@ make test
make lint
make lint-changed
npm run plugin:check
npm run ci:agent:ci
npm run ci:agent
```

## Local GitHub Actions With Agent CI

ClawPress is set up to run its GitHub Actions workflows locally with [Agent CI](https://github.com/redwoodjs/agent-ci).

One-time agent skill setup:

```bash
npx skills add redwoodjs/agent-ci --skill agent-ci
```

Local workflow commands:

```bash
npm run ci:agent:ci
npm run ci:agent
npm run ci:agent:retry -- --name <runner-name>
```

Notes:

- Agent CI needs Docker available locally.
- The current `agent-ci` CLI release expects Node.js 22+ for these local runner commands.
- Local secrets belong in `.env.agent-ci` and should never be committed.
- `.github/agent-ci.Dockerfile` adds the extra tools this repo needs for local workflow runs, including Docker CLI access for `wp-env`.

## Key Features

### Admin Assistant MVP
Expand Down Expand Up @@ -64,6 +79,7 @@ Current Agent Features:
- `file_read`
- `file_write`
- `file_delete`
- `web_fetch` (read-only remote fetch via the WordPress HTTP API, validated with `wp_http_validate_url()`, logged to the action log table)
- `memory_long_term_add`
- `memory_long_term_update`
- `memory_long_term_delete`
Expand All @@ -86,10 +102,10 @@ Current Agent Features:
## Technical Details

- Uses modern WordPress patterns for admin pages and REST API.
- Uses `@automattic/jetpack-autoloader` for autoloading. ([docs](https://github.com/Automattic/jetpack-autoloader))
- Uses `@wordpress/wp-ai-client` for AI client. ([docs](https://github.com/WordPress/wp-ai-client))
- Uses WordPress core AI client APIs on WordPress 7.0+. ([docs](https://github.com/WordPress/wp-ai-client))
- Uses `@woocommerce/action-scheduler` for background processing. ([docs](https://github.com/woocommerce/action-scheduler))
- Includes admin table/grid interface using `@wordpress/dataviews` with WordPress Data Layer.
- Uses Composer autoloading for native ClawPress PHP classes.
- Uses `@wordpress/dataviews` for admin `DataViews` tables and `DataForm` settings forms.
- Uses `wp-scripts` for build tooling. ([docs](https://developer.wordpress.org/block-editor/packages/packages-scripts/))
- Uses `phpunit` for unit testing.
- Uses `wp-coding-standards` and `phpcodesniffer` for code quality.
Expand All @@ -111,7 +127,9 @@ Custom endpoints with permission callbacks and parameter validation.
## Dependencies

### Runtime
- `@wordpress/dataviews` - Table/grid UI components
- WordPress core AI client APIs (WordPress 7.0+)
- `woocommerce/action-scheduler` - background task scheduling
- `@wordpress/dataviews` - `DataViews` tables and `DataForm` form components
- `@wordpress/icons` - Icon library

### Development (npm)
Expand All @@ -120,6 +138,7 @@ Custom endpoints with permission callbacks and parameter validation.

### Development (Composer)
- `wp-coding-standards/wpcs` - WordPress Coding Standards for PHP_CodeSniffer
- `phpunit/phpunit` - PHPUnit test runner

## Patterns Used

Expand All @@ -136,11 +155,22 @@ Custom endpoints with permission callbacks and parameter validation.
## Requirements

- PHP 8.1+
- WordPress 6.9+
- WordPress 7.0+
- Composer 2+
- Node.js 20+
- npm 10+

## WordPress 7.0 Decision

ClawPress now targets WordPress 7.0+ intentionally.

This was a deliberate compatibility decision:

- WordPress 7.0 provides the AI client APIs in core.
- Bundling a separate runtime copy of `wordpress/wp-ai-client` caused conflicts with the core-provided classes.
- ClawPress now relies on the core AI client at runtime instead of shipping its own runtime copy.
- On sites running below WordPress 7.0, ClawPress does not bootstrap and shows an admin notice explaining the minimum required version.

## TODO

### Approved
Expand Down Expand Up @@ -181,4 +211,6 @@ Custom endpoints with permission callbacks and parameter validation.
10. Background scheduling model: Action Scheduler (not WP-Cron).
11. Cards are used to display complex UI in chat panel.
12. Commands can be used offline.
13. Cards can have actions, which run commands, or send messages.# Test pre-push hook
13. Cards can have actions, which run commands, or send messages.
14. Runtime AI integration depends on WordPress 7.0+ core AI APIs instead of bundling `wordpress/wp-ai-client`.
15. On unsupported WordPress versions, ClawPress shows an admin notice and does not bootstrap.
2 changes: 1 addition & 1 deletion blueprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"landingPage": "/wp-admin/admin.php?page=clawpress",
"preferredVersions": {
"php": "8.2",
"wp": "latest"
"wp": "7.0"
},
"features": {
"networking": true
Expand Down
Loading
Loading