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
18 changes: 17 additions & 1 deletion data-machine-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,28 @@ function datamachine_code_register_system_abilities() {
return;
}

wp_register_ability_category(
'datamachine-code/workspace',
array(
'label' => __( 'Code Workspace', 'data-machine-code' ),
'description' => __( 'Git workspace management — clone, read, write, edit, and git operations.', 'data-machine-code' ),
)
);

wp_register_ability_category(
'datamachine-code/github',
array(
'label' => __( 'GitHub', 'data-machine-code' ),
'description' => __( 'GitHub issue, pull request, and repository operations.', 'data-machine-code' ),
)
);

wp_register_ability(
'datamachine/create-github-issue',
array(
'label' => 'Create GitHub Issue',
'description' => 'Create a new GitHub issue in a repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/github',
'input_schema' => array(
'type' => 'object',
'required' => array( 'title' ),
Expand Down
12 changes: 6 additions & 6 deletions inc/Abilities/GitHubAbilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private function registerAbilities(): void {
array(
'label' => 'List GitHub Issues',
'description' => 'List issues from a GitHub repository with optional filters',
'category' => 'datamachine',
'category' => 'datamachine-code/github',
'input_schema' => array(
'type' => 'object',
'required' => array( 'repo' ),
Expand Down Expand Up @@ -111,7 +111,7 @@ private function registerAbilities(): void {
array(
'label' => 'Get GitHub Issue',
'description' => 'Get a single GitHub issue with full details',
'category' => 'datamachine',
'category' => 'datamachine-code/github',
'input_schema' => array(
'type' => 'object',
'required' => array( 'repo', 'issue_number' ),
Expand Down Expand Up @@ -145,7 +145,7 @@ private function registerAbilities(): void {
array(
'label' => 'Update GitHub Issue',
'description' => 'Update a GitHub issue (title, body, labels, assignees, state)',
'category' => 'datamachine',
'category' => 'datamachine-code/github',
'input_schema' => array(
'type' => 'object',
'required' => array( 'repo', 'issue_number' ),
Expand Down Expand Up @@ -199,7 +199,7 @@ private function registerAbilities(): void {
array(
'label' => 'Comment on GitHub Issue',
'description' => 'Add a comment to a GitHub issue',
'category' => 'datamachine',
'category' => 'datamachine-code/github',
'input_schema' => array(
'type' => 'object',
'required' => array( 'repo', 'issue_number', 'body' ),
Expand Down Expand Up @@ -237,7 +237,7 @@ private function registerAbilities(): void {
array(
'label' => 'List GitHub Pull Requests',
'description' => 'List pull requests from a GitHub repository',
'category' => 'datamachine',
'category' => 'datamachine-code/github',
'input_schema' => array(
'type' => 'object',
'required' => array( 'repo' ),
Expand Down Expand Up @@ -280,7 +280,7 @@ private function registerAbilities(): void {
array(
'label' => 'List GitHub Repositories',
'description' => 'List repositories for a user or organization',
'category' => 'datamachine',
'category' => 'datamachine-code/github',
'input_schema' => array(
'type' => 'object',
'required' => array( 'owner' ),
Expand Down
32 changes: 16 additions & 16 deletions inc/Abilities/WorkspaceAbilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private function registerAbilities(): void {
array(
'label' => 'Get Workspace Path',
'description' => 'Get the agent workspace directory path. Optionally create the directory.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -80,7 +80,7 @@ private function registerAbilities(): void {
array(
'label' => 'List Workspace Repos',
'description' => 'List repositories in the agent workspace.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(),
Expand Down Expand Up @@ -116,7 +116,7 @@ private function registerAbilities(): void {
array(
'label' => 'Show Workspace Repo',
'description' => 'Show detailed info about a workspace repository (branch, remote, latest commit, dirty status).',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -154,7 +154,7 @@ private function registerAbilities(): void {
array(
'label' => 'Read Workspace File',
'description' => 'Read the contents of a text file from a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -203,7 +203,7 @@ private function registerAbilities(): void {
array(
'label' => 'List Workspace Directory',
'description' => 'List directory contents within a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -252,7 +252,7 @@ private function registerAbilities(): void {
array(
'label' => 'Clone Workspace Repo',
'description' => 'Clone a git repository into the workspace.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -287,7 +287,7 @@ private function registerAbilities(): void {
array(
'label' => 'Remove Workspace Repo',
'description' => 'Remove a repository from the workspace.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -316,7 +316,7 @@ private function registerAbilities(): void {
array(
'label' => 'Write Workspace File',
'description' => 'Create or overwrite a file in a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -355,7 +355,7 @@ private function registerAbilities(): void {
array(
'label' => 'Edit Workspace File',
'description' => 'Find-and-replace text in a workspace repository file.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -401,7 +401,7 @@ private function registerAbilities(): void {
array(
'label' => 'Workspace Git Status',
'description' => 'Get git status information for a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -439,7 +439,7 @@ private function registerAbilities(): void {
array(
'label' => 'Workspace Git Log',
'description' => 'Read git log entries for a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -484,7 +484,7 @@ private function registerAbilities(): void {
array(
'label' => 'Workspace Git Diff',
'description' => 'Read git diff output for a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -530,7 +530,7 @@ private function registerAbilities(): void {
array(
'label' => 'Workspace Git Pull',
'description' => 'Run git pull --ff-only for a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -564,7 +564,7 @@ private function registerAbilities(): void {
array(
'label' => 'Workspace Git Add',
'description' => 'Stage repository paths with git add.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -603,7 +603,7 @@ private function registerAbilities(): void {
array(
'label' => 'Workspace Git Commit',
'description' => 'Commit staged changes in a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down Expand Up @@ -638,7 +638,7 @@ private function registerAbilities(): void {
array(
'label' => 'Workspace Git Push',
'description' => 'Push commits for a workspace repository.',
'category' => 'datamachine',
'category' => 'datamachine-code/workspace',
'input_schema' => array(
'type' => 'object',
'properties' => array(
Expand Down
2 changes: 1 addition & 1 deletion inc/Tools/GitHubIssueTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GitHubIssueTool extends BaseTool {
* Constructor.
*/
public function __construct() {
$this->registerTool( 'create_github_issue', array( $this, 'getToolDefinition' ), array( 'chat', 'pipeline' ) );
$this->registerTool( 'create_github_issue', array( $this, 'getToolDefinition' ), array( 'chat', 'pipeline' ), array( 'ability' => 'datamachine/create-github-issue' ) );
}

/**
Expand Down
10 changes: 5 additions & 5 deletions inc/Tools/GitHubTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class GitHubTools extends BaseTool {
*/
public function __construct() {
$contexts = array( 'chat', 'pipeline' );
$this->registerTool( 'list_github_issues', array( $this, 'getListIssuesDefinition' ), $contexts );
$this->registerTool( 'get_github_issue', array( $this, 'getGetIssueDefinition' ), $contexts );
$this->registerTool( 'manage_github_issue', array( $this, 'getManageIssueDefinition' ), $contexts );
$this->registerTool( 'list_github_pulls', array( $this, 'getListPullsDefinition' ), $contexts );
$this->registerTool( 'list_github_repos', array( $this, 'getListReposDefinition' ), $contexts );
$this->registerTool( 'list_github_issues', array( $this, 'getListIssuesDefinition' ), $contexts, array( 'access_level' => 'editor' ) );
$this->registerTool( 'get_github_issue', array( $this, 'getGetIssueDefinition' ), $contexts, array( 'access_level' => 'editor' ) );
$this->registerTool( 'manage_github_issue', array( $this, 'getManageIssueDefinition' ), $contexts, array( 'access_level' => 'editor' ) );
$this->registerTool( 'list_github_pulls', array( $this, 'getListPullsDefinition' ), $contexts, array( 'access_level' => 'editor' ) );
$this->registerTool( 'list_github_repos', array( $this, 'getListReposDefinition' ), $contexts, array( 'access_level' => 'editor' ) );
}

/**
Expand Down
10 changes: 5 additions & 5 deletions inc/Tools/WorkspaceTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public function check_configuration( $configured, $tool_id ) {
*/
public function __construct() {
$contexts = array( 'chat', 'pipeline' );
$this->registerTool( 'workspace_path', array( $this, 'getPathDefinition' ), $contexts );
$this->registerTool( 'workspace_list', array( $this, 'getListDefinition' ), $contexts );
$this->registerTool( 'workspace_show', array( $this, 'getShowDefinition' ), $contexts );
$this->registerTool( 'workspace_ls', array( $this, 'getLsDefinition' ), $contexts );
$this->registerTool( 'workspace_read', array( $this, 'getReadDefinition' ), $contexts );
$this->registerTool( 'workspace_path', array( $this, 'getPathDefinition' ), $contexts, array( 'ability' => 'datamachine/workspace-path' ) );
$this->registerTool( 'workspace_list', array( $this, 'getListDefinition' ), $contexts, array( 'ability' => 'datamachine/workspace-list' ) );
$this->registerTool( 'workspace_show', array( $this, 'getShowDefinition' ), $contexts, array( 'ability' => 'datamachine/workspace-show' ) );
$this->registerTool( 'workspace_ls', array( $this, 'getLsDefinition' ), $contexts, array( 'ability' => 'datamachine/workspace-ls' ) );
$this->registerTool( 'workspace_read', array( $this, 'getReadDefinition' ), $contexts, array( 'ability' => 'datamachine/workspace-read' ) );
}

/**
Expand Down