rhachet 1.5.0 → 1.6.0

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.
@@ -16,3 +16,4 @@ export { getStitch } from '../logic/thread/getStitch';
16
16
  export { enrollThread } from '../logic/role/enrollThread';
17
17
  export { genRoleSkill } from '../logic/role/genRoleSkill';
18
18
  export { genContextStitchTrail } from '../logic/context/genContextStitchTrail';
19
+ export { getTemplatePathByCallerPath } from '../logic/template/getTemplatePathByCallerPath';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.genContextStitchTrail = exports.genRoleSkill = exports.enrollThread = exports.getStitch = exports.genStepImagineViaTemplate = exports.useTemplate = exports.getTemplateVarsFromRoleInherit = exports.getTemplateValFromArtifacts = exports.genTemplate = exports.asStitcherFlat = exports.asStitcher = exports.enweaveOneStitcher = exports.genStitchRoute = exports.genStitchFanout = exports.genStitchCycle = exports.genStitchChoice = void 0;
17
+ exports.getTemplatePathByCallerPath = exports.genContextStitchTrail = exports.genRoleSkill = exports.enrollThread = exports.getStitch = exports.genStepImagineViaTemplate = exports.useTemplate = exports.getTemplateVarsFromRoleInherit = exports.getTemplateValFromArtifacts = exports.genTemplate = exports.asStitcherFlat = exports.asStitcher = exports.enweaveOneStitcher = exports.genStitchRoute = exports.genStitchFanout = exports.genStitchCycle = exports.genStitchChoice = void 0;
18
18
  __exportStar(require("../domain/objects"), exports);
19
19
  var genStitchChoice_1 = require("../logic/weave/compose/genStitchChoice");
20
20
  Object.defineProperty(exports, "genStitchChoice", { enumerable: true, get: function () { return genStitchChoice_1.genStitchChoice; } });
@@ -48,4 +48,6 @@ var genRoleSkill_1 = require("../logic/role/genRoleSkill");
48
48
  Object.defineProperty(exports, "genRoleSkill", { enumerable: true, get: function () { return genRoleSkill_1.genRoleSkill; } });
49
49
  var genContextStitchTrail_1 = require("../logic/context/genContextStitchTrail");
50
50
  Object.defineProperty(exports, "genContextStitchTrail", { enumerable: true, get: function () { return genContextStitchTrail_1.genContextStitchTrail; } });
51
+ var getTemplatePathByCallerPath_1 = require("../logic/template/getTemplatePathByCallerPath");
52
+ Object.defineProperty(exports, "getTemplatePathByCallerPath", { enumerable: true, get: function () { return getTemplatePathByCallerPath_1.getTemplatePathByCallerPath; } });
51
53
  //# sourceMappingURL=sdk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/contract/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAElC,0EAAyE;AAAhE,kHAAA,eAAe,OAAA;AACxB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AACvB,0EAAyE;AAAhE,kHAAA,eAAe,OAAA;AACxB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AAEvB,wEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAE3B,gEAA+D;AAAtD,wGAAA,UAAU,OAAA;AACnB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AAEvB,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AACpB,6FAA4F;AAAnF,0IAAA,2BAA2B,OAAA;AACpC,mGAAkG;AAAzF,gJAAA,8BAA8B,OAAA;AACvC,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AACpB,yFAAwF;AAA/E,sIAAA,yBAAyB,OAAA;AAGlC,uDAAsD;AAA7C,sGAAA,SAAS,OAAA;AAClB,2DAA0D;AAAjD,4GAAA,YAAY,OAAA;AAErB,2DAA0D;AAAjD,4GAAA,YAAY,OAAA;AACrB,gFAA+E;AAAtE,8HAAA,qBAAqB,OAAA"}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/contract/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAElC,0EAAyE;AAAhE,kHAAA,eAAe,OAAA;AACxB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AACvB,0EAAyE;AAAhE,kHAAA,eAAe,OAAA;AACxB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AAEvB,wEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAE3B,gEAA+D;AAAtD,wGAAA,UAAU,OAAA;AACnB,wEAAuE;AAA9D,gHAAA,cAAc,OAAA;AAEvB,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AACpB,6FAA4F;AAAnF,0IAAA,2BAA2B,OAAA;AACpC,mGAAkG;AAAzF,gJAAA,8BAA8B,OAAA;AACvC,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AACpB,yFAAwF;AAA/E,sIAAA,yBAAyB,OAAA;AAGlC,uDAAsD;AAA7C,sGAAA,SAAS,OAAA;AAClB,2DAA0D;AAAjD,4GAAA,YAAY,OAAA;AAErB,2DAA0D;AAAjD,4GAAA,YAAY,OAAA;AACrB,gFAA+E;AAAtE,8HAAA,qBAAqB,OAAA;AAC9B,6FAA4F;AAAnF,0IAAA,2BAA2B,OAAA"}
@@ -0,0 +1,29 @@
1
+ import { PickOne } from 'type-fns';
2
+ /**
3
+ * .what = get the path of the file of the caller of this procedure
4
+ * .why =
5
+ * - automatically and reliably lookup the caller path
6
+ */
7
+ export declare const getCallerFilePath: (input?: {
8
+ /**
9
+ * .what = the distance of the caller to this fn
10
+ * .why = if you compose this fn within another before your target caller, the depth may shift (e.g., for each wrapper, +1, w/ start at 1)
11
+ */
12
+ depth: number;
13
+ }) => string | null;
14
+ /**
15
+ * .what = get the expected path of the template file for a given caller file
16
+ * .why =
17
+ * - template files are typically collocated with their caller file, simply replacing the extension with `.template.md`
18
+ * - this automates that replacement
19
+ */
20
+ export declare const getTemplatePathByCallerPath: (input: PickOne<{
21
+ /**
22
+ * .what = choice to self declare the caller path
23
+ */
24
+ path: string;
25
+ /**
26
+ * .what = choice to auto detect the caller path
27
+ */
28
+ auto: true;
29
+ }>) => string;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getTemplatePathByCallerPath = exports.getCallerFilePath = void 0;
7
+ const helpful_errors_1 = require("helpful-errors");
8
+ const path_1 = __importDefault(require("path"));
9
+ /**
10
+ * .what = get the path of the file of the caller of this procedure
11
+ * .why =
12
+ * - automatically and reliably lookup the caller path
13
+ */
14
+ const getCallerFilePath = (input = { depth: 1 }) => {
15
+ const originalPrepare = Error.prepareStackTrace;
16
+ try {
17
+ Error.prepareStackTrace = (_, stack) => stack;
18
+ const err = new Error();
19
+ const stack = err.stack;
20
+ // stack[0] is this fn, stack[1] is the caller of this fn
21
+ const caller = stack[input.depth]; // note: if wrapped, might need depth = 2; e.g., [0]=getCallerFile, [1]=wrapper, [2]=caller
22
+ if (!caller)
23
+ return null;
24
+ const callerFileName = caller.getFileName();
25
+ return callerFileName ? path_1.default.resolve(callerFileName) : null;
26
+ }
27
+ finally {
28
+ Error.prepareStackTrace = originalPrepare;
29
+ }
30
+ };
31
+ exports.getCallerFilePath = getCallerFilePath;
32
+ /**
33
+ * .what = get the expected path of the template file for a given caller file
34
+ * .why =
35
+ * - template files are typically collocated with their caller file, simply replacing the extension with `.template.md`
36
+ * - this automates that replacement
37
+ */
38
+ const getTemplatePathByCallerPath = (input) => {
39
+ // grab the path; support "auto" for auto detection
40
+ const path = input.auto === true
41
+ ? (0, exports.getCallerFilePath)({ depth: 2 }) ??
42
+ helpful_errors_1.UnexpectedCodePathError.throw('should have been able to get caller file path')
43
+ : input.path;
44
+ // parse dir, name, and ext separately
45
+ const { dir, name } = path_1.default.parse(path);
46
+ // join with a new extension, universally
47
+ return path_1.default.join(dir, `${name}.template.md`);
48
+ };
49
+ exports.getTemplatePathByCallerPath = getTemplatePathByCallerPath;
50
+ //# sourceMappingURL=getTemplatePathByCallerPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTemplatePathByCallerPath.js","sourceRoot":"","sources":["../../../src/logic/template/getTemplatePathByCallerPath.ts"],"names":[],"mappings":";;;;;;AAAA,mDAAyD;AACzD,gDAA2B;AAG3B;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAC/B,QAMI,EAAE,KAAK,EAAE,CAAC,EAAE,EACD,EAAE;IACjB,MAAM,eAAe,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAChD,IAAI,CAAC;QACH,KAAK,CAAC,iBAAiB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC;QAC9C,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAqC,CAAC;QAExD,yDAAyD;QACzD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,2FAA2F;QAC9H,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACzB,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QAC5C,OAAO,cAAc,CAAC,CAAC,CAAC,cAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,CAAC;YAAS,CAAC;QACT,KAAK,CAAC,iBAAiB,GAAG,eAAe,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC;AAvBW,QAAA,iBAAiB,qBAuB5B;AAEF;;;;;GAKG;AACI,MAAM,2BAA2B,GAAG,CACzC,KAUE,EACM,EAAE;IACV,mDAAmD;IACnD,MAAM,IAAI,GACR,KAAK,CAAC,IAAI,KAAK,IAAI;QACjB,CAAC,CAAC,IAAA,yBAAiB,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YAC/B,wCAAuB,CAAC,KAAK,CAC3B,+CAA+C,CAChD;QACH,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;IAEjB,sCAAsC;IACtC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,cAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE1C,yCAAyC;IACzC,OAAO,cAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,cAAc,CAAC,CAAC;AAClD,CAAC,CAAC;AA3BW,QAAA,2BAA2B,+BA2BtC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "rhachet",
3
3
  "author": "ehmpathy",
4
4
  "description": "A framework for reliable, thorough thought. Weave threads of thought via stitches.",
5
- "version": "1.5.0",
5
+ "version": "1.6.0",
6
6
  "repository": "ehmpathy/rhachet",
7
7
  "homepage": "https://github.com/ehmpathy/rhachet",
8
8
  "keywords": [