Skip to content

Add --format json flag for machine-readable CLI output #15905

@jiuqlo

Description

@jiuqlo

Is your feature request related to a problem? Please describe.

When automating ATK CLI operations (e.g., atk install, atk package), there is no machine-readable output format. The current human-friendly text output requires fragile regex/string parsing to extract structured data like Title ID, App ID, and share links. This makes it difficult to build reliable automation scripts, CI/CD pipelines, and agent-driven workflows on top of ATK CLI.

For example, after atk install --file-path <zip> --scope Personal, the only way to get the Title ID (needed for deeplinks like https://m365.cloud.microsoft/chat/?titleId=T_xxx) is to regex-parse the human-readable stdout — which is fragile, locale-dependent, and breaks when formatting changes between versions.

Describe the solution you'd like

Add a --format json (or --output json) global flag that outputs structured JSON instead of human-readable text, similar to how az CLI supports --output json/table/tsv.

Example for atk install:

{
  "status": "success",
  "titleId": "T_a687bf2c-...",
  "appId": "dc9f05d3-...",
  "shareLink": "https://m365.cloud.microsoft/chat/..."
}

Example for atk package:

{
  "status": "success",
  "outputPath": "/path/to/appPackage.dev.zip",
  "env": "dev"
}

The data already exists internally — for example, PackageService.sideLoading() returns a typed [titleId, appId, shareLink] tuple. The feature would primarily involve a thin output formatting layer in the logger/presenter rather than new business logic.

Describe alternatives you've considered

  • Parsing stdout with regex: Fragile, breaks on format changes, locale-dependent
  • Windows Registry lookup: Platform-specific (Windows only), not available on macOS/Linux
  • Wrapping ATK in expect/pexpect: Complex, brittle, poor DX

Additional context

This request comes from building automation for sideloading M365 agents in enterprise environments. Key use cases:

  1. CI/CD integration: Pipelines need to extract Title ID and App ID after sideloading to construct deeplinks, verify deployments, or chain subsequent operations
  2. Agent-driven workflows: AI agents and automation scripts need deterministic, parseable output
  3. Cross-platform consistency: Text output may vary by locale/terminal; JSON is universal

Ideally, --format json would be a global flag available on all commands (install, package, validate, etc.).

Metadata

Metadata

Assignees

Labels

feature-requestThe issue is a feature request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions