rhachet 1.15.2 → 1.17.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.
@@ -3,7 +3,7 @@ import type { RoleRegistry } from '../../contract/sdk';
3
3
  /**
4
4
  * .what = adds the "roles init" subcommand to the CLI
5
5
  * .why = executes role initialization commands after linking
6
- * .how = runs Role.inits.exec commands sequentially from cwd
6
+ * .how = runs Role.inits.exec commands sequentially, or a specific init via --command
7
7
  */
8
8
  export declare const invokeRolesInit: ({ command, registries, }: {
9
9
  command: Command;
@@ -3,12 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.invokeRolesInit = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
5
  const assureFindRole_1 = require("../../domain.operations/invoke/assureFindRole");
6
+ const executeInit_1 = require("../../domain.operations/invoke/executeInit");
7
+ const findUniqueInitExecutable_1 = require("../../domain.operations/invoke/findUniqueInitExecutable");
6
8
  const inferRepoByRole_1 = require("../../domain.operations/invoke/inferRepoByRole");
7
9
  const node_child_process_1 = require("node:child_process");
10
+ /**
11
+ * .what = extracts all args after 'init' command from process.argv
12
+ * .why = captures full arg list for passthrough to init script
13
+ */
14
+ const getRawArgsAfterInit = () => {
15
+ const argv = process.argv;
16
+ const initIdx = argv.indexOf('init');
17
+ if (initIdx === -1)
18
+ return [];
19
+ return argv.slice(initIdx + 1);
20
+ };
8
21
  /**
9
22
  * .what = adds the "roles init" subcommand to the CLI
10
23
  * .why = executes role initialization commands after linking
11
- * .how = runs Role.inits.exec commands sequentially from cwd
24
+ * .how = runs Role.inits.exec commands sequentially, or a specific init via --command
12
25
  */
13
26
  const invokeRolesInit = ({ command, registries, }) => {
14
27
  command
@@ -16,7 +29,28 @@ const invokeRolesInit = ({ command, registries, }) => {
16
29
  .description('execute role initialization commands')
17
30
  .option('--repo <slug>', 'the repository slug for the role')
18
31
  .option('--role <slug>', 'the role to initialize')
32
+ .option('--command <slug>', 'a specific init command to run')
33
+ .allowUnknownOption(true)
34
+ .allowExcessArguments(true)
19
35
  .action((opts) => {
36
+ // handle --command mode: run a specific init from linked inits directory
37
+ if (opts.command) {
38
+ const init = (0, findUniqueInitExecutable_1.findUniqueInitExecutable)({
39
+ repoSlug: opts.repo,
40
+ roleSlug: opts.role,
41
+ initSlug: opts.command,
42
+ });
43
+ // log which init will run
44
+ console.log(``);
45
+ console.log(`🔧 init "${init.slug}" from repo=${init.repoSlug} role=${init.roleSlug}`);
46
+ console.log(``);
47
+ // get all args after 'init' for passthrough
48
+ const rawArgs = getRawArgsAfterInit();
49
+ // execute with all args passed through
50
+ (0, executeInit_1.executeInit)({ init, args: rawArgs });
51
+ return;
52
+ }
53
+ // handle run-all mode: run all Role.inits.exec commands
20
54
  if (!opts.role)
21
55
  helpful_errors_1.BadRequestError.throw('--role is required (e.g., --role mechanic)');
22
56
  const role = (0, assureFindRole_1.assureFindRole)({ registries, slug: opts.role });
@@ -1 +1 @@
1
- {"version":3,"file":"invokeRolesInit.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeRolesInit.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAGjD,iFAA8E;AAC9E,mFAAgF;AAEhF,2DAA8C;AAE9C;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,EAC9B,OAAO,EACP,UAAU,GAIX,EAAQ,EAAE;IACT,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,sCAAsC,CAAC;SACnD,MAAM,CAAC,eAAe,EAAE,kCAAkC,CAAC;SAC3D,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC;SACjD,MAAM,CAAC,CAAC,IAAsC,EAAE,EAAE;QACjD,IAAI,CAAC,IAAI,CAAC,IAAI;YACZ,gCAAe,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAEtE,MAAM,IAAI,GAAG,IAAA,+BAAc,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,C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C,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,CAAC,IAAI,mCAAmC,CAAC,CAAC;YACvE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,CAAC,IAAI,gBAAgB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEhB,oCAAoC;QACpC,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;YAC1B,IAAA,6BAAQ,EAAC,GAAG,EAAE;gBACZ,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;gBAClB,KAAK,EAAE,SAAS;gBAChB,KAAK,EAAE,WAAW;aACnB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,IAAI,6BAA6B,CAAC,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AA7EW,QAAA,eAAe,mBA6E1B"}
@@ -3,6 +3,7 @@ export * from '../domain.objects';
3
3
  export { genContextStitchTrail } from '../domain.operations/context/genContextStitchTrail';
4
4
  export { enrollThread } from '../domain.operations/role/enrollThread';
5
5
  export { genRoleSkill } from '../domain.operations/role/genRoleSkill';
6
+ export { getRoleBriefs } from '../domain.operations/role/getRoleBriefs';
6
7
  export type { ContextStitchTrail } from '../domain.operations/stitch/withStitchTrail';
7
8
  export { genStepImagineViaTemplate } from '../domain.operations/template/genStepImagineViaTemplate';
8
9
  export { genTemplate } from '../domain.operations/template/genTemplate';
@@ -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.enweaveOneStitcher = exports.genStitchRoute = exports.genStitchFanout = exports.genStitchCycle = exports.genStitchChoice = exports.asStitcherFlat = exports.asStitcher = exports.getStitch = exports.useTemplate = exports.getTemplateVarsFromRoleInherit = exports.getTemplateValFromArtifacts = exports.getTemplatePathByCallerPath = exports.genTemplate = exports.genStepImagineViaTemplate = exports.genRoleSkill = exports.enrollThread = exports.genContextStitchTrail = exports.withImmute = void 0;
17
+ exports.enweaveOneStitcher = exports.genStitchRoute = exports.genStitchFanout = exports.genStitchCycle = exports.genStitchChoice = exports.asStitcherFlat = exports.asStitcher = exports.getStitch = exports.useTemplate = exports.getTemplateVarsFromRoleInherit = exports.getTemplateValFromArtifacts = exports.getTemplatePathByCallerPath = exports.genTemplate = exports.genStepImagineViaTemplate = exports.getRoleBriefs = exports.genRoleSkill = exports.enrollThread = exports.genContextStitchTrail = exports.withImmute = void 0;
18
18
  var domain_objects_1 = require("domain-objects");
19
19
  Object.defineProperty(exports, "withImmute", { enumerable: true, get: function () { return domain_objects_1.withImmute; } });
20
20
  __exportStar(require("../domain.objects"), exports);
@@ -24,6 +24,8 @@ var enrollThread_1 = require("../domain.operations/role/enrollThread");
24
24
  Object.defineProperty(exports, "enrollThread", { enumerable: true, get: function () { return enrollThread_1.enrollThread; } });
25
25
  var genRoleSkill_1 = require("../domain.operations/role/genRoleSkill");
26
26
  Object.defineProperty(exports, "genRoleSkill", { enumerable: true, get: function () { return genRoleSkill_1.genRoleSkill; } });
27
+ var getRoleBriefs_1 = require("../domain.operations/role/getRoleBriefs");
28
+ Object.defineProperty(exports, "getRoleBriefs", { enumerable: true, get: function () { return getRoleBriefs_1.getRoleBriefs; } });
27
29
  var genStepImagineViaTemplate_1 = require("../domain.operations/template/genStepImagineViaTemplate");
28
30
  Object.defineProperty(exports, "genStepImagineViaTemplate", { enumerable: true, get: function () { return genStepImagineViaTemplate_1.genStepImagineViaTemplate; } });
29
31
  var genTemplate_1 = require("../domain.operations/template/genTemplate");
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/contract/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAAnC,4GAAA,UAAU,OAAA;AAEnB,sDAAoC;AACpC,8FAA6F;AAApF,8HAAA,qBAAqB,OAAA;AAC9B,yEAAwE;AAA/D,4GAAA,YAAY,OAAA;AACrB,yEAAwE;AAA/D,4GAAA,YAAY,OAAA;AAErB,uGAAsG;AAA7F,sIAAA,yBAAyB,OAAA;AAClC,2EAA0E;AAAjE,0GAAA,WAAW,OAAA;AACpB,2GAA0G;AAAjG,0IAAA,2BAA2B,OAAA;AACpC,2GAA0G;AAAjG,0IAAA,2BAA2B,OAAA;AACpC,iHAAgH;AAAvG,gJAAA,8BAA8B,OAAA;AACvC,2EAA0E;AAAjE,0GAAA,WAAW,OAAA;AACpB,qEAAoE;AAA3D,sGAAA,SAAS,OAAA;AAClB,8EAA6E;AAApE,wGAAA,UAAU,OAAA;AACnB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,wFAAuF;AAA9E,kHAAA,eAAe,OAAA;AACxB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,wFAAuF;AAA9E,kHAAA,eAAe,OAAA;AACxB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,sFAAqF;AAA5E,wHAAA,kBAAkB,OAAA"}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/contract/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAAnC,4GAAA,UAAU,OAAA;AAEnB,sDAAoC;AACpC,8FAA6F;AAApF,8HAAA,qBAAqB,OAAA;AAC9B,yEAAwE;AAA/D,4GAAA,YAAY,OAAA;AACrB,yEAAwE;AAA/D,4GAAA,YAAY,OAAA;AACrB,2EAA0E;AAAjE,8GAAA,aAAa,OAAA;AAEtB,uGAAsG;AAA7F,sIAAA,yBAAyB,OAAA;AAClC,2EAA0E;AAAjE,0GAAA,WAAW,OAAA;AACpB,2GAA0G;AAAjG,0IAAA,2BAA2B,OAAA;AACpC,2GAA0G;AAAjG,0IAAA,2BAA2B,OAAA;AACpC,iHAAgH;AAAvG,gJAAA,8BAA8B,OAAA;AACvC,2EAA0E;AAAjE,0GAAA,WAAW,OAAA;AACpB,qEAAoE;AAA3D,sGAAA,SAAS,OAAA;AAClB,8EAA6E;AAApE,wGAAA,UAAU,OAAA;AACnB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,wFAAuF;AAA9E,kHAAA,eAAe,OAAA;AACxB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,wFAAuF;AAA9E,kHAAA,eAAe,OAAA;AACxB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,sFAAqF;AAA5E,wHAAA,kBAAkB,OAAA"}
@@ -0,0 +1,29 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ /**
3
+ * .what = represents a discovered executable init file from a role directory
4
+ * .why = enables init discovery and execution via `rhachet roles init --command`
5
+ */
6
+ export interface RoleInitExecutable {
7
+ /**
8
+ * .what = init identifier derived from relative path
9
+ * .example = "claude.hooks/sessionstart.notify-permissions", "init.claude"
10
+ */
11
+ slug: string;
12
+ /**
13
+ * .what = absolute path to the executable file
14
+ */
15
+ path: string;
16
+ /**
17
+ * .what = the repo (registry) this init belongs to
18
+ * .example = "ehmpathy", ".this"
19
+ */
20
+ repoSlug: string;
21
+ /**
22
+ * .what = the role this init belongs to
23
+ * .example = "mechanic", "designer"
24
+ */
25
+ roleSlug: string;
26
+ }
27
+ export declare class RoleInitExecutable extends DomainLiteral<RoleInitExecutable> implements RoleInitExecutable {
28
+ static unique: readonly ["repoSlug", "roleSlug", "slug"];
29
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RoleInitExecutable = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class RoleInitExecutable extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.RoleInitExecutable = RoleInitExecutable;
8
+ RoleInitExecutable.unique = ['repoSlug', 'roleSlug', 'slug'];
9
+ //# sourceMappingURL=RoleInitExecutable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoleInitExecutable.js","sourceRoot":"","sources":["../../src/domain.objects/RoleInitExecutable.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AA8B/C,MAAa,kBACX,SAAQ,8BAAiC;;AAD3C,gDAKC;AADe,yBAAM,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { RoleInitExecutable } from '../../domain.objects/RoleInitExecutable';
2
+ /**
3
+ * .what = discovers executable init files from linked role directories
4
+ * .why = enables `rhachet roles init --command` to find and execute inits
5
+ */
6
+ export declare const discoverInitExecutables: (input: {
7
+ repoSlug?: string;
8
+ roleSlug?: string;
9
+ initSlug?: string;
10
+ }) => RoleInitExecutable[];
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.discoverInitExecutables = void 0;
4
+ const RoleInitExecutable_1 = require("../../domain.objects/RoleInitExecutable");
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ /**
8
+ * .what = recursively finds all executable files in a directory
9
+ * .why = inits can be nested in subdirectories (e.g., claude.hooks/)
10
+ */
11
+ const getAllFilesFromDir = (dir) => {
12
+ // skip if directory does not exist
13
+ if (!(0, node_fs_1.existsSync)(dir))
14
+ return [];
15
+ const entries = (0, node_fs_1.readdirSync)(dir);
16
+ const files = [];
17
+ for (const entry of entries) {
18
+ const fullPath = (0, node_path_1.resolve)(dir, entry);
19
+ const stats = (0, node_fs_1.statSync)(fullPath);
20
+ if (stats.isDirectory()) {
21
+ files.push(...getAllFilesFromDir(fullPath));
22
+ }
23
+ else if (stats.isFile()) {
24
+ files.push(fullPath);
25
+ }
26
+ }
27
+ return files;
28
+ };
29
+ /**
30
+ * .what = extracts init slug from relative path
31
+ * .why = init slug must include subdirectory path (e.g., "claude.hooks/sessionstart.notify-permissions")
32
+ */
33
+ const extractSlugFromPath = (input) => {
34
+ // get path relative to inits directory
35
+ const relativePath = (0, node_path_1.relative)(input.initsDir, input.filePath);
36
+ // remove .sh extension if present
37
+ if (relativePath.endsWith('.sh'))
38
+ return relativePath.slice(0, -3);
39
+ return relativePath;
40
+ };
41
+ /**
42
+ * .what = discovers executable init files from linked role directories
43
+ * .why = enables `rhachet roles init --command` to find and execute inits
44
+ */
45
+ const discoverInitExecutables = (input) => {
46
+ const agentDir = (0, node_path_1.resolve)(process.cwd(), '.agent');
47
+ // skip if .agent directory does not exist
48
+ if (!(0, node_fs_1.existsSync)(agentDir))
49
+ return [];
50
+ // discover repo directories
51
+ const repoEntries = (0, node_fs_1.readdirSync)(agentDir).filter((entry) => entry.startsWith('repo='));
52
+ const inits = [];
53
+ for (const repoEntry of repoEntries) {
54
+ const repoSlug = repoEntry.replace('repo=', '');
55
+ // filter by repoSlug if specified
56
+ if (input.repoSlug && repoSlug !== input.repoSlug)
57
+ continue;
58
+ const repoDir = (0, node_path_1.resolve)(agentDir, repoEntry);
59
+ // discover role directories
60
+ const roleEntries = (0, node_fs_1.readdirSync)(repoDir).filter((entry) => entry.startsWith('role='));
61
+ for (const roleEntry of roleEntries) {
62
+ const roleSlug = roleEntry.replace('role=', '');
63
+ // filter by roleSlug if specified
64
+ if (input.roleSlug && roleSlug !== input.roleSlug)
65
+ continue;
66
+ const initsDir = (0, node_path_1.resolve)(repoDir, roleEntry, 'inits');
67
+ // get all files from inits directory
68
+ const initFiles = getAllFilesFromDir(initsDir);
69
+ for (const initPath of initFiles) {
70
+ const slug = extractSlugFromPath({ initsDir, filePath: initPath });
71
+ // filter by initSlug if specified
72
+ if (input.initSlug && slug !== input.initSlug)
73
+ continue;
74
+ inits.push(new RoleInitExecutable_1.RoleInitExecutable({
75
+ slug,
76
+ path: initPath,
77
+ repoSlug,
78
+ roleSlug,
79
+ }));
80
+ }
81
+ }
82
+ }
83
+ return inits;
84
+ };
85
+ exports.discoverInitExecutables = discoverInitExecutables;
86
+ //# sourceMappingURL=discoverInitExecutables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discoverInitExecutables.js","sourceRoot":"","sources":["../../../src/domain.operations/invoke/discoverInitExecutables.ts"],"names":[],"mappings":";;;AAAA,+EAA4E;AAE5E,qCAA4D;AAC5D,yCAA8C;AAE9C;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAY,EAAE;IACnD,mCAAmC;IACnC,IAAI,CAAC,IAAA,oBAAU,EAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAEhC,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC;IACjC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAA,mBAAO,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC,QAAQ,CAAC,CAAC;QAEjC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CA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BAAW,EAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CACxD,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAC1B,CAAC;QAEF,KAAK,MAAM,SAAS,IAAI,WAAW,EAAE,CAAC;YACpC,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAEhD,kCAAkC;YAClC,IAAI,KAAK,CAAC,QAAQ,IAAI,QAAQ,KAAK,KAAK,CAAC,QAAQ;gBAAE,SAAS;YAE5D,MAAM,QAAQ,GAAG,IAAA,mBAAO,EAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAEtD,qCAAqC;YACrC,MAAM,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAE/C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,MAAM,IAAI,GAAG,mBAAmB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAEnE,kCAAkC;gBAClC,IAAI,KAAK,CAAC,QAAQ,IAAI,IAAI,KAAK,KAAK,CAAC,QAAQ;oBAAE,SAAS;gBAExD,KAAK,CAAC,IAAI,CACR,IAAI,uCAAkB,CAAC;oBACrB,IAAI;oBACJ,IAAI,EAAE,QAAQ;oBACd,QAAQ;oBACR,QAAQ;iBACT,CAAC,CACH,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AA5DW,QAAA,uBAAuB,2BA4DlC"}
@@ -0,0 +1,9 @@
1
+ import type { RoleInitExecutable } from '../../domain.objects/RoleInitExecutable';
2
+ /**
3
+ * .what = executes an init script with passthrough args
4
+ * .why = runs the discovered init with full arg passthrough
5
+ */
6
+ export declare const executeInit: (input: {
7
+ init: RoleInitExecutable;
8
+ args: string[];
9
+ }) => void;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeInit = void 0;
4
+ const node_child_process_1 = require("node:child_process");
5
+ /**
6
+ * .what = executes an init script with passthrough args
7
+ * .why = runs the discovered init with full arg passthrough
8
+ */
9
+ const executeInit = (input) => {
10
+ // build command with args
11
+ const command = [input.init.path, ...input.args]
12
+ .map((arg) => {
13
+ // quote args with spaces
14
+ if (arg.includes(' '))
15
+ return `"${arg}"`;
16
+ return arg;
17
+ })
18
+ .join(' ');
19
+ // execute with inherited stdio
20
+ (0, node_child_process_1.execSync)(command, {
21
+ cwd: process.cwd(),
22
+ stdio: 'inherit',
23
+ shell: '/bin/bash',
24
+ });
25
+ };
26
+ exports.executeInit = executeInit;
27
+ //# sourceMappingURL=executeInit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeInit.js","sourceRoot":"","sources":["../../../src/domain.operations/invoke/executeInit.ts"],"names":[],"mappings":";;;AAEA,2DAA8C;AAE9C;;;GAGG;AACI,MAAM,WAAW,GAAG,CAAC,KAG3B,EAAQ,EAAE;IACT,0BAA0B;IAC1B,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;SAC7C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,yBAAyB;QACzB,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,GAAG,GAAG,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,+BAA+B;IAC/B,IAAA,6BAAQ,EAAC,OAAO,EAAE;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,WAAW;KACnB,CAAC,CAAC;AACL,CAAC,CAAC;AAnBW,QAAA,WAAW,eAmBtB"}
@@ -0,0 +1,10 @@
1
+ import type { RoleInitExecutable } from '../../domain.objects/RoleInitExecutable';
2
+ /**
3
+ * .what = finds exactly one init executable by slug, with optional repo/role filters
4
+ * .why = ensures unambiguous init resolution before execution
5
+ */
6
+ export declare const findUniqueInitExecutable: (input: {
7
+ repoSlug?: string;
8
+ roleSlug?: string;
9
+ initSlug: string;
10
+ }) => RoleInitExecutable;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findUniqueInitExecutable = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ const discoverInitExecutables_1 = require("./discoverInitExecutables");
6
+ /**
7
+ * .what = finds exactly one init executable by slug, with optional repo/role filters
8
+ * .why = ensures unambiguous init resolution before execution
9
+ */
10
+ const findUniqueInitExecutable = (input) => {
11
+ // discover inits with filters
12
+ const matches = (0, discoverInitExecutables_1.discoverInitExecutables)({
13
+ repoSlug: input.repoSlug,
14
+ roleSlug: input.roleSlug,
15
+ initSlug: input.initSlug,
16
+ });
17
+ // handle no matches
18
+ if (matches.length === 0) {
19
+ const filters = [
20
+ input.repoSlug ? `--repo ${input.repoSlug}` : null,
21
+ input.roleSlug ? `--role ${input.roleSlug}` : null,
22
+ ]
23
+ .filter(Boolean)
24
+ .join(' ');
25
+ const hint = filters
26
+ ? `no init "${input.initSlug}" found with ${filters}`
27
+ : `no init "${input.initSlug}" found in any linked role`;
28
+ // discover all available inits to show suggestions
29
+ const allInits = (0, discoverInitExecutables_1.discoverInitExecutables)({
30
+ repoSlug: input.repoSlug,
31
+ roleSlug: input.roleSlug,
32
+ });
33
+ const suggestions = allInits.length > 0
34
+ ? `\n\navailable inits:\n${allInits
35
+ .slice(0, 5)
36
+ .map((s) => ` - ${s.slug} (repo=${s.repoSlug} role=${s.roleSlug})`)
37
+ .join('\n')}${allInits.length > 5 ? `\n ... and ${allInits.length - 5} more` : ''}`
38
+ : '';
39
+ const tip = `\n\ntip: did you \`npx rhachet roles link\` the --role this init comes from?`;
40
+ helpful_errors_1.BadRequestError.throw(`${hint}${suggestions}${tip}`, { input });
41
+ }
42
+ // handle multiple matches
43
+ if (matches.length > 1) {
44
+ const matchList = matches
45
+ .map((m) => ` - repo=${m.repoSlug} role=${m.roleSlug}`)
46
+ .join('\n');
47
+ helpful_errors_1.BadRequestError.throw(`multiple inits found for "${input.initSlug}":\n${matchList}\n\nuse --repo and/or --role to disambiguate`, { input, matches });
48
+ }
49
+ // return unique match
50
+ return matches[0];
51
+ };
52
+ exports.findUniqueInitExecutable = findUniqueInitExecutable;
53
+ //# sourceMappingURL=findUniqueInitExecutable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findUniqueInitExecutable.js","sourceRoot":"","sources":["../../../src/domain.operations/invoke/findUniqueInitExecutable.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAIjD,uEAAoE;AAEpE;;;GAGG;AACI,MAAM,wBAAwB,GAAG,CAAC,KAIxC,EAAsB,EAAE;IACvB,8BAA8B;IAC9B,MAAM,OAAO,GAAG,IAAA,iDAAuB,EAAC;QACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IAEH,oBAAoB;IACpB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG;YACd,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI;YAClD,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI;SACnD;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,MAAM,IAAI,GAAG,OAAO;YAClB,CAAC,CAAC,YAAY,KAAK,CAAC,QAAQ,gBAAgB,OAAO,EAAE;YACrD,CAA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AO,CAAC,CAAC,CAAE,CAAC;AACrB,CAAC,CAAC;AA3DW,QAAA,wBAAwB,4BA2DnC"}
@@ -0,0 +1,24 @@
1
+ import type { Artifact } from 'rhachet-artifact';
2
+ import { type GitFile } from 'rhachet-artifact-git';
3
+ /**
4
+ * .what = finds and returns briefs from a linked role directory as lazy-loadable artifacts
5
+ * .why = enables role composition by allowing procedures to programmatically access briefs
6
+ *
7
+ * .note = this procedure looks into `.agent/*` directories for linked roles.
8
+ * if you just wrote a brief in the repo the role is defined in,
9
+ * you must run `npm run build && npx rhachet roles link` before it can be used.
10
+ */
11
+ export declare const getRoleBriefs: (input: {
12
+ by: {
13
+ role: {
14
+ name: string;
15
+ };
16
+ repo?: {
17
+ name: string;
18
+ };
19
+ briefs: {
20
+ name?: string[];
21
+ glob?: string;
22
+ };
23
+ };
24
+ }) => Promise<Artifact<typeof GitFile>[]>;
@@ -0,0 +1,95 @@
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.getRoleBriefs = void 0;
7
+ const fast_glob_1 = __importDefault(require("fast-glob"));
8
+ const helpful_errors_1 = require("helpful-errors");
9
+ const rhachet_artifact_git_1 = require("rhachet-artifact-git");
10
+ const node_fs_1 = require("node:fs");
11
+ const node_path_1 = require("node:path");
12
+ /**
13
+ * .what = finds and returns briefs from a linked role directory as lazy-loadable artifacts
14
+ * .why = enables role composition by allowing procedures to programmatically access briefs
15
+ *
16
+ * .note = this procedure looks into `.agent/*` directories for linked roles.
17
+ * if you just wrote a brief in the repo the role is defined in,
18
+ * you must run `npm run build && npx rhachet roles link` before it can be used.
19
+ */
20
+ const getRoleBriefs = async (input) => {
21
+ // resolve agent directory
22
+ const dirAgent = (0, node_path_1.resolve)(process.cwd(), '.agent');
23
+ if (!(0, node_fs_1.existsSync)(dirAgent))
24
+ throw new helpful_errors_1.BadRequestError('no .agent directory found. did you forget to `npx rhachet roles link`?');
25
+ // scan for repo directories
26
+ const dirsRepo = (0, node_fs_1.readdirSync)(dirAgent)
27
+ .filter((d) => d.startsWith('repo='))
28
+ .map((d) => ({ slug: d.replace('repo=', ''), path: (0, node_path_1.resolve)(dirAgent, d) }));
29
+ const rolesMatching = [];
30
+ for (const dirRepo of dirsRepo) {
31
+ // filter by repo if specified
32
+ if (input.by.repo?.name && dirRepo.slug !== input.by.repo.name)
33
+ continue;
34
+ // scan for role directories matching the requested name
35
+ const dirsRole = (0, node_fs_1.readdirSync)(dirRepo.path)
36
+ .filter((d) => d.startsWith('role='))
37
+ .filter((d) => d.replace('role=', '') === input.by.role.name);
38
+ // collect matching roles
39
+ for (const dirRole of dirsRole) {
40
+ const pathRole = (0, node_path_1.resolve)(dirRepo.path, dirRole);
41
+ rolesMatching.push({
42
+ slugRepo: dirRepo.slug,
43
+ slugRole: input.by.role.name,
44
+ pathRole,
45
+ pathBriefs: (0, node_path_1.resolve)(pathRole, 'briefs'),
46
+ });
47
+ }
48
+ }
49
+ // reject if no matching role found
50
+ if (rolesMatching.length === 0)
51
+ throw new helpful_errors_1.BadRequestError(`role "${input.by.role.name}" not found in .agent/ directory. did you forget to \`npx rhachet roles link --role ${input.by.role.name}\`?`);
52
+ // reject if multiple roles match without disambiguation
53
+ if (rolesMatching.length > 1) {
54
+ const locations = rolesMatching
55
+ .map((r) => ` - repo=${r.slugRepo}`)
56
+ .join('\n');
57
+ throw new helpful_errors_1.BadRequestError(`multiple roles found with name "${input.by.role.name}":\n${locations}\n\nuse by.repo.name to disambiguate`);
58
+ }
59
+ // extract the single matching role
60
+ const roleLinked = rolesMatching[0];
61
+ // reject if briefs directory doesn't exist
62
+ if (!(0, node_fs_1.existsSync)(roleLinked.pathBriefs))
63
+ throw new helpful_errors_1.BadRequestError(`briefs directory not found for role "${roleLinked.slugRole}" in repo="${roleLinked.slugRepo}". ` +
64
+ `did you forget to \`npx rhachet roles link --role ${roleLinked.slugRole}\`? ` +
65
+ `(if you just wrote a brief, run: npm run build && npx rhachet roles link)`);
66
+ // match briefs by name or glob
67
+ const pathsBrief = [];
68
+ if (input.by.briefs.name?.length) {
69
+ // exact name matching
70
+ for (const name of input.by.briefs.name) {
71
+ const pathsMatching = await (0, fast_glob_1.default)(`**/${name}*`, {
72
+ cwd: roleLinked.pathBriefs,
73
+ absolute: true,
74
+ onlyFiles: true,
75
+ });
76
+ if (pathsMatching.length === 0)
77
+ throw new helpful_errors_1.BadRequestError(`brief "${name}" not found in role "${roleLinked.slugRole}" (repo="${roleLinked.slugRepo}")`);
78
+ pathsBrief.push(...pathsMatching);
79
+ }
80
+ }
81
+ else if (input.by.briefs.glob) {
82
+ // glob pattern matching
83
+ const pathsMatching = await (0, fast_glob_1.default)(input.by.briefs.glob, {
84
+ cwd: roleLinked.pathBriefs,
85
+ absolute: true,
86
+ onlyFiles: true,
87
+ });
88
+ pathsBrief.push(...pathsMatching);
89
+ }
90
+ // dedupe and create artifacts
91
+ const pathsUnique = [...new Set(pathsBrief)];
92
+ return pathsUnique.map((uri) => (0, rhachet_artifact_git_1.genArtifactGitFile)({ uri }));
93
+ };
94
+ exports.getRoleBriefs = getRoleBriefs;
95
+ //# sourceMappingURL=getRoleBriefs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRoleBriefs.js","sourceRoot":"","sources":["../../../src/domain.operations/role/getRoleBriefs.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,mDAAiD;AAEjD,+DAAwE;AAExE,qCAAkD;AAClD,yCAAoC;AAEpC;;;;;;;GAOG;AACI,MAAM,aAAa,GAAG,KAAK,EAAE,KAMnC,EAAuC,EAAE;IACxC,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAI,CAAC,IAAA,oBAAU,EAAC,QAAQ,CAAC;QACvB,MAAM,IAAI,gCAAe,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;YACxC,MAAM,aAAa,GAAG,MAAM,IAAA,mBAAI,EAAC,MAAM,IAAI,GAAG,EAAE;gBAC9C,GAAG,EAAE,UAAU,CAAC,UAAU;gBAC1B,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YACH,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;gBAC5B,MAAM,IAAI,gCAAe,CACvB,UAAU,IAAI,wBAAwB,UAAU,CAAC,QAAQ,YAAY,UAAU,CAAC,QAAQ,IAAI,CAC7F,CAAC;YACJ,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;SAAM,IAAI,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAChC,wBAAwB;QACxB,MAAM,aAAa,GAAG,MAAM,IAAA,mBAAI,EAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE;YACrD,GAAG,EAAE,UAAU,CAAC,UAAU;YAC1B,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;IACpC,CAAC;IAED,8BAA8B;IAC9B,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,yCAAkB,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC;AAxGW,QAAA,aAAa,iBAwGxB"}
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.15.2",
5
+ "version": "1.17.0",
6
6
  "repository": "ehmpathy/rhachet",
7
7
  "homepage": "https://github.com/ehmpathy/rhachet",
8
8
  "keywords": [
@@ -51,7 +51,7 @@
51
51
  "postversion": "git push origin HEAD --tags --no-verify",
52
52
  "prepare:husky": "husky install && chmod ug+x .husky/*",
53
53
  "prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi",
54
- "prepare:rhachet": "rhachet init && rhachet roles link --role mechanic && .agent/repo=ehmpathy/role=mechanic/skills/.skills/init.claude.sh"
54
+ "prepare:rhachet": "rhachet init && rhachet roles link --repo ehmpathy --role mechanic && rhachet roles link --repo bhuild --role behaver && rhachet roles link --repo bhrain --role reviewer && rhachet roles init --role mechanic && rhachet roles init --role behaver"
55
55
  },
56
56
  "dependencies": {
57
57
  "@ehmpathy/uni-time": "1.9.0",
@@ -89,8 +89,10 @@
89
89
  "esbuild-register": "3.6.0",
90
90
  "husky": "8.0.3",
91
91
  "jest": "30.2.0",
92
- "rhachet": "1.13.11",
93
- "rhachet-roles-ehmpathy": "1.15.12",
92
+ "rhachet": "1.15.2",
93
+ "rhachet-roles-bhrain": "0.5.5",
94
+ "rhachet-roles-bhuild": "0.4.2",
95
+ "rhachet-roles-ehmpathy": "1.15.21",
94
96
  "test-fns": "1.7.0",
95
97
  "tsc-alias": "1.8.10",
96
98
  "tsx": "~4.20.6",