-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add What It Does rule (behaviour scanner for AI-edited code) #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,76 @@ | ||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||
| description: "Check what your edits actually changed about an application's behaviour — endpoints, what they read, write and delete, and whether a guard disappeared — using the what-it-does scanner. Apply when editing routes, server actions, middleware, or the code they reach." | ||||||||||||||||||||||||||
| globs: **/app/**/route.ts, **/app/**/route.js, **/app/**/page.tsx, **/actions.ts, **/actions.js, **/middleware.ts, **/middleware.js, **/functions/**/*.ts, **/functions/**/*.js | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== repo files matching rule name =="
fd -a 'what-it-does\.mdc|what-it-does' . | sed 's#^\./##' || true
echo
echo "== rules/what-it-does.mdc with numbering =="
if [ -f rules/what-it-does.mdc ]; then
cat -n rules/what-it-does.mdc | sed -n '1,120p'
fi
echo
echo "== all .mdc rule files =="
git ls-files '*.mdc' | sed -n '1,80p' || true
echo
echo "== search for globs/alwaysApply in mdc files =="
rg -n "globs:|alwaysApply:" -g '*.mdc' . || trueRepository: PatrickJS/awesome-cursorrules Length of output: 46453 🌐 Web query:
💡 Result: In Cursor, context rules are configured using.mdc (Markdown Cursor) files located in the.cursor/rules/ directory [1][2][3]. These files use YAML frontmatter to control how and when rules are applied through the alwaysApply, description, and globs properties [1][4][5]. Key details regarding context rules and glob patterns: 1. Rule Format: Rules must be stored as.mdc files in the.cursor/rules/ directory [2][5][6]. Plain.md files in this directory are ignored because they lack the necessary frontmatter [1][7][6]. 2. Glob Patterns: The globs field is used to scope a rule to specific files or directories [1][3]. When you define globs, the rule becomes "Auto-Attached," meaning it is automatically included in the AI context when a file matching the pattern is referenced or edited [1][3][7]. 3. Glob Syntax: - * matches any single file name segment [1][6]. - matches any number of directories (recursive) [1][6]. - Patterns are provided as a comma-separated string (e.g., globs: src//.ts, src//.tsx) [1][7]. - You can use the! prefix to exclude specific patterns [4]. 4. Application Logic: - Always Apply: If alwaysApply is set to true, the rule is included in every conversation, ignoring globs and descriptions [1][7][5]. - Auto-Attached: If alwaysApply is false and globs are provided, the rule triggers when matching files are in the AI context [1][7][5]. - Agent-Requested: If alwaysApply is false, globs are omitted, and a description is provided, the AI agent pulls in the rule when it determines the rule is relevant to the current conversation [1][7][5]. - Manual: If none of the above are set, the rule is only included if you Citations:
🌐 Web query:
💡 Result: There is no standard CLI tool named "what-it-does" in the Next.js ecosystem. It is likely that this name refers to either a generic placeholder for "what a CLI does" or is a misidentification of other tools. If you are looking for information on how the official Next.js CLI handles entry points and routing files, here is a summary of how Next.js operates: Next.js CLI Entry Points The official Next.js CLI ( Citations:
🌐 Web query:
💡 Result: In Next.js 16 (released October 2025), the Citations:
Broaden or qualify the auto-attachment scope. Since 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| alwaysApply: false | ||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Checking what you changed with what-it-does | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| `what-it-does` is an MIT-licensed CLI that reads a Next.js App Router or | ||||||||||||||||||||||||||
| Cloudflare Pages Functions project without executing it and reports its entry | ||||||||||||||||||||||||||
| points — pages, endpoints, form actions — with the effects of each: the tables | ||||||||||||||||||||||||||
| it reads, writes or deletes from, payment calls, outbound email. It runs | ||||||||||||||||||||||||||
| locally and makes no network calls. On an unsupported framework it says so | ||||||||||||||||||||||||||
| rather than guessing. | ||||||||||||||||||||||||||
|
Comment on lines
+9
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
curl -fsSL 'https://raw.githubusercontent.com/rolfe099-sketch/what-it-does/main/README.md' |
rg -n -C 2 'not on this list|warn|unsupported'Repository: PatrickJS/awesome-cursorrules Length of output: 397 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== rules/what-it-does.mdc lines 1-40 =="
sed -n '1,40p' rules/what-it-does.mdc
echo
echo "== README upstream broader context =="
curl -fsSL 'https://raw.githubusercontent.com/rolfe099-sketch/what-it-does/main/README.md' | sed -n '85,105p'Repository: PatrickJS/awesome-cursorrules Length of output: 2840 Correct the unsupported-framework limitation.
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## When to use it | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| A code diff shows which lines moved. It does not show that an endpoint stopped | ||||||||||||||||||||||||||
| checking who was asking, or that the last writer to a table is gone and the | ||||||||||||||||||||||||||
| table will now go stale. Those are behaviour changes that survive review | ||||||||||||||||||||||||||
| because nothing in the diff looks alarming — so compare behaviour before and | ||||||||||||||||||||||||||
| after any edit to server-side code. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## The loop | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Before editing server-side code, record the current behaviour: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| npx what-it-does --json > .what-it-does/before.json | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| After the edits are complete, compare and read the result: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| npx what-it-does --json > .what-it-does/after.json | ||||||||||||||||||||||||||
|
Comment on lines
+29
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Create On a clean project, the shell opens Proposed fix+mkdir -p .what-it-does
npx what-it-does --json > .what-it-does/before.json📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| npx what-it-does diff .what-it-does/before.json .what-it-does/after.json | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| The comparison is in behaviour, not in lines: | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
| DELETE /api/projects/[id] | ||||||||||||||||||||||||||
| − No longer: Checks who is asking | ||||||||||||||||||||||||||
| ! 1 new thing worth checking | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Rules for using it | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - **Surface what it flags. Do not silently act on it.** A finding can be a | ||||||||||||||||||||||||||
| false alarm — a guard may live behind an import the scanner could not | ||||||||||||||||||||||||||
| follow — and the report states what would make each one wrong. Tell the | ||||||||||||||||||||||||||
| user what it said and let them decide. | ||||||||||||||||||||||||||
| - **Skip it for changes that cannot alter behaviour**: styling, copy, | ||||||||||||||||||||||||||
| comments, tests, documentation, configuration nothing branches on. Running | ||||||||||||||||||||||||||
| it on a CSS change wastes a step and teaches everyone to ignore the output. | ||||||||||||||||||||||||||
| - **Absence of a finding is not proof.** The scanner reads code without | ||||||||||||||||||||||||||
| executing it, so anything reached through a name chosen at runtime is | ||||||||||||||||||||||||||
| invisible to it. It says so itself rather than implying coverage it does | ||||||||||||||||||||||||||
| not have. | ||||||||||||||||||||||||||
| - Add `.what-it-does/` to `.gitignore`; the snapshots are local scratch. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ## Other commands | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||
| npx what-it-does # scan here, write and open the HTML report | ||||||||||||||||||||||||||
| npx what-it-does ../other-app # scan somewhere else | ||||||||||||||||||||||||||
| npx what-it-does --no-code # omit source excerpts, for a shareable report | ||||||||||||||||||||||||||
| npx what-it-does agent # write this instruction into CLAUDE.md / AGENTS.md | ||||||||||||||||||||||||||
| npx what-it-does diff a.json b.json --fail-on-new # exit 1 on a new finding, for CI | ||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| The report is a single self-contained HTML file: entry points ranked by | ||||||||||||||||||||||||||
| consequence, a walkthrough of each, a dependency map, and a timeline once two | ||||||||||||||||||||||||||
| scans exist. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Source: https://github.com/rolfe099-sketch/what-it-does | ||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Keep the catalog alphabetically ordered.
What It Doesis followed byAnkra CLI, so this addition is not alphabetically placed. MoveWhat It DoesafterWeb App Optimization, or moveAnkra CLIbeforeAI Agent Specialist.🤖 Prompt for AI Agents