@danypops/tickets 0.4.3 → 0.4.5
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/package.json +1 -1
- package/src/adapters/github.ts +3 -1
- package/src/adapters/gitlab.ts +3 -1
- package/src/adapters/jira.ts +3 -2
- package/src/application/service.ts +2 -2
- package/src/cli/index.ts +4 -1
- package/src/daemon/ops.ts +1 -1
- package/src/daemon/server.ts +1 -1
- package/src/ports/repository.ts +2 -1
package/package.json
CHANGED
package/src/adapters/github.ts
CHANGED
|
@@ -158,7 +158,9 @@ export class GitHubRepository {
|
|
|
158
158
|
return toDomain(raw);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
// project is accepted for IssueRepository interface parity but ignored --
|
|
162
|
+
// GitHub's scope (owner/repo) is fixed at construction, not overridable per call.
|
|
163
|
+
async search(query: string, limit = 50, _project?: string): Promise<Issue[]> {
|
|
162
164
|
const scope = this.repo ? `repo:${this.owner}/${this.repo}` : `org:${this.owner}`;
|
|
163
165
|
const result = (await this.call((signal) =>
|
|
164
166
|
this.client.rest.search.issuesAndPullRequests({ q: `${scope} ${query}`, per_page: limit, request: { signal } }),
|
package/src/adapters/gitlab.ts
CHANGED
|
@@ -141,7 +141,9 @@ export class GitLabRepository {
|
|
|
141
141
|
return toDomain(raw);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
// project is accepted for IssueRepository interface parity but ignored --
|
|
145
|
+
// GitLab's scope (projectId) is fixed at construction, not overridable per call.
|
|
146
|
+
async search(query: string, limit = 50, _project?: string): Promise<Issue[]> {
|
|
145
147
|
const raw = await this.call<GlIssue[]>(() =>
|
|
146
148
|
this.client.Issues.all({ projectId: this.projectId, search: query, perPage: limit }),
|
|
147
149
|
);
|
package/src/adapters/jira.ts
CHANGED
|
@@ -237,8 +237,9 @@ export class JiraRepository {
|
|
|
237
237
|
return this.get(key);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
async search(query: string, limit = 50): Promise<Issue[]> {
|
|
241
|
-
const
|
|
240
|
+
async search(query: string, limit = 50, project?: string): Promise<Issue[]> {
|
|
241
|
+
const effectiveProject = project ?? this.project;
|
|
242
|
+
const scope = effectiveProject ? `project = ${jqlQuote(effectiveProject)} AND ` : "";
|
|
242
243
|
const jql = `${scope}text ~ ${jqlQuote(query)} ORDER BY created DESC`;
|
|
243
244
|
return this.searchJql(jql, limit);
|
|
244
245
|
}
|
|
@@ -77,8 +77,8 @@ export class TicketService {
|
|
|
77
77
|
return this.repo(backend).update(key, input);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
async search(backend: string, query: string, limit?: number): Promise<Issue[]> {
|
|
81
|
-
return this.repo(backend).search(query, limit);
|
|
80
|
+
async search(backend: string, query: string, limit?: number, project?: string): Promise<Issue[]> {
|
|
81
|
+
return this.repo(backend).search(query, limit, project);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
async children(ref: string): Promise<Issue[]> {
|
package/src/cli/index.ts
CHANGED
|
@@ -40,12 +40,14 @@ program
|
|
|
40
40
|
.command("list")
|
|
41
41
|
.description("list issues on a backend")
|
|
42
42
|
.requiredOption("-b, --backend <name>", "backend name")
|
|
43
|
+
.option("--project <key>", "project key/id override (e.g. reach CNF or OCPBUGS on a Jira backend defaulting to another project)")
|
|
43
44
|
.option("--status <status>", "filter by status")
|
|
44
45
|
.option("--assignee <user>", "filter by assignee")
|
|
45
46
|
.option("--label <label...>", "filter by label(s)")
|
|
46
47
|
.option("--limit <n>", "max results", (v) => Number.parseInt(v, 10))
|
|
47
48
|
.action(async (opts) => {
|
|
48
49
|
const filter: ListFilter = {
|
|
50
|
+
project: opts.project,
|
|
49
51
|
status: opts.status ? parseStatus(opts.status) : undefined,
|
|
50
52
|
assignee: opts.assignee,
|
|
51
53
|
labels: opts.label,
|
|
@@ -107,9 +109,10 @@ program
|
|
|
107
109
|
.command("search <query>")
|
|
108
110
|
.description("search issues on a backend")
|
|
109
111
|
.requiredOption("-b, --backend <name>", "backend name")
|
|
112
|
+
.option("--project <key>", "project key/id override (e.g. reach CNF or OCPBUGS on a Jira backend defaulting to another project)")
|
|
110
113
|
.option("--limit <n>", "max results", (v) => Number.parseInt(v, 10))
|
|
111
114
|
.action(async (query: string, opts) => {
|
|
112
|
-
await withClient((client) => client.call("issue.search", { backend: opts.backend, query, limit: opts.limit }));
|
|
115
|
+
await withClient((client) => client.call("issue.search", { backend: opts.backend, query, limit: opts.limit, project: opts.project }));
|
|
113
116
|
});
|
|
114
117
|
|
|
115
118
|
program
|
package/src/daemon/ops.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface TicketOpInputs extends Record<TicketOperation, unknown> {
|
|
|
36
36
|
"issue.get": { ref: string };
|
|
37
37
|
"issue.create": { backend: string; input: CreateInput };
|
|
38
38
|
"issue.update": { ref: string; input: UpdateInput };
|
|
39
|
-
"issue.search": { backend: string; query: string; limit?: number };
|
|
39
|
+
"issue.search": { backend: string; query: string; limit?: number; project?: string };
|
|
40
40
|
"issue.children": { ref: string };
|
|
41
41
|
"issue.comments": { ref: string };
|
|
42
42
|
"issue.comment_add": { ref: string; body: string };
|
package/src/daemon/server.ts
CHANGED
|
@@ -41,7 +41,7 @@ const handlers: { [Op in TicketOperation]: Handler<Op> } = {
|
|
|
41
41
|
"issue.get": async (deps, input) => ({ issue: await deps.service.get(input.ref) }),
|
|
42
42
|
"issue.create": async (deps, input) => ({ issue: await deps.service.create(input.backend, input.input) }),
|
|
43
43
|
"issue.update": async (deps, input) => ({ issue: await deps.service.update(input.ref, input.input) }),
|
|
44
|
-
"issue.search": async (deps, input) => ({ issues: await deps.service.search(input.backend, input.query, input.limit) }),
|
|
44
|
+
"issue.search": async (deps, input) => ({ issues: await deps.service.search(input.backend, input.query, input.limit, input.project) }),
|
|
45
45
|
"issue.children": async (deps, input) => ({ issues: await deps.service.children(input.ref) }),
|
|
46
46
|
"issue.comments": async (deps, input) => ({ comments: await deps.service.comments(input.ref) }),
|
|
47
47
|
"issue.comment_add": async (deps, input) => ({ comment: await deps.service.addComment(input.ref, input.body) }),
|
package/src/ports/repository.ts
CHANGED
|
@@ -13,7 +13,8 @@ export interface IssueRepository {
|
|
|
13
13
|
get(key: string): Promise<Issue>;
|
|
14
14
|
create(input: CreateInput): Promise<Issue>;
|
|
15
15
|
update(key: string, input: UpdateInput): Promise<Issue>;
|
|
16
|
-
|
|
16
|
+
/** project: per-call override of this repository's own default/configured project (Jira only; GitHub/GitLab ignore it -- their scope is fixed to the configured repo/project at construction). */
|
|
17
|
+
search(query: string, limit?: number, project?: string): Promise<Issue[]>;
|
|
17
18
|
listChildren(key: string): Promise<Issue[]>;
|
|
18
19
|
}
|
|
19
20
|
|