Commit Graph
54 Commits
Author SHA1 Message Date
Kang fe222d5ebf refactor(desktop): remove shell shortcut wildcard import 2026-07-28 12:49:13 +08:00
Kang 65d2556584 refactor(desktop): remove shell event pump module wildcard import 2026-07-28 12:43:25 +08:00
Kang 33d7dd5451 refactor(desktop): remove shell session event wildcard import 2026-07-28 12:41:38 +08:00
Kang 469ea8f815 refactor(desktop): remove shell runtime plane wildcard import 2026-07-28 12:39:04 +08:00
Kang 0c3ad88fb8 refactor(desktop): remove shell event pump helper wildcard import 2026-07-28 12:35:44 +08:00
Kang 03b432fc13 test(desktop): remove shell event pump helper wildcard import 2026-07-28 12:33:24 +08:00
Kang 3069d46727 refactor(desktop): remove shell bridge wildcard import 2026-07-28 12:28:38 +08:00
Kang 2949bef488 refactor(desktop): move connection group tree queries into state 2026-07-28 12:23:59 +08:00
Kang e680917814 refactor(desktop): remove connection query app wrappers 2026-07-28 12:18:19 +08:00
Kang b62d0881d3 refactor(desktop): move connection list queries into feature state 2026-07-28 12:11:30 +08:00
Kang 81700dfc22 refactor(desktop): hide connection list child state 2026-07-28 12:04:21 +08:00
Kang 19e2362c2a refactor(desktop): hide connection editor child state 2026-07-28 11:51:40 +08:00
Kang 778158b87a refactor(desktop): hide connection child state internals 2026-07-28 11:46:17 +08:00
Kang cea0bb3dd4 feat(terminal): give the right-click menu its icons
Tauri's terminal context menu leads every row with a Material glyph —
copy, search, search-online, AI, translate, paste, paste-selected,
clear, clear-all, select-all. Ours had none, which is most of why the
two menus do not read alike.

Every row now carries one, including the submenu triggers and the rows
inside them, and a row without an icon still reserves the column so the
labels line up. Six glyphs were missing from the bundle and are vendored
through the manifest like the rest.

Sending a prompt to the AI panel from this menu — or from anywhere else
— now writes it into the composer as well as the draft. The composer
owns its own buffer since it became a real input, so the two would
otherwise show different things.
2026-07-27 09:23:48 +08:00
Kang 380ab306cf feat(connections): lay the editor's form out the way Tauri does
Captions move above their boxes, so a field's whole width is what was
typed into it rather than half a line under a label. Host, port,
username and the serial port carry the red required marker, the fields
that had one in Tauri show their placeholder again, and the host row
gives the host the room while pinning the port at a fixed width instead
of splitting the row down the middle.

The port and the other numeric fields gain the spinner Tauri has, with
the range each one is actually valid over. Typing still works — the
buttons are a shortcut, not the only way in.

Switching the connection kind rewrites the default port on the draft;
the box now hears about it, so Telnet opens on 23 rather than showing
22 while the draft says otherwise.
2026-07-27 02:00:19 +08:00
Kang 8ac5401b8b fix(connections): sort folders too, and order names the way people read them
Cycling the sort button only reordered connections: `sort_groups` ignored
`ConnectionSortMode` entirely, so folders stayed put and the tree looked
unsorted. It now branches on the mode exactly as `sort_connections` does.

Both comparisons also used ASCII-lowercase ordering, which puts
`192.168.142.100` before `192.168.142.13` — and host lists are most of what
this panel sorts. `nyaterm_core::natural_compare` compares digit runs by value
without parsing them, so an arbitrarily long run cannot overflow, and falls
back to the raw comparison when case folding ties so the order stays total.
`visible_connection_ids` follows the same rule, or Shift-range selection would
walk a different list than the one on screen; it also stops descending into
collapsed folders, whose rows are not reachable.

The button now shows which mode is active instead of hiding it in a tooltip:
the glyph switches to sort-by-alpha, flips vertically for Z-A, and takes the
primary tint while a name sort is on.
2026-07-26 23:22:16 +08:00
Kang ebb81fcaa8 fix(ui): paint the svg icons that never declared a colour
`Svg::paint` does `self.path.zip(style.text.color)`, and `compute_style` starts
from `Style::default()`, whose `text.color` is `None`. A parent's
`.text_color(..)` cascades to real text but never to an `svg()` child, so a
glyph without a colour of its own was skipped entirely at paint time — no
error, no fallback, just an invisible icon still taking up layout.

59 call sites were affected: the window minimise/maximise/close controls, tab
close buttons, the title bar, the quick-command toolbar, the transfer browser
and queue, tunnels, settings and the AI panels. Shared button helpers are fixed
first, so most sites are covered by ~10 functions. Where the parent brightened
the icon on hover, the pair becomes `.group(..)` plus `.group_hover(..)`, since
a `.hover()` refinement cannot reach a child either.

`scripts/check-icon-references.sh` now fails on an `svg()` whose chain has a
`.path(..)` but no `.text_color(..)`. It checks depth 0 only: a colour that
lives solely inside `.group_hover(.., |s| s.text_color(..))` still leaves the
icon invisible until the pointer is over it.
2026-07-26 23:21:58 +08:00
Kang 5efce4e7cf feat(assets): vendor bundled icons from a pinned manifest
Icons were previously hand-added, so their provenance and licensing lived in
folklore and a mis-painted asset was invisible at runtime: GPUI's `svg()`
reduces a file to an alpha mask, and `img()` keeps its pixels, but nothing
complains when the two are swapped.

Assets are now described by `scripts/icons.manifest` and vendored by
`scripts/sync-icons.sh` from pinned upstream releases, keeping the tree
reproducible and reviewable. `icons/**` stays monochrome and `color/**` full
colour; `scripts/check-icon-references.sh` fails the build when a referenced
asset is missing or painted through the wrong element, and runs in CI.

The lookup tables move out of `formatting/` into a dedicated `features/icons`
module so a ~1000-line brand table is not rebuilt inside a render closure, and
saved connections gain `icon_auto_detect`, which fills in a blank icon from the
detected remote system without ever overwriting a deliberate choice.
2026-07-26 23:21:58 +08:00
Kang 575b59a401 refactor(desktop): remove the last #[path] declarations
The `pages` tree, `http/cloud_sync` and `models/workspace_tabs` were the
last pseudo-module roots. Each moves to `X/mod.rs` so its children
resolve by directory, and `pages/remote/docker` stops aliasing six
sibling files (`docker_containers.rs` as `mod containers`, and so on)
in favour of a normal `docker/` directory.

`nyaterm-terminal-gpui` had one redundant `#[path = "tests.rs"]` that
already pointed at the default location; it is dropped too.

`#[path = "..."]` is now absent from both crates, so the twenty-two
per-directory guards collapse into one crate-wide `check_no_matches`.
Module paths always match the directory layout again, which is what
makes `pub(in ...)` bounds mean something and what makes the next step,
replacing the `use super::*` chain with explicit imports, worth doing.
2026-07-26 15:02:51 +08:00
Kang f242c56308 refactor(desktop): nest layout, panels and inspector view modules
`layout`, `panels`, `inspector`, `formatting` and `view_widgets` were the
same pattern as the runtime areas: an `X.rs` pseudo-module root next to
an `X/` directory whose children were pulled in with `#[path]`.

Move each root to `X/mod.rs` and let the children resolve by directory,
including the nested `security_panel/panel`, `workspace/surface`,
`quick_commands_panel/panel`, `send_command_bar`, `tab_actions_overlay`
and `ai_widgets` subtrees. All five areas are guarded against new
`#[path]` declarations.

Desktop `#[path]` count drops from 178 to 90. What remains is the
`pages` tree plus two files under `models` and `http`.
2026-07-26 14:59:14 +08:00
Kang 99f972d1fa refactor(desktop): remove #[path] from the features root
The remaining twenty-one flattened declarations in `features/mod.rs`
covered the AI, commands, settings, sync, transfers, remote and
translation directories. Each becomes a real module with its own
`mod.rs`, and their `ai_runtime`, `command_runtime`,
`quick_command_runtime`, `security_runtime`, `settings_runtime`,
`cloud_sync_runtime`, `transfer_jobs` and `remote_runtime` subtrees
become directory modules as well, along with the deeper `ai_runtime/chat`,
`ai_runtime/settings` and `quick_command_runtime/import` trees.

`features/mod.rs` now contains zero `#[path]` declarations, which the
boundary script enforces, and every feature directory is guarded too.

As in the previous rounds, nesting surfaced real visibility: three
event-drain methods were `pub(super)` and only reachable because their
module used to be a flat sibling of the event pump. Ten more
`crate::features` level re-exports turned out to be unused once each
consumer sat inside the owning subtree, and were removed.

Desktop `#[path]` count drops from 247 to 178; what is left lives in the
view layer (`pages`, `panels`, `layout`, `inspector`) and in `models`.
2026-07-26 14:56:57 +08:00
Kang 4220c0a3a8 refactor(desktop): nest terminal feature modules
Eight terminal modules were declared in `features/mod.rs` through
`#[path = "terminal/..."]`, and four of them declared their own children
the same way.

Make the whole area a real module tree:

- `mod terminal;` with `features/terminal/mod.rs` owning the children.
- `terminal_runtime`, `terminal_surface`, `terminal_selection_runtime`
  and `terminal_context_menu_runtime` become directory modules,
  removing seventeen further `#[path]` declarations.
- Terminal internals are addressed as
  `crate::features::terminal::terminal_runtime` instead of a top-level
  `crate::features::terminal_runtime`.

Nesting also showed that nine prompt and terminal symbols no longer
needed a `crate::features` level alias, because every consumer now
reaches them inside the owning subtree. Those re-exports are removed,
which keeps the warning count at the existing baseline.

`features/mod.rs` is down from 52 `#[path]` declarations to 21, and the
desktop total drops from 272 to 247.
2026-07-26 14:53:04 +08:00
Kang c9b933e814 refactor(desktop): nest session feature modules
Thirteen session modules were declared in `features/mod.rs` through
`#[path = "session/..."]`, so `features/session` was a directory with no
module of its own.

Make it a real module:

- `mod session;` with `features/session/mod.rs` owning the children.
- `session_runtime` becomes a directory module, removing its two
  remaining `#[path]` declarations.
- Prompt and auth exports, plus the trzsz/zmodem session-state types
  used by `app_state`, reach `crate::features` through explicit
  re-exports instead of flattened module declarations.

Nesting immediately surfaced real visibility: four prompt-drain methods
were declared `pub(super)` and were only reachable from the event pump
because the module used to be a flat sibling. They are now
`pub(in crate::features)` on purpose rather than by accident.

`features/session` has zero `#[path]` declarations and is guarded.
Desktop `#[path]` count drops from 287 to 272.
2026-07-26 14:48:36 +08:00
Kang 1e0b990ffe refactor(desktop): nest shell feature modules
`features/mod.rs` declared twelve shell modules through
`#[path = "shell/..."]`, so the directory looked layered while the module
tree stayed flat: every shell module was a direct child of
`crate::features` and `pub(in crate::features)` meant "visible to the
whole desktop feature crate".

Make `features/shell` a real module:

- `mod shell;` with `features/shell/mod.rs` owning the twelve children.
- `event_pump` and `keybinding_runtime` become directory modules, so
  their own `#[path]` declarations go away too.
- Shell chrome exports reach the rest of `crate::features` through
  explicit re-exports in `features/shell/mod.rs` instead of twelve
  flattened module declarations.

`features/shell` now has zero `#[path]` declarations, and the boundary
script guards that instead of allowing a baseline of five. Desktop
`#[path]` count drops from 306 to 287.

The suggested order in the migration status doc is reworked to put the
module tree first: narrowing the shared prelude one symbol at a time
produced little real encapsulation while every feature directory was
still flattened into one namespace.
2026-07-26 14:44:55 +08:00
Kang a88d04d979 fix(scripts): make architecture boundary check portable
The guard was only reliable on the machine it was written on:

- `rg` prints backslash separators on Windows, so the legacy-source
  allowlist and the `use super::*` scope check never matched their
  `case` patterns and reported every file as a violation. Both call
  sites now pass `--path-separator /`.
- `IGNORECASE` is a gawk extension. Under gawk the secret-Debug scan
  matched CamelCase names such as `KeywordHighlightRule` and produced
  dozens of false positives; under mawk it was silently case-sensitive.
  Drop it so the result is the same everywhere, and note that the
  heuristic is currently weak and still needs a real triage pass.
- `\(` and `\.` inside an awk regex are implementation-defined; some
  awks strip the backslash and then fail with "unbalanced (". Use
  bracket expressions instead.
- Drop the stale `pages/connections.rs` path; that module became a
  directory earlier and `rg` failed on the missing file.
2026-07-26 14:44:25 +08:00
Kang 970e553a2c refactor(desktop): narrow terminal frame event prelude export 2026-07-26 14:23:23 +08:00
Kang 3d9edeed02 refactor(desktop): narrow terminal action link matcher prelude export 2026-07-26 14:18:59 +08:00
Kang 75b77e2226 refactor(desktop): narrow terminal interaction helper prelude export 2026-07-26 14:15:56 +08:00
Kang a712a550fa refactor(desktop): narrow terminal snapshot geometry prelude export 2026-07-26 14:13:58 +08:00
Kang c1078085da refactor(desktop): narrow terminal search result helper prelude export 2026-07-26 14:12:05 +08:00
Kang 32ae3cd0a7 refactor(desktop): narrow terminal output tail cap prelude export 2026-07-26 14:09:35 +08:00
Kang a06aa1b08d refactor(desktop): narrow terminal frame pipeline prelude export 2026-07-26 13:40:14 +08:00
Kang 7ba55db68f refactor(desktop): narrow terminal frame search key prelude export 2026-07-26 13:35:58 +08:00
Kang 5b0cf49f88 refactor(desktop): narrow terminal frame snapshot prelude export 2026-07-26 13:32:33 +08:00
Kang e94689a1d2 refactor(desktop): narrow terminal frame search prelude export 2026-07-26 13:29:26 +08:00
Kang 0cdd1668ce refactor(desktop): narrow terminal frame submission prelude export 2026-07-26 13:25:32 +08:00
Kang d38fe7d3d9 refactor(desktop): narrow terminal frame output prelude export 2026-07-26 13:22:26 +08:00
Kang 8ddd68cc42 refactor(desktop): narrow terminal frame buffer text prelude export 2026-07-26 13:18:57 +08:00
Kang 188df40a8a refactor(desktop): narrow terminal cell position prelude export 2026-07-26 13:13:28 +08:00
Kang 07142623e3 refactor(desktop): narrow terminal selection prelude export 2026-07-26 13:08:28 +08:00
Kang a257d03447 refactor(desktop): narrow terminal protocol state prelude export 2026-07-26 12:41:16 +08:00
Kang e557ffd8d8 refactor(desktop): narrow terminal performance mode prelude export 2026-07-26 12:36:21 +08:00
Kang 0f188c6f74 refactor(desktop): narrow feature prelude exports 2026-07-26 12:33:10 +08:00
Kang 55a4104b40 refactor(architecture): make job imports explicit 2026-07-25 22:10:14 +08:00
Kang 1c49cb5ada refactor(architecture): narrow shared import boundaries 2026-07-25 21:44:31 +08:00
Kang 16ddcd3042 refactor: add architecture boundary check script
This commit introduces a new script, `check-architecture-boundaries.sh`, which enforces architectural boundaries within the project. The script checks for dependencies between different components, ensuring that low-level crates remain independent of higher-level presentation code. It also validates that certain fields and methods are accessed only through designated state management methods, preventing direct mutations that could lead to inconsistencies.

Key features of the script include:
- Dependency checks between crates.
- Validation of access patterns for state management.
- Enforcement of limits on specific code patterns to maintain architectural integrity.
- Reporting of violations with detailed output for easier debugging.

This addition aims to improve code quality and maintainability by enforcing architectural guidelines.
2026-07-25 20:29:05 +08:00
Kang 63ff274888 refactor: migrate to GPUI 2026-07-05 17:26:19 +08:00
Kang 312d53a6f5 feat: Implement quick commands import functionality with scripts and example JSON
This commit introduces two new scripts, `import-quick-commands.ps1` and `import-quick-commands.sh`, for importing quick commands into the NyaTerm database. It also adds an example JSON file, `quick-commands.import.example.json`, demonstrating the expected format for quick commands and categories. Additionally, a new Rust example, `import_quick_commands.rs`, is added to handle the import logic, including options for database path, replacement, dry run, and backup. This enhancement streamlines the process of managing quick commands within the application.
2026-05-12 13:17:19 +08:00
Kang f7875d7871 refactor: Update references from Dragonfly to NyaTerm across documentation and codebase
This commit replaces all instances of "Dragonfly" with "NyaTerm" in various files, including documentation, configuration, and UI elements. The changes ensure consistency in branding and improve clarity for users transitioning from the previous version. Additionally, updates to the changelog and README reflect the new application name and its features.
2026-05-05 20:05:53 +08:00
Kang a37090e70d feat(logging): introduce console usage linting and enhance error logging structure across components for improved diagnostics 2026-04-20 21:39:55 +08:00