Skip to content

Commit 57dcac8

Browse files
authored
Merge pull request #582 from Extra-Chill/fix-clean-remote-active-worktrees
Fix cleanup for remote-tracking active worktrees
2 parents 3ce82ca + bf0e300 commit 57dcac8

14 files changed

Lines changed: 521 additions & 126 deletions

inc/Abilities/AbilityRegistry.php

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,13 @@
1111

1212
class AbilityRegistry {
1313

14-
public static function canonical_slug( string $slug ): string {
15-
if ( str_starts_with($slug, 'datamachine/') ) {
16-
return 'datamachine-code/' . substr($slug, strlen('datamachine/'));
17-
}
18-
19-
return $slug;
20-
}
21-
2214
/**
23-
* Register a DMC-owned ability and, for shipped datamachine/* slugs, a deprecated alias.
15+
* Register a DMC-owned ability.
2416
*
25-
* @param string $slug Legacy or canonical ability slug.
17+
* @param string $slug Canonical ability slug.
2618
* @param array<string,mixed> $args Ability registration args.
2719
*/
2820
public static function register( string $slug, array $args ): void {
29-
$canonical = self::canonical_slug($slug);
30-
wp_register_ability($canonical, $args);
31-
32-
if ( $canonical === $slug || ! str_starts_with($slug, 'datamachine/') ) {
33-
return;
34-
}
35-
36-
$alias_args = $args;
37-
$alias_args['meta'] = array_merge(
38-
$alias_args['meta'] ?? array(),
39-
array(
40-
'deprecated' => true,
41-
'replacement' => $canonical,
42-
)
43-
);
44-
45-
wp_register_ability($slug, $alias_args);
21+
wp_register_ability($slug, $args);
4622
}
4723
}

inc/Abilities/CodeTaskAbilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct() {
5252

5353
public function register(): void {
5454
AbilityRegistry::register(
55-
'datamachine/create-code-task',
55+
'datamachine-code/create-code-task',
5656
array(
5757
'label' => 'Create Code Task',
5858
'description' => 'Create an isolated workspace worktree from a structured evidence packet.',

inc/Abilities/GitHubAbilities.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function __construct() {
107107
private function registerAbilities(): void {
108108
$register_callback = function () {
109109
AbilityRegistry::register(
110-
'datamachine/list-github-issues',
110+
'datamachine-code/list-github-issues',
111111
array(
112112
'label' => 'List GitHub Issues',
113113
'description' => 'List issues from a GitHub repository with optional filters',
@@ -162,7 +162,7 @@ private function registerAbilities(): void {
162162
);
163163

164164
AbilityRegistry::register(
165-
'datamachine/get-github-issue',
165+
'datamachine-code/get-github-issue',
166166
array(
167167
'label' => 'Get GitHub Issue',
168168
'description' => 'Get a single GitHub issue with full details',
@@ -196,7 +196,7 @@ private function registerAbilities(): void {
196196
);
197197

198198
AbilityRegistry::register(
199-
'datamachine/update-github-issue',
199+
'datamachine-code/update-github-issue',
200200
array(
201201
'label' => 'Update GitHub Issue',
202202
'description' => 'Update a GitHub issue (title, body, labels, assignees, state)',
@@ -252,7 +252,7 @@ private function registerAbilities(): void {
252252
);
253253

254254
AbilityRegistry::register(
255-
'datamachine/create-github-issue',
255+
'datamachine-code/create-github-issue',
256256
array(
257257
'label' => 'Create GitHub Issue',
258258
'description' => 'Create a new GitHub issue with optional labels, assignees, and milestone',
@@ -304,7 +304,7 @@ private function registerAbilities(): void {
304304
);
305305

306306
AbilityRegistry::register(
307-
'datamachine/create-github-pull-request',
307+
'datamachine-code/create-github-pull-request',
308308
array(
309309
'label' => 'Create GitHub Pull Request',
310310
'description' => 'Open a new GitHub pull request from a head branch into a base branch',
@@ -371,7 +371,7 @@ private function registerAbilities(): void {
371371
);
372372

373373
AbilityRegistry::register(
374-
'datamachine/comment-github-issue',
374+
'datamachine-code/comment-github-issue',
375375
array(
376376
'label' => 'Comment on GitHub Issue',
377377
'description' => 'Add a comment to a GitHub issue',
@@ -413,7 +413,7 @@ private function registerAbilities(): void {
413413
);
414414

415415
AbilityRegistry::register(
416-
'datamachine/comment-github-pull-request',
416+
'datamachine-code/comment-github-pull-request',
417417
array(
418418
'label' => 'Comment on GitHub Pull Request',
419419
'description' => 'Add a comment to a GitHub pull request without broader issue-management permissions',
@@ -455,7 +455,7 @@ private function registerAbilities(): void {
455455
);
456456

457457
AbilityRegistry::register(
458-
'datamachine/add-github-labels',
458+
'datamachine-code/add-github-labels',
459459
array(
460460
'label' => 'Add GitHub Labels',
461461
'description' => 'Add one or more labels to a GitHub issue or pull request without replacing existing labels.',
@@ -487,7 +487,7 @@ private function registerAbilities(): void {
487487
);
488488

489489
AbilityRegistry::register(
490-
'datamachine/remove-github-label',
490+
'datamachine-code/remove-github-label',
491491
array(
492492
'label' => 'Remove GitHub Label',
493493
'description' => 'Remove a single label from a GitHub issue or pull request without touching other labels.',
@@ -518,7 +518,7 @@ private function registerAbilities(): void {
518518
);
519519

520520
AbilityRegistry::register(
521-
'datamachine/upsert-github-pull-review-comment',
521+
'datamachine-code/upsert-github-pull-review-comment',
522522
array(
523523
'label' => 'Upsert GitHub Pull Request Review Comment',
524524
'description' => 'Create or update one managed bot-authored GitHub pull request review comment identified by a hidden marker',
@@ -570,7 +570,7 @@ private function registerAbilities(): void {
570570
);
571571

572572
AbilityRegistry::register(
573-
'datamachine/merge-github-pull-request',
573+
'datamachine-code/merge-github-pull-request',
574574
array(
575575
'label' => 'Merge GitHub Pull Request',
576576
'description' => 'Merge an open GitHub pull request after verifying the expected head SHA',
@@ -623,7 +623,7 @@ private function registerAbilities(): void {
623623
);
624624

625625
AbilityRegistry::register(
626-
'datamachine/cleanup-github-pull-request',
626+
'datamachine-code/cleanup-github-pull-request',
627627
array(
628628
'label' => 'Cleanup GitHub Pull Request',
629629
'description' => 'Delete a merged pull request head branch through the GitHub API without checking out local branches',
@@ -672,7 +672,7 @@ private function registerAbilities(): void {
672672
);
673673

674674
AbilityRegistry::register(
675-
'datamachine/list-github-pulls',
675+
'datamachine-code/list-github-pulls',
676676
array(
677677
'label' => 'List GitHub Pull Requests',
678678
'description' => 'List pull requests from a GitHub repository',
@@ -715,7 +715,7 @@ private function registerAbilities(): void {
715715
);
716716

717717
AbilityRegistry::register(
718-
'datamachine/get-github-pull',
718+
'datamachine-code/get-github-pull',
719719
array(
720720
'label' => 'Get GitHub Pull Request',
721721
'description' => 'Get a single GitHub pull request with normalized metadata',
@@ -749,7 +749,7 @@ private function registerAbilities(): void {
749749
);
750750

751751
AbilityRegistry::register(
752-
'datamachine/list-github-pull-files',
752+
'datamachine-code/list-github-pull-files',
753753
array(
754754
'label' => 'List GitHub Pull Request Files',
755755
'description' => 'List changed files for a GitHub pull request',
@@ -792,7 +792,7 @@ private function registerAbilities(): void {
792792
);
793793

794794
AbilityRegistry::register(
795-
'datamachine/get-github-check-runs',
795+
'datamachine-code/get-github-check-runs',
796796
array(
797797
'label' => 'Get GitHub Check Runs',
798798
'description' => 'Get GitHub check runs for a commit SHA or ref with an overall summary',
@@ -837,7 +837,7 @@ private function registerAbilities(): void {
837837
);
838838

839839
AbilityRegistry::register(
840-
'datamachine/get-github-commit-statuses',
840+
'datamachine-code/get-github-commit-statuses',
841841
array(
842842
'label' => 'Get GitHub Commit Statuses',
843843
'description' => 'Get unmanaged GitHub commit statuses for a commit SHA or ref',
@@ -874,7 +874,7 @@ private function registerAbilities(): void {
874874
);
875875

876876
AbilityRegistry::register(
877-
'datamachine/get-github-actions-artifact',
877+
'datamachine-code/get-github-actions-artifact',
878878
array(
879879
'label' => 'Get GitHub Actions Artifact',
880880
'description' => 'Download a GitHub Actions artifact for a pull request or commit SHA and optionally parse JSON files from the ZIP',
@@ -928,7 +928,7 @@ private function registerAbilities(): void {
928928
);
929929

930930
AbilityRegistry::register(
931-
'datamachine/get-github-pull-review-context',
931+
'datamachine-code/get-github-pull-review-context',
932932
array(
933933
'label' => 'Get GitHub Pull Request Review Context',
934934
'description' => 'Get a review-ready payload for a GitHub pull request and its changed files',
@@ -1014,7 +1014,7 @@ private function registerAbilities(): void {
10141014
);
10151015

10161016
AbilityRegistry::register(
1017-
'datamachine/get-github-repo-review-profile',
1017+
'datamachine-code/get-github-repo-review-profile',
10181018
array(
10191019
'label' => 'Get GitHub Repository Review Profile',
10201020
'description' => 'Get bounded repository-level review context for a GitHub repository',
@@ -1064,7 +1064,7 @@ private function registerAbilities(): void {
10641064
);
10651065

10661066
AbilityRegistry::register(
1067-
'datamachine/get-github-pr-documentation-impact',
1067+
'datamachine-code/get-github-pr-documentation-impact',
10681068
array(
10691069
'label' => 'Get GitHub PR Documentation Impact',
10701070
'description' => 'Build a heuristic documentation-impact packet for a GitHub pull request',
@@ -1110,7 +1110,7 @@ private function registerAbilities(): void {
11101110
);
11111111

11121112
AbilityRegistry::register(
1113-
'datamachine/list-github-tree',
1113+
'datamachine-code/list-github-tree',
11141114
array(
11151115
'label' => 'List GitHub Repository Tree',
11161116
'description' => 'List files in a GitHub repository tree at a branch or ref',
@@ -1149,7 +1149,7 @@ private function registerAbilities(): void {
11491149
);
11501150

11511151
AbilityRegistry::register(
1152-
'datamachine/get-github-file',
1152+
'datamachine-code/get-github-file',
11531153
array(
11541154
'label' => 'Get GitHub Files',
11551155
'description' => 'Get decoded content for one or more files in a GitHub repository',
@@ -1200,7 +1200,7 @@ private function registerAbilities(): void {
12001200
);
12011201

12021202
AbilityRegistry::register(
1203-
'datamachine/create-or-update-github-file',
1203+
'datamachine-code/create-or-update-github-file',
12041204
array(
12051205
'label' => 'Create or Update GitHub File',
12061206
'description' => 'Create or update a file in a GitHub repository via the Contents API (upsert). If the file exists, it is updated; if not, it is created.',
@@ -1252,7 +1252,7 @@ private function registerAbilities(): void {
12521252
);
12531253

12541254
AbilityRegistry::register(
1255-
'datamachine/list-github-repos',
1255+
'datamachine-code/list-github-repos',
12561256
array(
12571257
'label' => 'List GitHub Repositories',
12581258
'description' => 'List repositories for a user or organization',
@@ -1299,7 +1299,7 @@ private function registerAbilities(): void {
12991299
);
13001300

13011301
AbilityRegistry::register(
1302-
'datamachine/github-status',
1302+
'datamachine-code/github-status',
13031303
array(
13041304
'label' => 'Get GitHub Integration Status',
13051305
'description' => 'Inspect GitHub authentication, default repository, and registered repository status.',

inc/Abilities/GitSyncAbilities.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private function registerAbilities(): void {
6161
// -----------------------------------------------------------------
6262

6363
AbilityRegistry::register(
64-
'datamachine/gitsync-list',
64+
'datamachine-code/gitsync-list',
6565
array(
6666
'label' => 'List GitSync Bindings',
6767
'description' => 'List every registered GitSync binding with a lightweight summary.',
@@ -84,7 +84,7 @@ private function registerAbilities(): void {
8484
);
8585

8686
AbilityRegistry::register(
87-
'datamachine/gitsync-status',
87+
'datamachine-code/gitsync-status',
8888
array(
8989
'label' => 'GitSync Binding Status',
9090
'description' => 'Report on-disk + upstream status for a single GitSync binding.',
@@ -122,7 +122,7 @@ private function registerAbilities(): void {
122122
// -----------------------------------------------------------------
123123

124124
AbilityRegistry::register(
125-
'datamachine/gitsync-bind',
125+
'datamachine-code/gitsync-bind',
126126
array(
127127
'label' => 'Bind GitSync Path',
128128
'description' => 'Register a binding between a site-owned local directory (relative to ABSPATH) and a GitHub repository. First pull materializes files.',
@@ -153,7 +153,7 @@ private function registerAbilities(): void {
153153
);
154154

155155
AbilityRegistry::register(
156-
'datamachine/gitsync-unbind',
156+
'datamachine-code/gitsync-unbind',
157157
array(
158158
'label' => 'Unbind GitSync Path',
159159
'description' => 'Remove a binding. Directory preserved by default; pass purge=true to delete it.',
@@ -182,7 +182,7 @@ private function registerAbilities(): void {
182182
);
183183

184184
AbilityRegistry::register(
185-
'datamachine/gitsync-pull',
185+
'datamachine-code/gitsync-pull',
186186
array(
187187
'label' => 'Pull GitSync Binding',
188188
'description' => 'Download all files from the pinned branch to the local directory. Uses GitHub Contents API — no git binary required.',
@@ -219,7 +219,7 @@ private function registerAbilities(): void {
219219
);
220220

221221
AbilityRegistry::register(
222-
'datamachine/gitsync-submit',
222+
'datamachine-code/gitsync-submit',
223223
array(
224224
'label' => 'Submit GitSync Binding as Pull Request',
225225
'description' => 'Upload changed local files to the sticky proposal branch (gitsync/<slug>) by default, or to a keyed proposal branch (gitsync/<slug>-<proposal-slug>) when proposal is provided, and open or update a PR against the pinned branch.',
@@ -262,7 +262,7 @@ private function registerAbilities(): void {
262262
);
263263

264264
AbilityRegistry::register(
265-
'datamachine/gitsync-push',
265+
'datamachine-code/gitsync-push',
266266
array(
267267
'label' => 'Push GitSync Binding Directly',
268268
'description' => 'Commit changed local files directly to the pinned branch — no PR. Requires policy.write_enabled=true AND policy.safe_direct_push=true (two-key authorization).',
@@ -296,7 +296,7 @@ private function registerAbilities(): void {
296296
);
297297

298298
AbilityRegistry::register(
299-
'datamachine/gitsync-policy-update',
299+
'datamachine-code/gitsync-policy-update',
300300
array(
301301
'label' => 'Update GitSync Binding Policy',
302302
'description' => 'Update one or more policy fields on an existing binding (write_enabled, safe_direct_push, allowed_paths, conflict, auto_pull, pull_interval).',

0 commit comments

Comments
 (0)