cnagent 2.1.12 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tools/dist/cn.js +501 -24
package/package.json
CHANGED
package/tools/dist/cn.js
CHANGED
|
@@ -11878,6 +11878,7 @@ var require_string = __commonJS({
|
|
|
11878
11878
|
var require_cn_lib = __commonJS({
|
|
11879
11879
|
"_build/default/tools/src/cn/output/tools/src/cn/cn_lib.js"(exports2, module2) {
|
|
11880
11880
|
"use strict";
|
|
11881
|
+
var Caml_obj = require_caml_obj();
|
|
11881
11882
|
var Stdlib__List2 = require_list();
|
|
11882
11883
|
var Stdlib__Option2 = require_option();
|
|
11883
11884
|
var Stdlib__String2 = require_string();
|
|
@@ -11999,17 +12000,28 @@ var require_cn_lib = __commonJS({
|
|
|
11999
12000
|
} else {
|
|
12000
12001
|
return "queue clear";
|
|
12001
12002
|
}
|
|
12002
|
-
case /*
|
|
12003
|
+
case /* Mca */
|
|
12003
12004
|
5:
|
|
12005
|
+
const d = t._0;
|
|
12006
|
+
if (
|
|
12007
|
+
/* tag */
|
|
12008
|
+
typeof d === "number" || typeof d === "string"
|
|
12009
|
+
) {
|
|
12010
|
+
return "mca list";
|
|
12011
|
+
} else {
|
|
12012
|
+
return "mca add " + d._0;
|
|
12013
|
+
}
|
|
12014
|
+
case /* Read */
|
|
12015
|
+
6:
|
|
12004
12016
|
return "read " + t._0;
|
|
12005
12017
|
case /* Reply */
|
|
12006
|
-
|
|
12018
|
+
7:
|
|
12007
12019
|
return "reply " + t._0;
|
|
12008
12020
|
case /* Send */
|
|
12009
|
-
|
|
12021
|
+
8:
|
|
12010
12022
|
return "send " + t._0;
|
|
12011
12023
|
case /* Gtd */
|
|
12012
|
-
|
|
12024
|
+
9:
|
|
12013
12025
|
const t$1 = t._0;
|
|
12014
12026
|
switch (t$1.TAG) {
|
|
12015
12027
|
case /* GtdDelete */
|
|
@@ -12029,7 +12041,7 @@ var require_cn_lib = __commonJS({
|
|
|
12029
12041
|
return "done " + t$1._0;
|
|
12030
12042
|
}
|
|
12031
12043
|
case /* Commit */
|
|
12032
|
-
|
|
12044
|
+
10:
|
|
12033
12045
|
const m = t._0;
|
|
12034
12046
|
if (m !== void 0) {
|
|
12035
12047
|
return "commit " + m;
|
|
@@ -12037,7 +12049,7 @@ var require_cn_lib = __commonJS({
|
|
|
12037
12049
|
return "commit";
|
|
12038
12050
|
}
|
|
12039
12051
|
case /* Save */
|
|
12040
|
-
|
|
12052
|
+
11:
|
|
12041
12053
|
const m$1 = t._0;
|
|
12042
12054
|
if (m$1 !== void 0) {
|
|
12043
12055
|
return "save " + m$1;
|
|
@@ -12223,6 +12235,44 @@ var require_cn_lib = __commonJS({
|
|
|
12223
12235
|
return;
|
|
12224
12236
|
}
|
|
12225
12237
|
}
|
|
12238
|
+
function parse_mca_cmd(param) {
|
|
12239
|
+
if (!param) {
|
|
12240
|
+
return (
|
|
12241
|
+
/* Mca_list */
|
|
12242
|
+
0
|
|
12243
|
+
);
|
|
12244
|
+
}
|
|
12245
|
+
switch (param.hd) {
|
|
12246
|
+
case "add":
|
|
12247
|
+
const rest = param.tl;
|
|
12248
|
+
if (Caml_obj.caml_notequal(
|
|
12249
|
+
rest,
|
|
12250
|
+
/* [] */
|
|
12251
|
+
0
|
|
12252
|
+
)) {
|
|
12253
|
+
return {
|
|
12254
|
+
TAG: (
|
|
12255
|
+
/* Mca_add */
|
|
12256
|
+
0
|
|
12257
|
+
),
|
|
12258
|
+
_0: Stdlib__String2.concat(" ", rest)
|
|
12259
|
+
};
|
|
12260
|
+
} else {
|
|
12261
|
+
return;
|
|
12262
|
+
}
|
|
12263
|
+
case "list":
|
|
12264
|
+
if (param.tl) {
|
|
12265
|
+
return;
|
|
12266
|
+
} else {
|
|
12267
|
+
return (
|
|
12268
|
+
/* Mca_list */
|
|
12269
|
+
0
|
|
12270
|
+
);
|
|
12271
|
+
}
|
|
12272
|
+
default:
|
|
12273
|
+
return;
|
|
12274
|
+
}
|
|
12275
|
+
}
|
|
12226
12276
|
function parse_gtd_cmd(param) {
|
|
12227
12277
|
if (!param) {
|
|
12228
12278
|
return;
|
|
@@ -12334,7 +12384,7 @@ var require_cn_lib = __commonJS({
|
|
|
12334
12384
|
return {
|
|
12335
12385
|
TAG: (
|
|
12336
12386
|
/* Commit */
|
|
12337
|
-
|
|
12387
|
+
10
|
|
12338
12388
|
),
|
|
12339
12389
|
_0: join_rest(param.tl)
|
|
12340
12390
|
};
|
|
@@ -12343,7 +12393,7 @@ var require_cn_lib = __commonJS({
|
|
|
12343
12393
|
return {
|
|
12344
12394
|
TAG: (
|
|
12345
12395
|
/* Gtd */
|
|
12346
|
-
|
|
12396
|
+
9
|
|
12347
12397
|
),
|
|
12348
12398
|
_0: c
|
|
12349
12399
|
};
|
|
@@ -12356,7 +12406,7 @@ var require_cn_lib = __commonJS({
|
|
|
12356
12406
|
return {
|
|
12357
12407
|
TAG: (
|
|
12358
12408
|
/* Gtd */
|
|
12359
|
-
|
|
12409
|
+
9
|
|
12360
12410
|
),
|
|
12361
12411
|
_0: c
|
|
12362
12412
|
};
|
|
@@ -12369,7 +12419,7 @@ var require_cn_lib = __commonJS({
|
|
|
12369
12419
|
return {
|
|
12370
12420
|
TAG: (
|
|
12371
12421
|
/* Gtd */
|
|
12372
|
-
|
|
12422
|
+
9
|
|
12373
12423
|
),
|
|
12374
12424
|
_0: c
|
|
12375
12425
|
};
|
|
@@ -12382,7 +12432,7 @@ var require_cn_lib = __commonJS({
|
|
|
12382
12432
|
return {
|
|
12383
12433
|
TAG: (
|
|
12384
12434
|
/* Gtd */
|
|
12385
|
-
|
|
12435
|
+
9
|
|
12386
12436
|
),
|
|
12387
12437
|
_0: c
|
|
12388
12438
|
};
|
|
@@ -12404,7 +12454,7 @@ var require_cn_lib = __commonJS({
|
|
|
12404
12454
|
return {
|
|
12405
12455
|
TAG: (
|
|
12406
12456
|
/* Gtd */
|
|
12407
|
-
|
|
12457
|
+
9
|
|
12408
12458
|
),
|
|
12409
12459
|
_0: c
|
|
12410
12460
|
};
|
|
@@ -12450,6 +12500,16 @@ var require_cn_lib = __commonJS({
|
|
|
12450
12500
|
_0: void 0
|
|
12451
12501
|
};
|
|
12452
12502
|
}
|
|
12503
|
+
case "mca":
|
|
12504
|
+
return Stdlib__Option2.map((function(c) {
|
|
12505
|
+
return {
|
|
12506
|
+
TAG: (
|
|
12507
|
+
/* Mca */
|
|
12508
|
+
5
|
|
12509
|
+
),
|
|
12510
|
+
_0: c
|
|
12511
|
+
};
|
|
12512
|
+
}), parse_mca_cmd(param.tl));
|
|
12453
12513
|
case "next":
|
|
12454
12514
|
if (param.tl) {
|
|
12455
12515
|
return;
|
|
@@ -12516,7 +12576,7 @@ var require_cn_lib = __commonJS({
|
|
|
12516
12576
|
return {
|
|
12517
12577
|
TAG: (
|
|
12518
12578
|
/* Read */
|
|
12519
|
-
|
|
12579
|
+
6
|
|
12520
12580
|
),
|
|
12521
12581
|
_0: match$1.hd
|
|
12522
12582
|
};
|
|
@@ -12530,7 +12590,7 @@ var require_cn_lib = __commonJS({
|
|
|
12530
12590
|
return {
|
|
12531
12591
|
TAG: (
|
|
12532
12592
|
/* Reply */
|
|
12533
|
-
|
|
12593
|
+
7
|
|
12534
12594
|
),
|
|
12535
12595
|
_0: match$2.hd,
|
|
12536
12596
|
_1: Stdlib__String2.concat(" ", match$2.tl)
|
|
@@ -12542,7 +12602,7 @@ var require_cn_lib = __commonJS({
|
|
|
12542
12602
|
return {
|
|
12543
12603
|
TAG: (
|
|
12544
12604
|
/* Save */
|
|
12545
|
-
|
|
12605
|
+
11
|
|
12546
12606
|
),
|
|
12547
12607
|
_0: join_rest(param.tl)
|
|
12548
12608
|
};
|
|
@@ -12552,7 +12612,7 @@ var require_cn_lib = __commonJS({
|
|
|
12552
12612
|
return {
|
|
12553
12613
|
TAG: (
|
|
12554
12614
|
/* Send */
|
|
12555
|
-
|
|
12615
|
+
8
|
|
12556
12616
|
),
|
|
12557
12617
|
_0: match$3.hd,
|
|
12558
12618
|
_1: Stdlib__String2.concat(" ", match$3.tl)
|
|
@@ -13014,8 +13074,8 @@ var require_cn_lib = __commonJS({
|
|
|
13014
13074
|
10
|
|
13015
13075
|
);
|
|
13016
13076
|
}
|
|
13017
|
-
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 process Queue inbox \xE2\x86\x92 input.md \xE2\x86\x92 wake agent\n queue [list|clear] View or clear the task queue\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";
|
|
13018
|
-
var version = "2.1.
|
|
13077
|
+
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 process Queue inbox \xE2\x86\x92 input.md \xE2\x86\x92 wake agent\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";
|
|
13078
|
+
var version = "2.1.13";
|
|
13019
13079
|
module2.exports = {
|
|
13020
13080
|
starts_with,
|
|
13021
13081
|
strip_prefix,
|
|
@@ -13027,6 +13087,7 @@ var require_cn_lib = __commonJS({
|
|
|
13027
13087
|
parse_outbox_cmd,
|
|
13028
13088
|
parse_peer_cmd,
|
|
13029
13089
|
parse_queue_cmd,
|
|
13090
|
+
parse_mca_cmd,
|
|
13030
13091
|
parse_gtd_cmd,
|
|
13031
13092
|
join_rest,
|
|
13032
13093
|
parse_command,
|
|
@@ -30616,6 +30677,407 @@ function run_queue_clear(hub_path) {
|
|
|
30616
30677
|
}
|
|
30617
30678
|
console.log(color("32", "\xE2\x9C\x93 ") + "Queue already empty");
|
|
30618
30679
|
}
|
|
30680
|
+
function mca_dir(hub_path) {
|
|
30681
|
+
return Path.join(hub_path, "state/mca");
|
|
30682
|
+
}
|
|
30683
|
+
function run_mca_add(hub_path, name, description) {
|
|
30684
|
+
const dir = Path.join(hub_path, "state/mca");
|
|
30685
|
+
ensure_dir(dir);
|
|
30686
|
+
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
30687
|
+
const slug = description.slice(0, 40).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
30688
|
+
const file_name = Curry._2(Stdlib__Printf.sprintf({
|
|
30689
|
+
TAG: (
|
|
30690
|
+
/* Format */
|
|
30691
|
+
0
|
|
30692
|
+
),
|
|
30693
|
+
_0: {
|
|
30694
|
+
TAG: (
|
|
30695
|
+
/* String */
|
|
30696
|
+
2
|
|
30697
|
+
),
|
|
30698
|
+
_0: (
|
|
30699
|
+
/* No_padding */
|
|
30700
|
+
0
|
|
30701
|
+
),
|
|
30702
|
+
_1: {
|
|
30703
|
+
TAG: (
|
|
30704
|
+
/* Char_literal */
|
|
30705
|
+
12
|
|
30706
|
+
),
|
|
30707
|
+
_0: (
|
|
30708
|
+
/* '-' */
|
|
30709
|
+
45
|
|
30710
|
+
),
|
|
30711
|
+
_1: {
|
|
30712
|
+
TAG: (
|
|
30713
|
+
/* String */
|
|
30714
|
+
2
|
|
30715
|
+
),
|
|
30716
|
+
_0: (
|
|
30717
|
+
/* No_padding */
|
|
30718
|
+
0
|
|
30719
|
+
),
|
|
30720
|
+
_1: {
|
|
30721
|
+
TAG: (
|
|
30722
|
+
/* String_literal */
|
|
30723
|
+
11
|
|
30724
|
+
),
|
|
30725
|
+
_0: ".md",
|
|
30726
|
+
_1: (
|
|
30727
|
+
/* End_of_format */
|
|
30728
|
+
0
|
|
30729
|
+
)
|
|
30730
|
+
}
|
|
30731
|
+
}
|
|
30732
|
+
}
|
|
30733
|
+
},
|
|
30734
|
+
_1: "%s-%s.md"
|
|
30735
|
+
}), ts, slug);
|
|
30736
|
+
const file_path = Path.join(dir, file_name);
|
|
30737
|
+
const content = Curry._4(Stdlib__Printf.sprintf({
|
|
30738
|
+
TAG: (
|
|
30739
|
+
/* Format */
|
|
30740
|
+
0
|
|
30741
|
+
),
|
|
30742
|
+
_0: {
|
|
30743
|
+
TAG: (
|
|
30744
|
+
/* String_literal */
|
|
30745
|
+
11
|
|
30746
|
+
),
|
|
30747
|
+
_0: "---\nid: ",
|
|
30748
|
+
_1: {
|
|
30749
|
+
TAG: (
|
|
30750
|
+
/* String */
|
|
30751
|
+
2
|
|
30752
|
+
),
|
|
30753
|
+
_0: (
|
|
30754
|
+
/* No_padding */
|
|
30755
|
+
0
|
|
30756
|
+
),
|
|
30757
|
+
_1: {
|
|
30758
|
+
TAG: (
|
|
30759
|
+
/* String_literal */
|
|
30760
|
+
11
|
|
30761
|
+
),
|
|
30762
|
+
_0: "\nsurfaced-by: ",
|
|
30763
|
+
_1: {
|
|
30764
|
+
TAG: (
|
|
30765
|
+
/* String */
|
|
30766
|
+
2
|
|
30767
|
+
),
|
|
30768
|
+
_0: (
|
|
30769
|
+
/* No_padding */
|
|
30770
|
+
0
|
|
30771
|
+
),
|
|
30772
|
+
_1: {
|
|
30773
|
+
TAG: (
|
|
30774
|
+
/* String_literal */
|
|
30775
|
+
11
|
|
30776
|
+
),
|
|
30777
|
+
_0: "\ncreated: ",
|
|
30778
|
+
_1: {
|
|
30779
|
+
TAG: (
|
|
30780
|
+
/* String */
|
|
30781
|
+
2
|
|
30782
|
+
),
|
|
30783
|
+
_0: (
|
|
30784
|
+
/* No_padding */
|
|
30785
|
+
0
|
|
30786
|
+
),
|
|
30787
|
+
_1: {
|
|
30788
|
+
TAG: (
|
|
30789
|
+
/* String_literal */
|
|
30790
|
+
11
|
|
30791
|
+
),
|
|
30792
|
+
_0: "\nstatus: open\n---\n\n# MCA\n\n",
|
|
30793
|
+
_1: {
|
|
30794
|
+
TAG: (
|
|
30795
|
+
/* String */
|
|
30796
|
+
2
|
|
30797
|
+
),
|
|
30798
|
+
_0: (
|
|
30799
|
+
/* No_padding */
|
|
30800
|
+
0
|
|
30801
|
+
),
|
|
30802
|
+
_1: {
|
|
30803
|
+
TAG: (
|
|
30804
|
+
/* Char_literal */
|
|
30805
|
+
12
|
|
30806
|
+
),
|
|
30807
|
+
_0: (
|
|
30808
|
+
/* '\n' */
|
|
30809
|
+
10
|
|
30810
|
+
),
|
|
30811
|
+
_1: (
|
|
30812
|
+
/* End_of_format */
|
|
30813
|
+
0
|
|
30814
|
+
)
|
|
30815
|
+
}
|
|
30816
|
+
}
|
|
30817
|
+
}
|
|
30818
|
+
}
|
|
30819
|
+
}
|
|
30820
|
+
}
|
|
30821
|
+
}
|
|
30822
|
+
}
|
|
30823
|
+
},
|
|
30824
|
+
_1: "---\nid: %s\nsurfaced-by: %s\ncreated: %s\nstatus: open\n---\n\n# MCA\n\n%s\n"
|
|
30825
|
+
}), slug, name, (/* @__PURE__ */ new Date()).toISOString(), description);
|
|
30826
|
+
Fs.writeFileSync(file_path, content);
|
|
30827
|
+
log_action(hub_path, "mca.add", Curry._2(Stdlib__Printf.sprintf({
|
|
30828
|
+
TAG: (
|
|
30829
|
+
/* Format */
|
|
30830
|
+
0
|
|
30831
|
+
),
|
|
30832
|
+
_0: {
|
|
30833
|
+
TAG: (
|
|
30834
|
+
/* String_literal */
|
|
30835
|
+
11
|
|
30836
|
+
),
|
|
30837
|
+
_0: "id:",
|
|
30838
|
+
_1: {
|
|
30839
|
+
TAG: (
|
|
30840
|
+
/* String */
|
|
30841
|
+
2
|
|
30842
|
+
),
|
|
30843
|
+
_0: (
|
|
30844
|
+
/* No_padding */
|
|
30845
|
+
0
|
|
30846
|
+
),
|
|
30847
|
+
_1: {
|
|
30848
|
+
TAG: (
|
|
30849
|
+
/* String_literal */
|
|
30850
|
+
11
|
|
30851
|
+
),
|
|
30852
|
+
_0: " desc:",
|
|
30853
|
+
_1: {
|
|
30854
|
+
TAG: (
|
|
30855
|
+
/* String */
|
|
30856
|
+
2
|
|
30857
|
+
),
|
|
30858
|
+
_0: (
|
|
30859
|
+
/* No_padding */
|
|
30860
|
+
0
|
|
30861
|
+
),
|
|
30862
|
+
_1: (
|
|
30863
|
+
/* End_of_format */
|
|
30864
|
+
0
|
|
30865
|
+
)
|
|
30866
|
+
}
|
|
30867
|
+
}
|
|
30868
|
+
}
|
|
30869
|
+
},
|
|
30870
|
+
_1: "id:%s desc:%s"
|
|
30871
|
+
}), slug, description));
|
|
30872
|
+
const msg = Curry._1(Stdlib__Printf.sprintf({
|
|
30873
|
+
TAG: (
|
|
30874
|
+
/* Format */
|
|
30875
|
+
0
|
|
30876
|
+
),
|
|
30877
|
+
_0: {
|
|
30878
|
+
TAG: (
|
|
30879
|
+
/* String_literal */
|
|
30880
|
+
11
|
|
30881
|
+
),
|
|
30882
|
+
_0: "MCA surfaced: ",
|
|
30883
|
+
_1: {
|
|
30884
|
+
TAG: (
|
|
30885
|
+
/* String */
|
|
30886
|
+
2
|
|
30887
|
+
),
|
|
30888
|
+
_0: (
|
|
30889
|
+
/* No_padding */
|
|
30890
|
+
0
|
|
30891
|
+
),
|
|
30892
|
+
_1: (
|
|
30893
|
+
/* End_of_format */
|
|
30894
|
+
0
|
|
30895
|
+
)
|
|
30896
|
+
}
|
|
30897
|
+
},
|
|
30898
|
+
_1: "MCA surfaced: %s"
|
|
30899
|
+
}), description);
|
|
30900
|
+
console.log(color("32", "\xE2\x9C\x93 ") + msg);
|
|
30901
|
+
}
|
|
30902
|
+
function run_mca_list(hub_path) {
|
|
30903
|
+
const dir = Path.join(hub_path, "state/mca");
|
|
30904
|
+
if (Fs.existsSync(dir)) {
|
|
30905
|
+
const items = Stdlib__List.sort(Stdlib__String.compare, Stdlib__List.filter(is_md_file, Stdlib__Array.to_list(Fs.readdirSync(dir))));
|
|
30906
|
+
if (items) {
|
|
30907
|
+
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
30908
|
+
TAG: (
|
|
30909
|
+
/* Format */
|
|
30910
|
+
0
|
|
30911
|
+
),
|
|
30912
|
+
_0: {
|
|
30913
|
+
TAG: (
|
|
30914
|
+
/* String_literal */
|
|
30915
|
+
11
|
|
30916
|
+
),
|
|
30917
|
+
_0: "Open MCAs: ",
|
|
30918
|
+
_1: {
|
|
30919
|
+
TAG: (
|
|
30920
|
+
/* Int */
|
|
30921
|
+
4
|
|
30922
|
+
),
|
|
30923
|
+
_0: (
|
|
30924
|
+
/* Int_d */
|
|
30925
|
+
0
|
|
30926
|
+
),
|
|
30927
|
+
_1: (
|
|
30928
|
+
/* No_padding */
|
|
30929
|
+
0
|
|
30930
|
+
),
|
|
30931
|
+
_2: (
|
|
30932
|
+
/* No_precision */
|
|
30933
|
+
0
|
|
30934
|
+
),
|
|
30935
|
+
_3: (
|
|
30936
|
+
/* End_of_format */
|
|
30937
|
+
0
|
|
30938
|
+
)
|
|
30939
|
+
}
|
|
30940
|
+
},
|
|
30941
|
+
_1: "Open MCAs: %d"
|
|
30942
|
+
}), Stdlib__List.length(items))));
|
|
30943
|
+
return Stdlib__List.iter((function(file) {
|
|
30944
|
+
const file_path = Path.join(dir, file);
|
|
30945
|
+
const content = Fs.readFileSync(file_path, "utf8");
|
|
30946
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
30947
|
+
const id = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
30948
|
+
if (param[0] === "id") {
|
|
30949
|
+
return param[1];
|
|
30950
|
+
}
|
|
30951
|
+
}), meta), "?");
|
|
30952
|
+
const by = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
30953
|
+
if (param[0] === "surfaced-by") {
|
|
30954
|
+
return param[1];
|
|
30955
|
+
}
|
|
30956
|
+
}), meta), "?");
|
|
30957
|
+
const lines = Stdlib__String.split_on_char(
|
|
30958
|
+
/* '\n' */
|
|
30959
|
+
10,
|
|
30960
|
+
content
|
|
30961
|
+
);
|
|
30962
|
+
const skip_frontmatter = function(_in_fm, _rest) {
|
|
30963
|
+
while (true) {
|
|
30964
|
+
const rest = _rest;
|
|
30965
|
+
const in_fm = _in_fm;
|
|
30966
|
+
if (!rest) {
|
|
30967
|
+
return (
|
|
30968
|
+
/* [] */
|
|
30969
|
+
0
|
|
30970
|
+
);
|
|
30971
|
+
}
|
|
30972
|
+
if (rest.hd === "---") {
|
|
30973
|
+
const rest$1 = rest.tl;
|
|
30974
|
+
if (in_fm) {
|
|
30975
|
+
if (in_fm) {
|
|
30976
|
+
return rest$1;
|
|
30977
|
+
}
|
|
30978
|
+
} else {
|
|
30979
|
+
_rest = rest$1;
|
|
30980
|
+
_in_fm = true;
|
|
30981
|
+
continue;
|
|
30982
|
+
}
|
|
30983
|
+
}
|
|
30984
|
+
if (!in_fm) {
|
|
30985
|
+
return rest;
|
|
30986
|
+
}
|
|
30987
|
+
_rest = rest.tl;
|
|
30988
|
+
continue;
|
|
30989
|
+
}
|
|
30990
|
+
;
|
|
30991
|
+
};
|
|
30992
|
+
const body_lines = skip_frontmatter(false, lines);
|
|
30993
|
+
const desc = Stdlib__Option.value(Stdlib__List.find_opt((function(l) {
|
|
30994
|
+
const t = Stdlib__String.trim(l);
|
|
30995
|
+
if (t !== "") {
|
|
30996
|
+
return !Cn_lib.starts_with("#", t);
|
|
30997
|
+
} else {
|
|
30998
|
+
return false;
|
|
30999
|
+
}
|
|
31000
|
+
}), body_lines), "(no description)");
|
|
31001
|
+
console.log(Curry._3(Stdlib__Printf.sprintf({
|
|
31002
|
+
TAG: (
|
|
31003
|
+
/* Format */
|
|
31004
|
+
0
|
|
31005
|
+
),
|
|
31006
|
+
_0: {
|
|
31007
|
+
TAG: (
|
|
31008
|
+
/* String_literal */
|
|
31009
|
+
11
|
|
31010
|
+
),
|
|
31011
|
+
_0: " [",
|
|
31012
|
+
_1: {
|
|
31013
|
+
TAG: (
|
|
31014
|
+
/* String */
|
|
31015
|
+
2
|
|
31016
|
+
),
|
|
31017
|
+
_0: (
|
|
31018
|
+
/* No_padding */
|
|
31019
|
+
0
|
|
31020
|
+
),
|
|
31021
|
+
_1: {
|
|
31022
|
+
TAG: (
|
|
31023
|
+
/* String_literal */
|
|
31024
|
+
11
|
|
31025
|
+
),
|
|
31026
|
+
_0: "] ",
|
|
31027
|
+
_1: {
|
|
31028
|
+
TAG: (
|
|
31029
|
+
/* String */
|
|
31030
|
+
2
|
|
31031
|
+
),
|
|
31032
|
+
_0: (
|
|
31033
|
+
/* No_padding */
|
|
31034
|
+
0
|
|
31035
|
+
),
|
|
31036
|
+
_1: {
|
|
31037
|
+
TAG: (
|
|
31038
|
+
/* String_literal */
|
|
31039
|
+
11
|
|
31040
|
+
),
|
|
31041
|
+
_0: " (by ",
|
|
31042
|
+
_1: {
|
|
31043
|
+
TAG: (
|
|
31044
|
+
/* String */
|
|
31045
|
+
2
|
|
31046
|
+
),
|
|
31047
|
+
_0: (
|
|
31048
|
+
/* No_padding */
|
|
31049
|
+
0
|
|
31050
|
+
),
|
|
31051
|
+
_1: {
|
|
31052
|
+
TAG: (
|
|
31053
|
+
/* Char_literal */
|
|
31054
|
+
12
|
|
31055
|
+
),
|
|
31056
|
+
_0: (
|
|
31057
|
+
/* ')' */
|
|
31058
|
+
41
|
|
31059
|
+
),
|
|
31060
|
+
_1: (
|
|
31061
|
+
/* End_of_format */
|
|
31062
|
+
0
|
|
31063
|
+
)
|
|
31064
|
+
}
|
|
31065
|
+
}
|
|
31066
|
+
}
|
|
31067
|
+
}
|
|
31068
|
+
}
|
|
31069
|
+
}
|
|
31070
|
+
},
|
|
31071
|
+
_1: " [%s] %s (by %s)"
|
|
31072
|
+
}), id, Stdlib__String.trim(desc), by));
|
|
31073
|
+
}), items);
|
|
31074
|
+
} else {
|
|
31075
|
+
console.log("(no MCAs)");
|
|
31076
|
+
return;
|
|
31077
|
+
}
|
|
31078
|
+
}
|
|
31079
|
+
console.log("(no MCAs)");
|
|
31080
|
+
}
|
|
30619
31081
|
function update_runtime(hub_path) {
|
|
30620
31082
|
const runtime_path = Path.join(hub_path, "state/runtime.md");
|
|
30621
31083
|
const v = exec("cn --version 2>/dev/null");
|
|
@@ -32381,20 +32843,32 @@ if (cmd !== void 0) {
|
|
|
32381
32843
|
run_queue_clear(hub_path$1);
|
|
32382
32844
|
}
|
|
32383
32845
|
break;
|
|
32384
|
-
case /*
|
|
32846
|
+
case /* Mca */
|
|
32385
32847
|
5:
|
|
32848
|
+
const desc = cmd._0;
|
|
32849
|
+
if (
|
|
32850
|
+
/* tag */
|
|
32851
|
+
typeof desc === "number" || typeof desc === "string"
|
|
32852
|
+
) {
|
|
32853
|
+
run_mca_list(hub_path$1);
|
|
32854
|
+
} else {
|
|
32855
|
+
run_mca_add(hub_path$1, name, desc._0);
|
|
32856
|
+
}
|
|
32857
|
+
break;
|
|
32858
|
+
case /* Read */
|
|
32859
|
+
6:
|
|
32386
32860
|
run_read(hub_path$1, cmd._0);
|
|
32387
32861
|
break;
|
|
32388
32862
|
case /* Reply */
|
|
32389
|
-
|
|
32863
|
+
7:
|
|
32390
32864
|
run_reply(hub_path$1, cmd._0, cmd._1);
|
|
32391
32865
|
break;
|
|
32392
32866
|
case /* Send */
|
|
32393
|
-
|
|
32867
|
+
8:
|
|
32394
32868
|
run_send(hub_path$1, cmd._0, cmd._1);
|
|
32395
32869
|
break;
|
|
32396
32870
|
case /* Gtd */
|
|
32397
|
-
|
|
32871
|
+
9:
|
|
32398
32872
|
const t = cmd._0;
|
|
32399
32873
|
switch (t.TAG) {
|
|
32400
32874
|
case /* GtdDelete */
|
|
@@ -32420,11 +32894,11 @@ if (cmd !== void 0) {
|
|
|
32420
32894
|
}
|
|
32421
32895
|
break;
|
|
32422
32896
|
case /* Commit */
|
|
32423
|
-
|
|
32897
|
+
10:
|
|
32424
32898
|
run_commit(hub_path$1, name, cmd._0);
|
|
32425
32899
|
break;
|
|
32426
32900
|
case /* Save */
|
|
32427
|
-
|
|
32901
|
+
11:
|
|
32428
32902
|
run_commit(hub_path$1, name, cmd._0);
|
|
32429
32903
|
run_push(hub_path$1);
|
|
32430
32904
|
break;
|
|
@@ -32540,6 +33014,9 @@ module.exports = {
|
|
|
32540
33014
|
run_sync,
|
|
32541
33015
|
run_queue_list,
|
|
32542
33016
|
run_queue_clear,
|
|
33017
|
+
mca_dir,
|
|
33018
|
+
run_mca_add,
|
|
33019
|
+
run_mca_list,
|
|
32543
33020
|
update_runtime,
|
|
32544
33021
|
run_init,
|
|
32545
33022
|
format_peers_md,
|