@promptbook/node 0.68.0 β†’ 0.69.0-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.
package/README.md CHANGED
@@ -28,7 +28,7 @@ To install this package, run:
28
28
  npm i ptbk
29
29
 
30
30
  # Install just this package to save space
31
- npm i @promptbook/node
31
+ npm install @promptbook/node
32
32
  ```
33
33
 
34
34
  Core of the library for Node.js runtime, it contains the main logic for promptbooks which uses filesystem.
package/esm/index.es.js CHANGED
@@ -14,7 +14,7 @@ import * as dotenv from 'dotenv';
14
14
  /**
15
15
  * The version of the Promptbook library
16
16
  */
17
- var PROMPTBOOK_VERSION = '0.68.0-5';
17
+ var PROMPTBOOK_VERSION = '0.69.0-0';
18
18
  // TODO: !!!! List here all the versions and annotate + put into script
19
19
 
20
20
  /*! *****************************************************************************
@@ -874,7 +874,7 @@ function forEachAsync(array, options, callbackfunction) {
874
874
  });
875
875
  }
876
876
 
877
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.68.0-5",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.68.0-5",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.68.0-5",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.68.0-5",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
877
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-0",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.69.0-0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.69.0-0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.69.0-0",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
878
878
 
879
879
  /**
880
880
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -4891,6 +4891,76 @@ var expectCommandParser = {
4891
4891
  },
4892
4892
  };
4893
4893
 
4894
+ /**
4895
+ * @@@
4896
+ *
4897
+ * @param text @@@
4898
+ * @returns @@@
4899
+ * @example 'HELLO_WORLD'
4900
+ * @example 'I_LOVE_PROMPTBOOK'
4901
+ * @public exported from `@promptbook/utils`
4902
+ */
4903
+ function normalizeTo_SCREAMING_CASE(text) {
4904
+ var e_1, _a;
4905
+ var charType;
4906
+ var lastCharType = 'OTHER';
4907
+ var normalizedName = '';
4908
+ try {
4909
+ for (var text_1 = __values(text), text_1_1 = text_1.next(); !text_1_1.done; text_1_1 = text_1.next()) {
4910
+ var char = text_1_1.value;
4911
+ var normalizedChar = void 0;
4912
+ if (/^[a-z]$/.test(char)) {
4913
+ charType = 'LOWERCASE';
4914
+ normalizedChar = char.toUpperCase();
4915
+ }
4916
+ else if (/^[A-Z]$/.test(char)) {
4917
+ charType = 'UPPERCASE';
4918
+ normalizedChar = char;
4919
+ }
4920
+ else if (/^[0-9]$/.test(char)) {
4921
+ charType = 'NUMBER';
4922
+ normalizedChar = char;
4923
+ }
4924
+ else if (/^\/$/.test(char)) {
4925
+ charType = 'SLASH';
4926
+ normalizedChar = char;
4927
+ }
4928
+ else {
4929
+ charType = 'OTHER';
4930
+ normalizedChar = '_';
4931
+ }
4932
+ if (charType !== lastCharType &&
4933
+ !(lastCharType === 'UPPERCASE' && charType === 'LOWERCASE') &&
4934
+ !(lastCharType === 'NUMBER') &&
4935
+ !(charType === 'NUMBER')) {
4936
+ normalizedName += '_';
4937
+ }
4938
+ normalizedName += normalizedChar;
4939
+ lastCharType = charType;
4940
+ }
4941
+ }
4942
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4943
+ finally {
4944
+ try {
4945
+ if (text_1_1 && !text_1_1.done && (_a = text_1.return)) _a.call(text_1);
4946
+ }
4947
+ finally { if (e_1) throw e_1.error; }
4948
+ }
4949
+ normalizedName = normalizedName.replace(/_+/g, '_');
4950
+ normalizedName = normalizedName.replace(/_?\/_?/g, '/');
4951
+ normalizedName = normalizedName.replace(/^_/, '');
4952
+ normalizedName = normalizedName.replace(/_$/, '');
4953
+ return normalizedName;
4954
+ }
4955
+ /**
4956
+ * TODO: Tests
4957
+ * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'Moje tabule' })).toEqual('/VtG7sR9rRJqwNEdM2/Moje tabule');
4958
+ * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'ěőčřžžýÑíúů' })).toEqual('/VtG7sR9rRJqwNEdM2/escrzyaieuu');
4959
+ * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj');
4960
+ * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj_ahojAhoj ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj-ahoj-ahoj-ahoj');
4961
+ * TODO: [🌺] Use some intermediate util splitWords
4962
+ */
4963
+
4894
4964
  /**
4895
4965
  * Parses the foreach command
4896
4966
  *
@@ -4928,17 +4998,59 @@ var foreachCommandParser = {
4928
4998
  'FOREACH List Line -> `{customer}`',
4929
4999
  'FOR List Line -> `{customer}`',
4930
5000
  'EACH List Line -> `{customer}`',
4931
- // <- TODO: [🍭] More
5001
+ // <- TODO: [🍭] !!!!!! More
4932
5002
  ],
4933
5003
  /**
4934
5004
  * Parses the FOREACH command
4935
5005
  */
4936
5006
  parse: function (input) {
4937
- var args = input.args;
4938
- keepUnused(args);
4939
- // <- TODO: [🍭] Implement
5007
+ var args = input.args, rawArgs = input.rawArgs;
5008
+ var formatName = normalizeTo_SCREAMING_CASE(args[0] || '');
5009
+ var cellName = normalizeTo_SCREAMING_CASE(args[1] || '');
5010
+ var assignSign = args[2];
5011
+ var parameter = args[3];
5012
+ if (![
5013
+ 'LIST',
5014
+ 'CSV',
5015
+ // <- TODO: [🏒] Unhardcode formats
5016
+ ].includes(formatName)) {
5017
+ console.info({ args: args, formatName: formatName });
5018
+ throw new Error("Unsupported format \"".concat(formatName, "\""));
5019
+ // <- TODO: [🏒] List all supported format names
5020
+ }
5021
+ if (![
5022
+ 'LINE',
5023
+ 'ROW',
5024
+ 'COLUMN',
5025
+ 'CELL',
5026
+ // <- TODO: [🏒] Unhardcode format cekks
5027
+ ].includes(cellName)) {
5028
+ console.info({ args: args, cellName: cellName });
5029
+ throw new Error("Format ".concat(formatName, " does not support cell \"").concat(cellName, "\""));
5030
+ // <- TODO: [🏒] List all supported cell names for the format
5031
+ }
5032
+ if (assignSign !== '->') {
5033
+ console.info({ args: args, assignSign: assignSign });
5034
+ throw new Error("FOREACH command must have '->' to assign the value to the parameter");
5035
+ }
5036
+ var parameterNames = extractParameterNames(parameter || rawArgs);
5037
+ if (parameterNames.size !== 1) {
5038
+ console.info({ args: args, parameter: parameter, rawArgs: rawArgs });
5039
+ throw new Error("FOREACH command contain exactly one parameter, but found ".concat(parameterNames.size));
5040
+ }
5041
+ var parameterName = parameterNames.values().next().value;
5042
+ if (typeof parameterName !== 'string'
5043
+ // <- TODO: !!!!!! Replace with propper parameter name validation
5044
+ ) {
5045
+ console.info({ args: args, parameterName: parameterName });
5046
+ throw new Error("Invalid parameter name");
5047
+ // <- TODO: !!!!!! Better error (with rules and precise error) from validateParameterName
5048
+ }
4940
5049
  return {
4941
5050
  type: 'FOREACH',
5051
+ formatName: formatName,
5052
+ cellName: cellName,
5053
+ parameterName: parameterName,
4942
5054
  };
4943
5055
  },
4944
5056
  /**
@@ -4948,7 +5060,7 @@ var foreachCommandParser = {
4948
5060
  */
4949
5061
  $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
4950
5062
  keepUnused(command, $templateJson, $pipelineJson);
4951
- // <- TODO: [🍭] Implement
5063
+ // <- TODO: [🍭] !!!!!! Implement
4952
5064
  },
4953
5065
  /**
4954
5066
  * Converts the FOREACH command back to string
@@ -4958,7 +5070,7 @@ var foreachCommandParser = {
4958
5070
  stringify: function (command) {
4959
5071
  keepUnused(command);
4960
5072
  return "";
4961
- // <- TODO: [🍭] Implement
5073
+ // <- TODO: [🍭] !!!!!! Implement
4962
5074
  },
4963
5075
  /**
4964
5076
  * Reads the FOREACH command from the `TemplateJson`
@@ -4968,11 +5080,12 @@ var foreachCommandParser = {
4968
5080
  takeFromTemplateJson: function ($templateJson) {
4969
5081
  keepUnused($templateJson);
4970
5082
  return [];
4971
- // <- TODO: [🍭] Implement
5083
+ // <- TODO: [🍭] !!!!!! Implement
4972
5084
  },
4973
5085
  };
4974
5086
  /**
4975
- * TODO: [🍭] Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
5087
+ * TODO: !!!!!! Comment console logs
5088
+ * TODO: [🍭] !!!!!! Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
4976
5089
  */
4977
5090
 
4978
5091
  /**
@@ -5325,6 +5438,7 @@ var parameterCommandParser = {
5325
5438
  isInput = false;
5326
5439
  isOutput = false;
5327
5440
  }
5441
+ // TODO: !!!!!! Add parameter name validation
5328
5442
  return {
5329
5443
  type: 'PARAMETER',
5330
5444
  parameterName: parameterName,
@@ -6077,76 +6191,6 @@ function removeMarkdownFormatting(str) {
6077
6191
  return str;
6078
6192
  }
6079
6193
 
6080
- /**
6081
- * @@@
6082
- *
6083
- * @param text @@@
6084
- * @returns @@@
6085
- * @example 'HELLO_WORLD'
6086
- * @example 'I_LOVE_PROMPTBOOK'
6087
- * @public exported from `@promptbook/utils`
6088
- */
6089
- function normalizeTo_SCREAMING_CASE(text) {
6090
- var e_1, _a;
6091
- var charType;
6092
- var lastCharType = 'OTHER';
6093
- var normalizedName = '';
6094
- try {
6095
- for (var text_1 = __values(text), text_1_1 = text_1.next(); !text_1_1.done; text_1_1 = text_1.next()) {
6096
- var char = text_1_1.value;
6097
- var normalizedChar = void 0;
6098
- if (/^[a-z]$/.test(char)) {
6099
- charType = 'LOWERCASE';
6100
- normalizedChar = char.toUpperCase();
6101
- }
6102
- else if (/^[A-Z]$/.test(char)) {
6103
- charType = 'UPPERCASE';
6104
- normalizedChar = char;
6105
- }
6106
- else if (/^[0-9]$/.test(char)) {
6107
- charType = 'NUMBER';
6108
- normalizedChar = char;
6109
- }
6110
- else if (/^\/$/.test(char)) {
6111
- charType = 'SLASH';
6112
- normalizedChar = char;
6113
- }
6114
- else {
6115
- charType = 'OTHER';
6116
- normalizedChar = '_';
6117
- }
6118
- if (charType !== lastCharType &&
6119
- !(lastCharType === 'UPPERCASE' && charType === 'LOWERCASE') &&
6120
- !(lastCharType === 'NUMBER') &&
6121
- !(charType === 'NUMBER')) {
6122
- normalizedName += '_';
6123
- }
6124
- normalizedName += normalizedChar;
6125
- lastCharType = charType;
6126
- }
6127
- }
6128
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
6129
- finally {
6130
- try {
6131
- if (text_1_1 && !text_1_1.done && (_a = text_1.return)) _a.call(text_1);
6132
- }
6133
- finally { if (e_1) throw e_1.error; }
6134
- }
6135
- normalizedName = normalizedName.replace(/_+/g, '_');
6136
- normalizedName = normalizedName.replace(/_?\/_?/g, '/');
6137
- normalizedName = normalizedName.replace(/^_/, '');
6138
- normalizedName = normalizedName.replace(/_$/, '');
6139
- return normalizedName;
6140
- }
6141
- /**
6142
- * TODO: Tests
6143
- * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'Moje tabule' })).toEqual('/VtG7sR9rRJqwNEdM2/Moje tabule');
6144
- * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: 'ěőčřžžýÑíúů' })).toEqual('/VtG7sR9rRJqwNEdM2/escrzyaieuu');
6145
- * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj');
6146
- * > expect(encodeRoutePath({ uriId: 'VtG7sR9rRJqwNEdM2', name: ' ahoj_ahojAhoj ahoj ' })).toEqual('/VtG7sR9rRJqwNEdM2/ahoj-ahoj-ahoj-ahoj');
6147
- * TODO: [🌺] Use some intermediate util splitWords
6148
- */
6149
-
6150
6194
  /**
6151
6195
  * Parses one line of ul/ol to command
6152
6196
  *
@@ -6159,6 +6203,7 @@ function parseCommand(raw, usagePlace) {
6159
6203
  if (raw.includes('\n') || raw.includes('\r')) {
6160
6204
  throw new ParseError('Command can not contain new line characters' /* <- TODO: [🚞] */);
6161
6205
  }
6206
+ // TODO: Unit test all this processing and parsing
6162
6207
  var normalized = raw.trim();
6163
6208
  normalized = normalized.split('`').join('');
6164
6209
  normalized = normalized.split('"').join('');
@@ -6214,7 +6259,7 @@ function parseCommand(raw, usagePlace) {
6214
6259
  // Arg1 Arg2 Arg3 | FOO
6215
6260
  {
6216
6261
  var commandNameRaw = items.slice(-1).join('_');
6217
- var args = items.slice(0, -1);
6262
+ var args = items.slice(0, -1); // <- Note: This is probbably not correct
6218
6263
  var rawArgs = raw.substring(0, raw.length - commandNameRaw.length).trim();
6219
6264
  var command = parseCommandVariant({ usagePlace: usagePlace, raw: raw, rawArgs: rawArgs, normalized: normalized, args: args, commandNameRaw: commandNameRaw });
6220
6265
  if (command !== null) {