80 lines
2.3 KiB
Markdown
80 lines
2.3 KiB
Markdown
Create a workspace management tool.
|
|
|
|
I want a cli written to manage workspaces in a directory
|
|
|
|
cli features
|
|
|
|
* list workspaces
|
|
* workspace name
|
|
* workspace description (read from the readme, everything after the h1 title)
|
|
* included repos, with ascii/int ahead/behind/dirty indicators
|
|
* add repos to a workspace (default workspace to current workspace)
|
|
* use iterfzf to pick repo
|
|
* list all directories in repos_dir as a repo
|
|
* checkout a worktree on branch with the name of the workspace into the
|
|
workspace with the repo_name
|
|
* list repos and branch on a current workspace
|
|
* repo name (should also be directory name)
|
|
* use ascii/int ahead/behind/dirty indicators for git status
|
|
* create new workspace
|
|
* ask for a name and description
|
|
* name will be the directory name
|
|
* make a readme with format `# <name>\n\n<description>`
|
|
|
|
|
|
configuration
|
|
|
|
* get workspaces_name from flag / settings / environment variable / default
|
|
WORKSPACES_DIR
|
|
* workspaces_name defaults to git
|
|
* repos_dir = ~/workspaces_name
|
|
* workspaces_dir = ~/workspaces_name + ".workspaces"
|
|
* workspaces will be two sibling directories,
|
|
* allow me to specify the workspaces name ex: work, personal, git, with a
|
|
flag to any command, fallback to env WORKSPACES_DIR, fallback to default
|
|
* repos_dir with all repos I work on, I will keep it clean default to ~/git
|
|
* workspaces_dir that I do work from that contains the workspace and a
|
|
collection of worktrees checked out from the repo in the repos_dir default
|
|
to ~/git.workspaces
|
|
|
|
fuzzy picker
|
|
|
|
* iterfzf is a python library that comes with fzf for fuzzy picking things
|
|
``` python
|
|
from iterfzf import iterfzf
|
|
metadata = { "key": "value" }
|
|
tables = metadata.tables.keys()
|
|
table_name = iterfzf(tables, prompt="pick a table")
|
|
```
|
|
|
|
directory layout
|
|
|
|
repos_dir
|
|
repo1
|
|
repo2
|
|
repo3
|
|
...
|
|
workspaces_dir
|
|
workspace1
|
|
readme.md
|
|
repo1 (worktree)
|
|
repo2 (worktree)
|
|
workspace2
|
|
readme.md
|
|
repo2 (worktree)
|
|
repo3 (worktree)
|
|
...
|
|
|
|
use the format for uv scripts as shown below. use typer for the cli, rich
|
|
console and rich table for cli output, pydantic-settings for settings.
|
|
|
|
#!/usr/bin/env -S uv run --quiet --script
|
|
# /// script
|
|
# requires-python = ">=3.12"
|
|
# dependencies = [
|
|
# "typer",
|
|
# "rich",
|
|
# "pydantic",
|
|
# "pydantic-settings",
|
|
# ]
|
|
# ///
|