@staff0rd/assist 0.92.5 → 0.93.1

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
@@ -56,6 +56,7 @@ After installation, the `assist` command will be available globally. You can als
56
56
  - `assist new cli` - Initialize a new tsup CLI project
57
57
  - `assist sync` - Copy command files to `~/.claude/commands`
58
58
  - `assist commit status` - Show git status and diff
59
+ - `assist commit <message>` - Commit staged changes with validation
59
60
  - `assist commit <files...> <message>` - Stage files and create a git commit with validation
60
61
  - `assist prs` - List pull requests for the current repository
61
62
  - `assist prs list-comments` - List all comments on the current branch's pull request
@@ -6,7 +6,11 @@ Review the git status and create a commit with only the files that are relevant
6
6
 
7
7
  First run `assist commit status` to see the current state of the working tree.
8
8
 
9
- Then use `assist commit <file1> <file2> ... "your message"` where:
9
+ Then either:
10
+ - `assist commit "your message"` to commit already-staged changes, or
11
+ - `assist commit <file1> <file2> ... "your message"` to stage files and commit
12
+
13
+ Where:
10
14
  - Each file argument is a path to git add before committing
11
15
  - The last argument is the commit message
12
16
  - The commit message is 40 characters or less
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.92.5",
9
+ version: "0.93.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -217,7 +217,15 @@ function getTranscriptConfig() {
217
217
  return config.transcript;
218
218
  }
219
219
 
220
- // src/commands/commit.ts
220
+ // src/shared/shellQuote.ts
221
+ function shellQuote(arg) {
222
+ if (/[^a-zA-Z0-9_./:=@%^+,-]/.test(arg)) {
223
+ return `'${arg.replace(/'/g, "'\\''")}'`;
224
+ }
225
+ return arg;
226
+ }
227
+
228
+ // src/commands/commit/validateMessage.ts
221
229
  var MAX_MESSAGE_LENGTH = 50;
222
230
  var CONVENTIONAL_COMMIT_REGEX = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(!)?(\(.+\))?!?: .+$/;
223
231
  function validateMessage(message, config) {
@@ -238,23 +246,25 @@ function validateMessage(message, config) {
238
246
  process.exit(1);
239
247
  }
240
248
  }
241
- function escapeShell(s) {
242
- return `"${s.replace(/"/g, '\\"')}"`;
243
- }
244
- function stageAndCommit(files, message) {
245
- const escaped = files.map(escapeShell).join(" ");
246
- execSync(`git add ${escaped}`, { stdio: "inherit" });
247
- execSync(`git commit -m ${escapeShell(message)}`, { stdio: "inherit" });
249
+
250
+ // src/commands/commit.ts
251
+ function commitStaged(message) {
252
+ execSync(`git commit -m ${shellQuote(message)}`, { stdio: "inherit" });
248
253
  return execSync("git rev-parse --short=7 HEAD", {
249
254
  encoding: "utf-8"
250
255
  }).trim();
251
256
  }
257
+ function stageAndCommit(files, message) {
258
+ const escaped = files.map(shellQuote).join(" ");
259
+ execSync(`git add ${escaped}`, { stdio: "inherit" });
260
+ return commitStaged(message);
261
+ }
252
262
  function execCommit(files, message, config) {
253
263
  try {
254
264
  if (config.commit?.pull) {
255
265
  execSync("git pull", { stdio: "inherit" });
256
266
  }
257
- const sha = stageAndCommit(files, message);
267
+ const sha = files.length > 0 ? stageAndCommit(files, message) : commitStaged(message);
258
268
  console.log(`Committed: ${sha}`);
259
269
  if (config.commit?.push) {
260
270
  execSync("git push", { stdio: "inherit" });
@@ -272,8 +282,8 @@ function commit(args) {
272
282
  });
273
283
  return;
274
284
  }
275
- if (args.length < 2) {
276
- console.error("Usage: assist commit <files...> <message>");
285
+ if (args.length < 1) {
286
+ console.error("Usage: assist commit [files...] <message>");
277
287
  process.exit(1);
278
288
  }
279
289
  const message = args[args.length - 1];
@@ -1423,14 +1433,8 @@ Total: ${lines.length} hardcoded color(s)`);
1423
1433
 
1424
1434
  // src/commands/verify/run/resolveEntries.ts
1425
1435
  import * as path13 from "path";
1426
- function quoteIfNeeded(arg) {
1427
- if (/[^a-zA-Z0-9_./:=@%^+,-]/.test(arg)) {
1428
- return `'${arg.replace(/'/g, "'\\''")}'`;
1429
- }
1430
- return arg;
1431
- }
1432
1436
  function buildFullCommand(command, args) {
1433
- return [quoteIfNeeded(command), ...(args ?? []).map(quoteIfNeeded)].join(" ");
1437
+ return [shellQuote(command), ...(args ?? []).map(shellQuote)].join(" ");
1434
1438
  }
1435
1439
  function getRunEntries() {
1436
1440
  const { run: run3 } = loadConfig();
@@ -5945,15 +5949,9 @@ function add2() {
5945
5949
  }
5946
5950
 
5947
5951
  // src/commands/run/index.ts
5948
- function quoteIfNeeded2(arg) {
5949
- if (/[^a-zA-Z0-9_./:=@%^+,-]/.test(arg)) {
5950
- return `'${arg.replace(/'/g, "'\\''")}'`;
5951
- }
5952
- return arg;
5953
- }
5954
5952
  function buildCommand(command, configArgs, extraArgs) {
5955
5953
  const allArgs = [...configArgs, ...extraArgs];
5956
- return [quoteIfNeeded2(command), ...allArgs.map(quoteIfNeeded2)].join(" ");
5954
+ return [shellQuote(command), ...allArgs.map(shellQuote)].join(" ");
5957
5955
  }
5958
5956
  function printAvailableConfigs(configs) {
5959
5957
  console.error("Available configurations:");
@@ -6137,11 +6135,11 @@ function getInstallDir() {
6137
6135
  }
6138
6136
  function isGitRepo(dir) {
6139
6137
  try {
6140
- execSync27("git rev-parse --is-inside-work-tree", {
6138
+ const result = execSync27("git rev-parse --show-toplevel", {
6141
6139
  cwd: dir,
6142
6140
  stdio: "pipe"
6143
- });
6144
- return true;
6141
+ }).toString().trim();
6142
+ return path30.resolve(result) === path30.resolve(dir);
6145
6143
  } catch {
6146
6144
  return false;
6147
6145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.92.5",
3
+ "version": "0.93.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {