@karmaniverous/jeeves 0.5.12 → 0.6.0-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.
@@ -1,128 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync, unlinkSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
- import * as commander from 'commander';
4
+ import { Command } from 'commander';
5
5
  import { z } from 'zod';
6
6
  import { execSync } from 'node:child_process';
7
7
  import { homedir } from 'node:os';
8
8
 
9
- function getDefaultExportFromCjs (x) {
10
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
11
- }
12
-
13
- function getAugmentedNamespace(n) {
14
- if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
15
- var f = n.default;
16
- if (typeof f == "function") {
17
- var a = function a () {
18
- var isInstance = false;
19
- try {
20
- isInstance = this instanceof a;
21
- } catch {}
22
- if (isInstance) {
23
- return Reflect.construct(f, arguments, this.constructor);
24
- }
25
- return f.apply(this, arguments);
26
- };
27
- a.prototype = f.prototype;
28
- } else a = {};
29
- Object.defineProperty(a, '__esModule', {value: true});
30
- Object.keys(n).forEach(function (k) {
31
- var d = Object.getOwnPropertyDescriptor(n, k);
32
- Object.defineProperty(a, k, d.get ? d : {
33
- enumerable: true,
34
- get: function () {
35
- return n[k];
36
- }
37
- });
38
- });
39
- return a;
40
- }
41
-
42
- var extraTypings = {exports: {}};
43
-
44
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(commander);
45
-
46
- var hasRequiredExtraTypings;
47
-
48
- function requireExtraTypings () {
49
- if (hasRequiredExtraTypings) return extraTypings.exports;
50
- hasRequiredExtraTypings = 1;
51
- (function (module, exports) {
52
- const commander = require$$0;
53
-
54
- exports = module.exports = {};
55
-
56
- // Return a different global program than commander,
57
- // and don't also return it as default export.
58
- exports.program = new commander.Command();
59
-
60
- /**
61
- * Expose classes. The FooT versions are just types, so return Commander original implementations!
62
- */
63
-
64
- exports.Argument = commander.Argument;
65
- exports.Command = commander.Command;
66
- exports.CommanderError = commander.CommanderError;
67
- exports.Help = commander.Help;
68
- exports.InvalidArgumentError = commander.InvalidArgumentError;
69
- exports.InvalidOptionArgumentError = commander.InvalidArgumentError; // Deprecated
70
- exports.Option = commander.Option;
71
-
72
- exports.createCommand = (name) => new commander.Command(name);
73
- exports.createOption = (flags, description) =>
74
- new commander.Option(flags, description);
75
- exports.createArgument = (name, description) =>
76
- new commander.Argument(name, description);
77
- } (extraTypings, extraTypings.exports));
78
- return extraTypings.exports;
79
- }
80
-
81
- var extraTypingsExports = requireExtraTypings();
82
- var extraTypingsCommander = /*@__PURE__*/getDefaultExportFromCjs(extraTypingsExports);
83
-
84
- // wrapper to provide named exports for ESM.
85
- const {
86
- program,
87
- createCommand,
88
- createArgument,
89
- createOption,
90
- CommanderError,
91
- InvalidArgumentError,
92
- InvalidOptionArgumentError, // deprecated old name
93
- Command,
94
- Argument,
95
- Option,
96
- Help,
97
- } = extraTypingsCommander;
98
-
99
9
  /**
100
10
  * Zod schema for the Jeeves component descriptor.
101
11
  *
102
12
  * @remarks
103
- * The descriptor replaces the v0.4.0 `JeevesComponent` interface with a
104
- * Zod-first approach. The TypeScript type is inferred via `z.infer<>`.
105
- * Validates at parse time: prime interval, callable functions.
106
- */
107
- /**
108
- * Check whether a number is prime.
13
+ * Zod-first: the TypeScript type is inferred via `z.infer<>`. The descriptor
14
+ * drives the service CLI, service manager, config handlers, and standard
15
+ * plugin toolset. v1 removed the TOOLS.md writer fields (`sectionId`,
16
+ * `refreshIntervalSeconds`, `generateToolsContent`, `dependencies`).
109
17
  *
110
- * @param n - Number to check.
111
- * @returns `true` if n is prime.
18
+ * @module
112
19
  */
113
- function isPrime(n) {
114
- if (n < 2)
115
- return false;
116
- if (n === 2)
117
- return true;
118
- if (n % 2 === 0)
119
- return false;
120
- for (let i = 3; i * i <= n; i += 2) {
121
- if (n % i === 0)
122
- return false;
123
- }
124
- return true;
125
- }
126
20
  /**
127
21
  * Zod schema for the Jeeves component descriptor.
128
22
  *
@@ -196,23 +90,6 @@ z.object({
196
90
  input: [z.string()],
197
91
  output: z.promise(z.void()),
198
92
  }),
199
- /** TOOLS.md section name (e.g., 'Watcher'). */
200
- sectionId: z.string().min(1, 'sectionId must be a non-empty string'),
201
- /** Refresh interval in seconds (must be a prime number). */
202
- refreshIntervalSeconds: z.number().int().positive().refine(isPrime, {
203
- message: 'refreshIntervalSeconds must be a prime number',
204
- }),
205
- /** Produce the component's TOOLS.md section content. */
206
- generateToolsContent: z.function({ input: [], output: z.string() }),
207
- /** Component dependencies for HEARTBEAT alert suppression. */
208
- dependencies: z
209
- .object({
210
- /** Components that must be healthy for this component to function. */
211
- hard: z.array(z.string()),
212
- /** Components that improve behavior but are not strictly required. */
213
- soft: z.array(z.string()),
214
- })
215
- .optional(),
216
93
  /** Extension point: add custom CLI commands to the service CLI. */
217
94
  customCliCommands: z
218
95
  .function({ input: [z.custom()], output: z.void() })
@@ -234,6 +111,8 @@ function getEffectiveServiceName(descriptor) {
234
111
 
235
112
  /**
236
113
  * Directory and file path conventions for the Jeeves platform.
114
+ *
115
+ * @module
237
116
  */
238
117
  /** Core config directory name within the config root. */
239
118
  const CORE_CONFIG_DIR = 'jeeves-core';
@@ -730,11 +609,13 @@ function getErrorMessage(err) {
730
609
  * Workspace-level shared configuration: `jeeves.config.json`.
731
610
  *
732
611
  * @remarks
733
- * Lives at the OpenClaw workspace root alongside TOOLS.md and SOUL.md.
612
+ * Lives at the OpenClaw workspace root alongside SOUL.md and AGENTS.md.
734
613
  * Provides namespaced shared defaults consumed by the root Jeeves CLI.
735
614
  * Resolution precedence: CLI flags → env vars → jeeves.config.json → defaults.
736
615
  *
737
616
  * This does not replace component-owned config schemas (Decision 41).
617
+ *
618
+ * @module
738
619
  */
739
620
  /** Core shared config section. */
740
621
  const workspaceCoreConfigSchema = z