@fractary/faber-cli 1.2.0 → 1.3.0

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Repo Client
3
3
  *
4
- * Wrapper for fractary-repo plugin commands (CLI-based)
4
+ * Integrates with @fractary/core SDK for repository and work tracking operations
5
5
  */
6
6
  interface Issue {
7
7
  id: string;
@@ -28,36 +28,40 @@ interface IssueUpdateOptions {
28
28
  removeLabel?: string;
29
29
  }
30
30
  /**
31
- * Repo Client - wraps fractary-repo plugin CLI operations
31
+ * Repo Client - integrates with @fractary/core SDK
32
32
  *
33
- * Note: This calls fractary-repo CLI commands as specified in SPEC-00030.
34
- * These commands must be implemented in the fractary-repo plugin.
33
+ * Provides repository and work tracking operations using WorkManager and RepoManager
34
+ * from the @fractary/core SDK. Replaces the previous CLI-based approach.
35
35
  */
36
36
  export declare class RepoClient {
37
37
  private config;
38
+ private workManager;
39
+ private repoManager;
40
+ private organization;
41
+ private project;
38
42
  constructor(config: any);
39
43
  /**
40
44
  * Fetch specific issues by ID
41
45
  *
42
- * Calls: fractary-repo issue-fetch --ids 258,259,260 --format json
46
+ * Uses WorkManager from @fractary/core SDK
43
47
  */
44
48
  fetchIssues(ids: string[]): Promise<Issue[]>;
45
49
  /**
46
50
  * Search issues by labels
47
51
  *
48
- * Calls: fractary-repo issue-search --labels "workflow:etl,status:approved" --format json
52
+ * Uses WorkManager from @fractary/core SDK
49
53
  */
50
54
  searchIssues(labels: string[]): Promise<Issue[]>;
51
55
  /**
52
56
  * Create a git branch
53
57
  *
54
- * Calls: fractary-repo branch-create <branch-name> --format json
58
+ * Uses RepoManager from @fractary/core SDK
55
59
  */
56
60
  createBranch(branchName: string): Promise<void>;
57
61
  /**
58
62
  * Create a git worktree
59
63
  *
60
- * Calls: fractary-repo worktree-create --work-id 258 --format json
64
+ * Uses RepoManager from @fractary/core SDK
61
65
  */
62
66
  createWorktree(options: {
63
67
  workId: string;
@@ -66,16 +70,9 @@ export declare class RepoClient {
66
70
  /**
67
71
  * Update GitHub issue
68
72
  *
69
- * Calls: fractary-repo issue-update --id 258 --comment "..." --add-label "..."
73
+ * Uses WorkManager from @fractary/core SDK
70
74
  */
71
75
  updateIssue(options: IssueUpdateOptions): Promise<void>;
72
- /**
73
- * Call fractary-repo CLI command
74
- *
75
- * This will be implemented to spawn fractary-repo CLI process safely.
76
- * For now, this is a placeholder showing the intended interface.
77
- */
78
- private callRepoCommand;
79
76
  }
80
77
  export {};
81
78
  //# sourceMappingURL=repo-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repo-client.d.ts","sourceRoot":"","sources":["../../src/lib/repo-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAM;gBAER,MAAM,EAAE,GAAG;IASvB;;;;OAIG;IACG,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAQlD;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAQtD;;;;OAIG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQrD;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAazF;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB7D;;;;;OAKG;YACW,eAAe;CAU9B"}
1
+ {"version":3,"file":"repo-client.d.ts","sourceRoot":"","sources":["../../src/lib/repo-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,kBAAkB;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,GAAG;IA6BvB;;;;OAIG;IACG,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAclD;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAetD;;;;OAIG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrD;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IA+BzF;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CA0B9D"}
@@ -1,105 +1,151 @@
1
1
  /**
2
2
  * Repo Client
3
3
  *
4
- * Wrapper for fractary-repo plugin commands (CLI-based)
4
+ * Integrates with @fractary/core SDK for repository and work tracking operations
5
5
  */
6
+ import { WorkManager, RepoManager } from '@fractary/core';
7
+ import { createWorkConfig, createRepoConfig } from './sdk-config-adapter.js';
8
+ import { sdkIssueToCLIIssue, sdkWorktreeToCLIWorktreeResult } from './sdk-type-adapter.js';
9
+ import os from 'os';
6
10
  /**
7
- * Repo Client - wraps fractary-repo plugin CLI operations
11
+ * Repo Client - integrates with @fractary/core SDK
8
12
  *
9
- * Note: This calls fractary-repo CLI commands as specified in SPEC-00030.
10
- * These commands must be implemented in the fractary-repo plugin.
13
+ * Provides repository and work tracking operations using WorkManager and RepoManager
14
+ * from the @fractary/core SDK. Replaces the previous CLI-based approach.
11
15
  */
12
16
  export class RepoClient {
13
17
  constructor(config) {
14
18
  this.config = config;
19
+ // Validate GitHub token
15
20
  const token = config.github?.token;
16
21
  if (!token) {
17
22
  throw new Error('GitHub token not found. Set GITHUB_TOKEN environment variable.');
18
23
  }
24
+ // Extract organization and project
25
+ this.organization = config.github?.organization || 'unknown';
26
+ this.project = config.github?.project || 'unknown';
27
+ // Create SDK configurations
28
+ const workConfig = createWorkConfig(config);
29
+ const repoConfig = createRepoConfig(config);
30
+ // Initialize SDK managers
31
+ try {
32
+ this.workManager = new WorkManager(workConfig);
33
+ this.repoManager = new RepoManager(repoConfig);
34
+ }
35
+ catch (error) {
36
+ if (error instanceof Error) {
37
+ throw new Error(`Failed to initialize SDK managers: ${error.message}`);
38
+ }
39
+ throw error;
40
+ }
19
41
  }
20
42
  /**
21
43
  * Fetch specific issues by ID
22
44
  *
23
- * Calls: fractary-repo issue-fetch --ids 258,259,260 --format json
45
+ * Uses WorkManager from @fractary/core SDK
24
46
  */
25
47
  async fetchIssues(ids) {
26
- // TODO: Call fractary-repo CLI when available
27
- // const result = await this.callRepoCommand('issue-fetch', ['--ids', ids.join(','), '--format', 'json']);
28
- // Placeholder implementation
29
- throw new Error('fractary-repo issue-fetch command not yet implemented. See SPEC-00030.');
48
+ try {
49
+ const issues = await Promise.all(ids.map(id => this.workManager.fetchIssue(id)));
50
+ return issues.map(sdkIssueToCLIIssue);
51
+ }
52
+ catch (error) {
53
+ if (error instanceof Error) {
54
+ throw new Error(`Failed to fetch issues: ${error.message}`);
55
+ }
56
+ throw error;
57
+ }
30
58
  }
31
59
  /**
32
60
  * Search issues by labels
33
61
  *
34
- * Calls: fractary-repo issue-search --labels "workflow:etl,status:approved" --format json
62
+ * Uses WorkManager from @fractary/core SDK
35
63
  */
36
64
  async searchIssues(labels) {
37
- // TODO: Call fractary-repo CLI when available
38
- // const result = await this.callRepoCommand('issue-search', ['--labels', labels.join(','), '--format', 'json']);
39
- // Placeholder implementation
40
- throw new Error('fractary-repo issue-search command not yet implemented. See SPEC-00030.');
65
+ try {
66
+ const issues = await this.workManager.searchIssues('', {
67
+ state: 'open',
68
+ labels: labels,
69
+ });
70
+ return issues.map(sdkIssueToCLIIssue);
71
+ }
72
+ catch (error) {
73
+ if (error instanceof Error) {
74
+ throw new Error(`Failed to search issues: ${error.message}`);
75
+ }
76
+ throw error;
77
+ }
41
78
  }
42
79
  /**
43
80
  * Create a git branch
44
81
  *
45
- * Calls: fractary-repo branch-create <branch-name> --format json
82
+ * Uses RepoManager from @fractary/core SDK
46
83
  */
47
84
  async createBranch(branchName) {
48
- // TODO: Call fractary-repo CLI when available
49
- // await this.callRepoCommand('branch-create', [branchName, '--format', 'json']);
50
- // Placeholder implementation
51
- throw new Error('fractary-repo branch-create command not yet implemented. See SPEC-00030.');
85
+ try {
86
+ await this.repoManager.createBranch(branchName);
87
+ }
88
+ catch (error) {
89
+ if (error instanceof Error) {
90
+ throw new Error(`Failed to create branch: ${error.message}`);
91
+ }
92
+ throw error;
93
+ }
52
94
  }
53
95
  /**
54
96
  * Create a git worktree
55
97
  *
56
- * Calls: fractary-repo worktree-create --work-id 258 --format json
98
+ * Uses RepoManager from @fractary/core SDK
57
99
  */
58
100
  async createWorktree(options) {
59
- // TODO: Call fractary-repo CLI when available
60
- // const args = ['--work-id', options.workId, '--format', 'json'];
61
- // if (options.path) {
62
- // args.push('--path', options.path);
63
- // }
64
- // const result = await this.callRepoCommand('worktree-create', args);
65
- // return result;
66
- // Placeholder implementation
67
- throw new Error('fractary-repo worktree-create command not yet implemented. See SPEC-00030.');
101
+ try {
102
+ const branch = `feature/${options.workId}`;
103
+ const path = options.path ||
104
+ `~/.claude-worktrees/${this.organization}-${this.project}-${options.workId}`;
105
+ // Expand ~ to home directory
106
+ const expandedPath = path.startsWith('~')
107
+ ? path.replace('~', os.homedir())
108
+ : path;
109
+ const worktree = this.repoManager.createWorktree({
110
+ path: expandedPath,
111
+ branch,
112
+ workId: options.workId,
113
+ });
114
+ return sdkWorktreeToCLIWorktreeResult(worktree, this.organization, this.project, options.workId);
115
+ }
116
+ catch (error) {
117
+ if (error instanceof Error) {
118
+ throw new Error(`Failed to create worktree: ${error.message}`);
119
+ }
120
+ throw error;
121
+ }
68
122
  }
69
123
  /**
70
124
  * Update GitHub issue
71
125
  *
72
- * Calls: fractary-repo issue-update --id 258 --comment "..." --add-label "..."
126
+ * Uses WorkManager from @fractary/core SDK
73
127
  */
74
128
  async updateIssue(options) {
75
- // TODO: Call fractary-repo CLI when available
76
- // const args = ['--id', options.id];
77
- // if (options.comment) {
78
- // args.push('--comment', options.comment);
79
- // }
80
- // if (options.addLabel) {
81
- // args.push('--add-label', options.addLabel);
82
- // }
83
- // if (options.removeLabel) {
84
- // args.push('--remove-label', options.removeLabel);
85
- // }
86
- // await this.callRepoCommand('issue-update', args);
87
- // Placeholder implementation
88
- throw new Error('fractary-repo issue-update command not yet implemented. See SPEC-00030.');
89
- }
90
- /**
91
- * Call fractary-repo CLI command
92
- *
93
- * This will be implemented to spawn fractary-repo CLI process safely.
94
- * For now, this is a placeholder showing the intended interface.
95
- */
96
- async callRepoCommand(command, args) {
97
- // Implementation will use safe process spawning to call:
98
- // fractary-repo <command> [args...]
99
- //
100
- // Example: fractary-repo issue-fetch --ids 258,259 --format json
101
- //
102
- // The command will return JSON which we parse and return.
103
- throw new Error(`fractary-repo ${command} not yet implemented`);
129
+ try {
130
+ const issueId = parseInt(options.id, 10);
131
+ // Create comment if provided
132
+ if (options.comment) {
133
+ await this.workManager.createComment(issueId, options.comment);
134
+ }
135
+ // Add label if provided
136
+ if (options.addLabel) {
137
+ await this.workManager.addLabels(issueId, [options.addLabel]);
138
+ }
139
+ // Remove label if provided
140
+ if (options.removeLabel) {
141
+ await this.workManager.removeLabels(issueId, [options.removeLabel]);
142
+ }
143
+ }
144
+ catch (error) {
145
+ if (error instanceof Error) {
146
+ throw new Error(`Failed to update issue: ${error.message}`);
147
+ }
148
+ throw error;
149
+ }
104
150
  }
105
151
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * SDK Configuration Adapter
3
+ *
4
+ * Converts FABER CLI configuration to @fractary/core SDK configuration format
5
+ */
6
+ import type { FaberConfig } from '../types/config.js';
7
+ import type { WorkConfig, RepoConfig } from '@fractary/core';
8
+ /**
9
+ * Create WorkConfig for WorkManager from FaberConfig
10
+ *
11
+ * @param faberConfig - FABER CLI configuration
12
+ * @returns WorkConfig for @fractary/core WorkManager
13
+ * @throws Error if required fields are missing
14
+ */
15
+ export declare function createWorkConfig(faberConfig: FaberConfig): WorkConfig;
16
+ /**
17
+ * Create RepoConfig for RepoManager from FaberConfig
18
+ *
19
+ * @param faberConfig - FABER CLI configuration
20
+ * @returns RepoConfig for @fractary/core RepoManager
21
+ * @throws Error if required fields are missing
22
+ */
23
+ export declare function createRepoConfig(faberConfig: FaberConfig): RepoConfig;
24
+ //# sourceMappingURL=sdk-config-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-config-adapter.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-config-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAuBrE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAiBrE"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * SDK Configuration Adapter
3
+ *
4
+ * Converts FABER CLI configuration to @fractary/core SDK configuration format
5
+ */
6
+ /**
7
+ * Create WorkConfig for WorkManager from FaberConfig
8
+ *
9
+ * @param faberConfig - FABER CLI configuration
10
+ * @returns WorkConfig for @fractary/core WorkManager
11
+ * @throws Error if required fields are missing
12
+ */
13
+ export function createWorkConfig(faberConfig) {
14
+ const token = faberConfig.github?.token;
15
+ const owner = faberConfig.github?.organization;
16
+ const repo = faberConfig.github?.project;
17
+ if (!token) {
18
+ throw new Error('GitHub token not found. Set GITHUB_TOKEN environment variable or configure in .fractary/settings.json');
19
+ }
20
+ if (!owner || !repo) {
21
+ throw new Error('GitHub organization and project must be configured in .fractary/settings.json');
22
+ }
23
+ return {
24
+ platform: 'github',
25
+ owner,
26
+ repo,
27
+ token,
28
+ };
29
+ }
30
+ /**
31
+ * Create RepoConfig for RepoManager from FaberConfig
32
+ *
33
+ * @param faberConfig - FABER CLI configuration
34
+ * @returns RepoConfig for @fractary/core RepoManager
35
+ * @throws Error if required fields are missing
36
+ */
37
+ export function createRepoConfig(faberConfig) {
38
+ const token = faberConfig.github?.token;
39
+ const owner = faberConfig.github?.organization;
40
+ const repo = faberConfig.github?.project;
41
+ if (!token) {
42
+ throw new Error('GitHub token not found. Set GITHUB_TOKEN environment variable or configure in .fractary/settings.json');
43
+ }
44
+ return {
45
+ platform: 'github',
46
+ owner,
47
+ repo,
48
+ token,
49
+ };
50
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * SDK Type Adapter
3
+ *
4
+ * Converts between @fractary/core SDK types and FABER CLI types
5
+ */
6
+ import type { Issue as SDKIssue, Worktree as SDKWorktree } from '@fractary/core';
7
+ interface CLIIssue {
8
+ id: string;
9
+ number: number;
10
+ title: string;
11
+ description: string;
12
+ labels: string[];
13
+ url: string;
14
+ state: string;
15
+ }
16
+ interface WorktreeResult {
17
+ path: string;
18
+ absolute_path: string;
19
+ branch: string;
20
+ created_at: string;
21
+ organization: string;
22
+ project: string;
23
+ work_id: string;
24
+ }
25
+ /**
26
+ * Convert SDK Issue to CLI Issue
27
+ *
28
+ * @param sdkIssue - Issue from @fractary/core SDK
29
+ * @returns CLI Issue format
30
+ */
31
+ export declare function sdkIssueToCLIIssue(sdkIssue: SDKIssue): CLIIssue;
32
+ /**
33
+ * Convert SDK Worktree to CLI WorktreeResult
34
+ *
35
+ * @param sdkWorktree - Worktree from @fractary/core SDK
36
+ * @param organization - GitHub organization
37
+ * @param project - GitHub project/repo name
38
+ * @param workId - Work/issue ID
39
+ * @returns CLI WorktreeResult format
40
+ */
41
+ export declare function sdkWorktreeToCLIWorktreeResult(sdkWorktree: SDKWorktree, organization: string, project: string, workId: string): WorktreeResult;
42
+ export {};
43
+ //# sourceMappingURL=sdk-type-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-type-adapter.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-type-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,IAAI,QAAQ,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGjF,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAU/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,cAAc,CAUhB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * SDK Type Adapter
3
+ *
4
+ * Converts between @fractary/core SDK types and FABER CLI types
5
+ */
6
+ /**
7
+ * Convert SDK Issue to CLI Issue
8
+ *
9
+ * @param sdkIssue - Issue from @fractary/core SDK
10
+ * @returns CLI Issue format
11
+ */
12
+ export function sdkIssueToCLIIssue(sdkIssue) {
13
+ return {
14
+ id: sdkIssue.id,
15
+ number: sdkIssue.number,
16
+ title: sdkIssue.title,
17
+ description: sdkIssue.body, // Map 'body' to 'description'
18
+ labels: sdkIssue.labels.map(label => label.name), // Extract label names
19
+ url: sdkIssue.url,
20
+ state: sdkIssue.state,
21
+ };
22
+ }
23
+ /**
24
+ * Convert SDK Worktree to CLI WorktreeResult
25
+ *
26
+ * @param sdkWorktree - Worktree from @fractary/core SDK
27
+ * @param organization - GitHub organization
28
+ * @param project - GitHub project/repo name
29
+ * @param workId - Work/issue ID
30
+ * @returns CLI WorktreeResult format
31
+ */
32
+ export function sdkWorktreeToCLIWorktreeResult(sdkWorktree, organization, project, workId) {
33
+ return {
34
+ path: sdkWorktree.path,
35
+ absolute_path: sdkWorktree.path, // SDK path is already absolute
36
+ branch: sdkWorktree.branch || '',
37
+ created_at: new Date().toISOString(),
38
+ organization,
39
+ project,
40
+ work_id: workId,
41
+ };
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fractary/faber-cli",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "FABER CLI - Command-line interface for FABER development toolkit",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -36,6 +36,7 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
+ "@fractary/core": "^0.2.0",
39
40
  "@fractary/faber": "*",
40
41
  "chalk": "^5.0.0",
41
42
  "commander": "^12.0.0"