OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
<?php
namespace Leantime\Domain\Tickets\Tools;
use Laravel\Mcp\Server\Tool;
use Laravel\Mcp\Server\Tools\ToolInputSchema;
use Laravel\Mcp\Server\Tools\ToolResult;
use Leantime\Domain\Tickets\Services\Tickets;
/**
* Add a new milestone to a project.
*/
class AddMilestoneTool extends Tool
{
public function __construct(
private Tickets $ticketsService,
) {}
/**
* Get the tool name.
*/
public function name(): string
{
return 'addMilestone';
}
/**
* Get the tool description.
*/
public function description(): string
{
return 'Adds a new milestone to the project. Milestones are used as hierarchical element to group tasks.';
}
/**
* Define the tool input schema.
*/
public function schema(ToolInputSchema $schema): ToolInputSchema
{
return $schema
->string('headline')->description('Title of the milestone.')->required()
->string('color')->description('Choose a color for this milestone using a hex code.')->required()
->string('editFrom')->description('Start date of the milestone in ISO8601 format (example: 2024-04-30T15:00:00-04:00).')->required()
->string('editTo')->description('End date of the milestone in ISO8601 format (example: 2024-04-30T15:00:00-04:00).')->required()
->integer('projectId')->description('Project ID.')->required()
->integer('editorId')->description('Editor ID.')->required()
->integer('dependentMilestone')->description('Dependent milestone ID.');
}
/**
* Handle the tool request.
*/
public function handle(array $arguments): ToolResult
{
$params = [
'headline' => $arguments['headline'],
'projectId' => (int) ($arguments['projectId'] ?? 0),
'editorId' => (int) ($arguments['editorId'] ?? 0),
'dependentMilestone' => ($arguments['dependentMilestone'] ?? null),
'tags' => $arguments['color'],
'editFrom' => $arguments['editFrom'],
'editTo' => $arguments['editTo'],
];
$result = $this->ticketsService->quickAddMilestone($params);
if ($result) {
return ToolResult::text("Milestone created successfully with ID: {$result}");
}
return ToolResult::error('Failed to create milestone.');
}
}