@fractary/faber-cli 1.5.6 → 1.5.7

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.js CHANGED
@@ -21,7 +21,7 @@ if (process.stdout.isTTY) {
21
21
  process.stdout._handle?.setBlocking?.(true);
22
22
  }
23
23
  console.error('[DEBUG] CLI starting, args:', process.argv);
24
- const version = '1.5.5';
24
+ const version = '1.5.7';
25
25
  /**
26
26
  * Create and configure the main CLI program
27
27
  */
@@ -2,6 +2,7 @@
2
2
  * Repo Client
3
3
  *
4
4
  * Integrates with @fractary/core SDK for repository and work tracking operations.
5
+ * Supports both PAT and GitHub App authentication.
5
6
  */
6
7
  import type { LoadedFaberConfig } from '../types/config.js';
7
8
  interface Issue {
@@ -42,6 +43,9 @@ export declare class RepoClient {
42
43
  /**
43
44
  * Create a RepoClient instance (async factory method)
44
45
  *
46
+ * Supports both PAT and GitHub App authentication.
47
+ * GitHub App takes precedence if configured.
48
+ *
45
49
  * @param config - FABER CLI configuration with GitHub settings
46
50
  * @returns Promise resolving to RepoClient instance
47
51
  */
@@ -1 +1 @@
1
- {"version":3,"file":"repo-client.d.ts","sourceRoot":"","sources":["../../src/lib/repo-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,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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KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IA+BzF;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAyB9D"}
@@ -2,8 +2,10 @@
2
2
  * Repo Client
3
3
  *
4
4
  * Integrates with @fractary/core SDK for repository and work tracking operations.
5
+ * Supports both PAT and GitHub App authentication.
5
6
  */
6
7
  import { WorkManager, RepoManager } from '@fractary/core';
8
+ import { GitHubAppAuth } from '@fractary/faber';
7
9
  import { sdkIssueToCLIIssue, sdkWorktreeToCLIWorktreeResult } from './sdk-type-adapter.js';
8
10
  import os from 'os';
9
11
  /**
@@ -16,33 +18,68 @@ export class RepoClient {
16
18
  /**
17
19
  * Create a RepoClient instance (async factory method)
18
20
  *
21
+ * Supports both PAT and GitHub App authentication.
22
+ * GitHub App takes precedence if configured.
23
+ *
19
24
  * @param config - FABER CLI configuration with GitHub settings
20
25
  * @returns Promise resolving to RepoClient instance
21
26
  */
22
27
  static async create(config) {
23
28
  const organization = config.github?.organization;
24
29
  const project = config.github?.project;
25
- const token = config.github?.token || process.env.GITHUB_TOKEN;
26
- if (!organization || !project) {
27
- throw new Error('GitHub organization and project must be configured in .fractary/config.yaml');
30
+ if (!organization || typeof organization !== 'string' || organization.trim() === '') {
31
+ throw new Error('GitHub organization must be configured in .fractary/config.yaml\n' +
32
+ 'Add: github.organization: "your-org"');
33
+ }
34
+ if (!project || typeof project !== 'string' || project.trim() === '') {
35
+ throw new Error('GitHub project must be configured in .fractary/config.yaml\n' +
36
+ 'Add: github.project: "your-repo"');
37
+ }
38
+ // Get token - GitHub App takes precedence over PAT
39
+ let token;
40
+ const appConfig = config.github?.app;
41
+ if (appConfig?.id && appConfig?.installation_id) {
42
+ // Use GitHub App authentication
43
+ try {
44
+ const auth = new GitHubAppAuth(appConfig);
45
+ token = await auth.getToken();
46
+ }
47
+ catch (error) {
48
+ if (error instanceof Error) {
49
+ throw new Error(`GitHub App authentication failed: ${error.message}`);
50
+ }
51
+ throw error;
52
+ }
28
53
  }
29
- if (!token) {
30
- throw new Error('GitHub token not found. Set GITHUB_TOKEN environment variable or configure in .fractary/config.yaml');
54
+ else {
55
+ // Fall back to PAT
56
+ const patToken = config.github?.token || process.env.GITHUB_TOKEN;
57
+ if (!patToken || typeof patToken !== 'string' || patToken.trim() === '') {
58
+ throw new Error('GitHub authentication not configured. Either:\n' +
59
+ ' 1. Set GITHUB_TOKEN environment variable, or\n' +
60
+ ' 2. Configure GitHub App in .fractary/config.yaml:\n' +
61
+ ' github:\n' +
62
+ ' app:\n' +
63
+ ' id: "<app-id>"\n' +
64
+ ' installation_id: "<installation-id>"\n' +
65
+ ' private_key_path: "~/.github/your-app.pem"');
66
+ }
67
+ token = patToken;
31
68
  }
32
69
  try {
33
70
  const workManager = new WorkManager({
34
71
  platform: 'github',
35
- owner: organization,
36
- repo: project,
72
+ owner: organization.trim(),
73
+ repo: project.trim(),
37
74
  token,
38
75
  });
39
76
  const repoManager = new RepoManager({
40
77
  platform: 'github',
41
- owner: organization,
42
- repo: project,
78
+ owner: organization.trim(),
79
+ repo: project.trim(),
43
80
  token,
44
81
  });
45
- return new RepoClient(workManager, repoManager, organization, project);
82
+ return new RepoClient(workManager, repoManager, organization.trim(), project.trim());
46
83
  }
47
84
  catch (error) {
48
85
  if (error instanceof Error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fractary/faber-cli",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "FABER CLI - Command-line interface for FABER development toolkit",
5
5
  "main": "dist/index.js",
6
6
  "bin": {