Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "make -s -C \"$CLAUDE_PROJECT_DIR\" dresscode-hook",
"timeout": 60
}
]
}
],
"SessionEnd": [
{
"hooks": [
Expand Down
6 changes: 3 additions & 3 deletions .claude/skills/adminer-plugin/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ your output and `exit` — this is how `sql-gemini.php` answers its own AJAX POS

Our own code is PSR-4 `Desktop\` under `app/src/`, native types on properties, `[]` not
`array()`, enums over magic strings. The downloaded catalogue in `available/` is
**excluded** from phpstan and phpcs (`phpstan.neon`, `phpcs.xml`) — so upstream's
**excluded** from phpstan and dresscode (`phpstan.neon`, `dresscode.neon`) — so upstream's
untyped style there is not a signal for code you write. A hook overriding an untyped
adminer method keeps adminer's shape (phpdoc `@param`/`@return`, or a `phpcs:ignore`),
adminer method keeps adminer's shape (phpdoc `@param`/`@return`, or a `// dresscode:ignore`),
because PHP forbids narrowing an inherited signature.

Verify:

```sh
make qa # php lint, phpstan level 6, phpcs, golangci-lint, oxfmt, oxlint, shellcheck
make qa # php lint, phpstan level 6, dresscode, golangci-lint, oxfmt, oxlint, shellcheck
make check # boots the app, constructs every picked plugin, asserts before-login behaviour
make e2e # Behat browser scenarios (needs docker); plugins in features/pgsql/plugins.feature
make debug # run with Safari Web Inspector attached — use this the moment a symptom is visual
Expand Down
2 changes: 1 addition & 1 deletion .docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ make debug # run with Safari's Web Inspector attached
## Checking it

```sh
make qa # php lint, phpstan, phpcs, golangci-lint, oxfmt, oxlint, shellcheck
make qa # php lint, phpstan, dresscode, golangci-lint, oxfmt, oxlint, shellcheck
make verify # adminer checksums + frankenphp's build provenance
make check # boots the app and asserts its behaviour before login
make e2e # Behat scenarios against postgres and mysql (needs docker)
Expand Down
10 changes: 7 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,19 @@ type on every property (`private ?string $file`, not a bare `private $file` on a
stays only for what the native type can't say — an array's shape), `[]` not `array()`, and an
enum for a fixed set of values (`Desktop\Mode` for the light/dark scheme) rather than a magic
string. `make qa` enforces these: phpstan at level 6 for parameter, return and value types,
and phpcs with slevomat (`phpcs.xml`) for the two things phpstan does not judge — native
property declarations and short array syntax. Both run through the bundled frankenphp, no
and dresscode (`dresscode.neon`) for what phpstan does not judge — native
property and constant declarations, short array syntax, tabs, `strict_types`. Both run through the bundled frankenphp, no
separate PHP install. The exceptions are adminer's own downloaded files (excluded) and a
method or property that overrides an untyped one in adminer's base class — those keep
adminer's untyped shape (a phpdoc `@param`/`@return`, or a `phpcs:ignore` on the line),
adminer's untyped shape (a phpdoc `@param`/`@return`, or a `// dresscode:ignore` on the line),
because PHP forbids narrowing an inherited signature. Class files are PSR-4: a PascalCase
filename matching the class, in folders matching the namespace (`Settings\Theme\Theme` →
`src/Settings/Theme/Theme.php`). Only non-class files stay lowercase — the `.latte` templates,
the `css/`/`javascript/` assets, and the two bare entries served by URL.

An agent's `Edit` or `Write` of a PHP file runs dresscode at once (`cli/dresscode-hook.php`, wired in
`.claude/settings.json`): it fixes what the edit broke and hands the agent what is left. A file
written through Bash is not seen, so `make qa` still decides.

Commit messages say why, not what. No Claude or AI attribution anywhere — not in
commits, PR text, comments or docs.
26 changes: 15 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ else
EXE = .exe
endif

.PHONY: help install linux-deps fetch verify qa phpstan phpcs golangci oxc security check check-app e2e e2e-visual e2e-packaged i18n i18n-check mcp-bridge-data bench build run dev editor debug demo down destroy kill-orphans bundle zip dist tarball windows deb logs serve clean checksums
.PHONY: help install linux-deps fetch verify qa phpstan dresscode dresscode-hook golangci oxc security check check-app e2e e2e-visual e2e-packaged i18n i18n-check mcp-bridge-data bench build run dev editor debug demo down destroy kill-orphans bundle zip dist tarball windows deb logs serve clean checksums

.DEFAULT_GOAL := help

Expand Down Expand Up @@ -224,12 +224,16 @@ phpstan: bin/frankenphp$(EXE) app/adminer.php app/vendor $(PHPSTAN_INI)/phpstan.
PHP_INI_SCAN_DIR=$(PHPSTAN_INI) ./bin/frankenphp$(EXE) php-cli app/vendor/phpstan/phpstan/phpstan.phar analyse -c phpstan.neon \
--no-progress --debug --memory-limit=2G

# The conventions phpstan does not judge: every property a native type (a bare @var is not
# enough) and [] over array(). PHPCS with slevomat, run through the frankenphp we already
# download — no separate PHP install. The ruleset (phpcs.xml) holds the rules and excludes
# adminer's own downloaded files, which keep their conventions.
phpcs: app/vendor
./bin/frankenphp$(EXE) php-cli app/vendor/bin/phpcs --standard=phpcs.xml
# The conventions phpstan does not judge, listed in dresscode.neon, which also excludes adminer's
# own downloaded files. --jobs 1 because its workers start through PHP_BINARY, and under
# frankenphp's php-cli that is frankenphp itself, which takes `check` for a command of its own.
dresscode: app/vendor
./bin/frankenphp$(EXE) php-cli app/vendor/bin/dresscode check --jobs 1

# What .claude/settings.json runs after an agent's edit, the edit's JSON on stdin. Silent and with no
# prerequisites: what it prints goes to the agent, and an edit must not start a composer install.
dresscode-hook:
@test -x bin/frankenphp$(EXE) && test -d app/vendor/dresscode || exit 0; ./bin/frankenphp$(EXE) php-cli cli/dresscode-hook.php

# A cache per checkout. The default one is per user and keeps absolute paths, so an agent's
# worktree linted second got the first one's findings at that worktree's paths; once it was
Expand Down Expand Up @@ -328,7 +332,7 @@ qa: bin/frankenphp$(EXE) app/vendor i18n mcp-bridge-data ## Run every static ch
@sh tests/launcher/downloads.sh
@command -v plutil >/dev/null && plutil -lint Info.plist.in lproj/*/Localizable.strings >/dev/null && echo "i18n + plists ok" || echo "i18n ok (plutil skipped, macOS only)"
@$(MAKE) --no-print-directory phpstan
@$(MAKE) --no-print-directory phpcs && echo "phpcs ok"
@$(MAKE) --no-print-directory dresscode
@$(MAKE) --no-print-directory golangci && echo "golangci-lint ok"
@$(MAKE) --no-print-directory oxc && echo "oxfmt + oxlint ok"

Expand Down Expand Up @@ -505,8 +509,8 @@ bundle: build app/vendor $(ICON) ## Build the macOS .app bundle
# The whole app/ tree in one copy — vendor/ lives in app/ now, so it (and the autoloader
# Latte needs) travels along too.
rsync -a app/ "$(APP)"/Contents/Resources/app/
# Strip the dev tooling the shared app/vendor target installs for qa (phpcs, slevomat,
# playwright — ~9 MB the shipped app never runs). composer.json travels with app/, so this
# Strip the dev tooling the shared app/vendor target installs for qa (dresscode,
# playwright: nothing the shipped app runs). composer.json travels with app/, so this
# reconciles the copied tree down to the production deps in place.
$(call package-app,"$(APP)"/Contents/Resources/app)
# NSLocalizedString resolves against the main bundle, so the .lproj folders have to
Expand Down Expand Up @@ -557,7 +561,7 @@ DIST = build.noindex/pkg/adminer-desktop

# Turns a copy of app/ into what ships; bundle, dist and e2e-packaged share it, so the nightly tests
# the same tree a release carries. composer strips the dev tooling app/vendor carries for qa
# (phpcs, slevomat, playwright — ~9 MB the shipped app never runs), reconciling the copy down to
# (dresscode, playwright: nothing the shipped app runs), reconciling the copy down to
# production deps in place. No precompile on windows: Latte locks even a precompiled template
# there, so app/ would have to be writable.
define package-app
Expand Down
4 changes: 2 additions & 2 deletions app/AdminerDesktop.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ function home(): string {
* @param string $missing
* @return void
*/
function navigation($missing): void { // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint -- adminer's own signature is untyped
function navigation($missing): void {
Latte::engine()->render(__DIR__ . "/src/Assets/busy.latte");
if ($missing != "auth") {
$this->dialog->render();
Expand All @@ -386,7 +386,7 @@ function navigation($missing): void { // phpcs:ignore SlevomatCodingStandard.Typ
* @param string $missing
* @return null
*/
function databasesPrint($missing) { // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint -- adminer's own signature is untyped
function databasesPrint($missing) {
$this->connections->badge();
return null;
}
Expand Down
10 changes: 4 additions & 6 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@
"behat/behat": "^4.0",
"dg/composer-cleaner": "^2.2",
"dibi/dibi": "^5.1",
"dresscode/dresscode": "^1.3.1",
"nette/tester": "^2.5",
"phpstan/phpstan": "2.3.1",
"phpstan/phpstan": "2.3.4",
"phpstan/phpstan-strict-rules": "2.1.0",
"playwright-php/playwright": "^1.2",
"slevomat/coding-standard": "^8.16",
"squizlabs/php_codesniffer": "^4.0"
"playwright-php/playwright": "^1.2"
},
"config": {
"allow-plugins": {
"dg/composer-cleaner": true,
"dealerdirect/phpcodesniffer-composer-installer": false
"dg/composer-cleaner": true
},
"sort-packages": true
},
Expand Down
Loading
Loading