Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import { boardTools } from "./tools/boards.ts";
import { cardTools } from "./tools/cards.ts";
import { commentTools } from "./tools/comments.ts";
import { fileTools } from "./tools/files.ts";
import { labelTools } from "./tools/labels.ts";
import { listTools } from "./tools/lists.ts";
import { meTools } from "./tools/me.ts";
Expand All @@ -32,6 +33,7 @@ const otperPlugin = {
...listTools(config),
...cardTools(config),
...commentTools(config),
...fileTools(config),
...labelTools(config),
...teamTools(config),
...priorityTools(config),
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ssntpl/openclaw-otper",
"version": "0.1.3",
"version": "0.1.4",
"description": "OpenClaw plugin for Otper boards (https://otper.com) — exposes Otper boards, lists, cards, labels, comments, and today's priorities as agent tools.",
"author": "SSNTPL <info@ssntpl.com>",
"license": "MIT",
Expand Down Expand Up @@ -39,7 +39,7 @@
]
},
"dependencies": {
"@ssntpl/otper-cli": "^0.1.7"
"@ssntpl/otper-cli": "^0.1.8"
},
"devDependencies": {
"@types/node": "^20.16.10",
Expand Down
98 changes: 98 additions & 0 deletions tools/files.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { files } from "@ssntpl/otper-cli";
import { clientFor, json, PluginConfig } from "./shared.ts";

export function fileTools(config: PluginConfig) {
return [
{
name: "otper_attach_file_to_card",
label: "Otper: attach file to card",
description:
"Upload a local file from disk and attach it to a card. Provide the absolute path to the file and the target card id. MIME type is detected from the extension; override with mimeType if needed.",
parameters: {
type: "object",
properties: {
cardId: { type: "string", description: "Card id to attach the file to." },
filePath: {
type: "string",
description: "Absolute path to the file on the local filesystem.",
},
filename: {
type: "string",
description:
"Optional: filename to send to the server. Defaults to the basename of filePath.",
},
mimeType: {
type: "string",
description:
"Optional: override the MIME type (e.g. image/png). Detected from extension by default.",
},
},
required: ["cardId", "filePath"],
},
execute: async (
_id: string,
p: {
cardId: string;
filePath: string;
filename?: string;
mimeType?: string;
},
) => {
const client = clientFor(config);
return json(
await files.uploadFile(client, {
cardId: p.cardId,
filePath: p.filePath,
filename: p.filename,
mimeType: p.mimeType,
}),
);
},
},
{
name: "otper_attach_file_to_comment",
label: "Otper: attach file to comment",
description:
"Upload a local file from disk and attach it to a comment. Both the comment id and the parent card id are required (Otper stores the file under the card).",
parameters: {
type: "object",
properties: {
commentId: { type: "string", description: "Comment id to attach the file to." },
cardId: {
type: "string",
description: "Id of the card the comment belongs to.",
},
filePath: {
type: "string",
description: "Absolute path to the file on the local filesystem.",
},
filename: { type: "string", description: "Optional override filename." },
mimeType: { type: "string", description: "Optional override MIME type." },
},
required: ["commentId", "cardId", "filePath"],
},
execute: async (
_id: string,
p: {
commentId: string;
cardId: string;
filePath: string;
filename?: string;
mimeType?: string;
},
) => {
const client = clientFor(config);
return json(
await files.uploadFile(client, {
cardId: p.cardId,
ownerType: "Comment",
ownerId: p.commentId,
filePath: p.filePath,
filename: p.filename,
mimeType: p.mimeType,
}),
);
},
},
];
}
Loading