Skip to content

docs(sdk): add JSDoc to all exported interfaces and types#26277

Merged
scidomino merged 1 commit intogoogle-gemini:mainfrom
fauzan171:docs/sdk-jsdoc-types
May 4, 2026
Merged

docs(sdk): add JSDoc to all exported interfaces and types#26277
scidomino merged 1 commit intogoogle-gemini:mainfrom
fauzan171:docs/sdk-jsdoc-types

Conversation

@fauzan171
Copy link
Copy Markdown
Contributor

Description

Add comprehensive JSDoc documentation to every exported interface, type, class, and function in the SDK package (packages/sdk).

Changes

packages/sdk/src/types.ts

  • SystemInstructions — documents the static string vs dynamic function pattern
  • GeminiCliAgentOptions — documents all 8 configuration properties
  • AgentFilesystem — documents the sandboxed filesystem interface and its methods
  • AgentShellOptions — documents shell execution options
  • AgentShellResult — documents all result fields (exitCode, output, stdout, stderr, error)
  • AgentShell — documents the shell execution interface
  • SessionContext — documents all 8 context properties

packages/sdk/src/tool.ts

  • ModelVisibleError — documents the error visibility behavior
  • ToolDefinition<T> — documents name, description, inputSchema, sendErrorsToModel
  • Tool<T> — documents the action function with @param and @returns
  • SdkTool<T> — documents the wrapper class
  • tool() — documents the helper factory with @example

packages/sdk/src/skills.ts

  • SkillReference — documents the skill directory reference type

packages/sdk/src/agent.ts

packages/sdk/src/session.ts

  • GeminiCliSession — class-level docs
  • id getter — documents the session identifier
  • initialize() — documents the initialization lifecycle
  • sendStream() — documents the streaming API with @example

packages/sdk/src/fs.ts

  • SdkAgentFilesystem — documents the implementation class

packages/sdk/src/shell.ts

  • SdkAgentShell — documents the implementation class

Testing

  • No functional changes, documentation only
  • All JSDoc tags use standard TSDoc syntax (@param, @returns, @throws, @typeParam, @example)
  • Cross-references use {@link} for navigation

Fixes #21505

@fauzan171 fauzan171 requested a review from a team as a code owner April 30, 2026 18:55
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 30, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the maintainability and usability of the SDK by introducing comprehensive documentation across the codebase. By providing clear descriptions, parameter details, and usage examples for core components, this change significantly improves the developer experience for those consuming the SDK.

Highlights

  • Comprehensive Documentation: Added detailed JSDoc comments to all exported interfaces, types, classes, and functions within the SDK package to improve developer experience and IDE intellisense.
  • Standardized TSDoc Syntax: Utilized standard TSDoc tags such as @param, @returns, @throws, @typeparam, and @example, along with {@link} cross-references for better navigation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@fauzan171 fauzan171 force-pushed the docs/sdk-jsdoc-types branch 2 times, most recently from 1855b4f to 744ca20 Compare April 30, 2026 19:01
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds comprehensive JSDoc documentation to the SDK package, covering core classes and interfaces such as GeminiCliAgent, GeminiCliSession, and Tool. The feedback identifies an opportunity to improve the SdkAgentShell documentation by clarifying that standard error is merged into the standard output stream, which is important for developers using the AgentShellResult interface.

Comment thread packages/sdk/src/shell.ts
Comment on lines +19 to +25
/**
* SDK implementation of {@link AgentShell} that executes commands via the
* core ShellExecutionService, subject to the agent's security policies.
*
* Commands that require interactive confirmation will be rejected since
* no interactive session is available in headless SDK mode.
*/
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.

high

The documentation for SdkAgentShell is helpful, but it's missing a crucial detail about how stdout and stderr are handled. The current implementation of exec combines both streams into the stdout field of the AgentShellResult and leaves stderr empty, which contradicts the definition of the AgentShellResult interface. This can be misleading for developers who might rely on the stderr field for error handling, leading to incorrect logic. It would be beneficial to add a note about this behavior in the class's JSDoc to prevent confusion.

/**
 * SDK implementation of {@link AgentShell} that executes commands via the
 * core ShellExecutionService, subject to the agent's security policies.
 *
 * Commands that require interactive confirmation will be rejected since
 * no interactive session is available in headless SDK mode.
 *
 * @remarks In this implementation, stderr is combined into stdout by the
 * underlying ShellExecutionService. As a result, the stderr field of the
 * returned {@link AgentShellResult} will be empty, and both output and
 * stdout will contain the combined output.
 */

@fauzan171 fauzan171 force-pushed the docs/sdk-jsdoc-types branch from 744ca20 to 2200165 Compare April 30, 2026 19:20
@gemini-cli gemini-cli Bot added area/core Issues related to User Interface, OS Support, Core Functionality area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality area/documentation Gemini CLI documentation tasks and issues help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Apr 30, 2026
Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request May 1, 2026
…ini-cli)

- openai/codex#20564 — Enforce animations=false for screen readers (merge-as-is)
- openai/codex#20530 — Support multi-env filesystem tools (merge-after-nits)
- BerriAI/litellm#26956 — Fix MCP semantic filter native tool passthrough (merge-after-nits)
- google-gemini/gemini-cli#26277 — docs(sdk): add JSDoc to all exports (merge-as-is)
Add comprehensive JSDoc documentation to every exported interface,
type, class, and function in the SDK package:

- types.ts: SystemInstructions, GeminiCliAgentOptions, AgentFilesystem,
  AgentShellOptions, AgentShellResult, AgentShell, SessionContext
- tool.ts: ModelVisibleError, ToolDefinition, Tool, SdkTool, tool()
- skills.ts: SkillReference
- agent.ts: GeminiCliAgent, session(), resumeSession()
- session.ts: GeminiCliSession, id, initialize(), sendStream()
- fs.ts: SdkAgentFilesystem
- shell.ts: SdkAgentShell

Each doc includes descriptions, @param, @returns, @throws, @typeparam,
and @example tags where appropriate.

Fixes google-gemini#21505
@scidomino scidomino force-pushed the docs/sdk-jsdoc-types branch from 2200165 to 7e93a5d Compare May 4, 2026 19:19
@scidomino
Copy link
Copy Markdown
Collaborator

I fixed the merge conflict.

@scidomino scidomino enabled auto-merge May 4, 2026 19:21
@scidomino scidomino added this pull request to the merge queue May 4, 2026
Merged via the queue into google-gemini:main with commit 7887794 May 4, 2026
27 checks passed
TirthNaik-99 pushed a commit to TirthNaik-99/gemini-cli that referenced this pull request May 4, 2026
kimjune01 pushed a commit to kimjune01/gemini-cli-claude that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality area/core Issues related to User Interface, OS Support, Core Functionality area/documentation Gemini CLI documentation tasks and issues help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(sdk): add JSDoc to exported interfaces in packages/sdk/src/types.ts

2 participants