ya-git-jira 1.6.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/architecture/SKILL.md +45 -0
- package/.opencode/skills/code-style/SKILL.md +76 -0
- package/.opencode/skills/git-confluence/SKILL.md +82 -0
- package/.opencode/skills/git-jira/SKILL.md +63 -0
- package/.opencode/skills/git-lab/SKILL.md +102 -0
- package/AGENTS.md +50 -0
- package/Dockerfile +58 -0
- package/README.md +125 -106
- package/bin/git-api.ts +70 -0
- package/bin/git-confluence-page-search.ts +58 -0
- package/bin/git-confluence-page-show.ts +61 -0
- package/bin/git-confluence-page-update.ts +77 -0
- package/bin/git-confluence-page.ts +28 -0
- package/bin/git-confluence-space-list.ts +34 -0
- package/bin/git-confluence-space.ts +24 -0
- package/bin/git-confluence-whoami.ts +33 -0
- package/bin/git-confluence.ts +27 -0
- package/bin/git-jira-start.ts +1 -1
- package/bin/git-jira-whoami.ts +32 -0
- package/bin/git-jira.ts +2 -0
- package/bin/git-lab-project-mr-list.ts +57 -0
- package/bin/git-lab-project-mr.ts +24 -0
- package/bin/git-lab-project-pipeline-jobs.ts +46 -0
- package/bin/git-lab-project-pipeline-latest.ts +47 -0
- package/bin/git-lab-project-pipeline-log.ts +49 -0
- package/bin/git-lab-project-pipeline.ts +6 -0
- package/bin/git-lab-project.ts +5 -1
- package/bin/gitj-install-skills.ts +131 -0
- package/bin/gitj.ts +12 -0
- package/dist/bin/git-api.js +2156 -0
- package/dist/bin/git-bump.js +132 -121
- package/dist/bin/git-confluence-page-search.js +2079 -0
- package/dist/bin/git-confluence-page-show.js +2082 -0
- package/dist/bin/git-confluence-page-update.js +2093 -0
- package/dist/bin/git-confluence-page.js +2186 -0
- package/dist/bin/git-confluence-space-list.js +2061 -0
- package/dist/bin/git-confluence-space.js +2073 -0
- package/dist/bin/git-confluence-whoami.js +2060 -0
- package/dist/bin/git-confluence.js +2251 -0
- package/dist/bin/git-jira-issue-list.js +136 -125
- package/dist/bin/git-jira-issue-show.js +136 -125
- package/dist/bin/git-jira-issue.js +140 -129
- package/dist/bin/git-jira-start.js +138 -127
- package/dist/bin/git-jira-whoami.js +1972 -0
- package/dist/bin/git-jira.js +170 -139
- package/dist/bin/git-lab-group-list.js +321 -279
- package/dist/bin/git-lab-group.js +323 -281
- package/dist/bin/git-lab-merge-active.js +321 -279
- package/dist/bin/git-lab-merge-todo.js +321 -279
- package/dist/bin/git-lab-merge-train-list.js +289 -273
- package/dist/bin/git-lab-merge-train.js +291 -275
- package/dist/bin/git-lab-merge.js +330 -288
- package/dist/bin/git-lab-namespace-list.js +138 -127
- package/dist/bin/git-lab-namespace.js +140 -129
- package/dist/bin/git-lab-project-list.js +288 -272
- package/dist/bin/git-lab-project-mr-list.js +2740 -0
- package/dist/bin/git-lab-project-mr.js +2752 -0
- package/dist/bin/git-lab-project-pipeline-jobs.js +2734 -0
- package/dist/bin/git-lab-project-pipeline-latest.js +2736 -0
- package/dist/bin/git-lab-project-pipeline-list.js +323 -281
- package/dist/bin/git-lab-project-pipeline-log.js +2739 -0
- package/dist/bin/git-lab-project-pipeline.js +437 -292
- package/dist/bin/git-lab-project-whereami.js +292 -276
- package/dist/bin/git-lab-project.js +563 -288
- package/dist/bin/git-lab-whoami.js +142 -131
- package/dist/bin/git-lab.js +575 -338
- package/dist/bin/gitj-install-skills.js +1954 -0
- package/dist/bin/gitj.js +1385 -473
- package/dist/index.js +371 -187
- package/index.ts +1 -0
- package/install-docker-gitj.sh +77 -0
- package/lib/api.ts +177 -0
- package/lib/confluence/api.ts +132 -0
- package/lib/confluence/config.ts +25 -0
- package/lib/confluence/index.ts +3 -0
- package/lib/confluence/types.ts +59 -0
- package/lib/gitlab/index.ts +1 -0
- package/lib/gitlab/job.ts +31 -0
- package/lib/gitlab/merge-request.ts +20 -0
- package/lib/gitlab/pipeline.ts +28 -1
- package/lib/gitlab/project.ts +14 -5
- package/lib/help.ts +40 -0
- package/lib/jira.ts +2 -2
- package/package.json +18 -2
- package/tests/all-help.test.ts +6 -1
- package/tests/gitj.test.ts +1 -1
- package/tests/help-all.test.ts +29 -0
- package/bun.lockb +0 -0
package/.dockerignore
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture
|
|
3
|
+
description: Project architecture, CLI design patterns, and test conventions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Dual-Mode Files
|
|
7
|
+
|
|
8
|
+
Every `bin/` file works both as an importable module (exporting `create()`) and as a
|
|
9
|
+
directly-executable script (via the `isMain()` guard). This enables hierarchical command
|
|
10
|
+
composition while allowing each command to be invoked standalone.
|
|
11
|
+
|
|
12
|
+
## Hierarchical CLI
|
|
13
|
+
|
|
14
|
+
Commands form a tree: `gitj` -> `lab` -> `merge` -> `active`. Each level is its own
|
|
15
|
+
file. Parent commands add children via `.addCommand(child.create())`.
|
|
16
|
+
|
|
17
|
+
## Eager Config Loading
|
|
18
|
+
|
|
19
|
+
Config values (git config reads) are initiated at module scope as top-level promises:
|
|
20
|
+
```ts
|
|
21
|
+
const hostP = getConfig("jira.host")
|
|
22
|
+
```
|
|
23
|
+
Then awaited when actually needed. This is a performance optimization.
|
|
24
|
+
|
|
25
|
+
## GitLab API Client
|
|
26
|
+
|
|
27
|
+
- `lib/gitlab/api.ts` handles pagination by following `Link` headers with `rel="next"`
|
|
28
|
+
- `projectScopedGet()` auto-determines the current GitLab project from the git remote URL
|
|
29
|
+
|
|
30
|
+
## TypeScript Configuration
|
|
31
|
+
|
|
32
|
+
- `strict: true`, target/module: `esnext`, `moduleResolution: "bundler"`
|
|
33
|
+
- `allowImportingTsExtensions: true` -- imports use `.ts` extensions
|
|
34
|
+
- `noEmit: true` -- Bun's bundler handles output, not tsc
|
|
35
|
+
- `types: ["bun-types"]` -- Bun global APIs (Bun.spawn, Bun.argv, etc.)
|
|
36
|
+
|
|
37
|
+
## Test Conventions
|
|
38
|
+
|
|
39
|
+
- Test runner: Bun's built-in (`bun:test`)
|
|
40
|
+
- Test files: `tests/*.test.ts`
|
|
41
|
+
- Imports: `import { describe, expect, test, beforeEach, afterEach } from 'bun:test'`
|
|
42
|
+
- Tests are async with explicit `Promise<void>` return types
|
|
43
|
+
- Integration tests spawn real subprocesses via the project's `spawn`/`doCommand` utilities
|
|
44
|
+
- Some tests set custom timeouts as a second argument: `test('name', async () => { ... }, 15000)`
|
|
45
|
+
- `all-help.test.ts` dynamically generates tests for every `bin/*.ts` script
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-style
|
|
3
|
+
description: Code style rules for writing and editing TypeScript in this project
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## File Structure
|
|
7
|
+
|
|
8
|
+
Every `bin/*.ts` file follows this exact pattern:
|
|
9
|
+
1. Shebang: `#!/usr/bin/env bun`
|
|
10
|
+
2. Imports
|
|
11
|
+
3. Top-level `const version = await getPackageVersion()`
|
|
12
|
+
4. `export function create(): Command { ... }` -- factory returning a Commander command
|
|
13
|
+
5. `export default create` -- default export of the factory (not the command instance)
|
|
14
|
+
6. `if (isMain('filename')) { await create().parseAsync(Bun.argv) }` -- dual-mode guard
|
|
15
|
+
|
|
16
|
+
Parent commands (routing nodes) compose children via `.addCommand()`.
|
|
17
|
+
Leaf commands define `.action(async () => { ... })` with inline logic.
|
|
18
|
+
|
|
19
|
+
## Imports
|
|
20
|
+
|
|
21
|
+
- Use `import type { Foo }` for type-only imports
|
|
22
|
+
- Relative paths use `.ts` extensions for files: `import { foo } from "../lib/git.ts"`
|
|
23
|
+
- Relative paths omit extensions for directories with `index.ts`: `import { bar } from "../lib/gitlab"`
|
|
24
|
+
- General ordering (not strictly enforced):
|
|
25
|
+
1. Third-party / built-in (`commander`, `debug`, `node:path`)
|
|
26
|
+
2. Local lib modules (`../lib/git`, `../lib/gitlab`)
|
|
27
|
+
3. Sibling imports (other `bin/` files for subcommand composition)
|
|
28
|
+
|
|
29
|
+
## Naming Conventions
|
|
30
|
+
|
|
31
|
+
| Element | Convention | Examples |
|
|
32
|
+
|---------|-----------|----------|
|
|
33
|
+
| Functions | camelCase | `getConfig`, `createBranch`, `getCurrentBranch` |
|
|
34
|
+
| Types/Interfaces | PascalCase | `SpawnResult`, `MergeRequest`, `JiraConfig` |
|
|
35
|
+
| Variables/Constants | camelCase | `defaultOptions`, `dlog` |
|
|
36
|
+
| Files | kebab-case | `merge-request.ts`, `merge-trains.ts` |
|
|
37
|
+
| API response fields | snake_case (matching external APIs) | `path_with_namespace`, `source_branch` |
|
|
38
|
+
|
|
39
|
+
## Types
|
|
40
|
+
|
|
41
|
+
- API response types use intersection with `JSONValue`:
|
|
42
|
+
`export type Project = JSONValue & { id: number; name: string; ... }`
|
|
43
|
+
- `JSONValue` is defined in `lib/json.ts` as a recursive union type
|
|
44
|
+
- API responses are cast with `as Type`: `await response.json() as Issue`
|
|
45
|
+
- Function return types are explicitly annotated: `Promise<string>`, `Promise<Array<Project>>`
|
|
46
|
+
- Both `Array<T>` and `T[]` appear; either is acceptable
|
|
47
|
+
- Use `export type` for API response shapes, `export interface` for configs/options
|
|
48
|
+
|
|
49
|
+
## Formatting
|
|
50
|
+
|
|
51
|
+
- **4-space indentation**
|
|
52
|
+
- **Single quotes** for strings (not double quotes)
|
|
53
|
+
- Semicolons are used inconsistently; both with and without are acceptable
|
|
54
|
+
- Opening braces on same line: `function foo(): Type {`
|
|
55
|
+
- Commander method chains use 4-space indentation with dot-chaining on new lines
|
|
56
|
+
|
|
57
|
+
## Error Handling
|
|
58
|
+
|
|
59
|
+
- **No try/catch blocks** -- errors propagate naturally
|
|
60
|
+
- Throw on missing config: `if (!host) throw new Error("jira.host not in git config")`
|
|
61
|
+
- CLI-facing errors use `console.error()` + `process.exit(1)`
|
|
62
|
+
- Non-fatal warnings use `console.warn()`
|
|
63
|
+
- The `spawn` utility warns on no-output commands unless `expectQuiet` is set
|
|
64
|
+
|
|
65
|
+
## Debug Logging
|
|
66
|
+
|
|
67
|
+
- Uses the `debug` npm package
|
|
68
|
+
- Create logger: `const dlog = debug('gitlab')` or `const dlog = debug('git-lab-project-pipeline-list')`
|
|
69
|
+
- Centralized for gitlab module in `lib/gitlab/dlog.ts`
|
|
70
|
+
- Enable at runtime: `DEBUG=gitlab bun run bin/git-lab-project.ts`
|
|
71
|
+
|
|
72
|
+
## Comments
|
|
73
|
+
|
|
74
|
+
- Minimal comments; code is self-documenting
|
|
75
|
+
- Use `//` single-line style when needed
|
|
76
|
+
- No JSDoc conventions
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-confluence
|
|
3
|
+
description: Using git-confluence commands to search, read, and update Confluence pages
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
`gitj confluence` interacts with Confluence Cloud via its REST API v2.
|
|
9
|
+
Authentication uses git config values with fallback to `jira.*` equivalents:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
git config --global confluence.host yourcompany.atlassian.net # falls back to jira.host
|
|
13
|
+
git config --global confluence.user you@company.com # falls back to jira.user, then user.email
|
|
14
|
+
git config --global confluence.token your-api-token # falls back to jira.token
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
```
|
|
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
|
+
```
|
|
26
|
+
|
|
27
|
+
Use `--help` on any command for options.
|
|
28
|
+
|
|
29
|
+
## Key Behaviors
|
|
30
|
+
|
|
31
|
+
- **`--body-format`** accepts `storage` (XHTML) or `atlas_doc_format` (ADF JSON).
|
|
32
|
+
`--body-only` requires `--body-format` to be set.
|
|
33
|
+
- **`page update`** always writes in `storage` representation, regardless of how
|
|
34
|
+
the content was read. It auto-fetches the current version and increments it.
|
|
35
|
+
- **Page IDs are numeric strings** (e.g., `"36306946"`).
|
|
36
|
+
- Page content uses Confluence storage format (XHTML with `ac:*`/`ri:*` namespaced
|
|
37
|
+
elements for macros, links, and images). Reference:
|
|
38
|
+
https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html
|
|
39
|
+
|
|
40
|
+
## Workflow: Read, Revise, and Update a Page
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
# 1. Find the page
|
|
44
|
+
gitj confluence page search "My Page Title"
|
|
45
|
+
|
|
46
|
+
# 2. Read content (outputs raw storage-format XHTML)
|
|
47
|
+
gitj confluence page show <id> --body-format storage --body-only > page.html
|
|
48
|
+
|
|
49
|
+
# 3. Edit page.html as needed (must remain valid storage format)
|
|
50
|
+
|
|
51
|
+
# 4. Push the update
|
|
52
|
+
gitj confluence page update <id> --file page.html --message "Updated content"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Content can also be piped via stdin:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
cat page.html | gitj confluence page update <id>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Arbitrary Confluence API Access
|
|
62
|
+
|
|
63
|
+
For operations not covered by the dedicated commands, use `gitj api confluence`:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
# GET (default) -- path is relative to /wiki/api/v2
|
|
67
|
+
gitj api confluence /spaces
|
|
68
|
+
gitj api confluence /pages/12345
|
|
69
|
+
|
|
70
|
+
# POST (auto-promoted when --data is provided)
|
|
71
|
+
gitj api confluence /pages -d '{"spaceId":"123","title":"New Page","body":{"representation":"storage","value":"<p>content</p>"},"status":"current"}'
|
|
72
|
+
|
|
73
|
+
# Paginated listing
|
|
74
|
+
gitj api confluence /spaces --paginate
|
|
75
|
+
|
|
76
|
+
# Skip /wiki/api/v2 prefix for v1 API access
|
|
77
|
+
gitj api confluence /wiki/rest/api/content/12345 --raw
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`gitj api` handles authentication and base URL automatically. It also supports
|
|
81
|
+
`-v` (status/headers to stderr), and exits with code 1 on HTTP 4xx/5xx.
|
|
82
|
+
Run `gitj api -h` for all options.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-jira
|
|
3
|
+
description: Using git-jira commands to work with Jira issues and branches
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
`gitj jira` interacts with Jira Cloud via its REST API v3. Authentication uses
|
|
9
|
+
git config values:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
git config --global jira.host yourcompany.atlassian.net
|
|
13
|
+
git config --global jira.user you@company.com # falls back to user.email
|
|
14
|
+
git config --global jira.token your-api-token
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
```
|
|
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
|
+
```
|
|
26
|
+
|
|
27
|
+
All dedicated commands are **read-only**. Use `--help` on any command for options.
|
|
28
|
+
|
|
29
|
+
## Workflow: Start Working on a Jira Issue
|
|
30
|
+
|
|
31
|
+
```sh
|
|
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
|
+
```
|
|
36
|
+
|
|
37
|
+
The `start` command only creates a local branch -- it does not push or
|
|
38
|
+
transition the Jira issue.
|
|
39
|
+
|
|
40
|
+
## Arbitrary Jira API Access
|
|
41
|
+
|
|
42
|
+
The dedicated commands are read-only. For write operations (creating issues,
|
|
43
|
+
transitions, comments, etc.), use `gitj api jira`:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
# GET (default) -- path is relative to /rest/api/3
|
|
47
|
+
gitj api jira /myself
|
|
48
|
+
gitj api jira /issue/PROJ-123
|
|
49
|
+
|
|
50
|
+
# POST (auto-promoted when --data is provided)
|
|
51
|
+
gitj api jira /issue -d '{"fields":{"project":{"key":"PROJ"},"summary":"New issue","issuetype":{"name":"Task"}}}'
|
|
52
|
+
|
|
53
|
+
# Explicit method
|
|
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
|
+
|
|
57
|
+
# Skip /rest/api/3 prefix for full URL control
|
|
58
|
+
gitj api jira /rest/api/2/myself --raw
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`gitj api` handles authentication and base URL automatically. It also supports
|
|
62
|
+
`--paginate`, `-v` (status/headers to stderr), and exits with code 1 on HTTP
|
|
63
|
+
4xx/5xx. Run `gitj api -h` for all options.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-lab
|
|
3
|
+
description: Using git-lab commands to work with GitLab projects, merge requests, and pipelines
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
`gitj lab` interacts with GitLab via its REST API v4. Authentication uses git
|
|
9
|
+
config values:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
git config --global gitlab.host gitlab.example.com # defaults to gitlab.com
|
|
13
|
+
git config --global gitlab.token glpat-xxxxxxxxxxxx # required
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The token is sent as a `Private-Token` header. User identity is resolved from
|
|
17
|
+
`user.email` (falls back to `gitlab.user`).
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
```
|
|
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
|
+
```
|
|
37
|
+
|
|
38
|
+
All dedicated commands are **read-only**. Use `--help` on any command for
|
|
39
|
+
options and defaults.
|
|
40
|
+
|
|
41
|
+
## Key Behaviors
|
|
42
|
+
|
|
43
|
+
- **Project-scoped commands** (`project whereami`, `project mr list`,
|
|
44
|
+
`merge train list`, all `pipeline` commands) require being in a git repo
|
|
45
|
+
with an `origin` remote pointing to GitLab.
|
|
46
|
+
- **`pipeline list`** filters to the current user's pipelines, not all project
|
|
47
|
+
pipelines.
|
|
48
|
+
- **`pipeline log`** outputs raw text to stdout, suitable for piping or agent
|
|
49
|
+
consumption when diagnosing CI failures.
|
|
50
|
+
|
|
51
|
+
## Workflows
|
|
52
|
+
|
|
53
|
+
### Find the MR for the current branch
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
gitj lab project mr list
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Defaults to the current directory's project and current branch. Use
|
|
60
|
+
`-p <path>` and `-b <branch>` to override.
|
|
61
|
+
|
|
62
|
+
### Debug a CI failure
|
|
63
|
+
|
|
64
|
+
```sh
|
|
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
|
+
```
|
|
69
|
+
|
|
70
|
+
### Review merge requests
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
gitj lab merge todo # MRs needing my review
|
|
74
|
+
gitj lab merge active # my own open MRs
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Arbitrary GitLab API Access
|
|
78
|
+
|
|
79
|
+
The dedicated commands are read-only. For write operations (approving MRs,
|
|
80
|
+
posting comments, triggering pipelines, etc.), use `gitj api gitlab`:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
# GET (default) -- path is relative to /api/v4
|
|
84
|
+
gitj api gitlab /user
|
|
85
|
+
gitj api gitlab /projects/123/merge_requests
|
|
86
|
+
|
|
87
|
+
# POST (auto-promoted when --data is provided)
|
|
88
|
+
gitj api gitlab /projects/123/merge_requests/456/notes -d '{"body":"LGTM"}'
|
|
89
|
+
|
|
90
|
+
# Explicit method
|
|
91
|
+
gitj api gitlab /projects/123/merge_requests/456/approve -X POST
|
|
92
|
+
|
|
93
|
+
# Paginated listing
|
|
94
|
+
gitj api gitlab /projects --paginate
|
|
95
|
+
|
|
96
|
+
# Skip /api/v4 prefix for full URL control
|
|
97
|
+
gitj api gitlab /api/v4/version --raw
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`gitj api` handles authentication and base URL automatically. It also supports
|
|
101
|
+
`-v` (status/headers to stderr), and exits with code 1 on HTTP 4xx/5xx.
|
|
102
|
+
Run `gitj api -h` for all options.
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# ya-git-jira
|
|
2
|
+
|
|
3
|
+
CLI tool providing git subcommands for Jira and GitLab integration
|
|
4
|
+
(e.g., `git-jira start`, `git-lab merge active`, `git-bump`). Built with TypeScript
|
|
5
|
+
on the Bun runtime (NOT Node.js). Uses Commander.js for CLI argument parsing.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
| Task | Command |
|
|
10
|
+
|------|---------|
|
|
11
|
+
| Install dependencies | `bun install` |
|
|
12
|
+
| Build | `bun run build` or `bun run build.ts` |
|
|
13
|
+
| Run all tests | `bun test` |
|
|
14
|
+
| Run a single test file | `bun test tests/git.test.ts` |
|
|
15
|
+
| Run a single test by name | `bun test --test-name-pattern "pattern"` |
|
|
16
|
+
| Type check (no emit) | `bunx tsc --noEmit` |
|
|
17
|
+
|
|
18
|
+
No linters or formatters are configured. Build output goes to `dist/` (gitignored).
|
|
19
|
+
|
|
20
|
+
## Commit Messages
|
|
21
|
+
|
|
22
|
+
Short, lowercase, descriptive phrases without conventional-commit prefixes:
|
|
23
|
+
- `improved config`
|
|
24
|
+
- `split lib/gitlab.ts into lib/gitlab/*.ts`
|
|
25
|
+
- `fix/update git-lab-merge-*`
|
|
26
|
+
- Version bumps: `v1.6.0`
|
|
27
|
+
|
|
28
|
+
## Key Files
|
|
29
|
+
|
|
30
|
+
| Path | Purpose |
|
|
31
|
+
|------|---------|
|
|
32
|
+
| `build.ts` | Bun build script (discovers entry points via glob) |
|
|
33
|
+
| `index.ts` | Barrel export of all lib modules |
|
|
34
|
+
| `lib/spawn.ts` | Process spawning wrapper around Bun.spawn |
|
|
35
|
+
| `lib/git.ts` | Git operations (config, branch, remote) |
|
|
36
|
+
| `lib/jira.ts` | Jira API client |
|
|
37
|
+
| `lib/json.ts` | JSONValue type definition |
|
|
38
|
+
| `lib/is_main.ts` | isMain() helper for dual import/run files |
|
|
39
|
+
| `lib/package.ts` | package.json reading and version extraction |
|
|
40
|
+
| `lib/gitlab/` | GitLab API client (api, config, groups, MRs, pipelines, etc.) |
|
|
41
|
+
| `lib/confluence/` | Confluence API client (api, config, types) |
|
|
42
|
+
| `bin/gitj.ts` | Root CLI entry point aggregating all subcommands |
|
|
43
|
+
|
|
44
|
+
## Skills
|
|
45
|
+
|
|
46
|
+
Load the `code-style` skill before writing or editing TypeScript code.
|
|
47
|
+
Load the `architecture` skill when you need to understand CLI design patterns, project structure, or test conventions.
|
|
48
|
+
Load the `git-confluence` skill when working with Confluence pages (searching, reading, or updating content).
|
|
49
|
+
Load the `git-jira` skill when working with Jira issues or the `git-jira` commands.
|
|
50
|
+
Load the `git-lab` skill when working with GitLab projects, merge requests, or the `git-lab` commands.
|
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"]
|