Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
60 changes: 60 additions & 0 deletions .github/workflows/test-ansible-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,45 @@ jobs:
# Test basic functionality
echo "✅ First installation completed successfully"

- name: Validate RTK integration (first run)
run: |
echo "=== Validating RTK integration ==="

# Check that rtk command is available (installed via Homebrew)
if ! command -v rtk >/dev/null 2>&1; then
echo "❌ rtk command not found"
exit 1
fi
echo "✅ rtk command is available"

# Check that GitHub Copilot hooks directory was created
if [ ! -d "${HOME}/.github/hooks" ]; then
echo "❌ ~/.github/hooks directory not found"
exit 1
fi
echo "✅ ~/.github/hooks directory exists"

Comment thread
francescoben marked this conversation as resolved.
Outdated
# Check that RTK instructions were injected into copilot-instructions.md
if [ ! -f "${HOME}/.github/copilot-instructions.md" ]; then
echo "❌ ~/.github/copilot-instructions.md not found"
exit 1
fi
echo "✅ ~/.github/copilot-instructions.md exists"

if ! grep -q "BEGIN RTK MANAGED BLOCK" "${HOME}/.github/copilot-instructions.md"; then
echo "❌ RTK managed block not found in copilot-instructions.md"
exit 1
fi
echo "✅ RTK managed block present in copilot-instructions.md"

echo "✅ RTK integration validated successfully"

- name: Add user content to copilot-instructions.md before second run
run: |
echo "# My custom instructions" >> "${HOME}/.github/copilot-instructions.md"
echo "This user content must survive re-provisioning." >> "${HOME}/.github/copilot-instructions.md"
echo "✅ User content added before second run"

- name: Fix ownership permissions and clean git state before second run
run: |
echo "=== Fixing ownership permissions and git state for second run ==="
Expand Down Expand Up @@ -143,6 +182,27 @@ jobs:

echo "✅ Second installation completed successfully - installer is idempotent"

- name: Validate RTK idempotency (second run)
run: |
echo "=== Validating RTK idempotency ==="

# The BEGIN marker must appear exactly once — blockinfile must replace, not append
MARKER_COUNT=$(grep -c "BEGIN RTK MANAGED BLOCK" "${HOME}/.github/copilot-instructions.md" || true)
if [ "${MARKER_COUNT}" -ne 1 ]; then
echo "❌ RTK managed block appears ${MARKER_COUNT} time(s) (expected 1) - idempotency broken"
exit 1
fi
echo "✅ RTK managed block appears exactly once — idempotency confirmed"

# User content added before the second run must still be present
if ! grep -q "My custom instructions" "${HOME}/.github/copilot-instructions.md"; then
echo "❌ User content was lost after re-provisioning"
exit 1
fi
echo "✅ User content preserved after re-provisioning"

echo "✅ RTK idempotency validated successfully"

- name: Clean up test installations (optional)
if: always()
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added RTK (Rust Token Killer) to default package list and Ansible provisioning: installs via `brew install rtk` and runs `rtk init -g` (Claude Code), `rtk init -g --copilot`, and `rtk init -g --opencode` to activate the token-optimization hook for Claude Code, GitHub Copilot and OpenCode (60-90% token savings on common dev commands); backs up and restores existing instruction files to guard against upstream overwrite bug (rtk-ai/rtk#834)
Comment thread
francescoben marked this conversation as resolved.
Outdated
- Added orphan cleanup to `sparkdock-agents-sync`: detects and removes managed skills/agent profiles no longer in upstream, with `--force` to remove locally modified orphans
- Added orphan detection to `sparkdock-agents-status`: flags resources removed from upstream as `orphan` type with cleanup hint
- Added DESCRIPTION column to `sjust sf-agents-status` tables, reading short descriptions from upstream `catalog.json` with tab-delimited rendering to support commas in descriptions
Expand Down
55 changes: 55 additions & 0 deletions ansible/macos/macos/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,61 @@
- openspec_completion_output is not skipped
- openspec_completion_output.rc == 0

- name: Configure RTK for LLM token optimization
tags: rtk
block:
# --- GitHub Copilot ---
- name: Initialize RTK for GitHub Copilot in temp directory
shell: |
RTK_TMPDIR=$(mktemp -d)
cd "${RTK_TMPDIR}"
rtk init --copilot --auto-patch > /dev/null 2>&1
echo "${RTK_TMPDIR}"
register: rtk_copilot_tmpdir
changed_when: true
become: false

- name: Ensure GitHub Copilot hooks directory exists
file:
path: "{{ ansible_facts['env']['HOME'] }}/.github/hooks"
state: directory
mode: '0755'
become: false

- name: Copy RTK hooks to GitHub Copilot config
copy:
src: "{{ rtk_copilot_tmpdir.stdout }}/.github/hooks/"
dest: "{{ ansible_facts['env']['HOME'] }}/.github/hooks/"
remote_src: true
become: false
ignore_errors: yes
Comment thread
francescoben marked this conversation as resolved.
Outdated

- name: Inject RTK instructions into Copilot copilot-instructions.md
blockinfile:
path: "{{ ansible_facts['env']['HOME'] }}/.github/copilot-instructions.md"
marker: "<!-- {mark} RTK MANAGED BLOCK -->"
block: "{{ lookup('file', rtk_copilot_tmpdir.stdout + '/.github/copilot-instructions.md') }}"
create: yes
become: false

- name: Cleanup GitHub Copilot temp directory
file:
path: "{{ rtk_copilot_tmpdir.stdout }}"
state: absent
become: false

Comment thread
francescoben marked this conversation as resolved.
Outdated
# --- OpenCode ---
- name: Initialize RTK for OpenCode
command: rtk init -g --opencode --auto-patch
register: rtk_opencode_result
changed_when: true
failed_when: rtk_opencode_result.rc != 0
become: false

- name: Display RTK initialization status
debug:
msg: "✅ RTK initialized for GitHub Copilot and OpenCode. Restart your AI coding tools to activate."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@francescoben I want to move all that logic into a sjust task (the shared one) and a reusable install script, so that we can:

  1. Manual re-run from sjust
  2. Easy to integrate in the archlinux provisioner @Monska85

@francescoben


- name: Sync AI coding agent resources from upstream repository
tags:
- skills
Expand Down
1 change: 1 addition & 0 deletions config/packages/all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ homebrew_packages:
- mas
- gh
- glab
- rtk
- "node"
- "[email protected]"
- golang
Expand Down
Loading