patchwork-os 0.2.0-alpha.3 → 0.2.0-alpha.31
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.bridge.md +6 -0
- package/README.md +40 -15
- package/deploy/bootstrap-vps.sh +184 -0
- package/deploy/deploy-dashboard.sh +174 -0
- package/deploy/deploy-landing.sh +79 -0
- package/dist/activationMetrics.d.ts +67 -0
- package/dist/activationMetrics.js +255 -0
- package/dist/activationMetrics.js.map +1 -0
- package/dist/approvalHttp.d.ts +24 -2
- package/dist/approvalHttp.js +150 -10
- package/dist/approvalHttp.js.map +1 -1
- package/dist/approvalQueue.d.ts +16 -1
- package/dist/approvalQueue.js +44 -3
- package/dist/approvalQueue.js.map +1 -1
- package/dist/automation.d.ts +20 -0
- package/dist/automation.js +54 -1
- package/dist/automation.js.map +1 -1
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.js +55 -130
- package/dist/bridge.js.map +1 -1
- package/dist/bridgeToken.js +57 -19
- package/dist/bridgeToken.js.map +1 -1
- package/dist/ccPermissions.js +6 -4
- package/dist/ccPermissions.js.map +1 -1
- package/dist/claudeOrchestrator.d.ts +1 -1
- package/dist/claudeOrchestrator.js +14 -8
- package/dist/claudeOrchestrator.js.map +1 -1
- package/dist/commands/launchd.d.ts +2 -0
- package/dist/commands/launchd.js +94 -0
- package/dist/commands/launchd.js.map +1 -0
- package/dist/commands/recipe.d.ts +258 -0
- package/dist/commands/recipe.js +1130 -0
- package/dist/commands/recipe.js.map +1 -0
- package/dist/commands/recipeInstall.d.ts +72 -0
- package/dist/commands/recipeInstall.js +339 -0
- package/dist/commands/recipeInstall.js.map +1 -0
- package/dist/config.d.ts +14 -1
- package/dist/config.js +99 -8
- package/dist/config.js.map +1 -1
- package/dist/connectors/baseConnector.d.ts +117 -0
- package/dist/connectors/baseConnector.js +213 -0
- package/dist/connectors/baseConnector.js.map +1 -0
- package/dist/connectors/confluence.d.ts +111 -0
- package/dist/connectors/confluence.js +406 -0
- package/dist/connectors/confluence.js.map +1 -0
- package/dist/connectors/datadog.d.ts +116 -0
- package/dist/connectors/datadog.js +385 -0
- package/dist/connectors/datadog.js.map +1 -0
- package/dist/connectors/fixtureLibrary.d.ts +21 -0
- package/dist/connectors/fixtureLibrary.js +70 -0
- package/dist/connectors/fixtureLibrary.js.map +1 -0
- package/dist/connectors/fixtureRecorder.d.ts +1 -0
- package/dist/connectors/fixtureRecorder.js +35 -0
- package/dist/connectors/fixtureRecorder.js.map +1 -0
- package/dist/connectors/github.d.ts +58 -8
- package/dist/connectors/github.js +312 -84
- package/dist/connectors/github.js.map +1 -1
- package/dist/connectors/gmail.d.ts +4 -1
- package/dist/connectors/gmail.js +79 -16
- package/dist/connectors/gmail.js.map +1 -1
- package/dist/connectors/googleCalendar.d.ts +60 -0
- package/dist/connectors/googleCalendar.js +345 -0
- package/dist/connectors/googleCalendar.js.map +1 -0
- package/dist/connectors/hubspot.d.ts +112 -0
- package/dist/connectors/hubspot.js +408 -0
- package/dist/connectors/hubspot.js.map +1 -0
- package/dist/connectors/intercom.d.ts +102 -0
- package/dist/connectors/intercom.js +402 -0
- package/dist/connectors/intercom.js.map +1 -0
- package/dist/connectors/jira.d.ts +98 -0
- package/dist/connectors/jira.js +379 -0
- package/dist/connectors/jira.js.map +1 -0
- package/dist/connectors/linear.d.ts +69 -19
- package/dist/connectors/linear.js +170 -129
- package/dist/connectors/linear.js.map +1 -1
- package/dist/connectors/mcpClient.d.ts +56 -0
- package/dist/connectors/mcpClient.js +189 -0
- package/dist/connectors/mcpClient.js.map +1 -0
- package/dist/connectors/mcpOAuth.d.ts +84 -0
- package/dist/connectors/mcpOAuth.js +389 -0
- package/dist/connectors/mcpOAuth.js.map +1 -0
- package/dist/connectors/mockConnector.d.ts +28 -0
- package/dist/connectors/mockConnector.js +81 -0
- package/dist/connectors/mockConnector.js.map +1 -0
- package/dist/connectors/notion.d.ts +143 -0
- package/dist/connectors/notion.js +424 -0
- package/dist/connectors/notion.js.map +1 -0
- package/dist/connectors/sentry.d.ts +17 -21
- package/dist/connectors/sentry.js +115 -131
- package/dist/connectors/sentry.js.map +1 -1
- package/dist/connectors/slack.d.ts +50 -0
- package/dist/connectors/slack.js +324 -0
- package/dist/connectors/slack.js.map +1 -0
- package/dist/connectors/stripe.d.ts +116 -0
- package/dist/connectors/stripe.js +379 -0
- package/dist/connectors/stripe.js.map +1 -0
- package/dist/connectors/tokenStorage.d.ts +35 -0
- package/dist/connectors/tokenStorage.js +459 -0
- package/dist/connectors/tokenStorage.js.map +1 -0
- package/dist/connectors/zendesk.d.ts +104 -0
- package/dist/connectors/zendesk.js +424 -0
- package/dist/connectors/zendesk.js.map +1 -0
- package/dist/drivers/gemini/index.d.ts +5 -1
- package/dist/drivers/gemini/index.js +39 -5
- package/dist/drivers/gemini/index.js.map +1 -1
- package/dist/drivers/index.d.ts +5 -0
- package/dist/drivers/index.js +1 -1
- package/dist/drivers/index.js.map +1 -1
- package/dist/featureFlags.d.ts +73 -0
- package/dist/featureFlags.js +203 -0
- package/dist/featureFlags.js.map +1 -0
- package/dist/fp/automationInterpreter.js +1 -0
- package/dist/fp/automationInterpreter.js.map +1 -1
- package/dist/fp/automationProgram.d.ts +1 -1
- package/dist/fp/automationProgram.js.map +1 -1
- package/dist/fp/policyParser.js +17 -0
- package/dist/fp/policyParser.js.map +1 -1
- package/dist/index.js +621 -61
- package/dist/index.js.map +1 -1
- package/dist/installGuard.d.ts +25 -0
- package/dist/installGuard.js +48 -0
- package/dist/installGuard.js.map +1 -0
- package/dist/oauth.d.ts +4 -1
- package/dist/oauth.js +50 -14
- package/dist/oauth.js.map +1 -1
- package/dist/patchworkConfig.d.ts +9 -0
- package/dist/patchworkConfig.js.map +1 -1
- package/dist/recipeOrchestration.d.ts +53 -0
- package/dist/recipeOrchestration.js +272 -0
- package/dist/recipeOrchestration.js.map +1 -0
- package/dist/recipes/RecipeOrchestrator.d.ts +40 -0
- package/dist/recipes/RecipeOrchestrator.js +51 -0
- package/dist/recipes/RecipeOrchestrator.js.map +1 -0
- package/dist/recipes/agentExecutor.d.ts +28 -0
- package/dist/recipes/agentExecutor.js +42 -0
- package/dist/recipes/agentExecutor.js.map +1 -0
- package/dist/recipes/chainedRunner.d.ts +140 -0
- package/dist/recipes/chainedRunner.js +539 -0
- package/dist/recipes/chainedRunner.js.map +1 -0
- package/dist/recipes/dependencyGraph.d.ts +39 -0
- package/dist/recipes/dependencyGraph.js +199 -0
- package/dist/recipes/dependencyGraph.js.map +1 -0
- package/dist/recipes/legacyRecipeCompat.d.ts +2 -0
- package/dist/recipes/legacyRecipeCompat.js +112 -0
- package/dist/recipes/legacyRecipeCompat.js.map +1 -0
- package/dist/recipes/manifest.d.ts +47 -0
- package/dist/recipes/manifest.js +141 -0
- package/dist/recipes/manifest.js.map +1 -0
- package/dist/recipes/nestedRecipeStep.d.ts +58 -0
- package/dist/recipes/nestedRecipeStep.js +95 -0
- package/dist/recipes/nestedRecipeStep.js.map +1 -0
- package/dist/recipes/outputRegistry.d.ts +28 -0
- package/dist/recipes/outputRegistry.js +52 -0
- package/dist/recipes/outputRegistry.js.map +1 -0
- package/dist/recipes/scheduler.d.ts +23 -7
- package/dist/recipes/scheduler.js +131 -41
- package/dist/recipes/scheduler.js.map +1 -1
- package/dist/recipes/schema.d.ts +17 -2
- package/dist/recipes/schemaGenerator.d.ts +28 -0
- package/dist/recipes/schemaGenerator.js +565 -0
- package/dist/recipes/schemaGenerator.js.map +1 -0
- package/dist/recipes/templateEngine.d.ts +62 -0
- package/dist/recipes/templateEngine.js +182 -0
- package/dist/recipes/templateEngine.js.map +1 -0
- package/dist/recipes/toolRegistry.d.ts +181 -0
- package/dist/recipes/toolRegistry.js +300 -0
- package/dist/recipes/toolRegistry.js.map +1 -0
- package/dist/recipes/tools/calendar.d.ts +6 -0
- package/dist/recipes/tools/calendar.js +61 -0
- package/dist/recipes/tools/calendar.js.map +1 -0
- package/dist/recipes/tools/confluence.d.ts +6 -0
- package/dist/recipes/tools/confluence.js +254 -0
- package/dist/recipes/tools/confluence.js.map +1 -0
- package/dist/recipes/tools/datadog.d.ts +6 -0
- package/dist/recipes/tools/datadog.js +239 -0
- package/dist/recipes/tools/datadog.js.map +1 -0
- package/dist/recipes/tools/diagnostics.d.ts +6 -0
- package/dist/recipes/tools/diagnostics.js +36 -0
- package/dist/recipes/tools/diagnostics.js.map +1 -0
- package/dist/recipes/tools/file.d.ts +6 -0
- package/dist/recipes/tools/file.js +170 -0
- package/dist/recipes/tools/file.js.map +1 -0
- package/dist/recipes/tools/git.d.ts +6 -0
- package/dist/recipes/tools/git.js +63 -0
- package/dist/recipes/tools/git.js.map +1 -0
- package/dist/recipes/tools/github.d.ts +6 -0
- package/dist/recipes/tools/github.js +91 -0
- package/dist/recipes/tools/github.js.map +1 -0
- package/dist/recipes/tools/gmail.d.ts +6 -0
- package/dist/recipes/tools/gmail.js +210 -0
- package/dist/recipes/tools/gmail.js.map +1 -0
- package/dist/recipes/tools/hubspot.d.ts +6 -0
- package/dist/recipes/tools/hubspot.js +232 -0
- package/dist/recipes/tools/hubspot.js.map +1 -0
- package/dist/recipes/tools/index.d.ts +22 -0
- package/dist/recipes/tools/index.js +25 -0
- package/dist/recipes/tools/index.js.map +1 -0
- package/dist/recipes/tools/intercom.d.ts +6 -0
- package/dist/recipes/tools/intercom.js +226 -0
- package/dist/recipes/tools/intercom.js.map +1 -0
- package/dist/recipes/tools/linear.d.ts +6 -0
- package/dist/recipes/tools/linear.js +83 -0
- package/dist/recipes/tools/linear.js.map +1 -0
- package/dist/recipes/tools/notion.d.ts +6 -0
- package/dist/recipes/tools/notion.js +278 -0
- package/dist/recipes/tools/notion.js.map +1 -0
- package/dist/recipes/tools/slack.d.ts +6 -0
- package/dist/recipes/tools/slack.js +72 -0
- package/dist/recipes/tools/slack.js.map +1 -0
- package/dist/recipes/tools/stripe.d.ts +6 -0
- package/dist/recipes/tools/stripe.js +265 -0
- package/dist/recipes/tools/stripe.js.map +1 -0
- package/dist/recipes/tools/zendesk.d.ts +6 -0
- package/dist/recipes/tools/zendesk.js +245 -0
- package/dist/recipes/tools/zendesk.js.map +1 -0
- package/dist/recipes/validation.d.ts +13 -0
- package/dist/recipes/validation.js +433 -0
- package/dist/recipes/validation.js.map +1 -0
- package/dist/recipes/yamlRunner.d.ts +87 -0
- package/dist/recipes/yamlRunner.js +693 -409
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/recipesHttp.d.ts +34 -6
- package/dist/recipesHttp.js +285 -15
- package/dist/recipesHttp.js.map +1 -1
- package/dist/riskTier.js +1 -0
- package/dist/riskTier.js.map +1 -1
- package/dist/runLog.d.ts +23 -0
- package/dist/runLog.js +56 -1
- package/dist/runLog.js.map +1 -1
- package/dist/schemas/dry-run-plan.v1.json +139 -0
- package/dist/schemas/recipe.v1.json +684 -0
- package/dist/server.d.ts +32 -1
- package/dist/server.js +980 -97
- package/dist/server.js.map +1 -1
- package/dist/streamableHttp.js +2 -0
- package/dist/streamableHttp.js.map +1 -1
- package/dist/tools/addLinearComment.d.ts +55 -0
- package/dist/tools/addLinearComment.js +72 -0
- package/dist/tools/addLinearComment.js.map +1 -0
- package/dist/tools/bridgeDoctor.js +2 -2
- package/dist/tools/bridgeDoctor.js.map +1 -1
- package/dist/tools/createLinearIssue.d.ts +84 -0
- package/dist/tools/createLinearIssue.js +146 -0
- package/dist/tools/createLinearIssue.js.map +1 -0
- package/dist/tools/fetchCalendarEvents.d.ts +94 -0
- package/dist/tools/fetchCalendarEvents.js +97 -0
- package/dist/tools/fetchCalendarEvents.js.map +1 -0
- package/dist/tools/fetchGithubIssue.d.ts +80 -0
- package/dist/tools/fetchGithubIssue.js +84 -0
- package/dist/tools/fetchGithubIssue.js.map +1 -0
- package/dist/tools/fetchGithubPR.d.ts +89 -0
- package/dist/tools/fetchGithubPR.js +96 -0
- package/dist/tools/fetchGithubPR.js.map +1 -0
- package/dist/tools/fetchSlackProfile.d.ts +43 -0
- package/dist/tools/fetchSlackProfile.js +46 -0
- package/dist/tools/fetchSlackProfile.js.map +1 -0
- package/dist/tools/getConnectorStatus.d.ts +58 -0
- package/dist/tools/getConnectorStatus.js +56 -0
- package/dist/tools/getConnectorStatus.js.map +1 -0
- package/dist/tools/github/actions.js +4 -2
- package/dist/tools/github/actions.js.map +1 -1
- package/dist/tools/github/composite.d.ts +339 -0
- package/dist/tools/github/composite.js +343 -0
- package/dist/tools/github/composite.js.map +1 -0
- package/dist/tools/github/index.d.ts +2 -1
- package/dist/tools/github/index.js +2 -1
- package/dist/tools/github/index.js.map +1 -1
- package/dist/tools/github/issues.js +8 -4
- package/dist/tools/github/issues.js.map +1 -1
- package/dist/tools/github/pr.d.ts +122 -0
- package/dist/tools/github/pr.js +195 -5
- package/dist/tools/github/pr.js.map +1 -1
- package/dist/tools/index.js +32 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/searchTools.js +1 -1
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/tools/slackListChannels.d.ts +65 -0
- package/dist/tools/slackListChannels.js +70 -0
- package/dist/tools/slackListChannels.js.map +1 -0
- package/dist/tools/slackPostMessage.d.ts +57 -0
- package/dist/tools/slackPostMessage.js +77 -0
- package/dist/tools/slackPostMessage.js.map +1 -0
- package/dist/tools/testTraceToSource.js +2 -2
- package/dist/tools/testTraceToSource.js.map +1 -1
- package/dist/tools/updateLinearIssue.d.ts +89 -0
- package/dist/tools/updateLinearIssue.js +117 -0
- package/dist/tools/updateLinearIssue.js.map +1 -0
- package/dist/transport.d.ts +7 -1
- package/dist/transport.js +85 -11
- package/dist/transport.js.map +1 -1
- package/package.json +5 -2
- package/scripts/start-all.sh +56 -19
- package/templates/automation-policies/recipe-authoring.json +25 -0
- package/templates/automation-policy.example.json +6 -0
- package/templates/co.patchwork-os.bridge.plist +34 -0
- package/templates/recipes/ctx-loop-test.yaml +75 -0
- package/templates/recipes/lint-on-save.yaml +1 -2
- package/templates/recipes/morning-brief-slack.yaml +57 -0
- package/templates/recipes/morning-brief.yaml +14 -6
- package/templates/recipes/project-health-check.yaml +50 -0
- package/templates/recipes/sentry-to-linear.yaml +77 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Calendar tools — calendar.list_events
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// calendar.list_events
|
|
9
|
+
// ============================================================================
|
|
10
|
+
registerTool({
|
|
11
|
+
id: "calendar.list_events",
|
|
12
|
+
namespace: "calendar",
|
|
13
|
+
description: "List upcoming Google Calendar events.",
|
|
14
|
+
paramsSchema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
days_ahead: {
|
|
18
|
+
type: "number",
|
|
19
|
+
description: "Number of days to look ahead",
|
|
20
|
+
default: 7,
|
|
21
|
+
},
|
|
22
|
+
max: CommonSchemas.max,
|
|
23
|
+
calendar_id: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Calendar ID (omit for primary calendar)",
|
|
26
|
+
},
|
|
27
|
+
into: CommonSchemas.into,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
outputSchema: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
count: { type: "number" },
|
|
34
|
+
events: { type: "array" },
|
|
35
|
+
error: { type: "string" },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
riskDefault: "low",
|
|
39
|
+
isWrite: false,
|
|
40
|
+
isConnector: true,
|
|
41
|
+
execute: async ({ params }) => {
|
|
42
|
+
const { listEvents } = await import("../../connectors/googleCalendar.js");
|
|
43
|
+
const daysAhead = typeof params.days_ahead === "number" ? params.days_ahead : 7;
|
|
44
|
+
const maxResults = typeof params.max === "number" ? params.max : 20;
|
|
45
|
+
const calendarId = params.calendar_id
|
|
46
|
+
? String(params.calendar_id)
|
|
47
|
+
: undefined;
|
|
48
|
+
try {
|
|
49
|
+
const events = await listEvents({ daysAhead, maxResults, calendarId });
|
|
50
|
+
return JSON.stringify({ count: events.length, events });
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
return JSON.stringify({
|
|
54
|
+
count: 0,
|
|
55
|
+
events: [],
|
|
56
|
+
error: err instanceof Error ? err.message : String(err),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../src/recipes/tools/calendar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,YAAY,CAAC;IACX,EAAE,EAAE,sBAAsB;IAC1B,SAAS,EAAE,UAAU;IACrB,WAAW,EAAE,uCAAuC;IACpD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8BAA8B;gBAC3C,OAAO,EAAE,CAAC;aACX;YACD,GAAG,EAAE,aAAa,CAAC,GAAG;YACtB,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;aACvD;YACD,IAAI,EAAE,aAAa,CAAC,IAAI;SACzB;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;YACzB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC1B;KACF;IACD,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAC5B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,oCAAoC,CAAC,CAAC;QAC1E,MAAM,SAAS,GACb,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW;YACnC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;YAC5B,CAAC,CAAC,SAAS,CAAC;QAEd,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;YACvE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACxD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Confluence tools — get pages, search, create pages, append content, list spaces.
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { assertWriteAllowed } from "../../featureFlags.js";
|
|
7
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// confluence.getPage
|
|
10
|
+
// ============================================================================
|
|
11
|
+
registerTool({
|
|
12
|
+
id: "confluence.getPage",
|
|
13
|
+
namespace: "confluence",
|
|
14
|
+
description: "Fetch a Confluence page by ID, including its storage-format body.",
|
|
15
|
+
paramsSchema: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
pageId: { type: "string", description: "Confluence page ID" },
|
|
19
|
+
includeBody: {
|
|
20
|
+
type: "boolean",
|
|
21
|
+
description: "Whether to include the page body (default true)",
|
|
22
|
+
default: true,
|
|
23
|
+
},
|
|
24
|
+
into: CommonSchemas.into,
|
|
25
|
+
},
|
|
26
|
+
required: ["pageId"],
|
|
27
|
+
},
|
|
28
|
+
outputSchema: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
id: { type: "string" },
|
|
32
|
+
title: { type: "string" },
|
|
33
|
+
status: { type: "string" },
|
|
34
|
+
spaceId: { type: "string" },
|
|
35
|
+
version: { type: "number" },
|
|
36
|
+
body: { type: ["string", "null"] },
|
|
37
|
+
url: { type: "string" },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
riskDefault: "low",
|
|
41
|
+
isWrite: false,
|
|
42
|
+
isConnector: true,
|
|
43
|
+
execute: async ({ params }) => {
|
|
44
|
+
const { getConfluenceConnector } = await import("../../connectors/confluence.js");
|
|
45
|
+
const connector = getConfluenceConnector();
|
|
46
|
+
const page = await connector.getPage(params.pageId, params.includeBody !== false);
|
|
47
|
+
if (!page)
|
|
48
|
+
return JSON.stringify({
|
|
49
|
+
error: `Page ${params.pageId} not found`,
|
|
50
|
+
});
|
|
51
|
+
return JSON.stringify({
|
|
52
|
+
id: page.id,
|
|
53
|
+
title: page.title,
|
|
54
|
+
status: page.status,
|
|
55
|
+
spaceId: page.spaceId,
|
|
56
|
+
version: page.version.number,
|
|
57
|
+
body: page.body?.storage?.value ?? null,
|
|
58
|
+
url: page._links.webui,
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
// ============================================================================
|
|
63
|
+
// confluence.search
|
|
64
|
+
// ============================================================================
|
|
65
|
+
registerTool({
|
|
66
|
+
id: "confluence.search",
|
|
67
|
+
namespace: "confluence",
|
|
68
|
+
description: "Search Confluence pages using a full-text query (CQL).",
|
|
69
|
+
paramsSchema: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
query: { type: "string", description: "Search terms" },
|
|
73
|
+
limit: {
|
|
74
|
+
type: "number",
|
|
75
|
+
description: "Max results to return (default 25)",
|
|
76
|
+
default: 25,
|
|
77
|
+
},
|
|
78
|
+
into: CommonSchemas.into,
|
|
79
|
+
},
|
|
80
|
+
required: ["query"],
|
|
81
|
+
},
|
|
82
|
+
outputSchema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
properties: {
|
|
85
|
+
results: { type: "array", items: { type: "object" } },
|
|
86
|
+
totalSize: { type: "number" },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
riskDefault: "low",
|
|
90
|
+
isWrite: false,
|
|
91
|
+
isConnector: true,
|
|
92
|
+
execute: async ({ params }) => {
|
|
93
|
+
const { getConfluenceConnector } = await import("../../connectors/confluence.js");
|
|
94
|
+
const connector = getConfluenceConnector();
|
|
95
|
+
const result = await connector.search(params.query, typeof params.limit === "number" ? params.limit : 25);
|
|
96
|
+
return JSON.stringify(result);
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
// ============================================================================
|
|
100
|
+
// confluence.createPage
|
|
101
|
+
// ============================================================================
|
|
102
|
+
registerTool({
|
|
103
|
+
id: "confluence.createPage",
|
|
104
|
+
namespace: "confluence",
|
|
105
|
+
description: "Create a new Confluence page in a space.",
|
|
106
|
+
paramsSchema: {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
spaceId: { type: "string", description: "Confluence space ID" },
|
|
110
|
+
title: { type: "string", description: "Page title" },
|
|
111
|
+
body: {
|
|
112
|
+
type: "string",
|
|
113
|
+
description: "Page body in Confluence storage format (XHTML)",
|
|
114
|
+
},
|
|
115
|
+
parentId: {
|
|
116
|
+
type: "string",
|
|
117
|
+
description: "Optional parent page ID to nest this page under",
|
|
118
|
+
},
|
|
119
|
+
into: CommonSchemas.into,
|
|
120
|
+
},
|
|
121
|
+
required: ["spaceId", "title", "body"],
|
|
122
|
+
},
|
|
123
|
+
outputSchema: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
id: { type: "string" },
|
|
127
|
+
title: { type: "string" },
|
|
128
|
+
url: { type: "string" },
|
|
129
|
+
version: { type: "number" },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
riskDefault: "medium",
|
|
133
|
+
isWrite: true,
|
|
134
|
+
isConnector: true,
|
|
135
|
+
execute: async ({ params }) => {
|
|
136
|
+
assertWriteAllowed("confluence.createPage");
|
|
137
|
+
const { getConfluenceConnector } = await import("../../connectors/confluence.js");
|
|
138
|
+
const connector = getConfluenceConnector();
|
|
139
|
+
const page = await connector.createPage({
|
|
140
|
+
spaceId: params.spaceId,
|
|
141
|
+
title: params.title,
|
|
142
|
+
body: params.body,
|
|
143
|
+
parentId: params.parentId,
|
|
144
|
+
});
|
|
145
|
+
return JSON.stringify({
|
|
146
|
+
id: page.id,
|
|
147
|
+
title: page.title,
|
|
148
|
+
url: page._links.webui,
|
|
149
|
+
version: page.version.number,
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
// ============================================================================
|
|
154
|
+
// confluence.appendToPage
|
|
155
|
+
// ============================================================================
|
|
156
|
+
registerTool({
|
|
157
|
+
id: "confluence.appendToPage",
|
|
158
|
+
namespace: "confluence",
|
|
159
|
+
description: "Append content to an existing Confluence page (increments version).",
|
|
160
|
+
paramsSchema: {
|
|
161
|
+
type: "object",
|
|
162
|
+
properties: {
|
|
163
|
+
pageId: { type: "string", description: "Confluence page ID" },
|
|
164
|
+
content: {
|
|
165
|
+
type: "string",
|
|
166
|
+
description: "Storage-format XHTML content to append",
|
|
167
|
+
},
|
|
168
|
+
into: CommonSchemas.into,
|
|
169
|
+
},
|
|
170
|
+
required: ["pageId", "content"],
|
|
171
|
+
},
|
|
172
|
+
outputSchema: {
|
|
173
|
+
type: "object",
|
|
174
|
+
properties: {
|
|
175
|
+
id: { type: "string" },
|
|
176
|
+
title: { type: "string" },
|
|
177
|
+
version: { type: "number" },
|
|
178
|
+
url: { type: "string" },
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
riskDefault: "medium",
|
|
182
|
+
isWrite: true,
|
|
183
|
+
isConnector: true,
|
|
184
|
+
execute: async ({ params }) => {
|
|
185
|
+
assertWriteAllowed("confluence.appendToPage");
|
|
186
|
+
const { getConfluenceConnector } = await import("../../connectors/confluence.js");
|
|
187
|
+
const connector = getConfluenceConnector();
|
|
188
|
+
const page = await connector.appendToPage(params.pageId, params.content);
|
|
189
|
+
return JSON.stringify({
|
|
190
|
+
id: page.id,
|
|
191
|
+
title: page.title,
|
|
192
|
+
version: page.version.number,
|
|
193
|
+
url: page._links.webui,
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
// ============================================================================
|
|
198
|
+
// confluence.listSpaces
|
|
199
|
+
// ============================================================================
|
|
200
|
+
registerTool({
|
|
201
|
+
id: "confluence.listSpaces",
|
|
202
|
+
namespace: "confluence",
|
|
203
|
+
description: "List all accessible Confluence spaces.",
|
|
204
|
+
paramsSchema: {
|
|
205
|
+
type: "object",
|
|
206
|
+
properties: {
|
|
207
|
+
limit: {
|
|
208
|
+
type: "number",
|
|
209
|
+
description: "Max spaces to return (default 50)",
|
|
210
|
+
default: 50,
|
|
211
|
+
},
|
|
212
|
+
into: CommonSchemas.into,
|
|
213
|
+
},
|
|
214
|
+
required: [],
|
|
215
|
+
},
|
|
216
|
+
outputSchema: {
|
|
217
|
+
type: "object",
|
|
218
|
+
properties: {
|
|
219
|
+
spaces: {
|
|
220
|
+
type: "array",
|
|
221
|
+
items: {
|
|
222
|
+
type: "object",
|
|
223
|
+
properties: {
|
|
224
|
+
id: { type: "string" },
|
|
225
|
+
key: { type: "string" },
|
|
226
|
+
name: { type: "string" },
|
|
227
|
+
type: { type: "string" },
|
|
228
|
+
url: { type: "string" },
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
count: { type: "number" },
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
riskDefault: "low",
|
|
236
|
+
isWrite: false,
|
|
237
|
+
isConnector: true,
|
|
238
|
+
execute: async ({ params }) => {
|
|
239
|
+
const { getConfluenceConnector } = await import("../../connectors/confluence.js");
|
|
240
|
+
const connector = getConfluenceConnector();
|
|
241
|
+
const spaces = await connector.listSpaces(typeof params.limit === "number" ? params.limit : 50);
|
|
242
|
+
return JSON.stringify({
|
|
243
|
+
spaces: spaces.map((s) => ({
|
|
244
|
+
id: s.id,
|
|
245
|
+
key: s.key,
|
|
246
|
+
name: s.name,
|
|
247
|
+
type: s.type,
|
|
248
|
+
url: s._links.webui,
|
|
249
|
+
})),
|
|
250
|
+
count: spaces.length,
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
//# sourceMappingURL=confluence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confluence.js","sourceRoot":"","sources":["../../../src/recipes/tools/confluence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,YAAY,CAAC;IACX,EAAE,EAAE,oBAAoB;IACxB,SAAS,EAAE,YAAY;IACv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,IAAI;gBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;YACH,KAAK,EAAE,MAAM,CAAC,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Datadog tools — query metrics, monitors, alerts, and incidents.
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { assertWriteAllowed } from "../../featureFlags.js";
|
|
7
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// datadog.queryMetrics
|
|
10
|
+
// ============================================================================
|
|
11
|
+
registerTool({
|
|
12
|
+
id: "datadog.queryMetrics",
|
|
13
|
+
namespace: "datadog",
|
|
14
|
+
description: "Query Datadog metrics for a time range. Returns time series data.",
|
|
15
|
+
paramsSchema: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
query: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: 'Datadog metrics query string (e.g. "avg:system.cpu.user{*}")',
|
|
21
|
+
},
|
|
22
|
+
from: {
|
|
23
|
+
type: "number",
|
|
24
|
+
description: "Start of the query window (Unix timestamp, seconds)",
|
|
25
|
+
},
|
|
26
|
+
to: {
|
|
27
|
+
type: "number",
|
|
28
|
+
description: "End of the query window (Unix timestamp, seconds)",
|
|
29
|
+
},
|
|
30
|
+
into: CommonSchemas.into,
|
|
31
|
+
},
|
|
32
|
+
required: ["query", "from", "to"],
|
|
33
|
+
},
|
|
34
|
+
outputSchema: {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
series: { type: "array", items: { type: "object" } },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
riskDefault: "low",
|
|
41
|
+
isWrite: false,
|
|
42
|
+
isConnector: true,
|
|
43
|
+
execute: async ({ params }) => {
|
|
44
|
+
const { getDatadogConnector } = await import("../../connectors/datadog.js");
|
|
45
|
+
const connector = getDatadogConnector();
|
|
46
|
+
const result = await connector.queryMetrics(params.query, params.from, params.to);
|
|
47
|
+
return JSON.stringify(result);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// datadog.listMonitors
|
|
52
|
+
// ============================================================================
|
|
53
|
+
registerTool({
|
|
54
|
+
id: "datadog.listMonitors",
|
|
55
|
+
namespace: "datadog",
|
|
56
|
+
description: "List Datadog monitors, optionally filtered by tags.",
|
|
57
|
+
paramsSchema: {
|
|
58
|
+
type: "object",
|
|
59
|
+
properties: {
|
|
60
|
+
tags: {
|
|
61
|
+
type: "array",
|
|
62
|
+
items: { type: "string" },
|
|
63
|
+
description: 'Filter monitors by tags (e.g. ["env:prod", "team:ops"])',
|
|
64
|
+
},
|
|
65
|
+
perPage: {
|
|
66
|
+
type: "number",
|
|
67
|
+
description: "Results per page (default 100)",
|
|
68
|
+
default: 100,
|
|
69
|
+
},
|
|
70
|
+
into: CommonSchemas.into,
|
|
71
|
+
},
|
|
72
|
+
required: [],
|
|
73
|
+
},
|
|
74
|
+
outputSchema: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: {
|
|
77
|
+
monitors: { type: "array", items: { type: "object" } },
|
|
78
|
+
count: { type: "number" },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
riskDefault: "low",
|
|
82
|
+
isWrite: false,
|
|
83
|
+
isConnector: true,
|
|
84
|
+
execute: async ({ params }) => {
|
|
85
|
+
const { getDatadogConnector } = await import("../../connectors/datadog.js");
|
|
86
|
+
const connector = getDatadogConnector();
|
|
87
|
+
const monitors = await connector.listMonitors({
|
|
88
|
+
tags: Array.isArray(params.tags) ? params.tags : undefined,
|
|
89
|
+
perPage: typeof params.perPage === "number" ? params.perPage : undefined,
|
|
90
|
+
});
|
|
91
|
+
return JSON.stringify({ monitors, count: monitors.length });
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
// ============================================================================
|
|
95
|
+
// datadog.getMonitor
|
|
96
|
+
// ============================================================================
|
|
97
|
+
registerTool({
|
|
98
|
+
id: "datadog.getMonitor",
|
|
99
|
+
namespace: "datadog",
|
|
100
|
+
description: "Fetch a single Datadog monitor by ID.",
|
|
101
|
+
paramsSchema: {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
monitorId: { type: "number", description: "Datadog monitor ID" },
|
|
105
|
+
into: CommonSchemas.into,
|
|
106
|
+
},
|
|
107
|
+
required: ["monitorId"],
|
|
108
|
+
},
|
|
109
|
+
outputSchema: {
|
|
110
|
+
type: "object",
|
|
111
|
+
properties: {
|
|
112
|
+
id: { type: "number" },
|
|
113
|
+
name: { type: "string" },
|
|
114
|
+
status: { type: "string" },
|
|
115
|
+
overall_state: { type: "string" },
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
riskDefault: "low",
|
|
119
|
+
isWrite: false,
|
|
120
|
+
isConnector: true,
|
|
121
|
+
execute: async ({ params }) => {
|
|
122
|
+
const { getDatadogConnector } = await import("../../connectors/datadog.js");
|
|
123
|
+
const connector = getDatadogConnector();
|
|
124
|
+
const monitor = await connector.getMonitor(params.monitorId);
|
|
125
|
+
return JSON.stringify(monitor);
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
// ============================================================================
|
|
129
|
+
// datadog.listActiveAlerts
|
|
130
|
+
// ============================================================================
|
|
131
|
+
registerTool({
|
|
132
|
+
id: "datadog.listActiveAlerts",
|
|
133
|
+
namespace: "datadog",
|
|
134
|
+
description: "List Datadog monitors currently in Alert or Warn state (active incidents).",
|
|
135
|
+
paramsSchema: {
|
|
136
|
+
type: "object",
|
|
137
|
+
properties: {
|
|
138
|
+
into: CommonSchemas.into,
|
|
139
|
+
},
|
|
140
|
+
required: [],
|
|
141
|
+
},
|
|
142
|
+
outputSchema: {
|
|
143
|
+
type: "object",
|
|
144
|
+
properties: {
|
|
145
|
+
alerts: { type: "array", items: { type: "object" } },
|
|
146
|
+
count: { type: "number" },
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
riskDefault: "low",
|
|
150
|
+
isWrite: false,
|
|
151
|
+
isConnector: true,
|
|
152
|
+
execute: async ({ params: _ }) => {
|
|
153
|
+
const { getDatadogConnector } = await import("../../connectors/datadog.js");
|
|
154
|
+
const connector = getDatadogConnector();
|
|
155
|
+
const alerts = await connector.listActiveAlerts();
|
|
156
|
+
return JSON.stringify({ alerts, count: alerts.length });
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
// ============================================================================
|
|
160
|
+
// datadog.muteMonitor
|
|
161
|
+
// ============================================================================
|
|
162
|
+
registerTool({
|
|
163
|
+
id: "datadog.muteMonitor",
|
|
164
|
+
namespace: "datadog",
|
|
165
|
+
description: "Mute a Datadog monitor to suppress alerts. Optionally specify when the mute expires.",
|
|
166
|
+
paramsSchema: {
|
|
167
|
+
type: "object",
|
|
168
|
+
properties: {
|
|
169
|
+
monitorId: { type: "number", description: "Datadog monitor ID" },
|
|
170
|
+
end: {
|
|
171
|
+
type: "number",
|
|
172
|
+
description: "Unix timestamp when the mute expires (optional). If omitted, muted indefinitely.",
|
|
173
|
+
},
|
|
174
|
+
into: CommonSchemas.into,
|
|
175
|
+
},
|
|
176
|
+
required: ["monitorId"],
|
|
177
|
+
},
|
|
178
|
+
outputSchema: {
|
|
179
|
+
type: "object",
|
|
180
|
+
properties: {
|
|
181
|
+
id: { type: "number" },
|
|
182
|
+
name: { type: "string" },
|
|
183
|
+
overall_state: { type: "string" },
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
riskDefault: "medium",
|
|
187
|
+
isWrite: true,
|
|
188
|
+
isConnector: true,
|
|
189
|
+
execute: async ({ params }) => {
|
|
190
|
+
assertWriteAllowed("datadog.muteMonitor");
|
|
191
|
+
const { getDatadogConnector } = await import("../../connectors/datadog.js");
|
|
192
|
+
const connector = getDatadogConnector();
|
|
193
|
+
const monitor = await connector.muteMonitor(params.monitorId, typeof params.end === "number" ? params.end : undefined);
|
|
194
|
+
return JSON.stringify({
|
|
195
|
+
id: monitor.id,
|
|
196
|
+
name: monitor.name,
|
|
197
|
+
overall_state: monitor.overall_state,
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
// ============================================================================
|
|
202
|
+
// datadog.listIncidents
|
|
203
|
+
// ============================================================================
|
|
204
|
+
registerTool({
|
|
205
|
+
id: "datadog.listIncidents",
|
|
206
|
+
namespace: "datadog",
|
|
207
|
+
description: "List Datadog incidents.",
|
|
208
|
+
paramsSchema: {
|
|
209
|
+
type: "object",
|
|
210
|
+
properties: {
|
|
211
|
+
perPage: {
|
|
212
|
+
type: "number",
|
|
213
|
+
description: "Results per page (default 10)",
|
|
214
|
+
default: 10,
|
|
215
|
+
},
|
|
216
|
+
into: CommonSchemas.into,
|
|
217
|
+
},
|
|
218
|
+
required: [],
|
|
219
|
+
},
|
|
220
|
+
outputSchema: {
|
|
221
|
+
type: "object",
|
|
222
|
+
properties: {
|
|
223
|
+
data: { type: "array", items: { type: "object" } },
|
|
224
|
+
count: { type: "number" },
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
riskDefault: "low",
|
|
228
|
+
isWrite: false,
|
|
229
|
+
isConnector: true,
|
|
230
|
+
execute: async ({ params }) => {
|
|
231
|
+
const { getDatadogConnector } = await import("../../connectors/datadog.js");
|
|
232
|
+
const connector = getDatadogConnector();
|
|
233
|
+
const result = await connector.listIncidents({
|
|
234
|
+
perPage: typeof params.perPage === "number" ? params.perPage : undefined,
|
|
235
|
+
});
|
|
236
|
+
return JSON.stringify({ data: result.data, count: result.data.length });
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
//# sourceMappingURL=datadog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datadog.js","sourceRoot":"","sources":["../../../src/rec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
|
|
5
|
+
*/
|
|
6
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// diagnostics.get
|
|
9
|
+
// ============================================================================
|
|
10
|
+
registerTool({
|
|
11
|
+
id: "diagnostics.get",
|
|
12
|
+
namespace: "diagnostics",
|
|
13
|
+
description: "Get diagnostic summary for a file URI (requires bridge connection; returns stub if unavailable).",
|
|
14
|
+
paramsSchema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
uri: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "File URI to get diagnostics for (e.g., 'file:///path/to/file.ts')",
|
|
20
|
+
default: "",
|
|
21
|
+
},
|
|
22
|
+
into: CommonSchemas.into,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
outputSchema: {
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "Diagnostic summary string (errors, warnings count or detailed list)",
|
|
28
|
+
},
|
|
29
|
+
riskDefault: "low",
|
|
30
|
+
isWrite: false,
|
|
31
|
+
execute: async ({ params, deps }) => {
|
|
32
|
+
const uri = String(params.uri ?? "");
|
|
33
|
+
return deps.getDiagnostics(uri);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../../src/recipes/tools/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E,YAAY,CAAC;IACX,EAAE,EAAE,iBAAiB;IACrB,SAAS,EAAE,aAAa;IACxB,WAAW,EACT,kGAAkG;IACpG,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,GAAG,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,mEAAmE;gBACrE,OAAO,EAAE,EAAE;aACZ;YACD,IAAI,EAAE,aAAa,CAAC,IAAI;SACzB;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,qEAAqE;KACxE;IACD,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;QAClC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACF,CAAC,CAAC"}
|