@nuvlore/extension-access-jira 0.1.1

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.
Files changed (95) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +27 -0
  3. package/package.json +54 -0
  4. package/skills/jira-sso-crud/SKILL.md +30 -0
  5. package/src/jiraSsoCrud.mjs +140 -0
  6. package/tools/jira_sso_comment_create.mjs +34 -0
  7. package/tools/jira_sso_comment_delete.mjs +33 -0
  8. package/tools/jira_sso_comment_update.mjs +35 -0
  9. package/tools/jira_sso_issue.mjs +32 -0
  10. package/tools/jira_sso_issue_create.mjs +36 -0
  11. package/tools/jira_sso_issue_delete.mjs +34 -0
  12. package/tools/jira_sso_issue_transition.mjs +36 -0
  13. package/tools/jira_sso_issue_update.mjs +35 -0
  14. package/tools/jira_sso_myself.mjs +26 -0
  15. package/tools/jira_sso_project.mjs +32 -0
  16. package/tools/jira_sso_project_versions.mjs +32 -0
  17. package/tools/jira_sso_projects.mjs +26 -0
  18. package/tools/jira_sso_read.mjs +34 -0
  19. package/tools/jira_sso_search.mjs +33 -0
  20. package/tools/jira_sso_user_assignable_search.mjs +35 -0
  21. package/tools/jira_sso_verify.mjs +26 -0
  22. package/vendor/extension-sso/LICENSE +202 -0
  23. package/vendor/extension-sso/README.md +35 -0
  24. package/vendor/extension-sso/commands/okta-login.md +10 -0
  25. package/vendor/extension-sso/package.json +52 -0
  26. package/vendor/extension-sso/skills/workday-okta-auth/SKILL.md +20 -0
  27. package/vendor/extension-sso/src/autoAuth.mjs +25 -0
  28. package/vendor/extension-sso/src/browserLogin.mjs +1 -0
  29. package/vendor/extension-sso/src/chromeCookies.mjs +1 -0
  30. package/vendor/extension-sso/src/cookieJar.mjs +1 -0
  31. package/vendor/extension-sso/src/extensionAccess.mjs +173 -0
  32. package/vendor/extension-sso/src/htmlSessionExtract.mjs +1 -0
  33. package/vendor/extension-sso/src/oktaAppAccess.mjs +133 -0
  34. package/vendor/extension-sso/src/oktaAppCatalog.mjs +118 -0
  35. package/vendor/extension-sso/src/oktaAppRead.mjs +119 -0
  36. package/vendor/extension-sso/src/oktaConfig.mjs +12 -0
  37. package/vendor/extension-sso/src/oktaSession.mjs +32 -0
  38. package/vendor/extension-sso/src/serviceOperations.mjs +407 -0
  39. package/vendor/extension-sso/src/serviceReadSearch.mjs +395 -0
  40. package/vendor/extension-sso/src/serviceReads.mjs +109 -0
  41. package/vendor/extension-sso/src/serviceRegistry.mjs +497 -0
  42. package/vendor/extension-sso/src/sessionAuth.mjs +339 -0
  43. package/vendor/extension-sso/src/sessionManager.mjs +212 -0
  44. package/vendor/extension-sso/src/sessionValidate.mjs +74 -0
  45. package/vendor/extension-sso/src/ssoConfig.mjs +31 -0
  46. package/vendor/extension-sso/src/ssoHttpRead.mjs +292 -0
  47. package/vendor/extension-sso/tools/extension-access-tools.shared.mjs +16 -0
  48. package/vendor/extension-sso/tools/okta-app-tools.shared.mjs +5 -0
  49. package/vendor/extension-sso/tools/okta-tools.shared.mjs +18 -0
  50. package/vendor/extension-sso/tools/workday_extension_read.mjs +51 -0
  51. package/vendor/extension-sso/tools/workday_extension_read_access.mjs +65 -0
  52. package/vendor/extension-sso/tools/workday_list_extension_access.mjs +39 -0
  53. package/vendor/extension-sso/tools/workday_list_okta_apps.mjs +18 -0
  54. package/vendor/extension-sso/tools/workday_list_service_operations.mjs +41 -0
  55. package/vendor/extension-sso/tools/workday_list_service_read_search_capabilities.mjs +34 -0
  56. package/vendor/extension-sso/tools/workday_list_services.mjs +31 -0
  57. package/vendor/extension-sso/tools/workday_okta_app_probe_all.mjs +24 -0
  58. package/vendor/extension-sso/tools/workday_okta_app_read.mjs +30 -0
  59. package/vendor/extension-sso/tools/workday_okta_app_read_access.mjs +25 -0
  60. package/vendor/extension-sso/tools/workday_okta_auth_header.mjs +58 -0
  61. package/vendor/extension-sso/tools/workday_okta_login.mjs +65 -0
  62. package/vendor/extension-sso/tools/workday_okta_open_app.mjs +63 -0
  63. package/vendor/extension-sso/tools/workday_okta_open_service.mjs +63 -0
  64. package/vendor/extension-sso/tools/workday_okta_status.mjs +35 -0
  65. package/vendor/extension-sso/tools/workday_service_auth.mjs +65 -0
  66. package/vendor/extension-sso/tools/workday_service_operation_read.mjs +51 -0
  67. package/vendor/extension-sso/tools/workday_service_read.mjs +56 -0
  68. package/vendor/extension-sso/tools/workday_service_search.mjs +62 -0
  69. package/vendor/extension-sso/tools/workday_sso_cookie_header.mjs +59 -0
  70. package/vendor/extension-sso/vendor/extension-browser-sso/LICENSE +202 -0
  71. package/vendor/extension-sso/vendor/extension-browser-sso/README.md +16 -0
  72. package/vendor/extension-sso/vendor/extension-browser-sso/package.json +47 -0
  73. package/vendor/extension-sso/vendor/extension-browser-sso/src/autoAuth.mjs +47 -0
  74. package/vendor/extension-sso/vendor/extension-browser-sso/src/browserHttpRead.mjs +76 -0
  75. package/vendor/extension-sso/vendor/extension-browser-sso/src/browserLogin.mjs +24 -0
  76. package/vendor/extension-sso/vendor/extension-browser-sso/src/chromeCookies.mjs +192 -0
  77. package/vendor/extension-sso/vendor/extension-browser-sso/src/cookieJar.mjs +132 -0
  78. package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/devops-data-paths.mjs +222 -0
  79. package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/devops-diagnostics.mjs +440 -0
  80. package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/enterprise-api-read.mjs +180 -0
  81. package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/read-only-command-pack.mjs +1 -0
  82. package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/read-only-plan.mjs +45 -0
  83. package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/read-only-shell-policy.d.mts +26 -0
  84. package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/read-only-shell-policy.mjs +170 -0
  85. package/vendor/extension-sso/vendor/extension-browser-sso/src/htmlSessionExtract.mjs +64 -0
  86. package/vendor/extension-sso/vendor/extension-read-only-toolkit/LICENSE +202 -0
  87. package/vendor/extension-sso/vendor/extension-read-only-toolkit/README.md +29 -0
  88. package/vendor/extension-sso/vendor/extension-read-only-toolkit/package.json +43 -0
  89. package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/devops-data-paths.mjs +222 -0
  90. package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/devops-diagnostics.mjs +440 -0
  91. package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/enterprise-api-read.mjs +180 -0
  92. package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/read-only-command-pack.mjs +1 -0
  93. package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/read-only-plan.mjs +45 -0
  94. package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/read-only-shell-policy.d.mts +26 -0
  95. package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/read-only-shell-policy.mjs +170 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @nuvlore/extension-access-jira
2
+
3
+ SSO access to Jira via browser session cookies.
4
+
5
+ Default tools are read/search only:
6
+
7
+ - `jira_sso_issue`
8
+ - `jira_sso_search`
9
+ - `jira_sso_project`
10
+ - `jira_sso_projects`
11
+ - `jira_sso_project_versions`
12
+ - `jira_sso_myself`
13
+ - `jira_sso_read`
14
+ - `jira_sso_user_assignable_search`
15
+ - `jira_sso_verify`
16
+
17
+ CRUD tools are available only for explicit user-approved Jira changes. They require `confirmed: true`; use `dryRun: true` to inspect the planned request without writing.
18
+
19
+ - `jira_sso_issue_create`
20
+ - `jira_sso_issue_update`
21
+ - `jira_sso_issue_delete`
22
+ - `jira_sso_comment_create`
23
+ - `jira_sso_comment_update`
24
+ - `jira_sso_comment_delete`
25
+ - `jira_sso_issue_transition`
26
+
27
+ Jira REST reads include the Jira page `Referer` header required by `jira2.workday.com`; without it some REST endpoints return `401` even when browser SSO cookies are valid.
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@nuvlore/extension-access-jira",
3
+ "version": "0.1.1",
4
+ "description": "SSO access to Jira via browser session cookies, with read tools and explicitly confirmed CRUD tools.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "files": [
8
+ "LICENSE",
9
+ "README.md",
10
+ "tools",
11
+ "skills",
12
+ "src",
13
+ "vendor/extension-sso/LICENSE",
14
+ "vendor/extension-sso/README.md",
15
+ "vendor/extension-sso/package.json",
16
+ "vendor/extension-sso/commands",
17
+ "vendor/extension-sso/skills",
18
+ "vendor/extension-sso/src",
19
+ "vendor/extension-sso/tools",
20
+ "vendor/extension-sso/vendor/extension-browser-sso/LICENSE",
21
+ "vendor/extension-sso/vendor/extension-browser-sso/README.md",
22
+ "vendor/extension-sso/vendor/extension-browser-sso/package.json",
23
+ "vendor/extension-sso/vendor/extension-browser-sso/src",
24
+ "vendor/extension-sso/vendor/extension-read-only-toolkit/LICENSE",
25
+ "vendor/extension-sso/vendor/extension-read-only-toolkit/README.md",
26
+ "vendor/extension-sso/vendor/extension-read-only-toolkit/package.json",
27
+ "vendor/extension-sso/vendor/extension-read-only-toolkit/src"
28
+ ],
29
+ "scripts": {
30
+ "test": "node --test test/unit/*.test.js && node --test test/integration/*.test.js",
31
+ "test:unit": "node --test test/unit/*.test.js",
32
+ "test:integration": "node --test test/integration/*.test.js"
33
+ },
34
+ "agentRuntimeDistribution": {
35
+ "visibility": "private",
36
+ "group": "sso-access",
37
+ "serviceGrouping": "single-service",
38
+ "publicService": false,
39
+ "rationale": "SSO HTTP access for Jira. Reads are default; CRUD tools require explicit confirmation."
40
+ },
41
+ "agentRuntimeTools": {
42
+ "service": "access-jira"
43
+ },
44
+ "dependencies": {
45
+ "@nuvlore/extension-sso": "file:vendor/extension-sso",
46
+ "@nuvlore/extension-read-only-toolkit": "file:vendor/extension-sso/vendor/extension-read-only-toolkit",
47
+ "zod": "^4.1.12"
48
+ },
49
+ "devDependencies": {},
50
+ "publishConfig": {
51
+ "registry": "https://registry.npmjs.org/",
52
+ "access": "public"
53
+ }
54
+ }
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: jira-sso-crud
3
+ description: Use for Jira issue reads/searches and explicitly user-approved Jira issue or comment CRUD through Workday Okta browser SSO.
4
+ tools:
5
+ - mcp__devops-tool__jira_sso_issue
6
+ - mcp__devops-tool__jira_sso_search
7
+ - mcp__devops-tool__jira_sso_issue_create
8
+ - mcp__devops-tool__jira_sso_issue_update
9
+ - mcp__devops-tool__jira_sso_issue_delete
10
+ - mcp__devops-tool__jira_sso_comment_create
11
+ - mcp__devops-tool__jira_sso_comment_update
12
+ - mcp__devops-tool__jira_sso_comment_delete
13
+ - mcp__devops-tool__jira_sso_issue_transition
14
+ ---
15
+
16
+ # Jira SSO CRUD
17
+
18
+ Use Jira read tools first. Read the target issue before making claims or preparing any update.
19
+
20
+ Writes are not the default operating mode. Only use create, update, delete, comment, or transition tools when the user explicitly asks for that Jira change in the current chat.
21
+
22
+ For every write:
23
+
24
+ 1. Use `dryRun: true` first when the requested change is not trivial, destructive, or fully specified.
25
+ 2. Use `confirmed: true` only after the user has explicitly approved the concrete Jira target and payload.
26
+ 3. Do not expose assistant identity or runtime details in Jira issue text or comments.
27
+ 4. Prefer narrow field updates over replacing broad issue fields.
28
+ 5. After a write succeeds, read the issue back with `jira_sso_issue` and report the verified state.
29
+
30
+ Deletes are destructive. Confirm the exact issue key or comment id immediately before calling a delete tool.
@@ -0,0 +1,140 @@
1
+ import { buildRequestUrl, normalizeBaseUrl, parseResponseBody } from "@nuvlore/extension-read-only-toolkit/enterprise-api-read";
2
+ import { assertNonHtmlApiResponse } from "@nuvlore/extension-read-only-toolkit/devops-diagnostics";
3
+ import { getServiceCookieHeader } from "@nuvlore/extension-sso/session-auth";
4
+
5
+ const DEFAULT_BASE_URL = "https://jira2.workday.com";
6
+
7
+ function assertRelativeRestPath(restPath) {
8
+ const path = String(restPath || "").trim();
9
+ if (!path) throw new Error("restPath is required.");
10
+ if (/^https?:\/\//i.test(path)) {
11
+ throw new Error("Jira SSO tools require a relative REST path, not an absolute URL.");
12
+ }
13
+ if (path.includes("..")) {
14
+ throw new Error("Jira SSO tools reject parent directory traversal in REST paths.");
15
+ }
16
+ return path;
17
+ }
18
+
19
+ function jiraReferer(baseUrl, issueKey) {
20
+ const key = String(issueKey || "").trim();
21
+ return key ? `${baseUrl}/browse/${encodeURIComponent(key)}` : `${baseUrl}/secure/Dashboard.jspa`;
22
+ }
23
+
24
+ function cleanQuery(query = {}) {
25
+ return Object.fromEntries(Object.entries(query).filter(([, value]) => value !== undefined && value !== null && value !== ""));
26
+ }
27
+
28
+ export function requireConfirmedWrite({ confirmed, dryRun }) {
29
+ if (dryRun === true) return;
30
+ if (confirmed !== true) {
31
+ throw new Error("Jira write tools require confirmed=true. Use dryRun=true to inspect the planned request without writing.");
32
+ }
33
+ }
34
+
35
+ export async function jiraSsoRequest(input = {}, options = {}) {
36
+ const {
37
+ body,
38
+ confirmed = false,
39
+ dryRun = false,
40
+ issueKey,
41
+ method = "GET",
42
+ query,
43
+ restPath
44
+ } = input;
45
+ const normalizedMethod = String(method || "GET").toUpperCase();
46
+ const normalizedPath = assertRelativeRestPath(restPath);
47
+ const baseUrl = normalizeBaseUrl(input.baseUrl || DEFAULT_BASE_URL);
48
+ const url = buildRequestUrl(baseUrl, normalizedPath, cleanQuery(query));
49
+
50
+ if (normalizedMethod !== "GET") {
51
+ requireConfirmedWrite({ confirmed, dryRun });
52
+ }
53
+
54
+ const request = {
55
+ readOnly: normalizedMethod === "GET",
56
+ method: normalizedMethod,
57
+ service: "jira",
58
+ baseUrl,
59
+ restPath: normalizedPath,
60
+ url: url.toString(),
61
+ body: body ?? null
62
+ };
63
+
64
+ if (dryRun) {
65
+ return {
66
+ ...request,
67
+ dryRun: true,
68
+ status: null,
69
+ data: null
70
+ };
71
+ }
72
+
73
+ const auth = await getServiceCookieHeader("jira", options);
74
+ if (!auth.ok || !auth.cookie) {
75
+ throw new Error(auth.message || "No Jira SSO cookie is available. Run workday_okta_open_service for service=jira.");
76
+ }
77
+
78
+ const fetchImpl = options.fetchImpl ?? globalThis.fetch;
79
+ const response = await fetchImpl(url, {
80
+ method: normalizedMethod,
81
+ headers: {
82
+ accept: "application/json",
83
+ cookie: auth.cookie,
84
+ "content-type": "application/json",
85
+ referer: jiraReferer(baseUrl, issueKey),
86
+ "user-agent": "Mozilla/5.0 nuvlore/0.1 jira-sso-crud",
87
+ "X-Atlassian-Token": "no-check",
88
+ ...(input.headers ?? {})
89
+ },
90
+ body: body === undefined || body === null ? undefined : JSON.stringify(body),
91
+ redirect: "manual"
92
+ });
93
+
94
+ const text = await response.text();
95
+ assertNonHtmlApiResponse("Jira", text);
96
+ const data = text ? parseResponseBody(text) : null;
97
+ if (!response.ok) {
98
+ const detail =
99
+ data && typeof data === "object"
100
+ ? JSON.stringify(data)
101
+ : String(data || `HTTP ${response.status}`);
102
+ throw new Error(`Jira ${normalizedMethod} ${normalizedPath} failed (${response.status}): ${detail}`);
103
+ }
104
+
105
+ return {
106
+ ...request,
107
+ status: response.status,
108
+ contentType: response.headers.get("content-type"),
109
+ data
110
+ };
111
+ }
112
+
113
+ export function buildIssueCreateBody(input = {}) {
114
+ const fields = {
115
+ project: { key: input.projectKey },
116
+ issuetype: { name: input.issueTypeName ?? "Task" },
117
+ summary: input.summary,
118
+ ...(input.description ? { description: input.description } : {}),
119
+ ...(input.fields ?? {})
120
+ };
121
+ return { fields };
122
+ }
123
+
124
+ export function buildIssueUpdateBody(input = {}) {
125
+ if (!input.fields && !input.update) {
126
+ throw new Error("jira_sso_issue_update requires fields or update.");
127
+ }
128
+ return {
129
+ ...(input.fields ? { fields: input.fields } : {}),
130
+ ...(input.update ? { update: input.update } : {})
131
+ };
132
+ }
133
+
134
+ export function buildTransitionBody(input = {}) {
135
+ return {
136
+ transition: { id: String(input.transitionId) },
137
+ ...(input.fields ? { fields: input.fields } : {}),
138
+ ...(input.update ? { update: input.update } : {})
139
+ };
140
+ }
@@ -0,0 +1,34 @@
1
+ export const description = "Add a Jira comment via Okta browser SSO. POST only after confirmed=true; use dryRun=true to preview.";
2
+
3
+ import { z } from "zod";
4
+ import { fail, ok } from "@nuvlore/extension-read-only-toolkit/devops-diagnostics";
5
+ import { jiraSsoRequest } from "../src/jiraSsoCrud.mjs";
6
+
7
+ const inputSchema = {
8
+ issueKey: z.string().trim().min(1).describe("Jira issue key, e.g. BDS-26598"),
9
+ body: z.string().trim().min(1).describe("Comment body in Jira wiki format/plain text"),
10
+ confirmed: z.boolean().default(false).describe("Must be true to add the comment"),
11
+ dryRun: z.boolean().default(false).describe("Return the planned request without writing")
12
+ };
13
+
14
+ export default {
15
+ name: "jira_sso_comment_create",
16
+ description: "Add a Jira comment via Okta browser SSO. POST only after confirmed=true; use dryRun=true to preview.",
17
+ inputSchema,
18
+ meta: { permissions: { rule: "ask" } },
19
+ annotations: { openWorldHint: true, readOnlyHint: false, destructiveHint: false },
20
+ async handler(input = {}) {
21
+ try {
22
+ return ok(JSON.stringify(await jiraSsoRequest({
23
+ method: "POST",
24
+ restPath: `/rest/api/latest/issue/${encodeURIComponent(input.issueKey)}/comment`,
25
+ issueKey: input.issueKey,
26
+ body: { body: input.body },
27
+ confirmed: input.confirmed,
28
+ dryRun: input.dryRun
29
+ }), null, 2));
30
+ } catch (error) {
31
+ return fail(error);
32
+ }
33
+ }
34
+ };
@@ -0,0 +1,33 @@
1
+ export const description = "Delete a Jira comment via Okta browser SSO. DELETE only after confirmed=true; use dryRun=true to preview.";
2
+
3
+ import { z } from "zod";
4
+ import { fail, ok } from "@nuvlore/extension-read-only-toolkit/devops-diagnostics";
5
+ import { jiraSsoRequest } from "../src/jiraSsoCrud.mjs";
6
+
7
+ const inputSchema = {
8
+ issueKey: z.string().trim().min(1).describe("Jira issue key, e.g. BDS-26598"),
9
+ commentId: z.union([z.string(), z.number()]).describe("Jira comment id"),
10
+ confirmed: z.boolean().default(false).describe("Must be true to delete the comment"),
11
+ dryRun: z.boolean().default(false).describe("Return the planned request without writing")
12
+ };
13
+
14
+ export default {
15
+ name: "jira_sso_comment_delete",
16
+ description: "Delete a Jira comment via Okta browser SSO. DELETE only after confirmed=true; use dryRun=true to preview.",
17
+ inputSchema,
18
+ meta: { permissions: { rule: "ask" } },
19
+ annotations: { openWorldHint: true, readOnlyHint: false, destructiveHint: true },
20
+ async handler(input = {}) {
21
+ try {
22
+ return ok(JSON.stringify(await jiraSsoRequest({
23
+ method: "DELETE",
24
+ restPath: `/rest/api/latest/issue/${encodeURIComponent(input.issueKey)}/comment/${encodeURIComponent(input.commentId)}`,
25
+ issueKey: input.issueKey,
26
+ confirmed: input.confirmed,
27
+ dryRun: input.dryRun
28
+ }), null, 2));
29
+ } catch (error) {
30
+ return fail(error);
31
+ }
32
+ }
33
+ };
@@ -0,0 +1,35 @@
1
+ export const description = "Update a Jira comment via Okta browser SSO. PUT only after confirmed=true; use dryRun=true to preview.";
2
+
3
+ import { z } from "zod";
4
+ import { fail, ok } from "@nuvlore/extension-read-only-toolkit/devops-diagnostics";
5
+ import { jiraSsoRequest } from "../src/jiraSsoCrud.mjs";
6
+
7
+ const inputSchema = {
8
+ issueKey: z.string().trim().min(1).describe("Jira issue key, e.g. BDS-26598"),
9
+ commentId: z.union([z.string(), z.number()]).describe("Jira comment id"),
10
+ body: z.string().trim().min(1).describe("Replacement comment body"),
11
+ confirmed: z.boolean().default(false).describe("Must be true to update the comment"),
12
+ dryRun: z.boolean().default(false).describe("Return the planned request without writing")
13
+ };
14
+
15
+ export default {
16
+ name: "jira_sso_comment_update",
17
+ description: "Update a Jira comment via Okta browser SSO. PUT only after confirmed=true; use dryRun=true to preview.",
18
+ inputSchema,
19
+ meta: { permissions: { rule: "ask" } },
20
+ annotations: { openWorldHint: true, readOnlyHint: false, destructiveHint: false },
21
+ async handler(input = {}) {
22
+ try {
23
+ return ok(JSON.stringify(await jiraSsoRequest({
24
+ method: "PUT",
25
+ restPath: `/rest/api/latest/issue/${encodeURIComponent(input.issueKey)}/comment/${encodeURIComponent(input.commentId)}`,
26
+ issueKey: input.issueKey,
27
+ body: { body: input.body },
28
+ confirmed: input.confirmed,
29
+ dryRun: input.dryRun
30
+ }), null, 2));
31
+ } catch (error) {
32
+ return fail(error);
33
+ }
34
+ }
35
+ };
@@ -0,0 +1,32 @@
1
+ export const description = "Read one Jira issue by key. GET only via Okta browser SSO cookies.";
2
+
3
+ import { z } from "zod";
4
+ import { defineReadOnlyTool, fail, ok } from "@nuvlore/extension-read-only-toolkit/devops-diagnostics";
5
+ import { readServiceOperation } from "@nuvlore/extension-sso/service-operations";
6
+
7
+ const inputSchema = {
8
+ issueKey: z.union([z.string(), z.number()]).describe("Required"),
9
+ };
10
+
11
+ const sharedTool = defineReadOnlyTool({
12
+ name: "jira_sso_issue",
13
+ description: "Read one Jira issue by key. GET only via Okta browser SSO cookies.",
14
+ inputSchema,
15
+ meta: { permissions: { rule: "ask" } },
16
+ annotations: { openWorldHint: true, readOnlyHint: true, destructiveHint: false },
17
+ async handler(input) {
18
+ try {
19
+ return ok(JSON.stringify(await readServiceOperation("jira", "issue", input ?? {}), null, 2));
20
+ } catch (error) {
21
+ return fail(error);
22
+ }
23
+ }
24
+ });
25
+
26
+ export default {
27
+ description,
28
+ inputSchema: sharedTool.inputSchema,
29
+ meta: sharedTool.meta,
30
+ annotations: sharedTool.annotations,
31
+ handler: sharedTool.handler
32
+ };
@@ -0,0 +1,36 @@
1
+ export const description = "Create a Jira issue via Okta browser SSO. POST only after confirmed=true; use dryRun=true to preview.";
2
+
3
+ import { z } from "zod";
4
+ import { fail, ok } from "@nuvlore/extension-read-only-toolkit/devops-diagnostics";
5
+ import { buildIssueCreateBody, jiraSsoRequest } from "../src/jiraSsoCrud.mjs";
6
+
7
+ const inputSchema = {
8
+ projectKey: z.string().trim().min(1).describe("Jira project key, e.g. BDS"),
9
+ summary: z.string().trim().min(1).describe("Issue summary"),
10
+ issueTypeName: z.string().trim().min(1).default("Task").optional(),
11
+ description: z.string().optional(),
12
+ fields: z.record(z.string(), z.unknown()).optional().describe("Additional Jira fields merged into fields"),
13
+ confirmed: z.boolean().default(false).describe("Must be true to create the issue"),
14
+ dryRun: z.boolean().default(false).describe("Return the planned request without writing")
15
+ };
16
+
17
+ export default {
18
+ name: "jira_sso_issue_create",
19
+ description: "Create a Jira issue via Okta browser SSO. POST only after confirmed=true; use dryRun=true to preview.",
20
+ inputSchema,
21
+ meta: { permissions: { rule: "ask" } },
22
+ annotations: { openWorldHint: true, readOnlyHint: false, destructiveHint: false },
23
+ async handler(input = {}) {
24
+ try {
25
+ return ok(JSON.stringify(await jiraSsoRequest({
26
+ method: "POST",
27
+ restPath: "/rest/api/latest/issue",
28
+ body: buildIssueCreateBody(input),
29
+ confirmed: input.confirmed,
30
+ dryRun: input.dryRun
31
+ }), null, 2));
32
+ } catch (error) {
33
+ return fail(error);
34
+ }
35
+ }
36
+ };
@@ -0,0 +1,34 @@
1
+ export const description = "Delete a Jira issue via Okta browser SSO. DELETE only after confirmed=true; use dryRun=true to preview.";
2
+
3
+ import { z } from "zod";
4
+ import { fail, ok } from "@nuvlore/extension-read-only-toolkit/devops-diagnostics";
5
+ import { jiraSsoRequest } from "../src/jiraSsoCrud.mjs";
6
+
7
+ const inputSchema = {
8
+ issueKey: z.string().trim().min(1).describe("Jira issue key, e.g. BDS-26598"),
9
+ deleteSubtasks: z.boolean().default(false).optional(),
10
+ confirmed: z.boolean().default(false).describe("Must be true to delete the issue"),
11
+ dryRun: z.boolean().default(false).describe("Return the planned request without writing")
12
+ };
13
+
14
+ export default {
15
+ name: "jira_sso_issue_delete",
16
+ description: "Delete a Jira issue via Okta browser SSO. DELETE only after confirmed=true; use dryRun=true to preview.",
17
+ inputSchema,
18
+ meta: { permissions: { rule: "ask" } },
19
+ annotations: { openWorldHint: true, readOnlyHint: false, destructiveHint: true },
20
+ async handler(input = {}) {
21
+ try {
22
+ return ok(JSON.stringify(await jiraSsoRequest({
23
+ method: "DELETE",
24
+ restPath: `/rest/api/latest/issue/${encodeURIComponent(input.issueKey)}`,
25
+ issueKey: input.issueKey,
26
+ query: { deleteSubtasks: input.deleteSubtasks === true },
27
+ confirmed: input.confirmed,
28
+ dryRun: input.dryRun
29
+ }), null, 2));
30
+ } catch (error) {
31
+ return fail(error);
32
+ }
33
+ }
34
+ };