@staff0rd/assist 0.347.0 → 0.349.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 +5 -1
- package/claude/commands/branch.md +34 -0
- package/claude/commands/update-jira.md +53 -0
- package/dist/commands/sessions/web/bundle.js +86 -86
- package/dist/index.js +37 -19
- package/package.json +1 -1
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.349.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -202,7 +202,8 @@ var assistConfigSchema = z2.strictObject({
|
|
|
202
202
|
expectedBranch: z2.string().optional()
|
|
203
203
|
}).default({ conventional: false, pull: false, push: false }),
|
|
204
204
|
branch: z2.strictObject({
|
|
205
|
-
prefix: z2.string().optional()
|
|
205
|
+
prefix: z2.string().optional(),
|
|
206
|
+
defaultBranch: z2.string().optional()
|
|
206
207
|
}).optional(),
|
|
207
208
|
devlog: z2.strictObject({
|
|
208
209
|
name: z2.string().optional(),
|
|
@@ -8719,18 +8720,20 @@ function buildBranchName({
|
|
|
8719
8720
|
|
|
8720
8721
|
// src/commands/branch/resolveDefaultBranch.ts
|
|
8721
8722
|
import { execSync as execSync23 } from "child_process";
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8723
|
+
var REMOTE_HEAD_REGEX = /^ref:\s+refs\/heads\/(\S+)\s+HEAD$/m;
|
|
8724
|
+
function resolveDefaultBranch(override, cwd) {
|
|
8725
|
+
if (override) return override;
|
|
8726
|
+
try {
|
|
8727
|
+
const output = execSync23("git ls-remote --symref origin HEAD", {
|
|
8728
|
+
encoding: "utf8",
|
|
8729
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
8730
|
+
cwd
|
|
8731
|
+
});
|
|
8732
|
+
const match = output.match(REMOTE_HEAD_REGEX);
|
|
8733
|
+
if (match) return match[1];
|
|
8734
|
+
} catch {
|
|
8732
8735
|
}
|
|
8733
|
-
return
|
|
8736
|
+
return "main";
|
|
8734
8737
|
}
|
|
8735
8738
|
|
|
8736
8739
|
// src/commands/branch/validateSlug.ts
|
|
@@ -8767,7 +8770,7 @@ function branch(slug, options2) {
|
|
|
8767
8770
|
slug
|
|
8768
8771
|
});
|
|
8769
8772
|
try {
|
|
8770
|
-
const defaultBranch = resolveDefaultBranch();
|
|
8773
|
+
const defaultBranch = resolveDefaultBranch(config.branch?.defaultBranch);
|
|
8771
8774
|
execSync24("git fetch", { stdio: "inherit" });
|
|
8772
8775
|
execSync24(
|
|
8773
8776
|
`git switch -c ${shellQuote(branchName)} ${shellQuote(`origin/${defaultBranch}`)}`,
|
|
@@ -8777,7 +8780,10 @@ function branch(slug, options2) {
|
|
|
8777
8780
|
`Created and switched to ${branchName} (from origin/${defaultBranch})`
|
|
8778
8781
|
);
|
|
8779
8782
|
process.exit(0);
|
|
8780
|
-
} catch {
|
|
8783
|
+
} catch (error) {
|
|
8784
|
+
console.error(
|
|
8785
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
8786
|
+
);
|
|
8781
8787
|
process.exit(1);
|
|
8782
8788
|
}
|
|
8783
8789
|
}
|
|
@@ -8931,14 +8937,26 @@ var BUILTIN_DENIES = [
|
|
|
8931
8937
|
message: `Do not run 'git commit' directly. Use 'assist commit "<message>"' instead.`
|
|
8932
8938
|
}
|
|
8933
8939
|
];
|
|
8940
|
+
var BRANCH_CREATION_MESSAGE = "Do not create branches with raw git. Use the /branch command, or 'assist branch <slug> [--jira <KEY>]' \u2014 it branches off the fresh remote default and enforces the team naming convention.";
|
|
8941
|
+
var BRANCH_CREATION_REGEXES = [
|
|
8942
|
+
/(?<=^|\s)git\s+(?:checkout|co)\s+-[bB](?=\s|$)/,
|
|
8943
|
+
/(?<=^|\s)git\s+switch\s+(?:-[cC]|--create)(?=\s|$)/,
|
|
8944
|
+
/(?<=^|\s)git\s+branch\s+(?!-)\S/
|
|
8945
|
+
];
|
|
8934
8946
|
function rawDenyRegex(pattern2) {
|
|
8935
8947
|
const tokens = pattern2.trim().split(/\s+/).map((token) => token.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`\s+`);
|
|
8936
8948
|
return new RegExp(`(?<=^|\\s)${tokens}(?=\\s|$)`);
|
|
8937
8949
|
}
|
|
8938
|
-
var RAW_BUILTIN_DENIES =
|
|
8939
|
-
...rule
|
|
8940
|
-
|
|
8941
|
-
|
|
8950
|
+
var RAW_BUILTIN_DENIES = [
|
|
8951
|
+
...BUILTIN_DENIES.map((rule) => ({
|
|
8952
|
+
message: rule.message,
|
|
8953
|
+
regex: rawDenyRegex(rule.pattern)
|
|
8954
|
+
})),
|
|
8955
|
+
...BRANCH_CREATION_REGEXES.map((regex) => ({
|
|
8956
|
+
message: BRANCH_CREATION_MESSAGE,
|
|
8957
|
+
regex
|
|
8958
|
+
}))
|
|
8959
|
+
];
|
|
8942
8960
|
function matchBuiltinDeny(text7) {
|
|
8943
8961
|
return RAW_BUILTIN_DENIES.find((rule) => rule.regex.test(text7));
|
|
8944
8962
|
}
|