=== SiteSelf Connector ===
Contributors: refact
Tags: automation, maintenance, agency, ai
Requires at least: 5.6
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.6.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lets your SiteSelf agent work on this site's theme and plugin files, with a log you can read and a one-click disconnect.

== Description ==

SiteSelf is a service that works on your WordPress site for you — updating
content, adjusting your design, keeping an eye on things — and reports back in
chat. This plugin is the part that lives on your site, and it exists so your
agent can work on your theme and plugin files rather than content alone.

**What it can do**

* Read and write files inside your themes and plugins folders
* Tell your agent how the site is built: WordPress and PHP versions, active
  theme, installed plugins, and which company hosts the site
* Clear caches
* Keep a log of everything it did, readable under Tools → SiteSelf

**What it will not do, by design**

* It never runs code that is sent to it. There is no remote code execution.
* It never reads credentials belonging to other services. It reads a short,
  fixed list of settings that describe how your site is built, and refuses
  anything that looks like a key, token or password.
* It writes only inside your themes and plugins folders. Both folders are
  resolved before anything is written, so `../` cannot climb out of them, and a
  file that turns out to be a shortcut to somewhere else (a symlink) is refused
  rather than followed.
* It cannot edit files that WordPress itself would not let you edit. Whether a
  request is allowed is WordPress's decision, using the same permissions as its
  built-in editors — so `DISALLOW_FILE_MODS`, `DISALLOW_FILE_EDIT`, a managed
  host that switches file changes off, and multisite's rule that only a network
  administrator may touch shared plugin files all apply here too.
* Before replacing a file it keeps a copy of the previous version, and it
  refuses to save PHP that has a syntax error.

**How access works**

The plugin adds no new way into your site. Every request must come from a
signed-in WordPress user with the right permissions, using WordPress's own
application passwords — which you create, and can revoke at any time under
Users → Profile → Application Passwords. Deactivating this plugin stops file
access immediately.

== Installation ==

This plugin does nothing on its own. It is the site-side half of a service, so
there is a short setup after you activate it.

1. Install and activate the plugin.
2. Create an application password: **Users → Profile → Application Passwords**.
   Give it a name you will recognise, such as "SiteSelf", and copy the password
   WordPress shows you. It is shown once.
3. Sign in at https://siteself.com and add this site, pasting in the site
   address, your WordPress username and that application password.

There are no settings to configure. **Tools → SiteSelf** shows what your agent
has done, the previous versions of any file it replaced, and a button that
disconnects the site.

To stop it at any time: revoke the application password under your profile, or
deactivate the plugin. Either takes effect immediately.

== External services ==

This plugin connects your site to **SiteSelf**, a service run by Refact at
https://siteself.com. The plugin is the site-side half of that service and is
not useful without it.

The plugin makes no outbound requests of its own. It sends nothing anywhere,
on any schedule. What it does is answer requests that SiteSelf makes to your
site, and it answers them only when they carry a signed-in WordPress user with
administrator permissions — an application password that you created and can
revoke.

**What leaves your site when SiteSelf asks.** A status request returns a
description of how this site is built:

* your site's name, home address, admin address and language
* your WordPress and PHP version numbers
* every plugin installed, with its version and whether it is active
* your active theme, its version, and whether it is a child theme
* which company hosts the site, any must-use plugins that identify them, and
  whether the host reports this as a staging copy
* the server software string and the file path WordPress is installed at
* how many published posts and pages you have
* whether this site permits file changes
* a public key this plugin creates for the site, so that moving to a new
  domain does not look like a different site. The matching private key never
  leaves your server — not to SiteSelf, not in any request.

Other requests return the contents of a file inside your themes or plugins
folders, a folder listing, or one of a short fixed list of WordPress settings
that describe how the site is built. Nothing else is readable, and anything
whose name looks like a key, token, secret or password is refused.

Your site's content is not sent by this plugin. No visitor data, analytics or
personal data of your users is collected, sent or stored by it.

Service terms: https://siteself.com/terms
Privacy policy: https://siteself.com/privacy

== Frequently Asked Questions ==

= Can I see what the agent has done? =

Yes. Tools → SiteSelf lists every action with a timestamp.

= How do I stop it? =

Deactivate the plugin, or revoke the application password under your user
profile. Either one takes effect immediately.

= Does it work without the SiteSelf service? =

No. This plugin is the site-side half of a service at https://siteself.com.

= Can it edit files if my host has locked them down? =

No, and that is deliberate. It asks WordPress the same question WordPress asks
before showing you its own file editors. If your host or your `wp-config.php`
has switched file changes off, this plugin is refused too, and your agent will
tell you which setting stopped it.

== Changelog ==

= 0.6.0 =
* Closed a hole in the file rails. A file that was a shortcut to somewhere else
  (a symlink) could be written through, which meant a write inside your themes
  folder could change a file outside it. Those are now refused. If you have
  deliberately symlinked a theme or plugin file, your agent will now say it
  cannot write to it rather than quietly changing the file at the other end.
* File editing now uses exactly the permissions WordPress uses for its own
  editors. **On a multisite network this is a real change**: only a network
  administrator can edit theme and plugin files now, because those folders are
  shared by every site on the network. A single-site administrator is
  unaffected. Sites whose host switches file changes off through a filter
  rather than a constant are now correctly refused as well.
* Tools → SiteSelf and your SiteSelf dashboard now report whether writes are
  actually permitted, rather than only whether the two `wp-config.php`
  constants are set. The two can disagree, and it was the second one that was
  being shown.

= 0.5.0 =
* Updates now come from WordPress.org, like every other plugin on your site.
  Earlier versions fetched their own updates from siteself.com because this
  plugin was not in the directory yet. Nothing changes on your Plugins screen —
  the update button is in the same place and works the same way.
* This is the last update that arrives from siteself.com. After it, your site
  checks WordPress.org.

= 0.4.0 =
* Your site can now tell SiteSelf who it is, so moving to a new domain no longer
  looks like a different site. The plugin creates a key the first time SiteSelf
  asks about your site, and keeps it here. The private half never leaves your
  server — not to SiteSelf, not in any request.
* Nothing else changes, and there is nothing to set up. If you move your site,
  restore a backup, or your host makes a staging copy, SiteSelf can tell which
  one is which instead of guessing from the address.
* Removing the plugin leaves the key in place, so reinstalling brings your site
  back as the same site. Disconnect, under Tools → SiteSelf, is what removes it.

= 0.3.0 =
* Updates now arrive on your own Plugins screen. Earlier versions had no way to
  tell WordPress where newer copies live, so updating meant deleting the plugin
  and uploading a zip by hand. It is now an ordinary one-click update, and can
  be turned on for automatic updates like any other plugin.

= 0.2.0 =
* Renamed from "Refact Agent Connector" to "SiteSelf Connector", including the
  plugin folder and the REST namespace. WordPress treats a renamed plugin as a
  different one, so this version had to be installed by hand alongside removing
  the old one — the change in 0.3.0 exists so that never happens again.

= 0.1.0 =
* First release: status, file read/write with backups, allowlisted settings
  reads, cache flush, and the activity log.
