ya-git-jira 1.5.0 → 2.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/.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/README.md +121 -71
- 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 +126 -0
- package/bin/gitj.ts +12 -0
- package/dist/bin/git-api.js +2156 -0
- package/dist/bin/git-bump.js +136 -125
- package/dist/bin/git-confluence-page-search.js +2079 -0
- package/dist/bin/{git-lab-projects.js → git-confluence-page-show.js} +294 -250
- package/dist/bin/{git-lab-projects-whereami.js → git-confluence-page-update.js} +300 -206
- package/dist/bin/git-confluence-page.js +2186 -0
- package/dist/bin/{git-lab-groups.js → git-confluence-space-list.js} +279 -210
- 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 +144 -129
- package/dist/bin/git-jira-issue-show.js +144 -129
- package/dist/bin/git-jira-issue.js +148 -133
- package/dist/bin/git-jira-start.js +146 -131
- package/dist/bin/{git-lab-namespaces.js → git-jira-whoami.js} +214 -226
- package/dist/bin/git-jira.js +178 -143
- package/dist/bin/git-lab-group-list.js +326 -394
- package/dist/bin/git-lab-group.js +328 -396
- package/dist/bin/git-lab-merge-active.js +326 -394
- package/dist/bin/git-lab-merge-todo.js +326 -394
- package/dist/bin/git-lab-merge-train-list.js +294 -388
- package/dist/bin/git-lab-merge-train.js +296 -390
- package/dist/bin/git-lab-merge.js +335 -403
- package/dist/bin/git-lab-namespace-list.js +145 -135
- package/dist/bin/git-lab-namespace.js +147 -137
- package/dist/bin/git-lab-project-list.js +293 -387
- 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 +328 -396
- package/dist/bin/git-lab-project-pipeline-log.js +2739 -0
- package/dist/bin/git-lab-project-pipeline.js +442 -407
- package/dist/bin/git-lab-project-whereami.js +297 -391
- package/dist/bin/git-lab-project.js +568 -403
- package/dist/bin/git-lab-whoami.js +149 -139
- package/dist/bin/git-lab.js +581 -454
- package/dist/bin/{git-lab-projects-list.js → gitj-install-skills.js} +226 -268
- package/dist/bin/gitj.js +1384 -578
- package/dist/index.js +379 -300
- package/index.ts +1 -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/git.ts +3 -3
- package/lib/gitlab/config.ts +5 -5
- 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 +11 -6
- package/lib/spawn.ts +3 -3
- 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
|
@@ -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
|
+
`git-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
|
+
git-confluence whoami Show current authenticated user
|
|
21
|
+
git-confluence space list List all spaces
|
|
22
|
+
git-confluence page search <q> Search pages (fuzzy title, --exact, or --full-text)
|
|
23
|
+
git-confluence page show <id> Show page metadata (add --body-format for content)
|
|
24
|
+
git-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
|
+
git-confluence page search "My Page Title"
|
|
45
|
+
|
|
46
|
+
# 2. Read content (outputs raw storage-format XHTML)
|
|
47
|
+
git-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
|
+
git-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 | git-confluence page update <id>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Arbitrary Confluence API Access
|
|
62
|
+
|
|
63
|
+
For operations not covered by the dedicated commands, use `git-api confluence`:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
# GET (default) -- path is relative to /wiki/api/v2
|
|
67
|
+
git-api confluence /spaces
|
|
68
|
+
git-api confluence /pages/12345
|
|
69
|
+
|
|
70
|
+
# POST (auto-promoted when --data is provided)
|
|
71
|
+
git-api confluence /pages -d '{"spaceId":"123","title":"New Page","body":{"representation":"storage","value":"<p>content</p>"},"status":"current"}'
|
|
72
|
+
|
|
73
|
+
# Paginated listing
|
|
74
|
+
git-api confluence /spaces --paginate
|
|
75
|
+
|
|
76
|
+
# Skip /wiki/api/v2 prefix for v1 API access
|
|
77
|
+
git-api confluence /wiki/rest/api/content/12345 --raw
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`git-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 `git-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
|
+
`git-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
|
+
git-jira whoami Show current Jira user
|
|
21
|
+
git-jira issue list List your unresolved issues (shortcut: git-jira list)
|
|
22
|
+
git-jira issue show <key> Show a single issue
|
|
23
|
+
git-jira start <key> Create a branch from an issue key + summary
|
|
24
|
+
git-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
|
+
git-jira issue list # find your unresolved issues
|
|
33
|
+
git-jira start PROJ-123 # creates and checks out a descriptive branch
|
|
34
|
+
git-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 `git-api jira`:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
# GET (default) -- path is relative to /rest/api/3
|
|
47
|
+
git-api jira /myself
|
|
48
|
+
git-api jira /issue/PROJ-123
|
|
49
|
+
|
|
50
|
+
# POST (auto-promoted when --data is provided)
|
|
51
|
+
git-api jira /issue -d '{"fields":{"project":{"key":"PROJ"},"summary":"New issue","issuetype":{"name":"Task"}}}'
|
|
52
|
+
|
|
53
|
+
# Explicit method
|
|
54
|
+
git-api jira /issue/PROJ-123 -X PUT -d '{"fields":{"summary":"Updated title"}}'
|
|
55
|
+
git-api jira /issue/PROJ-123/transitions -d '{"transition":{"id":"31"}}'
|
|
56
|
+
|
|
57
|
+
# Skip /rest/api/3 prefix for full URL control
|
|
58
|
+
git-api jira /rest/api/2/myself --raw
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`git-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 `git-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
|
+
`git-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
|
+
git-lab whoami Show current GitLab user
|
|
23
|
+
git-lab group list List groups
|
|
24
|
+
git-lab namespace list List namespaces
|
|
25
|
+
git-lab project list [--match] List projects (server + client-side filter)
|
|
26
|
+
git-lab project whereami Identify project from current git remote
|
|
27
|
+
git-lab project mr list List MRs for a project/branch (defaults to current)
|
|
28
|
+
git-lab merge active My open merge requests (across all projects)
|
|
29
|
+
git-lab merge todo MRs where I'm assigned as reviewer
|
|
30
|
+
git-lab merge train list Merge trains for the current project
|
|
31
|
+
git-lab project pipeline list Recent pipelines (scoped to current user)
|
|
32
|
+
git-lab project pipeline latest Jobs for latest pipeline on current branch
|
|
33
|
+
git-lab project pipeline jobs Jobs for a specific pipeline
|
|
34
|
+
git-lab project pipeline log Download a job's log output (plain text)
|
|
35
|
+
git-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
|
+
git-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
|
+
git-lab project pipeline latest # see jobs for current branch
|
|
66
|
+
git-lab project pipeline log --job <id> # download the log
|
|
67
|
+
git-lab project pipeline log --job <id> --tail 200 # last 200 lines
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Review merge requests
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
git-lab merge todo # MRs needing my review
|
|
74
|
+
git-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 `git-api gitlab`:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
# GET (default) -- path is relative to /api/v4
|
|
84
|
+
git-api gitlab /user
|
|
85
|
+
git-api gitlab /projects/123/merge_requests
|
|
86
|
+
|
|
87
|
+
# POST (auto-promoted when --data is provided)
|
|
88
|
+
git-api gitlab /projects/123/merge_requests/456/notes -d '{"body":"LGTM"}'
|
|
89
|
+
|
|
90
|
+
# Explicit method
|
|
91
|
+
git-api gitlab /projects/123/merge_requests/456/approve -X POST
|
|
92
|
+
|
|
93
|
+
# Paginated listing
|
|
94
|
+
git-api gitlab /projects --paginate
|
|
95
|
+
|
|
96
|
+
# Skip /api/v4 prefix for full URL control
|
|
97
|
+
git-api gitlab /api/v4/version --raw
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`git-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 `git-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/README.md
CHANGED
|
@@ -1,119 +1,169 @@
|
|
|
1
|
-
# ya-git-jira
|
|
1
|
+
# ya-git-jira
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
in the name.
|
|
3
|
+
Git extensions for Jira, GitLab, and Confluence. Each command is a standalone
|
|
4
|
+
executable that `git` discovers automatically (e.g. `git jira start`, `git lab
|
|
5
|
+
merge active`, `git confluence page search`). A unified `gitj` wrapper is also
|
|
6
|
+
provided.
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
## Requirements
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
[Bun](https://bun.sh) (not Node.js):
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
```
|
|
13
|
+
curl -fsSL https://bun.sh/install | bash
|
|
14
|
+
```
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
## Install
|
|
18
17
|
|
|
19
18
|
```
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
npm install -g ya-git-jira # or bun / yarn / pnpm
|
|
20
|
+
```
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
-h, --help display help for command
|
|
22
|
+
## Configuration
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
jira A collection of jira utility commands
|
|
29
|
-
```
|
|
24
|
+
All configuration is via `git config`. Use `--global` if the same settings apply
|
|
25
|
+
across repositories.
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
### Jira
|
|
32
28
|
|
|
33
|
-
#### Usage:
|
|
34
|
-
```bash
|
|
35
|
-
$ git jira-start <issue>
|
|
36
29
|
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
$ git jira-start BUG-0042
|
|
30
|
+
git config jira.host yourcompany.atlassian.net
|
|
31
|
+
git config jira.token "<api-token>"
|
|
41
32
|
```
|
|
42
33
|
|
|
43
|
-
|
|
44
|
-
a suitable branch name using the kebab-case-convention. If BUG-0042 had
|
|
45
|
-
the summary "fix the thing" then the branch name will be `BUG-0042-fix-the-thing`.
|
|
34
|
+
Create an API token: <https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/>
|
|
46
35
|
|
|
47
|
-
|
|
36
|
+
### GitLab
|
|
48
37
|
|
|
49
|
-
|
|
38
|
+
```
|
|
39
|
+
git config gitlab.host gitlab.com # default if omitted
|
|
40
|
+
git config gitlab.token "<api-token>"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Create a personal access token: <https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token>
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
### Confluence
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
git config confluence.host yourcompany.atlassian.net
|
|
49
|
+
git config confluence.token "<api-token>"
|
|
54
50
|
```
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
The token is an Atlassian API token (same kind as Jira).
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
Executing the bump command once will create a new branch named `BUG-0042-fix-the-thing.v1`. If you execute the bump command again it will
|
|
60
|
-
create a branch `BUG-0042-fix-the-thing.v2`.
|
|
54
|
+
### Email address
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
It just checks to see if the current branch already ends with `.v`<*num*>,
|
|
64
|
-
in which case it increments *num* but otherwise leaves the branch name as is.
|
|
65
|
-
If the current branch does not end with `.v`<*num*> then it simply appends the
|
|
66
|
-
suffix `.v1`.
|
|
56
|
+
Commands fall back to `user.email` from git config. Override per-service if needed:
|
|
67
57
|
|
|
68
|
-
|
|
58
|
+
```
|
|
59
|
+
git config jira.user <email>
|
|
60
|
+
git config gitlab.user <email>
|
|
61
|
+
git config confluence.user <email>
|
|
62
|
+
```
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
You must install it before you install this package.
|
|
64
|
+
## Command hierarchy
|
|
72
65
|
|
|
73
66
|
```
|
|
74
|
-
|
|
67
|
+
gitj
|
|
68
|
+
api authenticated REST request to any service
|
|
69
|
+
bump bump the version suffix of the current branch
|
|
70
|
+
confluence
|
|
71
|
+
whoami
|
|
72
|
+
space
|
|
73
|
+
list
|
|
74
|
+
page
|
|
75
|
+
search
|
|
76
|
+
show
|
|
77
|
+
update
|
|
78
|
+
install-skills install AI agent skills for a coding framework
|
|
79
|
+
jira
|
|
80
|
+
whoami
|
|
81
|
+
start create a topic branch from a Jira issue
|
|
82
|
+
issue
|
|
83
|
+
list
|
|
84
|
+
show
|
|
85
|
+
lab
|
|
86
|
+
whoami
|
|
87
|
+
group
|
|
88
|
+
list
|
|
89
|
+
merge
|
|
90
|
+
active
|
|
91
|
+
todo
|
|
92
|
+
train
|
|
93
|
+
list
|
|
94
|
+
namespace
|
|
95
|
+
list
|
|
96
|
+
project
|
|
97
|
+
list
|
|
98
|
+
mr
|
|
99
|
+
list
|
|
100
|
+
pipeline
|
|
101
|
+
jobs
|
|
102
|
+
latest
|
|
103
|
+
list
|
|
104
|
+
log
|
|
105
|
+
whereami
|
|
75
106
|
```
|
|
76
107
|
|
|
77
|
-
|
|
108
|
+
Every leaf command supports `--help`. Run `gitj --help-all` to print the full
|
|
109
|
+
tree with descriptions.
|
|
110
|
+
|
|
111
|
+
## Noteworthy commands
|
|
78
112
|
|
|
79
|
-
|
|
113
|
+
### git jira start
|
|
80
114
|
|
|
81
115
|
```
|
|
82
|
-
|
|
116
|
+
git jira start BUG-42
|
|
83
117
|
```
|
|
84
118
|
|
|
85
|
-
|
|
119
|
+
Fetches the issue summary from Jira, converts it to kebab-case, and creates a
|
|
120
|
+
branch like `BUG-42-fix-the-thing`.
|
|
86
121
|
|
|
87
|
-
|
|
88
|
-
repositories that all using Jira issue tracking then you probably want to use
|
|
89
|
-
the global config by adding the `-g` option to the commands below.
|
|
122
|
+
### git bump
|
|
90
123
|
|
|
91
|
-
|
|
124
|
+
```
|
|
125
|
+
git bump
|
|
126
|
+
```
|
|
92
127
|
|
|
93
|
-
|
|
128
|
+
Appends or increments a `.vN` suffix on the current branch name:
|
|
129
|
+
`BUG-42-fix-the-thing` -> `.v1` -> `.v2` -> ...
|
|
130
|
+
|
|
131
|
+
### git api
|
|
94
132
|
|
|
95
133
|
```
|
|
96
|
-
|
|
134
|
+
git api jira /rest/api/3/myself
|
|
135
|
+
git api gitlab /api/v4/user
|
|
136
|
+
git api confluence /wiki/api/v2/spaces
|
|
97
137
|
```
|
|
98
138
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
This package requries that you create a API Token (a.k.a. Personal Access Token) for your Atlassian
|
|
102
|
-
account, as described [here](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/).
|
|
139
|
+
Make arbitrary authenticated REST calls to any configured service. Useful for
|
|
140
|
+
one-off queries and scripting.
|
|
103
141
|
|
|
104
|
-
|
|
142
|
+
### gitj install-skills
|
|
105
143
|
|
|
106
144
|
```
|
|
107
|
-
|
|
145
|
+
gitj install-skills opencode # symlinks to ~/.config/opencode/skills/
|
|
146
|
+
gitj install-skills copilot # symlinks to ~/.copilot/skills/
|
|
147
|
+
gitj install-skills claude # symlinks to .claude/skills/ (project-level)
|
|
148
|
+
gitj install-skills opencode --copy # copy instead of symlink
|
|
149
|
+
gitj install-skills opencode --force # overwrite existing directories
|
|
108
150
|
```
|
|
109
151
|
|
|
110
|
-
|
|
152
|
+
Installs AI agent skill files (`git-jira`, `git-lab`, `git-confluence`) so that
|
|
153
|
+
coding assistants (OpenCode, GitHub Copilot, Claude Code) know how to use these
|
|
154
|
+
tools.
|
|
155
|
+
|
|
156
|
+
## AI agent skills
|
|
157
|
+
|
|
158
|
+
The `.opencode/skills/` directory contains concise skill files for AI coding
|
|
159
|
+
agents. These tell agents that the tools exist, how auth works, and key workflow
|
|
160
|
+
patterns. Install them with `gitj install-skills <framework>`.
|
|
111
161
|
|
|
112
|
-
|
|
113
|
-
If that email address is the same as your `user.email` setting you don't need to
|
|
114
|
-
add any other configuration. If you use different email addresses for `git` and Atlassian
|
|
115
|
-
then you need to add the email address via `git config` like this:
|
|
162
|
+
## Development
|
|
116
163
|
|
|
117
164
|
```
|
|
118
|
-
|
|
165
|
+
bun install # install dependencies
|
|
166
|
+
bun run build # build to dist/
|
|
167
|
+
bun test # run all tests
|
|
168
|
+
bunx tsc --noEmit # type check
|
|
119
169
|
```
|