cnagent 2.2.10 → 2.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -14
- package/package.json +1 -1
- package/tools/dist/cn.js +1649 -655
- package/tools/dist/inbox.js +205 -55
package/tools/dist/cn.js
CHANGED
|
@@ -12705,15 +12705,15 @@ var require_cn_lib = __commonJS({
|
|
|
12705
12705
|
}
|
|
12706
12706
|
;
|
|
12707
12707
|
}
|
|
12708
|
-
function get_flag(key,
|
|
12708
|
+
function get_flag(key, flags2) {
|
|
12709
12709
|
return Stdlib__List2.find_map((function(param) {
|
|
12710
12710
|
if (Caml_obj.caml_equal(param[0], key)) {
|
|
12711
12711
|
return Caml_option2.some(param[1]);
|
|
12712
12712
|
}
|
|
12713
|
-
}),
|
|
12713
|
+
}), flags2);
|
|
12714
12714
|
}
|
|
12715
12715
|
function parse_out_cmd(args2) {
|
|
12716
|
-
const
|
|
12716
|
+
const flags2 = parse_flags_from_args(
|
|
12717
12717
|
/* [] */
|
|
12718
12718
|
0,
|
|
12719
12719
|
args2
|
|
@@ -12731,7 +12731,7 @@ var require_cn_lib = __commonJS({
|
|
|
12731
12731
|
),
|
|
12732
12732
|
reason: r
|
|
12733
12733
|
};
|
|
12734
|
-
}), get_flag("reason",
|
|
12734
|
+
}), get_flag("reason", flags2));
|
|
12735
12735
|
case "delegate":
|
|
12736
12736
|
return Stdlib__Option2.map((function(t) {
|
|
12737
12737
|
return {
|
|
@@ -12741,7 +12741,7 @@ var require_cn_lib = __commonJS({
|
|
|
12741
12741
|
),
|
|
12742
12742
|
to_: t
|
|
12743
12743
|
};
|
|
12744
|
-
}), get_flag("to",
|
|
12744
|
+
}), get_flag("to", flags2));
|
|
12745
12745
|
case "delete":
|
|
12746
12746
|
return Stdlib__Option2.map((function(r) {
|
|
12747
12747
|
return {
|
|
@@ -12751,7 +12751,7 @@ var require_cn_lib = __commonJS({
|
|
|
12751
12751
|
),
|
|
12752
12752
|
reason: r
|
|
12753
12753
|
};
|
|
12754
|
-
}), get_flag("reason",
|
|
12754
|
+
}), get_flag("reason", flags2));
|
|
12755
12755
|
case "do":
|
|
12756
12756
|
const match2 = args2.tl;
|
|
12757
12757
|
if (!match2) {
|
|
@@ -12773,9 +12773,9 @@ var require_cn_lib = __commonJS({
|
|
|
12773
12773
|
artifact: a
|
|
12774
12774
|
}
|
|
12775
12775
|
};
|
|
12776
|
-
}), get_flag("artifact",
|
|
12776
|
+
}), get_flag("artifact", flags2));
|
|
12777
12777
|
case "noop":
|
|
12778
|
-
const r = get_flag("reason",
|
|
12778
|
+
const r = get_flag("reason", flags2);
|
|
12779
12779
|
if (r === void 0) {
|
|
12780
12780
|
return;
|
|
12781
12781
|
}
|
|
@@ -12836,10 +12836,10 @@ var require_cn_lib = __commonJS({
|
|
|
12836
12836
|
message: m
|
|
12837
12837
|
}
|
|
12838
12838
|
};
|
|
12839
|
-
}), get_flag("message",
|
|
12839
|
+
}), get_flag("message", flags2));
|
|
12840
12840
|
case "send":
|
|
12841
|
-
const match$1 = get_flag("to",
|
|
12842
|
-
const match$2 = get_flag("message",
|
|
12841
|
+
const match$1 = get_flag("to", flags2);
|
|
12842
|
+
const match$2 = get_flag("message", flags2);
|
|
12843
12843
|
if (match$1 !== void 0 && match$2 !== void 0) {
|
|
12844
12844
|
return {
|
|
12845
12845
|
TAG: (
|
|
@@ -12873,7 +12873,7 @@ var require_cn_lib = __commonJS({
|
|
|
12873
12873
|
desc: d
|
|
12874
12874
|
}
|
|
12875
12875
|
};
|
|
12876
|
-
}), get_flag("desc",
|
|
12876
|
+
}), get_flag("desc", flags2));
|
|
12877
12877
|
default:
|
|
12878
12878
|
return;
|
|
12879
12879
|
}
|
|
@@ -13239,10 +13239,10 @@ var require_cn_lib = __commonJS({
|
|
|
13239
13239
|
while (true) {
|
|
13240
13240
|
const param = _param;
|
|
13241
13241
|
const remaining = _remaining;
|
|
13242
|
-
const
|
|
13242
|
+
const flags2 = _flags;
|
|
13243
13243
|
if (!param) {
|
|
13244
13244
|
return [
|
|
13245
|
-
|
|
13245
|
+
flags2,
|
|
13246
13246
|
Stdlib__List2.rev(remaining)
|
|
13247
13247
|
];
|
|
13248
13248
|
}
|
|
@@ -13252,9 +13252,9 @@ var require_cn_lib = __commonJS({
|
|
|
13252
13252
|
case "--dry-run":
|
|
13253
13253
|
_param = param.tl;
|
|
13254
13254
|
_flags = {
|
|
13255
|
-
json:
|
|
13256
|
-
quiet:
|
|
13257
|
-
verbose:
|
|
13255
|
+
json: flags2.json,
|
|
13256
|
+
quiet: flags2.quiet,
|
|
13257
|
+
verbose: flags2.verbose,
|
|
13258
13258
|
dry_run: true
|
|
13259
13259
|
};
|
|
13260
13260
|
continue;
|
|
@@ -13262,9 +13262,9 @@ var require_cn_lib = __commonJS({
|
|
|
13262
13262
|
_param = param.tl;
|
|
13263
13263
|
_flags = {
|
|
13264
13264
|
json: true,
|
|
13265
|
-
quiet:
|
|
13266
|
-
verbose:
|
|
13267
|
-
dry_run:
|
|
13265
|
+
quiet: flags2.quiet,
|
|
13266
|
+
verbose: flags2.verbose,
|
|
13267
|
+
dry_run: flags2.dry_run
|
|
13268
13268
|
};
|
|
13269
13269
|
continue;
|
|
13270
13270
|
case "--quiet":
|
|
@@ -13287,19 +13287,19 @@ var require_cn_lib = __commonJS({
|
|
|
13287
13287
|
case 1:
|
|
13288
13288
|
_param = param.tl;
|
|
13289
13289
|
_flags = {
|
|
13290
|
-
json:
|
|
13290
|
+
json: flags2.json,
|
|
13291
13291
|
quiet: true,
|
|
13292
|
-
verbose:
|
|
13293
|
-
dry_run:
|
|
13292
|
+
verbose: flags2.verbose,
|
|
13293
|
+
dry_run: flags2.dry_run
|
|
13294
13294
|
};
|
|
13295
13295
|
continue;
|
|
13296
13296
|
case 2:
|
|
13297
13297
|
_param = param.tl;
|
|
13298
13298
|
_flags = {
|
|
13299
|
-
json:
|
|
13300
|
-
quiet:
|
|
13299
|
+
json: flags2.json,
|
|
13300
|
+
quiet: flags2.quiet,
|
|
13301
13301
|
verbose: true,
|
|
13302
|
-
dry_run:
|
|
13302
|
+
dry_run: flags2.dry_run
|
|
13303
13303
|
};
|
|
13304
13304
|
continue;
|
|
13305
13305
|
}
|
|
@@ -13618,7 +13618,7 @@ var require_cn_lib = __commonJS({
|
|
|
13618
13618
|
);
|
|
13619
13619
|
}
|
|
13620
13620
|
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 # 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";
|
|
13621
|
-
var version = "2.2.
|
|
13621
|
+
var version = "2.2.11";
|
|
13622
13622
|
module2.exports = {
|
|
13623
13623
|
starts_with,
|
|
13624
13624
|
strip_prefix,
|
|
@@ -26354,6 +26354,10 @@ var Child_process$1 = {
|
|
|
26354
26354
|
exec
|
|
26355
26355
|
};
|
|
26356
26356
|
var Json = {};
|
|
26357
|
+
var Str = {};
|
|
26358
|
+
var check = String.fromCodePoint(10003);
|
|
26359
|
+
var cross = String.fromCodePoint(10007);
|
|
26360
|
+
var warning = String.fromCodePoint(9888);
|
|
26357
26361
|
function now_iso(param) {
|
|
26358
26362
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
26359
26363
|
}
|
|
@@ -26435,13 +26439,30 @@ function dim(param) {
|
|
|
26435
26439
|
return color("2", param);
|
|
26436
26440
|
}
|
|
26437
26441
|
function ok(msg) {
|
|
26438
|
-
return color("32", "
|
|
26442
|
+
return color("32", check + " ") + msg;
|
|
26439
26443
|
}
|
|
26440
26444
|
function fail(msg) {
|
|
26441
|
-
return color("31", "
|
|
26445
|
+
return color("31", cross + " ") + msg;
|
|
26442
26446
|
}
|
|
26443
26447
|
function warn(msg) {
|
|
26444
|
-
return color("33", "
|
|
26448
|
+
return color("33", warning + " ") + msg;
|
|
26449
|
+
}
|
|
26450
|
+
var dry_run_mode = {
|
|
26451
|
+
contents: false
|
|
26452
|
+
};
|
|
26453
|
+
function would(msg) {
|
|
26454
|
+
if (dry_run_mode.contents) {
|
|
26455
|
+
console.log(color("2", "Would: " + msg));
|
|
26456
|
+
return true;
|
|
26457
|
+
} else {
|
|
26458
|
+
return false;
|
|
26459
|
+
}
|
|
26460
|
+
}
|
|
26461
|
+
function dry_run_banner(param) {
|
|
26462
|
+
if (dry_run_mode.contents) {
|
|
26463
|
+
console.log(warn("DRY RUN \xE2\x80\x94 no changes will be made"));
|
|
26464
|
+
return;
|
|
26465
|
+
}
|
|
26445
26466
|
}
|
|
26446
26467
|
function find_hub_path(_dir) {
|
|
26447
26468
|
while (true) {
|
|
@@ -26493,24 +26514,105 @@ function split_lines(s) {
|
|
|
26493
26514
|
s
|
|
26494
26515
|
));
|
|
26495
26516
|
}
|
|
26496
|
-
function
|
|
26497
|
-
return
|
|
26498
|
-
|
|
26499
|
-
|
|
26500
|
-
|
|
26501
|
-
|
|
26502
|
-
|
|
26503
|
-
|
|
26517
|
+
function slugify(s) {
|
|
26518
|
+
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
26519
|
+
}
|
|
26520
|
+
function threads_in(hub) {
|
|
26521
|
+
return Path.join(hub, "threads/in");
|
|
26522
|
+
}
|
|
26523
|
+
function threads_mail_inbox(hub) {
|
|
26524
|
+
return Path.join(hub, "threads/mail/inbox");
|
|
26525
|
+
}
|
|
26526
|
+
function threads_mail_outbox(hub) {
|
|
26527
|
+
return Path.join(hub, "threads/mail/outbox");
|
|
26528
|
+
}
|
|
26529
|
+
function threads_mail_sent(hub) {
|
|
26530
|
+
return Path.join(hub, "threads/mail/sent");
|
|
26531
|
+
}
|
|
26532
|
+
function threads_reflections_daily(hub) {
|
|
26533
|
+
return Path.join(hub, "threads/reflections/daily");
|
|
26534
|
+
}
|
|
26535
|
+
function threads_adhoc(hub) {
|
|
26536
|
+
return Path.join(hub, "threads/adhoc");
|
|
26537
|
+
}
|
|
26538
|
+
function timestamp_slug(param) {
|
|
26539
|
+
const iso = (/* @__PURE__ */ new Date()).toISOString();
|
|
26540
|
+
const date = Stdlib__String.concat("", Stdlib__String.split_on_char(
|
|
26541
|
+
/* '-' */
|
|
26542
|
+
45,
|
|
26543
|
+
Stdlib__String.sub(iso, 0, 10)
|
|
26544
|
+
));
|
|
26545
|
+
const time = Stdlib__String.concat("", Stdlib__String.split_on_char(
|
|
26546
|
+
/* ':' */
|
|
26547
|
+
58,
|
|
26548
|
+
Stdlib__String.sub(iso, 11, 8)
|
|
26549
|
+
));
|
|
26550
|
+
return Curry._2(Stdlib__Printf.sprintf({
|
|
26551
|
+
TAG: (
|
|
26552
|
+
/* Format */
|
|
26553
|
+
0
|
|
26554
|
+
),
|
|
26555
|
+
_0: {
|
|
26504
26556
|
TAG: (
|
|
26505
|
-
/*
|
|
26557
|
+
/* String */
|
|
26558
|
+
2
|
|
26559
|
+
),
|
|
26560
|
+
_0: (
|
|
26561
|
+
/* No_padding */
|
|
26506
26562
|
0
|
|
26507
26563
|
),
|
|
26508
|
-
|
|
26564
|
+
_1: {
|
|
26509
26565
|
TAG: (
|
|
26510
|
-
/*
|
|
26511
|
-
|
|
26566
|
+
/* Char_literal */
|
|
26567
|
+
12
|
|
26568
|
+
),
|
|
26569
|
+
_0: (
|
|
26570
|
+
/* '-' */
|
|
26571
|
+
45
|
|
26572
|
+
),
|
|
26573
|
+
_1: {
|
|
26574
|
+
TAG: (
|
|
26575
|
+
/* String */
|
|
26576
|
+
2
|
|
26577
|
+
),
|
|
26578
|
+
_0: (
|
|
26579
|
+
/* No_padding */
|
|
26580
|
+
0
|
|
26581
|
+
),
|
|
26582
|
+
_1: (
|
|
26583
|
+
/* End_of_format */
|
|
26584
|
+
0
|
|
26585
|
+
)
|
|
26586
|
+
}
|
|
26587
|
+
}
|
|
26588
|
+
},
|
|
26589
|
+
_1: "%s-%s"
|
|
26590
|
+
}), date, time);
|
|
26591
|
+
}
|
|
26592
|
+
function make_thread_filename(slug) {
|
|
26593
|
+
return Curry._2(Stdlib__Printf.sprintf({
|
|
26594
|
+
TAG: (
|
|
26595
|
+
/* Format */
|
|
26596
|
+
0
|
|
26597
|
+
),
|
|
26598
|
+
_0: {
|
|
26599
|
+
TAG: (
|
|
26600
|
+
/* String */
|
|
26601
|
+
2
|
|
26602
|
+
),
|
|
26603
|
+
_0: (
|
|
26604
|
+
/* No_padding */
|
|
26605
|
+
0
|
|
26606
|
+
),
|
|
26607
|
+
_1: {
|
|
26608
|
+
TAG: (
|
|
26609
|
+
/* Char_literal */
|
|
26610
|
+
12
|
|
26611
|
+
),
|
|
26612
|
+
_0: (
|
|
26613
|
+
/* '-' */
|
|
26614
|
+
45
|
|
26512
26615
|
),
|
|
26513
|
-
_0: "git branch -r | grep 'origin/",
|
|
26514
26616
|
_1: {
|
|
26515
26617
|
TAG: (
|
|
26516
26618
|
/* String */
|
|
@@ -26525,24 +26627,20 @@ function get_peer_branches(hub_path, peer_name) {
|
|
|
26525
26627
|
/* String_literal */
|
|
26526
26628
|
11
|
|
26527
26629
|
),
|
|
26528
|
-
_0: "
|
|
26630
|
+
_0: ".md",
|
|
26529
26631
|
_1: (
|
|
26530
26632
|
/* End_of_format */
|
|
26531
26633
|
0
|
|
26532
26634
|
)
|
|
26533
26635
|
}
|
|
26534
26636
|
}
|
|
26535
|
-
}
|
|
26536
|
-
|
|
26537
|
-
|
|
26538
|
-
|
|
26539
|
-
0
|
|
26540
|
-
));
|
|
26637
|
+
}
|
|
26638
|
+
},
|
|
26639
|
+
_1: "%s-%s.md"
|
|
26640
|
+
}), timestamp_slug(void 0), slug);
|
|
26541
26641
|
}
|
|
26542
|
-
function
|
|
26543
|
-
|
|
26544
|
-
const peers = load_peers(hub_path);
|
|
26545
|
-
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
26642
|
+
function delete_remote_branch(hub_path, branch) {
|
|
26643
|
+
if (would(Curry._1(Stdlib__Printf.sprintf({
|
|
26546
26644
|
TAG: (
|
|
26547
26645
|
/* Format */
|
|
26548
26646
|
0
|
|
@@ -26552,7 +26650,37 @@ function inbox_check(hub_path, name) {
|
|
|
26552
26650
|
/* String_literal */
|
|
26553
26651
|
11
|
|
26554
26652
|
),
|
|
26555
|
-
_0: "
|
|
26653
|
+
_0: "delete remote branch ",
|
|
26654
|
+
_1: {
|
|
26655
|
+
TAG: (
|
|
26656
|
+
/* String */
|
|
26657
|
+
2
|
|
26658
|
+
),
|
|
26659
|
+
_0: (
|
|
26660
|
+
/* No_padding */
|
|
26661
|
+
0
|
|
26662
|
+
),
|
|
26663
|
+
_1: (
|
|
26664
|
+
/* End_of_format */
|
|
26665
|
+
0
|
|
26666
|
+
)
|
|
26667
|
+
}
|
|
26668
|
+
},
|
|
26669
|
+
_1: "delete remote branch %s"
|
|
26670
|
+
}), branch))) {
|
|
26671
|
+
return true;
|
|
26672
|
+
}
|
|
26673
|
+
const cmd2 = Curry._1(Stdlib__Printf.sprintf({
|
|
26674
|
+
TAG: (
|
|
26675
|
+
/* Format */
|
|
26676
|
+
0
|
|
26677
|
+
),
|
|
26678
|
+
_0: {
|
|
26679
|
+
TAG: (
|
|
26680
|
+
/* String_literal */
|
|
26681
|
+
11
|
|
26682
|
+
),
|
|
26683
|
+
_0: "git push origin --delete ",
|
|
26556
26684
|
_1: {
|
|
26557
26685
|
TAG: (
|
|
26558
26686
|
/* String */
|
|
@@ -26567,7 +26695,7 @@ function inbox_check(hub_path, name) {
|
|
|
26567
26695
|
/* String_literal */
|
|
26568
26696
|
11
|
|
26569
26697
|
),
|
|
26570
|
-
_0: "
|
|
26698
|
+
_0: " 2>/dev/null",
|
|
26571
26699
|
_1: (
|
|
26572
26700
|
/* End_of_format */
|
|
26573
26701
|
0
|
|
@@ -26575,26 +26703,71 @@ function inbox_check(hub_path, name) {
|
|
|
26575
26703
|
}
|
|
26576
26704
|
}
|
|
26577
26705
|
},
|
|
26578
|
-
_1: "
|
|
26579
|
-
}),
|
|
26580
|
-
const
|
|
26581
|
-
|
|
26582
|
-
|
|
26583
|
-
|
|
26584
|
-
|
|
26585
|
-
|
|
26586
|
-
|
|
26587
|
-
|
|
26706
|
+
_1: "git push origin --delete %s 2>/dev/null"
|
|
26707
|
+
}), branch);
|
|
26708
|
+
const match2 = exec_in(hub_path, cmd2);
|
|
26709
|
+
if (match2 !== void 0) {
|
|
26710
|
+
log_action(hub_path, "branch.delete", branch);
|
|
26711
|
+
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
26712
|
+
TAG: (
|
|
26713
|
+
/* Format */
|
|
26714
|
+
0
|
|
26715
|
+
),
|
|
26716
|
+
_0: {
|
|
26588
26717
|
TAG: (
|
|
26589
|
-
/*
|
|
26718
|
+
/* String_literal */
|
|
26719
|
+
11
|
|
26720
|
+
),
|
|
26721
|
+
_0: " Deleted remote: ",
|
|
26722
|
+
_1: {
|
|
26723
|
+
TAG: (
|
|
26724
|
+
/* String */
|
|
26725
|
+
2
|
|
26726
|
+
),
|
|
26727
|
+
_0: (
|
|
26728
|
+
/* No_padding */
|
|
26729
|
+
0
|
|
26730
|
+
),
|
|
26731
|
+
_1: (
|
|
26732
|
+
/* End_of_format */
|
|
26733
|
+
0
|
|
26734
|
+
)
|
|
26735
|
+
}
|
|
26736
|
+
},
|
|
26737
|
+
_1: " Deleted remote: %s"
|
|
26738
|
+
}), branch)));
|
|
26739
|
+
return true;
|
|
26740
|
+
} else {
|
|
26741
|
+
return false;
|
|
26742
|
+
}
|
|
26743
|
+
}
|
|
26744
|
+
function is_orphan_branch(hub_path, branch) {
|
|
26745
|
+
const cmd2 = Curry._2(Stdlib__Printf.sprintf({
|
|
26746
|
+
TAG: (
|
|
26747
|
+
/* Format */
|
|
26748
|
+
0
|
|
26749
|
+
),
|
|
26750
|
+
_0: {
|
|
26751
|
+
TAG: (
|
|
26752
|
+
/* String_literal */
|
|
26753
|
+
11
|
|
26754
|
+
),
|
|
26755
|
+
_0: "git merge-base main origin/",
|
|
26756
|
+
_1: {
|
|
26757
|
+
TAG: (
|
|
26758
|
+
/* String */
|
|
26759
|
+
2
|
|
26760
|
+
),
|
|
26761
|
+
_0: (
|
|
26762
|
+
/* No_padding */
|
|
26590
26763
|
0
|
|
26591
26764
|
),
|
|
26592
|
-
|
|
26765
|
+
_1: {
|
|
26593
26766
|
TAG: (
|
|
26594
26767
|
/* String_literal */
|
|
26595
26768
|
11
|
|
26596
26769
|
),
|
|
26597
|
-
_0: "
|
|
26770
|
+
_0: " 2>/dev/null || git merge-base master origin/",
|
|
26598
26771
|
_1: {
|
|
26599
26772
|
TAG: (
|
|
26600
26773
|
/* String */
|
|
@@ -26609,30 +26782,78 @@ function inbox_check(hub_path, name) {
|
|
|
26609
26782
|
/* String_literal */
|
|
26610
26783
|
11
|
|
26611
26784
|
),
|
|
26612
|
-
_0: "
|
|
26785
|
+
_0: " 2>/dev/null",
|
|
26786
|
+
_1: (
|
|
26787
|
+
/* End_of_format */
|
|
26788
|
+
0
|
|
26789
|
+
)
|
|
26790
|
+
}
|
|
26791
|
+
}
|
|
26792
|
+
}
|
|
26793
|
+
}
|
|
26794
|
+
},
|
|
26795
|
+
_1: "git merge-base main origin/%s 2>/dev/null || git merge-base master origin/%s 2>/dev/null"
|
|
26796
|
+
}), branch, branch);
|
|
26797
|
+
const match2 = exec_in(hub_path, cmd2);
|
|
26798
|
+
return match2 === void 0;
|
|
26799
|
+
}
|
|
26800
|
+
function get_branch_author(hub_path, branch) {
|
|
26801
|
+
const cmd2 = Curry._1(Stdlib__Printf.sprintf({
|
|
26802
|
+
TAG: (
|
|
26803
|
+
/* Format */
|
|
26804
|
+
0
|
|
26805
|
+
),
|
|
26806
|
+
_0: {
|
|
26807
|
+
TAG: (
|
|
26808
|
+
/* String_literal */
|
|
26809
|
+
11
|
|
26810
|
+
),
|
|
26811
|
+
_0: "git log -1 --format='",
|
|
26812
|
+
_1: {
|
|
26813
|
+
TAG: (
|
|
26814
|
+
/* Char_literal */
|
|
26815
|
+
12
|
|
26816
|
+
),
|
|
26817
|
+
_0: (
|
|
26818
|
+
/* '%' */
|
|
26819
|
+
37
|
|
26820
|
+
),
|
|
26821
|
+
_1: {
|
|
26822
|
+
TAG: (
|
|
26823
|
+
/* String_literal */
|
|
26824
|
+
11
|
|
26825
|
+
),
|
|
26826
|
+
_0: "an <",
|
|
26827
|
+
_1: {
|
|
26828
|
+
TAG: (
|
|
26829
|
+
/* Char_literal */
|
|
26830
|
+
12
|
|
26831
|
+
),
|
|
26832
|
+
_0: (
|
|
26833
|
+
/* '%' */
|
|
26834
|
+
37
|
|
26835
|
+
),
|
|
26836
|
+
_1: {
|
|
26837
|
+
TAG: (
|
|
26838
|
+
/* String_literal */
|
|
26839
|
+
11
|
|
26840
|
+
),
|
|
26841
|
+
_0: "ae>' origin/",
|
|
26613
26842
|
_1: {
|
|
26614
26843
|
TAG: (
|
|
26615
|
-
/*
|
|
26616
|
-
|
|
26844
|
+
/* String */
|
|
26845
|
+
2
|
|
26617
26846
|
),
|
|
26618
26847
|
_0: (
|
|
26619
|
-
/* Int_d */
|
|
26620
|
-
0
|
|
26621
|
-
),
|
|
26622
|
-
_1: (
|
|
26623
26848
|
/* No_padding */
|
|
26624
26849
|
0
|
|
26625
26850
|
),
|
|
26626
|
-
|
|
26627
|
-
/* No_precision */
|
|
26628
|
-
0
|
|
26629
|
-
),
|
|
26630
|
-
_3: {
|
|
26851
|
+
_1: {
|
|
26631
26852
|
TAG: (
|
|
26632
26853
|
/* String_literal */
|
|
26633
26854
|
11
|
|
26634
26855
|
),
|
|
26635
|
-
_0: "
|
|
26856
|
+
_0: " 2>/dev/null",
|
|
26636
26857
|
_1: (
|
|
26637
26858
|
/* End_of_format */
|
|
26638
26859
|
0
|
|
@@ -26641,22 +26862,156 @@ function inbox_check(hub_path, name) {
|
|
|
26641
26862
|
}
|
|
26642
26863
|
}
|
|
26643
26864
|
}
|
|
26644
|
-
}
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26865
|
+
}
|
|
26866
|
+
}
|
|
26867
|
+
},
|
|
26868
|
+
_1: "git log -1 --format='%%an <%%ae>' origin/%s 2>/dev/null"
|
|
26869
|
+
}), branch);
|
|
26870
|
+
return Stdlib__Option.value(Stdlib__Option.map(Stdlib__String.trim, exec_in(hub_path, cmd2)), "unknown");
|
|
26871
|
+
}
|
|
26872
|
+
function reject_orphan_branch(hub_path, peer_name, branch) {
|
|
26873
|
+
const author = get_branch_author(hub_path, branch);
|
|
26874
|
+
if (dry_run_mode.contents) {
|
|
26875
|
+
console.log(color("2", Curry._2(Stdlib__Printf.sprintf({
|
|
26876
|
+
TAG: (
|
|
26877
|
+
/* Format */
|
|
26878
|
+
0
|
|
26879
|
+
),
|
|
26880
|
+
_0: {
|
|
26881
|
+
TAG: (
|
|
26882
|
+
/* String_literal */
|
|
26883
|
+
11
|
|
26884
|
+
),
|
|
26885
|
+
_0: "Would: reject orphan ",
|
|
26886
|
+
_1: {
|
|
26887
|
+
TAG: (
|
|
26888
|
+
/* String */
|
|
26889
|
+
2
|
|
26890
|
+
),
|
|
26891
|
+
_0: (
|
|
26892
|
+
/* No_padding */
|
|
26893
|
+
0
|
|
26894
|
+
),
|
|
26895
|
+
_1: {
|
|
26896
|
+
TAG: (
|
|
26897
|
+
/* String_literal */
|
|
26898
|
+
11
|
|
26899
|
+
),
|
|
26900
|
+
_0: " (from ",
|
|
26901
|
+
_1: {
|
|
26902
|
+
TAG: (
|
|
26903
|
+
/* String */
|
|
26904
|
+
2
|
|
26905
|
+
),
|
|
26906
|
+
_0: (
|
|
26907
|
+
/* No_padding */
|
|
26908
|
+
0
|
|
26909
|
+
),
|
|
26910
|
+
_1: {
|
|
26911
|
+
TAG: (
|
|
26912
|
+
/* Char_literal */
|
|
26913
|
+
12
|
|
26914
|
+
),
|
|
26915
|
+
_0: (
|
|
26916
|
+
/* ')' */
|
|
26917
|
+
41
|
|
26918
|
+
),
|
|
26919
|
+
_1: (
|
|
26920
|
+
/* End_of_format */
|
|
26921
|
+
0
|
|
26922
|
+
)
|
|
26923
|
+
}
|
|
26924
|
+
}
|
|
26925
|
+
}
|
|
26926
|
+
}
|
|
26927
|
+
},
|
|
26928
|
+
_1: "Would: reject orphan %s (from %s)"
|
|
26929
|
+
}), branch, author)));
|
|
26930
|
+
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
26931
|
+
TAG: (
|
|
26932
|
+
/* Format */
|
|
26933
|
+
0
|
|
26934
|
+
),
|
|
26935
|
+
_0: {
|
|
26936
|
+
TAG: (
|
|
26937
|
+
/* String_literal */
|
|
26938
|
+
11
|
|
26939
|
+
),
|
|
26940
|
+
_0: "Would: send rejection notice to ",
|
|
26941
|
+
_1: {
|
|
26942
|
+
TAG: (
|
|
26943
|
+
/* String */
|
|
26944
|
+
2
|
|
26945
|
+
),
|
|
26946
|
+
_0: (
|
|
26947
|
+
/* No_padding */
|
|
26948
|
+
0
|
|
26949
|
+
),
|
|
26950
|
+
_1: (
|
|
26951
|
+
/* End_of_format */
|
|
26952
|
+
0
|
|
26953
|
+
)
|
|
26954
|
+
}
|
|
26955
|
+
},
|
|
26956
|
+
_1: "Would: send rejection notice to %s"
|
|
26957
|
+
}), peer_name)));
|
|
26958
|
+
} else {
|
|
26959
|
+
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
26960
|
+
const slug = slugify(branch);
|
|
26961
|
+
const filename = make_thread_filename(Curry._1(Stdlib__Printf.sprintf({
|
|
26962
|
+
TAG: (
|
|
26963
|
+
/* Format */
|
|
26964
|
+
0
|
|
26965
|
+
),
|
|
26966
|
+
_0: {
|
|
26967
|
+
TAG: (
|
|
26968
|
+
/* String_literal */
|
|
26969
|
+
11
|
|
26970
|
+
),
|
|
26971
|
+
_0: "rejected-",
|
|
26972
|
+
_1: {
|
|
26973
|
+
TAG: (
|
|
26974
|
+
/* String */
|
|
26975
|
+
2
|
|
26976
|
+
),
|
|
26977
|
+
_0: (
|
|
26978
|
+
/* No_padding */
|
|
26979
|
+
0
|
|
26980
|
+
),
|
|
26981
|
+
_1: (
|
|
26982
|
+
/* End_of_format */
|
|
26983
|
+
0
|
|
26984
|
+
)
|
|
26985
|
+
}
|
|
26986
|
+
},
|
|
26987
|
+
_1: "rejected-%s"
|
|
26988
|
+
}), slug));
|
|
26989
|
+
const content = Curry._6(Stdlib__Printf.sprintf({
|
|
26990
|
+
TAG: (
|
|
26991
|
+
/* Format */
|
|
26992
|
+
0
|
|
26993
|
+
),
|
|
26994
|
+
_0: {
|
|
26995
|
+
TAG: (
|
|
26996
|
+
/* String_literal */
|
|
26997
|
+
11
|
|
26998
|
+
),
|
|
26999
|
+
_0: "---\nto: ",
|
|
27000
|
+
_1: {
|
|
27001
|
+
TAG: (
|
|
27002
|
+
/* String */
|
|
27003
|
+
2
|
|
27004
|
+
),
|
|
27005
|
+
_0: (
|
|
27006
|
+
/* No_padding */
|
|
27007
|
+
0
|
|
27008
|
+
),
|
|
27009
|
+
_1: {
|
|
26655
27010
|
TAG: (
|
|
26656
27011
|
/* String_literal */
|
|
26657
27012
|
11
|
|
26658
27013
|
),
|
|
26659
|
-
_0: "
|
|
27014
|
+
_0: "\ncreated: ",
|
|
26660
27015
|
_1: {
|
|
26661
27016
|
TAG: (
|
|
26662
27017
|
/* String */
|
|
@@ -26666,16 +27021,440 @@ function inbox_check(hub_path, name) {
|
|
|
26666
27021
|
/* No_padding */
|
|
26667
27022
|
0
|
|
26668
27023
|
),
|
|
26669
|
-
_1:
|
|
26670
|
-
|
|
26671
|
-
|
|
26672
|
-
|
|
26673
|
-
|
|
26674
|
-
|
|
26675
|
-
|
|
26676
|
-
|
|
26677
|
-
|
|
26678
|
-
|
|
27024
|
+
_1: {
|
|
27025
|
+
TAG: (
|
|
27026
|
+
/* String_literal */
|
|
27027
|
+
11
|
|
27028
|
+
),
|
|
27029
|
+
_0: "\nsubject: Branch rejected (orphan)\n---\n\nBranch `",
|
|
27030
|
+
_1: {
|
|
27031
|
+
TAG: (
|
|
27032
|
+
/* String */
|
|
27033
|
+
2
|
|
27034
|
+
),
|
|
27035
|
+
_0: (
|
|
27036
|
+
/* No_padding */
|
|
27037
|
+
0
|
|
27038
|
+
),
|
|
27039
|
+
_1: {
|
|
27040
|
+
TAG: (
|
|
27041
|
+
/* String_literal */
|
|
27042
|
+
11
|
|
27043
|
+
),
|
|
27044
|
+
_0: "` rejected and deleted.\n\n**Reason:** No merge base with main.\n\nThis happens when pushing from `cn-",
|
|
27045
|
+
_1: {
|
|
27046
|
+
TAG: (
|
|
27047
|
+
/* String */
|
|
27048
|
+
2
|
|
27049
|
+
),
|
|
27050
|
+
_0: (
|
|
27051
|
+
/* No_padding */
|
|
27052
|
+
0
|
|
27053
|
+
),
|
|
27054
|
+
_1: {
|
|
27055
|
+
TAG: (
|
|
27056
|
+
/* String_literal */
|
|
27057
|
+
11
|
|
27058
|
+
),
|
|
27059
|
+
_0: "` instead of `cn-{recipient}-clone`.\n\n**Author:** ",
|
|
27060
|
+
_1: {
|
|
27061
|
+
TAG: (
|
|
27062
|
+
/* String */
|
|
27063
|
+
2
|
|
27064
|
+
),
|
|
27065
|
+
_0: (
|
|
27066
|
+
/* No_padding */
|
|
27067
|
+
0
|
|
27068
|
+
),
|
|
27069
|
+
_1: {
|
|
27070
|
+
TAG: (
|
|
27071
|
+
/* String_literal */
|
|
27072
|
+
11
|
|
27073
|
+
),
|
|
27074
|
+
_0: "\n\n**Fix:**\n1. Delete local branch: `git branch -D ",
|
|
27075
|
+
_1: {
|
|
27076
|
+
TAG: (
|
|
27077
|
+
/* String */
|
|
27078
|
+
2
|
|
27079
|
+
),
|
|
27080
|
+
_0: (
|
|
27081
|
+
/* No_padding */
|
|
27082
|
+
0
|
|
27083
|
+
),
|
|
27084
|
+
_1: {
|
|
27085
|
+
TAG: (
|
|
27086
|
+
/* String_literal */
|
|
27087
|
+
11
|
|
27088
|
+
),
|
|
27089
|
+
_0: "`\n2. Re-send via cn outbox (uses clone automatically)\n",
|
|
27090
|
+
_1: (
|
|
27091
|
+
/* End_of_format */
|
|
27092
|
+
0
|
|
27093
|
+
)
|
|
27094
|
+
}
|
|
27095
|
+
}
|
|
27096
|
+
}
|
|
27097
|
+
}
|
|
27098
|
+
}
|
|
27099
|
+
}
|
|
27100
|
+
}
|
|
27101
|
+
}
|
|
27102
|
+
}
|
|
27103
|
+
}
|
|
27104
|
+
}
|
|
27105
|
+
}
|
|
27106
|
+
},
|
|
27107
|
+
_1: "---\nto: %s\ncreated: %s\nsubject: Branch rejected (orphan)\n---\n\nBranch `%s` rejected and deleted.\n\n**Reason:** No merge base with main.\n\nThis happens when pushing from `cn-%s` instead of `cn-{recipient}-clone`.\n\n**Author:** %s\n\n**Fix:**\n1. Delete local branch: `git branch -D %s`\n2. Re-send via cn outbox (uses clone automatically)\n"
|
|
27108
|
+
}), peer_name, ts, branch, peer_name, author, branch);
|
|
27109
|
+
const outbox_dir = Path.join(hub_path, "threads/mail/outbox");
|
|
27110
|
+
ensure_dir(outbox_dir);
|
|
27111
|
+
const prim0 = Path.join(outbox_dir, filename);
|
|
27112
|
+
Fs.writeFileSync(prim0, content);
|
|
27113
|
+
}
|
|
27114
|
+
delete_remote_branch(hub_path, branch);
|
|
27115
|
+
log_action(hub_path, "inbox.reject", Curry._3(Stdlib__Printf.sprintf({
|
|
27116
|
+
TAG: (
|
|
27117
|
+
/* Format */
|
|
27118
|
+
0
|
|
27119
|
+
),
|
|
27120
|
+
_0: {
|
|
27121
|
+
TAG: (
|
|
27122
|
+
/* String_literal */
|
|
27123
|
+
11
|
|
27124
|
+
),
|
|
27125
|
+
_0: "branch:",
|
|
27126
|
+
_1: {
|
|
27127
|
+
TAG: (
|
|
27128
|
+
/* String */
|
|
27129
|
+
2
|
|
27130
|
+
),
|
|
27131
|
+
_0: (
|
|
27132
|
+
/* No_padding */
|
|
27133
|
+
0
|
|
27134
|
+
),
|
|
27135
|
+
_1: {
|
|
27136
|
+
TAG: (
|
|
27137
|
+
/* String_literal */
|
|
27138
|
+
11
|
|
27139
|
+
),
|
|
27140
|
+
_0: " peer:",
|
|
27141
|
+
_1: {
|
|
27142
|
+
TAG: (
|
|
27143
|
+
/* String */
|
|
27144
|
+
2
|
|
27145
|
+
),
|
|
27146
|
+
_0: (
|
|
27147
|
+
/* No_padding */
|
|
27148
|
+
0
|
|
27149
|
+
),
|
|
27150
|
+
_1: {
|
|
27151
|
+
TAG: (
|
|
27152
|
+
/* String_literal */
|
|
27153
|
+
11
|
|
27154
|
+
),
|
|
27155
|
+
_0: " author:",
|
|
27156
|
+
_1: {
|
|
27157
|
+
TAG: (
|
|
27158
|
+
/* String */
|
|
27159
|
+
2
|
|
27160
|
+
),
|
|
27161
|
+
_0: (
|
|
27162
|
+
/* No_padding */
|
|
27163
|
+
0
|
|
27164
|
+
),
|
|
27165
|
+
_1: {
|
|
27166
|
+
TAG: (
|
|
27167
|
+
/* String_literal */
|
|
27168
|
+
11
|
|
27169
|
+
),
|
|
27170
|
+
_0: " reason:orphan",
|
|
27171
|
+
_1: (
|
|
27172
|
+
/* End_of_format */
|
|
27173
|
+
0
|
|
27174
|
+
)
|
|
27175
|
+
}
|
|
27176
|
+
}
|
|
27177
|
+
}
|
|
27178
|
+
}
|
|
27179
|
+
}
|
|
27180
|
+
}
|
|
27181
|
+
},
|
|
27182
|
+
_1: "branch:%s peer:%s author:%s reason:orphan"
|
|
27183
|
+
}), branch, peer_name, author));
|
|
27184
|
+
console.log(fail(Curry._2(Stdlib__Printf.sprintf({
|
|
27185
|
+
TAG: (
|
|
27186
|
+
/* Format */
|
|
27187
|
+
0
|
|
27188
|
+
),
|
|
27189
|
+
_0: {
|
|
27190
|
+
TAG: (
|
|
27191
|
+
/* String_literal */
|
|
27192
|
+
11
|
|
27193
|
+
),
|
|
27194
|
+
_0: "Rejected orphan: ",
|
|
27195
|
+
_1: {
|
|
27196
|
+
TAG: (
|
|
27197
|
+
/* String */
|
|
27198
|
+
2
|
|
27199
|
+
),
|
|
27200
|
+
_0: (
|
|
27201
|
+
/* No_padding */
|
|
27202
|
+
0
|
|
27203
|
+
),
|
|
27204
|
+
_1: {
|
|
27205
|
+
TAG: (
|
|
27206
|
+
/* String_literal */
|
|
27207
|
+
11
|
|
27208
|
+
),
|
|
27209
|
+
_0: " (from ",
|
|
27210
|
+
_1: {
|
|
27211
|
+
TAG: (
|
|
27212
|
+
/* String */
|
|
27213
|
+
2
|
|
27214
|
+
),
|
|
27215
|
+
_0: (
|
|
27216
|
+
/* No_padding */
|
|
27217
|
+
0
|
|
27218
|
+
),
|
|
27219
|
+
_1: {
|
|
27220
|
+
TAG: (
|
|
27221
|
+
/* Char_literal */
|
|
27222
|
+
12
|
|
27223
|
+
),
|
|
27224
|
+
_0: (
|
|
27225
|
+
/* ')' */
|
|
27226
|
+
41
|
|
27227
|
+
),
|
|
27228
|
+
_1: (
|
|
27229
|
+
/* End_of_format */
|
|
27230
|
+
0
|
|
27231
|
+
)
|
|
27232
|
+
}
|
|
27233
|
+
}
|
|
27234
|
+
}
|
|
27235
|
+
}
|
|
27236
|
+
},
|
|
27237
|
+
_1: "Rejected orphan: %s (from %s)"
|
|
27238
|
+
}), branch, author)));
|
|
27239
|
+
}
|
|
27240
|
+
function get_inbound_branches(clone_path, my_name) {
|
|
27241
|
+
return Stdlib__Option.value(
|
|
27242
|
+
Stdlib__Option.map(split_lines, exec_in(clone_path, Curry._1(Stdlib__Printf.sprintf({
|
|
27243
|
+
TAG: (
|
|
27244
|
+
/* Format */
|
|
27245
|
+
0
|
|
27246
|
+
),
|
|
27247
|
+
_0: {
|
|
27248
|
+
TAG: (
|
|
27249
|
+
/* String_literal */
|
|
27250
|
+
11
|
|
27251
|
+
),
|
|
27252
|
+
_0: "git branch -r | grep 'origin/",
|
|
27253
|
+
_1: {
|
|
27254
|
+
TAG: (
|
|
27255
|
+
/* String */
|
|
27256
|
+
2
|
|
27257
|
+
),
|
|
27258
|
+
_0: (
|
|
27259
|
+
/* No_padding */
|
|
27260
|
+
0
|
|
27261
|
+
),
|
|
27262
|
+
_1: {
|
|
27263
|
+
TAG: (
|
|
27264
|
+
/* String_literal */
|
|
27265
|
+
11
|
|
27266
|
+
),
|
|
27267
|
+
_0: "/' | sed 's/.*origin\\///'",
|
|
27268
|
+
_1: (
|
|
27269
|
+
/* End_of_format */
|
|
27270
|
+
0
|
|
27271
|
+
)
|
|
27272
|
+
}
|
|
27273
|
+
}
|
|
27274
|
+
},
|
|
27275
|
+
_1: "git branch -r | grep 'origin/%s/' | sed 's/.*origin\\///'"
|
|
27276
|
+
}), my_name))),
|
|
27277
|
+
/* [] */
|
|
27278
|
+
0
|
|
27279
|
+
);
|
|
27280
|
+
}
|
|
27281
|
+
function inbox_check(hub_path, name) {
|
|
27282
|
+
const peers = load_peers(hub_path);
|
|
27283
|
+
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
27284
|
+
TAG: (
|
|
27285
|
+
/* Format */
|
|
27286
|
+
0
|
|
27287
|
+
),
|
|
27288
|
+
_0: {
|
|
27289
|
+
TAG: (
|
|
27290
|
+
/* String_literal */
|
|
27291
|
+
11
|
|
27292
|
+
),
|
|
27293
|
+
_0: "Checking inbox for ",
|
|
27294
|
+
_1: {
|
|
27295
|
+
TAG: (
|
|
27296
|
+
/* String */
|
|
27297
|
+
2
|
|
27298
|
+
),
|
|
27299
|
+
_0: (
|
|
27300
|
+
/* No_padding */
|
|
27301
|
+
0
|
|
27302
|
+
),
|
|
27303
|
+
_1: {
|
|
27304
|
+
TAG: (
|
|
27305
|
+
/* String_literal */
|
|
27306
|
+
11
|
|
27307
|
+
),
|
|
27308
|
+
_0: "...",
|
|
27309
|
+
_1: (
|
|
27310
|
+
/* End_of_format */
|
|
27311
|
+
0
|
|
27312
|
+
)
|
|
27313
|
+
}
|
|
27314
|
+
}
|
|
27315
|
+
},
|
|
27316
|
+
_1: "Checking inbox for %s..."
|
|
27317
|
+
}), name)));
|
|
27318
|
+
const total = Stdlib__List.fold_left((function(acc, peer) {
|
|
27319
|
+
const match2 = peer.kind;
|
|
27320
|
+
const match$1 = peer.clone;
|
|
27321
|
+
if (match2 === "template") {
|
|
27322
|
+
return acc;
|
|
27323
|
+
}
|
|
27324
|
+
if (match$1 !== void 0) {
|
|
27325
|
+
if (Fs.existsSync(match$1)) {
|
|
27326
|
+
exec_in(match$1, "git fetch origin");
|
|
27327
|
+
const branches = get_inbound_branches(match$1, name);
|
|
27328
|
+
if (branches) {
|
|
27329
|
+
console.log(warn(Curry._2(Stdlib__Printf.sprintf({
|
|
27330
|
+
TAG: (
|
|
27331
|
+
/* Format */
|
|
27332
|
+
0
|
|
27333
|
+
),
|
|
27334
|
+
_0: {
|
|
27335
|
+
TAG: (
|
|
27336
|
+
/* String_literal */
|
|
27337
|
+
11
|
|
27338
|
+
),
|
|
27339
|
+
_0: "From ",
|
|
27340
|
+
_1: {
|
|
27341
|
+
TAG: (
|
|
27342
|
+
/* String */
|
|
27343
|
+
2
|
|
27344
|
+
),
|
|
27345
|
+
_0: (
|
|
27346
|
+
/* No_padding */
|
|
27347
|
+
0
|
|
27348
|
+
),
|
|
27349
|
+
_1: {
|
|
27350
|
+
TAG: (
|
|
27351
|
+
/* String_literal */
|
|
27352
|
+
11
|
|
27353
|
+
),
|
|
27354
|
+
_0: ": ",
|
|
27355
|
+
_1: {
|
|
27356
|
+
TAG: (
|
|
27357
|
+
/* Int */
|
|
27358
|
+
4
|
|
27359
|
+
),
|
|
27360
|
+
_0: (
|
|
27361
|
+
/* Int_d */
|
|
27362
|
+
0
|
|
27363
|
+
),
|
|
27364
|
+
_1: (
|
|
27365
|
+
/* No_padding */
|
|
27366
|
+
0
|
|
27367
|
+
),
|
|
27368
|
+
_2: (
|
|
27369
|
+
/* No_precision */
|
|
27370
|
+
0
|
|
27371
|
+
),
|
|
27372
|
+
_3: {
|
|
27373
|
+
TAG: (
|
|
27374
|
+
/* String_literal */
|
|
27375
|
+
11
|
|
27376
|
+
),
|
|
27377
|
+
_0: " inbound",
|
|
27378
|
+
_1: (
|
|
27379
|
+
/* End_of_format */
|
|
27380
|
+
0
|
|
27381
|
+
)
|
|
27382
|
+
}
|
|
27383
|
+
}
|
|
27384
|
+
}
|
|
27385
|
+
}
|
|
27386
|
+
},
|
|
27387
|
+
_1: "From %s: %d inbound"
|
|
27388
|
+
}), peer.name, Stdlib__List.length(branches))));
|
|
27389
|
+
Stdlib__List.iter((function(b) {
|
|
27390
|
+
console.log(Curry._1(Stdlib__Printf.sprintf({
|
|
27391
|
+
TAG: (
|
|
27392
|
+
/* Format */
|
|
27393
|
+
0
|
|
27394
|
+
),
|
|
27395
|
+
_0: {
|
|
27396
|
+
TAG: (
|
|
27397
|
+
/* String_literal */
|
|
27398
|
+
11
|
|
27399
|
+
),
|
|
27400
|
+
_0: " \xE2\x86\x90 ",
|
|
27401
|
+
_1: {
|
|
27402
|
+
TAG: (
|
|
27403
|
+
/* String */
|
|
27404
|
+
2
|
|
27405
|
+
),
|
|
27406
|
+
_0: (
|
|
27407
|
+
/* No_padding */
|
|
27408
|
+
0
|
|
27409
|
+
),
|
|
27410
|
+
_1: (
|
|
27411
|
+
/* End_of_format */
|
|
27412
|
+
0
|
|
27413
|
+
)
|
|
27414
|
+
}
|
|
27415
|
+
},
|
|
27416
|
+
_1: " \xE2\x86\x90 %s"
|
|
27417
|
+
}), b));
|
|
27418
|
+
}), branches);
|
|
27419
|
+
} else {
|
|
27420
|
+
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
27421
|
+
TAG: (
|
|
27422
|
+
/* Format */
|
|
27423
|
+
0
|
|
27424
|
+
),
|
|
27425
|
+
_0: {
|
|
27426
|
+
TAG: (
|
|
27427
|
+
/* String_literal */
|
|
27428
|
+
11
|
|
27429
|
+
),
|
|
27430
|
+
_0: " ",
|
|
27431
|
+
_1: {
|
|
27432
|
+
TAG: (
|
|
27433
|
+
/* String */
|
|
27434
|
+
2
|
|
27435
|
+
),
|
|
27436
|
+
_0: (
|
|
27437
|
+
/* No_padding */
|
|
27438
|
+
0
|
|
27439
|
+
),
|
|
27440
|
+
_1: {
|
|
27441
|
+
TAG: (
|
|
27442
|
+
/* String_literal */
|
|
27443
|
+
11
|
|
27444
|
+
),
|
|
27445
|
+
_0: ": no inbound",
|
|
27446
|
+
_1: (
|
|
27447
|
+
/* End_of_format */
|
|
27448
|
+
0
|
|
27449
|
+
)
|
|
27450
|
+
}
|
|
27451
|
+
}
|
|
27452
|
+
},
|
|
27453
|
+
_1: " %s: no inbound"
|
|
27454
|
+
}), peer.name)));
|
|
27455
|
+
}
|
|
27456
|
+
return acc + Stdlib__List.length(branches) | 0;
|
|
27457
|
+
}
|
|
26679
27458
|
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
26680
27459
|
TAG: (
|
|
26681
27460
|
/* Format */
|
|
@@ -26701,7 +27480,7 @@ function inbox_check(hub_path, name) {
|
|
|
26701
27480
|
/* String_literal */
|
|
26702
27481
|
11
|
|
26703
27482
|
),
|
|
26704
|
-
_0: ":
|
|
27483
|
+
_0: ": clone not found",
|
|
26705
27484
|
_1: (
|
|
26706
27485
|
/* End_of_format */
|
|
26707
27486
|
0
|
|
@@ -26709,18 +27488,61 @@ function inbox_check(hub_path, name) {
|
|
|
26709
27488
|
}
|
|
26710
27489
|
}
|
|
26711
27490
|
},
|
|
26712
|
-
_1: " %s:
|
|
27491
|
+
_1: " %s: clone not found"
|
|
26713
27492
|
}), peer.name)));
|
|
27493
|
+
return acc;
|
|
26714
27494
|
}
|
|
26715
|
-
|
|
27495
|
+
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
27496
|
+
TAG: (
|
|
27497
|
+
/* Format */
|
|
27498
|
+
0
|
|
27499
|
+
),
|
|
27500
|
+
_0: {
|
|
27501
|
+
TAG: (
|
|
27502
|
+
/* String_literal */
|
|
27503
|
+
11
|
|
27504
|
+
),
|
|
27505
|
+
_0: " ",
|
|
27506
|
+
_1: {
|
|
27507
|
+
TAG: (
|
|
27508
|
+
/* String */
|
|
27509
|
+
2
|
|
27510
|
+
),
|
|
27511
|
+
_0: (
|
|
27512
|
+
/* No_padding */
|
|
27513
|
+
0
|
|
27514
|
+
),
|
|
27515
|
+
_1: {
|
|
27516
|
+
TAG: (
|
|
27517
|
+
/* String_literal */
|
|
27518
|
+
11
|
|
27519
|
+
),
|
|
27520
|
+
_0: ": no clone path",
|
|
27521
|
+
_1: (
|
|
27522
|
+
/* End_of_format */
|
|
27523
|
+
0
|
|
27524
|
+
)
|
|
27525
|
+
}
|
|
27526
|
+
}
|
|
27527
|
+
},
|
|
27528
|
+
_1: " %s: no clone path"
|
|
27529
|
+
}), peer.name)));
|
|
27530
|
+
return acc;
|
|
26716
27531
|
}), 0, peers);
|
|
26717
27532
|
if (total === 0) {
|
|
26718
|
-
console.log(
|
|
27533
|
+
console.log(ok("Inbox clear"));
|
|
26719
27534
|
return;
|
|
26720
27535
|
}
|
|
26721
27536
|
}
|
|
26722
|
-
function
|
|
26723
|
-
|
|
27537
|
+
function materialize_branch(clone_path, hub_path, inbox_dir, peer_name, branch) {
|
|
27538
|
+
if (is_orphan_branch(clone_path, branch)) {
|
|
27539
|
+
reject_orphan_branch(hub_path, peer_name, branch);
|
|
27540
|
+
return (
|
|
27541
|
+
/* [] */
|
|
27542
|
+
0
|
|
27543
|
+
);
|
|
27544
|
+
}
|
|
27545
|
+
const diff_cmd = Curry._2(Stdlib__Printf.sprintf({
|
|
26724
27546
|
TAG: (
|
|
26725
27547
|
/* Format */
|
|
26726
27548
|
0
|
|
@@ -26730,7 +27552,7 @@ function delete_remote_branch(hub_path, branch) {
|
|
|
26730
27552
|
/* String_literal */
|
|
26731
27553
|
11
|
|
26732
27554
|
),
|
|
26733
|
-
_0: "git
|
|
27555
|
+
_0: "git diff main...origin/",
|
|
26734
27556
|
_1: {
|
|
26735
27557
|
TAG: (
|
|
26736
27558
|
/* String */
|
|
@@ -26745,7 +27567,104 @@ function delete_remote_branch(hub_path, branch) {
|
|
|
26745
27567
|
/* String_literal */
|
|
26746
27568
|
11
|
|
26747
27569
|
),
|
|
26748
|
-
_0: " 2>/dev/null",
|
|
27570
|
+
_0: " --name-only 2>/dev/null || git diff master...origin/",
|
|
27571
|
+
_1: {
|
|
27572
|
+
TAG: (
|
|
27573
|
+
/* String */
|
|
27574
|
+
2
|
|
27575
|
+
),
|
|
27576
|
+
_0: (
|
|
27577
|
+
/* No_padding */
|
|
27578
|
+
0
|
|
27579
|
+
),
|
|
27580
|
+
_1: {
|
|
27581
|
+
TAG: (
|
|
27582
|
+
/* String_literal */
|
|
27583
|
+
11
|
|
27584
|
+
),
|
|
27585
|
+
_0: " --name-only",
|
|
27586
|
+
_1: (
|
|
27587
|
+
/* End_of_format */
|
|
27588
|
+
0
|
|
27589
|
+
)
|
|
27590
|
+
}
|
|
27591
|
+
}
|
|
27592
|
+
}
|
|
27593
|
+
}
|
|
27594
|
+
},
|
|
27595
|
+
_1: "git diff main...origin/%s --name-only 2>/dev/null || git diff master...origin/%s --name-only"
|
|
27596
|
+
}), branch, branch);
|
|
27597
|
+
const files = Stdlib__List.filter(is_md_file, Stdlib__Option.value(
|
|
27598
|
+
Stdlib__Option.map(split_lines, exec_in(clone_path, diff_cmd)),
|
|
27599
|
+
/* [] */
|
|
27600
|
+
0
|
|
27601
|
+
));
|
|
27602
|
+
const trigger = Stdlib__Option.value(Stdlib__Option.map(Stdlib__String.trim, exec_in(clone_path, Curry._1(Stdlib__Printf.sprintf({
|
|
27603
|
+
TAG: (
|
|
27604
|
+
/* Format */
|
|
27605
|
+
0
|
|
27606
|
+
),
|
|
27607
|
+
_0: {
|
|
27608
|
+
TAG: (
|
|
27609
|
+
/* String_literal */
|
|
27610
|
+
11
|
|
27611
|
+
),
|
|
27612
|
+
_0: "git rev-parse origin/",
|
|
27613
|
+
_1: {
|
|
27614
|
+
TAG: (
|
|
27615
|
+
/* String */
|
|
27616
|
+
2
|
|
27617
|
+
),
|
|
27618
|
+
_0: (
|
|
27619
|
+
/* No_padding */
|
|
27620
|
+
0
|
|
27621
|
+
),
|
|
27622
|
+
_1: (
|
|
27623
|
+
/* End_of_format */
|
|
27624
|
+
0
|
|
27625
|
+
)
|
|
27626
|
+
}
|
|
27627
|
+
},
|
|
27628
|
+
_1: "git rev-parse origin/%s"
|
|
27629
|
+
}), branch))), "unknown");
|
|
27630
|
+
const match2 = Stdlib__List.rev(Stdlib__String.split_on_char(
|
|
27631
|
+
/* '/' */
|
|
27632
|
+
47,
|
|
27633
|
+
branch
|
|
27634
|
+
));
|
|
27635
|
+
const branch_slug = match2 ? match2.hd : branch;
|
|
27636
|
+
const inbox_file = make_thread_filename(Curry._2(Stdlib__Printf.sprintf({
|
|
27637
|
+
TAG: (
|
|
27638
|
+
/* Format */
|
|
27639
|
+
0
|
|
27640
|
+
),
|
|
27641
|
+
_0: {
|
|
27642
|
+
TAG: (
|
|
27643
|
+
/* String */
|
|
27644
|
+
2
|
|
27645
|
+
),
|
|
27646
|
+
_0: (
|
|
27647
|
+
/* No_padding */
|
|
27648
|
+
0
|
|
27649
|
+
),
|
|
27650
|
+
_1: {
|
|
27651
|
+
TAG: (
|
|
27652
|
+
/* Char_literal */
|
|
27653
|
+
12
|
|
27654
|
+
),
|
|
27655
|
+
_0: (
|
|
27656
|
+
/* '-' */
|
|
27657
|
+
45
|
|
27658
|
+
),
|
|
27659
|
+
_1: {
|
|
27660
|
+
TAG: (
|
|
27661
|
+
/* String */
|
|
27662
|
+
2
|
|
27663
|
+
),
|
|
27664
|
+
_0: (
|
|
27665
|
+
/* No_padding */
|
|
27666
|
+
0
|
|
27667
|
+
),
|
|
26749
27668
|
_1: (
|
|
26750
27669
|
/* End_of_format */
|
|
26751
27670
|
0
|
|
@@ -26753,12 +27672,126 @@ function delete_remote_branch(hub_path, branch) {
|
|
|
26753
27672
|
}
|
|
26754
27673
|
}
|
|
26755
27674
|
},
|
|
26756
|
-
_1: "
|
|
26757
|
-
}),
|
|
26758
|
-
const
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
|
|
27675
|
+
_1: "%s-%s"
|
|
27676
|
+
}), peer_name, branch_slug));
|
|
27677
|
+
const inbox_path = Path.join(inbox_dir, inbox_file);
|
|
27678
|
+
const already_exists = Stdlib__List.exists((function(f) {
|
|
27679
|
+
if (f.length > 16) {
|
|
27680
|
+
return Cn_lib.ends_with(Curry._2(Stdlib__Printf.sprintf({
|
|
27681
|
+
TAG: (
|
|
27682
|
+
/* Format */
|
|
27683
|
+
0
|
|
27684
|
+
),
|
|
27685
|
+
_0: {
|
|
27686
|
+
TAG: (
|
|
27687
|
+
/* String */
|
|
27688
|
+
2
|
|
27689
|
+
),
|
|
27690
|
+
_0: (
|
|
27691
|
+
/* No_padding */
|
|
27692
|
+
0
|
|
27693
|
+
),
|
|
27694
|
+
_1: {
|
|
27695
|
+
TAG: (
|
|
27696
|
+
/* Char_literal */
|
|
27697
|
+
12
|
|
27698
|
+
),
|
|
27699
|
+
_0: (
|
|
27700
|
+
/* '-' */
|
|
27701
|
+
45
|
|
27702
|
+
),
|
|
27703
|
+
_1: {
|
|
27704
|
+
TAG: (
|
|
27705
|
+
/* String */
|
|
27706
|
+
2
|
|
27707
|
+
),
|
|
27708
|
+
_0: (
|
|
27709
|
+
/* No_padding */
|
|
27710
|
+
0
|
|
27711
|
+
),
|
|
27712
|
+
_1: {
|
|
27713
|
+
TAG: (
|
|
27714
|
+
/* String_literal */
|
|
27715
|
+
11
|
|
27716
|
+
),
|
|
27717
|
+
_0: ".md",
|
|
27718
|
+
_1: (
|
|
27719
|
+
/* End_of_format */
|
|
27720
|
+
0
|
|
27721
|
+
)
|
|
27722
|
+
}
|
|
27723
|
+
}
|
|
27724
|
+
}
|
|
27725
|
+
},
|
|
27726
|
+
_1: "%s-%s.md"
|
|
27727
|
+
}), peer_name, branch_slug), f);
|
|
27728
|
+
} else {
|
|
27729
|
+
return false;
|
|
27730
|
+
}
|
|
27731
|
+
}), Stdlib__Array.to_list(Fs.readdirSync(inbox_dir)));
|
|
27732
|
+
const archived_dir = Path.join(inbox_dir, "_archived");
|
|
27733
|
+
const already_archived = Fs.existsSync(archived_dir) && Stdlib__List.exists((function(f) {
|
|
27734
|
+
if (f.length > 16) {
|
|
27735
|
+
return Cn_lib.ends_with(Curry._2(Stdlib__Printf.sprintf({
|
|
27736
|
+
TAG: (
|
|
27737
|
+
/* Format */
|
|
27738
|
+
0
|
|
27739
|
+
),
|
|
27740
|
+
_0: {
|
|
27741
|
+
TAG: (
|
|
27742
|
+
/* String */
|
|
27743
|
+
2
|
|
27744
|
+
),
|
|
27745
|
+
_0: (
|
|
27746
|
+
/* No_padding */
|
|
27747
|
+
0
|
|
27748
|
+
),
|
|
27749
|
+
_1: {
|
|
27750
|
+
TAG: (
|
|
27751
|
+
/* Char_literal */
|
|
27752
|
+
12
|
|
27753
|
+
),
|
|
27754
|
+
_0: (
|
|
27755
|
+
/* '-' */
|
|
27756
|
+
45
|
|
27757
|
+
),
|
|
27758
|
+
_1: {
|
|
27759
|
+
TAG: (
|
|
27760
|
+
/* String */
|
|
27761
|
+
2
|
|
27762
|
+
),
|
|
27763
|
+
_0: (
|
|
27764
|
+
/* No_padding */
|
|
27765
|
+
0
|
|
27766
|
+
),
|
|
27767
|
+
_1: {
|
|
27768
|
+
TAG: (
|
|
27769
|
+
/* String_literal */
|
|
27770
|
+
11
|
|
27771
|
+
),
|
|
27772
|
+
_0: ".md",
|
|
27773
|
+
_1: (
|
|
27774
|
+
/* End_of_format */
|
|
27775
|
+
0
|
|
27776
|
+
)
|
|
27777
|
+
}
|
|
27778
|
+
}
|
|
27779
|
+
}
|
|
27780
|
+
},
|
|
27781
|
+
_1: "%s-%s.md"
|
|
27782
|
+
}), peer_name, branch_slug), f);
|
|
27783
|
+
} else {
|
|
27784
|
+
return false;
|
|
27785
|
+
}
|
|
27786
|
+
}), Stdlib__Array.to_list(Fs.readdirSync(archived_dir)));
|
|
27787
|
+
if (already_exists || already_archived) {
|
|
27788
|
+
delete_remote_branch(clone_path, branch);
|
|
27789
|
+
return (
|
|
27790
|
+
/* [] */
|
|
27791
|
+
0
|
|
27792
|
+
);
|
|
27793
|
+
} else if (dry_run_mode.contents) {
|
|
27794
|
+
console.log(color("2", Curry._2(Stdlib__Printf.sprintf({
|
|
26762
27795
|
TAG: (
|
|
26763
27796
|
/* Format */
|
|
26764
27797
|
0
|
|
@@ -26768,7 +27801,7 @@ function delete_remote_branch(hub_path, branch) {
|
|
|
26768
27801
|
/* String_literal */
|
|
26769
27802
|
11
|
|
26770
27803
|
),
|
|
26771
|
-
_0: "
|
|
27804
|
+
_0: "Would: materialize ",
|
|
26772
27805
|
_1: {
|
|
26773
27806
|
TAG: (
|
|
26774
27807
|
/* String */
|
|
@@ -26778,61 +27811,21 @@ function delete_remote_branch(hub_path, branch) {
|
|
|
26778
27811
|
/* No_padding */
|
|
26779
27812
|
0
|
|
26780
27813
|
),
|
|
26781
|
-
_1: (
|
|
26782
|
-
/* End_of_format */
|
|
26783
|
-
0
|
|
26784
|
-
)
|
|
26785
|
-
}
|
|
26786
|
-
},
|
|
26787
|
-
_1: " Deleted remote: %s"
|
|
26788
|
-
}), branch)));
|
|
26789
|
-
return true;
|
|
26790
|
-
} else {
|
|
26791
|
-
return false;
|
|
26792
|
-
}
|
|
26793
|
-
}
|
|
26794
|
-
function materialize_branch(hub_path, inbox_dir, peer_name, branch) {
|
|
26795
|
-
const diff_cmd = Curry._2(Stdlib__Printf.sprintf({
|
|
26796
|
-
TAG: (
|
|
26797
|
-
/* Format */
|
|
26798
|
-
0
|
|
26799
|
-
),
|
|
26800
|
-
_0: {
|
|
26801
|
-
TAG: (
|
|
26802
|
-
/* String_literal */
|
|
26803
|
-
11
|
|
26804
|
-
),
|
|
26805
|
-
_0: "git diff main...origin/",
|
|
26806
|
-
_1: {
|
|
26807
|
-
TAG: (
|
|
26808
|
-
/* String */
|
|
26809
|
-
2
|
|
26810
|
-
),
|
|
26811
|
-
_0: (
|
|
26812
|
-
/* No_padding */
|
|
26813
|
-
0
|
|
26814
|
-
),
|
|
26815
|
-
_1: {
|
|
26816
|
-
TAG: (
|
|
26817
|
-
/* String_literal */
|
|
26818
|
-
11
|
|
26819
|
-
),
|
|
26820
|
-
_0: " --name-only 2>/dev/null || git diff master...origin/",
|
|
26821
27814
|
_1: {
|
|
26822
27815
|
TAG: (
|
|
26823
|
-
/*
|
|
26824
|
-
|
|
26825
|
-
),
|
|
26826
|
-
_0: (
|
|
26827
|
-
/* No_padding */
|
|
26828
|
-
0
|
|
27816
|
+
/* String_literal */
|
|
27817
|
+
11
|
|
26829
27818
|
),
|
|
27819
|
+
_0: " \xE2\x86\x92 ",
|
|
26830
27820
|
_1: {
|
|
26831
27821
|
TAG: (
|
|
26832
|
-
/*
|
|
26833
|
-
|
|
27822
|
+
/* String */
|
|
27823
|
+
2
|
|
27824
|
+
),
|
|
27825
|
+
_0: (
|
|
27826
|
+
/* No_padding */
|
|
27827
|
+
0
|
|
26834
27828
|
),
|
|
26835
|
-
_0: " --name-only",
|
|
26836
27829
|
_1: (
|
|
26837
27830
|
/* End_of_format */
|
|
26838
27831
|
0
|
|
@@ -26840,72 +27833,20 @@ function materialize_branch(hub_path, inbox_dir, peer_name, branch) {
|
|
|
26840
27833
|
}
|
|
26841
27834
|
}
|
|
26842
27835
|
}
|
|
26843
|
-
}
|
|
26844
|
-
|
|
26845
|
-
|
|
26846
|
-
|
|
26847
|
-
const files = Stdlib__List.filter(is_md_file, Stdlib__Option.value(
|
|
26848
|
-
Stdlib__Option.map(split_lines, exec_in(hub_path, diff_cmd)),
|
|
26849
|
-
/* [] */
|
|
26850
|
-
0
|
|
26851
|
-
));
|
|
26852
|
-
const trigger = Stdlib__Option.value(Stdlib__Option.map(Stdlib__String.trim, exec_in(hub_path, Curry._1(Stdlib__Printf.sprintf({
|
|
26853
|
-
TAG: (
|
|
26854
|
-
/* Format */
|
|
26855
|
-
0
|
|
26856
|
-
),
|
|
26857
|
-
_0: {
|
|
26858
|
-
TAG: (
|
|
26859
|
-
/* String_literal */
|
|
26860
|
-
11
|
|
26861
|
-
),
|
|
26862
|
-
_0: "git rev-parse origin/",
|
|
26863
|
-
_1: {
|
|
26864
|
-
TAG: (
|
|
26865
|
-
/* String */
|
|
26866
|
-
2
|
|
26867
|
-
),
|
|
26868
|
-
_0: (
|
|
26869
|
-
/* No_padding */
|
|
26870
|
-
0
|
|
26871
|
-
),
|
|
26872
|
-
_1: (
|
|
26873
|
-
/* End_of_format */
|
|
26874
|
-
0
|
|
26875
|
-
)
|
|
26876
|
-
}
|
|
26877
|
-
},
|
|
26878
|
-
_1: "git rev-parse origin/%s"
|
|
26879
|
-
}), branch))), "unknown");
|
|
26880
|
-
const match2 = Stdlib__List.rev(Stdlib__String.split_on_char(
|
|
26881
|
-
/* '/' */
|
|
26882
|
-
47,
|
|
26883
|
-
branch
|
|
26884
|
-
));
|
|
26885
|
-
const branch_slug = match2 ? match2.hd : branch;
|
|
26886
|
-
const inbox_file = Curry._2(Stdlib__Printf.sprintf({
|
|
26887
|
-
TAG: (
|
|
26888
|
-
/* Format */
|
|
26889
|
-
0
|
|
26890
|
-
),
|
|
26891
|
-
_0: {
|
|
27836
|
+
},
|
|
27837
|
+
_1: "Would: materialize %s \xE2\x86\x92 %s"
|
|
27838
|
+
}), branch, inbox_file)));
|
|
27839
|
+
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
26892
27840
|
TAG: (
|
|
26893
|
-
/*
|
|
26894
|
-
2
|
|
26895
|
-
),
|
|
26896
|
-
_0: (
|
|
26897
|
-
/* No_padding */
|
|
27841
|
+
/* Format */
|
|
26898
27842
|
0
|
|
26899
27843
|
),
|
|
26900
|
-
|
|
27844
|
+
_0: {
|
|
26901
27845
|
TAG: (
|
|
26902
|
-
/*
|
|
26903
|
-
|
|
26904
|
-
),
|
|
26905
|
-
_0: (
|
|
26906
|
-
/* '-' */
|
|
26907
|
-
45
|
|
27846
|
+
/* String_literal */
|
|
27847
|
+
11
|
|
26908
27848
|
),
|
|
27849
|
+
_0: "Would: delete remote branch ",
|
|
26909
27850
|
_1: {
|
|
26910
27851
|
TAG: (
|
|
26911
27852
|
/* String */
|
|
@@ -26915,30 +27856,21 @@ function materialize_branch(hub_path, inbox_dir, peer_name, branch) {
|
|
|
26915
27856
|
/* No_padding */
|
|
26916
27857
|
0
|
|
26917
27858
|
),
|
|
26918
|
-
_1:
|
|
26919
|
-
|
|
26920
|
-
|
|
26921
|
-
|
|
26922
|
-
),
|
|
26923
|
-
_0: ".md",
|
|
26924
|
-
_1: (
|
|
26925
|
-
/* End_of_format */
|
|
26926
|
-
0
|
|
26927
|
-
)
|
|
26928
|
-
}
|
|
27859
|
+
_1: (
|
|
27860
|
+
/* End_of_format */
|
|
27861
|
+
0
|
|
27862
|
+
)
|
|
26929
27863
|
}
|
|
26930
|
-
}
|
|
26931
|
-
|
|
26932
|
-
|
|
26933
|
-
|
|
26934
|
-
|
|
26935
|
-
|
|
26936
|
-
|
|
26937
|
-
|
|
26938
|
-
|
|
26939
|
-
|
|
26940
|
-
0
|
|
26941
|
-
);
|
|
27864
|
+
},
|
|
27865
|
+
_1: "Would: delete remote branch %s"
|
|
27866
|
+
}), branch)));
|
|
27867
|
+
return {
|
|
27868
|
+
hd: inbox_file,
|
|
27869
|
+
tl: (
|
|
27870
|
+
/* [] */
|
|
27871
|
+
0
|
|
27872
|
+
)
|
|
27873
|
+
};
|
|
26942
27874
|
} else {
|
|
26943
27875
|
return Stdlib__List.filter_map((function(file) {
|
|
26944
27876
|
const show_cmd = Curry._2(Stdlib__Printf.sprintf({
|
|
@@ -26989,7 +27921,7 @@ function materialize_branch(hub_path, inbox_dir, peer_name, branch) {
|
|
|
26989
27921
|
},
|
|
26990
27922
|
_1: "git show origin/%s:%s"
|
|
26991
27923
|
}), branch, file);
|
|
26992
|
-
const content = exec_in(
|
|
27924
|
+
const content = exec_in(clone_path, show_cmd);
|
|
26993
27925
|
if (content === void 0) {
|
|
26994
27926
|
return;
|
|
26995
27927
|
}
|
|
@@ -27069,25 +28001,34 @@ function materialize_branch(hub_path, inbox_dir, peer_name, branch) {
|
|
|
27069
28001
|
},
|
|
27070
28002
|
_1: "%s trigger:%s"
|
|
27071
28003
|
}), inbox_file, trigger));
|
|
27072
|
-
delete_remote_branch(
|
|
28004
|
+
delete_remote_branch(clone_path, branch);
|
|
27073
28005
|
return inbox_file;
|
|
27074
28006
|
}), files);
|
|
27075
28007
|
}
|
|
27076
28008
|
}
|
|
27077
28009
|
function inbox_process(hub_path) {
|
|
27078
28010
|
console.log(color("36", "Processing inbox..."));
|
|
27079
|
-
const inbox_dir = Path.join(hub_path, "threads/inbox");
|
|
28011
|
+
const inbox_dir = Path.join(hub_path, "threads/mail/inbox");
|
|
27080
28012
|
ensure_dir(inbox_dir);
|
|
28013
|
+
const my_name = Cn_lib.derive_name(hub_path);
|
|
27081
28014
|
const peers = load_peers(hub_path);
|
|
27082
28015
|
const materialized = Stdlib__List.fold_left(
|
|
27083
28016
|
(function(acc, peer) {
|
|
27084
28017
|
const match2 = peer.kind;
|
|
28018
|
+
const match$1 = peer.clone;
|
|
27085
28019
|
if (match2 === "template") {
|
|
27086
28020
|
return acc;
|
|
27087
28021
|
}
|
|
27088
|
-
|
|
27089
|
-
|
|
27090
|
-
|
|
28022
|
+
if (match$1 === void 0) {
|
|
28023
|
+
return acc;
|
|
28024
|
+
}
|
|
28025
|
+
if (!Fs.existsSync(match$1)) {
|
|
28026
|
+
return acc;
|
|
28027
|
+
}
|
|
28028
|
+
exec_in(match$1, "git fetch origin");
|
|
28029
|
+
const branches = get_inbound_branches(match$1, my_name);
|
|
28030
|
+
const files = Stdlib__List.concat_map((function(branch) {
|
|
28031
|
+
return materialize_branch(match$1, hub_path, inbox_dir, peer.name, branch);
|
|
27091
28032
|
}), branches);
|
|
27092
28033
|
return Stdlib.$at(acc, files);
|
|
27093
28034
|
}),
|
|
@@ -27096,7 +28037,7 @@ function inbox_process(hub_path) {
|
|
|
27096
28037
|
peers
|
|
27097
28038
|
);
|
|
27098
28039
|
Stdlib__List.iter((function(f) {
|
|
27099
|
-
|
|
28040
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
27100
28041
|
TAG: (
|
|
27101
28042
|
/* Format */
|
|
27102
28043
|
0
|
|
@@ -27123,11 +28064,10 @@ function inbox_process(hub_path) {
|
|
|
27123
28064
|
}
|
|
27124
28065
|
},
|
|
27125
28066
|
_1: "Materialized: %s"
|
|
27126
|
-
}), f);
|
|
27127
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
28067
|
+
}), f)));
|
|
27128
28068
|
}), materialized);
|
|
27129
28069
|
if (materialized) {
|
|
27130
|
-
|
|
28070
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
27131
28071
|
TAG: (
|
|
27132
28072
|
/* Format */
|
|
27133
28073
|
0
|
|
@@ -27169,18 +28109,17 @@ function inbox_process(hub_path) {
|
|
|
27169
28109
|
}
|
|
27170
28110
|
},
|
|
27171
28111
|
_1: "Processed %d thread(s)"
|
|
27172
|
-
}), Stdlib__List.length(materialized));
|
|
27173
|
-
|
|
27174
|
-
|
|
28112
|
+
}), Stdlib__List.length(materialized))));
|
|
28113
|
+
} else {
|
|
28114
|
+
console.log(color("36", "No new threads to materialize"));
|
|
27175
28115
|
}
|
|
27176
|
-
console.log(color("36", "No new threads to materialize"));
|
|
27177
28116
|
}
|
|
27178
28117
|
function outbox_check(hub_path) {
|
|
27179
|
-
const outbox_dir = Path.join(hub_path, "threads/outbox");
|
|
28118
|
+
const outbox_dir = Path.join(hub_path, "threads/mail/outbox");
|
|
27180
28119
|
if (Fs.existsSync(outbox_dir)) {
|
|
27181
28120
|
const ts = Stdlib__List.filter(is_md_file, Stdlib__Array.to_list(Fs.readdirSync(outbox_dir)));
|
|
27182
28121
|
if (ts) {
|
|
27183
|
-
|
|
28122
|
+
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
27184
28123
|
TAG: (
|
|
27185
28124
|
/* Format */
|
|
27186
28125
|
0
|
|
@@ -27215,8 +28154,7 @@ function outbox_check(hub_path) {
|
|
|
27215
28154
|
}
|
|
27216
28155
|
},
|
|
27217
28156
|
_1: "%d pending send(s):"
|
|
27218
|
-
}), Stdlib__List.length(ts));
|
|
27219
|
-
console.log(color("33", "\xE2\x9A\xA0 ") + msg);
|
|
28157
|
+
}), Stdlib__List.length(ts))));
|
|
27220
28158
|
return Stdlib__List.iter((function(f) {
|
|
27221
28159
|
const content = Fs.readFileSync(Path.join(outbox_dir, f), "utf8");
|
|
27222
28160
|
const meta = Cn_lib.parse_frontmatter(content);
|
|
@@ -27271,11 +28209,12 @@ function outbox_check(hub_path) {
|
|
|
27271
28209
|
_1: " \xE2\x86\x92 %s: %s"
|
|
27272
28210
|
}), to_peer, f));
|
|
27273
28211
|
}), ts);
|
|
28212
|
+
} else {
|
|
28213
|
+
console.log(ok("Outbox clear"));
|
|
28214
|
+
return;
|
|
27274
28215
|
}
|
|
27275
|
-
console.log(color("32", "\xE2\x9C\x93 ") + "Outbox clear");
|
|
27276
|
-
return;
|
|
27277
28216
|
}
|
|
27278
|
-
console.log(
|
|
28217
|
+
console.log(ok("Outbox clear"));
|
|
27279
28218
|
}
|
|
27280
28219
|
function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
27281
28220
|
const file_path = Path.join(outbox_dir, file);
|
|
@@ -27331,10 +28270,85 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27331
28270
|
0
|
|
27332
28271
|
)
|
|
27333
28272
|
}
|
|
27334
|
-
}
|
|
27335
|
-
},
|
|
27336
|
-
_1: "%s/%s"
|
|
27337
|
-
}), name, thread_name);
|
|
28273
|
+
}
|
|
28274
|
+
},
|
|
28275
|
+
_1: "%s/%s"
|
|
28276
|
+
}), name, thread_name);
|
|
28277
|
+
if (dry_run_mode.contents) {
|
|
28278
|
+
console.log(color("2", Curry._3(Stdlib__Printf.sprintf({
|
|
28279
|
+
TAG: (
|
|
28280
|
+
/* Format */
|
|
28281
|
+
0
|
|
28282
|
+
),
|
|
28283
|
+
_0: {
|
|
28284
|
+
TAG: (
|
|
28285
|
+
/* String_literal */
|
|
28286
|
+
11
|
|
28287
|
+
),
|
|
28288
|
+
_0: "Would: send ",
|
|
28289
|
+
_1: {
|
|
28290
|
+
TAG: (
|
|
28291
|
+
/* String */
|
|
28292
|
+
2
|
|
28293
|
+
),
|
|
28294
|
+
_0: (
|
|
28295
|
+
/* No_padding */
|
|
28296
|
+
0
|
|
28297
|
+
),
|
|
28298
|
+
_1: {
|
|
28299
|
+
TAG: (
|
|
28300
|
+
/* String_literal */
|
|
28301
|
+
11
|
|
28302
|
+
),
|
|
28303
|
+
_0: " to ",
|
|
28304
|
+
_1: {
|
|
28305
|
+
TAG: (
|
|
28306
|
+
/* String */
|
|
28307
|
+
2
|
|
28308
|
+
),
|
|
28309
|
+
_0: (
|
|
28310
|
+
/* No_padding */
|
|
28311
|
+
0
|
|
28312
|
+
),
|
|
28313
|
+
_1: {
|
|
28314
|
+
TAG: (
|
|
28315
|
+
/* String_literal */
|
|
28316
|
+
11
|
|
28317
|
+
),
|
|
28318
|
+
_0: " (branch: ",
|
|
28319
|
+
_1: {
|
|
28320
|
+
TAG: (
|
|
28321
|
+
/* String */
|
|
28322
|
+
2
|
|
28323
|
+
),
|
|
28324
|
+
_0: (
|
|
28325
|
+
/* No_padding */
|
|
28326
|
+
0
|
|
28327
|
+
),
|
|
28328
|
+
_1: {
|
|
28329
|
+
TAG: (
|
|
28330
|
+
/* Char_literal */
|
|
28331
|
+
12
|
|
28332
|
+
),
|
|
28333
|
+
_0: (
|
|
28334
|
+
/* ')' */
|
|
28335
|
+
41
|
|
28336
|
+
),
|
|
28337
|
+
_1: (
|
|
28338
|
+
/* End_of_format */
|
|
28339
|
+
0
|
|
28340
|
+
)
|
|
28341
|
+
}
|
|
28342
|
+
}
|
|
28343
|
+
}
|
|
28344
|
+
}
|
|
28345
|
+
}
|
|
28346
|
+
}
|
|
28347
|
+
},
|
|
28348
|
+
_1: "Would: send %s to %s (branch: %s)"
|
|
28349
|
+
}), file, to_peer, branch_name)));
|
|
28350
|
+
return file;
|
|
28351
|
+
}
|
|
27338
28352
|
const match2 = exec_in(clone_path, "git checkout main 2>/dev/null || git checkout master");
|
|
27339
28353
|
if (match2 !== void 0) {
|
|
27340
28354
|
exec_in(clone_path, "git pull --ff-only 2>/dev/null || true");
|
|
@@ -27383,7 +28397,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27383
28397
|
},
|
|
27384
28398
|
_1: "git checkout -b %s 2>/dev/null || git checkout %s"
|
|
27385
28399
|
}), branch_name, branch_name));
|
|
27386
|
-
const peer_thread_dir = Path.join(clone_path, "threads/
|
|
28400
|
+
const peer_thread_dir = Path.join(clone_path, "threads/in");
|
|
27387
28401
|
ensure_dir(peer_thread_dir);
|
|
27388
28402
|
const prim0 = Path.join(peer_thread_dir, file);
|
|
27389
28403
|
Fs.writeFileSync(prim0, content);
|
|
@@ -27397,7 +28411,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27397
28411
|
/* String_literal */
|
|
27398
28412
|
11
|
|
27399
28413
|
),
|
|
27400
|
-
_0: "git add 'threads/
|
|
28414
|
+
_0: "git add 'threads/in/",
|
|
27401
28415
|
_1: {
|
|
27402
28416
|
TAG: (
|
|
27403
28417
|
/* String */
|
|
@@ -27423,7 +28437,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27423
28437
|
}
|
|
27424
28438
|
}
|
|
27425
28439
|
},
|
|
27426
|
-
_1: "git add 'threads/
|
|
28440
|
+
_1: "git add 'threads/in/%s'"
|
|
27427
28441
|
}), file));
|
|
27428
28442
|
exec_in(clone_path, Curry._2(Stdlib__Printf.sprintf({
|
|
27429
28443
|
TAG: (
|
|
@@ -27574,7 +28588,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27574
28588
|
},
|
|
27575
28589
|
_1: "to:%s thread:%s"
|
|
27576
28590
|
}), to_peer, file));
|
|
27577
|
-
|
|
28591
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
27578
28592
|
TAG: (
|
|
27579
28593
|
/* Format */
|
|
27580
28594
|
0
|
|
@@ -27618,8 +28632,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27618
28632
|
}
|
|
27619
28633
|
},
|
|
27620
28634
|
_1: "Sent to %s: %s"
|
|
27621
|
-
}), to_peer, file);
|
|
27622
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
28635
|
+
}), to_peer, file)));
|
|
27623
28636
|
return file;
|
|
27624
28637
|
}
|
|
27625
28638
|
log_action(hub_path, "outbox.send", Curry._2(Stdlib__Printf.sprintf({
|
|
@@ -27674,7 +28687,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27674
28687
|
},
|
|
27675
28688
|
_1: "to:%s thread:%s error:checkout failed"
|
|
27676
28689
|
}), to_peer, file));
|
|
27677
|
-
|
|
28690
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
27678
28691
|
TAG: (
|
|
27679
28692
|
/* Format */
|
|
27680
28693
|
0
|
|
@@ -27701,8 +28714,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27701
28714
|
}
|
|
27702
28715
|
},
|
|
27703
28716
|
_1: "Failed to send %s"
|
|
27704
|
-
}), file);
|
|
27705
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg$1);
|
|
28717
|
+
}), file)));
|
|
27706
28718
|
return;
|
|
27707
28719
|
}
|
|
27708
28720
|
log_action(hub_path, "outbox.skip", Curry._2(Stdlib__Printf.sprintf({
|
|
@@ -27757,7 +28769,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27757
28769
|
},
|
|
27758
28770
|
_1: "thread:%s to:%s reason:no clone path"
|
|
27759
28771
|
}), file, to_peer));
|
|
27760
|
-
|
|
28772
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
27761
28773
|
TAG: (
|
|
27762
28774
|
/* Format */
|
|
27763
28775
|
0
|
|
@@ -27784,8 +28796,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27784
28796
|
}
|
|
27785
28797
|
},
|
|
27786
28798
|
_1: "No clone path for peer: %s"
|
|
27787
|
-
}), to_peer);
|
|
27788
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg$2);
|
|
28799
|
+
}), to_peer)));
|
|
27789
28800
|
return;
|
|
27790
28801
|
}
|
|
27791
28802
|
log_action(hub_path, "outbox.skip", Curry._2(Stdlib__Printf.sprintf({
|
|
@@ -27840,7 +28851,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27840
28851
|
},
|
|
27841
28852
|
_1: "thread:%s to:%s reason:unknown peer"
|
|
27842
28853
|
}), file, to_peer));
|
|
27843
|
-
|
|
28854
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
27844
28855
|
TAG: (
|
|
27845
28856
|
/* Format */
|
|
27846
28857
|
0
|
|
@@ -27867,8 +28878,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27867
28878
|
}
|
|
27868
28879
|
},
|
|
27869
28880
|
_1: "Unknown peer: %s"
|
|
27870
|
-
}), to_peer);
|
|
27871
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg$3);
|
|
28881
|
+
}), to_peer)));
|
|
27872
28882
|
return;
|
|
27873
28883
|
}
|
|
27874
28884
|
log_action(hub_path, "outbox.skip", Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -27906,7 +28916,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27906
28916
|
},
|
|
27907
28917
|
_1: "thread:%s reason:no recipient"
|
|
27908
28918
|
}), file));
|
|
27909
|
-
|
|
28919
|
+
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
27910
28920
|
TAG: (
|
|
27911
28921
|
/* Format */
|
|
27912
28922
|
0
|
|
@@ -27940,12 +28950,11 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27940
28950
|
}
|
|
27941
28951
|
},
|
|
27942
28952
|
_1: "Skipping %s: no 'to:' in frontmatter"
|
|
27943
|
-
}), file);
|
|
27944
|
-
console.log(color("33", "\xE2\x9A\xA0 ") + msg$4);
|
|
28953
|
+
}), file)));
|
|
27945
28954
|
}
|
|
27946
28955
|
function outbox_flush(hub_path, name) {
|
|
27947
|
-
const outbox_dir = Path.join(hub_path, "threads/outbox");
|
|
27948
|
-
const sent_dir = Path.join(hub_path, "threads/sent");
|
|
28956
|
+
const outbox_dir = Path.join(hub_path, "threads/mail/outbox");
|
|
28957
|
+
const sent_dir = Path.join(hub_path, "threads/mail/sent");
|
|
27949
28958
|
if (Fs.existsSync(outbox_dir)) {
|
|
27950
28959
|
ensure_dir(sent_dir);
|
|
27951
28960
|
const threads = Stdlib__List.filter(is_md_file, Stdlib__Array.to_list(Fs.readdirSync(outbox_dir)));
|
|
@@ -27997,16 +29006,16 @@ function outbox_flush(hub_path, name) {
|
|
|
27997
29006
|
Stdlib__List.filter_map((function(param) {
|
|
27998
29007
|
return send_thread(hub_path, name, peers, outbox_dir, sent_dir, param);
|
|
27999
29008
|
}), threads);
|
|
28000
|
-
console.log(
|
|
29009
|
+
console.log(ok("Outbox flush complete"));
|
|
28001
29010
|
return;
|
|
28002
29011
|
}
|
|
28003
|
-
console.log(
|
|
29012
|
+
console.log(ok("Outbox clear"));
|
|
28004
29013
|
return;
|
|
28005
29014
|
}
|
|
28006
|
-
console.log(
|
|
29015
|
+
console.log(ok("Outbox clear"));
|
|
28007
29016
|
}
|
|
28008
29017
|
function get_next_inbox_item(hub_path) {
|
|
28009
|
-
const inbox_dir = Path.join(hub_path, "threads/inbox");
|
|
29018
|
+
const inbox_dir = Path.join(hub_path, "threads/mail/inbox");
|
|
28010
29019
|
if (!Fs.existsSync(inbox_dir)) {
|
|
28011
29020
|
return;
|
|
28012
29021
|
}
|
|
@@ -28193,21 +29202,33 @@ function find_thread(hub_path, thread_id) {
|
|
|
28193
29202
|
return path2;
|
|
28194
29203
|
}
|
|
28195
29204
|
}), {
|
|
28196
|
-
hd: "
|
|
29205
|
+
hd: "in",
|
|
28197
29206
|
tl: {
|
|
28198
|
-
hd: "
|
|
29207
|
+
hd: "mail/inbox",
|
|
28199
29208
|
tl: {
|
|
28200
|
-
hd: "
|
|
29209
|
+
hd: "mail/outbox",
|
|
28201
29210
|
tl: {
|
|
28202
|
-
hd: "
|
|
29211
|
+
hd: "mail/sent",
|
|
28203
29212
|
tl: {
|
|
28204
|
-
hd: "
|
|
29213
|
+
hd: "doing",
|
|
28205
29214
|
tl: {
|
|
28206
|
-
hd: "
|
|
28207
|
-
tl:
|
|
28208
|
-
|
|
28209
|
-
|
|
28210
|
-
|
|
29215
|
+
hd: "deferred",
|
|
29216
|
+
tl: {
|
|
29217
|
+
hd: "adhoc",
|
|
29218
|
+
tl: {
|
|
29219
|
+
hd: "reflections/daily",
|
|
29220
|
+
tl: {
|
|
29221
|
+
hd: "reflections/weekly",
|
|
29222
|
+
tl: {
|
|
29223
|
+
hd: "reflections/monthly",
|
|
29224
|
+
tl: (
|
|
29225
|
+
/* [] */
|
|
29226
|
+
0
|
|
29227
|
+
)
|
|
29228
|
+
}
|
|
29229
|
+
}
|
|
29230
|
+
}
|
|
29231
|
+
}
|
|
28211
29232
|
}
|
|
28212
29233
|
}
|
|
28213
29234
|
}
|
|
@@ -28259,7 +29280,7 @@ function gtd_delete(hub_path, thread_id) {
|
|
|
28259
29280
|
if (path !== void 0) {
|
|
28260
29281
|
Fs.unlinkSync(path);
|
|
28261
29282
|
log_action(hub_path, "gtd.delete", thread_id);
|
|
28262
|
-
|
|
29283
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
28263
29284
|
TAG: (
|
|
28264
29285
|
/* Format */
|
|
28265
29286
|
0
|
|
@@ -28286,39 +29307,37 @@ function gtd_delete(hub_path, thread_id) {
|
|
|
28286
29307
|
}
|
|
28287
29308
|
},
|
|
28288
29309
|
_1: "Deleted: %s"
|
|
28289
|
-
}), thread_id);
|
|
28290
|
-
|
|
28291
|
-
|
|
28292
|
-
}
|
|
28293
|
-
const msg$1 = Curry._1(Stdlib__Printf.sprintf({
|
|
28294
|
-
TAG: (
|
|
28295
|
-
/* Format */
|
|
28296
|
-
0
|
|
28297
|
-
),
|
|
28298
|
-
_0: {
|
|
29310
|
+
}), thread_id)));
|
|
29311
|
+
} else {
|
|
29312
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28299
29313
|
TAG: (
|
|
28300
|
-
/*
|
|
28301
|
-
|
|
29314
|
+
/* Format */
|
|
29315
|
+
0
|
|
28302
29316
|
),
|
|
28303
|
-
_0:
|
|
28304
|
-
_1: {
|
|
29317
|
+
_0: {
|
|
28305
29318
|
TAG: (
|
|
28306
|
-
/*
|
|
28307
|
-
|
|
28308
|
-
),
|
|
28309
|
-
_0: (
|
|
28310
|
-
/* No_padding */
|
|
28311
|
-
0
|
|
29319
|
+
/* String_literal */
|
|
29320
|
+
11
|
|
28312
29321
|
),
|
|
28313
|
-
|
|
28314
|
-
|
|
28315
|
-
|
|
28316
|
-
|
|
28317
|
-
|
|
28318
|
-
|
|
28319
|
-
|
|
28320
|
-
|
|
28321
|
-
|
|
29322
|
+
_0: "Thread not found: ",
|
|
29323
|
+
_1: {
|
|
29324
|
+
TAG: (
|
|
29325
|
+
/* String */
|
|
29326
|
+
2
|
|
29327
|
+
),
|
|
29328
|
+
_0: (
|
|
29329
|
+
/* No_padding */
|
|
29330
|
+
0
|
|
29331
|
+
),
|
|
29332
|
+
_1: (
|
|
29333
|
+
/* End_of_format */
|
|
29334
|
+
0
|
|
29335
|
+
)
|
|
29336
|
+
}
|
|
29337
|
+
},
|
|
29338
|
+
_1: "Thread not found: %s"
|
|
29339
|
+
}), thread_id)));
|
|
29340
|
+
}
|
|
28322
29341
|
}
|
|
28323
29342
|
function gtd_defer(hub_path, thread_id, until) {
|
|
28324
29343
|
const path = find_thread(hub_path, thread_id);
|
|
@@ -28385,7 +29404,7 @@ function gtd_defer(hub_path, thread_id, until) {
|
|
|
28385
29404
|
_1: "%s until:%s"
|
|
28386
29405
|
}), thread_id, until_str));
|
|
28387
29406
|
const suffix = until !== void 0 ? " until " + until : "";
|
|
28388
|
-
|
|
29407
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
28389
29408
|
TAG: (
|
|
28390
29409
|
/* Format */
|
|
28391
29410
|
0
|
|
@@ -28422,11 +29441,10 @@ function gtd_defer(hub_path, thread_id, until) {
|
|
|
28422
29441
|
}
|
|
28423
29442
|
},
|
|
28424
29443
|
_1: "Deferred: %s%s"
|
|
28425
|
-
}), thread_id, suffix);
|
|
28426
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
29444
|
+
}), thread_id, suffix)));
|
|
28427
29445
|
return;
|
|
28428
29446
|
}
|
|
28429
|
-
|
|
29447
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28430
29448
|
TAG: (
|
|
28431
29449
|
/* Format */
|
|
28432
29450
|
0
|
|
@@ -28453,13 +29471,12 @@ function gtd_defer(hub_path, thread_id, until) {
|
|
|
28453
29471
|
}
|
|
28454
29472
|
},
|
|
28455
29473
|
_1: "Thread not found: %s"
|
|
28456
|
-
}), thread_id);
|
|
28457
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg$1);
|
|
29474
|
+
}), thread_id)));
|
|
28458
29475
|
}
|
|
28459
29476
|
function gtd_delegate(hub_path, name, thread_id, peer) {
|
|
28460
29477
|
const path = find_thread(hub_path, thread_id);
|
|
28461
29478
|
if (path !== void 0) {
|
|
28462
|
-
const outbox_dir = Path.join(hub_path, "threads/outbox");
|
|
29479
|
+
const outbox_dir = Path.join(hub_path, "threads/mail/outbox");
|
|
28463
29480
|
ensure_dir(outbox_dir);
|
|
28464
29481
|
const content = Fs.readFileSync(path, "utf8");
|
|
28465
29482
|
const prim1 = Cn_lib.update_frontmatter(content, {
|
|
@@ -28525,7 +29542,7 @@ function gtd_delegate(hub_path, name, thread_id, peer) {
|
|
|
28525
29542
|
},
|
|
28526
29543
|
_1: "%s to:%s"
|
|
28527
29544
|
}), thread_id, peer));
|
|
28528
|
-
|
|
29545
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
28529
29546
|
TAG: (
|
|
28530
29547
|
/* Format */
|
|
28531
29548
|
0
|
|
@@ -28569,12 +29586,11 @@ function gtd_delegate(hub_path, name, thread_id, peer) {
|
|
|
28569
29586
|
}
|
|
28570
29587
|
},
|
|
28571
29588
|
_1: "Delegated to %s: %s"
|
|
28572
|
-
}), peer, thread_id);
|
|
28573
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
29589
|
+
}), peer, thread_id)));
|
|
28574
29590
|
console.log(color("36", 'Run "cn sync" to send'));
|
|
28575
29591
|
return;
|
|
28576
29592
|
}
|
|
28577
|
-
|
|
29593
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28578
29594
|
TAG: (
|
|
28579
29595
|
/* Format */
|
|
28580
29596
|
0
|
|
@@ -28601,8 +29617,7 @@ function gtd_delegate(hub_path, name, thread_id, peer) {
|
|
|
28601
29617
|
}
|
|
28602
29618
|
},
|
|
28603
29619
|
_1: "Thread not found: %s"
|
|
28604
|
-
}), thread_id);
|
|
28605
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg$1);
|
|
29620
|
+
}), thread_id)));
|
|
28606
29621
|
}
|
|
28607
29622
|
function gtd_do(hub_path, thread_id) {
|
|
28608
29623
|
const path = find_thread(hub_path, thread_id);
|
|
@@ -28624,7 +29639,7 @@ function gtd_do(hub_path, thread_id) {
|
|
|
28624
29639
|
Fs.writeFileSync(prim0, prim1);
|
|
28625
29640
|
Fs.unlinkSync(path);
|
|
28626
29641
|
log_action(hub_path, "gtd.do", thread_id);
|
|
28627
|
-
|
|
29642
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
28628
29643
|
TAG: (
|
|
28629
29644
|
/* Format */
|
|
28630
29645
|
0
|
|
@@ -28651,11 +29666,10 @@ function gtd_do(hub_path, thread_id) {
|
|
|
28651
29666
|
}
|
|
28652
29667
|
},
|
|
28653
29668
|
_1: "Started: %s"
|
|
28654
|
-
}), thread_id);
|
|
28655
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
29669
|
+
}), thread_id)));
|
|
28656
29670
|
return;
|
|
28657
29671
|
}
|
|
28658
|
-
|
|
29672
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28659
29673
|
TAG: (
|
|
28660
29674
|
/* Format */
|
|
28661
29675
|
0
|
|
@@ -28682,8 +29696,7 @@ function gtd_do(hub_path, thread_id) {
|
|
|
28682
29696
|
}
|
|
28683
29697
|
},
|
|
28684
29698
|
_1: "Thread not found: %s"
|
|
28685
|
-
}), thread_id);
|
|
28686
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg$1);
|
|
29699
|
+
}), thread_id)));
|
|
28687
29700
|
}
|
|
28688
29701
|
function gtd_done(hub_path, thread_id) {
|
|
28689
29702
|
const path = find_thread(hub_path, thread_id);
|
|
@@ -28705,7 +29718,7 @@ function gtd_done(hub_path, thread_id) {
|
|
|
28705
29718
|
Fs.writeFileSync(prim0, prim1);
|
|
28706
29719
|
Fs.unlinkSync(path);
|
|
28707
29720
|
log_action(hub_path, "gtd.done", thread_id);
|
|
28708
|
-
|
|
29721
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
28709
29722
|
TAG: (
|
|
28710
29723
|
/* Format */
|
|
28711
29724
|
0
|
|
@@ -28739,11 +29752,10 @@ function gtd_done(hub_path, thread_id) {
|
|
|
28739
29752
|
}
|
|
28740
29753
|
},
|
|
28741
29754
|
_1: "Completed: %s \xE2\x86\x92 archived"
|
|
28742
|
-
}), thread_id);
|
|
28743
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
29755
|
+
}), thread_id)));
|
|
28744
29756
|
return;
|
|
28745
29757
|
}
|
|
28746
|
-
|
|
29758
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28747
29759
|
TAG: (
|
|
28748
29760
|
/* Format */
|
|
28749
29761
|
0
|
|
@@ -28770,8 +29782,7 @@ function gtd_done(hub_path, thread_id) {
|
|
|
28770
29782
|
}
|
|
28771
29783
|
},
|
|
28772
29784
|
_1: "Thread not found: %s"
|
|
28773
|
-
}), thread_id);
|
|
28774
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg$1);
|
|
29785
|
+
}), thread_id)));
|
|
28775
29786
|
}
|
|
28776
29787
|
function run_read(hub_path, thread_id) {
|
|
28777
29788
|
const path = find_thread(hub_path, thread_id);
|
|
@@ -28896,7 +29907,7 @@ function run_read(hub_path, thread_id) {
|
|
|
28896
29907
|
console.log(content);
|
|
28897
29908
|
return;
|
|
28898
29909
|
}
|
|
28899
|
-
|
|
29910
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
28900
29911
|
TAG: (
|
|
28901
29912
|
/* Format */
|
|
28902
29913
|
0
|
|
@@ -28923,11 +29934,10 @@ function run_read(hub_path, thread_id) {
|
|
|
28923
29934
|
}
|
|
28924
29935
|
},
|
|
28925
29936
|
_1: "Thread not found: %s"
|
|
28926
|
-
}), thread_id);
|
|
28927
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg);
|
|
29937
|
+
}), thread_id)));
|
|
28928
29938
|
}
|
|
28929
29939
|
function run_inbox_list(hub_path) {
|
|
28930
|
-
const inbox_dir = Path.join(hub_path, "threads/inbox");
|
|
29940
|
+
const inbox_dir = Path.join(hub_path, "threads/mail/inbox");
|
|
28931
29941
|
if (Fs.existsSync(inbox_dir)) {
|
|
28932
29942
|
const ts = Stdlib__List.filter(is_md_file, Stdlib__Array.to_list(Fs.readdirSync(inbox_dir)));
|
|
28933
29943
|
if (ts) {
|
|
@@ -28999,7 +30009,7 @@ function run_inbox_list(hub_path) {
|
|
|
28999
30009
|
console.log("(empty)");
|
|
29000
30010
|
}
|
|
29001
30011
|
function run_outbox_list(hub_path) {
|
|
29002
|
-
const outbox_dir = Path.join(hub_path, "threads/outbox");
|
|
30012
|
+
const outbox_dir = Path.join(hub_path, "threads/mail/outbox");
|
|
29003
30013
|
if (Fs.existsSync(outbox_dir)) {
|
|
29004
30014
|
const ts = Stdlib__List.filter(is_md_file, Stdlib__Array.to_list(Fs.readdirSync(outbox_dir)));
|
|
29005
30015
|
if (ts) {
|
|
@@ -29157,7 +30167,7 @@ function run_commit(hub_path, name, msg) {
|
|
|
29157
30167
|
}), escaped));
|
|
29158
30168
|
if (match2 !== void 0) {
|
|
29159
30169
|
log_action(hub_path, "commit", message);
|
|
29160
|
-
|
|
30170
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
29161
30171
|
TAG: (
|
|
29162
30172
|
/* Format */
|
|
29163
30173
|
0
|
|
@@ -29184,39 +30194,38 @@ function run_commit(hub_path, name, msg) {
|
|
|
29184
30194
|
}
|
|
29185
30195
|
},
|
|
29186
30196
|
_1: "Committed: %s"
|
|
29187
|
-
}), message);
|
|
29188
|
-
|
|
29189
|
-
|
|
29190
|
-
}
|
|
29191
|
-
log_action(hub_path, "commit", Curry._1(Stdlib__Printf.sprintf({
|
|
29192
|
-
TAG: (
|
|
29193
|
-
/* Format */
|
|
29194
|
-
0
|
|
29195
|
-
),
|
|
29196
|
-
_0: {
|
|
30197
|
+
}), message)));
|
|
30198
|
+
} else {
|
|
30199
|
+
log_action(hub_path, "commit", Curry._1(Stdlib__Printf.sprintf({
|
|
29197
30200
|
TAG: (
|
|
29198
|
-
/*
|
|
29199
|
-
|
|
30201
|
+
/* Format */
|
|
30202
|
+
0
|
|
29200
30203
|
),
|
|
29201
|
-
_0:
|
|
29202
|
-
_1: {
|
|
30204
|
+
_0: {
|
|
29203
30205
|
TAG: (
|
|
29204
|
-
/*
|
|
29205
|
-
|
|
29206
|
-
),
|
|
29207
|
-
_0: (
|
|
29208
|
-
/* No_padding */
|
|
29209
|
-
0
|
|
30206
|
+
/* String_literal */
|
|
30207
|
+
11
|
|
29210
30208
|
),
|
|
29211
|
-
|
|
29212
|
-
|
|
29213
|
-
|
|
29214
|
-
|
|
29215
|
-
|
|
29216
|
-
|
|
29217
|
-
|
|
29218
|
-
|
|
29219
|
-
|
|
30209
|
+
_0: "error:",
|
|
30210
|
+
_1: {
|
|
30211
|
+
TAG: (
|
|
30212
|
+
/* String */
|
|
30213
|
+
2
|
|
30214
|
+
),
|
|
30215
|
+
_0: (
|
|
30216
|
+
/* No_padding */
|
|
30217
|
+
0
|
|
30218
|
+
),
|
|
30219
|
+
_1: (
|
|
30220
|
+
/* End_of_format */
|
|
30221
|
+
0
|
|
30222
|
+
)
|
|
30223
|
+
}
|
|
30224
|
+
},
|
|
30225
|
+
_1: "error:%s"
|
|
30226
|
+
}), message));
|
|
30227
|
+
console.log(fail("Commit failed"));
|
|
30228
|
+
}
|
|
29220
30229
|
}
|
|
29221
30230
|
function run_push(hub_path) {
|
|
29222
30231
|
const branch = exec_in(hub_path, "git branch --show-current");
|
|
@@ -29252,7 +30261,7 @@ function run_push(hub_path) {
|
|
|
29252
30261
|
}), branch$1));
|
|
29253
30262
|
if (match2 !== void 0) {
|
|
29254
30263
|
log_action(hub_path, "push", branch$1);
|
|
29255
|
-
|
|
30264
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
29256
30265
|
TAG: (
|
|
29257
30266
|
/* Format */
|
|
29258
30267
|
0
|
|
@@ -29279,18 +30288,17 @@ function run_push(hub_path) {
|
|
|
29279
30288
|
}
|
|
29280
30289
|
},
|
|
29281
30290
|
_1: "Pushed to origin/%s"
|
|
29282
|
-
}), branch$1);
|
|
29283
|
-
|
|
29284
|
-
|
|
30291
|
+
}), branch$1)));
|
|
30292
|
+
} else {
|
|
30293
|
+
log_action(hub_path, "push", "error");
|
|
30294
|
+
console.log(fail("Push failed"));
|
|
29285
30295
|
}
|
|
29286
|
-
log_action(hub_path, "push", "error");
|
|
29287
|
-
console.log(color("31", "\xE2\x9C\x97 ") + "Push failed");
|
|
29288
30296
|
return;
|
|
29289
30297
|
}
|
|
29290
|
-
console.log(
|
|
30298
|
+
console.log(fail("Could not determine current branch"));
|
|
29291
30299
|
}
|
|
29292
30300
|
function run_send(hub_path, peer, message) {
|
|
29293
|
-
const outbox_dir = Path.join(hub_path, "threads/outbox");
|
|
30301
|
+
const outbox_dir = Path.join(hub_path, "threads/mail/outbox");
|
|
29294
30302
|
ensure_dir(outbox_dir);
|
|
29295
30303
|
const slug = message.slice(0, 30).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
29296
30304
|
const file_name = slug + ".md";
|
|
@@ -29436,7 +30444,7 @@ function run_send(hub_path, peer, message) {
|
|
|
29436
30444
|
},
|
|
29437
30445
|
_1: "to:%s thread:%s"
|
|
29438
30446
|
}), peer, slug));
|
|
29439
|
-
|
|
30447
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
29440
30448
|
TAG: (
|
|
29441
30449
|
/* Format */
|
|
29442
30450
|
0
|
|
@@ -29480,8 +30488,7 @@ function run_send(hub_path, peer, message) {
|
|
|
29480
30488
|
}
|
|
29481
30489
|
},
|
|
29482
30490
|
_1: "Created message to %s: %s"
|
|
29483
|
-
}), peer, slug);
|
|
29484
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
30491
|
+
}), peer, slug)));
|
|
29485
30492
|
console.log(color("36", 'Run "cn sync" to send'));
|
|
29486
30493
|
}
|
|
29487
30494
|
function run_reply(hub_path, thread_id, message) {
|
|
@@ -29561,7 +30568,7 @@ function run_reply(hub_path, thread_id, message) {
|
|
|
29561
30568
|
},
|
|
29562
30569
|
_1: "thread:%s"
|
|
29563
30570
|
}), thread_id));
|
|
29564
|
-
|
|
30571
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
29565
30572
|
TAG: (
|
|
29566
30573
|
/* Format */
|
|
29567
30574
|
0
|
|
@@ -29588,11 +30595,10 @@ function run_reply(hub_path, thread_id, message) {
|
|
|
29588
30595
|
}
|
|
29589
30596
|
},
|
|
29590
30597
|
_1: "Replied to %s"
|
|
29591
|
-
}), thread_id);
|
|
29592
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
30598
|
+
}), thread_id)));
|
|
29593
30599
|
return;
|
|
29594
30600
|
}
|
|
29595
|
-
|
|
30601
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
29596
30602
|
TAG: (
|
|
29597
30603
|
/* Format */
|
|
29598
30604
|
0
|
|
@@ -29619,8 +30625,7 @@ function run_reply(hub_path, thread_id, message) {
|
|
|
29619
30625
|
}
|
|
29620
30626
|
},
|
|
29621
30627
|
_1: "Thread not found: %s"
|
|
29622
|
-
}), thread_id);
|
|
29623
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg$1);
|
|
30628
|
+
}), thread_id)));
|
|
29624
30629
|
}
|
|
29625
30630
|
function run_status(hub_path, name) {
|
|
29626
30631
|
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -29689,7 +30694,7 @@ function run_status(hub_path, name) {
|
|
|
29689
30694
|
}
|
|
29690
30695
|
},
|
|
29691
30696
|
_1: "hub..................... %s\n"
|
|
29692
|
-
}), color("32",
|
|
30697
|
+
}), color("32", check));
|
|
29693
30698
|
Curry._2(Stdlib__Printf.printf({
|
|
29694
30699
|
TAG: (
|
|
29695
30700
|
/* Format */
|
|
@@ -29747,7 +30752,7 @@ function run_status(hub_path, name) {
|
|
|
29747
30752
|
}
|
|
29748
30753
|
},
|
|
29749
30754
|
_1: "name.................... %s %s\n"
|
|
29750
|
-
}), color("32",
|
|
30755
|
+
}), color("32", check), name);
|
|
29751
30756
|
Curry._2(Stdlib__Printf.printf({
|
|
29752
30757
|
TAG: (
|
|
29753
30758
|
/* Format */
|
|
@@ -29805,7 +30810,7 @@ function run_status(hub_path, name) {
|
|
|
29805
30810
|
}
|
|
29806
30811
|
},
|
|
29807
30812
|
_1: "path.................... %s %s\n"
|
|
29808
|
-
}), color("32",
|
|
30813
|
+
}), color("32", check), hub_path);
|
|
29809
30814
|
console.log("");
|
|
29810
30815
|
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
29811
30816
|
TAG: (
|
|
@@ -30019,7 +31024,7 @@ function run_doctor(hub_path) {
|
|
|
30019
31024
|
/* '.' */
|
|
30020
31025
|
46
|
|
30021
31026
|
);
|
|
30022
|
-
const status = c.passed ? color("32", "
|
|
31027
|
+
const status = c.passed ? color("32", check + (" " + c.value)) : color("31", cross + (" " + c.value));
|
|
30023
31028
|
Curry._3(Stdlib__Printf.printf({
|
|
30024
31029
|
TAG: (
|
|
30025
31030
|
/* Format */
|
|
@@ -30088,9 +31093,9 @@ function run_doctor(hub_path) {
|
|
|
30088
31093
|
}), checks));
|
|
30089
31094
|
const oks = Stdlib__List.length(checks) - fails | 0;
|
|
30090
31095
|
if (fails === 0) {
|
|
30091
|
-
console.log(
|
|
31096
|
+
console.log(ok("All critical checks passed."));
|
|
30092
31097
|
} else {
|
|
30093
|
-
|
|
31098
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
30094
31099
|
TAG: (
|
|
30095
31100
|
/* Format */
|
|
30096
31101
|
0
|
|
@@ -30125,8 +31130,7 @@ function run_doctor(hub_path) {
|
|
|
30125
31130
|
}
|
|
30126
31131
|
},
|
|
30127
31132
|
_1: "%d issue(s) found."
|
|
30128
|
-
}), fails);
|
|
30129
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg);
|
|
31133
|
+
}), fails)));
|
|
30130
31134
|
}
|
|
30131
31135
|
console.log(color("2", Curry._3(Stdlib__Printf.sprintf({
|
|
30132
31136
|
TAG: (
|
|
@@ -30475,7 +31479,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30475
31479
|
case /* Ack */
|
|
30476
31480
|
0:
|
|
30477
31481
|
log_action(hub_path, "op.ack", input_id);
|
|
30478
|
-
|
|
31482
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
30479
31483
|
TAG: (
|
|
30480
31484
|
/* Format */
|
|
30481
31485
|
0
|
|
@@ -30502,14 +31506,13 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30502
31506
|
}
|
|
30503
31507
|
},
|
|
30504
31508
|
_1: "Ack: %s"
|
|
30505
|
-
}), input_id);
|
|
30506
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
31509
|
+
}), input_id)));
|
|
30507
31510
|
return;
|
|
30508
31511
|
case /* Done */
|
|
30509
31512
|
1:
|
|
30510
31513
|
const id = op._0;
|
|
30511
31514
|
log_action(hub_path, "op.done", id);
|
|
30512
|
-
|
|
31515
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
30513
31516
|
TAG: (
|
|
30514
31517
|
/* Format */
|
|
30515
31518
|
0
|
|
@@ -30536,8 +31539,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30536
31539
|
}
|
|
30537
31540
|
},
|
|
30538
31541
|
_1: "Done: %s"
|
|
30539
|
-
}), id);
|
|
30540
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$1);
|
|
31542
|
+
}), id)));
|
|
30541
31543
|
return;
|
|
30542
31544
|
case /* Fail */
|
|
30543
31545
|
2:
|
|
@@ -30588,7 +31590,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30588
31590
|
},
|
|
30589
31591
|
_1: "id:%s reason:%s"
|
|
30590
31592
|
}), id$1, reason));
|
|
30591
|
-
|
|
31593
|
+
console.log(warn(Curry._2(Stdlib__Printf.sprintf({
|
|
30592
31594
|
TAG: (
|
|
30593
31595
|
/* Format */
|
|
30594
31596
|
0
|
|
@@ -30632,8 +31634,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30632
31634
|
}
|
|
30633
31635
|
},
|
|
30634
31636
|
_1: "Failed: %s - %s"
|
|
30635
|
-
}), id$1, reason);
|
|
30636
|
-
console.log(color("33", "\xE2\x9A\xA0 ") + msg$2);
|
|
31637
|
+
}), id$1, reason)));
|
|
30637
31638
|
return;
|
|
30638
31639
|
case /* Reply */
|
|
30639
31640
|
3:
|
|
@@ -30714,7 +31715,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30714
31715
|
},
|
|
30715
31716
|
_1: "thread:%s"
|
|
30716
31717
|
}), id$2));
|
|
30717
|
-
|
|
31718
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
30718
31719
|
TAG: (
|
|
30719
31720
|
/* Format */
|
|
30720
31721
|
0
|
|
@@ -30741,8 +31742,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30741
31742
|
}
|
|
30742
31743
|
},
|
|
30743
31744
|
_1: "Replied to %s"
|
|
30744
|
-
}), id$2);
|
|
30745
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$3);
|
|
31745
|
+
}), id$2)));
|
|
30746
31746
|
return;
|
|
30747
31747
|
}
|
|
30748
31748
|
log_action(hub_path, "op.reply", Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -30780,7 +31780,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30780
31780
|
},
|
|
30781
31781
|
_1: "thread:%s (not found)"
|
|
30782
31782
|
}), id$2));
|
|
30783
|
-
|
|
31783
|
+
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
30784
31784
|
TAG: (
|
|
30785
31785
|
/* Format */
|
|
30786
31786
|
0
|
|
@@ -30807,25 +31807,24 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30807
31807
|
}
|
|
30808
31808
|
},
|
|
30809
31809
|
_1: "Thread not found for reply: %s"
|
|
30810
|
-
}), id$2);
|
|
30811
|
-
console.log(color("33", "\xE2\x9A\xA0 ") + msg$4);
|
|
31810
|
+
}), id$2)));
|
|
30812
31811
|
return;
|
|
30813
31812
|
case /* Send */
|
|
30814
31813
|
4:
|
|
30815
31814
|
const body_opt = op._2;
|
|
30816
|
-
const msg
|
|
31815
|
+
const msg = op._1;
|
|
30817
31816
|
const peer = op._0;
|
|
30818
|
-
const outbox_dir = Path.join(hub_path, "threads/outbox");
|
|
31817
|
+
const outbox_dir = Path.join(hub_path, "threads/mail/outbox");
|
|
30819
31818
|
ensure_dir(outbox_dir);
|
|
30820
|
-
const slug = msg
|
|
31819
|
+
const slug = msg.slice(0, 30).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
30821
31820
|
const file_name = slug + ".md";
|
|
30822
31821
|
const match2 = Stdlib__String.split_on_char(
|
|
30823
31822
|
/* '\n' */
|
|
30824
31823
|
10,
|
|
30825
|
-
msg
|
|
31824
|
+
msg
|
|
30826
31825
|
);
|
|
30827
|
-
const first_line = match2 ? match2.hd : msg
|
|
30828
|
-
const body = body_opt !== void 0 ? body_opt : msg
|
|
31826
|
+
const first_line = match2 ? match2.hd : msg;
|
|
31827
|
+
const body = body_opt !== void 0 ? body_opt : msg;
|
|
30829
31828
|
const content = Curry._5(Stdlib__Printf.sprintf({
|
|
30830
31829
|
TAG: (
|
|
30831
31830
|
/* Format */
|
|
@@ -30979,7 +31978,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30979
31978
|
},
|
|
30980
31979
|
_1: "to:%s thread:%s"
|
|
30981
31980
|
}), peer, slug));
|
|
30982
|
-
|
|
31981
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
30983
31982
|
TAG: (
|
|
30984
31983
|
/* Format */
|
|
30985
31984
|
0
|
|
@@ -31006,8 +32005,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31006
32005
|
}
|
|
31007
32006
|
},
|
|
31008
32007
|
_1: "Queued message to %s"
|
|
31009
|
-
}), peer);
|
|
31010
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$6);
|
|
32008
|
+
}), peer)));
|
|
31011
32009
|
return;
|
|
31012
32010
|
case /* Delegate */
|
|
31013
32011
|
5:
|
|
@@ -31015,7 +32013,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31015
32013
|
const id$3 = op._0;
|
|
31016
32014
|
const path$1 = find_thread(hub_path, id$3);
|
|
31017
32015
|
if (path$1 !== void 0) {
|
|
31018
|
-
const outbox_dir$1 = Path.join(hub_path, "threads/outbox");
|
|
32016
|
+
const outbox_dir$1 = Path.join(hub_path, "threads/mail/outbox");
|
|
31019
32017
|
ensure_dir(outbox_dir$1);
|
|
31020
32018
|
const content$1 = Fs.readFileSync(path$1, "utf8");
|
|
31021
32019
|
const prim1 = Cn_lib.update_frontmatter(content$1, {
|
|
@@ -31081,7 +32079,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31081
32079
|
},
|
|
31082
32080
|
_1: "%s to:%s"
|
|
31083
32081
|
}), id$3, peer$1));
|
|
31084
|
-
|
|
32082
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
31085
32083
|
TAG: (
|
|
31086
32084
|
/* Format */
|
|
31087
32085
|
0
|
|
@@ -31125,11 +32123,10 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31125
32123
|
}
|
|
31126
32124
|
},
|
|
31127
32125
|
_1: "Delegated %s to %s"
|
|
31128
|
-
}), id$3, peer$1);
|
|
31129
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$7);
|
|
32126
|
+
}), id$3, peer$1)));
|
|
31130
32127
|
return;
|
|
31131
32128
|
}
|
|
31132
|
-
|
|
32129
|
+
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
31133
32130
|
TAG: (
|
|
31134
32131
|
/* Format */
|
|
31135
32132
|
0
|
|
@@ -31156,8 +32153,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31156
32153
|
}
|
|
31157
32154
|
},
|
|
31158
32155
|
_1: "Thread not found for delegate: %s"
|
|
31159
|
-
}), id$3);
|
|
31160
|
-
console.log(color("33", "\xE2\x9A\xA0 ") + msg$8);
|
|
32156
|
+
}), id$3)));
|
|
31161
32157
|
return;
|
|
31162
32158
|
case /* Defer */
|
|
31163
32159
|
6:
|
|
@@ -31225,7 +32221,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31225
32221
|
},
|
|
31226
32222
|
_1: "%s until:%s"
|
|
31227
32223
|
}), id$4, until_str));
|
|
31228
|
-
|
|
32224
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
31229
32225
|
TAG: (
|
|
31230
32226
|
/* Format */
|
|
31231
32227
|
0
|
|
@@ -31252,11 +32248,10 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31252
32248
|
}
|
|
31253
32249
|
},
|
|
31254
32250
|
_1: "Deferred %s"
|
|
31255
|
-
}), id$4);
|
|
31256
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$9);
|
|
32251
|
+
}), id$4)));
|
|
31257
32252
|
return;
|
|
31258
32253
|
}
|
|
31259
|
-
|
|
32254
|
+
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
31260
32255
|
TAG: (
|
|
31261
32256
|
/* Format */
|
|
31262
32257
|
0
|
|
@@ -31283,8 +32278,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31283
32278
|
}
|
|
31284
32279
|
},
|
|
31285
32280
|
_1: "Thread not found for defer: %s"
|
|
31286
|
-
}), id$4);
|
|
31287
|
-
console.log(color("33", "\xE2\x9A\xA0 ") + msg$10);
|
|
32281
|
+
}), id$4)));
|
|
31288
32282
|
return;
|
|
31289
32283
|
case /* Delete */
|
|
31290
32284
|
7:
|
|
@@ -31293,7 +32287,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31293
32287
|
if (path$3 !== void 0) {
|
|
31294
32288
|
Fs.unlinkSync(path$3);
|
|
31295
32289
|
log_action(hub_path, "op.delete", id$5);
|
|
31296
|
-
|
|
32290
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
31297
32291
|
TAG: (
|
|
31298
32292
|
/* Format */
|
|
31299
32293
|
0
|
|
@@ -31320,50 +32314,14 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31320
32314
|
}
|
|
31321
32315
|
},
|
|
31322
32316
|
_1: "Deleted %s"
|
|
31323
|
-
}), id$5);
|
|
31324
|
-
|
|
31325
|
-
|
|
31326
|
-
}
|
|
31327
|
-
log_action(hub_path, "op.delete", Curry._1(Stdlib__Printf.sprintf({
|
|
31328
|
-
TAG: (
|
|
31329
|
-
/* Format */
|
|
31330
|
-
0
|
|
31331
|
-
),
|
|
31332
|
-
_0: {
|
|
32317
|
+
}), id$5)));
|
|
32318
|
+
} else {
|
|
32319
|
+
log_action(hub_path, "op.delete", Curry._1(Stdlib__Printf.sprintf({
|
|
31333
32320
|
TAG: (
|
|
31334
|
-
/*
|
|
31335
|
-
2
|
|
31336
|
-
),
|
|
31337
|
-
_0: (
|
|
31338
|
-
/* No_padding */
|
|
32321
|
+
/* Format */
|
|
31339
32322
|
0
|
|
31340
32323
|
),
|
|
31341
|
-
|
|
31342
|
-
TAG: (
|
|
31343
|
-
/* String_literal */
|
|
31344
|
-
11
|
|
31345
|
-
),
|
|
31346
|
-
_0: " (not found)",
|
|
31347
|
-
_1: (
|
|
31348
|
-
/* End_of_format */
|
|
31349
|
-
0
|
|
31350
|
-
)
|
|
31351
|
-
}
|
|
31352
|
-
},
|
|
31353
|
-
_1: "%s (not found)"
|
|
31354
|
-
}), id$5));
|
|
31355
|
-
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
31356
|
-
TAG: (
|
|
31357
|
-
/* Format */
|
|
31358
|
-
0
|
|
31359
|
-
),
|
|
31360
|
-
_0: {
|
|
31361
|
-
TAG: (
|
|
31362
|
-
/* String_literal */
|
|
31363
|
-
11
|
|
31364
|
-
),
|
|
31365
|
-
_0: "Thread already gone: ",
|
|
31366
|
-
_1: {
|
|
32324
|
+
_0: {
|
|
31367
32325
|
TAG: (
|
|
31368
32326
|
/* String */
|
|
31369
32327
|
2
|
|
@@ -31372,14 +32330,49 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31372
32330
|
/* No_padding */
|
|
31373
32331
|
0
|
|
31374
32332
|
),
|
|
31375
|
-
_1:
|
|
31376
|
-
|
|
31377
|
-
|
|
31378
|
-
|
|
31379
|
-
|
|
31380
|
-
|
|
31381
|
-
|
|
31382
|
-
|
|
32333
|
+
_1: {
|
|
32334
|
+
TAG: (
|
|
32335
|
+
/* String_literal */
|
|
32336
|
+
11
|
|
32337
|
+
),
|
|
32338
|
+
_0: " (not found)",
|
|
32339
|
+
_1: (
|
|
32340
|
+
/* End_of_format */
|
|
32341
|
+
0
|
|
32342
|
+
)
|
|
32343
|
+
}
|
|
32344
|
+
},
|
|
32345
|
+
_1: "%s (not found)"
|
|
32346
|
+
}), id$5));
|
|
32347
|
+
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
32348
|
+
TAG: (
|
|
32349
|
+
/* Format */
|
|
32350
|
+
0
|
|
32351
|
+
),
|
|
32352
|
+
_0: {
|
|
32353
|
+
TAG: (
|
|
32354
|
+
/* String_literal */
|
|
32355
|
+
11
|
|
32356
|
+
),
|
|
32357
|
+
_0: "Thread already gone: ",
|
|
32358
|
+
_1: {
|
|
32359
|
+
TAG: (
|
|
32360
|
+
/* String */
|
|
32361
|
+
2
|
|
32362
|
+
),
|
|
32363
|
+
_0: (
|
|
32364
|
+
/* No_padding */
|
|
32365
|
+
0
|
|
32366
|
+
),
|
|
32367
|
+
_1: (
|
|
32368
|
+
/* End_of_format */
|
|
32369
|
+
0
|
|
32370
|
+
)
|
|
32371
|
+
}
|
|
32372
|
+
},
|
|
32373
|
+
_1: "Thread already gone: %s"
|
|
32374
|
+
}), id$5)));
|
|
32375
|
+
}
|
|
31383
32376
|
return;
|
|
31384
32377
|
case /* Surface */
|
|
31385
32378
|
8:
|
|
@@ -31572,7 +32565,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31572
32565
|
},
|
|
31573
32566
|
_1: "id:%s desc:%s"
|
|
31574
32567
|
}), slug$1, desc));
|
|
31575
|
-
|
|
32568
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
31576
32569
|
TAG: (
|
|
31577
32570
|
/* Format */
|
|
31578
32571
|
0
|
|
@@ -31599,8 +32592,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
31599
32592
|
}
|
|
31600
32593
|
},
|
|
31601
32594
|
_1: "Surfaced MCA: %s"
|
|
31602
|
-
}), desc);
|
|
31603
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$12);
|
|
32595
|
+
}), desc)));
|
|
31604
32596
|
return;
|
|
31605
32597
|
}
|
|
31606
32598
|
}
|
|
@@ -31714,7 +32706,7 @@ function archive_io_pair(hub_path, name) {
|
|
|
31714
32706
|
},
|
|
31715
32707
|
_1: "trigger:%s ops:%d"
|
|
31716
32708
|
}), trigger, Stdlib__List.length(ops)));
|
|
31717
|
-
|
|
32709
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
31718
32710
|
TAG: (
|
|
31719
32711
|
/* Format */
|
|
31720
32712
|
0
|
|
@@ -31773,8 +32765,7 @@ function archive_io_pair(hub_path, name) {
|
|
|
31773
32765
|
}
|
|
31774
32766
|
},
|
|
31775
32767
|
_1: "Archived: %s (%d ops)"
|
|
31776
|
-
}), trigger, Stdlib__List.length(ops));
|
|
31777
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
32768
|
+
}), trigger, Stdlib__List.length(ops))));
|
|
31778
32769
|
return true;
|
|
31779
32770
|
}
|
|
31780
32771
|
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -31815,7 +32806,7 @@ function archive_io_pair(hub_path, name) {
|
|
|
31815
32806
|
return false;
|
|
31816
32807
|
}
|
|
31817
32808
|
function queue_inbox_items(hub_path) {
|
|
31818
|
-
const inbox_dir = Path.join(hub_path, "threads/inbox");
|
|
32809
|
+
const inbox_dir = Path.join(hub_path, "threads/mail/inbox");
|
|
31819
32810
|
if (Fs.existsSync(inbox_dir)) {
|
|
31820
32811
|
return Stdlib__List.length(Stdlib__List.filter_map((function(file) {
|
|
31821
32812
|
const file_path = Path.join(inbox_dir, file);
|
|
@@ -31852,7 +32843,7 @@ function queue_inbox_items(hub_path) {
|
|
|
31852
32843
|
)
|
|
31853
32844
|
});
|
|
31854
32845
|
Fs.writeFileSync(file_path, prim1);
|
|
31855
|
-
|
|
32846
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
31856
32847
|
TAG: (
|
|
31857
32848
|
/* Format */
|
|
31858
32849
|
0
|
|
@@ -31906,8 +32897,7 @@ function queue_inbox_items(hub_path) {
|
|
|
31906
32897
|
}
|
|
31907
32898
|
},
|
|
31908
32899
|
_1: "Queued: %s (from %s)"
|
|
31909
|
-
}), trigger, from);
|
|
31910
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
32900
|
+
}), trigger, from)));
|
|
31911
32901
|
return file;
|
|
31912
32902
|
}), Stdlib__List.filter(is_md_file, Stdlib__Array.to_list(Fs.readdirSync(inbox_dir)))));
|
|
31913
32903
|
} else {
|
|
@@ -31976,7 +32966,7 @@ function feed_next_input(hub_path) {
|
|
|
31976
32966
|
},
|
|
31977
32967
|
_1: "id:%s from:%s"
|
|
31978
32968
|
}), id, from));
|
|
31979
|
-
|
|
32969
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
31980
32970
|
TAG: (
|
|
31981
32971
|
/* Format */
|
|
31982
32972
|
0
|
|
@@ -32030,8 +33020,7 @@ function feed_next_input(hub_path) {
|
|
|
32030
33020
|
}
|
|
32031
33021
|
},
|
|
32032
33022
|
_1: "Wrote state/input.md: %s (from %s)"
|
|
32033
|
-
}), id, from);
|
|
32034
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
33023
|
+
}), id, from)));
|
|
32035
33024
|
const remaining = queue_count(hub_path);
|
|
32036
33025
|
if (remaining > 0) {
|
|
32037
33026
|
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -32080,16 +33069,16 @@ function feed_next_input(hub_path) {
|
|
|
32080
33069
|
}
|
|
32081
33070
|
return true;
|
|
32082
33071
|
}
|
|
32083
|
-
console.log(
|
|
33072
|
+
console.log(ok("Queue empty - nothing to process"));
|
|
32084
33073
|
return false;
|
|
32085
33074
|
}
|
|
32086
33075
|
function wake_agent(param) {
|
|
32087
33076
|
console.log(color("36", "Triggering OpenClaw wake..."));
|
|
32088
33077
|
const match2 = exec("openclaw system event --text 'input.md ready' --mode now 2>/dev/null");
|
|
32089
33078
|
if (match2 !== void 0) {
|
|
32090
|
-
console.log(
|
|
33079
|
+
console.log(ok("Wake triggered"));
|
|
32091
33080
|
} else {
|
|
32092
|
-
console.log(
|
|
33081
|
+
console.log(warn("Wake trigger failed - is OpenClaw running?"));
|
|
32093
33082
|
}
|
|
32094
33083
|
}
|
|
32095
33084
|
function run_sync(hub_path, name) {
|
|
@@ -32097,7 +33086,7 @@ function run_sync(hub_path, name) {
|
|
|
32097
33086
|
inbox_check(hub_path, name);
|
|
32098
33087
|
inbox_process(hub_path);
|
|
32099
33088
|
outbox_flush(hub_path, name);
|
|
32100
|
-
console.log(
|
|
33089
|
+
console.log(ok("Sync complete"));
|
|
32101
33090
|
}
|
|
32102
33091
|
function run_queue_list(hub_path) {
|
|
32103
33092
|
const items = queue_list(hub_path);
|
|
@@ -32257,7 +33246,7 @@ function run_queue_clear(hub_path) {
|
|
|
32257
33246
|
},
|
|
32258
33247
|
_1: "count:%d"
|
|
32259
33248
|
}), Stdlib__List.length(items)));
|
|
32260
|
-
|
|
33249
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
32261
33250
|
TAG: (
|
|
32262
33251
|
/* Format */
|
|
32263
33252
|
0
|
|
@@ -32299,11 +33288,10 @@ function run_queue_clear(hub_path) {
|
|
|
32299
33288
|
}
|
|
32300
33289
|
},
|
|
32301
33290
|
_1: "Cleared %d item(s) from queue"
|
|
32302
|
-
}), Stdlib__List.length(items));
|
|
32303
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
33291
|
+
}), Stdlib__List.length(items))));
|
|
32304
33292
|
return;
|
|
32305
33293
|
}
|
|
32306
|
-
console.log(
|
|
33294
|
+
console.log(ok("Queue already empty"));
|
|
32307
33295
|
}
|
|
32308
33296
|
function run_mca_add(hub_path, name, description) {
|
|
32309
33297
|
const dir = Path.join(hub_path, "state/mca");
|
|
@@ -32494,7 +33482,7 @@ function run_mca_add(hub_path, name, description) {
|
|
|
32494
33482
|
},
|
|
32495
33483
|
_1: "id:%s desc:%s"
|
|
32496
33484
|
}), slug, description));
|
|
32497
|
-
|
|
33485
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
32498
33486
|
TAG: (
|
|
32499
33487
|
/* Format */
|
|
32500
33488
|
0
|
|
@@ -32521,8 +33509,7 @@ function run_mca_add(hub_path, name, description) {
|
|
|
32521
33509
|
}
|
|
32522
33510
|
},
|
|
32523
33511
|
_1: "MCA surfaced: %s"
|
|
32524
|
-
}), description);
|
|
32525
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
33512
|
+
}), description)));
|
|
32526
33513
|
}
|
|
32527
33514
|
function run_mca_list(hub_path) {
|
|
32528
33515
|
const dir = Path.join(hub_path, "state/mca");
|
|
@@ -33147,7 +34134,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33147
34134
|
_1: "Archived input \xE2\x86\x92 %s"
|
|
33148
34135
|
}), run_dir)));
|
|
33149
34136
|
}
|
|
33150
|
-
const outbox_dir = Path.join(hub_path, "threads/outbox");
|
|
34137
|
+
const outbox_dir = Path.join(hub_path, "threads/mail/outbox");
|
|
33151
34138
|
ensure_dir(outbox_dir);
|
|
33152
34139
|
if (typeof op_kind === "string") {
|
|
33153
34140
|
if (op_kind === "Delete") {
|
|
@@ -33160,7 +34147,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33160
34147
|
} else {
|
|
33161
34148
|
const variant = op_kind.NAME;
|
|
33162
34149
|
if (variant === "Commit") {
|
|
33163
|
-
|
|
34150
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
33164
34151
|
TAG: (
|
|
33165
34152
|
/* Format */
|
|
33166
34153
|
0
|
|
@@ -33187,8 +34174,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33187
34174
|
}
|
|
33188
34175
|
},
|
|
33189
34176
|
_1: "Commit recorded: %s"
|
|
33190
|
-
}), op_kind.VAL);
|
|
33191
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
34177
|
+
}), op_kind.VAL)));
|
|
33192
34178
|
} else if (variant === "Surface") {
|
|
33193
34179
|
const desc$1 = op_kind.VAL;
|
|
33194
34180
|
const mca_dir2 = Path.join(hub_path, "state/mca");
|
|
@@ -33223,7 +34209,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33223
34209
|
}), id);
|
|
33224
34210
|
const prim0$1 = Path.join(mca_dir2, mca_file);
|
|
33225
34211
|
Fs.writeFileSync(prim0$1, desc$1);
|
|
33226
|
-
|
|
34212
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
33227
34213
|
TAG: (
|
|
33228
34214
|
/* Format */
|
|
33229
34215
|
0
|
|
@@ -33250,10 +34236,9 @@ function run_out(hub_path, name, gtd) {
|
|
|
33250
34236
|
}
|
|
33251
34237
|
},
|
|
33252
34238
|
_1: "Surfaced MCA: %s"
|
|
33253
|
-
}), desc$1);
|
|
33254
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$1);
|
|
34239
|
+
}), desc$1)));
|
|
33255
34240
|
} else if (variant === "Delegate") {
|
|
33256
|
-
|
|
34241
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
33257
34242
|
TAG: (
|
|
33258
34243
|
/* Format */
|
|
33259
34244
|
0
|
|
@@ -33280,8 +34265,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33280
34265
|
}
|
|
33281
34266
|
},
|
|
33282
34267
|
_1: "Delegated to %s"
|
|
33283
|
-
}), op_kind.VAL);
|
|
33284
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$2);
|
|
34268
|
+
}), op_kind.VAL)));
|
|
33285
34269
|
} else if (variant === "Send") {
|
|
33286
34270
|
const match$2 = op_kind.VAL;
|
|
33287
34271
|
const to_$2 = match$2[0];
|
|
@@ -33407,7 +34391,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33407
34391
|
}), to_$2, (/* @__PURE__ */ new Date()).toISOString(), match$2[1]);
|
|
33408
34392
|
const prim0$2 = Path.join(outbox_dir, send_file);
|
|
33409
34393
|
Fs.writeFileSync(prim0$2, send_content);
|
|
33410
|
-
|
|
34394
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
33411
34395
|
TAG: (
|
|
33412
34396
|
/* Format */
|
|
33413
34397
|
0
|
|
@@ -33434,8 +34418,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33434
34418
|
}
|
|
33435
34419
|
},
|
|
33436
34420
|
_1: "Send \xE2\x86\x92 outbox/%s"
|
|
33437
|
-
}), send_file);
|
|
33438
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$3);
|
|
34421
|
+
}), send_file)));
|
|
33439
34422
|
} else {
|
|
33440
34423
|
const reply_file = Curry._2(Stdlib__Printf.sprintf({
|
|
33441
34424
|
TAG: (
|
|
@@ -33573,7 +34556,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33573
34556
|
}), from, id, (/* @__PURE__ */ new Date()).toISOString(), op_kind.VAL);
|
|
33574
34557
|
const prim0$3 = Path.join(outbox_dir, reply_file);
|
|
33575
34558
|
Fs.writeFileSync(prim0$3, reply_content);
|
|
33576
|
-
|
|
34559
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
33577
34560
|
TAG: (
|
|
33578
34561
|
/* Format */
|
|
33579
34562
|
0
|
|
@@ -33600,8 +34583,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33600
34583
|
}
|
|
33601
34584
|
},
|
|
33602
34585
|
_1: "Reply \xE2\x86\x92 outbox/%s"
|
|
33603
|
-
}), reply_file);
|
|
33604
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$4);
|
|
34586
|
+
}), reply_file)));
|
|
33605
34587
|
}
|
|
33606
34588
|
}
|
|
33607
34589
|
const output_content = Curry._4(Stdlib__Printf.sprintf({
|
|
@@ -33821,7 +34803,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33821
34803
|
Fs.writeFileSync(prim0$5, meta_content);
|
|
33822
34804
|
Fs.writeFileSync(inp, "");
|
|
33823
34805
|
Fs.writeFileSync(outp, "");
|
|
33824
|
-
console.log(
|
|
34806
|
+
console.log(ok("State cleared"));
|
|
33825
34807
|
log_action(hub_path, "out", Curry._3(Stdlib__Printf.sprintf({
|
|
33826
34808
|
TAG: (
|
|
33827
34809
|
/* Format */
|
|
@@ -33884,7 +34866,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33884
34866
|
},
|
|
33885
34867
|
_1: "id:%s gtd:%s run:%s"
|
|
33886
34868
|
}), id, gtd_type, run_dir));
|
|
33887
|
-
|
|
34869
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
33888
34870
|
TAG: (
|
|
33889
34871
|
/* Format */
|
|
33890
34872
|
0
|
|
@@ -33938,8 +34920,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33938
34920
|
}
|
|
33939
34921
|
},
|
|
33940
34922
|
_1: "Run complete: %s (%s)"
|
|
33941
|
-
}), gtd_type, id);
|
|
33942
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$5);
|
|
34923
|
+
}), gtd_type, id)));
|
|
33943
34924
|
exec_in(hub_path, Curry._2(Stdlib__Printf.sprintf({
|
|
33944
34925
|
TAG: (
|
|
33945
34926
|
/* Format */
|
|
@@ -33998,7 +34979,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
33998
34979
|
},
|
|
33999
34980
|
_1: "git add -A && git commit -m 'run: %s %s'"
|
|
34000
34981
|
}), gtd_type, id));
|
|
34001
|
-
console.log(
|
|
34982
|
+
console.log(ok("Committed run"));
|
|
34002
34983
|
}
|
|
34003
34984
|
function mca_cycle_path(hub_path) {
|
|
34004
34985
|
return Path.join(hub_path, "state/.mca-cycle");
|
|
@@ -34413,7 +35394,7 @@ function queue_mca_review(hub_path, name) {
|
|
|
34413
35394
|
},
|
|
34414
35395
|
_1: "trigger:%s count:%d"
|
|
34415
35396
|
}), trigger, Stdlib__List.length(mcas)));
|
|
34416
|
-
|
|
35397
|
+
console.log(ok(Curry._2(Stdlib__Printf.sprintf({
|
|
34417
35398
|
TAG: (
|
|
34418
35399
|
/* Format */
|
|
34419
35400
|
0
|
|
@@ -34465,8 +35446,7 @@ function queue_mca_review(hub_path, name) {
|
|
|
34465
35446
|
}
|
|
34466
35447
|
},
|
|
34467
35448
|
_1: "Queued MCA review (%d MCAs) trigger:%s"
|
|
34468
|
-
}), Stdlib__List.length(mcas), Stdlib__String.sub(trigger, 0, 7));
|
|
34469
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
35449
|
+
}), Stdlib__List.length(mcas), Stdlib__String.sub(trigger, 0, 7))));
|
|
34470
35450
|
}
|
|
34471
35451
|
function auto_save(hub_path, name) {
|
|
34472
35452
|
const status = exec_in(hub_path, "git status --porcelain");
|
|
@@ -34555,19 +35535,19 @@ function auto_save(hub_path, name) {
|
|
|
34555
35535
|
}), msg));
|
|
34556
35536
|
if (match2 !== void 0) {
|
|
34557
35537
|
log_action(hub_path, "auto-save.commit", msg);
|
|
34558
|
-
console.log(
|
|
35538
|
+
console.log(ok("Auto-committed changes"));
|
|
34559
35539
|
const match$1 = exec_in(hub_path, "git push");
|
|
34560
35540
|
if (match$1 !== void 0) {
|
|
34561
35541
|
log_action(hub_path, "auto-save.push", "success");
|
|
34562
|
-
console.log(
|
|
35542
|
+
console.log(ok("Auto-pushed to origin"));
|
|
34563
35543
|
} else {
|
|
34564
35544
|
log_action(hub_path, "auto-save.push", "failed");
|
|
34565
|
-
console.log(
|
|
35545
|
+
console.log(warn("Auto-push failed"));
|
|
34566
35546
|
}
|
|
34567
35547
|
return;
|
|
34568
35548
|
}
|
|
34569
35549
|
log_action(hub_path, "auto-save.commit", "failed");
|
|
34570
|
-
console.log(
|
|
35550
|
+
console.log(warn("Auto-commit failed"));
|
|
34571
35551
|
}
|
|
34572
35552
|
function run_inbound(hub_path, name) {
|
|
34573
35553
|
console.log(color("36", "cn in: handling external input..."));
|
|
@@ -34888,13 +35868,13 @@ function update_runtime(hub_path) {
|
|
|
34888
35868
|
_1: "# Runtime State\n\nAuto-generated by `cn update`. Do not edit manually.\n\n```yaml\nsession_start: %s\ncn_version: %s\ncn_commit: %s\ntemplate_version: %s\nopenclaw_version: %s\nhub_name: %s\nhub_commit: %s\npeer_count: %d\n```\n"
|
|
34889
35869
|
}), (/* @__PURE__ */ new Date()).toISOString(), cn_ver, cn_commit, cn_ver, oc_ver, hub_name, hub_commit, peer_count);
|
|
34890
35870
|
Fs.writeFileSync(runtime_path, content$1);
|
|
34891
|
-
console.log(
|
|
35871
|
+
console.log(ok("Updated state/runtime.md"));
|
|
34892
35872
|
}
|
|
34893
35873
|
function run_init(name) {
|
|
34894
35874
|
const hub_name = name !== void 0 ? name : Path.basename(process.cwd());
|
|
34895
35875
|
const hub_dir = "cn-" + hub_name;
|
|
34896
35876
|
if (Fs.existsSync(hub_dir)) {
|
|
34897
|
-
|
|
35877
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
34898
35878
|
TAG: (
|
|
34899
35879
|
/* Format */
|
|
34900
35880
|
0
|
|
@@ -34928,8 +35908,7 @@ function run_init(name) {
|
|
|
34928
35908
|
}
|
|
34929
35909
|
},
|
|
34930
35910
|
_1: "Directory %s already exists"
|
|
34931
|
-
}), hub_dir);
|
|
34932
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg);
|
|
35911
|
+
}), hub_dir)));
|
|
34933
35912
|
process.exit(1);
|
|
34934
35913
|
}
|
|
34935
35914
|
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -34964,9 +35943,13 @@ function run_init(name) {
|
|
|
34964
35943
|
mkdir_p(Path.join(hub_dir, ".cn"));
|
|
34965
35944
|
mkdir_p(Path.join(hub_dir, "spec"));
|
|
34966
35945
|
mkdir_p(Path.join(hub_dir, "state"));
|
|
34967
|
-
mkdir_p(Path.join(hub_dir, "threads/
|
|
34968
|
-
mkdir_p(Path.join(hub_dir, "threads/
|
|
34969
|
-
mkdir_p(Path.join(hub_dir, "threads/
|
|
35946
|
+
mkdir_p(Path.join(hub_dir, "threads/in"));
|
|
35947
|
+
mkdir_p(Path.join(hub_dir, "threads/mail/inbox"));
|
|
35948
|
+
mkdir_p(Path.join(hub_dir, "threads/mail/outbox"));
|
|
35949
|
+
mkdir_p(Path.join(hub_dir, "threads/mail/sent"));
|
|
35950
|
+
mkdir_p(Path.join(hub_dir, "threads/reflections/daily"));
|
|
35951
|
+
mkdir_p(Path.join(hub_dir, "threads/reflections/weekly"));
|
|
35952
|
+
mkdir_p(Path.join(hub_dir, "threads/reflections/monthly"));
|
|
34970
35953
|
mkdir_p(Path.join(hub_dir, "threads/adhoc"));
|
|
34971
35954
|
mkdir_p(Path.join(hub_dir, "threads/archived"));
|
|
34972
35955
|
mkdir_p(Path.join(hub_dir, "logs"));
|
|
@@ -35158,7 +36141,7 @@ function run_init(name) {
|
|
|
35158
36141
|
},
|
|
35159
36142
|
_1: "git commit -m 'Initialize %s hub'"
|
|
35160
36143
|
}), hub_name));
|
|
35161
|
-
|
|
36144
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
35162
36145
|
TAG: (
|
|
35163
36146
|
/* Format */
|
|
35164
36147
|
0
|
|
@@ -35185,8 +36168,7 @@ function run_init(name) {
|
|
|
35185
36168
|
}
|
|
35186
36169
|
},
|
|
35187
36170
|
_1: "Created hub: %s"
|
|
35188
|
-
}), hub_dir);
|
|
35189
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$1);
|
|
36171
|
+
}), hub_dir)));
|
|
35190
36172
|
console.log(color("36", "Next steps:"));
|
|
35191
36173
|
console.log(Curry._1(Stdlib__Printf.sprintf({
|
|
35192
36174
|
TAG: (
|
|
@@ -35497,7 +36479,7 @@ function run_peer_add(hub_path, peer_name, url) {
|
|
|
35497
36479
|
return p.name === peer_name;
|
|
35498
36480
|
}), peers);
|
|
35499
36481
|
if (exists2) {
|
|
35500
|
-
|
|
36482
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
35501
36483
|
TAG: (
|
|
35502
36484
|
/* Format */
|
|
35503
36485
|
0
|
|
@@ -35524,8 +36506,7 @@ function run_peer_add(hub_path, peer_name, url) {
|
|
|
35524
36506
|
}
|
|
35525
36507
|
},
|
|
35526
36508
|
_1: "Peer already exists: %s"
|
|
35527
|
-
}), peer_name);
|
|
35528
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg);
|
|
36509
|
+
}), peer_name)));
|
|
35529
36510
|
process.exit(1);
|
|
35530
36511
|
}
|
|
35531
36512
|
const new_peer_hub = url;
|
|
@@ -35590,7 +36571,7 @@ function run_peer_add(hub_path, peer_name, url) {
|
|
|
35590
36571
|
},
|
|
35591
36572
|
_1: "name:%s hub:%s"
|
|
35592
36573
|
}), peer_name, url));
|
|
35593
|
-
|
|
36574
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
35594
36575
|
TAG: (
|
|
35595
36576
|
/* Format */
|
|
35596
36577
|
0
|
|
@@ -35617,8 +36598,7 @@ function run_peer_add(hub_path, peer_name, url) {
|
|
|
35617
36598
|
}
|
|
35618
36599
|
},
|
|
35619
36600
|
_1: "Added peer: %s"
|
|
35620
|
-
}), peer_name);
|
|
35621
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$1);
|
|
36601
|
+
}), peer_name)));
|
|
35622
36602
|
}
|
|
35623
36603
|
function run_peer_remove(hub_path, peer_name) {
|
|
35624
36604
|
const peers = load_peers(hub_path);
|
|
@@ -35626,7 +36606,7 @@ function run_peer_remove(hub_path, peer_name) {
|
|
|
35626
36606
|
return p.name === peer_name;
|
|
35627
36607
|
}), peers);
|
|
35628
36608
|
if (!exists2) {
|
|
35629
|
-
|
|
36609
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
35630
36610
|
TAG: (
|
|
35631
36611
|
/* Format */
|
|
35632
36612
|
0
|
|
@@ -35653,8 +36633,7 @@ function run_peer_remove(hub_path, peer_name) {
|
|
|
35653
36633
|
}
|
|
35654
36634
|
},
|
|
35655
36635
|
_1: "Peer not found: %s"
|
|
35656
|
-
}), peer_name);
|
|
35657
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg);
|
|
36636
|
+
}), peer_name)));
|
|
35658
36637
|
process.exit(1);
|
|
35659
36638
|
}
|
|
35660
36639
|
const updated = Stdlib__List.filter((function(p) {
|
|
@@ -35664,7 +36643,7 @@ function run_peer_remove(hub_path, peer_name) {
|
|
|
35664
36643
|
const prim0 = Path.join(hub_path, "state/peers.md");
|
|
35665
36644
|
Fs.writeFileSync(prim0, prim1);
|
|
35666
36645
|
log_action(hub_path, "peer.remove", peer_name);
|
|
35667
|
-
|
|
36646
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
35668
36647
|
TAG: (
|
|
35669
36648
|
/* Format */
|
|
35670
36649
|
0
|
|
@@ -35691,8 +36670,7 @@ function run_peer_remove(hub_path, peer_name) {
|
|
|
35691
36670
|
}
|
|
35692
36671
|
},
|
|
35693
36672
|
_1: "Removed peer: %s"
|
|
35694
|
-
}), peer_name);
|
|
35695
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg$1);
|
|
36673
|
+
}), peer_name)));
|
|
35696
36674
|
}
|
|
35697
36675
|
function run_peer_sync(hub_path) {
|
|
35698
36676
|
const peers = load_peers(hub_path);
|
|
@@ -35703,7 +36681,7 @@ function run_peer_sync(hub_path) {
|
|
|
35703
36681
|
if (Fs.existsSync(clone_path)) {
|
|
35704
36682
|
const match2 = exec_in(clone_path, "git fetch origin && git pull --ff-only");
|
|
35705
36683
|
if (match2 !== void 0) {
|
|
35706
|
-
|
|
36684
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
35707
36685
|
TAG: (
|
|
35708
36686
|
/* Format */
|
|
35709
36687
|
0
|
|
@@ -35737,49 +36715,47 @@ function run_peer_sync(hub_path) {
|
|
|
35737
36715
|
}
|
|
35738
36716
|
},
|
|
35739
36717
|
_1: " %s: updated"
|
|
35740
|
-
}), peer.name);
|
|
35741
|
-
|
|
35742
|
-
|
|
35743
|
-
}
|
|
35744
|
-
const msg$1 = Curry._1(Stdlib__Printf.sprintf({
|
|
35745
|
-
TAG: (
|
|
35746
|
-
/* Format */
|
|
35747
|
-
0
|
|
35748
|
-
),
|
|
35749
|
-
_0: {
|
|
36718
|
+
}), peer.name)));
|
|
36719
|
+
} else {
|
|
36720
|
+
console.log(warn(Curry._1(Stdlib__Printf.sprintf({
|
|
35750
36721
|
TAG: (
|
|
35751
|
-
/*
|
|
35752
|
-
|
|
36722
|
+
/* Format */
|
|
36723
|
+
0
|
|
35753
36724
|
),
|
|
35754
|
-
_0:
|
|
35755
|
-
_1: {
|
|
36725
|
+
_0: {
|
|
35756
36726
|
TAG: (
|
|
35757
|
-
/*
|
|
35758
|
-
|
|
35759
|
-
),
|
|
35760
|
-
_0: (
|
|
35761
|
-
/* No_padding */
|
|
35762
|
-
0
|
|
36727
|
+
/* String_literal */
|
|
36728
|
+
11
|
|
35763
36729
|
),
|
|
36730
|
+
_0: " ",
|
|
35764
36731
|
_1: {
|
|
35765
36732
|
TAG: (
|
|
35766
|
-
/*
|
|
35767
|
-
|
|
36733
|
+
/* String */
|
|
36734
|
+
2
|
|
35768
36735
|
),
|
|
35769
|
-
_0:
|
|
35770
|
-
|
|
35771
|
-
/* End_of_format */
|
|
36736
|
+
_0: (
|
|
36737
|
+
/* No_padding */
|
|
35772
36738
|
0
|
|
35773
|
-
)
|
|
36739
|
+
),
|
|
36740
|
+
_1: {
|
|
36741
|
+
TAG: (
|
|
36742
|
+
/* String_literal */
|
|
36743
|
+
11
|
|
36744
|
+
),
|
|
36745
|
+
_0: ": fetch failed",
|
|
36746
|
+
_1: (
|
|
36747
|
+
/* End_of_format */
|
|
36748
|
+
0
|
|
36749
|
+
)
|
|
36750
|
+
}
|
|
35774
36751
|
}
|
|
35775
|
-
}
|
|
35776
|
-
|
|
35777
|
-
|
|
35778
|
-
}
|
|
35779
|
-
console.log(color("33", "\xE2\x9A\xA0 ") + msg$1);
|
|
36752
|
+
},
|
|
36753
|
+
_1: " %s: fetch failed"
|
|
36754
|
+
}), peer.name)));
|
|
36755
|
+
}
|
|
35780
36756
|
return;
|
|
35781
36757
|
}
|
|
35782
|
-
|
|
36758
|
+
console.log(warn(Curry._2(Stdlib__Printf.sprintf({
|
|
35783
36759
|
TAG: (
|
|
35784
36760
|
/* Format */
|
|
35785
36761
|
0
|
|
@@ -35823,8 +36799,7 @@ function run_peer_sync(hub_path) {
|
|
|
35823
36799
|
}
|
|
35824
36800
|
},
|
|
35825
36801
|
_1: " %s: clone not found at %s"
|
|
35826
|
-
}), peer.name, clone_path);
|
|
35827
|
-
console.log(color("33", "\xE2\x9A\xA0 ") + msg$2);
|
|
36802
|
+
}), peer.name, clone_path)));
|
|
35828
36803
|
return;
|
|
35829
36804
|
}
|
|
35830
36805
|
console.log(color("2", Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -35863,11 +36838,11 @@ function run_peer_sync(hub_path) {
|
|
|
35863
36838
|
_1: " %s: no clone path"
|
|
35864
36839
|
}), peer.name)));
|
|
35865
36840
|
}), peers);
|
|
35866
|
-
console.log(
|
|
36841
|
+
console.log(ok("Peer sync complete"));
|
|
35867
36842
|
}
|
|
35868
36843
|
function inbox_flush(hub_path, _name) {
|
|
35869
36844
|
console.log(color("36", "Flushing inbox (deleting processed branches)..."));
|
|
35870
|
-
const inbox_dir = Path.join(hub_path, "threads/inbox");
|
|
36845
|
+
const inbox_dir = Path.join(hub_path, "threads/mail/inbox");
|
|
35871
36846
|
if (Fs.existsSync(inbox_dir)) {
|
|
35872
36847
|
const threads = Stdlib__List.filter(is_md_file, Stdlib__Array.to_list(Fs.readdirSync(inbox_dir)));
|
|
35873
36848
|
const flushed = Stdlib__List.filter_map((function(file) {
|
|
@@ -35989,7 +36964,7 @@ function inbox_flush(hub_path, _name) {
|
|
|
35989
36964
|
},
|
|
35990
36965
|
_1: "branch:%s file:%s"
|
|
35991
36966
|
}), branch, file));
|
|
35992
|
-
|
|
36967
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
35993
36968
|
TAG: (
|
|
35994
36969
|
/* Format */
|
|
35995
36970
|
0
|
|
@@ -36016,12 +36991,11 @@ function inbox_flush(hub_path, _name) {
|
|
|
36016
36991
|
}
|
|
36017
36992
|
},
|
|
36018
36993
|
_1: "Flushed: %s"
|
|
36019
|
-
}), file);
|
|
36020
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
36994
|
+
}), file)));
|
|
36021
36995
|
return file;
|
|
36022
36996
|
}), threads);
|
|
36023
36997
|
if (flushed) {
|
|
36024
|
-
|
|
36998
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
36025
36999
|
TAG: (
|
|
36026
37000
|
/* Format */
|
|
36027
37001
|
0
|
|
@@ -36063,14 +37037,13 @@ function inbox_flush(hub_path, _name) {
|
|
|
36063
37037
|
}
|
|
36064
37038
|
},
|
|
36065
37039
|
_1: "Flushed %d thread(s)"
|
|
36066
|
-
}), Stdlib__List.length(flushed));
|
|
36067
|
-
|
|
36068
|
-
|
|
37040
|
+
}), Stdlib__List.length(flushed))));
|
|
37041
|
+
} else {
|
|
37042
|
+
console.log(color("36", "No triaged threads to flush"));
|
|
36069
37043
|
}
|
|
36070
|
-
console.log(color("36", "No triaged threads to flush"));
|
|
36071
37044
|
return;
|
|
36072
37045
|
}
|
|
36073
|
-
console.log(
|
|
37046
|
+
console.log(ok("Inbox empty"));
|
|
36074
37047
|
}
|
|
36075
37048
|
function update_cron(hub_path) {
|
|
36076
37049
|
const cron_line = Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -36146,9 +37119,9 @@ function update_cron(hub_path) {
|
|
|
36146
37119
|
}), cron_line);
|
|
36147
37120
|
const match2 = exec(cmd2);
|
|
36148
37121
|
if (match2 !== void 0) {
|
|
36149
|
-
console.log(
|
|
37122
|
+
console.log(ok("Crontab updated"));
|
|
36150
37123
|
} else {
|
|
36151
|
-
console.log(
|
|
37124
|
+
console.log(warn("Crontab update failed - update manually"));
|
|
36152
37125
|
}
|
|
36153
37126
|
}
|
|
36154
37127
|
function run_update(param) {
|
|
@@ -36185,7 +37158,7 @@ function run_update(param) {
|
|
|
36185
37158
|
if (latest_raw !== void 0) {
|
|
36186
37159
|
const latest = Stdlib__String.trim(latest_raw);
|
|
36187
37160
|
if (latest === Cn_lib.version) {
|
|
36188
|
-
console.log(
|
|
37161
|
+
console.log(ok("Already up to date"));
|
|
36189
37162
|
return;
|
|
36190
37163
|
}
|
|
36191
37164
|
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -36219,7 +37192,7 @@ function run_update(param) {
|
|
|
36219
37192
|
console.log(color("36", "Updating..."));
|
|
36220
37193
|
const match2 = exec("npm install -g cnagent@latest");
|
|
36221
37194
|
if (match2 !== void 0) {
|
|
36222
|
-
|
|
37195
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
36223
37196
|
TAG: (
|
|
36224
37197
|
/* Format */
|
|
36225
37198
|
0
|
|
@@ -36246,14 +37219,13 @@ function run_update(param) {
|
|
|
36246
37219
|
}
|
|
36247
37220
|
},
|
|
36248
37221
|
_1: "Updated to v%s"
|
|
36249
|
-
}), latest);
|
|
36250
|
-
|
|
36251
|
-
|
|
37222
|
+
}), latest)));
|
|
37223
|
+
} else {
|
|
37224
|
+
console.log(fail("Update failed. Try: npm install -g cnagent@latest"));
|
|
36252
37225
|
}
|
|
36253
|
-
console.log(color("31", "\xE2\x9C\x97 ") + "Update failed. Try: npm install -g cnagent@latest");
|
|
36254
37226
|
return;
|
|
36255
37227
|
}
|
|
36256
|
-
console.log(
|
|
37228
|
+
console.log(fail("Could not check npm registry"));
|
|
36257
37229
|
process.exit(1);
|
|
36258
37230
|
}
|
|
36259
37231
|
function run_update_with_cron(hub_path) {
|
|
@@ -36264,15 +37236,15 @@ function run_update_with_cron(hub_path) {
|
|
|
36264
37236
|
exec_in(hub_path, "git add state/runtime.md");
|
|
36265
37237
|
const commit_result = exec_in(hub_path, "git commit -m 'chore: cn update runtime'");
|
|
36266
37238
|
if (commit_result !== void 0) {
|
|
36267
|
-
console.log(
|
|
37239
|
+
console.log(ok("Committed runtime changes"));
|
|
36268
37240
|
const match2 = exec_in(hub_path, "git remote get-url origin 2>/dev/null");
|
|
36269
37241
|
if (match2 !== void 0) {
|
|
36270
37242
|
console.log(color("36", "Pushing to origin..."));
|
|
36271
37243
|
const match$1 = exec_in(hub_path, "git push origin HEAD 2>&1");
|
|
36272
37244
|
if (match$1 !== void 0) {
|
|
36273
|
-
console.log(
|
|
37245
|
+
console.log(ok("Pushed to origin"));
|
|
36274
37246
|
} else {
|
|
36275
|
-
console.log(
|
|
37247
|
+
console.log(warn("Push failed - push manually"));
|
|
36276
37248
|
}
|
|
36277
37249
|
return;
|
|
36278
37250
|
}
|
|
@@ -36355,7 +37327,7 @@ function self_update_check(param) {
|
|
|
36355
37327
|
}), Cn_lib.version, latest)));
|
|
36356
37328
|
const match2 = exec("npm install -g cnagent@latest 2>/dev/null");
|
|
36357
37329
|
if (match2 !== void 0) {
|
|
36358
|
-
|
|
37330
|
+
console.log(ok(Curry._1(Stdlib__Printf.sprintf({
|
|
36359
37331
|
TAG: (
|
|
36360
37332
|
/* Format */
|
|
36361
37333
|
0
|
|
@@ -36382,8 +37354,7 @@ function self_update_check(param) {
|
|
|
36382
37354
|
}
|
|
36383
37355
|
},
|
|
36384
37356
|
_1: "Updated to cn %s"
|
|
36385
|
-
}), latest);
|
|
36386
|
-
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
37357
|
+
}), latest)));
|
|
36387
37358
|
const args_str = Stdlib__String.concat(" ", Stdlib__List.tl(args2));
|
|
36388
37359
|
exec(Curry._1(Stdlib__Printf.sprintf({
|
|
36389
37360
|
TAG: (
|
|
@@ -36416,7 +37387,7 @@ function self_update_check(param) {
|
|
|
36416
37387
|
process.exit(0);
|
|
36417
37388
|
return;
|
|
36418
37389
|
}
|
|
36419
|
-
console.log(
|
|
37390
|
+
console.log(warn("Self-update failed - continuing with current version"));
|
|
36420
37391
|
}
|
|
36421
37392
|
function drop(n, lst) {
|
|
36422
37393
|
let _n = n;
|
|
@@ -36443,6 +37414,11 @@ self_update_check(void 0);
|
|
|
36443
37414
|
var args = drop(2, Stdlib__Array.to_list(process.argv));
|
|
36444
37415
|
var match = Cn_lib.parse_flags(args);
|
|
36445
37416
|
var cmd_args = match[1];
|
|
37417
|
+
var flags = match[0];
|
|
37418
|
+
dry_run_mode.contents = flags.dry_run;
|
|
37419
|
+
if (flags.dry_run) {
|
|
37420
|
+
dry_run_banner(void 0);
|
|
37421
|
+
}
|
|
36446
37422
|
var cmd = Cn_lib.parse_command(cmd_args);
|
|
36447
37423
|
if (cmd !== void 0) {
|
|
36448
37424
|
let exit = 0;
|
|
@@ -36671,7 +37647,7 @@ if (cmd !== void 0) {
|
|
|
36671
37647
|
}
|
|
36672
37648
|
}
|
|
36673
37649
|
} else {
|
|
36674
|
-
console.log(
|
|
37650
|
+
console.log(fail("Not in a cn hub."));
|
|
36675
37651
|
console.log("");
|
|
36676
37652
|
console.log("Either:");
|
|
36677
37653
|
console.log(" 1) cd into an existing hub (cn-sigma, cn-pi, etc.)");
|
|
@@ -36681,7 +37657,7 @@ if (cmd !== void 0) {
|
|
|
36681
37657
|
}
|
|
36682
37658
|
} else {
|
|
36683
37659
|
if (cmd_args) {
|
|
36684
|
-
|
|
37660
|
+
console.log(fail(Curry._1(Stdlib__Printf.sprintf({
|
|
36685
37661
|
TAG: (
|
|
36686
37662
|
/* Format */
|
|
36687
37663
|
0
|
|
@@ -36708,8 +37684,7 @@ if (cmd !== void 0) {
|
|
|
36708
37684
|
}
|
|
36709
37685
|
},
|
|
36710
37686
|
_1: "Unknown command: %s"
|
|
36711
|
-
}), cmd_args.hd);
|
|
36712
|
-
console.log(color("31", "\xE2\x9C\x97 ") + msg);
|
|
37687
|
+
}), cmd_args.hd)));
|
|
36713
37688
|
}
|
|
36714
37689
|
console.log(Cn_lib.help_text);
|
|
36715
37690
|
process.exit(1);
|
|
@@ -36723,6 +37698,10 @@ module.exports = {
|
|
|
36723
37698
|
Yaml,
|
|
36724
37699
|
Child_process: Child_process$1,
|
|
36725
37700
|
Json,
|
|
37701
|
+
Str,
|
|
37702
|
+
check,
|
|
37703
|
+
cross,
|
|
37704
|
+
warning,
|
|
36726
37705
|
now_iso,
|
|
36727
37706
|
no_color,
|
|
36728
37707
|
color,
|
|
@@ -36735,14 +37714,29 @@ module.exports = {
|
|
|
36735
37714
|
fail,
|
|
36736
37715
|
warn,
|
|
36737
37716
|
info,
|
|
37717
|
+
dry_run_mode,
|
|
37718
|
+
would,
|
|
37719
|
+
dry_run_banner,
|
|
36738
37720
|
find_hub_path,
|
|
36739
37721
|
log_action,
|
|
36740
37722
|
load_peers,
|
|
36741
37723
|
is_md_file,
|
|
36742
37724
|
split_lines,
|
|
36743
|
-
|
|
36744
|
-
|
|
37725
|
+
slugify,
|
|
37726
|
+
threads_in,
|
|
37727
|
+
threads_mail_inbox,
|
|
37728
|
+
threads_mail_outbox,
|
|
37729
|
+
threads_mail_sent,
|
|
37730
|
+
threads_reflections_daily,
|
|
37731
|
+
threads_adhoc,
|
|
37732
|
+
timestamp_slug,
|
|
37733
|
+
make_thread_filename,
|
|
36745
37734
|
delete_remote_branch,
|
|
37735
|
+
is_orphan_branch,
|
|
37736
|
+
get_branch_author,
|
|
37737
|
+
reject_orphan_branch,
|
|
37738
|
+
get_inbound_branches,
|
|
37739
|
+
inbox_check,
|
|
36746
37740
|
materialize_branch,
|
|
36747
37741
|
inbox_process,
|
|
36748
37742
|
outbox_check,
|