opencode-jobs 0.2.0 → 1.1.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 +35 -20
- package/dist/cli.js +1055 -75
- package/dist/index.d.ts +1 -1
- package/dist/index.js +274 -137
- package/dist/install.d.ts +3 -0
- package/dist/management.d.ts +9 -0
- package/dist/migration.d.ts +9 -0
- package/dist/paths.d.ts +1 -1
- package/dist/registry.d.ts +1 -0
- package/dist/systemd.d.ts +1 -1
- 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
|
|
@@ -79,11 +79,16 @@ opencode-jobs uninstall --purge
|
|
|
79
79
|
```text
|
|
80
80
|
opencode-jobs install [projectDir]
|
|
81
81
|
opencode-jobs uninstall [projectDir] [--purge]
|
|
82
|
+
opencode-jobs list [projectDir]
|
|
83
|
+
opencode-jobs enable [projectDir]
|
|
84
|
+
opencode-jobs disable [projectDir]
|
|
85
|
+
opencode-jobs run <slug> [projectDir]
|
|
82
86
|
```
|
|
83
87
|
|
|
84
88
|
The CLI is installed as the `opencode-jobs` npm executable. `projectDir`
|
|
85
|
-
defaults to the current directory.
|
|
86
|
-
|
|
89
|
+
defaults to the current directory. The management commands mirror the plugin's
|
|
90
|
+
list, project enable/disable, and immediate-run operations. All commands print
|
|
91
|
+
JSON results so they can also be used from setup scripts and CI.
|
|
87
92
|
|
|
88
93
|
## Tools
|
|
89
94
|
|
|
@@ -101,7 +106,7 @@ can also be used from setup scripts and CI.
|
|
|
101
106
|
|
|
102
107
|
## Job definitions
|
|
103
108
|
|
|
104
|
-
Jobs live in your repo at `.opencode/
|
|
109
|
+
Jobs live in your repo at `.opencode/jobs/<slug>.json` — review
|
|
105
110
|
them in PRs like any other code:
|
|
106
111
|
|
|
107
112
|
```json
|
|
@@ -179,9 +184,9 @@ Each run:
|
|
|
179
184
|
|
|
180
185
|
If the safety commit fails, the worktree is kept on disk rather than
|
|
181
186
|
discarded. The default base is
|
|
182
|
-
`~/.local/state/opencode/
|
|
187
|
+
`~/.local/state/opencode/jobs/worktrees/<scopeId>/<slug>` (respecting
|
|
183
188
|
`XDG_STATE_HOME`); override with `base` (relative paths resolve against the
|
|
184
|
-
project directory, and the base should be dedicated to
|
|
189
|
+
project directory, and the base should be dedicated to job worktrees).
|
|
185
190
|
Worktree jobs require `git` and a git repository — a missing repo fails the
|
|
186
191
|
run with a clear record. Branches accumulate per run by design; merge or
|
|
187
192
|
delete them when you no longer need the work.
|
|
@@ -204,29 +209,39 @@ delete them when you no longer need the work.
|
|
|
204
209
|
|
|
205
210
|
## Storage
|
|
206
211
|
|
|
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}`
|
|
212
|
+
| What | Where |
|
|
213
|
+
| ------------------- | ----------------------------------------------------------------------------- |
|
|
214
|
+
| Job definitions | `<project>/.opencode/jobs/<slug>.json` (git-committed) |
|
|
215
|
+
| Run scripts | `~/.config/opencode/jobs/scopes/<scopeId>/run-<slug>.sh` |
|
|
216
|
+
| Run history (JSONL) | `~/.config/opencode/jobs/runs/<scopeId>/<slug>.jsonl` |
|
|
217
|
+
| Session state | `~/.config/opencode/jobs/sessions/<scopeId>/<slug>.txt` |
|
|
218
|
+
| Run locks | `~/.config/opencode/jobs/locks/<scopeId>/<slug>.lock` (worktree jobs) |
|
|
219
|
+
| Job worktrees | `~/.local/state/opencode/jobs/worktrees/<scopeId>/<slug>` (removed after run) |
|
|
220
|
+
| Job logs | `~/.config/opencode/logs/jobs/<scopeId>/<slug>.log` |
|
|
221
|
+
| Project registry | `~/.config/opencode/jobs/registry.json` |
|
|
222
|
+
| systemd units | `~/.config/systemd/user/opencode-sched-<scope>-<slug>.{service,timer}` |
|
|
218
223
|
|
|
219
224
|
`scopeId` is a stable hash of the project path, so multiple projects can
|
|
220
225
|
define jobs without colliding. Because it is path-derived, moving or renaming
|
|
221
226
|
a project directory orphans its units, history, and registry entry — run
|
|
222
227
|
`opencode-jobs uninstall --purge` from the old path before moving, or clean
|
|
223
|
-
up `~/.config/opencode/
|
|
228
|
+
up `~/.config/opencode/jobs/` (and the unit files) manually afterwards.
|
|
229
|
+
|
|
230
|
+
### Upgrading storage
|
|
231
|
+
|
|
232
|
+
When the plugin or CLI first runs after an upgrade, it moves legacy 0.1.x
|
|
233
|
+
definitions and state to the paths above, preserving the registry, run history,
|
|
234
|
+
session state, logs, locks, and worktrees. Enabled projects are re-synced so
|
|
235
|
+
their existing systemd units use the new paths. Migration is idempotent and
|
|
236
|
+
refuses to overwrite a new path when both old and new data exist; reconcile or
|
|
237
|
+
back up one side and retry.
|
|
224
238
|
|
|
225
239
|
## Configuration
|
|
226
240
|
|
|
227
|
-
- `
|
|
241
|
+
- `OPENCODE_JOBS_OPENCODE_PATH` — absolute path to the `opencode`
|
|
228
242
|
binary the run scripts invoke (default: resolved from `PATH`, then
|
|
229
243
|
`~/.opencode/bin/opencode`, then common install locations).
|
|
244
|
+
`OPENCODE_SCHEDULER_OPENCODE_PATH` remains accepted for 0.1.x compatibility.
|
|
230
245
|
|
|
231
246
|
## Requirements
|
|
232
247
|
|