@staff0rd/assist 0.90.0 → 0.92.0
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 +2 -1
- package/claude/commands/commit.md +6 -4
- package/dist/index.js +38 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,7 +55,8 @@ After installation, the `assist` command will be available globally. You can als
|
|
|
55
55
|
- `assist new vite` - Initialize a new Vite React TypeScript project
|
|
56
56
|
- `assist new cli` - Initialize a new tsup CLI project
|
|
57
57
|
- `assist sync` - Copy command files to `~/.claude/commands`
|
|
58
|
-
- `assist commit
|
|
58
|
+
- `assist commit status` - Show git status and diff
|
|
59
|
+
- `assist commit <files...> <message>` - Stage files and create a git commit with validation
|
|
59
60
|
- `assist prs` - List pull requests for the current repository
|
|
60
61
|
- `assist prs list-comments` - List all comments on the current branch's pull request
|
|
61
62
|
- `assist prs fixed <comment-id> <sha>` - Reply with commit link and resolve thread
|
|
@@ -4,8 +4,10 @@ description: Commit only relevant files from the session
|
|
|
4
4
|
|
|
5
5
|
Review the git status and create a commit with only the files that are relevant to the current session. Write a clear, concise commit message that describes what changed and why. Do not reference Claude or any AI assistance in the commit message.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- 40 characters or less
|
|
9
|
-
- Does not reference Claude
|
|
7
|
+
First run `assist commit status` to see the current state of the working tree.
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
Then use `assist commit <file1> <file2> ... "your message"` where:
|
|
10
|
+
- Each file argument is a path to git add before committing
|
|
11
|
+
- The last argument is the commit message
|
|
12
|
+
- The commit message is 40 characters or less
|
|
13
|
+
- The commit message does not reference Claude
|
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.
|
|
9
|
+
version: "0.92.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -220,8 +220,7 @@ function getTranscriptConfig() {
|
|
|
220
220
|
// src/commands/commit.ts
|
|
221
221
|
var MAX_MESSAGE_LENGTH = 50;
|
|
222
222
|
var CONVENTIONAL_COMMIT_REGEX = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(!)?(\(.+\))?!?: .+$/;
|
|
223
|
-
function
|
|
224
|
-
const config = loadConfig();
|
|
223
|
+
function validateMessage(message, config) {
|
|
225
224
|
if (message.toLowerCase().includes("claude")) {
|
|
226
225
|
console.error("Error: Commit message must not reference Claude");
|
|
227
226
|
process.exit(1);
|
|
@@ -238,16 +237,24 @@ function commit(message) {
|
|
|
238
237
|
);
|
|
239
238
|
process.exit(1);
|
|
240
239
|
}
|
|
240
|
+
}
|
|
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" });
|
|
248
|
+
return execSync("git rev-parse --short=7 HEAD", {
|
|
249
|
+
encoding: "utf-8"
|
|
250
|
+
}).trim();
|
|
251
|
+
}
|
|
252
|
+
function execCommit(files, message, config) {
|
|
241
253
|
try {
|
|
242
254
|
if (config.commit?.pull) {
|
|
243
255
|
execSync("git pull", { stdio: "inherit" });
|
|
244
256
|
}
|
|
245
|
-
|
|
246
|
-
stdio: "inherit"
|
|
247
|
-
});
|
|
248
|
-
const sha = execSync("git rev-parse --short=7 HEAD", {
|
|
249
|
-
encoding: "utf-8"
|
|
250
|
-
}).trim();
|
|
257
|
+
const sha = stageAndCommit(files, message);
|
|
251
258
|
console.log(`Committed: ${sha}`);
|
|
252
259
|
if (config.commit?.push) {
|
|
253
260
|
execSync("git push", { stdio: "inherit" });
|
|
@@ -258,6 +265,23 @@ function commit(message) {
|
|
|
258
265
|
process.exit(1);
|
|
259
266
|
}
|
|
260
267
|
}
|
|
268
|
+
function commit(args) {
|
|
269
|
+
if (args[0] === "status") {
|
|
270
|
+
execSync("git status && echo '---DIFF---' && git diff", {
|
|
271
|
+
stdio: "inherit"
|
|
272
|
+
});
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (args.length < 2) {
|
|
276
|
+
console.error("Usage: assist commit <files...> <message>");
|
|
277
|
+
process.exit(1);
|
|
278
|
+
}
|
|
279
|
+
const message = args[args.length - 1];
|
|
280
|
+
const files = args.slice(0, -1);
|
|
281
|
+
const config = loadConfig();
|
|
282
|
+
validateMessage(message, config);
|
|
283
|
+
execCommit(files, message, config);
|
|
284
|
+
}
|
|
261
285
|
|
|
262
286
|
// src/commands/config/index.ts
|
|
263
287
|
import chalk2 from "chalk";
|
|
@@ -1136,7 +1160,7 @@ async function promptForOptions(options2) {
|
|
|
1136
1160
|
console.log(chalk17.bold("Available VS Code configurations to add:\n"));
|
|
1137
1161
|
return promptMultiselect("Select configurations to add:", options2);
|
|
1138
1162
|
}
|
|
1139
|
-
async function init3() {
|
|
1163
|
+
async function init3({ all = false } = {}) {
|
|
1140
1164
|
const { pkg } = requirePackageJson();
|
|
1141
1165
|
const setup2 = detectVscodeSetup(pkg);
|
|
1142
1166
|
const options2 = getAvailableOptions2(setup2);
|
|
@@ -1144,7 +1168,7 @@ async function init3() {
|
|
|
1144
1168
|
console.log(chalk17.green("VS Code configuration already exists!"));
|
|
1145
1169
|
return;
|
|
1146
1170
|
}
|
|
1147
|
-
const selected = await promptForOptions(options2);
|
|
1171
|
+
const selected = all ? options2.map((o) => o.value) : await promptForOptions(options2);
|
|
1148
1172
|
if (selected.length === 0) {
|
|
1149
1173
|
console.log(chalk17.yellow("No configurations selected"));
|
|
1150
1174
|
return;
|
|
@@ -1851,7 +1875,8 @@ async function newProject() {
|
|
|
1851
1875
|
initGit();
|
|
1852
1876
|
removeEslint({ removeLintScripts: true });
|
|
1853
1877
|
addViteBaseConfig();
|
|
1854
|
-
await
|
|
1878
|
+
await init3({ all: true });
|
|
1879
|
+
await init2();
|
|
1855
1880
|
await init5();
|
|
1856
1881
|
}
|
|
1857
1882
|
function addViteBaseConfig() {
|
|
@@ -6144,7 +6169,7 @@ var program = new Command();
|
|
|
6144
6169
|
program.name("assist").description("CLI application").version(package_default.version);
|
|
6145
6170
|
program.command("sync").description("Copy command files to ~/.claude/commands").option("-y, --yes", "Overwrite settings.json without prompting").action((options2) => sync(options2));
|
|
6146
6171
|
program.command("init").description("Initialize VS Code and verify configurations").action(init4);
|
|
6147
|
-
program.command("commit
|
|
6172
|
+
program.command("commit").description("Create a git commit with validation").argument("<args...>", "status | <files...> <message>").action(commit);
|
|
6148
6173
|
var configCommand = program.command("config").description("View and modify assist.yml configuration");
|
|
6149
6174
|
configCommand.command("set <key> <value>").description("Set a config value (e.g. commit.push true)").action(configSet);
|
|
6150
6175
|
configCommand.command("get <key>").description("Get a config value").action(configGet);
|