Commit 1be643f4 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

doc cleanup

parent 20e1cc33
Loading
Loading
Loading
Loading
+29 −5
Changes for LISEZMOI.md: 29 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ Ce dossier contient l'implémentation de `climax`, la CLI utilisée pour gérer
- Les données de registre des projets sont stockées dans `~/.climax/projects.json`.
- `templates-list` et `static-list` gardent volontairement une sortie texte simple.
- `info`, `projects` et les commandes de bundles utilisent des tableaux stylisés.
- `demo` et `sync` résolvent les releases MaX connues depuis la liste de releases embarquée/active, à partir du nom de version. L'URL de version dans `config.xml` n'est utilisée qu'en fallback pour les versions inconnues.
- Les archives de release sont installées en détectant la structure source de MaX, sans supposer un nom fixe pour le dossier racine extrait.
- Les téléchargements sont mis en cache dans `~/.climax/cache`; les hits de cache restent silencieux, et la progression réseau n'est affichée que sur les terminaux interactifs.

## Prérequis de développement

@@ -60,13 +63,34 @@ Conseil : utilisez `CLIMAX_HOME` pour isoler l'état local pendant le développe
CLIMAX_HOME=/tmp/climax-dev-home go run . projects
```

## Notes de comportement des commandes

- `new` crée ou initialise un projet MaX et écrit `.gitignore` ainsi que `config.xml` si nécessaire.
- `demo` doit être lancée dans un projet MaX existant. Elle télécharge la release MaX configurée à partir du nom de version, copie `fixtures/` dans le projet, charge `fixtures/max` dans `.max/basex/data/max`, puis lance la synchronisation.
- `sync` installe ou rafraîchit `.max`, BaseX, Saxon, XML Resolver, les fichiers core MaX, les fichiers webapp, les ressources et les bundles configurés.
- `start` choisit des ports BaseX, HTTP et stop libres proches des valeurs demandées; les ports HTTP et stop sont volontairement distincts.
- `freeze` démarre un processus BaseXHTTP temporaire, parcourt le site local, réécrit les liens HTML/CSS copiés en chemins relatifs et tolère les ressources liées manquantes en 4xx.

## Organisation du code

- [`main.go`](./main.go) : définitions des commandes + implémentation
- [`main_test.go`](./main_test.go) : tests unitaires/fonctionnels
- [`cli_commands_test.go`](./cli_commands_test.go) : tests des commandes/flags/help
- [`packaging/windows-installer.nsi`](./packaging/windows-installer.nsi) : script NSIS d'installeur
- [`Makefile`](./Makefile) : workflows de build, test et packaging
- [`main.go`](./main.go) : constantes partagées, structures de données, snapshot de releases embarqué et démarrage.
- [`cli.go`](./cli.go) : construction des commandes Cobra et flags.
- [`commands.go`](./commands.go) : implémentations des commandes CLI ordinaires.
- [`config.go`](./config.go) : parsing de configuration MaX, lookup des releases et helpers de version.
- [`projects.go`](./projects.go) : registre de projets JSON et helpers de validation de projet.
- [`sync.go`](./sync.go) : création/synchronisation d'instance MaX et synchronisation des bundles.
- [`java.go`](./java.go) : découverte du runtime Java embarqué et construction des commandes BaseX.
- [`server.go`](./server.go) : helpers de démarrage/arrêt serveur.
- [`freeze.go`](./freeze.go) : serveur de freeze, crawler, mapping des chemins et réécriture des liens.
- [`download.go`](./download.go) : téléchargements cachés et progression interactive.
- [`archive.go`](./archive.go) : helpers filesystem et extraction sûre des archives.
- [`paths.go`](./paths.go) : initialisation des chemins de données/cache de la CLI.
- [`ui.go`](./ui.go) : tableaux, rendu de l'aide, prompts et confirmations.
- [`i18n.go`](./i18n.go) : chaînes localisées et résolution de locale.
- [`main_test.go`](./main_test.go) : tests unitaires/fonctionnels.
- [`cli_commands_test.go`](./cli_commands_test.go) : tests des commandes/flags/help.
- [`packaging/windows-installer.nsi`](./packaging/windows-installer.nsi) : script NSIS d'installeur.
- [`Makefile`](./Makefile) : workflows de build, test et packaging.

## Workflow des dépendances

+29 −5
Changes for README.md: 29 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@ This directory contains the implementation of `climax`, the CLI used to manage [
- Project registry data is stored in `~/.climax/projects.json`.
- `templates-list` and `static-list` intentionally keep plain output.
- `info`, `projects`, and bundle commands use styled table output.
- `demo` and `sync` resolve known MaX releases from the embedded/live release list by version name. A `config.xml` version URL is only used as a fallback for unknown versions.
- Release archives are installed by detecting the MaX source layout, not by assuming a fixed top-level archive directory name.
- Downloads are cached in `~/.climax/cache`; cache hits are silent, and network progress is only shown on interactive terminals.

## Development prerequisites

@@ -61,13 +64,34 @@ Tip: use `CLIMAX_HOME` to isolate local state while developing:
CLIMAX_HOME=/tmp/climax-dev-home go run . projects
```

## Command Behavior Notes

- `new` creates or initializes a MaX project and writes `.gitignore` plus `config.xml` when needed.
- `demo` must run in an existing MaX project. It downloads the configured MaX release by version name, copies release `fixtures/` into the project, loads `fixtures/max` into `.max/basex/data/max`, then runs sync.
- `sync` installs or refreshes `.max`, BaseX, Saxon, XML Resolver, MaX core files, webapp files, resources, and configured bundles.
- `start` chooses nearby free BaseX, HTTP, and stop ports; the HTTP and stop ports are deliberately distinct.
- `freeze` starts a temporary BaseXHTTP process, crawls the local site, rewrites mirrored HTML/CSS links to relative paths, and tolerates missing linked 4xx resources.

## Code Layout

- [`main.go`](./main.go): command definitions + implementation
- [`main_test.go`](./main_test.go): functional unit tests
- [`cli_commands_test.go`](./cli_commands_test.go): command wiring/flags/help tests
- [`packaging/windows-installer.nsi`](./packaging/windows-installer.nsi): NSIS installer script
- [`Makefile`](./Makefile): build, test, and packaging workflows
- [`main.go`](./main.go): shared constants, data shapes, embedded release snapshot, and startup.
- [`cli.go`](./cli.go): Cobra command construction and flags.
- [`commands.go`](./commands.go): ordinary CLI command implementations.
- [`config.go`](./config.go): MaX config parsing, release lookup, and version helpers.
- [`projects.go`](./projects.go): JSON project registry and project validation helpers.
- [`sync.go`](./sync.go): MaX instance creation/sync and bundle sync.
- [`java.go`](./java.go): bundled Java runtime discovery and BaseX command construction.
- [`server.go`](./server.go): start/stop server helpers.
- [`freeze.go`](./freeze.go): freeze server, crawler, path mapping, and link rewriting.
- [`download.go`](./download.go): cached downloads and interactive progress.
- [`archive.go`](./archive.go): filesystem helpers and safe archive extraction.
- [`paths.go`](./paths.go): CLI data/cache path initialization.
- [`ui.go`](./ui.go): tables, help rendering, prompts, and confirmations.
- [`i18n.go`](./i18n.go): localized user-facing strings and locale resolution.
- [`main_test.go`](./main_test.go): functional unit tests.
- [`cli_commands_test.go`](./cli_commands_test.go): command wiring/flags/help tests.
- [`packaging/windows-installer.nsi`](./packaging/windows-installer.nsi): NSIS installer script.
- [`Makefile`](./Makefile): build, test, and packaging workflows.

## Dependency Workflow

−10
Changes for go.sum: 0 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -15,10 +15,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6N
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/felixge/fgprof v0.9.5/go.mod h1:yKl+ERSa++RYOs32d8K6WEXCB4uXdLls4ZaZPpayhMM=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA=
github.com/gocolly/colly/v2 v2.3.0 h1:HSFh0ckbgVd2CSGRE+Y/iA4goUhGROJwyQDCMXGFBWM=
github.com/gocolly/colly/v2 v2.3.0/go.mod h1:Qp54s/kQbwCQvFVx8KzKCSTXVJ1wWT4QeAKEu33x1q8=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -32,10 +30,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jawher/mow.cli v1.1.0/go.mod h1:aNaQlc7ozF3vw6IJ2dHjp2ZFiA4ozMIYY6PyuRJwlUg=
github.com/jedib0t/go-pretty/v6 v6.7.8 h1:BVYrDy5DPBA3Qn9ICT+PokP9cvCv1KaHv2i+Hc8sr5o=
github.com/jedib0t/go-pretty/v6 v6.7.8/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU=
github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o=
@@ -44,7 +40,6 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/nlnwa/whatwg-url v0.6.2 h1:jU61lU2ig4LANydbEJmA2nPrtCGiKdtgT0rmMd2VZ/Q=
github.com/nlnwa/whatwg-url v0.6.2/go.mod h1:x0FPXJzzOEieQtsBT/AKvbiBbQ46YlL6Xa7m02M1ECk=
github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
@@ -73,13 +68,11 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
@@ -99,7 +92,6 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -124,7 +116,6 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
@@ -143,7 +134,6 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=