opencode-immune 1.0.34 → 1.0.35

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/plugin.js +35 -5
  2. package/package.json +1 -1
package/dist/plugin.js CHANGED
@@ -1323,10 +1323,41 @@ async function archiveProgress(directory) {
1323
1323
  }
1324
1324
  }
1325
1325
  }
1326
+ /**
1327
+ * Build a descriptive commit message from tasks.md context + diff stat.
1328
+ * Format: "feat(ultrawork): <task-name-short> [L<level>]"
1329
+ * Body: diff stat + phase info
1330
+ */
1331
+ async function buildCommitMessage(directory, diffStat) {
1332
+ try {
1333
+ const ctx = await parseTasksFile(directory);
1334
+ if (ctx) {
1335
+ // Truncate task name to ~45 chars for subject line
1336
+ let taskShort = ctx.task;
1337
+ if (taskShort.length > 45) {
1338
+ taskShort = taskShort.slice(0, 42) + "...";
1339
+ }
1340
+ const subject = `feat(ultrawork): ${taskShort}`;
1341
+ const parts = [];
1342
+ parts.push(`- Level: ${ctx.level}`);
1343
+ if (ctx.intent)
1344
+ parts.push(`- Intent: ${ctx.intent}`);
1345
+ if (ctx.category)
1346
+ parts.push(`- Category: ${ctx.category}`);
1347
+ parts.push(`- Phase: ${ctx.phase}`);
1348
+ if (diffStat)
1349
+ parts.push("", diffStat);
1350
+ return `${subject}\n\n${parts.join("\n")}`;
1351
+ }
1352
+ }
1353
+ catch { /* fallback below */ }
1354
+ // Fallback: no tasks.md or parse failed
1355
+ const body = diffStat ? `\n\n${diffStat}` : "";
1356
+ return `chore(ultrawork): cycle auto-commit${body}`;
1357
+ }
1326
1358
  /**
1327
1359
  * Helper: run git add + diff-stat + commit with descriptive message.
1328
- * Builds commit body from `git diff --cached --stat` so the commit
1329
- * is not an opaque "auto-commit" but shows what changed.
1360
+ * Reads tasks.md to build a meaningful commit subject from task context.
1330
1361
  * Returns true if commit succeeded (or nothing to commit), false on error.
1331
1362
  */
1332
1363
  function runGitCommit(directory) {
@@ -1339,10 +1370,9 @@ function runGitCommit(directory) {
1339
1370
  return;
1340
1371
  }
1341
1372
  // Get diff stat for commit body
1342
- (0, child_process_1.execFile)("git", ["diff", "--cached", "--stat"], { cwd: directory }, (_diffErr, diffOut) => {
1373
+ (0, child_process_1.execFile)("git", ["diff", "--cached", "--stat"], { cwd: directory }, async (_diffErr, diffOut) => {
1343
1374
  const stat = (diffOut ?? "").trim();
1344
- const body = stat ? `\n\n${stat}` : "";
1345
- const message = `chore: ultrawork cycle auto-commit${body}`;
1375
+ const message = await buildCommitMessage(directory, stat);
1346
1376
  (0, child_process_1.execFile)("git", ["commit", "-m", message], { cwd: directory }, (commitErr, stdout, stderr) => {
1347
1377
  if (commitErr) {
1348
1378
  if (stderr?.includes("nothing to commit") || stdout?.includes("nothing to commit")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-immune",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "description": "OpenCode plugin: session recovery, auto-retry, multi-cycle automation, context monitoring",
5
5
  "exports": {
6
6
  "./server": "./dist/plugin.js"