mirror of
https://github.com/kbenestad/mdcms.git
synced 2026-06-18 15:24:32 +00:00
Merge branch 'main' of github.com:kbenestad/mdcms
This commit is contained in:
commit
0a83ca7e38
3 changed files with 31 additions and 5 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Versioning rule
|
||||||
|
|
||||||
|
Every merge into `main` is a release. Before committing any change to `mdcms.py`, ask: "Is this intended to be merged to main immediately?" If yes, bump `CLI_VERSION` and `CLI_RELEASE_DATE` in `mdcms.py` and `version` in `pyproject.toml` before committing. If the work is exploratory or not yet ready to merge, leave the version unchanged and ask again when the merge is imminent.
|
||||||
|
|
||||||
## Branching convention
|
## Branching convention
|
||||||
|
|
||||||
- **Code changes** (`mdcms.py`, `pyproject.toml`, `app/`, `.github/`) — use branch `mdcms_claude` (create from `main` if it doesn't exist), PR to `main`.
|
- **Code changes** (`mdcms.py`, `pyproject.toml`, `app/`, `.github/`) — use branch `mdcms_claude` (create from `main` if it doesn't exist), PR to `main`.
|
||||||
|
|
|
||||||
30
mdcms.py
30
mdcms.py
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# mdcms v0.3 — CLI companion
|
# mdcms v0.3.2 — CLI companion
|
||||||
#
|
#
|
||||||
# Copyright 2026 Kristian Benestad
|
# Copyright 2026 Kristian Benestad
|
||||||
# Apache License, Version 2.0 — https://www.apache.org/licenses/LICENSE-2.0
|
# Apache License, Version 2.0 — https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
"""MD-CMS v0.3 — CLI tool for managing and building MD-CMS sites."""
|
"""MD-CMS v0.3.2 — CLI tool for managing and building MD-CMS sites."""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
@ -20,7 +20,8 @@ import certifi
|
||||||
import click
|
import click
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
CLI_VERSION = "0.3"
|
CLI_VERSION = "0.3.2"
|
||||||
|
CLI_RELEASE_DATE = "16 May 2026"
|
||||||
MIN_SUPPORTED_VERSION = "0.3"
|
MIN_SUPPORTED_VERSION = "0.3"
|
||||||
|
|
||||||
MARKER_RE = re.compile(r"mdcms v(\d+\.\d+)", re.IGNORECASE)
|
MARKER_RE = re.compile(r"mdcms v(\d+\.\d+)", re.IGNORECASE)
|
||||||
|
|
@ -467,8 +468,29 @@ def download_template(dest: Path):
|
||||||
|
|
||||||
# ─── CLI commands ─────────────────────────────────────────────
|
# ─── CLI commands ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
def _version_callback(ctx, param, value):
|
||||||
|
if not value or ctx.resilient_parsing:
|
||||||
|
return
|
||||||
|
click.echo(f"mdcms v{CLI_VERSION} (released {CLI_RELEASE_DATE})")
|
||||||
|
url = f"https://raw.githubusercontent.com/kbenestad/mdcms/refs/heads/main/docs/banner/v{CLI_VERSION}.txt"
|
||||||
|
try:
|
||||||
|
ssl_ctx = ssl.create_default_context(cafile=certifi.where())
|
||||||
|
req = urllib.request.Request(url, headers={"User-Agent": f"mdcms/{CLI_VERSION}"})
|
||||||
|
with urllib.request.urlopen(req, context=ssl_ctx, timeout=5) as resp:
|
||||||
|
click.echo(resp.read().decode("utf-8").strip())
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
if e.code == 404:
|
||||||
|
click.echo("There is no online information defined for this version.")
|
||||||
|
else:
|
||||||
|
click.echo("There is no online information defined for this version.")
|
||||||
|
except Exception:
|
||||||
|
click.echo("There is no online information defined for this version.")
|
||||||
|
ctx.exit()
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
@click.version_option(CLI_VERSION, prog_name="mdcms")
|
@click.option("--version", is_flag=True, is_eager=True, expose_value=False,
|
||||||
|
callback=_version_callback, help="Show version and exit.")
|
||||||
def cli():
|
def cli():
|
||||||
"""MD-CMS — Markdown-based CMS companion CLI.
|
"""MD-CMS — Markdown-based CMS companion CLI.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "mdcms"
|
name = "mdcms"
|
||||||
version = "0.3.0"
|
version = "0.3.2"
|
||||||
description = "MD-CMS — Markdown-based CMS companion CLI"
|
description = "MD-CMS — Markdown-based CMS companion CLI"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "Apache-2.0" }
|
license = { text = "Apache-2.0" }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue