Skip to content

Commit 5370db2

Browse files
committed
chore: apply release lint fixes
1 parent beeeaf9 commit 5370db2

177 files changed

Lines changed: 67034 additions & 63651 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

data-machine-code.php

Lines changed: 585 additions & 540 deletions
Large diffs are not rendered by default.

inc/Abilities/CodeTaskAbilities.php

Lines changed: 95 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -11,102 +11,109 @@
1111
use DataMachineCode\CodeTask\CodeTaskCreator;
1212
use DataMachineCode\CodeTask\EvidencePacket;
1313

14-
defined( 'ABSPATH' ) || exit;
14+
defined('ABSPATH') || exit;
1515

16-
class CodeTaskAbilities {
16+
class CodeTaskAbilities
17+
{
1718

18-
private static bool $registered = false;
19+
private static bool $registered = false;
1920

20-
public function __construct() {
21-
if ( self::$registered ) {
22-
return;
23-
}
21+
public function __construct()
22+
{
23+
if (self::$registered ) {
24+
return;
25+
}
2426

25-
if ( ! function_exists( 'wp_register_ability' ) ) {
26-
add_action( 'wp_abilities_api_init', function (): void {
27-
if ( self::$registered || ! function_exists( 'wp_register_ability' ) ) {
28-
return;
29-
}
27+
if (! function_exists('wp_register_ability') ) {
28+
add_action(
29+
'wp_abilities_api_init', function (): void {
30+
if (self::$registered || ! function_exists('wp_register_ability') ) {
31+
return;
32+
}
3033

31-
$this->register();
32-
self::$registered = true;
33-
} );
34-
return;
35-
}
34+
$this->register();
35+
self::$registered = true;
36+
}
37+
);
38+
return;
39+
}
3640

37-
if ( function_exists( 'doing_action' ) && doing_action( 'wp_abilities_api_init' ) ) {
38-
$this->register();
39-
} else {
40-
add_action( 'wp_abilities_api_init', array( $this, 'register' ) );
41-
}
42-
self::$registered = true;
43-
}
41+
if (function_exists('doing_action') && doing_action('wp_abilities_api_init') ) {
42+
$this->register();
43+
} else {
44+
add_action('wp_abilities_api_init', array( $this, 'register' ));
45+
}
46+
self::$registered = true;
47+
}
4448

45-
public function register(): void {
46-
wp_register_ability(
47-
'datamachine/create-code-task',
48-
array(
49-
'label' => 'Create Code Task',
50-
'description' => 'Create an isolated workspace worktree from a structured evidence packet.',
51-
'category' => 'datamachine-code-code-task',
52-
'input_schema' => self::input_schema(),
53-
'output_schema' => array(
54-
'type' => 'object',
55-
'properties' => array(
56-
'success' => array( 'type' => 'boolean' ),
57-
'repo' => array( 'type' => 'string' ),
58-
'branch' => array( 'type' => 'string' ),
59-
'handle' => array( 'type' => 'string' ),
60-
'path' => array( 'type' => 'string' ),
61-
'prompt_path' => array( 'type' => 'string' ),
62-
'packet_path' => array( 'type' => 'string' ),
63-
'source_url' => array( 'type' => 'string' ),
64-
),
65-
),
66-
'execute_callback' => array( self::class, 'create' ),
67-
'permission_callback' => fn() => PermissionHelper::can_manage(),
68-
'meta' => array( 'show_in_rest' => false ),
69-
)
70-
);
71-
}
49+
public function register(): void
50+
{
51+
wp_register_ability(
52+
'datamachine/create-code-task',
53+
array(
54+
'label' => 'Create Code Task',
55+
'description' => 'Create an isolated workspace worktree from a structured evidence packet.',
56+
'category' => 'datamachine-code-code-task',
57+
'input_schema' => self::input_schema(),
58+
'output_schema' => array(
59+
'type' => 'object',
60+
'properties' => array(
61+
'success' => array( 'type' => 'boolean' ),
62+
'repo' => array( 'type' => 'string' ),
63+
'branch' => array( 'type' => 'string' ),
64+
'handle' => array( 'type' => 'string' ),
65+
'path' => array( 'type' => 'string' ),
66+
'prompt_path' => array( 'type' => 'string' ),
67+
'packet_path' => array( 'type' => 'string' ),
68+
'source_url' => array( 'type' => 'string' ),
69+
),
70+
),
71+
'execute_callback' => array( self::class, 'create' ),
72+
'permission_callback' => fn() => PermissionHelper::can_manage(),
73+
'meta' => array( 'show_in_rest' => false ),
74+
)
75+
);
76+
}
7277

73-
/**
74-
* @return array<string,mixed>
75-
*/
76-
public static function input_schema(): array {
77-
return array(
78-
'type' => 'object',
79-
'required' => array( 'packet' ),
80-
'properties' => array(
81-
'packet' => array(
82-
'type' => 'object',
83-
'description' => 'Structured evidence packet describing the source evidence and target repository.',
84-
),
85-
'branch' => array(
86-
'type' => 'string',
87-
'description' => 'Optional explicit branch name. Defaults to deterministic code-task/<source>-<title>-<hash>.',
88-
),
89-
'base_ref' => array(
90-
'type' => 'string',
91-
'description' => 'Optional base ref for the worktree. Defaults to origin/main.',
92-
),
93-
'allow_stale' => array( 'type' => 'boolean' ),
94-
'force' => array( 'type' => 'boolean' ),
95-
),
96-
);
97-
}
78+
/**
79+
* @return array<string,mixed>
80+
*/
81+
public static function input_schema(): array
82+
{
83+
return array(
84+
'type' => 'object',
85+
'required' => array( 'packet' ),
86+
'properties' => array(
87+
'packet' => array(
88+
'type' => 'object',
89+
'description' => 'Structured evidence packet describing the source evidence and target repository.',
90+
),
91+
'branch' => array(
92+
'type' => 'string',
93+
'description' => 'Optional explicit branch name. Defaults to deterministic code-task/<source>-<title>-<hash>.',
94+
),
95+
'base_ref' => array(
96+
'type' => 'string',
97+
'description' => 'Optional base ref for the worktree. Defaults to origin/main.',
98+
),
99+
'allow_stale' => array( 'type' => 'boolean' ),
100+
'force' => array( 'type' => 'boolean' ),
101+
),
102+
);
103+
}
98104

99-
/**
100-
* @param array<string,mixed> $input Ability input.
101-
* @return array<string,mixed>|\WP_Error
102-
*/
103-
public static function create( array $input ): array|\WP_Error {
104-
$packet = EvidencePacket::from_array( $input['packet'] ?? null );
105-
if ( $packet instanceof \WP_Error ) {
106-
return $packet;
107-
}
105+
/**
106+
* @param array<string,mixed> $input Ability input.
107+
* @return array<string,mixed>|\WP_Error
108+
*/
109+
public static function create( array $input ): array|\WP_Error
110+
{
111+
$packet = EvidencePacket::from_array($input['packet'] ?? null);
112+
if ($packet instanceof \WP_Error ) {
113+
return $packet;
114+
}
108115

109-
$creator = new CodeTaskCreator();
110-
return $creator->create( $packet, $input );
111-
}
116+
$creator = new CodeTaskCreator();
117+
return $creator->create($packet, $input);
118+
}
112119
}

0 commit comments

Comments
 (0)