Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9f68a4361 | ||
|
|
b63db50485 | ||
|
|
11ddf5e00c | ||
|
|
2187d9263d | ||
|
|
4e46e08e4d | ||
|
|
0c509a7c90 | ||
|
|
38d53d68c0 | ||
|
|
6f1826b96b | ||
|
|
e7bbc6275a | ||
|
|
6fba804e5f | ||
|
|
2a36d43d9d | ||
|
|
a60a28fb9c | ||
|
|
751f93156c | ||
|
|
04a563ee3e | ||
|
|
071161b6d6 | ||
|
|
f683e8bf43 | ||
|
|
3d4a39dc74 | ||
|
|
aa9be37311 | ||
|
|
396c41d99d | ||
|
|
5b192aadfe | ||
|
|
3529ae5a0e | ||
|
|
0be1455efb | ||
|
|
3c2fc56c43 | ||
|
|
963351200c |
No files matched your search
@@ -0,0 +1,80 @@
|
|||||||
|
---
|
||||||
|
name: beads
|
||||||
|
description: Use when working in a repository that uses bd or Beads for durable project task tracking, issue dependencies, blocker management, multi-session handoff, or shared work memory. Trigger when the user asks to find ready work, claim or close tasks, create follow-up work, inspect blockers, recover project context, or choose between local planning and persistent project tracking.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Beads
|
||||||
|
|
||||||
|
Use Beads as the shared project task system. Local plans, scratch files, and personal memories are useful, but they are not the durable source of truth for project work.
|
||||||
|
|
||||||
|
## First Step
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd prime
|
||||||
|
```
|
||||||
|
|
||||||
|
If that prints nothing, check whether the repository has an active Beads workspace:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd where
|
||||||
|
```
|
||||||
|
|
||||||
|
## Preferred Route
|
||||||
|
|
||||||
|
Use the `bd` CLI when shell access is available. It is the most compact and direct Beads interface.
|
||||||
|
|
||||||
|
## Core CLI Workflow
|
||||||
|
|
||||||
|
1. Find work:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd ready
|
||||||
|
bd list --status=open
|
||||||
|
bd list --status=in_progress
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Inspect before editing:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd show <id>
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Claim work atomically:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd update <id> --claim
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Create durable follow-up work when implementation reveals new tasks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd create "Short title" --description="Why this exists and what needs to be done" --type=task --priority=2
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Close completed work:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd close <id> --reason="Completed"
|
||||||
|
```
|
||||||
|
|
||||||
|
## What Belongs In Beads
|
||||||
|
|
||||||
|
Use Beads for:
|
||||||
|
|
||||||
|
- shared project tasks
|
||||||
|
- blockers and dependencies
|
||||||
|
- discovered follow-up work
|
||||||
|
- work that must survive thread reset, compaction, or handoff
|
||||||
|
- status that another person or agent should be able to resume
|
||||||
|
|
||||||
|
Use agent-local planning tools only for the current turn's execution checklist. Do not treat them as shared project state.
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
- Do not create markdown TODO files as the source of truth when Beads is available.
|
||||||
|
- Do not use `bd edit`; it opens an interactive editor. Use `bd update` flags instead.
|
||||||
|
- Prefer `--json` when parsing `bd` output programmatically.
|
||||||
|
- If hooks are installed, `bd prime` may already be injected. Run it manually when context is missing.
|
||||||
|
- Do not auto-close or mutate tasks unless the work is actually complete.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
interface:
|
||||||
|
display_name: "Beads"
|
||||||
|
short_description: "Project task tracking with bd"
|
||||||
|
default_prompt: "Use $beads to inspect ready work and manage durable project tasks."
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
# Dolt database (managed by Dolt, not git)
|
||||||
|
dolt/
|
||||||
|
embeddeddolt/
|
||||||
|
proxieddb/
|
||||||
|
|
||||||
|
# Runtime files
|
||||||
|
bd.sock
|
||||||
|
bd.sock.startlock
|
||||||
|
sync-state.json
|
||||||
|
last-touched
|
||||||
|
.exclusive-lock
|
||||||
|
|
||||||
|
# Daemon runtime (lock, log, pid)
|
||||||
|
daemon.*
|
||||||
|
|
||||||
|
# Push state (runtime, per-machine)
|
||||||
|
push-state.json
|
||||||
|
|
||||||
|
# Lock files (various runtime locks)
|
||||||
|
*.lock
|
||||||
|
|
||||||
|
# Credential key (encryption key for federation peer auth — never commit)
|
||||||
|
.beads-credential-key
|
||||||
|
|
||||||
|
# Local version tracking (prevents upgrade notification spam after git ops)
|
||||||
|
.local_version
|
||||||
|
|
||||||
|
proxied_server_client_info.json
|
||||||
|
|
||||||
|
# Worktree redirect file (contains relative path to main repo's .beads/)
|
||||||
|
# Must not be committed as paths would be wrong in other clones
|
||||||
|
redirect
|
||||||
|
|
||||||
|
# Sync state (local-only, per-machine)
|
||||||
|
# These files are machine-specific and should not be shared across clones
|
||||||
|
.sync.lock
|
||||||
|
|
||||||
|
# Workspace operation gate (internal/workspacegate): physical-root gate
|
||||||
|
# files live beside the guarded root inside .beads (e.g. dolt.gate.lock)
|
||||||
|
*.gate.lock*
|
||||||
|
export-state/
|
||||||
|
export-state.json
|
||||||
|
last_pull
|
||||||
|
|
||||||
|
# Ephemeral store (SQLite - wisps/molecules, intentionally not versioned)
|
||||||
|
ephemeral.sqlite3
|
||||||
|
ephemeral.sqlite3-journal
|
||||||
|
ephemeral.sqlite3-wal
|
||||||
|
ephemeral.sqlite3-shm
|
||||||
|
|
||||||
|
# Dolt server management (auto-started by bd)
|
||||||
|
dolt-server.pid
|
||||||
|
dolt-server.log
|
||||||
|
dolt-server.lock
|
||||||
|
dolt-server.port
|
||||||
|
dolt-server.activity
|
||||||
|
dolt-server-config.yaml
|
||||||
|
|
||||||
|
# Debug-mode pprof artifacts (written when dolt.debug: true in config.yaml)
|
||||||
|
dolt-pprof/
|
||||||
|
|
||||||
|
# Corrupt backup directories (created by bd doctor --fix recovery)
|
||||||
|
*.corrupt.backup/
|
||||||
|
|
||||||
|
# Backup data (auto-exported JSONL, local-only)
|
||||||
|
backup/
|
||||||
|
|
||||||
|
# Per-project environment file (Dolt connection config, GH#2520)
|
||||||
|
.env
|
||||||
|
|
||||||
|
# Legacy files (from pre-Dolt versions)
|
||||||
|
*.db
|
||||||
|
*.db?*
|
||||||
|
*.db-journal
|
||||||
|
*.db-wal
|
||||||
|
*.db-shm
|
||||||
|
db.sqlite
|
||||||
|
bd.db
|
||||||
|
# NOTE: Do NOT add negation patterns here.
|
||||||
|
# They would override fork protection in .git/info/exclude.
|
||||||
|
# Config files (metadata.json, config.yaml) are tracked by git by default
|
||||||
|
# since no pattern above ignores them.
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# Beads - AI-Native Issue Tracking
|
||||||
|
|
||||||
|
Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
|
||||||
|
|
||||||
|
## What is Beads?
|
||||||
|
|
||||||
|
Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
|
||||||
|
|
||||||
|
**Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### Essential Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create new issues
|
||||||
|
bd create "Add user authentication"
|
||||||
|
|
||||||
|
# View all issues
|
||||||
|
bd list
|
||||||
|
|
||||||
|
# View issue details
|
||||||
|
bd show <issue-id>
|
||||||
|
|
||||||
|
# Update issue status
|
||||||
|
bd update <issue-id> --claim
|
||||||
|
bd update <issue-id> --status done
|
||||||
|
|
||||||
|
# Sync with Dolt remote
|
||||||
|
bd dolt push
|
||||||
|
```
|
||||||
|
|
||||||
|
### Working with Issues
|
||||||
|
|
||||||
|
Issues in Beads are:
|
||||||
|
- **Git-native**: Stored in Dolt database with version control and branching
|
||||||
|
- **AI-friendly**: CLI-first design works perfectly with AI coding agents
|
||||||
|
- **Branch-aware**: Issues can follow your branch workflow
|
||||||
|
- **Sync-ready**: Uses Dolt remotes for backup and team sharing
|
||||||
|
|
||||||
|
## Why Beads?
|
||||||
|
|
||||||
|
✨ **AI-Native Design**
|
||||||
|
- Built specifically for AI-assisted development workflows
|
||||||
|
- CLI-first interface works seamlessly with AI coding agents
|
||||||
|
- No context switching to web UIs
|
||||||
|
|
||||||
|
🚀 **Developer Focused**
|
||||||
|
- Issues live in your repo, right next to your code
|
||||||
|
- Works offline, syncs when you push
|
||||||
|
- Fast, lightweight, and stays out of your way
|
||||||
|
|
||||||
|
🔧 **Git Integration**
|
||||||
|
- Dolt-native sync via bd dolt push / bd dolt pull
|
||||||
|
- Branch-aware issue tracking
|
||||||
|
- Dolt-native three-way merge resolution
|
||||||
|
|
||||||
|
## Get Started with Beads
|
||||||
|
|
||||||
|
Try Beads in your own projects:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install Beads
|
||||||
|
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
|
||||||
|
|
||||||
|
# Initialize in your repo
|
||||||
|
bd init
|
||||||
|
|
||||||
|
# Create your first issue
|
||||||
|
bd create "Try out Beads"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
- **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
|
||||||
|
- **Quick Start Guide**: Run `bd quickstart`
|
||||||
|
- **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Beads: Issue tracking that moves at the speed of thought* ⚡
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# Beads Configuration File
|
||||||
|
# This file configures default behavior for all bd commands in this repository
|
||||||
|
# All settings can also be set via environment variables (BD_* prefix)
|
||||||
|
# or overridden with command-line flags
|
||||||
|
|
||||||
|
# Issue prefix for this repository (used by bd init)
|
||||||
|
# If not set, bd init will auto-detect from directory name
|
||||||
|
# Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
|
||||||
|
# issue-prefix: ""
|
||||||
|
|
||||||
|
# Use no-db mode: JSONL-only, no Dolt database
|
||||||
|
# When true, .beads/issues.jsonl is the only local store
|
||||||
|
# no-db: false
|
||||||
|
|
||||||
|
# Enable JSON output by default
|
||||||
|
# json: false
|
||||||
|
|
||||||
|
# Feedback title formatting for mutating commands (create/update/close/dep/edit)
|
||||||
|
# 0 = hide titles, N > 0 = truncate to N characters
|
||||||
|
# output:
|
||||||
|
# title-length: 255
|
||||||
|
|
||||||
|
# Default actor for audit trails (overridden by BEADS_ACTOR or --actor)
|
||||||
|
# actor: ""
|
||||||
|
|
||||||
|
# Optional JSONL sidecar for explicit agent/tool interaction audit records.
|
||||||
|
# Issue history is always recorded in the database and is visible with
|
||||||
|
# bd history <id> --events; this only controls .beads/interactions.jsonl.
|
||||||
|
# audit:
|
||||||
|
# enabled: false
|
||||||
|
|
||||||
|
# Export events (audit trail) to .beads/events.jsonl on each flush/sync
|
||||||
|
# When enabled, new events are appended incrementally using a high-water mark.
|
||||||
|
# Use 'bd export --events' to trigger manually regardless of this setting.
|
||||||
|
# events-export: false
|
||||||
|
|
||||||
|
# Multi-repo configuration (experimental - bd-307)
|
||||||
|
# Allows hydrating from multiple repositories and routing writes to the correct database
|
||||||
|
# repos:
|
||||||
|
# primary: "." # Primary repo (where this database lives)
|
||||||
|
# additional: # Additional repos to hydrate from (read-only)
|
||||||
|
# - ~/beads-planning # Personal planning repo
|
||||||
|
# - ~/work-planning # Work planning repo
|
||||||
|
|
||||||
|
# Dolt-native backup (periodic backup for off-machine recovery)
|
||||||
|
# This is full database backup only. Cross-machine sync uses Dolt remotes.
|
||||||
|
# backup:
|
||||||
|
# enabled: false # Disable auto-backup entirely
|
||||||
|
# interval: 15m # Minimum time between auto-backups
|
||||||
|
# git-push: false # Disable git push (backup locally only)
|
||||||
|
# git-repo: "" # Separate git repo for backups (default: project repo)
|
||||||
|
|
||||||
|
# Optional JSONL auto-export for viewers, interchange, and issue-level migration.
|
||||||
|
# Disabled by default; enable only when an integration needs fresh .beads/issues.jsonl.
|
||||||
|
# Use relative paths under .beads/ for JSONL import/export filenames.
|
||||||
|
# export:
|
||||||
|
# auto: false
|
||||||
|
# path: issues.jsonl
|
||||||
|
# interval: 60s
|
||||||
|
# git-add: false
|
||||||
|
# import:
|
||||||
|
# path: issues.jsonl
|
||||||
|
|
||||||
|
# Integration settings (access with 'bd config get/set')
|
||||||
|
# Non-secret keys (stored in the database):
|
||||||
|
# - jira.url, jira.project
|
||||||
|
# - linear.team_id
|
||||||
|
# - github.org, github.repo
|
||||||
|
#
|
||||||
|
# Secret keys (stored in this file but prefer env vars to avoid git exposure):
|
||||||
|
# - linear.api_key → use LINEAR_API_KEY env var instead
|
||||||
|
# - github.token → use GITHUB_TOKEN env var instead
|
||||||
|
|
||||||
|
sync:
|
||||||
|
remote: "git+ssh://gitea@code.m3ta.dev/m3tam3re/m3ta-home.git"
|
||||||
|
export:
|
||||||
|
auto: true
|
||||||
Executable
+59
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# --- BEGIN BEADS INTEGRATION v1.3.2 ---
|
||||||
|
# This section is managed by beads. Do not remove these markers.
|
||||||
|
if command -v bd >/dev/null 2>&1; then
|
||||||
|
export BD_GIT_HOOK=1
|
||||||
|
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||||
|
case "$_bd_timeout" in
|
||||||
|
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||||
|
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||||
|
*) _bd_timeout_invalid=1 ;;
|
||||||
|
esac
|
||||||
|
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||||
|
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||||
|
_bd_timeout=300
|
||||||
|
fi
|
||||||
|
_bd_timeout_backend=none
|
||||||
|
_bd_timeout_command=
|
||||||
|
for _bd_timeout_candidate in timeout gtimeout; do
|
||||||
|
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||||
|
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||||
|
case "$_bd_timeout_version" in
|
||||||
|
"timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -n "$_bd_timeout_command" ]; then
|
||||||
|
_bd_timeout_backend=coreutils
|
||||||
|
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run post-checkout "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
elif command -v perl >/dev/null 2>&1; then
|
||||||
|
_bd_timeout_backend=perl
|
||||||
|
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run post-checkout "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "beads: hook 'post-checkout' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||||
|
if bd hooks run post-checkout "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||||
|
echo >&2 "beads: hook 'post-checkout' timed out after ${_bd_timeout}s — continuing without beads"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -eq 3 ]; then
|
||||||
|
echo >&2 "beads: database not initialized — skipping hook 'post-checkout'"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||||
|
fi
|
||||||
|
# --- END BEADS INTEGRATION v1.3.2 ---
|
||||||
Executable
+59
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# --- BEGIN BEADS INTEGRATION v1.3.2 ---
|
||||||
|
# This section is managed by beads. Do not remove these markers.
|
||||||
|
if command -v bd >/dev/null 2>&1; then
|
||||||
|
export BD_GIT_HOOK=1
|
||||||
|
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||||
|
case "$_bd_timeout" in
|
||||||
|
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||||
|
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||||
|
*) _bd_timeout_invalid=1 ;;
|
||||||
|
esac
|
||||||
|
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||||
|
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||||
|
_bd_timeout=300
|
||||||
|
fi
|
||||||
|
_bd_timeout_backend=none
|
||||||
|
_bd_timeout_command=
|
||||||
|
for _bd_timeout_candidate in timeout gtimeout; do
|
||||||
|
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||||
|
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||||
|
case "$_bd_timeout_version" in
|
||||||
|
"timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -n "$_bd_timeout_command" ]; then
|
||||||
|
_bd_timeout_backend=coreutils
|
||||||
|
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run post-merge "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
elif command -v perl >/dev/null 2>&1; then
|
||||||
|
_bd_timeout_backend=perl
|
||||||
|
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run post-merge "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "beads: hook 'post-merge' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||||
|
if bd hooks run post-merge "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||||
|
echo >&2 "beads: hook 'post-merge' timed out after ${_bd_timeout}s — continuing without beads"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -eq 3 ]; then
|
||||||
|
echo >&2 "beads: database not initialized — skipping hook 'post-merge'"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||||
|
fi
|
||||||
|
# --- END BEADS INTEGRATION v1.3.2 ---
|
||||||
Executable
+59
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# --- BEGIN BEADS INTEGRATION v1.3.2 ---
|
||||||
|
# This section is managed by beads. Do not remove these markers.
|
||||||
|
if command -v bd >/dev/null 2>&1; then
|
||||||
|
export BD_GIT_HOOK=1
|
||||||
|
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||||
|
case "$_bd_timeout" in
|
||||||
|
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||||
|
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||||
|
*) _bd_timeout_invalid=1 ;;
|
||||||
|
esac
|
||||||
|
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||||
|
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||||
|
_bd_timeout=300
|
||||||
|
fi
|
||||||
|
_bd_timeout_backend=none
|
||||||
|
_bd_timeout_command=
|
||||||
|
for _bd_timeout_candidate in timeout gtimeout; do
|
||||||
|
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||||
|
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||||
|
case "$_bd_timeout_version" in
|
||||||
|
"timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -n "$_bd_timeout_command" ]; then
|
||||||
|
_bd_timeout_backend=coreutils
|
||||||
|
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run pre-commit "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
elif command -v perl >/dev/null 2>&1; then
|
||||||
|
_bd_timeout_backend=perl
|
||||||
|
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run pre-commit "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "beads: hook 'pre-commit' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||||
|
if bd hooks run pre-commit "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||||
|
echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -eq 3 ]; then
|
||||||
|
echo >&2 "beads: database not initialized — skipping hook 'pre-commit'"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||||
|
fi
|
||||||
|
# --- END BEADS INTEGRATION v1.3.2 ---
|
||||||
Executable
+59
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# --- BEGIN BEADS INTEGRATION v1.3.2 ---
|
||||||
|
# This section is managed by beads. Do not remove these markers.
|
||||||
|
if command -v bd >/dev/null 2>&1; then
|
||||||
|
export BD_GIT_HOOK=1
|
||||||
|
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||||
|
case "$_bd_timeout" in
|
||||||
|
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||||
|
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||||
|
*) _bd_timeout_invalid=1 ;;
|
||||||
|
esac
|
||||||
|
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||||
|
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||||
|
_bd_timeout=300
|
||||||
|
fi
|
||||||
|
_bd_timeout_backend=none
|
||||||
|
_bd_timeout_command=
|
||||||
|
for _bd_timeout_candidate in timeout gtimeout; do
|
||||||
|
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||||
|
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||||
|
case "$_bd_timeout_version" in
|
||||||
|
"timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -n "$_bd_timeout_command" ]; then
|
||||||
|
_bd_timeout_backend=coreutils
|
||||||
|
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run pre-push "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
elif command -v perl >/dev/null 2>&1; then
|
||||||
|
_bd_timeout_backend=perl
|
||||||
|
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run pre-push "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "beads: hook 'pre-push' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||||
|
if bd hooks run pre-push "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||||
|
echo >&2 "beads: hook 'pre-push' timed out after ${_bd_timeout}s — continuing without beads"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -eq 3 ]; then
|
||||||
|
echo >&2 "beads: database not initialized — skipping hook 'pre-push'"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||||
|
fi
|
||||||
|
# --- END BEADS INTEGRATION v1.3.2 ---
|
||||||
Executable
+59
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# --- BEGIN BEADS INTEGRATION v1.3.2 ---
|
||||||
|
# This section is managed by beads. Do not remove these markers.
|
||||||
|
if command -v bd >/dev/null 2>&1; then
|
||||||
|
export BD_GIT_HOOK=1
|
||||||
|
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
||||||
|
case "$_bd_timeout" in
|
||||||
|
*[!0-9]*|'') _bd_timeout_invalid=1 ;;
|
||||||
|
*[1-9]*) _bd_timeout_invalid=0 ;;
|
||||||
|
*) _bd_timeout_invalid=1 ;;
|
||||||
|
esac
|
||||||
|
if [ "$_bd_timeout_invalid" -eq 1 ]; then
|
||||||
|
echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
|
||||||
|
_bd_timeout=300
|
||||||
|
fi
|
||||||
|
_bd_timeout_backend=none
|
||||||
|
_bd_timeout_command=
|
||||||
|
for _bd_timeout_candidate in timeout gtimeout; do
|
||||||
|
if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
|
||||||
|
if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
|
||||||
|
case "$_bd_timeout_version" in
|
||||||
|
"timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -n "$_bd_timeout_command" ]; then
|
||||||
|
_bd_timeout_backend=coreutils
|
||||||
|
if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run prepare-commit-msg "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
elif command -v perl >/dev/null 2>&1; then
|
||||||
|
_bd_timeout_backend=perl
|
||||||
|
if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run prepare-commit-msg "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "beads: hook 'prepare-commit-msg' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
||||||
|
if bd hooks run prepare-commit-msg "$@"; then
|
||||||
|
_bd_exit=0
|
||||||
|
else
|
||||||
|
_bd_exit=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
|
||||||
|
echo >&2 "beads: hook 'prepare-commit-msg' timed out after ${_bd_timeout}s — continuing without beads"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -eq 3 ]; then
|
||||||
|
echo >&2 "beads: database not initialized — skipping hook 'prepare-commit-msg'"
|
||||||
|
_bd_exit=0
|
||||||
|
fi
|
||||||
|
if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
|
||||||
|
fi
|
||||||
|
# --- END BEADS INTEGRATION v1.3.2 ---
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"database": "dolt",
|
||||||
|
"backend": "dolt",
|
||||||
|
"dolt_mode": "embedded",
|
||||||
|
"dolt_database": "m3ta_home",
|
||||||
|
"project_id": "1a47a19e-9056-4cd2-8199-2ff7dbb4cb01"
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"SessionStart": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"command": "bd prime --hook-json",
|
||||||
|
"type": "command"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"matcher": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[features]
|
||||||
|
hooks = true
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"PostCompact": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"command": "bd codex-hook PostCompact",
|
||||||
|
"statusMessage": "Scheduling Beads context refresh",
|
||||||
|
"type": "command"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"matcher": "manual|auto"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"PreCompact": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"command": "bd codex-hook PreCompact",
|
||||||
|
"statusMessage": "Checking Beads context",
|
||||||
|
"type": "command"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"matcher": "manual|auto"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"SessionStart": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"command": "bd codex-hook SessionStart",
|
||||||
|
"statusMessage": "Loading Beads context",
|
||||||
|
"type": "command"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"matcher": "startup|resume|clear"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"UserPromptSubmit": [
|
||||||
|
{
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"command": "bd codex-hook UserPromptSubmit",
|
||||||
|
"statusMessage": "Refreshing Beads context",
|
||||||
|
"type": "command"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"postToolUse": [
|
||||||
|
{
|
||||||
|
"command": "bd cursor-hook postToolUse"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"preCompact": [
|
||||||
|
{
|
||||||
|
"command": "bd cursor-hook preCompact"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sessionStart": [
|
||||||
|
{
|
||||||
|
"command": "bd cursor-hook sessionStart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
---
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- BEGIN BEADS INTEGRATION -->
|
||||||
|
<!-- Auto-generated by 'bd setup cursor'. Content between these markers is managed by bd. -->
|
||||||
|
|
||||||
|
# Beads Issue Tracking
|
||||||
|
|
||||||
|
This project uses [Beads (bd)](https://github.com/gastownhall/beads) for issue tracking.
|
||||||
|
|
||||||
|
## Core Rules
|
||||||
|
|
||||||
|
- Track ALL work in bd (never use markdown TODOs or comment-based task lists)
|
||||||
|
- Use `bd ready` to find available work
|
||||||
|
- Use `bd create` to track new issues/tasks/bugs
|
||||||
|
- Treat commit, push, and Dolt remote sync as policy-controlled handoff actions
|
||||||
|
- Run `bd prime` for complete workflow context (SSOT for operational commands)
|
||||||
|
- Default to conservative git authority: report status and proposed commands unless the user, orchestrator, or repository profile explicitly authorizes commit/sync/push
|
||||||
|
|
||||||
|
## Quick Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd prime # Load complete workflow context (SSOT)
|
||||||
|
bd ready # Show issues ready to work (no blockers)
|
||||||
|
bd list --status=open # List all open issues
|
||||||
|
bd create "title" -t task -p 2 # Create new issue
|
||||||
|
bd update <id> --claim # Claim work atomically
|
||||||
|
bd unclaim <id> # Release stuck issue (agent crashed)
|
||||||
|
bd close <id> # Mark complete
|
||||||
|
bd dep add <issue> <depends-on> # Add dependency
|
||||||
|
bd dolt push # Sync with remote when authorized
|
||||||
|
```
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
1. Check for ready work: `bd ready`
|
||||||
|
2. Claim an issue atomically: `bd update <id> --claim`
|
||||||
|
3. Do the work
|
||||||
|
4. Mark complete: `bd close <id>`
|
||||||
|
5. Handoff: report changed files, validation, issue status, and any proposed commit/sync/push commands
|
||||||
|
|
||||||
|
## Issue Types
|
||||||
|
|
||||||
|
- `bug` - Something broken
|
||||||
|
- `feature` - New functionality
|
||||||
|
- `task` - Work item (tests, docs, refactoring)
|
||||||
|
- `epic` - Large feature with subtasks
|
||||||
|
- `chore` - Maintenance (dependencies, tooling)
|
||||||
|
|
||||||
|
## Priorities
|
||||||
|
|
||||||
|
- `0` - Critical (security, data loss, broken builds)
|
||||||
|
- `1` - High (major features, important bugs)
|
||||||
|
- `2` - Medium (default, nice-to-have)
|
||||||
|
- `3` - Low (polish, optimization)
|
||||||
|
- `4` - Backlog (future ideas)
|
||||||
|
|
||||||
|
## Context Loading
|
||||||
|
|
||||||
|
Run `bd prime` to get complete workflow documentation in AI-optimized format.
|
||||||
|
`bd prime` is the single source of truth for operational commands and session workflow.
|
||||||
|
|
||||||
|
For detailed docs: see AGENTS.md, the beads quickstart
|
||||||
|
(https://github.com/gastownhall/beads/blob/main/docs/getting-started/quickstart.md), or run `bd --help`
|
||||||
|
|
||||||
|
<!-- END BEADS INTEGRATION -->
|
||||||
@@ -1,2 +1,9 @@
|
|||||||
.direnv
|
.direnv
|
||||||
.pi-lens
|
.pi-lens
|
||||||
|
|
||||||
|
# Beads / Dolt files (added by bd init)
|
||||||
|
.dolt/
|
||||||
|
*.db
|
||||||
|
.beads-credential-key
|
||||||
|
.beads/proxieddb/
|
||||||
|
*.gate.lock*
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
# Agent Instructions
|
||||||
|
|
||||||
|
This project uses **bd** (beads) for issue tracking. Run `bd prime` for full workflow context.
|
||||||
|
|
||||||
|
> **Architecture in one line:** Issues live in a local Dolt database
|
||||||
|
> (`.beads/dolt/`); cross-machine sync uses `bd dolt push/pull` (a
|
||||||
|
> git-compatible protocol), stored under `refs/dolt/data` on your git
|
||||||
|
> remote — separate from `refs/heads/*` where your code lives.
|
||||||
|
> `.beads/issues.jsonl` is a passive export, not the wire protocol.
|
||||||
|
>
|
||||||
|
> See [sync-concepts](https://github.com/gastownhall/beads/blob/main/docs/core-concepts/sync-concepts.md)
|
||||||
|
> for the one-screen overview and anti-patterns (don't treat JSONL as the
|
||||||
|
> source of truth; don't `bd import` during normal operation; don't
|
||||||
|
> reach for third-party Dolt hosting before trying the default).
|
||||||
|
|
||||||
|
## Quick Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd ready # Find available work
|
||||||
|
bd show <id> # View issue details
|
||||||
|
bd update <id> --claim # Claim work atomically
|
||||||
|
bd close <id> # Complete work
|
||||||
|
bd dolt push # Push beads data to remote
|
||||||
|
```
|
||||||
|
|
||||||
|
## Non-Interactive Shell Commands
|
||||||
|
|
||||||
|
**ALWAYS use non-interactive flags** with file operations to avoid hanging on confirmation prompts.
|
||||||
|
|
||||||
|
Shell commands like `cp`, `mv`, and `rm` may be aliased to include `-i` (interactive) mode on some systems, causing the agent to hang indefinitely waiting for y/n input.
|
||||||
|
|
||||||
|
**Use these forms instead:**
|
||||||
|
```bash
|
||||||
|
# Force overwrite without prompting
|
||||||
|
cp -f source dest # NOT: cp source dest
|
||||||
|
mv -f source dest # NOT: mv source dest
|
||||||
|
rm -f file # NOT: rm file
|
||||||
|
|
||||||
|
# For recursive operations
|
||||||
|
rm -rf directory # NOT: rm -r directory
|
||||||
|
cp -rf source dest # NOT: cp -r source dest
|
||||||
|
```
|
||||||
|
|
||||||
|
**Other commands that may prompt:**
|
||||||
|
- `scp` - use `-o BatchMode=yes` for non-interactive
|
||||||
|
- `ssh` - use `-o BatchMode=yes` to fail instead of prompting
|
||||||
|
- `apt-get` - use `-y` flag
|
||||||
|
- `brew` - use `HOMEBREW_NO_AUTO_UPDATE=1` env var
|
||||||
|
|
||||||
|
<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:46cd31e7 -->
|
||||||
|
## Beads Issue Tracker
|
||||||
|
|
||||||
|
This project uses **bd (beads)** for issue tracking. Run `bd prime` to see full workflow context and commands.
|
||||||
|
|
||||||
|
### Quick Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd ready # Find available work
|
||||||
|
bd show <id> # View issue details
|
||||||
|
bd update <id> --claim # Claim work
|
||||||
|
bd close <id> # Complete work
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
|
||||||
|
- Use `bd` for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
|
||||||
|
- Run `bd prime` for detailed command reference and session close protocol
|
||||||
|
- Use `bd remember` for persistent knowledge — do NOT use MEMORY.md files
|
||||||
|
|
||||||
|
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/core-concepts/sync-concepts.md for details and anti-patterns.
|
||||||
|
|
||||||
|
## Agent Context Profiles
|
||||||
|
|
||||||
|
The managed Beads block is task-tracking guidance, not permission to override repository, user, or orchestrator instructions.
|
||||||
|
|
||||||
|
- **Conservative (default)**: Use `bd` for task tracking. Do not run git commits, git pushes, or Dolt remote sync unless explicitly asked. At handoff, report changed files, validation, and suggested next commands.
|
||||||
|
- **Minimal**: Keep tool instruction files as pointers to `bd prime`; use the same conservative git policy unless active instructions say otherwise.
|
||||||
|
- **Team-maintainer**: Only when the repository explicitly opts in, agents may close beads, run quality gates, commit, and push as part of session close. A current "do not commit" or "do not push" instruction still wins.
|
||||||
|
|
||||||
|
## Session Completion
|
||||||
|
|
||||||
|
This protocol applies when ending a Beads implementation workflow. It is subordinate to explicit user, repository, and orchestrator instructions.
|
||||||
|
|
||||||
|
1. **File issues for remaining work** - Create beads for anything that needs follow-up
|
||||||
|
2. **Run quality gates** (if code changed) - Tests, linters, builds
|
||||||
|
3. **Update issue status** - Close finished work, update in-progress items
|
||||||
|
4. **Handle git/sync by active profile**:
|
||||||
|
```bash
|
||||||
|
# Conservative/minimal/default: report status and proposed commands; wait for approval.
|
||||||
|
git status
|
||||||
|
|
||||||
|
# Team-maintainer opt-in only, unless current instructions forbid it:
|
||||||
|
git pull --rebase
|
||||||
|
bd dolt push
|
||||||
|
git push
|
||||||
|
git status
|
||||||
|
```
|
||||||
|
5. **Hand off** - Summarize changes, validation, issue status, and any blocked sync/commit/push step
|
||||||
|
|
||||||
|
**Critical rules:**
|
||||||
|
- Explicit user or orchestrator instructions override this Beads block.
|
||||||
|
- Do not commit or push without clear authority from the active profile or the current user request.
|
||||||
|
- If a required sync or push is blocked, stop and report the exact command and error.
|
||||||
|
<!-- END BEADS INTEGRATION -->
|
||||||
|
|
||||||
|
<!-- BEGIN BEADS CODEX SETUP: generated by bd setup codex -->
|
||||||
|
## Beads Issue Tracker
|
||||||
|
|
||||||
|
Use Beads (`bd`) for durable task tracking in repositories that include it. Use the `beads` skill at `.agents/skills/beads/SKILL.md` (project install) or `~/.agents/skills/beads/SKILL.md` (global install) for Beads workflow guidance, then use the `bd` CLI for issue operations.
|
||||||
|
|
||||||
|
### Quick Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd ready # Find available work
|
||||||
|
bd show <id> # View issue details
|
||||||
|
bd update <id> --claim # Claim work
|
||||||
|
bd close <id> # Complete work
|
||||||
|
bd prime # Refresh Beads context
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
|
||||||
|
- Use `bd` for all task tracking; do not create markdown TODO lists.
|
||||||
|
- Run `bd prime` when Beads context is missing or stale. Codex 0.129.0+ can load Beads context automatically through native hooks; use `/hooks` to inspect or toggle them.
|
||||||
|
- Keep persistent project memory in Beads via `bd remember`; do not create ad hoc memory files.
|
||||||
|
|
||||||
|
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/core-concepts/sync-concepts.md for details and anti-patterns.
|
||||||
|
<!-- END BEADS CODEX SETUP -->
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# Project Instructions for AI Agents
|
||||||
|
|
||||||
|
This file provides instructions and context for AI coding agents working on this project.
|
||||||
|
|
||||||
|
<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:1105d646 -->
|
||||||
|
## Beads Issue Tracker
|
||||||
|
|
||||||
|
This project uses **bd (beads)** for issue tracking. Run `bd prime` to see full workflow context and commands.
|
||||||
|
|
||||||
|
### Quick Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bd ready # Find available work
|
||||||
|
bd show <id> # View issue details
|
||||||
|
bd update <id> --claim # Claim work
|
||||||
|
bd close <id> # Complete work
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
|
||||||
|
- Use `bd` for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
|
||||||
|
- Run `bd prime` for detailed command reference and session close protocol
|
||||||
|
- Use `bd remember` for persistent knowledge — do NOT use MEMORY.md files
|
||||||
|
|
||||||
|
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/core-concepts/sync-concepts.md for details and anti-patterns.
|
||||||
|
|
||||||
|
## Agent Context Profiles
|
||||||
|
|
||||||
|
The managed Beads block is task-tracking guidance, not permission to override repository, user, or orchestrator instructions.
|
||||||
|
|
||||||
|
- **Conservative (default)**: Use `bd` for task tracking. Do not run git commits, git pushes, or Dolt remote sync unless explicitly asked. At handoff, report changed files, validation, and suggested next commands.
|
||||||
|
- **Minimal**: Keep tool instruction files as pointers to `bd prime`; use the same conservative git policy unless active instructions say otherwise.
|
||||||
|
- **Team-maintainer**: Only when the repository explicitly opts in, agents may close beads, run quality gates, commit, and push as part of session close. A current "do not commit" or "do not push" instruction still wins.
|
||||||
|
|
||||||
|
## Session Completion
|
||||||
|
|
||||||
|
This protocol applies when ending a Beads implementation workflow. It is subordinate to explicit user, repository, and orchestrator instructions.
|
||||||
|
|
||||||
|
1. **File issues for remaining work** - Create beads for anything that needs follow-up
|
||||||
|
2. **Run quality gates** (if code changed) - Tests, linters, builds
|
||||||
|
3. **Update issue status** - Close finished work, update in-progress items
|
||||||
|
4. **Handle git/sync by active profile**:
|
||||||
|
```bash
|
||||||
|
# Conservative/minimal/default: report status and proposed commands; wait for approval.
|
||||||
|
git status
|
||||||
|
|
||||||
|
# Team-maintainer opt-in only, unless current instructions forbid it:
|
||||||
|
git pull --rebase
|
||||||
|
git push
|
||||||
|
git status
|
||||||
|
```
|
||||||
|
5. **Hand off** - Summarize changes, validation, issue status, and any blocked sync/commit/push step
|
||||||
|
|
||||||
|
**Critical rules:**
|
||||||
|
- Explicit user or orchestrator instructions override this Beads block.
|
||||||
|
- Do not commit or push without clear authority from the active profile or the current user request.
|
||||||
|
- If a required sync or push is blocked, stop and report the exact command and error.
|
||||||
|
<!-- END BEADS INTEGRATION -->
|
||||||
|
|
||||||
|
|
||||||
|
## Build & Test
|
||||||
|
|
||||||
|
_Add your build and test commands here_
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Example:
|
||||||
|
# npm install
|
||||||
|
# npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Architecture Overview
|
||||||
|
|
||||||
|
_Add a brief overview of your project architecture_
|
||||||
|
|
||||||
|
## Conventions & Patterns
|
||||||
|
|
||||||
|
_Add your project-specific conventions here_
|
||||||
@@ -142,7 +142,7 @@ If you bring a work NixOS machine into your fleet, you can use the same `m3ta-ho
|
|||||||
|
|
||||||
This gives you:
|
This gives you:
|
||||||
|
|
||||||
- Your familiar shell setup (fish, starship, nushell)
|
- Your familiar shell setup (starship, nushell)
|
||||||
- Your CLI tools (fzf, bat, eza, zoxide, etc.)
|
- Your CLI tools (fzf, bat, eza, zoxide, etc.)
|
||||||
- Your editor configs (neovim, zed)
|
- Your editor configs (neovim, zed)
|
||||||
- Work git identity and SSH configuration automatically
|
- Work git identity and SSH configuration automatically
|
||||||
@@ -162,7 +162,6 @@ Every module in m3ta-home has an `enable` option. Base modules default to `true`
|
|||||||
|
|
||||||
```
|
```
|
||||||
base.cliTools.ansible.enable # Ansible (config rollout to servers)
|
base.cliTools.ansible.enable # Ansible (config rollout to servers)
|
||||||
base.shell.fish.enable # Fish shell
|
|
||||||
base.shell.nushell.enable # Nushell
|
base.shell.nushell.enable # Nushell
|
||||||
base.shell.starship.enable # Starship prompt
|
base.shell.starship.enable # Starship prompt
|
||||||
base.cliTools.fzf.enable # Fuzzy finder
|
base.cliTools.fzf.enable # Fuzzy finder
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
# ai-memory auf AZ-LT-NIX anbinden
|
||||||
|
|
||||||
|
Schritt-für-Schritt-Anleitung, um die Arbeits-Workstation an den zentralen
|
||||||
|
ai-memory-Server (`https://memory.m3ta.dev`, läuft auf m3-hermes) anzubinden.
|
||||||
|
Alles auf AZ-LT-NIX landet im Workspace `az`.
|
||||||
|
|
||||||
|
Voraussetzungen, die bereits erledigt sind:
|
||||||
|
|
||||||
|
- Server, Traefik-Route und der Nutzer `sascha` existieren.
|
||||||
|
- Der `aim_`-Key mit Label `az-lt-nix` ist ausgestellt und liegt verschlüsselt
|
||||||
|
(für den Host-Key von AZ-LT-NIX und den Benutzer-Key `sascha.koenig`) im
|
||||||
|
Patch unten.
|
||||||
|
- m3ta-home `master` enthält das Modul `coding.aiMemory` (ab Commit `9633512`).
|
||||||
|
|
||||||
|
## 1. Patch auf AZ-LT-NIX holen
|
||||||
|
|
||||||
|
Der Patch liegt auf m3-kratos unter
|
||||||
|
`/home/m3tam3re/p/AZ/0001-feat-AZ-LT-NIX-enable-ai-memory-client.patch`.
|
||||||
|
Er enthält die vier Änderungen (`secrets.nix`, `hosts/AZ-LT-NIX/secrets.nix`,
|
||||||
|
`hosts/common/users/sascha.koenig.nix`, `secrets/ai-memory-token.age`) und
|
||||||
|
wurde mit `--binary` erzeugt, damit die `.age`-Datei byteidentisch ankommt.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# auf AZ-LT-NIX, in einem leeren Verzeichnis oder dem Repo-Ordner
|
||||||
|
scp m3-kratos:/home/m3tam3re/p/AZ/0001-feat-AZ-LT-NIX-enable-ai-memory-client.patch .
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. Patch anwenden
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/p/NIX/AZ-NIX-CLIENTS # oder wo das Repo liegt
|
||||||
|
git checkout master && git pull --ff-only
|
||||||
|
git am ../0001-feat-AZ-LT-NIX-enable-ai-memory-client.patch
|
||||||
|
```
|
||||||
|
|
||||||
|
Erwartet: ein neuer Commit `feat(AZ-LT-NIX): enable ai-memory client`.
|
||||||
|
|
||||||
|
Gegencheck, dass das Secret für diesen Host lesbar ist:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
age -d -i ~/.ssh/sascha.koenig secrets/ai-memory-token.age | cut -c1-4
|
||||||
|
```
|
||||||
|
|
||||||
|
Erwartet: `aim_`.
|
||||||
|
|
||||||
|
## 3. m3ta-home auf den aktuellen Stand ziehen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix flake update m3ta-home
|
||||||
|
git add flake.lock
|
||||||
|
git commit -m "chore: bump m3ta-home (ai-memory client)"
|
||||||
|
```
|
||||||
|
|
||||||
|
Der Lock muss mindestens auf m3ta-home `9633512` zeigen. Wenn der Pull über
|
||||||
|
SSH nach `code.m3ta.dev` scheitert, den Flake-Input vorübergehend auf
|
||||||
|
`git+https://code.m3ta.dev/m3tam3re/m3ta-home` stellen.
|
||||||
|
|
||||||
|
## 4. Bauen und switchen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix build .#nixosConfigurations.AZ-LT-NIX.config.system.build.toplevel
|
||||||
|
sudo nixos-rebuild switch --flake .#AZ-LT-NIX
|
||||||
|
```
|
||||||
|
|
||||||
|
In der Activation-Ausgabe darf **keine** Zeile
|
||||||
|
`ai-memory: token file /run/agenix/ai-memory-token missing, skipping`
|
||||||
|
stehen. Steht sie da, hat agenix das Secret nicht entschlüsselt (Host-Key
|
||||||
|
prüfen: `ssh-keyscan -t ed25519 localhost` gegen `secrets.nix`).
|
||||||
|
|
||||||
|
## 5. Prüfen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Token und Client-Config
|
||||||
|
ls -la /run/agenix/ai-memory-token ~/.local/share/ai-memory/auth-token
|
||||||
|
cat ~/.local/share/ai-memory/config.toml # server_url + bearer_token_file
|
||||||
|
cat ~/.ai-memory.toml # workspace = "az"
|
||||||
|
|
||||||
|
# Claude Code: Hooks zeigen auf den Server, MCP ist die stdio-Bridge
|
||||||
|
grep -c 'memory.m3ta.dev' ~/.claude/settings.json # > 0
|
||||||
|
claude mcp get ai-memory # Status: Connected, Type: stdio
|
||||||
|
|
||||||
|
# OpenCode: Plugin und MCP-Eintrag
|
||||||
|
grep -o 'const SERVER = "[^"]*"' ~/.config/opencode/plugins/ai-memory-opencode2.ts
|
||||||
|
grep -A4 '"ai-memory"' ~/.config/opencode/opencode.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Dann eine kurze Claude-Code-Session und eine OpenCode-Session in einem
|
||||||
|
Arbeits-Repo starten und wieder beenden. Danach von kratos aus:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-memory list-projects
|
||||||
|
```
|
||||||
|
|
||||||
|
Erwartet: das Repo erscheint im Workspace `az`.
|
||||||
|
|
||||||
|
## 6. Pushen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git push origin master
|
||||||
|
```
|
||||||
|
|
||||||
|
## Was das Modul auf dem Host macht
|
||||||
|
|
||||||
|
- Nix schreibt `~/.local/share/ai-memory/config.toml` (Server-URL,
|
||||||
|
`bearer_token_file = /run/agenix/ai-memory-token`), den MCP-Eintrag in
|
||||||
|
`opencode.json` und den Marker `~/.ai-memory.toml` mit `workspace = "az"`
|
||||||
|
plus den Capture-Ausschlüssen.
|
||||||
|
- Die Activation verlinkt `~/.local/share/ai-memory/auth-token` auf das
|
||||||
|
Secret (Hooks und OpenCode-Plugin lesen diesen Pfad), ruft
|
||||||
|
`ai-memory install-hooks` für Claude Code und OpenCode2 auf, registriert
|
||||||
|
für Claude Code die session-aware stdio-Bridge und installiert die Skills
|
||||||
|
nach `~/.agents/skills`.
|
||||||
|
- Der Token steht in keiner generierten Datei. Die MCP-Bridge liest ihn aus
|
||||||
|
der Client-Config, Hooks und Plugin über den `auth-token`-Symlink.
|
||||||
|
|
||||||
|
## Bekannte Grenzen
|
||||||
|
|
||||||
|
- `ai-memory doctor`, `recent` und `search` im Terminal brauchen den
|
||||||
|
Root-Bearer und antworten mit dem Host-Key `403`. Agents über MCP sind
|
||||||
|
nicht betroffen.
|
||||||
|
- Ist der Server nicht erreichbar, puffern die Hooks lokal in
|
||||||
|
`~/.local/share/ai-memory/hook-spool` und liefern nach.
|
||||||
|
- Key rotieren: auf m3-hermes `ai-memory api-key rotate` für Label
|
||||||
|
`az-lt-nix`, neuen Wert mit `age -r <AZ-LT-NIX> -r <sascha.koenig>` in
|
||||||
|
`secrets/ai-memory-token.age` schreiben, switchen.
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
# T3 Code als NixOS-Modul: Implementierungsplan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** T3 Code läuft aus einem Modul in m3ta-home auf m3-kratos und AZ-LT-NIX, folgt dem aktiven NetBird-Profil, und T3-Agents arbeiten auf beiden Gitea-Instanzen als `m3ta-chiron`.
|
||||||
|
|
||||||
|
**Architecture:** m3ta-home exportiert `nixosModules.t3code` und `overlays.t3code-agent-identity`. `nixos-config` und AZ-NIX-CLIENTS binden beides ein und liefern pro Host nur `enable`, `user`, `port` und Secrets.
|
||||||
|
|
||||||
|
**Tech Stack:** Nix Flakes, NixOS-Module, systemd, agenix, tea, NetBird 0.81.
|
||||||
|
|
||||||
|
**Spec:** `docs/superpowers/specs/2026-11-02-t3code-nixos-module-design.md`
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- Secret-Pfade: `/run/agenix/agent-gitea-token-m3ta` und `/run/agenix/agent-gitea-token-az`.
|
||||||
|
- Instanzen: `m3ta` = `https://code.m3ta.dev`, SSH-Port 22; `az` = `https://git.az-gruppe.com`, SSH-Port 2022; SSH-User jeweils `gitea`.
|
||||||
|
- Identität: `m3ta-chiron` / `m3ta-chiron@agentmail.to`; Schlüssel `~/.ssh/m3ta-chiron`.
|
||||||
|
- Host-Keys: `code.m3ta.dev ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmmqZ4GgDEXJgj8uYrZAr/EoLIA6LJGkTIyKGQD/60a` und `[git.az-gruppe.com]:2022 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItSijmU5YwcJcoshtmYxpxBaVA4TPaCMk23ws7KDkAH`.
|
||||||
|
- Port-Default `3773`; Interface-Default `wt0`.
|
||||||
|
- Kein `switch`, kein Push und kein Merge ohne ausdrückliche Freigabe. Arbeit in jedem Repo auf dem Branch `feat/t3code-module`.
|
||||||
|
- `nixos-config` nur in einem Worktree auf Basis von `origin/master` ändern; `secrets/rustfs-secret-key.age` im Hauptcheckout bleibt unberührt.
|
||||||
|
- Tokens nie in Logs, Testausgaben oder den Nix-Store.
|
||||||
|
|
||||||
|
## Review Focus
|
||||||
|
|
||||||
|
- `wt0` ist beim Dienststart da, hat aber noch keine IPv4: Das Skript wartet höchstens 60 Sekunden und bindet nie an `0.0.0.0` (Test Task 1).
|
||||||
|
- Nur ein Token ist lesbar: Genau dieser Login wird erzeugt und trägt `default: true` (Test Task 2).
|
||||||
|
- Kein Token ist lesbar: `tea` läuft ohne Login weiter, ohne Abbruch im Wrapper (Test Task 2).
|
||||||
|
- `user` fehlt oder NetBird ist aus: Die Evaluation scheitert mit klarer Meldung statt zur Laufzeit (Test Task 1).
|
||||||
|
- Git-Remote auf `git.az-gruppe.com`: SSH nutzt Port 2022 und `m3ta-chiron`, andere Hosts weiter `~/.ssh/config` (Test Task 2).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 0: Voraussetzungen durch Sascha
|
||||||
|
|
||||||
|
Nicht durch Agents ausführbar. Task 1 hängt nur an Schritt 1, Task 4 und 5 auch an den Secrets.
|
||||||
|
|
||||||
|
- [ ] **Step 1: `wt0`-Verhalten prüfen.** Zweites Profil anlegen, wechseln und `ip monitor link dev wt0` beobachten. Erwartet: `wt0` verschwindet und entsteht neu. Sonst bekommt Task 1 den in der Spec genannten `ip monitor`-Watcher.
|
||||||
|
- [ ] **Step 2: Schlüssel und Tokens.** Tabelle „Voraussetzungen“ der Spec abarbeiten.
|
||||||
|
- [ ] **Step 3: `.age`-Dateien** laut Tabelle „Secrets“ der Spec erzeugen, nachdem Task 4 und 5 die `secrets.nix`-Einträge ergänzt haben.
|
||||||
|
|
||||||
|
### Task 1: NixOS-Modul
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `modules/nixos/t3code.nix`
|
||||||
|
- Create: `modules/nixos/t3code.test.sh`
|
||||||
|
- Modify: `flake.nix`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `nixosModules.t3code` mit den Optionen `m3ta.t3code.{enable,user,port,interface,package}` aus der Spec.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Test schreiben.** `t3code.test.sh` evaluiert das Modul per `nixpkgs.lib.nixosSystem` mit einem Stub-`llm-agents.t3code` (Stil wie `profiles/sets/coding/agents/ai-memory.test.sh`) und prüft:
|
||||||
|
- `bindsTo` und `wantedBy` enthalten `sys-subsystem-net-devices-wt0.device`
|
||||||
|
- `serviceConfig.User` ist `alice`, `environment.T3CODE_PORT` ist `"3773"`, `HOME` ist `/home/alice`
|
||||||
|
- `networking.firewall.interfaces.wt0.allowedTCPPorts` ist `[3773]`
|
||||||
|
- ohne `services.netbird.enable` scheitert der Build von `system.build.toplevel` mit `m3ta.t3code requires services.netbird.enable`
|
||||||
|
- ohne `user` scheitert die Evaluation
|
||||||
|
- `enable = false` erzeugt keinen Dienst
|
||||||
|
- [ ] **Step 2: Startskript-Test ergänzen.** Das Skript mit einem Stub für `ip` und `t3` starten. Liefert der Stub sofort eine Adresse, ist der `t3`-Aufruf `serve --host 100.1.2.3`. Liefert er keine, endet das Skript mit Exit 1 (Timeout im Test per `T3CODE_ADDR_TIMEOUT=1`, Default `60`) und ruft `t3` nicht auf.
|
||||||
|
- [ ] **Step 3: Test ausführen.** `bash modules/nixos/t3code.test.sh`; erwartet: FAIL, weil das Modul fehlt.
|
||||||
|
- [ ] **Step 4: Modul schreiben** laut Abschnitt „Modul“ der Spec. Startskript per `pkgs.writeShellApplication`, Adresse per `ip -4 -o addr show dev <interface>`, Aufruf mit `exec`. In `flake.nix`: `nixosModules.t3code = ./modules/nixos/t3code.nix`.
|
||||||
|
- [ ] **Step 5: Test ausführen.** Erwartet: PASS.
|
||||||
|
- [ ] **Step 6: Commit** `feat(t3code): add NixOS module bound to the NetBird interface`.
|
||||||
|
|
||||||
|
### Task 2: Identitäts-Overlay mit zwei Instanzen
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `overlays/t3code-agent-identity.nix`
|
||||||
|
- Create: `overlays/t3code-agent-identity.test.sh`
|
||||||
|
- Modify: `flake.nix`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `overlays.t3code-agent-identity`. Die Datei ist `{tokenFiles ? {}}: final: prev: {…}`; die Instanzliste steht in der Datei, `tokenFiles` überschreibt Token-Pfade pro Instanzname (für Tests). Der Flake exportiert die Standardanwendung und behält `inputs.m3ta-nixpkgs.overlays` per `//`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Test schreiben.** Overlay mit Test-Instanzen und temporären Token-Dateien anwenden, gegen einen Stub-`llm-agents.t3code` bauen und prüfen:
|
||||||
|
- beide Tokens lesbar: `tea logins` listet `m3ta` und `az` mit ihren URLs
|
||||||
|
- nur `az` lesbar: nur `az`, mit `default: true`
|
||||||
|
- keiner lesbar: `tea logins` endet mit Exit 0 und leerer Liste
|
||||||
|
- ein gefälschtes Token taucht nach dem Lauf nirgends unter `$TMPDIR` auf (Temp-Verzeichnis aufgeräumt) und nicht im Closure (`nix-store -qR` + `grep`)
|
||||||
|
- `ssh -F <config> -G git.az-gruppe.com`: `port 2022`, `user gitea`, `identityfile ~/.ssh/m3ta-chiron`
|
||||||
|
- `ssh -F <config> -G code.m3ta.dev`: `port 22`, `user gitea`, gleicher Schlüssel
|
||||||
|
- `ssh -F <config> -G example.org` mit Test-`HOME` und eigener `~/.ssh/config`: nutzt deren Werte, kein `m3ta-chiron`
|
||||||
|
- im Wrapper sind `GIT_AUTHOR_NAME` und `GIT_COMMITTER_NAME` `m3ta-chiron`
|
||||||
|
- [ ] **Step 2: Test ausführen.** Erwartet: FAIL.
|
||||||
|
- [ ] **Step 3: Overlay schreiben.** Aus `git show origin/master:overlays/default.nix` in `nixos-config` übernehmen (`t3code-agent-identity`) und nur die festen Werte durch `instances` ersetzen. Der Rest-Block wird `Host * !code.m3ta.dev !git.az-gruppe.com`, aus `instances` erzeugt. Beibehalten: privates Temp-Verzeichnis pro Aufruf und der Kommentar zum `IdentityFile`-Verhalten.
|
||||||
|
- [ ] **Step 4: Test ausführen.** Erwartet: PASS.
|
||||||
|
- [ ] **Step 5: Commit** `feat(t3code): move agent identity overlay here, support two Gitea instances`.
|
||||||
|
|
||||||
|
### Task 3: `gitIdentity.sshKey` überschreibbar
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `profiles/sets/coding/agents/agents.nix:16`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Ändern.** `sshKey = lib.mkDefault "/home/m3tam3re/.ssh/gitea"`, `lib` in die Modulargumente aufnehmen.
|
||||||
|
- [ ] **Step 2: Prüfen.** Aus AZ-NIX-CLIENTS: `nix eval --raw --override-input m3ta-home path:<m3ta-home> .#nixosConfigurations.AZ-LT-NIX.config.home-manager.users."sascha.koenig".coding.agents.gitIdentity.sshKey`. Erwartet: `/home/m3tam3re/.ssh/gitea`, also unverändert ohne Override.
|
||||||
|
- [ ] **Step 3: Commit** `fix(agents): let hosts override the agent SSH key path`.
|
||||||
|
|
||||||
|
### Task 4: AZ-NIX-CLIENTS einbinden
|
||||||
|
|
||||||
|
**Files** (Repo `AZ-NIX-CLIENTS`):
|
||||||
|
- Modify: `hosts/common/default.nix` (Overlay nach `llm-agents-overrides`, Modul-Import)
|
||||||
|
- Modify: `hosts/common/ports.nix` (`t3code = 3773`)
|
||||||
|
- Modify: `hosts/common/users/sascha.koenig.nix` (`coding.agents.gitIdentity.sshKey = "/home/sascha.koenig/.ssh/m3ta-chiron"` in den AZ-LT-NIX-Flags)
|
||||||
|
- Modify: `hosts/AZ-LT-NIX/services/default.nix` oder neue `services/t3code.nix` (`m3ta.t3code`)
|
||||||
|
- Modify: `hosts/AZ-LT-NIX/secrets.nix`, `secrets.nix`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `nixosModules.t3code`, `overlays.t3code-agent-identity`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Änderungen ohne Secrets einbauen.** `m3ta.t3code = { enable = true; user = "sascha.koenig"; port = config.m3ta.ports.get "t3code"; };`
|
||||||
|
- [ ] **Step 2: Bauen.** `nixos-rebuild build --flake .#AZ-LT-NIX --override-input m3ta-home path:<m3ta-home>`; erwartet: Erfolg.
|
||||||
|
- [ ] **Step 3: Werte prüfen.** Per `nix eval`: `systemd.services.t3code.serviceConfig.User` ist `sascha.koenig`, `gitIdentity.sshKey` ist der neue Pfad.
|
||||||
|
- [ ] **Step 4: Thin Client prüfen.** `nix eval .#nixosConfigurations.AZ-TC-01.config.systemd.services.t3code.enable` mit Override: Fehler oder fehlender Dienst; der Host bekommt keinen T3-Dienst.
|
||||||
|
- [ ] **Step 5: Commit** `feat(AZ-LT-NIX): run T3 Code from the m3ta-home module`.
|
||||||
|
- [ ] **Step 6: Secret-Einträge ergänzen,** sobald Saschas `.age`-Dateien da sind (Rezept: `publicKeys` aus der Spec), bauen, Commit `feat(AZ-LT-NIX): add agent Gitea tokens`.
|
||||||
|
|
||||||
|
### Task 5: nixos-config umstellen
|
||||||
|
|
||||||
|
**Files** (Repo `nixos-config`, Worktree auf `origin/master`):
|
||||||
|
- Modify: `hosts/common/default.nix`, `overlays/default.nix` (lokales Overlay entfernen, das aus m3ta-home einbinden, Modul-Import)
|
||||||
|
- Delete: `hosts/m3-kratos/services/t3code.nix`
|
||||||
|
- Modify: `hosts/m3-kratos/services/default.nix`, `hosts/m3-kratos/secrets.nix`, `hosts/m3-hermes/secrets.nix`, `hosts/m3-hermes/services/t3code.nix` (Kommentar zum Secret-Namen), `secrets.nix`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: wie Task 4.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Worktree anlegen** und Modul sowie Overlay einbinden. Für m3-kratos: `m3ta.t3code` laut Spec.
|
||||||
|
- [ ] **Step 2: Bauen.** m3-kratos und m3-hermes mit `--override-input m3ta-home path:<m3ta-home>`; erwartet: Erfolg.
|
||||||
|
- [ ] **Step 3: Prüfen.** m3-hermes-`ExecStart` enthält weiter `--host 0.0.0.0`. m3-kratos-`ExecStart` enthält keine feste IP mehr.
|
||||||
|
- [ ] **Step 4: Commit** `refactor(m3-kratos): use the T3 Code module from m3ta-home`.
|
||||||
|
- [ ] **Step 5: Secrets umstellen,** sobald Saschas `.age`-Dateien da sind: `hermes-gitea-token` durch `agent-gitea-token-m3ta` ersetzen, `agent-gitea-token-az` nur auf m3-kratos. `git grep hermes-gitea-token` ist danach leer. Bauen, Commit `refactor(secrets): rename agent Gitea tokens per instance`.
|
||||||
|
|
||||||
|
### Task 6: Abschluss und Rollout
|
||||||
|
|
||||||
|
Pushes, Lock-Updates und `switch` nur nach ausdrücklicher Freigabe.
|
||||||
|
|
||||||
|
- [ ] **Step 1:** m3ta-home mergen und pushen, in beiden Repos `nix flake update m3ta-home`, ohne Override erneut bauen.
|
||||||
|
- [ ] **Step 2:** Deployment auf AZ-LT-NIX, dann m3-kratos; m3-hermes erhält nur den Secret-Wechsel.
|
||||||
|
- [ ] **Step 3: Kriterien 2 bis 6 der Spec prüfen.** Je Profil `ss -ltnp | grep 3773` zeigt die aktuelle NetBird-IP. Je Instanz ein Testcommit aus einer T3-Session (`git log -1 --format='%an %cn'`), Push und `tea repos`. Pairing pro Netz prüfen und das Ergebnis in die Spec schreiben.
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
# T3 Code als NixOS-Modul in m3ta-home
|
||||||
|
|
||||||
|
## Ziel
|
||||||
|
|
||||||
|
Der T3-Code-Server wird einmal in m3ta-home definiert statt pro Host. Er läuft auf
|
||||||
|
m3-kratos (`nixos-config`) und AZ-LT-NIX (`AZ-NIX-CLIENTS`) und ist nur aus dem
|
||||||
|
gerade aktiven NetBird-Netz erreichbar. Zwischen privatem und Firmen-Control-Server
|
||||||
|
wird zur Laufzeit per NetBird-Profil gewechselt, ohne Rebuild. Von T3 gestartete
|
||||||
|
Agents committen auf beiden Hosts als `m3ta-chiron`.
|
||||||
|
|
||||||
|
## Erfolgskriterien
|
||||||
|
|
||||||
|
1. Beide Hosts bauen mit `m3ta.t3code.enable = true`; pro Host sind nur `enable` und `user` nötig.
|
||||||
|
2. Nach `netbird up --profile <name>` lauscht T3 Code auf der neuen NetBird-IP, ohne manuellen Eingriff.
|
||||||
|
3. Der Port ist nur über `wt0` offen, und der Server bindet nie an eine andere Adresse.
|
||||||
|
4. Ein Commit aus einer T3-Session auf AZ-LT-NIX hat `m3ta-chiron` als Author und Committer.
|
||||||
|
5. Pushes aus einer T3-Session nach `code.m3ta.dev` und `git.az-gruppe.com` nutzen `~/.ssh/m3ta-chiron`.
|
||||||
|
6. Tea nutzt in Repos beider Instanzen den passenden Token.
|
||||||
|
|
||||||
|
## Nicht im Umfang
|
||||||
|
|
||||||
|
- m3-hermes behält seinen Dienst und seine Agent-Runtime. Der Host bekommt nur das Overlay aus der neuen Quelle.
|
||||||
|
- Beide NetBird-Netze gleichzeitig (`services.netbird.clients`).
|
||||||
|
- Deklarative NetBird-Profile: Sie enthalten die Peer-Registrierung und bleiben imperativ.
|
||||||
|
- Die übrige NetBird-Konfiguration der Hosts.
|
||||||
|
|
||||||
|
## Modul
|
||||||
|
|
||||||
|
`modules/nixos/t3code.nix`, exportiert als `nixosModules.t3code`.
|
||||||
|
|
||||||
|
| Option | Typ | Default |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `m3ta.t3code.enable` | bool | `false` |
|
||||||
|
| `m3ta.t3code.user` | str | keiner (Pflichtfeld) |
|
||||||
|
| `m3ta.t3code.port` | port | `3773` |
|
||||||
|
| `m3ta.t3code.interface` | str | `"wt0"` |
|
||||||
|
| `m3ta.t3code.package` | package | `pkgs.llm-agents.t3code` |
|
||||||
|
| `m3ta.t3code.environmentFile` | null oder absoluter Pfad außerhalb des Stores | `null` |
|
||||||
|
|
||||||
|
Eine Assertion verlangt `services.netbird.enable = true`.
|
||||||
|
|
||||||
|
`systemd.services.t3code`:
|
||||||
|
|
||||||
|
- Läuft als `user` mit Gruppe `users`; `HOME` und `WorkingDirectory` kommen aus `config.users.users.<user>.home`.
|
||||||
|
- `T3CODE_PORT` kommt aus `port`.
|
||||||
|
- `environmentFile` wird, falls gesetzt, als `EnvironmentFile` geladen (`KEY=value`-Zeilen, z. B. ein agenix-Secret).
|
||||||
|
- `path` enthält `/etc/profiles/per-user/<user>` und `/run/current-system/sw`.
|
||||||
|
- `Restart = "on-failure"`, `RestartSec = 5`.
|
||||||
|
- `bindsTo`, `after` und `wantedBy` zeigen auf `sys-subsystem-net-devices-<interface>.device`.
|
||||||
|
- `after` enthält zusätzlich `netbird.service`.
|
||||||
|
|
||||||
|
Das Startskript wartet auf die IPv4-Adresse des Interface und führt dann
|
||||||
|
`t3 serve --host <ip>` per `exec` aus. Kommt innerhalb von 60 Sekunden keine Adresse,
|
||||||
|
beendet es sich mit Fehler und `Restart` versucht es erneut.
|
||||||
|
|
||||||
|
Die Firewall öffnet `networking.firewall.interfaces.<interface>.allowedTCPPorts = [port]`.
|
||||||
|
|
||||||
|
Der Import steht in `hosts/common` beider Repos, `enable` und `user` in der Host-Konfiguration.
|
||||||
|
|
||||||
|
## Profilwechsel
|
||||||
|
|
||||||
|
Die Profile werden einmal pro Host angelegt:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
netbird profile add private
|
||||||
|
netbird up --profile private --management-url https://<privater-server>
|
||||||
|
```
|
||||||
|
|
||||||
|
Danach genügt `netbird up --profile <name>`. Das Profil `default` ist auf AZ-LT-NIX
|
||||||
|
der Firmen-Server. `wt0` verschwindet beim Wechsel und entsteht neu, dadurch startet
|
||||||
|
der Dienst über die Device-Unit neu.
|
||||||
|
|
||||||
|
**Bestätigt am 2026-11-02 auf AZ-LT-NIX:** Wechsel zwischen den Netzen über den
|
||||||
|
NetBird-Client funktioniert, T3 Code folgt ohne Eingriff. Ein Watcher für
|
||||||
|
Adressänderungen ist nicht nötig.
|
||||||
|
|
||||||
|
T3-Clients brauchen pro Netz einen eigenen Eintrag und müssen im selben Netz sein.
|
||||||
|
Ob pro Adresse neu gepairt werden muss, wird beim Rollout geprüft.
|
||||||
|
|
||||||
|
## Agent-Identität
|
||||||
|
|
||||||
|
Das Overlay `t3code-agent-identity` wandert aus `nixos-config/overlays/default.nix`
|
||||||
|
nach m3ta-home und wird als `overlays.t3code-agent-identity` zusätzlich zu den
|
||||||
|
`m3ta-nixpkgs`-Overlays exportiert. Beide Repos binden es nach
|
||||||
|
`llm-agents.overlays.shared-nixpkgs` ein, AZ-NIX-CLIENTS zusätzlich nach
|
||||||
|
`llm-agents-overrides`. Es umhüllt `t3code` und `t3code-desktop`, also gilt die
|
||||||
|
Identität auch für die Desktop-App.
|
||||||
|
|
||||||
|
Die Identität gilt nur für Prozesse, die T3 startet. Die globale Git-Konfiguration
|
||||||
|
auf AZ-LT-NIX bleibt `Sascha König`. Author und Committer gelten für jedes Remote.
|
||||||
|
|
||||||
|
### Mehrere Gitea-Instanzen
|
||||||
|
|
||||||
|
`m3ta-chiron` existiert auf zwei Instanzen, jede mit eigenem Token. Das Overlay
|
||||||
|
bekommt dafür eine Instanzliste statt der festen Werte für `code.m3ta.dev`:
|
||||||
|
|
||||||
|
| Name | URL | SSH | Token-Datei |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `m3ta` | `https://code.m3ta.dev` | `gitea@code.m3ta.dev:22` | `/run/agenix/agent-gitea-token-m3ta` |
|
||||||
|
| `az` | `https://git.az-gruppe.com` | `gitea@git.az-gruppe.com:2022` | `/run/agenix/agent-gitea-token-az` |
|
||||||
|
|
||||||
|
Daraus erzeugt das Overlay:
|
||||||
|
|
||||||
|
- **tea:** Der Wrapper schreibt pro lesbarer Token-Datei einen Login. Tea wählt den Login selbst anhand des Hosts im Git-Remote (`MatchLogins`), der Token geht also nur an seine Instanz. Fehlt eine Datei, entfällt nur dieser Login. `default: true` trägt der erste erzeugte Login.
|
||||||
|
- **SSH:** Pro Instanz ein `Host`-Block mit `User gitea`, Port, `IdentityFile ~/.ssh/m3ta-chiron` und `IdentitiesOnly yes`. Alle anderen Hosts nutzen weiter `~/.ssh/config`.
|
||||||
|
- **Known Hosts:** Die Host-Keys beider Instanzen, für `git.az-gruppe.com` als `[git.az-gruppe.com]:2022`.
|
||||||
|
|
||||||
|
Eine Instanz, die nicht in der Liste steht, bekommt weder SSH-Einstellungen noch Token.
|
||||||
|
|
||||||
|
Beide Accounts nutzen denselben Schlüssel `~/.ssh/m3ta-chiron` pro Host.
|
||||||
|
|
||||||
|
### Secrets
|
||||||
|
|
||||||
|
Pro Instanz gibt es eine eigene Datei, damit sich Tokens einzeln rotieren lassen und
|
||||||
|
der Arbeits-Token nur auf den Hosts liegt, die ihn brauchen.
|
||||||
|
|
||||||
|
| Repo | Datei | `publicKeys` | Hosts |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| AZ-NIX-CLIENTS | `secrets/agent-gitea-token-m3ta.age` | `[AZ-LT-NIX sascha.koenig]` | AZ-LT-NIX |
|
||||||
|
| AZ-NIX-CLIENTS | `secrets/agent-gitea-token-az.age` | `[AZ-LT-NIX sascha.koenig]` | AZ-LT-NIX |
|
||||||
|
| nixos-config | `secrets/agent-gitea-token-m3ta.age` | wie bisher `hermes-gitea-token` | m3-kratos, m3-hermes |
|
||||||
|
| nixos-config | `secrets/agent-gitea-token-az.age` | `[m3-kratos] ++ users` | m3-kratos |
|
||||||
|
|
||||||
|
m3-hermes bekommt den Arbeits-Token nicht.
|
||||||
|
|
||||||
|
In nixos-config ersetzt die neue Datei `hermes-gitea-token.age`; der Inhalt bleibt
|
||||||
|
gleich. Alle Tokens gehören dem Account `m3ta-chiron` der jeweiligen Instanz.
|
||||||
|
|
||||||
|
### Voraussetzungen
|
||||||
|
|
||||||
|
| Was | Wie | Durch |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `~/.ssh/m3ta-chiron` auf AZ-LT-NIX | `ssh-keygen -t ed25519 -N "" -C chiron-t3-az-lt-nix -f ~/.ssh/m3ta-chiron` | Sascha |
|
||||||
|
| `~/.ssh/m3ta-chiron` auf m3-kratos | Vorhandenen Schlüssel prüfen, sonst wie oben mit `-C chiron-t3-m3-kratos` anlegen | Sascha |
|
||||||
|
| Public Keys | Beide Hosts beim Account `m3ta-chiron` auf beiden Instanzen eintragen | Sascha |
|
||||||
|
| Erreichbarkeit | Von m3-kratos `ssh -T -p 2022 gitea@git.az-gruppe.com` testen | Sascha |
|
||||||
|
| Tokens und `.age`-Dateien | Pro Instanz einen Token erzeugen und mit `agenix -e` verschlüsseln | Sascha |
|
||||||
|
| agenix-Einträge in den Host-`secrets.nix` | Owner ist der jeweilige T3-User | Implementierung |
|
||||||
|
|
||||||
|
### Korrektur an `coding.agents.gitIdentity`
|
||||||
|
|
||||||
|
`profiles/sets/coding/agents/agents.nix` setzt `sshKey` fest auf
|
||||||
|
`/home/m3tam3re/.ssh/gitea`. Auf AZ-LT-NIX steht dieser Pfad deshalb schon heute in
|
||||||
|
`GIT_SSH_COMMAND` in `hm-session-vars.sh`, obwohl die Datei dort nicht existiert.
|
||||||
|
|
||||||
|
- `agents.nix` setzt den Wert per `lib.mkDefault`.
|
||||||
|
- AZ-LT-NIX setzt `coding.agents.gitIdentity.sshKey = "/home/sascha.koenig/.ssh/m3ta-chiron"`.
|
||||||
|
|
||||||
|
Dieselbe `gitIdentity` exportiert `GIT_AUTHOR_*` und `GIT_SSH_COMMAND` für alle Shells,
|
||||||
|
die `hm-session-vars.sh` laden. In Nushell sind die Variablen nicht gesetzt. In Shells,
|
||||||
|
die die Datei laden, committet und pusht auf AZ-LT-NIX also auch manuelles Git als
|
||||||
|
`m3ta-chiron`. Dieses Verhalten bleibt unverändert.
|
||||||
|
|
||||||
|
## Änderungen pro Repo
|
||||||
|
|
||||||
|
**m3ta-home**
|
||||||
|
|
||||||
|
- Neu: `modules/nixos/t3code.nix`
|
||||||
|
- `flake.nix`: Outputs `nixosModules.t3code` und `overlays.t3code-agent-identity`
|
||||||
|
- `agents.nix`: `sshKey` per `mkDefault`
|
||||||
|
|
||||||
|
**nixos-config**
|
||||||
|
|
||||||
|
- Flake-Input `m3ta-home` aktualisieren, Modul und Overlay aus m3ta-home einbinden
|
||||||
|
- Lokales Overlay und `hosts/m3-kratos/services/t3code.nix` entfernen
|
||||||
|
- m3-kratos: `m3ta.t3code = { enable = true; user = "m3tam3re"; port = config.m3ta.ports.get "t3code"; };`
|
||||||
|
- `hermes-gitea-token` durch `agent-gitea-token-m3ta` ersetzen (`secrets.nix`, m3-kratos, m3-hermes)
|
||||||
|
- `agent-gitea-token-az` ergänzen (`secrets.nix`, m3-kratos)
|
||||||
|
|
||||||
|
**AZ-NIX-CLIENTS**
|
||||||
|
|
||||||
|
- Flake-Input `m3ta-home` aktualisieren, Modul und Overlay einbinden
|
||||||
|
- `t3code = 3773` in `hosts/common/ports.nix`
|
||||||
|
- AZ-LT-NIX: `m3ta.t3code`, `gitIdentity.sshKey`, beide Secret-Einträge
|
||||||
|
- `secrets.nix`: Einträge für beide Tokens
|
||||||
|
|
||||||
|
Der lokale `nixos-config`-Klon ist 112 Commits hinter `origin/master` und hat eine
|
||||||
|
lokale Änderung an `secrets/rustfs-secret-key.age`. Die Arbeit dort startet in einem
|
||||||
|
eigenen Worktree auf Basis von `origin/master`.
|
||||||
|
|
||||||
|
## Reihenfolge
|
||||||
|
|
||||||
|
1. Prüfung des `wt0`-Verhaltens durch Sascha, weil die Firmenverbindung dabei kurz wegfällt.
|
||||||
|
2. m3ta-home implementieren.
|
||||||
|
3. Beide Hosts mit `--override-input m3ta-home path:…` bauen, ohne `switch`.
|
||||||
|
4. Schlüssel und Secret für AZ-LT-NIX anlegen (siehe Voraussetzungen).
|
||||||
|
5. Deployment auf AZ-LT-NIX, dann m3-kratos.
|
||||||
|
|
||||||
|
## Fehlerfälle
|
||||||
|
|
||||||
|
- **Keine Adresse auf `wt0`:** Das Startskript scheitert nach 60 Sekunden, systemd versucht es erneut.
|
||||||
|
- **NetBird getrennt:** Der Dienst stoppt mit `wt0` und startet nur mit `wt0` wieder. T3 Code ist dann offline, aber nie außerhalb des Mesh erreichbar.
|
||||||
|
- **Schlüssel fehlt:** Der Push zu einer der beiden Instanzen scheitert, es gibt keinen Rückfall auf einen persönlichen Schlüssel.
|
||||||
|
- **Token fehlt:** T3 erkennt die betroffene Instanz nicht als Gitea. Commits und Pushes funktionieren weiter, Change Requests nicht. Die andere Instanz ist nicht betroffen.
|
||||||
|
|
||||||
|
## Prüfung
|
||||||
|
|
||||||
|
- `nix eval` und `nixos-rebuild build` für AZ-LT-NIX und m3-kratos.
|
||||||
|
- Nach dem Deployment: Kriterien 2 bis 6, je Profil mit `ss -ltnp`, je Instanz mit einem Testcommit und `tea repos`.
|
||||||
Generated
+19
-19
@@ -159,11 +159,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1792649357,
|
"lastModified": 1792981560,
|
||||||
"narHash": "sha256-rs7tJ0CXejdadqy7LmcsFtsocx1qORmXMYfu1/z2AJM=",
|
"narHash": "sha256-wTMsaavNJwgGOX991oIa6xgDWHwJnWdi9bwwQsjGkAg=",
|
||||||
"owner": "AvengeMedia",
|
"owner": "AvengeMedia",
|
||||||
"repo": "dms-plugin-registry",
|
"repo": "dms-plugin-registry",
|
||||||
"rev": "39085a4579bb4b030492291d615542afc5a55a29",
|
"rev": "cb788da6d2e6cf20205784c0baca041e48183612",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -285,11 +285,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1792605213,
|
"lastModified": 1792896866,
|
||||||
"narHash": "sha256-J73EBU30r2hXvHCcBtaigQDAIu/GGPYk1nc6P9THcmg=",
|
"narHash": "sha256-/0tELNnhdSnP+bHSdWiEe6KpfSwi6WrTnT9cm/jNkjA=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "ab97a5d09e0f2aa7339cfd35ec5824fd6653e27c",
|
"rev": "c216bf5a1f173b0481bd5c8c489ebe5595ecc68c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -310,11 +310,11 @@
|
|||||||
"opencode": "opencode"
|
"opencode": "opencode"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1792655537,
|
"lastModified": 1792997202,
|
||||||
"narHash": "sha256-EKhK6UoEpp5WOE4WLphgmil3WHsGV5k8PBtXMnBTsIQ=",
|
"narHash": "sha256-tHNAo+Yc/7oUzxvnkAnximNt4MPRy2sW0tQAZ1Jq6oo=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "ffd27fba207bca9236e2782d6da893b543332a52",
|
"rev": "72695e2ef0b4f476ea28979dfdcd5a659d9496ce",
|
||||||
"revCount": 408,
|
"revCount": 411,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "ssh://gitea@code.m3ta.dev/m3tam3re/nixpkgs"
|
"url": "ssh://gitea@code.m3ta.dev/m3tam3re/nixpkgs"
|
||||||
},
|
},
|
||||||
@@ -423,11 +423,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_4": {
|
"nixpkgs_4": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1792502884,
|
"lastModified": 1792773339,
|
||||||
"narHash": "sha256-IoNisKcGbUjdd45qCqywGMCYmZ5EnkxezvLII0FWwNA=",
|
"narHash": "sha256-rZLrzrC6i+jnTAlvPZHogKDulY7WWDEv9hJeHieO7Zw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "02c087f3fe673c9e317f206a627cb6b910336dbe",
|
"rev": "3ec636362e1816bc2f0888fa0fa2c69f1bc9e504",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -439,11 +439,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_5": {
|
"nixpkgs_5": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1792502884,
|
"lastModified": 1792773339,
|
||||||
"narHash": "sha256-IoNisKcGbUjdd45qCqywGMCYmZ5EnkxezvLII0FWwNA=",
|
"narHash": "sha256-rZLrzrC6i+jnTAlvPZHogKDulY7WWDEv9hJeHieO7Zw=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "02c087f3fe673c9e317f206a627cb6b910336dbe",
|
"rev": "3ec636362e1816bc2f0888fa0fa2c69f1bc9e504",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -480,11 +480,11 @@
|
|||||||
"nixpkgs": "nixpkgs_5"
|
"nixpkgs": "nixpkgs_5"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1792654632,
|
"lastModified": 1792997485,
|
||||||
"narHash": "sha256-OSiP+J6DRaKBUgIJrk0PCT0hDa8WaRPmjHWYZ8AtQWs=",
|
"narHash": "sha256-f4HoNZ30TvZgK/uaZAxTCGeV3XDW2DPdcuiM1azihKw=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "b4e5f7d5440209cd144830fc996c647190fd715a",
|
"rev": "01c200726e3d527b5101b440be0ab19a7f74cba1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -50,6 +50,10 @@
|
|||||||
selfPath = self.outPath;
|
selfPath = self.outPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# NixOS modules — import in nixos-config via:
|
||||||
|
# imports = [ inputs.m3ta-home.nixosModules.t3code ];
|
||||||
|
nixosModules.t3code = ./modules/nixos/t3code.nix;
|
||||||
|
|
||||||
# Library functions — use in nixos-config via:
|
# Library functions — use in nixos-config via:
|
||||||
# m3ta-lib = inputs.m3ta-home.lib;
|
# m3ta-lib = inputs.m3ta-home.lib;
|
||||||
# imports = [ (m3ta-lib.mkHome { ... }) ];
|
# imports = [ (m3ta-lib.mkHome { ... }) ];
|
||||||
@@ -58,7 +62,11 @@
|
|||||||
selfPath = self.outPath;
|
selfPath = self.outPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Overlays (re-exports from m3ta-nixpkgs)
|
# Overlays (re-exports from m3ta-nixpkgs, plus our own)
|
||||||
overlays = inputs.m3ta-nixpkgs.overlays;
|
overlays =
|
||||||
|
inputs.m3ta-nixpkgs.overlays
|
||||||
|
// {
|
||||||
|
t3code-agent-identity = import ./overlays/t3code-agent-identity.nix {};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Start T3 Code on the interface's current IPv4 address. The address changes
|
||||||
|
# with the NetBird profile, so it cannot be a Nix value.
|
||||||
|
# Usage: t3code-serve.sh <interface> <t3 binary>
|
||||||
|
interface="$1"
|
||||||
|
t3="$2"
|
||||||
|
timeout="${T3CODE_ADDR_TIMEOUT:-60}"
|
||||||
|
|
||||||
|
address=""
|
||||||
|
for ((waited = 0; waited < timeout; waited++)); do
|
||||||
|
line="$(ip -4 -o addr show dev "$interface" 2>/dev/null || true)"
|
||||||
|
if [[ "$line" =~ inet[[:space:]]+([0-9.]+)/ ]]; then
|
||||||
|
address="${BASH_REMATCH[1]}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$address" ]]; then
|
||||||
|
echo "no IPv4 address on $interface after ${timeout}s" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$t3" serve --host "$address"
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
# T3 Code server, reachable from the active NetBird network only.
|
||||||
|
#
|
||||||
|
# The service follows the mesh interface: it stops when NetBird removes the
|
||||||
|
# interface and starts again with the new address when a profile comes up
|
||||||
|
# (`netbird up --profile <name>`). It owns ~/.t3, so a desktop app on the same
|
||||||
|
# host must connect as a client with its local environment off.
|
||||||
|
#
|
||||||
|
# Wanted by the device rather than multi-user.target, so a host without NetBird
|
||||||
|
# connection does not wait for it at boot. A first deploy with the interface
|
||||||
|
# already up needs one `systemctl start t3code`.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
utils,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.m3ta.t3code;
|
||||||
|
device = "${utils.escapeSystemdPath "/sys/subsystem/net/devices/${cfg.interface}"}.device";
|
||||||
|
home = config.users.users.${cfg.user}.home;
|
||||||
|
|
||||||
|
serve = pkgs.writeShellApplication {
|
||||||
|
name = "t3code-serve";
|
||||||
|
runtimeInputs = [pkgs.iproute2 pkgs.coreutils];
|
||||||
|
text = builtins.readFile ./t3code-serve.sh;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options.m3ta.t3code = {
|
||||||
|
enable = lib.mkEnableOption "the T3 Code server on the NetBird interface";
|
||||||
|
|
||||||
|
user = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "User running the server; the harnesses come from this user's profile.";
|
||||||
|
example = "m3tam3re";
|
||||||
|
};
|
||||||
|
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 3773;
|
||||||
|
description = "Port for the HTTP/WebSocket server.";
|
||||||
|
};
|
||||||
|
|
||||||
|
interface = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "wt0";
|
||||||
|
description = "NetBird interface to bind to and open the port on.";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = pkgs.llm-agents.t3code;
|
||||||
|
defaultText = lib.literalExpression "pkgs.llm-agents.t3code";
|
||||||
|
description = "T3 Code package.";
|
||||||
|
};
|
||||||
|
|
||||||
|
environmentFile = lib.mkOption {
|
||||||
|
type = lib.types.nullOr (lib.types.pathWith {
|
||||||
|
inStore = false;
|
||||||
|
absolute = true;
|
||||||
|
});
|
||||||
|
default = null;
|
||||||
|
example = "/run/agenix/t3code-env";
|
||||||
|
description = ''
|
||||||
|
File with `KEY=value` lines loaded into the server's environment
|
||||||
|
(systemd `EnvironmentFile`), e.g. tokens for the harnesses. Keep it
|
||||||
|
outside the Nix store, for example as an agenix secret.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = config.services.netbird.enable;
|
||||||
|
message = "m3ta.t3code requires services.netbird.enable";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.services.t3code = {
|
||||||
|
description = "T3 Code server";
|
||||||
|
after = [device "netbird.service"];
|
||||||
|
bindsTo = [device];
|
||||||
|
wantedBy = [device];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
User = cfg.user;
|
||||||
|
Group = "users";
|
||||||
|
WorkingDirectory = home;
|
||||||
|
ExecStart = "${serve}/bin/t3code-serve ${cfg.interface} ${cfg.package}/bin/t3";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "5";
|
||||||
|
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
T3CODE_PORT = toString cfg.port;
|
||||||
|
HOME = home;
|
||||||
|
};
|
||||||
|
|
||||||
|
# The harnesses come from the user's profile, not from the service.
|
||||||
|
path = [
|
||||||
|
"/etc/profiles/per-user/${cfg.user}"
|
||||||
|
"/run/current-system/sw"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.interfaces.${cfg.interface}.allowedTCPPorts = [cfg.port];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Eval and start-script checks for nixosModules.t3code.
|
||||||
|
# Usage: t3code.test.sh
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
here="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
repo="$(cd "$here/../.." && pwd)"
|
||||||
|
fail=0
|
||||||
|
|
||||||
|
check() { # name, got, want
|
||||||
|
if [[ "$2" == "$3" ]]; then echo "ok $1"; else echo "FAIL $1: got '$2', want '$3'"; fail=1; fi
|
||||||
|
}
|
||||||
|
contains() { # name, haystack, needle
|
||||||
|
if [[ "$2" == *"$3"* ]]; then echo "ok $1"; else echo "FAIL $1: missing '$3' in '$2'"; fail=1; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ev <module-attrs> <expression over `config`>; prints JSON, or the error on stderr.
|
||||||
|
ev() {
|
||||||
|
nix eval --impure --json --expr "
|
||||||
|
let
|
||||||
|
flake = builtins.getFlake \"path:$repo\";
|
||||||
|
system = flake.inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
flake.nixosModules.t3code
|
||||||
|
({pkgs, ...}: {
|
||||||
|
nixpkgs.hostPlatform = \"x86_64-linux\";
|
||||||
|
nixpkgs.overlays = [(final: prev: {llm-agents.t3code = final.hello;})];
|
||||||
|
boot.loader.grub.enable = false;
|
||||||
|
fileSystems.\"/\" = {device = \"none\"; fsType = \"tmpfs\";};
|
||||||
|
system.stateVersion = \"25.05\";
|
||||||
|
users.users.alice = {isNormalUser = true; home = \"/home/alice\";};
|
||||||
|
})
|
||||||
|
($1)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
config = system.config;
|
||||||
|
in $2"
|
||||||
|
}
|
||||||
|
|
||||||
|
on='{services.netbird.enable = true; m3ta.t3code = {enable = true; user = "alice";};}'
|
||||||
|
dev="sys-subsystem-net-devices-wt0.device"
|
||||||
|
|
||||||
|
check "bindsTo" "$(ev "$on" 'config.systemd.services.t3code.bindsTo')" "[\"$dev\"]"
|
||||||
|
check "wantedBy" "$(ev "$on" 'config.systemd.services.t3code.wantedBy')" "[\"$dev\"]"
|
||||||
|
contains "after device" "$(ev "$on" 'config.systemd.services.t3code.after')" "$dev"
|
||||||
|
contains "after netbird" "$(ev "$on" 'config.systemd.services.t3code.after')" "netbird.service"
|
||||||
|
check "user" "$(ev "$on" 'config.systemd.services.t3code.serviceConfig.User')" '"alice"'
|
||||||
|
check "port env" "$(ev "$on" 'config.systemd.services.t3code.environment.T3CODE_PORT')" '"3773"'
|
||||||
|
check "home env" "$(ev "$on" 'config.systemd.services.t3code.environment.HOME')" '"/home/alice"'
|
||||||
|
check "firewall" "$(ev "$on" 'config.networking.firewall.interfaces.wt0.allowedTCPPorts')" '[3773]'
|
||||||
|
contains "path has user profile" \
|
||||||
|
"$(ev "$on" 'map toString config.systemd.services.t3code.path')" "/etc/profiles/per-user/alice"
|
||||||
|
|
||||||
|
custom='{services.netbird.enable = true; m3ta.t3code = {enable = true; user = "alice"; port = 4000; interface = "nb-x";};}'
|
||||||
|
check "custom port" "$(ev "$custom" 'config.networking.firewall.interfaces."nb-x".allowedTCPPorts')" '[4000]'
|
||||||
|
contains "custom interface" "$(ev "$custom" 'config.systemd.services.t3code.bindsTo')" 'nb\\x2dx.device'
|
||||||
|
|
||||||
|
check "disabled has no service" \
|
||||||
|
"$(ev '{services.netbird.enable = true;}' 'config.systemd.services ? t3code')" "false"
|
||||||
|
|
||||||
|
err="$(ev '{m3ta.t3code = {enable = true; user = "alice";};}' 'config.system.build.toplevel.drvPath' 2>&1 || true)"
|
||||||
|
contains "netbird assertion" "$err" "m3ta.t3code requires services.netbird.enable"
|
||||||
|
|
||||||
|
err="$(ev '{services.netbird.enable = true; m3ta.t3code.enable = true;}' 'config.systemd.services.t3code.serviceConfig.User' 2>&1 || true)"
|
||||||
|
contains "user is required" "$err" "m3ta.t3code.user"
|
||||||
|
|
||||||
|
# ── Start script, with stubs for ip and t3 ──
|
||||||
|
stubs="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$stubs"' EXIT
|
||||||
|
cat >"$stubs/t3" <<'EOF'
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "t3 $*"
|
||||||
|
EOF
|
||||||
|
chmod +x "$stubs/t3"
|
||||||
|
|
||||||
|
run() { # ip stub body
|
||||||
|
cat >"$stubs/ip" <<EOF
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
$1
|
||||||
|
EOF
|
||||||
|
chmod +x "$stubs/ip"
|
||||||
|
PATH="$stubs:$PATH" T3CODE_ADDR_TIMEOUT=1 bash "$here/t3code-serve.sh" wt0 "$stubs/t3" 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
check "binds the interface address" \
|
||||||
|
"$(run 'echo "5: wt0 inet 100.1.2.3/16 brd 100.1.255.255 scope global wt0"')" "t3 serve --host 100.1.2.3"
|
||||||
|
|
||||||
|
set +e
|
||||||
|
out="$(run 'exit 0')"; rc=$?
|
||||||
|
set -e
|
||||||
|
check "no address exits 1" "$rc" "1"
|
||||||
|
if [[ "$out" == *"t3 serve"* ]]; then echo "FAIL no address must not start t3: $out"; fail=1; else echo "ok no address does not start t3"; fi
|
||||||
|
|
||||||
|
set +e
|
||||||
|
out="$(run 'echo "Device does not exist" >&2; exit 1')"; rc=$?
|
||||||
|
set -e
|
||||||
|
check "missing interface exits 1" "$rc" "1"
|
||||||
|
|
||||||
|
exit "$fail"
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
# T3 Code agents act as the m3ta-chiron bot on every host. Baked into the
|
||||||
|
# T3 packages rather than a session or service: everything T3 spawns
|
||||||
|
# inherits it, however T3 was launched (desktop launcher, systemd, shell),
|
||||||
|
# and any host installing T3 gets it. Must come AFTER shared-nixpkgs.
|
||||||
|
#
|
||||||
|
# Push auth needs ~/.ssh/m3ta-chiron on each host, with its pubkey on the
|
||||||
|
# m3ta-chiron account of each Gitea instance. A missing key fails the push
|
||||||
|
# instead of falling back to a personal key. Other hosts keep the user's own
|
||||||
|
# ssh config.
|
||||||
|
#
|
||||||
|
# Change requests need one agenix secret per instance, owned by the T3 user.
|
||||||
|
# Without it T3 cannot recognize that instance as Gitea; the others still work.
|
||||||
|
{tokenFiles ? {}}: final: prev: let
|
||||||
|
identity = {
|
||||||
|
name = "m3ta-chiron";
|
||||||
|
email = "m3ta-chiron@agentmail.to";
|
||||||
|
};
|
||||||
|
|
||||||
|
instances = [
|
||||||
|
{
|
||||||
|
name = "m3ta";
|
||||||
|
url = "https://code.m3ta.dev";
|
||||||
|
host = "code.m3ta.dev";
|
||||||
|
port = 22;
|
||||||
|
knownHost = "code.m3ta.dev";
|
||||||
|
hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmmqZ4GgDEXJgj8uYrZAr/EoLIA6LJGkTIyKGQD/60a";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "az";
|
||||||
|
url = "https://git.az-gruppe.com";
|
||||||
|
host = "git.az-gruppe.com";
|
||||||
|
port = 2022;
|
||||||
|
knownHost = "[git.az-gruppe.com]:2022";
|
||||||
|
hostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItSijmU5YwcJcoshtmYxpxBaVA4TPaCMk23ws7KDkAH";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
tokenFile = instance: tokenFiles.${instance.name} or "/run/agenix/agent-gitea-token-${instance.name}";
|
||||||
|
|
||||||
|
giteaKnownHosts = final.writeText "gitea-known-hosts" (
|
||||||
|
final.lib.concatMapStrings (instance: "${instance.knownHost} ${instance.hostKey}\n") instances
|
||||||
|
);
|
||||||
|
|
||||||
|
# ssh expands ~ from passwd, so this does not depend on $HOME.
|
||||||
|
sshConfig = final.writeText "t3-agent-ssh-config" ''
|
||||||
|
${final.lib.concatMapStrings (instance: ''
|
||||||
|
Host ${instance.host}
|
||||||
|
User gitea
|
||||||
|
Port ${toString instance.port}
|
||||||
|
IdentityFile ~/.ssh/m3ta-chiron
|
||||||
|
IdentitiesOnly yes
|
||||||
|
UserKnownHostsFile ${giteaKnownHosts}
|
||||||
|
|
||||||
|
'')
|
||||||
|
instances}
|
||||||
|
# Conditional: IdentityFile accumulates across matching blocks, so a
|
||||||
|
# personal entry for these hosts must not be read.
|
||||||
|
Host * ${final.lib.concatMapStringsSep " " (instance: "!${instance.host}") instances}
|
||||||
|
Include ~/.ssh/config
|
||||||
|
'';
|
||||||
|
|
||||||
|
# T3 only recognizes a Gitea on a custom domain through a matching tea
|
||||||
|
# login, and tea picks the login by the host of the git remote, so a token
|
||||||
|
# only reaches its own instance. The config lives in a private temp dir per
|
||||||
|
# call: tokens stay out of the nix store and a personal ~/.config/tea is left
|
||||||
|
# alone.
|
||||||
|
agentTea = final.writeShellApplication {
|
||||||
|
name = "tea";
|
||||||
|
text = ''
|
||||||
|
config="$(${final.coreutils}/bin/mktemp -d)"
|
||||||
|
trap '${final.coreutils}/bin/rm -rf "$config"' EXIT
|
||||||
|
${final.coreutils}/bin/mkdir "$config/tea"
|
||||||
|
default=true
|
||||||
|
${final.lib.concatMapStrings (instance: ''
|
||||||
|
if [ -r ${tokenFile instance} ]; then
|
||||||
|
if [ "$default" = true ]; then
|
||||||
|
printf 'logins:\n' >"$config/tea/config.yml"
|
||||||
|
fi
|
||||||
|
printf ' - name: %s\n url: %s\n token: %s\n user: %s\n default: %s\n' \
|
||||||
|
${instance.name} ${instance.url} "$(${final.coreutils}/bin/cat ${tokenFile instance})" \
|
||||||
|
${identity.name} "$default" >>"$config/tea/config.yml"
|
||||||
|
default=false
|
||||||
|
fi
|
||||||
|
'')
|
||||||
|
instances}
|
||||||
|
XDG_CONFIG_HOME="$config" ${final.tea}/bin/tea "$@"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
wrapperArgs = final.lib.concatStringsSep " " (final.lib.mapAttrsToList (name: value: "--set ${name} ${final.lib.escapeShellArg value}") {
|
||||||
|
GIT_AUTHOR_NAME = identity.name;
|
||||||
|
GIT_AUTHOR_EMAIL = identity.email;
|
||||||
|
GIT_COMMITTER_NAME = identity.name;
|
||||||
|
GIT_COMMITTER_EMAIL = identity.email;
|
||||||
|
JJ_USER = identity.name;
|
||||||
|
JJ_EMAIL = identity.email;
|
||||||
|
# bd otherwise falls back to the user's git user.name for its audit trail.
|
||||||
|
BEADS_ACTOR = identity.name;
|
||||||
|
GIT_SSH_COMMAND = "${final.openssh}/bin/ssh -F ${sshConfig}";
|
||||||
|
});
|
||||||
|
|
||||||
|
wrapT3 = package:
|
||||||
|
final.symlinkJoin {
|
||||||
|
inherit (package) name meta passthru;
|
||||||
|
paths = [package];
|
||||||
|
nativeBuildInputs = [final.makeWrapper];
|
||||||
|
postBuild = ''
|
||||||
|
for program in $out/bin/*; do
|
||||||
|
wrapProgram "$program" ${wrapperArgs} --prefix PATH : ${agentTea}/bin
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
llm-agents =
|
||||||
|
prev.llm-agents
|
||||||
|
// {
|
||||||
|
t3code = wrapT3 prev.llm-agents.t3code;
|
||||||
|
t3code-desktop = wrapT3 prev.llm-agents.t3code-desktop;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Checks for overlays.t3code-agent-identity with a stub t3 that runs its
|
||||||
|
# arguments inside the wrapper's environment.
|
||||||
|
# Usage: t3code-agent-identity.test.sh
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
here="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
repo="$(cd "$here/.." && pwd)"
|
||||||
|
fail=0
|
||||||
|
|
||||||
|
contains() { # name, haystack, needle
|
||||||
|
if [[ "$2" == *"$3"* ]]; then echo "ok $1"; else echo "FAIL $1: missing '$3' in '$2'"; fail=1; fi
|
||||||
|
}
|
||||||
|
refute() { # name, haystack, needle
|
||||||
|
if [[ "$2" == *"$3"* ]]; then echo "FAIL $1: found '$3'"; fail=1; else echo "ok $1"; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
work="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$work"' EXIT
|
||||||
|
secret="fake-token-$$-do-not-leak"
|
||||||
|
|
||||||
|
build() { # m3ta token file, az token file
|
||||||
|
nix build --no-link --print-out-paths --impure --expr "
|
||||||
|
let
|
||||||
|
flake = builtins.getFlake \"path:$repo\";
|
||||||
|
pkgs = import flake.inputs.nixpkgs {
|
||||||
|
system = \"x86_64-linux\";
|
||||||
|
overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
llm-agents.t3code = final.writeShellScriptBin \"t3\" ''exec \"\$@\"'';
|
||||||
|
llm-agents.t3code-desktop = final.writeShellScriptBin \"t3-desktop\" ''exec \"\$@\"'';
|
||||||
|
})
|
||||||
|
(import $repo/overlays/t3code-agent-identity.nix {
|
||||||
|
tokenFiles = {m3ta = \"$1\"; az = \"$2\";};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in pkgs.llm-agents.t3code"
|
||||||
|
}
|
||||||
|
|
||||||
|
printf '%s' "$secret" >"$work/token"
|
||||||
|
both="$(build "$work/token" "$work/token")"
|
||||||
|
az_only="$(build "$work/missing" "$work/token")"
|
||||||
|
none="$(build "$work/missing" "$work/missing")"
|
||||||
|
|
||||||
|
export TMPDIR="$work/tmp"
|
||||||
|
mkdir "$TMPDIR"
|
||||||
|
|
||||||
|
t3() { "$1/bin/t3" "${@:2}"; }
|
||||||
|
|
||||||
|
out="$(t3 "$both" tea logins)"
|
||||||
|
contains "both: m3ta login" "$out" "https://code.m3ta.dev"
|
||||||
|
contains "both: az login" "$out" "https://git.az-gruppe.com"
|
||||||
|
refute "login list hides the token" "$out" "$secret"
|
||||||
|
|
||||||
|
out="$(t3 "$az_only" tea logins)"
|
||||||
|
contains "az only: az login" "$out" "https://git.az-gruppe.com"
|
||||||
|
refute "az only: no m3ta login" "$out" "code.m3ta.dev"
|
||||||
|
out="$(t3 "$az_only" tea logins default)"
|
||||||
|
contains "az only: az is default" "$out" "az"
|
||||||
|
|
||||||
|
t3 "$none" tea logins >/dev/null && echo "ok no token: tea still runs" || { echo "FAIL no token: tea failed"; fail=1; }
|
||||||
|
|
||||||
|
if [ -n "$(ls -A "$TMPDIR")" ]; then echo "FAIL temp config left behind"; fail=1; else echo "ok temp config removed"; fi
|
||||||
|
if grep -rqF "$secret" "$both/bin"/; then echo "FAIL token in the store"; fail=1; else echo "ok token not in the wrapper"; fi
|
||||||
|
|
||||||
|
sshcmd="$(t3 "$both" printenv GIT_SSH_COMMAND)"
|
||||||
|
g() { $sshcmd -G "$1"; }
|
||||||
|
|
||||||
|
out="$(g git.az-gruppe.com)"
|
||||||
|
contains "az: port" "$out" "port 2022"
|
||||||
|
contains "az: user" "$out" "user gitea"
|
||||||
|
contains "az: key" "$out" "identityfile ~/.ssh/m3ta-chiron"
|
||||||
|
known="$(echo "$out" | awk '/^userknownhostsfile/ {print $2}')"
|
||||||
|
contains "az: host key" "$(cat "$known")" "[git.az-gruppe.com]:2022 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItSijmU5YwcJcoshtmYxpxBaVA4TPaCMk23ws7KDkAH"
|
||||||
|
|
||||||
|
out="$(g code.m3ta.dev)"
|
||||||
|
contains "m3ta: port" "$out" "port 22"
|
||||||
|
contains "m3ta: user" "$out" "user gitea"
|
||||||
|
contains "m3ta: key" "$out" "identityfile ~/.ssh/m3ta-chiron"
|
||||||
|
contains "m3ta: host key" "$(cat "$known")" "code.m3ta.dev ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmmqZ4GgDEXJgj8uYrZAr/EoLIA6LJGkTIyKGQD/60a"
|
||||||
|
|
||||||
|
refute "other hosts keep their own key" "$(g example.org)" "m3ta-chiron"
|
||||||
|
|
||||||
|
contains "author" "$(t3 "$both" printenv GIT_AUTHOR_NAME)" "m3ta-chiron"
|
||||||
|
contains "committer" "$(t3 "$both" printenv GIT_COMMITTER_EMAIL)" "m3ta-chiron@agentmail.to"
|
||||||
|
contains "beads actor" "$(t3 "$both" printenv BEADS_ACTOR)" "m3ta-chiron"
|
||||||
|
|
||||||
|
exit "$fail"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Carapace — multi-shell completion engine with Fish, Nushell, and Bash integration.
|
# Carapace — multi-shell completion engine with Nushell and Bash integration.
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
@@ -13,7 +13,6 @@ in {
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.carapace = {
|
programs.carapace = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
|
||||||
enableNushellIntegration = true;
|
enableNushellIntegration = true;
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ in {
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.eza = {
|
programs.eza = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
extraOptions = ["-l" "--icons" "--git" "-a"];
|
extraOptions = ["-l" "--icons" "--git" "-a"];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ in {
|
|||||||
programs.fzf =
|
programs.fzf =
|
||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
|
||||||
colors = {
|
colors = {
|
||||||
"fg" = "#${config.colorScheme.palette.base05}";
|
"fg" = "#${config.colorScheme.palette.base05}";
|
||||||
"bg" = "#${config.colorScheme.palette.base00}";
|
"bg" = "#${config.colorScheme.palette.base00}";
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ in {
|
|||||||
programs.nix-index = {
|
programs.nix-index = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
enableFishIntegration = true;
|
|
||||||
enableNushellIntegration = true;
|
enableNushellIntegration = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Zoxide — smarter cd with Fish and Nushell integration.
|
# Zoxide — smarter cd with Nushell integration.
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
@@ -13,7 +13,6 @@ in {
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.zoxide = {
|
programs.zoxide = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
|
||||||
enableNushellIntegration = true;
|
enableNushellIntegration = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# profiles/base/default.nix — Always loaded on every host.
|
# profiles/base/default.nix — Always loaded on every host.
|
||||||
#
|
#
|
||||||
# Provides:
|
# Provides:
|
||||||
# - Shell (nushell, fish, starship) with enable options
|
# - Shell (nushell, starship) with enable options
|
||||||
# - CLI tools (bat, carapace, direnv, eza, fzf, lf, nitch, television, zellij, zoxide)
|
# - CLI tools (bat, carapace, direnv, eza, fzf, lf, nitch, television, zellij, zoxide)
|
||||||
# - Secrets management (pass-wayland)
|
# - Secrets management (pass-wayland)
|
||||||
# - Color scheme (dracula)
|
# - Color scheme (dracula)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Shell aggregator — imports Nushell (primary), Fish, and Starship prompt.
|
# Shell aggregator — imports Nushell and Starship prompt.
|
||||||
{...}: {
|
{...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./nushell.nix
|
./nushell.nix
|
||||||
|
|||||||
+10
-112
@@ -1,118 +1,16 @@
|
|||||||
# Fish shell configuration exposed under the new base namespace.
|
# Deprecated: Fish was removed in favour of Nushell. The option stays as a no-op
|
||||||
|
# so configs that still set it keep evaluating; delete once none do.
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}: {
|
||||||
with lib; let
|
options.base.shell.fish.enable = lib.mkOption {
|
||||||
cfg = config.base.shell.fish;
|
type = lib.types.bool;
|
||||||
in {
|
default = false;
|
||||||
# Enabled by default — base modules are always-on.
|
visible = false;
|
||||||
options.base.shell.fish.enable = (mkEnableOption "enable fish shell") // {default = true;};
|
description = "Deprecated no-op. Fish is no longer configured by m3ta-home.";
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
programs.fish = {
|
|
||||||
enable = true;
|
|
||||||
interactiveShellInit = ''
|
|
||||||
# Fish colors using universal nix-colors palette
|
|
||||||
# Text colors
|
|
||||||
set -g fish_color_normal ${config.colorScheme.palette.base05} # text
|
|
||||||
set -g fish_color_param ${config.colorScheme.palette.base05} # text
|
|
||||||
set -g fish_color_comment ${config.colorScheme.palette.base03} # muted
|
|
||||||
set -g fish_color_autosuggestion ${config.colorScheme.palette.base03} # muted
|
|
||||||
|
|
||||||
# Command colors
|
|
||||||
set -g fish_color_command ${config.colorScheme.palette.base0D} # accent6 (blue)
|
|
||||||
set -g fish_color_quote ${config.colorScheme.palette.base0A} # accent3 (yellow)
|
|
||||||
set -g fish_color_redirection ${config.colorScheme.palette.base0E} # accent7 (purple)
|
|
||||||
set -g fish_color_end ${config.colorScheme.palette.base08} # accent1 (red)
|
|
||||||
set -g fish_color_error ${config.colorScheme.palette.base08} # accent1 (red)
|
|
||||||
set -g fish_color_operator ${config.colorScheme.palette.base0C} # accent5 (cyan)
|
|
||||||
set -g fish_color_escape ${config.colorScheme.palette.base09} # accent2 (orange)
|
|
||||||
|
|
||||||
# Path colors
|
|
||||||
set -g fish_color_cwd ${config.colorScheme.palette.base0B} # accent4 (green)
|
|
||||||
set -g fish_color_cwd_root ${config.colorScheme.palette.base08} # accent1 (red)
|
|
||||||
set -g fish_color_valid_path --underline
|
|
||||||
|
|
||||||
# Interactive colors
|
|
||||||
set -g fish_color_match ${config.colorScheme.palette.base0B} # accent4 (green)
|
|
||||||
set -g fish_color_selection --background=${config.colorScheme.palette.base02} # overlay
|
|
||||||
set -g fish_color_search_match --background=${config.colorScheme.palette.base02} # overlay
|
|
||||||
set -g fish_color_history_current --bold
|
|
||||||
set -g fish_color_user ${config.colorScheme.palette.base0B} # accent4 (green)
|
|
||||||
set -g fish_color_host ${config.colorScheme.palette.base0D} # accent6 (blue)
|
|
||||||
set -g fish_color_cancel -r
|
|
||||||
|
|
||||||
# Pager colors
|
|
||||||
set -g fish_pager_color_completion normal
|
|
||||||
set -g fish_pager_color_description ${config.colorScheme.palette.base03} # muted
|
|
||||||
set -g fish_pager_color_prefix ${config.colorScheme.palette.base0E} # accent7 (purple)
|
|
||||||
set -g fish_pager_color_progress ${config.colorScheme.palette.base0B} # accent4 (green)
|
|
||||||
'';
|
|
||||||
loginShellInit = ''
|
|
||||||
set -x NIX_PATH nixpkgs=channel:nixos-unstable
|
|
||||||
set -x NIX_LOG info
|
|
||||||
set -x WEBKIT_DISABLE_COMPOSITING_MODE 1
|
|
||||||
set -x TERMINAL ghostty
|
|
||||||
set -x EDITOR nvim
|
|
||||||
set -x VISUAL zed
|
|
||||||
set -x XDG_DATA_HOME $HOME/.local/share
|
|
||||||
set -x FZF_CTRL_R_OPTS "
|
|
||||||
--preview='bat --color=always -n {}'
|
|
||||||
--preview-window up:3:hidden:wrap
|
|
||||||
--bind 'ctrl-/:toggle-preview'
|
|
||||||
--bind 'ctrl-y:execute-silent(echo -n {2..} | wl-copy)+abort'
|
|
||||||
--color header:bold
|
|
||||||
--header 'Press CTRL-Y to copy command into clipboard'"
|
|
||||||
set -x FZF_DEFAULT_COMMAND fd --type f --exclude .git --follow --hidden
|
|
||||||
set -x FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND"
|
|
||||||
set -x FLAKE $HOME/p/nixos/nixos-config
|
|
||||||
source /run/agenix/${config.home.username}-secrets
|
|
||||||
|
|
||||||
if test (tty) = "/dev/tty1"
|
|
||||||
exec uwsm start -F /run/current-system/sw/bin/Hyprland
|
|
||||||
end
|
|
||||||
if test (tty) = "/dev/tty2"
|
|
||||||
exec gamescope -O HDMI-A-1 -W 1920 -H 1080 --adaptive-sync --hdr-enabled --rt --steam -- steam -pipewire-dmabuf -tenfoot
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
shellAbbrs = {
|
|
||||||
".." = "cd ..";
|
|
||||||
"..." = "cd ../..";
|
|
||||||
b = "yazi";
|
|
||||||
ls = "eza";
|
|
||||||
l = "eza -l --icons --git -a";
|
|
||||||
lt = "eza --tree --level=2 --long --icons --git";
|
|
||||||
grep = "rg";
|
|
||||||
ps = "procs";
|
|
||||||
just = "just --unstable";
|
|
||||||
node = "bun";
|
|
||||||
npx = "bunx";
|
|
||||||
fs = "du -ah . | sort -hr | head -n 10";
|
|
||||||
|
|
||||||
n = "nix";
|
|
||||||
nd = "nix develop -c $SHELL";
|
|
||||||
ns = "nix shell";
|
|
||||||
nsn = "nix shell nixpkgs#";
|
|
||||||
nb = "nix build";
|
|
||||||
nbn = "nix build nixpkgs#";
|
|
||||||
nf = "nix flake";
|
|
||||||
|
|
||||||
nr = "sudo nixos-rebuild --flake .";
|
|
||||||
nrs = "sudo nixos-rebuild switch --flake .#(uname -n)";
|
|
||||||
snr = "sudo nixos-rebuild --flake .";
|
|
||||||
snrs = "sudo nixos-rebuild --flake . switch";
|
|
||||||
hm = "home-manager --flake .";
|
|
||||||
hms = "home-manager --flake . switch";
|
|
||||||
hmr = "cd ~/projects/nix-configurations; nix flake lock --update-input dotfiles; home-manager --flake .#(whoami)@(hostname) switch";
|
|
||||||
|
|
||||||
tsu = "sudo tailscale up";
|
|
||||||
tsd = "sudo tailscale down";
|
|
||||||
|
|
||||||
vi = "nvim";
|
|
||||||
vim = "nvim";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config.warnings = lib.optional config.base.shell.fish.enable "base.shell.fish.enable has no effect anymore: Fish was removed from m3ta-home. Drop the setting.";
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,9 @@ in {
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.nushell = {
|
programs.nushell = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# Keep the pre-26.11 behaviour; set explicitly to silence the
|
||||||
|
# home-manager default-change warning.
|
||||||
|
loadSessionVariables = false;
|
||||||
envFile.text = ''
|
envFile.text = ''
|
||||||
$env.config.show_banner = false
|
$env.config.show_banner = false
|
||||||
$env.NIX_PATH = "nixpkgs=channel:nixos-unstable"
|
$env.NIX_PATH = "nixpkgs=channel:nixos-unstable"
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ in {
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
programs.starship = {
|
programs.starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
|
||||||
enableNushellIntegration = true;
|
enableNushellIntegration = true;
|
||||||
settings = {
|
settings = {
|
||||||
format = "$all$character";
|
format = "$all$character";
|
||||||
|
|||||||
@@ -94,7 +94,6 @@
|
|||||||
|
|
||||||
programs.ghostty = {
|
programs.ghostty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableFishIntegration = true;
|
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
settings = {
|
settings = {
|
||||||
font-family = "Fira Code";
|
font-family = "Fira Code";
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# Relies on coding.agents options provided by home/common/default.nix
|
# Relies on coding.agents options provided by home/common/default.nix
|
||||||
# (m3taHomeInputs.m3ta-nixpkgs.homeManagerModules.default).
|
# (m3taHomeInputs.m3ta-nixpkgs.homeManagerModules.default).
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
m3taHomeInputs,
|
m3taHomeInputs,
|
||||||
pkgs,
|
pkgs,
|
||||||
videoDrivers ? [],
|
videoDrivers ? [],
|
||||||
@@ -13,54 +14,19 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
name = "m3ta-chiron";
|
name = "m3ta-chiron";
|
||||||
email = "m3ta-chiron@agentmail.to";
|
email = "m3ta-chiron@agentmail.to";
|
||||||
sshKey = "/home/m3tam3re/.ssh/gitea";
|
sshKey = lib.mkDefault "/home/m3tam3re/.ssh/gitea";
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
# ai-memory client, skill mirror and OpenCode config
|
# ai-memory client, skill mirror, shared MCP catalogue, OpenCode and
|
||||||
|
# Claude Code config
|
||||||
./ai-memory.nix
|
./ai-memory.nix
|
||||||
./claude-skills.nix
|
./claude-skills.nix
|
||||||
|
./mcp.nix
|
||||||
./opencode.nix
|
./opencode.nix
|
||||||
|
./claude-code.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.mcp = {
|
|
||||||
enable = true;
|
|
||||||
servers = {
|
|
||||||
ContextMode = {
|
|
||||||
command = "bash";
|
|
||||||
args = ["-c" "exec bunx context-mode@latest"];
|
|
||||||
};
|
|
||||||
DeepWiki = {
|
|
||||||
url = "https://mcp.deepwiki.com/mcp";
|
|
||||||
};
|
|
||||||
Exa = {
|
|
||||||
command = "bash";
|
|
||||||
args = ["-c" "EXA_API_KEY=$(cat /run/agenix/exa-key) exec bunx exa-mcp-server@latest tools=web_search_exa"];
|
|
||||||
};
|
|
||||||
SallyAI = {
|
|
||||||
url = "https://app.sally.io/api/v1/McpExternal";
|
|
||||||
};
|
|
||||||
Metabase = {
|
|
||||||
url = "https://kpi.az-gruppe.com/api/metabase-mcp";
|
|
||||||
};
|
|
||||||
Outline = {
|
|
||||||
url = "https://wiki.az-gruppe.com/mcp";
|
|
||||||
};
|
|
||||||
Playwright = {
|
|
||||||
command = "bash";
|
|
||||||
args = ["-c" "exec bunx @playwright/mcp@latest"];
|
|
||||||
};
|
|
||||||
Ref = {
|
|
||||||
command = "bash";
|
|
||||||
args = ["-c" "REF_API_KEY=$(cat /run/agenix/ref-key) exec bunx ref-tools-mcp@latest"];
|
|
||||||
};
|
|
||||||
Teams = {
|
|
||||||
command = "bunx";
|
|
||||||
args = ["-y" "@floriscornel/teams-mcp@latest"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# NOTE: llm-agent packages are consumed via the `llm-agents` namespace
|
# NOTE: llm-agent packages are consumed via the `llm-agents` namespace
|
||||||
# (pkgs.llm-agents.*), provided by numtide/llm-agents.nix's
|
# (pkgs.llm-agents.*), provided by numtide/llm-agents.nix's
|
||||||
# `overlays.shared-nixpkgs`. The consumer's nixos-config MUST apply that
|
# `overlays.shared-nixpkgs`. The consumer's nixos-config MUST apply that
|
||||||
@@ -71,7 +37,6 @@
|
|||||||
agent-lib
|
agent-lib
|
||||||
llm-agents.agent-browser
|
llm-agents.agent-browser
|
||||||
llm-agents.beads
|
llm-agents.beads
|
||||||
llm-agents.claude-code
|
|
||||||
llm-agents.claude-desktop
|
llm-agents.claude-desktop
|
||||||
crunch
|
crunch
|
||||||
docker-sbx
|
docker-sbx
|
||||||
@@ -86,5 +51,7 @@
|
|||||||
llm-agents.openspec
|
llm-agents.openspec
|
||||||
openwork
|
openwork
|
||||||
talk
|
talk
|
||||||
|
llm-agents.t3code
|
||||||
|
llm-agents.t3code-desktop
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -3,19 +3,21 @@
|
|||||||
# The server runs on m3-hermes (nixos-config) and is reached at
|
# The server runs on m3-hermes (nixos-config) and is reached at
|
||||||
# memory.m3ta.dev; no server runs on clients. Hybrid setup:
|
# memory.m3ta.dev; no server runs on clients. Hybrid setup:
|
||||||
# - Nix owns the package, the client config (server URL + bearer token
|
# - Nix owns the package, the client config (server URL + bearer token
|
||||||
# file), the OpenCode MCP entry (via programs.mcp, since opencode.json
|
# file), the MCP entries (programs.mcp for OpenCode, and a session-aware
|
||||||
# is a home-manager symlink) and the scope markers (~/.ai-memory.toml
|
# override in programs.claude-code.mcpServers for Claude Code, both
|
||||||
# plus one marker per workspace directory).
|
# delivered through the agents' enableMcpIntegration) and the scope
|
||||||
# - Activation runs ai-memory's own installers for the lifecycle hooks,
|
# markers (~/.ai-memory.toml plus one marker per workspace directory).
|
||||||
# the session-aware Claude Code MCP entry and the skills, so generated
|
# - Activation runs ai-memory's own installers for the lifecycle hooks and
|
||||||
# files always match the installed ai-memory version.
|
# the skills, so generated files always match the installed ai-memory
|
||||||
|
# version.
|
||||||
#
|
#
|
||||||
# The bearer token (an `aim_` API key, one per host) is an agenix secret the
|
# The bearer token (an `aim_` API key, one per host) is an agenix secret the
|
||||||
# host repo provides at `tokenFile`. It is never copied into a generated
|
# host repo provides at `tokenFile`. It is never copied into a generated
|
||||||
# file: hooks and the MCP bridge read `[auth].bearer_token_file` from the
|
# file: the MCP bridge reads `[auth].bearer_token_file` from the client
|
||||||
# client config, and the OpenCode plugin reads `<data_dir>/auth-token`,
|
# config, while the native hooks and the OpenCode plugin read
|
||||||
# which activation symlinks to the secret. Without the token activation
|
# `<data_dir>/auth-token`, which activation symlinks to the secret. Without
|
||||||
# skips the installers instead of writing hooks that cannot authenticate.
|
# the token activation skips the installers instead of writing hooks that
|
||||||
|
# cannot authenticate.
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
@@ -99,6 +101,18 @@ in {
|
|||||||
args = ["mcp-bridge" "--no-session-id" "--server-url" "${cfg.serverUrl}/mcp"];
|
args = ["mcp-bridge" "--no-session-id" "--server-url" "${cfg.serverUrl}/mcp"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Claude Code gets the same server name through
|
||||||
|
# programs.claude-code.enableMcpIntegration, but session-aware: the stdio
|
||||||
|
# bridge forwards the lifecycle-hook session id and reads the token file
|
||||||
|
# itself. (A plain HTTP entry carries no credentials, and Claude Code then
|
||||||
|
# tries OAuth client registration, which ai-memory does not offer.)
|
||||||
|
# Claude Code's own mcpServers take precedence over the shared entry, so
|
||||||
|
# this is one server, not two.
|
||||||
|
programs.claude-code.mcpServers.ai-memory = mkIf (elem "claude-code" cfg.agents) {
|
||||||
|
command = exe;
|
||||||
|
args = ["mcp-bridge" "--server-url" "${cfg.serverUrl}/mcp"];
|
||||||
|
};
|
||||||
|
|
||||||
home.file =
|
home.file =
|
||||||
{
|
{
|
||||||
# Client config: `ai-memory hook`, `mcp-bridge` and the installers
|
# Client config: `ai-memory hook`, `mcp-bridge` and the installers
|
||||||
@@ -121,7 +135,7 @@ in {
|
|||||||
if [ ! -r ${escapeShellArg cfg.tokenFile} ]; then
|
if [ ! -r ${escapeShellArg cfg.tokenFile} ]; then
|
||||||
echo "ai-memory: token file ${cfg.tokenFile} missing, skipping" >&2
|
echo "ai-memory: token file ${cfg.tokenFile} missing, skipping" >&2
|
||||||
else
|
else
|
||||||
# The OpenCode plugin reads <data_dir>/auth-token; point it at the secret.
|
# Hooks and the OpenCode plugin read <data_dir>/auth-token; point it at the secret.
|
||||||
run mkdir -p ${escapeShellArg dataDir}
|
run mkdir -p ${escapeShellArg dataDir}
|
||||||
run ln -sfn ${escapeShellArg cfg.tokenFile} ${escapeShellArg "${dataDir}/auth-token"}
|
run ln -sfn ${escapeShellArg cfg.tokenFile} ${escapeShellArg "${dataDir}/auth-token"}
|
||||||
${concatMapStringsSep "\n" (agent: ''
|
${concatMapStringsSep "\n" (agent: ''
|
||||||
@@ -129,10 +143,10 @@ in {
|
|||||||
'')
|
'')
|
||||||
cfg.agents}
|
cfg.agents}
|
||||||
${optionalString (elem "claude-code" cfg.agents) ''
|
${optionalString (elem "claude-code" cfg.agents) ''
|
||||||
|
# The MCP entry now comes from programs.claude-code (see above);
|
||||||
|
# drop the user-scope entry earlier versions wrote into ~/.claude.json.
|
||||||
export PATH="${pkgs.llm-agents.claude-code}/bin:$PATH"
|
export PATH="${pkgs.llm-agents.claude-code}/bin:$PATH"
|
||||||
run claude mcp remove ai-memory -s user >/dev/null 2>&1 || true
|
run claude mcp remove ai-memory -s user >/dev/null 2>&1 || true
|
||||||
run ${exe} install-mcp --client claude-code --apply \
|
|
||||||
--server-url ${escapeShellArg "${cfg.serverUrl}/mcp"}
|
|
||||||
''}
|
''}
|
||||||
# Into ~/.agents/skills; claude-skills-sync mirrors them to Claude.
|
# Into ~/.agents/skills; claude-skills-sync mirrors them to Claude.
|
||||||
run ${exe} install-skills --scope global --agent agents
|
run ${exe} install-skills --scope global --agent agents
|
||||||
|
|||||||
@@ -51,6 +51,12 @@ check "hooks opencode2" "$act" "install-hooks --agent opencode2 --apply"
|
|||||||
check "auth-token symlink" "$act" "ln -sfn /run/agenix/ai-memory-token "
|
check "auth-token symlink" "$act" "ln -sfn /run/agenix/ai-memory-token "
|
||||||
refute "no token on command lines" "$act" "--auth-token"
|
refute "no token on command lines" "$act" "--auth-token"
|
||||||
refute "activation must not write opencode.json (home-manager symlink)" "$act" "install-mcp --client opencode"
|
refute "activation must not write opencode.json (home-manager symlink)" "$act" "install-mcp --client opencode"
|
||||||
|
refute "activation no longer registers the claude mcp itself" "$act" "install-mcp --client claude-code"
|
||||||
|
check "stale user-scope claude entry is removed" "$act" "claude mcp remove ai-memory -s user"
|
||||||
|
|
||||||
|
claude="$(ev programs.claude-code.mcpServers.ai-memory.args --apply 'builtins.concatStringsSep " "')"
|
||||||
|
check "claude mcp is the session-aware bridge" "$claude" "mcp-bridge --server-url https://memory.m3ta.dev/mcp"
|
||||||
|
refute "claude mcp forwards the session id" "$claude" "--no-session-id"
|
||||||
|
|
||||||
# Missing token file: skip with a warning, exit 0, never call ai-memory.
|
# Missing token file: skip with a warning, exit 0, never call ai-memory.
|
||||||
script="$(printf '%s\n' "$act" | sed 's|/run/agenix/ai-memory-token|/nonexistent/ai-memory-token|g')"
|
script="$(printf '%s\n' "$act" | sed 's|/run/agenix/ai-memory-token|/nonexistent/ai-memory-token|g')"
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Claude Code via home-manager `programs.claude-code`.
|
||||||
|
#
|
||||||
|
# enableMcpIntegration hands the shared programs.mcp catalogue (mcp.nix) to
|
||||||
|
# Claude Code the same way opencode.nix does for OpenCode: home-manager
|
||||||
|
# generates a plugin carrying .mcp.json and registers it (as a personal plugin
|
||||||
|
# under ~/.claude/skills/claude-code-home-manager on home-manager master, via a
|
||||||
|
# `--plugin-dir` wrapper on release-26.05). Nothing in ~/.claude is turned
|
||||||
|
# into a store symlink: settings.json (ai-memory hooks, plugins, theme) and
|
||||||
|
# ~/.claude.json (logins) stay writable for Claude Code itself.
|
||||||
|
#
|
||||||
|
# Do NOT add llm-agents.claude-code to home.packages next to this module;
|
||||||
|
# programs.claude-code installs its (possibly wrapped) package and a second
|
||||||
|
# `claude` would collide in the profile.
|
||||||
|
{pkgs, ...}: {
|
||||||
|
programs.claude-code = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.llm-agents.claude-code;
|
||||||
|
enableMcpIntegration = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# Shared MCP server catalogue (home-manager `programs.mcp`).
|
||||||
|
#
|
||||||
|
# Single source for every agent that integrates with programs.mcp:
|
||||||
|
# OpenCode (opencode.nix, enableMcpIntegration) and Claude Code
|
||||||
|
# (claude-code.nix, enableMcpIntegration). ai-memory adds its own entry in
|
||||||
|
# ai-memory.nix. Hosts that do not load the whole coding set (servers running
|
||||||
|
# T3 Code) import this file directly.
|
||||||
|
{...}: {
|
||||||
|
programs.mcp = {
|
||||||
|
enable = true;
|
||||||
|
servers = {
|
||||||
|
ContextMode = {
|
||||||
|
command = "bash";
|
||||||
|
args = ["-c" "exec bunx context-mode@latest"];
|
||||||
|
};
|
||||||
|
DeepWiki = {
|
||||||
|
url = "https://mcp.deepwiki.com/mcp";
|
||||||
|
};
|
||||||
|
Exa = {
|
||||||
|
command = "bash";
|
||||||
|
args = ["-c" "EXA_API_KEY=$(cat /run/agenix/exa-key) exec bunx exa-mcp-server@latest tools=web_search_exa"];
|
||||||
|
};
|
||||||
|
SallyAI = {
|
||||||
|
url = "https://app.sally.io/api/v1/McpExternal";
|
||||||
|
};
|
||||||
|
Metabase = {
|
||||||
|
url = "https://kpi.az-gruppe.com/api/metabase-mcp";
|
||||||
|
};
|
||||||
|
Outline = {
|
||||||
|
url = "https://wiki.az-gruppe.com/mcp";
|
||||||
|
};
|
||||||
|
Playwright = {
|
||||||
|
command = "bash";
|
||||||
|
args = ["-c" "exec bunx @playwright/mcp@latest"];
|
||||||
|
};
|
||||||
|
Ref = {
|
||||||
|
command = "bash";
|
||||||
|
args = ["-c" "REF_API_KEY=$(cat /run/agenix/ref-key) exec bunx ref-tools-mcp@latest"];
|
||||||
|
};
|
||||||
|
Teams = {
|
||||||
|
command = "bunx";
|
||||||
|
args = ["-y" "@floriscornel/teams-mcp@latest"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in new issue
Block a user