patchwork-os 0.2.0-alpha.2 → 0.2.0-alpha.22
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/dist/approvalHttp.d.ts +11 -2
- package/dist/approvalHttp.js +98 -10
- package/dist/approvalHttp.js.map +1 -1
- package/dist/approvalQueue.d.ts +12 -1
- package/dist/approvalQueue.js +25 -3
- package/dist/approvalQueue.js.map +1 -1
- package/dist/automation.d.ts +20 -0
- package/dist/automation.js +35 -0
- package/dist/automation.js.map +1 -1
- package/dist/bridge.js +145 -23
- package/dist/bridge.js.map +1 -1
- package/dist/bridgeToken.js +57 -19
- package/dist/bridgeToken.js.map +1 -1
- package/dist/claudeDriver.d.ts +3 -1
- package/dist/claudeDriver.js +48 -0
- package/dist/claudeDriver.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 +256 -0
- package/dist/commands/recipe.js +1313 -0
- package/dist/commands/recipe.js.map +1 -0
- package/dist/config.d.ts +15 -2
- package/dist/config.js +94 -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/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 +93 -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/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 +117 -0
- package/dist/connectors/linear.js +239 -0
- package/dist/connectors/linear.js.map +1 -0
- 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 +43 -0
- package/dist/connectors/sentry.js +188 -0
- package/dist/connectors/sentry.js.map +1 -0
- 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/tokenStorage.d.ts +35 -0
- package/dist/connectors/tokenStorage.js +394 -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/claude/api.d.ts +11 -0
- package/dist/drivers/claude/api.js +54 -0
- package/dist/drivers/claude/api.js.map +1 -0
- package/dist/drivers/claude/envSanitizer.d.ts +7 -0
- package/dist/drivers/claude/envSanitizer.js +18 -0
- package/dist/drivers/claude/envSanitizer.js.map +1 -0
- package/dist/drivers/claude/streamParser.d.ts +38 -0
- package/dist/drivers/claude/streamParser.js +34 -0
- package/dist/drivers/claude/streamParser.js.map +1 -0
- package/dist/drivers/claude/subprocess.d.ts +19 -0
- package/dist/drivers/claude/subprocess.js +216 -0
- package/dist/drivers/claude/subprocess.js.map +1 -0
- package/dist/drivers/claude/subprocessSettings.d.ts +9 -0
- package/dist/drivers/claude/subprocessSettings.js +55 -0
- package/dist/drivers/claude/subprocessSettings.js.map +1 -0
- package/dist/drivers/gemini/index.d.ts +18 -0
- package/dist/drivers/gemini/index.js +210 -0
- package/dist/drivers/gemini/index.js.map +1 -0
- package/dist/drivers/grok/index.d.ts +11 -0
- package/dist/drivers/grok/index.js +22 -0
- package/dist/drivers/grok/index.js.map +1 -0
- package/dist/drivers/index.d.ts +23 -0
- package/dist/drivers/index.js +31 -0
- package/dist/drivers/index.js.map +1 -0
- package/dist/drivers/openai/index.d.ts +24 -0
- package/dist/drivers/openai/index.js +110 -0
- package/dist/drivers/openai/index.js.map +1 -0
- package/dist/drivers/types.d.ts +72 -0
- package/dist/drivers/types.js +30 -0
- package/dist/drivers/types.js.map +1 -0
- 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 +543 -37
- 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/recipes/chainedRunner.d.ts +104 -0
- package/dist/recipes/chainedRunner.js +359 -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 +1 -0
- package/dist/recipes/legacyRecipeCompat.js +97 -0
- package/dist/recipes/legacyRecipeCompat.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 +135 -41
- package/dist/recipes/scheduler.js.map +1 -1
- package/dist/recipes/schemaGenerator.d.ts +28 -0
- package/dist/recipes/schemaGenerator.js +484 -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/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/index.d.ts +18 -0
- package/dist/recipes/tools/index.js +21 -0
- package/dist/recipes/tools/index.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/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/yamlRunner.d.ts +79 -0
- package/dist/recipes/yamlRunner.js +612 -346
- package/dist/recipes/yamlRunner.js.map +1 -1
- package/dist/recipesHttp.d.ts +14 -1
- package/dist/recipesHttp.js +21 -4
- 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/server.d.ts +19 -1
- package/dist/server.js +682 -31
- 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/ctxGetTaskContext.d.ts +4 -1
- package/dist/tools/ctxGetTaskContext.js +45 -2
- package/dist/tools/ctxGetTaskContext.js.map +1 -1
- 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/fetchLinearIssue.d.ts +112 -0
- package/dist/tools/fetchLinearIssue.js +129 -0
- package/dist/tools/fetchLinearIssue.js.map +1 -0
- package/dist/tools/fetchSentryIssue.d.ts +143 -0
- package/dist/tools/fetchSentryIssue.js +150 -0
- package/dist/tools/fetchSentryIssue.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 +36 -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/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 +4 -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 +21 -5
- 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;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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;IACvB,WAAW,EACT,mEAAmE;IACrE,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;YAC7D,WAAW,EAAE;gBACX,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,iDAAiD;gBAC9D,OAAO,EAAE,IAAI;aACd;YACD,IAAI,EAAE,aAAa,CAAC,IAAI;SACzB;QACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACtB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,MAAM,EA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,EAAE;qBACxB;iBACF;aACF;YACD,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,sBAAsB,EAAE,GAAG,MAAM,MAAM,CAC7C,gCAAgC,CACjC,CAAC;QACF,MAAM,SAAS,GAAG,sBAAsB,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,UAAU,CACvC,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CACrD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACzB,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,GAAG,EAAE,CAAC,CAAC,GAAG;gBACV,IAAI,EAAE,CAAC,CAAC,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,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagnostics tool — diagnostics.get
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
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"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File tools — file.read, file.write, file.append
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
7
|
+
import { dirname } from "node:path";
|
|
8
|
+
import { assertWriteAllowed } from "../../featureFlags.js";
|
|
9
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
10
|
+
function expandHome(p) {
|
|
11
|
+
if (p.startsWith("~/")) {
|
|
12
|
+
return `${process.env.HOME ?? process.env.USERPROFILE}${p.slice(1)}`;
|
|
13
|
+
}
|
|
14
|
+
return p;
|
|
15
|
+
}
|
|
16
|
+
function ensureDir(p) {
|
|
17
|
+
const dir = dirname(p);
|
|
18
|
+
if (dir && dir !== "." && !existsSync(dir)) {
|
|
19
|
+
mkdirSync(dir, { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// file.read
|
|
24
|
+
// ============================================================================
|
|
25
|
+
registerTool({
|
|
26
|
+
id: "file.read",
|
|
27
|
+
namespace: "file",
|
|
28
|
+
description: "Read file content into context. Supports optional flag to allow missing files.",
|
|
29
|
+
paramsSchema: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
path: CommonSchemas.filePath,
|
|
33
|
+
optional: CommonSchemas.optional,
|
|
34
|
+
into: CommonSchemas.into,
|
|
35
|
+
},
|
|
36
|
+
required: ["path"],
|
|
37
|
+
},
|
|
38
|
+
outputSchema: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "File content as string (or empty if optional and missing)",
|
|
41
|
+
},
|
|
42
|
+
riskDefault: "low",
|
|
43
|
+
isWrite: false,
|
|
44
|
+
execute: async ({ params, step, deps }) => {
|
|
45
|
+
const p = expandHome(params.path);
|
|
46
|
+
const optional = step.optional ?? false;
|
|
47
|
+
try {
|
|
48
|
+
return deps.readFile(p);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
if (optional)
|
|
52
|
+
return "";
|
|
53
|
+
throw new Error(`file.read: could not read ${p}`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
// ============================================================================
|
|
58
|
+
// file.write
|
|
59
|
+
// ============================================================================
|
|
60
|
+
registerTool({
|
|
61
|
+
id: "file.write",
|
|
62
|
+
namespace: "file",
|
|
63
|
+
description: "Write content to a file path (creates directories as needed).",
|
|
64
|
+
paramsSchema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: {
|
|
67
|
+
path: CommonSchemas.filePath,
|
|
68
|
+
content: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "Content to write (supports {{template}} substitution)",
|
|
71
|
+
},
|
|
72
|
+
into: CommonSchemas.into,
|
|
73
|
+
},
|
|
74
|
+
required: ["path", "content"],
|
|
75
|
+
},
|
|
76
|
+
outputSchema: {
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {
|
|
79
|
+
path: { type: "string" },
|
|
80
|
+
bytesWritten: { type: "number" },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
riskDefault: "medium",
|
|
84
|
+
isWrite: true,
|
|
85
|
+
execute: async ({ params, deps }) => {
|
|
86
|
+
assertWriteAllowed("file.write");
|
|
87
|
+
const p = expandHome(params.path);
|
|
88
|
+
const content = params.content;
|
|
89
|
+
ensureDir(p);
|
|
90
|
+
deps.writeFile(p, content);
|
|
91
|
+
return JSON.stringify({ path: p, bytesWritten: content.length });
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
// ============================================================================
|
|
95
|
+
// file.append
|
|
96
|
+
// ============================================================================
|
|
97
|
+
registerTool({
|
|
98
|
+
id: "file.append",
|
|
99
|
+
namespace: "file",
|
|
100
|
+
description: "Append content to a file (creates if missing). Supports conditional 'when' clause.",
|
|
101
|
+
paramsSchema: {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
path: CommonSchemas.filePath,
|
|
105
|
+
content: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "Content to append (supports {{template}} substitution)",
|
|
108
|
+
},
|
|
109
|
+
when: CommonSchemas.when,
|
|
110
|
+
into: CommonSchemas.into,
|
|
111
|
+
},
|
|
112
|
+
required: ["path", "content"],
|
|
113
|
+
},
|
|
114
|
+
outputSchema: {
|
|
115
|
+
type: "object",
|
|
116
|
+
properties: {
|
|
117
|
+
path: { type: "string" },
|
|
118
|
+
bytesAppended: { type: "number" },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
riskDefault: "medium",
|
|
122
|
+
isWrite: true,
|
|
123
|
+
execute: async ({ params, step, deps }) => {
|
|
124
|
+
assertWriteAllowed("file.append");
|
|
125
|
+
const p = expandHome(params.path);
|
|
126
|
+
const content = params.content;
|
|
127
|
+
// 'when' condition is evaluated before executeStep is called in yamlRunner
|
|
128
|
+
// but we check here too for direct registry usage
|
|
129
|
+
const when = step.when;
|
|
130
|
+
if (when && !evalCondition(when, {})) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
ensureDir(p);
|
|
134
|
+
deps.appendFile(p, content);
|
|
135
|
+
return JSON.stringify({ path: p, bytesAppended: content.length });
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* Minimal condition evaluator for 'when' clauses.
|
|
140
|
+
* Note: yamlRunner.ts has a more complete evalWhen that runs before executeStep.
|
|
141
|
+
* This is a fallback for direct registry usage.
|
|
142
|
+
*/
|
|
143
|
+
function evalCondition(expr, _ctx) {
|
|
144
|
+
// Simple numeric comparisons: "N > 0"
|
|
145
|
+
const match = expr.match(/^\s*(\w+)\s*([><=!]+)\s*(\d+)\s*$/);
|
|
146
|
+
if (match) {
|
|
147
|
+
const [, _var, op, val] = match;
|
|
148
|
+
if (!op || !val)
|
|
149
|
+
return false;
|
|
150
|
+
const num = 0; // Would resolve from ctx in full implementation
|
|
151
|
+
const cmp = parseInt(val, 10);
|
|
152
|
+
switch (op) {
|
|
153
|
+
case ">":
|
|
154
|
+
return num > cmp;
|
|
155
|
+
case ">=":
|
|
156
|
+
return num >= cmp;
|
|
157
|
+
case "<":
|
|
158
|
+
return num < cmp;
|
|
159
|
+
case "<=":
|
|
160
|
+
return num <= cmp;
|
|
161
|
+
case "==":
|
|
162
|
+
return num === cmp;
|
|
163
|
+
case "!=":
|
|
164
|
+
return num !== cmp;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Default: evaluate truthy
|
|
168
|
+
return expr.length > 0;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/recipes/tools/file.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjE,SAAS,UAAU,CAAC,CAAS;IAC3B,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,KAAK,CAA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AIG;AACH,SAAS,aAAa,CAAC,IAAY,EAAE,IAA6B;IAChE,sCAAsC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAC9D,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG;YAAE,OAAO,KAAK,CAAC;QAC9B,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,gDAAgD;QAC/D,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC9B,QAAQ,EAAE,EAAE,CAAC;YACX,KAAK,GAAG;gBACN,OAAO,GAAG,GAAG,GAAG,CAAC;YACnB,KAAK,IAAI;gBACP,OAAO,GAAG,IAAI,GAAG,CAAC;YACpB,KAAK,GAAG;gBACN,OAAO,GAAG,GAAG,GAAG,CAAC;YACnB,KAAK,IAAI;gBACP,OAAO,GAAG,IAAI,GAAG,CAAC;YACpB,KAAK,IAAI;gBACP,OAAO,GAAG,KAAK,GAAG,CAAC;YACrB,KAAK,IAAI;gBACP,OAAO,GAAG,KAAK,GAAG,CAAC;QACvB,CAAC;IACH,CAAC;IACD,2BAA2B;IAC3B,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git tools — git.log_since, git.stale_branches
|
|
3
|
+
*
|
|
4
|
+
* Self-registering tool module for the recipe tool registry.
|
|
5
|
+
*/
|
|
6
|
+
import { CommonSchemas, registerTool } from "../toolRegistry.js";
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// git.log_since
|
|
9
|
+
// ============================================================================
|
|
10
|
+
registerTool({
|
|
11
|
+
id: "git.log_since",
|
|
12
|
+
namespace: "git",
|
|
13
|
+
description: "Get git log since a time expression (e.g., '24h', '7d', '2026-01-01').",
|
|
14
|
+
paramsSchema: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
since: CommonSchemas.since,
|
|
18
|
+
into: CommonSchemas.into,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
outputSchema: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Git log output as newline-separated commits",
|
|
24
|
+
},
|
|
25
|
+
riskDefault: "low",
|
|
26
|
+
isWrite: false,
|
|
27
|
+
execute: async ({ params, deps }) => {
|
|
28
|
+
const since = params.since ?? "24h";
|
|
29
|
+
// Use injected gitLogSince for testability
|
|
30
|
+
return deps.gitLogSince(since, deps.workdir);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// git.stale_branches
|
|
35
|
+
// ============================================================================
|
|
36
|
+
registerTool({
|
|
37
|
+
id: "git.stale_branches",
|
|
38
|
+
namespace: "git",
|
|
39
|
+
description: "List branches with no activity in N days.",
|
|
40
|
+
paramsSchema: {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
days: {
|
|
44
|
+
type: "number",
|
|
45
|
+
description: "Number of days of inactivity to consider stale",
|
|
46
|
+
default: 30,
|
|
47
|
+
},
|
|
48
|
+
into: CommonSchemas.into,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
outputSchema: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "List of stale branches with last commit dates",
|
|
54
|
+
},
|
|
55
|
+
riskDefault: "low",
|
|
56
|
+
isWrite: false,
|
|
57
|
+
execute: async ({ params, deps }) => {
|
|
58
|
+
const days = typeof params.days === "number" ? params.days : 30;
|
|
59
|
+
// Use injected gitStaleBranches for testability
|
|
60
|
+
return deps.gitStaleBranches(days, deps.workdir);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js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