diff --git a/flake.lock b/flake.lock index bd65dca..3fd8206 100644 --- a/flake.lock +++ b/flake.lock @@ -864,6 +864,23 @@ "type": "github" } }, + "pi-mcp-adapter": { + "flake": false, + "locked": { + "lastModified": 1773642170, + "narHash": "sha256-E6Kf+OyTN/pF8pKADJO0B1+buAPqNcXnZl9ssZwSP8U=", + "owner": "nicobailon", + "repo": "pi-mcp-adapter", + "rev": "01ba9a4e86bd16d895db319b913d73754a473acb", + "type": "github" + }, + "original": { + "owner": "nicobailon", + "ref": "v2.2.0", + "repo": "pi-mcp-adapter", + "type": "github" + } + }, "pi-rose-pine": { "flake": false, "locked": { @@ -928,6 +945,7 @@ "pi-agent-stuff": "pi-agent-stuff", "pi-elixir": "pi-elixir", "pi-harness": "pi-harness", + "pi-mcp-adapter": "pi-mcp-adapter", "pi-rose-pine": "pi-rose-pine", "sops-nix": "sops-nix", "zjstatus": "zjstatus" diff --git a/flake.nix b/flake.nix index 7116e81..9ffd50e 100644 --- a/flake.nix +++ b/flake.nix @@ -80,6 +80,10 @@ url = "github:aliou/pi-harness"; flake = false; }; + pi-mcp-adapter = { + url = "github:nicobailon/pi-mcp-adapter/v2.2.0"; + flake = false; + }; pi-rose-pine = { url = "github:zenobi-us/pi-rose-pine"; flake = false; diff --git a/modules/_ai-tools/no-git.ts b/modules/_ai-tools/extensions/no-git.ts similarity index 100% rename from modules/_ai-tools/no-git.ts rename to modules/_ai-tools/extensions/no-git.ts diff --git a/modules/_ai-tools/no-scripting.ts b/modules/_ai-tools/extensions/no-scripting.ts similarity index 71% rename from modules/_ai-tools/no-scripting.ts rename to modules/_ai-tools/extensions/no-scripting.ts index 6deb5aa..79b6c1f 100644 --- a/modules/_ai-tools/no-scripting.ts +++ b/modules/_ai-tools/extensions/no-scripting.ts @@ -1,7 +1,7 @@ /** * No Scripting Extension * - * Blocks python, perl, ruby, php, lua, and inline bash/sh scripts. + * Blocks python, perl, ruby, php, lua, node -e, and inline bash/sh scripts. * Tells the LLM to use `nu -c` instead. */ @@ -9,7 +9,7 @@ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent"; import { isToolCallEventType } from "@mariozechner/pi-coding-agent"; const SCRIPTING_PATTERN = - /(?:^|[;&|]\s*|&&\s*|\|\|\s*|\$\(\s*|`\s*)(?:python[23]?|perl|ruby|php|lua|bash\s+-c|sh\s+-c)\s/; + /(?:^|[;&|]\s*|&&\s*|\|\|\s*|\$\(\s*|`\s*)(?:python[23]?|perl|ruby|php|lua|node\s+-e|bash\s+-c|sh\s+-c)\s/; export default function (pi: ExtensionAPI) { pi.on("tool_call", async (event, _ctx) => { @@ -21,7 +21,7 @@ export default function (pi: ExtensionAPI) { return { block: true, reason: - "Do not use python, perl, ruby, php, lua, or inline bash/sh for scripting. Use `nu -c` instead.", + "Do not use python, perl, ruby, php, lua, node -e, or inline bash/sh for scripting. Use `nu -c` instead.", }; } }); diff --git a/modules/_ai-tools/review.ts b/modules/_ai-tools/extensions/review.ts similarity index 100% rename from modules/_ai-tools/review.ts rename to modules/_ai-tools/extensions/review.ts diff --git a/modules/_ai-tools/session-name.ts b/modules/_ai-tools/extensions/session-name.ts similarity index 100% rename from modules/_ai-tools/session-name.ts rename to modules/_ai-tools/extensions/session-name.ts diff --git a/modules/_ai-tools/mcp.json b/modules/_ai-tools/mcp.json new file mode 100644 index 0000000..9fe8065 --- /dev/null +++ b/modules/_ai-tools/mcp.json @@ -0,0 +1,21 @@ +{ + "mcpServers": { + "opensrc": { + "command": "npx", + "args": ["-y", "opensrc-mcp"], + "directTools": true + }, + "context7": { + "url": "https://mcp.context7.com/mcp", + "directTools": true + }, + "grep_app": { + "url": "https://mcp.grep.app", + "directTools": true + }, + "sentry": { + "url": "https://mcp.sentry.dev/mcp", + "auth": "oauth" + } + } +} diff --git a/modules/_ai-tools/skills/jujutsu/SKILL.md b/modules/_ai-tools/skills/jujutsu/SKILL.md new file mode 100644 index 0000000..deec8df --- /dev/null +++ b/modules/_ai-tools/skills/jujutsu/SKILL.md @@ -0,0 +1,143 @@ +--- +name: jujutsu +description: Manages version control with Jujutsu (jj), including rebasing, conflict resolution, and Git interop. Use when tracking changes, navigating history, squashing/splitting commits, or pushing to Git remotes. +--- + +# Jujutsu + +Git-compatible VCS focused on concurrent development and ease of use. + +> ⚠️ **Not Git!** Jujutsu syntax differs from Git: +> +> - Parent: `@-` not `@~1` or `@^` +> - Grandparent: `@--` not `@~2` +> - Child: `@+` not `@~-1` +> - Use `jj log` not `jj changes` + +## Key Commands + +| Command | Description | +| -------------------------- | -------------------------------------------- | +| `jj st` | Show working copy status | +| `jj log` | Show change log | +| `jj diff` | Show changes in working copy | +| `jj new` | Create new change | +| `jj desc` | Edit change description | +| `jj squash` | Move changes to parent | +| `jj split` | Split current change | +| `jj rebase -s src -d dest` | Rebase changes | +| `jj absorb` | Move changes into stack of mutable revisions | +| `jj bisect` | Find bad revision by bisection | +| `jj fix` | Update files with formatting fixes | +| `jj sign` | Cryptographically sign a revision | +| `jj metaedit` | Modify metadata without changing content | + +## Basic Workflow + +```bash +jj new # Create new change +jj desc -m "feat: add feature" # Set description +jj log # View history +jj edit change-id # Switch to change +jj new --before @ # Time travel (create before current) +jj edit @- # Go to parent +``` + +## Time Travel + +```bash +jj edit change-id # Switch to specific change +jj next --edit # Next child change +jj edit @- # Parent change +jj new --before @ -m msg # Insert before current +``` + +## Merging & Rebasing + +```bash +jj new x yz -m msg # Merge changes +jj rebase -s src -d dest # Rebase source onto dest +jj abandon # Delete current change +``` + +## Conflicts + +```bash +jj resolve # Interactive conflict resolution +# Edit files, then continue +``` + +## Revset Syntax + +**Parent/child operators:** + +| Syntax | Meaning | Example | +| ------ | ---------------- | -------------------- | +| `@-` | Parent of @ | `jj diff -r @-` | +| `@--` | Grandparent | `jj log -r @--` | +| `x-` | Parent of x | `jj diff -r abc123-` | +| `@+` | Child of @ | `jj log -r @+` | +| `x::y` | x to y inclusive | `jj log -r main::@` | +| `x..y` | x to y exclusive | `jj log -r main..@` | +| `x\|y` | Union (or) | `jj log -r 'a \| b'` | + +**⚠️ Common mistakes:** + +- ❌ `@~1` → ✅ `@-` (parent) +- ❌ `@^` → ✅ `@-` (parent) +- ❌ `@~-1` → ✅ `@+` (child) +- ❌ `jj changes` → ✅ `jj log` or `jj diff` +- ❌ `a,b,c` → ✅ `a | b | c` (union uses pipe, not comma) + +**Functions:** + +```bash +jj log -r 'heads(all())' # All heads +jj log -r 'remote_bookmarks()..' # Not on remote +jj log -r 'author(name)' # By author +jj log -r 'description(regex)' # By description +jj log -r 'mine()' # My commits +jj log -r 'committer_date(after:"7 days ago")' # Recent commits +jj log -r 'mine() & committer_date(after:"yesterday")' # My recent +``` + +## Templates + +```bash +jj log -T 'commit_id ++ "\n" ++ description' +``` + +## Git Interop + +```bash +jj bookmark create main -r @ # Create bookmark +jj git push --bookmark main # Push bookmark +jj git fetch # Fetch from remote +jj bookmark track main@origin # Track remote +``` + +## Advanced Commands + +```bash +jj absorb # Auto-move changes to relevant commits in stack +jj bisect start # Start bisection +jj bisect good # Mark current as good +jj bisect bad # Mark current as bad +jj fix # Run configured formatters on files +jj sign -r @ # Sign current revision +jj metaedit -r @ -m "new message" # Edit metadata only +``` + +## Tips + +- No staging: changes are immediate +- Use conventional commits: `type(scope): desc` +- `jj undo` to revert operations +- `jj op log` to see operation history +- Bookmarks are like branches +- `jj absorb` is powerful for fixing up commits in a stack + +## Related Skills + +- **gh**: GitHub CLI for PRs and issues +- **review**: Code review before committing diff --git a/modules/_overlays/pi-mcp-adapter.nix b/modules/_overlays/pi-mcp-adapter.nix index b5fd060..47d0194 100644 --- a/modules/_overlays/pi-mcp-adapter.nix +++ b/modules/_overlays/pi-mcp-adapter.nix @@ -3,13 +3,7 @@ prev.buildNpmPackage { pname = "pi-mcp-adapter"; version = "2.2.0"; - src = - prev.fetchFromGitHub { - owner = "nicobailon"; - repo = "pi-mcp-adapter"; - rev = "v2.2.0"; - hash = "sha256-E6Kf+OyTN/pF8pKADJO0B1+buAPqNcXnZl9ssZwSP8U="; - }; + src = inputs.pi-mcp-adapter; npmDepsHash = "sha256-myJ9h/zC/KDddt8NOVvJjjqbnkdEN4ZR+okCR5nu7hM="; dontNpmBuild = true; }; diff --git a/modules/ai-tools.nix b/modules/ai-tools.nix index da51aef..983d653 100644 --- a/modules/ai-tools.nix +++ b/modules/ai-tools.nix @@ -2,7 +2,6 @@ den.aspects.ai-tools.homeManager = { pkgs, inputs', - lib, ... }: { home.packages = [ @@ -21,160 +20,15 @@ source = "${pkgs.pi-mcp-adapter}/lib/node_modules/pi-mcp-adapter"; recursive = true; }; - ".pi/agent/extensions/no-git.ts".source = ./_ai-tools/no-git.ts; - ".pi/agent/extensions/no-scripting.ts".source = ./_ai-tools/no-scripting.ts; - ".pi/agent/extensions/review.ts".source = ./_ai-tools/review.ts; - ".pi/agent/extensions/session-name.ts".source = ./_ai-tools/session-name.ts; + ".pi/agent/extensions/no-git.ts".source = ./_ai-tools/extensions/no-git.ts; + ".pi/agent/extensions/no-scripting.ts".source = ./_ai-tools/extensions/no-scripting.ts; + ".pi/agent/extensions/review.ts".source = ./_ai-tools/extensions/review.ts; + ".pi/agent/extensions/session-name.ts".source = ./_ai-tools/extensions/session-name.ts; ".pi/agent/skills/elixir-dev" = { source = "${inputs.pi-elixir}/skills/elixir-dev"; recursive = true; }; - ".pi/agent/skills/jujutsu/SKILL.md".text = - lib.removePrefix "\n" (builtins.replaceStrings ["\t"] [""] '' - --- - name: jujutsu - description: Manages version control with Jujutsu (jj), including rebasing, conflict resolution, and Git interop. Use when tracking changes, navigating history, squashing/splitting commits, or pushing to Git remotes. - --- - - # Jujutsu - - Git-compatible VCS focused on concurrent development and ease of use. - - > ⚠️ **Not Git!** Jujutsu syntax differs from Git: - > - > - Parent: `@-` not `@~1` or `@^` - > - Grandparent: `@--` not `@~2` - > - Child: `@+` not `@~-1` - > - Use `jj log` not `jj changes` - - ## Key Commands - - | Command | Description | - | -------------------------- | -------------------------------------------- | - | `jj st` | Show working copy status | - | `jj log` | Show change log | - | `jj diff` | Show changes in working copy | - | `jj new` | Create new change | - | `jj desc` | Edit change description | - | `jj squash` | Move changes to parent | - | `jj split` | Split current change | - | `jj rebase -s src -d dest` | Rebase changes | - | `jj absorb` | Move changes into stack of mutable revisions | - | `jj bisect` | Find bad revision by bisection | - | `jj fix` | Update files with formatting fixes | - | `jj sign` | Cryptographically sign a revision | - | `jj metaedit` | Modify metadata without changing content | - - ## Basic Workflow - - ```bash - jj new # Create new change - jj desc -m "feat: add feature" # Set description - jj log # View history - jj edit change-id # Switch to change - jj new --before @ # Time travel (create before current) - jj edit @- # Go to parent - ``` - - ## Time Travel - - ```bash - jj edit change-id # Switch to specific change - jj next --edit # Next child change - jj edit @- # Parent change - jj new --before @ -m msg # Insert before current - ``` - - ## Merging & Rebasing - - ```bash - jj new x yz -m msg # Merge changes - jj rebase -s src -d dest # Rebase source onto dest - jj abandon # Delete current change - ``` - - ## Conflicts - - ```bash - jj resolve # Interactive conflict resolution - # Edit files, then continue - ``` - - ## Revset Syntax - - **Parent/child operators:** - - | Syntax | Meaning | Example | - | ------ | ---------------- | -------------------- | - | `@-` | Parent of @ | `jj diff -r @-` | - | `@--` | Grandparent | `jj log -r @--` | - | `x-` | Parent of x | `jj diff -r abc123-` | - | `@+` | Child of @ | `jj log -r @+` | - | `x::y` | x to y inclusive | `jj log -r main::@` | - | `x..y` | x to y exclusive | `jj log -r main..@` | - | `x\|y` | Union (or) | `jj log -r 'a \| b'` | - - **⚠️ Common mistakes:** - - - ❌ `@~1` → ✅ `@-` (parent) - - ❌ `@^` → ✅ `@-` (parent) - - ❌ `@~-1` → ✅ `@+` (child) - - ❌ `jj changes` → ✅ `jj log` or `jj diff` - - ❌ `a,b,c` → ✅ `a | b | c` (union uses pipe, not comma) - - **Functions:** - - ```bash - jj log -r 'heads(all())' # All heads - jj log -r 'remote_bookmarks()..' # Not on remote - jj log -r 'author(name)' # By author - jj log -r 'description(regex)' # By description - jj log -r 'mine()' # My commits - jj log -r 'committer_date(after:"7 days ago")' # Recent commits - jj log -r 'mine() & committer_date(after:"yesterday")' # My recent - ``` - - ## Templates - - ```bash - jj log -T 'commit_id ++ "\n" ++ description' - ``` - - ## Git Interop - - ```bash - jj bookmark create main -r @ # Create bookmark - jj git push --bookmark main # Push bookmark - jj git fetch # Fetch from remote - jj bookmark track main@origin # Track remote - ``` - - ## Advanced Commands - - ```bash - jj absorb # Auto-move changes to relevant commits in stack - jj bisect start # Start bisection - jj bisect good # Mark current as good - jj bisect bad # Mark current as bad - jj fix # Run configured formatters on files - jj sign -r @ # Sign current revision - jj metaedit -r @ -m "new message" # Edit metadata only - ``` - - ## Tips - - - No staging: changes are immediate - - Use conventional commits: `type(scope): desc` - - `jj undo` to revert operations - - `jj op log` to see operation history - - Bookmarks are like branches - - `jj absorb` is powerful for fixing up commits in a stack - - ## Related Skills - - - **gh**: GitHub CLI for PRs and issues - - **review**: Code review before committing - ''); + ".pi/agent/skills/jujutsu/SKILL.md".source = ./_ai-tools/skills/jujutsu/SKILL.md; ".pi/agent/themes" = { source = "${inputs.pi-rose-pine}/themes"; recursive = true; @@ -209,25 +63,7 @@ } ]; }; - ".pi/agent/mcp.json".text = - builtins.toJSON { - mcpServers = { - opensrc = { - command = "npx"; - args = ["-y" "opensrc-mcp"]; - }; - context7 = { - url = "https://mcp.context7.com/mcp"; - }; - grep_app = { - url = "https://mcp.grep.app"; - }; - sentry = { - url = "https://mcp.sentry.dev/mcp"; - auth = "oauth"; - }; - }; - }; + ".pi/agent/mcp.json".source = ./_ai-tools/mcp.json; }; }; } diff --git a/modules/dendritic.nix b/modules/dendritic.nix index dbdaa7a..1f9eaa2 100644 --- a/modules/dendritic.nix +++ b/modules/dendritic.nix @@ -70,6 +70,10 @@ url = "github:aliou/pi-harness"; flake = false; }; + pi-mcp-adapter = { + url = "github:nicobailon/pi-mcp-adapter/v2.2.0"; + flake = false; + }; # Overlay inputs himalaya.url = "github:pimalaya/himalaya"; jj-ryu = {