@kody-ade/kody-engine 0.4.225 → 0.4.227

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.
Files changed (2) hide show
  1. package/dist/bin/kody.js +54 -9
  2. package/package.json +1 -1
package/dist/bin/kody.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "package.json"() {
16
16
  package_default = {
17
17
  name: "@kody-ade/kody-engine",
18
- version: "0.4.225",
18
+ version: "0.4.227",
19
19
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
20
20
  license: "MIT",
21
21
  type: "module",
@@ -269,23 +269,67 @@ function parseCompanyConfig(raw) {
269
269
  const r = raw;
270
270
  const out = {};
271
271
  if (r.activeDuties !== void 0) out.activeDuties = parseSlugArray(r.activeDuties, "company.activeDuties");
272
- if (r.activeGoals !== void 0) out.activeGoals = parseSlugArray(r.activeGoals, "company.activeGoals");
272
+ if (r.activeGoals !== void 0) out.activeGoals = parseGoalActivations(r.activeGoals);
273
273
  return Object.keys(out).length > 0 ? out : void 0;
274
274
  }
275
+ function parseGoalActivations(raw) {
276
+ if (!Array.isArray(raw)) throw new Error(`kody.config.json: company.activeGoals must be an array`);
277
+ const out = [];
278
+ const seen = /* @__PURE__ */ new Set();
279
+ for (const value of raw) {
280
+ if (typeof value === "string") {
281
+ const slug = parseSlug(value, "company.activeGoals");
282
+ if (!slug) continue;
283
+ if (!seen.has(slug)) {
284
+ seen.add(slug);
285
+ out.push(slug);
286
+ }
287
+ continue;
288
+ }
289
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
290
+ throw new Error(`kody.config.json: company.activeGoals entries must be strings or goal schedule objects`);
291
+ }
292
+ const r = value;
293
+ const template = typeof r.template === "string" ? parseSlug(r.template, "company.activeGoals.template") : "";
294
+ if (!template) throw new Error(`kody.config.json: company.activeGoals object requires template`);
295
+ const entry = { template };
296
+ if (r.every !== void 0) {
297
+ if (typeof r.every !== "string" || !/^[1-9][0-9]*[mhdw]$/.test(r.every.trim())) {
298
+ throw new Error(`kody.config.json: company.activeGoals every must look like "1d", "1w", "15m", or "2h"`);
299
+ }
300
+ entry.every = r.every.trim();
301
+ }
302
+ if (r.idPrefix !== void 0) {
303
+ if (typeof r.idPrefix !== "string") throw new Error(`kody.config.json: company.activeGoals idPrefix must be a string`);
304
+ const idPrefix = parseSlug(r.idPrefix, "company.activeGoals.idPrefix");
305
+ if (idPrefix) entry.idPrefix = idPrefix;
306
+ }
307
+ const facts = recordValue(r.facts);
308
+ if (r.facts !== void 0 && !facts) throw new Error(`kody.config.json: company.activeGoals facts must be an object`);
309
+ if (facts) entry.facts = facts;
310
+ out.push(entry);
311
+ }
312
+ return out;
313
+ }
275
314
  function parseSlugArray(raw, field) {
276
315
  if (!Array.isArray(raw)) throw new Error(`kody.config.json: ${field} must be an array of strings`);
277
316
  const out = [];
278
317
  for (const value of raw) {
279
- if (typeof value !== "string") throw new Error(`kody.config.json: ${field} entries must be strings`);
280
- const slug = value.trim();
318
+ const slug = parseSlug(value, field);
281
319
  if (!slug) continue;
282
- if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(slug)) {
283
- throw new Error(`kody.config.json: ${field} contains invalid slug "${value}"`);
284
- }
285
320
  out.push(slug);
286
321
  }
287
322
  return [...new Set(out)];
288
323
  }
324
+ function parseSlug(value, field) {
325
+ if (typeof value !== "string") throw new Error(`kody.config.json: ${field} entries must be strings`);
326
+ const slug = value.trim();
327
+ if (!slug) return "";
328
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(slug)) {
329
+ throw new Error(`kody.config.json: ${field} contains invalid slug "${value}"`);
330
+ }
331
+ return slug;
332
+ }
289
333
  function recordValue(raw) {
290
334
  return raw && typeof raw === "object" && !Array.isArray(raw) ? raw : void 0;
291
335
  }
@@ -8316,7 +8360,7 @@ var init_dispatchDutyFileTicks = __esm({
8316
8360
  continue;
8317
8361
  }
8318
8362
  const slugTarget = config.tickScript ? scriptedExecutable : config.executable ?? targetExecutable;
8319
- const cliArgs = { [slugArg]: slug };
8363
+ const cliArgs = config.executable && !config.tickScript ? {} : { [slugArg]: slug };
8320
8364
  process.stdout.write(`[jobs] \u2192 tick ${slug} (${slugTarget})
8321
8365
  `);
8322
8366
  try {
@@ -14845,7 +14889,8 @@ async function runJob(job, base) {
14845
14889
  quiet: base.quiet,
14846
14890
  preloadedData: Object.keys(preloadedData).length > 0 ? preloadedData : void 0
14847
14891
  };
14848
- input.cliArgs = resolvedDuty && profileName === resolvedDuty.executable ? { ...resolvedDuty.cliArgs, ...input.cliArgs } : input.cliArgs;
14892
+ const shouldApplyResolvedDutyArgs = valid.executable === void 0 && resolvedDuty && profileName === resolvedDuty.executable;
14893
+ input.cliArgs = shouldApplyResolvedDutyArgs ? { ...resolvedDuty.cliArgs, ...input.cliArgs } : input.cliArgs;
14849
14894
  const run = base.chain === false ? runExecutable : runExecutableChain;
14850
14895
  return run(profileName, input);
14851
14896
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.225",
3
+ "version": "0.4.227",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",