Skip to content
Open

Pi #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ tags*
.tags*
tmp
*.sw*

# pi — runtime state, never commit
configs/pi/auth.json
configs/pi/trust.json
configs/pi/sessions
configs/pi/npm
configs/pi/git
configs/pi/models-store.json
configs/pi/mcp-cache.json
Makefile.bak-*
31 changes: 30 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Default to this repository's location while allowing an explicit override.
DOTFILES ?= $(abspath $(dir $(lastword $(MAKEFILE_LIST))))

# Help command to see all available things.
help:
@echo "Available commands:"
Expand All @@ -10,7 +13,7 @@ msg:
echo "Already installed."

.PHONY: install # Symlinks all the configuration files
install: bash brew git vim
install: bash brew git vim pi

## DISABLED COMMANDS
# code_complete ctags
Expand Down Expand Up @@ -57,3 +60,29 @@ vim:

# Install vim plugins
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim || make msg


# Pi coding agent configuration
PI_SHA := ac4ac9eaf69f2b01ca3af984a5c48f3b99b84278
PI_REPO := https://github.com/earendil-works/pi.git
PI_CONFIG := $(DOTFILES)/configs/pi
PI_SCRIPT := $(DOTFILES)/scripts/pi-config.sh
PI_ENV := PI_SHA="$(PI_SHA)" PI_REPO="$(PI_REPO)" PI_CONFIG="$(PI_CONFIG)"

.PHONY: pi # Install pi and link the portable configuration
pi: pi_check
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
@$(PI_ENV) "$(PI_SCRIPT)" install
@echo "Pi is installed. Run 'pi' to configure this machine."

.PHONY: pi_check # Verify tracked pi configuration is portable and runtime-state-free
pi_check:
@$(PI_ENV) "$(PI_SCRIPT)" check

.PHONY: pi_verify # Verify the managed checkout and installed links
pi_verify:
@$(PI_ENV) "$(PI_SCRIPT)" verify

.PHONY: pi_unlink # Remove only symlinks managed by make pi
pi_unlink:
@$(PI_ENV) "$(PI_SCRIPT)" unlink
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,54 @@

- [Install Iterm 2](https://iterm2.com/downloads/stable/latest)
- Install Brew

```sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

- Export variables
```

```sh
CODE_PATH=~/Code
DOTFILES=$CODE_PATH/dotfiles
```
- Install Vim Plugins, by running `vim` and `:PlugInstall` - https://github.com/junegunn/vim-plug

- Install Vim Plugins, by running `vim` and `:PlugInstall` - <https://github.com/junegunn/vim-plug>

## Pi coding agent

Install pi and this repository's portable configuration with:

```sh
make pi
```

The command is safe to run repeatedly. It installs the coding agent, maintains a
sparse checkout of [`earendil-works/pi`](https://github.com/earendil-works/pi)
at a pinned revision under `~/.pi/src/pi`, and links the selected upstream and
custom extensions into `~/.pi/agent/extensions/`.

Machine-local runtime state is not copied or linked by this repository. Complete
any required setup through pi itself after installation.

Useful checks and cleanup commands:

```sh
make pi_check # validate the tracked configuration
make pi_verify # verify the installed checkout and links
make pi_unlink # remove only links managed by make pi
```

## Brew Packages

- ag
- bash-completion
- git
- tree
- wget

## Vim Plugins

- [vim-plug](https://github.com/junegunn/vim-plug)
- [ale](https://github.com/w0rp/ale)
- [ag](https://github.com/rking/ag.vim)
Expand Down
47 changes: 36 additions & 11 deletions configs/bash/.bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,62 @@ if [ ! -f ~/.git-completion.bash ]; then
fi

# Set the git branch color based on status
# set_git_prompt() {
# local branch=$(git branch --show-current 2>/dev/null)
#
# if [ -n "$branch" ]; then
# local git_status="$(git status --porcelain 2>/dev/null)"
# local color="32" # Default green
#
# if [ -n "$git_status" ]; then
# if git status 2>/dev/null | grep -q "Changes to be committed"; then
# color="33" # Yellow (staged)
# else
# color="31" # Red (unstaged)
# fi
# elif git status 2>/dev/null | grep -q "Your branch is ahead"; then
# color="36" # Cyan (ahead)
# fi
#
# # Store just the color code and branch name
# GIT_COLOR="$color"
# GIT_BRANCH="$branch"
# else
# GIT_COLOR=""
# GIT_BRANCH=""
# fi
# }

set_git_prompt() {
local branch=$(git branch --show-current 2>/dev/null)
local git_part=""

if [ -n "$branch" ]; then
local git_status="$(git status --porcelain 2>/dev/null)"
local color="32" # Default green
local color="32"

if [ -n "$git_status" ]; then
if git status 2>/dev/null | grep -q "Changes to be committed"; then
color="33" # Yellow (staged)
color="33"
else
color="31" # Red (unstaged)
color="31"
fi
elif git status 2>/dev/null | grep -q "Your branch is ahead"; then
color="36" # Cyan (ahead)
color="36"
fi

# Store just the color code and branch name
GIT_COLOR="$color"
GIT_BRANCH="$branch"
else
GIT_COLOR=""
GIT_BRANCH=""
git_part="(\001\033[1;${color}m\002${branch} ⛙\001\033[0m\002)"
fi

PS1="\001\033[4;1;${PROMPT_COLOR}m\002\w\001\033[0m\002${git_part}\$ "
}

# Update prompt before each command
PROMPT_COMMAND=set_git_prompt

# Build PS1 with proper escaping done at PS1 evaluation time
export PS1='\[\033[4;1;${PROMPT_COLOR}m\]\w\[\033[0m\]${GIT_BRANCH:+(}\[\033[1;${GIT_COLOR}m\]${GIT_BRANCH} ⛙\[\033[0m\]${GIT_BRANCH:+)}$ '
export PS1='\[\033[4;1;${PROMPT_COLOR}m\]\w\[\033[0m\]${GIT_BRANCH:+(\[\033[1;${GIT_COLOR}m\]${GIT_BRANCH} ⛙\[\033[0m\])}$ '
# export PS1='\[\033[4;1;${PROMPT_COLOR}m\]\w\[\033[0m\]${GIT_BRANCH:+(}\[\033[1;${GIT_COLOR}m\]${GIT_BRANCH} ⛙\[\033[0m\]${GIT_BRANCH:+)}$ '

######################################
# Aliases #
Expand Down
7 changes: 6 additions & 1 deletion configs/nvim/lua/keymaps.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- Keymaps (matching your vimrc workflow)

-- Command typo fixes
-- ============================================
-- Typos
-- ============================================
vim.cmd([[
cnoreabbrev W w
cnoreabbrev Q q
Expand All @@ -10,6 +12,9 @@ vim.cmd([[
cnoreabbrev Bd bd
]])

vim.keymap.set("n", ":w'", ":w")
vim.keymap.set("n", ":W'", ":w")

-- Helper function
local function map(mode, lhs, rhs, desc)
vim.keymap.set(mode, lhs, rhs, { noremap = true, silent = true, desc = desc })
Expand Down
6 changes: 6 additions & 0 deletions configs/nvim/lua/lsp-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ vim.lsp.config("pyright", {
},
})

vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
vim.diagnostic.open_float(nil, { focus = false })
end,
})

-- Enable servers (only if command exists)
local servers = {
{ name = "ts_ls", cmd = "typescript-language-server" },
Expand Down
16 changes: 8 additions & 8 deletions configs/nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ require("lazy").setup({
formatters_by_ft = {
["_"] = { "trim_whitespace", "trim_newlines" },
python = { "ruff_organize_imports", "ruff_format" },
javascript = { "prettier" },
javascriptreact = { "prettier" },
typescript = { "prettier" },
typescriptreact = { "prettier" },
css = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
javascript = { "oxfmt" },
javascriptreact = { "oxfmt" },
typescript = { "oxfmt" },
typescriptreact = { "oxfmt" },
css = { "oxfmt" },
json = { "oxfmt" },
yaml = { "oxfmt" },
markdown = { "oxfmt" },
},
format_on_save = true,
})
Expand Down
Loading