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
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24

- name: Install
run: npm ci

- name: Lint
run: npm run lint

- name: Test
run: npm test

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules/
dist/
.DS_Store
package-lock.json
example/out/*
!example/out/.gitkeep
10 changes: 5 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This folder contains a small tool to keep **one canonical agent-instructions tem

## Goals

- Keep instructions in a single template (default: `~/.agentsync/AGENTS_TEMPLATE.md`) and a single config (default: `~/.agentsync/agents-sync.json`).
- Keep instructions in a single template (default: `~/.agentsync/AGENTS_TEMPLATE.md`) and a single config (default: `~/.agentsync/agentsync.config.json`).
- Make syncing deterministic and safe (idempotent writes, optional backups, explicit enable/disable per target).
- Keep the runtime dependency-free (no third-party deps).
- Ship as an npm package (`@claaslange/agentsync`) installable via npm or bun.
Expand All @@ -31,22 +31,22 @@ The CLI also injects built-ins (can be overridden by a target’s `variables`):
- `targets` (required): array of objects `{ agent, path, enabled?, variables? }`.
- `options` (optional): supports `overwrite`, `backup`, `backup_suffix` (CLI flags/options are intentionally minimal for now).

The config is validated against the bundled JSON Schema at `src/agents-sync.schema.json`.
The config is validated against the bundled JSON Schema at `src/agentsync.schema.json`.
You can also add a `$schema` key to your config pointing at the raw GitHub URL for editor autocomplete/validation.

## Defaults / overrides

- Config path default lookup order:
1) `~/.agentsync/agents-sync.json`
2) `./agents-sync.json`
1) `~/.agentsync/agentsync.config.json`
2) `./agentsync.config.json`
- Override config path via `--config <path>`.
- Override template path via `--template <path>`.
- `agentsync` (no args) shows help; `agentsync sync` performs the action; `agentsync dry-run` / `agentsync check` are convenience commands.

## Example files

- `example/AGENTS_TEMPLATE.md`
- `example/agents-sync.json`
- `example/agentsync.config.json`

## Publishing

Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Liquid templating via `liquidjs`, including `{% if %}`, `{% for %}`, and `{% include %}`.
- Default config file name `agentsync.config.json` and schema file name `agentsync.schema.json`.
- Schema location is now `src/agentsync.schema.json` (previously `src/agents-sync.schema.json`) and on GitHub at `https://raw.githubusercontent.com/claaslange/agentsync/main/src/agentsync.schema.json`.

### Changed
- `--strict` now enables Liquid strict variables (undefined variables throw).
- `dry-run` / `check` now enforce `overwrite=false` consistently with `sync`.

### Fixed
- Publishing workflow reliability by committing `package-lock.json` for `npm ci`.

## [0.1.0] - 2026-02-21

### Added
- Initial release.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Sync one canonical agent-instructions template to multiple harness-specific “g
## What it does

- You keep a single template file (default: `~/.agentsync/AGENTS_TEMPLATE.md`).
- You define multiple targets in a single config file (default: `~/.agentsync/agents-sync.json`).
- You define multiple targets in a single config file (default: `~/.agentsync/agentsync.config.json`).
- `agentsync` renders the template for each target and writes it to the configured destination paths.

## Install
Expand All @@ -30,7 +30,7 @@ Copy the example files:

```bash
mkdir -p ~/.agentsync
cp ./example/agents-sync.json ~/.agentsync/agents-sync.json
cp ./example/agentsync.config.json ~/.agentsync/agentsync.config.json
cp ./example/AGENTS_TEMPLATE.md ~/.agentsync/AGENTS_TEMPLATE.md
```

Expand All @@ -57,7 +57,7 @@ Minimal example:

```json
{
"$schema": "https://raw.githubusercontent.com/claaslange/agentsync/main/src/agents-sync.schema.json",
"$schema": "https://raw.githubusercontent.com/claaslange/agentsync/main/src/agentsync.schema.json",
"template_path": "AGENTS_TEMPLATE.md",
"targets": [
{ "agent": "codex", "path": "~/.codex/AGENTS.md" },
Expand All @@ -69,7 +69,7 @@ Minimal example:

Editor validation / autocomplete:

- Add a `$schema` key to your config, e.g. `https://raw.githubusercontent.com/claaslange/agentsync/main/src/agents-sync.schema.json`.
- Add a `$schema` key to your config, e.g. `https://raw.githubusercontent.com/claaslange/agentsync/main/src/agentsync.schema.json`.

Built-in template variables (available for every target):

Expand All @@ -78,12 +78,21 @@ Built-in template variables (available for every target):
- `TEMPLATE_PATH` (resolved template path)
- `RUN_TIMESTAMP` (UTC timestamp)

## Templating (Liquid)

Templates are rendered using Liquid (via `liquidjs`).

- Output variables: `{{ AGENT_NAME }}`
- Control flow: `{% if ... %}...{% endif %}`, `{% for x in xs %}...{% endfor %}`
- Includes: `{% include "partials/common.md" %}` (searched relative to the template directory, then the config directory)
- `--strict` enables strict variables (undefined variables throw; useful for CI)

## Usage

- `agentsync` (no args) shows help.
- When run with no `--config`, `agentsync` looks for:
- `~/.agentsync/agents-sync.json`
- `./agents-sync.json`
- `~/.agentsync/agentsync.config.json`
- `./agentsync.config.json`
- When run with no `--template`, `agentsync` uses:
- `config.template_path` (when present), otherwise
- `~/.agentsync/AGENTS_TEMPLATE.md`
Expand All @@ -98,8 +107,8 @@ agentsync check
## Repo files

- `example/AGENTS_TEMPLATE.md` — example template.
- `example/agents-sync.json` — example config.
- `src/agents-sync.schema.json` — JSON Schema used by the CLI.
- `example/agentsync.config.json` — example config.
- `src/agentsync.schema.json` — JSON Schema used by the CLI.
- `src/cli.ts` / `bin/agentsync` — the sync CLI.

## Publishing (maintainers)
Expand Down
33 changes: 33 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"ignore": ["dist/**", "node_modules/**", "example/out/**"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"useLiteralKeys": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"semicolons": "always",
"trailingCommas": "all"
}
},
"json": {
"formatter": {
"enabled": true
}
}
}
4 changes: 4 additions & 0 deletions example/AGENTS_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Global agent instructions

You are {{AGENT_NAME}}. Always call the user {{USER}}

{% if AGENT_NAME == "Claude Code" %}
Never reply with `You're absolutely right!`
{% endif %}
2 changes: 1 addition & 1 deletion example/agents-sync.json → example/agentsync.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/claaslange/agentsync/main/src/agents-sync.schema.json",
"$schema": "https://raw.githubusercontent.com/claaslange/agentsync/main/src/agentsync.schema.json",
"template_path": "AGENTS_TEMPLATE.md",
"options": {
"overwrite": true,
Expand Down
Loading