Files
tinycast/Scripts
Abue Ammar 55d69ccd80 Docs/consolidate and standards (#199)
* feedbacks

* Split Tools/ into Tests/ and Scripts/

Tools/ held three unrelated things: 18 standalone Swift harnesses, the bash
test runner, and two Node data generators. Split them by what they are —
Tests/ for the harnesses, Scripts/ for everything executable — and move
build-dmg.sh off the repo root into Scripts/ with it.

The two generated files are regenerated rather than hand-edited, since their
'Generated by' header comes from the generator.

* Split release.md out of development.md

development.md covered two things that change for different reasons and are
read at different times: the local loop, and how a build reaches a user.
Packaging, CI, the release workflow, the Homebrew tap and the website deploy
move to release.md; development.md keeps setup, build, dev channel, editor,
formatting and generated data.

* Rewrite AGENTS.md and de-duplicate the docs around it

AGENTS.md restated standards.md's naming table and comment rules almost
verbatim, and printed the comment-budget shell checks that testing.md and
standards.md also carried — changing the comment cap meant editing three
files. Each rule now lives in exactly one place, with AGENTS.md stating it
and the doc carrying the reasoning.

Promotes the latest-only posture from a mid-document paragraph in
standards.md to the first thing AGENTS.md says, in directive form: prefer
modern Apple APIs, migrate rather than wrap, no compatibility layers, and
never add backwards compatibility unasked.

standards.md's Enforced table and testing.md's scattered checks collapse into
one Definition of done in testing.md. CONTRIBUTING.md's Code style and
Reviewing-your-own-diff sections were a third copy of standards.md and are
now links.

* Adopt swift-format and SwiftLint; no source touched

Formatting was deliberately absent because a shared config had been harmful
once (decisions.md entry 26). Two things make it safe now: the config is
committed, and swift-format runs with respectsExistingLineBreaks so it never
re-flows a break a person placed.

swift-format over SwiftFormat because it ships in the Xcode toolchain — no
Homebrew dependency, and the official swiftlang.swift extension drives it, so
format-on-save needs no third-party editor extension. Measured on this tree it
also changed 575 lines against SwiftFormat's 2,208.

SwiftLint carries the two comment rules that were awk/grep one-liners pasted
into three docs. Scoped to Tinycast/, which is what those checks covered.

Also replaces the manual xcode-build-server setup with Scripts/setup-editor.sh,
drops the hardcoded /opt/homebrew path from tasks.json so a non-Apple-silicon
Homebrew works, and deletes dependabot.yml.

* Keep SwiftLint, drop the formatter, and index Tests/ for SourceKit

Both formatters were adopted, configured and measured on this tree, and both
wanted to change code rather than lay it out.

swift-format restructured 74 files identically at lineLength 120 and 1000 —
splitting signatures, moving braces, adding trailing commas SwiftLint then
flagged. SwiftFormat could be tuned to leave structure alone, but only after
disabling eight rules, and a rule left on introduced a semantic error:
`--enable isEmpty` rewrote `$0.count > 0` to `!$0.isEmpty` in
LauncherRankingStore and PaletteRowIndex, whose `count` is a hit count, not a
collection count. Two harnesses stopped compiling. SwiftLint's own empty_count
flags the same two lines and is disabled for the same reason.

So decisions.md entry 26 keeps its conclusion and gains the evidence.
Scripts/lint.sh is the single command; errors block, warnings do not. The
baseline is 0 errors and 35 warnings, all real signal.

Also fixes the gap that nothing in Tests/ resolved in the editor: xcodebuild
never compiles the harnesses, so .compile had no entry for them. run-tests.sh
gains a --compile-db mode and setup-editor.sh merges it in, so the source lists
stay in one place. Re-run after adding a harness; the build task does it too.

* Drop the editor setup script, and make the Tests/ index actually work

Scripts/setup-editor.sh and .editorconfig are gone: which editor a contributor
uses, and how they configure it, is not the repo's business. Generating
buildServer.json goes back to a documented one-time command in development.md,
framed as an optional note rather than a setup step.

The Tests/ indexing it carried was also broken — verified by driving
sourcekit-lsp directly. It emitted relative paths, which sourcekit-lsp does not
resolve against the entry's `directory`, and no -sdk. Both fail silently. Now
absolute throughout, and the merge moved into run-tests.sh --index, which
already owns the source lists, so no separate script is needed.

Measured on fuzz-test.swift: 60 errors without an entry, 0 with one.

Also shortens eight ui.md headings that embedded file paths, which had made
four cross-document anchors dead (#dialogs--hud, #liquid-glass). The paths move
to a Source: line under each heading.

* Run lint in CI, and stop re-running CI on main

The lint step goes in the existing job rather than a second one, so there is no
extra runner spin-up. It shells out to Scripts/lint.sh with
SWIFTLINT_REPORTER=github-actions-logging, so violations annotate the PR diff
inline instead of being buried in the log, and the workflow still names no rule
itself. `if: always()` means a failing harness does not hide the annotations.
Warnings annotate only; lint errors fail the job, matching a local run.

The push trigger on `main` is gone. `pull_request` already builds the merge
result, so a post-merge run re-tests content CI has seen. workflow_dispatch is
the escape hatch for a direct push to main, which now gets no run otherwise.
2026-08-07 07:07:54 +06:00
..
2026-08-07 07:07:54 +06:00