@myagentroam/node 0.9.66 → 0.9.67
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.
|
@@ -54,10 +54,24 @@ async function credential(operation) {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
async function invoke(args) {
|
|
57
|
+
const cwd = gitWorkingDirectory(args);
|
|
57
58
|
const remote = await currentRemote(args);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const managedSshCommand = process.env.MAR_GIT_SSH_COMMAND;
|
|
60
|
+
const requestedSshCommand = process.env.GIT_SSH_COMMAND;
|
|
61
|
+
const invocationSshCommand = gitCommandLineConfig(args, 'core.sshCommand');
|
|
62
|
+
const originalSshCommand = managedSshCommand !== undefined && requestedSshCommand === managedSshCommand
|
|
63
|
+
? (await originalGitEnvironment()).GIT_SSH_COMMAND
|
|
64
|
+
: undefined;
|
|
65
|
+
const fallbackSshCommand = managedSshCommand !== undefined &&
|
|
66
|
+
requestedSshCommand !== undefined &&
|
|
67
|
+
requestedSshCommand !== managedSshCommand
|
|
68
|
+
? requestedSshCommand
|
|
69
|
+
: managedSshCommand === undefined
|
|
70
|
+
? undefined
|
|
71
|
+
: (originalSshCommand ??
|
|
72
|
+
(invocationSshCommand.found
|
|
73
|
+
? invocationSshCommand.value
|
|
74
|
+
: await gitOutput(['config', '--get', 'core.sshCommand'], cwd)));
|
|
61
75
|
const matched = remote === undefined ? { matched: false } : await gitCredentialRequest('/identity', { remote });
|
|
62
76
|
const identity = matched.matched === true &&
|
|
63
77
|
typeof matched.name === 'string' &&
|
|
@@ -65,24 +79,65 @@ async function invoke(args) {
|
|
|
65
79
|
!/[\r\n\0]/u.test(matched.name + matched.email)
|
|
66
80
|
? { name: matched.name, email: matched.email }
|
|
67
81
|
: undefined;
|
|
68
|
-
const environment =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
const environment = {
|
|
83
|
+
...process.env,
|
|
84
|
+
...(managedSshCommand === undefined
|
|
85
|
+
? {}
|
|
86
|
+
: { GIT_SSH_COMMAND: managedSshCommand, GIT_SSH_VARIANT: 'ssh' }),
|
|
87
|
+
...(fallbackSshCommand === undefined
|
|
88
|
+
? {}
|
|
89
|
+
: { MAR_GIT_ORIGINAL_SSH_COMMAND: fallbackSshCommand }),
|
|
90
|
+
...(identity === undefined
|
|
91
|
+
? {}
|
|
92
|
+
: {
|
|
93
|
+
GIT_AUTHOR_NAME: identity.name,
|
|
94
|
+
GIT_COMMITTER_NAME: identity.name,
|
|
95
|
+
GIT_AUTHOR_EMAIL: identity.email,
|
|
96
|
+
GIT_COMMITTER_EMAIL: identity.email
|
|
97
|
+
})
|
|
98
|
+
};
|
|
82
99
|
return run(gitExecutable(), identity === undefined
|
|
83
100
|
? args
|
|
84
101
|
: ['-c', `user.name=${identity.name}`, '-c', `user.email=${identity.email}`, ...args], { environment });
|
|
85
102
|
}
|
|
103
|
+
function gitCommandLineConfig(args, requestedName) {
|
|
104
|
+
let result = { found: false };
|
|
105
|
+
for (let index = 0; index < args.length; index++) {
|
|
106
|
+
const argument = args[index];
|
|
107
|
+
if (argument === '--')
|
|
108
|
+
break;
|
|
109
|
+
if (!argument.startsWith('-'))
|
|
110
|
+
break;
|
|
111
|
+
let assignment;
|
|
112
|
+
if (argument === '-c')
|
|
113
|
+
assignment = args[++index];
|
|
114
|
+
else if (argument.startsWith('-c') && argument.length > 2)
|
|
115
|
+
assignment = argument.slice(2);
|
|
116
|
+
else if (argument === '--config-env') {
|
|
117
|
+
const reference = args[++index];
|
|
118
|
+
if (reference !== undefined)
|
|
119
|
+
assignment = configEnvironmentAssignment(reference);
|
|
120
|
+
}
|
|
121
|
+
else if (argument.startsWith('--config-env='))
|
|
122
|
+
assignment = configEnvironmentAssignment(argument.slice('--config-env='.length));
|
|
123
|
+
else if (['-C', '--git-dir', '--work-tree', '--namespace', '--super-prefix'].includes(argument))
|
|
124
|
+
index++;
|
|
125
|
+
if (assignment === undefined)
|
|
126
|
+
continue;
|
|
127
|
+
const equals = assignment.indexOf('=');
|
|
128
|
+
if (equals < 1 || assignment.slice(0, equals).toLowerCase() !== requestedName.toLowerCase())
|
|
129
|
+
continue;
|
|
130
|
+
result = { found: true, value: assignment.slice(equals + 1) };
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
function configEnvironmentAssignment(reference) {
|
|
135
|
+
const equals = reference.indexOf('=');
|
|
136
|
+
if (equals < 1)
|
|
137
|
+
return undefined;
|
|
138
|
+
const value = process.env[reference.slice(equals + 1)];
|
|
139
|
+
return value === undefined ? undefined : `${reference.slice(0, equals)}=${value}`;
|
|
140
|
+
}
|
|
86
141
|
async function currentRemote(args) {
|
|
87
142
|
const cwd = gitWorkingDirectory(args);
|
|
88
143
|
const branch = await gitOutput(['branch', '--show-current'], cwd);
|
|
@@ -68,8 +68,10 @@ export class GitExecutionService {
|
|
|
68
68
|
environment[`GIT_CONFIG_VALUE_${count + index}`] = value;
|
|
69
69
|
}
|
|
70
70
|
if (parsed.data.credentials.some((entry) => entry.protocol === 'SSH')) {
|
|
71
|
-
|
|
71
|
+
const sshCommand = `${helperCommand('git-execution-helper')} ssh`;
|
|
72
|
+
environment.GIT_SSH_COMMAND = sshCommand;
|
|
72
73
|
environment.GIT_SSH_VARIANT = 'ssh';
|
|
74
|
+
environment.MAR_GIT_SSH_COMMAND = sshCommand;
|
|
73
75
|
}
|
|
74
76
|
const pathKey = process.platform === 'win32' && original.Path !== undefined ? 'Path' : 'PATH';
|
|
75
77
|
environment[pathKey] =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myagentroam/node",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.67",
|
|
4
4
|
"description": "MyAgentRoam Node runtime CLI.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"node-pty": "1.1.0",
|
|
28
28
|
"ws": "^8.21.3",
|
|
29
29
|
"zod": "4.4.3",
|
|
30
|
-
"@myagentroam/agent": "0.9.
|
|
31
|
-
"@myagentroam/protocol": "0.9.
|
|
30
|
+
"@myagentroam/agent": "0.9.67",
|
|
31
|
+
"@myagentroam/protocol": "0.9.67"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/ws": "^8.18.1"
|