rhachet 1.13.4 → 1.13.6

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.
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.invokeInit = void 0;
4
- const helpful_errors_1 = require("helpful-errors");
5
4
  const rhachet_artifact_git_1 = require("rhachet-artifact-git");
6
5
  const discoverRolePackages_1 = require("../../domain.operations/init/discoverRolePackages");
7
6
  const generateRhachetConfig_1 = require("../../domain.operations/init/generateRhachetConfig");
8
- const node_fs_1 = require("node:fs");
7
+ const findsertFile_1 = require("../../infra/findsertFile");
9
8
  const node_path_1 = require("node:path");
10
9
  /**
11
10
  * .what = adds the "init" command to the CLI
@@ -16,19 +15,12 @@ const invokeInit = ({ program }) => {
16
15
  program
17
16
  .command('init')
18
17
  .description('initialize rhachet.use.ts config from discovered role packages')
19
- .option('--force', 'overwrite existing rhachet.use.ts')
20
- .action(async (opts) => {
18
+ .action(async () => {
21
19
  const cwd = process.cwd();
22
20
  const root = await (0, rhachet_artifact_git_1.getGitRepoRoot)({ from: cwd });
23
- const configPath = (0, node_path_1.resolve)(root, 'rhachet.use.ts');
24
- const relativeConfigPath = (0, node_path_1.relative)(cwd, configPath);
25
- // Check if config already exists
26
- if ((0, node_fs_1.existsSync)(configPath) && !opts.force) {
27
- helpful_errors_1.BadRequestError.throw(`rhachet.use.ts already exists. Use --force to overwrite.`);
28
- }
29
21
  console.log(``);
30
22
  console.log(`🔭 Search for rhachet role packages...`);
31
- // Discover role packages
23
+ // discover role packages
32
24
  const packages = await (0, discoverRolePackages_1.discoverRolePackages)({ from: cwd });
33
25
  if (packages.length === 0) {
34
26
  console.log(` - [none found]`);
@@ -42,11 +34,20 @@ const invokeInit = ({ program }) => {
42
34
  console.log(` - [found] ${pkg}`);
43
35
  }
44
36
  console.log(``);
45
- console.log(`✨ Create rhachet.use.ts...`);
46
- // Generate and write config
47
- const content = (0, generateRhachetConfig_1.generateRhachetConfig)({ packages });
48
- (0, node_fs_1.writeFileSync)(configPath, content, 'utf8');
49
- console.log(` + [created] ${relativeConfigPath}`);
37
+ console.log(`✨ findsert rhachet resources...`);
38
+ // findsert rhachet.use.ts
39
+ const configPath = (0, node_path_1.resolve)(root, 'rhachet.use.ts');
40
+ const configContent = (0, generateRhachetConfig_1.generateRhachetConfig)({ packages });
41
+ (0, findsertFile_1.findsertFile)({ cwd, path: configPath, content: configContent });
42
+ // findsert .agent/repo=.this/role=any directories and readme
43
+ const roleAnyDir = (0, node_path_1.resolve)(root, '.agent', 'repo=.this', 'role=any');
44
+ (0, findsertFile_1.findsertFile)({ cwd, path: (0, node_path_1.resolve)(roleAnyDir, 'briefs') });
45
+ (0, findsertFile_1.findsertFile)({ cwd, path: (0, node_path_1.resolve)(roleAnyDir, 'skills') });
46
+ (0, findsertFile_1.findsertFile)({
47
+ cwd,
48
+ path: (0, node_path_1.resolve)(roleAnyDir, 'readme.md'),
49
+ content: 'this role applies to any agent that works within this repo\n',
50
+ });
50
51
  console.log(``);
51
52
  console.log(`🌊 Done, rhachet config with ${packages.length} role package(s), ready for use`);
52
53
  console.log(``);
@@ -1 +1 @@
1
- {"version":3,"file":"invokeInit.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeInit.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AACjD,+DAAsD;AAEtD,2FAAwF;AACxF,6FAA0F;AAE1F,qCAAoD;AACpD,yCAA8C;AAE9C;;;;GAIG;AACI,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAAwB,EAAQ,EAAE;IACpE,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,gEAAgE,CACjE;SACA,MAAM,CAAC,SAAS,EAAE,mCAAmC,CAAC;SACtD,MAAM,CAAC,KAAK,EAAE,IAAyB,EAAE,EAAE;QAC1C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,MAAM,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C,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CACT,gCAAgC,QAAQ,CAAC,MAAM,iCAAiC,CACjF,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AA1DW,QAAA,UAAU,cA0DrB"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * .what = findsert a file or directory (find or insert)
3
+ * .why = idempotent creation - reports [found] if exists, [created] if not
4
+ */
5
+ export declare const findsertFile: (input: {
6
+ cwd: string;
7
+ path: string;
8
+ content?: string;
9
+ }) => {
10
+ effect: 'FOUND' | 'CREATED';
11
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findsertFile = void 0;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ /**
7
+ * .what = findsert a file or directory (find or insert)
8
+ * .why = idempotent creation - reports [found] if exists, [created] if not
9
+ */
10
+ const findsertFile = (input) => {
11
+ // check if already exists
12
+ if ((0, node_fs_1.existsSync)(input.path)) {
13
+ console.log(` ○ [found] ${(0, node_path_1.relative)(input.cwd, input.path)}`);
14
+ return { effect: 'FOUND' };
15
+ }
16
+ // create file or directory
17
+ if (input.content !== undefined)
18
+ (0, node_fs_1.writeFileSync)(input.path, input.content, 'utf8');
19
+ else
20
+ (0, node_fs_1.mkdirSync)(input.path, { recursive: true });
21
+ console.log(` + [created] ${(0, node_path_1.relative)(input.cwd, input.path)}`);
22
+ return { effect: 'CREATED' };
23
+ };
24
+ exports.findsertFile = findsertFile;
25
+ //# sourceMappingURL=findsertFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findsertFile.js","sourceRoot":"","sources":["../../src/infra/findsertFile.ts"],"names":[],"mappings":";;;AAAA,qCAA+D;AAC/D,yCAAqC;AAErC;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,KAI5B,EAAmC,EAAE;IACpC,0BAA0B;IAC1B,IAAI,IAAA,oBAAU,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,eAAe,IAAA,oBAAQ,EAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,2BAA2B;IAC3B,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAC7B,IAAA,uBAAa,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;;QAC9C,IAAA,mBAAS,EAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAA,oBAAQ,EAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAC/B,CAAC,CAAC;AAjBW,QAAA,YAAY,gBAiBvB"}
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.13.4",
5
+ "version": "1.13.6",
6
6
  "repository": "ehmpathy/rhachet",
7
7
  "homepage": "https://github.com/ehmpathy/rhachet",
8
8
  "keywords": [