cnagent 2.2.17 → 2.2.19
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/package.json +1 -1
- package/tools/dist/cn.js +267 -142
package/package.json
CHANGED
package/tools/dist/cn.js
CHANGED
|
@@ -12160,6 +12160,9 @@ var require_cn_lib = __commonJS({
|
|
|
12160
12160
|
case /* Weekly */
|
|
12161
12161
|
10:
|
|
12162
12162
|
return "weekly";
|
|
12163
|
+
case /* Setup */
|
|
12164
|
+
11:
|
|
12165
|
+
return "setup";
|
|
12163
12166
|
}
|
|
12164
12167
|
} else {
|
|
12165
12168
|
switch (t.TAG) {
|
|
@@ -13182,6 +13185,15 @@ var require_cn_lib = __commonJS({
|
|
|
13182
13185
|
}
|
|
13183
13186
|
exit = 3;
|
|
13184
13187
|
break;
|
|
13188
|
+
case "setup":
|
|
13189
|
+
if (param.tl) {
|
|
13190
|
+
return;
|
|
13191
|
+
} else {
|
|
13192
|
+
return (
|
|
13193
|
+
/* Setup */
|
|
13194
|
+
11
|
|
13195
|
+
);
|
|
13196
|
+
}
|
|
13185
13197
|
case "status":
|
|
13186
13198
|
if (param.tl) {
|
|
13187
13199
|
return;
|
|
@@ -13654,8 +13666,8 @@ var require_cn_lib = __commonJS({
|
|
|
13654
13666
|
10
|
|
13655
13667
|
);
|
|
13656
13668
|
}
|
|
13657
|
-
var help_text = "cn - Coherent Network agent CLI\n\nUsage: cn <command> [options]\n\nCommands:\n # Agent decisions (output)\n delete <thread> GTD: discard\n defer <thread> GTD: postpone\n delegate <t> <peer> GTD: forward\n do <thread> GTD: claim/start\n done <thread> GTD: complete \xE2\x86\x92 archive\n reply <thread> <msg> Append to thread\n send <peer> <msg> Message to peer (or self)\n \n # cn operations (orchestrator)\n sync Fetch inbound + send outbound\n in Queue inbox \xE2\x86\x92 input.md \xE2\x86\x92 wake agent (alias: inbound, process)\n queue [list|clear] View or clear the task queue\n mca [list|add <desc>] Surface MCAs for community pickup\n inbox List inbox threads\n outbox List outbox threads\n next Get next inbox item (with cadence)\n read <thread> Read thread with cadence\n \n # Thread creation\n adhoc <title> Create adhoc thread\n daily Create/show daily reflection\n weekly Create/show weekly reflection\n \n # Hub management\n init [name] Create new hub\n status Show hub state\n commit [msg] Stage + commit\n push Push to origin\n save [msg] Commit + push\n peer Manage peers\n doctor Health check\n update Update cn to latest version\n\nAliases:\n i = inbox, o = outbox, s = status, d = doctor\n\nFlags:\n --help, -h Show help\n --version, -V Show version\n --json Machine-readable output\n --quiet, -q Minimal output\n --dry-run Show what would happen\n\nActor Model:\n cn runs on cron (every 5 min). It:\n 1. Syncs peers \xE2\x86\x92 queues new inbox items to state/queue/\n 2. If input.md empty \xE2\x86\x92 pops from queue \xE2\x86\x92 writes input.md \xE2\x86\x92 wakes agent\n Agent reads input.md, processes, deletes when done.\n";
|
|
13658
|
-
var version = "2.2.
|
|
13669
|
+
var help_text = "cn - Coherent Network agent CLI\n\nUsage: cn <command> [options]\n\nCommands:\n # Agent decisions (output)\n delete <thread> GTD: discard\n defer <thread> GTD: postpone\n delegate <t> <peer> GTD: forward\n do <thread> GTD: claim/start\n done <thread> GTD: complete \xE2\x86\x92 archive\n reply <thread> <msg> Append to thread\n send <peer> <msg> Message to peer (or self)\n \n # cn operations (orchestrator)\n sync Fetch inbound + send outbound\n in Queue inbox \xE2\x86\x92 input.md \xE2\x86\x92 wake agent (alias: inbound, process)\n queue [list|clear] View or clear the task queue\n mca [list|add <desc>] Surface MCAs for community pickup\n inbox List inbox threads\n outbox List outbox threads\n next Get next inbox item (with cadence)\n read <thread> Read thread with cadence\n \n # Thread creation\n adhoc <title> Create adhoc thread\n daily Create/show daily reflection\n weekly Create/show weekly reflection\n \n # Hub management\n init [name] Create new hub\n setup System setup (logrotate + cron) \xE2\x80\x94 run with sudo\n status Show hub state\n commit [msg] Stage + commit\n push Push to origin\n save [msg] Commit + push\n peer Manage peers\n doctor Health check\n update Update cn to latest version\n\nAliases:\n i = inbox, o = outbox, s = status, d = doctor\n\nFlags:\n --help, -h Show help\n --version, -V Show version\n --json Machine-readable output\n --quiet, -q Minimal output\n --dry-run Show what would happen\n\nActor Model:\n cn runs on cron (every 5 min). It:\n 1. Syncs peers \xE2\x86\x92 queues new inbox items to state/queue/\n 2. If input.md empty \xE2\x86\x92 pops from queue \xE2\x86\x92 writes input.md \xE2\x86\x92 wakes agent\n Agent reads input.md, processes, deletes when done.\n";
|
|
13670
|
+
var version = "2.2.19";
|
|
13659
13671
|
module2.exports = {
|
|
13660
13672
|
starts_with,
|
|
13661
13673
|
strip_prefix,
|
|
@@ -26520,53 +26532,7 @@ function find_hub_path(_dir) {
|
|
|
26520
26532
|
}
|
|
26521
26533
|
;
|
|
26522
26534
|
}
|
|
26523
|
-
function log_action(
|
|
26524
|
-
const logs_dir = Path.join(hub_path, "logs");
|
|
26525
|
-
ensure_dir(logs_dir);
|
|
26526
|
-
const entry = {
|
|
26527
|
-
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
26528
|
-
action,
|
|
26529
|
-
details
|
|
26530
|
-
};
|
|
26531
|
-
const date_str = Stdlib__String.sub((/* @__PURE__ */ new Date()).toISOString(), 0, 10).replace(/-/g, "");
|
|
26532
|
-
const log_file = Curry._1(Stdlib__Printf.sprintf({
|
|
26533
|
-
TAG: (
|
|
26534
|
-
/* Format */
|
|
26535
|
-
0
|
|
26536
|
-
),
|
|
26537
|
-
_0: {
|
|
26538
|
-
TAG: (
|
|
26539
|
-
/* String_literal */
|
|
26540
|
-
11
|
|
26541
|
-
),
|
|
26542
|
-
_0: "cn-",
|
|
26543
|
-
_1: {
|
|
26544
|
-
TAG: (
|
|
26545
|
-
/* String */
|
|
26546
|
-
2
|
|
26547
|
-
),
|
|
26548
|
-
_0: (
|
|
26549
|
-
/* No_padding */
|
|
26550
|
-
0
|
|
26551
|
-
),
|
|
26552
|
-
_1: {
|
|
26553
|
-
TAG: (
|
|
26554
|
-
/* String_literal */
|
|
26555
|
-
11
|
|
26556
|
-
),
|
|
26557
|
-
_0: ".log",
|
|
26558
|
-
_1: (
|
|
26559
|
-
/* End_of_format */
|
|
26560
|
-
0
|
|
26561
|
-
)
|
|
26562
|
-
}
|
|
26563
|
-
}
|
|
26564
|
-
},
|
|
26565
|
-
_1: "cn-%s.log"
|
|
26566
|
-
}), date_str);
|
|
26567
|
-
const prim1 = JSON.stringify(entry) + "\n";
|
|
26568
|
-
const prim0 = Path.join(logs_dir, log_file);
|
|
26569
|
-
Fs.appendFileSync(prim0, prim1);
|
|
26535
|
+
function log_action(_hub_path, _action, _details) {
|
|
26570
26536
|
}
|
|
26571
26537
|
function load_peers(hub_path) {
|
|
26572
26538
|
const peers_path = Path.join(hub_path, "state/peers.md");
|
|
@@ -26785,7 +26751,6 @@ function delete_remote_branch(hub_path, branch) {
|
|
|
26785
26751
|
}), branch);
|
|
26786
26752
|
const match2 = exec_in(hub_path, cmd2);
|
|
26787
26753
|
if (match2 !== void 0) {
|
|
26788
|
-
log_action(hub_path, "branch.delete", branch);
|
|
26789
26754
|
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
26790
26755
|
TAG: (
|
|
26791
26756
|
/* Format */
|
|
@@ -27189,7 +27154,7 @@ function reject_orphan_branch(hub_path, peer_name, branch) {
|
|
|
27189
27154
|
const prim0 = Path.join(outbox_dir, filename);
|
|
27190
27155
|
Fs.writeFileSync(prim0, content);
|
|
27191
27156
|
}
|
|
27192
|
-
|
|
27157
|
+
Curry._3(Stdlib__Printf.sprintf({
|
|
27193
27158
|
TAG: (
|
|
27194
27159
|
/* Format */
|
|
27195
27160
|
0
|
|
@@ -27257,7 +27222,7 @@ function reject_orphan_branch(hub_path, peer_name, branch) {
|
|
|
27257
27222
|
}
|
|
27258
27223
|
},
|
|
27259
27224
|
_1: "branch:%s peer:%s author:%s reason:orphan"
|
|
27260
|
-
}), branch, peer_name, author)
|
|
27225
|
+
}), branch, peer_name, author);
|
|
27261
27226
|
console.log(fail(Curry._2(Stdlib__Printf.sprintf({
|
|
27262
27227
|
TAG: (
|
|
27263
27228
|
/* Format */
|
|
@@ -28041,7 +28006,7 @@ function materialize_branch(clone_path, hub_path, inbox_dir, peer_name, branch)
|
|
|
28041
28006
|
};
|
|
28042
28007
|
const prim1 = Cn_lib.update_frontmatter(content, meta);
|
|
28043
28008
|
Fs.writeFileSync(inbox_path, prim1);
|
|
28044
|
-
|
|
28009
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
28045
28010
|
TAG: (
|
|
28046
28011
|
/* Format */
|
|
28047
28012
|
0
|
|
@@ -28078,7 +28043,7 @@ function materialize_branch(clone_path, hub_path, inbox_dir, peer_name, branch)
|
|
|
28078
28043
|
}
|
|
28079
28044
|
},
|
|
28080
28045
|
_1: "%s trigger:%s"
|
|
28081
|
-
}), inbox_file, trigger)
|
|
28046
|
+
}), inbox_file, trigger);
|
|
28082
28047
|
delete_remote_branch(clone_path, branch);
|
|
28083
28048
|
return inbox_file;
|
|
28084
28049
|
}), files);
|
|
@@ -28619,7 +28584,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28619
28584
|
const prim0$1 = Path.join(sent_dir, file);
|
|
28620
28585
|
Fs.writeFileSync(prim0$1, prim1);
|
|
28621
28586
|
Fs.unlinkSync(file_path);
|
|
28622
|
-
|
|
28587
|
+
Curry._3(Stdlib__Printf.sprintf({
|
|
28623
28588
|
TAG: (
|
|
28624
28589
|
/* Format */
|
|
28625
28590
|
0
|
|
@@ -28680,7 +28645,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28680
28645
|
}
|
|
28681
28646
|
},
|
|
28682
28647
|
_1: "to:%s thread:%s branch:%s"
|
|
28683
|
-
}), to_peer, file, branch_name)
|
|
28648
|
+
}), to_peer, file, branch_name);
|
|
28684
28649
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
28685
28650
|
TAG: (
|
|
28686
28651
|
/* Format */
|
|
@@ -28728,7 +28693,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28728
28693
|
}), to_peer, file)));
|
|
28729
28694
|
return file;
|
|
28730
28695
|
}
|
|
28731
|
-
|
|
28696
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
28732
28697
|
TAG: (
|
|
28733
28698
|
/* Format */
|
|
28734
28699
|
0
|
|
@@ -28779,7 +28744,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28779
28744
|
}
|
|
28780
28745
|
},
|
|
28781
28746
|
_1: "to:%s thread:%s error:checkout failed"
|
|
28782
|
-
}), to_peer, file)
|
|
28747
|
+
}), to_peer, file);
|
|
28783
28748
|
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28784
28749
|
TAG: (
|
|
28785
28750
|
/* Format */
|
|
@@ -28810,7 +28775,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28810
28775
|
}), file)));
|
|
28811
28776
|
return;
|
|
28812
28777
|
}
|
|
28813
|
-
|
|
28778
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
28814
28779
|
TAG: (
|
|
28815
28780
|
/* Format */
|
|
28816
28781
|
0
|
|
@@ -28861,7 +28826,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28861
28826
|
}
|
|
28862
28827
|
},
|
|
28863
28828
|
_1: "thread:%s to:%s reason:no clone path"
|
|
28864
|
-
}), file, to_peer)
|
|
28829
|
+
}), file, to_peer);
|
|
28865
28830
|
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28866
28831
|
TAG: (
|
|
28867
28832
|
/* Format */
|
|
@@ -28892,7 +28857,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28892
28857
|
}), to_peer)));
|
|
28893
28858
|
return;
|
|
28894
28859
|
}
|
|
28895
|
-
|
|
28860
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
28896
28861
|
TAG: (
|
|
28897
28862
|
/* Format */
|
|
28898
28863
|
0
|
|
@@ -28943,7 +28908,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28943
28908
|
}
|
|
28944
28909
|
},
|
|
28945
28910
|
_1: "thread:%s to:%s reason:unknown peer"
|
|
28946
|
-
}), file, to_peer)
|
|
28911
|
+
}), file, to_peer);
|
|
28947
28912
|
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28948
28913
|
TAG: (
|
|
28949
28914
|
/* Format */
|
|
@@ -28974,7 +28939,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
28974
28939
|
}), to_peer)));
|
|
28975
28940
|
return;
|
|
28976
28941
|
}
|
|
28977
|
-
|
|
28942
|
+
Curry._1(Stdlib__Printf.sprintf({
|
|
28978
28943
|
TAG: (
|
|
28979
28944
|
/* Format */
|
|
28980
28945
|
0
|
|
@@ -29008,7 +28973,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
29008
28973
|
}
|
|
29009
28974
|
},
|
|
29010
28975
|
_1: "thread:%s reason:no recipient"
|
|
29011
|
-
}), file)
|
|
28976
|
+
}), file);
|
|
29012
28977
|
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
29013
28978
|
TAG: (
|
|
29014
28979
|
/* Format */
|
|
@@ -29372,7 +29337,6 @@ function gtd_delete(hub_path, thread_id) {
|
|
|
29372
29337
|
const path = find_thread(hub_path, thread_id);
|
|
29373
29338
|
if (path !== void 0) {
|
|
29374
29339
|
Fs.unlinkSync(path);
|
|
29375
|
-
log_action(hub_path, "gtd.delete", thread_id);
|
|
29376
29340
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
29377
29341
|
TAG: (
|
|
29378
29342
|
/* Format */
|
|
@@ -29458,7 +29422,7 @@ function gtd_defer(hub_path, thread_id, until) {
|
|
|
29458
29422
|
const prim0 = Path.join(deferred_dir, Path.basename(path));
|
|
29459
29423
|
Fs.writeFileSync(prim0, prim1);
|
|
29460
29424
|
Fs.unlinkSync(path);
|
|
29461
|
-
|
|
29425
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
29462
29426
|
TAG: (
|
|
29463
29427
|
/* Format */
|
|
29464
29428
|
0
|
|
@@ -29495,7 +29459,7 @@ function gtd_defer(hub_path, thread_id, until) {
|
|
|
29495
29459
|
}
|
|
29496
29460
|
},
|
|
29497
29461
|
_1: "%s until:%s"
|
|
29498
|
-
}), thread_id, until_str)
|
|
29462
|
+
}), thread_id, until_str);
|
|
29499
29463
|
const suffix = until !== void 0 ? " until " + until : "";
|
|
29500
29464
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
29501
29465
|
TAG: (
|
|
@@ -29597,7 +29561,7 @@ function gtd_delegate(hub_path, name, thread_id, peer) {
|
|
|
29597
29561
|
const prim0 = Path.join(outbox_dir, Path.basename(path));
|
|
29598
29562
|
Fs.writeFileSync(prim0, prim1);
|
|
29599
29563
|
Fs.unlinkSync(path);
|
|
29600
|
-
|
|
29564
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
29601
29565
|
TAG: (
|
|
29602
29566
|
/* Format */
|
|
29603
29567
|
0
|
|
@@ -29634,7 +29598,7 @@ function gtd_delegate(hub_path, name, thread_id, peer) {
|
|
|
29634
29598
|
}
|
|
29635
29599
|
},
|
|
29636
29600
|
_1: "%s to:%s"
|
|
29637
|
-
}), thread_id, peer)
|
|
29601
|
+
}), thread_id, peer);
|
|
29638
29602
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
29639
29603
|
TAG: (
|
|
29640
29604
|
/* Format */
|
|
@@ -29731,7 +29695,6 @@ function gtd_do(hub_path, thread_id) {
|
|
|
29731
29695
|
const prim0 = Path.join(doing_dir, Path.basename(path));
|
|
29732
29696
|
Fs.writeFileSync(prim0, prim1);
|
|
29733
29697
|
Fs.unlinkSync(path);
|
|
29734
|
-
log_action(hub_path, "gtd.do", thread_id);
|
|
29735
29698
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
29736
29699
|
TAG: (
|
|
29737
29700
|
/* Format */
|
|
@@ -29810,7 +29773,6 @@ function gtd_done(hub_path, thread_id) {
|
|
|
29810
29773
|
const prim0 = Path.join(archived_dir, Path.basename(path));
|
|
29811
29774
|
Fs.writeFileSync(prim0, prim1);
|
|
29812
29775
|
Fs.unlinkSync(path);
|
|
29813
|
-
log_action(hub_path, "gtd.done", thread_id);
|
|
29814
29776
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
29815
29777
|
TAG: (
|
|
29816
29778
|
/* Format */
|
|
@@ -30259,7 +30221,6 @@ function run_commit(hub_path, name, msg) {
|
|
|
30259
30221
|
_1: 'git commit -m "%s"'
|
|
30260
30222
|
}), escaped));
|
|
30261
30223
|
if (match2 !== void 0) {
|
|
30262
|
-
log_action(hub_path, "commit", message);
|
|
30263
30224
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
30264
30225
|
TAG: (
|
|
30265
30226
|
/* Format */
|
|
@@ -30289,7 +30250,7 @@ function run_commit(hub_path, name, msg) {
|
|
|
30289
30250
|
_1: "Committed: %s"
|
|
30290
30251
|
}), message)));
|
|
30291
30252
|
} else {
|
|
30292
|
-
|
|
30253
|
+
Curry._1(Stdlib__Printf.sprintf({
|
|
30293
30254
|
TAG: (
|
|
30294
30255
|
/* Format */
|
|
30295
30256
|
0
|
|
@@ -30316,7 +30277,7 @@ function run_commit(hub_path, name, msg) {
|
|
|
30316
30277
|
}
|
|
30317
30278
|
},
|
|
30318
30279
|
_1: "error:%s"
|
|
30319
|
-
}), message)
|
|
30280
|
+
}), message);
|
|
30320
30281
|
console.log(fail("Commit failed"));
|
|
30321
30282
|
}
|
|
30322
30283
|
}
|
|
@@ -30353,7 +30314,6 @@ function run_push(hub_path) {
|
|
|
30353
30314
|
_1: "git push origin %s"
|
|
30354
30315
|
}), branch$1));
|
|
30355
30316
|
if (match2 !== void 0) {
|
|
30356
|
-
log_action(hub_path, "push", branch$1);
|
|
30357
30317
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
30358
30318
|
TAG: (
|
|
30359
30319
|
/* Format */
|
|
@@ -30383,7 +30343,6 @@ function run_push(hub_path) {
|
|
|
30383
30343
|
_1: "Pushed to origin/%s"
|
|
30384
30344
|
}), branch$1)));
|
|
30385
30345
|
} else {
|
|
30386
|
-
log_action(hub_path, "push", "error");
|
|
30387
30346
|
console.log(fail("Push failed"));
|
|
30388
30347
|
}
|
|
30389
30348
|
return;
|
|
@@ -30492,7 +30451,7 @@ function run_send(hub_path, peer, message) {
|
|
|
30492
30451
|
}), peer, (/* @__PURE__ */ new Date()).toISOString(), first_line, message);
|
|
30493
30452
|
const prim0 = Path.join(outbox_dir, file_name);
|
|
30494
30453
|
Fs.writeFileSync(prim0, content);
|
|
30495
|
-
|
|
30454
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
30496
30455
|
TAG: (
|
|
30497
30456
|
/* Format */
|
|
30498
30457
|
0
|
|
@@ -30536,7 +30495,7 @@ function run_send(hub_path, peer, message) {
|
|
|
30536
30495
|
}
|
|
30537
30496
|
},
|
|
30538
30497
|
_1: "to:%s thread:%s"
|
|
30539
|
-
}), peer, slug)
|
|
30498
|
+
}), peer, slug);
|
|
30540
30499
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
30541
30500
|
TAG: (
|
|
30542
30501
|
/* Format */
|
|
@@ -30633,7 +30592,7 @@ function run_reply(hub_path, thread_id, message) {
|
|
|
30633
30592
|
_1: "\n\n## Reply (%s)\n\n%s"
|
|
30634
30593
|
}), (/* @__PURE__ */ new Date()).toISOString(), message);
|
|
30635
30594
|
Fs.appendFileSync(path, reply);
|
|
30636
|
-
|
|
30595
|
+
Curry._1(Stdlib__Printf.sprintf({
|
|
30637
30596
|
TAG: (
|
|
30638
30597
|
/* Format */
|
|
30639
30598
|
0
|
|
@@ -30660,7 +30619,7 @@ function run_reply(hub_path, thread_id, message) {
|
|
|
30660
30619
|
}
|
|
30661
30620
|
},
|
|
30662
30621
|
_1: "thread:%s"
|
|
30663
|
-
}), thread_id)
|
|
30622
|
+
}), thread_id);
|
|
30664
30623
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
30665
30624
|
TAG: (
|
|
30666
30625
|
/* Format */
|
|
@@ -31460,7 +31419,7 @@ function queue_add(hub_path, id, from, content) {
|
|
|
31460
31419
|
_1: "---\nid: %s\nfrom: %s\nqueued: %s\n---\n\n%s"
|
|
31461
31420
|
}), id, from, (/* @__PURE__ */ new Date()).toISOString(), content);
|
|
31462
31421
|
Fs.writeFileSync(file_path, queued_content);
|
|
31463
|
-
|
|
31422
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
31464
31423
|
TAG: (
|
|
31465
31424
|
/* Format */
|
|
31466
31425
|
0
|
|
@@ -31504,7 +31463,7 @@ function queue_add(hub_path, id, from, content) {
|
|
|
31504
31463
|
}
|
|
31505
31464
|
},
|
|
31506
31465
|
_1: "id:%s from:%s"
|
|
31507
|
-
}), id, from)
|
|
31466
|
+
}), id, from);
|
|
31508
31467
|
return file_name;
|
|
31509
31468
|
}
|
|
31510
31469
|
function queue_pop(hub_path) {
|
|
@@ -31571,7 +31530,6 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31571
31530
|
switch (op.TAG) {
|
|
31572
31531
|
case /* Ack */
|
|
31573
31532
|
0:
|
|
31574
|
-
log_action(hub_path, "op.ack", input_id);
|
|
31575
31533
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
31576
31534
|
TAG: (
|
|
31577
31535
|
/* Format */
|
|
@@ -31603,8 +31561,6 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31603
31561
|
return;
|
|
31604
31562
|
case /* Done */
|
|
31605
31563
|
1:
|
|
31606
|
-
const id = op._0;
|
|
31607
|
-
log_action(hub_path, "op.done", id);
|
|
31608
31564
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
31609
31565
|
TAG: (
|
|
31610
31566
|
/* Format */
|
|
@@ -31632,13 +31588,13 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31632
31588
|
}
|
|
31633
31589
|
},
|
|
31634
31590
|
_1: "Done: %s"
|
|
31635
|
-
}),
|
|
31591
|
+
}), op._0)));
|
|
31636
31592
|
return;
|
|
31637
31593
|
case /* Fail */
|
|
31638
31594
|
2:
|
|
31639
31595
|
const reason = op._1;
|
|
31640
|
-
const id
|
|
31641
|
-
|
|
31596
|
+
const id = op._0;
|
|
31597
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
31642
31598
|
TAG: (
|
|
31643
31599
|
/* Format */
|
|
31644
31600
|
0
|
|
@@ -31682,7 +31638,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31682
31638
|
}
|
|
31683
31639
|
},
|
|
31684
31640
|
_1: "id:%s reason:%s"
|
|
31685
|
-
}), id
|
|
31641
|
+
}), id, reason);
|
|
31686
31642
|
console.log(warn(Curry._2(Stdlib__Printf.sprintf({
|
|
31687
31643
|
TAG: (
|
|
31688
31644
|
/* Format */
|
|
@@ -31727,12 +31683,12 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31727
31683
|
}
|
|
31728
31684
|
},
|
|
31729
31685
|
_1: "Failed: %s - %s"
|
|
31730
|
-
}), id
|
|
31686
|
+
}), id, reason)));
|
|
31731
31687
|
return;
|
|
31732
31688
|
case /* Reply */
|
|
31733
31689
|
3:
|
|
31734
|
-
const id$
|
|
31735
|
-
const path = find_thread(hub_path, id$
|
|
31690
|
+
const id$1 = op._0;
|
|
31691
|
+
const path = find_thread(hub_path, id$1);
|
|
31736
31692
|
if (path !== void 0) {
|
|
31737
31693
|
const reply = Curry._2(Stdlib__Printf.sprintf({
|
|
31738
31694
|
TAG: (
|
|
@@ -31780,7 +31736,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31780
31736
|
_1: "\n\n## Reply (%s)\n\n%s"
|
|
31781
31737
|
}), (/* @__PURE__ */ new Date()).toISOString(), op._1);
|
|
31782
31738
|
Fs.appendFileSync(path, reply);
|
|
31783
|
-
|
|
31739
|
+
Curry._1(Stdlib__Printf.sprintf({
|
|
31784
31740
|
TAG: (
|
|
31785
31741
|
/* Format */
|
|
31786
31742
|
0
|
|
@@ -31807,7 +31763,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31807
31763
|
}
|
|
31808
31764
|
},
|
|
31809
31765
|
_1: "thread:%s"
|
|
31810
|
-
}), id$
|
|
31766
|
+
}), id$1);
|
|
31811
31767
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
31812
31768
|
TAG: (
|
|
31813
31769
|
/* Format */
|
|
@@ -31835,10 +31791,10 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31835
31791
|
}
|
|
31836
31792
|
},
|
|
31837
31793
|
_1: "Replied to %s"
|
|
31838
|
-
}), id$
|
|
31794
|
+
}), id$1)));
|
|
31839
31795
|
return;
|
|
31840
31796
|
}
|
|
31841
|
-
|
|
31797
|
+
Curry._1(Stdlib__Printf.sprintf({
|
|
31842
31798
|
TAG: (
|
|
31843
31799
|
/* Format */
|
|
31844
31800
|
0
|
|
@@ -31872,7 +31828,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31872
31828
|
}
|
|
31873
31829
|
},
|
|
31874
31830
|
_1: "thread:%s (not found)"
|
|
31875
|
-
}), id$
|
|
31831
|
+
}), id$1);
|
|
31876
31832
|
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
31877
31833
|
TAG: (
|
|
31878
31834
|
/* Format */
|
|
@@ -31900,7 +31856,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31900
31856
|
}
|
|
31901
31857
|
},
|
|
31902
31858
|
_1: "Thread not found for reply: %s"
|
|
31903
|
-
}), id$
|
|
31859
|
+
}), id$1)));
|
|
31904
31860
|
return;
|
|
31905
31861
|
case /* Send */
|
|
31906
31862
|
4:
|
|
@@ -32026,7 +31982,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32026
31982
|
}), peer, (/* @__PURE__ */ new Date()).toISOString(), name, first_line, body);
|
|
32027
31983
|
const prim0 = Path.join(outbox_dir, file_name);
|
|
32028
31984
|
Fs.writeFileSync(prim0, content);
|
|
32029
|
-
|
|
31985
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
32030
31986
|
TAG: (
|
|
32031
31987
|
/* Format */
|
|
32032
31988
|
0
|
|
@@ -32070,7 +32026,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32070
32026
|
}
|
|
32071
32027
|
},
|
|
32072
32028
|
_1: "to:%s thread:%s"
|
|
32073
|
-
}), peer, slug)
|
|
32029
|
+
}), peer, slug);
|
|
32074
32030
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
32075
32031
|
TAG: (
|
|
32076
32032
|
/* Format */
|
|
@@ -32103,8 +32059,8 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32103
32059
|
case /* Delegate */
|
|
32104
32060
|
5:
|
|
32105
32061
|
const peer$1 = op._1;
|
|
32106
|
-
const id$
|
|
32107
|
-
const path$1 = find_thread(hub_path, id$
|
|
32062
|
+
const id$2 = op._0;
|
|
32063
|
+
const path$1 = find_thread(hub_path, id$2);
|
|
32108
32064
|
if (path$1 !== void 0) {
|
|
32109
32065
|
const outbox_dir$1 = Path.join(hub_path, "threads/mail/outbox");
|
|
32110
32066
|
ensure_dir(outbox_dir$1);
|
|
@@ -32134,7 +32090,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32134
32090
|
const prim0$1 = Path.join(outbox_dir$1, Path.basename(path$1));
|
|
32135
32091
|
Fs.writeFileSync(prim0$1, prim1);
|
|
32136
32092
|
Fs.unlinkSync(path$1);
|
|
32137
|
-
|
|
32093
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
32138
32094
|
TAG: (
|
|
32139
32095
|
/* Format */
|
|
32140
32096
|
0
|
|
@@ -32171,7 +32127,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32171
32127
|
}
|
|
32172
32128
|
},
|
|
32173
32129
|
_1: "%s to:%s"
|
|
32174
|
-
}), id$
|
|
32130
|
+
}), id$2, peer$1);
|
|
32175
32131
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
32176
32132
|
TAG: (
|
|
32177
32133
|
/* Format */
|
|
@@ -32216,7 +32172,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32216
32172
|
}
|
|
32217
32173
|
},
|
|
32218
32174
|
_1: "Delegated %s to %s"
|
|
32219
|
-
}), id$
|
|
32175
|
+
}), id$2, peer$1)));
|
|
32220
32176
|
return;
|
|
32221
32177
|
}
|
|
32222
32178
|
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -32246,12 +32202,12 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32246
32202
|
}
|
|
32247
32203
|
},
|
|
32248
32204
|
_1: "Thread not found for delegate: %s"
|
|
32249
|
-
}), id$
|
|
32205
|
+
}), id$2)));
|
|
32250
32206
|
return;
|
|
32251
32207
|
case /* Defer */
|
|
32252
32208
|
6:
|
|
32253
|
-
const id$
|
|
32254
|
-
const path$2 = find_thread(hub_path, id$
|
|
32209
|
+
const id$3 = op._0;
|
|
32210
|
+
const path$2 = find_thread(hub_path, id$3);
|
|
32255
32211
|
if (path$2 !== void 0) {
|
|
32256
32212
|
const deferred_dir = Path.join(hub_path, "threads/deferred");
|
|
32257
32213
|
ensure_dir(deferred_dir);
|
|
@@ -32276,7 +32232,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32276
32232
|
const prim0$2 = Path.join(deferred_dir, Path.basename(path$2));
|
|
32277
32233
|
Fs.writeFileSync(prim0$2, prim1$1);
|
|
32278
32234
|
Fs.unlinkSync(path$2);
|
|
32279
|
-
|
|
32235
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
32280
32236
|
TAG: (
|
|
32281
32237
|
/* Format */
|
|
32282
32238
|
0
|
|
@@ -32313,7 +32269,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32313
32269
|
}
|
|
32314
32270
|
},
|
|
32315
32271
|
_1: "%s until:%s"
|
|
32316
|
-
}), id$
|
|
32272
|
+
}), id$3, until_str);
|
|
32317
32273
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
32318
32274
|
TAG: (
|
|
32319
32275
|
/* Format */
|
|
@@ -32341,7 +32297,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32341
32297
|
}
|
|
32342
32298
|
},
|
|
32343
32299
|
_1: "Deferred %s"
|
|
32344
|
-
}), id$
|
|
32300
|
+
}), id$3)));
|
|
32345
32301
|
return;
|
|
32346
32302
|
}
|
|
32347
32303
|
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -32371,15 +32327,14 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32371
32327
|
}
|
|
32372
32328
|
},
|
|
32373
32329
|
_1: "Thread not found for defer: %s"
|
|
32374
|
-
}), id$
|
|
32330
|
+
}), id$3)));
|
|
32375
32331
|
return;
|
|
32376
32332
|
case /* Delete */
|
|
32377
32333
|
7:
|
|
32378
|
-
const id$
|
|
32379
|
-
const path$3 = find_thread(hub_path, id$
|
|
32334
|
+
const id$4 = op._0;
|
|
32335
|
+
const path$3 = find_thread(hub_path, id$4);
|
|
32380
32336
|
if (path$3 !== void 0) {
|
|
32381
32337
|
Fs.unlinkSync(path$3);
|
|
32382
|
-
log_action(hub_path, "op.delete", id$5);
|
|
32383
32338
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
32384
32339
|
TAG: (
|
|
32385
32340
|
/* Format */
|
|
@@ -32407,9 +32362,9 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32407
32362
|
}
|
|
32408
32363
|
},
|
|
32409
32364
|
_1: "Deleted %s"
|
|
32410
|
-
}), id$
|
|
32365
|
+
}), id$4)));
|
|
32411
32366
|
} else {
|
|
32412
|
-
|
|
32367
|
+
Curry._1(Stdlib__Printf.sprintf({
|
|
32413
32368
|
TAG: (
|
|
32414
32369
|
/* Format */
|
|
32415
32370
|
0
|
|
@@ -32436,7 +32391,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32436
32391
|
}
|
|
32437
32392
|
},
|
|
32438
32393
|
_1: "%s (not found)"
|
|
32439
|
-
}), id$
|
|
32394
|
+
}), id$4);
|
|
32440
32395
|
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
32441
32396
|
TAG: (
|
|
32442
32397
|
/* Format */
|
|
@@ -32464,7 +32419,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32464
32419
|
}
|
|
32465
32420
|
},
|
|
32466
32421
|
_1: "Thread already gone: %s"
|
|
32467
|
-
}), id$
|
|
32422
|
+
}), id$4)));
|
|
32468
32423
|
}
|
|
32469
32424
|
return;
|
|
32470
32425
|
case /* Surface */
|
|
@@ -32613,7 +32568,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32613
32568
|
}), slug$1, name, (/* @__PURE__ */ new Date()).toISOString(), desc);
|
|
32614
32569
|
const prim0$3 = Path.join(dir, file_name$1);
|
|
32615
32570
|
Fs.writeFileSync(prim0$3, content$3);
|
|
32616
|
-
|
|
32571
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
32617
32572
|
TAG: (
|
|
32618
32573
|
/* Format */
|
|
32619
32574
|
0
|
|
@@ -32657,7 +32612,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
32657
32612
|
}
|
|
32658
32613
|
},
|
|
32659
32614
|
_1: "id:%s desc:%s"
|
|
32660
|
-
}), slug$1, desc)
|
|
32615
|
+
}), slug$1, desc);
|
|
32661
32616
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
32662
32617
|
TAG: (
|
|
32663
32618
|
/* Format */
|
|
@@ -32746,7 +32701,7 @@ function archive_io_pair(hub_path, name) {
|
|
|
32746
32701
|
}), ops);
|
|
32747
32702
|
Fs.unlinkSync(inp);
|
|
32748
32703
|
Fs.unlinkSync(outp);
|
|
32749
|
-
|
|
32704
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
32750
32705
|
TAG: (
|
|
32751
32706
|
/* Format */
|
|
32752
32707
|
0
|
|
@@ -32798,7 +32753,7 @@ function archive_io_pair(hub_path, name) {
|
|
|
32798
32753
|
}
|
|
32799
32754
|
},
|
|
32800
32755
|
_1: "trigger:%s ops:%d"
|
|
32801
|
-
}), trigger, Stdlib__List.length(ops))
|
|
32756
|
+
}), trigger, Stdlib__List.length(ops));
|
|
32802
32757
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
32803
32758
|
TAG: (
|
|
32804
32759
|
/* Format */
|
|
@@ -33014,7 +32969,7 @@ function feed_next_input(hub_path) {
|
|
|
33014
32969
|
return param[1];
|
|
33015
32970
|
}
|
|
33016
32971
|
}), meta), "unknown");
|
|
33017
|
-
|
|
32972
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
33018
32973
|
TAG: (
|
|
33019
32974
|
/* Format */
|
|
33020
32975
|
0
|
|
@@ -33058,7 +33013,7 @@ function feed_next_input(hub_path) {
|
|
|
33058
33013
|
}
|
|
33059
33014
|
},
|
|
33060
33015
|
_1: "id:%s from:%s"
|
|
33061
|
-
}), id, from)
|
|
33016
|
+
}), id, from);
|
|
33062
33017
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
33063
33018
|
TAG: (
|
|
33064
33019
|
/* Format */
|
|
@@ -33357,7 +33312,7 @@ function run_queue_clear(hub_path) {
|
|
|
33357
33312
|
const prim = Path.join(dir, file);
|
|
33358
33313
|
Fs.unlinkSync(prim);
|
|
33359
33314
|
}), items);
|
|
33360
|
-
|
|
33315
|
+
Curry._1(Stdlib__Printf.sprintf({
|
|
33361
33316
|
TAG: (
|
|
33362
33317
|
/* Format */
|
|
33363
33318
|
0
|
|
@@ -33392,7 +33347,7 @@ function run_queue_clear(hub_path) {
|
|
|
33392
33347
|
}
|
|
33393
33348
|
},
|
|
33394
33349
|
_1: "count:%d"
|
|
33395
|
-
}), Stdlib__List.length(items))
|
|
33350
|
+
}), Stdlib__List.length(items));
|
|
33396
33351
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
33397
33352
|
TAG: (
|
|
33398
33353
|
/* Format */
|
|
@@ -33584,7 +33539,7 @@ function run_mca_add(hub_path, name, description) {
|
|
|
33584
33539
|
_1: "---\nid: %s\nsurfaced-by: %s\ncreated: %s\nstatus: open\n---\n\n# MCA\n\n%s\n"
|
|
33585
33540
|
}), slug, name, (/* @__PURE__ */ new Date()).toISOString(), description);
|
|
33586
33541
|
Fs.writeFileSync(file_path, content);
|
|
33587
|
-
|
|
33542
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
33588
33543
|
TAG: (
|
|
33589
33544
|
/* Format */
|
|
33590
33545
|
0
|
|
@@ -33628,7 +33583,7 @@ function run_mca_add(hub_path, name, description) {
|
|
|
33628
33583
|
}
|
|
33629
33584
|
},
|
|
33630
33585
|
_1: "id:%s desc:%s"
|
|
33631
|
-
}), slug, description)
|
|
33586
|
+
}), slug, description);
|
|
33632
33587
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
33633
33588
|
TAG: (
|
|
33634
33589
|
/* Format */
|
|
@@ -35405,7 +35360,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
35405
35360
|
Fs.writeFileSync(inp, "");
|
|
35406
35361
|
Fs.writeFileSync(outp, "");
|
|
35407
35362
|
console.log(ok("State cleared"));
|
|
35408
|
-
|
|
35363
|
+
Curry._3(Stdlib__Printf.sprintf({
|
|
35409
35364
|
TAG: (
|
|
35410
35365
|
/* Format */
|
|
35411
35366
|
0
|
|
@@ -35466,7 +35421,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
35466
35421
|
}
|
|
35467
35422
|
},
|
|
35468
35423
|
_1: "id:%s gtd:%s run:%s"
|
|
35469
|
-
}), id, gtd_type, run_dir)
|
|
35424
|
+
}), id, gtd_type, run_dir);
|
|
35470
35425
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
35471
35426
|
TAG: (
|
|
35472
35427
|
/* Format */
|
|
@@ -35942,7 +35897,7 @@ function queue_mca_review(hub_path, name) {
|
|
|
35942
35897
|
return Stdlib__Option.value(param, arg);
|
|
35943
35898
|
})(Stdlib__Option.map(Stdlib__String.trim, exec_in(hub_path, "git rev-parse HEAD")));
|
|
35944
35899
|
queue_add(hub_path, trigger, "system", body);
|
|
35945
|
-
|
|
35900
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
35946
35901
|
TAG: (
|
|
35947
35902
|
/* Format */
|
|
35948
35903
|
0
|
|
@@ -35994,7 +35949,7 @@ function queue_mca_review(hub_path, name) {
|
|
|
35994
35949
|
}
|
|
35995
35950
|
},
|
|
35996
35951
|
_1: "trigger:%s count:%d"
|
|
35997
|
-
}), trigger, Stdlib__List.length(mcas))
|
|
35952
|
+
}), trigger, Stdlib__List.length(mcas));
|
|
35998
35953
|
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
35999
35954
|
TAG: (
|
|
36000
35955
|
/* Format */
|
|
@@ -36135,19 +36090,15 @@ function auto_save(hub_path, name) {
|
|
|
36135
36090
|
_1: 'git commit -m "%s"'
|
|
36136
36091
|
}), msg));
|
|
36137
36092
|
if (match2 !== void 0) {
|
|
36138
|
-
log_action(hub_path, "auto-save.commit", msg);
|
|
36139
36093
|
console.log(ok("Auto-committed changes"));
|
|
36140
36094
|
const match$1 = exec_in(hub_path, "git push");
|
|
36141
36095
|
if (match$1 !== void 0) {
|
|
36142
|
-
log_action(hub_path, "auto-save.push", "success");
|
|
36143
36096
|
console.log(ok("Auto-pushed to origin"));
|
|
36144
36097
|
} else {
|
|
36145
|
-
log_action(hub_path, "auto-save.push", "failed");
|
|
36146
36098
|
console.log(warn("Auto-push failed"));
|
|
36147
36099
|
}
|
|
36148
36100
|
return;
|
|
36149
36101
|
}
|
|
36150
|
-
log_action(hub_path, "auto-save.commit", "failed");
|
|
36151
36102
|
console.log(warn("Auto-commit failed"));
|
|
36152
36103
|
}
|
|
36153
36104
|
function run_inbound(hub_path, name) {
|
|
@@ -37127,7 +37078,7 @@ function run_peer_add(hub_path, peer_name, url) {
|
|
|
37127
37078
|
const prim1 = format_peers_md(updated);
|
|
37128
37079
|
const prim0 = Path.join(hub_path, "state/peers.md");
|
|
37129
37080
|
Fs.writeFileSync(prim0, prim1);
|
|
37130
|
-
|
|
37081
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
37131
37082
|
TAG: (
|
|
37132
37083
|
/* Format */
|
|
37133
37084
|
0
|
|
@@ -37171,7 +37122,7 @@ function run_peer_add(hub_path, peer_name, url) {
|
|
|
37171
37122
|
}
|
|
37172
37123
|
},
|
|
37173
37124
|
_1: "name:%s hub:%s"
|
|
37174
|
-
}), peer_name, url)
|
|
37125
|
+
}), peer_name, url);
|
|
37175
37126
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
37176
37127
|
TAG: (
|
|
37177
37128
|
/* Format */
|
|
@@ -37243,7 +37194,6 @@ function run_peer_remove(hub_path, peer_name) {
|
|
|
37243
37194
|
const prim1 = format_peers_md(updated);
|
|
37244
37195
|
const prim0 = Path.join(hub_path, "state/peers.md");
|
|
37245
37196
|
Fs.writeFileSync(prim0, prim1);
|
|
37246
|
-
log_action(hub_path, "peer.remove", peer_name);
|
|
37247
37197
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
37248
37198
|
TAG: (
|
|
37249
37199
|
/* Format */
|
|
@@ -37520,7 +37470,7 @@ function inbox_flush(hub_path, _name) {
|
|
|
37520
37470
|
const prim0 = Path.join(archived_dir, file);
|
|
37521
37471
|
Fs.writeFileSync(prim0, prim1);
|
|
37522
37472
|
Fs.unlinkSync(file_path);
|
|
37523
|
-
|
|
37473
|
+
Curry._2(Stdlib__Printf.sprintf({
|
|
37524
37474
|
TAG: (
|
|
37525
37475
|
/* Format */
|
|
37526
37476
|
0
|
|
@@ -37564,7 +37514,7 @@ function inbox_flush(hub_path, _name) {
|
|
|
37564
37514
|
}
|
|
37565
37515
|
},
|
|
37566
37516
|
_1: "branch:%s file:%s"
|
|
37567
|
-
}), branch, file)
|
|
37517
|
+
}), branch, file);
|
|
37568
37518
|
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
37569
37519
|
TAG: (
|
|
37570
37520
|
/* Format */
|
|
@@ -37646,6 +37596,176 @@ function inbox_flush(hub_path, _name) {
|
|
|
37646
37596
|
}
|
|
37647
37597
|
console.log(ok("Inbox empty"));
|
|
37648
37598
|
}
|
|
37599
|
+
function run_setup(hub_path) {
|
|
37600
|
+
const s = exec("id -u");
|
|
37601
|
+
const uid = s !== void 0 ? Stdlib__String.trim(s) : "unknown";
|
|
37602
|
+
if (uid !== "0") {
|
|
37603
|
+
console.log(fail("Setup requires root. Run: sudo cn setup"));
|
|
37604
|
+
process.exit(1);
|
|
37605
|
+
}
|
|
37606
|
+
console.log(color("36", "Setting up cn system components..."));
|
|
37607
|
+
const logrotate_path = "/etc/logrotate.d/cn";
|
|
37608
|
+
Fs.writeFileSync(logrotate_path, "/var/log/cn-*.log {\n daily\n rotate 7\n compress\n missingok\n notifempty\n}\n");
|
|
37609
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
37610
|
+
TAG: (
|
|
37611
|
+
/* Format */
|
|
37612
|
+
0
|
|
37613
|
+
),
|
|
37614
|
+
_0: {
|
|
37615
|
+
TAG: (
|
|
37616
|
+
/* String_literal */
|
|
37617
|
+
11
|
|
37618
|
+
),
|
|
37619
|
+
_0: "Created ",
|
|
37620
|
+
_1: {
|
|
37621
|
+
TAG: (
|
|
37622
|
+
/* String */
|
|
37623
|
+
2
|
|
37624
|
+
),
|
|
37625
|
+
_0: (
|
|
37626
|
+
/* No_padding */
|
|
37627
|
+
0
|
|
37628
|
+
),
|
|
37629
|
+
_1: (
|
|
37630
|
+
/* End_of_format */
|
|
37631
|
+
0
|
|
37632
|
+
)
|
|
37633
|
+
}
|
|
37634
|
+
},
|
|
37635
|
+
_1: "Created %s"
|
|
37636
|
+
}), logrotate_path)));
|
|
37637
|
+
const cron_line = Curry._1(Stdlib__Printf.sprintf({
|
|
37638
|
+
TAG: (
|
|
37639
|
+
/* Format */
|
|
37640
|
+
0
|
|
37641
|
+
),
|
|
37642
|
+
_0: {
|
|
37643
|
+
TAG: (
|
|
37644
|
+
/* String_literal */
|
|
37645
|
+
11
|
|
37646
|
+
),
|
|
37647
|
+
_0: "*/5 * * * * cn-cron ",
|
|
37648
|
+
_1: {
|
|
37649
|
+
TAG: (
|
|
37650
|
+
/* String */
|
|
37651
|
+
2
|
|
37652
|
+
),
|
|
37653
|
+
_0: (
|
|
37654
|
+
/* No_padding */
|
|
37655
|
+
0
|
|
37656
|
+
),
|
|
37657
|
+
_1: (
|
|
37658
|
+
/* End_of_format */
|
|
37659
|
+
0
|
|
37660
|
+
)
|
|
37661
|
+
}
|
|
37662
|
+
},
|
|
37663
|
+
_1: "*/5 * * * * cn-cron %s"
|
|
37664
|
+
}), hub_path);
|
|
37665
|
+
const cmd2 = Curry._1(Stdlib__Printf.sprintf({
|
|
37666
|
+
TAG: (
|
|
37667
|
+
/* Format */
|
|
37668
|
+
0
|
|
37669
|
+
),
|
|
37670
|
+
_0: {
|
|
37671
|
+
TAG: (
|
|
37672
|
+
/* String_literal */
|
|
37673
|
+
11
|
|
37674
|
+
),
|
|
37675
|
+
_0: "echo '",
|
|
37676
|
+
_1: {
|
|
37677
|
+
TAG: (
|
|
37678
|
+
/* String */
|
|
37679
|
+
2
|
|
37680
|
+
),
|
|
37681
|
+
_0: (
|
|
37682
|
+
/* No_padding */
|
|
37683
|
+
0
|
|
37684
|
+
),
|
|
37685
|
+
_1: {
|
|
37686
|
+
TAG: (
|
|
37687
|
+
/* String_literal */
|
|
37688
|
+
11
|
|
37689
|
+
),
|
|
37690
|
+
_0: "' | crontab -",
|
|
37691
|
+
_1: (
|
|
37692
|
+
/* End_of_format */
|
|
37693
|
+
0
|
|
37694
|
+
)
|
|
37695
|
+
}
|
|
37696
|
+
}
|
|
37697
|
+
},
|
|
37698
|
+
_1: "echo '%s' | crontab -"
|
|
37699
|
+
}), cron_line);
|
|
37700
|
+
const match2 = exec(cmd2);
|
|
37701
|
+
if (match2 !== void 0) {
|
|
37702
|
+
console.log(ok("Crontab configured"));
|
|
37703
|
+
} else {
|
|
37704
|
+
console.log(warn("Crontab update failed - configure manually"));
|
|
37705
|
+
}
|
|
37706
|
+
console.log("");
|
|
37707
|
+
console.log(ok("Setup complete!"));
|
|
37708
|
+
console.log("");
|
|
37709
|
+
console.log("Configured:");
|
|
37710
|
+
console.log(Curry._1(Stdlib__Printf.sprintf({
|
|
37711
|
+
TAG: (
|
|
37712
|
+
/* Format */
|
|
37713
|
+
0
|
|
37714
|
+
),
|
|
37715
|
+
_0: {
|
|
37716
|
+
TAG: (
|
|
37717
|
+
/* String_literal */
|
|
37718
|
+
11
|
|
37719
|
+
),
|
|
37720
|
+
_0: " \xE2\x80\xA2 Logrotate: ",
|
|
37721
|
+
_1: {
|
|
37722
|
+
TAG: (
|
|
37723
|
+
/* String */
|
|
37724
|
+
2
|
|
37725
|
+
),
|
|
37726
|
+
_0: (
|
|
37727
|
+
/* No_padding */
|
|
37728
|
+
0
|
|
37729
|
+
),
|
|
37730
|
+
_1: (
|
|
37731
|
+
/* End_of_format */
|
|
37732
|
+
0
|
|
37733
|
+
)
|
|
37734
|
+
}
|
|
37735
|
+
},
|
|
37736
|
+
_1: " \xE2\x80\xA2 Logrotate: %s"
|
|
37737
|
+
}), logrotate_path));
|
|
37738
|
+
console.log(Curry._1(Stdlib__Printf.sprintf({
|
|
37739
|
+
TAG: (
|
|
37740
|
+
/* Format */
|
|
37741
|
+
0
|
|
37742
|
+
),
|
|
37743
|
+
_0: {
|
|
37744
|
+
TAG: (
|
|
37745
|
+
/* String_literal */
|
|
37746
|
+
11
|
|
37747
|
+
),
|
|
37748
|
+
_0: " \xE2\x80\xA2 Cron: */5 * * * * cn-cron ",
|
|
37749
|
+
_1: {
|
|
37750
|
+
TAG: (
|
|
37751
|
+
/* String */
|
|
37752
|
+
2
|
|
37753
|
+
),
|
|
37754
|
+
_0: (
|
|
37755
|
+
/* No_padding */
|
|
37756
|
+
0
|
|
37757
|
+
),
|
|
37758
|
+
_1: (
|
|
37759
|
+
/* End_of_format */
|
|
37760
|
+
0
|
|
37761
|
+
)
|
|
37762
|
+
}
|
|
37763
|
+
},
|
|
37764
|
+
_1: " \xE2\x80\xA2 Cron: */5 * * * * cn-cron %s"
|
|
37765
|
+
}), hub_path));
|
|
37766
|
+
console.log("");
|
|
37767
|
+
console.log("Logs will be written to: /var/log/cn-YYYYMMDD.log");
|
|
37768
|
+
}
|
|
37649
37769
|
function update_cron(hub_path) {
|
|
37650
37770
|
const cron_line = Curry._1(Stdlib__Printf.sprintf({
|
|
37651
37771
|
TAG: (
|
|
@@ -38125,6 +38245,10 @@ if (cmd !== void 0) {
|
|
|
38125
38245
|
10:
|
|
38126
38246
|
run_weekly(hub_path$1);
|
|
38127
38247
|
break;
|
|
38248
|
+
case /* Setup */
|
|
38249
|
+
11:
|
|
38250
|
+
run_setup(hub_path$1);
|
|
38251
|
+
break;
|
|
38128
38252
|
}
|
|
38129
38253
|
} else {
|
|
38130
38254
|
switch (cmd.TAG) {
|
|
@@ -38409,6 +38533,7 @@ module.exports = {
|
|
|
38409
38533
|
run_peer_remove,
|
|
38410
38534
|
run_peer_sync,
|
|
38411
38535
|
inbox_flush,
|
|
38536
|
+
run_setup,
|
|
38412
38537
|
update_cron,
|
|
38413
38538
|
run_update,
|
|
38414
38539
|
run_update_with_cron,
|