agor-live 0.7.10 → 0.7.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/dist/core/git/index.cjs +9 -0
- package/dist/core/git/index.d.cts +21 -0
- package/dist/core/git/index.d.ts +21 -0
- package/dist/core/git/index.js +9 -0
- package/dist/core/index.cjs +9 -0
- package/dist/core/index.js +9 -0
- package/dist/core/seed/index.cjs +9 -0
- package/dist/core/seed/index.js +9 -0
- package/package.json +1 -1
package/dist/core/git/index.cjs
CHANGED
|
@@ -68,6 +68,15 @@ function createGit(baseDir, env) {
|
|
|
68
68
|
const config = [
|
|
69
69
|
"core.sshCommand=ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
|
70
70
|
];
|
|
71
|
+
if (env?.GITHUB_TOKEN) {
|
|
72
|
+
const token = env.GITHUB_TOKEN;
|
|
73
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
74
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
75
|
+
} else if (env?.GH_TOKEN) {
|
|
76
|
+
const token = env.GH_TOKEN;
|
|
77
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
78
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
79
|
+
}
|
|
71
80
|
const git = (0, import_simple_git.simpleGit)({
|
|
72
81
|
baseDir,
|
|
73
82
|
binary: gitBinary,
|
|
@@ -4,6 +4,27 @@ export { simpleGit } from 'simple-git';
|
|
|
4
4
|
* Git Utils for Agor
|
|
5
5
|
*
|
|
6
6
|
* Provides Git operations for repo management and worktree isolation
|
|
7
|
+
*
|
|
8
|
+
* ## Authentication Strategy
|
|
9
|
+
*
|
|
10
|
+
* Git operations (clone, fetch, etc.) require authentication for private repositories.
|
|
11
|
+
* This module supports multiple authentication methods:
|
|
12
|
+
*
|
|
13
|
+
* 1. **SSH Keys** - Traditional SSH key-based auth (works automatically if keys are mounted)
|
|
14
|
+
* 2. **User Environment Variables** - Per-user GITHUB_TOKEN or GH_TOKEN from Agor user settings
|
|
15
|
+
* 3. **System Credential Helpers** - Existing git credential helpers (e.g., gh auth, git-credential-store)
|
|
16
|
+
*
|
|
17
|
+
* ### How User Environment Variables Work
|
|
18
|
+
*
|
|
19
|
+
* When a user configures GITHUB_TOKEN in their Agor user settings:
|
|
20
|
+
* 1. The token is encrypted and stored in the database
|
|
21
|
+
* 2. During git operations, we decrypt and pass it via the `env` parameter
|
|
22
|
+
* 3. We configure a **Git credential helper** (via `-c credential.helper=...`) that provides the token
|
|
23
|
+
* 4. When Git needs credentials for HTTPS operations, it calls our helper function
|
|
24
|
+
* 5. The helper outputs `username=x-access-token\npassword=TOKEN` in the format Git expects
|
|
25
|
+
*
|
|
26
|
+
* This approach mirrors how `gh auth` works - it's clean, secure, and doesn't pollute URLs with tokens.
|
|
27
|
+
* The credential helper is **ephemeral** and **scoped to the specific git command**, not system-wide.
|
|
7
28
|
*/
|
|
8
29
|
|
|
9
30
|
interface CloneOptions {
|
package/dist/core/git/index.d.ts
CHANGED
|
@@ -4,6 +4,27 @@ export { simpleGit } from 'simple-git';
|
|
|
4
4
|
* Git Utils for Agor
|
|
5
5
|
*
|
|
6
6
|
* Provides Git operations for repo management and worktree isolation
|
|
7
|
+
*
|
|
8
|
+
* ## Authentication Strategy
|
|
9
|
+
*
|
|
10
|
+
* Git operations (clone, fetch, etc.) require authentication for private repositories.
|
|
11
|
+
* This module supports multiple authentication methods:
|
|
12
|
+
*
|
|
13
|
+
* 1. **SSH Keys** - Traditional SSH key-based auth (works automatically if keys are mounted)
|
|
14
|
+
* 2. **User Environment Variables** - Per-user GITHUB_TOKEN or GH_TOKEN from Agor user settings
|
|
15
|
+
* 3. **System Credential Helpers** - Existing git credential helpers (e.g., gh auth, git-credential-store)
|
|
16
|
+
*
|
|
17
|
+
* ### How User Environment Variables Work
|
|
18
|
+
*
|
|
19
|
+
* When a user configures GITHUB_TOKEN in their Agor user settings:
|
|
20
|
+
* 1. The token is encrypted and stored in the database
|
|
21
|
+
* 2. During git operations, we decrypt and pass it via the `env` parameter
|
|
22
|
+
* 3. We configure a **Git credential helper** (via `-c credential.helper=...`) that provides the token
|
|
23
|
+
* 4. When Git needs credentials for HTTPS operations, it calls our helper function
|
|
24
|
+
* 5. The helper outputs `username=x-access-token\npassword=TOKEN` in the format Git expects
|
|
25
|
+
*
|
|
26
|
+
* This approach mirrors how `gh auth` works - it's clean, secure, and doesn't pollute URLs with tokens.
|
|
27
|
+
* The credential helper is **ephemeral** and **scoped to the specific git command**, not system-wide.
|
|
7
28
|
*/
|
|
8
29
|
|
|
9
30
|
interface CloneOptions {
|
package/dist/core/git/index.js
CHANGED
|
@@ -25,6 +25,15 @@ function createGit(baseDir, env) {
|
|
|
25
25
|
const config = [
|
|
26
26
|
"core.sshCommand=ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
|
27
27
|
];
|
|
28
|
+
if (env?.GITHUB_TOKEN) {
|
|
29
|
+
const token = env.GITHUB_TOKEN;
|
|
30
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
31
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
32
|
+
} else if (env?.GH_TOKEN) {
|
|
33
|
+
const token = env.GH_TOKEN;
|
|
34
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
35
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
36
|
+
}
|
|
28
37
|
const git = simpleGit({
|
|
29
38
|
baseDir,
|
|
30
39
|
binary: gitBinary,
|
package/dist/core/index.cjs
CHANGED
|
@@ -4685,6 +4685,15 @@ function createGit(baseDir, env) {
|
|
|
4685
4685
|
const config = [
|
|
4686
4686
|
"core.sshCommand=ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
|
4687
4687
|
];
|
|
4688
|
+
if (env?.GITHUB_TOKEN) {
|
|
4689
|
+
const token = env.GITHUB_TOKEN;
|
|
4690
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
4691
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
4692
|
+
} else if (env?.GH_TOKEN) {
|
|
4693
|
+
const token = env.GH_TOKEN;
|
|
4694
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
4695
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
4696
|
+
}
|
|
4688
4697
|
const git = (0, import_simple_git.simpleGit)({
|
|
4689
4698
|
baseDir,
|
|
4690
4699
|
binary: gitBinary,
|
package/dist/core/index.js
CHANGED
|
@@ -4521,6 +4521,15 @@ function createGit(baseDir, env) {
|
|
|
4521
4521
|
const config = [
|
|
4522
4522
|
"core.sshCommand=ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
|
4523
4523
|
];
|
|
4524
|
+
if (env?.GITHUB_TOKEN) {
|
|
4525
|
+
const token = env.GITHUB_TOKEN;
|
|
4526
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
4527
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
4528
|
+
} else if (env?.GH_TOKEN) {
|
|
4529
|
+
const token = env.GH_TOKEN;
|
|
4530
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
4531
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
4532
|
+
}
|
|
4524
4533
|
const git = simpleGit({
|
|
4525
4534
|
baseDir,
|
|
4526
4535
|
binary: gitBinary,
|
package/dist/core/seed/index.cjs
CHANGED
|
@@ -1460,6 +1460,15 @@ function createGit(baseDir, env) {
|
|
|
1460
1460
|
const config = [
|
|
1461
1461
|
"core.sshCommand=ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
|
1462
1462
|
];
|
|
1463
|
+
if (env?.GITHUB_TOKEN) {
|
|
1464
|
+
const token = env.GITHUB_TOKEN;
|
|
1465
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
1466
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
1467
|
+
} else if (env?.GH_TOKEN) {
|
|
1468
|
+
const token = env.GH_TOKEN;
|
|
1469
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
1470
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
1471
|
+
}
|
|
1463
1472
|
const git = (0, import_simple_git.simpleGit)({
|
|
1464
1473
|
baseDir,
|
|
1465
1474
|
binary: gitBinary,
|
package/dist/core/seed/index.js
CHANGED
|
@@ -1433,6 +1433,15 @@ function createGit(baseDir, env) {
|
|
|
1433
1433
|
const config = [
|
|
1434
1434
|
"core.sshCommand=ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
|
1435
1435
|
];
|
|
1436
|
+
if (env?.GITHUB_TOKEN) {
|
|
1437
|
+
const token = env.GITHUB_TOKEN;
|
|
1438
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
1439
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
1440
|
+
} else if (env?.GH_TOKEN) {
|
|
1441
|
+
const token = env.GH_TOKEN;
|
|
1442
|
+
const credentialHelper = `!f() { echo "username=x-access-token"; echo "password=${token}"; }; f`;
|
|
1443
|
+
config.push(`credential.helper=${credentialHelper}`);
|
|
1444
|
+
}
|
|
1436
1445
|
const git = simpleGit({
|
|
1437
1446
|
baseDir,
|
|
1438
1447
|
binary: gitBinary,
|