Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

navigator

БесплатноБез исполняемых скриптовНе проверен

Working with the Navigator Go submodule for web server fixes and enhancements. Use when deployment plans require Navigator changes, config parsing issues…

rubysот rubys★ 37 звёзд на GitHub14 установок в других каталогах

Об этом скилле

Navigator Submodule Development

Why Navigator is a Submodule

Navigator is included as a Git submodule because showcase routinely needs Navigator fixes to implement deployment plans. Changes are tested in showcase context before being pushed upstream.

Location: navigator/ (Git submodule) Language: Go Purpose: Multi-tenant web server with framework independence

Project Structure

navigator/
├── cmd/navigator/            # Production Navigator implementation
├── internal/                  # Modular packages
│   ├── config/               # Configuration loading and parsing
│   ├── server/               # HTTP handling, routing, static files
│   ├── auth/                 # Authentication (htpasswd)
│   ├── process/              # Web app lifecycle management
│   └── proxy/                # Reverse proxy and Fly-Replay
└── docs/                     # MkDocs documentation

Critical Architecture: Configuration Flow

Understanding this flow is essential for fixing config-related bugs:

  1. YAML file (user-facing config)
  2. YAMLConfig struct in types.go (mirrors YAML structure with yaml tags)
  3. ConfigParser in parser.go (converts YAML to internal format)
  4. Config struct in types.go (optimized internal representation)

Common Bug Pattern: When adding config fields, developers often:

  • ✅ Add field to Config struct (internal)
  • ❌ FORGET to add field to YAMLConfig struct
  • ❌ FORGET to add parsing logic in parser.go
  • Result: YAML config is valid but silently ignored!

Request Flow in Handler (Order Matters!)

// From internal/server/handler.go ServeHTTP()
1. Health checks      // BEFORE everything (bypasses auth)
2. Authentication     // EARLY check (before routing)
3. Rewrites/redirects
4. CGI scripts
5. Reverse proxies
6. Static files
7. Maintenance mode
8. Web app proxy      // Tenant routing

Security Critical: Health checks MUST come before auth. Auth MUST come before tenant routing.

Common Development Tasks

Adding a New Config Option

Example: Health Check Config (Recent Fix)

Step 1: Add to YAMLConfig in internal/config/types.go:

type YAMLConfig struct {
    Server struct {
        // ... other fields
        HealthCheck HealthCheckConfig `yaml:"health_check"` // ← Must have yaml tag
    } `yaml:"server"`
}

Step 2: Add to internal Config (if different structure needed):

type Config struct {
    Server struct {
        // ... other fields
        HealthCheck HealthCheckConfig
    }
}

Step 3: Add parsing logic in internal/config/parser.go:

func (p *ConfigParser) parseServerConfig() {
    // ... other parsing
    p.config.Server.HealthCheck = p.yamlConfig.Server.HealthCheck // ← CRITICAL
}

Step 4: Add tests in internal/config/parser_test.go:

func TestConfigParser_ParseHealthCheck(t *testing.T) {
    yamlConfig := YAMLConfig{}
    yamlConfig.Server.HealthCheck = HealthCheckConfig{
        Path: "/up",
        Response: &HealthCheckResponse{Status: 200, Body: "OK"},
    }

    parser := NewConfigParser(&yamlConfig)
    config, err := parser.Parse()

    if config.Server.HealthCheck.Path != "/up" {
        t.Errorf("HealthCheck not parsed correctly")
    }
}

Step 5: Add integration tests in internal/server/handler_test.go (or appropriate file).

Adding Handler Behavior

Example: Health Check Handler (Recent Fix)

// Add early in ServeHTTP - order matters!
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    // Health checks BEFORE authentication
    if h.config.Server.HealthCheck.Path != "" && r.URL.Path == h.config.Server.HealthCheck.Path {
        h.handleHealthCheck(recorder, r)
        return  // Stop processing
    }

    // Authentication check comes next
    // ... rest of handler
}

Integration Test (Security Critical):

func TestHandler_ServeHTTP_HealthCheckBeforeAuth(t *testing.T) {
    cfg := &config.Config{}
    cfg.Server.HealthCheck = config.HealthCheckConfig{
        Path: "/up",
        Response: &config.HealthCheckResponse{Status: 200, Body: "OK"},
    }
    cfg.Auth.Enabled = true  // Enable auth

    basicAuth := &auth.BasicAuth{}
    handler := CreateTestHandler(cfg, nil, basicAuth, nil)

    req := httptest.NewRequest("GET", "/up", nil)
    // NO auth credentials provided
    recorder := httptest.NewRecorder()
    handler.ServeHTTP(recorder, req)

    // MUST succeed without auth - critical security requirement
    if recorder.Code != 200 {
        t.Errorf("Health check should bypass auth")
    }
}

Testing Requirements

Test Checklist

  • Config parser tests (internal/config/parser_test.go)

    • YAML unmarshaling works
    • Parsing logic copies fields correctly
    • Default values applied
    • Edge cases (empty, nil)
  • Integration tests (appropriate *_test.go)

    • Full request/response through ServeHTTP
    • Security implications (especially auth bypass s
Полный SKILL.md на GitHub

Установить navigator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл navigator?

Working with the Navigator Go submodule for web server fixes and enhancements. Use when deployment plans require Navigator changes, config parsing issues arise, or new routing/proxy behavior is needed.

Как установить скилл navigator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл navigator запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить navigator с