git-workspace-service 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -897,7 +897,7 @@ declare class OAuthDeviceFlow {
897
897
  private readonly permissions;
898
898
  private readonly promptEmitter?;
899
899
  private readonly timeout;
900
- private readonly logger?;
900
+ private readonly logger;
901
901
  constructor(config: OAuthDeviceFlowConfig, logger?: OAuthDeviceFlowLogger);
902
902
  /**
903
903
  * Start the device code flow and wait for authorization
@@ -1158,118 +1158,111 @@ declare class CredentialService {
1158
1158
  }
1159
1159
 
1160
1160
  /**
1161
- * Workspace Service
1161
+ * GitHub PAT Client
1162
1162
  *
1163
- * Provisions and manages git workspaces for agent tasks.
1164
- * Handles cloning, branching, and PR creation.
1163
+ * Simple GitHub API client using a Personal Access Token.
1164
+ * Useful for testing and simple integrations without GitHub App setup.
1165
1165
  */
1166
1166
 
1167
- interface WorkspaceServiceLogger {
1168
- info(data: Record<string, unknown>, message: string): void;
1169
- warn(data: Record<string, unknown>, message: string): void;
1170
- error(data: Record<string, unknown>, message: string): void;
1171
- debug(data: Record<string, unknown>, message: string): void;
1172
- }
1173
- interface WorkspaceServiceOptions {
1174
- /**
1175
- * Configuration
1176
- */
1177
- config: WorkspaceServiceConfig;
1167
+ interface GitHubPatClientOptions {
1178
1168
  /**
1179
- * Credential service for managing git credentials
1169
+ * Personal Access Token
1180
1170
  */
1181
- credentialService: CredentialService;
1171
+ token: string;
1182
1172
  /**
1183
- * Optional logger
1173
+ * GitHub API base URL (for GitHub Enterprise)
1184
1174
  */
1185
- logger?: WorkspaceServiceLogger;
1175
+ baseUrl?: string;
1186
1176
  }
1187
- declare class WorkspaceService {
1188
- private workspaces;
1189
- private readonly baseDir;
1190
- private readonly branchPrefix;
1191
- private readonly credentialService;
1177
+ interface GitHubPatClientLogger {
1178
+ info(data: Record<string, unknown>, message: string): void;
1179
+ warn(data: Record<string, unknown>, message: string): void;
1180
+ error(data: Record<string, unknown>, message: string): void;
1181
+ }
1182
+ /**
1183
+ * Simple GitHub client using a Personal Access Token.
1184
+ * Provides PR and Issue management without GitHub App complexity.
1185
+ */
1186
+ declare class GitHubPatClient {
1187
+ private octokit;
1192
1188
  private readonly logger?;
1193
- private readonly eventHandlers;
1194
- constructor(options: WorkspaceServiceOptions);
1189
+ constructor(options: GitHubPatClientOptions, logger?: GitHubPatClientLogger);
1195
1190
  /**
1196
- * Initialize the workspace service
1191
+ * Create a pull request
1197
1192
  */
1198
- initialize(): Promise<void>;
1193
+ createPullRequest(owner: string, repo: string, options: {
1194
+ title: string;
1195
+ body: string;
1196
+ head: string;
1197
+ base: string;
1198
+ draft?: boolean;
1199
+ labels?: string[];
1200
+ reviewers?: string[];
1201
+ }): Promise<PullRequestInfo>;
1199
1202
  /**
1200
- * Register an event handler
1203
+ * Get a pull request
1201
1204
  */
1202
- onEvent(handler: WorkspaceEventHandler): () => void;
1205
+ getPullRequest(owner: string, repo: string, prNumber: number): Promise<PullRequestInfo>;
1203
1206
  /**
1204
- * Provision a new workspace for a task
1207
+ * Create an issue
1205
1208
  */
1206
- provision(config: WorkspaceConfig): Promise<Workspace>;
1209
+ createIssue(owner: string, repo: string, options: CreateIssueOptions): Promise<IssueInfo>;
1207
1210
  /**
1208
- * Add a worktree to an existing clone workspace (convenience method)
1211
+ * Get an issue
1209
1212
  */
1210
- addWorktree(parentWorkspaceId: string, options: {
1211
- branch: string;
1212
- execution: {
1213
- id: string;
1214
- patternName: string;
1215
- };
1216
- task: {
1217
- id: string;
1218
- role: string;
1219
- slug?: string;
1220
- };
1221
- }): Promise<Workspace>;
1213
+ getIssue(owner: string, repo: string, issueNumber: number): Promise<IssueInfo>;
1222
1214
  /**
1223
- * List all worktrees for a parent workspace
1215
+ * List issues
1224
1216
  */
1225
- listWorktrees(parentWorkspaceId: string): Workspace[];
1217
+ listIssues(owner: string, repo: string, options?: {
1218
+ state?: IssueState | 'all';
1219
+ labels?: string[];
1220
+ assignee?: string;
1221
+ }): Promise<IssueInfo[]>;
1226
1222
  /**
1227
- * Remove a worktree (alias for cleanup with worktree-specific handling)
1223
+ * Update an issue
1228
1224
  */
1229
- removeWorktree(workspaceId: string): Promise<void>;
1225
+ updateIssue(owner: string, repo: string, issueNumber: number, options: {
1226
+ title?: string;
1227
+ body?: string;
1228
+ state?: IssueState;
1229
+ labels?: string[];
1230
+ assignees?: string[];
1231
+ }): Promise<IssueInfo>;
1230
1232
  /**
1231
- * Finalize a workspace (push, create PR, cleanup)
1233
+ * Add labels to an issue
1232
1234
  */
1233
- finalize(workspaceId: string, options: WorkspaceFinalization): Promise<PullRequestInfo | void>;
1235
+ addLabels(owner: string, repo: string, issueNumber: number, labels: string[]): Promise<void>;
1234
1236
  /**
1235
- * Get a workspace by ID
1237
+ * Remove a label from an issue
1236
1238
  */
1237
- get(workspaceId: string): Workspace | null;
1239
+ removeLabel(owner: string, repo: string, issueNumber: number, label: string): Promise<void>;
1238
1240
  /**
1239
- * Get all workspaces for an execution
1241
+ * Add a comment to an issue or PR
1240
1242
  */
1241
- getForExecution(executionId: string): Workspace[];
1243
+ addComment(owner: string, repo: string, issueNumber: number, options: IssueCommentOptions): Promise<IssueComment>;
1242
1244
  /**
1243
- * Clean up a workspace
1245
+ * List comments on an issue or PR
1244
1246
  */
1245
- cleanup(workspaceId: string): Promise<void>;
1247
+ listComments(owner: string, repo: string, issueNumber: number): Promise<IssueComment[]>;
1246
1248
  /**
1247
- * Clean up all workspaces for an execution
1249
+ * Close an issue
1248
1250
  */
1249
- cleanupForExecution(executionId: string): Promise<void>;
1251
+ closeIssue(owner: string, repo: string, issueNumber: number): Promise<IssueInfo>;
1250
1252
  /**
1251
- * Try to clone a public repository without authentication
1253
+ * Reopen an issue
1252
1254
  */
1253
- private tryUnauthenticatedClone;
1254
- private cloneRepo;
1255
- private createBranch;
1256
- private addWorktreeFromParent;
1257
- private configureGit;
1258
- private pushBranch;
1259
- private createPullRequest;
1260
- private parseRepo;
1261
- private buildAuthenticatedUrl;
1262
- private execInDir;
1263
- private log;
1264
- private emitEvent;
1255
+ reopenIssue(owner: string, repo: string, issueNumber: number): Promise<IssueInfo>;
1265
1256
  /**
1266
- * Update workspace progress
1257
+ * Delete a branch
1267
1258
  */
1268
- private updateProgress;
1259
+ deleteBranch(owner: string, repo: string, branch: string): Promise<void>;
1269
1260
  /**
1270
- * Execute completion hook if configured
1261
+ * Check if a branch exists
1271
1262
  */
1272
- private executeCompletionHook;
1263
+ branchExists(owner: string, repo: string, branch: string): Promise<boolean>;
1264
+ private mapIssue;
1265
+ private log;
1273
1266
  }
1274
1267
 
1275
1268
  /**
@@ -1438,114 +1431,6 @@ declare class GitHubProvider implements GitProviderAdapter {
1438
1431
  private log;
1439
1432
  }
1440
1433
 
1441
- /**
1442
- * GitHub PAT Client
1443
- *
1444
- * Simple GitHub API client using a Personal Access Token.
1445
- * Useful for testing and simple integrations without GitHub App setup.
1446
- */
1447
-
1448
- interface GitHubPatClientOptions {
1449
- /**
1450
- * Personal Access Token
1451
- */
1452
- token: string;
1453
- /**
1454
- * GitHub API base URL (for GitHub Enterprise)
1455
- */
1456
- baseUrl?: string;
1457
- }
1458
- interface GitHubPatClientLogger {
1459
- info(data: Record<string, unknown>, message: string): void;
1460
- warn(data: Record<string, unknown>, message: string): void;
1461
- error(data: Record<string, unknown>, message: string): void;
1462
- }
1463
- /**
1464
- * Simple GitHub client using a Personal Access Token.
1465
- * Provides PR and Issue management without GitHub App complexity.
1466
- */
1467
- declare class GitHubPatClient {
1468
- private octokit;
1469
- private readonly logger?;
1470
- constructor(options: GitHubPatClientOptions, logger?: GitHubPatClientLogger);
1471
- /**
1472
- * Create a pull request
1473
- */
1474
- createPullRequest(owner: string, repo: string, options: {
1475
- title: string;
1476
- body: string;
1477
- head: string;
1478
- base: string;
1479
- draft?: boolean;
1480
- labels?: string[];
1481
- reviewers?: string[];
1482
- }): Promise<PullRequestInfo>;
1483
- /**
1484
- * Get a pull request
1485
- */
1486
- getPullRequest(owner: string, repo: string, prNumber: number): Promise<PullRequestInfo>;
1487
- /**
1488
- * Create an issue
1489
- */
1490
- createIssue(owner: string, repo: string, options: CreateIssueOptions): Promise<IssueInfo>;
1491
- /**
1492
- * Get an issue
1493
- */
1494
- getIssue(owner: string, repo: string, issueNumber: number): Promise<IssueInfo>;
1495
- /**
1496
- * List issues
1497
- */
1498
- listIssues(owner: string, repo: string, options?: {
1499
- state?: IssueState | 'all';
1500
- labels?: string[];
1501
- assignee?: string;
1502
- }): Promise<IssueInfo[]>;
1503
- /**
1504
- * Update an issue
1505
- */
1506
- updateIssue(owner: string, repo: string, issueNumber: number, options: {
1507
- title?: string;
1508
- body?: string;
1509
- state?: IssueState;
1510
- labels?: string[];
1511
- assignees?: string[];
1512
- }): Promise<IssueInfo>;
1513
- /**
1514
- * Add labels to an issue
1515
- */
1516
- addLabels(owner: string, repo: string, issueNumber: number, labels: string[]): Promise<void>;
1517
- /**
1518
- * Remove a label from an issue
1519
- */
1520
- removeLabel(owner: string, repo: string, issueNumber: number, label: string): Promise<void>;
1521
- /**
1522
- * Add a comment to an issue or PR
1523
- */
1524
- addComment(owner: string, repo: string, issueNumber: number, options: IssueCommentOptions): Promise<IssueComment>;
1525
- /**
1526
- * List comments on an issue or PR
1527
- */
1528
- listComments(owner: string, repo: string, issueNumber: number): Promise<IssueComment[]>;
1529
- /**
1530
- * Close an issue
1531
- */
1532
- closeIssue(owner: string, repo: string, issueNumber: number): Promise<IssueInfo>;
1533
- /**
1534
- * Reopen an issue
1535
- */
1536
- reopenIssue(owner: string, repo: string, issueNumber: number): Promise<IssueInfo>;
1537
- /**
1538
- * Delete a branch
1539
- */
1540
- deleteBranch(owner: string, repo: string, branch: string): Promise<void>;
1541
- /**
1542
- * Check if a branch exists
1543
- */
1544
- branchExists(owner: string, repo: string, branch: string): Promise<boolean>;
1545
- private mapIssue;
1546
- private log;
1547
- }
1548
-
1549
1434
  /**
1550
1435
  * Branch Naming Service
1551
1436
  *
@@ -1652,4 +1537,119 @@ declare function getGitCredentialConfig(helperScriptPath: string): string[];
1652
1537
  */
1653
1538
  declare function outputCredentials(username: string, password: string): void;
1654
1539
 
1540
+ /**
1541
+ * Workspace Service
1542
+ *
1543
+ * Provisions and manages git workspaces for agent tasks.
1544
+ * Handles cloning, branching, and PR creation.
1545
+ */
1546
+
1547
+ interface WorkspaceServiceLogger {
1548
+ info(data: Record<string, unknown>, message: string): void;
1549
+ warn(data: Record<string, unknown>, message: string): void;
1550
+ error(data: Record<string, unknown>, message: string): void;
1551
+ debug(data: Record<string, unknown>, message: string): void;
1552
+ }
1553
+ interface WorkspaceServiceOptions {
1554
+ /**
1555
+ * Configuration
1556
+ */
1557
+ config: WorkspaceServiceConfig;
1558
+ /**
1559
+ * Credential service for managing git credentials
1560
+ */
1561
+ credentialService?: CredentialService;
1562
+ /**
1563
+ * Optional logger
1564
+ */
1565
+ logger?: WorkspaceServiceLogger;
1566
+ }
1567
+ declare class WorkspaceService {
1568
+ private workspaces;
1569
+ private readonly baseDir;
1570
+ private readonly branchPrefix;
1571
+ private readonly credentialService;
1572
+ private readonly logger?;
1573
+ private readonly eventHandlers;
1574
+ constructor(options: WorkspaceServiceOptions);
1575
+ /**
1576
+ * Initialize the workspace service
1577
+ */
1578
+ initialize(): Promise<void>;
1579
+ /**
1580
+ * Register an event handler
1581
+ */
1582
+ onEvent(handler: WorkspaceEventHandler): () => void;
1583
+ /**
1584
+ * Provision a new workspace for a task
1585
+ */
1586
+ provision(config: WorkspaceConfig): Promise<Workspace>;
1587
+ /**
1588
+ * Add a worktree to an existing clone workspace (convenience method)
1589
+ */
1590
+ addWorktree(parentWorkspaceId: string, options: {
1591
+ branch: string;
1592
+ execution: {
1593
+ id: string;
1594
+ patternName: string;
1595
+ };
1596
+ task: {
1597
+ id: string;
1598
+ role: string;
1599
+ slug?: string;
1600
+ };
1601
+ }): Promise<Workspace>;
1602
+ /**
1603
+ * List all worktrees for a parent workspace
1604
+ */
1605
+ listWorktrees(parentWorkspaceId: string): Workspace[];
1606
+ /**
1607
+ * Remove a worktree (alias for cleanup with worktree-specific handling)
1608
+ */
1609
+ removeWorktree(workspaceId: string): Promise<void>;
1610
+ /**
1611
+ * Finalize a workspace (push, create PR, cleanup)
1612
+ */
1613
+ finalize(workspaceId: string, options: WorkspaceFinalization): Promise<PullRequestInfo | undefined>;
1614
+ /**
1615
+ * Get a workspace by ID
1616
+ */
1617
+ get(workspaceId: string): Workspace | null;
1618
+ /**
1619
+ * Get all workspaces for an execution
1620
+ */
1621
+ getForExecution(executionId: string): Workspace[];
1622
+ /**
1623
+ * Clean up a workspace
1624
+ */
1625
+ cleanup(workspaceId: string): Promise<void>;
1626
+ /**
1627
+ * Clean up all workspaces for an execution
1628
+ */
1629
+ cleanupForExecution(executionId: string): Promise<void>;
1630
+ /**
1631
+ * Try to clone a public repository without authentication
1632
+ */
1633
+ private tryUnauthenticatedClone;
1634
+ private cloneRepo;
1635
+ private createBranch;
1636
+ private addWorktreeFromParent;
1637
+ private configureGit;
1638
+ private pushBranch;
1639
+ private createPullRequest;
1640
+ private parseRepo;
1641
+ private buildAuthenticatedUrl;
1642
+ private execInDir;
1643
+ private log;
1644
+ private emitEvent;
1645
+ /**
1646
+ * Update workspace progress
1647
+ */
1648
+ private updateProgress;
1649
+ /**
1650
+ * Execute completion hook if configured
1651
+ */
1652
+ private executeCompletionHook;
1653
+ }
1654
+
1655
1655
  export { type AgentPermissions, type AuthPrompt, type AuthPromptEmitter, type AuthResult, type BranchConfig, type BranchInfo, type BranchNamingOptions, type BranchStrategy, type CompletionHook, type CreateIssueOptions, type CredentialContext, type CredentialGrant, type CredentialGrantStore, type CredentialHelperContext, CredentialService, type CredentialServiceConfig, type CredentialServiceLogger, type CredentialServiceOptions, type CredentialType, DEFAULT_AGENT_PERMISSIONS, DEFAULT_BRANCH_PREFIX, type DeviceCodeResponse, FileTokenStore, type GitCredential, type GitCredentialRequest, type GitHubAppConfig, type GitHubAppInstallation, GitHubPatClient, type GitHubPatClientLogger, type GitHubPatClientOptions, GitHubProvider, type GitHubProviderConfig, type GitHubProviderLogger, type GitProvider, type GitProviderAdapter, type IssueComment, type IssueCommentOptions, type IssueInfo, type IssueState, MemoryTokenStore, OAuthDeviceFlow, type OAuthDeviceFlowConfig, type OAuthDeviceFlowLogger, type OAuthToken, type PermissionLevel, type PullRequestInfo, READONLY_AGENT_PERMISSIONS, type RepositoryScope, type SshCredentials, type TokenCredentials, TokenStore, type TokenStoreOptions, type UserProvidedCredentials, type Workspace, type WorkspaceConfig, type WorkspaceEvent, type WorkspaceEventHandler, type WorkspaceEventType, type WorkspaceFinalization, type WorkspacePhase, type WorkspaceProgress, WorkspaceService, type WorkspaceServiceConfig, type WorkspaceServiceLogger, type WorkspaceServiceOptions, type WorkspaceStatus, type WorkspaceStrategy, cleanupCredentialFiles, configureCredentialHelper, createBranchInfo, createNodeCredentialHelperScript, createShellCredentialHelperScript, filterBranchesByExecution, generateBranchName, generateSlug, getGitCredentialConfig, isManagedBranch, outputCredentials, parseBranchName, updateCredentials };