@temmo/cli 0.0.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +14 -0
- package/.claude-plugin/plugin.json +16 -0
- package/.codex-plugin/plugin.json +30 -0
- package/.cursor-plugin/plugin.json +22 -0
- package/.mcp.json +18 -0
- package/LICENSE +202 -0
- package/README.md +82 -2
- package/THIRD_PARTY_NOTICES +32 -0
- package/commands/afk.md +17 -0
- package/deploy/build-ui.mjs +65 -0
- package/deploy/claude/README.md +16 -0
- package/deploy/claude/auto-mode.json +31 -0
- package/deploy/postgres/compose.yaml +26 -0
- package/deploy/temmo-runner.service +24 -0
- package/deploy/verify-ui.mjs +15 -0
- package/harness-core/README.md +27 -0
- package/harness-core/bin/harness.mjs +17 -0
- package/harness-core/package.json +10 -0
- package/harness-core/stage.mjs +108 -0
- package/harness-core/stages/commit.md +7 -0
- package/harness-core/stages/pr.md +7 -0
- package/harness-core/stages/push.md +7 -0
- package/hooks/codex-hooks.json +14 -0
- package/hooks/cursor-hooks.json +17 -0
- package/hooks/hooks.json +27 -0
- package/lib/acp/permission.js +72 -0
- package/lib/acp/sessionConfig.js +109 -0
- package/lib/activity.js +244 -0
- package/lib/agent-guard.js +72 -0
- package/lib/agents-route.js +55 -0
- package/lib/agents.js +213 -0
- package/lib/agui.js +255 -0
- package/lib/alerts.js +36 -0
- package/lib/analyze-otlp.js +46 -0
- package/lib/analyze-run-code.js +397 -0
- package/lib/analyze-sources.js +372 -0
- package/lib/approval-card.js +54 -0
- package/lib/approval-cli.js +53 -0
- package/lib/approval-request.js +81 -0
- package/lib/approval-signer.js +48 -0
- package/lib/approvals.js +295 -0
- package/lib/attachment-cache.js +236 -0
- package/lib/attachment.js +63 -0
- package/lib/blocked.js +20 -0
- package/lib/build-review.js +90 -0
- package/lib/builder/cli.js +90 -0
- package/lib/builder/policy.js +176 -0
- package/lib/builder/recover.js +189 -0
- package/lib/builder/run.js +240 -0
- package/lib/builder/settle.js +198 -0
- package/lib/builder/stage.js +240 -0
- package/lib/builder/state.js +73 -0
- package/lib/builder/supervisor.js +289 -0
- package/lib/builder-clean.js +223 -0
- package/lib/builder-code.cjs +67 -0
- package/lib/builder.js +9 -0
- package/lib/bus-postgres.js +281 -0
- package/lib/bus.js +349 -0
- package/lib/catalog/author.js +278 -0
- package/lib/catalog/dot.js +426 -0
- package/lib/catalog/pattern-model.js +193 -0
- package/lib/catalog/patterns.js +324 -0
- package/lib/catalog/projects.js +83 -0
- package/lib/catalog/records.js +2 -0
- package/lib/catalog/roster.js +70 -0
- package/lib/catalog/team-files.js +49 -0
- package/lib/catalog/teams.js +109 -0
- package/lib/claude-socket.js +333 -0
- package/lib/cli.js +741 -0
- package/lib/code-mode.js +45 -0
- package/lib/code-read-policy.yaml +9 -0
- package/lib/code-run.js +461 -0
- package/lib/codex-compact.js +141 -0
- package/lib/compaction.js +21 -0
- package/lib/config.js +424 -0
- package/lib/cursor-trace.js +248 -0
- package/lib/deep-link.js +20 -0
- package/lib/deliver-push.js +120 -0
- package/lib/delivery.js +28 -0
- package/lib/deploy-tree.js +227 -0
- package/lib/durable.js +404 -0
- package/lib/factory-tick.js +32 -0
- package/lib/family.js +63 -0
- package/lib/fetch-origin.js +53 -0
- package/lib/format.js +133 -0
- package/lib/harness-surface-cli.js +153 -0
- package/lib/harness-surface.js +486 -0
- package/lib/harness.js +271 -0
- package/lib/hook.mjs +291 -0
- package/lib/idle.js +40 -0
- package/lib/install-cursor.js +115 -0
- package/lib/install-opencode.js +105 -0
- package/lib/job.js +82 -0
- package/lib/land-cli.js +319 -0
- package/lib/land-member.js +64 -0
- package/lib/land.js +320 -0
- package/lib/lessons.js +223 -0
- package/lib/limit-alert.js +423 -0
- package/lib/limits.js +284 -0
- package/lib/machine-prompt.js +19 -0
- package/lib/merge-sweep.js +149 -0
- package/lib/messaging.js +1002 -0
- package/lib/mission-cli.js +103 -0
- package/lib/mission.js +241 -0
- package/lib/mode.js +215 -0
- package/lib/models.js +114 -0
- package/lib/names.js +86 -0
- package/lib/opencode-api.js +57 -0
- package/lib/opencode-plugin.mjs +313 -0
- package/lib/operator-token.js +78 -0
- package/lib/operator.js +187 -0
- package/lib/pad-activity.js +143 -0
- package/lib/pad-fresh.js +44 -0
- package/lib/pad.js +198 -0
- package/lib/pattern-cli.js +120 -0
- package/lib/pattern-compiler.js +68 -0
- package/lib/pattern-runs.js +795 -0
- package/lib/pattern-stall.js +58 -0
- package/lib/pattern-tick.js +45 -0
- package/lib/pattern-workflow.js +69 -0
- package/lib/pi-extension.mjs +98 -0
- package/lib/pi.js +57 -0
- package/lib/plugin-copy.js +76 -0
- package/lib/pm-review.js +32 -0
- package/lib/pm-workspace.js +87 -0
- package/lib/postgres.js +115 -0
- package/lib/pr-card.js +34 -0
- package/lib/probe.js +295 -0
- package/lib/process.js +67 -0
- package/lib/project-pause.js +23 -0
- package/lib/prune.js +793 -0
- package/lib/questions.js +250 -0
- package/lib/receipts.js +63 -0
- package/lib/reflect.js +962 -0
- package/lib/rename-migration.js +118 -0
- package/lib/run-terminal.js +437 -0
- package/lib/runner-request.js +33 -0
- package/lib/sandbox-app.js +120 -0
- package/lib/sandbox-claims.js +258 -0
- package/lib/sandbox-cli.js +188 -0
- package/lib/sandbox-hosts-cli.js +68 -0
- package/lib/sandbox-hosts.js +94 -0
- package/lib/sandbox-pr.js +102 -0
- package/lib/sandbox-proposal.js +367 -0
- package/lib/sandbox-tools.js +143 -0
- package/lib/sandbox.js +501 -0
- package/lib/schedule-session.js +68 -0
- package/lib/session-activity.js +67 -0
- package/lib/session-events.js +94 -0
- package/lib/sessions/control.js +244 -0
- package/lib/sessions/git-refs.js +265 -0
- package/lib/sessions/launch.js +359 -0
- package/lib/sessions/registry.js +450 -0
- package/lib/sessions/scope.js +111 -0
- package/lib/setup.js +377 -0
- package/lib/signed-approval.js +225 -0
- package/lib/slash.js +167 -0
- package/lib/spawn-cli.js +45 -0
- package/lib/spawn.js +107 -0
- package/lib/start-limit.js +58 -0
- package/lib/state.js +24 -0
- package/lib/stop.js +308 -0
- package/lib/store-read.js +62 -0
- package/lib/store.js +252 -0
- package/lib/subagent-guard.js +240 -0
- package/lib/surfaces/channel-post.js +43 -0
- package/lib/surfaces/instructions.js +15 -0
- package/lib/surfaces/mcp-reload.js +144 -0
- package/lib/surfaces/ops.js +629 -0
- package/lib/surfaces/render-mcp.js +33 -0
- package/lib/surfaces/run-terminal-ops.js +40 -0
- package/lib/surfaces/sandbox-ops.js +36 -0
- package/lib/surfaces/schema.js +7 -0
- package/lib/surfaces/task-view.js +90 -0
- package/lib/surfaces/types.js +4 -0
- package/lib/task-cli.js +274 -0
- package/lib/task-order.js +34 -0
- package/lib/task-order.mjs +2 -0
- package/lib/task-route.js +125 -0
- package/lib/tasks.js +631 -0
- package/lib/team-permission.js +34 -0
- package/lib/team-templates/blitz/team.dot +9 -0
- package/lib/team-templates/factory/team.dot +26 -0
- package/lib/team-templates/feature/team.dot +14 -0
- package/lib/team-templates/fix-and-review/team.dot +12 -0
- package/lib/team-templates/product/team.dot +16 -0
- package/lib/team-templates/release/team.dot +7 -0
- package/lib/team-templates/review/team.dot +6 -0
- package/lib/terminal-draft.js +42 -0
- package/lib/thread-branch.js +82 -0
- package/lib/thread-channel-store.js +181 -0
- package/lib/thread-channels.js +116 -0
- package/lib/thread-listening.js +20 -0
- package/lib/thread-routes.js +91 -0
- package/lib/threads.js +441 -0
- package/lib/tool-api.js +33 -0
- package/lib/transcript.js +98 -0
- package/lib/ui-build-output.js +19 -0
- package/lib/ui-capabilities.js +90 -0
- package/lib/usage.js +182 -0
- package/lib/vendor/mcp-sdk.d.mts +4 -0
- package/lib/vendor/mcp-sdk.mjs +17046 -0
- package/lib/waiter.js +127 -0
- package/lib/workflows.js +546 -0
- package/lib/worktree-setup.js +86 -0
- package/package.json +112 -1
- package/runner/adapters/claude.js +465 -0
- package/runner/adapters/cli-sandbox.js +277 -0
- package/runner/adapters/codex.js +675 -0
- package/runner/adapters/cursor.mjs +937 -0
- package/runner/adapters/fake.js +119 -0
- package/runner/adapters/opencode-sandbox.js +370 -0
- package/runner/adapters/opencode.js +486 -0
- package/runner/adapters/pi-sandbox.js +134 -0
- package/runner/adapters/pi.js +364 -0
- package/runner/client.js +40 -0
- package/runner/contract.js +129 -0
- package/runner/control.js +178 -0
- package/runner/delivery.js +184 -0
- package/runner/factory-tick.mjs +10 -0
- package/runner/lock.js +41 -0
- package/runner/main.mjs +118 -0
- package/runner/pattern-tick.mjs +16 -0
- package/runner/publish.js +113 -0
- package/runner/runner.js +2612 -0
- package/runner/sandbox-run.mjs +239 -0
- package/runner/schedules.js +294 -0
- package/runner/task-wake.js +59 -0
- package/scripts/ai-collab +3 -0
- package/scripts/ai-collab-bus.mjs +4 -0
- package/scripts/ai-collab-code-mcp.mjs +3 -0
- package/scripts/ai-collab-hook +3 -0
- package/scripts/ai-collab-hook.mjs +3 -0
- package/scripts/ai-collab-mcp-tools.mjs +2 -0
- package/scripts/ai-collab-mcp.mjs +3 -0
- package/scripts/ai-collab.mjs +3 -0
- package/scripts/install-cursor.mjs +11 -0
- package/scripts/install-opencode.mjs +10 -0
- package/scripts/temmo +3 -0
- package/scripts/temmo-bus.mjs +151 -0
- package/scripts/temmo-code-mcp.mjs +63 -0
- package/scripts/temmo-hook +3 -0
- package/scripts/temmo-hook.mjs +201 -0
- package/scripts/temmo-mcp-tools.mjs +22 -0
- package/scripts/temmo-mcp.mjs +27 -0
- package/scripts/temmo.mjs +4 -0
- package/skills/antislop/SKILL.md +701 -0
- package/skills/antislop/VERSION +1 -0
- package/skills/antislop-code/SKILL.md +128 -0
- package/skills/antislop-human/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-human/SKILL.md +204 -0
- package/skills/antislop-human/contrast-check.py +168 -0
- package/skills/antislop-human/contrast-mcp.py +125 -0
- package/skills/antislop-human/references/A11Y-PATTERNS.md +249 -0
- package/skills/antislop-human/references/WCAG.md +127 -0
- package/skills/antislop-layoutmobile/SKILL.md +170 -0
- package/skills/antislop-ui/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-ui/SKILL.md +351 -0
- package/skills/antislop-ui/references/CORE-WEB-VITALS.md +181 -0
- package/skills/antislop-ui/references/WEB-BASELINE.md +28 -0
- package/skills/harness-surface/SKILL.md +42 -0
- package/skills/land/SKILL.md +32 -0
- package/skills/memory-file/SKILL.md +39 -0
- package/skills/temmo/SKILL.md +101 -0
- package/skills/temmo/references/role-programs.md +47 -0
- package/skills/ui-sdk/SKILL.md +56 -0
- package/skills/ui-sdk/references/agent-ready.md +136 -0
- package/skills/ui-sdk/references/build-interface.md +187 -0
- package/skills/ui-sdk/references/create-component.md +88 -0
- package/skills/ui-sdk/references/patterns.md +246 -0
- package/skills/ui-sdk/references/styles.md +66 -0
- package/skills/ui-sdk/references/testing.md +172 -0
- package/skills/ui-sdk/references/web-components.md +78 -0
- package/tools/screen-state.mjs +119 -0
- package/tools/smoke-ui.mjs +540 -0
- package/web/app/activity.jsx +251 -0
- package/web/app/agent-mark.tsx +43 -0
- package/web/app/alert-level.jsx +16 -0
- package/web/app/api/[action]/route.js +8 -0
- package/web/app/api/auth/[step]/route.js +12 -0
- package/web/app/api/events/route.js +8 -0
- package/web/app/api/file/[name]/route.js +8 -0
- package/web/app/api/land/route.js +12 -0
- package/web/app/api/lessons/route.js +8 -0
- package/web/app/api/push/key/route.js +8 -0
- package/web/app/api/push/subscribe/route.js +12 -0
- package/web/app/api/push/test/route.js +8 -0
- package/web/app/api/refs/route.js +8 -0
- package/web/app/api/review-diff/route.js +8 -0
- package/web/app/api/schedules/route.js +8 -0
- package/web/app/api/thread-diff/route.js +8 -0
- package/web/app/api/version/route.js +6 -0
- package/web/app/cards.jsx +189 -0
- package/web/app/chat-api.js +82 -0
- package/web/app/chat-composer.jsx +313 -0
- package/web/app/chat-console.jsx +691 -0
- package/web/app/chat-image.tsx +61 -0
- package/web/app/chat-message.jsx +122 -0
- package/web/app/chat-shared.jsx +59 -0
- package/web/app/chat-sidebar.jsx +25 -0
- package/web/app/chat-stream.js +127 -0
- package/web/app/chat.jsx +31 -0
- package/web/app/compactions.jsx +57 -0
- package/web/app/composer-actions.tsx +87 -0
- package/web/app/decisions.jsx +53 -0
- package/web/app/fonts/OFL-hanken-grotesk.txt +93 -0
- package/web/app/fonts/OFL-ibm-plex-mono.txt +93 -0
- package/web/app/fonts/hanken-grotesk-latin-wght-normal.woff2 +0 -0
- package/web/app/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/web/app/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
- package/web/app/globals.css +199 -0
- package/web/app/home.jsx +246 -0
- package/web/app/icon.svg +1 -0
- package/web/app/land-panel.jsx +63 -0
- package/web/app/land-reviews.jsx +20 -0
- package/web/app/layout.jsx +17 -0
- package/web/app/lessons.tsx +76 -0
- package/web/app/logo.tsx +13 -0
- package/web/app/logos.jsx +16 -0
- package/web/app/manifest.js +8 -0
- package/web/app/mode-menu.tsx +46 -0
- package/web/app/new-session.jsx +275 -0
- package/web/app/notify.jsx +180 -0
- package/web/app/outcomes.tsx +94 -0
- package/web/app/page.jsx +9 -0
- package/web/app/pattern-graph.jsx +75 -0
- package/web/app/patterns-page.jsx +293 -0
- package/web/app/phone-nav.tsx +36 -0
- package/web/app/progress-feed.tsx +33 -0
- package/web/app/providers.tsx +27 -0
- package/web/app/quote.jsx +15 -0
- package/web/app/run-card.tsx +200 -0
- package/web/app/run-requests.tsx +148 -0
- package/web/app/scheduled.jsx +105 -0
- package/web/app/session-panel.tsx +174 -0
- package/web/app/session-toolbar.tsx +180 -0
- package/web/app/shadcn.css +638 -0
- package/web/app/shipped.jsx +49 -0
- package/web/app/subagent-runs.jsx +31 -0
- package/web/app/task-graph.jsx +67 -0
- package/web/app/tasks-strip.tsx +36 -0
- package/web/app/tasks.jsx +375 -0
- package/web/app/team-author.jsx +145 -0
- package/web/app/team-editor.jsx +88 -0
- package/web/app/thread-agents.tsx +32 -0
- package/web/app/thread-place.tsx +9 -0
- package/web/app/thread-sessions.tsx +149 -0
- package/web/app/thread-sidebar.tsx +418 -0
- package/web/app/thread-switcher.tsx +27 -0
- package/web/app/tool-diff.jsx +94 -0
- package/web/components/a2ui/controls.jsx +36 -0
- package/web/components/a2ui/option-picker.jsx +23 -0
- package/web/components/a2ui/script.tsx +121 -0
- package/web/components/a2ui/surface.jsx +81 -0
- package/web/components/chat/thread.jsx +50 -0
- package/web/components/script-text.tsx +42 -0
- package/web/components/ui/avatar.jsx +115 -0
- package/web/components/ui/badge.jsx +47 -0
- package/web/components/ui/button.jsx +63 -0
- package/web/components/ui/chat-container.jsx +52 -0
- package/web/components/ui/choice-list.tsx +72 -0
- package/web/components/ui/code-block.jsx +60 -0
- package/web/components/ui/copy-button.tsx +41 -0
- package/web/components/ui/dropdown-menu.jsx +257 -0
- package/web/components/ui/markdown.jsx +84 -0
- package/web/components/ui/message.jsx +28 -0
- package/web/components/ui/popover.jsx +33 -0
- package/web/components/ui/scroll-button.jsx +34 -0
- package/web/components/ui/select.jsx +189 -0
- package/web/components/ui/sheet.jsx +152 -0
- package/web/components/ui/sonner.jsx +10 -0
- package/web/components/ui/tabs.jsx +88 -0
- package/web/components/ui/textarea.jsx +20 -0
- package/web/components/ui/tooltip.jsx +56 -0
- package/web/components.json +24 -0
- package/web/instrumentation.js +8 -0
- package/web/lib/a2ui-catalog.js +34 -0
- package/web/lib/a2ui-pr.js +76 -0
- package/web/lib/a2ui-run-catalog.js +18 -0
- package/web/lib/a2ui-run.js +93 -0
- package/web/lib/a2ui.js +262 -0
- package/web/lib/activity-rows.js +275 -0
- package/web/lib/agent-detail.js +5 -0
- package/web/lib/alert-level.js +44 -0
- package/web/lib/approval-mode.js +22 -0
- package/web/lib/chat-turns.js +174 -0
- package/web/lib/child-subagents.js +16 -0
- package/web/lib/compaction-view.js +48 -0
- package/web/lib/composer-actions.js +40 -0
- package/web/lib/context-view.js +57 -0
- package/web/lib/fuzzy.js +26 -0
- package/web/lib/highlight.js +44 -0
- package/web/lib/lessons-view.js +23 -0
- package/web/lib/mentions.js +16 -0
- package/web/lib/message-routing.js +105 -0
- package/web/lib/new-session.js +85 -0
- package/web/lib/operator-messages.js +28 -0
- package/web/lib/pattern-graph.js +165 -0
- package/web/lib/pattern-view.js +33 -0
- package/web/lib/pending-summary.js +18 -0
- package/web/lib/permission-modes.js +30 -0
- package/web/lib/project-feed.js +107 -0
- package/web/lib/quote.js +7 -0
- package/web/lib/reply-quote.js +31 -0
- package/web/lib/scheduled.js +79 -0
- package/web/lib/selection.js +110 -0
- package/web/lib/send-confirmation.js +22 -0
- package/web/lib/session-dead.js +10 -0
- package/web/lib/session-state.js +132 -0
- package/web/lib/sidebar.js +15 -0
- package/web/lib/slash-commands.js +164 -0
- package/web/lib/start-default.js +35 -0
- package/web/lib/start-mode.js +35 -0
- package/web/lib/stream-views.js +49 -0
- package/web/lib/subagent-state.js +20 -0
- package/web/lib/task-board.js +54 -0
- package/web/lib/task-graph.js +183 -0
- package/web/lib/task-tags.js +41 -0
- package/web/lib/team-editor.js +10 -0
- package/web/lib/thread-groups.js +86 -0
- package/web/lib/threads.js +28 -0
- package/web/lib/tool-diff.js +273 -0
- package/web/lib/ui-events.js +58 -0
- package/web/lib/utils.js +5 -0
- package/web/lib/view-memory.js +25 -0
- package/web/next.config.mjs +37 -0
- package/web/postcss.config.mjs +1 -0
- package/web/proxy.js +25 -0
- package/web/public/sw.js +39 -0
- package/web/server/auth.js +178 -0
- package/web/server/dispatch.js +293 -0
- package/web/server/history.js +56 -0
- package/web/server/hosted.js +58 -0
- package/web/server/hub.js +126 -0
- package/web/server/instance.js +5 -0
- package/web/server/land-reviews.js +64 -0
- package/web/server/push.js +148 -0
- package/web/server/run-terminal.js +79 -0
- package/web/server/schedules.js +38 -0
- package/web/server/shipped.js +51 -0
- package/web/server/task-board.js +71 -0
- package/web/server/threads.js +209 -0
- package/web/server/ui.js +2937 -0
- package/web/tsconfig.base.json +16 -0
- package/web/tsconfig.json +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.2.32
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: antislop-code
|
|
3
|
+
description: "Load when cleaning comments. Remove generic comments and keep the ones that carry information. Load with antislop."
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
# antislop-code
|
|
7
|
+
|
|
8
|
+
> Anti Slop: Rules for AI Coding Agents. Code Comments skill
|
|
9
|
+
|
|
10
|
+
> Part of the antislop system. Read together with `antislop.md` (the core). This skill filters comments that read as generically AI (decorative, restating the obvious, stiff, loud) while preserving the comments that carry real information. It references core rules by number and never duplicates or renumbers them. Load it when the task writes or edits code comments.
|
|
11
|
+
|
|
12
|
+
## How to use this skill
|
|
13
|
+
|
|
14
|
+
- Load together with `antislop.md` whenever the task touches code comments. The core holds the mechanism (the purpose test, the three tiers, the Delivery Gate); this skill holds comment-specific depth.
|
|
15
|
+
- Every entry has the same shape: **Tell** (the pattern), **Why** (why it reads as slop), **Fix** (what to do instead), with the governing core rule cited as R-XX.
|
|
16
|
+
- **Scope guardrail:** this skill only modifies comments. Never modify executable code, identifiers, imports, formatting, indentation, whitespace, control flow, or logic. When in doubt, leave the code untouched.
|
|
17
|
+
- The Delivery Gate in the core remains the gate. The "Code Comment Checklist" at the end of this file is the comment-specific supplement to run alongside it.
|
|
18
|
+
|
|
19
|
+
## Comments That Add Nothing
|
|
20
|
+
|
|
21
|
+
### Decorative Separators
|
|
22
|
+
|
|
23
|
+
- **Tell:** banner comments built from repeated characters, ALL CAPS labels, or box drawing around a section name: `// =======================` around `Authentication`, `// -------- WORKFLOW --------`, or a `/* ---- ROUTES ---- */` header.
|
|
24
|
+
- **Why:** the decoration is the message. A label wrapped in `=` or `-` signals "AI made this" without adding information, and ALL CAPS reads as shouting.
|
|
25
|
+
- **Fix:** replace with a single plain line, or remove entirely if the label adds nothing (R-31).
|
|
26
|
+
|
|
27
|
+
### Restating the Obvious
|
|
28
|
+
|
|
29
|
+
- **Tell:** a comment that repeats what the next line or declaration already shows, like `// Initialize the variable` above `let count = 0`, `// User class` above `class User {}`, `// Validate user` above `function validateUser()`, or `const userAge = 25; // User age is 25`.
|
|
30
|
+
- **Why:** it doubles the reading load without adding anything. The code already says it; the comment just repeats it.
|
|
31
|
+
- **Fix:** remove and leave the line of code alone.
|
|
32
|
+
|
|
33
|
+
### Workflow Narration
|
|
34
|
+
|
|
35
|
+
- **Tell:** comments that narrate the flow step by step, like `// Step 1: Validate input`, `// Step 2: Process request`, `// Step 3: Return response`, or `// First...`, `// Next...`, `// Finally...`.
|
|
36
|
+
- **Why:** the control flow is visible in the code itself. Numbering it reads as a checklist, not an explanation.
|
|
37
|
+
- **Fix:** remove. If the flow is genuinely hard to follow, that is a structure problem, not a missing comment problem.
|
|
38
|
+
|
|
39
|
+
### Empty Labels
|
|
40
|
+
|
|
41
|
+
- **Tell:** generic labels with no information behind them: `// Main logic`, `// Core logic`, `// Business logic`, `// Helper function`, `// Entry point`, `// Error handling`, or `// Note: This is important.` / `// Important: Please read.`
|
|
42
|
+
- **Why:** the label names a category, not a fact. "Main logic" tells the reader nothing they could not infer from the code.
|
|
43
|
+
- **Fix:** remove unless the label carries specific information. "Note: retries happen only on 5xx" earns its place; "Note: this is important" does not.
|
|
44
|
+
|
|
45
|
+
### Vague Placeholders
|
|
46
|
+
|
|
47
|
+
- **Tell:** comments that promise future work without saying what: `// TODO: Improve this`, `// Future improvements`, `// Additional optimization can be added here`, `// Add more validation`.
|
|
48
|
+
- **Why:** a vague TODO is noise. It names a feeling (this could be better) instead of a task (what, and why).
|
|
49
|
+
- **Fix:** remove. Keep a TODO only when it names a specific task with enough context to act on.
|
|
50
|
+
|
|
51
|
+
### Signature Echo
|
|
52
|
+
|
|
53
|
+
- **Tell:** documentation that only restates the signature, like a JSDoc block that repeats `@param price The price.` and `@returns Total price.` for a function whose name and parameters already say all of it.
|
|
54
|
+
- **Why:** docs that echo the signature add length, not understanding. The reader learns nothing new.
|
|
55
|
+
- **Fix:** simplify or remove the echo. Keep documentation that explains business rules, edge cases, assumptions, algorithms, limitations, side effects, API behavior, or security implications. Never strip real documentation.
|
|
56
|
+
|
|
57
|
+
### Decorative Emoji
|
|
58
|
+
|
|
59
|
+
- **Tell:** emoji used as decoration in comments, like `// ✅ Validation` or `// 🚀 Performance`.
|
|
60
|
+
- **Why:** emoji is visual noise in code, and the specific set (✅, 🚀, 🔒) is the AI default vocabulary.
|
|
61
|
+
- **Fix:** replace with plain English, or remove if the label adds nothing.
|
|
62
|
+
|
|
63
|
+
### End Markers
|
|
64
|
+
|
|
65
|
+
- **Tell:** comments that only mark the end of a block, like `} // end if`, `# End of function`, or `// End processOrder`.
|
|
66
|
+
- **Why:** the closing brace already ends the block. The marker exists out of habit, not need.
|
|
67
|
+
- **Fix:** remove. In the rare case an end marker genuinely helps a long file, keep it only where it prevents confusion, not as a habit.
|
|
68
|
+
|
|
69
|
+
## How It Should Read
|
|
70
|
+
|
|
71
|
+
### The Over-Explained Comment
|
|
72
|
+
|
|
73
|
+
- **Tell:** one comment that runs on for several lines, stacking reasons, context, and history around a fact that fits in one line: a four-line block explaining that a stub sits on PATH, which release introduced the workaround, and what broke before it. Every sentence is true. The length is the tell.
|
|
74
|
+
- **Why:** a person leaves a note, a generator writes a case. Padding a one-line fact into a paragraph, building a "because X, so Y, and therefore Z" chain, or citing the issue number and the version that fixed it are the same flourish as any other AI pattern, and they bury the one line that matters under the ones that do not.
|
|
75
|
+
- **Fix:** cut to the constraint alone: one line, two at most, never three. Keep the platform trap, the silent failure, the protocol rule, the performance cost. Drop the issue number, the version history, and the reasoning chain.
|
|
76
|
+
|
|
77
|
+
### Line-by-Line Narration
|
|
78
|
+
|
|
79
|
+
- **Tell:** a comment on every trivial statement, narrating each line as it is written: `// Initialize count`, then `// Loop items`, then `// Get item`, then `// Increment`, then `// Return result`.
|
|
80
|
+
- **Why:** when every line is commented, none of the comments matter. The reader has to check each one to find the one that carries meaning.
|
|
81
|
+
- **Fix:** write one concise comment per logical block instead of one per line. If the block needs no comment, write none.
|
|
82
|
+
|
|
83
|
+
### Stiff or Loud Wording
|
|
84
|
+
|
|
85
|
+
- **Tell:** comments that sound formal, long, or shout: "This function is responsible for validating whether the supplied credentials are valid before continuing with the authentication process", or `// MAIN LOGIC` in caps.
|
|
86
|
+
- **Why:** formal and loud wording reads as generated, not as an engineer leaving a note for the next person.
|
|
87
|
+
- **Fix:** write short, sentence-case lines in a natural developer voice: `// Validate credentials before issuing a token.` Good comments explain why, not what, and they stay short.
|
|
88
|
+
|
|
89
|
+
## Not a Ban (preserve these)
|
|
90
|
+
|
|
91
|
+
Never remove comments that explain:
|
|
92
|
+
|
|
93
|
+
- business logic and intent
|
|
94
|
+
- architectural decisions
|
|
95
|
+
- security considerations
|
|
96
|
+
- performance trade-offs
|
|
97
|
+
- concurrency behavior
|
|
98
|
+
- protocol details
|
|
99
|
+
- API contracts
|
|
100
|
+
- workarounds
|
|
101
|
+
- edge cases and assumptions
|
|
102
|
+
- licensing and legal notices
|
|
103
|
+
|
|
104
|
+
Example that must stay:
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
// Stripe may retry webhook deliveries for up to three days.
|
|
108
|
+
// Ignore duplicate events using the event ID.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
A comment earns its place when it explains something the code does not already show: the reason, the constraint, the non-obvious behavior.
|
|
112
|
+
|
|
113
|
+
Earning a place says what may stay, never how long it may run. A workaround note is one line about the workaround, not a paragraph about it. The example above is two lines because two facts are real, not because two lines is a target. This list is the most common reason a comment survives a review it should not: the content is legitimately valuable, so the length goes unexamined. Value is not length.
|
|
114
|
+
|
|
115
|
+
## Code Comment Checklist
|
|
116
|
+
|
|
117
|
+
Run these alongside the core Delivery Gate when the task touches comments. All answers must be **yes**:
|
|
118
|
+
|
|
119
|
+
- [ ] Does every comment add information the code does not already show? (R-31)
|
|
120
|
+
- [ ] Do the comments avoid decorative separators, ALL CAPS banners, and box-drawn headers?
|
|
121
|
+
- [ ] Do the comments avoid restating the obvious line, declaration, or signature?
|
|
122
|
+
- [ ] Do the comments avoid step-by-step workflow narration?
|
|
123
|
+
- [ ] Do the comments avoid empty labels and vague TODOs that name no task?
|
|
124
|
+
- [ ] Do the comments avoid decorative emoji and end markers?
|
|
125
|
+
- [ ] Is the comment density one per logical block, not one per line?
|
|
126
|
+
- [ ] Is every comment one line, or two only when the second carries a new fact?
|
|
127
|
+
- [ ] Do the remaining comments read short, natural, and in sentence case?
|
|
128
|
+
- [ ] Is the scope guardrail held: only comments changed, the code untouched?
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Addy Osmani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: antislop-human
|
|
3
|
+
description: "Load for accessibility and focus. Contrast, keyboard, focus, and states. Load with antislop."
|
|
4
|
+
allowed-tools: Bash(python *), Bash(python3 *), Read, Write, Edit, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
# antislop-human
|
|
7
|
+
|
|
8
|
+
> Anti Slop: Rules for AI Coding Agents. Human skill
|
|
9
|
+
|
|
10
|
+
> Part of the antislop system. Read together with `antislop.md` (the core). This skill deep-dives the human concern: the UI must stay usable by people with different eyes, hands, and setups. Contrast, keyboard, focus, states, and the mobile details that exclude people.
|
|
11
|
+
|
|
12
|
+
## How to use this skill
|
|
13
|
+
|
|
14
|
+
- Load together with `antislop.md` whenever the task builds or edits UI. The core holds the mechanism (the purpose test, the three tiers, the Delivery Gate); this skill holds the human-side depth: the parts of a UI that exclude people with different eyes, hands, and setups.
|
|
15
|
+
- Every entry has the same shape: **Tell** (the pattern), **Why** (who it excludes, and why it reads as unfinished), **Fix** (what to do instead), with the governing core rule cited as R-XX.
|
|
16
|
+
- Accessibility is not a checklist of extras bolted on at the end. It is part of the core promise that "the UI holds up" (C-4). The Delivery Gate in the core remains the gate; the "Human Skill Checklist" at the end of this file is the supplement to run alongside it.
|
|
17
|
+
- The contrast checker (formula + reference table + script) lives in this skill. Use it for every color pairing you cannot verify by eye.
|
|
18
|
+
- This skill keeps only the mobile details that exclude people: zooming, and the on-screen keyboard.
|
|
19
|
+
|
|
20
|
+
## Color & Contrast
|
|
21
|
+
|
|
22
|
+
### Low-Contrast Text
|
|
23
|
+
|
|
24
|
+
- **Tell:** light grey text on a white or near-white background, thin body text, muted labels chosen because they look "elegant" but are hard to read.
|
|
25
|
+
- **Why:** it excludes low-vision users and everyone in bright light. It is a visual choice made without checking the standard, which is exactly the kind of default the filter exists to catch.
|
|
26
|
+
- **Fix:** meet WCAG AA minimums (R-25): 4.5:1 for normal text, 3:1 for large text (18px+). Compute the ratio; do not eyeball it.
|
|
27
|
+
|
|
28
|
+
### Text Over a Photo or Gradient
|
|
29
|
+
|
|
30
|
+
- **Tell:** white text placed directly over an image or gradient that is light in some areas, checked at one bright spot only.
|
|
31
|
+
- **Why:** contrast is local. Where the image is light, the text drops below 4.5:1 even if the hero still "looks" fine. R-25 requires testing the whole area the text passes over, not a single point.
|
|
32
|
+
- **Fix:** add a scrim or a solid color block behind the text, then verify the worst spot, not the best. If any part of the text area fails, the treatment fails.
|
|
33
|
+
|
|
34
|
+
### The Grey-on-Grey Hallucination
|
|
35
|
+
|
|
36
|
+
- **Tell:** "dark grey on black" or "light grey on white" claimed to pass AA without a computation.
|
|
37
|
+
- **Why:** this is the most common accessibility hallucination. The eye overestimates contrast on grey pairs, and agents repeat the claim because it sounds plausible. #555555 on black is 2.8:1. It fails.
|
|
38
|
+
- **Fix:** never assert a pairing passes. Run the contrast checker (below) or apply the formula. When neither is possible, use the reference table.
|
|
39
|
+
|
|
40
|
+
### Non-Text Contrast
|
|
41
|
+
|
|
42
|
+
- **Tell:** interactive components (buttons, icons, input borders, focus indicators, chart segments) distinguished from their background by less than 3:1.
|
|
43
|
+
- **Why:** non-text UI carries information by shape and edge. When the edge is a hair of tint, low-vision users cannot find the control. The same bar applies to states like hover and selected.
|
|
44
|
+
- **Fix:** give every component boundary and every status indicator a 3:1 ratio against adjacent colors (WCAG 1.4.11). Pair icons with a text label that meets 4.5:1.
|
|
45
|
+
|
|
46
|
+
### The Contrast Checker
|
|
47
|
+
|
|
48
|
+
The home of the contrast checker. Three layers, from most to least convenient:
|
|
49
|
+
|
|
50
|
+
**The script.** When a script runtime is available and the file is present, run it instead of computing by hand. The script ships in this skill's folder (`contrast-check.py`, next to this `SKILL.md`). Run it with `python3` on macOS and Linux, `python` on Windows:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python3 "${CLAUDE_SKILL_DIR}/contrast-check.py" "#FFFFFF" "#777777"
|
|
54
|
+
# normal text: FAIL (4.48 < 4.5)
|
|
55
|
+
# large text: PASS (4.48 >= 3.0)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If the `${CLAUDE_SKILL_DIR}` variable is not available in this agent, point the script path at this skill's folder directly. The script exists so agents stop hallucinating AA. It takes two hex colors and prints the ratio and the verdict for both text sizes. If the file is missing, the formula and table below are complete on their own. Never block on the script.
|
|
59
|
+
|
|
60
|
+
**The formula (WCAG 2.x).**
|
|
61
|
+
|
|
62
|
+
1. Contrast ratio = (L1 + 0.05) / (L2 + 0.05), where L1 is the lighter relative luminance and L2 the darker.
|
|
63
|
+
2. Relative luminance L of one color: convert each channel to 0-1 (`c = hex / 255`), then linearize: if `c <= 0.03928`, `c_lin = c / 12.92`; otherwise `c_lin = ((c + 0.055) / 1.055)^2.4`.
|
|
64
|
+
3. `L = 0.2126*R + 0.7152*G + 0.0722*B`.
|
|
65
|
+
4. Compare the unrounded ratio: 4.5:1 for normal text, 3:1 for large text (18px+, per R-25). Round only for display, so a pairing at 4.498:1 prints as 4.50 and still fails 4.5:1. The maximum ratio is 21.0 (black on white).
|
|
66
|
+
|
|
67
|
+
**The reference table** (common pairings, computed with the formula):
|
|
68
|
+
|
|
69
|
+
| Pairing (text on background) | Ratio | Normal text (4.5) | Large text (3.0) |
|
|
70
|
+
|------------------------------|-------|-------------------|------------------|
|
|
71
|
+
| Black on white | 21.00 | Pass | Pass |
|
|
72
|
+
| White on black | 21.00 | Pass | Pass |
|
|
73
|
+
| White on #333333 | 12.63 | Pass | Pass |
|
|
74
|
+
| White on #666666 | 5.74 | Pass | Pass |
|
|
75
|
+
| #777777 on white | 4.48 | Fail | Pass |
|
|
76
|
+
| #777777 on #070707 | 4.50 | Fail | Pass |
|
|
77
|
+
| White on #888888 | 3.54 | Fail | Pass |
|
|
78
|
+
| White on #999999 | 2.85 | Fail | Fail |
|
|
79
|
+
| #555555 on black | 2.82 | Fail | Fail |
|
|
80
|
+
|
|
81
|
+
The `#777777 on #070707` row is the near-threshold case: 4.4983:1 rounds to 4.50 for display and still fails 4.5:1.
|
|
82
|
+
|
|
83
|
+
Read the table as a sanity check, not as a substitute. Any pairing not listed, or anything near a threshold, goes through the formula or the script.
|
|
84
|
+
|
|
85
|
+
## Keyboard
|
|
86
|
+
|
|
87
|
+
### Removed Focus Outline
|
|
88
|
+
|
|
89
|
+
- **Tell:** `outline: none` or `outline: 0` with no replacement focus style.
|
|
90
|
+
- **Why:** keyboard users cannot see where they are. It is the fastest way to make a UI unusable without a mouse, and R-32 forbids it outright.
|
|
91
|
+
- **Fix:** keep or replace the outline with a visible `:focus-visible` style that meets the same contrast bar (3:1 against its neighbors). Never set `outline: none` without a replacement.
|
|
92
|
+
|
|
93
|
+
### Mouse-Only Patterns
|
|
94
|
+
|
|
95
|
+
- **Tell:** menus that open on hover only, dropdowns that click-open but do not keyboard-open, drag-and-drop with no keyboard fallback.
|
|
96
|
+
- **Why:** each one excludes keyboard and assistive-technology users (R-32). If a control cannot be reached and operated by Tab, Enter, or Space, it does not exist for a whole group of people.
|
|
97
|
+
- **Fix:** every interactive element is reachable and operable by keyboard (R-32): logical tab order following visual order, activation with Enter or Space, and dialogs closable with Escape (R-26).
|
|
98
|
+
|
|
99
|
+
### Broken Tab Order
|
|
100
|
+
|
|
101
|
+
- **Tell:** focus jumps around the page, skips content, or lands on hidden elements because the DOM order does not match the visual order.
|
|
102
|
+
- **Why:** tab order that reads the code order instead of the visual order makes navigation unpredictable (R-32). Users lose their place and the page feels broken.
|
|
103
|
+
- **Fix:** keep the source order matching the visual order, add skip links for long pages, and never give real content `tabindex="-1"` unless it is part of a controlled focus trap such as a dialog.
|
|
104
|
+
|
|
105
|
+
## Focus & States
|
|
106
|
+
|
|
107
|
+
### Weak or Invisible Focus Indicator
|
|
108
|
+
|
|
109
|
+
- **Tell:** a focus ring the same color as the background, a ring that only appears on hover, or an indicator thinner than a 1px border.
|
|
110
|
+
- **Why:** the focus indicator is how keyboard users know where they are. If it fails the contrast bar or only shows on hover, keyboard-only use breaks (R-32, R-34).
|
|
111
|
+
- **Fix:** a visible focus indicator on every interactive element, 3:1 against adjacent colors, in every theme you ship. Check it in dark and light mode.
|
|
112
|
+
|
|
113
|
+
### Color-Only Feedback
|
|
114
|
+
|
|
115
|
+
- **Tell:** success, error, and status communicated only by color: red error text, green success border, a tinted chip, with no icon, label, or text.
|
|
116
|
+
- **Why:** it excludes color-blind and low-vision users, and it disappears entirely in forced-colors mode. A status that depends on seeing hue is not a status (C-4).
|
|
117
|
+
- **Fix:** pair every color signal with text, an icon, or a pattern. Error states are text first: "Password must be at least 8 characters", not just a red border.
|
|
118
|
+
|
|
119
|
+
### Missing UI States
|
|
120
|
+
|
|
121
|
+
- **Tell:** a data view with no empty, loading, or error state, or states that exist but are invisible: a spinner with no text, an empty screen with no explanation.
|
|
122
|
+
- **Why:** R-27 requires the three states; the accessibility angle is that each must be perceivable and informative, not decorative. A loading spinner with no context reads as a frozen page to screen-reader users.
|
|
123
|
+
- **Fix:** every data view has all three states (R-27), each announced or visible: an explicit empty message, a loading state with text, and an error state that says what happened and how to proceed.
|
|
124
|
+
|
|
125
|
+
## Zoom & Mobile Use
|
|
126
|
+
|
|
127
|
+
The layout mechanics behind mobile (breakpoints, scale, grids, overflow, tap targets) are the concern of `antislop-layoutmobile`. This section keeps only the mobile details that exclude people: zooming, and the on-screen keyboard.
|
|
128
|
+
|
|
129
|
+
### Text That Cannot Zoom
|
|
130
|
+
|
|
131
|
+
- **Tell:** fixed pixel font sizes, or containers with `overflow: hidden` that clip text at 200% zoom.
|
|
132
|
+
- **Why:** users must be able to resize text (WCAG 1.4.4). If zooming to 200% clips the content or forces horizontal scroll, the text is not resizable in practice.
|
|
133
|
+
- **Fix:** fluid type that reflows with zoom, no clipping containers on text, and verify the layout holds at 200% zoom on a narrow viewport (R-35).
|
|
134
|
+
|
|
135
|
+
### Mobile Keyboard Covers the Form
|
|
136
|
+
|
|
137
|
+
- **Tell:** inputs at the bottom of the viewport hidden behind the on-screen keyboard, with no scroll-into-view and no room for the input.
|
|
138
|
+
- **Why:** a form the user cannot see or reach is a form they cannot complete. It is a mobile-only exclusion (R-03).
|
|
139
|
+
- **Fix:** when an input is focused, it scrolls into view above the keyboard, with enough bottom padding that the focused field is never covered. Test with a real device or an emulated keyboard.
|
|
140
|
+
|
|
141
|
+
## Interaction Affordances
|
|
142
|
+
|
|
143
|
+
Enforced by R-39: the small signals that tell a person "this can be used". Keyboard and focus stay with R-32, target size with R-03.
|
|
144
|
+
|
|
145
|
+
### Clickable Without a Pointer Cursor
|
|
146
|
+
|
|
147
|
+
- **Tell:** a `<button>`, a `<summary>`, a `<label>` for a checkbox, a custom `[role="button"]`, a clickable card, or a styled `<select>` that keeps the arrow cursor. Common after a CSS reset (Tailwind preflight resets `button` to `cursor: default`).
|
|
148
|
+
- **Why:** the cursor is the first affordance a mouse user reads. An arrow over a control says "this is text", so people hesitate or never click. It reads as a template that was styled but never used.
|
|
149
|
+
- **Fix:** every enabled interactive element gets `cursor: pointer`, set once in the base layer, not per component; disabled controls get `cursor: not-allowed`. Never put `cursor: pointer` on something that does nothing (R-26). The base-layer selector list is in [references/A11Y-PATTERNS.md](references/A11Y-PATTERNS.md).
|
|
150
|
+
|
|
151
|
+
### Div or Span Pretending to Be a Control
|
|
152
|
+
|
|
153
|
+
- **Tell:** `<div onClick>`, `<span onClick>`, or `<a>` without `href` used as a button; `<a href="#" onClick>` used for an action.
|
|
154
|
+
- **Why:** it has no role, so a screen reader does not announce it as a control, and it drops out of keyboard use.
|
|
155
|
+
- **Fix:** an action is a `<button type="button">`, a navigation is an `<a href>` to a real destination. A custom control that cannot be native gets a `role`, its state attributes (`aria-pressed`, `aria-expanded`), and full keyboard support (R-32).
|
|
156
|
+
|
|
157
|
+
### Icon-Only Control With No Name
|
|
158
|
+
|
|
159
|
+
- **Tell:** a close, menu, search, or social button that contains only an SVG or icon font, with no text, `aria-label`, or visually hidden label.
|
|
160
|
+
- **Why:** a screen reader announces "button" and nothing else. Voice-control users cannot say its name.
|
|
161
|
+
- **Fix:** give it an accessible name (`aria-label="Close dialog"` or a `.sr-only` span) that matches the visible word, and mark the icon `aria-hidden="true"`.
|
|
162
|
+
|
|
163
|
+
### No Hover, Active, or Disabled State
|
|
164
|
+
|
|
165
|
+
- **Tell:** buttons and links that look identical at rest, on hover, while pressed, and when disabled; a disabled button that is only greyed out and still clickable.
|
|
166
|
+
- **Why:** state feedback tells people their action registered. Without it a click feels lost and a disabled control looks broken.
|
|
167
|
+
- **Fix:** distinct `:hover`, `:active`, and disabled styles, held to the Non-Text Contrast bar above. Prefer the `disabled` attribute; a disabled control that must stay focusable uses `aria-disabled="true"` and blocks the action in code.
|
|
168
|
+
|
|
169
|
+
### Motion That Ignores the User Setting
|
|
170
|
+
|
|
171
|
+
- **Tell:** parallax, auto-playing carousels, scroll-jacking, or large entrance animations that still run under `prefers-reduced-motion: reduce`.
|
|
172
|
+
- **Why:** motion can trigger nausea and vestibular disorders, and an auto-advancing carousel moves content away from slow readers.
|
|
173
|
+
- **Fix:** wrap non-essential motion in `@media (prefers-reduced-motion: no-preference)`, and give anything that moves for more than 5 seconds a visible pause control.
|
|
174
|
+
|
|
175
|
+
### Form Field Without a Real Label
|
|
176
|
+
|
|
177
|
+
- **Tell:** a placeholder as the only label, or a label not tied to its input.
|
|
178
|
+
- **Why:** the placeholder disappears on typing, and an unlabeled input is announced as "edit text".
|
|
179
|
+
- **Fix:** a visible `<label for>` on every field. Error text follows Color-Only Feedback above.
|
|
180
|
+
|
|
181
|
+
### Missing Page-Level Semantics (whole documents only)
|
|
182
|
+
|
|
183
|
+
- **Tell:** a page with no `lang` on `<html>`, no `<main>`, headings chosen for size instead of order, or a generic `<title>`.
|
|
184
|
+
- **Why:** screen-reader users move by landmarks, headings, and the title; without them the page is one undifferentiated stream, read in the wrong voice.
|
|
185
|
+
- **Fix:** applies only when the task produces a whole document, never to a single component: `<html lang>`, one `<main>` with `<header>`/`<nav>`/`<footer>`, one `<h1>` and no skipped levels, and a unique `<title>`. Skip links are under Broken Tab Order (R-32).
|
|
186
|
+
|
|
187
|
+
## WCAG 2.2 Depth
|
|
188
|
+
|
|
189
|
+
Read on demand, instead of guessing a success criterion:
|
|
190
|
+
|
|
191
|
+
- [references/A11Y-PATTERNS.md](references/A11Y-PATTERNS.md): copy-ready markup for the pointer-cursor base layer, modal focus traps, skip links, form labels, error announcement, dragging alternatives, ARIA tabs, and live regions.
|
|
192
|
+
- [references/WCAG.md](references/WCAG.md): every WCAG 2.2 success criterion by level, for checking a conformance claim. A Lighthouse score alone never proves conformance (R-36).
|
|
193
|
+
|
|
194
|
+
## Human Skill Checklist
|
|
195
|
+
|
|
196
|
+
Run these alongside the core Delivery Gate when the task involves UI. All answers must be **yes**:
|
|
197
|
+
|
|
198
|
+
- [ ] Is every text and background pairing verified against the contrast checker (formula, table, or script), including text over images and gradients? (R-25)
|
|
199
|
+
- [ ] Does every interactive component boundary and status indicator meet 3:1 against its background? (non-text contrast)
|
|
200
|
+
- [ ] Is the focus indicator visible, high-contrast, and present on every interactive element in every theme? (R-32, R-34)
|
|
201
|
+
- [ ] Is every interactive element reachable and operable by keyboard, with dialogs closable via Escape and no `outline: none` without a replacement? (R-32, R-26)
|
|
202
|
+
- [ ] Are the empty, loading, and error states of every data view present and perceivable, not color-only? (R-27, C-4)
|
|
203
|
+
- [ ] Can text be resized to 200% without being clipped, and does the mobile keyboard never cover a focused input? (R-35)
|
|
204
|
+
- [ ] Does every enabled control show `cursor: pointer`, use a native element, carry an accessible name and a visible label, and respect `prefers-reduced-motion`? (R-39)
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""WCAG 2.x contrast checker, home of the antislop-human contrast checker.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python3 contrast-check.py "#FFFFFF" "#777777"
|
|
6
|
+
python3 contrast-check.py FFFFFF 777777
|
|
7
|
+
python3 contrast-check.py --selftest
|
|
8
|
+
|
|
9
|
+
Prints the contrast ratio and a PASS/FAIL verdict for normal text (4.5:1)
|
|
10
|
+
and large text (3:1, 18px+ per antislop R-25). Exit code 0 only when both
|
|
11
|
+
verdicts pass, so scripts can chain on it.
|
|
12
|
+
|
|
13
|
+
--selftest parses the reference table out of the SKILL.md next to this script
|
|
14
|
+
(the skill doc is the source of truth, not a list copied into this script) and
|
|
15
|
+
recomputes every row with the formula, checking the ratio and both verdicts.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
import re
|
|
20
|
+
import sys
|
|
21
|
+
|
|
22
|
+
REFERENCE_HEADER = "| Pairing (text on background) | Ratio | Normal text (4.5) | Large text (3.0) |"
|
|
23
|
+
NAMED_COLORS = {"black": (0, 0, 0), "white": (255, 255, 255)}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def parse_hex(value):
|
|
27
|
+
value = value.strip().lstrip("#")
|
|
28
|
+
if len(value) == 3:
|
|
29
|
+
value = "".join(ch * 2 for ch in value)
|
|
30
|
+
if not re.fullmatch(r"[0-9A-Fa-f]{6}", value):
|
|
31
|
+
raise ValueError(f"expected a hex color like #FFFFFF, got {value!r}")
|
|
32
|
+
return tuple(int(value[i:i + 2], 16) for i in (0, 2, 4))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def parse_pairing(pairing):
|
|
36
|
+
"""Turn 'White on #333333' or '#555555 on black' into two RGB tuples."""
|
|
37
|
+
colors = []
|
|
38
|
+
for token in re.split(r"\s+on\s+", pairing):
|
|
39
|
+
token = token.strip()
|
|
40
|
+
match = re.search(r"#[0-9A-Fa-f]{3,6}", token)
|
|
41
|
+
if match:
|
|
42
|
+
colors.append(parse_hex(match.group(0)))
|
|
43
|
+
elif token.lower() in NAMED_COLORS:
|
|
44
|
+
colors.append(NAMED_COLORS[token.lower()])
|
|
45
|
+
else:
|
|
46
|
+
raise ValueError(f"cannot parse {token!r} from pairing {pairing!r}")
|
|
47
|
+
if len(colors) != 2:
|
|
48
|
+
raise ValueError(f"expected two colors in pairing {pairing!r}")
|
|
49
|
+
return tuple(colors)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def linearize(channel):
|
|
53
|
+
c = channel / 255.0
|
|
54
|
+
if c <= 0.03928:
|
|
55
|
+
return c / 12.92
|
|
56
|
+
return ((c + 0.055) / 1.055) ** 2.4
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def luminance(rgb):
|
|
60
|
+
r, g, b = (linearize(ch) for ch in rgb)
|
|
61
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def contrast_ratio(color_a, color_b):
|
|
65
|
+
lum_a, lum_b = luminance(color_a), luminance(color_b)
|
|
66
|
+
lighter, darker = sorted((lum_a, lum_b), reverse=True)
|
|
67
|
+
return (lighter + 0.05) / (darker + 0.05)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def reference_doc_path():
|
|
71
|
+
here = os.path.dirname(os.path.abspath(__file__))
|
|
72
|
+
candidate = os.path.join(here, "SKILL.md")
|
|
73
|
+
return candidate if os.path.isfile(candidate) else None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def parse_reference_rows(path):
|
|
77
|
+
"""Reference table rows from SKILL.md, with the ratio already a float.
|
|
78
|
+
|
|
79
|
+
A row that does not split into four cells is dropped silently, not raised.
|
|
80
|
+
"""
|
|
81
|
+
rows = []
|
|
82
|
+
with open(path, encoding="utf-8") as handle:
|
|
83
|
+
in_table = False
|
|
84
|
+
for raw in handle:
|
|
85
|
+
line = raw.rstrip("\n")
|
|
86
|
+
if line.startswith(REFERENCE_HEADER):
|
|
87
|
+
in_table = True
|
|
88
|
+
continue
|
|
89
|
+
if not in_table:
|
|
90
|
+
continue
|
|
91
|
+
if not line.startswith("|"):
|
|
92
|
+
break
|
|
93
|
+
if line.startswith("|---"):
|
|
94
|
+
continue
|
|
95
|
+
cells = [cell.strip() for cell in line.strip().strip("|").split("|")]
|
|
96
|
+
if len(cells) != 4:
|
|
97
|
+
continue
|
|
98
|
+
pairing, ratio, normal, large = cells
|
|
99
|
+
rows.append({
|
|
100
|
+
"pairing": pairing,
|
|
101
|
+
"ratio": float(ratio),
|
|
102
|
+
"normal": normal,
|
|
103
|
+
"large": large,
|
|
104
|
+
})
|
|
105
|
+
return rows
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def selftest():
|
|
109
|
+
doc = reference_doc_path()
|
|
110
|
+
if doc is None:
|
|
111
|
+
print("selftest: SKILL.md not found next to the script; cannot check the table")
|
|
112
|
+
return 2
|
|
113
|
+
try:
|
|
114
|
+
rows = parse_reference_rows(doc)
|
|
115
|
+
except (OSError, ValueError) as exc:
|
|
116
|
+
print(f"selftest: could not read the table from SKILL.md: {exc}")
|
|
117
|
+
return 1
|
|
118
|
+
if not rows:
|
|
119
|
+
print("selftest: no reference rows found in SKILL.md")
|
|
120
|
+
return 1
|
|
121
|
+
|
|
122
|
+
failures = 0
|
|
123
|
+
for row in rows:
|
|
124
|
+
color_a, color_b = parse_pairing(row["pairing"])
|
|
125
|
+
# The verdicts read the unrounded ratio, exactly as main() does. Rounding first
|
|
126
|
+
# turns a 4.498:1 pairing into a displayed 4.50 that would pass 4.5:1 on paper.
|
|
127
|
+
raw = contrast_ratio(color_a, color_b)
|
|
128
|
+
computed = round(raw, 2)
|
|
129
|
+
expected_normal = "Pass" if raw >= 4.5 else "Fail"
|
|
130
|
+
expected_large = "Pass" if raw >= 3.0 else "Fail"
|
|
131
|
+
if f"{computed:.2f}" != f"{row['ratio']:.2f}":
|
|
132
|
+
failures += 1
|
|
133
|
+
print(f"selftest: {row['pairing']}: table says {row['ratio']}, the formula says {computed:.2f}")
|
|
134
|
+
if row["normal"] != expected_normal:
|
|
135
|
+
failures += 1
|
|
136
|
+
print(f"selftest: {row['pairing']}: normal text marked {row['normal']}, should be {expected_normal}")
|
|
137
|
+
if row["large"] != expected_large:
|
|
138
|
+
failures += 1
|
|
139
|
+
print(f"selftest: {row['pairing']}: large text marked {row['large']}, should be {expected_large}")
|
|
140
|
+
|
|
141
|
+
if failures:
|
|
142
|
+
return 1
|
|
143
|
+
print(f"selftest: {len(rows)} reference pairs OK")
|
|
144
|
+
return 0
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def main(argv):
|
|
148
|
+
if len(argv) == 1 and argv[0] == "--selftest":
|
|
149
|
+
return selftest()
|
|
150
|
+
if len(argv) != 2:
|
|
151
|
+
print("usage: python3 contrast-check.py <hex1> <hex2> | --selftest")
|
|
152
|
+
return 2
|
|
153
|
+
try:
|
|
154
|
+
ratio = contrast_ratio(parse_hex(argv[0]), parse_hex(argv[1]))
|
|
155
|
+
except ValueError as exc:
|
|
156
|
+
print(f"error: {exc}")
|
|
157
|
+
return 2
|
|
158
|
+
|
|
159
|
+
normal = ratio >= 4.5
|
|
160
|
+
large = ratio >= 3.0
|
|
161
|
+
print(f"ratio: {ratio:.2f}:1")
|
|
162
|
+
print(f"normal text (4.5:1): {'PASS' if normal else 'FAIL'}")
|
|
163
|
+
print(f"large text (3.0:1): {'PASS' if large else 'FAIL'}")
|
|
164
|
+
return 0 if normal and large else 1
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if __name__ == "__main__":
|
|
168
|
+
sys.exit(main(sys.argv[1:]))
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Minimal MCP stdio server exposing the antislop contrast checker as a tool.
|
|
3
|
+
|
|
4
|
+
All logging goes to stderr; stdout is reserved for JSON-RPC responses.
|
|
5
|
+
"""
|
|
6
|
+
import json
|
|
7
|
+
import re
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
PROTOCOL_VERSION = "2024-11-05"
|
|
11
|
+
SERVER_NAME = "antislop-contrast"
|
|
12
|
+
SERVER_VERSION = "3.2.32"
|
|
13
|
+
|
|
14
|
+
TOOLS = [
|
|
15
|
+
{
|
|
16
|
+
"name": "check_contrast",
|
|
17
|
+
"description": "Compute the WCAG contrast ratio between two hex colors and the pass or fail verdict for normal and large text. Use this instead of guessing whether a color pairing meets AA.",
|
|
18
|
+
"inputSchema": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"foreground": {"type": "string", "description": "Hex color of the text, for example #777777"},
|
|
22
|
+
"background": {"type": "string", "description": "Hex color of the background, for example #FFFFFF"},
|
|
23
|
+
},
|
|
24
|
+
"required": ["foreground", "background"],
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _channel(c):
|
|
31
|
+
c = c / 255.0
|
|
32
|
+
return c / 12.92 if c <= 0.03928 else ((c + 0.055) / 1.055) ** 2.4
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def relative_luminance(hex_color):
|
|
36
|
+
h = hex_color.strip().lstrip("#")
|
|
37
|
+
if len(h) == 3:
|
|
38
|
+
h = "".join(ch * 2 for ch in h)
|
|
39
|
+
# Slicing reads any length, so #00000080 would pass as opaque black. Same check as contrast-check.py.
|
|
40
|
+
if not re.fullmatch(r"[0-9A-Fa-f]{6}", h):
|
|
41
|
+
raise ValueError(f"expected a hex color like #FFFFFF, got {hex_color!r}")
|
|
42
|
+
r, g, b = (int(h[i : i + 2], 16) for i in (0, 2, 4))
|
|
43
|
+
return 0.2126 * _channel(r) + 0.7152 * _channel(g) + 0.0722 * _channel(b)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def contrast_ratio(fg, bg):
|
|
47
|
+
"""The unrounded WCAG ratio. Callers decide what to print, never what to compare."""
|
|
48
|
+
l1, l2 = relative_luminance(fg), relative_luminance(bg)
|
|
49
|
+
lighter, darker = max(l1, l2), min(l1, l2)
|
|
50
|
+
return (lighter + 0.05) / (darker + 0.05)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def check_contrast(fg, bg):
|
|
54
|
+
# The threshold is read from the raw ratio: 4.498:1 fails 4.5:1 even though it
|
|
55
|
+
# displays as 4.50 once rounded, and a rounded verdict would report the opposite.
|
|
56
|
+
ratio = contrast_ratio(fg, bg)
|
|
57
|
+
return {
|
|
58
|
+
"foreground": fg,
|
|
59
|
+
"background": bg,
|
|
60
|
+
"ratio": round(ratio, 2),
|
|
61
|
+
"normal_text": {"threshold": 4.5, "pass": ratio >= 4.5},
|
|
62
|
+
"large_text": {"threshold": 3.0, "pass": ratio >= 3.0},
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _send(msg):
|
|
67
|
+
sys.stdout.write(json.dumps(msg) + "\n")
|
|
68
|
+
sys.stdout.flush()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _text(content):
|
|
72
|
+
return {"content": [{"type": "text", "text": content}], "isError": False}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _error(message):
|
|
76
|
+
return {"content": [{"type": "text", "text": message}], "isError": True}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _reply(msg_id, result):
|
|
80
|
+
_send({"jsonrpc": "2.0", "id": msg_id, "result": result})
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def main():
|
|
84
|
+
for line in sys.stdin:
|
|
85
|
+
line = line.strip()
|
|
86
|
+
if not line:
|
|
87
|
+
continue
|
|
88
|
+
try:
|
|
89
|
+
msg = json.loads(line)
|
|
90
|
+
except json.JSONDecodeError:
|
|
91
|
+
continue
|
|
92
|
+
|
|
93
|
+
msg_id = msg.get("id")
|
|
94
|
+
method = msg.get("method")
|
|
95
|
+
|
|
96
|
+
if method == "initialize":
|
|
97
|
+
_reply(msg_id, {
|
|
98
|
+
"protocolVersion": PROTOCOL_VERSION,
|
|
99
|
+
"capabilities": {"tools": {}},
|
|
100
|
+
"serverInfo": {"name": SERVER_NAME, "version": SERVER_VERSION},
|
|
101
|
+
})
|
|
102
|
+
elif method == "notifications/initialized":
|
|
103
|
+
pass
|
|
104
|
+
elif method == "ping":
|
|
105
|
+
_reply(msg_id, {})
|
|
106
|
+
elif method == "tools/list":
|
|
107
|
+
_reply(msg_id, {"tools": TOOLS})
|
|
108
|
+
elif method == "tools/call":
|
|
109
|
+
params = msg.get("params") or {}
|
|
110
|
+
name = params.get("name")
|
|
111
|
+
args = params.get("arguments") or {}
|
|
112
|
+
if name == "check_contrast":
|
|
113
|
+
try:
|
|
114
|
+
result = check_contrast(args["foreground"], args["background"])
|
|
115
|
+
_reply(msg_id, _text(json.dumps(result)))
|
|
116
|
+
except Exception as exc:
|
|
117
|
+
_reply(msg_id, _error("check_contrast failed: " + str(exc)))
|
|
118
|
+
else:
|
|
119
|
+
_reply(msg_id, _error("Unknown tool: " + str(name)))
|
|
120
|
+
elif msg_id is not None:
|
|
121
|
+
_reply(msg_id, {})
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if __name__ == "__main__":
|
|
125
|
+
main()
|