ultra-jira-mcp 2.1.2
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/LICENSE +21 -0
- package/README.md +167 -0
- package/build/auth/jira-client.d.ts +59 -0
- package/build/auth/jira-client.d.ts.map +1 -0
- package/build/auth/jira-client.js +267 -0
- package/build/auth/jira-client.js.map +1 -0
- package/build/cli/direct.d.ts +5 -0
- package/build/cli/direct.d.ts.map +1 -0
- package/build/cli/direct.js +47 -0
- package/build/cli/direct.js.map +1 -0
- package/build/cli/index.d.ts +3 -0
- package/build/cli/index.d.ts.map +1 -0
- package/build/cli/index.js +27 -0
- package/build/cli/index.js.map +1 -0
- package/build/cli/install-skill.d.ts +10 -0
- package/build/cli/install-skill.d.ts.map +1 -0
- package/build/cli/install-skill.js +100 -0
- package/build/cli/install-skill.js.map +1 -0
- package/build/codeapi/boot.d.ts +16 -0
- package/build/codeapi/boot.d.ts.map +1 -0
- package/build/codeapi/boot.js +53 -0
- package/build/codeapi/boot.js.map +1 -0
- package/build/codeapi/bridge.d.ts +15 -0
- package/build/codeapi/bridge.d.ts.map +1 -0
- package/build/codeapi/bridge.js +59 -0
- package/build/codeapi/bridge.js.map +1 -0
- package/build/codeapi/generator.d.ts +22 -0
- package/build/codeapi/generator.d.ts.map +1 -0
- package/build/codeapi/generator.js +106 -0
- package/build/codeapi/generator.js.map +1 -0
- package/build/codeapi/templates.d.ts +17 -0
- package/build/codeapi/templates.d.ts.map +1 -0
- package/build/codeapi/templates.js +296 -0
- package/build/codeapi/templates.js.map +1 -0
- package/build/codeapi/tool.d.ts +6 -0
- package/build/codeapi/tool.d.ts.map +1 -0
- package/build/codeapi/tool.js +66 -0
- package/build/codeapi/tool.js.map +1 -0
- package/build/config.d.ts +18 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +124 -0
- package/build/config.js.map +1 -0
- package/build/core/adf.d.ts +14 -0
- package/build/core/adf.d.ts.map +1 -0
- package/build/core/adf.js +289 -0
- package/build/core/adf.js.map +1 -0
- package/build/core/attachments.d.ts +28 -0
- package/build/core/attachments.d.ts.map +1 -0
- package/build/core/attachments.js +150 -0
- package/build/core/attachments.js.map +1 -0
- package/build/core/http.d.ts +24 -0
- package/build/core/http.d.ts.map +1 -0
- package/build/core/http.js +110 -0
- package/build/core/http.js.map +1 -0
- package/build/core/lru.d.ts +18 -0
- package/build/core/lru.d.ts.map +1 -0
- package/build/core/lru.js +57 -0
- package/build/core/lru.js.map +1 -0
- package/build/core/manifest.d.ts +19 -0
- package/build/core/manifest.d.ts.map +1 -0
- package/build/core/manifest.js +99 -0
- package/build/core/manifest.js.map +1 -0
- package/build/core/operations.d.ts +3 -0
- package/build/core/operations.d.ts.map +1 -0
- package/build/core/operations.js +1028 -0
- package/build/core/operations.js.map +1 -0
- package/build/core/sandbox.d.ts +9 -0
- package/build/core/sandbox.d.ts.map +1 -0
- package/build/core/sandbox.js +17 -0
- package/build/core/sandbox.js.map +1 -0
- package/build/core/tenant-cache.d.ts +4 -0
- package/build/core/tenant-cache.d.ts.map +1 -0
- package/build/core/tenant-cache.js +53 -0
- package/build/core/tenant-cache.js.map +1 -0
- package/build/core/trim-registry.d.ts +15 -0
- package/build/core/trim-registry.d.ts.map +1 -0
- package/build/core/trim-registry.js +25 -0
- package/build/core/trim-registry.js.map +1 -0
- package/build/core/trim.d.ts +105 -0
- package/build/core/trim.d.ts.map +1 -0
- package/build/core/trim.js +147 -0
- package/build/core/trim.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +161 -0
- package/build/index.js.map +1 -0
- package/build/resources/index.d.ts +21 -0
- package/build/resources/index.d.ts.map +1 -0
- package/build/resources/index.js +99 -0
- package/build/resources/index.js.map +1 -0
- package/build/tools/attachments.d.ts +27 -0
- package/build/tools/attachments.d.ts.map +1 -0
- package/build/tools/attachments.js +98 -0
- package/build/tools/attachments.js.map +1 -0
- package/build/tools/boards.d.ts +205 -0
- package/build/tools/boards.d.ts.map +1 -0
- package/build/tools/boards.js +308 -0
- package/build/tools/boards.js.map +1 -0
- package/build/tools/comments.d.ts +134 -0
- package/build/tools/comments.d.ts.map +1 -0
- package/build/tools/comments.js +207 -0
- package/build/tools/comments.js.map +1 -0
- package/build/tools/epics.d.ts +107 -0
- package/build/tools/epics.d.ts.map +1 -0
- package/build/tools/epics.js +139 -0
- package/build/tools/epics.js.map +1 -0
- package/build/tools/fields.d.ts +59 -0
- package/build/tools/fields.d.ts.map +1 -0
- package/build/tools/fields.js +134 -0
- package/build/tools/fields.js.map +1 -0
- package/build/tools/filters.d.ts +233 -0
- package/build/tools/filters.d.ts.map +1 -0
- package/build/tools/filters.js +273 -0
- package/build/tools/filters.js.map +1 -0
- package/build/tools/groups.d.ts +109 -0
- package/build/tools/groups.d.ts.map +1 -0
- package/build/tools/groups.js +146 -0
- package/build/tools/groups.js.map +1 -0
- package/build/tools/index.d.ts +23 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +138 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/issue-links.d.ts +61 -0
- package/build/tools/issue-links.d.ts.map +1 -0
- package/build/tools/issue-links.js +139 -0
- package/build/tools/issue-links.js.map +1 -0
- package/build/tools/issues.d.ts +421 -0
- package/build/tools/issues.d.ts.map +1 -0
- package/build/tools/issues.js +479 -0
- package/build/tools/issues.js.map +1 -0
- package/build/tools/projects.d.ts +353 -0
- package/build/tools/projects.d.ts.map +1 -0
- package/build/tools/projects.js +457 -0
- package/build/tools/projects.js.map +1 -0
- package/build/tools/search.d.ts +60 -0
- package/build/tools/search.d.ts.map +1 -0
- package/build/tools/search.js +103 -0
- package/build/tools/search.js.map +1 -0
- package/build/tools/server.d.ts +12 -0
- package/build/tools/server.d.ts.map +1 -0
- package/build/tools/server.js +23 -0
- package/build/tools/server.js.map +1 -0
- package/build/tools/sprints.d.ts +269 -0
- package/build/tools/sprints.d.ts.map +1 -0
- package/build/tools/sprints.js +318 -0
- package/build/tools/sprints.js.map +1 -0
- package/build/tools/users.d.ts +134 -0
- package/build/tools/users.d.ts.map +1 -0
- package/build/tools/users.js +183 -0
- package/build/tools/users.js.map +1 -0
- package/build/tools/v2/attachment.d.ts +3 -0
- package/build/tools/v2/attachment.d.ts.map +1 -0
- package/build/tools/v2/attachment.js +25 -0
- package/build/tools/v2/attachment.js.map +1 -0
- package/build/tools/v2/board.d.ts +3 -0
- package/build/tools/v2/board.d.ts.map +1 -0
- package/build/tools/v2/board.js +64 -0
- package/build/tools/v2/board.js.map +1 -0
- package/build/tools/v2/comment.d.ts +3 -0
- package/build/tools/v2/comment.d.ts.map +1 -0
- package/build/tools/v2/comment.js +41 -0
- package/build/tools/v2/comment.js.map +1 -0
- package/build/tools/v2/dispatcher.d.ts +19 -0
- package/build/tools/v2/dispatcher.d.ts.map +1 -0
- package/build/tools/v2/dispatcher.js +255 -0
- package/build/tools/v2/dispatcher.js.map +1 -0
- package/build/tools/v2/epic.d.ts +3 -0
- package/build/tools/v2/epic.d.ts.map +1 -0
- package/build/tools/v2/epic.js +34 -0
- package/build/tools/v2/epic.js.map +1 -0
- package/build/tools/v2/field.d.ts +3 -0
- package/build/tools/v2/field.d.ts.map +1 -0
- package/build/tools/v2/field.js +26 -0
- package/build/tools/v2/field.js.map +1 -0
- package/build/tools/v2/filter.d.ts +3 -0
- package/build/tools/v2/filter.d.ts.map +1 -0
- package/build/tools/v2/filter.js +55 -0
- package/build/tools/v2/filter.js.map +1 -0
- package/build/tools/v2/group.d.ts +3 -0
- package/build/tools/v2/group.d.ts.map +1 -0
- package/build/tools/v2/group.js +40 -0
- package/build/tools/v2/group.js.map +1 -0
- package/build/tools/v2/index.d.ts +16 -0
- package/build/tools/v2/index.d.ts.map +1 -0
- package/build/tools/v2/index.js +121 -0
- package/build/tools/v2/index.js.map +1 -0
- package/build/tools/v2/issue.d.ts +3 -0
- package/build/tools/v2/issue.d.ts.map +1 -0
- package/build/tools/v2/issue.js +78 -0
- package/build/tools/v2/issue.js.map +1 -0
- package/build/tools/v2/link.d.ts +3 -0
- package/build/tools/v2/link.d.ts.map +1 -0
- package/build/tools/v2/link.js +29 -0
- package/build/tools/v2/link.js.map +1 -0
- package/build/tools/v2/project.d.ts +3 -0
- package/build/tools/v2/project.d.ts.map +1 -0
- package/build/tools/v2/project.js +101 -0
- package/build/tools/v2/project.js.map +1 -0
- package/build/tools/v2/search.d.ts +3 -0
- package/build/tools/v2/search.d.ts.map +1 -0
- package/build/tools/v2/search.js +43 -0
- package/build/tools/v2/search.js.map +1 -0
- package/build/tools/v2/server.d.ts +3 -0
- package/build/tools/v2/server.d.ts.map +1 -0
- package/build/tools/v2/server.js +13 -0
- package/build/tools/v2/server.js.map +1 -0
- package/build/tools/v2/sprint.d.ts +3 -0
- package/build/tools/v2/sprint.d.ts.map +1 -0
- package/build/tools/v2/sprint.js +67 -0
- package/build/tools/v2/sprint.js.map +1 -0
- package/build/tools/v2/user.d.ts +3 -0
- package/build/tools/v2/user.d.ts.map +1 -0
- package/build/tools/v2/user.js +48 -0
- package/build/tools/v2/user.js.map +1 -0
- package/build/tools/v2/watcher.d.ts +3 -0
- package/build/tools/v2/watcher.d.ts.map +1 -0
- package/build/tools/v2/watcher.js +31 -0
- package/build/tools/v2/watcher.js.map +1 -0
- package/build/tools/v2/worklog.d.ts +3 -0
- package/build/tools/v2/worklog.d.ts.map +1 -0
- package/build/tools/v2/worklog.js +55 -0
- package/build/tools/v2/worklog.js.map +1 -0
- package/build/tools/watchers.d.ts +35 -0
- package/build/tools/watchers.d.ts.map +1 -0
- package/build/tools/watchers.js +156 -0
- package/build/tools/watchers.js.map +1 -0
- package/build/tools/worklogs.d.ts +167 -0
- package/build/tools/worklogs.d.ts.map +1 -0
- package/build/tools/worklogs.js +266 -0
- package/build/tools/worklogs.js.map +1 -0
- package/build/types/jira.d.ts +337 -0
- package/build/types/jira.d.ts.map +1 -0
- package/build/types/jira.js +3 -0
- package/build/types/jira.js.map +1 -0
- package/build/types/refs.d.ts +14 -0
- package/build/types/refs.d.ts.map +1 -0
- package/build/types/refs.js +10 -0
- package/build/types/refs.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// Pure string templates for the code-api generator.
|
|
2
|
+
//
|
|
3
|
+
// Each function takes structured input and returns the literal `.ts`
|
|
4
|
+
// source emitted to disk. Keeping these pure (no fs, no manifest
|
|
5
|
+
// import) makes the generator easy to golden-test and lets the
|
|
6
|
+
// generator orchestrate path layout independently.
|
|
7
|
+
//
|
|
8
|
+
// Stubs are consumed by `tsx` (or `node --import tsx/esm`) in the
|
|
9
|
+
// agent's execution environment. They use `.js` import specifiers so
|
|
10
|
+
// they work under Node16 ESM resolution after compilation, and tsx
|
|
11
|
+
// resolves them transparently for direct .ts execution.
|
|
12
|
+
import { extractPathParams, } from "../core/manifest.js";
|
|
13
|
+
// Marker placed at the top of every generated file. Tests assert on
|
|
14
|
+
// it; humans see it and know not to hand-edit.
|
|
15
|
+
export const GENERATED_BANNER = `// AUTO-GENERATED by jira-mcp Layer 3 code-api generator. Do not edit by hand.\n// Source of truth: src/core/operations.ts (manifest entries).`;
|
|
16
|
+
// --- Name helpers ------------------------------------------------------
|
|
17
|
+
// "issue.get" → { category: "issue", verb: "get" }. The manifest's
|
|
18
|
+
// dot-separated naming is load-bearing here: the generator splits on
|
|
19
|
+
// the *first* dot only, so a hypothetical "issue.foo.bar" would land
|
|
20
|
+
// at issue/foo.bar.ts (we don't have any such names today).
|
|
21
|
+
export function splitOperationName(opName) {
|
|
22
|
+
const dot = opName.indexOf(".");
|
|
23
|
+
if (dot < 0) {
|
|
24
|
+
throw new Error(`Operation name must be 'category.verb', got: ${opName}`);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
category: opName.slice(0, dot),
|
|
28
|
+
verb: opName.slice(dot + 1),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// JS reserved words (and a couple of soft-reserved names) that would
|
|
32
|
+
// be syntax errors as parameter names. None of the current Jira params
|
|
33
|
+
// hit these, but we sanitize defensively so a future manifest entry
|
|
34
|
+
// can't break codegen silently.
|
|
35
|
+
const RESERVED = new Set([
|
|
36
|
+
"default",
|
|
37
|
+
"delete",
|
|
38
|
+
"function",
|
|
39
|
+
"class",
|
|
40
|
+
"const",
|
|
41
|
+
"let",
|
|
42
|
+
"var",
|
|
43
|
+
"return",
|
|
44
|
+
"import",
|
|
45
|
+
"export",
|
|
46
|
+
"new",
|
|
47
|
+
"typeof",
|
|
48
|
+
"instanceof",
|
|
49
|
+
"in",
|
|
50
|
+
"of",
|
|
51
|
+
"this",
|
|
52
|
+
"super",
|
|
53
|
+
"void",
|
|
54
|
+
"null",
|
|
55
|
+
"true",
|
|
56
|
+
"false",
|
|
57
|
+
]);
|
|
58
|
+
export function safeIdentifier(name) {
|
|
59
|
+
if (RESERVED.has(name))
|
|
60
|
+
return `${name}_`;
|
|
61
|
+
return name;
|
|
62
|
+
}
|
|
63
|
+
// --- Per-operation rendering ------------------------------------------
|
|
64
|
+
// Map a ParamSpec to a TS type literal. The manifest is stringly
|
|
65
|
+
// typed by design (PR #6) — we only know role + required, not the
|
|
66
|
+
// underlying TS shape. So path/query params are `string | number`
|
|
67
|
+
// (most common scalar shapes Jira accepts in URLs) and body params
|
|
68
|
+
// are `unknown` (callers pass arbitrary JSON-shaped values).
|
|
69
|
+
function paramType(spec) {
|
|
70
|
+
switch (spec.role) {
|
|
71
|
+
case "path":
|
|
72
|
+
return "string | number";
|
|
73
|
+
case "query":
|
|
74
|
+
// Arrays are flattened to comma-separated strings by the
|
|
75
|
+
// dispatcher (see manifest.ts), so accept either shape here.
|
|
76
|
+
return "string | number | boolean | Array<string | number>";
|
|
77
|
+
case "body":
|
|
78
|
+
return "unknown";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Emit a single operation's stub. One file per operation, exporting
|
|
82
|
+
// one function whose name matches the verb portion of the operation
|
|
83
|
+
// name. Uses an args object (rather than positional params) so the
|
|
84
|
+
// signature stays stable as the manifest evolves.
|
|
85
|
+
export function renderStub(op) {
|
|
86
|
+
const { category, verb } = splitOperationName(op.name);
|
|
87
|
+
const fnName = safeIdentifier(verb);
|
|
88
|
+
// Path params are always required even if the manifest doesn't say
|
|
89
|
+
// so explicitly — a missing path param produces a runtime error in
|
|
90
|
+
// interpolatePath. Mark them required in the TS type to surface
|
|
91
|
+
// that constraint at edit time.
|
|
92
|
+
const pathNames = new Set(extractPathParams(op.pathTemplate));
|
|
93
|
+
// Sort: required first (to match how callers usually write object
|
|
94
|
+
// literals), then by role (path → query → body), then by name for
|
|
95
|
+
// deterministic output across regenerations.
|
|
96
|
+
const sorted = [...op.params].sort((a, b) => {
|
|
97
|
+
const reqA = a.required || pathNames.has(a.name) ? 0 : 1;
|
|
98
|
+
const reqB = b.required || pathNames.has(b.name) ? 0 : 1;
|
|
99
|
+
if (reqA !== reqB)
|
|
100
|
+
return reqA - reqB;
|
|
101
|
+
const roleOrder = { path: 0, query: 1, body: 2 };
|
|
102
|
+
if (roleOrder[a.role] !== roleOrder[b.role]) {
|
|
103
|
+
return roleOrder[a.role] - roleOrder[b.role];
|
|
104
|
+
}
|
|
105
|
+
return a.name.localeCompare(b.name);
|
|
106
|
+
});
|
|
107
|
+
const fields = sorted.map((p) => {
|
|
108
|
+
const required = p.required || pathNames.has(p.name);
|
|
109
|
+
const optional = required ? "" : "?";
|
|
110
|
+
const desc = p.description ? ` // ${p.role}: ${p.description}` : ` // ${p.role}`;
|
|
111
|
+
return ` ${safeIdentifier(p.name)}${optional}: ${paramType(p)};${desc}`;
|
|
112
|
+
});
|
|
113
|
+
// Args interface name: e.g. "issue.get" → "IssueGetArgs".
|
|
114
|
+
const argsTypeName = `${capitalize(category)}${capitalize(verb)}Args`;
|
|
115
|
+
const hasParams = fields.length > 0;
|
|
116
|
+
const argsBlock = hasParams
|
|
117
|
+
? `export interface ${argsTypeName} {\n${fields.join("\n")}\n}\n\n`
|
|
118
|
+
: "";
|
|
119
|
+
const argsParam = hasParams ? `args: ${argsTypeName}` : "args: Record<string, never> = {}";
|
|
120
|
+
const passArgs = hasParams ? "args" : "{}";
|
|
121
|
+
const trimNote = op.trim
|
|
122
|
+
? `\n * Response is trimmed via the '${op.trim}' projection — see src/core/trim.ts.`
|
|
123
|
+
: "";
|
|
124
|
+
const agileNote = op.isAgile ? "\n * (Agile API endpoint.)" : "";
|
|
125
|
+
const body = `${GENERATED_BANNER}\n\n` +
|
|
126
|
+
`import { invoke } from "../_client.js";\n` +
|
|
127
|
+
`import type { Ref } from "../types.js";\n\n` +
|
|
128
|
+
argsBlock +
|
|
129
|
+
`/**\n` +
|
|
130
|
+
` * ${op.description}\n` +
|
|
131
|
+
` *\n` +
|
|
132
|
+
` * Operation: ${op.name} (${op.verb} ${op.pathTemplate})${agileNote}${trimNote}\n` +
|
|
133
|
+
` */\n` +
|
|
134
|
+
`export function ${fnName}(${argsParam}): Promise<Ref<unknown>> {\n` +
|
|
135
|
+
` return invoke(${JSON.stringify(op.name)}, ${passArgs});\n` +
|
|
136
|
+
`}\n`;
|
|
137
|
+
return {
|
|
138
|
+
relativePath: `${category}/${verb}.ts`,
|
|
139
|
+
contents: body,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function capitalize(s) {
|
|
143
|
+
return s.length === 0 ? s : s[0].toUpperCase() + s.slice(1);
|
|
144
|
+
}
|
|
145
|
+
// --- Per-category index ------------------------------------------------
|
|
146
|
+
// Re-exports every stub in a category as a named export, so callers
|
|
147
|
+
// can write either:
|
|
148
|
+
// import { get } from ".../api/issue/get.js"
|
|
149
|
+
// import * as issue from ".../api/issue/index.js"; issue.get(...)
|
|
150
|
+
export function renderCategoryIndex(category, operations) {
|
|
151
|
+
const lines = operations
|
|
152
|
+
.map((op) => splitOperationName(op.name).verb)
|
|
153
|
+
.sort()
|
|
154
|
+
.map((verb) => `export { ${safeIdentifier(verb)} } from "./${verb}.js";`);
|
|
155
|
+
return `${GENERATED_BANNER}\n\n${lines.join("\n")}\n`;
|
|
156
|
+
}
|
|
157
|
+
// --- Top-level index ---------------------------------------------------
|
|
158
|
+
// Emits namespace re-exports keyed by category, so the agent can
|
|
159
|
+
// import the whole API surface in one line:
|
|
160
|
+
// import * as jira from ".../api/index.js"
|
|
161
|
+
// await jira.issue.get({ issueIdOrKey: "PROJ-1" })
|
|
162
|
+
export function renderRootIndex(categories) {
|
|
163
|
+
const lines = [...categories]
|
|
164
|
+
.sort()
|
|
165
|
+
.map((cat) => `export * as ${safeIdentifier(cat)} from "./${cat}/index.js";`);
|
|
166
|
+
return `${GENERATED_BANNER}\n\n${lines.join("\n")}\n`;
|
|
167
|
+
}
|
|
168
|
+
// --- Static support files ----------------------------------------------
|
|
169
|
+
// types.ts — inlines the Ref / SandboxResult shape directly so the
|
|
170
|
+
// generated API has no dependency on the host install layout. Earlier
|
|
171
|
+
// versions re-exported these from the running jira-mcp build via an
|
|
172
|
+
// absolute path embedded at generate time, which forced runtime
|
|
173
|
+
// codegen. Inlining lets us ship a static api/ directory in the
|
|
174
|
+
// package and skip generation per session.
|
|
175
|
+
//
|
|
176
|
+
// Keep this in sync with src/types/refs.ts. The shapes are simple
|
|
177
|
+
// (5 primitive fields) and rarely change; a generator test asserts
|
|
178
|
+
// the inlined shape stays compatible.
|
|
179
|
+
export function renderTypesFile() {
|
|
180
|
+
return (`${GENERATED_BANNER}\n\n` +
|
|
181
|
+
`// Inlined from src/types/refs.ts. Self-contained so generated\n` +
|
|
182
|
+
`// stubs work in any execution context without resolving back to\n` +
|
|
183
|
+
`// the jira-mcp install.\n` +
|
|
184
|
+
`export interface SandboxResult<TSummary> {\n` +
|
|
185
|
+
` summary: TSummary;\n` +
|
|
186
|
+
` ref: string;\n` +
|
|
187
|
+
` hash: string;\n` +
|
|
188
|
+
` fullSize: number;\n` +
|
|
189
|
+
` fetchedAt: string;\n` +
|
|
190
|
+
`}\n\n` +
|
|
191
|
+
`export type Ref<TSummary> = SandboxResult<TSummary>;\n`);
|
|
192
|
+
}
|
|
193
|
+
// _client.ts — connects to the jira-mcp bridge over a local socket
|
|
194
|
+
// and forwards each `invoke()` call as a single ND-JSON request.
|
|
195
|
+
//
|
|
196
|
+
// Wire format is documented in src/codeapi/bridge.ts. The client
|
|
197
|
+
// opens a fresh connection per call: simpler than pooling, and each
|
|
198
|
+
// call's latency is dominated by the Jira HTTP round-trip on the
|
|
199
|
+
// server side, not the local socket setup.
|
|
200
|
+
//
|
|
201
|
+
// Address discovery: reads `JIRA_MCP_SOCKET` from the environment.
|
|
202
|
+
// PR #10 will set this when the MCP server spawns the agent's
|
|
203
|
+
// execution context. Two formats supported:
|
|
204
|
+
//
|
|
205
|
+
// - "/abs/path/to/ipc.sock" — Unix domain socket (POSIX)
|
|
206
|
+
// - "tcp:127.0.0.1:54321" — loopback TCP (Windows)
|
|
207
|
+
export function renderClientFile() {
|
|
208
|
+
return (`${GENERATED_BANNER}\n\n` +
|
|
209
|
+
`// Bridge client for the jira-mcp Layer 3 code-api.\n` +
|
|
210
|
+
`// Connects to the bridge server over a local socket per call.\n\n` +
|
|
211
|
+
`import { connect, type Socket } from "node:net";\n` +
|
|
212
|
+
`import type { Ref } from "./types.js";\n\n` +
|
|
213
|
+
`const SOCKET_ENV = "JIRA_MCP_SOCKET";\n\n` +
|
|
214
|
+
`interface BridgeOk { id: string; result: Ref<unknown> }\n` +
|
|
215
|
+
`interface BridgeErr { id: string; error: { name: string; message: string } }\n` +
|
|
216
|
+
`type BridgeResponse = BridgeOk | BridgeErr;\n\n` +
|
|
217
|
+
`function resolveSocket(): { path?: string; host?: string; port?: number } {\n` +
|
|
218
|
+
` const raw = process.env[SOCKET_ENV];\n` +
|
|
219
|
+
` if (!raw) {\n` +
|
|
220
|
+
` throw new Error(\n` +
|
|
221
|
+
` \`jira-mcp bridge address not set: \${SOCKET_ENV} env var missing. \` +\n` +
|
|
222
|
+
` \`Was this stub called outside the MCP server's execution context?\`,\n` +
|
|
223
|
+
` );\n` +
|
|
224
|
+
` }\n` +
|
|
225
|
+
` if (raw.startsWith("tcp:")) {\n` +
|
|
226
|
+
` const lastColon = raw.lastIndexOf(":");\n` +
|
|
227
|
+
` const host = raw.slice(4, lastColon);\n` +
|
|
228
|
+
` const port = Number(raw.slice(lastColon + 1));\n` +
|
|
229
|
+
` if (!host || !Number.isFinite(port)) {\n` +
|
|
230
|
+
` throw new Error(\`Malformed \${SOCKET_ENV}: \${raw}\`);\n` +
|
|
231
|
+
` }\n` +
|
|
232
|
+
` return { host, port };\n` +
|
|
233
|
+
` }\n` +
|
|
234
|
+
` return { path: raw };\n` +
|
|
235
|
+
`}\n\n` +
|
|
236
|
+
`let nextId = 0;\n\n` +
|
|
237
|
+
`export function invoke(\n` +
|
|
238
|
+
` operation: string,\n` +
|
|
239
|
+
` args: Record<string, unknown>,\n` +
|
|
240
|
+
`): Promise<Ref<unknown>> {\n` +
|
|
241
|
+
` const id = String(++nextId);\n` +
|
|
242
|
+
` return new Promise<Ref<unknown>>((resolve, reject) => {\n` +
|
|
243
|
+
` let target: { path?: string; host?: string; port?: number };\n` +
|
|
244
|
+
` try {\n` +
|
|
245
|
+
` target = resolveSocket();\n` +
|
|
246
|
+
` } catch (err) {\n` +
|
|
247
|
+
` reject(err);\n` +
|
|
248
|
+
` return;\n` +
|
|
249
|
+
` }\n` +
|
|
250
|
+
` const socket: Socket = connect(target as never);\n` +
|
|
251
|
+
` socket.setEncoding("utf8");\n` +
|
|
252
|
+
` let buffer = "";\n` +
|
|
253
|
+
` let settled = false;\n` +
|
|
254
|
+
` const settle = (fn: () => void) => {\n` +
|
|
255
|
+
` if (settled) return;\n` +
|
|
256
|
+
` settled = true;\n` +
|
|
257
|
+
` socket.end();\n` +
|
|
258
|
+
` fn();\n` +
|
|
259
|
+
` };\n` +
|
|
260
|
+
` socket.on("connect", () => {\n` +
|
|
261
|
+
` socket.write(\n` +
|
|
262
|
+
` JSON.stringify({ id, method: "invoke", params: { operation, args } }) + "\\n",\n` +
|
|
263
|
+
` );\n` +
|
|
264
|
+
` });\n` +
|
|
265
|
+
` socket.on("data", (chunk: string) => {\n` +
|
|
266
|
+
` buffer += chunk;\n` +
|
|
267
|
+
` const nl = buffer.indexOf("\\n");\n` +
|
|
268
|
+
` if (nl < 0) return;\n` +
|
|
269
|
+
` const line = buffer.slice(0, nl);\n` +
|
|
270
|
+
` let resp: BridgeResponse;\n` +
|
|
271
|
+
` try {\n` +
|
|
272
|
+
` resp = JSON.parse(line);\n` +
|
|
273
|
+
` } catch (err) {\n` +
|
|
274
|
+
` settle(() => reject(err));\n` +
|
|
275
|
+
` return;\n` +
|
|
276
|
+
` }\n` +
|
|
277
|
+
` if ("error" in resp) {\n` +
|
|
278
|
+
` const e = new Error(resp.error.message);\n` +
|
|
279
|
+
` e.name = resp.error.name;\n` +
|
|
280
|
+
` settle(() => reject(e));\n` +
|
|
281
|
+
` } else {\n` +
|
|
282
|
+
` settle(() => resolve(resp.result));\n` +
|
|
283
|
+
` }\n` +
|
|
284
|
+
` });\n` +
|
|
285
|
+
` socket.on("error", (err: Error) => settle(() => reject(err)));\n` +
|
|
286
|
+
` socket.on("close", () => {\n` +
|
|
287
|
+
` if (!settled) {\n` +
|
|
288
|
+
` settle(() =>\n` +
|
|
289
|
+
` reject(new Error("jira-mcp bridge closed before responding")),\n` +
|
|
290
|
+
` );\n` +
|
|
291
|
+
` }\n` +
|
|
292
|
+
` });\n` +
|
|
293
|
+
` });\n` +
|
|
294
|
+
`}\n`);
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/codeapi/templates.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,qEAAqE;AACrE,iEAAiE;AACjE,+DAA+D;AAC/D,mDAAmD;AACnD,EAAE;AACF,kEAAkE;AAClE,qEAAqE;AACrE,mEAAmE;AACnE,wDAAwD;AAExD,OAAO,EACL,iBAAiB,GAGlB,MAA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AW;QACX,WAAW;QACX,sEAAsE;QACtE,kCAAkC;QAClC,yBAAyB;QACzB,wBAAwB;QACxB,4EAA4E;QAC5E,cAAc;QACd,WAAW;QACX,WAAW;QACX,SAAS;QACT,KAAK,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { CodeApiToolContext, CodeApiToolResponse, } from "@scottlepper/mcp-toolkit/code-api";
|
|
2
|
+
import type { CodeApiToolContext, CodeApiToolResponse } from "@scottlepper/mcp-toolkit/code-api";
|
|
3
|
+
export declare const JIRA_CODE_API_TOOL_NAME = "jira_code_api";
|
|
4
|
+
export declare const jiraCodeApiToolDefinition: import("@scottlepper/mcp-toolkit/code-api").CodeApiToolDefinition;
|
|
5
|
+
export declare function buildCodeApiToolResponse(ctx: CodeApiToolContext): CodeApiToolResponse;
|
|
6
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/codeapi/tool.ts"],"names":[],"mappings":"AAcA,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,mCAAmC,CAAC;AAE3C,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAqBvD,eAAO,MAAM,yBAAyB,mEAAa,CAAC;AAEpD,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,kBAAkB,GACtB,mBAAmB,CAmCrB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// The single MCP tool exposed in code-api mode.
|
|
2
|
+
//
|
|
3
|
+
// In code-api mode the server publishes only this tool. Calling it
|
|
4
|
+
// returns the path to the jira-cli binary and the JIRA_MCP_SOCKET
|
|
5
|
+
// address; the agent then drives Jira through that CLI from its own
|
|
6
|
+
// shell and never calls an MCP tool again for reads.
|
|
7
|
+
//
|
|
8
|
+
// The toolkit owns the tool definition shape and the wiring contract;
|
|
9
|
+
// we override `buildResponse` with Jira-specific hints (the canonical
|
|
10
|
+
// `issue.get` example and the subtasks JQL gotcha) that historically
|
|
11
|
+
// saved first-use sessions multiple wasted calls.
|
|
12
|
+
import { createCodeApiTool } from "@scottlepper/mcp-toolkit/code-api";
|
|
13
|
+
export const JIRA_CODE_API_TOOL_NAME = "jira_code_api";
|
|
14
|
+
const JIRA_CODE_API_TOOL_DESCRIPTION = "Access Jira via the bundled jira-cli shell binary. Call once to " +
|
|
15
|
+
"get the binary path and JIRA_MCP_SOCKET address; every subsequent " +
|
|
16
|
+
"call is a `jira-cli <op> --flag=value` invocation that returns a " +
|
|
17
|
+
"trimmed summary on stdout and a ref path to the full response.";
|
|
18
|
+
// Use the toolkit for the tool definition (name, schema, description
|
|
19
|
+
// contract). We ignore its `buildResponse` and provide a Jira-flavored
|
|
20
|
+
// one below — the toolkit's generic snippet uses `<op> --flag=value`
|
|
21
|
+
// placeholders, but jira-mcp tests assert on the concrete `issue.get`
|
|
22
|
+
// example and the subtasks JQL hint that were tuned from real
|
|
23
|
+
// first-use sessions.
|
|
24
|
+
const { definition } = createCodeApiTool({
|
|
25
|
+
toolName: JIRA_CODE_API_TOOL_NAME,
|
|
26
|
+
cliBinaryName: "jira-cli",
|
|
27
|
+
socketEnvVar: "JIRA_MCP_SOCKET",
|
|
28
|
+
description: JIRA_CODE_API_TOOL_DESCRIPTION,
|
|
29
|
+
});
|
|
30
|
+
export const jiraCodeApiToolDefinition = definition;
|
|
31
|
+
export function buildCodeApiToolResponse(ctx) {
|
|
32
|
+
// The agent typically runs this via Claude Code's Bash tool, whose
|
|
33
|
+
// child shells *do not* inherit env vars from the MCP server
|
|
34
|
+
// process. So the snippet must export JIRA_MCP_SOCKET inline rather
|
|
35
|
+
// than assume it's already set.
|
|
36
|
+
//
|
|
37
|
+
// The discovery hint and subtask note exist because real first-use
|
|
38
|
+
// sessions burned 4-5 calls guessing at the wrong endpoint names
|
|
39
|
+
// ("searchAndReconsileIssuesUsingJql") and wrong subtask
|
|
40
|
+
// strategies ("issueLinkType = has subtask"). `jira-cli --help`
|
|
41
|
+
// lists every operation; `jira-cli <op> --help` lists its flags.
|
|
42
|
+
// We prefix invocations with `node` rather than relying on the
|
|
43
|
+
// shebang + exec bit. `npm install` sets the exec bit when wiring
|
|
44
|
+
// `bin` entries, but a freshly-built local checkout (the common
|
|
45
|
+
// dev path) leaves the file non-executable, and the agent has no
|
|
46
|
+
// reason to suspect that. `node <path>` works either way.
|
|
47
|
+
const cmd = `node ${ctx.cliPath}`;
|
|
48
|
+
const usage = [
|
|
49
|
+
`# JIRA_MCP_SOCKET prefix is load-bearing — child shells don't`,
|
|
50
|
+
`# inherit the MCP server's env.`,
|
|
51
|
+
`JIRA_MCP_SOCKET=${ctx.socketAddress} \\`,
|
|
52
|
+
` ${cmd} issue.get --issueIdOrKey=PROJ-1`,
|
|
53
|
+
`# stdout: trimmed summary as JSON, then a final \`ref: /path\` line`,
|
|
54
|
+
`# pointing at the full response on disk (\`cat\` it for detail).`,
|
|
55
|
+
`# Discovery: \`${cmd} --help\` lists ops;`,
|
|
56
|
+
`# \`${cmd} <op> --help\` lists flags.`,
|
|
57
|
+
`# Subtasks: use \`parent = KEY\` JQL on search.issues, not "has subtask".`,
|
|
58
|
+
].join("\n");
|
|
59
|
+
return {
|
|
60
|
+
cli: ctx.cliPath,
|
|
61
|
+
socketEnv: "JIRA_MCP_SOCKET",
|
|
62
|
+
socketAddress: ctx.socketAddress,
|
|
63
|
+
usage,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/codeapi/tool.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,mEAAmE;AACnE,kEAAkE;AAClE,oEAAoE;AACpE,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AAC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C,aAAa;QAChC,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type TokenType = "scoped" | "classic";
|
|
2
|
+
export type ToolMode = "code-api" | "classic";
|
|
3
|
+
export interface ToolFilterConfig {
|
|
4
|
+
enabledCategories: string[];
|
|
5
|
+
disabledActions: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface JiraConfig {
|
|
8
|
+
host: string;
|
|
9
|
+
email: string;
|
|
10
|
+
apiToken: string;
|
|
11
|
+
tokenType: TokenType;
|
|
12
|
+
cloudId?: string;
|
|
13
|
+
toolMode: ToolMode;
|
|
14
|
+
toolFilter: ToolFilterConfig;
|
|
15
|
+
}
|
|
16
|
+
export declare const CONSOLIDATED_CATEGORIES: readonly ["issue", "search", "comment", "user", "project", "board", "sprint", "epic", "worklog", "attachment", "filter", "link", "watcher", "field", "group", "server"];
|
|
17
|
+
export declare function getConfig(): JiraConfig;
|
|
18
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAa7C,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAgB9C,MAAM,WAAW,gBAAgB;IAK/B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAG5B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AA2BD,eAAO,MAAM,uBAAuB,yKAiB1B,CAAC;AAuCX,wBAAgB,SAAS,IAAI,UAAU,CA0CtC"}
|
package/build/config.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { config } from "dotenv";
|
|
2
|
+
// Load environment variables from .env files
|
|
3
|
+
// Priority: .env.local > .env (later calls override earlier)
|
|
4
|
+
//
|
|
5
|
+
// `quiet: true` suppresses dotenv v17's startup banner ("injected env
|
|
6
|
+
// (n) from .env"). The banner goes to stderr and is harmless for
|
|
7
|
+
// long-running processes (the MCP server) but adds noise to every
|
|
8
|
+
// jira-cli invocation in direct mode. Silencing it keeps the CLI's
|
|
9
|
+
// stderr reserved for actual errors.
|
|
10
|
+
config({ path: ".env", quiet: true });
|
|
11
|
+
config({ path: ".env.local", override: true, quiet: true });
|
|
12
|
+
/**
|
|
13
|
+
* Detect token type based on prefix
|
|
14
|
+
* - ATATT: Scoped API token (user)
|
|
15
|
+
* - ATSTT: Scoped API token (service account)
|
|
16
|
+
* - Other: Classic API token
|
|
17
|
+
*/
|
|
18
|
+
function detectTokenType(token) {
|
|
19
|
+
if (token.startsWith("ATATT") || token.startsWith("ATSTT")) {
|
|
20
|
+
return "scoped";
|
|
21
|
+
}
|
|
22
|
+
return "classic";
|
|
23
|
+
}
|
|
24
|
+
function parseToolMode(raw) {
|
|
25
|
+
if (raw === undefined || raw === "")
|
|
26
|
+
return "classic";
|
|
27
|
+
if (raw === "classic" || raw === "code-api")
|
|
28
|
+
return raw;
|
|
29
|
+
throw new Error(`Invalid JIRA_TOOL_MODE=${raw}. Expected "classic" (default) or "code-api".`);
|
|
30
|
+
}
|
|
31
|
+
// Canonical list of consolidated v2 tool categories. Mirrors the
|
|
32
|
+
// `jira_<category>` MCP tool names without the prefix. Kept as a
|
|
33
|
+
// constant rather than derived from the tools array to avoid a
|
|
34
|
+
// module cycle (config is imported broadly; tools/v2 is not).
|
|
35
|
+
export const CONSOLIDATED_CATEGORIES = [
|
|
36
|
+
"issue",
|
|
37
|
+
"search",
|
|
38
|
+
"comment",
|
|
39
|
+
"user",
|
|
40
|
+
"project",
|
|
41
|
+
"board",
|
|
42
|
+
"sprint",
|
|
43
|
+
"epic",
|
|
44
|
+
"worklog",
|
|
45
|
+
"attachment",
|
|
46
|
+
"filter",
|
|
47
|
+
"link",
|
|
48
|
+
"watcher",
|
|
49
|
+
"field",
|
|
50
|
+
"group",
|
|
51
|
+
"server",
|
|
52
|
+
];
|
|
53
|
+
function splitCsv(raw) {
|
|
54
|
+
if (!raw)
|
|
55
|
+
return [];
|
|
56
|
+
return raw
|
|
57
|
+
.split(",")
|
|
58
|
+
.map((s) => s.trim())
|
|
59
|
+
.filter((s) => s.length > 0);
|
|
60
|
+
}
|
|
61
|
+
function parseToolFilter() {
|
|
62
|
+
const enabledCategories = splitCsv(process.env.JIRA_ENABLED_CATEGORIES);
|
|
63
|
+
// Validate categories. Unknown values are dropped with a warning
|
|
64
|
+
// rather than thrown — a typo shouldn't crash the server.
|
|
65
|
+
const validCategorySet = new Set(CONSOLIDATED_CATEGORIES);
|
|
66
|
+
const validCategories = [];
|
|
67
|
+
for (const cat of enabledCategories) {
|
|
68
|
+
if (validCategorySet.has(cat)) {
|
|
69
|
+
validCategories.push(cat);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
console.error(`Warning: Unknown category "${cat}" in JIRA_ENABLED_CATEGORIES. ` +
|
|
73
|
+
`Valid categories: ${CONSOLIDATED_CATEGORIES.join(", ")}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// disabledActions are validated at runtime against the manifest in
|
|
77
|
+
// src/core/manifest.ts — config doesn't import operations.ts to
|
|
78
|
+
// avoid a heavy load-order coupling. Validation there surfaces
|
|
79
|
+
// unknown ops on first use.
|
|
80
|
+
const disabledActions = splitCsv(process.env.JIRA_DISABLED_ACTIONS);
|
|
81
|
+
return {
|
|
82
|
+
enabledCategories: validCategories,
|
|
83
|
+
disabledActions,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function getConfig() {
|
|
87
|
+
const host = process.env.JIRA_HOST;
|
|
88
|
+
const email = process.env.JIRA_EMAIL;
|
|
89
|
+
const apiToken = process.env.JIRA_API_TOKEN;
|
|
90
|
+
const cloudId = process.env.JIRA_CLOUD_ID;
|
|
91
|
+
const toolMode = parseToolMode(process.env.JIRA_TOOL_MODE);
|
|
92
|
+
const toolFilter = parseToolFilter();
|
|
93
|
+
const missing = [];
|
|
94
|
+
if (!host)
|
|
95
|
+
missing.push("JIRA_HOST");
|
|
96
|
+
if (!email)
|
|
97
|
+
missing.push("JIRA_EMAIL");
|
|
98
|
+
if (!apiToken)
|
|
99
|
+
missing.push("JIRA_API_TOKEN");
|
|
100
|
+
if (missing.length > 0) {
|
|
101
|
+
throw new Error(`Missing required environment variables: ${missing.join(", ")}\n\n` +
|
|
102
|
+
"Please set the following environment variables:\n" +
|
|
103
|
+
" JIRA_HOST - Your Jira instance URL (e.g., https://yourcompany.atlassian.net)\n" +
|
|
104
|
+
" JIRA_EMAIL - Your Atlassian account email\n" +
|
|
105
|
+
" JIRA_API_TOKEN - API token from https://id.atlassian.com/manage-profile/security/api-tokens\n" +
|
|
106
|
+
" JIRA_CLOUD_ID - (Optional) Cloud ID for scoped tokens, will be auto-fetched if not provided\n" +
|
|
107
|
+
" JIRA_TOOL_MODE - (Optional) 'classic' (default) or 'code-api'\n" +
|
|
108
|
+
" JIRA_ENABLED_CATEGORIES - (Optional) comma-separated tool categories (e.g. 'issue,search,comment'). Unset = all enabled.\n" +
|
|
109
|
+
" JIRA_DISABLED_ACTIONS - (Optional) comma-separated manifest operation names (e.g. 'issue.delete,project.delete').");
|
|
110
|
+
}
|
|
111
|
+
// Normalize host URL (remove trailing slash)
|
|
112
|
+
const normalizedHost = host.replace(/\/+$/, "");
|
|
113
|
+
const tokenType = detectTokenType(apiToken);
|
|
114
|
+
return {
|
|
115
|
+
host: normalizedHost,
|
|
116
|
+
email: email,
|
|
117
|
+
apiToken: apiToken,
|
|
118
|
+
tokenType,
|
|
119
|
+
cloudId,
|
|
120
|
+
toolMode,
|
|
121
|
+
toolFilter,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,6CAA6C;AAC7C,6DAA6D;AAC7D,EAAE;AACF,sEAAsE;AACtE,iEAAiE;AACjE,kEAAkE;AAClE,mEAAmE;AACnE,qCAAqC;AACrC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACtC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAwD5D;;;;;GAKG;AACH,SAAS,eAAe,CAAC,KAAa;IACpC,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,aAAa,CAAC,GAAuB;IAC5C,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACtD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,UAAU;QAAE,OAAO,GAAG,CAAC;IACxD,MAAM,IAAI,KAAK,CACb,0BAA0B,GAAG,+CAA+C,CAC7E,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,iEAAiE;AACjE,+DAA+D;AAC/D,8DAA8D;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,SAAS;IACT,OAAO;IACP,QAAQ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
+
export interface AdfNode {
|
|
2
|
+
type?: string;
|
|
3
|
+
text?: string;
|
|
4
|
+
content?: AdfNode[];
|
|
5
|
+
marks?: AdfMark[];
|
|
6
|
+
attrs?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface AdfMark {
|
|
9
|
+
type: string;
|
|
10
|
+
attrs?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export declare function adfToMarkdown(doc: unknown): string;
|
|
13
|
+
export declare function adfToPlainText(doc: unknown): string;
|
|
14
|
+
//# sourceMappingURL=adf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adf.d.ts","sourceRoot":"","sources":["../../src/core/adf.ts"],"names":[],"mappings":"AA8CA,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAOlD;AAKD,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQnD"}
|