gitnc 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. gitnc-0.1.2/.devcontainer/Dockerfile +56 -0
  2. gitnc-0.1.2/.devcontainer/devcontainer.json +26 -0
  3. gitnc-0.1.2/.gitignore +5 -0
  4. gitnc-0.1.2/CLAUDE.md +135 -0
  5. gitnc-0.1.2/LICENSE +232 -0
  6. gitnc-0.1.2/PKG-INFO +14 -0
  7. gitnc-0.1.2/README.md +375 -0
  8. gitnc-0.1.2/gitnc/__init__.py +3 -0
  9. gitnc-0.1.2/gitnc/__main__.py +15 -0
  10. gitnc-0.1.2/gitnc/app.py +4699 -0
  11. gitnc-0.1.2/gitnc/git.py +1052 -0
  12. gitnc-0.1.2/gitnc/terminal.py +230 -0
  13. gitnc-0.1.2/gitnc/themes/__init__.py +25 -0
  14. gitnc-0.1.2/gitnc/themes/atom-one-dark.yaml +100 -0
  15. gitnc-0.1.2/gitnc/themes/atom-one-light.yaml +100 -0
  16. gitnc-0.1.2/gitnc/themes/catppuccin-frappe.yaml +108 -0
  17. gitnc-0.1.2/gitnc/themes/catppuccin-latte.yaml +101 -0
  18. gitnc-0.1.2/gitnc/themes/catppuccin-macchiato.yaml +108 -0
  19. gitnc-0.1.2/gitnc/themes/catppuccin-mocha.yaml +108 -0
  20. gitnc-0.1.2/gitnc/themes/dracula.yaml +101 -0
  21. gitnc-0.1.2/gitnc/themes/flexoki.yaml +103 -0
  22. gitnc-0.1.2/gitnc/themes/gruvbox.yaml +102 -0
  23. gitnc-0.1.2/gitnc/themes/midnight-commander.yaml +104 -0
  24. gitnc-0.1.2/gitnc/themes/monokai.yaml +102 -0
  25. gitnc-0.1.2/gitnc/themes/nord.yaml +106 -0
  26. gitnc-0.1.2/gitnc/themes/rose-pine-dawn.yaml +107 -0
  27. gitnc-0.1.2/gitnc/themes/rose-pine-moon.yaml +107 -0
  28. gitnc-0.1.2/gitnc/themes/rose-pine.yaml +107 -0
  29. gitnc-0.1.2/gitnc/themes/solarized-dark.yaml +104 -0
  30. gitnc-0.1.2/gitnc/themes/solarized-light.yaml +104 -0
  31. gitnc-0.1.2/gitnc/themes/textual-ansi.yaml +110 -0
  32. gitnc-0.1.2/gitnc/themes/textual-dark.yaml +100 -0
  33. gitnc-0.1.2/gitnc/themes/textual-light.yaml +101 -0
  34. gitnc-0.1.2/gitnc/themes/tokyo-night.yaml +101 -0
  35. gitnc-0.1.2/gitnc/ui_theme.py +268 -0
  36. gitnc-0.1.2/pyproject.toml +54 -0
  37. gitnc-0.1.2/tests/__init__.py +0 -0
  38. gitnc-0.1.2/tests/gitprocess.py +56 -0
  39. gitnc-0.1.2/tests/test_app.py +6689 -0
  40. gitnc-0.1.2/tests/test_git.py +812 -0
  41. gitnc-0.1.2/tests/test_terminal.py +114 -0
  42. gitnc-0.1.2/tests/test_themes.py +81 -0
@@ -0,0 +1,56 @@
1
+ ARG PYTHON_VERSION=3.12
2
+
3
+ FROM ubuntu:24.04
4
+
5
+ ARG PYTHON_VERSION
6
+
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+
9
+ # Install base dependencies
10
+ RUN apt-get update && apt-get install -y --no-install-recommends \
11
+ curl \
12
+ wget \
13
+ gnupg \
14
+ ca-certificates \
15
+ software-properties-common \
16
+ git \
17
+ tmux \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Install Python
21
+ RUN add-apt-repository ppa:deadsnakes/ppa \
22
+ && apt-get update \
23
+ && apt-get install -y --no-install-recommends \
24
+ python${PYTHON_VERSION} \
25
+ python${PYTHON_VERSION}-venv \
26
+ python${PYTHON_VERSION}-dev \
27
+ python3-pip \
28
+ && update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 1 \
29
+ && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
30
+ && rm -rf /var/lib/apt/lists/*
31
+
32
+ # Install Node.js (LTS) — required by the Claude Code CLI
33
+ RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
34
+ && apt-get install -y --no-install-recommends nodejs \
35
+ && rm -rf /var/lib/apt/lists/*
36
+
37
+ # Create non-root user with UID 1000 to match typical host user UID.
38
+ # Ubuntu 24.04 base image ships with an "ubuntu" user at UID 1000; remove it first.
39
+ RUN userdel -r ubuntu 2>/dev/null || true \
40
+ && useradd -m -u 1000 -s /bin/bash vscode
41
+ USER vscode
42
+ WORKDIR /home/vscode
43
+ RUN mkdir -p /home/vscode/.config
44
+
45
+ # Install Claude Code CLI as the vscode user so it can write its own caches and state.
46
+ ENV NPM_CONFIG_PREFIX=/home/vscode/.npm-global
47
+ ENV PATH=/home/vscode/.npm-global/bin:${PATH}
48
+ RUN npm install -g @anthropic-ai/claude-code
49
+
50
+ # Install Hatch (project task runner) into its own venv, pipx-style — Ubuntu 24.04's
51
+ # system pip is externally managed (PEP 668), so a user-level pip install is refused.
52
+ ENV PATH=/home/vscode/.local/bin:${PATH}
53
+ RUN python3 -m venv /home/vscode/.local/share/hatch-venv \
54
+ && /home/vscode/.local/share/hatch-venv/bin/pip install --no-cache-dir hatch \
55
+ && mkdir -p /home/vscode/.local/bin \
56
+ && ln -s /home/vscode/.local/share/hatch-venv/bin/hatch /home/vscode/.local/bin/hatch
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "Python Dev Container",
3
+ "build": {
4
+ "dockerfile": "Dockerfile",
5
+ "args": {
6
+ "PYTHON_VERSION": "3.12"
7
+ }
8
+ },
9
+ "customizations": {
10
+ "vscode": {
11
+ "extensions": [
12
+ "ms-python.python",
13
+ "ms-python.vscode-pylance"
14
+ ],
15
+ "settings": {
16
+ "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
17
+ }
18
+ }
19
+ },
20
+ "postCreateCommand": "python -m venv .venv && .venv/bin/pip install -e '.[dev]'",
21
+ "mounts": [
22
+ "source=${localEnv:HOME}/.claude,target=/home/vscode/.claude,type=bind,consistency=cached",
23
+ "source=${localEnv:HOME}/.claude.json,target=/home/vscode/.claude.json,type=bind,consistency=cached"
24
+ ],
25
+ "remoteUser": "vscode"
26
+ }
gitnc-0.1.2/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .claude/
2
+ .venv/
3
+ dist/
4
+ .pypi/
5
+ __pycache__/
gitnc-0.1.2/CLAUDE.md ADDED
@@ -0,0 +1,135 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ See `README.md` for setup, running and general test invocations. Prefer the Hatch scripts defined in `pyproject.toml` for the standard tasks:
6
+
7
+ ```sh
8
+ hatch run test [args] # tests
9
+ hatch run lint # ruff check + ruff format --check + pyright
10
+ hatch run fmt # ruff check --fix + ruff format
11
+ hatch run start [path] # launch the app
12
+ ```
13
+
14
+ `hatch run test` accepts unittest args, so a single module or test runs as:
15
+
16
+ ```sh
17
+ hatch run test tests.test_app
18
+ hatch run test tests.test_app.TestGitNightCommanderApp.test_quit_binding_uses_f10
19
+ ```
20
+
21
+ Hatch builds its own virtualenv with the `dev` extra on first use, separate from `.venv` — the lint hook (below) still reads `.venv`, so keep that one set up too (per `README.md`).
22
+
23
+ ## Test stubs
24
+
25
+ `tests/test_app.py` installs stub `textual` / `rich` modules in `sys.modules` when those packages aren't installed, so the app tests can import `gitnc.app` without the real Textual dependency. If you add new symbols imported from `textual.*` at module load time in `gitnc/app.py`, also stub them in `_install_textual_stubs()`.
26
+
27
+ ## Architecture
28
+
29
+ Three modules under `gitnc/`:
30
+
31
+ - **`git.py`** — pure data layer. `GIT` shells out to `git` via `Popen(["git", "-C", path, ...])` + `communicate()`, tracking the live processes so `shutdown()` can end them (see *Quitting during a read*). Tests patch that seam with `tests/gitprocess.fake_git_processes()`. `GitStatus` enumerates porcelain status letters; `GitCode` is a dynamically-built enum of every two-character `staged+unstaged` combination, with `.staged` / `.unstaged` / `.contains()` helpers. `Commit` and `GitEntry` are the dataclasses returned to the UI.
32
+ - **`terminal.py`** — POSIX/Windows TTY plumbing for the `Ctrl+O` "previous screen" feature. Uses `pty.fork()` on POSIX to spawn `$SHELL -i`, proxies stdin/stdout, and watches for `PREVIOUS_SCREEN_TOGGLE_KEY` (`\x0f` = Ctrl+O) to terminate the shell and return to the TUI. Independent of Textual. `started_from_midnight_commander()` checks for mc's `MC_SID` / `MC_TMPDIR` so `on_mount` can open `MidnightCommanderDialog` — mc's subshell takes `Ctrl+O` before the app sees it — which continues on `C` / `Enter` and goes through `action_quit` on `E` / `Esc`.
33
+ - **`app.py`** — the Textual UI. `GitNightCommanderApp` owns `repo_path`, a `GIT` instance, and a `Terminal` instance.
34
+
35
+ **View switching:** a single `ContentSwitcher` toggles between three views: `status-view` (default — file list + inline diff), `history-view` (commit list + commit detail), and `diff-view` (full-screen file diff used in long-list mode). The View menu actions and `_focus_active_view()` route focus per view.
36
+
37
+ **File-list modes:** `MODE_SHORT` shows the status list beside an inline `FileDiff`; `MODE_LONG` widens the list to full width and routes selection to the full-screen `diff-view` instead. `_set_file_list_mode()` toggles the `.long-mode` CSS class on `#status-view` and reloads. The two modes are a radio group in the File menu: `_file_menu_items()` builds every label through `_menu_label()`, which prefixes a one-cell marker gutter (`MENU_RADIO_ON` / `MENU_RADIO_OFF` for the modes, `MENU_MARKER_BLANK` for plain entries) so all labels start in the same column and the item widths don't move when the mode changes. The labels depend on `file_list_mode`, so the menu is rebuilt via `_refresh_dropdown()` each time it opens.
38
+
39
+ The two File menu entries (`action_short_file_list` / `action_long_file_list`) are direct sets and nothing else. F3 goes through `action_toggle_file_list` to a pair of carrying variants — `action_short_file_list_inline_diff` and `action_long_file_list_full_screen_diff` — which call `_move_diff_between_modes()` so an open diff follows the user across the switch instead of being closed. Whether a diff *is* open is decided differently per direction: in long mode the full-screen diff owns the screen, so `_diff_entry_if_full_screen_visible()` just asks the `ContentSwitcher`; in short mode the inline panel stays visible after Enter opened it, so visibility alone can't tell "expand this diff" from "widen the list" — `_focused_inline_diff_entry()` also requires the panel to be the focused widget, and F3 with the file list focused is the plain mode switch it advertises. That focus read has to happen *before* `action_close_menus()`, which hands focus back to the active view.
40
+
41
+ **File-list filter:** `f` (`action_toggle_file_filter`) cycles `file_list_filter` through `FILE_LIST_FILTERS`, and the File menu carries the same choices as a second radio group under the modes (`action_file_filter_none` / `action_file_filter_untracked_dirs`, direct sets like the mode entries). `FILTER_UNTRACKED_DIRS` is not a filter over the loaded list: `_load_status()` passes `collapse_untracked_dirs` to `GIT.load_status()`, which switches `--untracked-files=all` to `normal`, so git itself folds a directory holding nothing tracked into one `dir/` entry — the same rule `git status` uses, and a directory with any tracked file still lists its untracked files one by one. The `dir/` entry is an ordinary untracked `GitEntry`: `git add` / `git clean -f` / `git stash push` all take it as a pathspec, `_entry_stat()` shows `<DIR>` for its size, and `load_file_content()` renders the files below it instead of reading a file. `GitFilelist.index_of()` falls back to the `dir/` row a file was folded into, so the highlight follows the file across the switch. `_update_status_header()` puts `FILE_LIST_FILTER_LABELS[...]` right after the file count, ahead of the highlighted entry's description, whose length varies.
42
+
43
+ **Menu system:** `MenuBar` (docked top) is built from the `MENU_BAR` table and holds one `MenuLabel` per menu. Each has a corresponding `DropdownMenu` rendered on the `overlay` layer. `toggle_menu()` / `_show_menu_by_index()` manage exclusivity (only one open at a time) and active-class styling. Left/right arrows cycle between menus while one is open (`on_key`); F9 opens the first menu; Escape closes any open menu and otherwise exits the full-screen diff view. Dropdown labels are rendered through `_menu_option_labels()`, which pads each entry to a common width and appends a right-aligned hint column filled by `_menu_hint()`: the shortcut looked up in `MENU_HINTS_BY_ACTION` (built from `SHORTCUTS`, so a menu table never repeats a key), or `MENU_SUBMENU_MARKER` (`▶`) for an action in `MENU_SUBMENU_ACTIONS`, so an entry that opens a nested menu is told apart from a leaf entry. A menu whose entries are all unbound leaves and no submenus keeps its bare labels. `DropdownMenu.show_at()` sizes itself from those rendered labels.
44
+
45
+ **Nested menus:** a `Submenu` (`name`, `items`, `parent_id`) in the `SUBMENUS` registry is the whole definition of one — today just Options → Theme. Everything else is derived from it: `compose()` mounts a `DropdownMenu` per entry under `submenu.dropdown_id` (`dropdown_<name>`); `submenu.action` (`open_submenu('<name>')`) is what the parent menu's entry runs and what the generic `action_open_submenu()` resolves back through `SUBMENUS_BY_NAME`; and `MENU_SUBMENU_ACTIONS` — the set `_menu_hint()` checks for the `▶` — is built from those actions. The opener cascades the child off the row that runs it: it re-shows the parent under the `MenuLabel` named by `parent_id` (the `OptionList` handler hid it on the way in), hides every *other* dropdown, and places the child at `parent_x + parent.menu_width`, `parent_y + parent.index_of_action(...)` — the row offset cancels the two menus' top borders, so the child's first entry lands on its parent's row. `DropdownMenu.menu_width` is computed from the items rather than read back from the layout, because both menus are placed in the same tick. Widths and heights are in screen cells, which only works because `DropdownMenu` is `position: absolute` — a relative offset would be measured from the *visible* overlay siblings, so a cascade would start one parent-width too far right. `_cascade_x()` flips the child to the parent's left when the right edge would run off screen. The parent label keeps its `-active` class, so the whole trail — bar label, parent row, child — stays visible. Both ways back out of a nested menu — Escape and left — go through `_close_submenu_to_parent()`, which reopens the parent by index and calls `DropdownMenu.highlight_action()` so the cursor lands on the entry the submenu was opened from; only once the parent is showing does Escape close the menus. `_open_submenu()` decides that by looking for a visible dropdown whose id is in the registry, so a submenu never has to record that it is open. Because a cascade leaves two dropdowns open, anything that closes a menu closes them all (`toggle_menu` included) — otherwise clicking the parent's bar label would orphan the child.
46
+
47
+ **Mnemonic accelerators:** every menu label declares its accelerator Turbo Vision style, with a `&` in front of one character (`"&File"`, `"&Short file list"`). `_split_mnemonic()` strips the marker — it never reaches the screen — and reports the index of the marked character; `_menu_mnemonic_key()` turns that into the key that selects the entry, and `_mnemonic_markup()` wraps the character in the theme's `menu_mnemonic` style as content markup (the style has to read on both the menu bar's `$menu-bar-background` and the dropdown's `$panel` background, which is why the default carries no color). Because markers are stripped before `_menu_option_labels()` pads, an accelerator can't widen a label or shift the hint column. Theme entries declare no accelerator — there are too many themes to spell one — and unmarked labels render untouched.
48
+
49
+ `Alt+letter` opens the matching top-level menu from anywhere, including while another menu is open (`_open_menu_for_accelerator()`, reached from `App.on_key` before the left/right cycling). Inside an open menu, the bare letter runs the entry (`DropdownMenu.on_key`); every other bare character is swallowed so the app's single-letter bindings (`s` / `u` / `c`) can't fire behind the menu. Only keys whose name equals their character are claimed, which leaves `space` / `enter` to the `OptionList` and lets `alt+letter` — which Textual reports with `character="f"` — bubble up to the menu bar.
50
+
51
+ Menu chrome is composed once and stays mounted, so `action_set_theme` / `_load_saved_theme` call `_restyle_menu_mnemonics()` to re-render the labels; otherwise they would keep the accelerator style of the theme that was active at compose time.
52
+
53
+ **Chrome colors:** the menu bar and the footer are painted from four `UITheme` fields — `menu_bar_background` / `menu_bar_foreground` / `footer_background` / `footer_foreground` — which `css_variables()` emits as `$menu-bar-background`, `$menu-bar-foreground`, `$footer-background` and `$footer-foreground` (the last two are Textual's own Footer variables, so the app carries no `Footer` CSS at all). The defaults are `$panel` / `$foreground`, i.e. Textual's Header/Footer palette, so a theme that says nothing about the chrome gets the bars every other Textual app has; `midnight-commander.yaml` overrides all four to `$warning` / `$background` for the MC look. Don't tie the bars to a palette role in CSS (they used to read `background: $warning`): "warning" means cyan in one theme and yellow in the next, so the bar changed color for reasons that had nothing to do with chrome. `MenuLabel`'s hover and `-active` states derive from those two variables — a 15% tint of the bar's own text color, and a full reverse — so they stay legible on any palette.
54
+
55
+ **Text selection colors:** selected text in the commit message box (Shift+arrows in the `TextArea`) is painted from `UITheme.text_selection_background` / `text_selection_foreground`, which `css_variables()` emits as Textual's own `$input-selection-background` / `$input-selection-foreground` — the variables `TextArea` and `Input` already read, so there is no selection CSS in the app. Unlike the chrome fields these are optional: an empty value emits nothing and leaves Textual's derived default (`$primary` lightened, at 40% over the background), because that default is fine in most themes and can't be written as a `$ref` `_resolve_refs()` understands. It is not fine in midnight-commander, where primary and background are both blue and a selection all but vanished; that theme sets `$warning` / `$background`, mcedit's dark-blue-on-cyan marked block. Set the selection through these fields, not through `variables`: `get_theme()` lets a `variables` entry win, so a second copy there would silently override the field.
56
+
57
+ **Committing:** `action_commit_files()` asks twice, and the two questions are different. The first — only when a target still has unstaged changes — is `Stage N file(s) for commit?`, listing the `git add` commands that would run. The second always comes, after the message dialog: `_confirm_commit()` shows `Commit N file(s)?` over the commands from `GIT.commit_with_selection_commands()`, which is the last point at which the files going into the commit are visible before `commit_with_selection` walks the submodules and commits. The command list comes from that method rather than being rebuilt in `app.py` so the popup and the executor can't drift apart, and the message inside it is cut to `_commit_message_subject()` — its first line, marked with `TRUNCATION_MARKER` when there is more — because the popup renders one command per row and a multi-line `-m` argument would break that. N on it doesn't cancel: `_show_confirm()`'s `on_cancel` reopens the message editor — `CommitDialog`, or the external editor the settings name — on the message just written, so backing out of the confirmation costs nothing. That is the only reason `on_cancel` exists; every other caller wants the default, which hands focus back to the active view.
58
+
59
+ Cancelling the message dialog rolls the index back to where the flow found it. Both halves of the mutation are undone: `_restore_externals()` re-stages the files it unstaged, and `_unstage_pending()` unstages what the stage confirmation added, from the `_pending_commit_staged` list `_begin_commit_message()` was handed. Without the second half the files stayed staged, so a second `C` on the same selection found nothing left to stage and skipped straight past `Stage N file(s) for commit?` — the question never came back. Only entries that had *nothing* staged before go on that list (`not code.has_staged_changes`): an entry that was already partly staged had its index state built by the user, and `git restore --staged` would throw that away instead of putting it back. `_commit_submit()` clears the list without running it — the files it staged are the files it just committed.
60
+
61
+ **Writing the message in an external editor:** the Options → Settings section *Commit message editor* is a three-row radio group — `SETTINGS_EDITOR_ROWS` maps each row to `COMMIT_EDITOR_BUILTIN` / `_ENVIRONMENT` / `_COMMAND`, Space picks one, and typing into the `Command:` row under it selects the command option — stored as `commit_editor` plus `commit_editor_command`. Every place the flow used to push `CommitDialog` for a message — `_begin_commit_message()` and the `on_cancel` of `_confirm_commit()` — now goes through `_edit_commit_message()`. That asks `_commit_editor_argv()` for a command line (`$EDITOR`, or the setting, split with `shlex`; `None` means the built-in dialog) and runs it with `_commit_in_external_editor()`: suspended on the previous screen like the drafting tool, with `run_commit_editor()` writing `commit_editor_template()` to a temporary `COMMIT_EDITMSG` (git's name, which is what puts editors in git-commit mode), running `<argv> <path>` and reading the file back through `strip_commit_editor_text()`. The help text and file list sit under git's scissors line (`COMMIT_EDITOR_SCISSORS`) rather than on `#` lines, so a message line starting with `#` survives. The result feeds `_commit_result()` exactly as the dialog's would: an empty message, one that is only the `branch:` prefix, or a failing exit status (`EditorResult.message is None`) cancels; anything else goes to the confirmation. Anything that stops the editor from running at all — unset `$EDITOR`, an empty or unparseable command, `EditorResult.started` false, a terminal that won't suspend — notifies and falls back to `CommitDialog`, so a bad setting never costs the user the commit. `KeyboardInterrupt` out of the editor is read as abandoning it, for the same reason as in the drafting tool. The Draft button lives in `CommitDialog`, so drafting isn't reachable with an external editor.
62
+
63
+ **Drafting commit messages:** the commit dialog's Draft button (F4) runs whatever tool the user named in Options → Settings. The two settings are free text — `commit_draft_command` (a command line, split with `shlex`) and `commit_draft_prompt` (a template) — rather than the fixed tool list this used to offer, so a tool the app has never heard of works without a code change. In `SettingsDialog` they sit with `commit_draft_parse_suggestions` under `_section_header("Experimental")` — three settings whose behavior depends on a tool the app doesn't ship, kept apart from the branch settings that always work. The prompt is the one row drawn by `_field_rows()` rather than `_text_row()`: a framed field with its label above it and a block caret while the row is under the cursor, because a template is a paragraph and a value trailing a label gives no sign of how much of it is on screen. `_wrap_field_text()` wraps it at word boundaries — not `textwrap.wrap()`, which drops the space after a finished word (that space is what pushes the caret along) and returns no lines at all for an empty value (the field still has to draw one); a word too long to break, a URL or a path, is cut where it fills the line. The field is `SETTINGS_FIELD_MIN_LINES` tall and grows with the value to `SETTINGS_FIELD_MAX_LINES`, past which it scrolls far enough to keep the caret's line on screen — the last lines by default, earlier ones once the arrows have gone up there — and the cap is what stops a pasted-in essay from pushing the rows under it off screen.
64
+
65
+ The caret is a position in the value (`_caret`), not the end of it: `edit_text()` inserts and backspaces there, and `_caret_markup()` draws it *on* a cell — `UITheme.text_caret` is `reverse` because the character under it still has to be readable. `FieldLine.start` is what connects the two, and `_caret_position()` maps an offset to a line and column with it; on a wrap boundary the two lines share the offset and the caret takes the one it is about to type into. Inside a framed field up and down are `move_caret_line()` and never leave it (up on the first line and down on the last go to the two ends of the value) — Tab and Enter are what leave a row, so the arrows are free to be the caret's. On a one-line row up and down stay the row cursor's, since there is nowhere else for them to go; left and right are `move_caret()` on any text row. `move_cursor()` enters a row with its caret at the end, and `_key_hint()` swaps the key line under the dialog, because the same arrows mean two different things depending on the row. `SETTINGS_SECTION_WIDTH` — the frame's indent plus its borders — is what the section rules run to and what `#settings-body`'s `min-width` is sized for, so nothing here wraps. `request_commit_draft()` invokes the command as `<argv> <prompt>`: `commit_draft_prompt()` joins the template and the filenames going into the commit into one final argument, `run_commit_draft()` runs it with stdin on `DEVNULL` (the run is shown on the terminal but nobody is typing into it, so a tool that decides to prompt would just sit there), and the result comes back as a `DraftResult` — `ok` says whether `text` is a commit message or the reason there isn't one. It is `Popen` plus two `_pump_draft_output()` readers rather than `subprocess.run`, because `run` hands its output over only once the process has exited and the point is to show the tool working: every line goes to the `on_output` callback as it is printed. stdout is the message and stderr is the failure detail, so the two are collected apart even though both are reported as progress; stderr gets its own thread, since draining them in sequence deadlocks as soon as one fills its pipe buffer while the other is being read. `subprocess.run(timeout=…)` used to enforce the deadline — with the pumps blocking on the pipes instead, a `threading.Timer` kills the process and the pumps then end at EOF. A `KeyboardInterrupt` out of the stdout pump is the user pressing Ctrl+C on the previous screen (see below): the tool is killed and the run comes back as cancelled, because letting it escape would skip `App.suspend()`'s resume — Textual's suspend has no `finally` — and strand the terminal outside the alternate screen. `_apply_commit_draft()` passes the output through `_with_branch_prefix()`, because the tool knows nothing about the branch-prefix setting: the branch name goes in front unless the message already starts with it. Both the prefill and the drafted message end up in the same `TextArea`, so either is editable before F2 commits it. `CommitDialog.append_output()` renders the lines into `#commit-output`, a pane that stays hidden (`display: none`) until something puts a line in it, holds the last `COMMIT_DRAFT_OUTPUT_LINES` lines pinned to the bottom, and stays on screen after the run that filled it. Only the worker fills it — see below — so on the normal path the dialog is the message box and nothing else.
66
+
67
+ **Where the drafting tool runs:** on the previous screen — the same terminal `Ctrl+O` puts a shell on. `_draft_on_previous_screen()` enters `App.suspend()` for the length of the run, echoes the command line (`shlex.join`, i.e. as a shell would show it) and then every line the tool prints through `Terminal.write_previous_screen()`, and only then hands the result to `_apply_commit_draft()`. Two things follow from that: the tool's progress is visible at full screen height instead of in a six-row pane, and it is *still* visible afterwards — the output is in the normal buffer's scrollback, so `Ctrl+O` from the main screen scrolls back to the whole run long after the commit. `write_previous_screen()` reads `sys.stdout` per call rather than capturing it, because `App.suspend()` rebinds it to the real stdout for the length of the block; a closed stream is swallowed, since a commit is not worth failing over an echo.
68
+
69
+ Showing the output does not replace capturing it — the lines are still parsed into the message, or into the reason there isn't one — but the screen is the only place they are *shown*. `#commit-output` stays empty and hidden on this path: the user has just watched the run at full screen height, and repeating it under the message box buries the one thing the dialog is for. The failure text still comes back through `notify()`, and the run itself is a `Ctrl+O` away. This path needs no `call_from_thread` either: it is inline on the UI thread, which is free precisely because there is no UI to keep responsive while the app is suspended.
70
+
71
+ `_commit_draft_worker()` is now the fallback for a terminal that can't be suspended: the same tool on a thread worker with the TUI still up, its lines arriving through `_post_draft_output()` — `call_from_thread` like every other worker result, from the worker and from the stderr reader both, and a `RuntimeError` there means the app outlived the run and the line has nowhere to go. `_draft_on_previous_screen()` returns whether it ran, and guards *only* entering the suspension (an `ExitStack` rather than a `with` around the whole thing), so a failure inside the run can't be misread as "never suspended" and send the same tool off to a second run. `RuntimeError` is caught alongside `SuspendNotSupported` there because an app with no driver — one that isn't running, which is every unit test — declines by returning from the context manager without yielding.
72
+
73
+ **Picking between drafted messages:** a tool asked for several candidates answers with a numbered list, so the third drafting setting — `commit_draft_parse_suggestions`, the "Parse suggestions from numbered list" checkbox — reads the output back into separate messages. `parse_numbered_suggestions()` drops everything ahead of the first number; an item then keeps the blank and *indented* lines under it — that is how a suggestion with a body survives — and ends at the first line back in column 0 that isn't another number. Indentation is what decides it because the alternative, running each item to the next number, made the last one collect the tool's closing remarks ("My pick: #2, because…") and drop them into the message the user picked. Only the item ends there, not the parse, so a tool that comments between its suggestions still yields all of them. `_joined_suggestion()` then dedents the body, since the indent was list markup rather than something the message asked for, and runs the item through `_strip_markdown_delimiters()`: a tool writing a list writes Markdown, and a commit message is plain text, so `**` and backticks come off (`MARKDOWN_DELIMITER_PATTERN`) and a fence line goes whole (`CODE_FENCE_PATTERN`) — stripping only its backticks would leave the language tag behind as a line of the message. Markers are removed one at a time rather than in matched pairs, because an item that ends at the first unindented line can be cut off mid-emphasis. `_` is not in the pattern: it belongs to `__init__` and `test_app.py` far more often than it marks emphasis. An item that was nothing but markup joins to the empty string, which the comprehension in `parse_numbered_suggestions()` already drops. What is left over is a body written without indentation, which reads as the end of its item; the pick is editable before F2, which is the remedy for that and for a tool that numbered something else entirely. `_apply_commit_draft()` branches on the count: more than one opens `SuggestionDialog` over the commit dialog, exactly one goes straight into the text area (nothing to choose between, but the number still comes off), and none falls back to the whole output with a notification — a tool that ignored the request still wrote something. The picker's rows are `_commit_message_subject()` of each suggestion, so a message with a body doesn't push the rest of the list off screen, while the dismissed value is the whole thing. Its `on_key` claims only Escape and the digits (1-9 pick that row); arrows and Enter are left to the `OptionList`, which is what moves and selects. `_apply_commit_suggestion()` puts the pick through `_with_branch_prefix()` like any other draft, and does nothing at all when the user backed out — the tool's output is still in the log pane, so cancelling loses nothing.
74
+
75
+ **Stash and remote commands:** the Repo menu — `Pull`, `Push`, `Stash`, `Stash pop` — and the letter pairs `p`/`P` and `z`/`Z` reach four actions that act on the repository rather than on the file under the cursor, which is why they are their own menu instead of more File entries. All four confirm through `_show_confirm()` for the same reason the file commands do: the popup is the last place the exact command line is visible, and each of them moves work the file list can't show — stash empties the worktree, pop refills it (and can conflict), pull moves HEAD, push leaves the machine. None of them gets a second free-text prompt: a stash message, or a remote to pick, is what the `Ctrl+O` shell is for.
76
+
77
+ Three refusals come *before* the dialog, because each would otherwise open a popup over a command that could only fail: a stash with a clean file list, a pop with an empty `stash_entries()`, and a pull or push with no remote (or, for pull, no upstream — `--ff-only` needs a ref to fast-forward to, and the fix is the push that sets one). What the question says is built from the same data: `action_stash_pop()` quotes the `git stash list` line it would reapply, cut to `STASH_PROMPT_MAX_WIDTH`, because which entry is on top is exactly what someone who stashed twice can't remember; `action_push()` says "and set it as upstream" whenever `push_command()` takes its `--set-upstream` shape, since that push publishes the branch rather than updating it.
78
+
79
+ Pull and push add one thing the other two don't: `_submodule_mismatch_notes()` puts a `-- Warning: submodule '…' is on branch '…' but parent is on '…' --` row under the command, one per submodule sitting on a branch of its own. Both commands move the parent's history past a gitlink pointing into a submodule nobody is on the branch of, so what arrives from the remote — or what the remote is told the submodule should be at — is a commit the checked-out submodule branch may not contain. The status view already carries the same sentence in its warning label, but the confirmation is the last thing between the keypress and the network. Both texts come from `_submodule_mismatch_text()` so they can't drift, and both read the `_submodule_mismatches` cache the status worker fills rather than re-running a `git rev-parse` per submodule on the UI thread. The warning does not refuse: a submodule on its own branch is a normal way to work, and the question is a question.
80
+
81
+ `GIT.stash_command()` passes `--include-untracked` — the file list shows untracked files, so a stash that left them behind would put away only part of what the user is looking at — and takes a pathspec when files are selected. Submodule entries drop out of a path-limited stash (the pathspec would name a path in another repo) and the dialog says how many were left behind. `GIT.pull_command()` is `--ff-only`: a pull that has to merge leaves the repo in a state this app can neither show nor finish, and refusing is recoverable in the shell one keystroke away.
82
+
83
+ Pull and push are the two writes that don't run inline. `git add` returns in milliseconds; a network command sits there, and inline it would freeze every key in the TUI, so `_start_remote_command()` hands it to `_remote_worker` (`@work(thread=True, group="git-remote")`) and `_apply_remote_result()` renders through `call_from_thread` like every other worker. It is guarded by the `_remote_running` flag rather than `exclusive=True`, which cancels a superseded worker's asyncio task but not its thread — a second `P` would reach the wire. `_remote_result_summary()` picks the line to notify from which end of the output holds it: the first stderr line when the command failed (git leads with the reason and follows with hints), the last line of either stream when it succeeded ("Already up to date.", the ref update).
84
+
85
+ **Confirm dialog sizing:** `ConfirmDialog` sizes its own box instead of leaving it on `width: auto`, so the popup matches the file list it is confirming. `text_width()` takes the widest of the prompt, the rendered command lines and the hint, floors it at `CONFIRM_DIALOG_MIN_TEXT_WIDTH` and caps it at the screen (`CONFIRM_DIALOG_CHROME_WIDTH` = the border + padding the box spends, plus `scrollbar_width()` when there are more commands than `CONFIRM_DIALOG_VISIBLE_COMMAND_ROWS` — without that reservation the scrollbar lands past the border and is clipped, hiding the only sign that the list continues). `compose()` sets `body.styles.width` from that number and renders the commands through `command_lines(text_width)`, which cuts anything longer with `TRUNCATION_MARKER` (`…`) in place of the tail, so a truncated filename reads as truncated rather than as a shorter name. Because Textual's box-sizing is `border-box`, the number set on `styles.width` is the outer width and `Widget.size` reports the inner one. With no screen to measure (unmounted, or the stubs in tests) `text_width()` returns 0 and both the explicit width and the truncation are skipped — the CSS `width: auto` sizes the box as before.
86
+
87
+ Height is capped at `CONFIRM_DIALOG_VISIBLE_COMMAND_ROWS` commands by default. The two commit prompts (`Stage N file(s) for commit?` and `Commit N file(s)?`) pass `fill_height=True` through `_show_confirm()`, and `visible_command_rows()` then lets the list grow to the screen height minus `CONFIRM_DIALOG_CHROME_HEIGHT` and the commands area's padding, so every file going into the commit is visible when the screen has room. `scrollbar_width()` measures against that same row count. An unmeasured screen keeps the default cap.
88
+
89
+ **Dialogs:** `ConfirmDialog`, `HelpDialog`, `SettingsDialog`, `CommitDialog` and `SuggestionDialog` are `ModalScreen` subclasses, opened with `push_screen(Dialog(...), callback=...)` and closed by the dialog calling `dismiss(result)`. Each takes its content through `__init__` and renders it in `compose()` — there is no `show()` / `hide()`, and they are not composed into the app's own tree.
90
+
91
+ Modality is structural: Textual truncates the binding chain at the first modal node (`Screen._modal_binding_chain`), so while a dialog is open the app's `s` / `u` / `c` / Escape bindings cannot fire and the `StatusList` is out of the focus chain. That is why the actions carry no re-entrancy guards and `App.on_key` / `action_escape` say nothing about dialogs. Each dialog handles its own keys in `on_key` and stops every event; don't mix `BINDINGS` into that, because a screen's own bindings are only consulted once the key bubbles to `App._on_key`, which a stopped event never reaches. `CommitDialog` is the exception in both halves: it has no `on_key` — the `TextArea` has to own typing — so its `BINDINGS` are reached normally, which is what makes F2/F4/Esc work while its Draft button rather than the text area holds focus. Priority bindings (F10 quit) are checked before forwarding and still work from inside a dialog.
92
+
93
+ In tests, the seam is `app.push_screen`: `_mock_app()` replaces it with a `MagicMock`, and `_DialogProbe` reads back the pushed screens and invokes the registered callback (`confirm()` / `cancel()`).
94
+
95
+ **Git reads run on thread workers:** every git call whose cost grows with the repo — `git status` + the per-submodule branch checks, `git log`, `git show`, and the per-file diff/content reads — runs on a `@work(thread=True, exclusive=True)` worker. Running one inline blocks Textual's event loop and freezes all input until the subprocess returns. Each read is a trio:
96
+
97
+ - a launcher on the UI thread (`_load_status`, `_load_commits`, `_load_commit_detail`, `_render_entry_into`) that captures any UI state it needs and calls `_new_request(group)`,
98
+ - a `_*_worker` that only fetches — it must not touch widgets or read app state,
99
+ - an `_apply_*` reached via `call_from_thread` that only renders.
100
+
101
+ `exclusive=True` cancels a superseded worker's asyncio task, but a *thread* worker keeps running to completion, so two results for one group can arrive in either order. Every `_apply_*` therefore drops results whose serial fails `_is_current_request()`. Because the reload is asynchronous, anything that has to happen *after* it must be passed into the launcher (`_load_status(restore=..., refocus=..., clear_diff=...)`) rather than sequenced at the call site.
102
+
103
+ Submodule branch mismatches are cached in `_submodule_mismatches` by the status worker; `_update_submodule_warnings()` renders from that cache so resize-driven re-renders never shell out.
104
+
105
+ Write operations (`stage_entry`, `restore_file`, `delete_file`, `commit_with_selection`, …) still run inline on the UI thread.
106
+
107
+ **Quitting during a read:** F10 goes through `action_quit`, which calls `GIT.shutdown()` before `exit()`. A thread worker can only be waited for — Textual joins its worker threads during shutdown — so a quit pressed while the startup `git status` / `git log` are still running registered fine and then changed nothing until git returned, which on a large repo is seconds of an app that looks like it ignored the key (and then exits on what feels like the fifth press). `shutdown()` terminates the git processes in flight and makes every later call return the failure shape without spawning one; refusing the next call is the half that matters, because a read is several git commands in a row (`load_status` walks the submodules) and killing only the running one hands the worker straight on to the next. It is what `_run_in()` uses `Popen` + `communicate()` for instead of `subprocess.run()`, and the spawn happens under the same lock the shutdown takes, so a process can't be born into the gap between the flag going up and the set being read. A pull or push in flight is the exception: `action_quit` leaves it alone and waits, because it is a write with half of itself on the wire and the user asked to close the app rather than to cancel the command.
108
+
109
+ In tests, the seam for the reads is `run_worker` / `call_from_thread`: `_mock_app()` collapses both to a direct call so the worker body and its UI callback run inline, keeping the synchronous call/assert shape. `_install_textual_stubs()` stubs `textual.work` with the same `self.run_worker(partial(...), **kwargs)` shape so both paths behave alike.
110
+
111
+ **Diff rendering:** `FileDiff.show()` parses unified-diff hunk headers (`@@ -a,b +c,d @@`) to track old/new line numbers and renders each line with a left-side line-number gutter, coloring `+`/`-` lines green/red and stripping the `diff`/`index`/`---`/`+++` headers. `render_commit_detail()` does the same for `git show` output in `CommitDetail` — commit header block and per-file headers bold, hunk markers colored, diffstat graph and patch body colored `+`/`-`, no gutter (the text spans several files). Both take their colors from `_diff_line_styles()` so the two views can't drift apart.
112
+
113
+ Colors come from the theme, never from git: `GIT._run_in()` invokes `git -c color.ui=false` and strips any SGR escapes that a per-command `color.diff = always` still forces through, because the widgets render git's stdout literally.
114
+
115
+ ## Linting & type-checking
116
+
117
+ After editing any `.py` file, run both tools on the changed file(s) and fix anything they report before considering the task done:
118
+
119
+ ```sh
120
+ hatch run ruff check <file> # lint
121
+ hatch run ruff format <file> # format in place (no --check)
122
+ hatch run pyright <file> # type-check
123
+ ```
124
+
125
+ A `PostToolUse` hook (`.claude/hooks/lint-python.sh`, wired in `.claude/settings.json`) runs these automatically on every `Write`/`Edit` of a `.py` file and blocks the turn with the diagnostics if anything fails. The hook shells the tools out of `.venv/bin/` directly rather than through Hatch, so `.venv` must exist with the `dev` extra installed. When the block fires, fix the reported issues and re-edit — don't just retry the same edit. Use `hatch run ruff check --fix` and `hatch run ruff format` (without `--check`) to apply automatic fixes; address pyright errors manually.
126
+
127
+ ## Conventions
128
+
129
+ - All git access goes through `GIT` in `gitnc/git.py`. Don't shell out to `git` from `app.py` or `terminal.py` — extend `GIT` instead. `run_commit_draft()` and `run_commit_editor()` are the only subprocesses `app.py` runs itself, and they deliberately aren't git: the drafting tool and the editor are whatever the user named.
130
+ - Styling lives inline as `DEFAULT_CSS` on each widget class plus the app-level `CSS` on `GitNightCommanderApp`. There is no external `.tcss` file.
131
+ - The `F5` key and the File→Refresh menu entry both map to `action_refresh`, which reloads whichever view is currently active.
132
+ - `SHORTCUTS` holds one primary key per action — the one the footer, the menu hint column and the README advertise. A second key for an action goes in `SHORTCUT_ALIASES` (`(key, action)`), which appends a `show=False` binding: the footer keys off the binding rather than the action, so a shown alias would print its action's description twice. Aliases stay out of `MENU_HINTS_BY_ACTION` (one key fits the column) and are folded into the key column of `HELP_SHORTCUTS`, which is what the Help→Keys dialog lists. Three actions carry both today: delete, `F8` because that is where every TUI file manager has put it and `Del` because desktop keyboards have that key; commit, `c` plus `F2`, the key that submits the message from inside `CommitDialog`, so one key opens the flow and closes it; and quit, `F10` plus `q`. The last is there because F10 is not the app's to rely on — a terminal emulator can keep it (VS Code's integrated terminal gives it to the debugger's Step Over and never forwards it), and a key the app never receives is indistinguishable from an app ignoring it. The alias is deliberately not priority, unlike the `F10` binding: priority bindings are checked before the key reaches a modal, so a priority `q` would quit the app out from under someone typing a commit message.
133
+ - The key a new action gets follows what the action is about. Function keys are the file-manager verbs this lineage has always put on that row — `F3` view, `F5` refresh, `F7`/`F8` restore and delete — plus the chrome (`F1` help, `F9` menu, `F10` quit). Bare letters are the git verbs: `s`/`u` stage and unstage, `c` commit, `p`/`P` pull and push, `z`/`Z` stash and pop — plus `f`, the file-list filter, which is a view toggle rather than a git verb but has no function key in this lineage to borrow. Within a letter pair shift is the counterpart, so a pair costs one letter rather than two. New keys default to `show=False`: the footer already runs past 80 columns with the eleven it shows, and the menus plus Help→Keys are where the rest are advertised.
134
+ - Function keys read `F8`, never `f8`, and shift+letter reads `Shift+P`, never `P` — Textual names the first in lower case and the second as the bare uppercase letter, one cell from its lowercase partner. `_shortcut_key_display()` fixes both for the two places that would otherwise show the raw name: the footer, via each binding's `key_display`, and the key column of `HELP_SHORTCUTS`. It returns `None` for everything else, which leaves Textual's own display alone — `^o` for `ctrl+o` reads better than a spelled-out modifier. The menu hint column doesn't go through it but through `_format_shortcut_key()`, which upper-cases every key it renders and spells shifted letters out the same way (`_is_shifted_letter()` is what both consult).
135
+ - To add a nested menu, append a `Submenu(...)` to `SUBMENUS` in `app.py` and point the parent menu's entry at `SUBMENUS_BY_NAME["<name>"].action`. That is all of it — the dropdown widget, the opener action, and the `▶` marker all follow from the registry entry. Don't hand-write a `dropdown_*` widget, a per-submenu `action_open_*_menu`, or an arrow inside a label: labels are padded before the hint column is appended, so a typed-in arrow would widen the entry and push the column out of line.
gitnc-0.1.2/LICENSE ADDED
@@ -0,0 +1,232 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+
6
+ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for software and other kinds of works.
11
+
12
+ The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
13
+
14
+ When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
15
+
16
+ To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
17
+
18
+ For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
19
+
20
+ Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
21
+
22
+ For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
23
+
24
+ Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
25
+
26
+ Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
27
+
28
+ The precise terms and conditions for copying, distribution and modification follow.
29
+
30
+ TERMS AND CONDITIONS
31
+
32
+ 0. Definitions.
33
+
34
+ “This License” refers to version 3 of the GNU General Public License.
35
+
36
+ “Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
37
+
38
+ “The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
39
+
40
+ To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
41
+
42
+ A “covered work” means either the unmodified Program or a work based on the Program.
43
+
44
+ To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
45
+
46
+ To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
47
+
48
+ An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
49
+
50
+ 1. Source Code.
51
+ The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
52
+
53
+ A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
54
+
55
+ The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
56
+
57
+ The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
58
+
59
+ The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
60
+
61
+ The Corresponding Source for a work in source code form is that same work.
62
+
63
+ 2. Basic Permissions.
64
+ All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
65
+
66
+ You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
67
+
68
+ Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
69
+
70
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
71
+ No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
72
+
73
+ When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
74
+
75
+ 4. Conveying Verbatim Copies.
76
+ You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
77
+
78
+ You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
79
+
80
+ 5. Conveying Modified Source Versions.
81
+ You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
82
+
83
+ a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
84
+
85
+ b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
86
+
87
+ c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
88
+
89
+ d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
90
+
91
+ A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
92
+
93
+ 6. Conveying Non-Source Forms.
94
+ You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
95
+
96
+ a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
97
+
98
+ b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
99
+
100
+ c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
101
+
102
+ d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
103
+
104
+ e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
105
+
106
+ A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
107
+
108
+ A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
109
+
110
+ “Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
111
+
112
+ If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
113
+
114
+ The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
115
+
116
+ Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
117
+
118
+ 7. Additional Terms.
119
+ “Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
120
+
121
+ When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
122
+
123
+ Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
124
+
125
+ a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
126
+
127
+ b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
128
+
129
+ c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
130
+
131
+ d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
132
+
133
+ e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
134
+
135
+ f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
136
+
137
+ All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
138
+
139
+ If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
140
+
141
+ Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
142
+
143
+ 8. Termination.
144
+ You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
145
+
146
+ However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
147
+
148
+ Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
149
+
150
+ Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
151
+
152
+ 9. Acceptance Not Required for Having Copies.
153
+ You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
154
+
155
+ 10. Automatic Licensing of Downstream Recipients.
156
+ Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
157
+
158
+ An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
159
+
160
+ You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
161
+
162
+ 11. Patents.
163
+ A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
164
+
165
+ A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
166
+
167
+ Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
168
+
169
+ In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
170
+
171
+ If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
172
+
173
+ If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
174
+
175
+ A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
176
+
177
+ Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
178
+
179
+ 12. No Surrender of Others' Freedom.
180
+ If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
181
+
182
+ 13. Use with the GNU Affero General Public License.
183
+ Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
184
+
185
+ 14. Revised Versions of this License.
186
+ The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
187
+
188
+ Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
189
+
190
+ If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
191
+
192
+ Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
193
+
194
+ 15. Disclaimer of Warranty.
195
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
196
+
197
+ 16. Limitation of Liability.
198
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
199
+
200
+ 17. Interpretation of Sections 15 and 16.
201
+ If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
202
+
203
+ END OF TERMS AND CONDITIONS
204
+
205
+ How to Apply These Terms to Your New Programs
206
+
207
+ If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
208
+
209
+ To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
210
+
211
+ GitNightCommander
212
+ Copyright (C) 2026 thomashyldgaard
213
+
214
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
215
+
216
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
217
+
218
+ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
219
+
220
+ Also add information on how to contact you by electronic and paper mail.
221
+
222
+ If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
223
+
224
+ GitNightCommander Copyright (C) 2026 thomashyldgaard
225
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
226
+ This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
227
+
228
+ The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
229
+
230
+ You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
231
+
232
+ The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
gitnc-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.5
2
+ Name: gitnc
3
+ Version: 0.1.2
4
+ Summary: GitNightCommander — a TUI git log browser built with Textual
5
+ Project-URL: Homepage, https://github.com/thomashyldgaard/GitNightCommander
6
+ Project-URL: Source, https://github.com/thomashyldgaard/GitNightCommander
7
+ Project-URL: Issues, https://github.com/thomashyldgaard/GitNightCommander/issues
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.12
10
+ Requires-Dist: pyyaml>=6.0
11
+ Requires-Dist: textual>=0.80.0
12
+ Provides-Extra: dev
13
+ Requires-Dist: pyright>=1.1.380; extra == 'dev'
14
+ Requires-Dist: ruff>=0.6.0; extra == 'dev'