@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
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Tool registry with virtual actions
3
+ */
4
+ export declare const JIRA_READ_TOOLS: readonly ["jira_search_issues", "jira_get_issue", "jira_get_issue_comments", "jira_list_projects", "jira_get_project", "jira_get_transitions", "jira_get_board", "jira_get_sprints", "jira_get_sprint_issues", "jira_get_issue_watchers"];
5
+ export declare const JIRA_WRITE_TOOLS: readonly ["jira_create_issue", "jira_update_issue", "jira_transition_issue", "jira_add_comment", "jira_link_issues"];
6
+ export declare const CONFLUENCE_READ_TOOLS: readonly ["confluence_search_content", "confluence_get_page", "confluence_get_page_by_title", "confluence_list_spaces", "confluence_get_space", "confluence_get_page_children", "confluence_get_comments", "confluence_list_attachments"];
7
+ export declare const CONFLUENCE_WRITE_TOOLS: readonly ["confluence_create_page", "confluence_update_page", "confluence_delete_page", "confluence_add_comment", "confluence_upload_attachment"];
8
+ export declare const TEMPO_READ_TOOLS: readonly ["tempo_get_worklogs", "tempo_get_worklog", "tempo_get_accounts", "tempo_get_account", "tempo_get_teams", "tempo_get_team", "tempo_get_team_worklogs", "tempo_get_user_info"];
9
+ export declare const TEMPO_WRITE_TOOLS: readonly ["tempo_log_work", "tempo_update_worklog", "tempo_delete_worklog"];
10
+ export declare const ALL_JIRA_TOOLS: readonly ["jira_search_issues", "jira_get_issue", "jira_get_issue_comments", "jira_list_projects", "jira_get_project", "jira_get_transitions", "jira_get_board", "jira_get_sprints", "jira_get_sprint_issues", "jira_get_issue_watchers", "jira_create_issue", "jira_update_issue", "jira_transition_issue", "jira_add_comment", "jira_link_issues"];
11
+ export declare const ALL_CONFLUENCE_TOOLS: readonly ["confluence_search_content", "confluence_get_page", "confluence_get_page_by_title", "confluence_list_spaces", "confluence_get_space", "confluence_get_page_children", "confluence_get_comments", "confluence_list_attachments", "confluence_create_page", "confluence_update_page", "confluence_delete_page", "confluence_add_comment", "confluence_upload_attachment"];
12
+ export declare const ALL_TEMPO_TOOLS: readonly ["tempo_get_worklogs", "tempo_get_worklog", "tempo_get_accounts", "tempo_get_account", "tempo_get_teams", "tempo_get_team", "tempo_get_team_worklogs", "tempo_get_user_info", "tempo_log_work", "tempo_update_worklog", "tempo_delete_worklog"];
13
+ export declare const ALL_TOOLS: readonly ["jira_search_issues", "jira_get_issue", "jira_get_issue_comments", "jira_list_projects", "jira_get_project", "jira_get_transitions", "jira_get_board", "jira_get_sprints", "jira_get_sprint_issues", "jira_get_issue_watchers", "jira_create_issue", "jira_update_issue", "jira_transition_issue", "jira_add_comment", "jira_link_issues", "confluence_search_content", "confluence_get_page", "confluence_get_page_by_title", "confluence_list_spaces", "confluence_get_space", "confluence_get_page_children", "confluence_get_comments", "confluence_list_attachments", "confluence_create_page", "confluence_update_page", "confluence_delete_page", "confluence_add_comment", "confluence_upload_attachment", "tempo_get_worklogs", "tempo_get_worklog", "tempo_get_accounts", "tempo_get_account", "tempo_get_teams", "tempo_get_team", "tempo_get_team_worklogs", "tempo_get_user_info", "tempo_log_work", "tempo_update_worklog", "tempo_delete_worklog"];
14
+ export declare const VIRTUAL_ACTIONS: {
15
+ readonly jira_read: readonly ["jira_search_issues", "jira_get_issue", "jira_get_issue_comments", "jira_list_projects", "jira_get_project", "jira_get_transitions", "jira_get_board", "jira_get_sprints", "jira_get_sprint_issues", "jira_get_issue_watchers"];
16
+ readonly jira_write: readonly ["jira_create_issue", "jira_update_issue", "jira_transition_issue", "jira_add_comment", "jira_link_issues"];
17
+ readonly jira_all: readonly ["jira_search_issues", "jira_get_issue", "jira_get_issue_comments", "jira_list_projects", "jira_get_project", "jira_get_transitions", "jira_get_board", "jira_get_sprints", "jira_get_sprint_issues", "jira_get_issue_watchers", "jira_create_issue", "jira_update_issue", "jira_transition_issue", "jira_add_comment", "jira_link_issues"];
18
+ readonly confluence_read: readonly ["confluence_search_content", "confluence_get_page", "confluence_get_page_by_title", "confluence_list_spaces", "confluence_get_space", "confluence_get_page_children", "confluence_get_comments", "confluence_list_attachments"];
19
+ readonly confluence_write: readonly ["confluence_create_page", "confluence_update_page", "confluence_delete_page", "confluence_add_comment", "confluence_upload_attachment"];
20
+ readonly confluence_all: readonly ["confluence_search_content", "confluence_get_page", "confluence_get_page_by_title", "confluence_list_spaces", "confluence_get_space", "confluence_get_page_children", "confluence_get_comments", "confluence_list_attachments", "confluence_create_page", "confluence_update_page", "confluence_delete_page", "confluence_add_comment", "confluence_upload_attachment"];
21
+ readonly tempo_read: readonly ["tempo_get_worklogs", "tempo_get_worklog", "tempo_get_accounts", "tempo_get_account", "tempo_get_teams", "tempo_get_team", "tempo_get_team_worklogs", "tempo_get_user_info"];
22
+ readonly tempo_write: readonly ["tempo_log_work", "tempo_update_worklog", "tempo_delete_worklog"];
23
+ readonly tempo_all: readonly ["tempo_get_worklogs", "tempo_get_worklog", "tempo_get_accounts", "tempo_get_account", "tempo_get_teams", "tempo_get_team", "tempo_get_team_worklogs", "tempo_get_user_info", "tempo_log_work", "tempo_update_worklog", "tempo_delete_worklog"];
24
+ };
25
+ export type JiraReadTool = (typeof JIRA_READ_TOOLS)[number];
26
+ export type JiraWriteTool = (typeof JIRA_WRITE_TOOLS)[number];
27
+ export type ConfluenceReadTool = (typeof CONFLUENCE_READ_TOOLS)[number];
28
+ export type ConfluenceWriteTool = (typeof CONFLUENCE_WRITE_TOOLS)[number];
29
+ export type TempoReadTool = (typeof TEMPO_READ_TOOLS)[number];
30
+ export type TempoWriteTool = (typeof TEMPO_WRITE_TOOLS)[number];
31
+ export type JiraTool = JiraReadTool | JiraWriteTool;
32
+ export type ConfluenceTool = ConfluenceReadTool | ConfluenceWriteTool;
33
+ export type TempoTool = TempoReadTool | TempoWriteTool;
34
+ export type RealToolName = JiraTool | ConfluenceTool | TempoTool;
35
+ export type VirtualAction = keyof typeof VIRTUAL_ACTIONS;
36
+ export type ToolName = RealToolName | VirtualAction;
37
+ /**
38
+ * Check if a string is a virtual action
39
+ */
40
+ export declare function isVirtualAction(action: string): action is VirtualAction;
41
+ /**
42
+ * Check if a string is a real tool name
43
+ */
44
+ export declare function isRealTool(tool: string): tool is RealToolName;
45
+ /**
46
+ * Expand virtual actions to real tool names
47
+ */
48
+ export declare function expandVirtualActions(actions: string[]): string[];
49
+ //# sourceMappingURL=tool-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/permissions/tool-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,eAAe,2OAWlB,CAAC;AAGX,eAAO,MAAM,gBAAgB,sHAMnB,CAAC;AAGX,eAAO,MAAM,qBAAqB,2OASxB,CAAC;AAGX,eAAO,MAAM,sBAAsB,mJAMzB,CAAC;AAGX,eAAO,MAAM,gBAAgB,wLASnB,CAAC;AAGX,eAAO,MAAM,iBAAiB,6EAIpB,CAAC;AAGX,eAAO,MAAM,cAAc,sVAAqD,CAAC;AACjF,eAAO,MAAM,oBAAoB,mXAGvB,CAAC;AACX,eAAO,MAAM,eAAe,0PAAuD,CAAC;AACpF,eAAO,MAAM,SAAS,66BAA4E,CAAC;AAGnG,eAAO,MAAM,eAAe;;;;;;;;;;CAUlB,CAAC;AAGX,MAAM,MAAM,Y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ira_get_issue_comments",
9
+ "jira_list_projects",
10
+ "jira_get_project",
11
+ "jira_get_transitions",
12
+ "jira_get_board",
13
+ "jira_get_sprints",
14
+ "jira_get_sprint_issues",
15
+ "jira_get_issue_watchers",
16
+ ];
17
+ // Jira write tools (5 tools)
18
+ export const JIRA_WRITE_TOOLS = [
19
+ "jira_create_issue",
20
+ "jira_update_issue",
21
+ "jira_transition_issue",
22
+ "jira_add_comment",
23
+ "jira_link_issues",
24
+ ];
25
+ // Confluence read-only tools (8 tools)
26
+ export const CONFLUENCE_READ_TOOLS = [
27
+ "confluence_search_content",
28
+ "confluence_get_page",
29
+ "confluence_get_page_by_title",
30
+ "confluence_list_spaces",
31
+ "confluence_get_space",
32
+ "confluence_get_page_children",
33
+ "confluence_get_comments",
34
+ "confluence_list_attachments",
35
+ ];
36
+ // Confluence write tools (5 tools)
37
+ export const CONFLUENCE_WRITE_TOOLS = [
38
+ "confluence_create_page",
39
+ "confluence_update_page",
40
+ "confluence_delete_page",
41
+ "confluence_add_comment",
42
+ "confluence_upload_attachment",
43
+ ];
44
+ // Tempo read-only tools (6 tools)
45
+ export const TEMPO_READ_TOOLS = [
46
+ "tempo_get_worklogs",
47
+ "tempo_get_worklog",
48
+ "tempo_get_accounts",
49
+ "tempo_get_account",
50
+ "tempo_get_teams",
51
+ "tempo_get_team",
52
+ "tempo_get_team_worklogs",
53
+ "tempo_get_user_info",
54
+ ];
55
+ // Tempo write tools (3 tools)
56
+ export const TEMPO_WRITE_TOOLS = [
57
+ "tempo_log_work",
58
+ "tempo_update_worklog",
59
+ "tempo_delete_worklog",
60
+ ];
61
+ // Combined tool lists
62
+ export const ALL_JIRA_TOOLS = [...JIRA_READ_TOOLS, ...JIRA_WRITE_TOOLS];
63
+ export const ALL_CONFLUENCE_TOOLS = [
64
+ ...CONFLUENCE_READ_TOOLS,
65
+ ...CONFLUENCE_WRITE_TOOLS,
66
+ ];
67
+ export const ALL_TEMPO_TOOLS = [...TEMPO_READ_TOOLS, ...TEMPO_WRITE_TOOLS];
68
+ export const ALL_TOOLS = [...ALL_JIRA_TOOLS, ...ALL_CONFLUENCE_TOOLS, ...ALL_TEMPO_TOOLS];
69
+ // Virtual actions mapping
70
+ export const VIRTUAL_ACTIONS = {
71
+ jira_read: JIRA_READ_TOOLS,
72
+ jira_write: JIRA_WRITE_TOOLS,
73
+ jira_all: ALL_JIRA_TOOLS,
74
+ confluence_read: CONFLUENCE_READ_TOOLS,
75
+ confluence_write: CONFLUENCE_WRITE_TOOLS,
76
+ confluence_all: ALL_CONFLUENCE_TOOLS,
77
+ tempo_read: TEMPO_READ_TOOLS,
78
+ tempo_write: TEMPO_WRITE_TOOLS,
79
+ tempo_all: ALL_TEMPO_TOOLS,
80
+ };
81
+ /**
82
+ * Check if a string is a virtual action
83
+ */
84
+ export function isVirtualAction(action) {
85
+ return action in VIRTUAL_ACTIONS;
86
+ }
87
+ /**
88
+ * Check if a string is a real tool name
89
+ */
90
+ export function isRealTool(tool) {
91
+ return ALL_TOOLS.includes(tool);
92
+ }
93
+ /**
94
+ * Expand virtual actions to real tool names
95
+ */
96
+ export function expandVirtualActions(actions) {
97
+ const expanded = new Set();
98
+ for (const action of actions) {
99
+ if (isVirtualAction(action)) {
100
+ // Expand virtual action
101
+ const tools = VIRTUAL_ACTIONS[action];
102
+ tools.forEach((tool) => expanded.add(tool));
103
+ }
104
+ else {
105
+ // Add real tool name as-is
106
+ expanded.add(action);
107
+ }
108
+ }
109
+ return Array.from(expanded);
110
+ }
111
+ //# sourceMappingURL=tool-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../src/permissions/tool-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,kCAAkC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,oBAAoB;IACpB,gBAAgB;IAChB,yBAAyB;IACzB,oBAAoB;IACpB,kBAAkB;IAClB,sBAAsB;IACtB,gBAAgB;IAChB,kBAAkB;IACl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SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,gBAAgB;IAC5B,QAAQ,EAAE,cAAc;IACxB,eAAe,EAAE,qBAAqB;IACtC,gBAAgB,EAAE,sBAAsB;IACxC,cAAc,EAAE,oBAAoB;IACpC,UAAU,EAAE,gBAAgB;IAC5B,WAAW,EAAE,iBAAiB;IAC9B,SAAS,EAAE,eAAe;CAClB,CAAC;AAkBX;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,MAAM,IAAI,eAAe,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAQ,SAA+B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAiB;IACpD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IAEnC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5B,wBAAwB;YACxB,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;YACtC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,2BAA2B;YAC3B,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Tempo API Client
3
+ * Uses Tempo v3 API (fallback to v2 if needed)
4
+ */
5
+ import type { ApiConfig } from "../types.js";
6
+ import type { TempoWorklog, TempoWorklogInput, TempoWorklogSearchResult, TempoAccount, TempoTeam } from "./types.js";
7
+ export declare class TempoClient {
8
+ private http;
9
+ private apiVersion;
10
+ constructor(config: ApiConfig, apiVersion?: string);
11
+ getWorklogs(dateFrom?: string, dateTo?: string, projectKey?: string, issueKey?: string, accountId?: string): Promise<TempoWorklogSearchResult>;
12
+ getWorklog(worklogId: number): Promise<TempoWorklog>;
13
+ logWork(worklogData: TempoWorklogInput): Promise<TempoWorklog>;
14
+ updateWorklog(worklogId: number, worklogData: Partial<TempoWorklogInput>): Promise<TempoWorklog>;
15
+ deleteWorklog(worklogId: number): Promise<void>;
16
+ getAccounts(): Promise<TempoAccount[]>;
17
+ getAccount(accountKey: string): Promise<TempoAccount>;
18
+ createAccount(accountData: {
19
+ key: string;
20
+ name: string;
21
+ leadAccountId: string;
22
+ status?: "OPEN" | "CLOSED";
23
+ }): Promise<TempoAccount>;
24
+ getTeams(): Promise<TempoTeam[]>;
25
+ getTeam(teamId: number): Promise<TempoTeam>;
26
+ getTeamWorklogs(teamId: number, dateFrom: string, dateTo: string): Promise<TempoWorklogSearchResult>;
27
+ getCurrentUser(): Promise<{
28
+ accountId: string;
29
+ displayName: string;
30
+ }>;
31
+ }
32
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/tempo/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EACZ,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB,qBAAa,WAAW;IACtB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,SAAS,EAAE,UAAU,GAAE,MAAY;IAMjD,WAAW,CACf,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,CAAC;IA8D9B,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAMpD,OAAO,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAO9D,aAAa,CACjB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACtC,OAAO,CAAC,YAAY,CAAC;IAOlB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO/C,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAQtC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAMrD,aAAa,CAAC,WAAW,EAAE;QAC/B,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;KAC5B,GAAG,OAAO,CAAC,YAAY,CAAC;IAQnB,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAQhC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAI3C,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,wBAAwB,CAAC;IA4B9B,cAAc,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAM5E"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Tempo API Client
3
+ * Uses Tempo v3 API (fallback to v2 if needed)
4
+ */
5
+ import { HttpClient } from "../utils/http-client.js";
6
+ export class TempoClient {
7
+ http;
8
+ apiVersion;
9
+ constructor(config, apiVersion = "3") {
10
+ this.http = new HttpClient(config);
11
+ this.apiVersion = apiVersion;
12
+ }
13
+ // Worklog operations
14
+ async getWorklogs(dateFrom, dateTo, projectKey, issueKey, accountId) {
15
+ const params = new URLSearchParams();
16
+ if (dateFrom)
17
+ params.append("from", dateFrom);
18
+ if (dateTo)
19
+ params.append("to", dateTo);
20
+ if (projectKey)
21
+ params.append("projectKey", projectKey);
22
+ if (issueKey)
23
+ params.append("issueKey", issueKey);
24
+ if (accountId)
25
+ params.append("worker", accountId);
26
+ const queryString = params.toString();
27
+ const url = `/rest/tempo-timesheets/${this.apiVersion}/worklogs${queryString ? `?${queryString}` : ""}`;
28
+ const response = await this.http.get(url);
29
+ // Defensive handling of response format
30
+ // Official API should return: { self, metadata: { count, offset, limit }, results: [] }
31
+ // Handle direct array (shouldn't happen but be defensive)
32
+ if (Array.isArray(response)) {
33
+ return {
34
+ results: response,
35
+ metadata: {
36
+ count: response.length,
37
+ offset: 0,
38
+ limit: response.length,
39
+ },
40
+ };
41
+ }
42
+ // Handle null/undefined response
43
+ if (!response) {
44
+ return {
45
+ results: [],
46
+ metadata: { count: 0, offset: 0, limit: 0 },
47
+ };
48
+ }
49
+ // Handle object with results array
50
+ if (response.results && Array.isArray(response.results)) {
51
+ // Add default metadata if missing
52
+ if (!response.metadata) {
53
+ return {
54
+ results: response.results,
55
+ metadata: {
56
+ count: response.results.length,
57
+ offset: 0,
58
+ limit: response.results.length,
59
+ },
60
+ };
61
+ }
62
+ // Response is in correct format
63
+ return response;
64
+ }
65
+ // Unexpected format - throw descriptive error
66
+ throw new Error(`Unexpected Tempo API response format. Expected object with 'results' array, got: ${JSON.stringify(response).substring(0, 200)}`);
67
+ }
68
+ async getWorklog(worklogId) {
69
+ return this.http.get(`/rest/tempo-timesheets/${this.apiVersion}/worklogs/${worklogId}`);
70
+ }
71
+ async logWork(worklogData) {
72
+ return this.http.post(`/rest/tempo-timesheets/${this.apiVersion}/worklogs`, worklogData);
73
+ }
74
+ async updateWorklog(worklogId, worklogData) {
75
+ return this.http.put(`/rest/tempo-timesheets/${this.apiVersion}/worklogs/${worklogId}`, worklogData);
76
+ }
77
+ async deleteWorklog(worklogId) {
78
+ await this.http.delete(`/rest/tempo-timesheets/${this.apiVersion}/worklogs/${worklogId}`);
79
+ }
80
+ // Account operations
81
+ async getAccounts() {
82
+ // API returns array directly, not wrapped object
83
+ const response = await this.http.get("/rest/tempo-accounts/1/account");
84
+ return Array.isArray(response) ? response : [];
85
+ }
86
+ async getAccount(accountKey) {
87
+ return this.http.get(`/rest/tempo-accounts/1/account/${accountKey}`);
88
+ }
89
+ async createAccount(accountData) {
90
+ return this.http.post("/rest/tempo-accounts/1/account", accountData);
91
+ }
92
+ // Team operations
93
+ async getTeams() {
94
+ // API returns array directly, not wrapped object
95
+ const response = await this.http.get("/rest/tempo-teams/1/team");
96
+ return Array.isArray(response) ? response : [];
97
+ }
98
+ async getTeam(teamId) {
99
+ return this.http.get(`/rest/tempo-teams/1/team/${teamId}`);
100
+ }
101
+ async getTeamWorklogs(teamId, dateFrom, dateTo) {
102
+ const team = await this.getTeam(teamId);
103
+ const memberAccountIds = team.members.map((m) => m.accountId);
104
+ // Get worklogs for all team members
105
+ const allWorklogs = [];
106
+ for (const accountId of memberAccountIds) {
107
+ const result = await this.getWorklogs(dateFrom, dateTo, undefined, undefined, accountId);
108
+ allWorklogs.push(...result.results);
109
+ }
110
+ return {
111
+ results: allWorklogs,
112
+ metadata: {
113
+ count: allWorklogs.length,
114
+ offset: 0,
115
+ limit: allWorklogs.length,
116
+ },
117
+ };
118
+ }
119
+ // User operations
120
+ async getCurrentUser() {
121
+ // Use Jira's myself endpoint since Tempo doesn't have its own
122
+ return this.http.get("/rest/api/2/myself");
123
+ }
124
+ }
125
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/tempo/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,y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,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,MAAc,EACd,QAAgB,EAChB,MAAc;QAEd,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAE9D,oCAAoC;QACpC,MAAM,WAAW,GAAmB,EAAE,CAAC;QACvC,KAAK,MAAM,SAAS,IAAI,gBAAgB,EAAE,CAAC;YACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CACnC,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,SAAS,CACV,CAAC;YACF,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAED,OAAO;YACL,OAAO,EAAE,WAAW;YACpB,QAAQ,EAAE;gBACR,KAAK,EAAE,WAAW,CAAC,MAAM;gBACzB,MAAM,EAAE,CAAC;gBACT,KAAK,EAAE,WAAW,CAAC,MAAM;aAC1B;SACF,CAAC;IACJ,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,cAAc;QAClB,8DAA8D;QAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAClB,oBAAoB,CACrB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Response formatters for Tempo API responses
3
+ * Converts verbose API responses into concise, readable formats
4
+ */
5
+ import type { TempoWorklog, TempoWorklogSearchResult, TempoAccount, TempoTeam } from "./types.js";
6
+ /**
7
+ * Format a single worklog entry
8
+ */
9
+ export declare function formatWorklog(worklog: TempoWorklog): string;
10
+ /**
11
+ * Format worklog search results
12
+ */
13
+ export declare function formatWorklogSearchResults(result: TempoWorklogSearchResult): string;
14
+ /**
15
+ * Format an account
16
+ */
17
+ export declare function formatAccount(account: TempoAccount): string;
18
+ /**
19
+ * Format list of accounts
20
+ */
21
+ export declare function formatAccounts(accounts: TempoAccount[]): string;
22
+ /**
23
+ * Format a team
24
+ */
25
+ export declare function formatTeam(team: TempoTeam): string;
26
+ /**
27
+ * Format list of teams
28
+ */
29
+ export declare function formatTeams(teams: TempoTeam[]): string;
30
+ //# sourceMappingURL=formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/tempo/formatters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,wBAAwB,EACxB,YAAY,EACZ,SAAS,EACV,MAAM,YAAY,CAAC;AAkBpB;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CA8B3D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,wBAAwB,GAC/B,MAAM,CAsER;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAgB3D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAoB/D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAwBlD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAkBtD"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Response formatters for Tempo API responses
3
+ * Converts verbose API responses into concise, readable formats
4
+ */
5
+ /**
6
+ * Format time in seconds to human-readable format
7
+ */
8
+ function formatTimeSpent(seconds) {
9
+ const hours = Math.floor(seconds / 3600);
10
+ const minutes = Math.floor((seconds % 3600) / 60);
11
+ if (hours === 0) {
12
+ return `${minutes}m`;
13
+ }
14
+ else if (minutes === 0) {
15
+ return `${hours}h`;
16
+ }
17
+ else {
18
+ return `${hours}h ${minutes}m`;
19
+ }
20
+ }
21
+ /**
22
+ * Format a single worklog entry
23
+ */
24
+ export function formatWorklog(worklog) {
25
+ const lines = [];
26
+ lines.push(`# Worklog #${worklog.tempoWorklogId}`);
27
+ lines.push("");
28
+ lines.push("## Details");
29
+ lines.push(`- **Issue**: ${worklog.issue.key}`);
30
+ lines.push(`- **Time Spent**: ${formatTimeSpent(worklog.timeSpentSeconds)}`);
31
+ lines.push(`- **Billable**: ${formatTimeSpent(worklog.billableSeconds || 0)}`);
32
+ lines.push(`- **Date**: ${worklog.startDate}`);
33
+ lines.push(`- **Author**: ${worklog.author.displayName}`);
34
+ if (worklog.description) {
35
+ lines.push("");
36
+ lines.push("## Description");
37
+ lines.push(worklog.description);
38
+ }
39
+ if (worklog.attributes && worklog.attributes.length > 0) {
40
+ lines.push("");
41
+ lines.push("## Attributes");
42
+ worklog.attributes.forEach((attr) => {
43
+ lines.push(`- **${attr.key}**: ${attr.value}`);
44
+ });
45
+ }
46
+ return lines.join("\n");
47
+ }
48
+ /**
49
+ * Format worklog search results
50
+ */
51
+ export function formatWorklogSearchResults(result) {
52
+ const lines = [];
53
+ // Defensive: ensure metadata exists
54
+ const count = result.metadata?.count ?? result.results.length;
55
+ lines.push(`# Worklogs: ${count} found (showing ${result.results.length})`);
56
+ lines.push("");
57
+ if (result.results.length === 0) {
58
+ lines.push("No worklogs found.");
59
+ return lines.join("\n");
60
+ }
61
+ // Calculate totals
62
+ const totalSeconds = result.results.reduce((sum, wl) => sum + wl.timeSpentSeconds, 0);
63
+ const totalBillable = result.results.reduce((sum, wl) => sum + (wl.billableSeconds || 0), 0);
64
+ lines.push("## Summary");
65
+ lines.push(`- **Total Time**: ${formatTimeSpent(totalSeconds)}`);
66
+ lines.push(`- **Total Billable**: ${formatTimeSpent(totalBillable)}`);
67
+ lines.push("");
68
+ lines.push("💡 **Tip**: Use `tempo_get_worklog(worklogId: <ID>)` to see full details");
69
+ lines.push("");
70
+ // Group by date
71
+ const byDate = new Map();
72
+ result.results.forEach((wl) => {
73
+ const existing = byDate.get(wl.startDate) || [];
74
+ existing.push(wl);
75
+ byDate.set(wl.startDate, existing);
76
+ });
77
+ // Sort dates descending
78
+ const sortedDates = Array.from(byDate.keys()).sort().reverse();
79
+ sortedDates.forEach((date) => {
80
+ const worklogs = byDate.get(date);
81
+ const dayTotal = worklogs.reduce((sum, wl) => sum + wl.timeSpentSeconds, 0);
82
+ lines.push(`## ${date} (${formatTimeSpent(dayTotal)})`);
83
+ lines.push("");
84
+ worklogs.forEach((wl) => {
85
+ lines.push(`- **${wl.issue.key}** - ${formatTimeSpent(wl.timeSpentSeconds)} - ${wl.author.displayName}`);
86
+ if (wl.description) {
87
+ const shortDesc = wl.description.length > 80
88
+ ? wl.description.substring(0, 80) + "..."
89
+ : wl.description;
90
+ lines.push(` ${shortDesc}`);
91
+ }
92
+ });
93
+ lines.push("");
94
+ });
95
+ return lines.join("\n");
96
+ }
97
+ /**
98
+ * Format an account
99
+ */
100
+ export function formatAccount(account) {
101
+ const lines = [];
102
+ lines.push(`# ${account.name}`);
103
+ lines.push("");
104
+ lines.push("## Details");
105
+ lines.push(`- **Key**: ${account.key}`);
106
+ lines.push(`- **Status**: ${account.status}`);
107
+ lines.push(`- **Lead**: ${account.lead.displayName}`);
108
+ if (account.contact) {
109
+ lines.push(`- **Contact**: ${account.contact.displayName}`);
110
+ }
111
+ return lines.join("\n");
112
+ }
113
+ /**
114
+ * Format list of accounts
115
+ */
116
+ export function formatAccounts(accounts) {
117
+ const lines = [];
118
+ lines.push(`# Tempo Accounts (${accounts.length})`);
119
+ lines.push("");
120
+ if (accounts.length === 0) {
121
+ lines.push("No accounts found.");
122
+ return lines.join("\n");
123
+ }
124
+ accounts.forEach((account) => {
125
+ lines.push(`## ${account.key}: ${account.name} (${account.status.toLowerCase()})`);
126
+ lines.push(` Lead: ${account.lead.displayName}`);
127
+ lines.push("");
128
+ });
129
+ return lines.join("\n");
130
+ }
131
+ /**
132
+ * Format a team
133
+ */
134
+ export function formatTeam(team) {
135
+ const lines = [];
136
+ lines.push(`# ${team.name}`);
137
+ lines.push("");
138
+ lines.push("## Details");
139
+ lines.push(`- **Team ID**: ${team.id}`);
140
+ lines.push(`- **Lead**: ${team.lead.displayName}`);
141
+ lines.push(`- **Members**: ${team.members.length}`);
142
+ if (team.summary) {
143
+ lines.push("");
144
+ lines.push("## Summary");
145
+ lines.push(team.summary);
146
+ }
147
+ lines.push("");
148
+ lines.push("## Team Members");
149
+ team.members.forEach((member) => {
150
+ lines.push(`- ${member.displayName}`);
151
+ });
152
+ return lines.join("\n");
153
+ }
154
+ /**
155
+ * Format list of teams
156
+ */
157
+ export function formatTeams(teams) {
158
+ const lines = [];
159
+ lines.push(`# Tempo Teams (${teams.length})`);
160
+ lines.push("");
161
+ if (teams.length === 0) {
162
+ lines.push("No teams found.");
163
+ return lines.join("\n");
164
+ }
165
+ teams.forEach((team) => {
166
+ lines.push(`## ${team.name}`);
167
+ lines.push(` Lead: ${team.lead.displayName} | Members: ${team.members.length}`);
168
+ lines.push("");
169
+ });
170
+ return lines.join("\n");
171
+ }
172
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/tempo/formatters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;GAEG;AACH,SAAS,eAAe,CAAC,OAAe;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAElD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,GAAG,OAAO,GAAG,CAAC;IACvB,CAAC;SAAM,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,KAAK,GAAG,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,OAAO,GA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