Skip to content

feat(cfl): port space key in page view/search #42

Closed

Description

@rianjs

Port space key display improvements from confluence-cli PR #104.

Files to modify:

  • tools/cfl/api/search.go - Extract space key from search results
  • tools/cfl/internal/cmd/page/view.go - Display space key
  • tools/cfl/internal/cmd/search/search.go - Add SPACE KEY column
  • Tests for each

Features:

page view:

  • Table/plain: Display space key alongside space ID (e.g., Space: DEV (ID: 9999))
  • JSON: Enrich with spaceKey field via GetSpace API call

search:

  • Add SPACE KEY column from resultGlobalContainer.displayUrl

Graceful fallback if space lookup fails.

Source: open-cli-collective/confluence-cli#104

Activity

  1. rianjs commented on Jan 31, 2026

    @rianjs
    ContributorAuthor

    Implementation Plan

    1. page view - Add space key display

    • Add SpaceID field to Page struct if not already present (it is - checking)
    • After fetching page, call GetSpace(spaceID) to get space key
    • Display as Space: DEV (ID: 9999) in table/plain output
    • For JSON output, enrich the page object with spaceKey field
    • Graceful fallback: if GetSpace fails, just show space ID

    2. search - Add SPACE KEY column

    • Add helper function to extract space key from resultGlobalContainer.displayUrl
      • URL format: /spaces/SPACEKEY/... or /wiki/spaces/SPACEKEY/...
    • Change headers from ["ID", "TYPE", "SPACE", "TITLE"] to ["ID", "TYPE", "SPACE KEY", "TITLE"]
    • Extract space key from displayUrl instead of using space title

    3. Tests

    • Test page view with space key lookup
    • Test page view graceful fallback when space lookup fails
    • Test search space key extraction from displayUrl
    • Table-driven tests for extractSpaceKey helper
  2. added 2 commits that reference this issue on Jan 31, 2026
    a462993
    fc75af0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions