Skip to content
Open
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
Binary file removed assets/aether_agent_card.png
Binary file not shown.
80 changes: 0 additions & 80 deletions assets/aether_agent_console.html

This file was deleted.

Binary file removed assets/aether_agent_console.png
Binary file not shown.
Binary file removed assets/card_commands.png
Binary file not shown.
Binary file removed assets/card_main.png
Binary file not shown.
Binary file removed assets/card_models.png
Binary file not shown.
140 changes: 140 additions & 0 deletions cleaningnotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# cleaningnotes.md — 2026-07-01 cleanup pass

Branch: `chore/repo-cleanup-audit`. Full-repo audit + bounded cleanup of
`aether-agent`. Cross-references [scource.md](scource.md) — file/line
citations below point at locations as surveyed before this pass; see
scource.md §1 for the post-split file map.

## Method

3 parallel read-only surveys covering `src/core/` (48 files), `src/ui/` (33
files), `src/commands/` + root (28 files + root config). Findings
synthesized, then a bounded set of high-value / low-risk fixes applied —
not every finding was acted on; see scource.md §4 for the tracked backlog of
what was found but deliberately left alone (and why).

Verification after every batch of changes: `npm run build` (tsc, strict
mode) + `npm test` (node:test, 468 tests). Both clean after all changes
below — see "Verification" at the end.

## Changes made

### 1. Dead weight removed

- `docs/index.html` — deleted. 186-line HTML file that was actually a
1.4MB unused bundler-loading placeholder page (embedded base64 SVG
thumbnail, `__bundler_loading`/`__bundler_thumbnail` DOM ids). Zero
references anywhere in the repo, not part of `package.json`'s `files`
allowlist, only ever touched by the squash-merged PR #32.
- `web-cloud.png` (root, ~57KB) — deleted. Zero references; README embeds
images via `github.com/user-attachments/assets/...` URLs, not local files.
- `assets/` (6 files: `aether_agent_card.png`, `aether_agent_console.html`,
`aether_agent_console.png`, `card_commands.png`, `card_main.png`,
`card_models.png`) — deleted, whole folder. Only reference anywhere is a
historical spec doc (`docs/specs/2026-06-08-aether-agent-rename-design.md`)
pointing at the *pre-rebrand* filename `aether_code_console.html`, which
doesn't even match — confirms these were already orphaned before the
rename.

Cross-ref: scource.md §1 repo map, §3.

### 2. Dead code removed

- `notYet(feature)` — deleted from both `src/commands/vault.ts:45` and
`src/commands/workflow.ts:44`. Byte-for-byte duplicated helper, zero
callers in either file (confirmed via repo-wide grep before deleting).
- `_lastMediaPrompt` — module-private `let` in old `slash.ts:72`, written 5
times (`photogenSlash`, `reframeSlash`, `videogenSlash`, `animateSlash`,
`recutSlash`) but never read anywhere. Dropped when the media handlers
moved to `slash_media.ts`.

Cross-ref: scource.md §3.

### 3. Dead imports removed

Old `slash.ts` imported 8 symbols that were never referenced in the file
body (confirmed by grep — each name appeared exactly once, in its own
import line): `filterMediaModels`, `ASPECT_RATIOS`, `IMAGE_SHORTCUTS`,
`VIDEO_SHORTCUTS` (from `core/vision.js`), `createTimer`, `HudElementId`
(from `core/hud.js`), `titledBox` (from `ui/box.js`), `goalHelp` (from
`./goals.js`). None were carried into the split files.

### 4. `fail()`/`errMsg()` duplication consolidated

5 near-identical error-formatter functions across `media.ts`, `output.ts`,
`vault.ts`, `workflow.ts` (`fail(err)` — print `✗ <msg>` [+ optional login
hint], return 1) and `github.ts` (`errMsg(err)` — return just the message
string, callers compose their own write). Added to `src/core/errors.ts`:

```ts
export function errorMessage(err: unknown): string
export function fail(err: unknown, hint?: string): number
```

Each of the 5 files now imports and calls the shared version — `media.ts`,
`vault.ts`, `workflow.ts` keep a one-line local `fail()` wrapper that
supplies their fixed login hint (output byte-identical to before);
`output.ts` calls `fail(err)` directly (no hint, matches its original
no-hint behavior); `github.ts` uses `errorMessage()` for its one custom-
prefixed message and `fail()`/`fail(err, hint)` for the other three.

Cross-ref: scource.md §3. The near-duplicate `hashOf`/`hashShortCustody`
pair was found in the same sweep but deliberately **not** merged — see
scource.md §4 for why (subtly different fallback semantics, audit-adjacent
code, not worth the regression risk for a cosmetic dedup).

### 5. `commands/slash.ts` split (1807 → 522 lines)

The repo's own convention caps files at ~800 lines (per user-global
coding-style rules already in effect for this session); `slash.ts` was over
2x that. Full read of all 1808 lines, then split into a thin dispatcher +
7 concern files — table and dependency map in scource.md §1.

Constraints honored:
- `handleSlash`'s switch statement stayed physically in `slash.ts`,
4-space case indentation unchanged — `test/slash_registry.test.ts` parses
this exact text via regex to verify registry↔switch sync. Verified this
test still passes.
- The 3 symbols `test/slash.test.ts` imports directly
(`resolveSelection`, `handleSlash`, `primeCatalog`) all still exported
from `slash.ts` with identical signatures/behavior.
- Every extracted function moved verbatim (no logic changes) — only
import lines and file boundaries changed. Cross-checked with `git diff`
reasoning during the split, confirmed via full test suite pass after.

New files: `slash_context.ts`, `slash_git_tools.ts`, `slash_codegen.ts`,
`slash_hud.ts`, `slash_vault_workflow.ts`, `slash_orchestra.ts`,
`slash_media.ts`. Largest is `slash_media.ts` at 303 lines — well under the
repo's ~800-line convention.

Note left inline in `slash.ts`, not extracted: `/mcp` (dynamic-imports
`./mcp.js`), `/logs`/`/logs-view` (calls `ui/logs_viewer.ts`), and the
`token-budget`/`limit` cases both intentionally route to the same
`limitSlash` — `token-budget` is a documented alias, not a duplicate case
left over from a copy-paste.

## Verification

```
npm run build → clean, 0 errors (tsc --strict)
npm test → 468/468 pass (1 flaky failure on first run, reran clean —
unrelated to this change, see below)
```

Note on the flaky test: first `npm test` run showed 467/468 pass with one
unspecified failure that didn't reproduce; immediate rerun was 468/468 clean.
Not chased further since it didn't reproduce and isn't in any file touched
by this pass — flagged here for visibility, not silently ignored.

## Not done (see scource.md §4 for the full, prioritized list)

Deliberately out of scope for this pass — found during the survey, logged
with file:line precision in scource.md, left for a dedicated follow-up PR:
cross-file duplication in `ui/` (progress bars, width-padding, ANSI escape
constants, kaomoji maps), a repo-wide magic-number sweep, further god-file
splits (`chat.ts`, `core/vision.ts`, `core/workflow.ts`, `ui/tui_layout.ts`),
and several misplaced-logic items (presentation code in `core/`, business
logic in `commands/`). Reasoning for stopping here: those items either carry
real regression risk for a mechanical pass (audit/custody code, the REPL
input engine) or are high-volume/low-risk items better batched as their own
reviewable PR rather than bundled into this one.
Loading