@promptbook/cli 0.63.0-6 → 0.63.0-7
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/esm/index.es.js +117 -68
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/cli/cli-commands/about.d.ts +11 -0
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -0
- package/esm/typings/src/cli/test/ptbk.d.ts +2 -0
- package/esm/typings/src/cli/test/ptbk.test.d.ts +1 -0
- package/esm/typings/src/config.d.ts +8 -0
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +3 -0
- package/package.json +1 -1
- package/umd/index.umd.js +117 -68
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -18,7 +18,7 @@ import glob from 'glob-promise';
|
|
|
18
18
|
/**
|
|
19
19
|
* The version of the Promptbook library
|
|
20
20
|
*/
|
|
21
|
-
var PROMPTBOOK_VERSION = '0.63.0-
|
|
21
|
+
var PROMPTBOOK_VERSION = '0.63.0-6';
|
|
22
22
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
23
23
|
|
|
24
24
|
/*! *****************************************************************************
|
|
@@ -175,66 +175,6 @@ var isRunningInNode = new Function("\n try {\n return this === global;
|
|
|
175
175
|
*/
|
|
176
176
|
new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
177
177
|
|
|
178
|
-
/**
|
|
179
|
-
* Initializes testing `hello` command for Promptbook CLI utilities
|
|
180
|
-
*
|
|
181
|
-
* @private internal function of `promptbookCli`
|
|
182
|
-
*/
|
|
183
|
-
function initializeHelloCommand(program) {
|
|
184
|
-
var _this = this;
|
|
185
|
-
var helloCommand = program.command('hello');
|
|
186
|
-
helloCommand.description(spaceTrim("\n Just command for testing\n "));
|
|
187
|
-
helloCommand.argument('<name>', 'Your name');
|
|
188
|
-
helloCommand.option('-g, --greeting <greeting>', "Greeting", 'Hello');
|
|
189
|
-
helloCommand.action(function (name, _a) {
|
|
190
|
-
var greeting = _a.greeting;
|
|
191
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
192
|
-
return __generator(this, function (_b) {
|
|
193
|
-
switch (_b.label) {
|
|
194
|
-
case 0:
|
|
195
|
-
console.info(colors.cyan("".concat(greeting, " ").concat(name)));
|
|
196
|
-
return [4 /*yield*/, forTime(1000)];
|
|
197
|
-
case 1:
|
|
198
|
-
_b.sent();
|
|
199
|
-
console.info(colors.rainbow("Nice to meet you!"));
|
|
200
|
-
process.exit(0);
|
|
201
|
-
return [2 /*return*/];
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
209
|
-
*/
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Converts PipelineCollection to serialized JSON
|
|
213
|
-
*
|
|
214
|
-
* Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
|
|
215
|
-
*
|
|
216
|
-
* @public exported from `@promptbook/core`
|
|
217
|
-
*/
|
|
218
|
-
function collectionToJson(collection) {
|
|
219
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
-
var pipelineUrls, promptbooks;
|
|
221
|
-
return __generator(this, function (_a) {
|
|
222
|
-
switch (_a.label) {
|
|
223
|
-
case 0: return [4 /*yield*/, collection.listPipelines()];
|
|
224
|
-
case 1:
|
|
225
|
-
pipelineUrls = _a.sent();
|
|
226
|
-
return [4 /*yield*/, Promise.all(pipelineUrls.map(function (url) { return collection.getPipelineByUrl(url); }))];
|
|
227
|
-
case 2:
|
|
228
|
-
promptbooks = _a.sent();
|
|
229
|
-
return [2 /*return*/, promptbooks];
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
|
|
236
|
-
*/
|
|
237
|
-
|
|
238
178
|
/**
|
|
239
179
|
* @@@
|
|
240
180
|
*
|
|
@@ -286,6 +226,14 @@ function deepFreezeWithSameType(objectValue) {
|
|
|
286
226
|
* @private within the repository
|
|
287
227
|
*/
|
|
288
228
|
var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so that any manual changes will be overwritten";
|
|
229
|
+
/**
|
|
230
|
+
* Claim for the Promptbook
|
|
231
|
+
*
|
|
232
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
233
|
+
*
|
|
234
|
+
* @public exported from `@promptbook/core`
|
|
235
|
+
*/
|
|
236
|
+
var CLAIM = "Supercharge LLM models with Promptbook";
|
|
289
237
|
/**
|
|
290
238
|
* Warning message for the generated sections and files files
|
|
291
239
|
*
|
|
@@ -363,6 +311,91 @@ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
|
363
311
|
*/
|
|
364
312
|
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
365
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Initializes `about` command for Promptbook CLI utilities
|
|
316
|
+
*
|
|
317
|
+
* @private internal function of `promptbookCli`
|
|
318
|
+
*/
|
|
319
|
+
function initializeAboutCommand(program) {
|
|
320
|
+
var _this = this;
|
|
321
|
+
var makeCommand = program.command('about');
|
|
322
|
+
makeCommand.description(spaceTrim("\n Tells about Promptbook CLI and its abilities\n "));
|
|
323
|
+
makeCommand.action(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
324
|
+
return __generator(this, function (_a) {
|
|
325
|
+
console.info(colors.cyan("Promptbook"));
|
|
326
|
+
console.info(colors.cyan(CLAIM));
|
|
327
|
+
console.info(colors.cyan("Version: ".concat(PROMPTBOOK_VERSION)));
|
|
328
|
+
console.info(colors.cyan("https://ptbk.io"));
|
|
329
|
+
process.exit(0);
|
|
330
|
+
return [2 /*return*/];
|
|
331
|
+
});
|
|
332
|
+
}); });
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
336
|
+
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Initializes testing `hello` command for Promptbook CLI utilities
|
|
341
|
+
*
|
|
342
|
+
* @private internal function of `promptbookCli`
|
|
343
|
+
*/
|
|
344
|
+
function initializeHelloCommand(program) {
|
|
345
|
+
var _this = this;
|
|
346
|
+
var helloCommand = program.command('hello');
|
|
347
|
+
helloCommand.description(spaceTrim("\n Just command for testing\n "));
|
|
348
|
+
helloCommand.argument('[name]', 'Your name', 'Paul');
|
|
349
|
+
helloCommand.option('-g, --greeting <greeting>', "Greeting", 'Hello');
|
|
350
|
+
helloCommand.action(function (name, _a) {
|
|
351
|
+
var greeting = _a.greeting;
|
|
352
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
353
|
+
return __generator(this, function (_b) {
|
|
354
|
+
switch (_b.label) {
|
|
355
|
+
case 0:
|
|
356
|
+
console.info(colors.cyan("".concat(greeting, " ").concat(name)));
|
|
357
|
+
return [4 /*yield*/, forTime(1000)];
|
|
358
|
+
case 1:
|
|
359
|
+
_b.sent();
|
|
360
|
+
console.info(colors.rainbow("Nice to meet you!"));
|
|
361
|
+
process.exit(0);
|
|
362
|
+
return [2 /*return*/];
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
370
|
+
*/
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Converts PipelineCollection to serialized JSON
|
|
374
|
+
*
|
|
375
|
+
* Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
|
|
376
|
+
*
|
|
377
|
+
* @public exported from `@promptbook/core`
|
|
378
|
+
*/
|
|
379
|
+
function collectionToJson(collection) {
|
|
380
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
381
|
+
var pipelineUrls, promptbooks;
|
|
382
|
+
return __generator(this, function (_a) {
|
|
383
|
+
switch (_a.label) {
|
|
384
|
+
case 0: return [4 /*yield*/, collection.listPipelines()];
|
|
385
|
+
case 1:
|
|
386
|
+
pipelineUrls = _a.sent();
|
|
387
|
+
return [4 /*yield*/, Promise.all(pipelineUrls.map(function (url) { return collection.getPipelineByUrl(url); }))];
|
|
388
|
+
case 2:
|
|
389
|
+
promptbooks = _a.sent();
|
|
390
|
+
return [2 /*return*/, promptbooks];
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
|
|
397
|
+
*/
|
|
398
|
+
|
|
366
399
|
/**
|
|
367
400
|
* Prettify the html code
|
|
368
401
|
*
|
|
@@ -806,7 +839,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
806
839
|
});
|
|
807
840
|
}
|
|
808
841
|
|
|
809
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-
|
|
842
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-6",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-6",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.63.0-6",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-6",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.63.0-6",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-6",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.63.0-6",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}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},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### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-6",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
810
843
|
|
|
811
844
|
/**
|
|
812
845
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -7789,7 +7822,9 @@ function initializeMakeCommand(program) {
|
|
|
7789
7822
|
var _this = this;
|
|
7790
7823
|
var makeCommand = program.command('make');
|
|
7791
7824
|
makeCommand.description(spaceTrim("\n Makes a new pipeline collection in given folder\n "));
|
|
7792
|
-
makeCommand.argument('
|
|
7825
|
+
makeCommand.argument('[path]',
|
|
7826
|
+
// <- TODO: [🧟♂️] Unite path to promptbook collection argument
|
|
7827
|
+
'Path to promptbook directory', './promptbook-collection');
|
|
7793
7828
|
makeCommand.option('--project-name', "Name of the project for whom collection is", 'Untitled Promptbook project');
|
|
7794
7829
|
makeCommand.option('-f, --format <format>', spaceTrim("\n Output format of builded collection \"javascript\", \"typescript\" or \"json\"\n\n Note: You can use multiple formats separated by comma\n "), 'javascript' /* <- Note: [🏳🌈] */);
|
|
7795
7830
|
makeCommand.option('--no-validation', "Do not validate logic of pipelines in collection", true);
|
|
@@ -7800,7 +7835,7 @@ function initializeMakeCommand(program) {
|
|
|
7800
7835
|
makeCommand.action(function (path, _a) {
|
|
7801
7836
|
var projectName = _a.projectName, format = _a.format, validation = _a.validation, reloadCache = _a.reloadCache, verbose = _a.verbose, outFile = _a.outFile;
|
|
7802
7837
|
return __awaiter(_this, void 0, void 0, function () {
|
|
7803
|
-
var isCacheReloaded, isVerbose, formats, validations, llmTools, collection, validations_1, validations_1_1, validation_1, _b, _c, pipelineUrl, pipeline, e_1_1, e_2_1, collectionJson, collectionJsonString, saveFile;
|
|
7838
|
+
var isCacheReloaded, isVerbose, formats, validations, llmTools, collection, validations_1, validations_1_1, validation_1, _b, _c, pipelineUrl, pipeline, e_1_1, e_2_1, collectionJson, collectionJsonString, collectionJsonItems, saveFile;
|
|
7804
7839
|
var e_2, _d, e_1, _e;
|
|
7805
7840
|
var _this = this;
|
|
7806
7841
|
return __generator(this, function (_f) {
|
|
@@ -7891,7 +7926,16 @@ function initializeMakeCommand(program) {
|
|
|
7891
7926
|
case 16: return [4 /*yield*/, collectionToJson(collection)];
|
|
7892
7927
|
case 17:
|
|
7893
7928
|
collectionJson = _f.sent();
|
|
7894
|
-
collectionJsonString = stringifyPipelineJson(collectionJson);
|
|
7929
|
+
collectionJsonString = stringifyPipelineJson(collectionJson).trim();
|
|
7930
|
+
collectionJsonItems = (function () {
|
|
7931
|
+
if (collectionJsonString.substring(0, 1) !== '{') {
|
|
7932
|
+
throw new UnexpectedError('Missing { at the beginning of serialized collection');
|
|
7933
|
+
}
|
|
7934
|
+
if (collectionJsonString.substring(-1) !== '}') {
|
|
7935
|
+
throw new UnexpectedError('Missing } at the end of serialized collection');
|
|
7936
|
+
}
|
|
7937
|
+
return spaceTrim(collectionJsonString.substring(1, collectionJsonString.length - 1));
|
|
7938
|
+
})();
|
|
7895
7939
|
saveFile = function (extension, content) { return __awaiter(_this, void 0, void 0, function () {
|
|
7896
7940
|
var filePath;
|
|
7897
7941
|
return __generator(this, function (_a) {
|
|
@@ -7924,14 +7968,14 @@ function initializeMakeCommand(program) {
|
|
|
7924
7968
|
case 19:
|
|
7925
7969
|
if (!(formats.includes('javascript') || formats.includes('js'))) return [3 /*break*/, 21];
|
|
7926
7970
|
formats = formats.filter(function (format) { return format !== 'javascript' && format !== 'js'; });
|
|
7927
|
-
return [4 /*yield*/, saveFile('js', spaceTrim(function (block) { return "\n // ".concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n\n import { createCollectionFromJson } from '@promptbook/core';\n\n /**\n * Pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @private internal cache for `getPipelineCollection`\n */\n let pipelineCollection = null;\n\n\n /**\n * Get pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @returns {PipelineCollection} Library of promptbooks for ").concat(projectName, "\n */\n export function getPipelineCollection(){\n if(pipelineCollection===null){\n pipelineCollection = createCollectionFromJson(").concat(block(
|
|
7971
|
+
return [4 /*yield*/, saveFile('js', spaceTrim(function (block) { return "\n // ".concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n\n import { createCollectionFromJson } from '@promptbook/core';\n\n /**\n * Pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @private internal cache for `getPipelineCollection`\n */\n let pipelineCollection = null;\n\n\n /**\n * Get pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @returns {PipelineCollection} Library of promptbooks for ").concat(projectName, "\n */\n export function getPipelineCollection(){\n if(pipelineCollection===null){\n pipelineCollection = createCollectionFromJson(\n ").concat(block(collectionJsonItems), "\n );\n }\n\n return pipelineCollection;\n }\n "); }))];
|
|
7928
7972
|
case 20:
|
|
7929
7973
|
(_f.sent()) + '\n';
|
|
7930
7974
|
_f.label = 21;
|
|
7931
7975
|
case 21:
|
|
7932
7976
|
if (!(formats.includes('typescript') || formats.includes('ts'))) return [3 /*break*/, 23];
|
|
7933
7977
|
formats = formats.filter(function (format) { return format !== 'typescript' && format !== 'ts'; });
|
|
7934
|
-
return [4 /*yield*/, saveFile('ts', spaceTrim(function (block) { return "\n // ".concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n\n import { createCollectionFromJson } from '@promptbook/core';\n import type { PipelineCollection } from '@promptbook/types';\n\n /**\n * Pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @private internal cache for `getPipelineCollection`\n */\n let pipelineCollection: null | PipelineCollection = null;\n\n\n /**\n * Get pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @returns {PipelineCollection} Library of promptbooks for ").concat(projectName, "\n */\n export function getPipelineCollection(): PipelineCollection{\n if(pipelineCollection===null){\n pipelineCollection = createCollectionFromJson(").concat(block(
|
|
7978
|
+
return [4 /*yield*/, saveFile('ts', spaceTrim(function (block) { return "\n // ".concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n\n import { createCollectionFromJson } from '@promptbook/core';\n import type { PipelineCollection } from '@promptbook/types';\n\n /**\n * Pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @private internal cache for `getPipelineCollection`\n */\n let pipelineCollection: null | PipelineCollection = null;\n\n\n /**\n * Get pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @returns {PipelineCollection} Library of promptbooks for ").concat(projectName, "\n */\n export function getPipelineCollection(): PipelineCollection{\n if(pipelineCollection===null){\n pipelineCollection = createCollectionFromJson(\n ").concat(block(collectionJsonItems), "\n );\n }\n\n return pipelineCollection;\n }\n "); }) + '\n')];
|
|
7935
7979
|
case 22:
|
|
7936
7980
|
_f.sent();
|
|
7937
7981
|
_f.label = 23;
|
|
@@ -7951,6 +7995,7 @@ function initializeMakeCommand(program) {
|
|
|
7951
7995
|
});
|
|
7952
7996
|
}
|
|
7953
7997
|
/**
|
|
7998
|
+
* TODO: Maybe remove this command - "about" command should be enough?
|
|
7954
7999
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
7955
8000
|
* Note: [🟡] This code should never be published outside of `@promptbook/cli`
|
|
7956
8001
|
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
@@ -8157,7 +8202,9 @@ function initializePrettifyCommand(program) {
|
|
|
8157
8202
|
var _this = this;
|
|
8158
8203
|
var prettifyCommand = program.command('prettify');
|
|
8159
8204
|
prettifyCommand.description(spaceTrim("\n Iterates over promptbooks and does multiple enhancing operations on them:\n\n 1) Adds Mermaid graph\n 2) Prettifies the markdown\n "));
|
|
8160
|
-
prettifyCommand.argument('<filesGlob>',
|
|
8205
|
+
prettifyCommand.argument('<filesGlob>',
|
|
8206
|
+
// <- TODO: [🧟♂️] Unite path to promptbook collection argument
|
|
8207
|
+
'Promptbooks to prettify as glob pattern');
|
|
8161
8208
|
prettifyCommand.option('-i, --ignore <glob>', "Ignore as glob pattern");
|
|
8162
8209
|
prettifyCommand.action(function (filesGlob, _a) {
|
|
8163
8210
|
var ignore = _a.ignore;
|
|
@@ -8250,8 +8297,10 @@ function promptbookCli() {
|
|
|
8250
8297
|
}
|
|
8251
8298
|
program = new commander.Command();
|
|
8252
8299
|
program.name('promptbook');
|
|
8300
|
+
program.alias('ptbk');
|
|
8253
8301
|
program.version(PROMPTBOOK_VERSION);
|
|
8254
8302
|
program.description(spaceTrim$1("\n Promptbook utilities for enhancing workflow with promptbooks\n "));
|
|
8303
|
+
initializeAboutCommand(program);
|
|
8255
8304
|
initializeHelloCommand(program);
|
|
8256
8305
|
initializeMakeCommand(program);
|
|
8257
8306
|
initializePrettifyCommand(program);
|