@claudein.org/cli 0.1.2 → 0.1.16
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/index.js +448 -162
- package/package.json +11 -5
package/dist/index.js
CHANGED
|
@@ -3623,9 +3623,9 @@ var require_createNode = __commonJS((exports) => {
|
|
|
3623
3623
|
if (identity.isNode(value))
|
|
3624
3624
|
return value;
|
|
3625
3625
|
if (identity.isPair(value)) {
|
|
3626
|
-
const
|
|
3627
|
-
|
|
3628
|
-
return
|
|
3626
|
+
const map3 = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);
|
|
3627
|
+
map3.items.push(value);
|
|
3628
|
+
return map3;
|
|
3629
3629
|
}
|
|
3630
3630
|
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
|
|
3631
3631
|
value = value.valueOf();
|
|
@@ -4346,7 +4346,7 @@ var require_stringify = __commonJS((exports) => {
|
|
|
4346
4346
|
}
|
|
4347
4347
|
}
|
|
4348
4348
|
let tagObj = undefined;
|
|
4349
|
-
const node = identity.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (
|
|
4349
|
+
const node = identity.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o2) => tagObj = o2 });
|
|
4350
4350
|
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
|
|
4351
4351
|
const props = stringifyProps(node, tagObj, ctx);
|
|
4352
4352
|
if (props.length > 0)
|
|
@@ -4532,30 +4532,30 @@ var require_merge = __commonJS((exports) => {
|
|
|
4532
4532
|
stringify: () => MERGE_KEY
|
|
4533
4533
|
};
|
|
4534
4534
|
var isMergeKey = (ctx, key) => (merge2.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge2.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge2.tag && tag.default);
|
|
4535
|
-
function addMergeToJSMap(ctx,
|
|
4535
|
+
function addMergeToJSMap(ctx, map3, value) {
|
|
4536
4536
|
const source = resolveAliasValue(ctx, value);
|
|
4537
4537
|
if (identity.isSeq(source))
|
|
4538
4538
|
for (const it of source.items)
|
|
4539
|
-
mergeValue(ctx,
|
|
4539
|
+
mergeValue(ctx, map3, it);
|
|
4540
4540
|
else if (Array.isArray(source))
|
|
4541
4541
|
for (const it of source)
|
|
4542
|
-
mergeValue(ctx,
|
|
4542
|
+
mergeValue(ctx, map3, it);
|
|
4543
4543
|
else
|
|
4544
|
-
mergeValue(ctx,
|
|
4544
|
+
mergeValue(ctx, map3, source);
|
|
4545
4545
|
}
|
|
4546
|
-
function mergeValue(ctx,
|
|
4546
|
+
function mergeValue(ctx, map3, value) {
|
|
4547
4547
|
const source = resolveAliasValue(ctx, value);
|
|
4548
4548
|
if (!identity.isMap(source))
|
|
4549
4549
|
throw new Error("Merge sources must be maps or map aliases");
|
|
4550
4550
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
4551
4551
|
for (const [key, value2] of srcMap) {
|
|
4552
|
-
if (
|
|
4553
|
-
if (!
|
|
4554
|
-
|
|
4555
|
-
} else if (
|
|
4556
|
-
|
|
4557
|
-
} else if (!Object.prototype.hasOwnProperty.call(
|
|
4558
|
-
Object.defineProperty(
|
|
4552
|
+
if (map3 instanceof Map) {
|
|
4553
|
+
if (!map3.has(key))
|
|
4554
|
+
map3.set(key, value2);
|
|
4555
|
+
} else if (map3 instanceof Set) {
|
|
4556
|
+
map3.add(key);
|
|
4557
|
+
} else if (!Object.prototype.hasOwnProperty.call(map3, key)) {
|
|
4558
|
+
Object.defineProperty(map3, key, {
|
|
4559
4559
|
value: value2,
|
|
4560
4560
|
writable: true,
|
|
4561
4561
|
enumerable: true,
|
|
@@ -4563,7 +4563,7 @@ var require_merge = __commonJS((exports) => {
|
|
|
4563
4563
|
});
|
|
4564
4564
|
}
|
|
4565
4565
|
}
|
|
4566
|
-
return
|
|
4566
|
+
return map3;
|
|
4567
4567
|
}
|
|
4568
4568
|
function resolveAliasValue(ctx, value) {
|
|
4569
4569
|
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
@@ -4580,32 +4580,32 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
4580
4580
|
var stringify = require_stringify();
|
|
4581
4581
|
var identity = require_identity();
|
|
4582
4582
|
var toJS = require_toJS();
|
|
4583
|
-
function addPairToJSMap(ctx,
|
|
4583
|
+
function addPairToJSMap(ctx, map3, { key, value }) {
|
|
4584
4584
|
if (identity.isNode(key) && key.addToJSMap)
|
|
4585
|
-
key.addToJSMap(ctx,
|
|
4585
|
+
key.addToJSMap(ctx, map3, value);
|
|
4586
4586
|
else if (merge2.isMergeKey(ctx, key))
|
|
4587
|
-
merge2.addMergeToJSMap(ctx,
|
|
4587
|
+
merge2.addMergeToJSMap(ctx, map3, value);
|
|
4588
4588
|
else {
|
|
4589
4589
|
const jsKey = toJS.toJS(key, "", ctx);
|
|
4590
|
-
if (
|
|
4591
|
-
|
|
4592
|
-
} else if (
|
|
4593
|
-
|
|
4590
|
+
if (map3 instanceof Map) {
|
|
4591
|
+
map3.set(jsKey, toJS.toJS(value, jsKey, ctx));
|
|
4592
|
+
} else if (map3 instanceof Set) {
|
|
4593
|
+
map3.add(jsKey);
|
|
4594
4594
|
} else {
|
|
4595
4595
|
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
4596
4596
|
const jsValue = toJS.toJS(value, stringKey, ctx);
|
|
4597
|
-
if (stringKey in
|
|
4598
|
-
Object.defineProperty(
|
|
4597
|
+
if (stringKey in map3)
|
|
4598
|
+
Object.defineProperty(map3, stringKey, {
|
|
4599
4599
|
value: jsValue,
|
|
4600
4600
|
writable: true,
|
|
4601
4601
|
enumerable: true,
|
|
4602
4602
|
configurable: true
|
|
4603
4603
|
});
|
|
4604
4604
|
else
|
|
4605
|
-
|
|
4605
|
+
map3[stringKey] = jsValue;
|
|
4606
4606
|
}
|
|
4607
4607
|
}
|
|
4608
|
-
return
|
|
4608
|
+
return map3;
|
|
4609
4609
|
}
|
|
4610
4610
|
function stringifyKey(key, jsKey, ctx) {
|
|
4611
4611
|
if (jsKey === null)
|
|
@@ -4855,14 +4855,14 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
4855
4855
|
}
|
|
4856
4856
|
static from(schema, obj, ctx) {
|
|
4857
4857
|
const { keepUndefined, replacer } = ctx;
|
|
4858
|
-
const
|
|
4858
|
+
const map3 = new this(schema);
|
|
4859
4859
|
const add = (key, value) => {
|
|
4860
4860
|
if (typeof replacer === "function")
|
|
4861
4861
|
value = replacer.call(obj, key, value);
|
|
4862
4862
|
else if (Array.isArray(replacer) && !replacer.includes(key))
|
|
4863
4863
|
return;
|
|
4864
4864
|
if (value !== undefined || keepUndefined)
|
|
4865
|
-
|
|
4865
|
+
map3.items.push(Pair.createPair(key, value, ctx));
|
|
4866
4866
|
};
|
|
4867
4867
|
if (obj instanceof Map) {
|
|
4868
4868
|
for (const [key, value] of obj)
|
|
@@ -4872,9 +4872,9 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
4872
4872
|
add(key, obj[key]);
|
|
4873
4873
|
}
|
|
4874
4874
|
if (typeof schema.sortMapEntries === "function") {
|
|
4875
|
-
|
|
4875
|
+
map3.items.sort(schema.sortMapEntries);
|
|
4876
4876
|
}
|
|
4877
|
-
return
|
|
4877
|
+
return map3;
|
|
4878
4878
|
}
|
|
4879
4879
|
add(pair, overwrite) {
|
|
4880
4880
|
let _pair;
|
|
@@ -4922,12 +4922,12 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
4922
4922
|
this.add(new Pair.Pair(key, value), true);
|
|
4923
4923
|
}
|
|
4924
4924
|
toJSON(_, ctx, Type) {
|
|
4925
|
-
const
|
|
4925
|
+
const map3 = Type ? new Type : ctx?.mapAsMap ? new Map : {};
|
|
4926
4926
|
if (ctx?.onCreate)
|
|
4927
|
-
ctx.onCreate(
|
|
4927
|
+
ctx.onCreate(map3);
|
|
4928
4928
|
for (const item of this.items)
|
|
4929
|
-
addPairToJSMap.addPairToJSMap(ctx,
|
|
4930
|
-
return
|
|
4929
|
+
addPairToJSMap.addPairToJSMap(ctx, map3, item);
|
|
4930
|
+
return map3;
|
|
4931
4931
|
}
|
|
4932
4932
|
toString(ctx, onComment, onChompKeep) {
|
|
4933
4933
|
if (!ctx)
|
|
@@ -4955,19 +4955,19 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
4955
4955
|
var require_map = __commonJS((exports) => {
|
|
4956
4956
|
var identity = require_identity();
|
|
4957
4957
|
var YAMLMap = require_YAMLMap();
|
|
4958
|
-
var
|
|
4958
|
+
var map3 = {
|
|
4959
4959
|
collection: "map",
|
|
4960
4960
|
default: true,
|
|
4961
4961
|
nodeClass: YAMLMap.YAMLMap,
|
|
4962
4962
|
tag: "tag:yaml.org,2002:map",
|
|
4963
|
-
resolve(
|
|
4964
|
-
if (!identity.isMap(
|
|
4963
|
+
resolve(map4, onError) {
|
|
4964
|
+
if (!identity.isMap(map4))
|
|
4965
4965
|
onError("Expected a mapping for this tag");
|
|
4966
|
-
return
|
|
4966
|
+
return map4;
|
|
4967
4967
|
},
|
|
4968
4968
|
createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
|
|
4969
4969
|
};
|
|
4970
|
-
exports.map =
|
|
4970
|
+
exports.map = map3;
|
|
4971
4971
|
});
|
|
4972
4972
|
|
|
4973
4973
|
// ../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
@@ -5245,7 +5245,7 @@ var require_int = __commonJS((exports) => {
|
|
|
5245
5245
|
|
|
5246
5246
|
// ../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/core/schema.js
|
|
5247
5247
|
var require_schema = __commonJS((exports) => {
|
|
5248
|
-
var
|
|
5248
|
+
var map3 = require_map();
|
|
5249
5249
|
var _null4 = require_null();
|
|
5250
5250
|
var seq = require_seq();
|
|
5251
5251
|
var string4 = require_string();
|
|
@@ -5253,7 +5253,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
5253
5253
|
var float = require_float();
|
|
5254
5254
|
var int2 = require_int();
|
|
5255
5255
|
var schema = [
|
|
5256
|
-
|
|
5256
|
+
map3.map,
|
|
5257
5257
|
seq.seq,
|
|
5258
5258
|
string4.string,
|
|
5259
5259
|
_null4.nullTag,
|
|
@@ -5271,7 +5271,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
5271
5271
|
// ../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/json/schema.js
|
|
5272
5272
|
var require_schema2 = __commonJS((exports) => {
|
|
5273
5273
|
var Scalar = require_Scalar();
|
|
5274
|
-
var
|
|
5274
|
+
var map3 = require_map();
|
|
5275
5275
|
var seq = require_seq();
|
|
5276
5276
|
function intIdentify(value) {
|
|
5277
5277
|
return typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -5328,7 +5328,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
5328
5328
|
return str;
|
|
5329
5329
|
}
|
|
5330
5330
|
};
|
|
5331
|
-
var schema = [
|
|
5331
|
+
var schema = [map3.map, seq.seq].concat(jsonScalars, jsonError);
|
|
5332
5332
|
exports.schema = schema;
|
|
5333
5333
|
});
|
|
5334
5334
|
|
|
@@ -5375,8 +5375,8 @@ var require_binary = __commonJS((exports) => {
|
|
|
5375
5375
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
5376
5376
|
const n = Math.ceil(str.length / lineWidth);
|
|
5377
5377
|
const lines = new Array(n);
|
|
5378
|
-
for (let i = 0,
|
|
5379
|
-
lines[i] = str.substr(
|
|
5378
|
+
for (let i = 0, o2 = 0;i < n; ++i, o2 += lineWidth) {
|
|
5379
|
+
lines[i] = str.substr(o2, lineWidth);
|
|
5380
5380
|
}
|
|
5381
5381
|
str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? `
|
|
5382
5382
|
` : " ");
|
|
@@ -5483,9 +5483,9 @@ var require_omap = __commonJS((exports) => {
|
|
|
5483
5483
|
toJSON(_, ctx) {
|
|
5484
5484
|
if (!ctx)
|
|
5485
5485
|
return super.toJSON(_);
|
|
5486
|
-
const
|
|
5486
|
+
const map3 = new Map;
|
|
5487
5487
|
if (ctx?.onCreate)
|
|
5488
|
-
ctx.onCreate(
|
|
5488
|
+
ctx.onCreate(map3);
|
|
5489
5489
|
for (const pair of this.items) {
|
|
5490
5490
|
let key, value;
|
|
5491
5491
|
if (identity.isPair(pair)) {
|
|
@@ -5494,11 +5494,11 @@ var require_omap = __commonJS((exports) => {
|
|
|
5494
5494
|
} else {
|
|
5495
5495
|
key = toJS.toJS(pair, "", ctx);
|
|
5496
5496
|
}
|
|
5497
|
-
if (
|
|
5497
|
+
if (map3.has(key))
|
|
5498
5498
|
throw new Error("Ordered maps must not include duplicate keys");
|
|
5499
|
-
|
|
5499
|
+
map3.set(key, value);
|
|
5500
5500
|
}
|
|
5501
|
-
return
|
|
5501
|
+
return map3;
|
|
5502
5502
|
}
|
|
5503
5503
|
static from(schema, iterable, ctx) {
|
|
5504
5504
|
const pairs$1 = pairs.createPairs(schema, iterable, ctx);
|
|
@@ -5753,15 +5753,15 @@ var require_set = __commonJS((exports) => {
|
|
|
5753
5753
|
default: false,
|
|
5754
5754
|
tag: "tag:yaml.org,2002:set",
|
|
5755
5755
|
createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
|
|
5756
|
-
resolve(
|
|
5757
|
-
if (identity.isMap(
|
|
5758
|
-
if (
|
|
5759
|
-
return Object.assign(new YAMLSet,
|
|
5756
|
+
resolve(map3, onError) {
|
|
5757
|
+
if (identity.isMap(map3)) {
|
|
5758
|
+
if (map3.hasAllNullValues(true))
|
|
5759
|
+
return Object.assign(new YAMLSet, map3);
|
|
5760
5760
|
else
|
|
5761
5761
|
onError("Set items must all have null values");
|
|
5762
5762
|
} else
|
|
5763
5763
|
onError("Expected a mapping for this tag");
|
|
5764
|
-
return
|
|
5764
|
+
return map3;
|
|
5765
5765
|
}
|
|
5766
5766
|
};
|
|
5767
5767
|
exports.YAMLSet = YAMLSet;
|
|
@@ -5852,7 +5852,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
5852
5852
|
|
|
5853
5853
|
// ../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
5854
5854
|
var require_schema3 = __commonJS((exports) => {
|
|
5855
|
-
var
|
|
5855
|
+
var map3 = require_map();
|
|
5856
5856
|
var _null4 = require_null();
|
|
5857
5857
|
var seq = require_seq();
|
|
5858
5858
|
var string4 = require_string();
|
|
@@ -5866,7 +5866,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
5866
5866
|
var set2 = require_set();
|
|
5867
5867
|
var timestamp = require_timestamp();
|
|
5868
5868
|
var schema = [
|
|
5869
|
-
|
|
5869
|
+
map3.map,
|
|
5870
5870
|
seq.seq,
|
|
5871
5871
|
string4.string,
|
|
5872
5872
|
_null4.nullTag,
|
|
@@ -5893,7 +5893,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
5893
5893
|
|
|
5894
5894
|
// ../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/tags.js
|
|
5895
5895
|
var require_tags = __commonJS((exports) => {
|
|
5896
|
-
var
|
|
5896
|
+
var map3 = require_map();
|
|
5897
5897
|
var _null4 = require_null();
|
|
5898
5898
|
var seq = require_seq();
|
|
5899
5899
|
var string4 = require_string();
|
|
@@ -5911,7 +5911,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
5911
5911
|
var timestamp = require_timestamp();
|
|
5912
5912
|
var schemas3 = new Map([
|
|
5913
5913
|
["core", schema.schema],
|
|
5914
|
-
["failsafe", [
|
|
5914
|
+
["failsafe", [map3.map, seq.seq, string4.string]],
|
|
5915
5915
|
["json", schema$1.schema],
|
|
5916
5916
|
["yaml11", schema$2.schema],
|
|
5917
5917
|
["yaml-1.1", schema$2.schema]
|
|
@@ -5927,7 +5927,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
5927
5927
|
intHex: int2.intHex,
|
|
5928
5928
|
intOct: int2.intOct,
|
|
5929
5929
|
intTime: timestamp.intTime,
|
|
5930
|
-
map:
|
|
5930
|
+
map: map3.map,
|
|
5931
5931
|
merge: merge2.merge,
|
|
5932
5932
|
null: _null4.nullTag,
|
|
5933
5933
|
omap: omap.omap,
|
|
@@ -5985,7 +5985,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
5985
5985
|
// ../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/schema/Schema.js
|
|
5986
5986
|
var require_Schema = __commonJS((exports) => {
|
|
5987
5987
|
var identity = require_identity();
|
|
5988
|
-
var
|
|
5988
|
+
var map3 = require_map();
|
|
5989
5989
|
var seq = require_seq();
|
|
5990
5990
|
var string4 = require_string();
|
|
5991
5991
|
var tags = require_tags();
|
|
@@ -5998,7 +5998,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
5998
5998
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
5999
5999
|
this.tags = tags.getTags(customTags, this.name, merge2);
|
|
6000
6000
|
this.toStringOptions = toStringDefaults ?? null;
|
|
6001
|
-
Object.defineProperty(this, identity.MAP, { value:
|
|
6001
|
+
Object.defineProperty(this, identity.MAP, { value: map3.map });
|
|
6002
6002
|
Object.defineProperty(this, identity.SCALAR, { value: string4.string });
|
|
6003
6003
|
Object.defineProperty(this, identity.SEQ, { value: seq.seq });
|
|
6004
6004
|
this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
|
|
@@ -6601,7 +6601,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
6601
6601
|
var startColMsg = "All mapping items must start at the same column";
|
|
6602
6602
|
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
|
|
6603
6603
|
const NodeClass = tag?.nodeClass ?? YAMLMap.YAMLMap;
|
|
6604
|
-
const
|
|
6604
|
+
const map3 = new NodeClass(ctx.schema);
|
|
6605
6605
|
if (ctx.atRoot)
|
|
6606
6606
|
ctx.atRoot = false;
|
|
6607
6607
|
let offset = bm.offset;
|
|
@@ -6627,11 +6627,11 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
6627
6627
|
if (!keyProps.anchor && !keyProps.tag && !sep) {
|
|
6628
6628
|
commentEnd = keyProps.end;
|
|
6629
6629
|
if (keyProps.comment) {
|
|
6630
|
-
if (
|
|
6631
|
-
|
|
6630
|
+
if (map3.comment)
|
|
6631
|
+
map3.comment += `
|
|
6632
6632
|
` + keyProps.comment;
|
|
6633
6633
|
else
|
|
6634
|
-
|
|
6634
|
+
map3.comment = keyProps.comment;
|
|
6635
6635
|
}
|
|
6636
6636
|
continue;
|
|
6637
6637
|
}
|
|
@@ -6647,7 +6647,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
6647
6647
|
if (ctx.schema.compat)
|
|
6648
6648
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
|
|
6649
6649
|
ctx.atKey = false;
|
|
6650
|
-
if (utilMapIncludes.mapIncludes(ctx,
|
|
6650
|
+
if (utilMapIncludes.mapIncludes(ctx, map3.items, keyNode))
|
|
6651
6651
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
6652
6652
|
const valueProps = resolveProps.resolveProps(sep ?? [], {
|
|
6653
6653
|
indicator: "map-value-ind",
|
|
@@ -6672,7 +6672,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
6672
6672
|
const pair = new Pair.Pair(keyNode, valueNode);
|
|
6673
6673
|
if (ctx.options.keepSourceTokens)
|
|
6674
6674
|
pair.srcToken = collItem;
|
|
6675
|
-
|
|
6675
|
+
map3.items.push(pair);
|
|
6676
6676
|
} else {
|
|
6677
6677
|
if (implicitKey)
|
|
6678
6678
|
onError(keyNode.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values");
|
|
@@ -6686,13 +6686,13 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
6686
6686
|
const pair = new Pair.Pair(keyNode);
|
|
6687
6687
|
if (ctx.options.keepSourceTokens)
|
|
6688
6688
|
pair.srcToken = collItem;
|
|
6689
|
-
|
|
6689
|
+
map3.items.push(pair);
|
|
6690
6690
|
}
|
|
6691
6691
|
}
|
|
6692
6692
|
if (commentEnd && commentEnd < offset)
|
|
6693
6693
|
onError(commentEnd, "IMPOSSIBLE", "Map comment with trailing content");
|
|
6694
|
-
|
|
6695
|
-
return
|
|
6694
|
+
map3.range = [bm.offset, offset, commentEnd ?? offset];
|
|
6695
|
+
return map3;
|
|
6696
6696
|
}
|
|
6697
6697
|
exports.resolveBlockMap = resolveBlockMap;
|
|
6698
6698
|
});
|
|
@@ -6931,17 +6931,17 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
6931
6931
|
if (ctx.options.keepSourceTokens)
|
|
6932
6932
|
pair.srcToken = collItem;
|
|
6933
6933
|
if (isMap) {
|
|
6934
|
-
const
|
|
6935
|
-
if (utilMapIncludes.mapIncludes(ctx,
|
|
6934
|
+
const map3 = coll;
|
|
6935
|
+
if (utilMapIncludes.mapIncludes(ctx, map3.items, keyNode))
|
|
6936
6936
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
6937
|
-
|
|
6937
|
+
map3.items.push(pair);
|
|
6938
6938
|
} else {
|
|
6939
|
-
const
|
|
6940
|
-
|
|
6941
|
-
|
|
6939
|
+
const map3 = new YAMLMap.YAMLMap(ctx.schema);
|
|
6940
|
+
map3.flow = true;
|
|
6941
|
+
map3.items.push(pair);
|
|
6942
6942
|
const endRange = (valueNode ?? keyNode).range;
|
|
6943
|
-
|
|
6944
|
-
coll.items.push(
|
|
6943
|
+
map3.range = [keyNode.range[0], endRange[1], endRange[2]];
|
|
6944
|
+
coll.items.push(map3);
|
|
6945
6945
|
}
|
|
6946
6946
|
offset = valueNode ? valueNode.range[2] : valueProps.end;
|
|
6947
6947
|
}
|
|
@@ -9281,14 +9281,14 @@ var require_parser = __commonJS((exports) => {
|
|
|
9281
9281
|
delete scalar.end;
|
|
9282
9282
|
} else
|
|
9283
9283
|
sep = [this.sourceToken];
|
|
9284
|
-
const
|
|
9284
|
+
const map3 = {
|
|
9285
9285
|
type: "block-map",
|
|
9286
9286
|
offset: scalar.offset,
|
|
9287
9287
|
indent: scalar.indent,
|
|
9288
9288
|
items: [{ start, key: scalar, sep }]
|
|
9289
9289
|
};
|
|
9290
9290
|
this.onKeyLine = true;
|
|
9291
|
-
this.stack[this.stack.length - 1] =
|
|
9291
|
+
this.stack[this.stack.length - 1] = map3;
|
|
9292
9292
|
} else
|
|
9293
9293
|
yield* this.lineEnd(scalar);
|
|
9294
9294
|
}
|
|
@@ -9319,8 +9319,8 @@ var require_parser = __commonJS((exports) => {
|
|
|
9319
9319
|
yield* this.step();
|
|
9320
9320
|
}
|
|
9321
9321
|
}
|
|
9322
|
-
*blockMap(
|
|
9323
|
-
const it =
|
|
9322
|
+
*blockMap(map3) {
|
|
9323
|
+
const it = map3.items[map3.items.length - 1];
|
|
9324
9324
|
switch (this.type) {
|
|
9325
9325
|
case "newline":
|
|
9326
9326
|
this.onKeyLine = false;
|
|
@@ -9330,7 +9330,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9330
9330
|
if (last?.type === "comment")
|
|
9331
9331
|
end?.push(this.sourceToken);
|
|
9332
9332
|
else
|
|
9333
|
-
|
|
9333
|
+
map3.items.push({ start: [this.sourceToken] });
|
|
9334
9334
|
} else if (it.sep) {
|
|
9335
9335
|
it.sep.push(this.sourceToken);
|
|
9336
9336
|
} else {
|
|
@@ -9340,17 +9340,17 @@ var require_parser = __commonJS((exports) => {
|
|
|
9340
9340
|
case "space":
|
|
9341
9341
|
case "comment":
|
|
9342
9342
|
if (it.value) {
|
|
9343
|
-
|
|
9343
|
+
map3.items.push({ start: [this.sourceToken] });
|
|
9344
9344
|
} else if (it.sep) {
|
|
9345
9345
|
it.sep.push(this.sourceToken);
|
|
9346
9346
|
} else {
|
|
9347
|
-
if (this.atIndentedComment(it.start,
|
|
9348
|
-
const prev =
|
|
9347
|
+
if (this.atIndentedComment(it.start, map3.indent)) {
|
|
9348
|
+
const prev = map3.items[map3.items.length - 2];
|
|
9349
9349
|
const end = prev?.value?.end;
|
|
9350
9350
|
if (Array.isArray(end)) {
|
|
9351
9351
|
arrayPushArray(end, it.start);
|
|
9352
9352
|
end.push(this.sourceToken);
|
|
9353
|
-
|
|
9353
|
+
map3.items.pop();
|
|
9354
9354
|
return;
|
|
9355
9355
|
}
|
|
9356
9356
|
}
|
|
@@ -9358,8 +9358,8 @@ var require_parser = __commonJS((exports) => {
|
|
|
9358
9358
|
}
|
|
9359
9359
|
return;
|
|
9360
9360
|
}
|
|
9361
|
-
if (this.indent >=
|
|
9362
|
-
const atMapIndent = !this.onKeyLine && this.indent ===
|
|
9361
|
+
if (this.indent >= map3.indent) {
|
|
9362
|
+
const atMapIndent = !this.onKeyLine && this.indent === map3.indent;
|
|
9363
9363
|
const atNextItem = atMapIndent && (it.sep || it.explicitKey) && this.type !== "seq-item-ind";
|
|
9364
9364
|
let start = [];
|
|
9365
9365
|
if (atNextItem && it.sep && !it.value) {
|
|
@@ -9373,7 +9373,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9373
9373
|
case "space":
|
|
9374
9374
|
break;
|
|
9375
9375
|
case "comment":
|
|
9376
|
-
if (st.indent >
|
|
9376
|
+
if (st.indent > map3.indent)
|
|
9377
9377
|
nl.length = 0;
|
|
9378
9378
|
break;
|
|
9379
9379
|
default:
|
|
@@ -9388,7 +9388,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9388
9388
|
case "tag":
|
|
9389
9389
|
if (atNextItem || it.value) {
|
|
9390
9390
|
start.push(this.sourceToken);
|
|
9391
|
-
|
|
9391
|
+
map3.items.push({ start });
|
|
9392
9392
|
this.onKeyLine = true;
|
|
9393
9393
|
} else if (it.sep) {
|
|
9394
9394
|
it.sep.push(this.sourceToken);
|
|
@@ -9402,7 +9402,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9402
9402
|
it.explicitKey = true;
|
|
9403
9403
|
} else if (atNextItem || it.value) {
|
|
9404
9404
|
start.push(this.sourceToken);
|
|
9405
|
-
|
|
9405
|
+
map3.items.push({ start, explicitKey: true });
|
|
9406
9406
|
} else {
|
|
9407
9407
|
this.stack.push({
|
|
9408
9408
|
type: "block-map",
|
|
@@ -9428,7 +9428,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9428
9428
|
});
|
|
9429
9429
|
}
|
|
9430
9430
|
} else if (it.value) {
|
|
9431
|
-
|
|
9431
|
+
map3.items.push({ start: [], key: null, sep: [this.sourceToken] });
|
|
9432
9432
|
} else if (includesToken(it.sep, "map-value-ind")) {
|
|
9433
9433
|
this.stack.push({
|
|
9434
9434
|
type: "block-map",
|
|
@@ -9458,7 +9458,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9458
9458
|
if (!it.sep) {
|
|
9459
9459
|
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
|
9460
9460
|
} else if (it.value || atNextItem) {
|
|
9461
|
-
|
|
9461
|
+
map3.items.push({ start, key: null, sep: [this.sourceToken] });
|
|
9462
9462
|
} else if (includesToken(it.sep, "map-value-ind")) {
|
|
9463
9463
|
this.stack.push({
|
|
9464
9464
|
type: "block-map",
|
|
@@ -9478,7 +9478,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9478
9478
|
case "double-quoted-scalar": {
|
|
9479
9479
|
const fs6 = this.flowScalar(this.type);
|
|
9480
9480
|
if (atNextItem || it.value) {
|
|
9481
|
-
|
|
9481
|
+
map3.items.push({ start, key: fs6, sep: [] });
|
|
9482
9482
|
this.onKeyLine = true;
|
|
9483
9483
|
} else if (it.sep) {
|
|
9484
9484
|
this.stack.push(fs6);
|
|
@@ -9489,7 +9489,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9489
9489
|
return;
|
|
9490
9490
|
}
|
|
9491
9491
|
default: {
|
|
9492
|
-
const bv = this.startBlockValue(
|
|
9492
|
+
const bv = this.startBlockValue(map3);
|
|
9493
9493
|
if (bv) {
|
|
9494
9494
|
if (bv.type === "block-seq") {
|
|
9495
9495
|
if (!it.explicitKey && it.sep && !includesToken(it.sep, "newline")) {
|
|
@@ -9502,7 +9502,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
9502
9502
|
return;
|
|
9503
9503
|
}
|
|
9504
9504
|
} else if (atMapIndent) {
|
|
9505
|
-
|
|
9505
|
+
map3.items.push({ start });
|
|
9506
9506
|
}
|
|
9507
9507
|
this.stack.push(bv);
|
|
9508
9508
|
return;
|
|
@@ -9643,14 +9643,14 @@ var require_parser = __commonJS((exports) => {
|
|
|
9643
9643
|
fixFlowSeqItems(fc);
|
|
9644
9644
|
const sep = fc.end.splice(1, fc.end.length);
|
|
9645
9645
|
sep.push(this.sourceToken);
|
|
9646
|
-
const
|
|
9646
|
+
const map3 = {
|
|
9647
9647
|
type: "block-map",
|
|
9648
9648
|
offset: fc.offset,
|
|
9649
9649
|
indent: fc.indent,
|
|
9650
9650
|
items: [{ start, key: fc, sep }]
|
|
9651
9651
|
};
|
|
9652
9652
|
this.onKeyLine = true;
|
|
9653
|
-
this.stack[this.stack.length - 1] =
|
|
9653
|
+
this.stack[this.stack.length - 1] = map3;
|
|
9654
9654
|
} else {
|
|
9655
9655
|
yield* this.lineEnd(fc);
|
|
9656
9656
|
}
|
|
@@ -9879,7 +9879,21 @@ var import_sender = __toESM(require_sender(), 1);
|
|
|
9879
9879
|
var import_subprotocol = __toESM(require_subprotocol(), 1);
|
|
9880
9880
|
var import_websocket = __toESM(require_websocket(), 1);
|
|
9881
9881
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
9882
|
+
var wrapper_default = import_websocket.default;
|
|
9882
9883
|
|
|
9884
|
+
// ../common/links.ts
|
|
9885
|
+
var links = {
|
|
9886
|
+
_: "/",
|
|
9887
|
+
auth: {
|
|
9888
|
+
google: `/auth/google`,
|
|
9889
|
+
linkedin: `/auth/linkedin`
|
|
9890
|
+
},
|
|
9891
|
+
close: `/close`,
|
|
9892
|
+
guide: `/guide`,
|
|
9893
|
+
post: {
|
|
9894
|
+
port: (port) => `/post/${port}`
|
|
9895
|
+
}
|
|
9896
|
+
};
|
|
9883
9897
|
// ../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
9884
9898
|
var exports_external = {};
|
|
9885
9899
|
__export(exports_external, {
|
|
@@ -24159,55 +24173,46 @@ config(en_default());
|
|
|
24159
24173
|
// ../node_modules/.bun/zod@4.4.3/node_modules/zod/index.js
|
|
24160
24174
|
var zod_default = exports_external;
|
|
24161
24175
|
|
|
24162
|
-
// ../common/
|
|
24176
|
+
// ../common/index.ts
|
|
24163
24177
|
var yml;
|
|
24164
24178
|
((yml) => {
|
|
24165
|
-
yml.
|
|
24179
|
+
yml.Media = zod_default.object({
|
|
24180
|
+
type: zod_default.union([zod_default.literal("image"), zod_default.literal("video")]),
|
|
24166
24181
|
src: zod_default.string(),
|
|
24167
24182
|
title: zod_default.string().optional(),
|
|
24168
24183
|
description: zod_default.string().optional()
|
|
24169
24184
|
});
|
|
24170
24185
|
const Base = zod_default.object({
|
|
24171
|
-
created: zod_default.iso.
|
|
24172
|
-
post_id: zod_default.number().int()
|
|
24186
|
+
created: zod_default.iso.date()
|
|
24173
24187
|
});
|
|
24174
24188
|
yml.PostText = Base.extend({
|
|
24175
24189
|
type: zod_default.literal("text"),
|
|
24176
24190
|
text: zod_default.string()
|
|
24177
24191
|
});
|
|
24178
|
-
yml.
|
|
24179
|
-
type: zod_default.literal("
|
|
24192
|
+
yml.PostMedia = Base.extend({
|
|
24193
|
+
type: zod_default.literal("media"),
|
|
24180
24194
|
text: zod_default.string().optional(),
|
|
24181
|
-
|
|
24195
|
+
media: yml.Media
|
|
24182
24196
|
});
|
|
24183
|
-
yml.Post = zod_default.discriminatedUnion("type", [yml.PostText, yml.
|
|
24197
|
+
yml.Post = zod_default.discriminatedUnion("type", [yml.PostText, yml.PostMedia]);
|
|
24184
24198
|
yml.Posts = zod_default.object({ posts: zod_default.array(yml.Post) });
|
|
24185
24199
|
})(yml ||= {});
|
|
24186
24200
|
var proto;
|
|
24187
24201
|
((proto) => {
|
|
24188
|
-
const
|
|
24189
|
-
|
|
24190
|
-
base64: zod_default.string()
|
|
24191
|
-
})
|
|
24202
|
+
const Media = yml.Media.extend({
|
|
24203
|
+
base64: zod_default.string()
|
|
24192
24204
|
});
|
|
24193
|
-
|
|
24205
|
+
const PostMedia = yml.PostMedia.extend({
|
|
24206
|
+
media: Media
|
|
24207
|
+
});
|
|
24208
|
+
proto.Post = zod_default.discriminatedUnion("type", [yml.PostText, PostMedia]);
|
|
24194
24209
|
proto.Payload = zod_default.object({
|
|
24195
|
-
|
|
24210
|
+
hash: zod_default.string(),
|
|
24211
|
+
post: proto.Post
|
|
24196
24212
|
});
|
|
24213
|
+
proto.Payloads = zod_default.array(proto.Payload);
|
|
24197
24214
|
})(proto ||= {});
|
|
24198
|
-
|
|
24199
|
-
var links = {
|
|
24200
|
-
_: "/",
|
|
24201
|
-
auth: {
|
|
24202
|
-
google: `/auth/google`,
|
|
24203
|
-
linkedin: `/auth/linkedin`
|
|
24204
|
-
},
|
|
24205
|
-
close: `/close`,
|
|
24206
|
-
guide: `/guide`,
|
|
24207
|
-
post: {
|
|
24208
|
-
port: (port) => `/post/${port}`
|
|
24209
|
-
}
|
|
24210
|
-
};
|
|
24215
|
+
|
|
24211
24216
|
// ../node_modules/.bun/@versecafe+zcli@0.1.2/node_modules/@versecafe/zcli/dist/index.js
|
|
24212
24217
|
import { readdir, stat } from "node:fs/promises";
|
|
24213
24218
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -24418,6 +24423,114 @@ function parseCompletionArgs(args) {
|
|
|
24418
24423
|
currentIndex
|
|
24419
24424
|
};
|
|
24420
24425
|
}
|
|
24426
|
+
function generateBashCompletion(name) {
|
|
24427
|
+
return `# Bash completion for ${name}
|
|
24428
|
+
# Generated by @versecafe/zcli
|
|
24429
|
+
#
|
|
24430
|
+
# Installation: ${name} completion bash >> ~/.bashrc
|
|
24431
|
+
# or: ${name} completion bash > /etc/bash_completion.d/${name}
|
|
24432
|
+
|
|
24433
|
+
_${name}_completions() {
|
|
24434
|
+
local cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
24435
|
+
local completions
|
|
24436
|
+
|
|
24437
|
+
completions="$("${name}" --get-completions "$COMP_CWORD" "\${COMP_WORDS[@]}" 2>/dev/null)"
|
|
24438
|
+
|
|
24439
|
+
if [[ -n "$completions" ]]; then
|
|
24440
|
+
COMPREPLY=()
|
|
24441
|
+
while IFS= read -r line; do
|
|
24442
|
+
COMPREPLY+=("$line")
|
|
24443
|
+
done <<< "$completions"
|
|
24444
|
+
fi
|
|
24445
|
+
}
|
|
24446
|
+
|
|
24447
|
+
complete -o default -o bashdefault -F _${name}_completions ${name}
|
|
24448
|
+
`;
|
|
24449
|
+
}
|
|
24450
|
+
function generateZshCompletion(name) {
|
|
24451
|
+
return `#compdef ${name}
|
|
24452
|
+
|
|
24453
|
+
# Zsh completion for ${name}
|
|
24454
|
+
# Generated by @versecafe/zcli
|
|
24455
|
+
#
|
|
24456
|
+
# Installation: ${name} completion zsh > ~/.zsh/completions/_${name}
|
|
24457
|
+
# Then add: fpath=(~/.zsh/completions $fpath) to ~/.zshrc
|
|
24458
|
+
|
|
24459
|
+
_${name}() {
|
|
24460
|
+
local completions
|
|
24461
|
+
completions=("\${(@f)$("${name}" --get-completions "$((CURRENT - 1))" "\${words[@]}" 2>/dev/null)}")
|
|
24462
|
+
|
|
24463
|
+
if (( \${#completions[@]} > 0 )); then
|
|
24464
|
+
_describe -t commands "${name}" completions
|
|
24465
|
+
fi
|
|
24466
|
+
}
|
|
24467
|
+
|
|
24468
|
+
_${name}
|
|
24469
|
+
`;
|
|
24470
|
+
}
|
|
24471
|
+
function generateFishCompletion(name) {
|
|
24472
|
+
return `# Fish completion for ${name}
|
|
24473
|
+
# Generated by @versecafe/zcli
|
|
24474
|
+
#
|
|
24475
|
+
# Installation: ${name} completion fish > ~/.config/fish/completions/${name}.fish
|
|
24476
|
+
|
|
24477
|
+
function __${name}_completions
|
|
24478
|
+
set -l tokens (commandline -opc)
|
|
24479
|
+
set -l current (commandline -ct)
|
|
24480
|
+
set -l index (count $tokens)
|
|
24481
|
+
|
|
24482
|
+
${name} --get-completions $index $tokens $current 2>/dev/null
|
|
24483
|
+
end
|
|
24484
|
+
|
|
24485
|
+
complete -c ${name} -f -a "(__${name}_completions)"
|
|
24486
|
+
`;
|
|
24487
|
+
}
|
|
24488
|
+
function generatePowerShellCompletion(name) {
|
|
24489
|
+
return `# PowerShell completion for ${name}
|
|
24490
|
+
# Generated by @versecafe/zcli
|
|
24491
|
+
#
|
|
24492
|
+
# Installation: ${name} completion powershell >> $PROFILE
|
|
24493
|
+
# Or save to a file and dot-source it: . ./completions.ps1
|
|
24494
|
+
|
|
24495
|
+
Register-ArgumentCompleter -Native -CommandName '${name}' -ScriptBlock {
|
|
24496
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
24497
|
+
|
|
24498
|
+
$tokens = $commandAst.CommandElements | ForEach-Object { $_.Extent.Text }
|
|
24499
|
+
$index = $commandAst.CommandElements.Count
|
|
24500
|
+
if ($wordToComplete) {
|
|
24501
|
+
$index--
|
|
24502
|
+
}
|
|
24503
|
+
|
|
24504
|
+
$completions = & '${name}' --get-completions $index @tokens 2>$null
|
|
24505
|
+
|
|
24506
|
+
if ($completions) {
|
|
24507
|
+
$completions -split '\\r?\\n' | ForEach-Object {
|
|
24508
|
+
if ($_) {
|
|
24509
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
24510
|
+
$_,
|
|
24511
|
+
$_,
|
|
24512
|
+
'ParameterValue',
|
|
24513
|
+
$_
|
|
24514
|
+
)
|
|
24515
|
+
}
|
|
24516
|
+
}
|
|
24517
|
+
}
|
|
24518
|
+
}
|
|
24519
|
+
`;
|
|
24520
|
+
}
|
|
24521
|
+
function generateCompletionScript(config2, shell) {
|
|
24522
|
+
const name = config2.name;
|
|
24523
|
+
switch (shell) {
|
|
24524
|
+
case "bash":
|
|
24525
|
+
return generateBashCompletion(name);
|
|
24526
|
+
case "zsh":
|
|
24527
|
+
return generateZshCompletion(name);
|
|
24528
|
+
case "fish":
|
|
24529
|
+
return generateFishCompletion(name);
|
|
24530
|
+
case "powershell":
|
|
24531
|
+
return generatePowerShellCompletion(name);
|
|
24532
|
+
}
|
|
24533
|
+
}
|
|
24421
24534
|
function createMatrix(rows, cols) {
|
|
24422
24535
|
const matrix = [];
|
|
24423
24536
|
for (let i = 0;i < rows; i++) {
|
|
@@ -25504,9 +25617,85 @@ function positional(schema, index, meta3) {
|
|
|
25504
25617
|
}
|
|
25505
25618
|
|
|
25506
25619
|
// src/index.ts
|
|
25620
|
+
import crypto from "crypto";
|
|
25507
25621
|
import { watch } from "fs";
|
|
25508
|
-
import { readFile } from "fs/promises";
|
|
25622
|
+
import { readFile, writeFile } from "fs/promises";
|
|
25623
|
+
import { createRequire as createRequire2 } from "module";
|
|
25509
25624
|
|
|
25625
|
+
// ../node_modules/.bun/nanostores@1.3.0/node_modules/nanostores/clean-stores/index.js
|
|
25626
|
+
var clean = Symbol("clean");
|
|
25627
|
+
|
|
25628
|
+
// ../node_modules/.bun/nanostores@1.3.0/node_modules/nanostores/atom/index.js
|
|
25629
|
+
var listenerQueue = [];
|
|
25630
|
+
var lqIndex = 0;
|
|
25631
|
+
var QUEUE_ITEMS_PER_LISTENER = 4;
|
|
25632
|
+
var nanostoresGlobal = globalThis.nanostoresGlobal ||= { epoch: 0 };
|
|
25633
|
+
var atom = (initialValue) => {
|
|
25634
|
+
let listeners = [];
|
|
25635
|
+
let $atom = {
|
|
25636
|
+
get() {
|
|
25637
|
+
if (!$atom.lc) {
|
|
25638
|
+
$atom.listen(() => {})();
|
|
25639
|
+
}
|
|
25640
|
+
return $atom.value;
|
|
25641
|
+
},
|
|
25642
|
+
init: initialValue,
|
|
25643
|
+
lc: 0,
|
|
25644
|
+
listen(listener) {
|
|
25645
|
+
$atom.lc = listeners.push(listener);
|
|
25646
|
+
return () => {
|
|
25647
|
+
for (let i = lqIndex + QUEUE_ITEMS_PER_LISTENER;i < listenerQueue.length; ) {
|
|
25648
|
+
if (listenerQueue[i] === listener) {
|
|
25649
|
+
listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
|
|
25650
|
+
} else {
|
|
25651
|
+
i += QUEUE_ITEMS_PER_LISTENER;
|
|
25652
|
+
}
|
|
25653
|
+
}
|
|
25654
|
+
let index = listeners.indexOf(listener);
|
|
25655
|
+
if (~index) {
|
|
25656
|
+
listeners.splice(index, 1);
|
|
25657
|
+
if (!--$atom.lc)
|
|
25658
|
+
$atom.off();
|
|
25659
|
+
}
|
|
25660
|
+
};
|
|
25661
|
+
},
|
|
25662
|
+
notify(oldValue, changedKey) {
|
|
25663
|
+
nanostoresGlobal.epoch++;
|
|
25664
|
+
let runListenerQueue = !listenerQueue.length;
|
|
25665
|
+
for (let listener of listeners) {
|
|
25666
|
+
listenerQueue.push(listener, $atom.value, oldValue, changedKey);
|
|
25667
|
+
}
|
|
25668
|
+
if (runListenerQueue) {
|
|
25669
|
+
for (lqIndex = 0;lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) {
|
|
25670
|
+
listenerQueue[lqIndex](listenerQueue[lqIndex + 1], listenerQueue[lqIndex + 2], listenerQueue[lqIndex + 3]);
|
|
25671
|
+
}
|
|
25672
|
+
listenerQueue.length = 0;
|
|
25673
|
+
}
|
|
25674
|
+
},
|
|
25675
|
+
off() {},
|
|
25676
|
+
set(newValue) {
|
|
25677
|
+
let oldValue = $atom.value;
|
|
25678
|
+
if (oldValue !== newValue) {
|
|
25679
|
+
$atom.value = newValue;
|
|
25680
|
+
$atom.notify(oldValue);
|
|
25681
|
+
}
|
|
25682
|
+
},
|
|
25683
|
+
subscribe(listener) {
|
|
25684
|
+
let unbind = $atom.listen(listener);
|
|
25685
|
+
listener($atom.value);
|
|
25686
|
+
return unbind;
|
|
25687
|
+
},
|
|
25688
|
+
value: initialValue
|
|
25689
|
+
};
|
|
25690
|
+
if (true) {
|
|
25691
|
+
$atom[clean] = () => {
|
|
25692
|
+
listeners = [];
|
|
25693
|
+
$atom.lc = 0;
|
|
25694
|
+
$atom.off();
|
|
25695
|
+
};
|
|
25696
|
+
}
|
|
25697
|
+
return $atom;
|
|
25698
|
+
};
|
|
25510
25699
|
// ../node_modules/.bun/open@10.2.0/node_modules/open/index.js
|
|
25511
25700
|
import process8 from "node:process";
|
|
25512
25701
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
@@ -26008,6 +26197,33 @@ defineLazyProperty(apps, "browser", () => "browser");
|
|
|
26008
26197
|
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
26009
26198
|
var open_default = open;
|
|
26010
26199
|
|
|
26200
|
+
// ../node_modules/.bun/stable-hash@0.0.6/node_modules/stable-hash/dist/index.mjs
|
|
26201
|
+
var o = new WeakMap;
|
|
26202
|
+
var u = 0;
|
|
26203
|
+
function stableHash(t) {
|
|
26204
|
+
const i = typeof t, s = t && t.constructor, c = s === Date;
|
|
26205
|
+
if (Object(t) === t && !c && s != RegExp) {
|
|
26206
|
+
let e = o.get(t);
|
|
26207
|
+
if (e)
|
|
26208
|
+
return e;
|
|
26209
|
+
e = ++u + "~", o.set(t, e);
|
|
26210
|
+
let n;
|
|
26211
|
+
if (s === Array) {
|
|
26212
|
+
for (e = "@", n = 0;n < t.length; n++)
|
|
26213
|
+
e += stableHash(t[n]) + ",";
|
|
26214
|
+
o.set(t, e);
|
|
26215
|
+
} else if (s === Object) {
|
|
26216
|
+
e = "#";
|
|
26217
|
+
const f = Object.keys(t).sort();
|
|
26218
|
+
for (;(n = f.pop()) !== undefined; )
|
|
26219
|
+
t[n] !== undefined && (e += n + ":" + stableHash(t[n]) + ",");
|
|
26220
|
+
o.set(t, e);
|
|
26221
|
+
}
|
|
26222
|
+
return e;
|
|
26223
|
+
}
|
|
26224
|
+
return c ? t.toJSON() : i === "symbol" ? t.toString() : i === "string" ? JSON.stringify(t) : "" + t;
|
|
26225
|
+
}
|
|
26226
|
+
|
|
26011
26227
|
// ../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/index.js
|
|
26012
26228
|
var composer = require_composer();
|
|
26013
26229
|
var Document = require_Document();
|
|
@@ -26055,47 +26271,117 @@ var $visit = visit.visit;
|
|
|
26055
26271
|
var $visitAsync = visit.visitAsync;
|
|
26056
26272
|
|
|
26057
26273
|
// src/index.ts
|
|
26274
|
+
var { version: version2 } = createRequire2(import.meta.url)("../package.json");
|
|
26058
26275
|
var DOMAIN = process.env.CIN_ENV === "dev" ? "localhost:3000" : "claudein.org";
|
|
26059
|
-
|
|
26060
|
-
|
|
26061
|
-
return post;
|
|
26062
|
-
const data = await readFile(post.image.src);
|
|
26063
|
-
return { ...post, image: { ...post.image, base64: data.toString("base64") } };
|
|
26064
|
-
}
|
|
26065
|
-
async function ps2ps({ posts }) {
|
|
26066
|
-
return {
|
|
26067
|
-
posts: await Promise.all(posts.map(p2p))
|
|
26068
|
-
};
|
|
26276
|
+
function hash2(post) {
|
|
26277
|
+
return crypto.createHash("sha256").update(stableHash(post)).digest("base64url").substring(0, 16);
|
|
26069
26278
|
}
|
|
26279
|
+
var P2P = {
|
|
26280
|
+
async text(post) {
|
|
26281
|
+
return post;
|
|
26282
|
+
},
|
|
26283
|
+
async media({ media, ...info }) {
|
|
26284
|
+
const base643 = await readFile(media.src).then((buf) => buf.toString("base64"));
|
|
26285
|
+
return {
|
|
26286
|
+
...info,
|
|
26287
|
+
media: {
|
|
26288
|
+
...media,
|
|
26289
|
+
base64: base643
|
|
26290
|
+
}
|
|
26291
|
+
};
|
|
26292
|
+
}
|
|
26293
|
+
};
|
|
26294
|
+
function p2p(post) {
|
|
26295
|
+
return P2P[post.type](post);
|
|
26296
|
+
}
|
|
26297
|
+
function ps2ps(posts) {
|
|
26298
|
+
return Promise.all(posts.posts.map((post) => p2p(post)));
|
|
26299
|
+
}
|
|
26300
|
+
var formatter = new Intl.DateTimeFormat("en-CA", {
|
|
26301
|
+
year: "numeric",
|
|
26302
|
+
month: "2-digit",
|
|
26303
|
+
day: "2-digit"
|
|
26304
|
+
});
|
|
26305
|
+
var posts = {
|
|
26306
|
+
posts: [{
|
|
26307
|
+
type: "text",
|
|
26308
|
+
created: formatter.format(new Date),
|
|
26309
|
+
text: "I'm using ClaudeIn to share my thoughts and ideas!"
|
|
26310
|
+
}]
|
|
26311
|
+
};
|
|
26312
|
+
var sample = [
|
|
26313
|
+
"# yaml-language-server: $schema=https://raw.githubusercontent.com/claudein-org/main/refs/heads/main/claudein.schema.yml",
|
|
26314
|
+
$stringify(posts)
|
|
26315
|
+
].join(`
|
|
26316
|
+
|
|
26317
|
+
`);
|
|
26070
26318
|
var start = command("start").meta({
|
|
26071
|
-
description: "Start the
|
|
26072
|
-
examples: ["cin start my-posts.yml"]
|
|
26319
|
+
description: "Start the live preview server. Claude Code writes posts to a .yml file, you see them in the browser in real time, and can click to post to LinkedIn.",
|
|
26320
|
+
examples: ["cin start", "cin start my-posts.yml"]
|
|
26073
26321
|
}).inputs({
|
|
26074
|
-
file: positional(zod_default.string().describe("Path to a .yml posts file"), 0)
|
|
26322
|
+
file: positional(zod_default.string().describe("Path to a .yml posts file"), 0).default("posts.yml")
|
|
26075
26323
|
}).action(async ({ inputs: { file: file2 } }) => {
|
|
26076
|
-
|
|
26077
|
-
|
|
26078
|
-
|
|
26324
|
+
try {
|
|
26325
|
+
await readFile(file2);
|
|
26326
|
+
} catch {
|
|
26327
|
+
await writeFile(file2, sample, "utf-8");
|
|
26328
|
+
console.log(`Created ${file2} with a sample post`);
|
|
26329
|
+
}
|
|
26079
26330
|
const wss = new import_websocket_server.default({ port: 0 });
|
|
26080
|
-
const
|
|
26081
|
-
|
|
26082
|
-
|
|
26083
|
-
|
|
26084
|
-
|
|
26085
|
-
|
|
26086
|
-
|
|
26087
|
-
|
|
26088
|
-
|
|
26089
|
-
|
|
26090
|
-
|
|
26091
|
-
|
|
26092
|
-
|
|
26093
|
-
|
|
26331
|
+
const $payloads = atom([]);
|
|
26332
|
+
const $info = atom("");
|
|
26333
|
+
const mediaWatchers = [];
|
|
26334
|
+
async function loadPosts() {
|
|
26335
|
+
try {
|
|
26336
|
+
const data = await readFile(file2, "utf-8");
|
|
26337
|
+
const posts2 = yml.Posts.parse($parse(data));
|
|
26338
|
+
mediaWatchers.forEach((w) => w.close());
|
|
26339
|
+
mediaWatchers.length = 0;
|
|
26340
|
+
posts2.posts.forEach((post) => {
|
|
26341
|
+
if (post.type === "media") {
|
|
26342
|
+
mediaWatchers.push(watch(post.media.src, loadPosts));
|
|
26343
|
+
}
|
|
26344
|
+
});
|
|
26345
|
+
const protoPosts = await ps2ps(posts2);
|
|
26346
|
+
const payloads = protoPosts.map((post) => ({ hash: hash2(post), post })).sort((a, b) => a.post.created.localeCompare(b.post.created));
|
|
26347
|
+
$payloads.set(payloads);
|
|
26348
|
+
} catch (err) {
|
|
26349
|
+
console.error("Failed to load posts:", err);
|
|
26350
|
+
}
|
|
26351
|
+
}
|
|
26352
|
+
wss.on("connection", (ws) => {
|
|
26353
|
+
const current = $info.get();
|
|
26354
|
+
if (current)
|
|
26355
|
+
ws.send(current);
|
|
26356
|
+
});
|
|
26357
|
+
$payloads.subscribe((payloads) => {
|
|
26358
|
+
$info.set(JSON.stringify(payloads));
|
|
26359
|
+
});
|
|
26360
|
+
$info.subscribe((info) => {
|
|
26361
|
+
wss.clients.forEach((client) => {
|
|
26362
|
+
if (client.readyState === wrapper_default.OPEN)
|
|
26363
|
+
client.send(info);
|
|
26364
|
+
});
|
|
26094
26365
|
});
|
|
26366
|
+
watch(file2, loadPosts);
|
|
26367
|
+
await loadPosts();
|
|
26095
26368
|
const { port } = wss.address();
|
|
26096
26369
|
open_default(`https://${DOMAIN}${links.post.port(port)}`);
|
|
26097
26370
|
});
|
|
26098
|
-
|
|
26371
|
+
var versionCmd = command("version").meta({ description: "Print the version number" }).action(() => {
|
|
26372
|
+
console.log(generateVersion("cin", version2));
|
|
26373
|
+
});
|
|
26374
|
+
var cinRef;
|
|
26375
|
+
var completionCmd = command("completion").meta({
|
|
26376
|
+
description: "Generate shell completion script",
|
|
26377
|
+
examples: ["cin completion bash >> ~/.bashrc", "cin completion fish > ~/.config/fish/completions/cin.fish"]
|
|
26378
|
+
}).inputs({
|
|
26379
|
+
shell: positional(zod_default.enum(["bash", "zsh", "fish", "powershell"]).describe("Shell to generate completions for"), 0)
|
|
26380
|
+
}).action(({ inputs: { shell } }) => {
|
|
26381
|
+
console.log(generateCompletionScript(cinRef._config, shell));
|
|
26382
|
+
});
|
|
26383
|
+
cinRef = cli("cin", { version: version2 }).use(start).use(versionCmd).use(completionCmd);
|
|
26384
|
+
cinRef.run();
|
|
26099
26385
|
export {
|
|
26100
|
-
|
|
26386
|
+
hash2 as hash
|
|
26101
26387
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claudein.org/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Post to LinkedIn from the command line",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/claudein-org/main.git"
|
|
9
|
+
},
|
|
6
10
|
"bin": {
|
|
7
|
-
"cin": "
|
|
11
|
+
"cin": "dist/index.js"
|
|
8
12
|
},
|
|
9
13
|
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
14
|
+
"access": "public",
|
|
15
|
+
"provenance": true
|
|
11
16
|
},
|
|
12
17
|
"files": [
|
|
13
18
|
"dist"
|
|
@@ -20,7 +25,9 @@
|
|
|
20
25
|
"dependencies": {
|
|
21
26
|
"@types/ws": "^8.18.1",
|
|
22
27
|
"@versecafe/zcli": "^0.1.2",
|
|
28
|
+
"nanostores": "^1.3.0",
|
|
23
29
|
"open": "^10.1.0",
|
|
30
|
+
"stable-hash": "^0.0.6",
|
|
24
31
|
"ws": "^8.21.0",
|
|
25
32
|
"zod": "^4.4.3"
|
|
26
33
|
},
|
|
@@ -28,11 +35,10 @@
|
|
|
28
35
|
"typescript": "^5"
|
|
29
36
|
},
|
|
30
37
|
"devDependencies": {
|
|
31
|
-
"@claudein.org/common": "0.1.0",
|
|
32
38
|
"@types/bun": "^1.3.14",
|
|
33
39
|
"@types/node": "^20",
|
|
34
40
|
"eslint": "^9",
|
|
35
41
|
"tsx": "^4",
|
|
36
42
|
"typescript-eslint": "^8.61.1"
|
|
37
43
|
}
|
|
38
|
-
}
|
|
44
|
+
}
|