Skip to content

feat(cli): organize help text with logical option groups#1241

Open
Mossaka wants to merge 1 commit intomainfrom
feat/068-help-text-organization
Open

feat(cli): organize help text with logical option groups#1241
Mossaka wants to merge 1 commit intomainfrom
feat/068-help-text-organization

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Mar 11, 2026

Summary

  • Groups CLI flags into 6 logical sections: Domain Filtering, Image Management, Container Configuration, Network & Security, API Proxy, and Logging & Debug
  • Adds visual section headers in --help output using a custom configureHelp formatter
  • Shortens and standardizes option descriptions for consistency

Fixes #500

Test plan

  • npm run build passes
  • All 856 tests pass
  • npm run lint has 0 errors (only pre-existing warnings)
  • awf --help shows grouped options with section headers
  • CI passes

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 11, 2026 18:03
@Mossaka Mossaka closed this Mar 11, 2026
@Mossaka Mossaka reopened this Mar 11, 2026
@Mossaka Mossaka force-pushed the feat/068-help-text-organization branch from f95444a to 8a029ba Compare March 11, 2026 18:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reorganizes the awf --help output to make CLI flags easier to discover by grouping options into logical sections and customizing Commander’s help formatter.

Changes:

  • Adds a custom configureHelp().formatHelp() implementation and group headers for options.
  • Reorders and regroups CLI flags into six sections (Domain Filtering, Image Management, Container Configuration, Network & Security, API Proxy, Logging & Debug).
  • Shortens/standardizes several option descriptions.
Comments suppressed due to low confidence (3)

src/cli.ts:890

  • The --copilot-api-target help text states a fixed default of api.githubcopilot.com, but the api-proxy can auto-derive an enterprise endpoint from GITHUB_SERVER_URL when COPILOT_API_TARGET is not set, and the env var also overrides. Suggest mentioning (briefly) the precedence: CLI flag / COPILOT_API_TARGET env override > derived from GITHUB_SERVER_URL > api.githubcopilot.com.
  .option(
    '--copilot-api-target <host>',
    'Target hostname for Copilot API requests (default: api.githubcopilot.com)',
  )

src/cli.ts:695

  • In formatItem, the condition if (term.length < fullWidth - sep) is effectively term.length < termWidth. This means the longest option term (where term.length === termWidth) will always be forced onto its own line with the description on the next line, while all shorter terms stay single-line. If that’s not intentional, change the comparison to include equality so max-width terms still render as term + padding + description like the others.
  const fullWidth = termWidth + sep;
  if (description) {
    if (term.length < fullWidth - sep) {
      return `${indentStr}${term.padEnd(fullWidth)}${description}`;
    }
    return `${indentStr}${term}\n${' '.repeat(indent + fullWidth)}${description}`;
  }

src/cli.ts:782

  • parseDomainsFile() supports both line-separated and comma-separated formats (and is tested that way), but the updated --allow-domains-file help text now claims "one per line". This is misleading—either update the help text to mention comma-separated/mixed formats, or restrict parsing to one-per-line to match the help.
  .option(
    '--allow-domains-file <path>',
    'Path to file with allowed domains (one per line, supports # comments)'
  )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 787 to 790
.option(
'--block-domains-file <path>',
'Path to file containing blocked domains (one per line or comma-separated, supports # comments)'
'Path to file with blocked domains (one per line, supports # comments)'
)
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseDomainsFile() supports comma-separated and mixed formats, but the updated --block-domains-file help text now claims "one per line". Please align the help text with the actual supported formats (or change the parser behavior).

This issue also appears on line 779 of the same file.

Copilot uses AI. Check for mistakes.
@@ -749,20 +824,22 @@ program
.option(
'--image-tag <tag>',
'Container image tag (applies to both squid and agent images)\n' +
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new --image-tag description implies the tag is applied only to the --agent-image preset (e.g. agent:<tag>), but this tag is also used for other GHCR images (e.g. Squid, and api-proxy when enabled). Consider rewording to reflect that it controls the AWF container image tag(s) in general, and note that it only applies when using preset/GHCR images (not custom --agent-image values).

Suggested change
'Container image tag (applies to both squid and agent images)\n' +
'AWF container image tag for preset/GHCR images (applied to agent and related service images; not used with custom --agent-image values)',

Copilot uses AI. Check for mistakes.
Comment on lines +716 to +761
.configureHelp({
formatHelp(cmd, helper): string {
const termWidth = helper.padWidth(cmd, helper);
const helpWidth = (helper as unknown as { helpWidth?: number }).helpWidth ?? 80;
const itemIndent = 2;
const itemSep = 2;

const output: string[] = [];

// Usage line
const usage = helper.commandUsage(cmd);
output.push(`Usage: ${usage}`);

const desc = helper.commandDescription(cmd);
if (desc) {
output.push('');
output.push(desc);
}

// Arguments
const args = helper.visibleArguments(cmd);
if (args.length > 0) {
output.push('');
output.push('Arguments:');
for (const arg of args) {
const term = helper.argumentTerm(arg);
const argDesc = helper.argumentDescription(arg);
output.push(formatItem(term, argDesc, termWidth, itemIndent, itemSep, helpWidth));
}
}

// Options with group headers
const options = helper.visibleOptions(cmd);
if (options.length > 0) {
output.push('');
output.push('Options:');
for (const opt of options) {
const flags = helper.optionTerm(opt);
const optDesc = helper.optionDescription(opt);
const longFlag = opt.long?.replace(/^--/, '');
if (longFlag && optionGroupHeaders[longFlag]) {
output.push('');
output.push(` ${optionGroupHeaders[longFlag]}`);
}
output.push(formatItem(flags, optDesc, termWidth, itemIndent + 2, itemSep, helpWidth));
}
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The custom configureHelp().formatHelp() implementation bypasses Commander’s built-in wrapping/indentation. As a result, many option descriptions will exceed the configured width (e.g. --allow-domains first-line description) because helpWidth is computed but never applied. Consider using Commander’s helper.wrap() (or equivalent) and indenting continuation lines, so help output stays within helpWidth without relying on hard-coded spaces inside option description strings.

This issue also appears on line 689 of the same file.

Copilot uses AI. Check for mistakes.
Comment on lines +701 to +710
// Option group markers used by the custom help formatter to insert section headers.
// Each key is the long flag name of the first option in a group.
const optionGroupHeaders: Record<string, string> = {
'allow-domains': 'Domain Filtering:',
'build-local': 'Image Management:',
'env': 'Container Configuration:',
'dns-servers': 'Network & Security:',
'enable-api-proxy': 'API Proxy:',
'log-level': 'Logging & Debug:',
};
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New help formatting/grouping behavior (configureHelp + optionGroupHeaders) is a user-facing feature but there are no unit tests covering the --help output structure (e.g., that section headers appear and options remain visible). Since this file already has extensive unit tests, consider adding a focused snapshot/assertion test for program.helpInformation() (or invoking --help) to prevent regressions when options are added/reordered.

Copilot uses AI. Check for mistakes.
)

// -- API Proxy --
.option(
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --enable-api-proxy help text says it supports OpenAI and Anthropic APIs, but the proxy sidecar also supports GitHub Copilot when COPILOT_GITHUB_TOKEN is set (and there are Copilot-specific flags right below). Consider updating this description to include Copilot so users understand why --copilot-api-target exists and what enabling the proxy affects.

This issue also appears on line 887 of the same file.

Suggested change
.option(
' Supports OpenAI (Codex), Anthropic (Claude), and GitHub Copilot APIs.',

Copilot uses AI. Check for mistakes.
false
)

// -- Network & Security --
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated --dns-servers description drops a key security property: DNS traffic is restricted to only these servers (see host-level iptables setup and type docs). The shortened text could mislead users into thinking it’s just a preference rather than an enforced allow-list. Suggest reintroducing that “DNS is ONLY allowed to these servers” wording (and optionally mention Docker’s embedded DNS is also allowed).

Suggested change
// -- Network & Security --
'Comma-separated trusted DNS servers. DNS traffic is ONLY allowed to these servers (and Docker\'s embedded DNS, when used).',

Copilot uses AI. Check for mistakes.
'--dns-servers <servers>',
'Comma-separated trusted DNS servers',
'8.8.8.8,8.8.4.4'
)
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated --enable-host-access help text removes the security warning about combining it with --allow-domains host.docker.internal. Even though runtime warns later, this flag meaningfully expands access to host services, so the --help description should keep a concise warning to avoid accidental misuse.

Suggested change
)
'Enable access to host services via host.docker.internal. Use with caution; combining with --allow-domains host.docker.internal can expose host services.',

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 82.50% 81.18% 📉 -1.32%
Statements 82.50% 81.20% 📉 -1.30%
Functions 82.69% 81.90% 📉 -0.79%
Branches 74.78% 73.84% 📉 -0.94%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/cli.ts 47.0% → 42.9% (-4.15%) 47.5% → 43.3% (-4.15%)
src/docker-manager.ts 84.0% → 84.5% (+0.54%) 83.3% → 83.8% (+0.52%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Contributor

🤖 Smoke test results for @Mossaka:

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot for issue #1241

@github-actions
Copy link
Contributor

fix(cli): clear LD_PRELOAD after one-shot-token library loads
fix(ci): update Copilot CLI version from 0.0.411 to 0.0.421
GitHub MCP ✅; Safeinputs GH ✅; Playwright ✅; Tavily ❌
File write ✅; Bash cat ✅; Discussion ✅; Build ✅
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1241

@github-actions
Copy link
Contributor

Smoke test results — run 22967427599

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1241

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.12 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: FAILED — Python and Node.js versions differ between host and chroot.

Tested by Smoke Chroot for issue #1241

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 82.50% 81.51% 📉 -0.99%
Statements 82.50% 81.52% 📉 -0.98%
Functions 82.69% 82.38% 📉 -0.31%
Branches 74.78% 74.18% 📉 -0.60%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/cli.ts 47.0% → 44.6% (-2.39%) 47.5% → 45.0% (-2.41%)
src/docker-manager.ts 84.0% → 84.5% (+0.54%) 83.3% → 83.8% (+0.52%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Contributor

Smoke Test Results ✅ PASS

Last 2 merged PRs:

Test Result
GitHub MCP (list merged PRs)
Playwright (github.com title)
File write
Bash verify

PR author: @Mossaka · No assignees

📰 BREAKING: Report filed by Smoke Copilot for issue #1241

@github-actions
Copy link
Contributor

Smoke Test Results

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1241

@github-actions
Copy link
Contributor

✅ fix(cli): clear LD_PRELOAD after one-shot-token library loads
✅ fix(ci): update Copilot CLI version from 0.0.411 to 0.0.421
✅ feat(cli): add --agent-timeout flag for execution time limit
✅ feat(cli): organize help text with logical option groups
✅ Playwright title contains "GitHub"
❌ Tavily web search unavailable
✅ smoke-test-codex-22967971469.txt written and read
✅ npm ci && npm run build
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1241

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.12 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot for issue #1241

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.42% 82.89% 📈 +0.47%
Statements 82.42% 82.87% 📈 +0.45%
Functions 82.77% 82.93% 📈 +0.16%
Branches 74.82% 75.00% 📈 +0.18%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 84.0% → 84.5% (+0.54%) 83.3% → 83.8% (+0.52%)
src/cli.ts 47.8% → 52.6% (+4.83%) 48.1% → 52.9% (+4.75%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Contributor

Smoke Test Results

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1241

@github-actions
Copy link
Contributor

Smoke test summary
GitHub MCP merged PRs ✅: test: expand credential hiding tests to all 14 protected paths | test(docker): verify capsh execution chain after PR #715
safeinputs-gh pr list ✅: feat(cli): add --agent-timeout flag for execution time limit | feat(cli): organize help text with logical option groups
Playwright title ✅
Tavily search ❌ (tool unavailable; used web.run)
File write + cat ✅
Build npm ci && npm run build
Discussion comment ✅
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1241

@github-actions
Copy link
Contributor

Smoke Test Results@Mossaka

✅ GitHub MCP: Last 2 merged PRs — #1240 "test(docker): verify capsh execution chain after PR #715", #1232 "fix(cli): clear LD_PRELOAD after one-shot-token library loads"
✅ Playwright: github.com title contains "GitHub"
✅ File write: /tmp/gh-aw/agent/smoke-test-copilot-22968393694.txt created and verified
✅ Bash: cat confirmed file contents

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot for issue #1241

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.12 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ❌ Not all versions matched — Python and Node.js versions differ between host and chroot environment.

Tested by Smoke Chroot for issue #1241

@github-actions

This comment has been minimized.

@Mossaka Mossaka force-pushed the feat/068-help-text-organization branch from 883df8a to a34a479 Compare March 11, 2026 19:02
@github-actions
Copy link
Contributor

Smoke test results (run 22969585895)

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1241

@github-actions
Copy link
Contributor

GitHub MCP merged PRs: ✅
test: expand credential hiding tests to all 14 protected paths | test(docker): verify capsh execution chain after PR #715
safeinputs-gh PR list: ✅
feat(cli): add predownload command to pre-pull container images | fix(cli): fix secure_getenv() bypass of one-shot token protection
Playwright: ✅ | Tavily: ❌ | File: ✅ | Discussion: ✅ | Build: ✅
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1241

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.12 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ❌ Not all runtimes matched — Python and Node.js versions differ between host and chroot.

Tested by Smoke Chroot for issue #1241

@github-actions
Copy link
Contributor

Smoke test results for @Mossaka:

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot for issue #1241

@github-actions

This comment has been minimized.

Reorganize CLI options into 6 logical groups (Domain Filtering, Image
Management, Container Configuration, Network & Security, API Proxy,
Logging & Debug) with section headers in --help output using custom
configureHelp formatter. Shorten and standardize option descriptions.

Fixes #500

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Mossaka Mossaka force-pushed the feat/068-help-text-organization branch from a34a479 to 62fb1b6 Compare March 11, 2026 19:19
@github-actions
Copy link
Contributor

Smoke Test Results

GitHub MCP: #1243 feat(cli): add --memory-limit flag for configurable container memory; #1163 test: expand credential hiding tests to all 14 protected paths
Playwright: github.com title contains "GitHub"
File Write: /tmp/gh-aw/agent/smoke-test-claude-22970267367.txt created
Bash: File content verified

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1241

@github-actions
Copy link
Contributor

Smoke Test Results — run 22970267295

✅ GitHub MCP — Last 2 merged PRs: #1243 feat(cli): add --memory-limit flag, #1240 test(docker): verify capsh execution chain
✅ Playwright — github.com title contains "GitHub"
✅ File Write — /tmp/gh-aw/agent/smoke-test-copilot-22970267295.txt created
✅ Bash — file verified with cat

Overall: PASS | PR by @Mossaka, no assignees

📰 BREAKING: Report filed by Smoke Copilot for issue #1241

@github-actions
Copy link
Contributor

PRs: feat(cli): add --memory-limit flag for configurable container memory; test: expand credential hiding tests to all 14 protected paths
GitHub MCP merged PR review ✅
Safeinputs-gh PR list ✅
Playwright title check ✅
Tavily web search ❌ (tool unavailable)
File write ✅
Cat verify ✅
Discussion query+comment ✅
Build (npm ci && npm run build) ✅
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1241

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.12 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot for issue #1241

@github-actions
Copy link
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson N/A ❌ FAIL
Java caffeine N/A ❌ FAIL
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 7/8 ecosystems passed — ❌ FAIL


❌ Failure Details

Java (gson, caffeine)mvn compile failed for both projects.

Maven needs to download plugins/dependencies from Maven Central (https://repo.maven.apache.org/maven2), but the AWF network firewall blocks direct outbound HTTPS from the runner. The squid-proxy hostname configured in settings.xml (per the task instructions) is only resolvable within the AWF Docker container network, not from the host runner environment.

[ERROR] Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:3.3.1
        from/to central (https://repo.maven.apache.org/maven2): Network is unreachable

This failure is environmental — Java/Maven requires network access to Maven Central to bootstrap, and neither direct access nor proxy routing is available outside the AWF Docker network.

Generated by Build Test Suite for issue #1241 ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve help text organization and consistency

2 participants