@promptbook/cli 0.81.0-12 โ†’ 0.81.0-14

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 CHANGED
@@ -39,7 +39,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
39
39
  * @generated
40
40
  * @see https://github.com/webgptorg/promptbook
41
41
  */
42
- var PROMPTBOOK_ENGINE_VERSION = '0.81.0-11';
42
+ var PROMPTBOOK_ENGINE_VERSION = '0.81.0-13';
43
43
  /**
44
44
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
45
45
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -308,6 +308,7 @@ var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
308
308
  * @public exported from `@promptbook/core`
309
309
  */
310
310
  var DEFAULT_BOOKS_DIRNAME = './books';
311
+ // <- TODO: [๐Ÿ•] Make also `BOOKS_DIRNAME_ALTERNATIVES`
311
312
  /**
312
313
  * Where to store the cache of executions for promptbook CLI
313
314
  *
@@ -12262,7 +12263,7 @@ function executionReportJsonToString(executionReportJson, options) {
12262
12263
  */
12263
12264
  function $getCompiledBook(tools, pipelineSource, options) {
12264
12265
  return __awaiter(this, void 0, void 0, function () {
12265
- var fs, fetch, filePathRaw, filePath, filePathCandidates, filePathCandidates_1, filePathCandidates_1_1, filePathCandidate, pipelineString, pipelineJson, e_1_1, rootDirname, _loop_1, i, state_1, response_1, pipelineString, pipelineJson;
12266
+ var fs, fetch, filePathRaw, filePath, filePathCandidates, filePathCandidates_1, filePathCandidates_1_1, filePathCandidate, pipelineString, pipelineJson, e_1_1, rootDirnameBase, _loop_1, i, state_1, response_1, pipelineString, pipelineJson;
12266
12267
  var e_1, _a;
12267
12268
  var _this = this;
12268
12269
  return __generator(this, function (_b) {
@@ -12311,13 +12312,20 @@ function $getCompiledBook(tools, pipelineSource, options) {
12311
12312
  return [7 /*endfinally*/];
12312
12313
  case 10:
12313
12314
  if (!isValidPipelineUrl(pipelineSource)) return [3 /*break*/, 14];
12314
- rootDirname = process.cwd();
12315
+ rootDirnameBase = process.cwd();
12315
12316
  _loop_1 = function (i) {
12316
- var collection, pipeline;
12317
+ var rootDirname, collection, pipeline;
12317
12318
  return __generator(this, function (_c) {
12318
12319
  switch (_c.label) {
12319
- case 0: return [4 /*yield*/, createCollectionFromDirectory('./books', tools, __assign({ isRecursive: true, rootDirname: rootDirname }, options))];
12320
+ case 0:
12321
+ rootDirname = join(rootDirnameBase, DEFAULT_BOOKS_DIRNAME /* <- TODO: [๐Ÿ•] Make here more candidates */);
12322
+ return [4 /*yield*/, isDirectoryExisting(rootDirname, fs)];
12320
12323
  case 1:
12324
+ if (!(_c.sent())) {
12325
+ return [2 /*return*/, "continue-up_to_root"];
12326
+ }
12327
+ return [4 /*yield*/, createCollectionFromDirectory(rootDirname, tools, __assign({ isRecursive: true, rootDirname: rootDirname }, options))];
12328
+ case 2:
12321
12329
  collection = _c.sent();
12322
12330
  return [4 /*yield*/, (function () { return __awaiter(_this, void 0, void 0, function () {
12323
12331
  var error_1;
@@ -12338,16 +12346,16 @@ function $getCompiledBook(tools, pipelineSource, options) {
12338
12346
  }
12339
12347
  });
12340
12348
  }); })()];
12341
- case 2:
12349
+ case 3:
12342
12350
  pipeline = _c.sent();
12343
12351
  if (pipeline !== null) {
12344
12352
  return [2 /*return*/, { value: pipeline }];
12345
12353
  }
12346
12354
  // Note: searches recursivelly for books
12347
- if (isPathRoot(rootDirname)) {
12348
- return [2 /*return*/, "break"];
12355
+ if (isPathRoot(rootDirnameBase)) {
12356
+ return [2 /*return*/, "break-up_to_root"];
12349
12357
  }
12350
- rootDirname = join(rootDirname, '..');
12358
+ rootDirnameBase = join(rootDirnameBase, '..');
12351
12359
  return [2 /*return*/];
12352
12360
  }
12353
12361
  });
@@ -12361,8 +12369,10 @@ function $getCompiledBook(tools, pipelineSource, options) {
12361
12369
  state_1 = _b.sent();
12362
12370
  if (typeof state_1 === "object")
12363
12371
  return [2 /*return*/, state_1.value];
12364
- if (state_1 === "break")
12365
- return [3 /*break*/, 14];
12372
+ switch (state_1) {
12373
+ case "break-up_to_root": return [3 /*break*/, 14];
12374
+ case "continue-up_to_root": return [3 /*break*/, 13];
12375
+ }
12366
12376
  _b.label = 13;
12367
12377
  case 13:
12368
12378
  i++;