@bretwardjames/ghp-cli 0.1.2 → 0.1.4

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,148 +1,19 @@
1
- import type { RepoInfo, ProjectItem, Project, StatusField } from './types.js';
2
- export declare class GitHubAPI {
3
- private graphqlWithAuth;
4
- username: string | null;
5
- /**
6
- * Get token from gh CLI or environment variable
7
- */
8
- getToken(): Promise<string | null>;
9
- /**
10
- * Authenticate with GitHub
11
- */
12
- authenticate(): Promise<boolean>;
13
- get isAuthenticated(): boolean;
14
- /**
15
- * Get projects linked to a repository
16
- */
17
- getProjects(repo: RepoInfo): Promise<Project[]>;
18
- /**
19
- * Get items from a project
20
- */
21
- getProjectItems(projectId: string, projectTitle: string): Promise<ProjectItem[]>;
22
- /**
23
- * Get the Status field info for a project
24
- */
25
- getStatusField(projectId: string): Promise<StatusField | null>;
26
- /**
27
- * Get project views
28
- */
29
- getProjectViews(projectId: string): Promise<Array<{
30
- name: string;
31
- filter: string | null;
32
- }>>;
33
- /**
34
- * Update an item's status
35
- */
36
- updateItemStatus(projectId: string, itemId: string, fieldId: string, optionId: string): Promise<boolean>;
37
- /**
38
- * Find an item by issue number across all projects for this repo
39
- */
40
- findItemByNumber(repo: RepoInfo, issueNumber: number): Promise<ProjectItem | null>;
41
- /**
42
- * Get all fields for a project
43
- */
44
- getProjectFields(projectId: string): Promise<Array<{
45
- id: string;
46
- name: string;
47
- type: string;
48
- options?: Array<{
49
- id: string;
50
- name: string;
51
- }>;
52
- }>>;
53
- /**
54
- * Set a field value on a project item
55
- */
56
- setFieldValue(projectId: string, itemId: string, fieldId: string, value: {
57
- text?: string;
58
- number?: number;
59
- singleSelectOptionId?: string;
60
- }): Promise<boolean>;
61
- /**
62
- * Create a new issue
63
- */
64
- createIssue(repo: RepoInfo, title: string, body?: string): Promise<{
65
- id: string;
66
- number: number;
67
- } | null>;
68
- /**
69
- * Add an issue to a project
70
- */
71
- addToProject(projectId: string, contentId: string): Promise<string | null>;
72
- /**
73
- * Get full issue details including body and comments
74
- */
75
- getIssueDetails(repo: RepoInfo, issueNumber: number): Promise<IssueDetails | null>;
76
- /**
77
- * Add a comment to an issue or PR
78
- */
79
- addComment(repo: RepoInfo, issueNumber: number, body: string): Promise<boolean>;
80
- /**
81
- * Get repository collaborators (for @ mention suggestions)
82
- */
83
- getCollaborators(repo: RepoInfo): Promise<Collaborator[]>;
84
- /**
85
- * Get recent issues (for # reference suggestions)
86
- */
87
- getRecentIssues(repo: RepoInfo, limit?: number): Promise<IssueReference[]>;
88
- /**
89
- * Get the active label name for a user
90
- */
91
- getActiveLabelName(): string;
92
- /**
93
- * Ensure a label exists in the repository, create if it doesn't
94
- */
95
- ensureLabel(repo: RepoInfo, labelName: string, color?: string): Promise<boolean>;
96
- /**
97
- * Add a label to an issue
98
- */
99
- addLabelToIssue(repo: RepoInfo, issueNumber: number, labelName: string): Promise<boolean>;
100
- /**
101
- * Remove a label from an issue
102
- */
103
- removeLabelFromIssue(repo: RepoInfo, issueNumber: number, labelName: string): Promise<boolean>;
104
- /**
105
- * Find all issues with a specific label
106
- */
107
- findIssuesWithLabel(repo: RepoInfo, labelName: string): Promise<number[]>;
108
- /**
109
- * Get available issue types for a repository
110
- */
111
- getIssueTypes(repo: RepoInfo): Promise<Array<{
112
- id: string;
113
- name: string;
114
- }>>;
115
- /**
116
- * Set the issue type on an issue
117
- */
118
- setIssueType(repo: RepoInfo, issueNumber: number, issueTypeId: string): Promise<boolean>;
1
+ /**
2
+ * CLI-specific GitHub API wrapper.
3
+ *
4
+ * This module wraps the core GitHubAPI class with CLI-specific behavior:
5
+ * - Token from `gh auth token` or environment variables
6
+ * - Chalk-colored error messages
7
+ * - process.exit on auth errors
8
+ */
9
+ import { GitHubAPI as CoreGitHubAPI } from '@bretwardjames/ghp-core';
10
+ /**
11
+ * Extended GitHubAPI class for CLI with pre-configured token provider
12
+ */
13
+ declare class CLIGitHubAPI extends CoreGitHubAPI {
14
+ constructor();
119
15
  }
120
- export interface IssueDetails {
121
- title: string;
122
- body: string;
123
- state: string;
124
- type: 'issue' | 'pull_request';
125
- createdAt: string;
126
- author: string;
127
- labels: Array<{
128
- name: string;
129
- color: string;
130
- }>;
131
- comments: Array<{
132
- author: string;
133
- body: string;
134
- createdAt: string;
135
- }>;
136
- totalComments: number;
137
- }
138
- export interface Collaborator {
139
- login: string;
140
- name: string | null;
141
- }
142
- export interface IssueReference {
143
- number: number;
144
- title: string;
145
- state: string;
146
- }
147
- export declare const api: GitHubAPI;
16
+ export type { RepoInfo, Project, ProjectItem, StatusField, IssueDetails, Collaborator, IssueReference, } from '@bretwardjames/ghp-core';
17
+ export declare const api: CLIGitHubAPI;
18
+ export { CLIGitHubAPI as GitHubAPI };
148
19
  //# sourceMappingURL=github-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"github-api.d.ts","sourceRoot":"","sources":["../src/github-api.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAwB9E,qBAAa,SAAS;IAClB,OAAO,CAAC,eAAe,CAA+B;IAC/C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEtC;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAkBxC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IA6BtC,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED;;OAEG;IACG,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAuCrD;;OAEG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAiLtF;;OAEG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAA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