Compare commits

..
Author SHA1 Message Date
ars9 6e5da08719 feat(client): include version in exported scenario and snippet filenames
CI / changes (pull_request) Successful in 10s
CI / server (pull_request) Skipped
CI / client (pull_request) Successful in 1m21s
CI / image (pull_request) Skipped
- request the exact version being exported via ?version=N so file
  content always matches the filename
- name downloads <scenario>-v<N>.yaml and snippet-<alias>-v<N>.yaml
2026-10-07 17:34:21 +03:00
ars9 1abd95f9e1 Merge pull request 'fix(install): read prompts from the terminal and start liqa' (#11) from fix/install-tty into master
CI / changes (push) Successful in 6s
CI / server (push) Skipped
CI / client (push) Skipped
CI / image (push) Skipped
Reviewed-on: #11
2026-10-02 15:53:43 +03:00
ars9 d7476f0fe8 fix(install): read prompts from the terminal and start liqa
CI / changes (pull_request) Successful in 7s
CI / server (pull_request) Skipped
CI / client (pull_request) Skipped
CI / image (pull_request) Skipped
- read answers from /dev/tty: under `curl ... | bash` stdin is the
  script itself, so `read` consumed the script's own lines; fall back
  to defaults when there is no terminal
- check that docker, the compose plugin and the daemon work and that
  compose accepts the generated compose.yaml
- start liqa with `docker compose up -d` in the install directory,
  printing the manual start command if a check or the start fails
2026-10-02 15:53:16 +03:00
4 changed files with 64 additions and 15 deletions

No files matched your search

+12 -3
View File
@@ -123,8 +123,9 @@ export const snippets = {
versions(id: string): Promise<SnippetVersion[]> {
return request(`/snippets/${id}/versions`);
},
exportSnippet(id: string): Promise<unknown> {
return request(`/snippets/${id}/export`);
exportSnippet(id: string, version?: number): Promise<unknown> {
const query = version === undefined ? '' : `?version=${version}`;
return request(`/snippets/${id}/export${query}`);
},
};
@@ -247,7 +248,12 @@ export const scenarios = {
},
exportScenario(
id: string,
options: { includeEnvironment: boolean; credentialIds: string[]; snippetIds: string[] } = {
options: {
includeEnvironment: boolean;
credentialIds: string[];
snippetIds: string[];
version?: number;
} = {
includeEnvironment: false,
credentialIds: [],
snippetIds: [],
@@ -255,6 +261,9 @@ export const scenarios = {
): Promise<string> {
const params = new URLSearchParams();
params.set('includeEnvironment', String(options.includeEnvironment));
if (options.version !== undefined) {
params.set('version', String(options.version));
}
for (const cid of options.credentialIds) {
params.append('credentialIds', cid);
}
@@ -229,12 +229,13 @@ export function ScenarioDetailPage() {
includeEnvironment,
credentialIds: credIds,
snippetIds: Array.from(includedSnippetIds),
version: scenario.version,
});
const blob = new Blob([yamlContent], { type: 'application/yaml' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `${scenario.name}.yaml`;
a.download = `${scenario.name}-v${scenario.version}.yaml`;
a.click();
URL.revokeObjectURL(url);
setExportModalOpen(false);
@@ -51,12 +51,12 @@ export function SnippetDetailPage() {
const handleExport = async () => {
if (!snippet) return;
const data = await snippets.exportSnippet(snippet.id);
const data = await snippets.exportSnippet(snippet.id, snippet.version);
const blob = new Blob([yamlStringify(data)], { type: 'application/yaml' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `snippet-${snippet.alias}.yaml`;
a.download = `snippet-${snippet.alias}-v${snippet.version}.yaml`;
a.click();
URL.revokeObjectURL(url);
};
+48 -9
View File
@@ -6,14 +6,20 @@ set -euo pipefail
REGISTRY_IMAGE="git.hq.ars9.space/ars9/liqa"
read -rp "Install directory [./liqa]: " install_dir
install_dir="${install_dir:-./liqa}"
# Prompt on the terminal, not stdin: under `curl ... | bash` stdin is the
# script itself, so a plain `read` would consume the script's own lines.
# Without a terminal, the default is used.
ask() {
local prompt="$1" default="$2" answer=""
if { : </dev/tty; } 2>/dev/null; then
read -rp "$prompt [$default]: " answer </dev/tty
fi
echo "${answer:-$default}"
}
read -rp "Port to expose [13000]: " port
port="${port:-13000}"
read -rp "Version to install [latest]: " version
version="${version:-latest}"
install_dir="$(ask "Install directory" "./liqa")"
port="$(ask "Port to expose" "13000")"
version="$(ask "Version to install" "latest")"
mkdir -p "$install_dir/data"
@@ -35,5 +41,38 @@ EOF
echo "Wrote $compose_file"
echo "Created $install_dir/data"
echo
echo "To start liqa:"
echo " cd $install_dir && docker compose up -d"
start_hint() {
echo "Once that is fixed, start liqa with:" >&2
echo " cd $install_dir && docker compose up -d" >&2
exit 1
}
if ! command -v docker >/dev/null 2>&1; then
echo "Error: docker is not installed. Install Docker Engine with the Compose plugin:" >&2
echo " https://docs.docker.com/engine/install/" >&2
start_hint
elif ! docker compose version >/dev/null 2>&1; then
echo "Error: the Docker Compose plugin (docker compose) is not available. Install it:" >&2
echo " https://docs.docker.com/compose/install/linux/" >&2
start_hint
elif ! docker compose -f "$compose_file" config --quiet >/dev/null 2>&1; then
echo "Error: docker compose rejected $compose_file:" >&2
docker compose -f "$compose_file" config --quiet >&2 || true
start_hint
elif ! docker info >/dev/null 2>&1; then
echo "Error: can't reach the Docker daemon. Make sure it is running and that" >&2
echo "your user may use it (e.g. is in the docker group), or use sudo." >&2
start_hint
fi
cd "$install_dir"
if ! docker compose up -d; then
echo >&2
echo "Error: docker compose up failed." >&2
start_hint
fi
echo
echo "liqa is running at http://localhost:$port"
echo "Manage it from $install_dir with docker compose (ps, logs, down, pull)."