@neuravim/aiden 0.12.0 → 0.12.1

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/index.js CHANGED
@@ -1388,6 +1388,9 @@ ${feedback}`;
1388
1388
  // src/providers/adapters/codex.ts
1389
1389
  var GENERATE_TIMEOUT_MS = 6e5;
1390
1390
  var REVIEW_TIMEOUT_MS = 3e5;
1391
+ function getCodexExecArgs(cwd, sandbox) {
1392
+ return ["--ask-for-approval", "never", "exec", "--sandbox", sandbox, "--cd", cwd, "-"];
1393
+ }
1391
1394
  function createCodexAdapter(command = "codex", projectDir) {
1392
1395
  const capabilities = {
1393
1396
  analysis: true,
@@ -1403,11 +1406,11 @@ function createCodexAdapter(command = "codex", projectDir) {
1403
1406
  capabilities,
1404
1407
  async generate(prompt, _context) {
1405
1408
  const start = Date.now();
1406
- const output = await executeSubprocess(
1407
- command,
1408
- ["exec", "--sandbox", "workspace-write", "--cd", cwd, "-"],
1409
- { stdin: prompt, cwd, timeoutMs: GENERATE_TIMEOUT_MS }
1410
- );
1409
+ const output = await executeSubprocess(command, getCodexExecArgs(cwd, "workspace-write"), {
1410
+ stdin: prompt,
1411
+ cwd,
1412
+ timeoutMs: GENERATE_TIMEOUT_MS
1413
+ });
1411
1414
  return {
1412
1415
  content: output,
1413
1416
  tokensUsed: estimateTokens(prompt + output),
@@ -1427,15 +1430,11 @@ SUGGESTIONS:
1427
1430
 
1428
1431
  Code:
1429
1432
  ${code}`;
1430
- const output = await executeSubprocess(
1431
- command,
1432
- ["exec", "--sandbox", "read-only", "--cd", cwd, "-"],
1433
- {
1434
- stdin: prompt,
1435
- cwd,
1436
- timeoutMs: REVIEW_TIMEOUT_MS
1437
- }
1438
- );
1433
+ const output = await executeSubprocess(command, getCodexExecArgs(cwd, "read-only"), {
1434
+ stdin: prompt,
1435
+ cwd,
1436
+ timeoutMs: REVIEW_TIMEOUT_MS
1437
+ });
1439
1438
  const parsed = parseReviewOutput(output);
1440
1439
  return {
1441
1440
  passed: parsed.passed,
@@ -1458,11 +1457,11 @@ ${artefact}
1458
1457
  Feedback:
1459
1458
  ${feedback}`;
1460
1459
  const start = Date.now();
1461
- const output = await executeSubprocess(
1462
- command,
1463
- ["exec", "--sandbox", "workspace-write", "--cd", cwd, "-"],
1464
- { stdin: prompt, cwd, timeoutMs: REVIEW_TIMEOUT_MS }
1465
- );
1460
+ const output = await executeSubprocess(command, getCodexExecArgs(cwd, "workspace-write"), {
1461
+ stdin: prompt,
1462
+ cwd,
1463
+ timeoutMs: REVIEW_TIMEOUT_MS
1464
+ });
1466
1465
  return {
1467
1466
  content: output,
1468
1467
  tokensUsed: estimateTokens(prompt + output),
@@ -3468,6 +3467,18 @@ var QAAgent = class extends BaseAgent {
3468
3467
  const filesChanged = devOutput?.structured?.filesChanged ?? [];
3469
3468
  const codeToReview = pipeline.previousOutputs.filter((o) => o.agent === "dev").map((o) => o.content).join("\n") || pipeline.featureRequest;
3470
3469
  let reviewInput = "";
3470
+ if (this.skillInstructions) {
3471
+ reviewInput += `--- SKILL / PROFILE VALIDATION INSTRUCTIONS ---
3472
+ ${this.skillInstructions}
3473
+
3474
+ `;
3475
+ }
3476
+ if (this.rules.length > 0) {
3477
+ reviewInput += `--- ENTERPRISE RULES ---
3478
+ ${this.rules.join("\n")}
3479
+
3480
+ `;
3481
+ }
3471
3482
  if (storyCriteria.length > 0) {
3472
3483
  reviewInput += "--- ACCEPTANCE CRITERIA TO VERIFY ---\n";
3473
3484
  for (const story of storyCriteria) {
@@ -3883,8 +3894,10 @@ async function loadSkill(skillDir) {
3883
3894
 
3884
3895
  // src/skills/skill-injector.ts
3885
3896
  import { join as join11 } from "path";
3886
- function getSkillsForAgent(agent, mode, skills) {
3897
+ function getSkillsForAgent(agent, mode, skills, activeProfile) {
3898
+ const profileSkillNames = new Set(activeProfile?.skills ?? []);
3887
3899
  return skills.filter((s) => {
3900
+ if (profileSkillNames.has(s.manifest.name)) return true;
3888
3901
  const agentMatch = s.manifest.agents.includes(agent);
3889
3902
  const modeMatch = !s.manifest.modes || s.manifest.modes.includes(mode);
3890
3903
  return agentMatch && modeMatch;
@@ -3898,6 +3911,22 @@ ${s.instructions}`);
3898
3911
  function extractSkillRules(skills) {
3899
3912
  return skills.flatMap((s) => s.rules.map((r) => r.content));
3900
3913
  }
3914
+ function extractSkillHooks(skills) {
3915
+ const merged = {};
3916
+ for (const skill of skills) {
3917
+ if (!skill.manifest.hooks) continue;
3918
+ for (const [event, hooks] of Object.entries(skill.manifest.hooks)) {
3919
+ if (!merged[event]) merged[event] = [];
3920
+ for (const hook of hooks) {
3921
+ merged[event].push({
3922
+ ...hook,
3923
+ command: hook.command.startsWith("./") ? join11(skill.dir, hook.command.slice(2)) : hook.command
3924
+ });
3925
+ }
3926
+ }
3927
+ }
3928
+ return merged;
3929
+ }
3901
3930
 
3902
3931
  // src/agents/agent-profiles.ts
3903
3932
  function mergeUnique(left, right) {
@@ -4034,6 +4063,16 @@ function executeShell(command) {
4034
4063
  });
4035
4064
  });
4036
4065
  }
4066
+ function mergeHooks(...sources) {
4067
+ const merged = {};
4068
+ for (const source of sources) {
4069
+ for (const [event, hooks] of Object.entries(source)) {
4070
+ if (!merged[event]) merged[event] = [];
4071
+ merged[event].push(...hooks);
4072
+ }
4073
+ }
4074
+ return merged;
4075
+ }
4037
4076
  var HookBlockError = class extends Error {
4038
4077
  constructor(message) {
4039
4078
  super(message);
@@ -4344,6 +4383,9 @@ var TraceHookBridge = class {
4344
4383
 
4345
4384
  // src/core/orchestrator.ts
4346
4385
  var MAX_QA_RETRIES = 2;
4386
+ function resolveAidenSubdir(explicitDir, aidenDir, subdir) {
4387
+ return explicitDir ?? join13(aidenDir ?? join13(process.cwd(), ".aiden"), subdir);
4388
+ }
4347
4389
  var FeatureLockError = class extends Error {
4348
4390
  constructor(featureSlug) {
4349
4391
  super(
@@ -4471,6 +4513,16 @@ var Orchestrator = class {
4471
4513
  const ctx = await this.deps.contextStore.load();
4472
4514
  ctx.activeFeatures[featureSlug] = feature;
4473
4515
  await this.deps.contextStore.save(ctx);
4516
+ const projectContext = await this.deps.contextStore.load();
4517
+ const workflow = this.lead.getWorkflow(mode);
4518
+ const rulesDir = resolveAidenSubdir(this.deps.rulesDir, this.deps.aidenDir, "rules");
4519
+ const allRules = await loadRules(rulesDir);
4520
+ const skillsDir = resolveAidenSubdir(this.deps.skillsDir, this.deps.aidenDir, "skills");
4521
+ const allSkills = await loadSkills(skillsDir);
4522
+ this.hookRunner = createHookRunner(
4523
+ mergeHooks(this.deps.config.hooks ?? {}, extractSkillHooks(allSkills)),
4524
+ this.deps.logger
4525
+ );
4474
4526
  await this.runHook(
4475
4527
  "on_feature_created",
4476
4528
  featureSlug,
@@ -4480,12 +4532,6 @@ var Orchestrator = class {
4480
4532
  hookBridge,
4481
4533
  tc.getRootSpanId()
4482
4534
  );
4483
- const projectContext = await this.deps.contextStore.load();
4484
- const workflow = this.lead.getWorkflow(mode);
4485
- const rulesDir = this.deps.rulesDir ?? join13(this.deps.aidenDir ?? process.cwd(), ".aiden", "rules");
4486
- const allRules = await loadRules(rulesDir);
4487
- const skillsDir = this.deps.skillsDir ?? join13(this.deps.aidenDir ?? process.cwd(), ".aiden", "skills");
4488
- const allSkills = await loadSkills(skillsDir);
4489
4535
  const activeProfile = resolveAgentProfile(
4490
4536
  this.deps.config.activeProfile,
4491
4537
  this.deps.config,
@@ -4506,7 +4552,7 @@ var Orchestrator = class {
4506
4552
  persona_override: resolveAgentProfilePersona(activeProfile, step.agent) !== void 0
4507
4553
  });
4508
4554
  }
4509
- const agentSkills = getSkillsForAgent(step.agent, mode, allSkills);
4555
+ const agentSkills = getSkillsForAgent(step.agent, mode, allSkills, activeProfile);
4510
4556
  const skillInstructions = [profileInstructions, formatSkillInstructions(agentSkills)].filter((block) => block.length > 0).join("\n\n---\n\n");
4511
4557
  agent.injectSkillInstructions(skillInstructions);
4512
4558
  if (agentSkills.length > 0) {
@@ -4932,9 +4978,9 @@ var Orchestrator = class {
4932
4978
  );
4933
4979
  const outputs = [];
4934
4980
  const projectContext = await this.deps.contextStore.load();
4935
- const rulesDir = this.deps.rulesDir ?? join13(this.deps.aidenDir ?? process.cwd(), ".aiden", "rules");
4981
+ const rulesDir = resolveAidenSubdir(this.deps.rulesDir, this.deps.aidenDir, "rules");
4936
4982
  const allRules = await loadRules(rulesDir);
4937
- const skillsDir = this.deps.skillsDir ?? join13(this.deps.aidenDir ?? process.cwd(), ".aiden", "skills");
4983
+ const skillsDir = resolveAidenSubdir(this.deps.skillsDir, this.deps.aidenDir, "skills");
4938
4984
  const allSkills = await loadSkills(skillsDir);
4939
4985
  const activeProfile = resolveAgentProfile(
4940
4986
  this.deps.config.activeProfile,
@@ -4946,7 +4992,7 @@ var Orchestrator = class {
4946
4992
  const agent = this.agents.get(step.agent);
4947
4993
  if (!agent) continue;
4948
4994
  agent.setPersona(resolveAgentProfilePersona(activeProfile, step.agent));
4949
- const agentSkills = getSkillsForAgent(step.agent, newMode, allSkills);
4995
+ const agentSkills = getSkillsForAgent(step.agent, newMode, allSkills, activeProfile);
4950
4996
  const skillInstructions = [profileInstructions, formatSkillInstructions(agentSkills)].filter((block) => block.length > 0).join("\n\n---\n\n");
4951
4997
  agent.injectSkillInstructions(skillInstructions);
4952
4998
  const skillRules = extractSkillRules(agentSkills);
@@ -5680,7 +5726,7 @@ function createFlashCommand() {
5680
5726
  error: err,
5681
5727
  command: "flash",
5682
5728
  mode: "flash",
5683
- aidenVersion: true ? "0.12.0" : void 0,
5729
+ aidenVersion: true ? "0.12.1" : void 0,
5684
5730
  argv: process.argv.slice(2),
5685
5731
  extra: { description }
5686
5732
  });
@@ -5735,7 +5781,7 @@ function createStandardCommand() {
5735
5781
  error: err,
5736
5782
  command: "standard",
5737
5783
  mode: "standard",
5738
- aidenVersion: true ? "0.12.0" : void 0,
5784
+ aidenVersion: true ? "0.12.1" : void 0,
5739
5785
  argv: process.argv.slice(2),
5740
5786
  extra: { description }
5741
5787
  });
@@ -5796,7 +5842,7 @@ function createEnterpriseCommand() {
5796
5842
  error: err,
5797
5843
  command: "enterprise",
5798
5844
  mode: "enterprise",
5799
- aidenVersion: true ? "0.12.0" : void 0,
5845
+ aidenVersion: true ? "0.12.1" : void 0,
5800
5846
  argv: process.argv.slice(2),
5801
5847
  extra: { description, autoApprove: options.autoApprove ? "true" : "false" }
5802
5848
  });
@@ -7445,7 +7491,7 @@ process.on("uncaughtException", (err) => {
7445
7491
  reportCrash(createLogger("error"), {
7446
7492
  error: err,
7447
7493
  command: process.argv[2],
7448
- aidenVersion: true ? "0.12.0" : void 0,
7494
+ aidenVersion: true ? "0.12.1" : void 0,
7449
7495
  argv: process.argv.slice(2),
7450
7496
  extra: { origin: "uncaughtException" }
7451
7497
  });
@@ -7455,14 +7501,14 @@ process.on("unhandledRejection", (reason) => {
7455
7501
  reportCrash(createLogger("error"), {
7456
7502
  error: reason,
7457
7503
  command: process.argv[2],
7458
- aidenVersion: true ? "0.12.0" : void 0,
7504
+ aidenVersion: true ? "0.12.1" : void 0,
7459
7505
  argv: process.argv.slice(2),
7460
7506
  extra: { origin: "unhandledRejection" }
7461
7507
  });
7462
7508
  process.exit(1);
7463
7509
  });
7464
7510
  var program = new Command17();
7465
- program.name("aiden").description("AIDEN \u2014 AI-Driven Engineering: CLI framework for AI-assisted development").version("0.12.0");
7511
+ program.name("aiden").description("AIDEN \u2014 AI-Driven Engineering: CLI framework for AI-assisted development").version("0.12.1");
7466
7512
  program.addCommand(createInitCommand());
7467
7513
  program.addCommand(createFlashCommand());
7468
7514
  program.addCommand(createStandardCommand());