Skip to content

Structure → Sort declarations consistently in files#81

Merged
revett merged 3 commits into
mainfrom
revett/structure-files
Jul 20, 2026
Merged

Structure → Sort declarations consistently in files#81
revett merged 3 commits into
mainfrom
revett/structure-files

Conversation

@revett

@revett revett commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a new File Layout rule to the TypeScript-as-Go skill guide (v0.4.0 → v0.5.1) and mechanically applies it across all 15 source files: declarations are sorted by kind first (exported constants → private constants → exported types → private types → exported functions → private functions → framework class shell), then alphabetically within each kind.

  • SKILL.md gains the File Layout section defining the sort order; the rule explicitly exempts test files, which instead read as narratives (central to peripheral, happy path first).
  • All source files receive pure reordering changes — no logic, no types, and no API surfaces are altered; every function body is preserved byte-for-byte.
  • settings.test.ts reorders two case arrays to lead with the happy-path test, consistent with the new test-file narrative rule.

Confidence Score: 5/5

Pure mechanical reordering with no logic changes; safe to merge.

Every changed file contains only moved declarations — no function bodies, types, or exported signatures were altered. The SKILL.md update adds the layout rule that this PR then applies uniformly, and the test file changes follow the new narrative ordering guidance.

No files require special attention.

Important Files Changed

Filename Overview
.agents/skills/typescript-as-go/SKILL.md Bumps SKILL.md from v0.4.0 to v0.5.1, adding the File Layout rules that govern the declaration ordering applied across all changed source files in this PR.
src/settings/settings.ts Reordered declarations to match the layout rule: exported const (DEFAULT_SETTINGS) then exported type (GeodeSettings) then exported functions A-Z then private function (stringOr). No logic changes.
src/settings/settings.test.ts Reorders two test case arrays to put the happy-path case first, consistent with the SKILL.md narrative rule for test files. No test cases added or removed.
src/log/log.ts Reordered to: private const (LEVEL_ORDER), exported types A-Z, exported functions A-Z, private functions A-Z. No logic changes.
src/storage/storage.ts Exported types reordered A-Z; exported and private functions sorted accordingly. No logic changes.
src/vault/vault.ts Exported types A-Z, exported functions A-Z, private functions A-Z. No logic changes.

Comments Outside Diff (1)

  1. src/settings/settings.test.ts, line 14-92 (link)

    P2 Test group order doesn't follow new source declaration order

    The new layout rule says test files must group cases by the symbol under test "following the same order the source file declares them." After this PR, settings.ts exports alphabetically: draftForDisplay (d) → endpointFor (e) → hasConnectionConfig (h) → normalizeSettings (n) → regionFor (r) → settingsEqual (s). The test file currently opens with normalizeCases and closes with draftForDisplayCases, which is the reverse of that order. The group ordering should be: draftForDisplayendpointForhasConnectionConfignormalizeSettingsregionForsettingsEqual.

    Context Used: .agents/skills/typescript-as-go/SKILL.md (source)

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (3): Last reviewed commit: "Merge branch 'main' into revett/structur..." | Re-trigger Greptile

Context used:

  • Context used - .agents/skills/typescript-as-go/SKILL.md (source)

@revett
revett force-pushed the revett/structure-files branch from 77b75c7 to 637ff80 Compare July 20, 2026 22:08
@revett
revett merged commit 5f74b91 into main Jul 20, 2026
10 checks passed
@revett
revett deleted the revett/structure-files branch July 20, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant