opencode-jobs 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -18
- package/dist/cli.js +795 -65
- package/dist/index.d.ts +1 -1
- package/dist/index.js +151 -60
- package/dist/install.d.ts +3 -0
- package/dist/migration.d.ts +9 -0
- package/dist/paths.d.ts +1 -1
- package/dist/registry.d.ts +1 -0
- package/dist/tools.d.ts +1 -1
- package/package.json +1 -1
- package/skill/opencode-jobs/SKILL.md +4 -4
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ and reports the manual change required.
|
|
|
36
36
|
|
|
37
37
|
Job files are committed agent prompts that run on your machine on a
|
|
38
38
|
schedule — only install and enable projects whose
|
|
39
|
-
`.opencode/
|
|
39
|
+
`.opencode/jobs/` you trust, the same care you would take before
|
|
40
40
|
running an unfamiliar repository's build.
|
|
41
41
|
|
|
42
42
|
Alternatively, add the package manually to the project root `opencode.json`
|
|
@@ -67,7 +67,7 @@ the uninstaller cannot rewrite safely is left untouched with a non-zero
|
|
|
67
67
|
exit. Job definitions, run history, session state, and logs are kept.
|
|
68
68
|
|
|
69
69
|
Add `--purge` to also delete the project's job definitions
|
|
70
|
-
(`.opencode/
|
|
70
|
+
(`.opencode/jobs/`) and its job data (run scripts, run history,
|
|
71
71
|
session state, run locks, worktrees, and logs):
|
|
72
72
|
|
|
73
73
|
```sh
|
|
@@ -101,7 +101,7 @@ can also be used from setup scripts and CI.
|
|
|
101
101
|
|
|
102
102
|
## Job definitions
|
|
103
103
|
|
|
104
|
-
Jobs live in your repo at `.opencode/
|
|
104
|
+
Jobs live in your repo at `.opencode/jobs/<slug>.json` — review
|
|
105
105
|
them in PRs like any other code:
|
|
106
106
|
|
|
107
107
|
```json
|
|
@@ -179,9 +179,9 @@ Each run:
|
|
|
179
179
|
|
|
180
180
|
If the safety commit fails, the worktree is kept on disk rather than
|
|
181
181
|
discarded. The default base is
|
|
182
|
-
`~/.local/state/opencode/
|
|
182
|
+
`~/.local/state/opencode/jobs/worktrees/<scopeId>/<slug>` (respecting
|
|
183
183
|
`XDG_STATE_HOME`); override with `base` (relative paths resolve against the
|
|
184
|
-
project directory, and the base should be dedicated to
|
|
184
|
+
project directory, and the base should be dedicated to job worktrees).
|
|
185
185
|
Worktree jobs require `git` and a git repository — a missing repo fails the
|
|
186
186
|
run with a clear record. Branches accumulate per run by design; merge or
|
|
187
187
|
delete them when you no longer need the work.
|
|
@@ -204,29 +204,39 @@ delete them when you no longer need the work.
|
|
|
204
204
|
|
|
205
205
|
## Storage
|
|
206
206
|
|
|
207
|
-
| What | Where
|
|
208
|
-
| ------------------- |
|
|
209
|
-
| Job definitions | `<project>/.opencode/
|
|
210
|
-
| Run scripts | `~/.config/opencode/
|
|
211
|
-
| Run history (JSONL) | `~/.config/opencode/
|
|
212
|
-
| Session state | `~/.config/opencode/
|
|
213
|
-
| Run locks | `~/.config/opencode/
|
|
214
|
-
| Job worktrees | `~/.local/state/opencode/
|
|
215
|
-
| Job logs | `~/.config/opencode/logs/
|
|
216
|
-
| Project registry | `~/.config/opencode/
|
|
217
|
-
| systemd units | `~/.config/systemd/user/opencode-sched-<scope>-<slug>.{service,timer}`
|
|
207
|
+
| What | Where |
|
|
208
|
+
| ------------------- | ----------------------------------------------------------------------------- |
|
|
209
|
+
| Job definitions | `<project>/.opencode/jobs/<slug>.json` (git-committed) |
|
|
210
|
+
| Run scripts | `~/.config/opencode/jobs/scopes/<scopeId>/run-<slug>.sh` |
|
|
211
|
+
| Run history (JSONL) | `~/.config/opencode/jobs/runs/<scopeId>/<slug>.jsonl` |
|
|
212
|
+
| Session state | `~/.config/opencode/jobs/sessions/<scopeId>/<slug>.txt` |
|
|
213
|
+
| Run locks | `~/.config/opencode/jobs/locks/<scopeId>/<slug>.lock` (worktree jobs) |
|
|
214
|
+
| Job worktrees | `~/.local/state/opencode/jobs/worktrees/<scopeId>/<slug>` (removed after run) |
|
|
215
|
+
| Job logs | `~/.config/opencode/logs/jobs/<scopeId>/<slug>.log` |
|
|
216
|
+
| Project registry | `~/.config/opencode/jobs/registry.json` |
|
|
217
|
+
| systemd units | `~/.config/systemd/user/opencode-sched-<scope>-<slug>.{service,timer}` |
|
|
218
218
|
|
|
219
219
|
`scopeId` is a stable hash of the project path, so multiple projects can
|
|
220
220
|
define jobs without colliding. Because it is path-derived, moving or renaming
|
|
221
221
|
a project directory orphans its units, history, and registry entry — run
|
|
222
222
|
`opencode-jobs uninstall --purge` from the old path before moving, or clean
|
|
223
|
-
up `~/.config/opencode/
|
|
223
|
+
up `~/.config/opencode/jobs/` (and the unit files) manually afterwards.
|
|
224
|
+
|
|
225
|
+
### Upgrading storage
|
|
226
|
+
|
|
227
|
+
When the plugin or CLI first runs after an upgrade, it moves legacy 0.1.x
|
|
228
|
+
definitions and state to the paths above, preserving the registry, run history,
|
|
229
|
+
session state, logs, locks, and worktrees. Enabled projects are re-synced so
|
|
230
|
+
their existing systemd units use the new paths. Migration is idempotent and
|
|
231
|
+
refuses to overwrite a new path when both old and new data exist; reconcile or
|
|
232
|
+
back up one side and retry.
|
|
224
233
|
|
|
225
234
|
## Configuration
|
|
226
235
|
|
|
227
|
-
- `
|
|
236
|
+
- `OPENCODE_JOBS_OPENCODE_PATH` — absolute path to the `opencode`
|
|
228
237
|
binary the run scripts invoke (default: resolved from `PATH`, then
|
|
229
238
|
`~/.opencode/bin/opencode`, then common install locations).
|
|
239
|
+
`OPENCODE_SCHEDULER_OPENCODE_PATH` remains accepted for 0.1.x compatibility.
|
|
230
240
|
|
|
231
241
|
## Requirements
|
|
232
242
|
|