ultrahope 0.1.5 → 0.1.6

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
@@ -51,6 +51,22 @@ git add -A && git ultrahope commit --guide "GHSA-gq3j-xvxp-8hrf: override reason
51
51
  jj ultrahope describe --guide "GHSA-gq3j-xvxp-8hrf: override reason"
52
52
  ```
53
53
 
54
+ If you run `git ultrahope commit` with no staged files, interactive mode now asks whether to stage all changes:
55
+
56
+ ```bash
57
+ # With staged changes:
58
+ git add packages/cli/commands/commit.ts
59
+ git ultrahope commit
60
+
61
+ # Without staged changes:
62
+ git ultrahope commit
63
+ # prompts: No staged changes. Stage all files with `git add -A` and continue? (y/N)
64
+ ```
65
+
66
+ If you answer `y`, Ultrahope runs `git add -A` and continues with staged changes.
67
+ If you answer `n` (or leave the default), it exits with the existing staged-changes error.
68
+ In `--no-interactive` mode, no prompt is shown and it exits immediately when no staged changes exist.
69
+
54
70
  In interactive mode for `git ultrahope commit`, `ultrahope jj describe`, and `ultrahope translate --target vcs-commit-message`, use `r` to reroll and `R` (Shift+r) to reroll with additional instructions.
55
71
 
56
72
  #### Difference Between `guide` And Refine Instructions
@@ -2,6 +2,9 @@
2
2
 
3
3
  // commands/commit.ts
4
4
  import { execSync as execSync2 } from "child_process";
5
+ import * as fs3 from "fs";
6
+ import * as readline4 from "readline";
7
+ import * as tty3 from "tty";
5
8
 
6
9
  // lib/api-client.ts
7
10
  import createClient from "openapi-fetch";
@@ -2010,6 +2013,47 @@ function getStagedDiff() {
2010
2013
  process.exit(1);
2011
2014
  }
2012
2015
  }
2016
+ function canPromptForStagedChanges() {
2017
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
2018
+ return false;
2019
+ }
2020
+ try {
2021
+ fs3.accessSync("/dev/tty", fs3.constants.R_OK);
2022
+ return true;
2023
+ } catch {
2024
+ return false;
2025
+ }
2026
+ }
2027
+ async function promptStageAllChanges() {
2028
+ return new Promise((resolve3) => {
2029
+ const fd = fs3.openSync("/dev/tty", "r");
2030
+ const ttyInput = new tty3.ReadStream(fd);
2031
+ const rl = readline4.createInterface({
2032
+ input: ttyInput,
2033
+ output: process.stdout,
2034
+ terminal: true
2035
+ });
2036
+ rl.question(
2037
+ ui.prompt(
2038
+ "No staged changes. Stage all files with `git add -A` and continue? (y/N) "
2039
+ ),
2040
+ (answer) => {
2041
+ rl.close();
2042
+ ttyInput.destroy();
2043
+ const normalized = answer.trim().toLowerCase();
2044
+ resolve3(normalized === "y");
2045
+ }
2046
+ );
2047
+ });
2048
+ }
2049
+ function stageAllChanges() {
2050
+ try {
2051
+ execSync2("git add -A", { stdio: "inherit" });
2052
+ } catch {
2053
+ console.error("Error: Failed to stage changes with `git add -A`.");
2054
+ process.exit(1);
2055
+ }
2056
+ }
2013
2057
  function commitWithMessage(message) {
2014
2058
  try {
2015
2059
  execSync2(`git commit -m ${JSON.stringify(message)}`, { stdio: "inherit" });
@@ -2026,12 +2070,29 @@ async function commit(args2) {
2026
2070
  apiPath: "/v1/commit-message/stream"
2027
2071
  });
2028
2072
  const models = resolveModels(options.cliModels);
2029
- const diff = getStagedDiff();
2073
+ let diff = getStagedDiff();
2030
2074
  if (!diff.trim()) {
2031
- console.error(
2032
- "Error: No staged changes. Stage files with `git add` first."
2033
- );
2034
- process.exit(1);
2075
+ if (!options.interactive || !canPromptForStagedChanges()) {
2076
+ console.error(
2077
+ "Error: No staged changes. Stage files with `git add` first."
2078
+ );
2079
+ process.exit(1);
2080
+ }
2081
+ const shouldStage = await promptStageAllChanges();
2082
+ if (!shouldStage) {
2083
+ console.error(
2084
+ "Error: No staged changes. Stage files with `git add` first."
2085
+ );
2086
+ process.exit(1);
2087
+ }
2088
+ stageAllChanges();
2089
+ diff = getStagedDiff();
2090
+ if (!diff.trim()) {
2091
+ console.error(
2092
+ "Error: No staged changes. Stage files with `git add` first."
2093
+ );
2094
+ process.exit(1);
2095
+ }
2035
2096
  }
2036
2097
  try {
2037
2098
  const token = await getToken();
@@ -2188,6 +2249,8 @@ Commit options:
2188
2249
  --guide <text> Additional context to guide message generation
2189
2250
  --models <list> Comma-separated model list (overrides config)
2190
2251
  --capture-stream <path> Save commit-message stream as replay JSON
2252
+ When no staged changes are found in interactive mode, you will be prompted
2253
+ to run \`git add -A\` first.
2191
2254
 
2192
2255
  Examples:
2193
2256
  git ultrahope commit # interactive selector (default)
package/dist/index.js CHANGED
@@ -2730,7 +2730,7 @@ function parseArgs(args2) {
2730
2730
  // package.json
2731
2731
  var package_default = {
2732
2732
  name: "ultrahope",
2733
- version: "0.1.5",
2733
+ version: "0.1.6",
2734
2734
  description: "LLM-powered development workflow assistant",
2735
2735
  type: "module",
2736
2736
  license: "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultrahope",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "LLM-powered development workflow assistant",
5
5
  "type": "module",
6
6
  "license": "MIT",