ya-git-jira 2.0.0 → 2.1.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/.dockerignore +8 -0
- package/.opencode/skills/git-confluence/SKILL.md +18 -18
- package/.opencode/skills/git-jira/SKILL.md +18 -18
- package/.opencode/skills/git-lab/SKILL.md +30 -30
- package/Dockerfile +58 -0
- package/README.md +31 -12
- package/bin/gitj-install-skills.ts +13 -8
- package/install-docker-gitj.sh +77 -0
- package/package.json +1 -1
package/.dockerignore
ADDED
|
@@ -5,7 +5,7 @@ description: Using git-confluence commands to search, read, and update Confluenc
|
|
|
5
5
|
|
|
6
6
|
## Overview
|
|
7
7
|
|
|
8
|
-
`
|
|
8
|
+
`gitj confluence` interacts with Confluence Cloud via its REST API v2.
|
|
9
9
|
Authentication uses git config values with fallback to `jira.*` equivalents:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
@@ -17,11 +17,11 @@ git config --global confluence.token your-api-token # falls back to j
|
|
|
17
17
|
## Commands
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
gitj confluence whoami Show current authenticated user
|
|
21
|
+
gitj confluence space list List all spaces
|
|
22
|
+
gitj confluence page search <q> Search pages (fuzzy title, --exact, or --full-text)
|
|
23
|
+
gitj confluence page show <id> Show page metadata (add --body-format for content)
|
|
24
|
+
gitj confluence page update <id> Update page content (from stdin or --file)
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Use `--help` on any command for options.
|
|
@@ -41,42 +41,42 @@ Use `--help` on any command for options.
|
|
|
41
41
|
|
|
42
42
|
```sh
|
|
43
43
|
# 1. Find the page
|
|
44
|
-
|
|
44
|
+
gitj confluence page search "My Page Title"
|
|
45
45
|
|
|
46
46
|
# 2. Read content (outputs raw storage-format XHTML)
|
|
47
|
-
|
|
47
|
+
gitj confluence page show <id> --body-format storage --body-only > page.html
|
|
48
48
|
|
|
49
49
|
# 3. Edit page.html as needed (must remain valid storage format)
|
|
50
50
|
|
|
51
51
|
# 4. Push the update
|
|
52
|
-
|
|
52
|
+
gitj confluence page update <id> --file page.html --message "Updated content"
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
Content can also be piped via stdin:
|
|
56
56
|
|
|
57
57
|
```sh
|
|
58
|
-
cat page.html |
|
|
58
|
+
cat page.html | gitj confluence page update <id>
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
## Arbitrary Confluence API Access
|
|
62
62
|
|
|
63
|
-
For operations not covered by the dedicated commands, use `
|
|
63
|
+
For operations not covered by the dedicated commands, use `gitj api confluence`:
|
|
64
64
|
|
|
65
65
|
```sh
|
|
66
66
|
# GET (default) -- path is relative to /wiki/api/v2
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
gitj api confluence /spaces
|
|
68
|
+
gitj api confluence /pages/12345
|
|
69
69
|
|
|
70
70
|
# POST (auto-promoted when --data is provided)
|
|
71
|
-
|
|
71
|
+
gitj api confluence /pages -d '{"spaceId":"123","title":"New Page","body":{"representation":"storage","value":"<p>content</p>"},"status":"current"}'
|
|
72
72
|
|
|
73
73
|
# Paginated listing
|
|
74
|
-
|
|
74
|
+
gitj api confluence /spaces --paginate
|
|
75
75
|
|
|
76
76
|
# Skip /wiki/api/v2 prefix for v1 API access
|
|
77
|
-
|
|
77
|
+
gitj api confluence /wiki/rest/api/content/12345 --raw
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
`
|
|
80
|
+
`gitj api` handles authentication and base URL automatically. It also supports
|
|
81
81
|
`-v` (status/headers to stderr), and exits with code 1 on HTTP 4xx/5xx.
|
|
82
|
-
Run `
|
|
82
|
+
Run `gitj api -h` for all options.
|
|
@@ -5,7 +5,7 @@ description: Using git-jira commands to work with Jira issues and branches
|
|
|
5
5
|
|
|
6
6
|
## Overview
|
|
7
7
|
|
|
8
|
-
`
|
|
8
|
+
`gitj jira` interacts with Jira Cloud via its REST API v3. Authentication uses
|
|
9
9
|
git config values:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
@@ -17,11 +17,11 @@ git config --global jira.token your-api-token
|
|
|
17
17
|
## Commands
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
gitj jira whoami Show current Jira user
|
|
21
|
+
gitj jira issue list List your unresolved issues (shortcut: gitj jira list)
|
|
22
|
+
gitj jira issue show <key> Show a single issue
|
|
23
|
+
gitj jira start <key> Create a branch from an issue key + summary
|
|
24
|
+
gitj bump Increment the branch version suffix
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
All dedicated commands are **read-only**. Use `--help` on any command for options.
|
|
@@ -29,9 +29,9 @@ All dedicated commands are **read-only**. Use `--help` on any command for option
|
|
|
29
29
|
## Workflow: Start Working on a Jira Issue
|
|
30
30
|
|
|
31
31
|
```sh
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
gitj jira issue list # find your unresolved issues
|
|
33
|
+
gitj jira start PROJ-123 # creates and checks out a descriptive branch
|
|
34
|
+
gitj bump # re-branch with incremented suffix if needed
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
The `start` command only creates a local branch -- it does not push or
|
|
@@ -40,24 +40,24 @@ transition the Jira issue.
|
|
|
40
40
|
## Arbitrary Jira API Access
|
|
41
41
|
|
|
42
42
|
The dedicated commands are read-only. For write operations (creating issues,
|
|
43
|
-
transitions, comments, etc.), use `
|
|
43
|
+
transitions, comments, etc.), use `gitj api jira`:
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
46
|
# GET (default) -- path is relative to /rest/api/3
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
gitj api jira /myself
|
|
48
|
+
gitj api jira /issue/PROJ-123
|
|
49
49
|
|
|
50
50
|
# POST (auto-promoted when --data is provided)
|
|
51
|
-
|
|
51
|
+
gitj api jira /issue -d '{"fields":{"project":{"key":"PROJ"},"summary":"New issue","issuetype":{"name":"Task"}}}'
|
|
52
52
|
|
|
53
53
|
# Explicit method
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
gitj api jira /issue/PROJ-123 -X PUT -d '{"fields":{"summary":"Updated title"}}'
|
|
55
|
+
gitj api jira /issue/PROJ-123/transitions -d '{"transition":{"id":"31"}}'
|
|
56
56
|
|
|
57
57
|
# Skip /rest/api/3 prefix for full URL control
|
|
58
|
-
|
|
58
|
+
gitj api jira /rest/api/2/myself --raw
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
`
|
|
61
|
+
`gitj api` handles authentication and base URL automatically. It also supports
|
|
62
62
|
`--paginate`, `-v` (status/headers to stderr), and exits with code 1 on HTTP
|
|
63
|
-
4xx/5xx. Run `
|
|
63
|
+
4xx/5xx. Run `gitj api -h` for all options.
|
|
@@ -5,7 +5,7 @@ description: Using git-lab commands to work with GitLab projects, merge requests
|
|
|
5
5
|
|
|
6
6
|
## Overview
|
|
7
7
|
|
|
8
|
-
`
|
|
8
|
+
`gitj lab` interacts with GitLab via its REST API v4. Authentication uses git
|
|
9
9
|
config values:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
@@ -19,20 +19,20 @@ The token is sent as a `Private-Token` header. User identity is resolved from
|
|
|
19
19
|
## Commands
|
|
20
20
|
|
|
21
21
|
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
gitj lab whoami Show current GitLab user
|
|
23
|
+
gitj lab group list List groups
|
|
24
|
+
gitj lab namespace list List namespaces
|
|
25
|
+
gitj lab project list [--match] List projects (server + client-side filter)
|
|
26
|
+
gitj lab project whereami Identify project from current git remote
|
|
27
|
+
gitj lab project mr list List MRs for a project/branch (defaults to current)
|
|
28
|
+
gitj lab merge active My open merge requests (across all projects)
|
|
29
|
+
gitj lab merge todo MRs where I'm assigned as reviewer
|
|
30
|
+
gitj lab merge train list Merge trains for the current project
|
|
31
|
+
gitj lab project pipeline list Recent pipelines (scoped to current user)
|
|
32
|
+
gitj lab project pipeline latest Jobs for latest pipeline on current branch
|
|
33
|
+
gitj lab project pipeline jobs Jobs for a specific pipeline
|
|
34
|
+
gitj lab project pipeline log Download a job's log output (plain text)
|
|
35
|
+
gitj bump Increment branch version suffix
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
All dedicated commands are **read-only**. Use `--help` on any command for
|
|
@@ -53,7 +53,7 @@ options and defaults.
|
|
|
53
53
|
### Find the MR for the current branch
|
|
54
54
|
|
|
55
55
|
```sh
|
|
56
|
-
|
|
56
|
+
gitj lab project mr list
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Defaults to the current directory's project and current branch. Use
|
|
@@ -62,41 +62,41 @@ Defaults to the current directory's project and current branch. Use
|
|
|
62
62
|
### Debug a CI failure
|
|
63
63
|
|
|
64
64
|
```sh
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
gitj lab project pipeline latest # see jobs for current branch
|
|
66
|
+
gitj lab project pipeline log --job <id> # download the log
|
|
67
|
+
gitj lab project pipeline log --job <id> --tail 200 # last 200 lines
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
### Review merge requests
|
|
71
71
|
|
|
72
72
|
```sh
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
gitj lab merge todo # MRs needing my review
|
|
74
|
+
gitj lab merge active # my own open MRs
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
## Arbitrary GitLab API Access
|
|
78
78
|
|
|
79
79
|
The dedicated commands are read-only. For write operations (approving MRs,
|
|
80
|
-
posting comments, triggering pipelines, etc.), use `
|
|
80
|
+
posting comments, triggering pipelines, etc.), use `gitj api gitlab`:
|
|
81
81
|
|
|
82
82
|
```sh
|
|
83
83
|
# GET (default) -- path is relative to /api/v4
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
gitj api gitlab /user
|
|
85
|
+
gitj api gitlab /projects/123/merge_requests
|
|
86
86
|
|
|
87
87
|
# POST (auto-promoted when --data is provided)
|
|
88
|
-
|
|
88
|
+
gitj api gitlab /projects/123/merge_requests/456/notes -d '{"body":"LGTM"}'
|
|
89
89
|
|
|
90
90
|
# Explicit method
|
|
91
|
-
|
|
91
|
+
gitj api gitlab /projects/123/merge_requests/456/approve -X POST
|
|
92
92
|
|
|
93
93
|
# Paginated listing
|
|
94
|
-
|
|
94
|
+
gitj api gitlab /projects --paginate
|
|
95
95
|
|
|
96
96
|
# Skip /api/v4 prefix for full URL control
|
|
97
|
-
|
|
97
|
+
gitj api gitlab /api/v4/version --raw
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
`
|
|
100
|
+
`gitj api` handles authentication and base URL automatically. It also supports
|
|
101
101
|
`-v` (status/headers to stderr), and exits with code 1 on HTTP 4xx/5xx.
|
|
102
|
-
Run `
|
|
102
|
+
Run `gitj api -h` for all options.
|
package/Dockerfile
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# ya-git-jira Docker image
|
|
2
|
+
# Provides gitj/git-jira/git-lab/git-confluence/git-bump commands
|
|
3
|
+
# without requiring bun installed on the host.
|
|
4
|
+
#
|
|
5
|
+
# Build:
|
|
6
|
+
# docker build -t gitj .
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# docker run --rm \
|
|
10
|
+
# --user "$(id -u):$(id -g)" \
|
|
11
|
+
# -e HOME="$HOME" \
|
|
12
|
+
# -v "$HOME:$HOME" \
|
|
13
|
+
# -v "$(pwd):$(pwd)" -w "$(pwd)" \
|
|
14
|
+
# gitj <command> [args...]
|
|
15
|
+
#
|
|
16
|
+
# Examples:
|
|
17
|
+
# docker run --rm --user "$(id -u):$(id -g)" -e HOME="$HOME" -v "$HOME:$HOME" -v "$(pwd):$(pwd)" -w "$(pwd)" gitj jira start
|
|
18
|
+
# docker run --rm --user "$(id -u):$(id -g)" -e HOME="$HOME" -v "$HOME:$HOME" -v "$(pwd):$(pwd)" -w "$(pwd)" gitj lab merge active
|
|
19
|
+
|
|
20
|
+
FROM oven/bun:1 AS builder
|
|
21
|
+
|
|
22
|
+
WORKDIR /build
|
|
23
|
+
|
|
24
|
+
# Install dependencies first (cache layer)
|
|
25
|
+
COPY package.json bun.lockb ./
|
|
26
|
+
RUN bun install --frozen-lockfile --production --ignore-scripts
|
|
27
|
+
|
|
28
|
+
# Copy source and build
|
|
29
|
+
COPY build.ts index.ts tsconfig.json ./
|
|
30
|
+
COPY bin/ bin/
|
|
31
|
+
COPY lib/ lib/
|
|
32
|
+
RUN bun run build.ts
|
|
33
|
+
|
|
34
|
+
# --- Runtime stage ---
|
|
35
|
+
FROM oven/bun:1-slim
|
|
36
|
+
|
|
37
|
+
# git is required - the tool reads config from git and operates on repos
|
|
38
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
|
|
39
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
40
|
+
|
|
41
|
+
WORKDIR /app
|
|
42
|
+
|
|
43
|
+
# Copy built artifacts and dependencies
|
|
44
|
+
COPY --from=builder /build/dist/ dist/
|
|
45
|
+
COPY --from=builder /build/node_modules/ node_modules/
|
|
46
|
+
COPY package.json ./
|
|
47
|
+
|
|
48
|
+
# Include skill files so install-skills can copy them into projects
|
|
49
|
+
COPY .opencode/skills/ .opencode/skills/
|
|
50
|
+
|
|
51
|
+
# Symlink all bin entries onto PATH
|
|
52
|
+
RUN mkdir -p /usr/local/bin && \
|
|
53
|
+
for f in dist/bin/*.js; do \
|
|
54
|
+
name=$(basename "$f" .js); \
|
|
55
|
+
ln -s /app/"$f" /usr/local/bin/"$name"; \
|
|
56
|
+
done
|
|
57
|
+
|
|
58
|
+
ENTRYPOINT ["gitj"]
|
package/README.md
CHANGED
|
@@ -5,20 +5,39 @@ executable that `git` discovers automatically (e.g. `git jira start`, `git lab
|
|
|
5
5
|
merge active`, `git confluence page search`). A unified `gitj` wrapper is also
|
|
6
6
|
provided.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
There are three ways to install. Options 1 and 2 require
|
|
11
|
+
[Bun](https://bun.sh). Option 3 requires only Docker.
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
### Option 1: npm install (requires Bun)
|
|
11
14
|
|
|
12
15
|
```
|
|
13
|
-
curl -fsSL https://bun.sh/install | bash
|
|
16
|
+
curl -fsSL https://bun.sh/install | bash # install Bun first
|
|
17
|
+
npm install -g ya-git-jira # or bun / yarn / pnpm
|
|
14
18
|
```
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
### Option 2: Clone and build (requires Bun)
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
git clone https://github.com/jimlloyd/ya-git-jira.git
|
|
24
|
+
cd ya-git-jira
|
|
25
|
+
bun install
|
|
26
|
+
bun link
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Option 3: Clone and Docker (no Bun needed)
|
|
17
30
|
|
|
18
31
|
```
|
|
19
|
-
|
|
32
|
+
git clone https://github.com/jimlloyd/ya-git-jira.git
|
|
33
|
+
cd ya-git-jira
|
|
34
|
+
./install-docker-gitj.sh
|
|
20
35
|
```
|
|
21
36
|
|
|
37
|
+
This builds a Docker image and installs a `gitj` wrapper script into a bin
|
|
38
|
+
directory on your PATH (e.g. `~/.local/bin`). The wrapper transparently runs
|
|
39
|
+
commands inside Docker, so usage is identical to a native install.
|
|
40
|
+
|
|
22
41
|
## Configuration
|
|
23
42
|
|
|
24
43
|
All configuration is via `git config`. Use `--global` if the same settings apply
|
|
@@ -142,16 +161,16 @@ one-off queries and scripting.
|
|
|
142
161
|
### gitj install-skills
|
|
143
162
|
|
|
144
163
|
```
|
|
145
|
-
gitj install-skills opencode #
|
|
146
|
-
gitj install-skills copilot #
|
|
147
|
-
gitj install-skills claude #
|
|
148
|
-
gitj install-skills opencode --copy # copy instead of symlink
|
|
164
|
+
gitj install-skills opencode # copies to .opencode/skills/
|
|
165
|
+
gitj install-skills copilot # copies to .github/skills/
|
|
166
|
+
gitj install-skills claude # copies to .claude/skills/
|
|
149
167
|
gitj install-skills opencode --force # overwrite existing directories
|
|
150
168
|
```
|
|
151
169
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
170
|
+
Skills are installed into the current project directory. Run this from your
|
|
171
|
+
project root so that your AI coding assistant discovers the skill files. When
|
|
172
|
+
running via Docker, files are always copied (symlinks would point into the
|
|
173
|
+
container).
|
|
155
174
|
|
|
156
175
|
## AI agent skills
|
|
157
176
|
|
|
@@ -6,7 +6,6 @@ import { findPackageJson } from '../lib/package'
|
|
|
6
6
|
import { isMain } from '../lib/is_main'
|
|
7
7
|
import fs from 'node:fs'
|
|
8
8
|
import path from 'node:path'
|
|
9
|
-
import os from 'node:os'
|
|
10
9
|
|
|
11
10
|
const version = await getPackageVersion()
|
|
12
11
|
|
|
@@ -29,14 +28,14 @@ function getSkillsSourceDir(): string {
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
function getTargetDir(framework: Framework): string {
|
|
32
|
-
const
|
|
31
|
+
const cwd = process.cwd()
|
|
33
32
|
switch (framework) {
|
|
34
33
|
case 'opencode':
|
|
35
|
-
return path.join(
|
|
34
|
+
return path.join(cwd, '.opencode', 'skills')
|
|
36
35
|
case 'copilot':
|
|
37
|
-
return path.join(
|
|
36
|
+
return path.join(cwd, '.github', 'skills')
|
|
38
37
|
case 'claude':
|
|
39
|
-
return path.join(
|
|
38
|
+
return path.join(cwd, '.claude', 'skills')
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -101,7 +100,7 @@ export function create(): Command {
|
|
|
101
100
|
.name('install-skills')
|
|
102
101
|
.description('Install AI agent skills for a coding framework')
|
|
103
102
|
.argument('<framework>', `framework to install for (${frameworks.join(', ')})`)
|
|
104
|
-
.option('--copy', 'copy files instead of creating symlinks')
|
|
103
|
+
.option('--copy', 'copy files instead of creating symlinks (automatic in Docker)')
|
|
105
104
|
.option('--force', 'overwrite existing skill directories')
|
|
106
105
|
.action(async (framework: string, options: { copy?: boolean; force?: boolean }) => {
|
|
107
106
|
if (!frameworks.includes(framework as Framework)) {
|
|
@@ -110,10 +109,16 @@ export function create(): Command {
|
|
|
110
109
|
process.exit(1)
|
|
111
110
|
}
|
|
112
111
|
|
|
112
|
+
// When running in Docker, source files live inside the container
|
|
113
|
+
// so symlinks would be broken on the host. Force copy mode.
|
|
114
|
+
const sourceDir = getSkillsSourceDir()
|
|
115
|
+
const inDocker = sourceDir.startsWith('/app/')
|
|
116
|
+
const copy = !!(options.copy || inDocker)
|
|
117
|
+
|
|
113
118
|
if (options.force) {
|
|
114
|
-
forceInstallSkills(framework as Framework,
|
|
119
|
+
forceInstallSkills(framework as Framework, copy)
|
|
115
120
|
} else {
|
|
116
|
-
installSkills(framework as Framework,
|
|
121
|
+
installSkills(framework as Framework, copy)
|
|
117
122
|
}
|
|
118
123
|
})
|
|
119
124
|
return program
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
IMAGE_NAME="gitj"
|
|
5
|
+
WRAPPER_NAME="gitj"
|
|
6
|
+
|
|
7
|
+
# --- Find a writable bin directory on PATH under $HOME ---
|
|
8
|
+
|
|
9
|
+
find_bin_dir() {
|
|
10
|
+
# Prefer ~/.local/bin if it exists and is on PATH
|
|
11
|
+
if [ -d "$HOME/.local/bin" ]; then
|
|
12
|
+
case ":$PATH:" in
|
|
13
|
+
*":$HOME/.local/bin:"*) echo "$HOME/.local/bin"; return 0 ;;
|
|
14
|
+
esac
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Search PATH for any directory under $HOME
|
|
18
|
+
IFS=: read -ra path_dirs <<< "$PATH"
|
|
19
|
+
for dir in "${path_dirs[@]}"; do
|
|
20
|
+
case "$dir" in
|
|
21
|
+
"$HOME"/*)
|
|
22
|
+
if [ -d "$dir" ] && [ -w "$dir" ]; then
|
|
23
|
+
echo "$dir"
|
|
24
|
+
return 0
|
|
25
|
+
fi
|
|
26
|
+
;;
|
|
27
|
+
esac
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
# Fall back to creating ~/.local/bin
|
|
31
|
+
echo ""
|
|
32
|
+
return 1
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# --- Main ---
|
|
36
|
+
|
|
37
|
+
echo "Building Docker image '$IMAGE_NAME'..."
|
|
38
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
39
|
+
docker build -t "$IMAGE_NAME" "$SCRIPT_DIR"
|
|
40
|
+
echo ""
|
|
41
|
+
|
|
42
|
+
BIN_DIR=$(find_bin_dir) || true
|
|
43
|
+
|
|
44
|
+
if [ -z "$BIN_DIR" ]; then
|
|
45
|
+
BIN_DIR="$HOME/.local/bin"
|
|
46
|
+
echo "No bin directory found under \$HOME on your PATH."
|
|
47
|
+
echo "Creating $BIN_DIR ..."
|
|
48
|
+
mkdir -p "$BIN_DIR"
|
|
49
|
+
echo ""
|
|
50
|
+
echo "WARNING: $BIN_DIR is not on your PATH."
|
|
51
|
+
echo "Add this to your shell profile (~/.bashrc, ~/.zshrc, etc.):"
|
|
52
|
+
echo ""
|
|
53
|
+
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
|
|
54
|
+
echo ""
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
WRAPPER="$BIN_DIR/$WRAPPER_NAME"
|
|
58
|
+
|
|
59
|
+
cat > "$WRAPPER" << 'SCRIPT'
|
|
60
|
+
#!/usr/bin/env bash
|
|
61
|
+
exec docker run --rm \
|
|
62
|
+
--user "$(id -u):$(id -g)" \
|
|
63
|
+
-e HOME="$HOME" \
|
|
64
|
+
-v "$HOME:$HOME" \
|
|
65
|
+
-v "$(pwd):$(pwd)" -w "$(pwd)" \
|
|
66
|
+
gitj "$@"
|
|
67
|
+
SCRIPT
|
|
68
|
+
|
|
69
|
+
chmod +x "$WRAPPER"
|
|
70
|
+
|
|
71
|
+
echo "Installed $WRAPPER"
|
|
72
|
+
echo ""
|
|
73
|
+
echo "Usage:"
|
|
74
|
+
echo " gitj --version"
|
|
75
|
+
echo " gitj jira start BUG-42"
|
|
76
|
+
echo " gitj lab merge active"
|
|
77
|
+
echo " gitj --help-all"
|