Skip to content

Rules for an AI coding agent to filter out generic AI-generated UI designs, text, and code.

feat(cli): stamp the installed version and name it on update (#39)

Fajar Hidayat069bbe467338
diff --git a/GUIDE.md b/GUIDE.md
index 4008b81..474495c 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -222,9 +222,11 @@ The installer, the skills directory, and the plugin doors all need a terminal, s
## Update
-Nothing here is automatic unless a route below says it is. Every route updates by running that route's own command again, or by replacing the copy you made.
+Nothing here is automatic unless a route below says it is. Every route updates by running that route's own command again, or by replacing the copy you made. Whichever route you use, your agent loads skills when a session starts, so close the session you are in and open a new one afterwards. Until you do, the old rules are still the ones loaded.
-**First, how do you know a new version is out?** Nothing notifies you. Two places always carry the current one: the [releases page](https://github.com/miqdadbadjuber/anti-slop/releases) and the version badge at the top of the [README](README.md). Compare that against what you have, then use your route's section below. The installer route can skip the comparison, because its own command prints the version it would fetch.
+**First, how do you know a new version is out?** Nothing notifies you. Two places always carry the current one: the [releases page](https://github.com/miqdadbadjuber/anti-slop/releases) and the version badge at the top of the [README](README.md).
+
+**And which one do you have?** The installed `antislop` folder holds a `VERSION` file naming the release it came from. Open it, or ask your agent "which antislop version is installed?" and it reads the file for you. A folder with no `VERSION` file predates that file, so it is old enough to update without checking anything else. The installer route can skip this entirely: it prints both versions itself.
### The installer
@@ -234,7 +236,13 @@ The installer copies files, so your project holds a snapshot. When a new version
npx antislop-ai
```
-Answer the questions exactly as you did the first time. Because the folders already exist, it now asks one extra question:
+Answer the questions exactly as you did the first time. When it reaches folders you already have, it prints what it found before asking anything:
+
+```
+▲ Already here: antislop 3.2.10. This installer carries 3.2.12.
+```
+
+Then it asks one extra question:
- **Overwrite them** replaces your copies with the version it just downloaded. **This is the update.**
- **Keep what is there** leaves your old files alone and installs nothing.
diff --git a/README.md b/README.md
index ecda51c..63e8a83 100644
--- a/README.md
+++ b/README.md
@@ -80,7 +80,7 @@ One command, then answer the prompts. It asks which extra skills you want, where
npx antislop-ai
```
-To update later, run the same command and choose **Overwrite them** when it finds the existing folders. Choosing **Keep what is there** installs nothing and leaves you on the old version.
+To update later, run the same command and choose **Overwrite them** when it finds the existing folders. See [Update](#update).
### 2. The skills directory
@@ -170,6 +170,23 @@ The core `antislop.md` alone is a complete filter you can paste into any chat wi
curl -o antislop.md https://raw.githubusercontent.com/miqdadbadjuber/anti-slop/main/antislop.md
```
+## Update
+
+antislop does not update itself and nothing tells you a release is out. Every route updates by running its own command again:
+
+| Route | Update it with |
+|-------|----------------|
+| The installer | `npx antislop-ai`, then **Overwrite them**. It prints the version on disk next to the one it carries. |
+| The skills directory | `npx skills add miqdadbadjuber/anti-slop` |
+| The plugin (Claude Code) | `claude plugin update antislop@anti-slop` |
+| The plugin (Antigravity) | `agy plugin install https://github.com/miqdadbadjuber/anti-slop` |
+| The plugin (Codex) | `codex plugin marketplace upgrade anti-slop` |
+| The plugin (Cursor) | `agent plugin marketplace update https://github.com/miqdadbadjuber/anti-slop` |
+| The plugin (Kimi Code) | `/plugins install https://github.com/miqdadbadjuber/anti-slop` |
+| Manual | download `antislop.md` again |
+
+Skills load when a session starts, so start a new one afterwards. To see which version you are on, open the `VERSION` file in the installed `antislop` folder, or ask your agent. [GUIDE.md](GUIDE.md#update) covers each route step by step.
+
## Skills
| Skill | What it covers | Ships in |
diff --git a/antislop.md b/antislop.md
index b5f0abd..806fae9 100644
--- a/antislop.md
+++ b/antislop.md
@@ -55,6 +55,19 @@ Notes:
- The wizard needs file-write access for step 5 (the pointer block), and nothing else; the user approves once. It never needs network access.
- The pointer block is the source of truth for which skills are installed. To add or remove a skill later, update the block to match (add or remove the file and its line).
+### Already installed, and the user asks how to update
+
+antislop never updates itself, and nothing announces a new release. Answer from the route the user installed with, and say which route you are assuming when you cannot tell:
+
+- **The installer** (`npx antislop-ai`): run it again, answer as before, and pick **Overwrite them**. It prints the version already on disk next to the version it carries, so nothing has to be compared by hand. *Keep what is there* installs nothing.
+- **The skills directory** (`npx skills add miqdadbadjuber/anti-slop`): run the same command again.
+- **A plugin door** (Claude Code, Antigravity, Codex, Cursor, Kimi Code): each agent has its own update command. `GUIDE.md` in the repo lists them one by one.
+- **This file alone**: download it again and replace the copy.
+
+The folder this skill sits in holds a `VERSION` file naming the release it came from, unless it was installed before that file shipped. The current release is on the repo's releases page.
+
+Skills load when a session starts, so the session asking the question keeps the old rules either way. Say so, and tell the user to start a new one.
+
---
## Two Usage Modes
diff --git a/cli/index.mjs b/cli/index.mjs
index c01078b..a4d11fa 100644
--- a/cli/index.mjs
+++ b/cli/index.mjs
@@ -12,7 +12,9 @@ import {
detectConflicts,
detectDuplicateReads,
installSkills,
+ installedVersion,
updatePointers,
+ VERSION,
} from './lib/install.mjs'
const EXTRA_SKILLS = [
@@ -36,7 +38,7 @@ function displayDir(agent, location) {
async function main() {
if (process.argv.includes('--version') || process.argv.includes('-v')) {
- console.log('antislop 3.2.12')
+ console.log(`antislop ${VERSION}`)
return
}
@@ -98,11 +100,17 @@ async function main() {
const conflicts = detectConflicts({ skills, targets })
let overwrite = false
if (conflicts.length > 0) {
+ // Overwriting is how an update happens, and the version on disk is the one fact
+ // the user cannot look up anywhere. Name both sides so the choice is obvious.
+ const found = [...new Set(targets.map((t) => installedVersion(t.path)).filter(Boolean))]
+ const have = found.length > 0 ? `antislop ${found.join(' and ')}` : 'an antislop old enough that it records no version'
+ log.warn(`Already here: ${have}. This installer carries ${VERSION}.`)
+
const answer = await select({
message: `${conflicts.length} skill folder(s) already exist. What should I do?`,
options: [
- { value: 'overwrite', label: 'Overwrite them', hint: 'replace with this version' },
- { value: 'keep', label: 'Keep what is there', hint: 'leave the old version in place' },
+ { value: 'overwrite', label: 'Overwrite them', hint: `update to ${VERSION}` },
+ { value: 'keep', label: 'Keep what is there', hint: 'stay on what is installed' },
],
})
if (isCancel(answer)) stop('Install cancelled.')
diff --git a/cli/lib/install.mjs b/cli/lib/install.mjs
index f5d8d13..a92eb56 100644
--- a/cli/lib/install.mjs
+++ b/cli/lib/install.mjs
@@ -7,6 +7,17 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
export const CORE = 'antislop'
+export const VERSION = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')).version
+
+/** The release an existing install came from, or null when it predates the VERSION file.
+ * Nothing else on disk names it, so without this an update cannot tell the user what
+ * they already have.
+ */
+export function installedVersion(targetPath) {
+ const file = path.join(targetPath, CORE, 'VERSION')
+ return fs.existsSync(file) ? fs.readFileSync(file, 'utf8').trim() : null
+}
+
// Every row carries the entry file it writes, so a new agent cannot be added
// without one: `entry` is what `updatePointers` needs and nothing else supplies it.
// `readsAlso` lists the other project folders the agent loads skills from besides its
diff --git a/cli/scripts/smoke-worker.mjs b/cli/scripts/smoke-worker.mjs
index 0b27ad6..05c37b3 100644
--- a/cli/scripts/smoke-worker.mjs
+++ b/cli/scripts/smoke-worker.mjs
@@ -9,7 +9,9 @@ import {
detectConflicts,
detectDuplicateReads,
installSkills,
+ installedVersion,
updatePointers,
+ VERSION,
} from '../lib/install.mjs'
const skills = ['antislop', 'antislop-ui']
@@ -121,6 +123,10 @@ const src = fs.readFileSync(path.join(skillSourceDir(), 'antislop-ui', 'SKILL.md
const dst = fs.readFileSync(path.join(process.cwd(), '.claude', 'skills', 'antislop-ui', 'SKILL.md'), 'utf8')
check('G antislop-ui SKILL.md identical', src === dst, true)
+// The conflict prompt reports the release on disk from this file alone.
+check('G installed version is stamped', installedVersion(targets[0].path), VERSION)
+check('G no install means no version', installedVersion(path.join(process.cwd(), 'nowhere')), null)
+
updatePointers({ targets, skills })
const entry = fs.readFileSync(path.join(process.cwd(), 'CLAUDE.md'), 'utf8')
check('H blocks after a second run', (entry.match(/antislop:start/g) || []).length, 1)
diff --git a/cli/scripts/sync-skills.mjs b/cli/scripts/sync-skills.mjs
index 70d82b6..5c5b992 100644
--- a/cli/scripts/sync-skills.mjs
+++ b/cli/scripts/sync-skills.mjs
@@ -16,6 +16,8 @@ const CORE_FRONTMATTER = [
'',
].join('\n')
+const version = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')).version
+
const coreBody = fs.readFileSync(path.join(repoRoot, 'antislop.md'), 'utf8')
.replace(/\r\n/g, '\n')
.trim()
@@ -27,10 +29,14 @@ if (/https?:\/\/raw\.githubusercontent\.com/.test(coreBody)) {
fs.writeFileSync(path.join(repoSkills, 'antislop', 'SKILL.md'), CORE_FRONTMATTER + coreBody + '\n')
+// An installed copy is a snapshot with nothing in it that names the release it came from,
+// so an update could not say what was on disk. Every install route copies this folder.
+fs.writeFileSync(path.join(repoSkills, 'antislop', 'VERSION'), version + '\n')
+
// Python leaves a __pycache__ beside the contrast checker; it must not reach the tarball.
fs.rmSync(cliSkills, { recursive: true, force: true })
fs.cpSync(repoSkills, cliSkills, {
recursive: true,
filter: (src) => path.basename(src) !== '__pycache__',
})
-console.log('Regenerated skills/antislop/SKILL.md from antislop.md and synced to cli/skills/')
+console.log(`Regenerated skills/antislop/SKILL.md and VERSION (${version}) and synced to cli/skills/`)
diff --git a/scripts/check-repo.mjs b/scripts/check-repo.mjs
index 6591f68..0df41fa 100644
--- a/scripts/check-repo.mjs
+++ b/scripts/check-repo.mjs
@@ -108,7 +108,8 @@ function versions() {
['.codex-plugin/plugin.json', json('.codex-plugin/plugin.json')?.version],
['.cursor-plugin/plugin.json', json('.cursor-plugin/plugin.json')?.version],
['.kimi-plugin/plugin.json', json('.kimi-plugin/plugin.json')?.version],
- ['cli/index.mjs', read('cli/index.mjs').match(/antislop (\d+\.\d+\.\d+)/)?.[1]],
+ // Stamped into every install, so a stale one makes the installer misreport what is on disk.
+ ['skills/antislop/VERSION', read('skills/antislop/VERSION').trim()],
['cli/lib/banner.mjs', read('cli/lib/banner.mjs').match(/installer v(\d+\.\d+\.\d+)/)?.[1]],
['skills/antislop-human/contrast-mcp.py', read('skills/antislop-human/contrast-mcp.py').match(/SERVER_VERSION = "(\d+\.\d+\.\d+)"/)?.[1]],
]
diff --git a/skills/antislop/SKILL.md b/skills/antislop/SKILL.md
index 1320ada..d8a2e13 100644
--- a/skills/antislop/SKILL.md
+++ b/skills/antislop/SKILL.md
@@ -60,6 +60,19 @@ Notes:
- The wizard needs file-write access for step 5 (the pointer block), and nothing else; the user approves once. It never needs network access.
- The pointer block is the source of truth for which skills are installed. To add or remove a skill later, update the block to match (add or remove the file and its line).
+### Already installed, and the user asks how to update
+
+antislop never updates itself, and nothing announces a new release. Answer from the route the user installed with, and say which route you are assuming when you cannot tell:
+
+- **The installer** (`npx antislop-ai`): run it again, answer as before, and pick **Overwrite them**. It prints the version already on disk next to the version it carries, so nothing has to be compared by hand. *Keep what is there* installs nothing.
+- **The skills directory** (`npx skills add miqdadbadjuber/anti-slop`): run the same command again.
+- **A plugin door** (Claude Code, Antigravity, Codex, Cursor, Kimi Code): each agent has its own update command. `GUIDE.md` in the repo lists them one by one.
+- **This file alone**: download it again and replace the copy.
+
+The folder this skill sits in holds a `VERSION` file naming the release it came from, unless it was installed before that file shipped. The current release is on the repo's releases page.
+
+Skills load when a session starts, so the session asking the question keeps the old rules either way. Say so, and tell the user to start a new one.
+
---
## Two Usage Modes
diff --git a/skills/antislop/VERSION b/skills/antislop/VERSION
new file mode 100644
index 0000000..275e51e
--- /dev/null
+++ b/skills/antislop/VERSION
@@ -0,0 +1 @@
+3.2.12