diff --git a/.agents/skills/containdb-development/SKILL.md b/.agents/skills/containdb/SKILL.md similarity index 99% rename from .agents/skills/containdb-development/SKILL.md rename to .agents/skills/containdb/SKILL.md index bb8a23a..f6cc788 100644 --- a/.agents/skills/containdb-development/SKILL.md +++ b/.agents/skills/containdb/SKILL.md @@ -1,5 +1,5 @@ --- -name: containdb-development +name: containdb description: Development rules and patterns for ContainDB CLI tool version: 1.0.0 tags: [golang, docker, cli, cross-platform, containers] diff --git a/.codex/config.toml b/.codex/config.toml deleted file mode 100644 index a9e89ee..0000000 --- a/.codex/config.toml +++ /dev/null @@ -1,68 +0,0 @@ -# OpenAI Codex CLI Configuration for ContainDB - -[project] -name = "ContainDB" -description = "Database Container Management CLI Tool" -language = "Go" -runtime = "Go ≥1.18" - -[model] -default = "gpt-4-turbo" -temperature = 0.2 -max_tokens = 4096 - -[approval] -mode = "strict" -ask_before_install = true -ask_before_delete = true -ask_before_build = true - -[build] -command = "go build -o containdb src/Core/main.go" -required = true -run_after_changes = true - -[test] -command = "go test ./..." -required = true - -[style] -use_go_fmt = true -use_go_vet = true -error_handling = "descriptive_with_context" - -[rules] -cross_platform = true -docker_sdk_only = true -auto_rollback = true -interactive_prompts = true -no_hardcoded_secrets = true - -[security] -validate_inputs = true -no_log_passwords = true -warn_root_required = true -use_docker_networks = true - -[documentation] -update_readme = true -update_design = true -update_installation = true -update_changelog = true - -[antipatterns] -no_platform_specific_without_fallback = true -no_hardcoded_credentials = true -no_docker_commands = true -no_breaking_cli_changes = true -no_incomplete_rollback = true - -[completion] -required = [ - "go build passes", - "go test ./... passes", - "Works on Linux, macOS, Windows", - "Documentation updated", - "Backward compatible", - "Auto-rollback implemented" -] diff --git a/.cursor/rules/containdb-core.mdc b/.cursor/rules/containdb-core.mdc deleted file mode 100644 index f7a9486..0000000 --- a/.cursor/rules/containdb-core.mdc +++ /dev/null @@ -1,140 +0,0 @@ -# ContainDB Core Rules for Cursor IDE - -## Project Context - -**ContainDB** is a CLI tool for managing containerized databases. Written in Go, cross-platform (Linux/macOS/Windows), distributed via npm and native binaries. - -## Mandatory Workflows - -### After EVERY Code Change -```bash -go build -o containdb src/Core/main.go -go test ./... -go fmt ./... -go vet ./... -``` - -### For ANY Feature Change -1. Test on Linux, macOS, Windows -2. Update docs (README, DESIGN, INSTALLATION) -3. Verify auto-rollback works -4. Test error scenarios - -## Definition of "Done" - -- ✅ `go build` passes -- ✅ `go test ./...` passes -- ✅ Works on all platforms -- ✅ Documentation updated -- ✅ Backward compatible -- ✅ Auto-rollback implemented -- ✅ Clear error messages - -## Architecture - -### Layers -``` -CLI (main.go) → Base Operations → Docker SDK → Docker Engine -``` - -### Structure -``` -src/ -├── Core/main.go # Entry point -├── base/ # Logic (Create, Remove, Export, Import) -├── Docker/ # SDK wrapper -└── tools/ # Management tools -``` - -## Go Standards - -### Error Handling -```go -// ✅ REQUIRED -if err != nil { - return fmt.Errorf("failed to create container '%s': %w", name, err) -} - -// ❌ FORBIDDEN -if err != nil { - return err -} -``` - -### Type Safety -```go -// ✅ Use structs -type ContainerOptions struct { - Name string - Image string - Port int -} - -// ❌ Too many params -func Create(name, image string, port int) error -``` - -## Key Patterns - -### Auto-Rollback (CRITICAL) -```go -created := []string{} -defer func() { - if err != nil { - for _, id := range created { - cleanup(id) - } - } -}() -``` - -### Docker SDK (NOT Commands) -```go -// ✅ Use SDK -import "github.com/docker/docker/client" - -cli, err := client.NewClientWithOpts(client.FromEnv) - -// ❌ Don't execute commands -exec.Command("docker", "run", ...) -``` - -### Interactive Prompts -```go -// ✅ Prompt for passwords -password := promptSecure("Enter password:") - -// ❌ No hardcoded defaults -password := "password123" -``` - -## Security - -- Never log passwords -- Validate all inputs (ports, names) -- Warn about root requirements -- Use Docker networks for isolation - -## Testing - -- Unit tests for core logic -- Integration tests for CLI -- Test on Linux, macOS, Windows -- Test error scenarios - -## Anti-Patterns (FORBIDDEN) - -❌ Platform-specific code without fallbacks -❌ Hardcoded credentials -❌ Direct docker commands -❌ Breaking CLI interface -❌ Missing error handling -❌ Incomplete rollback - -## Success Criteria - -- ✅ Builds successfully -- ✅ Tests pass -- ✅ Works cross-platform -- ✅ Docs updated -- ✅ Backward compatible diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/ContainDB.iml b/.idea/ContainDB.iml deleted file mode 100644 index 5e764c4..0000000 --- a/.idea/ContainDB.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/dictionaries/project.xml b/.idea/dictionaries/project.xml deleted file mode 100644 index 9125995..0000000 --- a/.idea/dictionaries/project.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - containdb - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index e47f639..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/GEMINI.md b/GEMINI.md deleted file mode 100644 index 38d9cf3..0000000 --- a/GEMINI.md +++ /dev/null @@ -1,151 +0,0 @@ -# GEMINI.md - -This file provides guidance to Gemini Code Assist when working with code in this repository. - -## Project Overview - -**ContainDB** - Database Container Management CLI Tool - -- **Language**: Go ≥1.18 -- **Type**: CLI for Docker database management -- **Platform**: Linux, macOS, Windows -- **Distribution**: npm + native binaries - -## Commands - -```bash -# Build & Run -go build -o containdb src/Core/main.go -go run src/Core/main.go -./Scripts/BinBuilder.sh # Multi-platform build - -# Test & Lint -go test ./... -go fmt ./... -go vet ./... -``` - -## Core Rules (NON-NEGOTIABLE) - -1. **Cross-platform**: Must work on Linux, macOS, Windows -2. **ALWAYS test**: Test on all platforms before release -3. **ALWAYS build**: Run `go build` after changes -4. **Docker API only**: Use SDK, not direct commands -5. **Auto-rollback**: Cleanup on failures -6. **Update docs**: README, DESIGN, INSTALLATION - -## Architecture - -### Layers -``` -CLI (main.go) - ↓ -Base Operations (src/base/) - ↓ -Docker Abstraction (src/Docker/) - ↓ -Docker Engine -``` - -### Structure -``` -src/ -├── Core/ # main.go -├── base/ # Business logic -│ ├── Create.go -│ ├── Remove.go -│ ├── Export.go -│ └── Import.go -├── Docker/ # Docker SDK wrapper -└── tools/ # Management tools -``` - -## Go Standards - -### Error Handling -```go -// ✅ GOOD -if err != nil { - return fmt.Errorf("failed to create container '%s': %w", name, err) -} - -// ❌ BAD -if err != nil { - return err -} -``` - -### Type Safety -```go -// ✅ Use structs -type ContainerOptions struct { - Name string - Image string - Port int -} - -// ❌ Too many params -func Create(name, image string, port int) error -``` - -## Key Patterns - -### Auto-Rollback -```go -created := []string{} -defer func() { - if err != nil { - for _, id := range created { - cleanup(id) - } - } -}() -``` - -### Docker SDK -```go -// ✅ Use Docker SDK -import "github.com/docker/docker/client" - -cli, err := client.NewClientWithOpts(client.FromEnv) - -// ❌ Don't execute commands -exec.Command("docker", "run", ...) -``` - -## Documentation - -Update when features change: -- `README.md` - Usage, installation -- `DESIGN.md` - Architecture -- `INSTALLATION.md` - Platform guides -- Code comments for exported functions - -## Security - -- Never log passwords -- Validate all inputs -- Warn about root requirements -- Use Docker networks for isolation - -## Testing - -- Unit tests for core logic -- Integration tests for CLI -- Cross-platform testing -- Error case scenarios - -## Supported Systems - -- MySQL, PostgreSQL, MariaDB -- MongoDB, Redis -- phpMyAdmin, pgAdmin, RedisInsight - -## Definition of "Done" - -- ✅ `go build` passes -- ✅ `go test ./...` passes -- ✅ Works on Linux, macOS, Windows -- ✅ Documentation updated -- ✅ Backward compatible -- ✅ Auto-rollback works diff --git a/INSTALLATION.md b/INSTALLATION.md index 25e96e4..f5a033a 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -19,10 +19,10 @@ This is the simplest method for Debian-based systems like Ubuntu, Debian, Linux ```bash # Download the latest .deb release -wget https://github.com/nexoral/ContainDB/releases/download/v9.20.46-stable/containDB_9.20.46-stable_amd64.deb +wget https://github.com/nexoral/ContainDB/releases/download/v9.20.47-stable/containDB_9.20.47-stable_amd64.deb # Install the package -sudo dpkg -i containDB_9.20.46-stable_amd64.deb +sudo dpkg -i containDB_9.20.47-stable_amd64.deb # If you see dependency errors, run: sudo apt-get install -f diff --git a/Scripts/installer.sh b/Scripts/installer.sh index 20449d1..09f2c36 100755 --- a/Scripts/installer.sh +++ b/Scripts/installer.sh @@ -7,7 +7,7 @@ ARCH=$(dpkg --print-architecture) echo "Detected architecture: $ARCH" -VERSION="9.20.46-stable" +VERSION="9.20.47-stable" if [[ "$ARCH" == "amd64" ]]; then PKG="containdb_${VERSION}_amd64.deb" diff --git a/VERSION b/VERSION index 8bbc39e..804e998 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.20.46-stable +9.20.47-stable diff --git a/codebase-map.md b/codebase-map.md deleted file mode 100644 index 1764059..0000000 --- a/codebase-map.md +++ /dev/null @@ -1,166 +0,0 @@ -# ContainDB -24 files | 2272 logic lines - -## Tree -``` -ContainDB/ -├─ npm -│ └─ InstallController.js -└─ src - ├─ base - │ ├─ Banner.go - │ ├─ BaseCaseHandler.go - │ ├─ DatabaseSelector.go - │ ├─ DockerStarterPack.go - │ ├─ FilePathSelector.go - │ ├─ flagHandler.go - │ └─ StartContainer.go - ├─ Core - │ └─ main.go - ├─ Docker - │ ├─ docker_container.go - │ ├─ docker_installation.go - │ ├─ Docker_Network.go - │ ├─ docker.go - │ ├─ DockerComposeMaker.go - │ ├─ ImportDockerServices.go - │ ├─ platform.go - │ └─ SysRequirement.go - └─ tools - ├─ AfterContainerToolInstaller.go - ├─ askForInput.go - ├─ MongoDB_Tools.go - ├─ PgAdmin.go - ├─ PhpMyAdmin.go - ├─ Redis_Insight.go - └─ rollback.go -``` - -## Modules - -### npm -**InstallController.js** (29L) -deps:child_process,path,os - -### src/Core -**main.go** (76L) -pkg:main | uses:Docker,base,tools,fmt,os,signal,runtime - main() @13 - -### src/Docker -**DockerComposeMaker.go** (275L) -pkg:Docker | uses:fmt,os,exec,filepath,strings,template -structs: ContainerInfo - MakeDockerComposeWithAllServices() -> string [E] @26 - getContainerInfo(containerName) -> (ContainerInfo, error) @82 - generateComposeYAML(containers) -> string @248 -**Docker_Network.go** (16L) -pkg:Docker | uses:os,exec - CreateDockerNetworkIfNotExists() -> error [E] @8 -**ImportDockerServices.go** (103L) -pkg:Docker | uses:errors,fmt,ioutil,net,os,exec,strings,yaml.v2 -structs: DockerComposeConfig, DockerComposeService - ImportDockerServices(composeFilePath) -> error [E] @31 - volumeExists(name) -> bool @108 - getRunningContainers() -> ([]string, error) @115 - isPortAvailable(port) -> bool @125 -**SysRequirement.go** (147L) -pkg:Docker | uses:fmt,os,exec,runtime,strconv,strings - CheckSystemRequirements() [E] @12 - checkDockerInstallation() -> error @35 - checkRAM(minGB) -> error @46 - checkDiskSpace(minGB) -> error @115 -**docker.go** (139L) -pkg:Docker | uses:fmt,os,exec,strings - ListRunningDatabases() -> ([]string, error) [E] @11 - RemoveDatabase(name) -> error [E] @28 - ListDatabaseImages() -> ([]string, error) [E] @68 - IsImageInUse(image) -> (bool, string, error) [E] @103 - RemoveImage(image) -> error [E] @123 - ListContainDBVolumes() -> ([]string, error) [E] @134 - IsVolumeInUse(volume) -> (bool, string, error) [E] @168 -**docker_container.go** (92L) -pkg:Docker | uses:fmt,os,exec,strings,promptui - AskYesNo(label) -> bool [E] @12 - IsContainerRunning(nameOrImage, checkByName) -> bool [E] @31 - ListOfContainers(images) -> []string [E] @42 - VolumeExists(name) -> bool [E] @83 - CreateVolume(name) -> error [E] @90 - RemoveVolume(name) -> error [E] @98 -**docker_installation.go** (161L) -pkg:Docker | uses:fmt,os,exec,runtime - IsDockerInstalled() -> bool [E] @10 - InstallDocker() -> error [E] @16 - installDockerLinux() -> error @31 - installDockerWindows() -> error @59 - installDockerMacOS() -> error @76 - UninstallDocker() -> error [E] @120 - uninstallDockerLinux() -> error @135 - uninstallDockerWindows() -> error @158 - uninstallDockerMacOS() -> error @172 -**platform.go** (91L) -pkg:Docker | uses:fmt,os,exec,runtime - IsAdmin() -> bool [E] @12 - GetTempDir() -> string [E] @25 - IsWindows() -> bool [E] @33 - IsMacOS() -> bool [E] @38 - IsLinux() -> bool [E] @43 - GetOSName() -> string [E] @48 - CheckOSSupport() -> error [E] @62 - GetOSRelease() -> string [E] @75 - CheckDockerCommand(cmd) -> error [E] @88 - GetShell() -> string [E] @98 - ExecuteCommand(name, args) -> *exec.Cmd [E] @114 - BuildDockerRunCommand(args) -> []string [E] @119 - -### src/base -**Banner.go** (51L) -pkg:base | uses:fmt,os,runtime,strings,color - ShowBanner() [E] @14 -**BaseCaseHandler.go** (230L) -pkg:base | uses:Docker,tools,fmt,os,exec,runtime,promptui - BaseCaseHandler() [E] @14 -**DatabaseSelector.go** (24L) -pkg:base | uses:tools,fmt,os,promptui - SelectDatabase() -> string [E] @11 -**DockerStarterPack.go** (28L) -pkg:base | uses:Docker,fmt,os,promptui - DockerStarter() [E] @11 -**FilePathSelector.go** (96L) -pkg:base | uses:fmt,os,filepath,strings,promptui - SelectFilePath(label, defaultPath, extension) -> (string, error) [E] @13 -**StartContainer.go** (146L) -pkg:base | uses:Docker,tools,fmt,os,exec,strings,promptui - StartContainer(database) [E] @14 -**flagHandler.go** (50L) -pkg:base | uses:Docker,fmt,os - FlagHandler() [E] @10 - -### src/tools -**AfterContainerToolInstaller.go** (47L) -pkg:tools | uses:Docker,fmt - AfterContainerToolInstaller(database) [E] @22 -**MongoDB_Tools.go** (70L) -pkg:tools | uses:Docker,fmt,io,http,os,exec,filepath,runtime - DownloadMongoDBCompass() [E] @14 -**PgAdmin.go** (93L) -pkg:tools | uses:Docker,fmt,os,exec,strings,promptui - StartPgAdmin() [E] @13 -**PhpMyAdmin.go** (185L) -pkg:tools | uses:Docker,fmt,os,exec,strings,promptui -structs: CloudDBConfig - StartPHPMyAdmin() [E] @23 - selectConnectionType(hasLocalContainers) -> string @62 - startPHPMyAdminLocal(sqlContainers) @91 - startPHPMyAdminCloud() @139 - getCloudConnectionConfig() -> CloudDBConfig @209 -**Redis_Insight.go** (72L) -pkg:tools | uses:Docker,fmt,os,exec,strings,promptui - StartRedisInsight() [E] @13 -**askForInput.go** (17L) -pkg:tools | uses:bufio,fmt,os,strings - AskForInput(label, defaultValue) -> string [E] @10 -**rollback.go** (34L) -pkg:tools | uses:Docker,fmt,os,exec,filepath,strings - Cleanup() [E] @13 - diff --git a/npm/package.json b/npm/package.json index 37c3f45..eb50e42 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "containdb", - "version": "9.20.46", + "version": "9.20.47", "description": "The Ultimate Docker Database Manager. Automate the creation, management, and monitoring of containerized databases (MongoDB, MySQL, PostgreSQL, Redis) and their GUI tools (Compass, phpMyAdmin, PgAdmin, RedisInsight) with a simple CLI. No complex Docker commands—just productivity.", "bin": { "containdb": "./InstallController.js" diff --git a/src/Core/main.go b/src/Core/main.go index 0927f3e..e5cad63 100644 --- a/src/Core/main.go +++ b/src/Core/main.go @@ -11,7 +11,7 @@ import ( ) func main() { - VERSION := "9.20.46-stable" + VERSION := "9.20.47-stable" // handle version flag without requiring sudo if len(os.Args) > 1 && os.Args[1] == "--version" { diff --git a/src/base/Banner.go b/src/base/Banner.go index aaba3df..cbfbada 100644 --- a/src/base/Banner.go +++ b/src/base/Banner.go @@ -9,7 +9,7 @@ import ( "github.com/fatih/color" ) -const Version = "9.20.46-stable" +const Version = "9.20.47-stable" func ShowBanner() { // Define styles