Skip to content

feat(cli): initial implementation of FluentUI CLI - #36734

Open
Martin Hochel (Hotell) wants to merge 19 commits into
microsoft:masterfrom
Hotell:fluentui-cli/prepare-for-merge
Open

Martin Hochel (Hotell) wants to merge 19 commits into
microsoft:masterfrom
Hotell:fluentui-cli/prepare-for-merge

Conversation

@Hotell

Copy link
Copy Markdown
Contributor

Previous Behavior

Fluent UI did not provide a unified CLI for collecting environment/package diagnostics, analyzing API usage, or extracting API metadata from declaration output.

The repository also contained an experimental v8-to-v9 migration documentation verification skill that is not ready to ship with the CLI.

New Behavior

  • Adds the experimental @fluentui/cli package with lazy-loaded yargs commands:
    • report info for environment and installed-package summaries.
    • report usage for Fluent UI API usage analysis with JSON, Markdown, and HTML reporters.
    • metadata for extracting API metadata from package .d.ts output.
  • Adds an Nx generator for scaffolding future CLI commands using the established command-module pattern.
  • Adds CLI documentation, agent guidance, tests, build configuration, and an initial-release beachball change file.
  • Removes the incomplete migrate command and the related v8-to-v9 migration skills so the master-facing CLI contains only supported functionality.

Validation

  • yarn nx run cli:test --skip-nx-cache (14 suites, 182 tests)
  • yarn nx run cli:lint --skip-nx-cache
  • yarn nx run cli:type-check --skip-nx-cache
  • yarn nx run cli:build --skip-nx-cache
  • Verified root and command-level help for report info, report usage, and metadata.
  • Verified migrate is rejected as an unknown argument and is absent from root help.
  • Executed fixture-backed report usage and metadata smoke tests.

Related Issue(s)

None.

Dmytro Kirpa (dmytrokirpa) and others added 19 commits March 2, 2026 15:25
…ands (microsoft#35842)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…icrosoft#35843)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
microsoft#35964)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

📊 Bundle size report

✅ No changes found

@github-actions

Copy link
Copy Markdown

Pull request demo site: URL

Comment thread .github/skills/fluentui-cli/SKILL.md
@Hotell

Copy link
Copy Markdown
Contributor Author

Dmytro Kirpa (@dmytrokirpa) there is this internal skill and generator to spawn new commands. i think it's fine to keep it for now, but long term ideally remove or collocated within the package to prevent context rot . wdyt ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why this got removed, shouldn't we keep it?

Comment thread docs/plans/fluent-cli.md
@@ -0,0 +1,125 @@
# Fluent UI CLI Project Spec

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we still need this? if so, should we move it from the /docs/plans to /tools/cli/docs?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Published entry points and several core reporting and metadata-analysis paths currently produce incorrect results.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Introduces the experimental Fluent UI diagnostics and API-metadata CLI, plus supporting generators, tests, documentation, and release configuration.

Changes:

  • Adds report info, report usage, and metadata commands.
  • Adds an Nx command generator and extensive fixture-based tests.
  • Replaces migration guidance with CLI-focused agent documentation.

Merge confidence: 20/100 — packaging and core analysis issues remain.

File summaries
File Description
.github/skills/fluentui-cli/SKILL.md Adds CLI agent guidance.
.github/skills/fluentui-cli/references/adding-commands.md Documents command creation.
.github/skills/verify-v8-v9-migration-docs/SKILL.md Removes migration skill.
change/@fluentui-cli-1d82ac6b-1cef-4156-892b-832d275398da.json Adds release change record.
docs/plans/fluent-cli.md Defines CLI scope and architecture.
tools/cli/.swcrc Configures SWC compilation.
tools/cli/README.md Documents CLI usage.
tools/cli/bin/fluentui-cli.js Adds executable entry point.
tools/cli/eslint.config.cjs Configures CLI linting.
tools/cli/jest.config.ts Configures CLI tests.
tools/cli/package.json Defines the published package.
tools/cli/project.json Defines the Nx project.
tools/cli/tsconfig.json Adds root TypeScript configuration.
tools/cli/tsconfig.lib.json Configures library compilation.
tools/cli/tsconfig.spec.json Configures test compilation.
tools/cli/src/cli.ts Registers root commands.
tools/cli/src/index.ts Adds package entry module.
tools/cli/src/utils/index.ts Exports shared utilities.
tools/cli/src/utils/types.ts Defines the handler type.
tools/cli/src/commands/report/README.md Documents reporting commands.
tools/cli/src/commands/report/index.ts Registers report subcommands.
tools/cli/src/commands/report/commands/info.ts Defines report info.
tools/cli/src/commands/report/commands/info.spec.ts Tests info command routing.
tools/cli/src/commands/report/commands/usage.ts Defines report usage.
tools/cli/src/commands/report/commands/usage.spec.ts Tests usage command routing.
tools/cli/src/commands/report/impl/types.ts Defines report data contracts.
tools/cli/src/commands/report/impl/index.ts Exports report contracts.
tools/cli/src/commands/report/impl/ast-parser.ts Implements usage AST analysis.
tools/cli/src/commands/report/impl/ast-parser.spec.ts Tests AST analysis.
tools/cli/src/commands/report/impl/file-discovery.ts Discovers and filters sources.
tools/cli/src/commands/report/impl/file-discovery.spec.ts Tests source discovery.
tools/cli/src/commands/report/impl/package-resolver.ts Resolves packages and environment.
tools/cli/src/commands/report/impl/package-resolver.spec.ts Tests package resolution.
tools/cli/src/commands/report/impl/info-report.ts Produces environment reports.
tools/cli/src/commands/report/impl/info-report.spec.ts Tests environment formatting.
tools/cli/src/commands/report/impl/usage-report.ts Aggregates API usage.
tools/cli/src/commands/report/impl/usage-report.spec.ts Tests usage aggregation.
tools/cli/src/commands/report/impl/markdown-reporter.ts Formats usage as Markdown.
tools/cli/src/commands/report/impl/markdown-reporter.spec.ts Tests Markdown reports.
tools/cli/src/commands/report/impl/html-reporter.ts Formats usage as HTML.
tools/cli/src/commands/report/impl/html-reporter.spec.ts Tests HTML reports.
tools/cli/src/commands/report/__fixtures__/sample-app/package.json Defines report fixture package.
tools/cli/src/commands/report/__fixtures__/sample-app/tsconfig.json Configures report fixtures.
tools/cli/src/commands/report/__fixtures__/sample-app/src/basic-usage.tsx Exercises basic API usage.
tools/cli/src/commands/report/__fixtures__/sample-app/src/hook-args.tsx Exercises hook arguments.
tools/cli/src/commands/report/__fixtures__/sample-app/src/mixed-imports.tsx Exercises mixed imports.
tools/cli/src/commands/report/__fixtures__/sample-app/src/path-alias-imports.tsx Exercises path aliases.
tools/cli/src/commands/report/__fixtures__/sample-app/src/type-imports.ts Exercises type imports.
tools/cli/src/commands/report/__fixtures__/sample-app/src/type-refs.tsx Exercises type references.
tools/cli/src/commands/report/__fixtures__/sample-app/packages/azure-theme/src/index.ts Exports fixture theme.
tools/cli/src/commands/report/__fixtures__/sample-app/packages/azure-theme/src/components/AzureLightTheme/index.ts Re-exports fixture implementation.
tools/cli/src/commands/report/__fixtures__/sample-app/packages/azure-theme/src/components/AzureLightTheme/AzureLightTheme.ts Defines fixture theme.
tools/cli/src/commands/report/__fixtures__/sample-app/_mock_node_modules/@proj/react-components/index.d.ts Mocks component declarations.
tools/cli/src/commands/report/__fixtures__/sample-app/_mock_node_modules/@proj/react-components/package.json Defines mock component package.
tools/cli/src/commands/report/__fixtures__/sample-app/_mock_node_modules/@types/react/index.d.ts Mocks React declarations.
tools/cli/src/commands/report/__fixtures__/sample-app/_mock_node_modules/@types/react/package.json Defines mock React package.
tools/cli/src/commands/metadata/README.md Documents metadata extraction.
tools/cli/src/commands/metadata/index.ts Defines metadata command options.
tools/cli/src/commands/metadata/handler.ts Orchestrates metadata generation.
tools/cli/src/commands/metadata/handler.spec.ts Tests metadata orchestration.
tools/cli/src/commands/metadata/impl/types.ts Defines metadata contracts.
tools/cli/src/commands/metadata/impl/dts-parser.ts Parses declaration exports.
tools/cli/src/commands/metadata/impl/dts-parser.spec.ts Tests declaration parsing.
tools/cli/src/commands/metadata/impl/entry-resolver.ts Resolves declaration entries.
tools/cli/src/commands/metadata/impl/entry-resolver.spec.ts Tests entry resolution.
tools/cli/src/commands/metadata/impl/cross-package-resolver.ts Resolves dependency references.
tools/cli/src/commands/metadata/impl/cross-package-resolver.spec.ts Tests dependency references.
tools/cli/src/commands/metadata/impl/annotation-groups.ts Groups API annotations.
tools/cli/src/commands/metadata/impl/annotation-groups.spec.ts Tests annotation grouping.
tools/cli/src/commands/metadata/impl/markdown-formatter.ts Formats metadata as Markdown.
tools/cli/src/commands/metadata/impl/html-formatter.ts Formats metadata as HTML.
tools/cli/src/commands/metadata/__fixtures__/package.json Defines metadata fixture package.
tools/cli/src/commands/metadata/__fixtures__/sample-button.d.ts Provides metadata fixture API.
tools/workspace-plugin/generators.json Registers CLI generator.
tools/workspace-plugin/src/generators/cli-command/README.md Documents generator usage.
tools/workspace-plugin/src/generators/cli-command/generator.ts Implements command scaffolding.
tools/workspace-plugin/src/generators/cli-command/generator.spec.ts Tests command scaffolding.
tools/workspace-plugin/src/generators/cli-command/schema.ts Defines generator options.
tools/workspace-plugin/src/generators/cli-command/schema.json Defines generator schema.
tools/workspace-plugin/src/generators/cli-command/files/index.ts__tmpl__ Templates command registration.
tools/workspace-plugin/src/generators/cli-command/files/handler.ts__tmpl__ Templates command handlers.
tools/workspace-plugin/src/generators/cli-command/files/handler.spec.ts__tmpl__ Templates handler tests.
tsconfig.base.json Adds CLI path mapping.
tsconfig.base.all.json Adds complete CLI path mapping.
yarn.lock Records CLI dependencies.
Review details

Files not reviewed (2)

  • tools/cli/src/commands/report/fixtures/sample-app/_mock_node_modules/@proj/react-components/package.json: Generated file
  • tools/cli/src/commands/report/fixtures/sample-app/_mock_node_modules/@types/react/package.json: Generated file
  • Files reviewed: 78/85 changed files
  • Comments generated: 9
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tools/cli/package.json
Comment on lines +5 to +6
"main": "./src/index.js",
"types": "./src/index.d.ts",
Comment on lines +65 to +67
if (content.includes(importPath)) {
return;
}
@@ -0,0 +1,7 @@
{
"type": "patch",
Comment on lines +88 to +89
// Collect imported package specifiers and named imports
for (const imp of sourceFile.getImportDeclarations()) {
Comment on lines +240 to +242
for (const p of params) {
lines.push(`| \`${p.name}\` | \`${p.type}\` | ${p.required ? 'Yes' : 'No'} | ${p.description} |`);
}
Comment on lines +99 to +100
return sourceFile.getImportDeclarations().map(decl => {
const namedImports = decl.getNamedImports().map(ni => ni.getName());
Comment on lines +61 to +81
const absoluteRoot = path.resolve(rootPath);
const relativeSet = new Set(filePaths.map(fp => path.relative(absoluteRoot, fp)));

let selected: Set<string>;

if (include?.length) {
const matched = new Set(fg.globSync(include, { cwd: absoluteRoot, dot: true, onlyFiles: true }));
// Intersect fast-glob results with our discovered file list
selected = new Set([...relativeSet].filter(rel => matched.has(rel)));
} else {
selected = new Set(relativeSet);
}

if (exclude?.length) {
const excluded = new Set<string>(fg.globSync(exclude, { cwd: absoluteRoot, dot: true, onlyFiles: true }));
for (const ex of excluded) {
selected.delete(ex);
}
}

return filePaths.filter(fp => selected.has(path.relative(absoluteRoot, fp)));
Comment on lines +1 to +4
---
name: fluentui-cli
description: 'Guides working with @fluentui/cli — the internal Fluent UI command-line tool. Use when asked to add a new CLI command, modify an existing command, understand CLI architecture, debug CLI issues, or work with the CLI build/test workflow. Covers: architecture overview, yargs conventions, lazy-loading pattern, testing, and available Nx generators.'
---
Comment thread tools/cli/README.md

Command-line tool for Fluent UI usage reporting and API metadata extraction.

> **⚠️ Experimental** — This package is published under the `experimental` npm tag. APIs and commands may change without notice.
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.

3 participants