@crypto512/jicon-mcp 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.
Files changed (103) hide show
  1. package/.env.example +9 -0
  2. package/.jicon.json.custom +21 -0
  3. package/.jicon.json.example +15 -0
  4. package/.jicon.json.readonly +15 -0
  5. package/CLAUDE.md +596 -0
  6. package/CONTRIBUTING.md +371 -0
  7. package/DEVELOPMENT.md +400 -0
  8. package/LICENSE +21 -0
  9. package/README.md +300 -0
  10. package/TOOL_LIST.md +435 -0
  11. package/dist/config/constants.d.ts +14 -0
  12. package/dist/config/constants.d.ts.map +1 -0
  13. package/dist/config/constants.js +18 -0
  14. package/dist/config/constants.js.map +1 -0
  15. package/dist/config/loader.d.ts +35 -0
  16. package/dist/config/loader.d.ts.map +1 -0
  17. package/dist/config/loader.js +108 -0
  18. package/dist/config/loader.js.map +1 -0
  19. package/dist/config/types.d.ts +130 -0
  20. package/dist/config/types.d.ts.map +1 -0
  21. package/dist/config/types.js +32 -0
  22. package/dist/config/types.js.map +1 -0
  23. package/dist/confluence/client.d.ts +30 -0
  24. package/dist/confluence/client.d.ts.map +1 -0
  25. package/dist/confluence/client.js +176 -0
  26. package/dist/confluence/client.js.map +1 -0
  27. package/dist/confluence/defaults.d.ts +23 -0
  28. package/dist/confluence/defaults.d.ts.map +1 -0
  29. package/dist/confluence/defaults.js +29 -0
  30. package/dist/confluence/defaults.js.map +1 -0
  31. package/dist/confluence/formatters.d.ts +22 -0
  32. package/dist/confluence/formatters.d.ts.map +1 -0
  33. package/dist/confluence/formatters.js +125 -0
  34. package/dist/confluence/formatters.js.map +1 -0
  35. package/dist/confluence/tools.d.ts +266 -0
  36. package/dist/confluence/tools.d.ts.map +1 -0
  37. package/dist/confluence/tools.js +376 -0
  38. package/dist/confluence/tools.js.map +1 -0
  39. package/dist/confluence/types.d.ts +122 -0
  40. package/dist/confluence/types.d.ts.map +1 -0
  41. package/dist/confluence/types.js +5 -0
  42. package/dist/confluence/types.js.map +1 -0
  43. package/dist/index.d.ts +6 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +161 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/jira/client.d.ts +46 -0
  48. package/dist/jira/client.d.ts.map +1 -0
  49. package/dist/jira/client.js +178 -0
  50. package/dist/jira/client.js.map +1 -0
  51. package/dist/jira/defaults.d.ts +19 -0
  52. package/dist/jira/defaults.d.ts.map +1 -0
  53. package/dist/jira/defaults.js +57 -0
  54. package/dist/jira/defaults.js.map +1 -0
  55. package/dist/jira/formatters.d.ts +22 -0
  56. package/dist/jira/formatters.d.ts.map +1 -0
  57. package/dist/jira/formatters.js +128 -0
  58. package/dist/jira/formatters.js.map +1 -0
  59. package/dist/jira/tools.d.ts +334 -0
  60. package/dist/jira/tools.d.ts.map +1 -0
  61. package/dist/jira/tools.js +372 -0
  62. package/dist/jira/tools.js.map +1 -0
  63. package/dist/jira/types.d.ts +110 -0
  64. package/dist/jira/types.d.ts.map +1 -0
  65. package/dist/jira/types.js +5 -0
  66. package/dist/jira/types.js.map +1 -0
  67. package/dist/permissions/filter.d.ts +30 -0
  68. package/dist/permissions/filter.d.ts.map +1 -0
  69. package/dist/permissions/filter.js +89 -0
  70. package/dist/permissions/filter.js.map +1 -0
  71. package/dist/permissions/tool-registry.d.ts +49 -0
  72. package/dist/permissions/tool-registry.d.ts.map +1 -0
  73. package/dist/permissions/tool-registry.js +111 -0
  74. package/dist/permissions/tool-registry.js.map +1 -0
  75. package/dist/tempo/client.d.ts +32 -0
  76. package/dist/tempo/client.d.ts.map +1 -0
  77. package/dist/tempo/client.js +125 -0
  78. package/dist/tempo/client.js.map +1 -0
  79. package/dist/tempo/formatters.d.ts +30 -0
  80. package/dist/tempo/formatters.d.ts.map +1 -0
  81. package/dist/tempo/formatters.js +172 -0
  82. package/dist/tempo/formatters.js.map +1 -0
  83. package/dist/tempo/tools.d.ts +184 -0
  84. package/dist/tempo/tools.d.ts.map +1 -0
  85. package/dist/tempo/tools.js +392 -0
  86. package/dist/tempo/tools.js.map +1 -0
  87. package/dist/tempo/types.d.ts +98 -0
  88. package/dist/tempo/types.d.ts.map +1 -0
  89. package/dist/tempo/types.js +5 -0
  90. package/dist/tempo/types.js.map +1 -0
  91. package/dist/types.d.ts +27 -0
  92. package/dist/types.d.ts.map +1 -0
  93. package/dist/types.js +6 -0
  94. package/dist/types.js.map +1 -0
  95. package/dist/utils/http-client.d.ts +22 -0
  96. package/dist/utils/http-client.d.ts.map +1 -0
  97. package/dist/utils/http-client.js +137 -0
  98. package/dist/utils/http-client.js.map +1 -0
  99. package/dist/utils/response-formatter.d.ts +8 -0
  100. package/dist/utils/response-formatter.d.ts.map +1 -0
  101. package/dist/utils/response-formatter.js +38 -0
  102. package/dist/utils/response-formatter.js.map +1 -0
  103. package/package.json +50 -0
package/TOOL_LIST.md ADDED
@@ -0,0 +1,435 @@
1
+ # Jira & Confluence MCP Server - Tool List
2
+
3
+ ## Overview
4
+ This document provides a comprehensive reference of all available tools in the Jira and Confluence MCP server.
5
+
6
+ ## Summary
7
+
8
+ **Total Tools**: 28
9
+ - **Jira Tools**: 15
10
+ - **Confluence Tools**: 13
11
+
12
+ ---
13
+
14
+ ## Jira Tools (15)
15
+
16
+ ### 1. jira_search_issues
17
+ **Description**: Search for Jira issues using JQL queries
18
+ **Use Cases**: Find bugs, filter by status, search by assignee, complex queries
19
+
20
+ | Parameter | Type | Required | Description |
21
+ |-----------|------|----------|-------------|
22
+ | jql | string | ✓ | JQL query string |
23
+ | maxResults | number | ✗ | Maximum results (default: 50) |
24
+ | fields | string[] | ✗ | Specific fields to return |
25
+
26
+ ---
27
+
28
+ ### 2. jira_get_issue
29
+ **Description**: Get detailed information about a specific issue
30
+ **Use Cases**: View issue details, check status, read description and comments
31
+
32
+ | Parameter | Type | Required | Description |
33
+ |-----------|------|----------|-------------|
34
+ | issueKey | string | ✓ | Issue key (e.g., "PROJ-123") |
35
+ | fields | string[] | ✗ | Specific fields to return |
36
+ | expand | string[] | ✗ | Additional data (e.g., "changelog") |
37
+
38
+ ---
39
+
40
+ ### 3. jira_create_issue
41
+ **Description**: Create a new Jira issue
42
+ **Use Cases**: Report bugs, create tasks, add stories to backlog
43
+
44
+ | Parameter | Type | Required | Description |
45
+ |-----------|------|----------|-------------|
46
+ | projectKey | string | ✓ | Project key |
47
+ | issueType | string | ✓ | Issue type (Bug, Story, Task, etc.) |
48
+ | summary | string | ✓ | Issue summary/title |
49
+ | description | string | ✗ | Detailed description |
50
+ | priority | string | ✗ | Priority level |
51
+ | assignee | string | ✗ | Assignee username |
52
+ | labels | string[] | ✗ | Array of labels |
53
+ | components | string[] | ✗ | Component names |
54
+ | customFields | object | ✗ | Custom field values |
55
+
56
+ ---
57
+
58
+ ### 4. jira_update_issue
59
+ **Description**: Update fields on an existing issue
60
+ **Use Cases**: Change priority, update description, modify assignee
61
+
62
+ | Parameter | Type | Required | Description |
63
+ |-----------|------|----------|-------------|
64
+ | issueKey | string | ✓ | Issue key |
65
+ | fields | object | ✓ | Fields to update |
66
+ | notifyUsers | boolean | ✗ | Send notifications (default: true) |
67
+
68
+ ---
69
+
70
+ ### 5. jira_transition_issue
71
+ **Description**: Move issue to different status
72
+ **Use Cases**: Start work, mark as done, move to review
73
+
74
+ | Parameter | Type | Required | Description |
75
+ |-----------|------|----------|-------------|
76
+ | issueKey | string | ✓ | Issue key |
77
+ | transitionName | string | ✓ | Transition/status name |
78
+ | comment | string | ✗ | Transition comment |
79
+ | fields | object | ✗ | Fields to update |
80
+
81
+ ---
82
+
83
+ ### 6. jira_add_comment
84
+ **Description**: Add a comment to an issue
85
+ **Use Cases**: Provide updates, ask questions, document decisions
86
+
87
+ | Parameter | Type | Required | Description |
88
+ |-----------|------|----------|-------------|
89
+ | issueKey | string | ✓ | Issue key |
90
+ | comment | string | ✓ | Comment text (Jira markdown) |
91
+ | visibility | object | ✗ | Visibility restrictions |
92
+
93
+ ---
94
+
95
+ ### 7. jira_get_issue_comments
96
+ **Description**: Retrieve comments from an issue
97
+ **Use Cases**: Read discussion history, check updates
98
+
99
+ | Parameter | Type | Required | Description |
100
+ |-----------|------|----------|-------------|
101
+ | issueKey | string | ✓ | Issue key |
102
+ | maxResults | number | ✗ | Maximum number of comments |
103
+ | orderBy | string | ✗ | Sort order ("created" or "-created") |
104
+
105
+ ---
106
+
107
+ ### 8. jira_list_projects
108
+ **Description**: List all accessible Jira projects
109
+ **Use Cases**: Discover available projects, get project keys
110
+
111
+ | Parameter | Type | Required | Description |
112
+ |-----------|------|----------|-------------|
113
+ | recent | boolean | ✗ | Only recent projects |
114
+ | expand | string[] | ✗ | Additional data to expand |
115
+
116
+ ---
117
+
118
+ ### 9. jira_get_project
119
+ **Description**: Get detailed project information
120
+ **Use Cases**: View project details, components, versions
121
+
122
+ | Parameter | Type | Required | Description |
123
+ |-----------|------|----------|-------------|
124
+ | projectKey | string | ✓ | Project key |
125
+ | expand | string[] | ✗ | Additional data to expand |
126
+
127
+ ---
128
+
129
+ ### 10. jira_get_transitions
130
+ **Description**: Get available workflow transitions for an issue
131
+ **Use Cases**: Check what status changes are possible
132
+
133
+ | Parameter | Type | Required | Description |
134
+ |-----------|------|----------|-------------|
135
+ | issueKey | string | ✓ | Issue key |
136
+
137
+ ---
138
+
139
+ ### 11. jira_link_issues
140
+ **Description**: Create a link between two issues
141
+ **Use Cases**: Mark blockers, relate issues, create dependencies
142
+
143
+ | Parameter | Type | Required | Description |
144
+ |-----------|------|----------|-------------|
145
+ | issueKey | string | ✓ | Source issue key |
146
+ | linkedIssueKey | string | ✓ | Target issue key |
147
+ | linkType | string | ✓ | Link type (e.g., "Blocks") |
148
+ | comment | string | ✗ | Comment for the link |
149
+
150
+ ---
151
+
152
+ ### 12. jira_get_board
153
+ **Description**: Get Agile board information
154
+ **Use Cases**: View board details, get board configuration
155
+
156
+ | Parameter | Type | Required | Description |
157
+ |-----------|------|----------|-------------|
158
+ | boardId | number | ✓ | Board ID |
159
+
160
+ ---
161
+
162
+ ### 13. jira_get_sprints
163
+ **Description**: List sprints for an Agile board
164
+ **Use Cases**: View active sprints, check sprint schedules
165
+
166
+ | Parameter | Type | Required | Description |
167
+ |-----------|------|----------|-------------|
168
+ | boardId | number | ✓ | Board ID |
169
+ | state | string | ✗ | Sprint state ("active", "future", "closed") |
170
+
171
+ ---
172
+
173
+ ### 14. jira_get_sprint_issues
174
+ **Description**: Get all issues in a sprint
175
+ **Use Cases**: View sprint backlog, check sprint progress
176
+
177
+ | Parameter | Type | Required | Description |
178
+ |-----------|------|----------|-------------|
179
+ | sprintId | number | ✓ | Sprint ID |
180
+ | maxResults | number | ✗ | Maximum number of results |
181
+
182
+ ---
183
+
184
+ ### 15. jira_get_issue_watchers
185
+ **Description**: Get list of watchers on an issue
186
+ **Use Cases**: See who's following an issue
187
+
188
+ | Parameter | Type | Required | Description |
189
+ |-----------|------|----------|-------------|
190
+ | issueKey | string | ✓ | Issue key |
191
+
192
+ ---
193
+
194
+ ## Confluence Tools (13)
195
+
196
+ ### 1. confluence_search_content
197
+ **Description**: Search Confluence content using CQL
198
+ **Use Cases**: Find pages, search by keyword, filter by space
199
+
200
+ | Parameter | Type | Required | Description |
201
+ |-----------|------|----------|-------------|
202
+ | cql | string | ✓ | CQL query string |
203
+ | limit | number | ✗ | Maximum results (default: 25) |
204
+ | expand | string[] | ✗ | Additional data to expand |
205
+
206
+ ---
207
+
208
+ ### 2. confluence_get_page
209
+ **Description**: Get a Confluence page by ID
210
+ **Use Cases**: Read page content, check version
211
+
212
+ | Parameter | Type | Required | Description |
213
+ |-----------|------|----------|-------------|
214
+ | pageId | string | ✓ | Page ID |
215
+ | expand | string[] | ✗ | Additional data (e.g., "body.storage") |
216
+
217
+ ---
218
+
219
+ ### 3. confluence_get_page_by_title
220
+ **Description**: Get a page by title and space
221
+ **Use Cases**: Find page by name, access documentation
222
+
223
+ | Parameter | Type | Required | Description |
224
+ |-----------|------|----------|-------------|
225
+ | spaceKey | string | ✓ | Space key |
226
+ | title | string | ✓ | Page title |
227
+ | expand | string[] | ✗ | Additional data to expand |
228
+
229
+ ---
230
+
231
+ ### 4. confluence_create_page
232
+ **Description**: Create a new Confluence page
233
+ **Use Cases**: Add documentation, create meeting notes
234
+
235
+ | Parameter | Type | Required | Description |
236
+ |-----------|------|----------|-------------|
237
+ | spaceKey | string | ✓ | Space key |
238
+ | title | string | ✓ | Page title |
239
+ | content | string | ✓ | Page content (HTML/storage format) |
240
+ | parentId | string | ✗ | Parent page ID |
241
+ | labels | string[] | ✗ | Array of labels |
242
+
243
+ ---
244
+
245
+ ### 5. confluence_update_page
246
+ **Description**: Update an existing page
247
+ **Use Cases**: Edit documentation, fix content
248
+
249
+ | Parameter | Type | Required | Description |
250
+ |-----------|------|----------|-------------|
251
+ | pageId | string | ✓ | Page ID |
252
+ | title | string | ✗ | New title |
253
+ | content | string | ✗ | New content |
254
+ | version | number | ✓ | Current version (for locking) |
255
+ | minorEdit | boolean | ✗ | Is this a minor edit |
256
+
257
+ ---
258
+
259
+ ### 6. confluence_delete_page
260
+ **Description**: Delete a Confluence page
261
+ **Use Cases**: Remove outdated content
262
+
263
+ | Parameter | Type | Required | Description |
264
+ |-----------|------|----------|-------------|
265
+ | pageId | string | ✓ | Page ID |
266
+
267
+ ---
268
+
269
+ ### 7. confluence_list_spaces
270
+ **Description**: List all accessible spaces
271
+ **Use Cases**: Discover available spaces, get space keys
272
+
273
+ | Parameter | Type | Required | Description |
274
+ |-----------|------|----------|-------------|
275
+ | limit | number | ✗ | Maximum number of results |
276
+ | type | string | ✗ | Space type ("global" or "personal") |
277
+
278
+ ---
279
+
280
+ ### 8. confluence_get_space
281
+ **Description**: Get detailed space information
282
+ **Use Cases**: View space details, get homepage
283
+
284
+ | Parameter | Type | Required | Description |
285
+ |-----------|------|----------|-------------|
286
+ | spaceKey | string | ✓ | Space key |
287
+ | expand | string[] | ✗ | Additional data to expand |
288
+
289
+ ---
290
+
291
+ ### 9. confluence_get_page_children
292
+ **Description**: Get child pages of a page
293
+ **Use Cases**: Navigate page hierarchy, list subpages
294
+
295
+ | Parameter | Type | Required | Description |
296
+ |-----------|------|----------|-------------|
297
+ | pageId | string | ✓ | Parent page ID |
298
+ | expand | string[] | ✗ | Additional data to expand |
299
+ | limit | number | ✗ | Maximum number of results |
300
+
301
+ ---
302
+
303
+ ### 10. confluence_add_comment
304
+ **Description**: Add a comment to a page
305
+ **Use Cases**: Provide feedback, ask questions
306
+
307
+ | Parameter | Type | Required | Description |
308
+ |-----------|------|----------|-------------|
309
+ | pageId | string | ✓ | Page ID |
310
+ | comment | string | ✓ | Comment text (HTML) |
311
+
312
+ ---
313
+
314
+ ### 11. confluence_get_comments
315
+ **Description**: Get comments on a page
316
+ **Use Cases**: Read feedback, review discussions
317
+
318
+ | Parameter | Type | Required | Description |
319
+ |-----------|------|----------|-------------|
320
+ | pageId | string | ✓ | Page ID |
321
+ | limit | number | ✗ | Maximum number of results |
322
+
323
+ ---
324
+
325
+ ### 12. confluence_upload_attachment
326
+ **Description**: Upload a file attachment to a page
327
+ **Use Cases**: Attach documents, upload images
328
+
329
+ | Parameter | Type | Required | Description |
330
+ |-----------|------|----------|-------------|
331
+ | pageId | string | ✓ | Page ID |
332
+ | filePath | string | ✓ | Local file path |
333
+ | comment | string | ✗ | Attachment comment |
334
+
335
+ ---
336
+
337
+ ### 13. confluence_list_attachments
338
+ **Description**: List attachments on a page
339
+ **Use Cases**: View uploaded files, check attachments
340
+
341
+ | Parameter | Type | Required | Description |
342
+ |-----------|------|----------|-------------|
343
+ | pageId | string | ✓ | Page ID |
344
+ | limit | number | ✗ | Maximum number of results |
345
+
346
+ ---
347
+
348
+ ## Query Language Reference
349
+
350
+ ### JQL (Jira Query Language) Examples
351
+
352
+ ```jql
353
+ # Find open bugs assigned to you
354
+ project = PROJ AND type = Bug AND status = Open AND assignee = currentUser()
355
+
356
+ # Issues updated in the last 7 days
357
+ updatedDate >= -7d
358
+
359
+ # High priority issues in multiple projects
360
+ project in (PROJ1, PROJ2) AND priority = High
361
+
362
+ # Issues with specific label
363
+ labels = "customer-request"
364
+
365
+ # Complex query with multiple conditions
366
+ project = PROJ AND status = "In Progress" AND assignee = currentUser()
367
+ AND priority in (High, Critical) ORDER BY created DESC
368
+ ```
369
+
370
+ ### CQL (Confluence Query Language) Examples
371
+
372
+ ```cql
373
+ # Find pages by title keyword
374
+ type=page AND title~"API Documentation"
375
+
376
+ # Find content in specific space
377
+ space=DOCS AND type=page
378
+
379
+ # Find recently modified pages
380
+ type=page AND lastModified >= now("-7d")
381
+
382
+ # Find pages with specific label
383
+ type=page AND label="public"
384
+
385
+ # Complex search
386
+ type=page AND space=DOCS AND (title~"API" OR text~"endpoint")
387
+ AND lastModified >= now("-30d")
388
+ ```
389
+
390
+ ## Common Workflows
391
+
392
+ ### Workflow 1: Bug Triage
393
+ 1. `jira_search_issues` - Find new bugs
394
+ 2. `jira_get_issue` - Review bug details
395
+ 3. `jira_update_issue` - Set priority/assignee
396
+ 4. `jira_add_comment` - Add triage notes
397
+ 5. `jira_transition_issue` - Move to backlog
398
+
399
+ ### Workflow 2: Sprint Planning
400
+ 1. `jira_get_board` - Get board info
401
+ 2. `jira_get_sprints` - Find active sprint
402
+ 3. `jira_get_sprint_issues` - Review sprint items
403
+ 4. `jira_search_issues` - Find candidates for next sprint
404
+ 5. `jira_update_issue` - Assign to sprint
405
+
406
+ ### Workflow 3: Documentation Update
407
+ 1. `confluence_search_content` - Find existing page
408
+ 2. `confluence_get_page` - Read current content
409
+ 3. `confluence_update_page` - Update content
410
+ 4. `confluence_add_comment` - Note changes
411
+ 5. `confluence_upload_attachment` - Add supporting files
412
+
413
+ ### Workflow 4: Issue Investigation
414
+ 1. `jira_get_issue` - Get issue details
415
+ 2. `jira_get_issue_comments` - Read discussion
416
+ 3. `confluence_search_content` - Find related docs
417
+ 4. `confluence_get_page` - Read documentation
418
+ 5. `jira_add_comment` - Document findings
419
+ 6. `jira_link_issues` - Link related issues
420
+
421
+ ## Tool Selection Guide
422
+
423
+ ### When to use Jira tools:
424
+ - **Issue tracking**: Creating, updating, searching for issues
425
+ - **Agile workflows**: Sprint planning, board management
426
+ - **Bug management**: Triaging, prioritizing, assigning bugs
427
+ - **Project tracking**: Monitoring project progress
428
+ - **Team collaboration**: Comments, linking, status updates
429
+
430
+ ### When to use Confluence tools:
431
+ - **Documentation**: Creating, reading, updating docs
432
+ - **Knowledge sharing**: Publishing guides, FAQs, how-tos
433
+ - **Meeting notes**: Recording decisions, action items
434
+ - **Collaboration**: Comments, feedback on pages
435
+ - **Content organization**: Space and page hierarchy management
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Configuration constants
3
+ */
4
+ export declare const PROJECT_CONFIG_FILE = ".jicon.json";
5
+ export declare const HOME_CONFIG_DIR: string;
6
+ export declare const HOME_CONFIG_FILE: string;
7
+ export declare const DEFAULT_CONFIG: {
8
+ permissions: {
9
+ mode: "full";
10
+ whitelist: never[];
11
+ blacklist: never[];
12
+ };
13
+ };
14
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AACjD,eAAO,MAAM,eAAe,QAA8C,CAAC;AAC3E,eAAO,MAAM,gBAAgB,QAA2C,CAAC;AAGzE,eAAO,MAAM,cAAc;;;;;;CAM1B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Configuration constants
3
+ */
4
+ import * as path from "path";
5
+ import * as os from "os";
6
+ // Configuration file names
7
+ export const PROJECT_CONFIG_FILE = ".jicon.json";
8
+ export const HOME_CONFIG_DIR = path.join(os.homedir(), ".config", "jicon");
9
+ export const HOME_CONFIG_FILE = path.join(HOME_CONFIG_DIR, "jicon.json");
10
+ // Default configuration
11
+ export const DEFAULT_CONFIG = {
12
+ permissions: {
13
+ mode: "full",
14
+ whitelist: [],
15
+ blacklist: [],
16
+ },
17
+ };
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,2BAA2B;AAC3B,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AACjD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AAEzE,wBAAwB;AACxB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW,EAAE;QACX,IAAI,EAAE,MAAe;QACrB,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,EAAE;KACd;CACF,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Configuration loader with hierarchy support
3
+ */
4
+ import { type Config, type ApiConfig } from "./types.js";
5
+ export declare class ConfigLoader {
6
+ /**
7
+ * Load configuration with priority:
8
+ * 1. Project config (.jicon.json in current directory)
9
+ * 2. User config ($HOME/.config/jicon/jicon.json)
10
+ * 3. Environment variables
11
+ */
12
+ static load(): Config;
13
+ /**
14
+ * Load configuration from a JSON file
15
+ */
16
+ private static loadFromFile;
17
+ /**
18
+ * Load configuration from environment variables (legacy support)
19
+ */
20
+ private static loadFromEnv;
21
+ /**
22
+ * Parse auth type from string
23
+ */
24
+ private static parseAuthType;
25
+ /**
26
+ * Convert service config to ApiConfig format (for backward compatibility)
27
+ */
28
+ static toApiConfig(serviceConfig: {
29
+ url: string;
30
+ username?: string;
31
+ token: string;
32
+ authType?: "basic" | "bearer";
33
+ } | undefined): ApiConfig | null;
34
+ }
35
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAgB,KAAK,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAOvE,qBAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,IAAI,IAAI,MAAM;IAqBrB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAqB3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IA4B1B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAS5B;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,aAAa,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;KAAE,GAAG,SAAS,GAC1G,SAAS,GAAG,IAAI;CAYpB"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Configuration loader with hierarchy support
3
+ */
4
+ import * as fs from "fs";
5
+ import * as path from "path";
6
+ import { ConfigSchema } from "./types.js";
7
+ import { PROJECT_CONFIG_FILE, HOME_CONFIG_FILE, DEFAULT_CONFIG, } from "./constants.js";
8
+ export class ConfigLoader {
9
+ /**
10
+ * Load configuration with priority:
11
+ * 1. Project config (.jicon.json in current directory)
12
+ * 2. User config ($HOME/.config/jicon/jicon.json)
13
+ * 3. Environment variables
14
+ */
15
+ static load() {
16
+ // 1. Try project config
17
+ const projectConfigPath = path.resolve(process.cwd(), PROJECT_CONFIG_FILE);
18
+ const projectConfig = this.loadFromFile(projectConfigPath);
19
+ if (projectConfig) {
20
+ console.error(`✓ Using project config: ${projectConfigPath}`);
21
+ return projectConfig;
22
+ }
23
+ // 2. Try user config
24
+ const homeConfig = this.loadFromFile(HOME_CONFIG_FILE);
25
+ if (homeConfig) {
26
+ console.error(`✓ Using user config: ${HOME_CONFIG_FILE}`);
27
+ return homeConfig;
28
+ }
29
+ // 3. Fallback to environment variables
30
+ console.error("✓ Using environment variables");
31
+ return this.loadFromEnv();
32
+ }
33
+ /**
34
+ * Load configuration from a JSON file
35
+ */
36
+ static loadFromFile(filePath) {
37
+ try {
38
+ if (!fs.existsSync(filePath)) {
39
+ return null;
40
+ }
41
+ const content = fs.readFileSync(filePath, "utf-8");
42
+ const data = JSON.parse(content);
43
+ // Validate with Zod schema
44
+ const config = ConfigSchema.parse(data);
45
+ return config;
46
+ }
47
+ catch (error) {
48
+ if (error instanceof Error) {
49
+ console.error(`Warning: Failed to load config from ${filePath}:`, error.message);
50
+ }
51
+ return null;
52
+ }
53
+ }
54
+ /**
55
+ * Load configuration from environment variables (legacy support)
56
+ */
57
+ static loadFromEnv() {
58
+ const config = {
59
+ permissions: DEFAULT_CONFIG.permissions,
60
+ };
61
+ // Load Jira config from env
62
+ if (process.env.JIRA_URL) {
63
+ config.jira = {
64
+ url: process.env.JIRA_URL,
65
+ username: process.env.JIRA_USERNAME,
66
+ token: process.env.JIRA_API_TOKEN || "",
67
+ authType: this.parseAuthType(process.env.JIRA_AUTH_TYPE),
68
+ };
69
+ }
70
+ // Load Confluence config from env
71
+ if (process.env.CONFLUENCE_URL) {
72
+ config.confluence = {
73
+ url: process.env.CONFLUENCE_URL,
74
+ username: process.env.CONFLUENCE_USERNAME,
75
+ token: process.env.CONFLUENCE_API_TOKEN || "",
76
+ authType: this.parseAuthType(process.env.CONFLUENCE_AUTH_TYPE),
77
+ };
78
+ }
79
+ return config;
80
+ }
81
+ /**
82
+ * Parse auth type from string
83
+ */
84
+ static parseAuthType(value) {
85
+ if (!value)
86
+ return undefined;
87
+ const normalized = value.toLowerCase();
88
+ if (normalized === "basic" || normalized === "bearer") {
89
+ return normalized;
90
+ }
91
+ return undefined;
92
+ }
93
+ /**
94
+ * Convert service config to ApiConfig format (for backward compatibility)
95
+ */
96
+ static toApiConfig(serviceConfig) {
97
+ if (!serviceConfig) {
98
+ return null;
99
+ }
100
+ return {
101
+ url: serviceConfig.url,
102
+ username: serviceConfig.username,
103
+ token: serviceConfig.token,
104
+ authType: serviceConfig.authType,
105
+ };
106
+ }
107
+ }
108
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAA+B,MAAM,YAAY,CAAC;AACvE,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,MAAM,OAAO,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,IAAI;QACT,wBAAwB;QACxB,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,mBAAmB,CAAC,CAAC;QAC3E,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,2BAA2B,iBAAiB,EAAE,CAAC,CAAC;YAC9D,OAAO,aAAa,CAAC;QACvB,CAAC;QAED,qBAAqB;QACrB,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,gBAAgB,EAAE,CAAC,CAAC;YAC1D,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,uCAAuC;QACvC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IA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