@moxxy/cli 0.0.9 → 0.0.11

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
@@ -1402,12 +1402,15 @@ var init_process_manager = __esm({
1402
1402
  );
1403
1403
  }
1404
1404
  const args = this.buildArgs(options);
1405
- const stdinMode = options.message ? "ignore" : "pipe";
1406
1405
  const proc = (0, import_node_child_process.spawn)(this.config.cliPath, args, {
1407
1406
  cwd: options.workingDirectory || this.config.workingDirectory || process.cwd(),
1408
1407
  env: process.env,
1409
- stdio: [stdinMode, "pipe", "pipe"]
1408
+ stdio: ["pipe", "pipe", "pipe"]
1410
1409
  });
1410
+ if (options.message) {
1411
+ proc.stdin.write(options.message);
1412
+ }
1413
+ proc.stdin.end();
1411
1414
  const claudeProc = {
1412
1415
  sessionKey: options.sessionKey,
1413
1416
  process: proc,
@@ -1448,9 +1451,6 @@ var init_process_manager = __esm({
1448
1451
  if (workingDir) {
1449
1452
  args.push("--add-dir", workingDir);
1450
1453
  }
1451
- if (options.message) {
1452
- args.push(options.message);
1453
- }
1454
1454
  return args;
1455
1455
  }
1456
1456
  /**
@@ -24467,21 +24467,51 @@ function log3(level, issueKey, message) {
24467
24467
  };
24468
24468
  console.log(`${time} ${levels[level]}${tag} ${issue} ${message}`);
24469
24469
  }
24470
- async function implementIssue(supervisor, agentId, payload, workflow) {
24470
+ async function implementIssue(supervisor, agentId, payload, options) {
24471
+ const { authCloneUrl, branchName, plan } = options;
24472
+ const cloneDir = `/tmp/moxxy-${payload.repo.name}-issue-${payload.issueNumber}`;
24473
+ const commitMessage = plan.commitMessage || `fix: ${payload.title} (#${payload.issueNumber})`;
24474
+ const stepsDescription = plan.steps.map((s, i) => `${i + 1}. **${s.action}** \`${s.path}\`: ${s.description}`).join("\n");
24471
24475
  const instruction = {
24472
- prompt: `Execute this workflow for issue #${payload.issueNumber}: ${payload.title}
24476
+ prompt: `You are implementing changes for GitHub issue #${payload.issueNumber}: ${payload.title}
24477
+
24478
+ Use the moxxy-agent CLI for ALL file and git operations. Install it first if not available.
24479
+
24480
+ ## Step 1: Setup
24481
+ \`\`\`bash
24482
+ npm install -g @moxxy/agent-cli
24483
+ moxxy-agent workspace init --repo "${authCloneUrl}" --branch "${branchName}" --clone-dir "${cloneDir}"
24484
+ cd "${cloneDir}"
24485
+ \`\`\`
24486
+
24487
+ ## Step 2: Implement Changes
24488
+ ${stepsDescription}
24473
24489
 
24474
- Workflow:
24475
- ${JSON.stringify(workflow, null, 2)}
24490
+ Available moxxy-agent commands:
24491
+ - \`moxxy-agent file read <path>\` \u2014 read a file
24492
+ - \`moxxy-agent file create <path> --content "..."\` \u2014 create a new file
24493
+ - \`moxxy-agent file update <path> --content "..."\` \u2014 overwrite a file
24494
+ - \`moxxy-agent file patch <path> --search "old" --replace "new"\` \u2014 find-and-replace in a file
24495
+ - \`moxxy-agent file delete <path>\` \u2014 delete a file
24496
+ - \`moxxy-agent dir list [path]\` \u2014 list directory contents
24497
+ - \`moxxy-agent search code <pattern>\` \u2014 search code by regex
24476
24498
 
24477
- Execute each step using the moxxy-agent CLI tool. For each step, run:
24478
- moxxy-agent <plugin> <command> <args>
24499
+ Read existing files first to understand context before making changes.
24479
24500
 
24480
- Handle any errors by adapting. Report the results of each step.`,
24501
+ ## Step 3: Commit & Push
24502
+ \`\`\`bash
24503
+ moxxy-agent git add --all
24504
+ moxxy-agent git commit -m "${commitMessage}"
24505
+ moxxy-agent git push --set-upstream
24506
+ \`\`\`
24507
+
24508
+ IMPORTANT:
24509
+ - Use ONLY moxxy-agent commands for file and git operations.
24510
+ - Execute all steps in order \u2014 setup, implement, then commit & push.
24511
+ - If a command fails, read the error and adapt your approach.`,
24481
24512
  metadata: {
24482
24513
  stage: "implement",
24483
- issueNumber: payload.issueNumber,
24484
- workflowId: workflow.id
24514
+ issueNumber: payload.issueNumber
24485
24515
  }
24486
24516
  };
24487
24517
  const result = await supervisor.sendInstruction(agentId, instruction);
@@ -24594,6 +24624,32 @@ Respond with exactly this JSON structure (no other text):
24594
24624
  const result = await supervisor.sendInstruction(agentId, instruction);
24595
24625
  return extractJSON(result.response, "triage");
24596
24626
  }
24627
+ function verifyWebhookSignature(payload, signature, secret) {
24628
+ const expected = "sha256=" + (0, import_crypto4.createHmac)("sha256", secret).update(payload).digest("hex");
24629
+ if (expected.length !== signature.length) return false;
24630
+ return (0, import_crypto4.timingSafeEqual)(Buffer.from(expected), Buffer.from(signature));
24631
+ }
24632
+ function parseIssuePayload(body) {
24633
+ const issue = body.issue;
24634
+ if (!issue) return null;
24635
+ return {
24636
+ action: body.action,
24637
+ issueNumber: issue.number,
24638
+ title: issue.title,
24639
+ body: issue.body ?? null,
24640
+ labels: (issue.labels || []).map((l) => l.name),
24641
+ author: issue.user?.login || "unknown",
24642
+ repo: {
24643
+ owner: body.repository.owner.login,
24644
+ name: body.repository.name,
24645
+ fullName: body.repository.full_name,
24646
+ defaultBranch: body.repository.default_branch,
24647
+ cloneUrl: body.repository.clone_url
24648
+ },
24649
+ url: issue.html_url,
24650
+ createdAt: issue.created_at
24651
+ };
24652
+ }
24597
24653
  function buildWorkflow(payload, plan, branchName) {
24598
24654
  const steps = [];
24599
24655
  let stepIndex = 0;
@@ -24656,32 +24712,6 @@ function buildWorkflow(payload, plan, branchName) {
24656
24712
  }
24657
24713
  };
24658
24714
  }
24659
- function verifyWebhookSignature(payload, signature, secret) {
24660
- const expected = "sha256=" + (0, import_crypto4.createHmac)("sha256", secret).update(payload).digest("hex");
24661
- if (expected.length !== signature.length) return false;
24662
- return (0, import_crypto4.timingSafeEqual)(Buffer.from(expected), Buffer.from(signature));
24663
- }
24664
- function parseIssuePayload(body) {
24665
- const issue = body.issue;
24666
- if (!issue) return null;
24667
- return {
24668
- action: body.action,
24669
- issueNumber: issue.number,
24670
- title: issue.title,
24671
- body: issue.body ?? null,
24672
- labels: (issue.labels || []).map((l) => l.name),
24673
- author: issue.user?.login || "unknown",
24674
- repo: {
24675
- owner: body.repository.owner.login,
24676
- name: body.repository.name,
24677
- fullName: body.repository.full_name,
24678
- defaultBranch: body.repository.default_branch,
24679
- cloneUrl: body.repository.clone_url
24680
- },
24681
- url: issue.html_url,
24682
- createdAt: issue.created_at
24683
- };
24684
- }
24685
24715
  async function createBranchFromDefault(client, owner, repo, branchName, defaultBranch) {
24686
24716
  await client.createBranch(owner, repo, branchName, defaultBranch);
24687
24717
  }
@@ -24734,9 +24764,17 @@ var init_dist7 = __esm({
24734
24764
  };
24735
24765
  GitHubClient = class {
24736
24766
  octokit;
24767
+ token;
24737
24768
  constructor(token) {
24769
+ this.token = token;
24738
24770
  this.octokit = new Octokit2({ auth: token });
24739
24771
  }
24772
+ /**
24773
+ * Build an authenticated HTTPS clone URL for git push.
24774
+ */
24775
+ getAuthCloneUrl(owner, repo) {
24776
+ return `https://x-access-token:${this.token}@github.com/${owner}/${repo}.git`;
24777
+ }
24740
24778
  async verifyAuth() {
24741
24779
  try {
24742
24780
  const { data } = await this.octokit.users.getAuthenticated();
@@ -24959,11 +24997,15 @@ var init_dist7 = __esm({
24959
24997
  this.logStageResult(issueKey, planResult);
24960
24998
  if (planResult.status === "failed") throw new Error(`Plan failed: ${planResult.error}`);
24961
24999
  const branchName = `moxxy/issue-${payload.issueNumber}`;
24962
- const workflow = buildWorkflow(payload, planResult.output, branchName);
25000
+ const authCloneUrl = this.github.getAuthCloneUrl(payload.repo.owner, payload.repo.name);
24963
25001
  this.logger.stageStart(issueKey, "implement");
24964
25002
  const implementResult = await this.runStage(
24965
25003
  "implement",
24966
- () => implementIssue(this.supervisor, this.moltAgentId, payload, workflow)
25004
+ () => implementIssue(this.supervisor, this.moltAgentId, payload, {
25005
+ authCloneUrl,
25006
+ branchName,
25007
+ plan: planResult.output
25008
+ })
24967
25009
  );
24968
25010
  pipelineRun.stages.push(implementResult);
24969
25011
  this.logStageResult(issueKey, implementResult);
@@ -25426,7 +25468,7 @@ __export(cli_exports, {
25426
25468
  });
25427
25469
  function createProgram() {
25428
25470
  const program = new import_commander.Command();
25429
- program.name("moxxy").description("Moxxy - Agent orchestration platform").version("0.0.9");
25471
+ program.name("moxxy").description("Moxxy - Agent orchestration platform").version("0.0.11");
25430
25472
  registerStartCommand(program);
25431
25473
  registerRepoCommand(program);
25432
25474
  registerConfigCommand(program);
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ConfigManager,
3
3
  createProgram
4
- } from "./chunk-SOFST2PV.mjs";
4
+ } from "./chunk-HHOAOGUS.mjs";
5
5
  import "./chunk-GSNMMI3H.mjs";
6
6
  import "./chunk-6DZX6EAA.mjs";
7
7
 
8
8
  // src/index.ts
9
9
  async function run() {
10
- const { createProgram: createProgram2 } = await import("./cli-XXOW4VXJ.mjs");
10
+ const { createProgram: createProgram2 } = await import("./cli-2AIWTL6F.mjs");
11
11
  const program = createProgram2();
12
12
  await program.parseAsync(process.argv);
13
13
  }