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
3 changes: 2 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24"
go-version: "1.25.10"
cache: true
- run: go mod download
- run: go test ./... -v
Expand All @@ -63,6 +63,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: AxeForging/reviewforge@main
continue-on-error: true
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AI_PROVIDER: gemini
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: "1.24"
go-version: "1.25.10"
cache: true

- name: Download dependencies
Expand Down
3 changes: 3 additions & 0 deletions .structlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ file_naming_pattern:
- "*.toml"
- "*.md"
- "*.txt"
- "*.css"
- "*.js"
- "*.tmpl"
- "*.png"
- "*.jpg"
- "*.svg"
Expand Down
134 changes: 134 additions & 0 deletions COMMANDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# YankRun Commands

Quick reference for the commands available in the single `yankrun` binary.

## `template`

Template an existing directory in place.

```sh
yankrun template --dir ./project --input values.yaml
yankrun template --dir ./project --input values.yaml --dryRun
yankrun template --dir ./project --input values.yaml --processTemplates
```

Useful when you already have a working tree and want to replace placeholders safely.

Key flags:

| Flag | Description |
|------|-------------|
| `--dir`, `-d` | Directory to process |
| `--input`, `-i` | YAML/JSON values file |
| `--dryRun`, `--dr` | Preview without writing |
| `--startDelim`, `--sd` | Start delimiter, default `[[` |
| `--endDelim`, `--ed` | End delimiter, default `]]` |
| `--processTemplates`, `--pt` | Process `.tpl` files and remove `.tpl` suffix |
| `--onlyTemplates`, `--ot` | Only process `.tpl` files |
| `--ignore` | Glob pattern to skip |

## `clone`

Clone a repository and apply replacements.

```sh
yankrun clone \
--repo https://github.com/AxeForging/template-tester.git \
--input values.yaml \
--outputDir ./my-project
```

SSH works when your local SSH key or agent can access the repo:

```sh
yankrun clone \
--repo git@github.com:AxeForging/template-tester.git \
--branch main \
--outputDir ./my-project
```

Key flags:

| Flag | Description |
|------|-------------|
| `--repo` | HTTPS or SSH Git URL |
| `--branch`, `-b` | Branch to clone |
| `--outputDir`, `-o` | Output directory |
| `--input`, `-i` | YAML/JSON values file |
| `--dryRun`, `--dr` | Preview without leaving output behind |

## `generate`

Choose from configured template repos and generate a project.

```sh
yankrun generate --prompt
yankrun generate --template go-service --input values.yaml --outputDir ./new-service
```

Templates come from `~/.yankrun/config.yaml` and optional GitHub discovery.

Key flags:

| Flag | Description |
|------|-------------|
| `--template`, `-t` | Template name/filter |
| `--branch`, `-b` | Branch to clone |
| `--outputDir`, `-o` | Output directory |
| `--input`, `-i` | YAML/JSON values file |
| `--noCache`, `--nc` | Bypass cached GitHub/template data |

## `serve`

Open the local web workbench.

```sh
yankrun serve --dir ./project --input values.yaml
yankrun serve --dir ./project --addr 127.0.0.1:19090
yankrun serve --dir ./project --dryRun
```

The server binds to `127.0.0.1:17817` by default.

Use `serve` when you want:

- Local, Clone, and Generate modes in one UI
- file-level placeholder trees
- evaluated transform previews
- idle refresh while editing values
- saved presets per repo/template in browser IndexedDB
- JSON import/export for presets

Key flags:

| Flag | Description |
|------|-------------|
| `--dir`, `-d` | Local directory for Local mode |
| `--input`, `-i` | YAML/JSON values file |
| `--addr` | Listen address |
| `--dryRun`, `--dr` | Force preview-only mode |
| `--ignore` | Glob pattern to skip |

## `tui`

Run a conservative terminal workflow for local templating.

```sh
yankrun tui --dir ./project --input values.yaml
yankrun tui --dir ./project --dryRun
```

The TUI scans, summarizes, previews replacement counts, and writes only when not in dry-run mode.

## `setup`

Manage `~/.yankrun/config.yaml`.

```sh
yankrun setup
yankrun setup --show
yankrun setup --reset
```

Use this to configure default delimiters, file size limits, template repos, and GitHub discovery.

158 changes: 158 additions & 0 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# YankRun Examples

Practical examples for common template workflows.

## Try the public sample template

```sh
cat > values.yaml <<'EOF'
variables:
- key: APP_NAME
value: TemplateTester
- key: PROJECT_NAME
value: DemoProject
- key: USER_NAME
value: tester
- key: USER_EMAIL
value: tester@example.com
- key: VERSION
value: 9.9.9
EOF

yankrun clone \
--repo https://github.com/AxeForging/template-tester.git \
--input values.yaml \
--outputDir ./template-test
```

## Preview a repo in the web workbench

```sh
yankrun serve --dir ./template-test --input values.yaml
```

Open `http://127.0.0.1:17817`, then use:

- **Local** for the directory passed with `--dir`
- **Clone** for a direct SSH/HTTPS repo URL
- **Generate** for templates configured in `~/.yankrun/config.yaml`

The workbench shows a file tree for each placeholder and evaluated transform previews such as `APP_NAME:toUpperCase -> TEMPLATETESTER`.

## Clone with SSH auth

```sh
yankrun clone \
--repo git@github.com:AxeForging/template-tester.git \
--branch main \
--input values.yaml \
--outputDir ./template-test
```

This uses the same local SSH setup as Git. If your key or agent works with `git clone`, YankRun should work too.

## Configure templates for `generate`

Create or edit `~/.yankrun/config.yaml`:

```yaml
templates:
- name: template-tester
url: https://github.com/AxeForging/template-tester.git
description: YankRun sample template repo
default_branch: main
```

Then run:

```sh
yankrun generate --template template-tester --input values.yaml --outputDir ./generated-app
```

Or use the **Generate** tab in `yankrun serve`.

## Template an existing project

```sh
cat > updates.yaml <<'EOF'
variables:
- key: COMPANY_NAME
value: AxeForge
- key: SUPPORT_EMAIL
value: support@example.com
- key: VERSION
value: 2.0.0
EOF

yankrun template --dir ./project --input updates.yaml --dryRun
yankrun template --dir ./project --input updates.yaml
```

## Avoid Helm or Go template conflicts

YankRun defaults to `[[` and `]]`, so it will not touch Helm/Go template syntax like `{{ .Values.name }}`.

If a project already uses `[[` and `]]`, choose custom delimiters:

```sh
yankrun template \
--dir ./project \
--input values.yaml \
--startDelim "<%" \
--endDelim "%>"
```

Template files can then contain:

```text
name: <%APP_NAME%>
version: <%VERSION%>
```

## Process `.tpl` files

```sh
yankrun template \
--dir ./project \
--input values.yaml \
--processTemplates
```

`README.md.tpl` becomes `README.md` after template processing. Existing target files are not overwritten silently.

## Use transforms

Template:

```text
Package: [[APP_NAME:toLowerCase]]
Constant: [[APP_NAME:toUpperCase]]
URL slug: [[PROJECT_NAME:gsub( ,-):toLowerCase]]
```

Values:

```yaml
variables:
- key: APP_NAME
value: My App
- key: PROJECT_NAME
value: My Project
```

Result:

```text
Package: my app
Constant: MY APP
URL slug: my-project
```

## Save and reuse presets in `serve`

1. Run `yankrun serve --dir ./project --input values.yaml`.
2. Preview a Local, Clone, or Generate run.
3. The run is saved locally in browser IndexedDB.
4. Use the left preset rail to search by repo, template, branch, output directory, or value keys.
5. Export/import presets as JSON when moving between browsers.

Loading
Loading