create-hq 10.1.0 → 10.7.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/dist/admin-onboarding.d.ts +42 -0
- package/dist/admin-onboarding.d.ts.map +1 -0
- package/dist/admin-onboarding.js +460 -0
- package/dist/admin-onboarding.js.map +1 -0
- package/dist/art.d.ts +17 -0
- package/dist/art.d.ts.map +1 -0
- package/dist/art.js +171 -0
- package/dist/art.js.map +1 -0
- package/dist/auth.d.ts +60 -23
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +219 -116
- package/dist/auth.js.map +1 -1
- package/dist/cloud.d.ts +26 -0
- package/dist/cloud.d.ts.map +1 -0
- package/dist/cloud.js +126 -0
- package/dist/cloud.js.map +1 -0
- package/dist/company-template.d.ts +34 -0
- package/dist/company-template.d.ts.map +1 -0
- package/dist/company-template.js +142 -0
- package/dist/company-template.js.map +1 -0
- package/dist/deps.d.ts +2 -0
- package/dist/deps.d.ts.map +1 -1
- package/dist/deps.js +42 -30
- package/dist/deps.js.map +1 -1
- package/dist/fetch-template.d.ts +2 -2
- package/dist/fetch-template.d.ts.map +1 -1
- package/dist/fetch-template.js +54 -38
- package/dist/fetch-template.js.map +1 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +28 -4
- package/dist/git.js.map +1 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/dist/invite-command.d.ts +10 -0
- package/dist/invite-command.d.ts.map +1 -0
- package/dist/invite-command.js +110 -0
- package/dist/invite-command.js.map +1 -0
- package/dist/invite.d.ts +91 -0
- package/dist/invite.d.ts.map +1 -0
- package/dist/invite.js +230 -0
- package/dist/invite.js.map +1 -0
- package/dist/join-flow.d.ts +32 -0
- package/dist/join-flow.d.ts.map +1 -0
- package/dist/join-flow.js +194 -0
- package/dist/join-flow.js.map +1 -0
- package/dist/platform.d.ts +2 -2
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +14 -1
- package/dist/platform.js.map +1 -1
- package/dist/scaffold.d.ts +4 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +152 -41
- package/dist/scaffold.js.map +1 -1
- package/dist/team-setup.d.ts +58 -0
- package/dist/team-setup.d.ts.map +1 -0
- package/dist/team-setup.js +237 -0
- package/dist/team-setup.js.map +1 -0
- package/dist/teams-flow.d.ts +36 -0
- package/dist/teams-flow.d.ts.map +1 -0
- package/dist/teams-flow.js +134 -0
- package/dist/teams-flow.js.map +1 -0
- package/dist/tui.d.ts +8 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +86 -0
- package/dist/tui.js.map +1 -0
- package/dist/ui.d.ts +17 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +45 -0
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Member team discovery + clone flow.
|
|
3
|
+
*
|
|
4
|
+
* For users who already have access to one or more HQ team repos via the
|
|
5
|
+
* hq-team-sync GitHub App, enumerate their installations, find the {org}/hq
|
|
6
|
+
* repo for each, present a checklist, and clone the selected repos into
|
|
7
|
+
* companies/{slug}/.
|
|
8
|
+
*
|
|
9
|
+
* No backend involved — all data comes from api.github.com using the user's
|
|
10
|
+
* GitHub App user token.
|
|
11
|
+
*/
|
|
12
|
+
import { type GitHubAuth } from "./auth.js";
|
|
13
|
+
export interface DiscoveredTeam {
|
|
14
|
+
/** Org login (used as companies/{slug}/ directory name) */
|
|
15
|
+
slug: string;
|
|
16
|
+
/** Display name (defaults to org login). */
|
|
17
|
+
name: string;
|
|
18
|
+
/** GitHub HTML URL for the team repo. */
|
|
19
|
+
repoHtmlUrl: string;
|
|
20
|
+
/** HTTPS clone URL. */
|
|
21
|
+
cloneUrl: string;
|
|
22
|
+
/** GitHub installation ID for the App on this org. */
|
|
23
|
+
installationId: number;
|
|
24
|
+
}
|
|
25
|
+
export interface MemberJoinResult {
|
|
26
|
+
joined: DiscoveredTeam[];
|
|
27
|
+
skipped: DiscoveredTeam[];
|
|
28
|
+
failed: {
|
|
29
|
+
team: DiscoveredTeam;
|
|
30
|
+
error: string;
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Enumerate the user's HQ team memberships by walking their App installations.
|
|
35
|
+
* Returns one DiscoveredTeam per hq-* repo found across all installed orgs.
|
|
36
|
+
*/
|
|
37
|
+
export declare function discoverTeams(auth: GitHubAuth): Promise<DiscoveredTeam[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Present discovered teams as a numbered list with all pre-selected, and
|
|
40
|
+
* let the user deselect any they want to skip.
|
|
41
|
+
*
|
|
42
|
+
* Input format:
|
|
43
|
+
* - empty / "all" → keep all
|
|
44
|
+
* - "none" → skip all
|
|
45
|
+
* - "1,3" → deselect entries 1 and 3
|
|
46
|
+
*/
|
|
47
|
+
export declare function selectTeams(teams: DiscoveredTeam[]): Promise<{
|
|
48
|
+
selected: DiscoveredTeam[];
|
|
49
|
+
skipped: DiscoveredTeam[];
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Discover, select, and clone team repos for an authenticated member.
|
|
53
|
+
*
|
|
54
|
+
* Returns a result with joined / skipped / failed lists. Returns null if
|
|
55
|
+
* the user has no HQ teams at all (caller can route to admin onboarding).
|
|
56
|
+
*/
|
|
57
|
+
export declare function runMemberJoin(auth: GitHubAuth, hqRoot: string): Promise<MemberJoinResult | null>;
|
|
58
|
+
//# sourceMappingURL=team-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-setup.d.ts","sourceRoot":"","sources":["../src/team-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,WAAW,CAAC;AA6BnB,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,EAAE;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnD;AA4FD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAwB/E;AAID;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,cAAc,EAAE,GACtB,OAAO,CAAC;IAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAAC,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,CA8CpE;AAoCD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAkDlC"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Member team discovery + clone flow.
|
|
3
|
+
*
|
|
4
|
+
* For users who already have access to one or more HQ team repos via the
|
|
5
|
+
* hq-team-sync GitHub App, enumerate their installations, find the {org}/hq
|
|
6
|
+
* repo for each, present a checklist, and clone the selected repos into
|
|
7
|
+
* companies/{slug}/.
|
|
8
|
+
*
|
|
9
|
+
* No backend involved — all data comes from api.github.com using the user's
|
|
10
|
+
* GitHub App user token.
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from "fs";
|
|
13
|
+
import * as path from "path";
|
|
14
|
+
import * as os from "os";
|
|
15
|
+
import { execSync } from "child_process";
|
|
16
|
+
import { createInterface } from "readline";
|
|
17
|
+
import chalk from "chalk";
|
|
18
|
+
import { HQ_GITHUB_APP_SLUG, githubApi, } from "./auth.js";
|
|
19
|
+
import { ensureCompanyStructure } from "./company-template.js";
|
|
20
|
+
import { stepStatus, success, warn, info } from "./ui.js";
|
|
21
|
+
// ─── Prompt helper ──────────────────────────────────────────────────────────
|
|
22
|
+
function prompt(question, defaultVal) {
|
|
23
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
24
|
+
const suffix = defaultVal ? ` (${defaultVal})` : "";
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
rl.question(` ? ${question}${suffix} `, (answer) => {
|
|
27
|
+
rl.close();
|
|
28
|
+
resolve(answer.trim() || defaultVal || "");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// ─── Git with embedded token (mirrors admin-onboarding.ts) ──────────────────
|
|
33
|
+
function runGitWithToken(args, cwd, auth) {
|
|
34
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "create-hq-git-"));
|
|
35
|
+
const isWindows = process.platform === "win32";
|
|
36
|
+
const askpassPath = path.join(tmpDir, isWindows ? "askpass.cmd" : "askpass.sh");
|
|
37
|
+
try {
|
|
38
|
+
if (isWindows) {
|
|
39
|
+
fs.writeFileSync(askpassPath, `@echo off\nif "%~1"=="" (echo %GIT_TOKEN%) else (echo %GIT_TOKEN%)\n`, "utf-8");
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
fs.writeFileSync(askpassPath, `#!/bin/sh\necho "$GIT_TOKEN"\n`, "utf-8");
|
|
43
|
+
fs.chmodSync(askpassPath, 0o700);
|
|
44
|
+
}
|
|
45
|
+
execSync(`git -c credential.helper= ${args.join(" ")}`, {
|
|
46
|
+
cwd,
|
|
47
|
+
stdio: "pipe",
|
|
48
|
+
env: {
|
|
49
|
+
...process.env,
|
|
50
|
+
GIT_TOKEN: auth.access_token,
|
|
51
|
+
GIT_ASKPASS: askpassPath,
|
|
52
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
53
|
+
GCM_INTERACTIVE: "never",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// ignore
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function tokenAuthUrl(cloneUrl) {
|
|
67
|
+
const u = new URL(cloneUrl);
|
|
68
|
+
u.username = "x-access-token";
|
|
69
|
+
return u.toString();
|
|
70
|
+
}
|
|
71
|
+
// ─── Discovery ──────────────────────────────────────────────────────────────
|
|
72
|
+
async function fetchHqInstallations(auth) {
|
|
73
|
+
const data = await githubApi("/user/installations?per_page=100", auth);
|
|
74
|
+
return (data.installations ?? []).filter((i) => i.app_slug === HQ_GITHUB_APP_SLUG);
|
|
75
|
+
}
|
|
76
|
+
async function findHqReposInInstallation(auth, installation) {
|
|
77
|
+
// GitHub App user token can list repos accessible through this installation
|
|
78
|
+
const data = await githubApi(`/user/installations/${installation.id}/repositories?per_page=100`, auth);
|
|
79
|
+
const repos = data.repositories ?? [];
|
|
80
|
+
// Match repos named hq-* (e.g. hq-indigo, hq-frogbear)
|
|
81
|
+
return repos.filter((r) => /^hq-.+$/i.test(r.name));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Derive a team slug from the repo name. Repo naming convention: hq-{teamSlug}.
|
|
85
|
+
* e.g. "hq-indigo" → "indigo", "hq-frogbear" → "frogbear"
|
|
86
|
+
*/
|
|
87
|
+
function teamSlugFromRepoName(repoName) {
|
|
88
|
+
return repoName.replace(/^hq-/i, "").toLowerCase();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Enumerate the user's HQ team memberships by walking their App installations.
|
|
92
|
+
* Returns one DiscoveredTeam per hq-* repo found across all installed orgs.
|
|
93
|
+
*/
|
|
94
|
+
export async function discoverTeams(auth) {
|
|
95
|
+
const installations = await fetchHqInstallations(auth);
|
|
96
|
+
const teams = [];
|
|
97
|
+
for (const inst of installations) {
|
|
98
|
+
try {
|
|
99
|
+
const repos = await findHqReposInInstallation(auth, inst);
|
|
100
|
+
for (const repo of repos) {
|
|
101
|
+
const slug = teamSlugFromRepoName(repo.name);
|
|
102
|
+
teams.push({
|
|
103
|
+
slug,
|
|
104
|
+
name: `${inst.account.login}/${slug}`,
|
|
105
|
+
repoHtmlUrl: repo.html_url,
|
|
106
|
+
cloneUrl: repo.clone_url,
|
|
107
|
+
installationId: inst.id,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Per-installation errors should not abort the whole discovery
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return teams;
|
|
117
|
+
}
|
|
118
|
+
// ─── Selection UI ───────────────────────────────────────────────────────────
|
|
119
|
+
/**
|
|
120
|
+
* Present discovered teams as a numbered list with all pre-selected, and
|
|
121
|
+
* let the user deselect any they want to skip.
|
|
122
|
+
*
|
|
123
|
+
* Input format:
|
|
124
|
+
* - empty / "all" → keep all
|
|
125
|
+
* - "none" → skip all
|
|
126
|
+
* - "1,3" → deselect entries 1 and 3
|
|
127
|
+
*/
|
|
128
|
+
export async function selectTeams(teams) {
|
|
129
|
+
if (teams.length === 0) {
|
|
130
|
+
return { selected: [], skipped: [] };
|
|
131
|
+
}
|
|
132
|
+
if (teams.length === 1) {
|
|
133
|
+
console.log();
|
|
134
|
+
console.log(chalk.bold(" Found 1 HQ team:"));
|
|
135
|
+
console.log(chalk.green(" [✓] ") + chalk.white(teams[0].name));
|
|
136
|
+
console.log();
|
|
137
|
+
const answer = await prompt(`Set up ${chalk.cyan(teams[0].name)}? (Y/n)`, "y");
|
|
138
|
+
if (answer.toLowerCase().startsWith("y")) {
|
|
139
|
+
return { selected: [teams[0]], skipped: [] };
|
|
140
|
+
}
|
|
141
|
+
return { selected: [], skipped: [teams[0]] };
|
|
142
|
+
}
|
|
143
|
+
console.log();
|
|
144
|
+
console.log(chalk.bold(` Found ${teams.length} HQ teams (all pre-selected):`));
|
|
145
|
+
for (let i = 0; i < teams.length; i++) {
|
|
146
|
+
console.log(chalk.green(" [✓] ") + chalk.cyan(`${i + 1}. `) + chalk.white(teams[i].name));
|
|
147
|
+
}
|
|
148
|
+
console.log();
|
|
149
|
+
console.log(chalk.dim(" Press Enter to set up all, or type numbers to skip (e.g. 2,3)"));
|
|
150
|
+
const answer = await prompt("Skip");
|
|
151
|
+
if (!answer || answer.toLowerCase() === "all") {
|
|
152
|
+
return { selected: [...teams], skipped: [] };
|
|
153
|
+
}
|
|
154
|
+
if (answer.toLowerCase() === "none") {
|
|
155
|
+
return { selected: [], skipped: [...teams] };
|
|
156
|
+
}
|
|
157
|
+
const skipIdx = new Set(answer
|
|
158
|
+
.split(",")
|
|
159
|
+
.map((s) => parseInt(s.trim(), 10) - 1)
|
|
160
|
+
.filter((n) => Number.isInteger(n) && n >= 0 && n < teams.length));
|
|
161
|
+
const selected = teams.filter((_, i) => !skipIdx.has(i));
|
|
162
|
+
const skipped = teams.filter((_, i) => skipIdx.has(i));
|
|
163
|
+
return { selected, skipped };
|
|
164
|
+
}
|
|
165
|
+
// ─── Clone ──────────────────────────────────────────────────────────────────
|
|
166
|
+
function cloneTeam(team, hqRoot, auth) {
|
|
167
|
+
const companiesDir = path.join(hqRoot, "companies");
|
|
168
|
+
if (!fs.existsSync(companiesDir)) {
|
|
169
|
+
fs.mkdirSync(companiesDir, { recursive: true });
|
|
170
|
+
}
|
|
171
|
+
const companyDir = path.join(companiesDir, team.slug);
|
|
172
|
+
if (fs.existsSync(companyDir) && fs.readdirSync(companyDir).length > 0) {
|
|
173
|
+
throw new Error(`companies/${team.slug}/ already exists and is not empty`);
|
|
174
|
+
}
|
|
175
|
+
const remoteUrl = tokenAuthUrl(team.cloneUrl);
|
|
176
|
+
runGitWithToken(["clone", `"${remoteUrl}"`, `"${companyDir}"`], companiesDir, auth);
|
|
177
|
+
// Strip token from stored remote URL
|
|
178
|
+
execSync(`git remote set-url origin "${team.cloneUrl}"`, {
|
|
179
|
+
cwd: companyDir,
|
|
180
|
+
stdio: "pipe",
|
|
181
|
+
});
|
|
182
|
+
// Make sure all standard subdirs exist
|
|
183
|
+
ensureCompanyStructure(companyDir);
|
|
184
|
+
return companyDir;
|
|
185
|
+
}
|
|
186
|
+
// ─── Main flow ──────────────────────────────────────────────────────────────
|
|
187
|
+
/**
|
|
188
|
+
* Discover, select, and clone team repos for an authenticated member.
|
|
189
|
+
*
|
|
190
|
+
* Returns a result with joined / skipped / failed lists. Returns null if
|
|
191
|
+
* the user has no HQ teams at all (caller can route to admin onboarding).
|
|
192
|
+
*/
|
|
193
|
+
export async function runMemberJoin(auth, hqRoot) {
|
|
194
|
+
const discoveryLabel = "Looking up your HQ teams";
|
|
195
|
+
stepStatus(discoveryLabel, "running");
|
|
196
|
+
let teams;
|
|
197
|
+
try {
|
|
198
|
+
teams = await discoverTeams(auth);
|
|
199
|
+
stepStatus(discoveryLabel, "done");
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
stepStatus(discoveryLabel, "failed");
|
|
203
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
204
|
+
warn(`Could not look up your teams: ${message}`);
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
if (teams.length === 0) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
const { selected, skipped } = await selectTeams(teams);
|
|
211
|
+
if (selected.length === 0) {
|
|
212
|
+
info("No teams selected — continuing.");
|
|
213
|
+
return { joined: [], skipped, failed: [] };
|
|
214
|
+
}
|
|
215
|
+
const joined = [];
|
|
216
|
+
const failed = [];
|
|
217
|
+
for (const team of selected) {
|
|
218
|
+
const label = `Cloning ${team.name} → companies/${team.slug}`;
|
|
219
|
+
stepStatus(label, "running");
|
|
220
|
+
try {
|
|
221
|
+
cloneTeam(team, hqRoot, auth);
|
|
222
|
+
stepStatus(label, "done");
|
|
223
|
+
joined.push(team);
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
stepStatus(label, "failed");
|
|
227
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
228
|
+
warn(`Could not set up ${team.name}: ${message}`);
|
|
229
|
+
failed.push({ team, error: message });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (joined.length > 0) {
|
|
233
|
+
success(`${joined.length} team${joined.length === 1 ? "" : "s"} ready`);
|
|
234
|
+
}
|
|
235
|
+
return { joined, skipped, failed };
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=team-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-setup.js","sourceRoot":"","sources":["../src/team-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,kBAAkB,EAClB,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AA8C1D,+EAA+E;AAE/E,SAAS,MAAM,CAAC,QAAgB,EAAE,UAAmB;IACnD,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IA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AAO,GAAG,EAAE,CAAC;YACb,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC5B,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,IAAI,CAAC,oBAAoB,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;YAClD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,CACL,GAAG,MAAM,CAAC,MAAM,QAAQ,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,QAAQ,CAC/D,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teams flow router.
|
|
3
|
+
*
|
|
4
|
+
* Called by scaffold.ts after the user opts into the HQ Teams path. Handles:
|
|
5
|
+
* - Reusing or refreshing GitHub auth
|
|
6
|
+
* - Routing: invite code → join-by-invite, discovery → auto-discovery, new → admin onboarding
|
|
7
|
+
*
|
|
8
|
+
* The team setup happens *after* core HQ has been installed, so all paths
|
|
9
|
+
* receive a fully scaffolded hqRoot to drop companies/{slug}/ into.
|
|
10
|
+
*/
|
|
11
|
+
import { type GitHubAuth } from "./auth.js";
|
|
12
|
+
import { type AdminOnboardingResult } from "./admin-onboarding.js";
|
|
13
|
+
import { type MemberJoinResult } from "./team-setup.js";
|
|
14
|
+
import { type JoinByInviteResult } from "./join-flow.js";
|
|
15
|
+
export type TeamsFlowMode = "existing" | "new";
|
|
16
|
+
export interface TeamsFlowResult {
|
|
17
|
+
auth: GitHubAuth;
|
|
18
|
+
member: MemberJoinResult | null;
|
|
19
|
+
admin: AdminOnboardingResult | null;
|
|
20
|
+
/** Set when the member joined via an invite token. */
|
|
21
|
+
joinedByInvite: JoinByInviteResult | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Authenticate the user, reusing a stored token if it's still valid.
|
|
25
|
+
* If the user doesn't have a GitHub account yet, walk them through creating one.
|
|
26
|
+
*/
|
|
27
|
+
export declare function authenticate(): Promise<GitHubAuth | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Run the teams flow. The mode determines the entry point:
|
|
30
|
+
* - "existing": user said they have an HQ Teams account → prompt for invite code, then discovery
|
|
31
|
+
* - "new": user wants to create a new team → admin onboarding
|
|
32
|
+
*
|
|
33
|
+
* @param joinToken - Pre-supplied invite token (from --join flag). Skips the invite code prompt.
|
|
34
|
+
*/
|
|
35
|
+
export declare function runTeamsFlow(mode: TeamsFlowMode, hqRoot: string, hqVersion: string, preAuth?: GitHubAuth, joinToken?: string): Promise<TeamsFlowResult | null>;
|
|
36
|
+
//# sourceMappingURL=teams-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams-flow.d.ts","sourceRoot":"","sources":["../src/teams-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EACL,KAAK,UAAU,EAMhB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAmB,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAI1E,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,KAAK,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACpC,sDAAsD;IACtD,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC3C;AAoBD;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAqC/D;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,UAAU,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA2DjC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teams flow router.
|
|
3
|
+
*
|
|
4
|
+
* Called by scaffold.ts after the user opts into the HQ Teams path. Handles:
|
|
5
|
+
* - Reusing or refreshing GitHub auth
|
|
6
|
+
* - Routing: invite code → join-by-invite, discovery → auto-discovery, new → admin onboarding
|
|
7
|
+
*
|
|
8
|
+
* The team setup happens *after* core HQ has been installed, so all paths
|
|
9
|
+
* receive a fully scaffolded hqRoot to drop companies/{slug}/ into.
|
|
10
|
+
*/
|
|
11
|
+
import chalk from "chalk";
|
|
12
|
+
import { createInterface } from "readline";
|
|
13
|
+
import { loadGitHubAuth, isGitHubAuthValid, startGitHubDeviceFlow, clearGitHubAuth, openBrowser, } from "./auth.js";
|
|
14
|
+
import { runAdminOnboarding } from "./admin-onboarding.js";
|
|
15
|
+
import { runMemberJoin } from "./team-setup.js";
|
|
16
|
+
import { runJoinByInvite } from "./join-flow.js";
|
|
17
|
+
import { decodeInviteToken } from "./invite.js";
|
|
18
|
+
import { warn, info } from "./ui.js";
|
|
19
|
+
function prompt(question, defaultVal) {
|
|
20
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
21
|
+
const suffix = defaultVal ? ` (${defaultVal})` : "";
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
rl.question(` ? ${question}${suffix} `, (answer) => {
|
|
24
|
+
rl.close();
|
|
25
|
+
resolve(answer.trim() || defaultVal || "");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async function confirm(question, defaultYes) {
|
|
30
|
+
const hint = defaultYes ? "Y/n" : "y/N";
|
|
31
|
+
const answer = await prompt(`${question} (${hint})`);
|
|
32
|
+
if (!answer)
|
|
33
|
+
return defaultYes;
|
|
34
|
+
return answer.toLowerCase().startsWith("y");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Authenticate the user, reusing a stored token if it's still valid.
|
|
38
|
+
* If the user doesn't have a GitHub account yet, walk them through creating one.
|
|
39
|
+
*/
|
|
40
|
+
export async function authenticate() {
|
|
41
|
+
// Try existing token first
|
|
42
|
+
const existing = loadGitHubAuth();
|
|
43
|
+
if (existing) {
|
|
44
|
+
const valid = await isGitHubAuthValid(existing);
|
|
45
|
+
if (valid) {
|
|
46
|
+
info(`Already signed in as ${chalk.cyan("@" + existing.login)}`);
|
|
47
|
+
return existing;
|
|
48
|
+
}
|
|
49
|
+
info("Stored credentials expired — re-authenticating");
|
|
50
|
+
clearGitHubAuth();
|
|
51
|
+
}
|
|
52
|
+
// Quick check: does the user have a GitHub account?
|
|
53
|
+
console.log();
|
|
54
|
+
const hasGithub = await confirm("Do you have a GitHub account?", true);
|
|
55
|
+
if (!hasGithub) {
|
|
56
|
+
console.log();
|
|
57
|
+
info("HQ Teams uses GitHub for identity, repos, and access control.");
|
|
58
|
+
const create = await confirm("Open github.com/signup in your browser to create one?", true);
|
|
59
|
+
if (!create) {
|
|
60
|
+
warn("A GitHub account is required for HQ Teams. Aborting team setup.");
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
openBrowser("https://github.com/signup");
|
|
64
|
+
console.log();
|
|
65
|
+
info("After creating your account, come back here and press Enter...");
|
|
66
|
+
await prompt("");
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
return await startGitHubDeviceFlow();
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
73
|
+
warn(`GitHub sign-in failed: ${message}`);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Run the teams flow. The mode determines the entry point:
|
|
79
|
+
* - "existing": user said they have an HQ Teams account → prompt for invite code, then discovery
|
|
80
|
+
* - "new": user wants to create a new team → admin onboarding
|
|
81
|
+
*
|
|
82
|
+
* @param joinToken - Pre-supplied invite token (from --join flag). Skips the invite code prompt.
|
|
83
|
+
*/
|
|
84
|
+
export async function runTeamsFlow(mode, hqRoot, hqVersion, preAuth, joinToken) {
|
|
85
|
+
const auth = preAuth ?? await authenticate();
|
|
86
|
+
if (!auth)
|
|
87
|
+
return null;
|
|
88
|
+
const result = { auth, member: null, admin: null, joinedByInvite: null };
|
|
89
|
+
if (mode === "existing") {
|
|
90
|
+
// Check for a pre-supplied token (--join flag) or prompt for one
|
|
91
|
+
let token = joinToken;
|
|
92
|
+
if (!token) {
|
|
93
|
+
console.log();
|
|
94
|
+
token = await prompt("Enter your invite code (or press Enter to auto-discover)");
|
|
95
|
+
}
|
|
96
|
+
// If the user provided a token, use the invite flow
|
|
97
|
+
if (token) {
|
|
98
|
+
// Validate the token before proceeding
|
|
99
|
+
const decoded = decodeInviteToken(token);
|
|
100
|
+
if (!decoded) {
|
|
101
|
+
warn("That doesn't look like a valid invite code.");
|
|
102
|
+
info("Check that you copied the full code starting with hq_");
|
|
103
|
+
console.log();
|
|
104
|
+
// Fall through to discovery as a courtesy
|
|
105
|
+
info("Trying auto-discovery instead...");
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
result.joinedByInvite = await runJoinByInvite(auth, hqRoot, token);
|
|
109
|
+
if (result.joinedByInvite) {
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
// Join failed — don't fall through to discovery, the user needs to
|
|
113
|
+
// fix the access issue first
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Auto-discovery: find teams via GitHub App installations
|
|
118
|
+
result.member = await runMemberJoin(auth, hqRoot);
|
|
119
|
+
if (result.member === null) {
|
|
120
|
+
// No teams found at all
|
|
121
|
+
console.log();
|
|
122
|
+
info("No HQ teams are linked to your GitHub account yet.");
|
|
123
|
+
const create = await confirm("Would you like to create a new team now?", false);
|
|
124
|
+
if (create) {
|
|
125
|
+
result.admin = await runAdminOnboarding(auth, hqRoot, hqVersion);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
// mode === "new"
|
|
131
|
+
result.admin = await runAdminOnboarding(auth, hqRoot, hqVersion);
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=teams-flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams-flow.js","sourceRoot":"","sources":["../src/teams-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAEL,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,kBAAkB,EAA8B,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,eAAe,EAA2B,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAuB,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAY1D,SAAS,MAAM,CAAC,QAAgB,EAAE,UAAmB;IACnD,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK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F,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,KAAK,GAAG,MAAM,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,iBAAiB;IACjB,MAAM,CAAC,KAAK,GAAG,MAAM,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/tui.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function stepHeader(current: number, total: number, label: string): void;
|
|
2
|
+
export declare function completedStep(current: number, total: number, label: string): void;
|
|
3
|
+
export declare function failedStep(current: number, total: number, label: string, error: string): void;
|
|
4
|
+
export declare function tuiPrompt(question: string, defaultVal?: string): Promise<string>;
|
|
5
|
+
export declare function tuiConfirm(question: string, defaultYes?: boolean): Promise<boolean>;
|
|
6
|
+
export declare function summaryBox(title: string, lines: string[]): void;
|
|
7
|
+
export declare function errorBox(title: string, message: string, suggestion?: string): void;
|
|
8
|
+
//# sourceMappingURL=tui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAG9E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEjF;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAG7F;AAID,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAatF;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAOtF;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAgB/D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAsBlF"}
|
package/dist/tui.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { createInterface } from "readline";
|
|
3
|
+
// ── Step Headers ────────────────────────────────────────────────
|
|
4
|
+
export function stepHeader(current, total, label) {
|
|
5
|
+
console.log();
|
|
6
|
+
console.log(chalk.cyan.bold(` [${current}/${total}]`) + " " + chalk.white.bold(label));
|
|
7
|
+
}
|
|
8
|
+
export function completedStep(current, total, label) {
|
|
9
|
+
console.log(chalk.green(` [${current}/${total}] ✓`) + " " + chalk.dim(label));
|
|
10
|
+
}
|
|
11
|
+
export function failedStep(current, total, label, error) {
|
|
12
|
+
console.log(chalk.red(` [${current}/${total}] ✗`) + " " + chalk.red(label));
|
|
13
|
+
console.log(chalk.red(" ") + chalk.dim(error));
|
|
14
|
+
}
|
|
15
|
+
// ── Prompts ─────────────────────────────────────────────────────
|
|
16
|
+
export async function tuiPrompt(question, defaultVal) {
|
|
17
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
18
|
+
const suffix = defaultVal ? chalk.dim(` (${defaultVal})`) : "";
|
|
19
|
+
const frame = chalk.dim(" │ ");
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
console.log(chalk.dim(" ┌─────────────────────────────────────"));
|
|
22
|
+
rl.question(`${frame}${question}${suffix} `, (answer) => {
|
|
23
|
+
console.log(chalk.dim(" └─────────────────────────────────────"));
|
|
24
|
+
rl.close();
|
|
25
|
+
resolve(answer.trim() || defaultVal || "");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export async function tuiConfirm(question, defaultYes = true) {
|
|
30
|
+
const yes = defaultYes ? chalk.white.bold("Y") : chalk.dim("y");
|
|
31
|
+
const no = defaultYes ? chalk.dim("n") : chalk.white.bold("N");
|
|
32
|
+
const hint = `${yes}${chalk.dim("/")}${no}`;
|
|
33
|
+
const answer = await tuiPrompt(`${question} [${hint}]`);
|
|
34
|
+
if (!answer)
|
|
35
|
+
return defaultYes;
|
|
36
|
+
return answer.toLowerCase().startsWith("y");
|
|
37
|
+
}
|
|
38
|
+
// ── Boxes ───────────────────────────────────────────────────────
|
|
39
|
+
export function summaryBox(title, lines) {
|
|
40
|
+
const pad = 2;
|
|
41
|
+
const maxContent = Math.max(title.length, ...lines.map(stripAnsi).map((l) => l.length));
|
|
42
|
+
const innerWidth = maxContent + pad * 2;
|
|
43
|
+
console.log();
|
|
44
|
+
console.log(chalk.green(" ┌" + "─".repeat(innerWidth) + "┐"));
|
|
45
|
+
console.log(chalk.green(" │") + centerText(chalk.green.bold(title), innerWidth, title.length) + chalk.green("│"));
|
|
46
|
+
console.log(chalk.green(" ├" + "─".repeat(innerWidth) + "┤"));
|
|
47
|
+
for (const line of lines) {
|
|
48
|
+
const raw = stripAnsi(line);
|
|
49
|
+
const padding = innerWidth - raw.length - pad;
|
|
50
|
+
console.log(chalk.green(" │") + " ".repeat(pad) + line + " ".repeat(Math.max(0, padding)) + chalk.green("│"));
|
|
51
|
+
}
|
|
52
|
+
console.log(chalk.green(" └" + "─".repeat(innerWidth) + "┘"));
|
|
53
|
+
console.log();
|
|
54
|
+
}
|
|
55
|
+
export function errorBox(title, message, suggestion) {
|
|
56
|
+
const lines = [message];
|
|
57
|
+
if (suggestion) {
|
|
58
|
+
lines.push("");
|
|
59
|
+
lines.push(chalk.dim("Suggestion: ") + suggestion);
|
|
60
|
+
}
|
|
61
|
+
const pad = 2;
|
|
62
|
+
const maxContent = Math.max(title.length, ...lines.map(stripAnsi).map((l) => l.length));
|
|
63
|
+
const innerWidth = maxContent + pad * 2;
|
|
64
|
+
console.log();
|
|
65
|
+
console.log(chalk.red(" ┌" + "─".repeat(innerWidth) + "┐"));
|
|
66
|
+
console.log(chalk.red(" │") + centerText(chalk.red.bold(title), innerWidth, title.length) + chalk.red("│"));
|
|
67
|
+
console.log(chalk.red(" ├" + "─".repeat(innerWidth) + "┤"));
|
|
68
|
+
for (const line of lines) {
|
|
69
|
+
const raw = stripAnsi(line);
|
|
70
|
+
const padding = innerWidth - raw.length - pad;
|
|
71
|
+
console.log(chalk.red(" │") + " ".repeat(pad) + line + " ".repeat(Math.max(0, padding)) + chalk.red("│"));
|
|
72
|
+
}
|
|
73
|
+
console.log(chalk.red(" └" + "─".repeat(innerWidth) + "┘"));
|
|
74
|
+
console.log();
|
|
75
|
+
}
|
|
76
|
+
// ── Helpers ─────────────────────────────────────────────────────
|
|
77
|
+
function stripAnsi(str) {
|
|
78
|
+
// eslint-disable-next-line no-control-regex
|
|
79
|
+
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
80
|
+
}
|
|
81
|
+
function centerText(text, width, rawLength) {
|
|
82
|
+
const leftPad = Math.floor((width - rawLength) / 2);
|
|
83
|
+
const rightPad = width - rawLength - leftPad;
|
|
84
|
+
return " ".repeat(leftPad) + text + " ".repeat(rightPad);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=tui.js.map
|
package/dist/tui.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,mEAAmE;AAEnE,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,KA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AC;AAC3D,CAAC"}
|
package/dist/ui.d.ts
CHANGED
|
@@ -4,5 +4,22 @@ export declare function success(msg: string): void;
|
|
|
4
4
|
export declare function warn(msg: string): void;
|
|
5
5
|
export declare function info(msg: string): void;
|
|
6
6
|
export declare function step(msg: string): void;
|
|
7
|
+
export type TeamOrientationOptions = {
|
|
8
|
+
mode: "admin";
|
|
9
|
+
displayDir: string;
|
|
10
|
+
teamName: string;
|
|
11
|
+
teamSlug: string;
|
|
12
|
+
orgLogin: string;
|
|
13
|
+
repoUrl: string;
|
|
14
|
+
} | {
|
|
15
|
+
mode: "member";
|
|
16
|
+
displayDir: string;
|
|
17
|
+
teams: {
|
|
18
|
+
name: string;
|
|
19
|
+
slug: string;
|
|
20
|
+
repoUrl: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
export declare function teamOrientation(opts: TeamOrientationOptions): void;
|
|
7
24
|
export declare function nextSteps(dir: string): void;
|
|
8
25
|
//# sourceMappingURL=ui.d.ts.map
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAKA,wBAAgB,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAmC1E;AAMD,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAChD,IAAI,CA2CN;AAID,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzC;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,wBAAgB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