Skip to content

feat: list command defaults to auto-pagination when --limit is not sp…#149

Merged
rsonghuster merged 1 commit intomasterfrom
feat/list-auto-pagination
May 4, 2026
Merged

feat: list command defaults to auto-pagination when --limit is not sp…#149
rsonghuster merged 1 commit intomasterfrom
feat/list-auto-pagination

Conversation

@rsonghuster
Copy link
Copy Markdown
Contributor

@rsonghuster rsonghuster commented May 4, 2026

…ecified

When no --limit is passed, the list command now uses listFunctions which auto-paginates through all functions. When --limit is explicitly set, it still uses listFunctionsPage for single-page results with nextToken support.

Also includes:

  • Input validation for --limit (must be a positive integer)
  • Extracted LIST_TABLE_KEYS constant to eliminate duplication
  • Increased listFunctions batch size from 2 to 100 for performance

Change-Id: I54d5f7f36ec5c03117465d03dea0ce1f641e3420
Co-developed-by: Claude noreply@anthropic.com

Summary by CodeRabbit

  • New Features

    • Added list command to retrieve functions with support for region specification, prefix filtering, custom pagination limits, continuation tokens, and formatted table output.
  • Tests

    • Added test coverage for the list command.
  • Chores

    • Version updated to 0.1.19.

…ecified

When no --limit is passed, the list command now uses listFunctions which
auto-paginates through all functions. When --limit is explicitly set, it
still uses listFunctionsPage for single-page results with nextToken support.

Also includes:
- Input validation for --limit (must be a positive integer)
- Extracted LIST_TABLE_KEYS constant to eliminate duplication
- Increased listFunctions batch size from 2 to 100 for performance

Change-Id: I54d5f7f36ec5c03117465d03dea0ce1f641e3420
Co-developed-by: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d646b6e1-b707-47a3-bb6d-0bb8a09aa5ff

📥 Commits

Reviewing files that changed from the base of the PR and between 1586992 and 6adf276.

📒 Files selected for processing (8)
  • .gitignore
  • __tests__/ut/commands/list_test.ts
  • publish.yaml
  • src/commands-help/index.ts
  • src/commands-help/list.ts
  • src/index.ts
  • src/resources/fc/impl/client.ts
  • src/subCommands/list/index.ts

📝 Walkthrough

Walkthrough

A new list subcommand is added to the Fc SDK, enabling listing of functions with optional prefix filtering, pagination control, and table-formatted output. The implementation includes argument parsing, region validation, SDK client integration, comprehensive tests, help documentation, and updated client methods.

Changes

List Subcommand Feature

Layer / File(s) Summary
Client Methods
src/resources/fc/impl/client.ts
Added listFunctionsPage(limit, prefix?, nextToken?) for single-page listing; increased per-request limit in listFunctions() from 2 to 100 for more efficient pagination.
Core Command Logic
src/subCommands/list/index.ts
Implements List class with argument parsing (--region, --prefix, --limit, --next-token, --table), region validation, SDK client instantiation, and run() method that conditionally calls paginated or single-page list methods and renders table output when requested.
Integration & Wiring
src/index.ts, src/commands-help/index.ts
Exposes public async list(inputs: IInputs) method in Fc class; registers list command in commands-help index.
Help Documentation
src/commands-help/list.ts
Exports help definition for list command with description, usage examples, summary, and documented CLI options.
Tests
__tests__/ut/commands/list_test.ts
Comprehensive Jest suite validating constructor behavior (region precedence), auto-pagination mode (listFunctions), single-page mode with --limit, validation of --limit as positive integer, table rendering, and error propagation from API calls.
Configuration & Metadata
.gitignore, publish.yaml
Updated .gitignore to ignore .env, .qoder, and docs/ directory; bumped component version from 0.1.18 to 0.1.19.

Sequence Diagram

sequenceDiagram
    participant User as User/CLI
    participant List as List Command
    participant FC as FC SDK
    participant API as FC API
    
    User->>List: invoke with args<br/>(--region, --limit, --prefix, --table)
    List->>List: parse & validate args
    List->>List: resolve region from props/args
    List->>FC: instantiate FC client<br/>(credentials, region, user-agent)
    alt --limit provided
        List->>FC: listFunctionsPage(limit, prefix?, nextToken?)
    else auto-pagination
        List->>FC: listFunctions(prefix?)
        loop while nextToken exists
            FC->>API: fetch next page
            API-->>FC: return page
        end
    end
    FC->>API: call FC SDK
    API-->>FC: return functions list
    alt --table flag
        List->>List: render table<br/>(tableShow)
    end
    List-->>User: return results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through the codebase with glee,
New list commands now work—one, two, three!
With pagination and tables so bright,
And tests to ensure everything's right! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/list-auto-pagination

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@rsonghuster rsonghuster merged commit 35e5bfe into master May 4, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant