You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Notes: captures stdout/stderr to a temporary log that is attached as a git note (skipped if empty) and merges `{run:{...}}` into the JSON trailer via `SHIPLOG_EXTRA_JSON`. `--dry-run` prints the command that would execute and exits without running it or writing a journal entry. See `docs/reference/json-schema.md` for the structured payload.
45
+
- Notes: captures stdout/stderr to a temporary log that is attached as a git note (skipped if empty) and merges `{run:{...}}` into the JSON trailer via `SHIPLOG_EXTRA_JSON`. `--dry-run` prints the command that would execute and exits without running it or writing a journal entry. See `docs/features/run.md` for detailed behavior (preview output, exit codes, caveats) and `docs/reference/json-schema.md` for the structured payload.
`git shiplog run` wraps a shell command, captures its stdout/stderr, and records the execution as a Shiplog journal entry. The command output is saved as a git note, and the structured trailer gains a `run` payload describing the invocation. Use `--dry-run` to preview what would happen without executing the command or writing an entry.
4
+
`git shiplog run` wraps a shell command, captures its stdout/stderr, and records the execution as a Shiplog journal entry. Output is saved as a git note, and the structured trailer gains a `run` payload describing the invocation. Use `--dry-run` to preview the command, status, and trailer fields without executing the command or mutating the journal.
5
5
6
6
## Usage
7
7
```bash
8
+
# Standard execution (writes to the journal once the wrapped command runs)
8
9
git shiplog run --service deploy --reason "Smoke test" -- env printf hi
10
+
11
+
# Dry run: rehearse the invocation without executing or writing an entry
9
12
git shiplog run --dry-run --service deploy --reason "Smoke test" -- env printf hi
10
13
```
11
14
12
-
-`--service` is required in non-interactive mode (and highly recommended in general).
13
-
- Place the command to execute after `--`. All arguments are preserved and logged.
- Exits with status `0` when the dry-run invocation is well formed. Invalid flags, missing `--`, or unknown subcommands surface the same non-zero exit codes as the standard command.
23
+
- Deterministic output keeps automation safe while rehearsing deploy playbooks.
15
24
16
-
## Behavior
17
-
- Captures stdout/stderr to a temporary file. When not in boring mode, output is also streamed to your terminal via `tee`.
18
-
-`--dry-run` prints the wrapped command, returns exit code 0, and skips execution, journal writes, and log attachment.
19
-
- Sets `SHIPLOG_BORING=1` and `SHIPLOG_ASSUME_YES=1` while calling `git shiplog write` so no prompts fire.
20
-
- Populates `SHIPLOG_EXTRA_JSON` with:
25
+
## Behavior (Standard Runs)
26
+
- Captures stdout/stderr to a temporary file. When Bosun is available, output streams through a live preview while still being recorded for notes.
27
+
- Sets `SHIPLOG_BORING=1` and `SHIPLOG_ASSUME_YES=1` while delegating to `git shiplog write`, ensuring prompts are bypassed.
28
+
- Populates `SHIPLOG_EXTRA_JSON` with a `run` block such as:
21
29
```json
22
30
{
23
31
"run": {
@@ -32,21 +40,34 @@ git shiplog run --dry-run --service deploy --reason "Smoke test" -- env printf h
32
40
}
33
41
}
34
42
```
35
-
- Attaches the captured log as a git note under `refs/_shiplog/notes/logs` when the entry is written successfully.
36
-
- Returns the wrapped command’s exit code so it can be chained in scripts or CI pipelines.
43
+
- Attaches the captured log as a git note under `refs/_shiplog/notes/logs` when an entry is written successfully.
44
+
- Returns the wrapped command’s exit code so it can chain cleanly in scripts or CI pipelines.
45
+
46
+
## Exit Codes
47
+
- Dry run
48
+
-`0` when the preview succeeds.
49
+
- Non-zero for malformed invocations or validation errors.
50
+
- Standard run
51
+
- Mirrors the wrapped command’s exit status after the journal entry is recorded.
52
+
- Propagates Shiplog errors directly if the CLI fails before wrapping the command.
37
53
38
54
## Options
39
-
-`--dry-run` — Print the command that would execute, then exit without running it or writing a journal entry.
55
+
-`--dry-run` — Preview the command and metadata without executing or writing an entry.
40
56
-`--env <name>` — Target journal environment (defaults to `SHIPLOG_ENV` or `prod`).
41
57
-`--service <name>` — Service/component; required when prompts are disabled.
> In my haste to release `v0.2.0`, I neglected to add a `--dry-run` mode to `git shiplog run`. This rapid follow-up is to address this oversight.
7
+
8
+
**Release type:** Feature release
9
+
10
+
This feature release introduces the new `--dry-run` flag for `git shiplog run`, letting teams rehearse deployments safely without mutating the journal.
11
+
12
+
## ⚓ Highlight
13
+
14
+
### 🧪 Dry-Run Preview — `git shiplog run --dry-run`
15
+
16
+
Plan a maintenance step or incident response without firing the actual command. The new `--dry-run` flag formats the invocation, previews exactly what would be logged, and exits 0 without executing or touching the journal.
17
+
18
+
```bash
19
+
$ git shiplog run \
20
+
--dry-run \
21
+
--service deploy \
22
+
--reason "Canary toggle" \
23
+
-- env ./scripts/flip-canary staging
24
+
ℹ️ shiplog run --dry-run: would execute: env ./scripts/flip-canary staging
25
+
```
26
+
27
+
- No command side effects and no Git notes are created.
28
+
- Bosun-enabled terminals (see the [Bosun CLI styling tool docs](../bosun/overview.md)) receive a styled “Dry Run” card; otherwise the CLI prints the same message once.
29
+
- Successful dry runs exit 0 for scripting ease; malformed input or unknown commands still return non-zero.
30
+
31
+
## 🧭 Upgrade Notes
32
+
33
+
- No trailer changes or schema updates
34
+
- Existing automation keeps working.
35
+
- New dry-run behavior is documented in `docs/features/run.md` and the command reference so teams can adopt it immediately.
36
+
- Tests covering both the preview path and the standard execution flow run in the Dockerized Bats matrix.
37
+
38
+
## 🚦Please, Enjoy
39
+
40
+
Why are you still reading this when you could be downloading `v0.2.1`?!
41
+
42
+
When you want confidence before the real maneuver: **Shiplog** now lets you practice the tack ⛵️ before committing it to the log.
0 commit comments