panrelease 0.19.0

Utility to release software
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# Configuration Guide

Panrelease is configured through a `.panproject.toml` file placed at the root of your Git repository. This document covers all available configuration options with examples.

## Table of Contents

- [File Location]#file-location
- [Minimal Configuration]#minimal-configuration
- [Full Configuration Reference]#full-configuration-reference
- [VCS Configuration]#vcs-configuration
- [Module Configuration]#module-configuration
- [Hooks]#hooks
- [Package Manager Details]#package-manager-details
- [Examples]#examples
- [Auto-Detection]#auto-detection

## File Location

The configuration file must be named `.panproject.toml` and placed at the root of your Git repository (same level as `.git/`).

```
my-project/
├── .git/
├── .panproject.toml    <-- here
├── src/
└── ...
```

## Minimal Configuration

If no `.panproject.toml` exists, Panrelease will auto-detect the package manager based on manifest files in the current directory. However, for explicit control, create a minimal config:

```toml
[modules.main]
path = "."
packageManager = "Cargo"
main = true
```

## Full Configuration Reference

```toml
# Version Control System configuration
[vcs]
software = "Git"                    # VCS type (currently only "Git" is supported)
force_sign = false                  # Require GPG-signed commits and tags
tag_template = "{{version}}"        # Template for Git tag names

# Module definitions (one or more)
[modules.my-module]
path = "."                          # Path relative to project root
packageManager = "Cargo"            # Package manager type
main = true                         # Whether this is the primary module

# Post-release hooks for a module
[modules.my-module.hooks.after_rel]
build = ["cargo", "build", "--release"]
test = ["cargo", "test"]
```

## VCS Configuration

The `[vcs]` section configures version control behavior.

### `software` (string)

The version control system to use. Currently only `"Git"` is supported.

```toml
[vcs]
software = "Git"
```

**Default:** `"Git"`

### `force_sign` (boolean)

When `true`, Panrelease will use `git commit -S` and `git tag -s` to create GPG-signed commits and tags. Requires GPG to be configured in your Git settings.

```toml
[vcs]
force_sign = true
```

**Default:** `false`

### `tag_template` (string)

A template string for Git tag names. Use `{{version}}` as a placeholder for the version number.

```toml
[vcs]
tag_template = "v{{version}}"
```

| Template | Version | Tag |
|----------|---------|-----|
| `{{version}}` | 1.0.0 | `1.0.0` |
| `v{{version}}` | 1.0.0 | `v1.0.0` |
| `release-{{version}}` | 1.0.0 | `release-1.0.0` |
| `myapp/{{version}}` | 1.0.0 | `myapp/1.0.0` |

**Default:** `"{{version}}"`

## Module Configuration

Each `[modules.<name>]` section defines a package/module in your project.

### `path` (string, required)

The path to the module directory, relative to the project root.

```toml
[modules.core]
path = "packages/core"
```

Use `"."` for the project root:

```toml
[modules.main]
path = "."
```

### `packageManager` (string, required)

The package manager used by this module. Determines which manifest file is read and how versions are updated.

| Value | Manifest File | Description |
|-------|--------------|-------------|
| `"Cargo"` | `Cargo.toml` | Rust projects using Cargo |
| `"Npm"` | `package.json` | Node.js projects using npm/yarn/pnpm |
| `"Maven"` | `pom.xml` | Java projects using Maven |
| `"Gradle"` | `gradle.properties` | Java/Kotlin projects using Gradle |
| `"Generic"` | User-defined | Any project with a version in a JSON, XML, or TOML file |

```toml
[modules.backend]
packageManager = "Maven"
```

When using `"Generic"`, additional fields are required — see [Generic](#generic) below.

### `main` (boolean)

Marks this module as the primary module. The main module is used to extract the current project version before bumping. In multi-module projects, exactly one module must be marked as `main = true`.

```toml
[modules.core]
main = true
```

**Default:** `false`

**Rules:**
- If only one module is defined, it is automatically treated as the main module
- If multiple modules exist, exactly one must have `main = true`
- Having zero or multiple main modules in a multi-module project will cause an error

## Hooks

Hooks allow you to run commands after a release. They are defined per module under `[modules.<name>.hooks.after_rel]`.

### Structure

```toml
[modules.myapp.hooks.after_rel]
hook_name = ["command", "arg1", "arg2"]
```

Each hook is a named entry with a command specified as an array of strings (the command and its arguments).

### Execution

- Hooks run **after** the version has been updated in the manifest file
- Hooks run **before** the Git commit
- Hooks execute in alphabetical order by name
- Hooks run in the module's directory
- If a hook fails, the release process stops

### Examples

```toml
# Build after version bump
[modules.myapp.hooks.after_rel]
build = ["cargo", "build", "--release"]

# Run tests
[modules.myapp.hooks.after_rel]
test = ["cargo", "test"]

# Publish to registry
[modules.myapp.hooks.after_rel]
publish = ["cargo", "publish"]

# Multiple hooks (execute in alphabetical order)
[modules.myapp.hooks.after_rel]
01_build = ["cargo", "build", "--release"]
02_test = ["cargo", "test"]
03_publish = ["cargo", "publish"]
```

**Tip:** Prefix hook names with numbers to control execution order, since they run in alphabetical order.

## Package Manager Details

### Cargo

Reads and writes version in `Cargo.toml` under the `[package]` section. After updating the version, runs `cargo check` to regenerate `Cargo.lock`.

```toml
# Cargo.toml structure expected:
# [package]
# version = "1.0.0"
```

### Npm

Reads and writes version in `package.json`. Automatically detects and updates the appropriate lockfile:

| Lockfile | Tool |
|----------|------|
| `package-lock.json` | npm |
| `yarn.lock` | yarn |
| `pnpm-lock.yaml` | pnpm |

The lockfile is updated by running the corresponding package manager's install command.

### Maven

Reads and writes version in `pom.xml`. Supports two version patterns:

1. **Direct version**: `<version>1.0.0</version>` under `<project>`
2. **Property-based version**: Version stored in `<properties>` and referenced via `${property.name}` in `<version>`

### Gradle

Reads and writes the `version` property in `gradle.properties`:

```properties
# gradle.properties
version=1.0.0
```

### Generic

For projects that store their version in a custom file not covered by the built-in package managers. Requires three additional fields in the module configuration:

| Field | Type | Description |
|-------|------|-------------|
| `file` | string | Filename of the manifest (relative to module `path`) |
| `format` | string | File format: `"json"`, `"xml"`, or `"toml"` |
| `versionField` | string | Dot-separated path to the version field |

```toml
[modules.tauri]
path = "src-tauri"
packageManager = "Generic"
file = "tauri.conf.json"
format = "json"
versionField = "version"
```

The `versionField` uses dot notation to navigate nested structures. For example, `"package.version"` would target the `version` key inside a `package` object (JSON/TOML) or element (XML).

| Format | File example | versionField | Navigates to |
|--------|-------------|-------------|-------------|
| `json` | `config.json` | `version` | `{"version": "1.0.0"}` |
| `json` | `config.json` | `package.version` | `{"package": {"version": "1.0.0"}}` |
| `xml` | `config.xml` | `project.version` | `<project><version>1.0.0</version></project>` |
| `toml` | `config.toml` | `package.version` | `[package]` then `version = "1.0.0"` |

Generic modules have no built-in post-release hook (unlike Cargo's `cargo check` or Npm's lockfile update). Use the `[hooks.after_rel]` section for any custom commands you need.

**Note:** Generic modules cannot be auto-detected — they must be explicitly configured in `.panproject.toml`.

## Examples

### Single Rust Project

```toml
[modules.main]
path = "."
packageManager = "Cargo"
main = true

[modules.main.hooks.after_rel]
test = ["cargo", "test"]
```

### Node.js Project with Prefixed Tags

```toml
[vcs]
software = "Git"
tag_template = "v{{version}}"

[modules.app]
path = "."
packageManager = "Npm"
main = true
```

### Java Maven Project with Signed Commits

```toml
[vcs]
software = "Git"
force_sign = true
tag_template = "v{{version}}"

[modules.api]
path = "."
packageManager = "Maven"
main = true
```

### Monorepo with Multiple Languages

```toml
[vcs]
software = "Git"
tag_template = "v{{version}}"

[modules.rust-core]
path = "crates/core"
packageManager = "Cargo"
main = true

[modules.rust-cli]
path = "crates/cli"
packageManager = "Cargo"

[modules.node-sdk]
path = "packages/sdk"
packageManager = "Npm"

[modules.java-client]
path = "clients/java"
packageManager = "Maven"

[modules.rust-core.hooks.after_rel]
test = ["cargo", "test"]

[modules.node-sdk.hooks.after_rel]
build = ["npm", "run", "build"]
test = ["npm", "test"]
```

### Gradle + npm Hybrid Project

```toml
[vcs]
software = "Git"

[modules.backend]
path = "backend"
packageManager = "Gradle"
main = true

[modules.frontend]
path = "frontend"
packageManager = "Npm"
```

### Tauri Project (Npm + Cargo + Generic)

```toml
[vcs]
software = "Git"
tag_template = "v{{version}}"

[modules.frontend]
path = "."
packageManager = "Npm"
main = true

[modules.rust-backend]
path = "src-tauri"
packageManager = "Cargo"

[modules.tauri-conf]
path = "src-tauri"
packageManager = "Generic"
file = "tauri.conf.json"
format = "json"
versionField = "version"

[modules.frontend.hooks.after_rel]
build = ["pnpm", "build"]
test = ["pnpm", "test"]
```

## Auto-Detection

When no `.panproject.toml` is present, Panrelease attempts to auto-detect the package manager by checking for manifest files in this order:

1. `Cargo.toml` → Cargo
2. `pom.xml` → Maven
3. `package.json` → Npm
4. `gradle.properties` → Gradle

Auto-detection only works for single-module projects. For multi-module projects, a configuration file is required.