rhachet 1.15.1 → 1.16.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.
- package/dist/contract/cli/invokeList.js +36 -15
- package/dist/contract/cli/invokeList.js.map +1 -1
- package/dist/contract/cli/invokeReadme.js +8 -8
- package/dist/contract/cli/invokeReadme.js.map +1 -1
- package/dist/contract/cli/invokeRolesInit.d.ts +1 -1
- package/dist/contract/cli/invokeRolesInit.js +35 -1
- package/dist/contract/cli/invokeRolesInit.js.map +1 -1
- package/dist/domain.objects/RoleInitExecutable.d.ts +29 -0
- package/dist/domain.objects/RoleInitExecutable.js +9 -0
- package/dist/domain.objects/RoleInitExecutable.js.map +1 -0
- package/dist/domain.operations/invoke/discoverInitExecutables.d.ts +10 -0
- package/dist/domain.operations/invoke/discoverInitExecutables.js +86 -0
- package/dist/domain.operations/invoke/discoverInitExecutables.js.map +1 -0
- package/dist/domain.operations/invoke/executeInit.d.ts +9 -0
- package/dist/domain.operations/invoke/executeInit.js +27 -0
- package/dist/domain.operations/invoke/executeInit.js.map +1 -0
- package/dist/domain.operations/invoke/findUniqueInitExecutable.d.ts +10 -0
- package/dist/domain.operations/invoke/findUniqueInitExecutable.js +53 -0
- package/dist/domain.operations/invoke/findUniqueInitExecutable.js.map +1 -0
- package/package.json +5 -3
|
@@ -11,36 +11,57 @@ const invokeList = ({ program, registries, }) => {
|
|
|
11
11
|
program
|
|
12
12
|
.command('list')
|
|
13
13
|
.description('list available roles or skills under a role')
|
|
14
|
-
.option('--
|
|
15
|
-
.option('--role <slug>', 'list skills under this role (
|
|
14
|
+
.option('--repo <slug>', 'list roles under this repo')
|
|
15
|
+
.option('--role <slug>', 'list skills under this role (repo optional)')
|
|
16
16
|
.action((opts) => {
|
|
17
|
+
// list skills for a specific role
|
|
17
18
|
if (opts.role) {
|
|
18
19
|
const role = (0, assureFindRole_1.assureFindRole)({ registries, slug: opts.role });
|
|
19
20
|
if (!role)
|
|
20
21
|
helpful_errors_1.BadRequestError.throw(`no role named "${opts.role}"`);
|
|
21
22
|
console.log(``);
|
|
22
|
-
console.log(`📖 ${role.slug}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
console.log(`📖 ${role.slug}`);
|
|
24
|
+
const skills = role.skills.refs;
|
|
25
|
+
for (let i = 0; i < skills.length; i++) {
|
|
26
|
+
const isLast = i === skills.length - 1;
|
|
27
|
+
const prefix = isLast ? '└── ' : '├── ';
|
|
28
|
+
console.log(`${prefix}${skills[i].slug}`);
|
|
29
|
+
}
|
|
25
30
|
console.log(``);
|
|
26
31
|
return;
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
// list roles for a specific repo
|
|
34
|
+
if (opts.repo) {
|
|
35
|
+
const registry = registries.find((r) => r.slug === opts.repo);
|
|
30
36
|
if (!registry)
|
|
31
|
-
helpful_errors_1.BadRequestError.throw(`no
|
|
37
|
+
helpful_errors_1.BadRequestError.throw(`no repo named "${opts.repo}"`);
|
|
32
38
|
console.log(``);
|
|
33
|
-
console.log(`📖 ${registry.slug}
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
console.log(`📖 ${registry.slug}`);
|
|
40
|
+
const roles = registry.roles;
|
|
41
|
+
for (let i = 0; i < roles.length; i++) {
|
|
42
|
+
const isLast = i === roles.length - 1;
|
|
43
|
+
const prefix = isLast ? '└── ' : '├── ';
|
|
44
|
+
console.log(`${prefix}${roles[i].slug}: ${roles[i].purpose}`);
|
|
45
|
+
}
|
|
36
46
|
console.log(``);
|
|
37
47
|
return;
|
|
38
48
|
}
|
|
49
|
+
// list all repos and roles
|
|
39
50
|
console.log(``);
|
|
40
|
-
console.log(`📖
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
console.log(`📖 repos`);
|
|
52
|
+
for (let i = 0; i < registries.length; i++) {
|
|
53
|
+
const registry = registries[i];
|
|
54
|
+
const isLastRegistry = i === registries.length - 1;
|
|
55
|
+
const registryPrefix = isLastRegistry ? '└── ' : '├── ';
|
|
56
|
+
const childPrefix = isLastRegistry ? ' ' : '│ ';
|
|
57
|
+
console.log(`${registryPrefix}${registry.slug}`);
|
|
58
|
+
const roles = registry.roles;
|
|
59
|
+
for (let j = 0; j < roles.length; j++) {
|
|
60
|
+
const isLastRole = j === roles.length - 1;
|
|
61
|
+
const rolePrefix = isLastRole ? '└── ' : '├── ';
|
|
62
|
+
console.log(`${childPrefix}${rolePrefix}${roles[j].slug}: ${roles[j].purpose}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
44
65
|
console.log(``);
|
|
45
66
|
});
|
|
46
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invokeList.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeList.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAGjD,iFAA8E;AAE9E;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,EACzB,OAAO,EACP,UAAU,GAIX,EAAQ,EAAE;IACT,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,6CAA6C,CAAC;SAC1D,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"invokeList.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeList.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAGjD,iFAA8E;AAE9E;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,EACzB,OAAO,EACP,UAAU,GAIX,EAAQ,EAAE;IACT,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,6CAA6C,CAAC;SAC1D,MAAM,CAAC,eAAe,EAAE,4BAA4B,CAAC;SACrD,MAAM,CAAC,eAAe,EAAE,6CAA6C,CAAC;SACtE,MAAM,CAAC,CAAC,IAAsC,EAAE,EAAE;QACjD,kCAAkC;QAClC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,IAAI,GAAG,IAAA,+BAAc,EAAC,EAAE,UAAU,EAAE,IAAI,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AAE,CAAC;gBACtC,MAAM,UAAU,GAAG,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC1C,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;gBAChD,OAAO,CAAC,GAAG,CACT,GAAG,WAAW,GAAG,UAAU,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAE,CAAC,OAAO,EAAE,CACrE,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AApEW,QAAA,UAAU,cAoErB"}
|
|
@@ -11,21 +11,21 @@ const invokeReadme = ({ program, registries, }) => {
|
|
|
11
11
|
program
|
|
12
12
|
.command('readme')
|
|
13
13
|
.description('print documentation for the registry, a role, or a skill')
|
|
14
|
-
.option('--
|
|
14
|
+
.option('--repo <slug>', 'which repo to inspect')
|
|
15
15
|
.option('--role <slug>', 'which role to inspect')
|
|
16
16
|
.option('--skill <slug>', 'which skill to inspect')
|
|
17
17
|
.action((opts) => {
|
|
18
18
|
// no inputs provided
|
|
19
|
-
if (!opts.
|
|
20
|
-
helpful_errors_1.BadRequestError.throw('must provide --
|
|
21
|
-
// resolve registry
|
|
22
|
-
const registry = opts.
|
|
23
|
-
? registries.find((r) => r.slug === opts.
|
|
19
|
+
if (!opts.repo && !opts.role)
|
|
20
|
+
helpful_errors_1.BadRequestError.throw('must provide --repo or --role');
|
|
21
|
+
// resolve registry by repo slug
|
|
22
|
+
const registry = opts.repo
|
|
23
|
+
? registries.find((r) => r.slug === opts.repo)
|
|
24
24
|
: null;
|
|
25
25
|
if (!opts.role) {
|
|
26
26
|
if (!registry)
|
|
27
|
-
helpful_errors_1.BadRequestError.throw(`no
|
|
28
|
-
//
|
|
27
|
+
helpful_errors_1.BadRequestError.throw(`no repo matches given options`);
|
|
28
|
+
// repo level readme
|
|
29
29
|
return printReadme(`${registry.slug}`, registry.readme);
|
|
30
30
|
}
|
|
31
31
|
// resolve role
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invokeReadme.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeReadme.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAGjD,iFAA8E;AAE9E;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,EAC3B,OAAO,EACP,UAAU,GAIX,EAAQ,EAAE;IACT,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,0DAA0D,CAAC;SACvE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"invokeReadme.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeReadme.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAGjD,iFAA8E;AAE9E;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,EAC3B,OAAO,EACP,UAAU,GAIX,EAAQ,EAAE;IACT,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,0DAA0D,CAAC;SACvE,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC;SAChD,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC;SAChD,MAAM,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;SAClD,MAAM,CAAC,CAAC,IAAsD,EAAE,EAAE;QACjE,qBAAqB;QACrB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI;YAC1B,gCAAe,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEzD,gCAAgC;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI;YACxB,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;YAC9C,CAAC,CAAC,IAAI,CAAC;QACT,I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E,KAAK,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AArDW,QAAA,YAAY,gBAqDvB;AAEF;;;GAGG;AACH,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,EAAE;IACrD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,IAAA,mBAAW,EAAC,QAAQ,CAAC,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,MAAM,GAAG,CAAC,EAAU,EAAE;IAC9D,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC;SACjC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB"}
|
|
@@ -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
|
|
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
|
|
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,
|
|
1
|
+
{"version":3,"file":"invokeRolesInit.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeRolesInit.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAGjD,iFAA8E;AAC9E,2EAAwE;AACxE,qGAAkG;AAClG,mFAAgF;AAEhF,2DAA8C;AAE9C;;;GAGG;AACH,MAAM,mBAAmB,GAAG,GAAa,EAAE;IACzC,MAAM,IAA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E,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"}
|
|
@@ -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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AkB,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,C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AAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC;aACvD,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,gCAAe,CAAC,KAAK,CACnB,6BAA6B,KAAK,CAAC,QAAQ,OAAO,SAAS,8CAA8C,EACzG,EAAE,KAAK,EAAE,OAAO,EAAE,CACnB,CAAC;IACJ,CAAC;IAED,sBAAsB;IACtB,OAAO,OAAO,CAAC,CAAC,CAAE,CAAC;AACrB,CAAC,CAAC;AA3DW,QAAA,wBAAwB,4BA2DnC"}
|
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
|
+
"version": "1.16.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 &&
|
|
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,7 +89,9 @@
|
|
|
89
89
|
"esbuild-register": "3.6.0",
|
|
90
90
|
"husky": "8.0.3",
|
|
91
91
|
"jest": "30.2.0",
|
|
92
|
-
"rhachet": "1.
|
|
92
|
+
"rhachet": "1.15.2",
|
|
93
|
+
"rhachet-roles-bhrain": "0.5.5",
|
|
94
|
+
"rhachet-roles-bhuild": "0.4.2",
|
|
93
95
|
"rhachet-roles-ehmpathy": "1.15.12",
|
|
94
96
|
"test-fns": "1.7.0",
|
|
95
97
|
"tsc-alias": "1.8.10",
|