@tidegap/cli 0.0.0-stage → 0.18.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/LICENSE +201 -0
- package/README.md +125 -2
- package/dist/commands/env-file.d.ts +53 -0
- package/dist/commands/env-file.d.ts.map +1 -0
- package/dist/commands/env-file.js +127 -0
- package/dist/commands/env-file.js.map +1 -0
- package/dist/commands/install.d.ts +84 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +299 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/queue.d.ts +139 -0
- package/dist/commands/queue.d.ts.map +1 -0
- package/dist/commands/queue.js +491 -0
- package/dist/commands/queue.js.map +1 -0
- package/dist/commands/receipts.d.ts +15 -0
- package/dist/commands/receipts.d.ts.map +1 -0
- package/dist/commands/receipts.js +70 -0
- package/dist/commands/receipts.js.map +1 -0
- package/dist/commands/register-wake.d.ts +21 -0
- package/dist/commands/register-wake.d.ts.map +1 -0
- package/dist/commands/register-wake.js +76 -0
- package/dist/commands/register-wake.js.map +1 -0
- package/dist/commands/stats.d.ts +31 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +165 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/tick.d.ts +73 -0
- package/dist/commands/tick.d.ts.map +1 -0
- package/dist/commands/tick.js +294 -0
- package/dist/commands/tick.js.map +1 -0
- package/dist/commands/ui.d.ts +25 -0
- package/dist/commands/ui.d.ts.map +1 -0
- package/dist/commands/ui.js +83 -0
- package/dist/commands/ui.js.map +1 -0
- package/dist/commands/verify.d.ts +32 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +135 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/env.d.ts +55 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +90 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +351 -0
- package/dist/index.js.map +1 -0
- package/dist/platform/index.d.ts +30 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +66 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/linux.d.ts +81 -0
- package/dist/platform/linux.d.ts.map +1 -0
- package/dist/platform/linux.js +158 -0
- package/dist/platform/linux.js.map +1 -0
- package/dist/platform/macos.d.ts +69 -0
- package/dist/platform/macos.d.ts.map +1 -0
- package/dist/platform/macos.js +151 -0
- package/dist/platform/macos.js.map +1 -0
- package/dist/platform/windows.d.ts +31 -0
- package/dist/platform/windows.d.ts.map +1 -0
- package/dist/platform/windows.js +58 -0
- package/dist/platform/windows.js.map +1 -0
- package/dist/ui/api.d.ts +59 -0
- package/dist/ui/api.d.ts.map +1 -0
- package/dist/ui/api.js +459 -0
- package/dist/ui/api.js.map +1 -0
- package/dist/ui/dispatcher.d.ts +84 -0
- package/dist/ui/dispatcher.d.ts.map +1 -0
- package/dist/ui/dispatcher.js +150 -0
- package/dist/ui/dispatcher.js.map +1 -0
- package/dist/ui/events.d.ts +27 -0
- package/dist/ui/events.d.ts.map +1 -0
- package/dist/ui/events.js +85 -0
- package/dist/ui/events.js.map +1 -0
- package/dist/ui/server.d.ts +69 -0
- package/dist/ui/server.d.ts.map +1 -0
- package/dist/ui/server.js +258 -0
- package/dist/ui/server.js.map +1 -0
- package/package.json +54 -3
- package/ui/agenda.js +256 -0
- package/ui/api.js +111 -0
- package/ui/app.css +707 -0
- package/ui/app.js +597 -0
- package/ui/detail.js +431 -0
- package/ui/dialog.js +279 -0
- package/ui/dnd.js +131 -0
- package/ui/dom.js +255 -0
- package/ui/index.html +37 -0
- package/ui/journal.js +207 -0
- package/ui/keys.js +92 -0
- package/ui/row.js +153 -0
- package/ui/state.js +412 -0
- package/ui/timeline.js +202 -0
- package/ui/toast.js +69 -0
- package/ui/tokens.css +106 -0
- package/ui/views.js +31 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `tidegap` — CLI entry point.
|
|
4
|
+
*
|
|
5
|
+
* tidegap tick drain due tasks (one-shot or --daemon)
|
|
6
|
+
* tidegap install write launchd plist or print systemd/schtasks templates
|
|
7
|
+
* tidegap queue list print queued/scheduled/running/completed tasks
|
|
8
|
+
* tidegap queue cancel | reschedule | run-now | reply change a task (the
|
|
9
|
+
* next tick runs it; these commands never dispatch)
|
|
10
|
+
* tidegap receipts list print carbon receipts for completed tasks
|
|
11
|
+
* tidegap stats local-only personal-impact summary
|
|
12
|
+
* tidegap register-wake schedule a macOS wake event 30s before a task
|
|
13
|
+
* tidegap ui local task page (timeline, inbox, detail, actions) on 127.0.0.1
|
|
14
|
+
*/
|
|
15
|
+
import { createRequire } from "node:module";
|
|
16
|
+
import { basename } from "node:path";
|
|
17
|
+
import { stripControlChars } from "@tidegap/core";
|
|
18
|
+
import { Command } from "commander";
|
|
19
|
+
import { runInstall } from "./commands/install.js";
|
|
20
|
+
import { runQueueCancel, runQueueList, runQueueReply, runQueueReschedule, runQueueRunNow, runQueueShow, runQueueUnread, } from "./commands/queue.js";
|
|
21
|
+
import { runReceiptsList } from "./commands/receipts.js";
|
|
22
|
+
import { runRegisterWake } from "./commands/register-wake.js";
|
|
23
|
+
import { runStats } from "./commands/stats.js";
|
|
24
|
+
import { runTick } from "./commands/tick.js";
|
|
25
|
+
import { runUi } from "./commands/ui.js";
|
|
26
|
+
import { runVerify } from "./commands/verify.js";
|
|
27
|
+
/**
|
|
28
|
+
* CLI version — read from this package's own `package.json` so there is
|
|
29
|
+
* a single source of truth and `tidegap --version` never drifts from the
|
|
30
|
+
* published version. `createRequire` resolves relative to this module,
|
|
31
|
+
* so it works from both `src` (tests) and `dist` (published bin).
|
|
32
|
+
*/
|
|
33
|
+
export function readCliVersion() {
|
|
34
|
+
try {
|
|
35
|
+
const require = createRequire(import.meta.url);
|
|
36
|
+
const pkg = require("../package.json");
|
|
37
|
+
return pkg.version ?? "0.0.0";
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return "0.0.0";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const CLI_VERSION = readCliVersion();
|
|
44
|
+
export function buildProgram() {
|
|
45
|
+
const program = new Command();
|
|
46
|
+
program
|
|
47
|
+
.name("tidegap")
|
|
48
|
+
.description("CLI for Tidegap — carbon-aware scheduler tick + install")
|
|
49
|
+
.version(CLI_VERSION);
|
|
50
|
+
program
|
|
51
|
+
.command("tick")
|
|
52
|
+
.description("Drain due provider-call tasks")
|
|
53
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
54
|
+
.option("--once", "Run a single drain pass (default)")
|
|
55
|
+
.option("--daemon", "Loop forever, draining every --interval seconds")
|
|
56
|
+
.option("--interval <sec>", "Daemon interval seconds", (v) => parseInt(v, 10), 60)
|
|
57
|
+
.option("--region <code>", "Default region for hydrated tasks", undefined)
|
|
58
|
+
.option("--no-notify", "Do not post an OS notification per finished task")
|
|
59
|
+
.action(async (opts) => {
|
|
60
|
+
const code = await runTick({
|
|
61
|
+
notify: opts.notify !== false,
|
|
62
|
+
db: opts.db,
|
|
63
|
+
once: opts.once === true,
|
|
64
|
+
daemon: opts.daemon === true,
|
|
65
|
+
interval: opts.interval,
|
|
66
|
+
region: opts.region,
|
|
67
|
+
});
|
|
68
|
+
process.exit(code);
|
|
69
|
+
});
|
|
70
|
+
const install = program
|
|
71
|
+
.command("install")
|
|
72
|
+
.description("Wire up the OS-level cron tick")
|
|
73
|
+
.option("--laptop", "Laptop mode: launchd plist + pmset wake registration helper")
|
|
74
|
+
.option("--server", "Server mode: launchd plist only, no wake events")
|
|
75
|
+
.action(async (opts) => {
|
|
76
|
+
let mode;
|
|
77
|
+
if (opts.laptop)
|
|
78
|
+
mode = "laptop";
|
|
79
|
+
if (opts.server)
|
|
80
|
+
mode = "server";
|
|
81
|
+
if (!mode) {
|
|
82
|
+
install.help({ error: true });
|
|
83
|
+
process.exit(2);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const result = await runInstall({ mode });
|
|
87
|
+
// eslint-disable-next-line no-console
|
|
88
|
+
console.log(result.nextSteps);
|
|
89
|
+
});
|
|
90
|
+
const queue = program
|
|
91
|
+
.command("queue")
|
|
92
|
+
.description("Inspect and change the queue");
|
|
93
|
+
queue
|
|
94
|
+
.command("list")
|
|
95
|
+
.description("List queued / scheduled / running / completed tasks")
|
|
96
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
97
|
+
.option("--status <status>", "Filter by status", undefined)
|
|
98
|
+
.option("--kind <kind>", "Filter by deadline kind: absolute | quota_reset", undefined)
|
|
99
|
+
.option("--unread", "Only completed or failed tasks nobody has viewed yet")
|
|
100
|
+
.option("--json", "Emit JSON instead of the table")
|
|
101
|
+
.option("--hook", "Claude Code SessionStart mode: one unread-count line or nothing; always exits 0")
|
|
102
|
+
.option("--series <id>", "Only the occurrences of this repeating series, oldest first")
|
|
103
|
+
.action(async (opts) => {
|
|
104
|
+
if (opts.hook === true) {
|
|
105
|
+
const res = await runQueueList({ db: opts.db, hook: true });
|
|
106
|
+
// eslint-disable-next-line no-console
|
|
107
|
+
if (res.rendered)
|
|
108
|
+
console.log(res.rendered);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const res = await runQueueList({
|
|
113
|
+
db: opts.db,
|
|
114
|
+
status: opts.status,
|
|
115
|
+
kind: opts.kind,
|
|
116
|
+
unread: opts.unread === true,
|
|
117
|
+
json: opts.json === true,
|
|
118
|
+
series: opts.series,
|
|
119
|
+
});
|
|
120
|
+
// eslint-disable-next-line no-console
|
|
121
|
+
console.log(res.rendered);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
// eslint-disable-next-line no-console
|
|
125
|
+
console.error(err.message);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
queue
|
|
130
|
+
.command("show <task-id>")
|
|
131
|
+
.description("Show one task: prompt, result, receipt; marks a finished task read")
|
|
132
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
133
|
+
.option("--raw", "Include the raw vendor payload")
|
|
134
|
+
.option("--json", "Emit JSON (the record plus its message history)")
|
|
135
|
+
.option("--no-mark-read", "Do not mark the task read (for scripts)")
|
|
136
|
+
.action(async (taskId, opts) => {
|
|
137
|
+
try {
|
|
138
|
+
const res = await runQueueShow(taskId, {
|
|
139
|
+
db: opts.db,
|
|
140
|
+
raw: opts.raw === true,
|
|
141
|
+
json: opts.json === true,
|
|
142
|
+
markRead: opts.markRead !== false,
|
|
143
|
+
});
|
|
144
|
+
// eslint-disable-next-line no-console
|
|
145
|
+
console.log(res.rendered);
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
// eslint-disable-next-line no-console
|
|
149
|
+
console.error(err.message);
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
queue
|
|
154
|
+
.command("unread <task-id>")
|
|
155
|
+
.description("Mark a task unread again, so it shows in the inbox")
|
|
156
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
157
|
+
.action(async (taskId, opts) => {
|
|
158
|
+
try {
|
|
159
|
+
// eslint-disable-next-line no-console
|
|
160
|
+
console.log(await runQueueUnread(taskId, { db: opts.db }));
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
// eslint-disable-next-line no-console
|
|
164
|
+
console.error(err.message);
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
/** Run one write command: print its result, or the core's refusal and exit 1. */
|
|
169
|
+
const write = async (fn) => {
|
|
170
|
+
try {
|
|
171
|
+
// eslint-disable-next-line no-console
|
|
172
|
+
console.log(await fn());
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
// eslint-disable-next-line no-console
|
|
176
|
+
console.error(stripControlChars(err.message));
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
queue
|
|
181
|
+
.command("cancel <task-id>")
|
|
182
|
+
.description("Cancel a pending task; a repeating task skips this occurrence")
|
|
183
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
184
|
+
.option("--series", "Also end the task's repeating series")
|
|
185
|
+
.action((taskId, opts) => write(() => runQueueCancel(taskId, { db: opts.db, series: opts.series === true })));
|
|
186
|
+
queue
|
|
187
|
+
.command("reschedule <task-id>")
|
|
188
|
+
.description("Move a queued or scheduled task: a new deadline, an exact time, or a local day")
|
|
189
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
190
|
+
.option("--by <when>", "New deadline: a duration (30m, 2h, 3d, 1w) or an ISO-8601 time")
|
|
191
|
+
.option("--at <when>", "Run at exactly this time (duration or ISO-8601)")
|
|
192
|
+
.option("--day <yyyy-mm-dd>", "Run on this local day, at its cleanest forecast hour")
|
|
193
|
+
.action((taskId, opts) => write(() => runQueueReschedule(taskId, opts)));
|
|
194
|
+
queue
|
|
195
|
+
.command("run-now <task-id>")
|
|
196
|
+
.description("Mark a queued or scheduled task due now; the next tick runs it")
|
|
197
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
198
|
+
.action((taskId, opts) => write(() => runQueueRunNow(taskId, { db: opts.db })));
|
|
199
|
+
queue
|
|
200
|
+
.command("reply <task-id> <text>")
|
|
201
|
+
.description("Continue a completed task: queue a new task with its conversation plus this text")
|
|
202
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
203
|
+
.option("--by <when>", "Deadline for the reply (default 1h)")
|
|
204
|
+
.action((taskId, text, opts) => write(() => runQueueReply(taskId, text, { db: opts.db, by: opts.by })));
|
|
205
|
+
const receipts = program
|
|
206
|
+
.command("receipts")
|
|
207
|
+
.description("Inspect carbon receipts");
|
|
208
|
+
receipts
|
|
209
|
+
.command("list")
|
|
210
|
+
.description("List receipts for completed tasks")
|
|
211
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
212
|
+
.option("--since <iso>", "Only receipts at or after this ISO-8601 time")
|
|
213
|
+
.action(async (opts) => {
|
|
214
|
+
try {
|
|
215
|
+
const res = await runReceiptsList({ db: opts.db, since: opts.since });
|
|
216
|
+
// eslint-disable-next-line no-console
|
|
217
|
+
console.log(res.rendered);
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
// eslint-disable-next-line no-console
|
|
221
|
+
console.error(err.message);
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
program
|
|
226
|
+
.command("stats")
|
|
227
|
+
.description("Show local-only personal-impact stats from the queue ledger")
|
|
228
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
229
|
+
.option("--json", "Emit JSON instead of the human-readable table")
|
|
230
|
+
.action(async (opts) => {
|
|
231
|
+
try {
|
|
232
|
+
const res = await runStats({ db: opts.db, json: opts.json === true });
|
|
233
|
+
// eslint-disable-next-line no-console
|
|
234
|
+
console.log(res.rendered);
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
// eslint-disable-next-line no-console
|
|
238
|
+
console.error(err.message);
|
|
239
|
+
process.exit(1);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
program
|
|
243
|
+
.command("verify [task-id]")
|
|
244
|
+
.description("Verify the Ed25519 signature on a carbon receipt — from the ledger by task_id, or from a JSON file via --file")
|
|
245
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
246
|
+
.option("--file <path>", "Path to a receipt JSON file (alternative to task_id)", undefined)
|
|
247
|
+
.option("--trusted-public-key <b64>", "Pin the expected signer's public key (base64); fail if the receipt was signed by anyone else", undefined)
|
|
248
|
+
.option("--json", "Emit JSON instead of the human-readable summary")
|
|
249
|
+
.action(async (taskId, opts) => {
|
|
250
|
+
try {
|
|
251
|
+
const res = await runVerify({
|
|
252
|
+
taskId,
|
|
253
|
+
db: opts.db,
|
|
254
|
+
file: opts.file,
|
|
255
|
+
trustedPublicKey: opts.trustedPublicKey,
|
|
256
|
+
json: opts.json === true,
|
|
257
|
+
});
|
|
258
|
+
// eslint-disable-next-line no-console
|
|
259
|
+
console.log(res.rendered);
|
|
260
|
+
process.exit(res.exitCode);
|
|
261
|
+
}
|
|
262
|
+
catch (err) {
|
|
263
|
+
// eslint-disable-next-line no-console
|
|
264
|
+
console.error(err.message);
|
|
265
|
+
process.exit(4);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
program
|
|
269
|
+
.command("register-wake <task-id>")
|
|
270
|
+
.description("Schedule a macOS wake event 30s before a task's window")
|
|
271
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
272
|
+
.option("--dry-run", "Print the pmset command without running it")
|
|
273
|
+
.action(async (taskId, opts) => {
|
|
274
|
+
try {
|
|
275
|
+
const res = await runRegisterWake({
|
|
276
|
+
taskId,
|
|
277
|
+
db: opts.db,
|
|
278
|
+
dryRun: opts.dryRun === true,
|
|
279
|
+
});
|
|
280
|
+
// eslint-disable-next-line no-console
|
|
281
|
+
console.log(res.message);
|
|
282
|
+
process.exit(res.ok ? 0 : 1);
|
|
283
|
+
}
|
|
284
|
+
catch (err) {
|
|
285
|
+
// eslint-disable-next-line no-console
|
|
286
|
+
console.error(err.message);
|
|
287
|
+
process.exit(1);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
program
|
|
291
|
+
.command("ui")
|
|
292
|
+
.description("Open the local task page: timeline, inbox, task detail, actions (127.0.0.1 only; never dispatches)")
|
|
293
|
+
.option("--db <path>", "SQLite queue path", undefined)
|
|
294
|
+
.option("--port <port>", "Port on 127.0.0.1 (default: a free port)", (v) => parseInt(v, 10), 0)
|
|
295
|
+
.option("--region <code>", "Region for the forecast curve", undefined)
|
|
296
|
+
.option("--no-open", "Print the URL without opening a browser")
|
|
297
|
+
.action(async (opts) => {
|
|
298
|
+
try {
|
|
299
|
+
const code = await runUi({
|
|
300
|
+
db: opts.db,
|
|
301
|
+
port: opts.port,
|
|
302
|
+
region: opts.region,
|
|
303
|
+
open: opts.open !== false,
|
|
304
|
+
});
|
|
305
|
+
process.exit(code);
|
|
306
|
+
}
|
|
307
|
+
catch (err) {
|
|
308
|
+
// eslint-disable-next-line no-console
|
|
309
|
+
console.error(err.message);
|
|
310
|
+
process.exit(1);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
return program;
|
|
314
|
+
}
|
|
315
|
+
const isDirect = (() => {
|
|
316
|
+
try {
|
|
317
|
+
const argv1 = process.argv[1];
|
|
318
|
+
if (!argv1)
|
|
319
|
+
return false;
|
|
320
|
+
return import.meta.url.endsWith(argv1) || import.meta.url.includes("/cli/dist/index.js");
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
})();
|
|
326
|
+
/**
|
|
327
|
+
* The deprecation line for the 0.18 `ebb` bin alias, or `undefined` when the
|
|
328
|
+
* program was started under any other name. npm links both bins to this file,
|
|
329
|
+
* so the name the user typed is the basename of `argv[1]`. The alias goes
|
|
330
|
+
* away in 0.19.
|
|
331
|
+
*/
|
|
332
|
+
export function binAliasDeprecation(argv1) {
|
|
333
|
+
if (!argv1)
|
|
334
|
+
return undefined;
|
|
335
|
+
const name = basename(argv1).replace(/\.(c|m)?js$/, "");
|
|
336
|
+
if (name !== "ebb")
|
|
337
|
+
return undefined;
|
|
338
|
+
return "tidegap: the `ebb` command is now `tidegap`; the `ebb` alias is removed in 0.19.";
|
|
339
|
+
}
|
|
340
|
+
if (isDirect) {
|
|
341
|
+
const deprecation = binAliasDeprecation(process.argv[1]);
|
|
342
|
+
// eslint-disable-next-line no-console
|
|
343
|
+
if (deprecation)
|
|
344
|
+
console.error(deprecation);
|
|
345
|
+
buildProgram().parseAsync(process.argv).catch((err) => {
|
|
346
|
+
// eslint-disable-next-line no-console
|
|
347
|
+
console.error(err);
|
|
348
|
+
process.exit(1);
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=index.js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C;AAEL;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAyB;IAC3D,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACxD,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,kFAAkF,CAAC;AAC5F,CAAC;AAED,IAAI,QAAQ,EAAE,CAAC;IACb,MAAM,WAAW,GAAG,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,sCAAsC;IACtC,IAAI,WAAW;QAAE,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC5C,YAAY,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACpD,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-aware loader. Returns the right submodule for the current OS.
|
|
3
|
+
* The submodules expose the same shape (`caffeinateWhilePending`,
|
|
4
|
+
* `pmsetScheduleWake`, etc.); only macOS is fully wired in v0.4.
|
|
5
|
+
*/
|
|
6
|
+
import * as linux from "./linux.js";
|
|
7
|
+
import * as macos from "./macos.js";
|
|
8
|
+
import * as windows from "./windows.js";
|
|
9
|
+
export type PlatformName = "macos" | "linux" | "windows";
|
|
10
|
+
export declare function currentPlatform(): PlatformName;
|
|
11
|
+
export declare function getPlatform(name?: PlatformName): {
|
|
12
|
+
name: PlatformName;
|
|
13
|
+
caffeinateWhilePending: typeof macos.caffeinateWhilePending;
|
|
14
|
+
pmsetScheduleWake: typeof macos.pmsetScheduleWake;
|
|
15
|
+
};
|
|
16
|
+
export { macos, linux, windows };
|
|
17
|
+
/** Whether a tick daemon (`tidegap install`) is set up on this machine. */
|
|
18
|
+
export type DaemonStatus = "installed" | "not_installed" | "unknown";
|
|
19
|
+
/**
|
|
20
|
+
* Probe for the unit file `tidegap install` writes: the macOS LaunchAgent plist
|
|
21
|
+
* or the Linux systemd user timer. Windows reports `unknown`, because there
|
|
22
|
+
* `tidegap install` only prints a schtasks command and nothing on disk shows
|
|
23
|
+
* whether the user ran it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function daemonStatus(opts?: {
|
|
26
|
+
platform?: NodeJS.Platform;
|
|
27
|
+
home?: string;
|
|
28
|
+
exists?: (path: string) => boolean;
|
|
29
|
+
}): DaemonStatus;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzD,wBAAgB,eAAe,IAAI,YAAY,CAI9C;AAED,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG;IAChD,IAAI,EAAE,YAAY,CAAC;IACnB,sBAAsB,EAAE,OAAO,KAAK,CAAC,sBAAsB,CAAC;IAC5D,iBAAiB,EAAE,OAAO,KAAK,CAAC,iBAAiB,CAAC;CACnD,CAqBA;AAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAEjC,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,eAAe,GAAG,SAAS,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,GAAE;IACJ,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CAC/B,GACL,YAAY,CAgBd"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-aware loader. Returns the right submodule for the current OS.
|
|
3
|
+
* The submodules expose the same shape (`caffeinateWhilePending`,
|
|
4
|
+
* `pmsetScheduleWake`, etc.); only macOS is fully wired in v0.4.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { homedir } from "node:os";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import * as linux from "./linux.js";
|
|
10
|
+
import * as macos from "./macos.js";
|
|
11
|
+
import * as windows from "./windows.js";
|
|
12
|
+
export function currentPlatform() {
|
|
13
|
+
if (process.platform === "darwin")
|
|
14
|
+
return "macos";
|
|
15
|
+
if (process.platform === "win32")
|
|
16
|
+
return "windows";
|
|
17
|
+
return "linux";
|
|
18
|
+
}
|
|
19
|
+
export function getPlatform(name) {
|
|
20
|
+
const resolved = name ?? currentPlatform();
|
|
21
|
+
if (resolved === "macos") {
|
|
22
|
+
return {
|
|
23
|
+
name: "macos",
|
|
24
|
+
caffeinateWhilePending: macos.caffeinateWhilePending,
|
|
25
|
+
pmsetScheduleWake: macos.pmsetScheduleWake,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (resolved === "windows") {
|
|
29
|
+
return {
|
|
30
|
+
name: "windows",
|
|
31
|
+
caffeinateWhilePending: windows.caffeinateWhilePending,
|
|
32
|
+
pmsetScheduleWake: windows.pmsetScheduleWake,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
name: "linux",
|
|
37
|
+
caffeinateWhilePending: linux.caffeinateWhilePending,
|
|
38
|
+
pmsetScheduleWake: linux.pmsetScheduleWake,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export { macos, linux, windows };
|
|
42
|
+
/**
|
|
43
|
+
* Probe for the unit file `tidegap install` writes: the macOS LaunchAgent plist
|
|
44
|
+
* or the Linux systemd user timer. Windows reports `unknown`, because there
|
|
45
|
+
* `tidegap install` only prints a schtasks command and nothing on disk shows
|
|
46
|
+
* whether the user ran it.
|
|
47
|
+
*/
|
|
48
|
+
export function daemonStatus(opts = {}) {
|
|
49
|
+
const platform = opts.platform ?? process.platform;
|
|
50
|
+
const home = opts.home ?? homedir();
|
|
51
|
+
const exists = opts.exists ?? existsSync;
|
|
52
|
+
// The 0.17 unit counts too: it keeps ticking the same ledger until removed.
|
|
53
|
+
if (platform === "darwin") {
|
|
54
|
+
const agents = join(home, "Library", "LaunchAgents");
|
|
55
|
+
return [macos.LAUNCHD_LABEL, macos.LEGACY_LAUNCHD_LABEL].some((l) => exists(join(agents, `${l}.plist`)))
|
|
56
|
+
? "installed"
|
|
57
|
+
: "not_installed";
|
|
58
|
+
}
|
|
59
|
+
if (platform === "win32")
|
|
60
|
+
return "unknown";
|
|
61
|
+
const units = join(home, ".config", "systemd", "user");
|
|
62
|
+
return [linux.SYSTEMD_UNIT, linux.LEGACY_SYSTEMD_UNIT].some((u) => exists(join(units, `${u}.timer`)))
|
|
63
|
+
? "installed"
|
|
64
|
+
: "not_installed";
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,KAAK,KAAK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AA4E;IAC5E,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QACrD,OAAO,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;YACtG,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,eAAe,CAAC;IACtB,CAAC;IACD,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnG,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,eAAe,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linux platform helpers — `systemd-inhibit`, `rtcwake`, and
|
|
3
|
+
* user-systemd unit-file generation.
|
|
4
|
+
*
|
|
5
|
+
* Like the macOS module, these wrap shell-outs and string-templating.
|
|
6
|
+
* The only side-effects are spawning subprocesses; nothing here writes
|
|
7
|
+
* a file. The `install` command places the unit files on disk.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Spawn `systemd-inhibit --what=idle` so the system stays awake.
|
|
11
|
+
* Returns a kill() function. If `systemd-inhibit` is not available,
|
|
12
|
+
* the returned kill() is a no-op.
|
|
13
|
+
*
|
|
14
|
+
* Note: many Linux desktops will honour this; headless servers may
|
|
15
|
+
* have no idle-sleep policy at all, in which case the inhibit is a
|
|
16
|
+
* functional no-op.
|
|
17
|
+
*/
|
|
18
|
+
export declare function caffeinateWhilePending(durationSec: number): Promise<() => void>;
|
|
19
|
+
/**
|
|
20
|
+
* Build the exact `rtcwake -m no -t <epoch-seconds>` command for a
|
|
21
|
+
* given date. `-m no` tells rtcwake to *only* arm the RTC alarm without
|
|
22
|
+
* suspending the machine itself.
|
|
23
|
+
*/
|
|
24
|
+
export declare function rtcwakeCommand(at: Date): string;
|
|
25
|
+
/**
|
|
26
|
+
* Run `rtcwake -m no -t <epoch>`. Needs CAP_SYS_TIME / root. If we are
|
|
27
|
+
* euid 0 we run it directly; otherwise we try `sudo -n` (non-interactive
|
|
28
|
+
* — succeeds only if a sudoers rule pre-authorizes it without a password)
|
|
29
|
+
* and, on failure, hand the caller a non-ok result so it can print the
|
|
30
|
+
* exact sudoers one-liner.
|
|
31
|
+
*/
|
|
32
|
+
export declare function rtcwakeScheduleWake(at: Date): Promise<{
|
|
33
|
+
command: string;
|
|
34
|
+
ok: boolean;
|
|
35
|
+
stderr: string;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Compatibility alias for the cross-platform `getPlatform` shim so
|
|
39
|
+
* callers can keep using one name regardless of OS.
|
|
40
|
+
*/
|
|
41
|
+
export declare const pmsetScheduleWake: typeof rtcwakeScheduleWake;
|
|
42
|
+
/** Base name of the systemd user units (`.service` and `.timer`). */
|
|
43
|
+
export declare const SYSTEMD_UNIT = "tidegap-tick";
|
|
44
|
+
/** The 0.17 unit name, detected so `tidegap install` can print its cleanup. */
|
|
45
|
+
export declare const LEGACY_SYSTEMD_UNIT = "ebb-tick";
|
|
46
|
+
export interface SystemdServiceOptions {
|
|
47
|
+
dbPath: string;
|
|
48
|
+
/**
|
|
49
|
+
* The argv[0..n] that invoke `tidegap`, resolved at install time. For a
|
|
50
|
+
* pinned node install this is `[process.execPath, realpath(argv[1])]`
|
|
51
|
+
* — the exact interpreter plus the real dist entry — immune to a bare
|
|
52
|
+
* service PATH and `#!/usr/bin/env node` shebangs. Falls back to
|
|
53
|
+
* `ebbBinaryPath` (single element) if omitted.
|
|
54
|
+
*/
|
|
55
|
+
launcher?: string[];
|
|
56
|
+
/** Legacy single-binary launcher. Prefer `launcher`. */
|
|
57
|
+
ebbBinaryPath?: string;
|
|
58
|
+
/** Absolute path to write stdout/stderr logs. Defaults to ~/.tidegap/logs/tick.log. */
|
|
59
|
+
logPath?: string;
|
|
60
|
+
/** Optional env vars added as `Environment=KEY=VAL` lines. */
|
|
61
|
+
env?: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Render the `tidegap-tick.service` unit file. `Type=oneshot` because the
|
|
65
|
+
* service runs `tidegap tick --once` and exits; the companion timer is
|
|
66
|
+
* responsible for cadence. `EnvironmentFile=` references a user-owned
|
|
67
|
+
* env file (belt-and-braces: `tidegap tick` also loads it directly), so
|
|
68
|
+
* secrets never land in the service unit itself.
|
|
69
|
+
*/
|
|
70
|
+
export declare function systemdService(opts: SystemdServiceOptions): string;
|
|
71
|
+
export interface SystemdTimerOptions {
|
|
72
|
+
tickIntervalSec: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Render the `tidegap-tick.timer` unit file. Uses `OnUnitActiveSec=<n>s`
|
|
76
|
+
* so the cadence matches the launchd `StartInterval` — fires every N
|
|
77
|
+
* seconds regardless of wall-clock alignment. `OnBootSec=30s` covers
|
|
78
|
+
* the case where the user-session starts before the network does.
|
|
79
|
+
*/
|
|
80
|
+
export declare function systemdTimer(opts: SystemdTimerOptions): string;
|
|
81
|
+
//# sourceMappingURL=linux.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linux.d.ts","sourceRoot":"","sources":["../../src/platform/linux.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1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