@greeana/jira-dev-workflow 0.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/README.md +293 -0
- package/bin/jira-dev-workflow.mjs +223 -0
- package/examples/.jira-dev-workflow/.env.example +3 -0
- package/examples/.jira-dev-workflow/config.json +9 -0
- package/examples/.jira-dev-workflow/import.csv +3 -0
- package/package.json +53 -0
- package/skill/jira-dev-workflow/SKILL.md +113 -0
- package/src/add-comment.ts +177 -0
- package/src/attach-file.ts +86 -0
- package/src/comment-adf.ts +151 -0
- package/src/commit-message.ts +10 -0
- package/src/commit-with-issue.ts +90 -0
- package/src/config.ts +184 -0
- package/src/create-issue.ts +191 -0
- package/src/csv.ts +273 -0
- package/src/find-issue.ts +172 -0
- package/src/git.ts +59 -0
- package/src/image-dimensions.ts +137 -0
- package/src/import-issues.ts +196 -0
- package/src/install.ts +323 -0
- package/src/issue-search.ts +129 -0
- package/src/jira-client.ts +325 -0
- package/src/prepare-commit-draft.ts +164 -0
- package/src/prepare-commit.ts +197 -0
- package/src/show-current-issue.ts +66 -0
- package/src/state.ts +36 -0
- package/src/test-connection.ts +107 -0
- package/src/use-issue.ts +84 -0
- package/tsconfig.json +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# @greeana/jira-dev-workflow
|
|
2
|
+
|
|
3
|
+
Publishable npm CLI plus Codex skill template for Jira-backed development workflows.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
- find matching Jira issues for a diff or free text
|
|
8
|
+
- reuse open issues and avoid reusing closed ones
|
|
9
|
+
- create a new issue when no suitable open issue exists
|
|
10
|
+
- prepare commit plans from staged or working-tree changes
|
|
11
|
+
- save the selected Jira issue locally for later commands
|
|
12
|
+
- post implementation comments, reports, and screenshots
|
|
13
|
+
- create git commits with Jira key prefixes
|
|
14
|
+
- import Jira issues from CSV
|
|
15
|
+
|
|
16
|
+
## Package model
|
|
17
|
+
|
|
18
|
+
This package is designed to be published as:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
@greeana/jira-dev-workflow
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The included Codex skill calls the published CLI through `npx`, so consumers do not need to vendor the source code into each repo.
|
|
25
|
+
|
|
26
|
+
## Consumer repo layout
|
|
27
|
+
|
|
28
|
+
Each consumer repo keeps its own local workflow state and secrets under:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
.jira-dev-workflow/config.json
|
|
32
|
+
.jira-dev-workflow/.env.local
|
|
33
|
+
.jira-dev-workflow/state/current-issue.json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The CLI searches upward from the current working directory until it finds `.jira-dev-workflow/`.
|
|
37
|
+
|
|
38
|
+
See the examples under [`examples/.jira-dev-workflow/`](./examples/.jira-dev-workflow/).
|
|
39
|
+
|
|
40
|
+
Minimal config:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"projectKey": "JDW",
|
|
45
|
+
"defaultIssueType": "Task",
|
|
46
|
+
"issueLinkType": "Relates",
|
|
47
|
+
"commitMessageFormat": "{issueKey} {message}",
|
|
48
|
+
"searchLimit": 5,
|
|
49
|
+
"reuseClosedAsRelatedLink": true,
|
|
50
|
+
"stateFile": "state/current-issue.json"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Minimal env:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
JIRA_BASE_URL=https://your-company.atlassian.net
|
|
58
|
+
JIRA_EMAIL=your.name@company.com
|
|
59
|
+
JIRA_API_TOKEN=your_jira_api_token
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Local development
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install
|
|
66
|
+
npm test
|
|
67
|
+
node ./bin/jira-dev-workflow.mjs help
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Bootstrap the current repo with the local skill and required workflow files:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx -y @greeana/jira-dev-workflow install
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Test the skill locally before any npm publish by generating a skill that calls this checkout directly:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
node ./bin/jira-dev-workflow.mjs install --local
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Generate a repo-local skill that keeps using the npm `preview` dist-tag:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npx -y @greeana/jira-dev-workflow@preview install --preview
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Generate a repo-local skill pinned to an exact published version:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx -y @greeana/jira-dev-workflow@0.1.0-preview.0 install --version 0.1.0-preview.0
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This creates:
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
.codex/skills/jira-dev-workflow/SKILL.md
|
|
98
|
+
.jira-dev-workflow/config.json
|
|
99
|
+
.jira-dev-workflow/.env.local
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
It also ensures `.gitignore` contains:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
.jira-dev-workflow/.env.local
|
|
106
|
+
.jira-dev-workflow/state/
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Published CLI examples
|
|
110
|
+
|
|
111
|
+
Show all commands:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx -y @greeana/jira-dev-workflow help
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Install into the current repo:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npx -y @greeana/jira-dev-workflow install
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Install into the current repo and write the Jira project key up front:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx -y @greeana/jira-dev-workflow install --project-key JDW
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Install into the current repo and make the generated skill keep using the npm `preview` tag:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npx -y @greeana/jira-dev-workflow@preview install --preview
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Install into the current repo and pin the generated skill to an exact published version:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npx -y @greeana/jira-dev-workflow@0.1.0-preview.0 install --version 0.1.0-preview.0
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Install into the current repo and make the generated skill call a local checkout directly:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
node /absolute/path/to/jira-dev-workflow/bin/jira-dev-workflow.mjs install --local
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Test Jira access:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npx -y @greeana/jira-dev-workflow test
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Prepare a commit plan from staged changes:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npx -y @greeana/jira-dev-workflow prepare-commit --json
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Expected interactive flow for agents:
|
|
160
|
+
|
|
161
|
+
1. User stages changes and asks to prepare a Jira commit.
|
|
162
|
+
2. Agent runs `prepare-commit --json`.
|
|
163
|
+
3. Agent shows matching open issues, or a drafted new issue if no open issue fits, and asks the user which path to take.
|
|
164
|
+
4. Agent does not create an issue, commit, or post back to Jira yet.
|
|
165
|
+
5. After the user selects an issue or approves a new one, the agent previews the final commit message with `commit --dry-run` and asks for confirmation.
|
|
166
|
+
6. Only after explicit confirmation does the agent create the commit.
|
|
167
|
+
7. Posting an implementation comment or attachments back to Jira is a separate confirmation step unless the user explicitly asked for that as part of the workflow.
|
|
168
|
+
|
|
169
|
+
Prepare a commit plan from working-tree changes:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npx -y @greeana/jira-dev-workflow prepare-commit --working-tree --json
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Search Jira directly:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npx -y @greeana/jira-dev-workflow find --text "qa agent isolation" --json
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Create a new Jira issue:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npx -y @greeana/jira-dev-workflow create \
|
|
185
|
+
--summary "Improve QA agent isolation" \
|
|
186
|
+
--description-file /tmp/issue.md
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Create a new Jira issue related to a closed one:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npx -y @greeana/jira-dev-workflow create \
|
|
193
|
+
--summary "Improve QA agent isolation" \
|
|
194
|
+
--description-file /tmp/issue.md \
|
|
195
|
+
--related-issue JDW-19
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Save the selected issue for later commands:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
npx -y @greeana/jira-dev-workflow use --issue JDW-23
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Show the current saved issue:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
npx -y @greeana/jira-dev-workflow current
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Attach a screenshot or artifact:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
npx -y @greeana/jira-dev-workflow attach --issue JDW-23 --file /absolute/path/to/screenshot.png
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Add an implementation report comment:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
npx -y @greeana/jira-dev-workflow comment \
|
|
220
|
+
--issue JDW-23 \
|
|
221
|
+
--text $'Implemented in:\nhttps://git.example.com/commit/abcdef'
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Add a comment with inline screenshots:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
npx -y @greeana/jira-dev-workflow comment \
|
|
228
|
+
--issue JDW-23 \
|
|
229
|
+
--text $'Implementation report:\n\nPrepared commit result:\n\n[[inline-file]]\n\nJira issue after preparation:\n\n[[inline-file]]' \
|
|
230
|
+
--inline-file /absolute/path/to/screenshot-1.png \
|
|
231
|
+
--inline-file /absolute/path/to/screenshot-2.png
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Inline screenshot placement rules:
|
|
235
|
+
|
|
236
|
+
- `[[inline-file]]` inserts the next inline screenshot in order.
|
|
237
|
+
- `[[inline-file:2]]` inserts a specific inline screenshot by 1-based index.
|
|
238
|
+
- Place placeholders as their own paragraphs to position screenshots between report sections.
|
|
239
|
+
- If you pass inline screenshots without placeholders, they are appended after the text for backward compatibility.
|
|
240
|
+
|
|
241
|
+
Preview the final commit message:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
npx -y @greeana/jira-dev-workflow commit --issue JDW-23 -m "Improve QA agent isolation" --dry-run
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Create the git commit:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
npx -y @greeana/jira-dev-workflow commit --issue JDW-23 -m "Improve QA agent isolation"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Import issues from CSV:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
npx -y @greeana/jira-dev-workflow import --file .jira-dev-workflow/import.csv
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Codex skill
|
|
260
|
+
|
|
261
|
+
The portable skill template lives in:
|
|
262
|
+
|
|
263
|
+
```text
|
|
264
|
+
skill/jira-dev-workflow/SKILL.md
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Install it into either:
|
|
268
|
+
|
|
269
|
+
```text
|
|
270
|
+
~/.codex/skills/jira-dev-workflow/
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
or:
|
|
274
|
+
|
|
275
|
+
```text
|
|
276
|
+
.codex/skills/jira-dev-workflow/
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
The skill assumes the published package name is `@greeana/jira-dev-workflow`. If you publish under a different scope or package name, update the `npx` commands in the skill file.
|
|
280
|
+
|
|
281
|
+
## Release checklist
|
|
282
|
+
|
|
283
|
+
1. Update `version` in `package.json`.
|
|
284
|
+
2. Run `npm test`.
|
|
285
|
+
3. Run `npm pack --dry-run` and confirm only the intended files are included.
|
|
286
|
+
4. Confirm `skill/jira-dev-workflow/SKILL.md` still points to `npx -y @greeana/jira-dev-workflow`.
|
|
287
|
+
5. Publish with `npm publish --access public`.
|
|
288
|
+
6. Smoke-test the published package:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
npx -y @greeana/jira-dev-workflow help
|
|
292
|
+
npx -y @greeana/jira-dev-workflow test
|
|
293
|
+
```
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const packageDir = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
8
|
+
const commandMap = new Map([
|
|
9
|
+
["unit", "tests"],
|
|
10
|
+
["install", "src/install.ts"],
|
|
11
|
+
["test", "src/test-connection.ts"],
|
|
12
|
+
["prepare-commit", "src/prepare-commit.ts"],
|
|
13
|
+
["find", "src/find-issue.ts"],
|
|
14
|
+
["create", "src/create-issue.ts"],
|
|
15
|
+
["comment", "src/add-comment.ts"],
|
|
16
|
+
["attach", "src/attach-file.ts"],
|
|
17
|
+
["use", "src/use-issue.ts"],
|
|
18
|
+
["current", "src/show-current-issue.ts"],
|
|
19
|
+
["commit", "src/commit-with-issue.ts"],
|
|
20
|
+
["import", "src/import-issues.ts"],
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
function main() {
|
|
24
|
+
const args = process.argv.slice(2);
|
|
25
|
+
|
|
26
|
+
if (args.length === 0) {
|
|
27
|
+
showGeneralHelp();
|
|
28
|
+
process.exitCode = 1;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const [commandName, ...commandArgs] = args;
|
|
33
|
+
|
|
34
|
+
if (!commandName) {
|
|
35
|
+
showGeneralHelp();
|
|
36
|
+
process.exitCode = 1;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (commandName === "help" || commandName === "-h" || commandName === "--help") {
|
|
41
|
+
showCommandHelp(commandArgs[0]);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!commandMap.has(commandName)) {
|
|
46
|
+
console.error(`Unknown jira-dev-workflow command: ${commandName}`);
|
|
47
|
+
process.exitCode = 1;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (commandArgs[0] === "--help" || commandArgs[0] === "-h") {
|
|
52
|
+
showCommandHelp(commandName);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
runCommand(commandName, commandArgs);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function runCommand(commandName, commandArgs) {
|
|
60
|
+
if (commandName === "unit") {
|
|
61
|
+
const result = spawnSync(process.execPath, ["--import", "tsx", "--test", "tests/**/*.test.ts", ...commandArgs], {
|
|
62
|
+
cwd: packageDir,
|
|
63
|
+
stdio: "inherit",
|
|
64
|
+
});
|
|
65
|
+
process.exitCode = result.status ?? 1;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const entry = commandMap.get(commandName);
|
|
70
|
+
|
|
71
|
+
if (!entry || entry === "tests") {
|
|
72
|
+
process.exitCode = 1;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const result = spawnSync(process.execPath, ["--import", "tsx", entry, ...commandArgs], {
|
|
77
|
+
cwd: packageDir,
|
|
78
|
+
stdio: "inherit",
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
process.exitCode = result.status ?? 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function showGeneralHelp() {
|
|
85
|
+
console.log(`Usage: jira-dev-workflow <command> [args...]
|
|
86
|
+
|
|
87
|
+
Commands:
|
|
88
|
+
help Show all commands
|
|
89
|
+
unit Run package-local tests
|
|
90
|
+
install Scaffold repo-local config and Codex skill
|
|
91
|
+
test Check Jira auth and project permissions
|
|
92
|
+
prepare-commit Build a staged-diff Jira + commit plan
|
|
93
|
+
find Search Jira issues by text or diff
|
|
94
|
+
create Create a Jira issue
|
|
95
|
+
comment Add a comment to a Jira issue
|
|
96
|
+
attach Attach a local file to a Jira issue
|
|
97
|
+
use Save the current Jira issue locally
|
|
98
|
+
current Show the saved current Jira issue
|
|
99
|
+
commit Preview or create a git commit with Jira key
|
|
100
|
+
import Import issues from a CSV file
|
|
101
|
+
|
|
102
|
+
Use:
|
|
103
|
+
jira-dev-workflow help <command>
|
|
104
|
+
jira-dev-workflow <command> --help`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function showCommandHelp(commandName) {
|
|
108
|
+
switch (commandName) {
|
|
109
|
+
case undefined:
|
|
110
|
+
case "":
|
|
111
|
+
case "help":
|
|
112
|
+
showGeneralHelp();
|
|
113
|
+
return;
|
|
114
|
+
case "unit":
|
|
115
|
+
console.log(`Usage:
|
|
116
|
+
jira-dev-workflow unit
|
|
117
|
+
|
|
118
|
+
Description:
|
|
119
|
+
Run package-local tests for the Jira workflow CLI.`);
|
|
120
|
+
return;
|
|
121
|
+
case "install":
|
|
122
|
+
console.log(`Usage:
|
|
123
|
+
jira-dev-workflow install [--project-key KEY] [--local | --preview | --version VERSION] [--force] [--json]
|
|
124
|
+
|
|
125
|
+
Description:
|
|
126
|
+
Scaffold the current repo with .jira-dev-workflow config, a repo-local Codex skill,
|
|
127
|
+
and recommended .gitignore entries.
|
|
128
|
+
|
|
129
|
+
Parameters:
|
|
130
|
+
--project-key KEY Optionally write the Jira project key into the generated config
|
|
131
|
+
--local Make the generated skill call this local checkout directly
|
|
132
|
+
--preview Make the generated skill call the npm preview dist-tag
|
|
133
|
+
--version VERSION Make the generated skill call an exact npm package version
|
|
134
|
+
--force Overwrite existing managed files
|
|
135
|
+
--json Print the created/updated paths as JSON`);
|
|
136
|
+
return;
|
|
137
|
+
case "test":
|
|
138
|
+
console.log(`Usage:
|
|
139
|
+
jira-dev-workflow test [--project-key KEY] [--env-file PATH] [--config PATH]
|
|
140
|
+
|
|
141
|
+
Description:
|
|
142
|
+
Validate Jira authentication, project visibility, and CREATE_ISSUES permission.
|
|
143
|
+
|
|
144
|
+
Parameters:
|
|
145
|
+
--project-key KEY Override the configured Jira project key
|
|
146
|
+
--env-file PATH Load credentials from a different env file
|
|
147
|
+
--config PATH Load a different .jira-dev-workflow/config.json file`);
|
|
148
|
+
return;
|
|
149
|
+
case "prepare-commit":
|
|
150
|
+
console.log(`Usage:
|
|
151
|
+
jira-dev-workflow prepare-commit [--json] [--working-tree|--staged] [--limit N] [--project-key KEY] [--env-file PATH] [--config PATH]
|
|
152
|
+
|
|
153
|
+
Description:
|
|
154
|
+
Build a non-destructive commit plan from the current diff. It returns Jira matches,
|
|
155
|
+
a new issue draft, and commit-message previews.`);
|
|
156
|
+
return;
|
|
157
|
+
case "find":
|
|
158
|
+
console.log(`Usage:
|
|
159
|
+
jira-dev-workflow find (--text TEXT | --from-diff) [--json] [--working-tree|--staged] [--limit N] [--project-key KEY] [--env-file PATH] [--config PATH]
|
|
160
|
+
|
|
161
|
+
Description:
|
|
162
|
+
Search Jira for matching issues by explicit text or by text extracted from the git diff.
|
|
163
|
+
Closed issues are not reused; they are returned only as related references.`);
|
|
164
|
+
return;
|
|
165
|
+
case "create":
|
|
166
|
+
console.log(`Usage:
|
|
167
|
+
jira-dev-workflow create --summary TEXT [--description TEXT | --description-file PATH] [--related-issue KEY ...] [--issue-type NAME] [--project-key KEY] [--label NAME ...] [--json] [--no-save] [--env-file PATH] [--config PATH]
|
|
168
|
+
|
|
169
|
+
Description:
|
|
170
|
+
Create a new Jira issue and optionally relate it to one or more existing issues.`);
|
|
171
|
+
return;
|
|
172
|
+
case "comment":
|
|
173
|
+
console.log(`Usage:
|
|
174
|
+
jira-dev-workflow comment [--issue KEY] [--file PATH ...] [--inline-file PATH ...] [--text TEXT | --text-file PATH] [--json] [--env-file PATH] [--config PATH]
|
|
175
|
+
|
|
176
|
+
Description:
|
|
177
|
+
Add a Jira comment. Files are attached; inline files are embedded in the comment using
|
|
178
|
+
the attachment redirect workaround. To place inline images between text sections,
|
|
179
|
+
put placeholder paragraphs such as [[inline-file]] or [[inline-file:2]] inside the
|
|
180
|
+
comment text or text file.`);
|
|
181
|
+
return;
|
|
182
|
+
case "attach":
|
|
183
|
+
console.log(`Usage:
|
|
184
|
+
jira-dev-workflow attach [--issue KEY] --file PATH [--file PATH ...] [--env-file PATH] [--config PATH]
|
|
185
|
+
|
|
186
|
+
Description:
|
|
187
|
+
Attach one or more local files to a Jira issue.`);
|
|
188
|
+
return;
|
|
189
|
+
case "use":
|
|
190
|
+
console.log(`Usage:
|
|
191
|
+
jira-dev-workflow use --issue KEY [--env-file PATH] [--config PATH]
|
|
192
|
+
|
|
193
|
+
Description:
|
|
194
|
+
Save an existing Jira issue as the current issue for later commands.`);
|
|
195
|
+
return;
|
|
196
|
+
case "current":
|
|
197
|
+
console.log(`Usage:
|
|
198
|
+
jira-dev-workflow current [--json] [--config PATH]
|
|
199
|
+
|
|
200
|
+
Description:
|
|
201
|
+
Show the locally saved current Jira issue.`);
|
|
202
|
+
return;
|
|
203
|
+
case "commit":
|
|
204
|
+
console.log(`Usage:
|
|
205
|
+
jira-dev-workflow commit [-m TEXT | --message TEXT] [--issue KEY] [--dry-run] [--config PATH]
|
|
206
|
+
|
|
207
|
+
Description:
|
|
208
|
+
Preview or create a git commit prefixed with the Jira issue key.`);
|
|
209
|
+
return;
|
|
210
|
+
case "import":
|
|
211
|
+
console.log(`Usage:
|
|
212
|
+
jira-dev-workflow import [--file PATH] [--dry-run] [--continue-on-error] [--limit N] [--project-key KEY] [--issue-type NAME] [--env-file PATH] [--config PATH]
|
|
213
|
+
|
|
214
|
+
Description:
|
|
215
|
+
Import issues from a CSV file into Jira.`);
|
|
216
|
+
return;
|
|
217
|
+
default:
|
|
218
|
+
console.error(`Unknown jira-dev-workflow command: ${commandName}`);
|
|
219
|
+
process.exitCode = 1;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@greeana/jira-dev-workflow",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for Jira-backed development workflows: issue search/create, commit preparation, implementation comments, and imports.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"jira-dev-workflow": "./bin/jira-dev-workflow.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"examples",
|
|
12
|
+
"src",
|
|
13
|
+
"skill",
|
|
14
|
+
"README.md",
|
|
15
|
+
"tsconfig.json"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "node --import tsx --test tests/**/*.test.ts",
|
|
19
|
+
"install-workflow": "node --import tsx src/install.ts",
|
|
20
|
+
"test-connection": "node --import tsx src/test-connection.ts",
|
|
21
|
+
"find": "node --import tsx src/find-issue.ts",
|
|
22
|
+
"prepare-commit": "node --import tsx src/prepare-commit.ts",
|
|
23
|
+
"create": "node --import tsx src/create-issue.ts",
|
|
24
|
+
"comment": "node --import tsx src/add-comment.ts",
|
|
25
|
+
"attach": "node --import tsx src/attach-file.ts",
|
|
26
|
+
"use-issue": "node --import tsx src/use-issue.ts",
|
|
27
|
+
"show-current": "node --import tsx src/show-current-issue.ts",
|
|
28
|
+
"commit": "node --import tsx src/commit-with-issue.ts",
|
|
29
|
+
"import-issues": "node --import tsx src/import-issues.ts",
|
|
30
|
+
"prepublishOnly": "npm test"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"jira",
|
|
34
|
+
"codex",
|
|
35
|
+
"workflow",
|
|
36
|
+
"cli",
|
|
37
|
+
"commit"
|
|
38
|
+
],
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=20"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"tsx": "^4.21.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^25.6.0",
|
|
51
|
+
"typescript": "^6.0.3"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: jira-dev-workflow
|
|
3
|
+
description: Use when the user wants to find or create Jira issues for code changes, prepare Jira-linked commits, add implementation reports or screenshots to Jira, or import Jira issues from CSV. This skill orchestrates the published @greeana/jira-dev-workflow CLI through npx, prefers reusing open issues, and when only closed issues match it creates a new issue linked to the closed match.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Jira Dev Workflow
|
|
7
|
+
|
|
8
|
+
Use this skill for Jira-aware development workflows.
|
|
9
|
+
|
|
10
|
+
## Package
|
|
11
|
+
|
|
12
|
+
This skill expects the published npm CLI to be available through:
|
|
13
|
+
|
|
14
|
+
`npx -y @greeana/jira-dev-workflow`
|
|
15
|
+
|
|
16
|
+
If you publish under a different package name or npm scope, update the commands in this file.
|
|
17
|
+
|
|
18
|
+
## Atomic commands
|
|
19
|
+
|
|
20
|
+
- `npx -y @greeana/jira-dev-workflow test`
|
|
21
|
+
Check Jira auth, project access, and issue-creation permission.
|
|
22
|
+
- `npx -y @greeana/jira-dev-workflow prepare-commit --json`
|
|
23
|
+
Build a commit plan from the current diff: open matches, closed matches, issue draft, and commit-message drafts.
|
|
24
|
+
- `npx -y @greeana/jira-dev-workflow find --text "..." --json`
|
|
25
|
+
Search Jira directly by text or diff and return ranked issue candidates.
|
|
26
|
+
- `npx -y @greeana/jira-dev-workflow create --summary "..." --description-file <file>`
|
|
27
|
+
Create a new Jira issue. Add `--related-issue JDW-123` to link a closed related issue.
|
|
28
|
+
- `npx -y @greeana/jira-dev-workflow comment --issue JDW-123 --text "..."`
|
|
29
|
+
Add a Jira comment, optionally with `--file` attachments or inline screenshots via `--inline-file`.
|
|
30
|
+
- `npx -y @greeana/jira-dev-workflow use --issue JDW-123`
|
|
31
|
+
Save the selected Jira issue as the current issue for later commands.
|
|
32
|
+
- `npx -y @greeana/jira-dev-workflow current`
|
|
33
|
+
Show the saved current issue.
|
|
34
|
+
- `npx -y @greeana/jira-dev-workflow attach --issue JDW-123 --file <path>`
|
|
35
|
+
Attach a local file such as a screenshot to a Jira issue.
|
|
36
|
+
- `npx -y @greeana/jira-dev-workflow commit --issue JDW-123 -m "Short message" --dry-run`
|
|
37
|
+
Preview the final commit message with Jira key prefixing.
|
|
38
|
+
- `npx -y @greeana/jira-dev-workflow commit --issue JDW-123 -m "Short message"`
|
|
39
|
+
Create the git commit.
|
|
40
|
+
- `npx -y @greeana/jira-dev-workflow import --file .jira-dev-workflow/import.csv`
|
|
41
|
+
Import issues from a CSV file.
|
|
42
|
+
|
|
43
|
+
## Default flow
|
|
44
|
+
|
|
45
|
+
1. Run `npx -y @greeana/jira-dev-workflow test` if Jira connectivity or permissions are uncertain.
|
|
46
|
+
2. For a commit workflow, start with:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx -y @greeana/jira-dev-workflow prepare-commit --json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
3. Use the `openMatches`, `closedMatches`, `issueDraft`, and `commitMessageDrafts` fields to ask the user which issue to use.
|
|
53
|
+
4. If a strong open issue exists and the user picks it, reuse it:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx -y @greeana/jira-dev-workflow use --issue JDW-123
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
5. If there are no open matches and only closed matches exist, create a new issue and pass the best closed match as `--related-issue`.
|
|
60
|
+
6. If UI or preview evidence is useful, attach screenshots or add an implementation report comment.
|
|
61
|
+
7. Preview the commit message with:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx -y @greeana/jira-dev-workflow commit --issue JDW-123 -m "Short commit message" --dry-run
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
8. After the user confirms, commit with:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx -y @greeana/jira-dev-workflow commit -m "Short commit message"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Interaction contract for `prepare commit`
|
|
74
|
+
|
|
75
|
+
When the user asks to prepare a Jira commit, the agent must treat `prepare-commit` as a planning step, not an execution step.
|
|
76
|
+
|
|
77
|
+
1. Assume the user has already staged the intended files unless they say otherwise.
|
|
78
|
+
2. Run `npx -y @greeana/jira-dev-workflow prepare-commit --json`.
|
|
79
|
+
3. If `openMatches` contains candidates, present them and ask the user which issue to use, or whether to create a new one instead.
|
|
80
|
+
4. If there are no reusable open matches, present the drafted new-issue summary and description and ask the user whether to create that issue.
|
|
81
|
+
5. Do not create a Jira issue, do not save a current issue, do not commit, and do not post comments while still in the `prepare commit` step.
|
|
82
|
+
6. After the user selects an issue or approves creating a new one, preview the final commit message with `commit --dry-run` and ask for confirmation.
|
|
83
|
+
7. Only create the git commit after explicit user confirmation.
|
|
84
|
+
8. Only post an implementation comment or attach files after the user explicitly asks for that, or clearly confirms a workflow that includes posting after commit.
|
|
85
|
+
|
|
86
|
+
The intended conversation shape is:
|
|
87
|
+
- User stages changes and asks to prepare a Jira commit.
|
|
88
|
+
- Agent runs `prepare-commit`, shows candidate issues or a new-issue draft, and asks the user to choose.
|
|
89
|
+
- User selects an existing issue or approves creating a new one.
|
|
90
|
+
- Agent shows the final commit message preview and asks for confirmation.
|
|
91
|
+
- User confirms.
|
|
92
|
+
- Agent commits, and only then posts back to Jira if the user asked for posting.
|
|
93
|
+
|
|
94
|
+
## Important rules
|
|
95
|
+
|
|
96
|
+
- Do not reuse closed Jira issues.
|
|
97
|
+
- If only closed issues match, create a new issue and relate it to the best closed match.
|
|
98
|
+
- Prefer `npx -y @greeana/jira-dev-workflow prepare-commit --json` for commit workflows because it includes both Jira matches and draft commit text.
|
|
99
|
+
- Use `npx -y @greeana/jira-dev-workflow current` if you need to confirm the selected issue before commit.
|
|
100
|
+
- For commit messages, keep the human part short because the Jira key is prefixed automatically by the workflow.
|
|
101
|
+
- For implementation reports with screenshots, prefer `comment --text-file ... --inline-file ...` and place screenshot markers as standalone paragraphs inside the text:
|
|
102
|
+
- `[[inline-file]]` inserts the next screenshot in order
|
|
103
|
+
- `[[inline-file:2]]` inserts a specific screenshot by 1-based index
|
|
104
|
+
- if no markers are present, inline screenshots are appended after the text
|
|
105
|
+
|
|
106
|
+
## Local repo setup
|
|
107
|
+
|
|
108
|
+
This CLI expects repo-local config under:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
.jira-dev-workflow/config.json
|
|
112
|
+
.jira-dev-workflow/.env.local
|
|
113
|
+
```
|