From f3d4448cca4a87f002979b76735a6492c24cc144 Mon Sep 17 00:00:00 2001 From: Mads Lorentzen <50207393+MadsLorentzen@users.noreply.github.com> Date: Tue, 7 Jul 2026 17:39:47 +0200 Subject: [PATCH] fix: restore Danish CLI commands/ and tsconfig files dropped by old .gitignore (#53) The pre-#21 .gitignore's unanchored 'commands/' rule silently excluded .agents/skills/*/cli/src/commands/ (and the tsconfigs) from the initial release, so every clone's four Danish portal CLIs failed on import with 'Cannot find module ./commands/search.js'. #21 fixed the rule but the files were never restored - git history has no trace of them. Restored from the maintainer's working copies, including the updated jobindex helpers.ts (Jobindex moved search results from the JSON endpoint, which now returns 204, into an embedded HTML Stash blob). Verified: all four CLIs typecheck and return live results with their documented flags. Surfaced while reviewing #52. Co-authored-by: Claude Fable 5 --- .../jobbank-search/cli/src/commands/detail.ts | 164 ++++++++++ .../jobbank-search/cli/src/commands/search.ts | 199 ++++++++++++ .../skills/jobbank-search/cli/tsconfig.json | 20 ++ .../cli/src/commands/autocomplete.ts | 111 +++++++ .../cli/src/commands/categories.ts | 67 ++++ .../cli/src/commands/detail.ts | 165 ++++++++++ .../cli/src/commands/locations.ts | 101 ++++++ .../cli/src/commands/search.ts | 208 +++++++++++++ .../jobdanmark-search/cli/tsconfig.json | 20 ++ .../cli/src/commands/detail.ts | 291 ++++++++++++++++++ .../cli/src/commands/search.ts | 103 +++++++ .../skills/jobindex-search/cli/src/helpers.ts | 106 +++++++ .../skills/jobindex-search/cli/tsconfig.json | 20 ++ .../jobnet-search/cli/src/commands/detail.ts | 132 ++++++++ .../cli/src/commands/occupations.ts | 84 +++++ .../jobnet-search/cli/src/commands/search.ts | 208 +++++++++++++ .../cli/src/commands/suggestions.ts | 66 ++++ .../skills/jobnet-search/cli/tsconfig.json | 20 ++ 18 files changed, 2085 insertions(+) create mode 100644 .agents/skills/jobbank-search/cli/src/commands/detail.ts create mode 100644 .agents/skills/jobbank-search/cli/src/commands/search.ts create mode 100644 .agents/skills/jobbank-search/cli/tsconfig.json create mode 100644 .agents/skills/jobdanmark-search/cli/src/commands/autocomplete.ts create mode 100644 .agents/skills/jobdanmark-search/cli/src/commands/categories.ts create mode 100644 .agents/skills/jobdanmark-search/cli/src/commands/detail.ts create mode 100644 .agents/skills/jobdanmark-search/cli/src/commands/locations.ts create mode 100644 .agents/skills/jobdanmark-search/cli/src/commands/search.ts create mode 100644 .agents/skills/jobdanmark-search/cli/tsconfig.json create mode 100644 .agents/skills/jobindex-search/cli/src/commands/detail.ts create mode 100644 .agents/skills/jobindex-search/cli/src/commands/search.ts create mode 100644 .agents/skills/jobindex-search/cli/tsconfig.json create mode 100644 .agents/skills/jobnet-search/cli/src/commands/detail.ts create mode 100644 .agents/skills/jobnet-search/cli/src/commands/occupations.ts create mode 100644 .agents/skills/jobnet-search/cli/src/commands/search.ts create mode 100644 .agents/skills/jobnet-search/cli/src/commands/suggestions.ts create mode 100644 .agents/skills/jobnet-search/cli/tsconfig.json diff --git a/.agents/skills/jobbank-search/cli/src/commands/detail.ts b/.agents/skills/jobbank-search/cli/src/commands/detail.ts new file mode 100644 index 0000000..b752b3e --- /dev/null +++ b/.agents/skills/jobbank-search/cli/src/commands/detail.ts @@ -0,0 +1,164 @@ +import { defineCommand, option } from "@bunli/core" +import { z } from "zod" +import { fetchWithUA, writeError, BASE_URL } from "../helpers.js" +import { parse as parseHtml } from "node-html-parser" + +export const detail = defineCommand({ + name: "detail", + description: "Full detail for a single job posting", + options: { + format: option(z.enum(["json", "plain"]).default("json"), { + description: "Output format: json, plain", + }), + }, + handler: async ({ positional, flags, signal }) => { + if (signal.aborted) return + + const id = positional[0] + if (!id) { + writeError("Job ID is required", "MISSING_REQUIRED") + process.exit(1) + } + + const url = `${BASE_URL}/job/${id}/` + + try { + const response = await fetchWithUA(url) + + if (response.status === 404) { + writeError("Job not found", "NOT_FOUND") + process.exit(1) + } + + if (!response.ok) { + writeError(`Failed to fetch job page: ${response.status} ${response.statusText}`, "API_ERROR") + process.exit(1) + } + + const html = await response.text() + + if (signal.aborted) return + + const root = parseHtml(html) + + // Find all