@openagt/skill-github 0.1.9 → 0.1.11

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/SKILL.md CHANGED
@@ -20,7 +20,7 @@ Open a pull request only when your task or the person asks for one, or asks you
20
20
  npx @openagt/skill-github@0.1 open --title "<one line naming what the change does>" --body "<what changed, and why>"
21
21
  ```
22
22
 
23
- It opens the pull request for the branch you are on and prints it in `request` (`number`, `url`). A branch that already has an open pull request gets no second one: that one is answered, with `existing` true. Add `--merge` when the work may land on its own: the pull request then merges once its checks pass, also where the repository does not allow auto-merge (`merge` in the answer says `auto-armed`, `merged` or `watching`). Add `--draft` instead for a pull request a person should look at first; with `--merge` too, `--draft` is dropped.
23
+ It opens the pull request for the branch you are on and prints it in `request` (`number`, `url`). A branch that already has an open pull request gets no second one: that one is answered, with `existing` true. Add `--base <branch>` when you were told which branch the pull request goes into; without it, it goes into the project's default branch. Add `--merge` when the work may land on its own: the pull request then merges once its checks pass, also where the repository does not allow auto-merge (`merge` in the answer says `auto-armed`, `merged` or `watching`). Add `--draft` instead for a pull request a person should look at first; with `--merge` too, `--draft` is dropped.
24
24
 
25
25
  A pull request whose body has a line `Closes #<number>` closes that issue when it merges.
26
26
 
@@ -1,40 +1,71 @@
1
1
  import { type GhRunner } from './gh.js';
2
2
  /**
3
- * The GitHub accounts this computer's `gh` knows, and the one OpenAgent's runs use. The terminal's
4
- * `gh` keeps its own active account; runs use the account picked here, given to each run as its
5
- * own token, so switching one never moves the other. The pick is the account `gh` had active when
6
- * OpenAgent first looked, kept from then on, until it is picked again here.
3
+ * The GitHub accounts OpenAgent has, and the one its runs use. They are OpenAgent's own, never the
4
+ * person's: each account is a folder of its own, the folder `gh` keeps that account's login in
5
+ * (`GH_CONFIG_DIR`), so nothing OpenAgent does reads or changes the person's own `gh`, git or
6
+ * keychain. An account is added by logging it in here, in the browser, or by handing its token
7
+ * over (a server of the person's gets theirs that way).
7
8
  *
8
- * The pick is kept in a file of its own, logins only: `gh` keeps the logins' tokens, and a run's
9
- * is asked of it when the run starts (`gh auth token --user`).
9
+ * The runs' pick is kept in a file of its own, logins only.
10
10
  */
11
11
  /** The host this package answers for. */
12
12
  export declare const HOST = "github.com";
13
- /** An account `gh` knows on the host. */
13
+ /** An account OpenAgent has on the host. */
14
14
  export interface GhAccount {
15
15
  login: string;
16
- /** The terminal's: the one `gh` uses when it is not told which. */
17
- terminal: boolean;
18
- /** Whether `gh` could use it when asked: false for a login GitHub no longer takes. */
16
+ /** Whether GitHub still takes its login: false for one that was revoked or expired. */
19
17
  ok: boolean;
20
18
  }
21
- /** What `gh` knows of the host: whether it is installed at all, and its accounts there. */
19
+ /** Whether `gh` is on this computer at all, and OpenAgent's accounts. */
22
20
  export type GhState = {
23
21
  installed: false;
24
22
  } | {
25
23
  installed: true;
26
24
  accounts: GhAccount[];
27
25
  };
26
+ /** What OpenAgent keeps of an account beside its login: what its commits are signed with. */
27
+ export interface AccountFacts {
28
+ login: string;
29
+ id: number;
30
+ name?: string;
31
+ }
32
+ /** Where OpenAgent's accounts are: one folder each, beside OpenAgent's other files in the person's config folder. */
33
+ export declare function accountsRoot(env?: NodeJS.ProcessEnv): string;
34
+ /** The folder of one account: what `gh` is given as `GH_CONFIG_DIR` to work as it. */
35
+ export declare function accountDir(root: string, login: string): string;
36
+ /** Whether `dir` is one of OpenAgent's account folders: a run is given one, and works as it. */
37
+ export declare function isAccountDir(root: string, dir: string): boolean;
38
+ /** `gh` working as the account in `dir`: its folder, never the person's, and no token from the environment unless given. */
39
+ export declare function asAccount(gh: GhRunner, dir: string): GhRunner;
40
+ /** The logins OpenAgent has, by name. */
41
+ export declare function accountLogins(root: string): string[];
42
+ export declare function readFacts(dir: string): AccountFacts | undefined;
43
+ /** Who GitHub says the account `gh` works as is: its login, id and name. */
44
+ export declare function whoAmI(gh: GhRunner, cwd: string): Promise<AccountFacts>;
45
+ /**
46
+ * A browser login that GitHub said yes to becomes an account: its folder is named by its login,
47
+ * an account of that name before it replaced. Nothing while the login is still waiting, or when
48
+ * none was started. Answers the login added.
49
+ */
50
+ export declare function settleAdded(root: string, gh: GhRunner, cwd: string, files?: JobFiles): Promise<string | undefined>;
28
51
  /** Where the runs' pick is kept: beside OpenAgent's other files in the person's config folder. */
29
52
  export declare function picksPath(env?: NodeJS.ProcessEnv): string;
30
- /** What `gh` knows of the host. A `gh` that is not on this computer is "not installed"; one that cannot say is no account. */
31
- export declare function ghState(cwd: string, gh: GhRunner): Promise<GhState>;
32
53
  /**
33
- * The account runs use: the one picked, while `gh` still knows it; else the terminal's, kept as
34
- * the pick from now on, so a later switch in the terminal leaves the runs where they were.
54
+ * Whether `gh` is on this computer, and OpenAgent's accounts with whether GitHub still takes each.
55
+ * A `gh` that is not on this computer is "not installed".
35
56
  */
57
+ export declare function ghState(root: string, cwd: string, gh: GhRunner): Promise<GhState>;
58
+ /** The account runs use: the one picked, while OpenAgent still has it; else the first, kept as the pick from now on. */
36
59
  export declare function runsAccount(accounts: readonly GhAccount[], path?: string): string | undefined;
37
- /** Runs use `login` from now on: an account `gh` knows. */
60
+ /**
61
+ * The account runs use and its folder, read off the files alone, asking GitHub nothing: for
62
+ * OpenAgent's own copy of its login to a server. None when OpenAgent has no account.
63
+ */
64
+ export declare function runsAccountDir(env?: NodeJS.ProcessEnv): {
65
+ login: string;
66
+ dir: string;
67
+ } | undefined;
68
+ /** Runs use `login` from now on: an account OpenAgent has. */
38
69
  export declare function useForRuns(login: string, accounts: readonly GhAccount[], path?: string): void;
39
70
  /**
40
71
  * How `gh` is put on this computer with no admin: with Homebrew where it is, else GitHub's own
@@ -77,19 +108,30 @@ export interface LoggingIn {
77
108
  /** The login under way, while its `gh` is still waiting for the browser's yes. */
78
109
  export declare function loginUnderWay(files?: JobFiles): LoggingIn | undefined;
79
110
  /**
80
- * Log an account in to `gh` in the browser: GitHub's device login, whose code the person types at
81
- * github.com/login/device, wherever they are. `gh` makes the new account the terminal's, so once
82
- * the browser said yes, the terminal's account before it is made the terminal's again: logging an
83
- * account in for runs leaves the terminal as it was. Git is given a name then when it has none
84
- * ({@link NAMED}). Answers once `gh` showed the code; `gh` waits on, in a process of its own, for
85
- * the yes.
111
+ * Log an account in, in the browser: GitHub's device login, whose code the person types at
112
+ * github.com/login/device, wherever they are. The login goes into a folder of its own, its token
113
+ * kept there and not in the keychain the person's `gh` uses, so the person's own logins stay as
114
+ * they are. Answers once `gh` showed the code; `gh` waits on, in a process of its own, for the
115
+ * yes; {@link settleAdded} then names the folder by the account.
86
116
  */
87
- export declare function startLogin(terminal: string | undefined, files?: JobFiles, waitMs?: number): Promise<LoggingIn>;
117
+ export declare function startLogin(root: string, files?: JobFiles, waitMs?: number): Promise<LoggingIn>;
118
+ /** Keep a login handed over as a token as one of OpenAgent's accounts: its folder, its facts. */
119
+ export declare function takeToken(root: string, token: string, facts: AccountFacts, gh: GhRunner, cwd: string): Promise<void>;
120
+ /** OpenAgent forgets an account: its folder goes, and a runs' pick that named it. The token is not ended. */
121
+ export declare function forgetAccount(root: string, login: string, path?: string): void;
88
122
  /**
89
- * The environment a run gets to work as `login`: its token for `gh`, and the same token for git's
123
+ * The environment to work as an account: its folder for `gh`, its token for `gh` and for git's
90
124
  * pushes and fetches to GitHub, whatever the person's own git keeps for it (the keychain, a
91
- * different helper, an ssh key). Set through git's environment, so nothing of the person's own
92
- * settings changes. The settings already in the environment are kept.
125
+ * different helper, an ssh key), and its name on the commits. Set through git's environment, so
126
+ * nothing of the person's own settings changes. The settings already in the environment are kept.
127
+ */
128
+ /**
129
+ * The git settings that make git use the account in `dir` at GitHub, with no secret in them: an
130
+ * empty helper drops every helper set before it (the person's keychain among them), then gh,
131
+ * working in the account's folder only, answers git's ask for the login; a remote written for
132
+ * ssh goes over https, where that login is the one asked. What a repository OpenAgent sends as
133
+ * an account keeps in its own config.
93
134
  */
94
- export declare function runEnv(token: string, env?: NodeJS.ProcessEnv): Record<string, string>;
135
+ export declare function gitConfig(dir: string): [string, string][];
136
+ export declare function runEnv(token: string, dir: string, facts: AccountFacts | undefined, env?: NodeJS.ProcessEnv): Record<string, string>;
95
137
  //# sourceMappingURL=accounts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAErD;;;;;;;;GAQG;AAEH,yCAAyC;AACzC,eAAO,MAAM,IAAI,eAAe,CAAA;AAEhC,yCAAyC;AACzC,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAA;IACjB,sFAAsF;IACtF,EAAE,EAAE,OAAO,CAAA;CACZ;AAED,2FAA2F;AAC3F,MAAM,MAAM,OAAO,GAAG;IAAE,SAAS,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,SAAS,EAAE,CAAA;CAAE,CAAA;AAEvF,kGAAkG;AAClG,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAGtE;AA2BD,8HAA8H;AAC9H,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBzE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,GAAE,MAAoB,GAAG,MAAM,GAAG,SAAS,CAO1G;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,GAAE,MAAoB,GAAG,IAAI,CAI1G;AAUD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAyB,EAAE,IAAI,GAAE,MA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AsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,WAAoB,EAAE,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAmB7G;AAED,iGAAiG;AACjG,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAa1H;AAED,6GAA6G;AAC7G,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,MAAoB,GAAG,IAAI,CAO3F;AAUD;;;;;GAKG;AACH;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAQzD;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,SAAS,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBhJ"}
package/dist/accounts.js CHANGED
@@ -1,19 +1,104 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { chmodSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
3
3
  import { homedir, tmpdir } from 'node:os';
4
- import { dirname, join } from 'node:path';
4
+ import { dirname, join, relative, isAbsolute } from 'node:path';
5
5
  import { errorMessage } from './gh.js';
6
6
  /**
7
- * The GitHub accounts this computer's `gh` knows, and the one OpenAgent's runs use. The terminal's
8
- * `gh` keeps its own active account; runs use the account picked here, given to each run as its
9
- * own token, so switching one never moves the other. The pick is the account `gh` had active when
10
- * OpenAgent first looked, kept from then on, until it is picked again here.
7
+ * The GitHub accounts OpenAgent has, and the one its runs use. They are OpenAgent's own, never the
8
+ * person's: each account is a folder of its own, the folder `gh` keeps that account's login in
9
+ * (`GH_CONFIG_DIR`), so nothing OpenAgent does reads or changes the person's own `gh`, git or
10
+ * keychain. An account is added by logging it in here, in the browser, or by handing its token
11
+ * over (a server of the person's gets theirs that way).
11
12
  *
12
- * The pick is kept in a file of its own, logins only: `gh` keeps the logins' tokens, and a run's
13
- * is asked of it when the run starts (`gh auth token --user`).
13
+ * The runs' pick is kept in a file of its own, logins only.
14
14
  */
15
15
  /** The host this package answers for. */
16
16
  export const HOST = 'github.com';
17
+ /** A GitHub login, as GitHub allows one: also what keeps a folder's name inside the accounts' folder. */
18
+ const LOGIN = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/;
19
+ /** Where OpenAgent's accounts are: one folder each, beside OpenAgent's other files in the person's config folder. */
20
+ export function accountsRoot(env = process.env) {
21
+ if (env['XDG_CONFIG_HOME'])
22
+ return join(env['XDG_CONFIG_HOME'], 'openagent-github');
23
+ return join(env['HOME'] ?? homedir(), '.openagent-github');
24
+ }
25
+ /** The folder of one account: what `gh` is given as `GH_CONFIG_DIR` to work as it. */
26
+ export function accountDir(root, login) {
27
+ if (!LOGIN.test(login))
28
+ throw new Error(`${login} is no GitHub login`);
29
+ return join(root, login);
30
+ }
31
+ /** Where a browser login waits until GitHub said yes; then it becomes the account's folder. */
32
+ const ADDING = '.adding';
33
+ /** Whether `dir` is one of OpenAgent's account folders: a run is given one, and works as it. */
34
+ export function isAccountDir(root, dir) {
35
+ const rel = relative(root, dir);
36
+ return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel) && LOGIN.test(rel);
37
+ }
38
+ /** `gh` working as the account in `dir`: its folder, never the person's, and no token from the environment unless given. */
39
+ export function asAccount(gh, dir) {
40
+ return (args, cwd, env, input) => gh(args, cwd, { GH_TOKEN: '', GITHUB_TOKEN: '', ...env, GH_CONFIG_DIR: dir }, input);
41
+ }
42
+ /** The logins OpenAgent has, by name. */
43
+ export function accountLogins(root) {
44
+ let names;
45
+ try {
46
+ names = readdirSync(root);
47
+ }
48
+ catch {
49
+ return [];
50
+ }
51
+ return names.filter(name => LOGIN.test(name) && existsSync(join(root, name, 'hosts.yml'))).sort((a, b) => a.localeCompare(b));
52
+ }
53
+ export function readFacts(dir) {
54
+ try {
55
+ const facts = JSON.parse(readFileSync(join(dir, 'account.json'), 'utf8'));
56
+ if (typeof facts.login === 'string' && typeof facts.id === 'number')
57
+ return { login: facts.login, id: facts.id, ...(typeof facts.name === 'string' && facts.name ? { name: facts.name } : {}) };
58
+ }
59
+ catch {
60
+ // None kept: the account was added before its facts were.
61
+ }
62
+ return undefined;
63
+ }
64
+ function writeFile600(path, text) {
65
+ mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
66
+ const next = `${path}.${process.pid}.tmp`;
67
+ writeFileSync(next, text, { mode: 0o600 });
68
+ chmodSync(next, 0o600);
69
+ renameSync(next, path);
70
+ }
71
+ /** Who GitHub says the account `gh` works as is: its login, id and name. */
72
+ export async function whoAmI(gh, cwd) {
73
+ const said = (await gh(['api', '--hostname', HOST, 'user', '--jq', '[.login, (.id | tostring), (.name // "")] | @tsv'], cwd)).trim();
74
+ const [login = '', id = '', name = ''] = said.split('\t');
75
+ if (!LOGIN.test(login) || !/^\d+$/.test(id))
76
+ throw new Error(`GitHub said no account: ${said || 'nothing'}`);
77
+ return { login, id: Number(id), ...(name ? { name } : {}) };
78
+ }
79
+ /**
80
+ * A browser login that GitHub said yes to becomes an account: its folder is named by its login,
81
+ * an account of that name before it replaced. Nothing while the login is still waiting, or when
82
+ * none was started. Answers the login added.
83
+ */
84
+ export async function settleAdded(root, gh, cwd, files = jobFiles('login')) {
85
+ const adding = join(root, ADDING);
86
+ if (!existsSync(join(adding, 'hosts.yml')))
87
+ return undefined;
88
+ const state = jobState(files);
89
+ if (state?.running)
90
+ return undefined;
91
+ if (state && 'failed' in state && state.failed !== undefined) {
92
+ rmSync(adding, { recursive: true, force: true });
93
+ return undefined;
94
+ }
95
+ const facts = await whoAmI(asAccount(gh, adding), cwd);
96
+ const dir = accountDir(root, facts.login);
97
+ rmSync(dir, { recursive: true, force: true });
98
+ renameSync(adding, dir);
99
+ writeFile600(join(dir, 'account.json'), `${JSON.stringify(facts, null, 2)}\n`);
100
+ return facts.login;
101
+ }
17
102
  /** Where the runs' pick is kept: beside OpenAgent's other files in the person's config folder. */
18
103
  export function picksPath(env = process.env) {
19
104
  if (env['XDG_CONFIG_HOME'])
@@ -33,14 +118,13 @@ function readPicks(path) {
33
118
  return { runs: {} };
34
119
  }
35
120
  function writePicks(path, file) {
36
- mkdirSync(dirname(path), { recursive: true });
37
- const next = `${path}.${process.pid}.tmp`;
38
- writeFileSync(next, `${JSON.stringify(file, null, 2)}\n`, { mode: 0o600 });
39
- chmodSync(next, 0o600);
40
- renameSync(next, path);
121
+ writeFile600(path, `${JSON.stringify(file, null, 2)}\n`);
41
122
  }
42
- /** What `gh` knows of the host. A `gh` that is not on this computer is "not installed"; one that cannot say is no account. */
43
- export async function ghState(cwd, gh) {
123
+ /**
124
+ * Whether `gh` is on this computer, and OpenAgent's accounts with whether GitHub still takes each.
125
+ * A `gh` that is not on this computer is "not installed".
126
+ */
127
+ export async function ghState(root, cwd, gh) {
44
128
  try {
45
129
  await gh(['--version'], cwd);
46
130
  }
@@ -48,41 +132,37 @@ export async function ghState(cwd, gh) {
48
132
  if (/ENOENT|not found/i.test(errorMessage(err)))
49
133
  return { installed: false };
50
134
  }
51
- let said;
52
- try {
53
- said = JSON.parse(await gh(['auth', 'status', '--json', 'hosts', '--hostname', HOST], cwd));
54
- }
55
- catch {
56
- return { installed: true, accounts: [] };
57
- }
58
- const rows = said?.hosts?.[HOST];
59
135
  const accounts = [];
60
- for (const row of Array.isArray(rows) ? rows : []) {
61
- const r = row;
62
- if (typeof r['login'] !== 'string' || !r['login'])
63
- continue;
64
- accounts.push({ login: r['login'], terminal: r['active'] === true, ok: r['state'] === 'success' });
136
+ for (const login of accountLogins(root)) {
137
+ const ok = await asAccount(gh, join(root, login))(['auth', 'status', '--hostname', HOST], cwd).then(() => true, () => false);
138
+ accounts.push({ login, ok });
65
139
  }
66
140
  return { installed: true, accounts };
67
141
  }
68
- /**
69
- * The account runs use: the one picked, while `gh` still knows it; else the terminal's, kept as
70
- * the pick from now on, so a later switch in the terminal leaves the runs where they were.
71
- */
142
+ /** The account runs use: the one picked, while OpenAgent still has it; else the first, kept as the pick from now on. */
72
143
  export function runsAccount(accounts, path = picksPath()) {
73
144
  const picks = readPicks(path);
74
145
  const picked = picks.runs[HOST];
75
146
  if (picked !== undefined && accounts.some(a => a.login === picked))
76
147
  return picked;
77
- const terminal = accounts.find(a => a.terminal)?.login;
78
- if (terminal !== undefined)
79
- writePicks(path, { runs: { ...picks.runs, [HOST]: terminal } });
80
- return terminal;
148
+ const first = accounts[0]?.login;
149
+ if (first !== undefined)
150
+ writePicks(path, { runs: { ...picks.runs, [HOST]: first } });
151
+ return first;
152
+ }
153
+ /**
154
+ * The account runs use and its folder, read off the files alone, asking GitHub nothing: for
155
+ * OpenAgent's own copy of its login to a server. None when OpenAgent has no account.
156
+ */
157
+ export function runsAccountDir(env = process.env) {
158
+ const root = accountsRoot(env);
159
+ const login = runsAccount(accountLogins(root).map(name => ({ login: name, ok: true })), picksPath(env));
160
+ return login === undefined ? undefined : { login, dir: accountDir(root, login) };
81
161
  }
82
- /** Runs use `login` from now on: an account `gh` knows. */
162
+ /** Runs use `login` from now on: an account OpenAgent has. */
83
163
  export function useForRuns(login, accounts, path = picksPath()) {
84
164
  if (!accounts.some(a => a.login === login))
85
- throw new Error(`gh knows no account ${login} on ${HOST}: add it first`);
165
+ throw new Error(`OpenAgent has no GitHub account ${login}: add it in Permissions first`);
86
166
  const picks = readPicks(path);
87
167
  writePicks(path, { runs: { ...picks.runs, [HOST]: login } });
88
168
  }
@@ -183,37 +263,21 @@ export function loginUnderWay(files = jobFiles('login')) {
183
263
  return state?.running ? codeIn(state.said) : undefined;
184
264
  }
185
265
  /**
186
- * Once logged in, give git the name and email of the terminal's account, when it has none: git
187
- * makes no commit without them, and a user a shared computer made for a person starts with none.
188
- * Only what git lacks is given. The email is GitHub's own address for the account, which hides the
189
- * person's own. The login stands whether or not git could be given them.
266
+ * Log an account in, in the browser: GitHub's device login, whose code the person types at
267
+ * github.com/login/device, wherever they are. The login goes into a folder of its own, its token
268
+ * kept there and not in the keychain the person's `gh` uses, so the person's own logins stay as
269
+ * they are. Answers once `gh` showed the code; `gh` waits on, in a process of its own, for the
270
+ * yes; {@link settleAdded} then names the folder by the account.
190
271
  */
191
- const NAMED = `{
192
- has() { [ -n "$(cd / && git config --get "$1")" ]; }
193
- if ! has user.name || ! has user.email; then
194
- facts=$(gh api --hostname ${HOST} user --jq '[.login, (.id | tostring), (.name // "")] | @tsv') &&
195
- login=$(printf '%s' "$facts" | cut -f1) && id=$(printf '%s' "$facts" | cut -f2) && name=$(printf '%s' "$facts" | cut -f3) &&
196
- [ -n "$login" ] && [ -n "$id" ] && {
197
- has user.name || git config --global -- user.name "\${name:-$login}"
198
- has user.email || git config --global -- user.email "$id+$login@users.noreply.github.com"
199
- }
200
- fi
201
- true
202
- }`;
203
- /**
204
- * Log an account in to `gh` in the browser: GitHub's device login, whose code the person types at
205
- * github.com/login/device, wherever they are. `gh` makes the new account the terminal's, so once
206
- * the browser said yes, the terminal's account before it is made the terminal's again: logging an
207
- * account in for runs leaves the terminal as it was. Git is given a name then when it has none
208
- * ({@link NAMED}). Answers once `gh` showed the code; `gh` waits on, in a process of its own, for
209
- * the yes.
210
- */
211
- export async function startLogin(terminal, files = jobFiles('login'), waitMs = 20_000) {
272
+ export async function startLogin(root, files = jobFiles('login'), waitMs = 20_000) {
212
273
  const under = loginUnderWay(files);
213
274
  if (under)
214
275
  return under;
215
- const back = terminal !== undefined ? ` && gh auth switch --hostname ${HOST} --user "$1"` : '';
216
- await startJob(files, `gh auth login --hostname ${HOST} --git-protocol https --web${back} && ${NAMED}`, terminal !== undefined ? [terminal] : []);
276
+ const adding = join(root, ADDING);
277
+ rmSync(adding, { recursive: true, force: true });
278
+ mkdirSync(adding, { recursive: true, mode: 0o700 });
279
+ chmodSync(root, 0o700);
280
+ await startJob(files, `env -u GH_TOKEN -u GITHUB_TOKEN GH_CONFIG_DIR="$1" gh auth login --hostname ${HOST} --web --insecure-storage --skip-ssh-key`, [adding]);
217
281
  const until = Date.now() + waitMs;
218
282
  for (;;) {
219
283
  const state = jobState(files);
@@ -228,6 +292,31 @@ export async function startLogin(terminal, files = jobFiles('login'), waitMs = 2
228
292
  await new Promise(resolve => setTimeout(resolve, 200));
229
293
  }
230
294
  }
295
+ /** Keep a login handed over as a token as one of OpenAgent's accounts: its folder, its facts. */
296
+ export async function takeToken(root, token, facts, gh, cwd) {
297
+ const dir = accountDir(root, facts.login);
298
+ const next = join(root, `.taking-${process.pid}`);
299
+ rmSync(next, { recursive: true, force: true });
300
+ mkdirSync(next, { recursive: true, mode: 0o700 });
301
+ try {
302
+ await asAccount(gh, next)(['auth', 'login', '--hostname', HOST, '--with-token', '--insecure-storage'], cwd, undefined, token);
303
+ writeFile600(join(next, 'account.json'), `${JSON.stringify(facts, null, 2)}\n`);
304
+ rmSync(dir, { recursive: true, force: true });
305
+ renameSync(next, dir);
306
+ }
307
+ finally {
308
+ rmSync(next, { recursive: true, force: true });
309
+ }
310
+ }
311
+ /** OpenAgent forgets an account: its folder goes, and a runs' pick that named it. The token is not ended. */
312
+ export function forgetAccount(root, login, path = picksPath()) {
313
+ rmSync(accountDir(root, login), { recursive: true, force: true });
314
+ const picks = readPicks(path);
315
+ if (picks.runs[HOST] === login) {
316
+ const { [HOST]: _gone, ...rest } = picks.runs;
317
+ writePicks(path, { runs: rest });
318
+ }
319
+ }
231
320
  function stopJob(files) {
232
321
  try {
233
322
  process.kill(-Number(readFileSync(files.pid, 'utf8').trim()), 'SIGTERM');
@@ -237,12 +326,28 @@ function stopJob(files) {
237
326
  }
238
327
  }
239
328
  /**
240
- * The environment a run gets to work as `login`: its token for `gh`, and the same token for git's
329
+ * The environment to work as an account: its folder for `gh`, its token for `gh` and for git's
241
330
  * pushes and fetches to GitHub, whatever the person's own git keeps for it (the keychain, a
242
- * different helper, an ssh key). Set through git's environment, so nothing of the person's own
243
- * settings changes. The settings already in the environment are kept.
331
+ * different helper, an ssh key), and its name on the commits. Set through git's environment, so
332
+ * nothing of the person's own settings changes. The settings already in the environment are kept.
333
+ */
334
+ /**
335
+ * The git settings that make git use the account in `dir` at GitHub, with no secret in them: an
336
+ * empty helper drops every helper set before it (the person's keychain among them), then gh,
337
+ * working in the account's folder only, answers git's ask for the login; a remote written for
338
+ * ssh goes over https, where that login is the one asked. What a repository OpenAgent sends as
339
+ * an account keeps in its own config.
244
340
  */
245
- export function runEnv(token, env = process.env) {
341
+ export function gitConfig(dir) {
342
+ const quoted = `'${dir.replace(/'/g, `'\\''`)}'`;
343
+ return [
344
+ [`credential.https://${HOST}.helper`, ''],
345
+ [`credential.https://${HOST}.helper`, `!f() { test "$1" = get || exit 0; GH_TOKEN= GITHUB_TOKEN= GH_CONFIG_DIR=${quoted} gh auth git-credential get; }; f`],
346
+ [`url.https://${HOST}/.insteadOf`, `git@${HOST}:`],
347
+ [`url.https://${HOST}/.insteadOf`, `ssh://git@${HOST}/`],
348
+ ];
349
+ }
350
+ export function runEnv(token, dir, facts, env = process.env) {
246
351
  const given = Number(env['GIT_CONFIG_COUNT'] ?? 0) || 0;
247
352
  const lines = [
248
353
  // An empty helper drops every helper set before it; then one that answers with the token.
@@ -252,11 +357,17 @@ export function runEnv(token, env = process.env) {
252
357
  [`url.https://${HOST}/.insteadOf`, `git@${HOST}:`],
253
358
  [`url.https://${HOST}/.insteadOf`, `ssh://git@${HOST}/`],
254
359
  ];
255
- const out = { GH_TOKEN: token, GIT_CONFIG_COUNT: String(given + lines.length) };
360
+ const out = { GH_CONFIG_DIR: dir, GH_TOKEN: token, GIT_CONFIG_COUNT: String(given + lines.length) };
256
361
  lines.forEach(([key, value], i) => {
257
362
  out[`GIT_CONFIG_KEY_${given + i}`] = key;
258
363
  out[`GIT_CONFIG_VALUE_${given + i}`] = value;
259
364
  });
365
+ if (facts) {
366
+ // The commits are the account's: its name, and GitHub's own address for it, which hides the person's own.
367
+ const name = facts.name ?? facts.login;
368
+ const email = `${facts.id}+${facts.login}@users.noreply.github.com`;
369
+ Object.assign(out, { GIT_AUTHOR_NAME: name, GIT_AUTHOR_EMAIL: email, GIT_COMMITTER_NAME: name, GIT_COMMITTER_EMAIL: email });
370
+ }
260
371
  return out;
261
372
  }
262
373
  //# sourceMappingURL=accounts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,YAAY,EAAiB,MAAM,SAAS,CAAA;AAErD;;;;;;;;GAQG;AAEH,yCAAyC;AACzC,MAAM,CAAC,MAAM,IAAI,GAAG,YAAY,CAAA;AAchC,kGAAkG;AAClG,MAAM,UAAU,SAAS,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAC5D,IAAI,GAAG,CAAC,iBAAiB,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,uBAAuB,CAAC,CAAA;IACxF,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,OAAO,EAAE,EAAE,wBAAwB,CAAC,CAAA;AACjE,CAAC;AAOD,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,CAA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mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAA;IAC9H,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type GitRunner } from '@openagt/agent-data';
2
2
  import { type GhRunner } from './gh.js';
3
+ import { type ProfileFetch } from './profile.js';
3
4
  import { type JobState, type LoggingIn } from './accounts.js';
4
5
  /**
5
6
  * The command line over the package (#1820): the same functions for an agent in a shell, and for
@@ -14,8 +15,12 @@ import { type JobState, type LoggingIn } from './accounts.js';
14
15
  *
15
16
  * Every command acts on the repository the working directory is in: `gh` finds the repository
16
17
  * and its remote from there, as it does for a person.
18
+ *
19
+ * The commands that talk to GitHub work as one of OpenAgent's own accounts, never as the
20
+ * person's `gh`: inside a run, the account the run was given; elsewhere, the account runs use.
21
+ * With none, they are refused, and say where one is added.
17
22
  */
18
- export declare const USAGE = "usage: github <command>\n\n requests [--branch <b>] [--state open|merged|all] [--since <iso>]\n the project's pull requests, newest first: number, url, state, title, draft, branch, head, createdAt, mergedAt, mergeCommit\n replies [--since <iso>] what came on the open issues and pull requests this machine's agents worked on, since each agent ended: maintainers' words\n that call the agent with /agent, and on an agent's own pull request checks that turned red and a conflict once the base branch moved;\n [{ run, text }], one per run, read from the project's run records; with --since, also [{ for, text, branch? }] for each open issue or\n pull request no run was on, where a maintainer called the agent since then: the check of a scheduler's row with each\n comment <number> --body <text>\n post a comment on issue or pull request <number>: its id and url. It opens with the coding agent's logo, the model and the effort, as the agent's\n run record says (found through AGENT_DIARY, which its runner sets), else the line \uD83E\uDD16 automated; a hidden mark after the text, so replies never counts it\n open [--branch <b>] --title <t> [--body <text>] [--draft] [--merge]\n open the pull request of branch <b> (default: the current branch; it must be on the remote already); an open one is answered as it is; --merge lands it on green.\n An account that cannot write to the project pushes to its fork: git remote set-url --push origin <fork>; open and replies then take that fork's\n pull requests as this machine's\n merge <number> land pull request <number>: a draft is marked ready, then the merge is armed as --merge arms it\n watch <number> wait for pull request <number>'s checks and merge it once they pass; what --merge starts where the repository has no auto-merge\n home the project's page on GitHub, from its origin remote\n me who is signed in to GitHub through gh: login, name, avatar (a picture's https address)\n people <email>... the GitHub accounts behind the project's commit emails: [{ email, login, avatar }], one per email a commit of the\n repository's is signed with by an account (at most 20 asked at once); an email no account's commit carries is left out\n accounts [--host <host>] the GitHub accounts this computer's gh knows and the one OpenAgent's runs use: { host, name, requestWord, logo, tool, installed,\n install, accounts: [{ login, terminal, runs, ok }], loggingIn? }; a host other than github.com is refused (not-mine)\n use <login> OpenAgent's runs use <login> from now on, an account gh knows; the terminal's gh stays on its own\n login log another account in to gh in the browser: { code, url }, the code typed at url; gh waits on for the yes, then the terminal's\n account is made the terminal's again\n install put gh on this computer with no admin: Homebrew where it is, else GitHub's build into ~/.local/bin; answers once it\n started, and accounts says installing until it ended, then installFailed if it did\n env [--user <login>] the environment a run gets to work as <login> (default: the account runs use): { env }, its token for gh and for git\n token --user <login> <login>'s token as gh keeps it, checked with GitHub to be that account's: { login, token }; what OpenAgent copies to a\n server of the person's, which then uses the same login, never a new one\n take log in to gh with the token on standard input, beside the accounts gh knows: { login }\n forget <login> gh forgets <login> on this computer; the token is not ended, and goes on working wherever else it is\n create [--check] create a private repository for a project with no origin, named <account>/<folder>, set it as origin and push;\n --check only says which repository that would be\n\nJSON on stdout. Exit code 1 for a refusal or a failure (the reason on stderr), 2 for a usage error.";
23
+ export declare const USAGE = "usage: github <command>\n\n requests [--branch <b>] [--state open|merged|all] [--since <iso>]\n the project's pull requests, newest first: number, url, state, title, draft, branch, head, createdAt, mergedAt, mergeCommit\n replies [--since <iso>] what came on the open issues and pull requests this machine's agents worked on, since each agent ended: maintainers' words\n that call the agent with /agent, and on an agent's own pull request checks that turned red and a conflict once the base branch moved;\n [{ run, text }], one per run, read from the project's run records; with --since, also [{ for, text, branch? }] for each open issue or\n pull request no run was on, where a maintainer called the agent since then: the check of a scheduler's row with each\n comment <number> --body <text>\n post a comment on issue or pull request <number>: its id and url. It opens with the coding agent's logo, the model and the effort, as the agent's\n run record says (found through AGENT_DIARY, which its runner sets), else the line \uD83E\uDD16 automated; a hidden mark after the text, so replies never counts it\n open [--branch <b>] --title <t> [--body <text>] [--base <b>] [--draft] [--merge]\n open the pull request of branch <b> (default: the current branch; it must be on the remote already); an open one is answered as it is; --base names the branch it\n goes into (default: the repository's default branch); --merge lands it on green.\n An account that cannot write to the project pushes to its fork: git remote set-url --push origin <fork>; open and replies then take that fork's\n pull requests as this machine's\n merge <number> land pull request <number>: a draft is marked ready, then the merge is armed as --merge arms it\n watch <number> wait for pull request <number>'s checks and merge it once they pass; what --merge starts where the repository has no auto-merge\n home the project's page on GitHub, from its origin remote\n profile <login> a GitHub user's public profile, read with no login: { login, name, avatar } (a picture's https address); what a person copies\n into OpenAgent as their own name and picture\n repos [--user <login>] [--owner <name>]\n the repositories of <name>, a GitHub user or organization (default: the account itself), as the account <login> (default:\n the account runs use) sees them, its private ones too: { login, owner, repos: [{ address, url, private, pushedAt, description }] },\n the newest pushed first, at most 300\n people <email>... the GitHub accounts behind the project's commit emails: [{ email, login, avatar }], one per email a commit of the\n repository's is signed with by an account, or that is GitHub's own address for one (at most 20 asked at once); any other email is left out\n accounts [--host <host>] OpenAgent's own GitHub accounts and the one its runs use: { host, name, requestWord, logo, tool, installed,\n install, accounts: [{ login, runs, ok }], loggingIn? }; a host other than github.com is refused (not-mine)\n use <login> OpenAgent's runs use <login> from now on, one of its accounts\n login add an account to OpenAgent, logged in in the browser: { code, url }, the code typed at url; gh waits on for the yes.\n The account is OpenAgent's own: the person's gh, git and keychain stay as they are\n install put gh on this computer with no admin: Homebrew where it is, else GitHub's build into ~/.local/bin; answers once it\n started, and accounts says installing until it ended, then installFailed if it did\n env [--user <login>] the environment a run gets to work as <login> (default: the account runs use): { env }, its gh folder, its token for gh and\n for git, its name on commits; refused (no-account) when OpenAgent has no account\n git-config [--user <login>] the git settings that make git push and fetch as <login> (default: the account runs use), asking gh for its login when git needs it:\n { login, host, config: [[key, value]] }; no secret in them, so they may be kept in a repository's own config\n token --user <login> <login>'s token as OpenAgent keeps it, checked with GitHub to be that account's: { login, token }; what OpenAgent copies to a\n server of the person's, which then uses the same login, never a new one\n take add the login whose token is on standard input as one of OpenAgent's accounts: { login }\n forget <login> OpenAgent forgets <login>; the token is not ended, and goes on working wherever else it is\n create [--check] create a private repository for a project with no origin, named <account>/<folder>, set it as origin and push;\n --check only says which repository that would be\n\nJSON on stdout. Exit code 1 for a refusal or a failure (the reason on stderr), 2 for a usage error.";
19
24
  /** The streams and the working directory a run of the CLI sees. */
20
25
  export interface CliIo {
21
26
  cwd: string;
@@ -36,12 +41,14 @@ export interface CliDeps {
36
41
  shell?: (command: string) => Promise<void>;
37
42
  /** How the install started last went; the default reads it off its files. */
38
43
  installing?: () => JobState | undefined;
39
- /** Start a browser login, the terminal's account given back after; the default runs gh. */
40
- login?: (terminal: string | undefined) => Promise<LoggingIn>;
44
+ /** Start a browser login into OpenAgent's accounts' folder; the default runs gh. */
45
+ login?: (root: string) => Promise<LoggingIn>;
41
46
  /** The browser login under way; the default reads it off its files. */
42
47
  underWay?: () => LoggingIn | undefined;
43
48
  /** What the command was handed on standard input; the default reads the process's. */
44
49
  stdin?: () => Promise<string>;
50
+ /** What reads a public profile from GitHub; the default is `fetch`. */
51
+ fetch?: ProfileFetch;
45
52
  }
46
53
  /** A refusal: a rule said no, and the caller learns which. */
47
54
  export type CliRefusal = {