majlis 0.4.4 → 0.4.5

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/cli.js +28 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2634,6 +2634,10 @@ function gitRevert(branch, cwd) {
2634
2634
  encoding: "utf-8"
2635
2635
  }).trim();
2636
2636
  if (currentBranch === branch) {
2637
+ try {
2638
+ (0, import_node_child_process3.execSync)("git checkout -- .", { cwd, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
2639
+ } catch {
2640
+ }
2637
2641
  (0, import_node_child_process3.execSync)("git checkout main 2>/dev/null || git checkout master", {
2638
2642
  cwd,
2639
2643
  encoding: "utf-8",
@@ -2743,6 +2747,7 @@ Build the experiment: ${exp.hypothesis}` : `Build the experiment: ${exp.hypothes
2743
2747
  }, root);
2744
2748
  warn(`Experiment stays at 'building'. Run \`majlis build\` to retry or \`majlis revert\` to abandon.`);
2745
2749
  } else {
2750
+ gitCommitBuild(exp, root);
2746
2751
  updateExperimentStatus(db, exp.id, "built");
2747
2752
  success(`Build complete for ${exp.slug}. Run \`majlis doubt\` or \`majlis challenge\` next.`);
2748
2753
  }
@@ -2861,6 +2866,23 @@ async function doCompress(db, root) {
2861
2866
  recordCompression(db, sessionCount, sizeBefore, sizeAfter);
2862
2867
  success(`Compression complete. Synthesis: ${sizeBefore}B \u2192 ${sizeAfter}B`);
2863
2868
  }
2869
+ function gitCommitBuild(exp, cwd) {
2870
+ try {
2871
+ (0, import_node_child_process4.execSync)('git add -A -- ":!.majlis/"', { cwd, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
2872
+ const diff = (0, import_node_child_process4.execSync)("git diff --cached --stat", { cwd, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
2873
+ if (!diff) {
2874
+ info("No code changes to commit.");
2875
+ return;
2876
+ }
2877
+ const msg = `EXP-${String(exp.id).padStart(3, "0")}: ${exp.slug}
2878
+
2879
+ ${exp.hypothesis ?? ""}`;
2880
+ (0, import_node_child_process4.execSync)(`git commit -m ${JSON.stringify(msg)}`, { cwd, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
2881
+ info(`Committed builder changes on ${exp.branch}.`);
2882
+ } catch {
2883
+ warn("Could not auto-commit builder changes \u2014 commit manually before resolving.");
2884
+ }
2885
+ }
2864
2886
  function resolveExperimentArg(db, args) {
2865
2887
  const slugArg = args.filter((a) => !a.startsWith("--"))[0];
2866
2888
  let exp;
@@ -2915,12 +2937,13 @@ function ingestStructuredOutput(db, experimentId, structured) {
2915
2937
  info(`Ingested ${structured.challenges.length} challenge(s)`);
2916
2938
  }
2917
2939
  }
2918
- var fs9, path9;
2940
+ var fs9, path9, import_node_child_process4;
2919
2941
  var init_cycle = __esm({
2920
2942
  "src/commands/cycle.ts"() {
2921
2943
  "use strict";
2922
2944
  fs9 = __toESM(require("fs"));
2923
2945
  path9 = __toESM(require("path"));
2946
+ import_node_child_process4 = require("child_process");
2924
2947
  init_connection();
2925
2948
  init_queries();
2926
2949
  init_machine();
@@ -3347,7 +3370,7 @@ async function deriveNextHypothesis(goal, root, db) {
3347
3370
  let metricsOutput = "";
3348
3371
  if (config.metrics?.command) {
3349
3372
  try {
3350
- metricsOutput = (0, import_node_child_process4.execSync)(config.metrics.command, {
3373
+ metricsOutput = (0, import_node_child_process5.execSync)(config.metrics.command, {
3351
3374
  cwd: root,
3352
3375
  encoding: "utf-8",
3353
3376
  timeout: 6e4,
@@ -3438,7 +3461,7 @@ function createNewExperiment(db, root, hypothesis) {
3438
3461
  const paddedNum = String(num).padStart(3, "0");
3439
3462
  const branch = `exp/${paddedNum}-${finalSlug}`;
3440
3463
  try {
3441
- (0, import_node_child_process4.execSync)(`git checkout -b ${branch}`, {
3464
+ (0, import_node_child_process5.execSync)(`git checkout -b ${branch}`, {
3442
3465
  cwd: root,
3443
3466
  encoding: "utf-8",
3444
3467
  stdio: ["pipe", "pipe", "pipe"]
@@ -3487,13 +3510,13 @@ function loadConfig7(projectRoot) {
3487
3510
  }
3488
3511
  return JSON.parse(fs13.readFileSync(configPath, "utf-8"));
3489
3512
  }
3490
- var fs13, path13, import_node_child_process4;
3513
+ var fs13, path13, import_node_child_process5;
3491
3514
  var init_run = __esm({
3492
3515
  "src/commands/run.ts"() {
3493
3516
  "use strict";
3494
3517
  fs13 = __toESM(require("fs"));
3495
3518
  path13 = __toESM(require("path"));
3496
- import_node_child_process4 = require("child_process");
3519
+ import_node_child_process5 = require("child_process");
3497
3520
  init_connection();
3498
3521
  init_queries();
3499
3522
  init_machine();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "majlis",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Multi-agent workflow CLI for structured doubt, independent verification, and compressed knowledge",
5
5
  "bin": {
6
6
  "majlis": "./dist/cli.js"