@skitterbyte/skitterspec-github 0.0.0-stage → 1.0.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/MIGRATION.md +1126 -0
- package/README.md +53 -2
- package/assets/claude-md-section.md +85 -0
- package/assets/commands/allow-main.md +33 -0
- package/assets/commands/spec-connect.md +13 -0
- package/assets/commands/spec-live.md +14 -0
- package/assets/commands/spec-remote-review.md +37 -0
- package/assets/commands/spec-skip.md +24 -0
- package/assets/core/SETUP.md +112 -0
- package/assets/core/env.config.json.example +56 -0
- package/assets/core/env.config.md +557 -0
- package/assets/core/gating.config.json.example +4 -0
- package/assets/core/gating.config.md +81 -0
- package/assets/core/github.config.json.example +18 -0
- package/assets/core/github.config.md +66 -0
- package/assets/hooks/main-guard.cjs +162 -0
- package/assets/hooks/review-gate.cjs +146 -0
- package/assets/review/page.html +3384 -0
- package/assets/rules/commit-trailers.md +103 -0
- package/assets/rules/negative-checks.md +69 -0
- package/assets/rules/offered-unblocks.md +100 -0
- package/assets/rules/spec-planning.md +692 -0
- package/assets/rules/spec-reports.md +557 -0
- package/assets/skills/no-spec/SKILL.md +246 -0
- package/assets/skills/spec/SKILL.md +718 -0
- package/assets/skills/spec-bug/SKILL.md +646 -0
- package/assets/skills/spec-cancel/SKILL.md +263 -0
- package/assets/skills/spec-claim/SKILL.md +122 -0
- package/assets/skills/spec-complete/SKILL.md +450 -0
- package/assets/skills/spec-diff/SKILL.md +870 -0
- package/assets/skills/spec-github-setup/SKILL.md +236 -0
- package/assets/skills/spec-hotfix/SKILL.md +668 -0
- package/assets/skills/spec-init/SKILL.md +178 -0
- package/assets/skills/spec-list/SKILL.md +172 -0
- package/assets/skills/spec-next/SKILL.md +685 -0
- package/assets/skills/spec-push/SKILL.md +307 -0
- package/assets/skills/spec-review/SKILL.md +258 -0
- package/assets/skills/spec-reviewed/SKILL.md +284 -0
- package/assets/skills/spec-start/SKILL.md +554 -0
- package/assets/skills/spec-status/SKILL.md +112 -0
- package/assets/skills/spec-sync/SKILL.md +226 -0
- package/assets/skills/spec-to-main/SKILL.md +139 -0
- package/bin/skitterspec-github.js +61 -0
- package/package.json +41 -4
- package/src/cli.js +5907 -0
- package/src/deprecate.js +138 -0
- package/src/env/bootstrap.js +188 -0
- package/src/env/building.js +143 -0
- package/src/env/classify.js +176 -0
- package/src/env/commitcmd.js +108 -0
- package/src/env/config.js +753 -0
- package/src/env/dev.js +63 -0
- package/src/env/hooks.js +226 -0
- package/src/env/hotfix.js +411 -0
- package/src/env/hotfixland.js +302 -0
- package/src/env/integrate.js +126 -0
- package/src/env/live.js +504 -0
- package/src/env/mainguard.js +299 -0
- package/src/env/provision.js +466 -0
- package/src/env/proxy.js +225 -0
- package/src/env/prune.js +119 -0
- package/src/env/registry.js +159 -0
- package/src/env/render.js +17 -0
- package/src/env/resolve.js +716 -0
- package/src/env/review.js +2577 -0
- package/src/env/reviewers/coderabbit.js +228 -0
- package/src/env/reviewers.js +517 -0
- package/src/env/serve.js +1044 -0
- package/src/env/supervise.js +157 -0
- package/src/env/teardown.js +248 -0
- package/src/env/trust.js +87 -0
- package/src/gating.js +155 -0
- package/src/init.js +1150 -0
- package/src/lines-diff.js +114 -0
- package/src/prompts.js +129 -0
- package/src/vendor/github/api.js +800 -0
- package/src/vendor/github/cli-sync.js +1530 -0
- package/src/vendor/github/commands.js +44 -0
- package/src/vendor/github/config.js +414 -0
- package/src/vendor/github/credentials.js +109 -0
- package/src/vendor/github/dialect.js +62 -0
- package/src/vendor/github/identity.js +38 -0
- package/src/vendor/github/mcp.js +85 -0
- package/src/vendor/provider-kit/index.js +41 -0
- package/src/vendor/provider-kit/src/adapter.js +23 -0
- package/src/vendor/provider-kit/src/apply.js +207 -0
- package/src/vendor/provider-kit/src/args.js +68 -0
- package/src/vendor/provider-kit/src/assignment.js +277 -0
- package/src/vendor/provider-kit/src/config.js +198 -0
- package/src/vendor/provider-kit/src/credentials.js +404 -0
- package/src/vendor/provider-kit/src/doctor.js +35 -0
- package/src/vendor/provider-kit/src/http.js +63 -0
- package/src/vendor/provider-kit/src/identity.js +93 -0
- package/src/vendor/provider-kit/src/md-compare.js +39 -0
- package/src/vendor/provider-kit/src/md-tables.js +94 -0
- package/src/vendor/provider-kit/src/prompt.js +50 -0
- package/src/vendor/provider-kit/src/released.js +269 -0
- package/src/vendor/provider-kit/src/releases.js +380 -0
- package/src/vendor/provider-kit/src/specs.js +166 -0
- package/src/vendor/provider-kit/src/transport.js +22 -0
- package/src/vendor/sync-core/index.js +93 -0
- package/src/vendor/sync-core/src/base.js +81 -0
- package/src/vendor/sync-core/src/compare.js +338 -0
- package/src/vendor/sync-core/src/dialect.js +51 -0
- package/src/vendor/sync-core/src/fields.js +36 -0
- package/src/vendor/sync-core/src/legacy.js +100 -0
- package/src/vendor/sync-core/src/normalize.js +998 -0
- package/src/vendor/sync-core/src/push.js +85 -0
- package/src/vendor/sync-core/src/retarget.js +278 -0
- package/src/vendor/sync-core/src/task-block.js +308 -0
- package/src/vendor/sync-core/src/verify.js +67 -0
- package/src/vendor/sync-core/src/write.js +191 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The commands this provider distribution adds on top of the base CLI.
|
|
5
|
+
*
|
|
6
|
+
* ONE table drives both routing and `--help`, exactly as the Linear provider's
|
|
7
|
+
* does: anything added here is routed and documented in the same edit, so the
|
|
8
|
+
* two cannot drift.
|
|
9
|
+
*
|
|
10
|
+
* `run(rest)` returns an exit code (the bin propagates it); `summary` is the
|
|
11
|
+
* one-line description `--help` prints.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const { specSync } = require('./cli-sync.js')
|
|
15
|
+
|
|
16
|
+
const DIST = '@skitterbyte/skitterspec-github'
|
|
17
|
+
|
|
18
|
+
const PROVIDER_COMMANDS = {
|
|
19
|
+
'spec-sync': {
|
|
20
|
+
run: specSync,
|
|
21
|
+
usage: 'skitterspec spec-sync <cmd>',
|
|
22
|
+
summary:
|
|
23
|
+
'One-way sync to GitHub (repo -> tracker; opt-in, needs\n' +
|
|
24
|
+
'specs/.core/github.config.json). Run it with no args to\n' +
|
|
25
|
+
'list its subcommands.',
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The `--help` section for these commands, in the base HELP's column layout:
|
|
30
|
+
// two-space indent, description starting at column 30, continuations aligned.
|
|
31
|
+
const COL = 30
|
|
32
|
+
|
|
33
|
+
function providerHelpSection() {
|
|
34
|
+
const lines = [`Provider commands (${DIST}):`]
|
|
35
|
+
for (const name of Object.keys(PROVIDER_COMMANDS)) {
|
|
36
|
+
const { usage, summary } = PROVIDER_COMMANDS[name]
|
|
37
|
+
const [first, ...rest] = summary.split('\n')
|
|
38
|
+
lines.push(` ${usage.padEnd(COL - 2)}${first}`)
|
|
39
|
+
for (const line of rest) lines.push(`${' '.repeat(COL)}${line}`)
|
|
40
|
+
}
|
|
41
|
+
return lines.join('\n') + '\n'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = { PROVIDER_COMMANDS, providerHelpSection, DIST }
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `specs/.core/github.config.json` — the committed, shareable half of this
|
|
5
|
+
* provider's setup. It holds the repo, the board's number and field NAMES, and
|
|
6
|
+
* env-var NAMES; never a credential (those live in the user-level store —
|
|
7
|
+
* `credentials.js`).
|
|
8
|
+
*
|
|
9
|
+
* The merge/validation machinery is the kit's (`provider-kit/src/config.js`);
|
|
10
|
+
* this module owns what is GitHub's: the defaults, the file name, and the
|
|
11
|
+
* vocabularies.
|
|
12
|
+
*
|
|
13
|
+
* WORKFLOW STATE LIVES ON THE BOARD. A GitHub issue is only open or closed; the
|
|
14
|
+
* named states a spec moves through are options of a Projects v2 single-select
|
|
15
|
+
* field (`github.statusField`, "Status" by default). The board is required —
|
|
16
|
+
* an issue that is not on it has no state at all — and the terminal buckets
|
|
17
|
+
* also close the issue, with the reason `closeReasonFor` names, so the issue
|
|
18
|
+
* list agrees with the board.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const { readFileSync } = require('node:fs')
|
|
22
|
+
const { join } = require('node:path')
|
|
23
|
+
|
|
24
|
+
const kitConfig = require('../provider-kit/src/config.js')
|
|
25
|
+
const { dialect } = require('./dialect.js')
|
|
26
|
+
|
|
27
|
+
const CONFIG_FILE = 'specs/.core/github.config.json'
|
|
28
|
+
|
|
29
|
+
const OWNERSHIP = Object.freeze(['both', 'pull', 'push', 'none'])
|
|
30
|
+
const TASK_MAPPINGS = Object.freeze(['checklist', 'none'])
|
|
31
|
+
const PHASE_MAPPINGS = Object.freeze(['subissue', 'deferred', 'inline'])
|
|
32
|
+
const TRANSPORTS = Object.freeze(['api', 'mcp'])
|
|
33
|
+
const DEFAULT_TOKEN_ENV = 'GITHUB_TOKEN'
|
|
34
|
+
// Read after `auth.tokenEnv`, because it is the name the GitHub CLI itself
|
|
35
|
+
// honours — a machine with `gh` configured often already exports it.
|
|
36
|
+
const FALLBACK_TOKEN_ENV = 'GH_TOKEN'
|
|
37
|
+
const DEFAULT_PHASE_MODE = 'subissue'
|
|
38
|
+
|
|
39
|
+
// The issue's own state for a lifecycle bucket — the half of Decision 3 that
|
|
40
|
+
// is not the board. A bucket absent here leaves the issue OPEN.
|
|
41
|
+
const CLOSE_REASONS = Object.freeze({ complete: 'completed', cancelled: 'not_planned' })
|
|
42
|
+
|
|
43
|
+
const DEFAULT_CONFIG = Object.freeze({
|
|
44
|
+
// `owner`/`repo` is where spec issues land; `project` is the Projects v2
|
|
45
|
+
// board's NUMBER (the one in its URL), owned by `owner`. One board per repo.
|
|
46
|
+
// `statusField` names the single-select carrying workflow state. `labels`
|
|
47
|
+
// tell a spec issue from a phase issue on a personal account, where issue
|
|
48
|
+
// types do not exist; `issueTypes`, when set on an org-owned repo, are used
|
|
49
|
+
// as well.
|
|
50
|
+
github: Object.freeze({
|
|
51
|
+
owner: '',
|
|
52
|
+
repo: '',
|
|
53
|
+
project: null,
|
|
54
|
+
statusField: 'Status',
|
|
55
|
+
labels: Object.freeze({ spec: 'spec', phase: 'phase' }),
|
|
56
|
+
issueTypes: Object.freeze({ spec: '', phase: '' }),
|
|
57
|
+
}),
|
|
58
|
+
// A spec is a GitHub ISSUE; each phase a SUB-ISSUE of it, carrying the
|
|
59
|
+
// phase's checkboxes in its body as a task list (rendered live by GitHub —
|
|
60
|
+
// still a read-only mirror).
|
|
61
|
+
mapping: Object.freeze({ specFolder: 'issue', phases: DEFAULT_PHASE_MODE, tasks: 'checklist' }),
|
|
62
|
+
// Board STATUS OPTION names — the spec issue's (from the folder bucket) and
|
|
63
|
+
// each sub-issue's (from the phase emoji) both map through this table. They
|
|
64
|
+
// must match the Status field's options exactly; the adapter resolves them
|
|
65
|
+
// to option ids at run time and refuses an unknown name.
|
|
66
|
+
states: Object.freeze({
|
|
67
|
+
backlog: 'Backlog',
|
|
68
|
+
'in-progress': 'In Progress',
|
|
69
|
+
complete: 'Done',
|
|
70
|
+
cancelled: 'Cancelled',
|
|
71
|
+
}),
|
|
72
|
+
snapshot: Object.freeze({ overviewFile: '00-overview.md' }),
|
|
73
|
+
// The frontmatter FIELD VOCABULARY this provider stamps into spec files
|
|
74
|
+
// (sync-core `src/fields.js`). The identifier is `#123`; node ids and
|
|
75
|
+
// database ids are resolved from it at run time, never stamped.
|
|
76
|
+
fields: Object.freeze({
|
|
77
|
+
identifier: 'github_identifier',
|
|
78
|
+
url: 'github_url',
|
|
79
|
+
issueId: 'github_issue_id',
|
|
80
|
+
assigneeId: 'github_assignee_id',
|
|
81
|
+
assigneeName: 'github_assignee_name',
|
|
82
|
+
}),
|
|
83
|
+
intake: Object.freeze({ label: '', bugLabels: Object.freeze(['bug']), hotfixLabels: Object.freeze([]) }),
|
|
84
|
+
release: Object.freeze({ stages: Object.freeze([]), ignorePaths: Object.freeze(['specs/', 'CHANGELOG.md', 'RELEASES.md']) }),
|
|
85
|
+
// GitHub Releases, created by CI on a tag push (`spec-sync release …`). Each
|
|
86
|
+
// series names a tag prefix and its deploy envs, keyed by what CI says
|
|
87
|
+
// (`deployed <tag> test`) and valued by the option of `deployedField` — a
|
|
88
|
+
// second single-select on the board, never a Status option.
|
|
89
|
+
releases: Object.freeze({ deployedField: 'Deployed', series: Object.freeze([]) }),
|
|
90
|
+
branch: Object.freeze({ pattern: '{type}/{slug}' }),
|
|
91
|
+
// An env-var NAME, not a value. A classic PAT with `repo` + `project`: the
|
|
92
|
+
// fine-grained kind is documented only for org-owned boards.
|
|
93
|
+
auth: Object.freeze({ tokenEnv: DEFAULT_TOKEN_ENV }),
|
|
94
|
+
apply: Object.freeze({ transport: '' }),
|
|
95
|
+
sync: Object.freeze({
|
|
96
|
+
baseDir: 'specs/.core/github-base',
|
|
97
|
+
backupDir: 'specs/.core/github-backups',
|
|
98
|
+
fieldOwnership: Object.freeze({
|
|
99
|
+
description: 'push',
|
|
100
|
+
subIssues: 'push',
|
|
101
|
+
workflowState: 'push',
|
|
102
|
+
assignee: 'push',
|
|
103
|
+
}),
|
|
104
|
+
localOnlySections: Object.freeze(['State log', 'Changelog', 'Open questions']),
|
|
105
|
+
keyedFields: Object.freeze({}),
|
|
106
|
+
}),
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
const IDENTIFIER_FIELD = DEFAULT_CONFIG.fields.identifier
|
|
110
|
+
|
|
111
|
+
// The per-spec-isolation keys THIS PROVIDER needs a project to declare, merged
|
|
112
|
+
// into env.config.json.example at dist-compose time (see build-dist.js).
|
|
113
|
+
const ENV_CONFIG_DEFAULTS = Object.freeze({
|
|
114
|
+
branch: Object.freeze({ identifierField: IDENTIFIER_FIELD }),
|
|
115
|
+
spec: Object.freeze({
|
|
116
|
+
companionPaths: Object.freeze([`${DEFAULT_CONFIG.sync.baseDir}/{identifier}.base.json`]),
|
|
117
|
+
}),
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
const LIFECYCLE_BUCKETS = Object.freeze(Object.keys(DEFAULT_CONFIG.states))
|
|
121
|
+
|
|
122
|
+
// A fresh, deeply-mutable copy of the defaults to merge onto.
|
|
123
|
+
function defaults() {
|
|
124
|
+
const g = DEFAULT_CONFIG.github
|
|
125
|
+
return {
|
|
126
|
+
github: { ...g, labels: { ...g.labels }, issueTypes: { ...g.issueTypes } },
|
|
127
|
+
mapping: { ...DEFAULT_CONFIG.mapping },
|
|
128
|
+
states: { ...DEFAULT_CONFIG.states },
|
|
129
|
+
snapshot: { ...DEFAULT_CONFIG.snapshot },
|
|
130
|
+
fields: { ...DEFAULT_CONFIG.fields },
|
|
131
|
+
intake: {
|
|
132
|
+
label: DEFAULT_CONFIG.intake.label,
|
|
133
|
+
bugLabels: [...DEFAULT_CONFIG.intake.bugLabels],
|
|
134
|
+
hotfixLabels: [...DEFAULT_CONFIG.intake.hotfixLabels],
|
|
135
|
+
},
|
|
136
|
+
release: {
|
|
137
|
+
stages: DEFAULT_CONFIG.release.stages.map((s) => ({ ...s })),
|
|
138
|
+
ignorePaths: [...DEFAULT_CONFIG.release.ignorePaths],
|
|
139
|
+
},
|
|
140
|
+
releases: { deployedField: DEFAULT_CONFIG.releases.deployedField, series: [] },
|
|
141
|
+
branch: { ...DEFAULT_CONFIG.branch },
|
|
142
|
+
auth: { ...DEFAULT_CONFIG.auth },
|
|
143
|
+
apply: { ...DEFAULT_CONFIG.apply },
|
|
144
|
+
sync: {
|
|
145
|
+
baseDir: DEFAULT_CONFIG.sync.baseDir,
|
|
146
|
+
backupDir: DEFAULT_CONFIG.sync.backupDir,
|
|
147
|
+
fieldOwnership: { ...DEFAULT_CONFIG.sync.fieldOwnership },
|
|
148
|
+
localOnlySections: [...DEFAULT_CONFIG.sync.localOnlySections],
|
|
149
|
+
keyedFields: { ...DEFAULT_CONFIG.sync.keyedFields },
|
|
150
|
+
},
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const { isObject, stringList, assign } = kitConfig
|
|
155
|
+
const { mergeFieldOwnership, mergePhaseMapping, mergeReleaseStages, mergeReleaseIgnorePaths, mergeKeyedFields } =
|
|
156
|
+
kitConfig.makeMergeHelpers({
|
|
157
|
+
configFile: CONFIG_FILE,
|
|
158
|
+
ownership: OWNERSHIP,
|
|
159
|
+
lifecycleBuckets: LIFECYCLE_BUCKETS,
|
|
160
|
+
phaseMappings: PHASE_MAPPINGS,
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
function invalid(key, value, expected) {
|
|
164
|
+
return new Error(`Invalid ${CONFIG_FILE}: ${key} = ${JSON.stringify(value)} (expected ${expected})`)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Merge a parsed config over the defaults. Only known keys are copied (unknown
|
|
169
|
+
* keys ignored for forward-compat). Nested objects are merged field-by-field.
|
|
170
|
+
*/
|
|
171
|
+
function mergeConfig(base, parsed) {
|
|
172
|
+
if (!isObject(parsed)) return base
|
|
173
|
+
|
|
174
|
+
if (isObject(parsed.github)) {
|
|
175
|
+
assign(base.github, parsed.github, 'owner', 'string?')
|
|
176
|
+
assign(base.github, parsed.github, 'repo', 'string?')
|
|
177
|
+
assign(base.github, parsed.github, 'statusField', 'string')
|
|
178
|
+
if ('project' in parsed.github) {
|
|
179
|
+
const n = parsed.github.project
|
|
180
|
+
// The board's NUMBER, from its URL — not its node id. A string of digits
|
|
181
|
+
// is accepted because that is what gets pasted out of a URL.
|
|
182
|
+
if (n === null || n === '') base.github.project = null
|
|
183
|
+
else if (Number.isInteger(n) && n > 0) base.github.project = n
|
|
184
|
+
else if (typeof n === 'string' && /^\d+$/.test(n.trim()) && Number(n) > 0) base.github.project = Number(n)
|
|
185
|
+
else throw invalid('github.project', n, 'the board number from its URL, e.g. 7')
|
|
186
|
+
}
|
|
187
|
+
if (isObject(parsed.github.labels)) {
|
|
188
|
+
assign(base.github.labels, parsed.github.labels, 'spec', 'string?')
|
|
189
|
+
assign(base.github.labels, parsed.github.labels, 'phase', 'string?')
|
|
190
|
+
}
|
|
191
|
+
if (isObject(parsed.github.issueTypes)) {
|
|
192
|
+
assign(base.github.issueTypes, parsed.github.issueTypes, 'spec', 'string?')
|
|
193
|
+
assign(base.github.issueTypes, parsed.github.issueTypes, 'phase', 'string?')
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (isObject(parsed.mapping)) {
|
|
198
|
+
assign(base.mapping, parsed.mapping, 'specFolder', 'string')
|
|
199
|
+
assign(base.mapping, parsed.mapping, 'tasks', 'string')
|
|
200
|
+
if (!TASK_MAPPINGS.includes(base.mapping.tasks)) {
|
|
201
|
+
throw invalid('mapping.tasks', base.mapping.tasks, `one of ${TASK_MAPPINGS.join('|')}`)
|
|
202
|
+
}
|
|
203
|
+
mergePhaseMapping(base.mapping, parsed.mapping)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (isObject(parsed.states)) {
|
|
207
|
+
for (const key of Object.keys(base.states)) {
|
|
208
|
+
assign(base.states, parsed.states, key, 'string')
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (isObject(parsed.snapshot)) {
|
|
213
|
+
assign(base.snapshot, parsed.snapshot, 'overviewFile', 'string')
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (isObject(parsed.intake)) {
|
|
217
|
+
assign(base.intake, parsed.intake, 'label', 'string?')
|
|
218
|
+
if (Array.isArray(parsed.intake.bugLabels)) base.intake.bugLabels = stringList(parsed.intake.bugLabels)
|
|
219
|
+
if (Array.isArray(parsed.intake.hotfixLabels)) base.intake.hotfixLabels = stringList(parsed.intake.hotfixLabels)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (isObject(parsed.release)) {
|
|
223
|
+
mergeReleaseStages(base.release, parsed.release)
|
|
224
|
+
mergeReleaseIgnorePaths(base.release, parsed.release)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (isObject(parsed.releases)) {
|
|
228
|
+
assign(base.releases, parsed.releases, 'deployedField', 'string')
|
|
229
|
+
if (parsed.releases.series !== undefined) {
|
|
230
|
+
if (!Array.isArray(parsed.releases.series)) throw invalid('releases.series', parsed.releases.series, 'an array of { tagPrefix, envs }')
|
|
231
|
+
const seen = new Set()
|
|
232
|
+
base.releases.series = parsed.releases.series.map((entry, i) => {
|
|
233
|
+
if (!isObject(entry) || typeof entry.tagPrefix !== 'string' || !entry.tagPrefix.trim()) {
|
|
234
|
+
throw invalid(`releases.series[${i}]`, entry, '{ tagPrefix: "pkg@", envs: { key: "Option" } }')
|
|
235
|
+
}
|
|
236
|
+
const tagPrefix = entry.tagPrefix.trim()
|
|
237
|
+
if (seen.has(tagPrefix)) throw invalid(`releases.series[${i}].tagPrefix`, tagPrefix, 'a prefix not already listed')
|
|
238
|
+
seen.add(tagPrefix)
|
|
239
|
+
const envs = {}
|
|
240
|
+
if (entry.envs !== undefined) {
|
|
241
|
+
if (!isObject(entry.envs)) throw invalid(`releases.series[${i}].envs`, entry.envs, 'an object of { key: "Option" }')
|
|
242
|
+
for (const [key, option] of Object.entries(entry.envs)) {
|
|
243
|
+
if (!/^[A-Za-z0-9_.-]+$/.test(key) || typeof option !== 'string' || !option.trim()) {
|
|
244
|
+
throw invalid(`releases.series[${i}].envs.${key}`, option, 'a key of letters/digits and a non-empty option name')
|
|
245
|
+
}
|
|
246
|
+
envs[key] = option.trim()
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return { tagPrefix, envs }
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (isObject(parsed.branch)) {
|
|
255
|
+
assign(base.branch, parsed.branch, 'pattern', 'string')
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (isObject(parsed.auth)) {
|
|
259
|
+
assign(base.auth, parsed.auth, 'tokenEnv', 'string')
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (isObject(parsed.apply)) {
|
|
263
|
+
assign(base.apply, parsed.apply, 'transport', 'string?')
|
|
264
|
+
if (base.apply.transport && !TRANSPORTS.includes(base.apply.transport)) {
|
|
265
|
+
throw invalid('apply.transport', base.apply.transport, `one of ${TRANSPORTS.join('|')}`)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (isObject(parsed.sync)) {
|
|
270
|
+
assign(base.sync, parsed.sync, 'baseDir', 'string')
|
|
271
|
+
assign(base.sync, parsed.sync, 'backupDir', 'string')
|
|
272
|
+
mergeFieldOwnership(base.sync.fieldOwnership, parsed.sync.fieldOwnership)
|
|
273
|
+
if (Array.isArray(parsed.sync.localOnlySections)) {
|
|
274
|
+
base.sync.localOnlySections = stringList(parsed.sync.localOnlySections)
|
|
275
|
+
}
|
|
276
|
+
mergeKeyedFields(base.sync.keyedFields, parsed.sync.keyedFields)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return base
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The issue's own state for a board Status name: `'completed'` /
|
|
284
|
+
* `'not_planned'` for the names the terminal buckets map to, `null` (stays or
|
|
285
|
+
* becomes open) for every other name.
|
|
286
|
+
*
|
|
287
|
+
* Keyed through `states`, so a project that renames "Done" to "Shipped" closes
|
|
288
|
+
* on "Shipped". WHAT WOULD FOOL IT: two buckets mapped to the SAME option name
|
|
289
|
+
* — `complete` and `cancelled` both "Done" — are indistinguishable from the
|
|
290
|
+
* name alone, so the first terminal bucket in `CLOSE_REASONS` order wins and
|
|
291
|
+
* a cancelled spec closes as `completed`. Callers that know the bucket pass it
|
|
292
|
+
* instead (`closeReasonForBucket`), which has no such ambiguity.
|
|
293
|
+
*/
|
|
294
|
+
function closeReasonFor(config, stateName) {
|
|
295
|
+
const want = String(stateName || '').toLowerCase().trim()
|
|
296
|
+
if (!want) return null
|
|
297
|
+
for (const [bucket, reason] of Object.entries(CLOSE_REASONS)) {
|
|
298
|
+
const name = config && config.states && config.states[bucket]
|
|
299
|
+
if (name && String(name).toLowerCase().trim() === want) return reason
|
|
300
|
+
}
|
|
301
|
+
return null
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const closeReasonForBucket = (bucket) => CLOSE_REASONS[bucket] || null
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* What marks an issue as a spec or a phase on create: its label (always, when
|
|
308
|
+
* one is configured) and its issue type (only when one is configured — issue
|
|
309
|
+
* types exist on org-owned repos alone, and naming one on a personal repo is a
|
|
310
|
+
* 422). `kind` is `'spec'` or `'phase'`.
|
|
311
|
+
*/
|
|
312
|
+
function markersFor(config, kind) {
|
|
313
|
+
const g = (config && config.github) || {}
|
|
314
|
+
const label = g.labels && typeof g.labels[kind] === 'string' ? g.labels[kind].trim() : ''
|
|
315
|
+
const type = g.issueTypes && typeof g.issueTypes[kind] === 'string' ? g.issueTypes[kind].trim() : ''
|
|
316
|
+
return { labels: label ? [label] : [], type: type || null }
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Attach the parts of the provider contract that are code, not JSON: the GFM
|
|
320
|
+
// dialect, and the `provider` block retarget reads. GitHub refs carry no team
|
|
321
|
+
// key — `#123` — so `teamKey` is empty and the kit's foreign-key partition
|
|
322
|
+
// never fires; a cross-repo ref is excluded by the ref pattern instead
|
|
323
|
+
// (provider-kit `GITHUB_REF_RE`). Runs on BOTH loader paths so an absent
|
|
324
|
+
// config still carries them.
|
|
325
|
+
function withRuntime(config) {
|
|
326
|
+
config.dialect = dialect
|
|
327
|
+
config.provider = {
|
|
328
|
+
teamKey: '',
|
|
329
|
+
configFile: CONFIG_FILE,
|
|
330
|
+
teamKeyJsonField: 'repo',
|
|
331
|
+
}
|
|
332
|
+
// How sync-core reads a REMOTE issue handed to it raw. The workflow state is
|
|
333
|
+
// the BOARD's Status value, not the issue's open/closed — reading `state`
|
|
334
|
+
// off a REST issue would report "open"/"closed" and every drift check would
|
|
335
|
+
// compare that against "In Progress". The adapter's normalised shape carries
|
|
336
|
+
// `state: { name }` already; the raw GraphQL shape carries it under
|
|
337
|
+
// `projectItems`. Anything else is a cannot-tell (undefined).
|
|
338
|
+
config.remote = {
|
|
339
|
+
stateName(issue) {
|
|
340
|
+
if (!issue || typeof issue !== 'object') return null
|
|
341
|
+
if (issue.state && typeof issue.state === 'object') return issue.state.name != null ? issue.state.name : null
|
|
342
|
+
const items = issue.projectItems && issue.projectItems.nodes
|
|
343
|
+
if (Array.isArray(items)) {
|
|
344
|
+
const want = config.github && config.github.project
|
|
345
|
+
const item = items.find((n) => n && n.project && n.project.number === want)
|
|
346
|
+
const v = item && item.fieldValueByName
|
|
347
|
+
return v && v.name != null ? v.name : null
|
|
348
|
+
}
|
|
349
|
+
return undefined
|
|
350
|
+
},
|
|
351
|
+
description(issue) {
|
|
352
|
+
if (!issue || typeof issue !== 'object') return undefined
|
|
353
|
+
if (typeof issue.description === 'string') return issue.description
|
|
354
|
+
// `body: null` IS an answer: GitHub returns it for an issue whose body
|
|
355
|
+
// was cleared, which is an edit, not a cannot-tell.
|
|
356
|
+
if ('body' in issue) return issue.body == null ? '' : String(issue.body)
|
|
357
|
+
return undefined
|
|
358
|
+
},
|
|
359
|
+
}
|
|
360
|
+
return config
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function loadGithubConfig(dir = process.cwd()) {
|
|
364
|
+
const base = defaults()
|
|
365
|
+
const file = join(dir, CONFIG_FILE)
|
|
366
|
+
|
|
367
|
+
let raw
|
|
368
|
+
try {
|
|
369
|
+
raw = readFileSync(file, 'utf-8')
|
|
370
|
+
} catch (error) {
|
|
371
|
+
if (error.code === 'ENOENT') return { config: withRuntime(base), present: false }
|
|
372
|
+
throw error
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
let parsed
|
|
376
|
+
try {
|
|
377
|
+
parsed = JSON.parse(raw)
|
|
378
|
+
} catch (error) {
|
|
379
|
+
throw new Error(`Invalid ${CONFIG_FILE}: ${error.message}`)
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return { config: withRuntime(mergeConfig(base, parsed)), present: true }
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// The declared deployment ladder (possibly empty) and its rungs — same
|
|
386
|
+
// accessors the other providers expose, reading this provider's config.
|
|
387
|
+
const releaseStages = (config) => (config.release && config.release.stages) || []
|
|
388
|
+
const stageFor = (config, key) => releaseStages(config).find((s) => s.key === key) || null
|
|
389
|
+
const releaseIgnorePaths = (config) => (config.release && config.release.ignorePaths) || []
|
|
390
|
+
|
|
391
|
+
module.exports = {
|
|
392
|
+
loadGithubConfig,
|
|
393
|
+
mergeConfig,
|
|
394
|
+
defaults,
|
|
395
|
+
withRuntime,
|
|
396
|
+
closeReasonFor,
|
|
397
|
+
closeReasonForBucket,
|
|
398
|
+
markersFor,
|
|
399
|
+
releaseStages,
|
|
400
|
+
stageFor,
|
|
401
|
+
releaseIgnorePaths,
|
|
402
|
+
DEFAULT_CONFIG,
|
|
403
|
+
CONFIG_FILE,
|
|
404
|
+
CLOSE_REASONS,
|
|
405
|
+
OWNERSHIP,
|
|
406
|
+
TASK_MAPPINGS,
|
|
407
|
+
PHASE_MAPPINGS,
|
|
408
|
+
LIFECYCLE_BUCKETS,
|
|
409
|
+
TRANSPORTS,
|
|
410
|
+
DEFAULT_TOKEN_ENV,
|
|
411
|
+
FALLBACK_TOKEN_ENV,
|
|
412
|
+
ENV_CONFIG_DEFAULTS,
|
|
413
|
+
IDENTIFIER_FIELD,
|
|
414
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The GitHub binding of the shared credentials store
|
|
5
|
+
* (`@skitterbyte/skitterspec-provider-kit`, `src/credentials.js`) — one file
|
|
6
|
+
* per machine at `$XDG_CONFIG_HOME/skitterspec/credentials.json`, this
|
|
7
|
+
* provider's entries keyed by `github.com/<owner>` so one token serves every
|
|
8
|
+
* repo that owner holds.
|
|
9
|
+
*
|
|
10
|
+
* The credential is a bare token string (a classic PAT with `repo` +
|
|
11
|
+
* `project`), on exactly the terms the Linear key is: never logged, never in an
|
|
12
|
+
* error, never in argv.
|
|
13
|
+
*
|
|
14
|
+
* Environment wins over the store: `auth.tokenEnv` (GITHUB_TOKEN by default),
|
|
15
|
+
* then GH_TOKEN — the name the GitHub CLI itself reads, which a machine with
|
|
16
|
+
* `gh` configured often already exports.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const kit = require('../provider-kit/src/credentials.js')
|
|
20
|
+
const { DEFAULT_TOKEN_ENV, FALLBACK_TOKEN_ENV } = require('./config.js')
|
|
21
|
+
|
|
22
|
+
// v1 stores were only ever written by the Linear provider (the store predates
|
|
23
|
+
// the namespace), so this binding is NOT their owner: its first write migrates
|
|
24
|
+
// a v1 file to the namespaced v2 shape, folding the old entries under linear.
|
|
25
|
+
const store = kit.makeCredentialsStore({ provider: 'github', legacyV1Owner: 'linear' })
|
|
26
|
+
|
|
27
|
+
// A GitHub token pasted where a command belongs: classic (`ghp_`), OAuth
|
|
28
|
+
// (`gho_`), user-to-server (`ghu_`), server-to-server (`ghs_`), refresh
|
|
29
|
+
// (`ghr_`), and fine-grained (`github_pat_`).
|
|
30
|
+
const LITERAL_TOKEN_RE = /\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/
|
|
31
|
+
|
|
32
|
+
const LITERAL_TOKEN_ADVICE =
|
|
33
|
+
'that command has a GitHub token written into it.\n' +
|
|
34
|
+
' A command is displayed by `credentials status` and is not treated as a\n' +
|
|
35
|
+
' secret — embedding a token there exposes it. To store a token, run\n' +
|
|
36
|
+
' `credentials set` with no arguments and paste at the hidden prompt.'
|
|
37
|
+
|
|
38
|
+
// The store scope for a config: the OWNER, not the repo — a classic PAT is an
|
|
39
|
+
// account's, and every repo that account holds is reached by the same one.
|
|
40
|
+
const scopeOf = (config) => {
|
|
41
|
+
const owner = config && config.github && config.github.owner
|
|
42
|
+
return owner ? `github.com/${String(owner).toLowerCase()}` : ''
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Resolve the token: environment first, then the store.
|
|
47
|
+
*
|
|
48
|
+
* @returns {{ ok: true, token, source, envVar? } | { ok: false, error, envVars }}
|
|
49
|
+
* `source` is `'env'`, `'store'` or `'command'`. The error names what was
|
|
50
|
+
* looked for and where; it never contains a token.
|
|
51
|
+
*/
|
|
52
|
+
function resolveCredential(config, env = process.env, deps = {}) {
|
|
53
|
+
const tokenEnv = (config && config.auth && config.auth.tokenEnv) || DEFAULT_TOKEN_ENV
|
|
54
|
+
const envVars = tokenEnv === FALLBACK_TOKEN_ENV ? [tokenEnv] : [tokenEnv, FALLBACK_TOKEN_ENV]
|
|
55
|
+
for (const name of envVars) {
|
|
56
|
+
const token = (env[name] || '').trim()
|
|
57
|
+
if (token) return { ok: true, token, source: 'env', envVar: name, envVars }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const scope = scopeOf(config)
|
|
61
|
+
const file = (deps.storePath || kit.storePath)(env)
|
|
62
|
+
if (scope) {
|
|
63
|
+
const read = (deps.readStore || kit.readStore)(file)
|
|
64
|
+
if (read.ok) {
|
|
65
|
+
const got = store.resolveKey(read.store, scope, deps)
|
|
66
|
+
if (got.key) return { ok: true, token: got.key, source: got.source, path: file, envVars }
|
|
67
|
+
if (got.reason) return { ok: false, error: got.reason, envVars, path: file }
|
|
68
|
+
} else if (read.code !== 'absent') {
|
|
69
|
+
return { ok: false, error: read.reason, envVars, path: file }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
ok: false,
|
|
75
|
+
error:
|
|
76
|
+
`no GitHub token: set ${envVars.join(' or ')}, or run ` +
|
|
77
|
+
'`skitterspec-github spec-sync credentials set`' +
|
|
78
|
+
(scope ? '' : ' (and set github.owner, which keys the stored token)'),
|
|
79
|
+
envVars,
|
|
80
|
+
path: file,
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const writeCredential = (file, scope, token, deps) => store.writeKey(file, scope, token, deps)
|
|
85
|
+
const userForScope = (s, scope) => store.userFor(s, scope)
|
|
86
|
+
const writeUser = (file, scope, user, deps) => store.writeUser(file, scope, user, deps)
|
|
87
|
+
const removeUser = (file, scope, deps) => store.removeUser(file, scope, deps)
|
|
88
|
+
const removeCredential = (file, scope, deps) => store.removeKey(file, scope, deps)
|
|
89
|
+
const writeKeyCommand = (file, scope, command, deps) =>
|
|
90
|
+
store.writeKeyCommand(file, scope, command, deps, {
|
|
91
|
+
literalKeyRe: LITERAL_TOKEN_RE,
|
|
92
|
+
literalKeyAdvice: LITERAL_TOKEN_ADVICE,
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
module.exports = {
|
|
96
|
+
storePath: kit.storePath,
|
|
97
|
+
readStore: kit.readStore,
|
|
98
|
+
storeMode: kit.storeMode,
|
|
99
|
+
fingerprint: kit.fingerprint,
|
|
100
|
+
resolveCredential,
|
|
101
|
+
scopeOf,
|
|
102
|
+
writeCredential,
|
|
103
|
+
userForScope,
|
|
104
|
+
writeUser,
|
|
105
|
+
removeUser,
|
|
106
|
+
removeCredential,
|
|
107
|
+
writeKeyCommand,
|
|
108
|
+
LITERAL_TOKEN_RE,
|
|
109
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The GitHub dialect — how projections are shaped for, and read back from, a
|
|
5
|
+
* tracker that stores GitHub-flavoured markdown as-is.
|
|
6
|
+
*
|
|
7
|
+
* Near-identity, and that is the point: GitHub keeps an issue body verbatim
|
|
8
|
+
* and renders `- [ ]` task lists natively, so there is no format to convert
|
|
9
|
+
* and no reserialisation mangle to defend against. What the hooks carry
|
|
10
|
+
* (sync-core `src/dialect.js`):
|
|
11
|
+
*
|
|
12
|
+
* - `canonicalize` — light canonicalisation of the outbound projection:
|
|
13
|
+
* bullet markers unify, trailing whitespace and blank runs collapse, so
|
|
14
|
+
* semantically-equal content hashes equal.
|
|
15
|
+
* - `flattenTables` — NOT supplied. GFM renders a table inside a list item
|
|
16
|
+
* only when it is indented as the item's continuation, which the
|
|
17
|
+
* projection already does; nothing here is known to be corrupted, and
|
|
18
|
+
* re-shaping text that renders fine is a change nobody asked for.
|
|
19
|
+
* - `canonicalForCompare` — the shared markdown-form reduction (kit
|
|
20
|
+
* `src/md-compare.js`). GitHub stores what it is sent, so a read-back
|
|
21
|
+
* differs only where a PERSON edited the body on GitHub — a ticked box
|
|
22
|
+
* included — and that is drift the next push replaces, loudly.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const { markdownCanonicalForCompare } = require('../provider-kit/src/md-compare.js')
|
|
26
|
+
|
|
27
|
+
// GitHub's issue body limit, in characters. A body over it is refused by the
|
|
28
|
+
// API with a 422 that names only the field; refusing first names the spec.
|
|
29
|
+
const MAX_BODY_CHARS = 65536
|
|
30
|
+
|
|
31
|
+
function canonicalizeMarkdown(text) {
|
|
32
|
+
if (text == null) return text
|
|
33
|
+
return String(text)
|
|
34
|
+
.replace(/\r\n/g, '\n')
|
|
35
|
+
.split('\n')
|
|
36
|
+
.map((line) => line.replace(/^(\s*)[*+-]( +)/, '$1-$2').replace(/[ \t]+$/, ''))
|
|
37
|
+
.join('\n')
|
|
38
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
39
|
+
.trim()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const dialect = Object.freeze({
|
|
43
|
+
canonicalize: canonicalizeMarkdown,
|
|
44
|
+
canonicalForCompare: markdownCanonicalForCompare,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Throw a named refusal when a body would exceed GitHub's limit. `what` names
|
|
49
|
+
* the thing being written (a spec, a phase file) so the reader knows which
|
|
50
|
+
* document to trim.
|
|
51
|
+
*/
|
|
52
|
+
function assertBodyFits(body, what) {
|
|
53
|
+
const n = body == null ? 0 : String(body).length
|
|
54
|
+
if (n > MAX_BODY_CHARS) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`${what || 'this issue body'} is ${n} characters — GitHub caps an issue body at ` +
|
|
57
|
+
`${MAX_BODY_CHARS}. Trim the document (or move detail into a linked file) and push again.`,
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = { dialect, canonicalizeMarkdown, assertBodyFits, MAX_BODY_CHARS }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* "Who am I on GitHub?" — the GitHub binding of the kit's identity resolver
|
|
5
|
+
* (`provider-kit/src/identity.js`: store → viewer → unknown, unknown being a
|
|
6
|
+
* normal state).
|
|
7
|
+
*
|
|
8
|
+
* The answer is DERIVED from the token: a personal access token belongs to a
|
|
9
|
+
* person, so `GET /user` names them. The id is the LOGIN — what an assignee is
|
|
10
|
+
* set by — never the numeric id, which nothing in the CLI accepts.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const { resolveIdentity: kitResolveIdentity, defaultDisplayName } = require('../provider-kit/src/identity.js')
|
|
14
|
+
const { makeApiAdapter } = require('./api.js')
|
|
15
|
+
const { storePath, readStore, userForScope, resolveCredential, scopeOf } = require('./credentials.js')
|
|
16
|
+
|
|
17
|
+
async function resolveIdentity(config, env = process.env, deps = {}) {
|
|
18
|
+
const file = (deps.storePath || storePath)(env)
|
|
19
|
+
return kitResolveIdentity({
|
|
20
|
+
scopeId: scopeOf(config),
|
|
21
|
+
file,
|
|
22
|
+
readStore: (f) => (deps.readStore || readStore)(f),
|
|
23
|
+
userFor: (store, id) => userForScope(store, id),
|
|
24
|
+
// An injected adapter needs no token — the test seam, and nothing else.
|
|
25
|
+
resolveCredential: () => (deps.adapter ? { ok: true } : resolveCredential(config, env)),
|
|
26
|
+
readViewer: (cred) => {
|
|
27
|
+
const g = (config && config.github) || {}
|
|
28
|
+
const adapter =
|
|
29
|
+
deps.adapter || makeApiAdapter({ owner: g.owner, repo: g.repo, project: g.project, token: cred.token, fetch: deps.fetch })
|
|
30
|
+
return adapter.readViewer()
|
|
31
|
+
},
|
|
32
|
+
nameOf: displayNameOf,
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const displayNameOf = defaultDisplayName
|
|
37
|
+
|
|
38
|
+
module.exports = { resolveIdentity, displayNameOf }
|