Skip to content

Commit 59ddbf5

Browse files
Phase 9 (partial): rename Cwd/Remote properties on hand-written types
- CopilotClientOptions.Cwd -> WorkingDirectory - CopilotClientOptions.Remote -> EnableRemoteSessions - McpStdioServerConfig.Cwd -> WorkingDirectory (wire name stays 'cwd') - SessionListFilter.Cwd -> WorkingDirectory Full CLI/server -> runtime terminology overhaul (the RuntimeConnection discriminated config and removal of flat CliPath/CliArgs/Port/UseStdio/CliUrl properties) is deferred — it requires substantial restructuring of the connection-routing logic in Client.cs and warrants its own change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 174b535 commit 59ddbf5

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

dotnet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ new CopilotClient(CopilotClientOptions? options = null)
7979
- `UseStdio` - Use stdio transport instead of TCP (default: true)
8080
- `LogLevel` - Log level (default: "info")
8181
- `AutoStart` - Auto-start server (default: true)
82-
- `Cwd` - Working directory for the CLI process
82+
- `WorkingDirectory` - Working directory for the CLI process
8383
- `CopilotHome` - Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned CLI process. When not set, the CLI defaults to `~/.copilot`. Useful in restricted environments where only specific directories are writable. Ignored when using `CliUrl`.
8484
- `Environment` - Environment variables to pass to the CLI process
8585
- `Logger` - `ILogger` instance for SDK logging

dotnet/src/Client.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ private static bool IsUnsupportedConnectMethod(RemoteRpcException ex)
13841384
args.AddRange(["--session-idle-timeout", options.SessionIdleTimeoutSeconds.Value.ToString(CultureInfo.InvariantCulture)]);
13851385
}
13861386

1387-
if (options.Remote)
1387+
if (options.EnableRemoteSessions)
13881388
{
13891389
args.Add("--remote");
13901390
}
@@ -1401,7 +1401,7 @@ private static bool IsUnsupportedConnectMethod(RemoteRpcException ex)
14011401
RedirectStandardInput = options.UseStdio == true,
14021402
RedirectStandardOutput = true,
14031403
RedirectStandardError = true,
1404-
WorkingDirectory = options.Cwd,
1404+
WorkingDirectory = options.WorkingDirectory,
14051405
CreateNoWindow = true
14061406
};
14071407

dotnet/src/Types.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected CopilotClientOptions(CopilotClientOptions? other)
127127
CliArgs = (string[]?)other.CliArgs?.Clone();
128128
CliPath = other.CliPath;
129129
CliUrl = other.CliUrl;
130-
Cwd = other.Cwd;
130+
WorkingDirectory = other.WorkingDirectory;
131131
CopilotHome = other.CopilotHome;
132132
Environment = other.Environment;
133133
GitHubToken = other.GitHubToken;
@@ -141,7 +141,7 @@ protected CopilotClientOptions(CopilotClientOptions? other)
141141
SessionFs = other.SessionFs;
142142
SessionIdleTimeoutSeconds = other.SessionIdleTimeoutSeconds;
143143
TcpConnectionToken = other.TcpConnectionToken;
144-
Remote = other.Remote;
144+
EnableRemoteSessions = other.EnableRemoteSessions;
145145
}
146146

147147
/// <summary>
@@ -155,7 +155,7 @@ protected CopilotClientOptions(CopilotClientOptions? other)
155155
/// <summary>
156156
/// Working directory for the CLI process.
157157
/// </summary>
158-
public string? Cwd { get; set; }
158+
public string? WorkingDirectory { get; set; }
159159
/// <summary>
160160
/// Base directory for Copilot data (session state, config, etc.).
161161
/// Sets the <c>COPILOT_HOME</c> environment variable on the spawned CLI process.
@@ -257,7 +257,7 @@ protected CopilotClientOptions(CopilotClientOptions? other)
257257
/// This option is only used when the SDK spawns the CLI process; it is ignored
258258
/// when connecting to an external server via <see cref="CliUrl"/>.
259259
/// </summary>
260-
public bool Remote { get; set; }
260+
public bool EnableRemoteSessions { get; set; }
261261

262262
/// <summary>
263263
/// Creates a shallow clone of this <see cref="CopilotClientOptions"/> instance.
@@ -1939,7 +1939,7 @@ public sealed class McpStdioServerConfig : McpServerConfig
19391939
/// Working directory for the server process.
19401940
/// </summary>
19411941
[JsonPropertyName("cwd")]
1942-
public string? Cwd { get; set; }
1942+
public string? WorkingDirectory { get; set; }
19431943
}
19441944

19451945
/// <summary>
@@ -2823,8 +2823,8 @@ public sealed class SessionContext
28232823
/// </summary>
28242824
public sealed class SessionListFilter
28252825
{
2826-
/// <summary>Filter by exact cwd match.</summary>
2827-
public string? Cwd { get; set; }
2826+
/// <summary>Filter by exact working directory match.</summary>
2827+
public string? WorkingDirectory { get; set; }
28282828
/// <summary>Filter by git root.</summary>
28292829
public string? GitRoot { get; set; }
28302830
/// <summary>Filter by repository (owner/repo format).</summary>

dotnet/test/E2E/ClientOptionsE2ETests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task Should_Use_Client_Cwd_For_Default_WorkingDirectory()
4242

4343
await using var client = Ctx.CreateClient(options: new CopilotClientOptions
4444
{
45-
Cwd = clientCwd,
45+
WorkingDirectory = clientCwd,
4646
});
4747

4848
var session = await client.CreateSessionAsync(new SessionConfig

dotnet/test/E2E/SessionMcpAndAgentConfigE2ETests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public async Task Should_Pass_Literal_Env_Values_To_Mcp_Server_Subprocess()
269269
Command = "node",
270270
Args = [Path.Combine(testHarnessDir, "test-mcp-server.mjs")],
271271
Env = new Dictionary<string, string> { ["TEST_SECRET"] = "hunter2" },
272-
Cwd = testHarnessDir,
272+
WorkingDirectory = testHarnessDir,
273273
Tools = ["*"]
274274
}
275275
};
@@ -330,7 +330,7 @@ await File.WriteAllTextAsync(
330330
"--config",
331331
configPath
332332
],
333-
Cwd = testHarnessDir,
333+
WorkingDirectory = testHarnessDir,
334334
Tools = ["*"]
335335
}
336336
};

dotnet/test/Harness/E2ETestContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public CopilotClient CreateClient(
212212
{
213213
options ??= new CopilotClientOptions();
214214

215-
options.Cwd ??= WorkDir;
215+
options.WorkingDirectory ??= WorkDir;
216216
options.Environment ??= GetEnvironment();
217217
options.UseStdio = useStdio;
218218
options.Logger ??= Logger;

dotnet/test/Unit/CloneTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void CopilotClientOptions_Clone_CopiesAllProperties()
1515
{
1616
CliPath = "/usr/bin/copilot",
1717
CliArgs = ["--verbose", "--debug"],
18-
Cwd = "/home/user",
18+
WorkingDirectory = "/home/user",
1919
Port = 8080,
2020
UseStdio = false,
2121
CliUrl = "http://localhost:8080",
@@ -24,15 +24,15 @@ public void CopilotClientOptions_Clone_CopiesAllProperties()
2424
GitHubToken = "ghp_test",
2525
UseLoggedInUser = false,
2626
CopilotHome = "/custom/copilot/home",
27-
Remote = true,
27+
EnableRemoteSessions = true,
2828
SessionIdleTimeoutSeconds = 600,
2929
};
3030

3131
var clone = original.Clone();
3232

3333
Assert.Equal(original.CliPath, clone.CliPath);
3434
Assert.Equal(original.CliArgs, clone.CliArgs);
35-
Assert.Equal(original.Cwd, clone.Cwd);
35+
Assert.Equal(original.WorkingDirectory, clone.WorkingDirectory);
3636
Assert.Equal(original.Port, clone.Port);
3737
Assert.Equal(original.UseStdio, clone.UseStdio);
3838
Assert.Equal(original.CliUrl, clone.CliUrl);
@@ -41,7 +41,7 @@ public void CopilotClientOptions_Clone_CopiesAllProperties()
4141
Assert.Equal(original.GitHubToken, clone.GitHubToken);
4242
Assert.Equal(original.UseLoggedInUser, clone.UseLoggedInUser);
4343
Assert.Equal(original.CopilotHome, clone.CopilotHome);
44-
Assert.Equal(original.Remote, clone.Remote);
44+
Assert.Equal(original.EnableRemoteSessions, clone.EnableRemoteSessions);
4545
Assert.Equal(original.SessionIdleTimeoutSeconds, clone.SessionIdleTimeoutSeconds);
4646
}
4747

0 commit comments

Comments
 (0)