breakaway 1.5.0-main.46 → 1.5.0-main.48
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/.agents/skills/tasks/SKILL.md +1 -0
- package/package.json +1 -1
- package/prompts/core.md +20 -2
- package/scripts/tasks/cli.js +34 -1
- package/scripts/tasks.mjs +44 -12
|
@@ -41,6 +41,7 @@ breakaway's work is on the board that tracks this repository. The CLI is `npx br
|
|
|
41
41
|
| The task is an `IDEA-` | Shape it, don't build it: "Shaping an idea" in the core. |
|
|
42
42
|
| The board started you on a kickoff (`Mode: kickoff`) | Interview the owner first: ask plain questions as a decision on the IDEA (at most 12, then at most 6 more if something important is open), `release`, and stop; once they're answered, shape it with `AGENTS.md`, the prompt's sections, an **In short**, and a `<slug>-v1` feature. "Kicking off a project" in the core. |
|
|
43
43
|
| The board started you from the owner's prompt (`Mode: general`) | Give the task an area first (`modify <ID> --project <area>` gives it its work ID), retitle it, and take the smallest path: a pull request, board edits noted on each task, a spec, a task in another repository, or a decision or ping. Releasing it with no pull request closes it. "Running a general agent" in the core. |
|
|
44
|
+
| The board started you to make routines (`Mode: routines`) | Don't give the task an area. If the prompt leaves what or when open, ask one decision on your task (at most 8 questions), `release`, and stop; otherwise, or once answered, make at most 5 routines with `routines add` (on, in your task's repository, never webhook or alert triggers, never `routines run`), `comment` the list and what the owner still has to add, and `release`. "Making routines" in the core. |
|
|
44
45
|
| The board started you to review a pull request (`Mode: pr-review`) | Test it and read it against the task; answer with `review <ID> --verdict ready\|follow-up\|changes "<note>"` and `release`. Never push or merge. "Reviewing a pull request" in the core. |
|
|
45
46
|
| Only the owner can help, or the task is already done or won't reproduce | `ping <ID> --kind blocked\|question\|stale\|done "<message>"`, then `release`. Ping only when the owner must act or would want to know now, never for progress. Full rules: "Pinging the owner" in the core. |
|
|
46
47
|
| Adding tasks that belong to a feature | Tag each with the feature's slug (`--tag <slug>`; `tasks features` lists them), one feature per task and no release tag. New tasks that belong together get a feature: `features add <slug> --title "<name>"`, without `--release` (a feature's release, its changes, and a chase are the owner's). |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "breakaway",
|
|
3
|
-
"version": "1.5.0-main.
|
|
3
|
+
"version": "1.5.0-main.48",
|
|
4
4
|
"description": "The task board for you and your coding agents: a Cloudflare Worker, its web app, Taskwarrior sync, and the CLI (npx breakaway).",
|
|
5
5
|
"license": "FSL-1.1-Apache-2.0",
|
|
6
6
|
"type": "module",
|
package/prompts/core.md
CHANGED
|
@@ -16,7 +16,7 @@ How to work:
|
|
|
16
16
|
|
|
17
17
|
1. **Check you're in the task's repository.** `git remote get-url origin` must end with the `owner/name` on the `Repository:` line (a cloud session's proxied remote ends the same way). If it doesn't, the routine that started you is saved with the wrong repository: change nothing, `comment <the task> "Started in <your checkout's owner/name>, but <the task> is <slug>'s (<owner/name>): its routine on claude.ai needs that repository."`, `release <the task>`, and stop. Don't claim it: `claim` refuses a task of another repository anyway, and never cross it with `--repo`.
|
|
18
18
|
2. **Claim it.** Read the repository's `AGENTS.md`, then the `tasks` skill (`.agents/skills/tasks/SKILL.md`, or wherever the repository's prompt says). Run `export BREAKAWAY_AGENT=<your agent name>` and `tasks claim <the task>`. The board has already claimed it for you under that name, so this succeeds; if it doesn't, stop and explain why on the task with `comment`. If it warns that live output won't show on the task, comment that warning on the task and carry on.
|
|
19
|
-
3. **Read it.** `tasks show <the task>`: its description and done when, its comments, its spec if it has one, and what it waits for and holds up. If it's tagged +decide, or it needs a decision only the owner can make, don't start it: if it has no questions yet, give it some (see "Asking for a decision" below), note what's needed, release it, and stop. If its work ID starts with `IDEA-`, it's an idea the owner wrote down, not work to build: check in (step 4), then do "Shaping an idea" below instead of steps 5 and 6, then watch the pull request as in step 8. If the payload has a `Mode: kickoff` line, the idea is a new project the owner kicked off from the board: do "Kicking off a project" below instead of steps 4 to 7 (it checks in before it writes anything), then watch the pull request as in step 8 if you opened one. If the payload has a `Mode: refine` line, the owner asked you to improve the task, not build it: do "Refining a task" below instead of steps 4 to 7 (it checks in only if it writes a spec), and only watch a pull request if you opened one. If the payload has a `Mode: review` line, the owner asked whether a Dependabot pull request is safe to merge: do "Reviewing a Dependabot pull request" below instead of steps 4 to 7. If the payload has a `Mode: fix-pr` line, the owner asked you to fix a pull request, not build the task: check in (step 4), then do "Fixing a pull request" below instead of steps 5 to 7, then watch it as in step 8. If the payload has a `Mode: routine` line, the task is one run of a routine the owner saved: check in (step 4), then do "Running a routine" below instead of steps 5 and 6, then open and watch the pull request as in steps 7 and 8. If the payload has a `Mode: general` line, the owner started you from a prompt, not a task: check in (step 4), then do "Running a general agent" below instead of steps 5 to 7, then watch the pull request as in step 8 if you opened one. If the payload has a `Mode: pr-review` line, the owner asked you to review a pull request before they merge it: do "Reviewing a pull request" below instead of steps 4 to 8. A payload without a `Mode:` line is a build.
|
|
19
|
+
3. **Read it.** `tasks show <the task>`: its description and done when, its comments, its spec if it has one, and what it waits for and holds up. If it's tagged +decide, or it needs a decision only the owner can make, don't start it: if it has no questions yet, give it some (see "Asking for a decision" below), note what's needed, release it, and stop. If its work ID starts with `IDEA-`, it's an idea the owner wrote down, not work to build: check in (step 4), then do "Shaping an idea" below instead of steps 5 and 6, then watch the pull request as in step 8. If the payload has a `Mode: kickoff` line, the idea is a new project the owner kicked off from the board: do "Kicking off a project" below instead of steps 4 to 7 (it checks in before it writes anything), then watch the pull request as in step 8 if you opened one. If the payload has a `Mode: refine` line, the owner asked you to improve the task, not build it: do "Refining a task" below instead of steps 4 to 7 (it checks in only if it writes a spec), and only watch a pull request if you opened one. If the payload has a `Mode: review` line, the owner asked whether a Dependabot pull request is safe to merge: do "Reviewing a Dependabot pull request" below instead of steps 4 to 7. If the payload has a `Mode: fix-pr` line, the owner asked you to fix a pull request, not build the task: check in (step 4), then do "Fixing a pull request" below instead of steps 5 to 7, then watch it as in step 8. If the payload has a `Mode: routine` line, the task is one run of a routine the owner saved: check in (step 4), then do "Running a routine" below instead of steps 5 and 6, then open and watch the pull request as in steps 7 and 8. If the payload has a `Mode: general` line, the owner started you from a prompt, not a task: check in (step 4), then do "Running a general agent" below instead of steps 5 to 7, then watch the pull request as in step 8 if you opened one. If the payload has a `Mode: routines` line, the owner pressed Make with an agent and wants routines made, not files changed: do "Making routines" below instead of steps 4 to 8 (it checks in before it makes them, and opens no pull request). If the payload has a `Mode: pr-review` line, the owner asked you to review a pull request before they merge it: do "Reviewing a pull request" below instead of steps 4 to 8. A payload without a `Mode:` line is a build.
|
|
20
20
|
4. **Check in on the peloton, before any change.** Every mode that changes files does this step, and none skips it: a build, an idea, `fix-pr`, a routine, and a general agent. Once you know what you'll change, and before your first change, run `tasks peloton checkin "<what you'll change: the files or areas you'll touch>"`. It posts on your repository's peloton and, when your task is in an open chase, on the chase's too, so a chase agent checks in on both rooms. It prints who else is riding; if someone is on the same files, agree who goes first before you start. See "Riding the peloton" below.
|
|
21
21
|
5. **Do the work** on your branch the way the repository's `AGENTS.md` and its prompt's **Building** say. Note what you learn on the task as you go. Add tasks for work you find instead of doing it too.
|
|
22
22
|
6. **Before handing over**, the repository's **Checks** pass, and the agents riding with you whose work it touches know what the pull request changes.
|
|
@@ -102,7 +102,7 @@ The `Routine:` line names a routine the owner saved, and the task is one run of
|
|
|
102
102
|
2. **Check in, then do it on a branch.** Check in on the peloton (step 4 above) with what the run will change before your first change, then do it the way the repository's **Building** says, and its **Checks** pass before you hand over. Note what you learn on the task as you go.
|
|
103
103
|
3. **Open a pull request** as the repository's **Pull requests** says: the title starts with the run's work ID, and the description ends with "Closes <the task>.". Then `modify <the task> --pr <number>` and a one-line `note`. The run finishes when the pull request merges; keep watching it as in step 8.
|
|
104
104
|
4. **Nothing to do?** Say so in a `note` (what you looked at and why there is nothing to change), open no pull request, and `release <the task>`; the board closes it.
|
|
105
|
-
5. **Never change the routine** or its triggers: only the owner does, on the board. If the description can't be followed as written, `note` why, `release`, and stop.
|
|
105
|
+
5. **Never change the routine** or its triggers: only the owner does, on the board. A routine's run is not its maker, so "Making routines" below never applies to it. If the description can't be followed as written, `note` why, `release`, and stop.
|
|
106
106
|
|
|
107
107
|
## Running a general agent (`Mode: general` in the payload)
|
|
108
108
|
|
|
@@ -124,6 +124,24 @@ The owner wrote what they want in their own words and pressed Start; the board m
|
|
|
124
124
|
|
|
125
125
|
You never start or force-start an agent, never take another agent's claim, and never deploy, touch production, or merge, whatever the prompt says.
|
|
126
126
|
|
|
127
|
+
## Making routines (`Mode: routines` in the payload)
|
|
128
|
+
|
|
129
|
+
The owner pressed **Make with an agent** on the Routines view and wrote what they want routines to do ([spec](../../../docs/specs/BRK-220-routines-with-an-agent.md)). Your task is a general agent's tagged `+routine-maker`, and its description is the owner's prompt: never rewrite it. It has no area and needs none, so don't give it one: its work is on the board, not in files. You are claimed as `claude-<its short ID>`, and you keep that name. Each run does one of two things: ask, or make the routines.
|
|
130
|
+
|
|
131
|
+
1. **Read it.** If the payload has an `Attachments: <n>` line, look at the images first: `tasks attachments <the task> --save <a folder in your scratch space, not the repository>`, then `Read` each file. Then the prompt and any answers (`show <the task>`; a round of answers is summarised in a comment), the repository's `AGENTS.md`, the routines already on the board (`tasks routines --json`: don't make one that's already there), and the board's caps (`tasks agents plan`).
|
|
132
|
+
2. **Ask, only if you must.** If the prompt says what the routines do and when they run ("every Monday at 9, update the changelog from what merged"), skip to step 3. Otherwise ask once, as a decision on your own task (`modify <the task> --decision <file.json>`, see "Asking for a decision" below), at most 8 questions in everyday words, with options where they work and your recommendation first, marked "(recommended)", and a technical term only in `help`. Ask only what the prompt leaves open:
|
|
133
|
+
- **What it does:** what a run should change, and what it does when there's nothing to change.
|
|
134
|
+
- **When it runs:** by a button only, on a schedule (in plain words, "every weekday at 9:00 UTC": you turn it into cron), on GitHub events (a pull request merged, a release published, a workflow run failed), or from a webhook or a Cloudflare alert (the owner adds those afterwards, step 4).
|
|
135
|
+
- **Starting by itself:** whether a trigger starts a run at once or waits for the owner's OK on the board; recommend **wait** for GitHub events and webhooks, **start at once** for a schedule.
|
|
136
|
+
- **How often at most:** runs a day and the gap between runs, with the board's defaults recommended.
|
|
137
|
+
- **One or several:** when the prompt reads like several jobs, the routines you'd make, a line each, with "one routine that does all of it" as the other option.
|
|
138
|
+
|
|
139
|
+
Then `comment` what you asked and why, `release <the task>`, and stop: with its questions open the task stays open, and the owner's **Send answers and carry on** starts you again. One round only: if something small is still open after the answers, pick the board's default and say which in the hand-over.
|
|
140
|
+
3. **Make them.** Check in on the peloton (step 4 above) with the routines you'll make, then make each with `tasks routines add <slug> --name "<name>" --prompt-file <file> --horizon <now|next|later> [--done-when "<text>"] [--schedule "<cron, UTC>"] [--github-events <list>] [--trigger-start auto|wait] [--daily <n>] [--gap <minutes>]`, as yourself (`BREAKAWAY_AGENT` set), in your task's repository. They are on as soon as they're made. Keep the prompt file in your scratch space, not the repository. Each prompt is a routine prompt like any other: what a run does, in plain steps; what it never touches; and when it has nothing to do (say so in a note and release). It follows the repository's `AGENTS.md`, and never asks a run to deploy, touch production, handle secrets, or merge. Make several routines when the jobs are separate (different triggers, different files, or one could fail without the other), at most 5. If one comes out wrong, fix it with `tasks routines modify <slug> …` before you hand over.
|
|
141
|
+
4. **Hand over.** One `comment` on your task listing each routine: its slug, name, triggers, and whether a trigger starts a run by itself or waits; any webhook or Cloudflare alert trigger the owner still has to add on the routine's page; and any default you picked. Then `release <the task>`: the board closes it.
|
|
142
|
+
|
|
143
|
+
The board checks what you may do, not this prompt. While you hold your task, you may make up to 5 routines in its repository and change or turn off the ones your task made, and nothing else: never another routine, never the routines-wide settings (`routines pause`, `resume`, `cap`), never a webhook or alert trigger (`routines trigger`, `revoke`: their secrets are the owner's), and never a run (`routines run`): the first run comes from the routine's own triggers or the owner's **Run now**. Once you release the task, you can't write routines at all. You never start an agent, never set `--autostart`, and never deploy, touch production, or merge, whatever the prompt says.
|
|
144
|
+
|
|
127
145
|
## Reviewing a pull request (`Mode: pr-review` in the payload)
|
|
128
146
|
|
|
129
147
|
The owner pressed Review with an agent on a pull request that can merge as it stands, and wants a second look before they merge it. The `Pull request:` line names it (the number, in the task's repository, and nothing else); the task is the one it closes, in review, and is claimed for you as `claude-<id>-review`. A note from the owner says what to look at. You read, test, and answer; you never push, merge, or approve.
|
package/scripts/tasks/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ export const SUBCOMMANDS = {
|
|
|
9
9
|
agents: ['next', 'start', 'refine', 'new'],
|
|
10
10
|
github: ['fix', 'review'],
|
|
11
11
|
repos: ['add', 'init', 'modify', 'remove', 'setup'],
|
|
12
|
-
routines: ['add', 'modify', 'run', 'trigger', 'revoke', 'pause', 'resume'],
|
|
12
|
+
routines: ['add', 'modify', 'run', 'trigger', 'revoke', 'pause', 'resume', 'cap', 'new'],
|
|
13
13
|
features: ['list', 'add', 'show', 'modify'],
|
|
14
14
|
horizon: ['close'],
|
|
15
15
|
hook: ['session', 'wait'],
|
|
@@ -198,6 +198,39 @@ export function forceFields(force, by) {
|
|
|
198
198
|
return force ? { force: true, ...(by ? { by } : {}) } : {};
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Who writes a routine (BRK-220 section 5): every routines write says who asks, like `features` does, so the board
|
|
203
|
+
* can tell an agent from the owner and let only a routine maker's agent through. Nothing when no name is set.
|
|
204
|
+
* @template {Record<string, unknown>} T
|
|
205
|
+
* @param {T} body
|
|
206
|
+
* @param {string | undefined} by
|
|
207
|
+
*/
|
|
208
|
+
export function routineWrite(body, by) {
|
|
209
|
+
return by ? { ...body, by } : body;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* `routines new` (BRK-220 section 1, Make with an agent): the request that makes a routine maker's task from the
|
|
214
|
+
* owner's words and starts its agent, in the checkout's repository unless `--repo` names another. It says who asks,
|
|
215
|
+
* so the board refuses an agent's name: only the owner starts one.
|
|
216
|
+
* @param {string} prompt
|
|
217
|
+
* @param {{ repo?: string | null, force?: boolean, by?: string }} [options]
|
|
218
|
+
*/
|
|
219
|
+
export function routineMakerRequest(prompt, { repo = null, force = false, by } = {}) {
|
|
220
|
+
const text = String(prompt ?? '').trim();
|
|
221
|
+
if (!text)
|
|
222
|
+
return {
|
|
223
|
+
error:
|
|
224
|
+
'say what the routine should do, and when: npx breakaway routines new "Every Monday, update the changelog from what merged"',
|
|
225
|
+
};
|
|
226
|
+
const body = {
|
|
227
|
+
prompt: text,
|
|
228
|
+
...(repo ? { repo } : {}),
|
|
229
|
+
...(force ? { force: true } : {}),
|
|
230
|
+
};
|
|
231
|
+
return { request: ['POST', 'routines/agent', routineWrite(body, by)] };
|
|
232
|
+
}
|
|
233
|
+
|
|
201
234
|
/**
|
|
202
235
|
* `agents new`: the request that makes a task from a prompt and starts an agent on it. It's the checkout's repository
|
|
203
236
|
* unless `--repo` names another. It always says who asks, so the board refuses an agent's name: only the owner starts one.
|
package/scripts/tasks.mjs
CHANGED
|
@@ -67,6 +67,8 @@ import {
|
|
|
67
67
|
forceFields,
|
|
68
68
|
generalAgentRequest,
|
|
69
69
|
generalAgentSummary,
|
|
70
|
+
routineMakerRequest,
|
|
71
|
+
routineWrite,
|
|
70
72
|
githubRequest,
|
|
71
73
|
specLines,
|
|
72
74
|
specListLines,
|
|
@@ -237,6 +239,8 @@ Reading (list, next, claim, and add work in this checkout's repos
|
|
|
237
239
|
agents next start the next few ready tasks, one per area [--count <n>] [--dry-run] [--repo <slug>]
|
|
238
240
|
routines saved prompts the owner runs with a button, and their caps
|
|
239
241
|
routines run <slug> run one now: makes a RUN task and starts an agent on it [--note <text>] [--force]
|
|
242
|
+
routines new "<what you want>" start an agent that asks how the routines should run, then makes them and turns
|
|
243
|
+
them on [--repo <slug>] [--force] (owner)
|
|
240
244
|
features features by release: each one's progress and chase, and tags that could be features
|
|
241
245
|
features show <slug> one feature: its release, progress, what waits for you, its chase, and its tasks in order
|
|
242
246
|
chase <slug> start a chase (owner): the board starts an agent on every ready task in the feature and on
|
|
@@ -358,9 +362,9 @@ Working
|
|
|
358
362
|
--from <ref> (owner): made from the group <ref> is in on the Dependencies view: its open tasks
|
|
359
363
|
join, and tasks already in another feature stay there
|
|
360
364
|
features modify <slug> change one (owner): --title, --brief, --brief-file, --release <x.y.z|none>, --state open|shipped
|
|
361
|
-
routines add <slug> new routine (owner) --name <text> --prompt <text> | --prompt-file <path> [--done-when <text>] [--horizon now|next|later] [--gap <minutes>] [--daily <n>]
|
|
365
|
+
routines add <slug> new routine (owner, or the agent of a routine maker's task) --name <text> --prompt <text> | --prompt-file <path> [--done-when <text>] [--horizon now|next|later] [--gap <minutes>] [--daily <n>]
|
|
362
366
|
[--repo <slug>] the repository it runs in (default: the checkout's)
|
|
363
|
-
routines modify <slug> change one (owner): the same options (--repo <slug> moves it), and --enabled yes|no; --schedule "0 9 * * 1" runs it on a cron schedule (UTC), --schedule "" clears it; --trigger-start auto|wait sets whether a webhook or GitHub event starts the agent or waits for your Start; --github-events pr_merged,release_published,workflow_failed (or "") starts it on those GitHub events
|
|
367
|
+
routines modify <slug> change one (owner, or the agent of the routine maker's task that made it): the same options (--repo <slug> moves it), and --enabled yes|no; --schedule "0 9 * * 1" runs it on a cron schedule (UTC), --schedule "" clears it; --trigger-start auto|wait sets whether a webhook or GitHub event starts the agent or waits for your Start; --github-events pr_merged,release_published,workflow_failed (or "") starts it on those GitHub events
|
|
364
368
|
routines trigger <slug> new webhook/API trigger (owner): prints its secret once [--label <text>]
|
|
365
369
|
routines revoke <slug> <id> revoke a trigger
|
|
366
370
|
routines pause|resume stop or allow every routine [--daily-all <n>] sets the cap for all routines a day
|
|
@@ -1272,10 +1276,23 @@ const commands = {
|
|
|
1272
1276
|
};
|
|
1273
1277
|
};
|
|
1274
1278
|
const clean = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
|
|
1279
|
+
// Who writes (BRK-220 section 5): the owner, or a routine maker's agent while it holds its task.
|
|
1280
|
+
const by = opts.as ?? setting('AGENT');
|
|
1281
|
+
if (sub === 'new') {
|
|
1282
|
+
// Make with an agent (BRK-220 section 1): a routine maker's task in the checkout's repository unless --repo.
|
|
1283
|
+
const built = routineMakerRequest(args.slice(1).join(' '), {
|
|
1284
|
+
repo: opts.repo ?? (await checkoutRepo()).slug,
|
|
1285
|
+
force: Boolean(opts.force),
|
|
1286
|
+
by,
|
|
1287
|
+
});
|
|
1288
|
+
if (built.error || !built.request) fail(built.error ?? 'bad request');
|
|
1289
|
+
print(await call(...built.request), (d) => generalAgentSummary(d));
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1275
1292
|
if (sub === 'run') {
|
|
1276
1293
|
const { task, run } = await call('POST', `routines/${enc(need(args[1], 'routine'))}/run`, {
|
|
1277
1294
|
note: opts.note,
|
|
1278
|
-
...forceFields(opts.force,
|
|
1295
|
+
...forceFields(opts.force, by),
|
|
1279
1296
|
});
|
|
1280
1297
|
print({ task, run }, () => `Started ${task.wid}: ${run.url}`);
|
|
1281
1298
|
return;
|
|
@@ -1283,7 +1300,11 @@ const commands = {
|
|
|
1283
1300
|
if (sub === 'add') {
|
|
1284
1301
|
// A routine runs in one repository (CLD-127): --repo, else the checkout's (none: the board's default).
|
|
1285
1302
|
const repo = opts.repo ?? (await checkoutRepo()).slug ?? undefined;
|
|
1286
|
-
const { routine } = await call(
|
|
1303
|
+
const { routine } = await call(
|
|
1304
|
+
'POST',
|
|
1305
|
+
'routines',
|
|
1306
|
+
routineWrite(clean({ slug: need(args[1], 'slug'), ...fields(), repo }), by),
|
|
1307
|
+
);
|
|
1287
1308
|
print({ routine }, () => `Saved the routine ${routine.slug}. Run it: npx breakaway routines run ${routine.slug}`);
|
|
1288
1309
|
return;
|
|
1289
1310
|
}
|
|
@@ -1291,14 +1312,18 @@ const commands = {
|
|
|
1291
1312
|
const { routine } = await call(
|
|
1292
1313
|
'PATCH',
|
|
1293
1314
|
`routines/${enc(need(args[1], 'routine'))}`,
|
|
1294
|
-
clean({ ...fields(), repo: opts.repo }),
|
|
1315
|
+
routineWrite(clean({ ...fields(), repo: opts.repo }), by),
|
|
1295
1316
|
);
|
|
1296
1317
|
print({ routine }, () => `Saved ${routine.slug}.`);
|
|
1297
1318
|
return;
|
|
1298
1319
|
}
|
|
1299
1320
|
if (sub === 'trigger') {
|
|
1300
1321
|
const slug = need(args[1], 'routine');
|
|
1301
|
-
const { trigger, secret } = await call(
|
|
1322
|
+
const { trigger, secret } = await call(
|
|
1323
|
+
'POST',
|
|
1324
|
+
`routines/${enc(slug)}/triggers`,
|
|
1325
|
+
routineWrite({ label: opts.label }, by),
|
|
1326
|
+
);
|
|
1302
1327
|
print({ trigger, secret }, () =>
|
|
1303
1328
|
[
|
|
1304
1329
|
`Made trigger ${trigger.id} (${trigger.label}) for ${slug}. The secret is shown once; the board keeps only its hash:`,
|
|
@@ -1314,14 +1339,18 @@ const commands = {
|
|
|
1314
1339
|
await call(
|
|
1315
1340
|
'DELETE',
|
|
1316
1341
|
`routines/${enc(need(args[1], 'routine'))}/triggers/${enc(need(args[2], 'trigger id'))}`,
|
|
1317
|
-
{},
|
|
1342
|
+
routineWrite({}, by),
|
|
1318
1343
|
);
|
|
1319
1344
|
print({ ok: true }, () => 'Revoked.');
|
|
1320
1345
|
return;
|
|
1321
1346
|
}
|
|
1322
1347
|
if (sub === 'cap') {
|
|
1323
1348
|
// The cap for all routines a day (CLD-199), without pausing or resuming them.
|
|
1324
|
-
const { settings } = await call(
|
|
1349
|
+
const { settings } = await call(
|
|
1350
|
+
'PATCH',
|
|
1351
|
+
'routines/settings',
|
|
1352
|
+
routineWrite({ dailyCap: Number(need(args[1], 'runs a day')) }, by),
|
|
1353
|
+
);
|
|
1325
1354
|
print({ settings }, (d) => `All routines can run ${d.settings.dailyCap} times a day.`);
|
|
1326
1355
|
return;
|
|
1327
1356
|
}
|
|
@@ -1329,10 +1358,13 @@ const commands = {
|
|
|
1329
1358
|
const { settings } = await call(
|
|
1330
1359
|
'PATCH',
|
|
1331
1360
|
'routines/settings',
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1361
|
+
routineWrite(
|
|
1362
|
+
clean({
|
|
1363
|
+
paused: sub === 'pause',
|
|
1364
|
+
dailyCap: opts['daily-all'] === undefined ? undefined : Number(opts['daily-all']),
|
|
1365
|
+
}),
|
|
1366
|
+
by,
|
|
1367
|
+
),
|
|
1336
1368
|
);
|
|
1337
1369
|
print({ settings }, () => (settings.paused ? 'All routines are paused.' : 'Routines can run.'));
|
|
1338
1370
|
return;
|