nightralph 0.0.38 → 0.0.41

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
@@ -39,6 +39,7 @@ so they can't drift as long as you install the skills with this package.
39
39
  + [`pi` + OpenRouter model](#pi--openrouter-model)
40
40
  + [`codex` + Luna](#codex--luna)
41
41
  + [`codex` + Terra](#codex--terra)
42
+ + [Mercury](#mercury)
42
43
 
43
44
  <!-- tocstop -->
44
45
 
@@ -300,7 +301,7 @@ keep the machine awake, but the display can still go dark.
300
301
  #### Claude Opus 4.6
301
302
 
302
303
  ```sh
303
- caffeinate -i npx nightralph claude -m claude-opus-4-6 --effort high
304
+ caffeinate -i npx nightralph claude -m claude-opus-4-6 --effort low
304
305
  ```
305
306
 
306
307
  #### Claude Sonnet 5
@@ -312,13 +313,9 @@ caffeinate -i npx nightralph claude -m claude-sonnet-5 --effort high
312
313
  #### `pi` + OpenRouter model
313
314
 
314
315
  ```sh
315
- caffeinate -i npx nightralph pi -m openrouter/z-ai/glm-5.3-flash --thinking high
316
+ caffeinate -i npx nightralph pi -m openrouter/z-ai/glm-5.3-flash --effort high
316
317
  ```
317
318
 
318
- ##### pi `--thinking` levels
319
-
320
- `off`, `minimal`, `low`, `medium`,`high`, and `xhigh`
321
-
322
319
  #### `codex` + Luna
323
320
 
324
321
  ```sh
@@ -328,5 +325,11 @@ caffeinate -i npx nightralph codex -m gpt-5.6-luna --effort high
328
325
  #### `codex` + Terra
329
326
 
330
327
  ```sh
331
- caffeinate -i npx nightralph codex -m gpt-5.6-luna --effort medium
328
+ caffeinate -i npx nightralph codex -m gpt-5.6-terra --effort medium
329
+ ```
330
+
331
+ #### Mercury
332
+
333
+ ```sh
334
+ caffeinate -i npx nightralph pi -m openrouter/inception/mercury-2.5 --effort high
332
335
  ```
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
4
4
 
5
5
  // src/index.ts
6
6
  import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:fs";
7
- import { dirname as dirname3, join as join6 } from "node:path";
7
+ import { dirname as dirname4, join as join6 } from "node:path";
8
8
  import yargs from "yargs";
9
9
  import { hideBin } from "yargs/helpers";
10
10
  import { select as select2 } from "@inquirer/prompts";
@@ -205,14 +205,14 @@ import {
205
205
  readdirSync as readdirSync2
206
206
  } from "node:fs";
207
207
  import { tmpdir } from "node:os";
208
- import { join as join4, dirname, basename as basename2 } from "node:path";
208
+ import { join as join4, dirname as dirname2, basename as basename2 } from "node:path";
209
209
  import { createInterface } from "node:readline";
210
210
  import { promisify as promisify4 } from "node:util";
211
211
 
212
212
  // src/worktree.ts
213
213
  import { execFile, execFileSync } from "node:child_process";
214
214
  import { promisify } from "node:util";
215
- import { basename, join as join2 } from "node:path";
215
+ import { basename, dirname, join as join2, resolve } from "node:path";
216
216
  import { existsSync as existsSync2 } from "node:fs";
217
217
  var execFileAsync = promisify(execFile);
218
218
  function getRepoRoot() {
@@ -225,7 +225,12 @@ function getRepoRoot() {
225
225
  }
226
226
  __name(getRepoRoot, "getRepoRoot");
227
227
  function getRepoName() {
228
- return basename(getRepoRoot());
228
+ const commonDir = execFileSync(
229
+ "git",
230
+ ["rev-parse", "--git-common-dir"],
231
+ { encoding: "utf8" }
232
+ ).trim();
233
+ return basename(dirname(resolve(commonDir)));
229
234
  }
230
235
  __name(getRepoName, "getRepoName");
231
236
  function getCurrentBranch() {
@@ -237,6 +242,24 @@ function getCurrentBranch() {
237
242
  return stdout.trim();
238
243
  }
239
244
  __name(getCurrentBranch, "getCurrentBranch");
245
+ function branchExistsSync(repoRoot, branchName) {
246
+ try {
247
+ execFileSync(
248
+ "git",
249
+ [
250
+ "show-ref",
251
+ "--verify",
252
+ "--quiet",
253
+ `refs/heads/${branchName}`
254
+ ],
255
+ { cwd: repoRoot }
256
+ );
257
+ return true;
258
+ } catch {
259
+ return false;
260
+ }
261
+ }
262
+ __name(branchExistsSync, "branchExistsSync");
240
263
  async function branchExists(repoRoot, branchName) {
241
264
  try {
242
265
  await execFileAsync(
@@ -250,11 +273,19 @@ async function branchExists(repoRoot, branchName) {
250
273
  }
251
274
  }
252
275
  __name(branchExists, "branchExists");
276
+ function buildBranchName(repoRoot, repoName, ticket) {
277
+ const num = String(ticket.num).padStart(2, "0");
278
+ const sep = branchExistsSync(repoRoot, repoName) ? "--" : "/";
279
+ return `${repoName}${sep}${num}-${ticket.slug}`;
280
+ }
281
+ __name(buildBranchName, "buildBranchName");
253
282
  async function createWorktreeNow(opts) {
254
283
  const { repoRoot, repoName, baseBranch, ticket } = opts;
255
- const branchName = `${repoName}/${String(
256
- ticket.num
257
- ).padStart(2, "0")}-${ticket.slug}`;
284
+ const branchName = buildBranchName(
285
+ repoRoot,
286
+ repoName,
287
+ ticket
288
+ );
258
289
  const worktreePath = join2(
259
290
  repoRoot,
260
291
  "..",
@@ -1043,7 +1074,7 @@ function detectTestCmd(projectDir) {
1043
1074
  }
1044
1075
  __name(detectTestCmd, "detectTestCmd");
1045
1076
  function runTestCmd(opts) {
1046
- return new Promise((resolve) => {
1077
+ return new Promise((resolve2) => {
1047
1078
  let settled = false;
1048
1079
  const child = spawn("sh", ["-c", opts.cmd], {
1049
1080
  cwd: opts.cwd,
@@ -1075,7 +1106,7 @@ function runTestCmd(opts) {
1075
1106
  opts.registry.delete(child.pid);
1076
1107
  }
1077
1108
  chunks.push(String(err));
1078
- resolve({
1109
+ resolve2({
1079
1110
  exitCode: 1,
1080
1111
  output: chunks.join("")
1081
1112
  });
@@ -1087,7 +1118,7 @@ function runTestCmd(opts) {
1087
1118
  if (child.pid !== void 0 && opts.registry) {
1088
1119
  opts.registry.delete(child.pid);
1089
1120
  }
1090
- resolve({
1121
+ resolve2({
1091
1122
  exitCode: code ?? 1,
1092
1123
  output: chunks.join("")
1093
1124
  });
@@ -1813,7 +1844,7 @@ function spawnAgent(opts) {
1813
1844
  proc.stdin.write(opts.prompt);
1814
1845
  }
1815
1846
  proc.stdin.end();
1816
- return new Promise((resolve) => {
1847
+ return new Promise((resolve2) => {
1817
1848
  let settled = false;
1818
1849
  let graceTimer;
1819
1850
  function finish(exitCode) {
@@ -1839,7 +1870,7 @@ function spawnAgent(opts) {
1839
1870
  rlErr.close();
1840
1871
  logStream.end();
1841
1872
  if (promptFile) cleanupPromptFile(promptFile);
1842
- resolve({ exitCode, completedItems, timedOut });
1873
+ resolve2({ exitCode, completedItems, timedOut });
1843
1874
  }
1844
1875
  __name(finish, "finish");
1845
1876
  proc.on("exit", (code) => {
@@ -1869,7 +1900,7 @@ function spawnAgent(opts) {
1869
1900
  "Agent process error:",
1870
1901
  formatErrorMessage(err)
1871
1902
  );
1872
- resolve({
1903
+ resolve2({
1873
1904
  exitCode: 1,
1874
1905
  completedItems,
1875
1906
  timedOut
@@ -1920,7 +1951,11 @@ function dryRunIsolated(opts) {
1920
1951
  );
1921
1952
  for (const t of ready) {
1922
1953
  const num = String(t.num).padStart(2, "0");
1923
- const branchName = `${opts.repoName}/${num}-${t.slug}`;
1954
+ const branchName = buildBranchName(
1955
+ opts.repoRoot,
1956
+ opts.repoName,
1957
+ t
1958
+ );
1924
1959
  const worktreePath = `../${opts.repoName}.${num}-${t.slug}`;
1925
1960
  console.log(` worktree: ${worktreePath}`);
1926
1961
  console.log(` branch: ${branchName}`);
@@ -2087,7 +2122,7 @@ function retryDelayFor(base, attempt) {
2087
2122
  }
2088
2123
  __name(retryDelayFor, "retryDelayFor");
2089
2124
  function sleep(ms) {
2090
- return new Promise((resolve) => setTimeout(resolve, ms));
2125
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
2091
2126
  }
2092
2127
  __name(sleep, "sleep");
2093
2128
  function attemptLogPath(logsDir, ticket, attempt, ext) {
@@ -2420,7 +2455,7 @@ async function runWavesIsolated(opts) {
2420
2455
  );
2421
2456
  }
2422
2457
  const progressPath = join4(
2423
- dirname(opts.logsDir),
2458
+ dirname2(opts.logsDir),
2424
2459
  "progress.md"
2425
2460
  );
2426
2461
  const progress = mergeProgress(
@@ -2755,11 +2790,11 @@ __name(runWavesIsolated, "runWavesIsolated");
2755
2790
 
2756
2791
  // src/resolve.ts
2757
2792
  import { existsSync as existsSync4, readdirSync as readdirSync3 } from "node:fs";
2758
- import { dirname as dirname2, join as join5 } from "node:path";
2793
+ import { dirname as dirname3, join as join5 } from "node:path";
2759
2794
  import { fileURLToPath } from "node:url";
2760
2795
  import { select } from "@inquirer/prompts";
2761
2796
  function getScriptDir(metaUrl) {
2762
- return dirname2(fileURLToPath(metaUrl));
2797
+ return dirname3(fileURLToPath(metaUrl));
2763
2798
  }
2764
2799
  __name(getScriptDir, "getScriptDir");
2765
2800
  function findFeatureDirs(cwd) {
@@ -2986,7 +3021,7 @@ async function runExecute(argv) {
2986
3021
  (b) => knownNums.has(b)
2987
3022
  );
2988
3023
  }
2989
- const logsDir = join6(dirname3(dir), "logs");
3024
+ const logsDir = join6(dirname4(dir), "logs");
2990
3025
  const timeout = argv.timeout ?? 900;
2991
3026
  const testCmd = argv.testCmd || detectTestCmd(
2992
3027
  isGitRepo() ? getRepoRoot() : process.cwd()
@@ -2994,15 +3029,17 @@ async function runExecute(argv) {
2994
3029
  const featureName = extractFeatureName(spec);
2995
3030
  const conflictStrategy = argv.stopOnConflict ? "stop" : "respawn";
2996
3031
  const progressPath = join6(
2997
- dirname3(dir),
3032
+ dirname4(dir),
2998
3033
  "progress.md"
2999
3034
  );
3000
3035
  if (argv.dryRun) {
3001
3036
  if (isGitRepo()) {
3037
+ const repoRoot = getRepoRoot();
3002
3038
  const repoName = getRepoName();
3003
3039
  dryRunIsolated({
3004
3040
  tickets,
3005
3041
  specBody,
3042
+ repoRoot,
3006
3043
  repoName,
3007
3044
  conflictStrategy,
3008
3045
  progressPath,