Skip to content

[WIP] Create relteX CLI tool in Go for managing UI components#1

Merged
Jeccoman merged 1 commit into
mainfrom
copilot/build-reltex-cli-tool
Jan 8, 2026
Merged

[WIP] Create relteX CLI tool in Go for managing UI components#1
Jeccoman merged 1 commit into
mainfrom
copilot/build-reltex-cli-tool

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 8, 2026

Implementation Plan for relteX CLI Tool

  • Set up project structure and dependencies
    • Create go.mod with required dependencies
    • Create main.go entry point
    • Create .gitignore file
    • Create LICENSE file
  • Implement core packages
    • Create internal/config package (config.go)
    • Create internal/registry package (registry.go, fetcher.go)
    • Create internal/component package (installer.go)
    • Create internal/utils package (files.go)
  • Implement CLI commands
    • Create cmd/root.go with Cobra setup
    • Create cmd/init.go for project initialization
    • Create cmd/add.go for adding components
    • Create cmd/list.go for listing components
    • Create cmd/diff.go for comparing components
  • Create documentation and CI/CD
    • Write comprehensive README.md
    • Create GitHub Actions release workflow
  • Test and validate
    • Build the project
    • Test all commands manually
    • Verify error handling
Original prompt

Build Complete relteX CLI Tool in Go

Create a fully functional CLI tool in Go to help developers easily add and manage relteX-UI components in their React Native projects.

Context

relteX-UI is a React Native UI library (similar to shadcn/ui for React) with 35+ components. The registry is located at:

Complete Project Structure Required

relteX-cli/
├── main.go
├── go.mod
├── .gitignore
├── README.md
├── LICENSE
├── cmd/
│   ├── root.go
│   ├── init.go
│   ├── add.go
│   ├── list.go
│   └── diff.go
├── internal/
│   ├── config/
│   │   └── config.go
│   ├── registry/
│   │   ├── registry.go
│   │   └── fetcher.go
│   ├── component/
│   │   └── installer.go
│   └── utils/
│       └── files.go
└── .github/
    └── workflows/
        └── release.yml

Detailed Implementation Requirements

1. Main Entry Point (main.go)

package main

import (
	"github.com/relteX-UI/relteX-cli/cmd"
)

func main() {
	cmd.Execute()
}

2. Go Module (go.mod)

module github.com/relteX-UI/relteX-cli

go 1.21

require (
	github.com/briandowns/spinner v1.23.0
	github.com/fatih/color v1.16.0
	github.com/olekukonko/tablewriter v0.0.5
	github.com/spf13/cobra v1.8.0
	github.com/spf13/viper v1.18.2
)

3. Root Command (cmd/root.go)

  • Set up Cobra CLI framework
  • Version: 1.0.0
  • Global flags: --verbose, --config
  • Initialize Viper for configuration management
  • Handle config file loading from reltex.json

4. Init Command (cmd/init.go)

Command: reltex init

Functionality:

  • Check if package.json exists (validate React Native project)
  • Create reltex.json with default configuration:
    {
      "registry": "https://raw.githubusercontent.com/relteX-UI/relteX/main/registry.json",
      "componentsDir": "./components/ui",
      "utils": "./lib/utils.ts",
      "style": "default"
    }
  • Create components directory (./components/ui)
  • Create lib directory
  • Create utils.ts file with cn helper function:
    import { clsx, type ClassValue } from "clsx";
    import { twMerge } from "tailwind-merge";
    
    export function cn(...inputs: ClassValue[]) {
      return twMerge(clsx(inputs));
    }
  • Display success message with next steps
  • Use colored output (green for success, cyan for info)

5. Add Command (cmd/add.go)

Command: reltex add <component...> or reltex add --all

Functionality:

  • Load configuration from reltex.json
  • Support multiple component names as arguments
  • Support --all flag to install all components
  • For each component:
    1. Fetch registry from configured URL
    2. Find component in registry by name
    3. Install registry dependencies first (recursive)
    4. Download component files from GitHub raw URLs
    5. Save to configured components directory
    6. Parse and install npm dependencies
    7. Show progress with spinner
    8. Display success/failure for each component
  • Handle errors gracefully
  • Skip react-native from dependencies (already installed)
  • Use npm or yarn (detect which is available)

Example URLs:

6. List Command (cmd/list.go)

Command: reltex list

Functionality:

  • Fetch registry from configured URL (or default if no config)
  • Display all components in a formatted table with:
    • Name
    • Description (truncated to 40 chars)
    • Dependencies count
    • Status (Installed/Available)
  • Check which components are already installed locally
  • Use tablewriter for nice formatting
  • Use colors: cyan for headers, green for installed components
  • Show total count

7. Diff Command (cmd/diff.go)

Command: reltex diff <component>

Functionality:

  • Load configuration
  • Check if component exists locally
  • Fetch latest version from registry
  • Compare file hashes (SHA256)
  • Display if component is up-to-date or has updates
  • Suggest update command if different
  • Use colors: green for up-to-date, yellow for updates available

8. Config Package (internal/config/config.go)

type Config struct {
	Registry      string `json:"registry"`
	ComponentsDir string `json:"componentsDir"`
	Utils         string `json:"utils"`
	Style         string `json:"style"`
}

Functions:

  • LoadConfig() - Load from reltex.json
  • Save() - Save config to file
  • Handle JSON marshaling/unmarshaling
  • Error handling for missing files

9. Registry Package (internal/registry/registry.go)

type Component struct {
	Name                 string         `json:"name"`
	Type                 string         `json:"type"`
	Title                string         `json:"title"`
	Description          string         `json:"description"`
	Files                []RegistryFile `json:"files"`
	Dependencies  ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

@Jeccoman Jeccoman marked this pull request as ready for review January 8, 2026 08:08
@Jeccoman Jeccoman requested a review from Copilot January 8, 2026 08:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Jeccoman Jeccoman merged commit 42a0b7c into main Jan 8, 2026
1 check failed
Copilot AI requested a review from Jeccoman January 8, 2026 08:09
Copilot stopped work on behalf of Jeccoman due to an error January 8, 2026 08:09
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.

3 participants