@senomas/pi-git-hat 0.2.0 → 0.2.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/git-hat.ts +14 -7
- package/package.json +1 -1
package/git-hat.ts
CHANGED
|
@@ -1312,13 +1312,19 @@ If the user asks you to make changes, tell them to switch to an appropriate bran
|
|
|
1312
1312
|
if (isBash) {
|
|
1313
1313
|
const cmd = ((event.input as { command?: string }).command ?? "").trim();
|
|
1314
1314
|
|
|
1315
|
-
//
|
|
1316
|
-
if (
|
|
1315
|
+
// Require confirmation for git rebase (any target)
|
|
1316
|
+
if (/\bgit\s+rebase\b/.test(cmd)) {
|
|
1317
|
+
const confirmed = await ctx.ui.confirm(
|
|
1318
|
+
`Rebase onto master? Running: \`${cmd}\``,
|
|
1319
|
+
);
|
|
1320
|
+
if (!confirmed) {
|
|
1321
|
+
return { block: true, reason: "Rebase cancelled by user." };
|
|
1322
|
+
}
|
|
1317
1323
|
return;
|
|
1318
1324
|
}
|
|
1319
1325
|
|
|
1320
1326
|
// Require confirmation for git switch/checkout
|
|
1321
|
-
if (
|
|
1327
|
+
if (/\bgit\s+(switch|checkout)\b/.test(cmd)) {
|
|
1322
1328
|
const confirmed = await ctx.ui.confirm(
|
|
1323
1329
|
`Switch branches? Running: \`${cmd}\``,
|
|
1324
1330
|
);
|
|
@@ -1336,15 +1342,16 @@ If the user asks you to make changes, tell them to switch to an appropriate bran
|
|
|
1336
1342
|
}
|
|
1337
1343
|
}
|
|
1338
1344
|
|
|
1339
|
-
// For known roles: require confirmation for git
|
|
1345
|
+
// For known roles: require confirmation for git rebase/switch/checkout
|
|
1340
1346
|
if (isBash) {
|
|
1341
1347
|
const cmd = ((event.input as { command?: string }).command ?? "").trim();
|
|
1342
|
-
if (
|
|
1348
|
+
if (/\bgit\s+(rebase|switch|checkout)\b/.test(cmd)) {
|
|
1349
|
+
const action = /rebase/.test(cmd) ? "Rebase" : "Switch";
|
|
1343
1350
|
const confirmed = await ctx.ui.confirm(
|
|
1344
|
-
|
|
1351
|
+
`${action} branches? Running: \`${cmd}\``,
|
|
1345
1352
|
);
|
|
1346
1353
|
if (!confirmed) {
|
|
1347
|
-
return { block: true, reason:
|
|
1354
|
+
return { block: true, reason: `${action} cancelled by user.` };
|
|
1348
1355
|
}
|
|
1349
1356
|
return;
|
|
1350
1357
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@senomas/pi-git-hat",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Pi extension for role-based Git branch workflows — wear different hats by switching branches",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": ["pi-package", "git", "workflow", "branching", "roles"],
|