Skip to content

Commit 4425c3d

Browse files
authored
format, lint and document new flags
1 parent d5beff1 commit 4425c3d

10 files changed

Lines changed: 68 additions & 73 deletions

File tree

.github/aw/github-agentic-workflows.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,18 @@ The YAML frontmatter supports these fields:
214214
The `custom` engine allows you to define your own GitHub Actions steps instead of using an AI processor. Each step in the `steps` array follows standard GitHub Actions step syntax with `name`, `uses`/`run`, `with`, `env`, etc. This is useful for deterministic workflows that don't require AI processing.
215215

216216
**Environment Variables Available to Custom Engines:**
217-
217+
218218
Custom engine steps have access to the following environment variables:
219-
219+
220220
- **`$GH_AW_PROMPT`**: Path to the generated prompt file (`/tmp/gh-aw/aw-prompts/prompt.txt`) containing the markdown content from the workflow. This file contains the natural language instructions that would normally be sent to an AI processor. Custom engines can read this file to access the workflow's markdown content programmatically.
221221
- **`$GH_AW_SAFE_OUTPUTS`**: Path to the safe outputs file (when safe-outputs are configured). Used for writing structured output that gets processed automatically.
222222
- **`$GH_AW_MAX_TURNS`**: Maximum number of turns/iterations (when max-turns is configured in engine config).
223-
223+
224224
Example of accessing the prompt content:
225225
```bash
226226
# Read the workflow prompt content
227227
cat $GH_AW_PROMPT
228-
228+
229229
# Process the prompt content in a custom step
230230
- name: Process workflow instructions
231231
run: |
@@ -253,7 +253,7 @@ The YAML frontmatter supports these fields:
253253
log-level: debug # Optional: debug, info (default), warn, error
254254
args: ["--custom-arg", "value"] # Optional: additional AWF arguments
255255
```
256-
256+
257257
- **`sandbox:`** - Sandbox configuration for AI engines (string or object)
258258
- String format: `"default"` (no sandbox), `"awf"` (Agent Workflow Firewall), `"srt"` or `"sandbox-runtime"` (Anthropic Sandbox Runtime)
259259
- Object format for full configuration:
@@ -703,7 +703,7 @@ cache:
703703
restore-keys: |
704704
node-modules-
705705
- key: build-cache-${{ github.sha }}
706-
path:
706+
path:
707707
- dist
708708
- .cache
709709
restore-keys:
@@ -963,7 +963,7 @@ All other expressions are dissallowed.
963963
The `needs.activation.outputs.text` value provides automatically sanitized content based on the triggering event:
964964

965965
- **Issues**: `title + "\n\n" + body`
966-
- **Pull Requests**: `title + "\n\n" + body`
966+
- **Pull Requests**: `title + "\n\n" + body`
967967
- **Issue Comments**: `comment.body`
968968
- **PR Review Comments**: `comment.body`
969969
- **PR Reviews**: `review.body`
@@ -1163,7 +1163,7 @@ permissions:
11631163
11641164
safe-outputs:
11651165
create-issue: # Automatic issue creation
1166-
add-comment: # Automatic comment creation
1166+
add-comment: # Automatic comment creation
11671167
create-pull-request: # Automatic PR creation
11681168
```
11691169

@@ -1437,7 +1437,7 @@ The `--start-date` and `--end-date` flags support delta time syntax for relative
14371437

14381438
**Supported Time Units:**
14391439
- **Days**: `-1d`, `-7d`
1440-
- **Weeks**: `-1w`, `-4w`
1440+
- **Weeks**: `-1w`, `-4w`
14411441
- **Months**: `-1mo`, `-6mo`
14421442
- **Hours/Minutes**: `-12h`, `-30m` (for sub-day precision)
14431443
- **Combinations**: `-1mo2w3d`, `-2w5d12h`
@@ -1447,7 +1447,7 @@ The `--start-date` and `--end-date` flags support delta time syntax for relative
14471447
# Get runs from the last week
14481448
gh aw logs --start-date -1w
14491449
1450-
# Get runs up to yesterday
1450+
# Get runs up to yesterday
14511451
gh aw logs --end-date -1d
14521452
14531453
# Get runs from the last month
@@ -1502,7 +1502,7 @@ permissions:
15021502
GitHub Agentic Workflows supports security scanning during compilation with `--actionlint`, `--zizmor`, and `--poutine` flags.
15031503

15041504
**actionlint** - Lints GitHub Actions workflows and validates shell scripts with integrated shellcheck
1505-
**zizmor** - Scans for security vulnerabilities, privilege escalation, and secret exposure
1505+
**zizmor** - Scans for security vulnerabilities, privilege escalation, and secret exposure
15061506
**poutine** - Analyzes supply chain risks and third-party action usage
15071507

15081508
```bash
@@ -1559,7 +1559,7 @@ gh aw mcp list-tools github weekly-research
15591559

15601560
This command is useful for:
15611561
- **Discovering capabilities**: See what tools are available from each MCP server
1562-
- **Workflow discovery**: Find which workflows use a specific MCP server
1562+
- **Workflow discovery**: Find which workflows use a specific MCP server
15631563
- **Permission debugging**: Check which tools are allowed in your workflow configuration
15641564

15651565
## Compilation Process
@@ -1588,7 +1588,7 @@ Agentic workflows compile to GitHub Actions YAML:
15881588

15891589
1. **Use descriptive workflow names** that clearly indicate purpose
15901590
2. **Set appropriate timeouts** to prevent runaway costs
1591-
3. **Include security notices** for workflows processing user content
1591+
3. **Include security notices** for workflows processing user content
15921592
4. **Use the `imports:` field** in frontmatter for common patterns and security boilerplate
15931593
5. **ALWAYS run `gh aw compile` after every change** to generate the GitHub Actions workflow (or `gh aw compile <workflow-id>` for specific workflows)
15941594
6. **Review generated `.lock.yml`** files before deploying
@@ -1651,4 +1651,4 @@ gh aw logs <workflow-id>
16511651

16521652
### Documentation
16531653

1654-
For complete CLI documentation, see: https://githubnext.github.io/gh-aw/setup/cli/
1654+
For complete CLI documentation, see: https://githubnext.github.io/gh-aw/setup/cli/

docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,10 @@ By default, the SDK automatically manages the Copilot CLI process lifecycle, sta
950950

951951
### Running the CLI in Server Mode
952952

953-
Start the CLI in server mode using the `--server` flag and optionally specify a port:
953+
Start the CLI in server mode using the `--headless` flag and optionally specify a port:
954954

955955
```bash
956-
copilot --server --port 4321
956+
copilot --headless --port 4321
957957
```
958958

959959
If you don't specify a port, the CLI will choose a random available port.

dotnet/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Delete a session and its data from disk.
126126

127127
##### `GetForegroundSessionIdAsync(): Task<string?>`
128128

129-
Get the ID of the session currently displayed in the TUI. Only available when connecting to a server running in TUI+server mode (`--interactive --server`).
129+
Get the ID of the session currently displayed in the TUI. Only available when connecting to a server running in TUI+server mode (`--ui-server`).
130130

131131
##### `SetForegroundSessionIdAsync(string sessionId): Task`
132132

@@ -499,13 +499,13 @@ var session = await client.CreateSessionAsync(new SessionConfig
499499
// request.Question - The question to ask
500500
// request.Choices - Optional list of choices for multiple choice
501501
// request.AllowFreeform - Whether freeform input is allowed (default: true)
502-
502+
503503
Console.WriteLine($"Agent asks: {request.Question}");
504504
if (request.Choices?.Count > 0)
505505
{
506506
Console.WriteLine($"Choices: {string.Join(", ", request.Choices)}");
507507
}
508-
508+
509509
// Return the user's response
510510
return new UserInputResponse
511511
{
@@ -538,7 +538,7 @@ var session = await client.CreateSessionAsync(new SessionConfig
538538
AdditionalContext = "Extra context for the model"
539539
};
540540
},
541-
541+
542542
// Called after each tool execution
543543
OnPostToolUse = async (input, invocation) =>
544544
{
@@ -548,7 +548,7 @@ var session = await client.CreateSessionAsync(new SessionConfig
548548
AdditionalContext = "Post-execution notes"
549549
};
550550
},
551-
551+
552552
// Called when user submits a prompt
553553
OnUserPromptSubmitted = async (input, invocation) =>
554554
{
@@ -558,7 +558,7 @@ var session = await client.CreateSessionAsync(new SessionConfig
558558
ModifiedPrompt = input.Prompt // Optionally modify the prompt
559559
};
560560
},
561-
561+
562562
// Called when session starts
563563
OnSessionStart = async (input, invocation) =>
564564
{
@@ -568,14 +568,14 @@ var session = await client.CreateSessionAsync(new SessionConfig
568568
AdditionalContext = "Session initialization context"
569569
};
570570
},
571-
571+
572572
// Called when session ends
573573
OnSessionEnd = async (input, invocation) =>
574574
{
575575
Console.WriteLine($"Session ended: {input.Reason}");
576576
return null;
577577
},
578-
578+
579579
// Called when an error occurs
580580
OnErrorOccurred = async (input, invocation) =>
581581
{

dotnet/src/Client.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ public async Task<List<SessionMetadata>> ListSessionsAsync(CancellationToken can
673673
/// </summary>
674674
/// <remarks>
675675
/// This is only available when connecting to a server running in TUI+server mode
676-
/// (--interactive --server).
676+
/// (--ui-server).
677677
/// </remarks>
678678
/// <param name="cancellationToken">A token to cancel the operation.</param>
679679
/// <returns>The session ID, or null if no foreground session is set.</returns>
@@ -701,7 +701,7 @@ public async Task<List<SessionMetadata>> ListSessionsAsync(CancellationToken can
701701
/// </summary>
702702
/// <remarks>
703703
/// This is only available when connecting to a server running in TUI+server mode
704-
/// (--interactive --server).
704+
/// (--ui-server).
705705
/// </remarks>
706706
/// <param name="sessionId">The ID of the session to display in the TUI.</param>
707707
/// <param name="cancellationToken">A token to cancel the operation.</param>
@@ -875,7 +875,7 @@ private async Task VerifyProtocolVersionAsync(Connection connection, Cancellatio
875875
args.AddRange(options.CliArgs);
876876
}
877877

878-
args.AddRange(["--server", "--log-level", options.LogLevel]);
878+
args.AddRange(["--headless", "--log-level", options.LogLevel]);
879879

880880
if (options.UseStdio)
881881
{

go/client.go

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,24 @@ import (
6161
// }
6262
// defer client.Stop()
6363
type Client struct {
64-
options ClientOptions
65-
process *exec.Cmd
66-
client *JSONRPCClient
67-
actualPort int
68-
actualHost string
69-
state ConnectionState
70-
sessions map[string]*Session
71-
sessionsMux sync.Mutex
72-
isExternalServer bool
73-
conn net.Conn // stores net.Conn for external TCP connections
74-
useStdio bool // resolved value from options
75-
autoStart bool // resolved value from options
76-
autoRestart bool // resolved value from options
77-
modelsCache []ModelInfo
78-
modelsCacheMux sync.Mutex
79-
lifecycleHandlers []SessionLifecycleHandler
80-
typedLifecycleHandlers map[SessionLifecycleEventType][]SessionLifecycleHandler
81-
lifecycleHandlersMux sync.Mutex
64+
options ClientOptions
65+
process *exec.Cmd
66+
client *JSONRPCClient
67+
actualPort int
68+
actualHost string
69+
state ConnectionState
70+
sessions map[string]*Session
71+
sessionsMux sync.Mutex
72+
isExternalServer bool
73+
conn net.Conn // stores net.Conn for external TCP connections
74+
useStdio bool // resolved value from options
75+
autoStart bool // resolved value from options
76+
autoRestart bool // resolved value from options
77+
modelsCache []ModelInfo
78+
modelsCacheMux sync.Mutex
79+
lifecycleHandlers []SessionLifecycleHandler
80+
typedLifecycleHandlers map[SessionLifecycleEventType][]SessionLifecycleHandler
81+
lifecycleHandlersMux sync.Mutex
8282
}
8383

8484
// NewClient creates a new Copilot CLI client with the given options.
@@ -915,7 +915,7 @@ func (c *Client) DeleteSession(sessionID string) error {
915915
// GetForegroundSessionID returns the ID of the session currently displayed in the TUI.
916916
//
917917
// This is only available when connecting to a server running in TUI+server mode
918-
// (--interactive --server). Returns nil if no foreground session is set.
918+
// (--ui-server). Returns nil if no foreground session is set.
919919
//
920920
// Example:
921921
//
@@ -958,7 +958,7 @@ func (c *Client) GetForegroundSessionID() (*string, error) {
958958
// SetForegroundSessionID requests the TUI to switch to displaying the specified session.
959959
//
960960
// This is only available when connecting to a server running in TUI+server mode
961-
// (--interactive --server).
961+
// (--ui-server).
962962
//
963963
// Example:
964964
//
@@ -1277,7 +1277,7 @@ func (c *Client) verifyProtocolVersion() error {
12771277
// This spawns the CLI server as a subprocess using the configured transport
12781278
// mode (stdio or TCP).
12791279
func (c *Client) startCLIServer() error {
1280-
args := []string{"--server", "--log-level", c.options.LogLevel}
1280+
args := []string{"--headless", "--log-level", c.options.LogLevel}
12811281

12821282
// Choose transport mode
12831283
if c.useStdio {
@@ -1432,7 +1432,8 @@ func (c *Client) connectViaTcp() error {
14321432
// setupNotificationHandler configures handlers for session events, tool calls, and permission requests.
14331433
func (c *Client) setupNotificationHandler() {
14341434
c.client.SetNotificationHandler(func(method string, params map[string]any) {
1435-
if method == "session.event" {
1435+
switch method {
1436+
case "session.event":
14361437
// Extract sessionId and event
14371438
sessionID, ok := params["sessionId"].(string)
14381439
if !ok {
@@ -1458,7 +1459,7 @@ func (c *Client) setupNotificationHandler() {
14581459
if ok {
14591460
session.dispatchEvent(event)
14601461
}
1461-
} else if method == "session.lifecycle" {
1462+
case "session.lifecycle":
14621463
// Handle session lifecycle events
14631464
eventJSON, err := json.Marshal(params)
14641465
if err != nil {

nodejs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Delete a session and its data from disk.
118118

119119
##### `getForegroundSessionId(): Promise<string | undefined>`
120120

121-
Get the ID of the session currently displayed in the TUI. Only available when connecting to a server running in TUI+server mode (`--interactive --server`).
121+
Get the ID of the session currently displayed in the TUI. Only available when connecting to a server running in TUI+server mode (`--ui-server`).
122122

123123
##### `setForegroundSessionId(sessionId: string): Promise<void>`
124124

nodejs/src/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ export class CopilotClient {
825825
* Gets the foreground session ID in TUI+server mode.
826826
*
827827
* This returns the ID of the session currently displayed in the TUI.
828-
* Only available when connecting to a server running in TUI+server mode (--interactive --server).
828+
* Only available when connecting to a server running in TUI+server mode (--ui-server).
829829
*
830830
* @returns A promise that resolves with the foreground session ID, or undefined if none
831831
* @throws Error if the client is not connected
@@ -851,7 +851,7 @@ export class CopilotClient {
851851
* Sets the foreground session in TUI+server mode.
852852
*
853853
* This requests the TUI to switch to displaying the specified session.
854-
* Only available when connecting to a server running in TUI+server mode (--interactive --server).
854+
* Only available when connecting to a server running in TUI+server mode (--ui-server).
855855
*
856856
* @param sessionId - The ID of the session to display in the TUI
857857
* @returns A promise that resolves when the session is switched
@@ -962,7 +962,7 @@ export class CopilotClient {
962962
return new Promise((resolve, reject) => {
963963
const args = [
964964
...this.options.cliArgs,
965-
"--server",
965+
"--headless",
966966
"--log-level",
967967
this.options.logLevel,
968968
];

0 commit comments

Comments
 (0)