sketchi 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/package.json +1 -1
  3. package/sketchi.js +1 -1
package/README.md CHANGED
@@ -162,3 +162,7 @@ sketchi generate --help
162
162
 
163
163
  Source, issue tracking, and architecture documentation live in the
164
164
  [Sketchi repository](https://github.com/shpitdev/sketchi).
165
+
166
+ See the [changelog](https://github.com/shpitdev/sketchi/blob/main/apps/cli/CHANGELOG.md)
167
+ for everything that changed, or browse published versions on
168
+ [GitHub Releases](https://github.com/shpitdev/sketchi/releases).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sketchi",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Local Sketchi authoring CLI: offline flowchart and mindmap workflows plus one unauthenticated prompt-assisted generate command.",
5
5
  "keywords": [
6
6
  "sketchi",
package/sketchi.js CHANGED
@@ -95,7 +95,7 @@ Errors and next steps:
95
95
  `:`error: usage_error
96
96
  ${t}
97
97
  next: ${n}
98
- `}},l=new Proxy(globalThis.console,{get(e,t,r){if("log"===t)return(...t)=>{(1!==t.length||""!==t[0])&&e.log(...t)};let n=Reflect.get(e,t,r);return"function"==typeof n?n.bind(e):n}}),l$(l7,{version:"0.1.0"})(e).pipe(j.sFT(e=>ei.i5(e,i$)&&"ShowHelp"!==e._tag?iO(o.formatErrors([e])):j.rIH),j.PfK(ah,{builtIns:[ao,al,au]}),j.PfK(sy,o),j.PfK(iS,l))).pipe(j.khu({onFailure:e=>j.JkU(function*(){let t,r=q.getOrUndefined(P.L$(e));if(r instanceof lF)return r.exitCode;if(r instanceof nl)return 7;let n=function(e){if(ei.i5(e,i$))return"ShowHelp"===e._tag?2*(e.errors.length>0):2}(r);if(void 0!==n)return n;let i=yield*lD;return yield*i.stderr((t={code:"internal_error",message:"Sketchi could not complete the command.",hint:"Retry once; if it persists, report the command and inputs without secrets."},"json"===c?nS({ok:!1,command:"sketchi",error:t}):lU(t))).pipe(j.MfU(()=>j.rIH)),1}),onSuccess:()=>j.PyW(0)}))}),ct=X.Um(na.Tx,(0,na.rR)({createId:e=>`${e}_offline_cli`})),cr=X.Gt(nT,ct),cn=X.Um(nH,n4),ci=X.Gt(il,cn),cs=X.Gt(ip,X.Um(ci,nW)),ca=X.Um(nH,n4,cr,ci,cs,lP.pipe(X.Gt(nH)),lR),co=X.S5(ca,ns);Y(ce(process.argv.slice(2)).pipe(j.Mim(e=>j.OH5(()=>{process.exitCode=e})),j.Gte(co)),{disableErrorReporting:!0})},181(e){e.exports=t("buffer")},6982(e){e.exports=t("crypto")},932(e){e.exports=t("process")},7876(e,t,r){var n=r(6730),i=r(8376),s=r(73),a=r(7028),o=r(3244),l=r(6225),c=r(9661);function u(e,t,r,n,i,s){let a="block-map"===r.type?o.resolveBlockMap(e,t,r,n,s):"block-seq"===r.type?l.resolveBlockSeq(e,t,r,n,s):c.resolveFlowCollection(e,t,r,n,s),u=a.constructor;return"!"===i||i===u.tagName?a.tag=u.tagName:i&&(a.tag=i),a}t.composeCollection=function(e,t,r,o,l){let c=o.tag,d=c?t.directives.tagName(c.source,e=>l(c,"TAG_RESOLVE_FAILED",e)):null;if("block-seq"===r.type){let{anchor:e,newlineAfterProp:t}=o,r=e&&c?e.offset>c.offset?e:c:e??c;r&&(!t||t.offset<r.offset)&&l(r,"MISSING_CHAR","Missing newline after block sequence props")}let f="block-map"===r.type?"map":"block-seq"===r.type?"seq":"{"===r.start.source?"map":"seq";if(!c||!d||"!"===d||d===s.YAMLMap.tagName&&"map"===f||d===a.YAMLSeq.tagName&&"seq"===f)return u(e,t,r,l,d);let h=t.schema.tags.find(e=>e.tag===d&&e.collection===f);if(!h){let n=t.schema.knownTags[d];if(n?.collection!==f)return n?l(c,"BAD_COLLECTION_TYPE",`${n.tag} used for ${f} collection, but expects ${n.collection??"scalar"}`,!0):l(c,"TAG_RESOLVE_FAILED",`Unresolved tag: ${d}`,!0),u(e,t,r,l,d);t.schema.tags.push(Object.assign({},n,{default:!1})),h=n}let p=u(e,t,r,l,d,h),m=h.resolve?.(p,e=>l(c,"TAG_RESOLVE_FAILED",e),t.options)??p,g=n.isNode(m)?m:new i.Scalar(m);return g.range=p.range,g.tag=d,h?.format&&(g.format=h.format),g}},6040(e,t,r){var n=r(9960),i=r(9724),s=r(4915),a=r(7800);t.composeDoc=function(e,t,{offset:r,start:o,value:l,end:c},u){let d=Object.assign({_directives:t},e),f=new n.Document(void 0,d),h={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},p=a.resolveProps(o,{indicator:"doc-start",next:l??c?.[0],offset:r,onError:u,parentIndent:0,startOnNewline:!0});p.found&&(f.directives.docStart=!0,l&&("block-map"===l.type||"block-seq"===l.type)&&!p.hasNewline&&u(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=l?i.composeNode(h,l,p,u):i.composeEmptyNode(h,p.end,o,null,p,u);let m=f.contents.range[2],g=s.resolveEnd(c,m,!1,u);return g.comment&&(f.comment=g.comment),f.range=[r,m,g.offset],f}},9724(e,t,r){var n=r(2298),i=r(6730),s=r(7876),a=r(5120),o=r(4915),l=r(4898);let c={composeNode:u,composeEmptyNode:d};function u(e,t,r,l){let u,f=e.atKey,{spaceBefore:h,comment:p,anchor:m,tag:g}=r,y=!0;switch(t.type){case"alias":u=function({options:e},{offset:t,source:r,end:i},s){let a=new n.Alias(r.substring(1));""===a.source&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&s(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let l=t+r.length,c=o.resolveEnd(i,l,e.strict,s);return a.range=[t,l,c.offset],c.comment&&(a.comment=c.comment),a}(e,t,l),(m||g)&&l(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=a.composeScalar(e,t,g,l),m&&(u.anchor=m.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=s.composeCollection(c,e,t,r,l),m&&(u.anchor=m.source.substring(1))}catch(e){l(t,"RESOURCE_EXHAUSTION",e instanceof Error?e.message:String(e))}break;default:{let e="error"===t.type?t.message:`Unsupported token (type: ${t.type})`;l(t,"UNEXPECTED_TOKEN",e),y=!1}}return u??(u=d(e,t.offset,void 0,null,r,l)),m&&""===u.anchor&&l(m,"BAD_ALIAS","Anchor cannot be an empty string"),f&&e.options.stringKeys&&(!i.isScalar(u)||"string"!=typeof u.value||u.tag&&"tag:yaml.org,2002:str"!==u.tag)&&l(g??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),h&&(u.spaceBefore=!0),p&&("scalar"===t.type&&""===t.source?u.comment=p:u.commentBefore=p),e.options.keepSourceTokens&&y&&(u.srcToken=t),u}function d(e,t,r,n,{spaceBefore:i,comment:s,anchor:o,tag:c,end:u},f){let h={type:"scalar",offset:l.emptyScalarPosition(t,r,n),indent:-1,source:""},p=a.composeScalar(e,h,c,f);return o&&(p.anchor=o.source.substring(1),""===p.anchor&&f(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}t.composeEmptyNode=d,t.composeNode=u},5120(e,t,r){var n=r(6730),i=r(8376),s=r(2992),a=r(3165);t.composeScalar=function(e,t,r,o){let l,c,{value:u,type:d,comment:f,range:h}="block-scalar"===t.type?s.resolveBlockScalar(e,t,o):a.resolveFlowScalar(t,e.options.strict,o),p=r?e.directives.tagName(r.source,e=>o(r,"TAG_RESOLVE_FAILED",e)):null;l=e.options.stringKeys&&e.atKey?e.schema[n.SCALAR]:p?function(e,t,r,i,s){if("!"===r)return e[n.SCALAR];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===r)if(!t.default||!t.test)return t;else a.push(t);for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[r];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,"tag:yaml.org,2002:str"!==r),e[n.SCALAR])}(e.schema,u,p,r,o):"scalar"===t.type?function({atKey:e,directives:t,schema:r},i,s,a){let o=r.tags.find(t=>(!0===t.default||e&&"key"===t.default)&&t.test?.test(i))||r[n.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[n.SCALAR];if(o.tag!==e.tag){let r=t.tagString(o.tag),n=t.tagString(e.tag);a(s,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${r} or ${n}`,!0)}}return o}(e,u,t,o):e.schema[n.SCALAR];try{let s=l.resolve(u,e=>o(r??t,"TAG_RESOLVE_FAILED",e),e.options);c=n.isScalar(s)?s:new i.Scalar(s)}catch(e){o(r??t,"TAG_RESOLVE_FAILED",e instanceof Error?e.message:String(e)),c=new i.Scalar(u)}return c.range=h,c.source=u,d&&(c.type=d),p&&(c.tag=p),l.format&&(c.format=l.format),f&&(c.comment=f),c}},2545(e,t,r){var n=r(932),i=r(7087),s=r(9960),a=r(3409),o=r(6730),l=r(6040),c=r(4915);function u(e){if("number"==typeof e)return[e,e+1];if(Array.isArray(e))return 2===e.length?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+("string"==typeof r?r.length:1)]}function d(e){let t="",r=!1,n=!1;for(let i=0;i<e.length;++i){let s=e[i];switch(s[0]){case"#":t+=(""===t?"":n?"\n\n":"\n")+(s.substring(1)||" "),r=!0,n=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:t,afterEmptyLine:n}}t.Composer=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,r,n)=>{let i=u(e);n?this.warnings.push(new a.YAMLWarning(i,t,r)):this.errors.push(new a.YAMLParseError(i,t,r))},this.directives=new i.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:n}=d(this.prelude);if(r){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
98
+ `}},l=new Proxy(globalThis.console,{get(e,t,r){if("log"===t)return(...t)=>{(1!==t.length||""!==t[0])&&e.log(...t)};let n=Reflect.get(e,t,r);return"function"==typeof n?n.bind(e):n}}),l$(l7,{version:"0.1.1"})(e).pipe(j.sFT(e=>ei.i5(e,i$)&&"ShowHelp"!==e._tag?iO(o.formatErrors([e])):j.rIH),j.PfK(ah,{builtIns:[ao,al,au]}),j.PfK(sy,o),j.PfK(iS,l))).pipe(j.khu({onFailure:e=>j.JkU(function*(){let t,r=q.getOrUndefined(P.L$(e));if(r instanceof lF)return r.exitCode;if(r instanceof nl)return 7;let n=function(e){if(ei.i5(e,i$))return"ShowHelp"===e._tag?2*(e.errors.length>0):2}(r);if(void 0!==n)return n;let i=yield*lD;return yield*i.stderr((t={code:"internal_error",message:"Sketchi could not complete the command.",hint:"Retry once; if it persists, report the command and inputs without secrets."},"json"===c?nS({ok:!1,command:"sketchi",error:t}):lU(t))).pipe(j.MfU(()=>j.rIH)),1}),onSuccess:()=>j.PyW(0)}))}),ct=X.Um(na.Tx,(0,na.rR)({createId:e=>`${e}_offline_cli`})),cr=X.Gt(nT,ct),cn=X.Um(nH,n4),ci=X.Gt(il,cn),cs=X.Gt(ip,X.Um(ci,nW)),ca=X.Um(nH,n4,cr,ci,cs,lP.pipe(X.Gt(nH)),lR),co=X.S5(ca,ns);Y(ce(process.argv.slice(2)).pipe(j.Mim(e=>j.OH5(()=>{process.exitCode=e})),j.Gte(co)),{disableErrorReporting:!0})},181(e){e.exports=t("buffer")},6982(e){e.exports=t("crypto")},932(e){e.exports=t("process")},7876(e,t,r){var n=r(6730),i=r(8376),s=r(73),a=r(7028),o=r(3244),l=r(6225),c=r(9661);function u(e,t,r,n,i,s){let a="block-map"===r.type?o.resolveBlockMap(e,t,r,n,s):"block-seq"===r.type?l.resolveBlockSeq(e,t,r,n,s):c.resolveFlowCollection(e,t,r,n,s),u=a.constructor;return"!"===i||i===u.tagName?a.tag=u.tagName:i&&(a.tag=i),a}t.composeCollection=function(e,t,r,o,l){let c=o.tag,d=c?t.directives.tagName(c.source,e=>l(c,"TAG_RESOLVE_FAILED",e)):null;if("block-seq"===r.type){let{anchor:e,newlineAfterProp:t}=o,r=e&&c?e.offset>c.offset?e:c:e??c;r&&(!t||t.offset<r.offset)&&l(r,"MISSING_CHAR","Missing newline after block sequence props")}let f="block-map"===r.type?"map":"block-seq"===r.type?"seq":"{"===r.start.source?"map":"seq";if(!c||!d||"!"===d||d===s.YAMLMap.tagName&&"map"===f||d===a.YAMLSeq.tagName&&"seq"===f)return u(e,t,r,l,d);let h=t.schema.tags.find(e=>e.tag===d&&e.collection===f);if(!h){let n=t.schema.knownTags[d];if(n?.collection!==f)return n?l(c,"BAD_COLLECTION_TYPE",`${n.tag} used for ${f} collection, but expects ${n.collection??"scalar"}`,!0):l(c,"TAG_RESOLVE_FAILED",`Unresolved tag: ${d}`,!0),u(e,t,r,l,d);t.schema.tags.push(Object.assign({},n,{default:!1})),h=n}let p=u(e,t,r,l,d,h),m=h.resolve?.(p,e=>l(c,"TAG_RESOLVE_FAILED",e),t.options)??p,g=n.isNode(m)?m:new i.Scalar(m);return g.range=p.range,g.tag=d,h?.format&&(g.format=h.format),g}},6040(e,t,r){var n=r(9960),i=r(9724),s=r(4915),a=r(7800);t.composeDoc=function(e,t,{offset:r,start:o,value:l,end:c},u){let d=Object.assign({_directives:t},e),f=new n.Document(void 0,d),h={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},p=a.resolveProps(o,{indicator:"doc-start",next:l??c?.[0],offset:r,onError:u,parentIndent:0,startOnNewline:!0});p.found&&(f.directives.docStart=!0,l&&("block-map"===l.type||"block-seq"===l.type)&&!p.hasNewline&&u(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=l?i.composeNode(h,l,p,u):i.composeEmptyNode(h,p.end,o,null,p,u);let m=f.contents.range[2],g=s.resolveEnd(c,m,!1,u);return g.comment&&(f.comment=g.comment),f.range=[r,m,g.offset],f}},9724(e,t,r){var n=r(2298),i=r(6730),s=r(7876),a=r(5120),o=r(4915),l=r(4898);let c={composeNode:u,composeEmptyNode:d};function u(e,t,r,l){let u,f=e.atKey,{spaceBefore:h,comment:p,anchor:m,tag:g}=r,y=!0;switch(t.type){case"alias":u=function({options:e},{offset:t,source:r,end:i},s){let a=new n.Alias(r.substring(1));""===a.source&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&s(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let l=t+r.length,c=o.resolveEnd(i,l,e.strict,s);return a.range=[t,l,c.offset],c.comment&&(a.comment=c.comment),a}(e,t,l),(m||g)&&l(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=a.composeScalar(e,t,g,l),m&&(u.anchor=m.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=s.composeCollection(c,e,t,r,l),m&&(u.anchor=m.source.substring(1))}catch(e){l(t,"RESOURCE_EXHAUSTION",e instanceof Error?e.message:String(e))}break;default:{let e="error"===t.type?t.message:`Unsupported token (type: ${t.type})`;l(t,"UNEXPECTED_TOKEN",e),y=!1}}return u??(u=d(e,t.offset,void 0,null,r,l)),m&&""===u.anchor&&l(m,"BAD_ALIAS","Anchor cannot be an empty string"),f&&e.options.stringKeys&&(!i.isScalar(u)||"string"!=typeof u.value||u.tag&&"tag:yaml.org,2002:str"!==u.tag)&&l(g??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),h&&(u.spaceBefore=!0),p&&("scalar"===t.type&&""===t.source?u.comment=p:u.commentBefore=p),e.options.keepSourceTokens&&y&&(u.srcToken=t),u}function d(e,t,r,n,{spaceBefore:i,comment:s,anchor:o,tag:c,end:u},f){let h={type:"scalar",offset:l.emptyScalarPosition(t,r,n),indent:-1,source:""},p=a.composeScalar(e,h,c,f);return o&&(p.anchor=o.source.substring(1),""===p.anchor&&f(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}t.composeEmptyNode=d,t.composeNode=u},5120(e,t,r){var n=r(6730),i=r(8376),s=r(2992),a=r(3165);t.composeScalar=function(e,t,r,o){let l,c,{value:u,type:d,comment:f,range:h}="block-scalar"===t.type?s.resolveBlockScalar(e,t,o):a.resolveFlowScalar(t,e.options.strict,o),p=r?e.directives.tagName(r.source,e=>o(r,"TAG_RESOLVE_FAILED",e)):null;l=e.options.stringKeys&&e.atKey?e.schema[n.SCALAR]:p?function(e,t,r,i,s){if("!"===r)return e[n.SCALAR];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===r)if(!t.default||!t.test)return t;else a.push(t);for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[r];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,"tag:yaml.org,2002:str"!==r),e[n.SCALAR])}(e.schema,u,p,r,o):"scalar"===t.type?function({atKey:e,directives:t,schema:r},i,s,a){let o=r.tags.find(t=>(!0===t.default||e&&"key"===t.default)&&t.test?.test(i))||r[n.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[n.SCALAR];if(o.tag!==e.tag){let r=t.tagString(o.tag),n=t.tagString(e.tag);a(s,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${r} or ${n}`,!0)}}return o}(e,u,t,o):e.schema[n.SCALAR];try{let s=l.resolve(u,e=>o(r??t,"TAG_RESOLVE_FAILED",e),e.options);c=n.isScalar(s)?s:new i.Scalar(s)}catch(e){o(r??t,"TAG_RESOLVE_FAILED",e instanceof Error?e.message:String(e)),c=new i.Scalar(u)}return c.range=h,c.source=u,d&&(c.type=d),p&&(c.tag=p),l.format&&(c.format=l.format),f&&(c.comment=f),c}},2545(e,t,r){var n=r(932),i=r(7087),s=r(9960),a=r(3409),o=r(6730),l=r(6040),c=r(4915);function u(e){if("number"==typeof e)return[e,e+1];if(Array.isArray(e))return 2===e.length?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+("string"==typeof r?r.length:1)]}function d(e){let t="",r=!1,n=!1;for(let i=0;i<e.length;++i){let s=e[i];switch(s[0]){case"#":t+=(""===t?"":n?"\n\n":"\n")+(s.substring(1)||" "),r=!0,n=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:t,afterEmptyLine:n}}t.Composer=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,r,n)=>{let i=u(e);n?this.warnings.push(new a.YAMLWarning(i,t,r)):this.errors.push(new a.YAMLParseError(i,t,r))},this.directives=new i.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:r,afterEmptyLine:n}=d(this.prelude);if(r){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
99
99
  ${r}`:r;else if(n||e.directives.docStart||!i)e.commentBefore=r;else if(o.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];o.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${r}
100
100
  ${t}`:r}else{let e=i.commentBefore;i.commentBefore=e?`${r}
101
101
  ${e}`:r}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:d(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,r=-1){for(let t of e)yield*this.next(t);yield*this.end(t,r)}*next(e){switch(n.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,r,n)=>{let i=u(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",r,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=l.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new a.YAMLParseError(u(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){this.errors.push(new a.YAMLParseError(u(e),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let t=c.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}