gnhf 0.1.37 → 0.1.38

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/README.md CHANGED
@@ -159,6 +159,7 @@ Pass `--current-branch` to run on the branch you are already on instead of creat
159
159
  Pass `--push` to push the current branch after each successful iteration.
160
160
  Together, `--current-branch --push` is useful for loose projects where you want a deployed or locally watched branch to update throughout the run.
161
161
 
162
+ - Re-running the same prompt with `--current-branch` resumes the existing `.gnhf/runs/<runId>/` history on a clean working tree and continues iteration numbering.
162
163
  - Push failures abort the run after preserving the successful local commit.
163
164
  - gnhf never force-pushes or auto-pulls for this mode.
164
165
  - `--push` also works with the default `gnhf/` branch mode and sets `origin` as the upstream when needed.
@@ -276,7 +277,7 @@ You can also pass a raw custom ACP server command directly as a quoted `acp:` sp
276
277
 
277
278
  - Omit it to keep the default `gnhf <iteration>: <summary>` format.
278
279
  - Set `preset: conventional` to ask the agent for `type` and optional `scope`, then commit as `type(scope): summary` for semantic-release style workflows. Valid types are `build`, `ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `test`, and `chore`; invalid or missing types fall back to `chore`, and empty scopes are omitted.
279
- - The resolved commit-message convention is saved per run, so resuming a `gnhf/` branch keeps the original subject format even if `config.yml` changes later.
280
+ - The resolved commit-message convention is saved per run, so resuming keeps the original subject format even if `config.yml` changes later.
280
281
 
281
282
  ### Custom Agent Paths
282
283
 
package/dist/cli.mjs CHANGED
@@ -18138,10 +18138,19 @@ function initializeNewBranch(prompt, cwd, schemaOptions) {
18138
18138
  const runId = createBranchWithSuffix(slugifyPrompt(prompt), cwd).split("/")[1];
18139
18139
  return setupRun(runId, prompt, baseCommit, cwd, schemaOptions);
18140
18140
  }
18141
+ function promptRunId(prompt) {
18142
+ return slugifyPrompt(prompt).split("/")[1];
18143
+ }
18144
+ function resumeCurrentBranchRun(prompt, cwd, schemaOptions) {
18145
+ const runId = promptRunId(prompt);
18146
+ if (!existsSync(join(cwd, ".gnhf", "runs", runId))) return null;
18147
+ ensureCleanWorkingTree(cwd);
18148
+ return resumeRun(runId, cwd, schemaOptions);
18149
+ }
18141
18150
  function initializeCurrentBranchRun(prompt, cwd, schemaOptions) {
18142
18151
  ensureCleanWorkingTree(cwd);
18143
18152
  const baseCommit = getHeadCommit(cwd);
18144
- return setupRun(createRunIdWithSuffix(slugifyPrompt(prompt).split("/")[1], cwd), prompt, baseCommit, cwd, schemaOptions);
18153
+ return setupRun(createRunIdWithSuffix(promptRunId(prompt), cwd), prompt, baseCommit, cwd, schemaOptions);
18145
18154
  }
18146
18155
  function branchNameWithSuffix(branchName, suffix) {
18147
18156
  return suffix === 0 ? branchName : `${branchName}-${suffix}`;
@@ -18443,7 +18452,14 @@ program.name("gnhf").description("Before I go to bed, I tell my agents: good nig
18443
18452
  program.help();
18444
18453
  return;
18445
18454
  }
18446
- runInfo = initializeCurrentBranchRun(prompt, cwd, schemaOptions);
18455
+ const existing = resumeCurrentBranchRun(prompt, cwd, buildResumeSchemaOptions(options.stopWhen, effectiveCommitMessage));
18456
+ if (existing) {
18457
+ runInfo = existing;
18458
+ effectiveStopWhen = existing.stopWhen;
18459
+ effectiveCommitMessage = existing.commitMessage;
18460
+ schemaOptions = buildSchemaOptions(effectiveStopWhen, effectiveCommitMessage);
18461
+ startIteration = getLastIterationNumber(existing);
18462
+ } else runInfo = initializeCurrentBranchRun(prompt, cwd, schemaOptions);
18447
18463
  } else if (onGnhfBranch) {
18448
18464
  const existingRunId = currentBranch.slice(5);
18449
18465
  const existingMetadata = peekRunMetadata(existingRunId, cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gnhf",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "Before I go to bed, I tell my agents: good night, have fun",
5
5
  "type": "module",
6
6
  "bin": {