bisgit 0.0.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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/chunks/chunk-5RER3IEO.js +2 -0
- package/dist/chunks/chunk-5WTQIRZS.js +2 -0
- package/dist/chunks/commands-V2SGZOKB.js +6 -0
- package/dist/chunks/demo-PL6P4QST.js +2 -0
- package/dist/chunks/wrapper-UX2PKFOA.js +2 -0
- package/dist/main.js +2 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Alex Dombroski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{spawn as l}from"node:child_process";function p(r,s,o){let n=l(r,s,o??{});o?.silent||(n.stdout?.on("data",t=>{console.log(String(t))}),n.stderr?.on("data",t=>{console.error(String(t))})),n.on("close",t=>{o?.triggerExit&&process.exit(t)})}async function a(r,s="inherit"){let{promise:o,resolve:n,reject:t}=Promise.withResolvers(),i=l("git",["-c","color.ui=always",...r],{stdio:s});return i.on("close",e=>{e===0?n({code:e}):t({code:e})}),i.on("error",t),o}export{p as a,a as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
function t(){return process.argv[2]}function n(){return process.argv.slice(3)}async function o(){let[r,e]=n();return r||(console.error("Requires <branch> or <remote> <branch>"),process.exit(1)),e?{remote:r,branch:e}:{remote:"origin",branch:r}}export{t as a,n as b,o as c};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{b as e,c as v}from"./chunk-5WTQIRZS.js";import{a as n,b as s}from"./chunk-5RER3IEO.js";function P(){n("git",["commit","--amend","--no-edit",...e()],{stdio:"inherit",silent:!0,triggerExit:!0})}import{exec as X}from"node:child_process";import{exec as O}from"node:child_process";import{normalize as U}from"node:path";import{promisify as z}from"node:util";var c=z(O);async function f(){let{stdout:t}=await c("git branch --show-current");return t.trim()}async function A(t){t??=await f();let{stdout:r}=await c(`git config --get branch.${t}.remote`);return r.trim()}async function b(t,r){try{let{stdout:o}=await c(`git rev-list --count ${t}/${r}..${r}`);return parseInt(o.trim(),10)}catch(o){return console.error("Error getting commits ahead:",o),NaN}}async function R(t,r){try{let{stdout:o}=await c(`git rev-list --count ${r}..${t}/${r}`);return parseInt(o.trim(),10)}catch(o){return console.error("Error getting commits behind:",o),NaN}}async function u(t){let{stdout:r}=await c(`git rev-parse --git-path ${t}`);return U(r.trim())}import{spawnSync as V}from"node:child_process";import K from"fs/promises";async function q(t){try{return await K.access(t),!0}catch{return!1}}function x(t,r,o){V(t,r,{stdio:"ignore"}).status!==0&&(o&&console.error(o),process.exit(1))}var l=()=>x("git",["rev-parse","HEAD"],"Need to create first commit."),m=(t="origin")=>x("git",["remote","get-url",t],`Need to add remote '${t}'.`),y=t=>x("git",["show-ref","--branches",t],`Branch '${t}' isn't tracked locally and may not exist.`);var d=async t=>{await q(t)||(console.error(`${t} must exist for this operation and it doesn't for some reason`),process.exit(1))};import{render as _}from"ink";import{Suspense as Y,use as Z}from"react";import{Text as C}from"ink";import j from"ink-spinner";import{jsx as h,jsxs as Q}from"react/jsx-runtime";function S(t){let{msg:r}=t;return h(Y,{fallback:Q(C,{children:[h(j,{type:"dots"}),"\xA0",r]}),children:h(J,{...t})})}function J({msg:t,promise:r}){return Z(r),h(C,{children:`\u2714 ${t}`})}import{promisify as M}from"node:util";import{jsx as rt}from"react/jsx-runtime";var p=M(X);async function E(){let t=process.argv[3],r=process.argv[4]??await f();if(y(t),y(r),t===r)return console.log(`No reason to merge '${t}' into '${r}'`);let o=await A(t);m(o),_(rt(S,{msg:"Updating target branch and merging",promise:(async()=>{try{await tt(o,t)}catch{console.error(`Error when updating branch ${t} with remote ${o}. Fix divergent branches before merging into ${r}`);return}await f()!==r&&await p(`git switch ${r}`),n("git",["merge",t],{stdio:"inherit",silent:!0})})()}))}async function tt(t,r){await p(`git fetch ${t} ${r}`);let[o,g,a]=await Promise.all([b(t,r),R(t,r),f()]);if(g!==0){if(o===0&&a!==r){await p(`git fetch ${t} ${r}:${r}`);return}if(await p(`git switch ${r}`),o===0){await p(`git merge ${t}/${r}`);return}await s(["merge",`${t}/${r}`],["ignore","ignore","inherit"])}}import{appendFileSync as et}from"node:fs";import{readFile as ot}from"node:fs/promises";async function w(t){return(await ot(t,"utf-8")).split(/\r?\n/).map(o=>o.trim()).filter(o=>o&&!o.startsWith("#"))}async function D(){let t=await u("info/exclude");await d(t);let r=await w(t);e().forEach(o=>{r.includes(o)?console.info(`Already Exists: '${o}'`):(et(t,`${o}
|
|
3
|
+
`),console.info(`Added '${o}'`))}),console.info(`
|
|
4
|
+
See file at ${t}`)}function F(){n("git",["show","--name-only","--pretty=format:",...e()],{stdio:"inherit",silent:!0,triggerExit:!0})}import{readFile as it,writeFile as nt}from"node:fs/promises";async function B(){let t=await u("info/exclude");await d(t);let r=await w(t),o=e();o.filter(i=>!r.includes(i)).forEach(i=>console.info(`No match: '${i}'`));let a=(await it(t,"utf-8")).split(/\r?\n/).map(i=>i.trim()),$=a.filter(i=>!o.includes(i));await nt(t,$.join(`
|
|
5
|
+
`)),console.info(`
|
|
6
|
+
Removed ${a.length-$.length} entries from ${t}`)}import{execSync as st}from"node:child_process";function mt(){return st("git rev-parse --show-toplevel",{encoding:"utf-8"}).trim()}function N(){let t=mt();console.log(t)}import{execSync as k,spawnSync as at}from"node:child_process";function ct(){l(),m();let t=at("git",["rev-parse","--abbrev-ref","origin/HEAD"],{encoding:"utf-8"});return t.status===0?t.stdout.trim():(k("git remote set-head origin -a",{stdio:"ignore"}),k("git rev-parse --abbrev-ref origin/HEAD",{encoding:"utf-8"}).trim())}function G(){let t=ct();console.log(`Remote default branch is '${t}'`)}import{exec as ft}from"node:child_process";function W(){return new Date().toLocaleString("en-US",{year:"2-digit",month:"2-digit",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}).replace(",","")}import{promisify as pt}from"node:util";var gt=pt(ft);async function I(){let t=W();await gt("git add -A"),await s(["commit","-m",`"WIP ${t}"`])}import{execSync as ut}from"node:child_process";import lt from"clipboardy";async function T(){l();let t=dt(process.argv[3]);await lt.write(t),console.log(`'${t}' copied to clipboard`)}function dt(t="HEAD"){return ut(`git rev-parse --short ${t}`,{encoding:"utf-8"}).trim()}async function L(){let{remote:t,branch:r}=await v();m(t),await s(["switch","-c",r,"--track",`${t}/${r}`])}var H={amend:P,backmerge:E,exclude:D,files:F,include:B,pwd:N,"remote-default":G,savepoint:I,sha:T,track:L};async function Ir(t){return await H[t]?.(),Object.hasOwn(H,t)}export{Ir as runCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{useState as x}from"react";import{Text as e,Box as c,useInput as p,render as i}from"ink";import{jsx as t,jsxs as n}from"react/jsx-runtime";var f=()=>{let[o,s]=x(0);return p((r,m)=>{r==="q"&&process.exit(),r==="+"&&s(o+1),r==="-"&&s(o-1)}),n(c,{flexDirection:"column",children:[t(e,{children:"\u{1F44B} Welcome to the Demo Ink App!"}),t(e,{children:"---------------------------------"}),n(e,{children:["Count: ",o]}),t(e,{children:'Press "+" to increase, "-" to decrease'}),t(e,{children:'Press "q" to quit'})]})},d=()=>i(t(f,{}));export{d as renderApp};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as r}from"./chunk-5RER3IEO.js";var i=["init","clone","add","status","diff","commit","restore","reset","branch","checkout","switch","merge","log","stash","tag","worktree","fetch","pull","push","remote","submodule","show","apply","cherry-pick","rebase","revert","bisect","blame","grep","clean","fsck","reflog","bundle","daemon","cat-file","check-ignore","checkout-index","commit-tree","count-objects","diff-index","for-each-ref","hash-object","ls-files","ls-tree","merge-base","read-tree","rev-list","rev-parse","show-ref","symbolic-ref","update-index","update-ref","verify-pack","write-tree","column"];function t(e){return i.includes(e)}var n=["auth","browse","codespace","gist","issue","org","pr","project","release","repo","cache","run","workflow","agent-task","alias","api","attestation","completion","config","extension","gpg-key","label","preview","ruleset","search","secret","ssh-key","status","variable"];function s(e){return n.includes(e)}var o=e=>{r(e,process.argv.slice(2),{stdio:"inherit",silent:!0})};async function f(e){return t(e)?(o("git"),!0):s(e)?(o("gh"),!0):!1}export{f as runWrapper};
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as t}from"./chunks/chunk-5WTQIRZS.js";async function e(){let n=t();if(!n){let{renderApp:i}=await import("./chunks/demo-PL6P4QST.js");return i()}let{runCommand:o}=await import("./chunks/commands-V2SGZOKB.js");if(await o(n))return;let{runWrapper:r}=await import("./chunks/wrapper-UX2PKFOA.js");await r(n)||(console.error("unknown command"),process.exit(1))}e().catch(n=>{typeof n=="object"&&(n=JSON.stringify(n,void 0,2)),console.error(`An error occurred: ${n}`),process.exit(1)});
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bisgit",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Git CLI tool to simplify common advanced git workflows",
|
|
5
|
+
"main": "dist/main.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"bisgit": "dist/main.js",
|
|
8
|
+
"gi": "dist/main.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"git",
|
|
15
|
+
"cli",
|
|
16
|
+
"tui",
|
|
17
|
+
"github"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/alexanderdombroski/bisgit#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/alexanderdombroski/bisgit/issues"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/alexanderdombroski/bisgit.git"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"author": "Alex Dombroski",
|
|
29
|
+
"type": "module",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"start": "node dist/main.js",
|
|
32
|
+
"dev": "node esbuild.mjs && node dist/main.js",
|
|
33
|
+
"build": "node esbuild.mjs --watch",
|
|
34
|
+
"package": "rm -rf dist && node esbuild.mjs --production",
|
|
35
|
+
"profile": "npm-run-all -p profile:*",
|
|
36
|
+
"profile:size": "esbuild-visualizer --metadata ./profile/meta.json --filename ./profile/visualizer.html && open ./profile/visualizer.html",
|
|
37
|
+
"profile:lazy": "esbuild-lazy-analyzer --metafile ./profile/meta.json --outmeta ./profile/lazy.json --outreport ./profile/lazy.html && open ./profile/lazy.html",
|
|
38
|
+
"gi": "npm run package && node dist/main.js",
|
|
39
|
+
"lint": "eslint src",
|
|
40
|
+
"check-types": "tsc --noEmit",
|
|
41
|
+
"prepare": "husky"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^25.0.3",
|
|
45
|
+
"@types/react": "^19.2.7",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
47
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
48
|
+
"esbuild": "^0.27.2",
|
|
49
|
+
"esbuild-lazy-analyzer": "^1.4.0",
|
|
50
|
+
"esbuild-visualizer": "^0.7.0",
|
|
51
|
+
"eslint": "^9.39.2",
|
|
52
|
+
"eslint-plugin-import": "^2.32.0",
|
|
53
|
+
"husky": "^9.1.7",
|
|
54
|
+
"lint-staged": "^16.2.7",
|
|
55
|
+
"npm-run-all": "^4.1.5",
|
|
56
|
+
"prettier": "^3.7.4"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"clipboardy": "^5.0.2",
|
|
60
|
+
"ink": "^6.6.0",
|
|
61
|
+
"ink-spinner": "^5.0.0",
|
|
62
|
+
"react": "^19.2.3",
|
|
63
|
+
"react-devtools-core": "^6.1.5"
|
|
64
|
+
}
|
|
65
|
+
}
|