1 Commits

Author SHA1 Message Date
6e38a7dbad fix(deps): update all dependencies
Some checks failed
renovate/artifacts Artifact file update failure
2026-03-21 01:34:56 +00:00
8 changed files with 16 additions and 296 deletions

View File

@@ -11,7 +11,7 @@ jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0

View File

@@ -46,19 +46,15 @@ release:
name_template: "v{{ .Version }}" name_template: "v{{ .Version }}"
mode: keep-existing mode: keep-existing
brews: homebrew_casks:
- name: gitnow - name: gitnow
binaries:
- gitnow
repository: repository:
owner: kjuulh owner: kjuulh
name: homebrew-tap name: homebrew-tap
token: "{{ .Env.RELEASE_TOKEN }}" token: "{{ .Env.RELEASE_TOKEN }}"
directory: Formula url:
url_template: "https://git.kjuulh.io/kjuulh/gitnow/releases/download/{{ .Tag }}/{{ .ArtifactName }}" template: "https://git.kjuulh.io/kjuulh/gitnow/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
homepage: "https://gitnow-client.prod.kjuulh.app" homepage: "https://gitnow-client.prod.kjuulh.app"
description: "Git Now is a utility for easily navigating git projects from common upstream providers." description: "Git Now is a utility for easily navigating git projects from common upstream providers."
install: |
bin.install "gitnow"
caveats: |
To enable shell integration, add this to your .zshrc:
eval "$(gitnow init zsh)"

View File

@@ -30,7 +30,7 @@ cargo binstall gitnow
gitnow gitnow
# Or install gitnow scripts (in your .bashrc, .zshrc) this will use native shell commands to move you around # Or install gitnow scripts (in your .bashrc, .zshrc) this will use native shell commands to move you around
eval "$(gitnow init zsh)" eval $(gitnow init zsh)
git-now # Long git-now # Long
gn # Short alias gn # Short alias
``` ```
@@ -165,7 +165,7 @@ Commands that navigate to a directory (`gitnow`, `gitnow project`, `gitnow proje
The recommended way to use gitnow is with shell integration, which uses a **chooser file** to communicate the selected path back to your shell: The recommended way to use gitnow is with shell integration, which uses a **chooser file** to communicate the selected path back to your shell:
```bash ```bash
eval "$(gitnow init zsh)" eval $(gitnow init zsh)
git-now # or gn git-now # or gn
``` ```

View File

@@ -22,17 +22,17 @@ dotenvy.workspace = true
serde = { version = "1.0.197", features = ["derive"] } serde = { version = "1.0.197", features = ["derive"] }
uuid = { version = "1.7.0", features = ["v4"] } uuid = { version = "1.7.0", features = ["v4"] }
async-trait = "0.1.82" async-trait = "0.1.82"
toml = "0.8.19" toml = "1.0.0"
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-webpki-roots", "json"] } reqwest = { version = "0.13", default-features = false, features = ["rustls-tls-webpki-roots", "json"] }
url = "2.5.2" url = "2.5.2"
dirs = "6.0.0" dirs = "6.0.0"
prost = "0.13.2" prost = "0.13.2"
prost-types = "0.13.2" prost-types = "0.13.2"
bytes = "1.7.1" bytes = "1.7.1"
nucleo-matcher = "0.3.1" nucleo-matcher = "0.3.1"
ratatui = { version = "0.29.0", features = ["termwiz"] } ratatui = { version = "0.30.0", features = ["termwiz"] }
crossterm = { version = "0.28.0", features = ["event-stream"] } crossterm = { version = "0.29.0", features = ["event-stream"] }
futures = "0.3.30" futures = "0.3.30"
termwiz = "0.23.0" termwiz = "0.23.0"
regex = "1.11.1" regex = "1.11.1"

View File

@@ -1,7 +1,6 @@
pub mod project; pub mod project;
pub mod root; pub mod root;
pub mod shell; pub mod shell;
pub mod skill;
pub mod update; pub mod update;
pub mod worktree; pub mod worktree;
pub mod clone { pub mod clone {

View File

@@ -1,264 +0,0 @@
/// The `skill` subcommand outputs a comprehensive, LLM-readable description of
/// everything gitnow can do — commands, flags, configuration, and workflows.
#[derive(clap::Parser)]
pub struct SkillCommand {}
impl SkillCommand {
pub async fn execute(&self) -> anyhow::Result<()> {
print!("{}", SKILL_TEXT);
Ok(())
}
}
const SKILL_TEXT: &str = r#"# gitnow — Navigate git projects at the speed of thought
gitnow is a CLI tool for discovering, cloning, and navigating git repositories
from multiple providers (GitHub, Gitea). It maintains a local cache of known
repositories and provides fuzzy-search, interactive selection, worktree
management, and scratch-pad project workspaces.
## Quick reference
```
gitnow [OPTIONS] [SEARCH] # search/clone/open a repository
gitnow update # refresh the local repository cache
gitnow clone --search <REGEX> # batch-clone repositories matching a pattern
gitnow worktree [SEARCH] [OPTIONS] # create and enter a git worktree for a branch
gitnow project [SEARCH] [OPTIONS] # open an existing scratch-pad project
gitnow project create [NAME] # create a new multi-repo project
gitnow project add [NAME] # add repositories to a project
gitnow project delete [NAME] # delete a project
gitnow init zsh # print zsh shell integration script
gitnow skill # print this reference (you are here)
```
## Commands in detail
### Default (no subcommand)
```
gitnow [OPTIONS] [SEARCH]
```
Search for a repository, optionally clone it, and open a shell inside it.
- If SEARCH is provided, fuzzy-matches against cached repositories.
- If omitted, opens an interactive fuzzy-search picker.
- Clones the repository if it does not exist locally.
- Spawns a sub-shell in the repository directory.
**Flags:**
| Flag | Description |
|-----------------------|----------------------------------------------------------|
| `--no-cache` | Skip reading from the local cache; fetch fresh data |
| `--no-clone` | Do not clone the repository if it is missing locally |
| `--no-shell` | Print the path instead of spawning a shell |
| `--force-refresh` | Force a fresh clone even if the repo already exists |
| `--force-cache-update`| Update the cache before searching |
| `--chooser-file PATH` | Write selected path to this file (implies --no-shell) |
| `-c, --config PATH` | Path to config file (global flag) |
**Environment variables:**
- `GITNOW_CONFIG` — path to config file (overrides default)
- `GITNOW_CHOOSER_FILE` — equivalent to `--chooser-file`
---
### `gitnow update`
Fetch all repositories from configured providers and update the local cache.
Should be run periodically or after adding new providers/organisations.
No flags.
---
### `gitnow clone --search <REGEX>`
Batch-clone all repositories whose relative path matches the given regex.
Clones up to 5 repositories concurrently. Skips repos that already exist locally.
**Required flags:**
| Flag | Description |
|--------------------|--------------------------------------------|
| `--search <REGEX>` | Regular expression to match repository paths |
---
### `gitnow worktree [SEARCH] [OPTIONS]`
Create a git worktree for a specific branch of a repository. This is useful for
working on multiple branches simultaneously without switching.
**Workflow:**
1. Select a repository (fuzzy search or interactive picker)
2. Bare-clone the repository if not already present
3. List remote branches
4. Select a branch (interactive picker, or `--branch`)
5. Create a worktree directory at `<project>/<sanitized-branch>/`
6. Spawn a shell in the worktree (or write path to chooser file)
**Flags:**
| Flag | Description |
|-------------------|------------------------------------------------|
| `[SEARCH]` | Optional search string to pre-filter repos |
| `-b, --branch` | Branch name (skips interactive branch picker) |
| `--no-cache` | Skip the local cache |
| `--no-shell` | Print path instead of spawning a shell |
---
### `gitnow project [SEARCH] [OPTIONS]`
Manage scratch-pad projects — directories containing multiple cloned repositories,
optionally bootstrapped from a template.
When called without a subcommand, opens an existing project (interactive picker
or fuzzy match on SEARCH).
**Flags:**
| Flag | Description |
|--------------|------------------------------------------|
| `[SEARCH]` | Filter existing projects by name |
| `--no-shell` | Print path instead of spawning a shell |
#### `gitnow project create [NAME] [OPTIONS]`
Create a new project directory, interactively select repositories to clone into it,
and optionally apply a template.
| Flag | Description |
|---------------------|------------------------------------------------------|
| `[NAME]` | Project name (prompted if omitted) |
| `-t, --template` | Template name to bootstrap from |
| `--no-cache` | Skip local cache when listing repos |
| `--no-shell` | Print path instead of spawning a shell |
Templates live in `~/.gitnow/templates/` (or the configured directory). Each
subdirectory is a template; its contents are copied into the new project.
#### `gitnow project add [NAME] [OPTIONS]`
Add more repositories to an existing project.
| Flag | Description |
|--------------|------------------------------------------|
| `[NAME]` | Project name (interactive if omitted) |
| `--no-cache` | Skip local cache when listing repos |
#### `gitnow project delete [NAME] [OPTIONS]`
Delete a project directory.
| Flag | Description |
|---------------|--------------------------------------|
| `[NAME]` | Project name (interactive if omitted)|
| `-f, --force` | Skip confirmation prompt |
---
### `gitnow init zsh`
Print a zsh shell integration script to stdout. Typically used as:
```zsh
eval "$(gitnow init zsh)"
```
This provides a shell function that changes directory after gitnow exits,
using the chooser-file mechanism.
---
### `gitnow skill`
Print this LLM-readable reference document to stdout.
---
## Configuration
Config file location (in priority order):
1. `--config` / `-c` flag
2. `GITNOW_CONFIG` environment variable
3. `~/.config/gitnow/gitnow.toml`
### Config file format (TOML)
```toml
[settings]
# Where repositories are cloned to (default: ~/git)
projects = { directory = "~/git" }
# Custom clone command (minijinja template)
# Available variables: {{ ssh_url }}, {{ path }}
# Default: "git clone {{ ssh_url }} {{ path }}"
clone_command = "git clone {{ ssh_url }} {{ path }}"
# Commands to run after cloning a repository
post_clone_command = "echo 'cloned!'"
# or as a list:
# post_clone_command = ["cmd1", "cmd2"]
# Commands to run when opening an already-cloned repository
post_update_command = "git fetch --prune"
[settings.cache]
# Where the cache is stored (default: ~/.cache/gitnow)
location = "~/.cache/gitnow"
# Cache duration (default: 7 days). Set to false to disable.
duration = { days = 7, hours = 0, minutes = 0 }
[settings.worktree]
# Custom worktree commands (minijinja templates)
clone_command = "git clone --bare {{ ssh_url }} {{ bare_path }}"
add_command = "git -C {{ bare_path }} worktree add {{ worktree_path }} {{ branch }}"
list_branches_command = "git -C {{ bare_path }} branch -r --format=%(refname:short)"
[settings.project]
# Where scratch-pad projects are stored (default: ~/.gitnow/projects)
directory = "~/.gitnow/projects"
# Where project templates live (default: ~/.gitnow/templates)
templates_directory = "~/.gitnow/templates"
# --- Providers ---
[[providers.github]]
access_token = "ghp_..." # or { env = "GITHUB_TOKEN" }
current_user = "your-username" # optional, for user-specific repos
users = ["user1"] # fetch repos for these users
organisations = ["org1", "org2"] # fetch repos for these orgs
url = "https://api.github.com" # optional, for GitHub Enterprise
[[providers.gitea]]
url = "https://gitea.example.com/api/v1"
access_token = "token" # or { env = "GITEA_TOKEN" }
current_user = "your-username"
users = ["user1"]
organisations = ["org1"]
```
Multiple provider entries are supported — gitnow aggregates repositories from all of them.
## Typical workflows
### First-time setup
1. Create `~/.config/gitnow/gitnow.toml` with at least one provider
2. Run `gitnow update` to populate the cache
3. Run `gitnow` to interactively search and clone a repo
### Daily use
- `gitnow <partial-name>` — jump to a repo by fuzzy name
- `gitnow worktree <repo> -b feature-x` — start work on a branch in a worktree
- `gitnow project create my-feature` — set up a multi-repo workspace
### Shell integration (zsh)
Add to `.zshrc`:
```zsh
eval "$(gitnow init zsh)"
```
This wraps gitnow so that selecting a repository changes your current shell's
working directory (instead of spawning a sub-shell).
"#;

View File

@@ -3,8 +3,8 @@ use std::path::PathBuf;
use anyhow::Context; use anyhow::Context;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use commands::{ use commands::{
clone::CloneCommand, project::ProjectCommand, root::RootCommand, shell::Shell, clone::CloneCommand, project::ProjectCommand, root::RootCommand, shell::Shell, update::Update,
skill::SkillCommand, update::Update, worktree::WorktreeCommand, worktree::WorktreeCommand,
}; };
use config::Config; use config::Config;
use tracing::level_filters::LevelFilter; use tracing::level_filters::LevelFilter;
@@ -29,13 +29,7 @@ mod template_command;
mod worktree; mod worktree;
#[derive(Parser)] #[derive(Parser)]
#[command( #[command(author, version, about, long_about = Some("Navigate git projects at the speed of thought"))]
author,
version,
about,
long_about = Some("Navigate git projects at the speed of thought"),
after_help = "TIP: LLM/AI agents should run `gitnow skill` for a complete machine-readable reference."
)]
struct Command { struct Command {
#[command(subcommand)] #[command(subcommand)]
command: Option<Commands>, command: Option<Commands>,
@@ -77,8 +71,6 @@ enum Commands {
Worktree(WorktreeCommand), Worktree(WorktreeCommand),
/// Manage scratch-pad projects with multiple repositories /// Manage scratch-pad projects with multiple repositories
Project(ProjectCommand), Project(ProjectCommand),
/// Print an LLM-readable reference of all gitnow capabilities
Skill(SkillCommand),
} }
const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml"; const DEFAULT_CONFIG_PATH: &str = ".config/gitnow/gitnow.toml";
@@ -139,9 +131,6 @@ async fn main() -> anyhow::Result<()> {
Commands::Project(mut project) => { Commands::Project(mut project) => {
project.execute(app, &chooser).await?; project.execute(app, &chooser).await?;
} }
Commands::Skill(skill) => {
skill.execute().await?;
}
}, },
None => { None => {
RootCommand::new(app) RootCommand::new(app)

View File

@@ -1,5 +1,5 @@
[tools] [tools]
rust = "1.93" rust = "1.94.0"
goreleaser = "latest" goreleaser = "latest"
zig = "latest" zig = "latest"
"cargo:cargo-zigbuild" = "latest" "cargo:cargo-zigbuild" = "latest"