@padua/cli 1.13.1 → 2.0.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.
- package/README.md +121 -6
- package/dist/commands/doctor/index.d.ts.map +1 -1
- package/dist/commands/doctor/index.js +85 -0
- package/dist/commands/doctor/index.js.map +1 -1
- package/dist/commands/doctor/mcp-checks.d.ts +36 -0
- package/dist/commands/doctor/mcp-checks.d.ts.map +1 -0
- package/dist/commands/doctor/mcp-checks.js +235 -0
- package/dist/commands/doctor/mcp-checks.js.map +1 -0
- package/dist/commands/doctor/mcp-service-checks.d.ts +35 -0
- package/dist/commands/doctor/mcp-service-checks.d.ts.map +1 -0
- package/dist/commands/doctor/mcp-service-checks.js +146 -0
- package/dist/commands/doctor/mcp-service-checks.js.map +1 -0
- package/dist/commands/doctor/types.d.ts +4 -1
- package/dist/commands/doctor/types.d.ts.map +1 -1
- package/dist/commands/doctor/types.js +1 -0
- package/dist/commands/doctor/types.js.map +1 -1
- package/dist/commands/login/index.d.ts +1 -1
- package/dist/commands/login/index.d.ts.map +1 -1
- package/dist/commands/login/index.js +44 -185
- package/dist/commands/login/index.js.map +1 -1
- package/dist/commands/login/mcp-steps.d.ts +38 -0
- package/dist/commands/login/mcp-steps.d.ts.map +1 -0
- package/dist/commands/login/mcp-steps.js +176 -0
- package/dist/commands/login/mcp-steps.js.map +1 -0
- package/dist/commands/login/orchestrator.d.ts +9 -0
- package/dist/commands/login/orchestrator.d.ts.map +1 -0
- package/dist/commands/login/orchestrator.js +251 -0
- package/dist/commands/login/orchestrator.js.map +1 -0
- package/dist/commands/login/types.d.ts +11 -0
- package/dist/commands/login/types.d.ts.map +1 -1
- package/dist/commands/login/types.js.map +1 -1
- package/dist/commands/status/aws-checks.d.ts +14 -0
- package/dist/commands/status/aws-checks.d.ts.map +1 -0
- package/dist/commands/status/aws-checks.js +145 -0
- package/dist/commands/status/aws-checks.js.map +1 -0
- package/dist/commands/status/checks.d.ts +9 -25
- package/dist/commands/status/checks.d.ts.map +1 -1
- package/dist/commands/status/checks.js +52 -254
- package/dist/commands/status/checks.js.map +1 -1
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +53 -1
- package/dist/commands/status/index.js.map +1 -1
- package/dist/commands/status/mcp-checks.d.ts +35 -0
- package/dist/commands/status/mcp-checks.d.ts.map +1 -0
- package/dist/commands/status/mcp-checks.js +175 -0
- package/dist/commands/status/mcp-checks.js.map +1 -0
- package/dist/commands/status/types.d.ts +34 -0
- package/dist/commands/status/types.d.ts.map +1 -1
- package/dist/mcp/config/index.d.ts +4 -0
- package/dist/mcp/config/index.d.ts.map +1 -0
- package/dist/mcp/config/index.js +14 -0
- package/dist/mcp/config/index.js.map +1 -0
- package/dist/mcp/config/loaders.d.ts +45 -0
- package/dist/mcp/config/loaders.d.ts.map +1 -0
- package/dist/mcp/config/loaders.js +149 -0
- package/dist/mcp/config/loaders.js.map +1 -0
- package/dist/mcp/config/types.d.ts +234 -0
- package/dist/mcp/config/types.d.ts.map +1 -0
- package/dist/mcp/config/types.js +45 -0
- package/dist/mcp/config/types.js.map +1 -0
- package/dist/mcp/daemon/entry-logic.d.ts +28 -0
- package/dist/mcp/daemon/entry-logic.d.ts.map +1 -0
- package/dist/mcp/daemon/entry-logic.js +82 -0
- package/dist/mcp/daemon/entry-logic.js.map +1 -0
- package/dist/mcp/daemon/entry.d.ts +8 -0
- package/dist/mcp/daemon/entry.d.ts.map +1 -0
- package/dist/mcp/daemon/entry.js +34 -0
- package/dist/mcp/daemon/entry.js.map +1 -0
- package/dist/mcp/daemon/fork.d.ts +21 -0
- package/dist/mcp/daemon/fork.d.ts.map +1 -0
- package/dist/mcp/daemon/fork.js +188 -0
- package/dist/mcp/daemon/fork.js.map +1 -0
- package/dist/mcp/daemon/health.d.ts +8 -0
- package/dist/mcp/daemon/health.d.ts.map +1 -0
- package/dist/mcp/daemon/health.js +50 -0
- package/dist/mcp/daemon/health.js.map +1 -0
- package/dist/mcp/daemon/index.d.ts +6 -0
- package/dist/mcp/daemon/index.d.ts.map +1 -0
- package/dist/mcp/daemon/index.js +22 -0
- package/dist/mcp/daemon/index.js.map +1 -0
- package/dist/mcp/daemon/types.d.ts +63 -0
- package/dist/mcp/daemon/types.d.ts.map +1 -0
- package/dist/mcp/daemon/types.js +18 -0
- package/dist/mcp/daemon/types.js.map +1 -0
- package/dist/mcp/errors/index.d.ts +3 -0
- package/dist/mcp/errors/index.d.ts.map +1 -0
- package/dist/mcp/errors/index.js +13 -0
- package/dist/mcp/errors/index.js.map +1 -0
- package/dist/mcp/errors/types.d.ts +83 -0
- package/dist/mcp/errors/types.d.ts.map +1 -0
- package/dist/mcp/errors/types.js +148 -0
- package/dist/mcp/errors/types.js.map +1 -0
- package/dist/mcp/providers/atlassian/auth.d.ts +34 -0
- package/dist/mcp/providers/atlassian/auth.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/auth.js +107 -0
- package/dist/mcp/providers/atlassian/auth.js.map +1 -0
- package/dist/mcp/providers/atlassian/client.d.ts +15 -0
- package/dist/mcp/providers/atlassian/client.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/client.js +38 -0
- package/dist/mcp/providers/atlassian/client.js.map +1 -0
- package/dist/mcp/providers/atlassian/index.d.ts +6 -0
- package/dist/mcp/providers/atlassian/index.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/index.js +11 -0
- package/dist/mcp/providers/atlassian/index.js.map +1 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/index.d.ts +17 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/index.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/index.js +29 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/index.js.map +1 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/nodes.d.ts +43 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/nodes.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/nodes.js +101 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/nodes.js.map +1 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/parser.d.ts +14 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/parser.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/parser.js +250 -0
- package/dist/mcp/providers/atlassian/markdown-to-adf/parser.js.map +1 -0
- package/dist/mcp/providers/atlassian/provider.d.ts +38 -0
- package/dist/mcp/providers/atlassian/provider.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/provider.js +101 -0
- package/dist/mcp/providers/atlassian/provider.js.map +1 -0
- package/dist/mcp/providers/atlassian/resources.d.ts +4 -0
- package/dist/mcp/providers/atlassian/resources.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/resources.js +67 -0
- package/dist/mcp/providers/atlassian/resources.js.map +1 -0
- package/dist/mcp/providers/atlassian/tools/confluence.d.ts +4 -0
- package/dist/mcp/providers/atlassian/tools/confluence.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/tools/confluence.js +169 -0
- package/dist/mcp/providers/atlassian/tools/confluence.js.map +1 -0
- package/dist/mcp/providers/atlassian/tools/jira.d.ts +4 -0
- package/dist/mcp/providers/atlassian/tools/jira.d.ts.map +1 -0
- package/dist/mcp/providers/atlassian/tools/jira.js +274 -0
- package/dist/mcp/providers/atlassian/tools/jira.js.map +1 -0
- package/dist/mcp/providers/gitlab/auth.d.ts +10 -0
- package/dist/mcp/providers/gitlab/auth.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/auth.js +23 -0
- package/dist/mcp/providers/gitlab/auth.js.map +1 -0
- package/dist/mcp/providers/gitlab/client.d.ts +23 -0
- package/dist/mcp/providers/gitlab/client.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/client.js +17 -0
- package/dist/mcp/providers/gitlab/client.js.map +1 -0
- package/dist/mcp/providers/gitlab/index.d.ts +5 -0
- package/dist/mcp/providers/gitlab/index.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/index.js +10 -0
- package/dist/mcp/providers/gitlab/index.js.map +1 -0
- package/dist/mcp/providers/gitlab/provider.d.ts +25 -0
- package/dist/mcp/providers/gitlab/provider.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/provider.js +48 -0
- package/dist/mcp/providers/gitlab/provider.js.map +1 -0
- package/dist/mcp/providers/gitlab/resources.d.ts +11 -0
- package/dist/mcp/providers/gitlab/resources.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/resources.js +54 -0
- package/dist/mcp/providers/gitlab/resources.js.map +1 -0
- package/dist/mcp/providers/gitlab/tools/issues.d.ts +4 -0
- package/dist/mcp/providers/gitlab/tools/issues.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/tools/issues.js +120 -0
- package/dist/mcp/providers/gitlab/tools/issues.js.map +1 -0
- package/dist/mcp/providers/gitlab/tools/merge-requests.d.ts +11 -0
- package/dist/mcp/providers/gitlab/tools/merge-requests.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/tools/merge-requests.js +282 -0
- package/dist/mcp/providers/gitlab/tools/merge-requests.js.map +1 -0
- package/dist/mcp/providers/gitlab/tools/pipelines.d.ts +10 -0
- package/dist/mcp/providers/gitlab/tools/pipelines.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/tools/pipelines.js +173 -0
- package/dist/mcp/providers/gitlab/tools/pipelines.js.map +1 -0
- package/dist/mcp/providers/gitlab/tools/repository.d.ts +4 -0
- package/dist/mcp/providers/gitlab/tools/repository.d.ts.map +1 -0
- package/dist/mcp/providers/gitlab/tools/repository.js +191 -0
- package/dist/mcp/providers/gitlab/tools/repository.js.map +1 -0
- package/dist/mcp/providers/index.d.ts +4 -0
- package/dist/mcp/providers/index.d.ts.map +1 -0
- package/dist/mcp/providers/index.js +6 -0
- package/dist/mcp/providers/index.js.map +1 -0
- package/dist/mcp/providers/registry.d.ts +90 -0
- package/dist/mcp/providers/registry.d.ts.map +1 -0
- package/dist/mcp/providers/registry.js +128 -0
- package/dist/mcp/providers/registry.js.map +1 -0
- package/dist/mcp/providers/tool-helpers.d.ts +14 -0
- package/dist/mcp/providers/tool-helpers.d.ts.map +1 -0
- package/dist/mcp/providers/tool-helpers.js +12 -0
- package/dist/mcp/providers/tool-helpers.js.map +1 -0
- package/dist/mcp/providers/types.d.ts +80 -0
- package/dist/mcp/providers/types.d.ts.map +1 -0
- package/dist/mcp/providers/types.js +13 -0
- package/dist/mcp/providers/types.js.map +1 -0
- package/dist/mcp/server/auth.d.ts +8 -0
- package/dist/mcp/server/auth.d.ts.map +1 -0
- package/dist/mcp/server/auth.js +36 -0
- package/dist/mcp/server/auth.js.map +1 -0
- package/dist/mcp/server/health.d.ts +24 -0
- package/dist/mcp/server/health.d.ts.map +1 -0
- package/dist/mcp/server/health.js +37 -0
- package/dist/mcp/server/health.js.map +1 -0
- package/dist/mcp/server/index.d.ts +11 -0
- package/dist/mcp/server/index.d.ts.map +1 -0
- package/dist/mcp/server/index.js +27 -0
- package/dist/mcp/server/index.js.map +1 -0
- package/dist/mcp/server/logging.d.ts +46 -0
- package/dist/mcp/server/logging.d.ts.map +1 -0
- package/dist/mcp/server/logging.js +109 -0
- package/dist/mcp/server/logging.js.map +1 -0
- package/dist/mcp/server/ratelimit.d.ts +3 -0
- package/dist/mcp/server/ratelimit.d.ts.map +1 -0
- package/dist/mcp/server/ratelimit.js +70 -0
- package/dist/mcp/server/ratelimit.js.map +1 -0
- package/dist/mcp/server/routes.d.ts +3 -0
- package/dist/mcp/server/routes.d.ts.map +1 -0
- package/dist/mcp/server/routes.js +8 -0
- package/dist/mcp/server/routes.js.map +1 -0
- package/dist/mcp/server/server.d.ts +21 -0
- package/dist/mcp/server/server.d.ts.map +1 -0
- package/dist/mcp/server/server.js +114 -0
- package/dist/mcp/server/server.js.map +1 -0
- package/dist/mcp/server/validation.d.ts +22 -0
- package/dist/mcp/server/validation.d.ts.map +1 -0
- package/dist/mcp/server/validation.js +32 -0
- package/dist/mcp/server/validation.js.map +1 -0
- package/dist/mcp/store/encrypt.d.ts +22 -0
- package/dist/mcp/store/encrypt.d.ts.map +1 -0
- package/dist/mcp/store/encrypt.js +66 -0
- package/dist/mcp/store/encrypt.js.map +1 -0
- package/dist/mcp/store/index.d.ts +12 -0
- package/dist/mcp/store/index.d.ts.map +1 -0
- package/dist/mcp/store/index.js +16 -0
- package/dist/mcp/store/index.js.map +1 -0
- package/dist/mcp/store/migrate.d.ts +70 -0
- package/dist/mcp/store/migrate.d.ts.map +1 -0
- package/dist/mcp/store/migrate.js +211 -0
- package/dist/mcp/store/migrate.js.map +1 -0
- package/dist/mcp/store/null-token-store.d.ts +22 -0
- package/dist/mcp/store/null-token-store.d.ts.map +1 -0
- package/dist/mcp/store/null-token-store.js +40 -0
- package/dist/mcp/store/null-token-store.js.map +1 -0
- package/dist/mcp/store/sqlite.d.ts +27 -0
- package/dist/mcp/store/sqlite.d.ts.map +1 -0
- package/dist/mcp/store/sqlite.js +100 -0
- package/dist/mcp/store/sqlite.js.map +1 -0
- package/dist/mcp/store/types.d.ts +183 -0
- package/dist/mcp/store/types.d.ts.map +1 -0
- package/dist/mcp/store/types.js +13 -0
- package/dist/mcp/store/types.js.map +1 -0
- package/dist/mcp/token/http-client.d.ts +3 -0
- package/dist/mcp/token/http-client.d.ts.map +1 -0
- package/dist/mcp/token/http-client.js +186 -0
- package/dist/mcp/token/http-client.js.map +1 -0
- package/dist/mcp/token/index.d.ts +5 -0
- package/dist/mcp/token/index.d.ts.map +1 -0
- package/dist/mcp/token/index.js +15 -0
- package/dist/mcp/token/index.js.map +1 -0
- package/dist/mcp/token/manager.d.ts +54 -0
- package/dist/mcp/token/manager.d.ts.map +1 -0
- package/dist/mcp/token/manager.js +194 -0
- package/dist/mcp/token/manager.js.map +1 -0
- package/dist/mcp/token/null-token-manager.d.ts +19 -0
- package/dist/mcp/token/null-token-manager.d.ts.map +1 -0
- package/dist/mcp/token/null-token-manager.js +50 -0
- package/dist/mcp/token/null-token-manager.js.map +1 -0
- package/dist/mcp/token/oauth.d.ts +44 -0
- package/dist/mcp/token/oauth.d.ts.map +1 -0
- package/dist/mcp/token/oauth.js +257 -0
- package/dist/mcp/token/oauth.js.map +1 -0
- package/dist/mcp/token/types.d.ts +81 -0
- package/dist/mcp/token/types.d.ts.map +1 -0
- package/dist/mcp/token/types.js +6 -0
- package/dist/mcp/token/types.js.map +1 -0
- package/package.json +10 -3
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error hierarchy for the MCP server integration.
|
|
4
|
+
*
|
|
5
|
+
* All errors extend PaduaError so callers can catch at different granularities.
|
|
6
|
+
* Token redaction is applied to every message at construction time to prevent
|
|
7
|
+
* credential exposure in logs and error reporting pipelines.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ErrorCodes = exports.ProviderError = exports.ValidationError = exports.DaemonError = exports.AuthError = exports.StoreError = exports.PaduaError = void 0;
|
|
11
|
+
exports.redactTokens = redactTokens;
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Token redaction utility
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/**
|
|
16
|
+
* Replaces credential-like patterns in a message string with [REDACTED].
|
|
17
|
+
*
|
|
18
|
+
* Patterns covered:
|
|
19
|
+
* - Bearer <token> in Authorization headers
|
|
20
|
+
* - access_token / refresh_token / accessToken / refreshToken in JSON or query strings
|
|
21
|
+
* - Hex strings longer than 20 characters (encryption keys, nonces)
|
|
22
|
+
* - Base64-like strings longer than 30 characters (JWT segments, encoded secrets)
|
|
23
|
+
*/
|
|
24
|
+
function redactTokens(message) {
|
|
25
|
+
let result = message;
|
|
26
|
+
// Bearer tokens in Authorization headers
|
|
27
|
+
result = result.replace(/Bearer\s+[A-Za-z0-9\-._~+/]+=*/g, 'Bearer [REDACTED]');
|
|
28
|
+
// token fields in JSON ("access_token": "value") or query strings (accessToken=value)
|
|
29
|
+
result = result.replace(/(access_token|refresh_token|accessToken|refreshToken)["']?\s*[:=]\s*["']?[A-Za-z0-9\-._~+/]+=*/g, '$1=[REDACTED]');
|
|
30
|
+
// Standalone hex strings longer than 20 characters
|
|
31
|
+
result = result.replace(/\b[0-9a-fA-F]{21,}\b/g, '[REDACTED]');
|
|
32
|
+
// Base64-like strings (JWT segments or encoded secrets) longer than 30 characters
|
|
33
|
+
// Matches base64url alphabet — minimum 31 chars to avoid false positives on
|
|
34
|
+
// common words that happen to be alphanumeric
|
|
35
|
+
result = result.replace(/[A-Za-z0-9\-_+/]{31,}={0,2}/g, '[REDACTED]');
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Base error class
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
/**
|
|
42
|
+
* Base error for all Padua MCP operations.
|
|
43
|
+
* Carries a machine-readable code alongside the human-readable message.
|
|
44
|
+
* Messages are token-redacted at construction time.
|
|
45
|
+
*/
|
|
46
|
+
class PaduaError extends Error {
|
|
47
|
+
code;
|
|
48
|
+
constructor(message, code) {
|
|
49
|
+
super(redactTokens(message));
|
|
50
|
+
this.code = code;
|
|
51
|
+
this.name = 'PaduaError';
|
|
52
|
+
// Required for correct prototype chain in CommonJS (tsc target ES2022 + module commonjs)
|
|
53
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.PaduaError = PaduaError;
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Domain-specific subclasses
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
/** Errors originating from the encrypted SQLite token store. */
|
|
61
|
+
class StoreError extends PaduaError {
|
|
62
|
+
constructor(message, code) {
|
|
63
|
+
super(message, code);
|
|
64
|
+
this.name = 'StoreError';
|
|
65
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.StoreError = StoreError;
|
|
69
|
+
/** Errors originating from OAuth flows and token lifecycle management. */
|
|
70
|
+
class AuthError extends PaduaError {
|
|
71
|
+
constructor(message, code) {
|
|
72
|
+
super(message, code);
|
|
73
|
+
this.name = 'AuthError';
|
|
74
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.AuthError = AuthError;
|
|
78
|
+
/** Errors originating from the background daemon process lifecycle. */
|
|
79
|
+
class DaemonError extends PaduaError {
|
|
80
|
+
constructor(message, code) {
|
|
81
|
+
super(message, code);
|
|
82
|
+
this.name = 'DaemonError';
|
|
83
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.DaemonError = DaemonError;
|
|
87
|
+
/** Errors originating from config or input validation failures. */
|
|
88
|
+
class ValidationError extends PaduaError {
|
|
89
|
+
constructor(message, code) {
|
|
90
|
+
super(message, code);
|
|
91
|
+
this.name = 'ValidationError';
|
|
92
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.ValidationError = ValidationError;
|
|
96
|
+
/**
|
|
97
|
+
* Errors originating from a specific provider (GitLab, Atlassian).
|
|
98
|
+
* The `provider` property identifies which provider produced the error.
|
|
99
|
+
*/
|
|
100
|
+
class ProviderError extends PaduaError {
|
|
101
|
+
provider;
|
|
102
|
+
constructor(message, code, provider) {
|
|
103
|
+
super(message, code);
|
|
104
|
+
this.provider = provider;
|
|
105
|
+
this.name = 'ProviderError';
|
|
106
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.ProviderError = ProviderError;
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
// ErrorCodes catalog
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
/**
|
|
114
|
+
* Exhaustive catalog of machine-readable error codes used throughout the MCP
|
|
115
|
+
* server integration. Every error instantiation must use one of these constants.
|
|
116
|
+
*
|
|
117
|
+
* Grouped by the error subclass that typically throws them.
|
|
118
|
+
*/
|
|
119
|
+
exports.ErrorCodes = {
|
|
120
|
+
// StoreError — encrypted SQLite token store
|
|
121
|
+
ENCRYPTION_KEY_UNAVAILABLE: 'ENCRYPTION_KEY_UNAVAILABLE',
|
|
122
|
+
TOKEN_DECRYPTION_FAILED: 'TOKEN_DECRYPTION_FAILED',
|
|
123
|
+
DB_OPEN_FAILED: 'DB_OPEN_FAILED',
|
|
124
|
+
DB_WRITE_FAILED: 'DB_WRITE_FAILED',
|
|
125
|
+
// AuthError — OAuth flows and token lifecycle
|
|
126
|
+
CALLBACK_PORT_IN_USE: 'CALLBACK_PORT_IN_USE',
|
|
127
|
+
OAUTH_CALLBACK_ERROR: 'OAUTH_CALLBACK_ERROR',
|
|
128
|
+
OAUTH_STATE_EXPIRED: 'OAUTH_STATE_EXPIRED',
|
|
129
|
+
OAUTH_CALLBACK_TIMEOUT: 'OAUTH_CALLBACK_TIMEOUT',
|
|
130
|
+
OAUTH_CODE_EXCHANGE_FAILED: 'OAUTH_CODE_EXCHANGE_FAILED',
|
|
131
|
+
TOKEN_REFRESH_FAILED: 'TOKEN_REFRESH_FAILED',
|
|
132
|
+
CIRCUIT_BREAKER_OPEN: 'CIRCUIT_BREAKER_OPEN',
|
|
133
|
+
// DaemonError — background daemon process lifecycle
|
|
134
|
+
DAEMON_START_TIMEOUT: 'DAEMON_START_TIMEOUT',
|
|
135
|
+
DAEMON_ALREADY_RUNNING: 'DAEMON_ALREADY_RUNNING',
|
|
136
|
+
DAEMON_STALE_PID: 'DAEMON_STALE_PID',
|
|
137
|
+
DAEMON_HEALTH_FAILED: 'DAEMON_HEALTH_FAILED',
|
|
138
|
+
DAEMON_PORT_IN_USE: 'DAEMON_PORT_IN_USE',
|
|
139
|
+
// ValidationError — config and input validation
|
|
140
|
+
INVALID_CONFIG: 'INVALID_CONFIG',
|
|
141
|
+
MARKDOWN_TOO_LARGE: 'MARKDOWN_TOO_LARGE',
|
|
142
|
+
// ProviderError — GitLab and Atlassian API calls
|
|
143
|
+
API_TIMEOUT: 'API_TIMEOUT',
|
|
144
|
+
API_RATE_LIMITED: 'API_RATE_LIMITED',
|
|
145
|
+
API_UNAUTHORIZED: 'API_UNAUTHORIZED',
|
|
146
|
+
CLOUD_ID_RESOLUTION_FAILED: 'CLOUD_ID_RESOLUTION_FAILED',
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/mcp/errors/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAeH,oCAqBC;AAlCD,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAAC,OAAe;IAC1C,IAAI,MAAM,GAAG,OAAO,CAAC;IAErB,yCAAyC;IACzC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,iCAAiC,EAAE,mBAAmB,CAAC,CAAC;IAEhF,sFAAsF;IACtF,MAAM,GAAG,MAAM,CAAC,OAAO,CACrB,iGAAiG,EACjG,eAAe,CAChB,CAAC;IAEF,mDAAmD;IACnD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC;IAE/D,kFAAkF;IAClF,4EAA4E;IAC5E,8CAA8C;IAC9C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,8BAA8B,EAAE,YAAY,CAAC,CAAC;IAEtE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;GAIG;AACH,MAAa,UAAW,SAAQ,KAAK;IAC1B,IAAI,CAAS;IAEtB,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,C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B,EAAE,kBAAkB;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,0BAA0B,EAAE,4BAA4B;CAChD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atlassian-specific OAuth config factory and Cloud ID resolver.
|
|
3
|
+
*
|
|
4
|
+
* Atlassian uses a confidential client flow: clientSecret is included and
|
|
5
|
+
* PKCE is disabled. Cloud ID is resolved via the accessible-resources endpoint
|
|
6
|
+
* before the full token manager is wired.
|
|
7
|
+
*/
|
|
8
|
+
import type { OAuthConfig } from '../../token/types';
|
|
9
|
+
import type { AtlassianProviderConfig } from '../../config/types';
|
|
10
|
+
/**
|
|
11
|
+
* Build the OAuthConfig for an Atlassian provider.
|
|
12
|
+
*
|
|
13
|
+
* Atlassian uses a confidential client — clientSecret is included and
|
|
14
|
+
* usePKCE is false. The audience and prompt params are required by Atlassian.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createAtlassianOAuthConfig(config: AtlassianProviderConfig): OAuthConfig;
|
|
17
|
+
export interface CloudResource {
|
|
18
|
+
id: string;
|
|
19
|
+
url: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the Atlassian Cloud ID by calling the accessible-resources endpoint.
|
|
24
|
+
* Returns the first accessible resource (most users have exactly one).
|
|
25
|
+
*
|
|
26
|
+
* Uses node:https directly — called during provider init before TokenManager
|
|
27
|
+
* is fully wired.
|
|
28
|
+
*
|
|
29
|
+
* @param accessToken - Valid OAuth2 access token
|
|
30
|
+
* @returns Cloud resource with id, url, name
|
|
31
|
+
* @throws ProviderError(CLOUD_ID_RESOLUTION_FAILED) if no resources found or request fails
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveCloudId(accessToken: string): Promise<CloudResource>;
|
|
34
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/mcp/providers/atlassian/auth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAgBlE;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,uBAAuB,GAAG,WAAW,CAevF;AAMD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAqChF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Atlassian-specific OAuth config factory and Cloud ID resolver.
|
|
4
|
+
*
|
|
5
|
+
* Atlassian uses a confidential client flow: clientSecret is included and
|
|
6
|
+
* PKCE is disabled. Cloud ID is resolved via the accessible-resources endpoint
|
|
7
|
+
* before the full token manager is wired.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createAtlassianOAuthConfig = createAtlassianOAuthConfig;
|
|
11
|
+
exports.resolveCloudId = resolveCloudId;
|
|
12
|
+
const node_https_1 = require("node:https");
|
|
13
|
+
const errors_1 = require("../../errors");
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Constants
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
const AUTH_URL = 'https://auth.atlassian.com/authorize';
|
|
18
|
+
const TOKEN_URL = 'https://auth.atlassian.com/oauth/token';
|
|
19
|
+
const DEFAULT_REDIRECT_PORT = 18081;
|
|
20
|
+
const ACCESSIBLE_RESOURCES_URL = 'https://api.atlassian.com/oauth/token/accessible-resources';
|
|
21
|
+
const PROVIDER = 'atlassian';
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// OAuthConfig factory
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
/**
|
|
26
|
+
* Build the OAuthConfig for an Atlassian provider.
|
|
27
|
+
*
|
|
28
|
+
* Atlassian uses a confidential client — clientSecret is included and
|
|
29
|
+
* usePKCE is false. The audience and prompt params are required by Atlassian.
|
|
30
|
+
*/
|
|
31
|
+
function createAtlassianOAuthConfig(config) {
|
|
32
|
+
const redirectPort = config.redirectPort ?? DEFAULT_REDIRECT_PORT;
|
|
33
|
+
return {
|
|
34
|
+
clientId: config.clientId,
|
|
35
|
+
clientSecret: config.clientSecret,
|
|
36
|
+
authUrl: AUTH_URL,
|
|
37
|
+
tokenUrl: TOKEN_URL,
|
|
38
|
+
redirectUri: `http://localhost:${redirectPort}/callback/atlassian`,
|
|
39
|
+
scopes: config.scopes,
|
|
40
|
+
usePKCE: false,
|
|
41
|
+
additionalAuthParams: {
|
|
42
|
+
audience: 'api.atlassian.com',
|
|
43
|
+
prompt: 'consent',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Cloud ID resolver
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the Atlassian Cloud ID by calling the accessible-resources endpoint.
|
|
52
|
+
* Returns the first accessible resource (most users have exactly one).
|
|
53
|
+
*
|
|
54
|
+
* Uses node:https directly — called during provider init before TokenManager
|
|
55
|
+
* is fully wired.
|
|
56
|
+
*
|
|
57
|
+
* @param accessToken - Valid OAuth2 access token
|
|
58
|
+
* @returns Cloud resource with id, url, name
|
|
59
|
+
* @throws ProviderError(CLOUD_ID_RESOLUTION_FAILED) if no resources found or request fails
|
|
60
|
+
*/
|
|
61
|
+
async function resolveCloudId(accessToken) {
|
|
62
|
+
const url = new URL(ACCESSIBLE_RESOURCES_URL);
|
|
63
|
+
const reqOptions = {
|
|
64
|
+
hostname: url.hostname,
|
|
65
|
+
port: 443,
|
|
66
|
+
path: url.pathname,
|
|
67
|
+
method: 'GET',
|
|
68
|
+
headers: {
|
|
69
|
+
Authorization: `Bearer ${accessToken}`,
|
|
70
|
+
Accept: 'application/json',
|
|
71
|
+
'User-Agent': 'padua-cli',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
const req = (0, node_https_1.request)(reqOptions, (res) => {
|
|
76
|
+
const chunks = [];
|
|
77
|
+
res.on('data', (chunk) => chunks.push(chunk));
|
|
78
|
+
res.on('end', () => {
|
|
79
|
+
const raw = Buffer.concat(chunks).toString('utf8');
|
|
80
|
+
handleResourcesResponse(raw, resolve, reject);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
req.on('error', (err) => {
|
|
84
|
+
reject(new errors_1.ProviderError(`Cloud ID resolution request failed: ${err.message}`, errors_1.ErrorCodes.CLOUD_ID_RESOLUTION_FAILED, PROVIDER));
|
|
85
|
+
});
|
|
86
|
+
req.end();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Internal helpers
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
function handleResourcesResponse(raw, resolve, reject) {
|
|
93
|
+
let resources;
|
|
94
|
+
try {
|
|
95
|
+
resources = JSON.parse(raw);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
reject(new errors_1.ProviderError('Cloud ID resolution returned invalid JSON', errors_1.ErrorCodes.CLOUD_ID_RESOLUTION_FAILED, PROVIDER));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!Array.isArray(resources) || resources.length === 0) {
|
|
102
|
+
reject(new errors_1.ProviderError('No accessible Atlassian Cloud resources found', errors_1.ErrorCodes.CLOUD_ID_RESOLUTION_FAILED, PROVIDER));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
resolve(resources[0]);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/mcp/providers/atlassian/auth.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA2BH,gEAeC;AA2BD,wCAqCC;AAxGD,2CAAqD;AACrD,yCAAyD;AAIzD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,QAAQ,GAAG,sCAAsC,CAAC;AACxD,MAAM,SAAS,GAAG,wCAAwC,CAAC;AAC3D,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,wBAAwB,GAAG,4DAA4D,CAAC;AAC9F,MAAM,QAAQ,GAAG,WAAW,CAAC;AAE7B,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,MAA+B;IACxE,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,qBAAqB,CAAC;IAClE,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,SAAS;QACnB,WAAW,EAAE,oBAAoB,YAAY,qBAAqB;QAClE,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,KAAK;QACd,oBAAoB,EAAE;YACpB,QAAQ,EAAE,mBAAmB;YAC7B,MAAM,EAAE,SAAS;SAClB;KACF,CAAC;AACJ,CAAC;AAYD,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACI,KAAK,UAAU,cAAc,CAAC,WAAmB;IACtD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAE9C,MAAM,UAAU,GAAG;QACjB,QAAQ,EAAE,GAAG,CAAC,QAAQ;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AI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CACJ,IAAI,sBAAa,CACf,2CAA2C,EAC3C,mBAAU,CAAC,0BAA0B,EACrC,QAAQ,CACT,CACF,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxD,MAAM,CACJ,IAAI,sBAAa,CACf,+CAA+C,EAC/C,mBAAU,CAAC,0BAA0B,EACrC,QAAQ,CACT,CACF,CAAC;QACF,OAAO;IACT,CAAC;IAED,OAAO,CAAC,SAAS,CAAC,CAAC,CAAkB,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ApiResponse, TokenManager } from '../../token/types';
|
|
2
|
+
export interface AtlassianClient {
|
|
3
|
+
jiraGet<T = unknown>(path: string, params?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
4
|
+
jiraPost<T = unknown>(path: string, body?: unknown): Promise<ApiResponse<T>>;
|
|
5
|
+
jiraPut<T = unknown>(path: string, body?: unknown): Promise<ApiResponse<T>>;
|
|
6
|
+
jiraDelete<T = unknown>(path: string): Promise<ApiResponse<T>>;
|
|
7
|
+
confluenceGet<T = unknown>(path: string, params?: Record<string, string>): Promise<ApiResponse<T>>;
|
|
8
|
+
confluencePost<T = unknown>(path: string, body?: unknown): Promise<ApiResponse<T>>;
|
|
9
|
+
confluencePut<T = unknown>(path: string, body?: unknown): Promise<ApiResponse<T>>;
|
|
10
|
+
confluenceDelete<T = unknown>(path: string): Promise<ApiResponse<T>>;
|
|
11
|
+
jiraGetAllPages<T = unknown>(path: string, params?: Record<string, string>): Promise<T[]>;
|
|
12
|
+
confluenceGetAllPages<T = unknown>(path: string, params?: Record<string, string>): Promise<T[]>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createAtlassianClient(cloudId: string, tokenManager: TokenManager): AtlassianClient;
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/mcp/providers/atlassian/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAK9E,MAAM,WAAW,eAAe;IAE9B,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAG/D,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnG,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnF,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAGrE,eAAe,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1F,qBAAqB,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACjG;AAsCD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,eAAe,CAelG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAtlassianClient = createAtlassianClient;
|
|
4
|
+
const http_client_1 = require("../../token/http-client");
|
|
5
|
+
const ATLASSIAN_API_BASE = 'https://api.atlassian.com';
|
|
6
|
+
function buildJiraBaseUrl(cloudId) {
|
|
7
|
+
return `${ATLASSIAN_API_BASE}/ex/jira/${cloudId}/rest/api/3`;
|
|
8
|
+
}
|
|
9
|
+
function buildConfluenceBaseUrl(cloudId) {
|
|
10
|
+
return `${ATLASSIAN_API_BASE}/ex/confluence/${cloudId}/rest/api`;
|
|
11
|
+
}
|
|
12
|
+
function wrapJiraClient(client) {
|
|
13
|
+
return {
|
|
14
|
+
jiraGet: (path, params) => client.get(path, params),
|
|
15
|
+
jiraPost: (path, body) => client.post(path, body),
|
|
16
|
+
jiraPut: (path, body) => client.put(path, body),
|
|
17
|
+
jiraDelete: (path) => client.delete(path),
|
|
18
|
+
jiraGetAllPages: (path, params) => client.getAllPages(path, params),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function wrapConfluenceClient(client) {
|
|
22
|
+
return {
|
|
23
|
+
confluenceGet: (path, params) => client.get(path, params),
|
|
24
|
+
confluencePost: (path, body) => client.post(path, body),
|
|
25
|
+
confluencePut: (path, body) => client.put(path, body),
|
|
26
|
+
confluenceDelete: (path) => client.delete(path),
|
|
27
|
+
confluenceGetAllPages: (path, params) => client.getAllPages(path, params),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function createAtlassianClient(cloudId, tokenManager) {
|
|
31
|
+
const jiraClient = (0, http_client_1.createApiClient)({ baseUrl: buildJiraBaseUrl(cloudId) }, tokenManager);
|
|
32
|
+
const confluenceClient = (0, http_client_1.createApiClient)({ baseUrl: buildConfluenceBaseUrl(cloudId) }, tokenManager);
|
|
33
|
+
return {
|
|
34
|
+
...wrapJiraClient(jiraClient),
|
|
35
|
+
...wrapConfluenceClient(confluenceClient),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/mcp/providers/atlassian/client.ts"],"names":[],"mappings":";;AA2DA,sDAeC;AAzED,yDAA0D;AAE1D,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAoBvD,SAAS,gBAAgB,CAAC,OAAe;IACvC,OAAO,GAAG,kBAAkB,YAAY,OAAO,aAAa,CAAC;AAC/D,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAe;IAC7C,OAAO,GAAG,kBAAkB,kBAAkB,OAAO,WAAW,CAAC;AACnE,CAAC;AAED,SAAS,cAAc,CAAC,MAAiB;IAIvC,OAAO;QACL,OAAO,EAAE,CAAI,IAAY,EAAE,MAA+B,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAI,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M,gBAAgB,GAAG,IAAA,6BAAe,EACtC,EAAE,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAAE,EAC5C,YAAY,CACb,CAAC;IAEF,OAAO;QACL,GAAG,cAAc,CAAC,UAAU,CAAC;QAC7B,GAAG,oBAAoB,CAAC,gBAAgB,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AtlassianProvider } from './provider';
|
|
2
|
+
export { createAtlassianOAuthConfig, resolveCloudId } from './auth';
|
|
3
|
+
export type { CloudResource } from './auth';
|
|
4
|
+
export { createAtlassianClient } from './client';
|
|
5
|
+
export type { AtlassianClient } from './client';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp/providers/atlassian/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAtlassianClient = exports.resolveCloudId = exports.createAtlassianOAuthConfig = exports.AtlassianProvider = void 0;
|
|
4
|
+
var provider_1 = require("./provider");
|
|
5
|
+
Object.defineProperty(exports, "AtlassianProvider", { enumerable: true, get: function () { return provider_1.AtlassianProvider; } });
|
|
6
|
+
var auth_1 = require("./auth");
|
|
7
|
+
Object.defineProperty(exports, "createAtlassianOAuthConfig", { enumerable: true, get: function () { return auth_1.createAtlassianOAuthConfig; } });
|
|
8
|
+
Object.defineProperty(exports, "resolveCloudId", { enumerable: true, get: function () { return auth_1.resolveCloudId; } });
|
|
9
|
+
var client_1 = require("./client");
|
|
10
|
+
Object.defineProperty(exports, "createAtlassianClient", { enumerable: true, get: function () { return client_1.createAtlassianClient; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mcp/providers/atlassian/index.ts"],"names":[],"mappings":";;;AAAA,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAC1B,+BAAoE;AAA3D,kHAAA,0BAA0B,OAAA;AAAE,sGAAA,cAAc,OAAA;AAEnD,mCAAiD;AAAxC,+GAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API for the markdown-to-ADF converter.
|
|
3
|
+
*
|
|
4
|
+
* Validates input size then delegates to parseBlocks for the actual parsing.
|
|
5
|
+
* The 500KB limit prevents memory exhaustion from pathologically large inputs.
|
|
6
|
+
*/
|
|
7
|
+
import type { AdfDocument } from './nodes';
|
|
8
|
+
export type { AdfDocument, AdfNode, AdfMark } from './nodes';
|
|
9
|
+
/**
|
|
10
|
+
* Convert markdown to Atlassian Document Format (ADF).
|
|
11
|
+
*
|
|
12
|
+
* @param markdown - Input markdown string
|
|
13
|
+
* @returns ADF document
|
|
14
|
+
* @throws ValidationError(MARKDOWN_TOO_LARGE) if input exceeds 500 KB
|
|
15
|
+
*/
|
|
16
|
+
export declare function markdownToAdf(markdown: string): AdfDocument;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/providers/atlassian/markdown-to-adf/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAI7D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAW3D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Public API for the markdown-to-ADF converter.
|
|
4
|
+
*
|
|
5
|
+
* Validates input size then delegates to parseBlocks for the actual parsing.
|
|
6
|
+
* The 500KB limit prevents memory exhaustion from pathologically large inputs.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.markdownToAdf = markdownToAdf;
|
|
10
|
+
const parser_1 = require("./parser");
|
|
11
|
+
const nodes_1 = require("./nodes");
|
|
12
|
+
const errors_1 = require("../../../errors");
|
|
13
|
+
const MAX_INPUT_BYTES = 524_288; // 500 KB
|
|
14
|
+
/**
|
|
15
|
+
* Convert markdown to Atlassian Document Format (ADF).
|
|
16
|
+
*
|
|
17
|
+
* @param markdown - Input markdown string
|
|
18
|
+
* @returns ADF document
|
|
19
|
+
* @throws ValidationError(MARKDOWN_TOO_LARGE) if input exceeds 500 KB
|
|
20
|
+
*/
|
|
21
|
+
function markdownToAdf(markdown) {
|
|
22
|
+
const byteLength = Buffer.byteLength(markdown, 'utf-8');
|
|
23
|
+
if (byteLength > MAX_INPUT_BYTES) {
|
|
24
|
+
throw new errors_1.ValidationError(`Markdown input too large: ${byteLength} bytes exceeds ${MAX_INPUT_BYTES} byte limit`, errors_1.ErrorCodes.MARKDOWN_TOO_LARGE);
|
|
25
|
+
}
|
|
26
|
+
const content = (0, parser_1.parseBlocks)(markdown);
|
|
27
|
+
return (0, nodes_1.doc)(content);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/mcp/providers/atlassian/markdown-to-adf/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAkBH,sCAWC;AA3BD,qCAAuC;AACvC,mCAA8B;AAE9B,4CAA8D;AAI9D,MAAM,eAAe,GAAG,OAAO,CAAC,CAAC,SAAS;AAE1C;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,QAAgB;IAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxD,IAAI,UAAU,GAAG,eAAe,EAAE,CAAC;QACjC,MAAM,IAAI,wBAAe,CACvB,6BAA6B,UAAU,kBAAkB,eAAe,aAAa,EACrF,mBAAU,CAAC,kBAAkB,CAC9B,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,oBAAW,EAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,IAAA,WAAG,EAAC,OAAO,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADF type definitions and factory functions.
|
|
3
|
+
*
|
|
4
|
+
* Each function creates a single ADF node or mark object.
|
|
5
|
+
* Factory functions keep construction consistent and make the
|
|
6
|
+
* rest of the converter read like a grammar.
|
|
7
|
+
*/
|
|
8
|
+
export interface AdfNode {
|
|
9
|
+
type: string;
|
|
10
|
+
attrs?: Record<string, unknown>;
|
|
11
|
+
content?: AdfNode[];
|
|
12
|
+
marks?: AdfMark[];
|
|
13
|
+
text?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AdfMark {
|
|
16
|
+
type: string;
|
|
17
|
+
attrs?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
export interface AdfDocument {
|
|
20
|
+
version: 1;
|
|
21
|
+
type: 'doc';
|
|
22
|
+
content: AdfNode[];
|
|
23
|
+
}
|
|
24
|
+
export declare function doc(content: AdfNode[]): AdfDocument;
|
|
25
|
+
export declare function heading(level: number, content: AdfNode[]): AdfNode;
|
|
26
|
+
export declare function paragraph(content: AdfNode[]): AdfNode;
|
|
27
|
+
export declare function codeBlock(language: string | null, content: AdfNode[]): AdfNode;
|
|
28
|
+
export declare function bulletList(items: AdfNode[]): AdfNode;
|
|
29
|
+
export declare function orderedList(items: AdfNode[]): AdfNode;
|
|
30
|
+
export declare function listItem(content: AdfNode[]): AdfNode;
|
|
31
|
+
export declare function blockquote(content: AdfNode[]): AdfNode;
|
|
32
|
+
export declare function table(rows: AdfNode[]): AdfNode;
|
|
33
|
+
export declare function tableRow(cells: AdfNode[]): AdfNode;
|
|
34
|
+
export declare function tableHeader(content: AdfNode[]): AdfNode;
|
|
35
|
+
export declare function tableCell(content: AdfNode[]): AdfNode;
|
|
36
|
+
export declare function hardBreak(): AdfNode;
|
|
37
|
+
export declare function text(value: string, marks?: AdfMark[]): AdfNode;
|
|
38
|
+
export declare function strong(): AdfMark;
|
|
39
|
+
export declare function em(): AdfMark;
|
|
40
|
+
export declare function code(): AdfMark;
|
|
41
|
+
export declare function link(href: string): AdfMark;
|
|
42
|
+
export declare function strike(): AdfMark;
|
|
43
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/providers/atlassian/markdown-to-adf/nodes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,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IAAI,OAAO,CAE9B;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1C;AAED,wBAAgB,MAAM,IAAI,OAAO,CAEhC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ADF type definitions and factory functions.
|
|
4
|
+
*
|
|
5
|
+
* Each function creates a single ADF node or mark object.
|
|
6
|
+
* Factory functions keep construction consistent and make the
|
|
7
|
+
* rest of the converter read like a grammar.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.doc = doc;
|
|
11
|
+
exports.heading = heading;
|
|
12
|
+
exports.paragraph = paragraph;
|
|
13
|
+
exports.codeBlock = codeBlock;
|
|
14
|
+
exports.bulletList = bulletList;
|
|
15
|
+
exports.orderedList = orderedList;
|
|
16
|
+
exports.listItem = listItem;
|
|
17
|
+
exports.blockquote = blockquote;
|
|
18
|
+
exports.table = table;
|
|
19
|
+
exports.tableRow = tableRow;
|
|
20
|
+
exports.tableHeader = tableHeader;
|
|
21
|
+
exports.tableCell = tableCell;
|
|
22
|
+
exports.hardBreak = hardBreak;
|
|
23
|
+
exports.text = text;
|
|
24
|
+
exports.strong = strong;
|
|
25
|
+
exports.em = em;
|
|
26
|
+
exports.code = code;
|
|
27
|
+
exports.link = link;
|
|
28
|
+
exports.strike = strike;
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Block node factories
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
function doc(content) {
|
|
33
|
+
return { version: 1, type: 'doc', content };
|
|
34
|
+
}
|
|
35
|
+
function heading(level, content) {
|
|
36
|
+
return { type: 'heading', attrs: { level }, content };
|
|
37
|
+
}
|
|
38
|
+
function paragraph(content) {
|
|
39
|
+
return { type: 'paragraph', content };
|
|
40
|
+
}
|
|
41
|
+
function codeBlock(language, content) {
|
|
42
|
+
const node = { type: 'codeBlock', content };
|
|
43
|
+
if (language)
|
|
44
|
+
node.attrs = { language };
|
|
45
|
+
return node;
|
|
46
|
+
}
|
|
47
|
+
function bulletList(items) {
|
|
48
|
+
return { type: 'bulletList', content: items };
|
|
49
|
+
}
|
|
50
|
+
function orderedList(items) {
|
|
51
|
+
return { type: 'orderedList', content: items };
|
|
52
|
+
}
|
|
53
|
+
function listItem(content) {
|
|
54
|
+
return { type: 'listItem', content };
|
|
55
|
+
}
|
|
56
|
+
function blockquote(content) {
|
|
57
|
+
return { type: 'blockquote', content };
|
|
58
|
+
}
|
|
59
|
+
function table(rows) {
|
|
60
|
+
return { type: 'table', content: rows };
|
|
61
|
+
}
|
|
62
|
+
function tableRow(cells) {
|
|
63
|
+
return { type: 'tableRow', content: cells };
|
|
64
|
+
}
|
|
65
|
+
function tableHeader(content) {
|
|
66
|
+
return { type: 'tableHeader', content };
|
|
67
|
+
}
|
|
68
|
+
function tableCell(content) {
|
|
69
|
+
return { type: 'tableCell', content };
|
|
70
|
+
}
|
|
71
|
+
function hardBreak() {
|
|
72
|
+
return { type: 'hardBreak' };
|
|
73
|
+
}
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// Inline text node factory
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
function text(value, marks) {
|
|
78
|
+
const node = { type: 'text', text: value };
|
|
79
|
+
if (marks && marks.length > 0)
|
|
80
|
+
node.marks = marks;
|
|
81
|
+
return node;
|
|
82
|
+
}
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
// Mark factories
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
function strong() {
|
|
87
|
+
return { type: 'strong' };
|
|
88
|
+
}
|
|
89
|
+
function em() {
|
|
90
|
+
return { type: 'em' };
|
|
91
|
+
}
|
|
92
|
+
function code() {
|
|
93
|
+
return { type: 'code' };
|
|
94
|
+
}
|
|
95
|
+
function link(href) {
|
|
96
|
+
return { type: 'link', attrs: { href } };
|
|
97
|
+
}
|
|
98
|
+
function strike() {
|
|
99
|
+
return { type: 'strike' };
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../../../../src/mcp/providers/atlassian/markdown-to-adf/nodes.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA6BH,kBAEC;AAED,0BAEC;AAED,8BAEC;AAED,8BAIC;AAED,gCAEC;AAED,kCAEC;AAED,4BAEC;AAED,gCAEC;AAED,sBAEC;AAED,4BAEC;AAED,kCAEC;AAED,8BAEC;AAED,8BAEC;AAMD,oBAIC;AAMD,wBAEC;AAED,gBAEC;AAED,oBAEC;AAED,oBAEC;AAED,wBAEC;AA1FD,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E,SAAgB,GAAG,CAAC,OAAkB;IACpC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC9C,CAAC;AAED,SAAgB,OAAO,CAAC,KAAa,EAAE,OAAkB;IACvD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC;AACxD,CAAC;AAED,SAAgB,SAAS,CAAC,OAAkB;IAC1C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC;AAED,SAAgB,SAAS,CAAC,QAAuB,EAAE,OAAkB;IACnE,MAAM,IAAI,GAAY,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;IACrD,IAAI,QAAQ;QAAE,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,CAAC;IACxC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,UAAU,CAAC,KAAgB;IACzC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,C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AM;IACpB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED,SAAgB,EAAE;IAChB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC;AAED,SAAgB,IAAI;IAClB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC;AAED,SAAgB,IAAI,CAAC,IAAY;IAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;AAC3C,CAAC;AAED,SAAgB,MAAM;IACpB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block-level and inline markdown parsers.
|
|
3
|
+
*
|
|
4
|
+
* parseBlocks: Walks lines top-down, dispatching to individual block parsers.
|
|
5
|
+
* parseInline: Position-based scanner that handles nested inline marks.
|
|
6
|
+
*
|
|
7
|
+
* Each parser returns the ADF node(s) produced and the number of lines consumed,
|
|
8
|
+
* making it easy for parseBlocks to advance the cursor correctly.
|
|
9
|
+
*/
|
|
10
|
+
import type { AdfNode, AdfMark } from './nodes';
|
|
11
|
+
export declare function parseBlocks(markdown: string): AdfNode[];
|
|
12
|
+
export declare function parseInline(input: string): AdfNode[];
|
|
13
|
+
export type { AdfNode, AdfMark };
|
|
14
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/providers/atlassian/markdown-to-adf/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAuHhD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,EAAE,CA4DvD;AA0CD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CA0BpD;AAMD,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
|