@tarcisiopgs/lisa 1.25.0 → 1.26.1

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/README.md CHANGED
@@ -91,7 +91,7 @@ source: linear
91
91
  workflow: worktree # "worktree" (isolated) or "branch" (in-place)
92
92
 
93
93
  source_config:
94
- team: Engineering
94
+ scope: Engineering
95
95
  project: Web App
96
96
  label: ready
97
97
  pick_from: Backlog
@@ -129,7 +129,7 @@ JIRA_BASE_URL="" && JIRA_EMAIL="" && JIRA_API_TOKEN=""
129
129
 
130
130
  | Field | Linear | Trello | Plane | Shortcut | GitLab Issues | GitHub Issues | Jira |
131
131
  |-------|--------|--------|-------|----------|---------------|---------------|------|
132
- | `team` | Team name | Board name | Workspace slug | Group name | Project path | `owner/repo` | Project key |
132
+ | `scope` | Team name | Board name | Workspace slug | | Project path | `owner/repo` | Project key |
133
133
  | `project` | Project name | — | Project ID | — | — | — | — |
134
134
  | `pick_from` | Status name | List name | State name | Workflow state | — | — | Status name |
135
135
  | `label` | Label | Label | Label | Label | Label | Label | Label |
@@ -213,7 +213,7 @@ function makeIssueId(owner, repo, number) {
213
213
  var GitHubIssuesSource = class {
214
214
  name = "github-issues";
215
215
  async fetchNextIssue(config) {
216
- const { owner, repo } = parseOwnerRepo(config.team);
216
+ const { owner, repo } = parseOwnerRepo(config.scope);
217
217
  const validStates = ["open", "closed", "all"];
218
218
  const isOrphanDetection = !!config.pick_from && !validStates.includes(config.pick_from);
219
219
  const filterLabels = isOrphanDetection ? [config.pick_from] : Array.isArray(config.label) ? config.label : [config.label];
@@ -355,7 +355,7 @@ var GitHubIssuesSource = class {
355
355
  }
356
356
  }
357
357
  async listIssues(config) {
358
- const { owner, repo } = parseOwnerRepo(config.team);
358
+ const { owner, repo } = parseOwnerRepo(config.scope);
359
359
  const labels = Array.isArray(config.label) ? config.label : [config.label];
360
360
  const label = labels.map((l) => encodeURIComponent(l)).join(",");
361
361
  const path = `/repos/${owner}/${repo}/issues?labels=${label}&state=open&sort=created&direction=asc&per_page=100`;
@@ -367,6 +367,25 @@ var GitHubIssuesSource = class {
367
367
  url: issue.html_url
368
368
  }));
369
369
  }
370
+ async listLabels(scope) {
371
+ const { owner, repo } = parseOwnerRepo(scope);
372
+ const results = [];
373
+ let page = 1;
374
+ while (true) {
375
+ const labels = await githubGet(
376
+ `/repos/${owner}/${repo}/labels?per_page=100&page=${page}`
377
+ );
378
+ for (const l of labels) {
379
+ results.push({
380
+ value: l.name,
381
+ label: l.description ? `${l.name} \u2014 ${l.description}` : l.name
382
+ });
383
+ }
384
+ if (labels.length < 100) break;
385
+ page++;
386
+ }
387
+ return results;
388
+ }
370
389
  async removeLabel(issueId, labelToRemove) {
371
390
  const ref = parseGitHubIssueNumber(issueId);
372
391
  try {
@@ -458,7 +477,7 @@ function splitIssueId(id) {
458
477
  var GitLabIssuesSource = class {
459
478
  name = "gitlab-issues";
460
479
  async fetchNextIssue(config) {
461
- const project = parseGitLabProject(config.team);
480
+ const project = parseGitLabProject(config.scope);
462
481
  const validStates = ["opened", "closed", "all"];
463
482
  const isOrphanDetection = !!config.pick_from && !validStates.includes(config.pick_from);
464
483
  const filterLabels = isOrphanDetection ? [config.pick_from] : Array.isArray(config.label) ? config.label : [config.label];
@@ -504,7 +523,7 @@ var GitLabIssuesSource = class {
504
523
  const issue = sorted[0];
505
524
  if (!issue) return null;
506
525
  return {
507
- id: makeIssueId2(config.team, issue.iid),
526
+ id: makeIssueId2(config.scope, issue.iid),
508
527
  title: issue.title,
509
528
  description: issue.description ?? "",
510
529
  url: issue.web_url
@@ -573,18 +592,37 @@ var GitLabIssuesSource = class {
573
592
  });
574
593
  }
575
594
  async listIssues(config) {
576
- const project = parseGitLabProject(config.team);
595
+ const project = parseGitLabProject(config.scope);
577
596
  const labelsArr = Array.isArray(config.label) ? config.label : [config.label];
578
597
  const label = labelsArr.map((l) => encodeURIComponent(l)).join(",");
579
598
  const path = `/projects/${project}/issues?labels=${label}&state=opened&per_page=100`;
580
599
  const issues = await gitlabGet(path);
581
600
  return issues.map((issue) => ({
582
- id: makeIssueId2(config.team, issue.iid),
601
+ id: makeIssueId2(config.scope, issue.iid),
583
602
  title: issue.title,
584
603
  description: issue.description ?? "",
585
604
  url: issue.web_url
586
605
  }));
587
606
  }
607
+ async listLabels(scope) {
608
+ const project = parseGitLabProject(scope);
609
+ const results = [];
610
+ let page = 1;
611
+ while (true) {
612
+ const labels = await gitlabGet(
613
+ `/projects/${project}/labels?per_page=100&page=${page}`
614
+ );
615
+ for (const l of labels) {
616
+ results.push({
617
+ value: l.name,
618
+ label: l.description ? `${l.name} \u2014 ${l.description}` : l.name
619
+ });
620
+ }
621
+ if (labels.length < 100) break;
622
+ page++;
623
+ }
624
+ return results;
625
+ }
588
626
  async removeLabel(issueId, labelToRemove) {
589
627
  const { project, iid } = splitIssueId(issueId);
590
628
  const encodedProject = parseGitLabProject(project);