Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions home/.chezmoitemplates/apm/mcp-server.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- name: {{ index . "name" }}
- name: "{{ index . "name" }}"
registry: {{ index . "registry" }}
transport: {{ index . "transport" }}
{{- if hasKey . "url" }}
url: {{ index . "url" }}
url: "{{ index . "url" }}"
{{- end }}
{{- if hasKey . "headers" }}
headers:
Expand All @@ -11,7 +11,7 @@
{{- end }}
{{- end }}
{{- if hasKey . "command" }}
command: {{ index . "command" }}
command: "{{ index . "command" }}"
{{- end }}
{{- if hasKey . "args" }}
args:
Expand Down
4 changes: 2 additions & 2 deletions home/dot_apm/apm.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ dependencies:
{{- with .skills }}
skills:
{{- range . }}
- {{ . }}
- "{{ . }}"
{{- end }}
{{- end }}
{{- else }}
- {{ . }}
- "{{ . }}"
{{- end }}
{{ end }}
{{ end -}}
Expand Down
4 changes: 2 additions & 2 deletions home/dot_config/git/config.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[user]
name = {{ .git.name }}
email = {{ .git.email }}
name = "{{ .git.name }}"
email = "{{ .git.email }}"
[core]
editor = code --wait
pager = delta
Expand Down
2 changes: 1 addition & 1 deletion home/dot_config/mise/config.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

[settings]
idiomatic_version_file_enable_tools = ["node", "python", "pnpm"]
trusted_config_paths = ["/"]
trusted_config_paths = ["~"]
10 changes: 5 additions & 5 deletions tests/template/agent-instructions.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
# @brief Template rendering tests for shared agent instruction markdown.

load '../test_helpers/load.bash'
load '../test_helpers/templates.bash'

SOURCE_DIR="$DOTFILES_ROOT/home"
CLAUDE_TEMPLATE="$DOTFILES_ROOT/home/dot_claude/CLAUDE.md.tmpl"
OPENCODE_TEMPLATE="$DOTFILES_ROOT/home/dot_config/opencode/AGENTS.md.tmpl"

@test "agent instruction templates render shared markdown" {
run mise exec -- chezmoi execute-template --source "$SOURCE_DIR" <"$CLAUDE_TEMPLATE"
run render_chezmoi_template "$CLAUDE_TEMPLATE"

assert_success
assert_line --index 0 '# Claude Code Settings'
assert_line --regexp '^### GitHub CLI$'
assert_line 'Use `gh` CLI for all GitHub interactions. Never clone repositories to read code.'

run mise exec -- chezmoi execute-template --source "$SOURCE_DIR" <"$OPENCODE_TEMPLATE"
run render_chezmoi_template "$OPENCODE_TEMPLATE"

assert_success
assert_line --index 0 '# Claude Code Settings'
Expand All @@ -36,15 +36,15 @@ OPENCODE_TEMPLATE="$DOTFILES_ROOT/home/dot_config/opencode/AGENTS.md.tmpl"
}

@test "agent instruction templates render Graphify guidance" {
run mise exec -- chezmoi execute-template --source "$SOURCE_DIR" <"$CLAUDE_TEMPLATE"
run render_chezmoi_template "$CLAUDE_TEMPLATE"

assert_success
assert_line '## Graphify'
assert_line '- Use the installed Graphify skill when the user invokes `/graphify`.'
assert_line --partial 'graphify query'
assert_line --partial 'GRAPH_REPORT.md'

run mise exec -- chezmoi execute-template --source "$SOURCE_DIR" <"$OPENCODE_TEMPLATE"
run render_chezmoi_template "$OPENCODE_TEMPLATE"

assert_success
assert_line '## Graphify'
Expand Down
56 changes: 24 additions & 32 deletions tests/template/apm-config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,23 @@
# @brief Template rendering tests for home/dot_apm/apm.yml.tmpl.

load '../test_helpers/load.bash'
load '../test_helpers/templates.bash'

SOURCE_DIR="$DOTFILES_ROOT/home"
APM_TEMPLATE="$DOTFILES_ROOT/home/dot_apm/apm.yml.tmpl"
PERSONAL_DATA='{"chezmoi":{"os":"darwin"},"personal":true,"work":false}'
WORK_DATA='{"chezmoi":{"os":"darwin"},"personal":false,"work":true}'

render_apm_template() {
local data="$1"

mise exec -- chezmoi execute-template --source "$SOURCE_DIR" --override-data "$data" <"$APM_TEMPLATE"
}

@test "personal APM config renders only shared MCP servers" {
run render_apm_template "$PERSONAL_DATA"
run render_chezmoi_template "$APM_TEMPLATE" "$PERSONAL_DATA"

assert_success
assert_line ' - name: grep'
assert_line ' - name: "grep"'
assert_line ' registry: false'
assert_line ' url: https://mcp.grep.app'
assert_line ' url: "https://mcp.grep.app"'
refute_line --regexp 'name: figma'
refute_line --regexp 'name: jira'
}

@test "personal APM config renders personal target" {
run render_apm_template "$PERSONAL_DATA"
run render_chezmoi_template "$APM_TEMPLATE" "$PERSONAL_DATA"

assert_success
assert_line ' - claude'
Expand All @@ -38,36 +30,36 @@ render_apm_template() {
}

@test "personal APM config renders shared and personal APM packages" {
run render_apm_template "$PERSONAL_DATA"
run render_chezmoi_template "$APM_TEMPLATE" "$PERSONAL_DATA"

assert_success
assert_line --partial ' - obra/superpowers'
assert_line --partial ' - JuliusBrussee/caveman'
assert_line --partial ' - anthropics/claude-plugins-official/plugins/skill-creator'
assert_line --partial ' - schpet/linear-cli'
assert_line --partial ' - tavily-ai/skills'
assert_line --partial ' - "obra/superpowers'
assert_line --partial ' - "JuliusBrussee/caveman'
assert_line --partial ' - "anthropics/claude-plugins-official/plugins/skill-creator'
assert_line --partial ' - "schpet/linear-cli'
assert_line --partial ' - "tavily-ai/skills'
assert_line --partial ' - git: JuliusBrussee/skills'
assert_line ' skills:'
assert_line ' - grill-me'
assert_line ' - junior-to-senior'
assert_line ' - "grill-me"'
assert_line ' - "junior-to-senior"'
refute_line --partial 'interface-kit'
refute_line --partial 'loop-factory'
refute_line --partial 'context-canary'
}

@test "work APM config renders Figma and Jira MCP servers" {
run render_apm_template "$WORK_DATA"
run render_chezmoi_template "$APM_TEMPLATE" "$WORK_DATA"

assert_success
assert_line ' - name: grep'
assert_line ' - name: figma'
assert_line ' url: https://mcp.figma.com/mcp'
assert_line ' - name: jira'
assert_line ' url: https://mcp.atlassian.com/v1/mcp'
assert_line ' - name: "grep"'
assert_line ' - name: "figma"'
assert_line ' url: "https://mcp.figma.com/mcp"'
assert_line ' - name: "jira"'
assert_line ' url: "https://mcp.atlassian.com/v1/mcp"'
}

@test "work APM config renders work target" {
run render_apm_template "$WORK_DATA"
run render_chezmoi_template "$APM_TEMPLATE" "$WORK_DATA"

assert_success
assert_line ' - copilot'
Expand All @@ -78,12 +70,12 @@ render_apm_template() {
}

@test "work APM config renders shared APM packages without personal packages" {
run render_apm_template "$WORK_DATA"
run render_chezmoi_template "$APM_TEMPLATE" "$WORK_DATA"

assert_success
assert_line --partial ' - obra/superpowers'
assert_line --partial ' - JuliusBrussee/caveman'
assert_line --partial ' - anthropics/claude-plugins-official/plugins/skill-creator'
assert_line --partial ' - "obra/superpowers'
assert_line --partial ' - "JuliusBrussee/caveman'
assert_line --partial ' - "anthropics/claude-plugins-official/plugins/skill-creator'
refute_line --partial ' - schpet/linear-cli'
refute_line --partial ' - tavily-ai/skills'
refute_line --partial 'JuliusBrussee/skills'
Expand Down
10 changes: 3 additions & 7 deletions tests/template/apm-lockfile.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@
# @brief apm.lock.yaml.tmpl selects the correct per-context lockfile.

load '../test_helpers/load.bash'
load '../test_helpers/templates.bash'

SOURCE_DIR="$DOTFILES_ROOT/home"
TMPL="$DOTFILES_ROOT/home/dot_apm/apm.lock.yaml.tmpl"
PERSONAL='{"personal":true,"work":false}'
WORK='{"personal":false,"work":true}'

render() {
mise exec -- chezmoi execute-template --source "$SOURCE_DIR" --override-data "$1" <"$TMPL"
}

@test "personal context renders the personal lockfile" {
personal_first="$(grep -m1 resolved_commit "$DOTFILES_ROOT/home/.chezmoitemplates/apm/apm.lock.personal.yaml")"
run render "$PERSONAL"
run render_chezmoi_template "$TMPL" "$PERSONAL"
assert_success
assert_line --regexp '^lockfile_version'
assert_line "$personal_first"
}

@test "work context renders the work lockfile" {
run render "$WORK"
run render_chezmoi_template "$TMPL" "$WORK"
assert_success
assert_line --regexp '^lockfile_version'
}
27 changes: 9 additions & 18 deletions tests/template/chezmoi-helpers.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,33 @@
# @brief Template rendering tests for chezmoi helper templates.

load '../test_helpers/load.bash'
load '../test_helpers/templates.bash'

SOURCE_DIR="$DOTFILES_ROOT/home"
ACTIVE_GROUPS_TMPL="$DOTFILES_ROOT/home/.chezmoitemplates/lib/chezmoi/active-groups.json.tmpl"
ACTIVE_GROUP_VALUES_TMPL="$DOTFILES_ROOT/home/.chezmoitemplates/lib/chezmoi/active-group-values.json.tmpl"

DARWIN_DATA='{"chezmoi":{"os":"darwin"},"personal":true,"work":false}'
WORK_DATA='{"chezmoi":{"os":"darwin"},"personal":false,"work":true}'
SHARED_DATA='{"chezmoi":{"os":"darwin"},"personal":false,"work":false}'
BOTH_DATA='{"chezmoi":{"os":"darwin"},"personal":true,"work":true}'

APM_VALUES_BY_GROUP='{"shared":["graphify"],"personal":["claude","agent-skills"],"work":["copilot"]}'
APM_VALUES_SPARSE='{"shared":["graphify"]}'

render_helper() {
local template="$1"
local data="$2"

mise exec -- chezmoi execute-template --source "$SOURCE_DIR" --override-data "$data" <"$template"
}

@test "active-groups returns shared and personal for personal context" {
run render_helper "$ACTIVE_GROUPS_TMPL" "$DARWIN_DATA"
run render_chezmoi_template "$ACTIVE_GROUPS_TMPL" "$DARWIN_DATA"

assert_success
assert_output '["shared","personal"]'
}

@test "active-groups returns shared and work for work context" {
run render_helper "$ACTIVE_GROUPS_TMPL" "$WORK_DATA"
run render_chezmoi_template "$ACTIVE_GROUPS_TMPL" "$WORK_DATA"

assert_success
assert_output '["shared","work"]'
}

@test "active-groups returns only shared when neither personal nor work" {
run render_helper "$ACTIVE_GROUPS_TMPL" "$SHARED_DATA"
run render_chezmoi_template "$ACTIVE_GROUPS_TMPL" "$SHARED_DATA"

assert_success
assert_output '["shared"]'
Expand All @@ -48,7 +39,7 @@ render_helper() {
local data
data=$(printf '{"ctx":{"personal":true,"work":false},"valuesByGroup":%s}' "$APM_VALUES_BY_GROUP")

run render_helper "$ACTIVE_GROUP_VALUES_TMPL" "$data"
run render_chezmoi_template "$ACTIVE_GROUP_VALUES_TMPL" "$data"

assert_success
assert_output '["graphify","claude","agent-skills"]'
Expand All @@ -58,7 +49,7 @@ render_helper() {
local data
data=$(printf '{"ctx":{"personal":false,"work":true},"valuesByGroup":%s}' "$APM_VALUES_BY_GROUP")

run render_helper "$ACTIVE_GROUP_VALUES_TMPL" "$data"
run render_chezmoi_template "$ACTIVE_GROUP_VALUES_TMPL" "$data"

assert_success
assert_output '["graphify","copilot"]'
Expand All @@ -68,14 +59,14 @@ render_helper() {
local data
data=$(printf '{"ctx":{"personal":false,"work":false},"valuesByGroup":%s}' "$APM_VALUES_BY_GROUP")

run render_helper "$ACTIVE_GROUP_VALUES_TMPL" "$data"
run render_chezmoi_template "$ACTIVE_GROUP_VALUES_TMPL" "$data"

assert_success
assert_output '["graphify"]'
}

@test "active-groups returns shared, personal, and work when both are true" {
run render_helper "$ACTIVE_GROUPS_TMPL" "$BOTH_DATA"
run render_chezmoi_template "$ACTIVE_GROUPS_TMPL" "$BOTH_DATA"

assert_success
assert_output '["shared","personal","work"]'
Expand All @@ -85,7 +76,7 @@ render_helper() {
local data
data=$(printf '{"ctx":{"personal":true,"work":false},"valuesByGroup":%s}' "$APM_VALUES_SPARSE")

run render_helper "$ACTIVE_GROUP_VALUES_TMPL" "$data"
run render_chezmoi_template "$ACTIVE_GROUP_VALUES_TMPL" "$data"

assert_success
assert_output '["graphify"]'
Expand Down
Loading
Loading