sequoia-cli 0.5.0 → 0.5.2
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/dist/components/sequoia-comments.js +52 -14
- package/dist/components/sequoia-subscribe.js +225 -53
- package/dist/index.js +446 -180
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -2512,9 +2512,156 @@ var require_browser = __commonJS((exports, module) => {
|
|
|
2512
2512
|
};
|
|
2513
2513
|
});
|
|
2514
2514
|
|
|
2515
|
+
// ../../node_modules/.bun/supports-color@10.2.2/node_modules/supports-color/index.js
|
|
2516
|
+
var exports_supports_color = {};
|
|
2517
|
+
__export(exports_supports_color, {
|
|
2518
|
+
default: () => supports_color_default2,
|
|
2519
|
+
createSupportsColor: () => createSupportsColor2
|
|
2520
|
+
});
|
|
2521
|
+
import process3 from "node:process";
|
|
2522
|
+
import os2 from "node:os";
|
|
2523
|
+
import tty2 from "node:tty";
|
|
2524
|
+
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process3.argv) {
|
|
2525
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
2526
|
+
const position = argv.indexOf(prefix + flag);
|
|
2527
|
+
const terminatorPosition = argv.indexOf("--");
|
|
2528
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
2529
|
+
}
|
|
2530
|
+
function envForceColor2() {
|
|
2531
|
+
if (!("FORCE_COLOR" in env2)) {
|
|
2532
|
+
return;
|
|
2533
|
+
}
|
|
2534
|
+
if (env2.FORCE_COLOR === "true") {
|
|
2535
|
+
return 1;
|
|
2536
|
+
}
|
|
2537
|
+
if (env2.FORCE_COLOR === "false") {
|
|
2538
|
+
return 0;
|
|
2539
|
+
}
|
|
2540
|
+
if (env2.FORCE_COLOR.length === 0) {
|
|
2541
|
+
return 1;
|
|
2542
|
+
}
|
|
2543
|
+
const level = Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
|
|
2544
|
+
if (![0, 1, 2, 3].includes(level)) {
|
|
2545
|
+
return;
|
|
2546
|
+
}
|
|
2547
|
+
return level;
|
|
2548
|
+
}
|
|
2549
|
+
function translateLevel2(level) {
|
|
2550
|
+
if (level === 0) {
|
|
2551
|
+
return false;
|
|
2552
|
+
}
|
|
2553
|
+
return {
|
|
2554
|
+
level,
|
|
2555
|
+
hasBasic: true,
|
|
2556
|
+
has256: level >= 2,
|
|
2557
|
+
has16m: level >= 3
|
|
2558
|
+
};
|
|
2559
|
+
}
|
|
2560
|
+
function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
2561
|
+
const noFlagForceColor = envForceColor2();
|
|
2562
|
+
if (noFlagForceColor !== undefined) {
|
|
2563
|
+
flagForceColor2 = noFlagForceColor;
|
|
2564
|
+
}
|
|
2565
|
+
const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
|
|
2566
|
+
if (forceColor === 0) {
|
|
2567
|
+
return 0;
|
|
2568
|
+
}
|
|
2569
|
+
if (sniffFlags) {
|
|
2570
|
+
if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
|
|
2571
|
+
return 3;
|
|
2572
|
+
}
|
|
2573
|
+
if (hasFlag2("color=256")) {
|
|
2574
|
+
return 2;
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
|
|
2578
|
+
return 1;
|
|
2579
|
+
}
|
|
2580
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
2581
|
+
return 0;
|
|
2582
|
+
}
|
|
2583
|
+
const min = forceColor || 0;
|
|
2584
|
+
if (env2.TERM === "dumb") {
|
|
2585
|
+
return min;
|
|
2586
|
+
}
|
|
2587
|
+
if (process3.platform === "win32") {
|
|
2588
|
+
const osRelease = os2.release().split(".");
|
|
2589
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
2590
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2591
|
+
}
|
|
2592
|
+
return 1;
|
|
2593
|
+
}
|
|
2594
|
+
if ("CI" in env2) {
|
|
2595
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env2))) {
|
|
2596
|
+
return 3;
|
|
2597
|
+
}
|
|
2598
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env2)) || env2.CI_NAME === "codeship") {
|
|
2599
|
+
return 1;
|
|
2600
|
+
}
|
|
2601
|
+
return min;
|
|
2602
|
+
}
|
|
2603
|
+
if ("TEAMCITY_VERSION" in env2) {
|
|
2604
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
|
|
2605
|
+
}
|
|
2606
|
+
if (env2.COLORTERM === "truecolor") {
|
|
2607
|
+
return 3;
|
|
2608
|
+
}
|
|
2609
|
+
if (env2.TERM === "xterm-kitty") {
|
|
2610
|
+
return 3;
|
|
2611
|
+
}
|
|
2612
|
+
if (env2.TERM === "xterm-ghostty") {
|
|
2613
|
+
return 3;
|
|
2614
|
+
}
|
|
2615
|
+
if (env2.TERM === "wezterm") {
|
|
2616
|
+
return 3;
|
|
2617
|
+
}
|
|
2618
|
+
if ("TERM_PROGRAM" in env2) {
|
|
2619
|
+
const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
2620
|
+
switch (env2.TERM_PROGRAM) {
|
|
2621
|
+
case "iTerm.app": {
|
|
2622
|
+
return version >= 3 ? 3 : 2;
|
|
2623
|
+
}
|
|
2624
|
+
case "Apple_Terminal": {
|
|
2625
|
+
return 2;
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
if (/-256(color)?$/i.test(env2.TERM)) {
|
|
2630
|
+
return 2;
|
|
2631
|
+
}
|
|
2632
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
|
|
2633
|
+
return 1;
|
|
2634
|
+
}
|
|
2635
|
+
if ("COLORTERM" in env2) {
|
|
2636
|
+
return 1;
|
|
2637
|
+
}
|
|
2638
|
+
return min;
|
|
2639
|
+
}
|
|
2640
|
+
function createSupportsColor2(stream, options = {}) {
|
|
2641
|
+
const level = _supportsColor2(stream, {
|
|
2642
|
+
streamIsTTY: stream && stream.isTTY,
|
|
2643
|
+
...options
|
|
2644
|
+
});
|
|
2645
|
+
return translateLevel2(level);
|
|
2646
|
+
}
|
|
2647
|
+
var env2, flagForceColor2, supportsColor2, supports_color_default2;
|
|
2648
|
+
var init_supports_color2 = __esm(() => {
|
|
2649
|
+
({ env: env2 } = process3);
|
|
2650
|
+
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
|
|
2651
|
+
flagForceColor2 = 0;
|
|
2652
|
+
} else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
|
|
2653
|
+
flagForceColor2 = 1;
|
|
2654
|
+
}
|
|
2655
|
+
supportsColor2 = {
|
|
2656
|
+
stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
|
|
2657
|
+
stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
|
|
2658
|
+
};
|
|
2659
|
+
supports_color_default2 = supportsColor2;
|
|
2660
|
+
});
|
|
2661
|
+
|
|
2515
2662
|
// ../../node_modules/.bun/cmd-ts@0.14.3/node_modules/cmd-ts/node_modules/debug/src/node.js
|
|
2516
2663
|
var require_node = __commonJS((exports, module) => {
|
|
2517
|
-
var
|
|
2664
|
+
var tty3 = __require("tty");
|
|
2518
2665
|
var util = __require("util");
|
|
2519
2666
|
exports.init = init;
|
|
2520
2667
|
exports.log = log;
|
|
@@ -2525,8 +2672,8 @@ var require_node = __commonJS((exports, module) => {
|
|
|
2525
2672
|
exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
2526
2673
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
2527
2674
|
try {
|
|
2528
|
-
const
|
|
2529
|
-
if (
|
|
2675
|
+
const supportsColor3 = (init_supports_color2(), __toCommonJS(exports_supports_color));
|
|
2676
|
+
if (supportsColor3 && (supportsColor3.stderr || supportsColor3).level >= 2) {
|
|
2530
2677
|
exports.colors = [
|
|
2531
2678
|
20,
|
|
2532
2679
|
21,
|
|
@@ -2627,7 +2774,7 @@ var require_node = __commonJS((exports, module) => {
|
|
|
2627
2774
|
return obj;
|
|
2628
2775
|
}, {});
|
|
2629
2776
|
function useColors() {
|
|
2630
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) :
|
|
2777
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty3.isatty(process.stderr.fd);
|
|
2631
2778
|
}
|
|
2632
2779
|
function formatArgs(args) {
|
|
2633
2780
|
const { namespace: name, useColors: useColors2 } = this;
|
|
@@ -3677,8 +3824,8 @@ var require_cjs = __commonJS((exports) => {
|
|
|
3677
3824
|
var require_picocolors = __commonJS((exports, module) => {
|
|
3678
3825
|
var p = process || {};
|
|
3679
3826
|
var argv = p.argv || [];
|
|
3680
|
-
var
|
|
3681
|
-
var isColorSupported = !(!!
|
|
3827
|
+
var env3 = p.env || {};
|
|
3828
|
+
var isColorSupported = !(!!env3.NO_COLOR || argv.includes("--no-color")) && (!!env3.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env3.TERM !== "dumb" || !!env3.CI);
|
|
3682
3829
|
var formatter = (open, close, replace = open) => (input) => {
|
|
3683
3830
|
let string = "" + input, index = string.indexOf(close, open.length);
|
|
3684
3831
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
@@ -8864,7 +9011,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
8864
9011
|
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
8865
9012
|
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
8866
9013
|
};
|
|
8867
|
-
__addDisposableResource = function(
|
|
9014
|
+
__addDisposableResource = function(env3, value, async) {
|
|
8868
9015
|
if (value !== null && value !== undefined) {
|
|
8869
9016
|
if (typeof value !== "object" && typeof value !== "function")
|
|
8870
9017
|
throw new TypeError("Object expected.");
|
|
@@ -8891,9 +9038,9 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
8891
9038
|
return Promise.reject(e);
|
|
8892
9039
|
}
|
|
8893
9040
|
};
|
|
8894
|
-
|
|
9041
|
+
env3.stack.push({ value, dispose, async });
|
|
8895
9042
|
} else if (async) {
|
|
8896
|
-
|
|
9043
|
+
env3.stack.push({ async: true });
|
|
8897
9044
|
}
|
|
8898
9045
|
return value;
|
|
8899
9046
|
};
|
|
@@ -8901,17 +9048,17 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
8901
9048
|
var e = new Error(message);
|
|
8902
9049
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
8903
9050
|
};
|
|
8904
|
-
__disposeResources = function(
|
|
9051
|
+
__disposeResources = function(env3) {
|
|
8905
9052
|
function fail(e) {
|
|
8906
|
-
|
|
8907
|
-
|
|
9053
|
+
env3.error = env3.hasError ? new _SuppressedError(e, env3.error, "An error was suppressed during disposal.") : e;
|
|
9054
|
+
env3.hasError = true;
|
|
8908
9055
|
}
|
|
8909
9056
|
var r, s = 0;
|
|
8910
9057
|
function next() {
|
|
8911
|
-
while (r =
|
|
9058
|
+
while (r = env3.stack.pop()) {
|
|
8912
9059
|
try {
|
|
8913
9060
|
if (!r.async && s === 1)
|
|
8914
|
-
return s = 0,
|
|
9061
|
+
return s = 0, env3.stack.push(r), Promise.resolve().then(next);
|
|
8915
9062
|
if (r.dispose) {
|
|
8916
9063
|
var result = r.dispose.call(r.value);
|
|
8917
9064
|
if (r.async)
|
|
@@ -8926,9 +9073,9 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
8926
9073
|
}
|
|
8927
9074
|
}
|
|
8928
9075
|
if (s === 1)
|
|
8929
|
-
return
|
|
8930
|
-
if (
|
|
8931
|
-
throw
|
|
9076
|
+
return env3.hasError ? Promise.reject(env3.error) : Promise.resolve();
|
|
9077
|
+
if (env3.hasError)
|
|
9078
|
+
throw env3.error;
|
|
8932
9079
|
}
|
|
8933
9080
|
return next();
|
|
8934
9081
|
};
|
|
@@ -81771,8 +81918,8 @@ var require_alg = __commonJS((exports) => {
|
|
|
81771
81918
|
exports.jwkAlgorithms = jwkAlgorithms;
|
|
81772
81919
|
var errors_js_1 = require_errors3();
|
|
81773
81920
|
var jwk_js_1 = require_jwk();
|
|
81774
|
-
var { process:
|
|
81775
|
-
var IS_NODE_RUNTIME = typeof
|
|
81921
|
+
var { process: process4 } = globalThis;
|
|
81922
|
+
var IS_NODE_RUNTIME = typeof process4 !== "undefined" && typeof process4?.versions?.node === "string";
|
|
81776
81923
|
function* jwkAlgorithms(jwk) {
|
|
81777
81924
|
if (typeof jwk.alg === "string") {
|
|
81778
81925
|
yield jwk.alg;
|
|
@@ -87186,9 +87333,9 @@ var require_environment_user_agent = __commonJS((exports, module) => {
|
|
|
87186
87333
|
var require_environment_v8_version = __commonJS((exports, module) => {
|
|
87187
87334
|
var globalThis2 = require_global_this();
|
|
87188
87335
|
var userAgent = require_environment_user_agent();
|
|
87189
|
-
var
|
|
87336
|
+
var process4 = globalThis2.process;
|
|
87190
87337
|
var Deno = globalThis2.Deno;
|
|
87191
|
-
var versions =
|
|
87338
|
+
var versions = process4 && process4.versions || Deno && Deno.version;
|
|
87192
87339
|
var v8 = versions && versions.v8;
|
|
87193
87340
|
var match2;
|
|
87194
87341
|
var version;
|
|
@@ -90721,7 +90868,7 @@ var require_runtime3 = __commonJS((exports) => {
|
|
|
90721
90868
|
|
|
90722
90869
|
// ../../node_modules/.bun/@atproto+oauth-client@0.5.14/node_modules/@atproto/oauth-client/dist/session-getter.js
|
|
90723
90870
|
var require_session_getter = __commonJS((exports) => {
|
|
90724
|
-
var __addDisposableResource = exports && exports.__addDisposableResource || function(
|
|
90871
|
+
var __addDisposableResource = exports && exports.__addDisposableResource || function(env3, value, async) {
|
|
90725
90872
|
if (value !== null && value !== undefined) {
|
|
90726
90873
|
if (typeof value !== "object" && typeof value !== "function")
|
|
90727
90874
|
throw new TypeError("Object expected.");
|
|
@@ -90748,24 +90895,24 @@ var require_session_getter = __commonJS((exports) => {
|
|
|
90748
90895
|
return Promise.reject(e);
|
|
90749
90896
|
}
|
|
90750
90897
|
};
|
|
90751
|
-
|
|
90898
|
+
env3.stack.push({ value, dispose, async });
|
|
90752
90899
|
} else if (async) {
|
|
90753
|
-
|
|
90900
|
+
env3.stack.push({ async: true });
|
|
90754
90901
|
}
|
|
90755
90902
|
return value;
|
|
90756
90903
|
};
|
|
90757
90904
|
var __disposeResources = exports && exports.__disposeResources || function(SuppressedError2) {
|
|
90758
|
-
return function(
|
|
90905
|
+
return function(env3) {
|
|
90759
90906
|
function fail(e) {
|
|
90760
|
-
|
|
90761
|
-
|
|
90907
|
+
env3.error = env3.hasError ? new SuppressedError2(e, env3.error, "An error was suppressed during disposal.") : e;
|
|
90908
|
+
env3.hasError = true;
|
|
90762
90909
|
}
|
|
90763
90910
|
var r, s = 0;
|
|
90764
90911
|
function next() {
|
|
90765
|
-
while (r =
|
|
90912
|
+
while (r = env3.stack.pop()) {
|
|
90766
90913
|
try {
|
|
90767
90914
|
if (!r.async && s === 1)
|
|
90768
|
-
return s = 0,
|
|
90915
|
+
return s = 0, env3.stack.push(r), Promise.resolve().then(next);
|
|
90769
90916
|
if (r.dispose) {
|
|
90770
90917
|
var result = r.dispose.call(r.value);
|
|
90771
90918
|
if (r.async)
|
|
@@ -90780,9 +90927,9 @@ var require_session_getter = __commonJS((exports) => {
|
|
|
90780
90927
|
}
|
|
90781
90928
|
}
|
|
90782
90929
|
if (s === 1)
|
|
90783
|
-
return
|
|
90784
|
-
if (
|
|
90785
|
-
throw
|
|
90930
|
+
return env3.hasError ? Promise.reject(env3.error) : Promise.resolve();
|
|
90931
|
+
if (env3.hasError)
|
|
90932
|
+
throw env3.error;
|
|
90786
90933
|
}
|
|
90787
90934
|
return next();
|
|
90788
90935
|
};
|
|
@@ -91504,14 +91651,14 @@ var init_is_inside_container = __esm(() => {
|
|
|
91504
91651
|
});
|
|
91505
91652
|
|
|
91506
91653
|
// ../../node_modules/.bun/is-wsl@3.1.0/node_modules/is-wsl/index.js
|
|
91507
|
-
import
|
|
91508
|
-
import
|
|
91654
|
+
import process4 from "node:process";
|
|
91655
|
+
import os5 from "node:os";
|
|
91509
91656
|
import fs11 from "node:fs";
|
|
91510
91657
|
var isWsl = () => {
|
|
91511
|
-
if (
|
|
91658
|
+
if (process4.platform !== "linux") {
|
|
91512
91659
|
return false;
|
|
91513
91660
|
}
|
|
91514
|
-
if (
|
|
91661
|
+
if (os5.release().toLowerCase().includes("microsoft")) {
|
|
91515
91662
|
if (isInsideContainer()) {
|
|
91516
91663
|
return false;
|
|
91517
91664
|
}
|
|
@@ -91525,15 +91672,15 @@ var isWsl = () => {
|
|
|
91525
91672
|
}, is_wsl_default;
|
|
91526
91673
|
var init_is_wsl = __esm(() => {
|
|
91527
91674
|
init_is_inside_container();
|
|
91528
|
-
is_wsl_default =
|
|
91675
|
+
is_wsl_default = process4.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
91529
91676
|
});
|
|
91530
91677
|
|
|
91531
91678
|
// ../../node_modules/.bun/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
|
|
91532
|
-
import
|
|
91679
|
+
import process5 from "node:process";
|
|
91533
91680
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
91534
91681
|
import { promisify } from "node:util";
|
|
91535
91682
|
import childProcess from "node:child_process";
|
|
91536
|
-
var execFile, powerShellPath = () => `${
|
|
91683
|
+
var execFile, powerShellPath = () => `${process5.env.SYSTEMROOT || process5.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command5, options = {}) => {
|
|
91537
91684
|
const {
|
|
91538
91685
|
powerShellPath: psPath,
|
|
91539
91686
|
...execFileOptions
|
|
@@ -91663,10 +91810,10 @@ function defineLazyProperty(object, propertyName, valueGetter) {
|
|
|
91663
91810
|
|
|
91664
91811
|
// ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
91665
91812
|
import { promisify as promisify3 } from "node:util";
|
|
91666
|
-
import
|
|
91813
|
+
import process6 from "node:process";
|
|
91667
91814
|
import { execFile as execFile3 } from "node:child_process";
|
|
91668
91815
|
async function defaultBrowserId() {
|
|
91669
|
-
if (
|
|
91816
|
+
if (process6.platform !== "darwin") {
|
|
91670
91817
|
throw new Error("macOS only");
|
|
91671
91818
|
}
|
|
91672
91819
|
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
@@ -91683,11 +91830,11 @@ var init_default_browser_id = __esm(() => {
|
|
|
91683
91830
|
});
|
|
91684
91831
|
|
|
91685
91832
|
// ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
91686
|
-
import
|
|
91833
|
+
import process7 from "node:process";
|
|
91687
91834
|
import { promisify as promisify4 } from "node:util";
|
|
91688
91835
|
import { execFile as execFile4, execFileSync } from "node:child_process";
|
|
91689
91836
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
91690
|
-
if (
|
|
91837
|
+
if (process7.platform !== "darwin") {
|
|
91691
91838
|
throw new Error("macOS only");
|
|
91692
91839
|
}
|
|
91693
91840
|
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
@@ -91761,21 +91908,21 @@ var init_windows = __esm(() => {
|
|
|
91761
91908
|
|
|
91762
91909
|
// ../../node_modules/.bun/default-browser@5.4.0/node_modules/default-browser/index.js
|
|
91763
91910
|
import { promisify as promisify6 } from "node:util";
|
|
91764
|
-
import
|
|
91911
|
+
import process8 from "node:process";
|
|
91765
91912
|
import { execFile as execFile6 } from "node:child_process";
|
|
91766
91913
|
async function defaultBrowser2() {
|
|
91767
|
-
if (
|
|
91914
|
+
if (process8.platform === "darwin") {
|
|
91768
91915
|
const id = await defaultBrowserId();
|
|
91769
91916
|
const name = await bundleName(id);
|
|
91770
91917
|
return { name, id };
|
|
91771
91918
|
}
|
|
91772
|
-
if (
|
|
91919
|
+
if (process8.platform === "linux") {
|
|
91773
91920
|
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
91774
91921
|
const id = stdout.trim();
|
|
91775
91922
|
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
91776
91923
|
return { name, id };
|
|
91777
91924
|
}
|
|
91778
|
-
if (
|
|
91925
|
+
if (process8.platform === "win32") {
|
|
91779
91926
|
return defaultBrowser();
|
|
91780
91927
|
}
|
|
91781
91928
|
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
@@ -91790,10 +91937,10 @@ var init_default_browser = __esm(() => {
|
|
|
91790
91937
|
});
|
|
91791
91938
|
|
|
91792
91939
|
// ../../node_modules/.bun/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
|
|
91793
|
-
import
|
|
91940
|
+
import process9 from "node:process";
|
|
91794
91941
|
var isInSsh, is_in_ssh_default;
|
|
91795
91942
|
var init_is_in_ssh = __esm(() => {
|
|
91796
|
-
isInSsh = Boolean(
|
|
91943
|
+
isInSsh = Boolean(process9.env.SSH_CONNECTION || process9.env.SSH_CLIENT || process9.env.SSH_TTY);
|
|
91797
91944
|
is_in_ssh_default = isInSsh;
|
|
91798
91945
|
});
|
|
91799
91946
|
|
|
@@ -91804,7 +91951,7 @@ __export(exports_open, {
|
|
|
91804
91951
|
default: () => open_default,
|
|
91805
91952
|
apps: () => apps
|
|
91806
91953
|
});
|
|
91807
|
-
import
|
|
91954
|
+
import process10 from "node:process";
|
|
91808
91955
|
import path10 from "node:path";
|
|
91809
91956
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
91810
91957
|
import childProcess3 from "node:child_process";
|
|
@@ -91975,7 +92122,7 @@ var fallbackAttemptSymbol, __dirname3, localXdgOpenPath, platform, arch, tryEach
|
|
|
91975
92122
|
await fs13.access(localXdgOpenPath, fsConstants2.X_OK);
|
|
91976
92123
|
exeLocalXdgOpen = true;
|
|
91977
92124
|
} catch {}
|
|
91978
|
-
const useSystemXdgOpen =
|
|
92125
|
+
const useSystemXdgOpen = process10.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
|
|
91979
92126
|
command5 = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
91980
92127
|
}
|
|
91981
92128
|
if (appArguments.length > 0) {
|
|
@@ -92062,7 +92209,7 @@ var init_open = __esm(() => {
|
|
|
92062
92209
|
fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
92063
92210
|
__dirname3 = import.meta.url ? path10.dirname(fileURLToPath4(import.meta.url)) : "";
|
|
92064
92211
|
localXdgOpenPath = path10.join(__dirname3, "xdg-open");
|
|
92065
|
-
({ platform, arch } =
|
|
92212
|
+
({ platform, arch } = process10);
|
|
92066
92213
|
apps = {
|
|
92067
92214
|
browser: "browser",
|
|
92068
92215
|
browserPrivate: "browserPrivate"
|
|
@@ -93295,6 +93442,7 @@ async function loadConfig(configPath) {
|
|
|
93295
93442
|
}
|
|
93296
93443
|
function generateConfigTemplate(options) {
|
|
93297
93444
|
const config = {
|
|
93445
|
+
$schema: "https://tangled.org/stevedylan.dev/sequoia/raw/main/sequoia.schema.json",
|
|
93298
93446
|
siteUrl: options.siteUrl,
|
|
93299
93447
|
contentDir: options.contentDir
|
|
93300
93448
|
};
|
|
@@ -93332,6 +93480,9 @@ function generateConfigTemplate(options) {
|
|
|
93332
93480
|
if (options.textContentField) {
|
|
93333
93481
|
config.textContentField = options.textContentField;
|
|
93334
93482
|
}
|
|
93483
|
+
if (options.publishContent) {
|
|
93484
|
+
config.publishContent = options.publishContent;
|
|
93485
|
+
}
|
|
93335
93486
|
if (options.bluesky) {
|
|
93336
93487
|
config.bluesky = options.bluesky;
|
|
93337
93488
|
}
|
|
@@ -97935,7 +98086,7 @@ class PathScurryBase {
|
|
|
97935
98086
|
const dirs = new Set;
|
|
97936
98087
|
const queue = [entry];
|
|
97937
98088
|
let processing = 0;
|
|
97938
|
-
const
|
|
98089
|
+
const process4 = () => {
|
|
97939
98090
|
let paused = false;
|
|
97940
98091
|
while (!paused) {
|
|
97941
98092
|
const dir = queue.shift();
|
|
@@ -97976,9 +98127,9 @@ class PathScurryBase {
|
|
|
97976
98127
|
}
|
|
97977
98128
|
}
|
|
97978
98129
|
if (paused && !results.flowing) {
|
|
97979
|
-
results.once("drain",
|
|
98130
|
+
results.once("drain", process4);
|
|
97980
98131
|
} else if (!sync) {
|
|
97981
|
-
|
|
98132
|
+
process4();
|
|
97982
98133
|
}
|
|
97983
98134
|
};
|
|
97984
98135
|
let sync = true;
|
|
@@ -97986,7 +98137,7 @@ class PathScurryBase {
|
|
|
97986
98137
|
sync = false;
|
|
97987
98138
|
}
|
|
97988
98139
|
};
|
|
97989
|
-
|
|
98140
|
+
process4();
|
|
97990
98141
|
return results;
|
|
97991
98142
|
}
|
|
97992
98143
|
streamSync(entry = this.cwd, opts = {}) {
|
|
@@ -98004,7 +98155,7 @@ class PathScurryBase {
|
|
|
98004
98155
|
}
|
|
98005
98156
|
const queue = [entry];
|
|
98006
98157
|
let processing = 0;
|
|
98007
|
-
const
|
|
98158
|
+
const process4 = () => {
|
|
98008
98159
|
let paused = false;
|
|
98009
98160
|
while (!paused) {
|
|
98010
98161
|
const dir = queue.shift();
|
|
@@ -98038,9 +98189,9 @@ class PathScurryBase {
|
|
|
98038
98189
|
}
|
|
98039
98190
|
}
|
|
98040
98191
|
if (paused && !results.flowing)
|
|
98041
|
-
results.once("drain",
|
|
98192
|
+
results.once("drain", process4);
|
|
98042
98193
|
};
|
|
98043
|
-
|
|
98194
|
+
process4();
|
|
98044
98195
|
return results;
|
|
98045
98196
|
}
|
|
98046
98197
|
chdir(path4 = this.cwd) {
|
|
@@ -102745,6 +102896,20 @@ function parseFrontmatter(content, mapping) {
|
|
|
102745
102896
|
}
|
|
102746
102897
|
}
|
|
102747
102898
|
}
|
|
102899
|
+
const updatedAtField = mapping?.updatedAt;
|
|
102900
|
+
if (updatedAtField && raw[updatedAtField]) {
|
|
102901
|
+
frontmatter.updatedAt = raw[updatedAtField];
|
|
102902
|
+
} else if (raw.updatedAt) {
|
|
102903
|
+
frontmatter.updatedAt = raw.updatedAt;
|
|
102904
|
+
} else {
|
|
102905
|
+
const updatedAtFields = ["updated_at", "modifiedAt", "modified_at"];
|
|
102906
|
+
for (const field of updatedAtFields) {
|
|
102907
|
+
if (raw[field]) {
|
|
102908
|
+
frontmatter.updatedAt = raw[field];
|
|
102909
|
+
break;
|
|
102910
|
+
}
|
|
102911
|
+
}
|
|
102912
|
+
}
|
|
102748
102913
|
const coverField = mapping?.coverImage || "ogImage";
|
|
102749
102914
|
frontmatter.ogImage = raw[coverField] || raw.ogImage;
|
|
102750
102915
|
const tagsField = mapping?.tags || "tags";
|
|
@@ -102916,9 +103081,9 @@ var import_oauth_client_node = __toESM(require_dist24(), 1);
|
|
|
102916
103081
|
|
|
102917
103082
|
// src/lib/oauth-store.ts
|
|
102918
103083
|
import * as fs4 from "node:fs/promises";
|
|
102919
|
-
import * as
|
|
103084
|
+
import * as os3 from "node:os";
|
|
102920
103085
|
import * as path5 from "node:path";
|
|
102921
|
-
var CONFIG_DIR = path5.join(
|
|
103086
|
+
var CONFIG_DIR = path5.join(os3.homedir(), ".config", "sequoia");
|
|
102922
103087
|
var OAUTH_FILE = path5.join(CONFIG_DIR, "oauth.json");
|
|
102923
103088
|
async function fileExists2(filePath) {
|
|
102924
103089
|
try {
|
|
@@ -103087,7 +103252,7 @@ function isDocumentRecord(value) {
|
|
|
103087
103252
|
if (!value || typeof value !== "object")
|
|
103088
103253
|
return false;
|
|
103089
103254
|
const v = value;
|
|
103090
|
-
return v.$type === "site.standard.document" && typeof v.title === "string" && typeof v.site === "string" && typeof v.path === "string" && typeof v.textContent === "string" && typeof v.publishedAt === "string";
|
|
103255
|
+
return v.$type === "site.standard.document" && typeof v.title === "string" && typeof v.site === "string" && typeof v.path === "string" && typeof v.textContent === "string" && typeof v.publishedAt === "string" && (v.updatedAt === undefined || typeof v.updatedAt === "string");
|
|
103091
103256
|
}
|
|
103092
103257
|
async function fileExists3(filePath) {
|
|
103093
103258
|
try {
|
|
@@ -103219,10 +103384,14 @@ async function resolveImagePath(ogImage, imagesDir, contentDir) {
|
|
|
103219
103384
|
async function createDocument(agent, post, config, coverImage) {
|
|
103220
103385
|
const postPath = resolvePostPath(post, config.pathPrefix, config.pathTemplate);
|
|
103221
103386
|
const publishDate = new Date(post.frontmatter.publishDate);
|
|
103222
|
-
let
|
|
103223
|
-
if (
|
|
103387
|
+
let updatedAt;
|
|
103388
|
+
if (post.frontmatter.updatedAt) {
|
|
103389
|
+
updatedAt = new Date(post.frontmatter.updatedAt);
|
|
103390
|
+
}
|
|
103391
|
+
let textContent = null;
|
|
103392
|
+
if (config.publishContent && config.textContentField && post.rawFrontmatter?.[config.textContentField]) {
|
|
103224
103393
|
textContent = String(post.rawFrontmatter[config.textContentField]);
|
|
103225
|
-
} else {
|
|
103394
|
+
} else if (config.publishContent) {
|
|
103226
103395
|
textContent = stripMarkdownForText(post.content);
|
|
103227
103396
|
}
|
|
103228
103397
|
const record = {
|
|
@@ -103230,10 +103399,13 @@ async function createDocument(agent, post, config, coverImage) {
|
|
|
103230
103399
|
title: post.frontmatter.title,
|
|
103231
103400
|
site: config.publicationUri,
|
|
103232
103401
|
path: postPath,
|
|
103233
|
-
textContent: textContent
|
|
103402
|
+
textContent: textContent?.slice(0, 1e4),
|
|
103234
103403
|
publishedAt: publishDate.toISOString(),
|
|
103235
103404
|
canonicalUrl: `${config.siteUrl}${postPath}`
|
|
103236
103405
|
};
|
|
103406
|
+
if (updatedAt) {
|
|
103407
|
+
record.updatedAt = updatedAt.toISOString();
|
|
103408
|
+
}
|
|
103237
103409
|
if (post.frontmatter.description) {
|
|
103238
103410
|
record.description = post.frontmatter.description;
|
|
103239
103411
|
}
|
|
@@ -103258,10 +103430,11 @@ async function updateDocument(agent, post, atUri, config, coverImage) {
|
|
|
103258
103430
|
const [, , collection, rkey] = uriMatch;
|
|
103259
103431
|
const postPath = resolvePostPath(post, config.pathPrefix, config.pathTemplate);
|
|
103260
103432
|
const publishDate = new Date(post.frontmatter.publishDate);
|
|
103261
|
-
|
|
103262
|
-
|
|
103433
|
+
const updatedAt = post.frontmatter.updatedAt ? new Date(post.frontmatter.updatedAt) : undefined;
|
|
103434
|
+
let textContent = null;
|
|
103435
|
+
if (config.publishContent && config.textContentField && post.rawFrontmatter?.[config.textContentField]) {
|
|
103263
103436
|
textContent = String(post.rawFrontmatter[config.textContentField]);
|
|
103264
|
-
} else {
|
|
103437
|
+
} else if (config.publishContent) {
|
|
103265
103438
|
textContent = stripMarkdownForText(post.content);
|
|
103266
103439
|
}
|
|
103267
103440
|
const existingResponse = await agent.com.atproto.repo.getRecord({
|
|
@@ -103276,10 +103449,13 @@ async function updateDocument(agent, post, atUri, config, coverImage) {
|
|
|
103276
103449
|
title: post.frontmatter.title,
|
|
103277
103450
|
site: config.publicationUri,
|
|
103278
103451
|
path: postPath,
|
|
103279
|
-
textContent: textContent
|
|
103452
|
+
textContent: textContent?.slice(0, 1e4),
|
|
103280
103453
|
publishedAt: publishDate.toISOString(),
|
|
103281
103454
|
canonicalUrl: `${config.siteUrl}${postPath}`
|
|
103282
103455
|
};
|
|
103456
|
+
if (updatedAt) {
|
|
103457
|
+
record.updatedAt = updatedAt.toISOString();
|
|
103458
|
+
}
|
|
103283
103459
|
if (post.frontmatter.description) {
|
|
103284
103460
|
record.description = post.frontmatter.description;
|
|
103285
103461
|
}
|
|
@@ -103531,9 +103707,9 @@ async function addBskyPostRefToDocument(agent, documentAtUri, bskyPostRef) {
|
|
|
103531
103707
|
|
|
103532
103708
|
// src/lib/credentials.ts
|
|
103533
103709
|
import * as fs6 from "node:fs/promises";
|
|
103534
|
-
import * as
|
|
103710
|
+
import * as os4 from "node:os";
|
|
103535
103711
|
import * as path7 from "node:path";
|
|
103536
|
-
var CONFIG_DIR2 = path7.join(
|
|
103712
|
+
var CONFIG_DIR2 = path7.join(os4.homedir(), ".config", "sequoia");
|
|
103537
103713
|
var CREDENTIALS_FILE = path7.join(CONFIG_DIR2, "credentials.json");
|
|
103538
103714
|
async function fileExists4(filePath) {
|
|
103539
103715
|
try {
|
|
@@ -103943,6 +104119,10 @@ var initCommand = import_cmd_ts3.command({
|
|
|
103943
104119
|
pathPrefix: () => Qt({
|
|
103944
104120
|
message: "URL path prefix for posts:",
|
|
103945
104121
|
placeholder: "/posts, /blog, /articles, etc."
|
|
104122
|
+
}),
|
|
104123
|
+
publishContent: () => Mt2({
|
|
104124
|
+
message: "Publish the post content on the standard.site document?",
|
|
104125
|
+
initialValue: true
|
|
103946
104126
|
})
|
|
103947
104127
|
}, { onCancel });
|
|
103948
104128
|
R2.info("Configure your frontmatter field mappings (press Enter to use defaults):");
|
|
@@ -104126,7 +104306,8 @@ var initCommand = import_cmd_ts3.command({
|
|
|
104126
104306
|
publicationUri,
|
|
104127
104307
|
pdsUrl,
|
|
104128
104308
|
frontmatter: frontmatterMapping,
|
|
104129
|
-
bluesky: blueskyConfig
|
|
104309
|
+
bluesky: blueskyConfig,
|
|
104310
|
+
publishContent: siteConfig.publishContent
|
|
104130
104311
|
});
|
|
104131
104312
|
const configPath = path8.join(process.cwd(), "sequoia.json");
|
|
104132
104313
|
await fs7.writeFile(configPath, configContent);
|
|
@@ -104510,8 +104691,131 @@ function waitForCallback() {
|
|
|
104510
104691
|
|
|
104511
104692
|
// src/commands/publish.ts
|
|
104512
104693
|
var import_cmd_ts6 = __toESM(require_cjs(), 1);
|
|
104694
|
+
import * as fs15 from "node:fs/promises";
|
|
104695
|
+
import * as path12 from "node:path";
|
|
104696
|
+
|
|
104697
|
+
// src/lib/sync.ts
|
|
104513
104698
|
import * as fs14 from "node:fs/promises";
|
|
104514
104699
|
import * as path11 from "node:path";
|
|
104700
|
+
async function syncStateFromPDS(agent, config, configDir, options = {}) {
|
|
104701
|
+
const { updateFrontmatter = false, dryRun = false, quiet = false } = options;
|
|
104702
|
+
const documents = await listDocuments(agent, config.publicationUri);
|
|
104703
|
+
if (documents.length === 0) {
|
|
104704
|
+
if (!quiet) {
|
|
104705
|
+
R2.info("No documents found for this publication.");
|
|
104706
|
+
}
|
|
104707
|
+
return {
|
|
104708
|
+
state: await loadState(configDir),
|
|
104709
|
+
matchedCount: 0,
|
|
104710
|
+
unmatchedCount: 0,
|
|
104711
|
+
frontmatterUpdatesApplied: 0
|
|
104712
|
+
};
|
|
104713
|
+
}
|
|
104714
|
+
const contentDir = path11.isAbsolute(config.contentDir) ? config.contentDir : path11.join(configDir, config.contentDir);
|
|
104715
|
+
const localPosts = await scanContentDirectory(contentDir, {
|
|
104716
|
+
frontmatterMapping: config.frontmatter,
|
|
104717
|
+
ignorePatterns: config.ignore,
|
|
104718
|
+
slugField: config.frontmatter?.slugField,
|
|
104719
|
+
removeIndexFromSlug: config.removeIndexFromSlug,
|
|
104720
|
+
stripDatePrefix: config.stripDatePrefix
|
|
104721
|
+
});
|
|
104722
|
+
const postsByPath = new Map;
|
|
104723
|
+
for (const post of localPosts) {
|
|
104724
|
+
const postPath = resolvePostPath(post, config.pathPrefix, config.pathTemplate);
|
|
104725
|
+
postsByPath.set(postPath, post);
|
|
104726
|
+
}
|
|
104727
|
+
const state = await loadState(configDir);
|
|
104728
|
+
let matchedCount = 0;
|
|
104729
|
+
let unmatchedCount = 0;
|
|
104730
|
+
let frontmatterUpdatesApplied = 0;
|
|
104731
|
+
const frontmatterUpdates = [];
|
|
104732
|
+
if (!quiet) {
|
|
104733
|
+
R2.message(`
|
|
104734
|
+
Matching documents to local files:
|
|
104735
|
+
`);
|
|
104736
|
+
}
|
|
104737
|
+
for (const doc of documents) {
|
|
104738
|
+
const docPath = doc.value.path;
|
|
104739
|
+
const localPost = postsByPath.get(docPath);
|
|
104740
|
+
if (localPost) {
|
|
104741
|
+
matchedCount++;
|
|
104742
|
+
const relativeFilePath = path11.relative(configDir, localPost.filePath);
|
|
104743
|
+
if (!quiet) {
|
|
104744
|
+
R2.message(` ✓ ${doc.value.title}`);
|
|
104745
|
+
R2.message(` Path: ${docPath}`);
|
|
104746
|
+
R2.message(` URI: ${doc.uri}`);
|
|
104747
|
+
R2.message(` File: ${path11.basename(localPost.filePath)}`);
|
|
104748
|
+
}
|
|
104749
|
+
const needsFrontmatterUpdate = updateFrontmatter && localPost.frontmatter.atUri !== doc.uri;
|
|
104750
|
+
if (needsFrontmatterUpdate) {
|
|
104751
|
+
frontmatterUpdates.push({
|
|
104752
|
+
filePath: localPost.filePath,
|
|
104753
|
+
atUri: doc.uri,
|
|
104754
|
+
relativeFilePath
|
|
104755
|
+
});
|
|
104756
|
+
if (!quiet) {
|
|
104757
|
+
R2.message(` → Will update frontmatter`);
|
|
104758
|
+
}
|
|
104759
|
+
}
|
|
104760
|
+
let contentHash;
|
|
104761
|
+
if (needsFrontmatterUpdate) {
|
|
104762
|
+
const updatedContent = updateFrontmatterWithAtUri(localPost.rawContent, doc.uri);
|
|
104763
|
+
contentHash = await getContentHash(updatedContent);
|
|
104764
|
+
} else {
|
|
104765
|
+
contentHash = await getContentHash(localPost.rawContent);
|
|
104766
|
+
}
|
|
104767
|
+
state.posts[relativeFilePath] = {
|
|
104768
|
+
contentHash,
|
|
104769
|
+
atUri: doc.uri,
|
|
104770
|
+
lastPublished: doc.value.publishedAt
|
|
104771
|
+
};
|
|
104772
|
+
} else {
|
|
104773
|
+
unmatchedCount++;
|
|
104774
|
+
if (!quiet) {
|
|
104775
|
+
R2.message(` ✗ ${doc.value.title} (no matching local file)`);
|
|
104776
|
+
R2.message(` Path: ${docPath}`);
|
|
104777
|
+
R2.message(` URI: ${doc.uri}`);
|
|
104778
|
+
}
|
|
104779
|
+
}
|
|
104780
|
+
if (!quiet) {
|
|
104781
|
+
R2.message("");
|
|
104782
|
+
}
|
|
104783
|
+
}
|
|
104784
|
+
if (!quiet) {
|
|
104785
|
+
R2.message("---");
|
|
104786
|
+
R2.info(`Matched: ${matchedCount} documents`);
|
|
104787
|
+
if (unmatchedCount > 0) {
|
|
104788
|
+
R2.warn(`Unmatched: ${unmatchedCount} documents (exist on PDS but not locally)`);
|
|
104789
|
+
}
|
|
104790
|
+
}
|
|
104791
|
+
if (dryRun) {
|
|
104792
|
+
if (!quiet) {
|
|
104793
|
+
R2.info(`
|
|
104794
|
+
Dry run complete. No changes made.`);
|
|
104795
|
+
}
|
|
104796
|
+
return {
|
|
104797
|
+
state,
|
|
104798
|
+
matchedCount,
|
|
104799
|
+
unmatchedCount,
|
|
104800
|
+
frontmatterUpdatesApplied: 0
|
|
104801
|
+
};
|
|
104802
|
+
}
|
|
104803
|
+
await saveState(configDir, state);
|
|
104804
|
+
if (frontmatterUpdates.length > 0) {
|
|
104805
|
+
for (const { filePath, atUri } of frontmatterUpdates) {
|
|
104806
|
+
const content = await fs14.readFile(filePath, "utf-8");
|
|
104807
|
+
const updated = updateFrontmatterWithAtUri(content, atUri);
|
|
104808
|
+
await fs14.writeFile(filePath, updated);
|
|
104809
|
+
if (!quiet) {
|
|
104810
|
+
R2.message(` Updated: ${path11.basename(filePath)}`);
|
|
104811
|
+
}
|
|
104812
|
+
}
|
|
104813
|
+
frontmatterUpdatesApplied = frontmatterUpdates.length;
|
|
104814
|
+
}
|
|
104815
|
+
return { state, matchedCount, unmatchedCount, frontmatterUpdatesApplied };
|
|
104816
|
+
}
|
|
104817
|
+
|
|
104818
|
+
// src/commands/publish.ts
|
|
104515
104819
|
var publishCommand = import_cmd_ts6.command({
|
|
104516
104820
|
name: "publish",
|
|
104517
104821
|
description: "Publish content to ATProto",
|
|
@@ -104539,7 +104843,7 @@ var publishCommand = import_cmd_ts6.command({
|
|
|
104539
104843
|
process.exit(1);
|
|
104540
104844
|
}
|
|
104541
104845
|
const config = await loadConfig(configPath);
|
|
104542
|
-
const configDir =
|
|
104846
|
+
const configDir = path12.dirname(configPath);
|
|
104543
104847
|
R2.info(`Site: ${config.siteUrl}`);
|
|
104544
104848
|
R2.info(`Content directory: ${config.contentDir}`);
|
|
104545
104849
|
let credentials = await loadCredentials(config.identity);
|
|
@@ -104589,10 +104893,36 @@ var publishCommand = import_cmd_ts6.command({
|
|
|
104589
104893
|
const displayId = credentials.type === "oauth" ? credentials.handle || credentials.did : credentials.identifier;
|
|
104590
104894
|
R2.info(`Tip: Add "identity": "${displayId}" to sequoia.json to use this by default.`);
|
|
104591
104895
|
}
|
|
104592
|
-
const contentDir =
|
|
104593
|
-
const imagesDir = config.imagesDir ?
|
|
104594
|
-
|
|
104896
|
+
const contentDir = path12.isAbsolute(config.contentDir) ? config.contentDir : path12.join(configDir, config.contentDir);
|
|
104897
|
+
const imagesDir = config.imagesDir ? path12.isAbsolute(config.imagesDir) ? config.imagesDir : path12.join(configDir, config.imagesDir) : undefined;
|
|
104898
|
+
let state = await loadState(configDir);
|
|
104595
104899
|
const s = Ie();
|
|
104900
|
+
let agent;
|
|
104901
|
+
if (config.autoSync !== false && Object.keys(state.posts).length === 0 && !dryRun) {
|
|
104902
|
+
const connectingTo = credentials.type === "oauth" ? credentials.handle : credentials.pdsUrl;
|
|
104903
|
+
s.start(`Connecting as ${connectingTo}...`);
|
|
104904
|
+
try {
|
|
104905
|
+
agent = await createAgent(credentials);
|
|
104906
|
+
s.stop(`Logged in as ${agent.did}`);
|
|
104907
|
+
} catch (error) {
|
|
104908
|
+
s.stop("Failed to login");
|
|
104909
|
+
R2.error(`Failed to login: ${error}`);
|
|
104910
|
+
process.exit(1);
|
|
104911
|
+
}
|
|
104912
|
+
try {
|
|
104913
|
+
s.start("Auto-syncing state from PDS...");
|
|
104914
|
+
const syncResult = await syncStateFromPDS(agent, config, configDir, {
|
|
104915
|
+
updateFrontmatter: true,
|
|
104916
|
+
quiet: true
|
|
104917
|
+
});
|
|
104918
|
+
s.stop(`Auto-synced ${syncResult.matchedCount} posts from PDS`);
|
|
104919
|
+
state = syncResult.state;
|
|
104920
|
+
} catch (error) {
|
|
104921
|
+
s.stop("Auto-sync failed");
|
|
104922
|
+
R2.warn(`Auto-sync failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
104923
|
+
R2.warn("Continuing with empty state. Run 'sequoia sync' manually to fix.");
|
|
104924
|
+
}
|
|
104925
|
+
}
|
|
104596
104926
|
s.start("Scanning for posts...");
|
|
104597
104927
|
const posts = await scanContentDirectory(contentDir, {
|
|
104598
104928
|
frontmatterMapping: config.frontmatter,
|
|
@@ -104610,7 +104940,7 @@ var publishCommand = import_cmd_ts6.command({
|
|
|
104610
104940
|
continue;
|
|
104611
104941
|
}
|
|
104612
104942
|
const contentHash = await getContentHash(post.rawContent);
|
|
104613
|
-
const relativeFilePath =
|
|
104943
|
+
const relativeFilePath = path12.relative(configDir, post.filePath);
|
|
104614
104944
|
const postState = state.posts[relativeFilePath];
|
|
104615
104945
|
if (force) {
|
|
104616
104946
|
postsToPublish.push({
|
|
@@ -104648,7 +104978,7 @@ ${postsToPublish.length} posts to publish:
|
|
|
104648
104978
|
cutoffDate.setDate(cutoffDate.getDate() - maxAgeDays);
|
|
104649
104979
|
for (const { post, action, reason } of postsToPublish) {
|
|
104650
104980
|
const icon = action === "create" ? "+" : "~";
|
|
104651
|
-
const relativeFilePath =
|
|
104981
|
+
const relativeFilePath = path12.relative(configDir, post.filePath);
|
|
104652
104982
|
const existingBskyPostRef = state.posts[relativeFilePath]?.bskyPostRef;
|
|
104653
104983
|
let bskyNote = "";
|
|
104654
104984
|
if (blueskyEnabled) {
|
|
@@ -104680,16 +105010,17 @@ Bluesky posting: enabled (max age: ${maxAgeDays} days)`);
|
|
|
104680
105010
|
Dry run complete. No changes made.`);
|
|
104681
105011
|
return;
|
|
104682
105012
|
}
|
|
104683
|
-
|
|
104684
|
-
|
|
104685
|
-
|
|
104686
|
-
|
|
104687
|
-
|
|
104688
|
-
|
|
104689
|
-
|
|
104690
|
-
|
|
104691
|
-
|
|
104692
|
-
|
|
105013
|
+
if (!agent) {
|
|
105014
|
+
const connectingTo = credentials.type === "oauth" ? credentials.handle : credentials.pdsUrl;
|
|
105015
|
+
s.start(`Connecting as ${connectingTo}...`);
|
|
105016
|
+
try {
|
|
105017
|
+
agent = await createAgent(credentials);
|
|
105018
|
+
s.stop(`Logged in as ${agent.did}`);
|
|
105019
|
+
} catch (error) {
|
|
105020
|
+
s.stop("Failed to login");
|
|
105021
|
+
R2.error(`Failed to login: ${error}`);
|
|
105022
|
+
process.exit(1);
|
|
105023
|
+
}
|
|
104693
105024
|
}
|
|
104694
105025
|
let publishedCount = 0;
|
|
104695
105026
|
let updatedCount = 0;
|
|
@@ -104702,7 +105033,7 @@ Dry run complete. No changes made.`);
|
|
|
104702
105033
|
if (post.frontmatter.ogImage) {
|
|
104703
105034
|
const imagePath = await resolveImagePath(post.frontmatter.ogImage, imagesDir, contentDir);
|
|
104704
105035
|
if (imagePath) {
|
|
104705
|
-
R2.info(` Uploading cover image: ${
|
|
105036
|
+
R2.info(` Uploading cover image: ${path12.basename(imagePath)}`);
|
|
104706
105037
|
coverImage = await uploadImage(agent, imagePath);
|
|
104707
105038
|
if (coverImage) {
|
|
104708
105039
|
R2.info(` Uploaded image blob: ${coverImage.ref.$link}`);
|
|
@@ -104714,14 +105045,14 @@ Dry run complete. No changes made.`);
|
|
|
104714
105045
|
let atUri;
|
|
104715
105046
|
let contentForHash;
|
|
104716
105047
|
let bskyPostRef;
|
|
104717
|
-
const relativeFilePath =
|
|
105048
|
+
const relativeFilePath = path12.relative(configDir, post.filePath);
|
|
104718
105049
|
const existingBskyPostRef = state.posts[relativeFilePath]?.bskyPostRef;
|
|
104719
105050
|
if (action === "create") {
|
|
104720
105051
|
atUri = await createDocument(agent, post, config, coverImage);
|
|
104721
105052
|
s.stop(`Created: ${atUri}`);
|
|
104722
105053
|
const updatedContent = updateFrontmatterWithAtUri(post.rawContent, atUri);
|
|
104723
|
-
await
|
|
104724
|
-
R2.info(` Updated frontmatter in ${
|
|
105054
|
+
await fs15.writeFile(post.filePath, updatedContent);
|
|
105055
|
+
R2.info(` Updated frontmatter in ${path12.basename(post.filePath)}`);
|
|
104725
105056
|
contentForHash = updatedContent;
|
|
104726
105057
|
publishedCount++;
|
|
104727
105058
|
} else {
|
|
@@ -104770,7 +105101,7 @@ Dry run complete. No changes made.`);
|
|
|
104770
105101
|
};
|
|
104771
105102
|
} catch (error) {
|
|
104772
105103
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
104773
|
-
s.stop(`Error publishing "${
|
|
105104
|
+
s.stop(`Error publishing "${path12.basename(post.filePath)}"`);
|
|
104774
105105
|
R2.error(` ${errorMessage}`);
|
|
104775
105106
|
errorCount++;
|
|
104776
105107
|
}
|
|
@@ -104791,8 +105122,7 @@ Dry run complete. No changes made.`);
|
|
|
104791
105122
|
|
|
104792
105123
|
// src/commands/sync.ts
|
|
104793
105124
|
var import_cmd_ts7 = __toESM(require_cjs(), 1);
|
|
104794
|
-
import * as
|
|
104795
|
-
import * as path12 from "node:path";
|
|
105125
|
+
import * as path13 from "node:path";
|
|
104796
105126
|
var syncCommand = import_cmd_ts7.command({
|
|
104797
105127
|
name: "sync",
|
|
104798
105128
|
description: "Sync state from ATProto to restore .sequoia-state.json",
|
|
@@ -104815,7 +105145,7 @@ var syncCommand = import_cmd_ts7.command({
|
|
|
104815
105145
|
process.exit(1);
|
|
104816
105146
|
}
|
|
104817
105147
|
const config = await loadConfig(configPath);
|
|
104818
|
-
const configDir =
|
|
105148
|
+
const configDir = path13.dirname(configPath);
|
|
104819
105149
|
R2.info(`Site: ${config.siteUrl}`);
|
|
104820
105150
|
R2.info(`Publication: ${config.publicationUri}`);
|
|
104821
105151
|
let credentials = await loadCredentials(config.identity);
|
|
@@ -104875,89 +105205,19 @@ var syncCommand = import_cmd_ts7.command({
|
|
|
104875
105205
|
process.exit(1);
|
|
104876
105206
|
}
|
|
104877
105207
|
s.start("Fetching documents from PDS...");
|
|
104878
|
-
const
|
|
104879
|
-
|
|
104880
|
-
|
|
104881
|
-
|
|
104882
|
-
return;
|
|
104883
|
-
}
|
|
104884
|
-
const contentDir = path12.isAbsolute(config.contentDir) ? config.contentDir : path12.join(configDir, config.contentDir);
|
|
104885
|
-
s.start("Scanning local content...");
|
|
104886
|
-
const localPosts = await scanContentDirectory(contentDir, {
|
|
104887
|
-
frontmatterMapping: config.frontmatter,
|
|
104888
|
-
ignorePatterns: config.ignore,
|
|
104889
|
-
slugField: config.frontmatter?.slugField,
|
|
104890
|
-
removeIndexFromSlug: config.removeIndexFromSlug,
|
|
104891
|
-
stripDatePrefix: config.stripDatePrefix
|
|
105208
|
+
const result = await syncStateFromPDS(agent, config, configDir, {
|
|
105209
|
+
updateFrontmatter,
|
|
105210
|
+
dryRun,
|
|
105211
|
+
quiet: false
|
|
104892
105212
|
});
|
|
104893
|
-
s.stop(`Found
|
|
104894
|
-
|
|
104895
|
-
|
|
104896
|
-
|
|
104897
|
-
|
|
104898
|
-
|
|
104899
|
-
|
|
104900
|
-
const originalPostCount = Object.keys(state.posts).length;
|
|
104901
|
-
let matchedCount = 0;
|
|
104902
|
-
let unmatchedCount = 0;
|
|
104903
|
-
const frontmatterUpdates = [];
|
|
104904
|
-
R2.message(`
|
|
104905
|
-
Matching documents to local files:
|
|
104906
|
-
`);
|
|
104907
|
-
for (const doc of documents) {
|
|
104908
|
-
const docPath = doc.value.path;
|
|
104909
|
-
const localPost = postsByPath.get(docPath);
|
|
104910
|
-
if (localPost) {
|
|
104911
|
-
matchedCount++;
|
|
104912
|
-
R2.message(` ✓ ${doc.value.title}`);
|
|
104913
|
-
R2.message(` Path: ${docPath}`);
|
|
104914
|
-
R2.message(` URI: ${doc.uri}`);
|
|
104915
|
-
R2.message(` File: ${path12.basename(localPost.filePath)}`);
|
|
104916
|
-
const contentHash = await getContentHash(localPost.rawContent);
|
|
104917
|
-
const relativeFilePath = path12.relative(configDir, localPost.filePath);
|
|
104918
|
-
state.posts[relativeFilePath] = {
|
|
104919
|
-
contentHash,
|
|
104920
|
-
atUri: doc.uri,
|
|
104921
|
-
lastPublished: doc.value.publishedAt
|
|
104922
|
-
};
|
|
104923
|
-
if (updateFrontmatter && localPost.frontmatter.atUri !== doc.uri) {
|
|
104924
|
-
frontmatterUpdates.push({
|
|
104925
|
-
filePath: localPost.filePath,
|
|
104926
|
-
atUri: doc.uri
|
|
104927
|
-
});
|
|
104928
|
-
R2.message(` → Will update frontmatter`);
|
|
104929
|
-
}
|
|
104930
|
-
} else {
|
|
104931
|
-
unmatchedCount++;
|
|
104932
|
-
R2.message(` ✗ ${doc.value.title} (no matching local file)`);
|
|
104933
|
-
R2.message(` Path: ${docPath}`);
|
|
104934
|
-
R2.message(` URI: ${doc.uri}`);
|
|
105213
|
+
s.stop(`Found documents on PDS`);
|
|
105214
|
+
if (!dryRun) {
|
|
105215
|
+
const stateCount = Object.keys(result.state.posts).length;
|
|
105216
|
+
R2.success(`
|
|
105217
|
+
Saved .sequoia-state.json (${stateCount} entries)`);
|
|
105218
|
+
if (result.frontmatterUpdatesApplied > 0) {
|
|
105219
|
+
R2.success(`Updated frontmatter in ${result.frontmatterUpdatesApplied} files`);
|
|
104935
105220
|
}
|
|
104936
|
-
R2.message("");
|
|
104937
|
-
}
|
|
104938
|
-
R2.message("---");
|
|
104939
|
-
R2.info(`Matched: ${matchedCount} documents`);
|
|
104940
|
-
if (unmatchedCount > 0) {
|
|
104941
|
-
R2.warn(`Unmatched: ${unmatchedCount} documents (exist on PDS but not locally)`);
|
|
104942
|
-
}
|
|
104943
|
-
if (dryRun) {
|
|
104944
|
-
R2.info(`
|
|
104945
|
-
Dry run complete. No changes made.`);
|
|
104946
|
-
return;
|
|
104947
|
-
}
|
|
104948
|
-
await saveState(configDir, state);
|
|
104949
|
-
const newPostCount = Object.keys(state.posts).length;
|
|
104950
|
-
R2.success(`
|
|
104951
|
-
Saved .sequoia-state.json (${originalPostCount} → ${newPostCount} entries)`);
|
|
104952
|
-
if (frontmatterUpdates.length > 0) {
|
|
104953
|
-
s.start(`Updating frontmatter in ${frontmatterUpdates.length} files...`);
|
|
104954
|
-
for (const { filePath, atUri } of frontmatterUpdates) {
|
|
104955
|
-
const content = await fs15.readFile(filePath, "utf-8");
|
|
104956
|
-
const updated = updateFrontmatterWithAtUri(content, atUri);
|
|
104957
|
-
await fs15.writeFile(filePath, updated);
|
|
104958
|
-
R2.message(` Updated: ${path12.basename(filePath)}`);
|
|
104959
|
-
}
|
|
104960
|
-
s.stop("Frontmatter updated");
|
|
104961
105221
|
}
|
|
104962
105222
|
R2.success(`
|
|
104963
105223
|
Sync complete!`);
|
|
@@ -105074,6 +105334,7 @@ async function updateConfigFlow(config, configPath) {
|
|
|
105074
105334
|
stripDatePrefix: configUpdated.stripDatePrefix,
|
|
105075
105335
|
pathTemplate: configUpdated.pathTemplate,
|
|
105076
105336
|
textContentField: configUpdated.textContentField,
|
|
105337
|
+
publishContent: configUpdated.publishContent,
|
|
105077
105338
|
bluesky: configUpdated.bluesky
|
|
105078
105339
|
});
|
|
105079
105340
|
await fs16.writeFile(configPath, configContent);
|
|
@@ -105210,6 +105471,10 @@ async function editAdvanced(config) {
|
|
|
105210
105471
|
message: "Strip YYYY-MM-DD- prefix from filenames (Jekyll-style)?",
|
|
105211
105472
|
initialValue: config.stripDatePrefix || false
|
|
105212
105473
|
}));
|
|
105474
|
+
const publishContent = exitOnCancel(await Mt2({
|
|
105475
|
+
message: "Publish the post content on the standard.site document?",
|
|
105476
|
+
initialValue: config.publishContent ?? true
|
|
105477
|
+
}));
|
|
105213
105478
|
const textContentField = exitOnCancel(await Qt({
|
|
105214
105479
|
message: "Frontmatter field for textContent (leave empty to use markdown body):",
|
|
105215
105480
|
initialValue: config.textContentField || ""
|
|
@@ -105222,7 +105487,8 @@ async function editAdvanced(config) {
|
|
|
105222
105487
|
ignore: ignore && ignore.length > 0 ? ignore : undefined,
|
|
105223
105488
|
removeIndexFromSlug: removeIndexFromSlug || undefined,
|
|
105224
105489
|
stripDatePrefix: stripDatePrefix || undefined,
|
|
105225
|
-
textContentField: textContentField || undefined
|
|
105490
|
+
textContentField: textContentField || undefined,
|
|
105491
|
+
publishContent: publishContent ?? true
|
|
105226
105492
|
};
|
|
105227
105493
|
}
|
|
105228
105494
|
async function editBluesky(config) {
|
|
@@ -105418,7 +105684,7 @@ Publish evergreen content to the ATmosphere
|
|
|
105418
105684
|
|
|
105419
105685
|
> https://tangled.org/stevedylan.dev/sequoia
|
|
105420
105686
|
`,
|
|
105421
|
-
version: "0.5.
|
|
105687
|
+
version: "0.5.2",
|
|
105422
105688
|
cmds: {
|
|
105423
105689
|
add: addCommand,
|
|
105424
105690
|
auth: authCommand,
|