@goodandready/dsh-kanban 0.2.19 → 0.2.21

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/lib/intake.js CHANGED
@@ -1,11 +1,9 @@
1
- // Архив выполненного и подхват новых задач из Gitea.
1
+ // Archival of completed tasks and ingestion of new tasks from Gitea.
2
2
  //
3
- // Две противоположные заботы в одном месте: одна убирает с доски отработавшее,
4
- // другая приносит новое. Обе решают, ЧТО должно быть на доске, и держать их
5
- // рядом дешевле, чем искать по разным углам, почему карточка появилась или
6
- // пропала.
3
+ // Two complementary concerns in one module: one clears finished tasks from board,
4
+ // the other ingests new ones. Both govern WHAT belongs on the board.
7
5
 
8
- /** Разбор списка репозиториев из настройки: через запятую, пробелы не в счёт. */
6
+ /** Parse repository list from config: comma-separated, ignoring whitespace. */
9
7
  export function parseWatchList(value) {
10
8
  return String(value ?? '')
11
9
  .split(',')
@@ -14,11 +12,9 @@ export function parseWatchList(value) {
14
12
  }
15
13
 
16
14
  /**
17
- * Репозитории, за которыми следим, если их назвали поимённо.
15
+ * Repositories watched explicitly when named.
18
16
  *
19
- * Пустой список означает «все», и разбирается это не здесь, а в проходе
20
- * подхвата: там есть Gitea, у которого можно спросить, какие репозитории вообще
21
- * существуют.
17
+ * Empty list means 'all', handled in intake pass where Gitea query lists all repos.
22
18
  *
23
19
  * @returns {Array<{owner: string, repo: string}>}
24
20
  */
@@ -26,8 +22,7 @@ export function watchedRepos({ config, owner }) {
26
22
  const out = []
27
23
  const seen = new Set()
28
24
  for (const name of parseWatchList(config?.watchRepos)) {
29
- // Имя допускается и полное, и короткое: `владелец/репо` либо просто
30
- // `репо` — тогда владелец берётся общий.
25
+ // Name can be full or short: `owner/repo` or just `repo` using default owner.
31
26
  const at = name.indexOf('/')
32
27
  const pair = at > 0
33
28
  ? { owner: name.slice(0, at), repo: name.slice(at + 1) }
@@ -42,16 +37,15 @@ export function watchedRepos({ config, owner }) {
42
37
  }
43
38
 
44
39
  /**
45
- * Стоит ли заводить карточку под этот issue.
40
+ * Whether to create a card for this issue.
46
41
  *
47
- * @returns {{take: boolean, why: string}} `why` называет причину отказа —
48
- * иначе «почему этой задачи нет на доске» превращается в гадание.
42
+ * @returns {{take: boolean, why: string}} `why` states reason on rejection.
49
43
  */
50
44
  export function shouldTake({ store, owner, repo, issue }) {
51
45
  const number = issue?.number
52
46
  if (typeof number !== 'number') return { take: false, why: 'missing-number' }
53
- // Pull request в Gitea — тоже issue, но работой на доске он не является:
54
- // он ход работы, а не сама работа.
47
+ // Pull request in Gitea is also an issue, but not a standalone board card:
48
+ // it reflects execution progress, not the task definition.
55
49
  if (issue?.pull_request !== undefined && issue?.pull_request !== null) {
56
50
  return { take: false, why: 'pull-request-ignored' }
57
51
  }
@@ -66,13 +60,12 @@ export function shouldTake({ store, owner, repo, issue }) {
66
60
  }
67
61
 
68
62
  /**
69
- * Пора ли задаче в архив.
63
+ * Whether task is ready for archival.
70
64
  *
71
- * Архивируем ТОЛЬКО из `done`. Задача, застрявшая в ревью на месяц, — это
72
- * сигнал, а не мусор, и прятать её нельзя.
65
+ * Archived ONLY from `done`. A task stuck in review for a month is an alert,
66
+ * not clutter, and must not be hidden.
73
67
  *
74
- * Ноль в настройке отключает самоархивацию: это осознанное «не убирать»,
75
- * а не пропущенное значение.
68
+ * Zero in settings disables auto-archival.
76
69
  */
77
70
  export function archiveBefore({ now, afterDays }) {
78
71
  const days = Number(afterDays)
@@ -81,11 +74,10 @@ export function archiveBefore({ now, afterDays }) {
81
74
  }
82
75
 
83
76
  /**
84
- * Следим ли за этим репозиторием.
77
+ * Whether given repository is watched.
85
78
  *
86
- * Событие из репозитория вне списка подхвата не заслуживает: по таймеру мы
87
- * туда не ходим, и через вебхук ходить тоже не должны — иначе список перестаёт
88
- * что-либо решать.
79
+ * Events outside watched list are ignored: timer does not poll them,
80
+ * so webhooks should not process them either.
89
81
  */
90
82
  export function isWatched({ config, owner, defaultOwner, repo }) {
91
83
  return watchedRepos({ config, owner: defaultOwner }).some(