harnesstap 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -15
- package/dist/apply-2GRNKR5H.js +67 -0
- package/dist/apply-2GRNKR5H.js.map +1 -0
- package/dist/approve-KQNCNH2R.js +181 -0
- package/dist/approve-KQNCNH2R.js.map +1 -0
- package/dist/audit-SLYOZCMI.js +434 -0
- package/dist/audit-SLYOZCMI.js.map +1 -0
- package/dist/auth-3IEVICFT.js +220 -0
- package/dist/auth-3IEVICFT.js.map +1 -0
- package/dist/bin.js +166 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-2EIJYDNI.js +10945 -0
- package/dist/chunk-2EIJYDNI.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-37E5M4JX.js +34 -0
- package/dist/chunk-37E5M4JX.js.map +1 -0
- package/dist/chunk-3FIWOI3H.js +98 -0
- package/dist/chunk-3FIWOI3H.js.map +1 -0
- package/dist/chunk-3IWTJCPA.js +6448 -0
- package/dist/chunk-3IWTJCPA.js.map +1 -0
- package/dist/chunk-3IZ7SEGT.js +346 -0
- package/dist/chunk-3IZ7SEGT.js.map +1 -0
- package/dist/chunk-3RBYT7QN.js +540 -0
- package/dist/chunk-3RBYT7QN.js.map +1 -0
- package/dist/chunk-4KNQZDZC.js +115 -0
- package/dist/chunk-4KNQZDZC.js.map +1 -0
- package/dist/chunk-5F3LNDZG.js +9 -0
- package/dist/chunk-5F3LNDZG.js.map +1 -0
- package/dist/chunk-63U7QWNY.js +364 -0
- package/dist/chunk-63U7QWNY.js.map +1 -0
- package/dist/chunk-6BY4BV5G.js +998 -0
- package/dist/chunk-6BY4BV5G.js.map +1 -0
- package/dist/chunk-7L2K4N25.js +610 -0
- package/dist/chunk-7L2K4N25.js.map +1 -0
- package/dist/chunk-7LWH5SWH.js +18 -0
- package/dist/chunk-7LWH5SWH.js.map +1 -0
- package/dist/chunk-BIBUCC2E.js +696 -0
- package/dist/chunk-BIBUCC2E.js.map +1 -0
- package/dist/chunk-BSOBXLYI.js +172 -0
- package/dist/chunk-BSOBXLYI.js.map +1 -0
- package/dist/chunk-C4QBVVEH.js +32 -0
- package/dist/chunk-C4QBVVEH.js.map +1 -0
- package/dist/chunk-CHQGE2HF.js +283 -0
- package/dist/chunk-CHQGE2HF.js.map +1 -0
- package/dist/chunk-DV74UZJI.js +87 -0
- package/dist/chunk-DV74UZJI.js.map +1 -0
- package/dist/chunk-DWVAR4BP.js +656 -0
- package/dist/chunk-DWVAR4BP.js.map +1 -0
- package/dist/chunk-DXKAKKLP.js +302 -0
- package/dist/chunk-DXKAKKLP.js.map +1 -0
- package/dist/chunk-EIWXS4RM.js +235 -0
- package/dist/chunk-EIWXS4RM.js.map +1 -0
- package/dist/chunk-EWBCFAF3.js +681 -0
- package/dist/chunk-EWBCFAF3.js.map +1 -0
- package/dist/chunk-F2L4VNQK.js +1759 -0
- package/dist/chunk-F2L4VNQK.js.map +1 -0
- package/dist/chunk-G26HZZDJ.js +1359 -0
- package/dist/chunk-G26HZZDJ.js.map +1 -0
- package/dist/chunk-GQKKX7OE.js +818 -0
- package/dist/chunk-GQKKX7OE.js.map +1 -0
- package/dist/chunk-GRJY22U6.js +691 -0
- package/dist/chunk-GRJY22U6.js.map +1 -0
- package/dist/chunk-H6DVP2SI.js +682 -0
- package/dist/chunk-H6DVP2SI.js.map +1 -0
- package/dist/chunk-HVVPTCKR.js +1173 -0
- package/dist/chunk-HVVPTCKR.js.map +1 -0
- package/dist/chunk-I6XFZLTJ.js +9 -0
- package/dist/chunk-I6XFZLTJ.js.map +1 -0
- package/dist/chunk-IBOABSIA.js +17 -0
- package/dist/chunk-IBOABSIA.js.map +1 -0
- package/dist/chunk-IK524ZDW.js +691 -0
- package/dist/chunk-IK524ZDW.js.map +1 -0
- package/dist/chunk-IRU7NBOT.js +141 -0
- package/dist/chunk-IRU7NBOT.js.map +1 -0
- package/dist/chunk-J4CKQXQ6.js +806 -0
- package/dist/chunk-J4CKQXQ6.js.map +1 -0
- package/dist/chunk-JKGSJGCC.js +311 -0
- package/dist/chunk-JKGSJGCC.js.map +1 -0
- package/dist/chunk-JQOKQKQT.js +158 -0
- package/dist/chunk-JQOKQKQT.js.map +1 -0
- package/dist/chunk-JRFUTIEH.js +426 -0
- package/dist/chunk-JRFUTIEH.js.map +1 -0
- package/dist/chunk-K2BPYEH5.js +491 -0
- package/dist/chunk-K2BPYEH5.js.map +1 -0
- package/dist/chunk-KCQC7YBK.js +7795 -0
- package/dist/chunk-KCQC7YBK.js.map +1 -0
- package/dist/chunk-KDAV2GUT.js +1357 -0
- package/dist/chunk-KDAV2GUT.js.map +1 -0
- package/dist/chunk-KDDXZBMC.js +583 -0
- package/dist/chunk-KDDXZBMC.js.map +1 -0
- package/dist/chunk-KMWHZSEG.js +41 -0
- package/dist/chunk-KMWHZSEG.js.map +1 -0
- package/dist/chunk-KRI4R7EM.js +25 -0
- package/dist/chunk-KRI4R7EM.js.map +1 -0
- package/dist/chunk-LNJ3WZZX.js +186 -0
- package/dist/chunk-LNJ3WZZX.js.map +1 -0
- package/dist/chunk-MWXA4PFE.js +103 -0
- package/dist/chunk-MWXA4PFE.js.map +1 -0
- package/dist/chunk-MY62SSKC.js +183 -0
- package/dist/chunk-MY62SSKC.js.map +1 -0
- package/dist/chunk-NAGAJ5UM.js +145 -0
- package/dist/chunk-NAGAJ5UM.js.map +1 -0
- package/dist/chunk-NJ7WRKIQ.js +532 -0
- package/dist/chunk-NJ7WRKIQ.js.map +1 -0
- package/dist/chunk-OS6NUIBJ.js +38 -0
- package/dist/chunk-OS6NUIBJ.js.map +1 -0
- package/dist/chunk-PXU2OS26.js +238 -0
- package/dist/chunk-PXU2OS26.js.map +1 -0
- package/dist/chunk-QO4LBDVI.js +496 -0
- package/dist/chunk-QO4LBDVI.js.map +1 -0
- package/dist/chunk-QRZPQNLX.js +65 -0
- package/dist/chunk-QRZPQNLX.js.map +1 -0
- package/dist/chunk-SNVAMWB7.js +40 -0
- package/dist/chunk-SNVAMWB7.js.map +1 -0
- package/dist/chunk-SPRVUATR.js +430 -0
- package/dist/chunk-SPRVUATR.js.map +1 -0
- package/dist/chunk-SY7G5QEI.js +35 -0
- package/dist/chunk-SY7G5QEI.js.map +1 -0
- package/dist/chunk-SZNBUIDR.js +6438 -0
- package/dist/chunk-SZNBUIDR.js.map +1 -0
- package/dist/chunk-TQ2NA4Z4.js +24 -0
- package/dist/chunk-TQ2NA4Z4.js.map +1 -0
- package/dist/chunk-TYULB6ZY.js +2959 -0
- package/dist/chunk-TYULB6ZY.js.map +1 -0
- package/dist/chunk-UJYFTXHV.js +296 -0
- package/dist/chunk-UJYFTXHV.js.map +1 -0
- package/dist/chunk-VC6OKCJF.js +184 -0
- package/dist/chunk-VC6OKCJF.js.map +1 -0
- package/dist/chunk-VL2NWCZV.js +118 -0
- package/dist/chunk-VL2NWCZV.js.map +1 -0
- package/dist/chunk-VL7BGD47.js +514 -0
- package/dist/chunk-VL7BGD47.js.map +1 -0
- package/dist/chunk-VQVUJYYY.js +244 -0
- package/dist/chunk-VQVUJYYY.js.map +1 -0
- package/dist/chunk-VZQG2JDV.js +9 -0
- package/dist/chunk-VZQG2JDV.js.map +1 -0
- package/dist/chunk-XFZQVYIN.js +115 -0
- package/dist/chunk-XFZQVYIN.js.map +1 -0
- package/dist/chunk-XGTTOO4R.js +84 -0
- package/dist/chunk-XGTTOO4R.js.map +1 -0
- package/dist/chunk-XQFT4PEP.js +60 -0
- package/dist/chunk-XQFT4PEP.js.map +1 -0
- package/dist/chunk-YDD3ES2K.js +571 -0
- package/dist/chunk-YDD3ES2K.js.map +1 -0
- package/dist/chunk-ZY2MZ2KQ.js +1140 -0
- package/dist/chunk-ZY2MZ2KQ.js.map +1 -0
- package/dist/compile-57EEIUMB.js +161 -0
- package/dist/compile-57EEIUMB.js.map +1 -0
- package/dist/config-4EJ3D7QJ.js +438 -0
- package/dist/config-4EJ3D7QJ.js.map +1 -0
- package/dist/doctor-EEV6P5CH.js +111 -0
- package/dist/doctor-EEV6P5CH.js.map +1 -0
- package/dist/environment-WFEG4DAT.js +2745 -0
- package/dist/environment-WFEG4DAT.js.map +1 -0
- package/dist/github-BSMQD72A.js +114 -0
- package/dist/github-BSMQD72A.js.map +1 -0
- package/dist/harness-VX3PNVQW.js +746 -0
- package/dist/harness-VX3PNVQW.js.map +1 -0
- package/dist/help-AW2HKX63.js +2079 -0
- package/dist/help-AW2HKX63.js.map +1 -0
- package/dist/help-BVFOZD7E.js +1892 -0
- package/dist/help-BVFOZD7E.js.map +1 -0
- package/dist/index.d.ts +164 -1
- package/dist/index.js +50 -59246
- package/dist/index.js.map +1 -1
- package/dist/init-SPN2GEZ4.js +873 -0
- package/dist/init-SPN2GEZ4.js.map +1 -0
- package/dist/lock-K2LLUU7H.js +455 -0
- package/dist/lock-K2LLUU7H.js.map +1 -0
- package/dist/marketplace-VEKSWGX3.js +495 -0
- package/dist/marketplace-VEKSWGX3.js.map +1 -0
- package/dist/mcp-T6DKIKSF.js +202 -0
- package/dist/mcp-T6DKIKSF.js.map +1 -0
- package/dist/migrate-OO37WSB2.js +1043 -0
- package/dist/migrate-OO37WSB2.js.map +1 -0
- package/dist/open-3V3QK5RK.js +32 -0
- package/dist/open-3V3QK5RK.js.map +1 -0
- package/dist/pack-V32UPC7W.js +99 -0
- package/dist/pack-V32UPC7W.js.map +1 -0
- package/dist/plugin-KOBNQ7GT.js +64 -0
- package/dist/plugin-KOBNQ7GT.js.map +1 -0
- package/dist/plugin-from-project-X3VO3MB6.js +16 -0
- package/dist/plugin-from-project-X3VO3MB6.js.map +1 -0
- package/dist/policy-F5MKZNOC.js +105 -0
- package/dist/policy-F5MKZNOC.js.map +1 -0
- package/dist/profile-H4PMH4XT.js +1886 -0
- package/dist/profile-H4PMH4XT.js.map +1 -0
- package/dist/project-QVNEJJGH.js +1392 -0
- package/dist/project-QVNEJJGH.js.map +1 -0
- package/dist/resource-GL4RLSGI.js +555 -0
- package/dist/resource-GL4RLSGI.js.map +1 -0
- package/dist/version-PBHZK44K.js +17 -0
- package/dist/version-PBHZK44K.js.map +1 -0
- package/package.json +21 -14
- package/schemas/ap-package.v1.json +36 -0
- package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
- package/schemas/fixtures/confidence.ap.json +13 -0
- package/schemas/fixtures/context7.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
- package/schemas/fixtures/superpowers.ap.json +13 -0
- package/schemas/fixtures/third-party-skills.ap.json +13 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts","../package.json","../src/copy/cli.ts","../src/db/native-module.ts","../src/db/connection.ts","../src/utils/fetch-with-timeout.ts","../src/utils/git-errors.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport packageJson from \"../package.json\" with { type: \"json\" };\n\ndeclare const __HT_VERSION__: string | undefined;\n\nconst GIT_SHA = /^[0-9a-f]{7,40}$/i;\n\nexport interface DevBuildVersionOptions {\n isRelease?: boolean;\n gitSha?: string | null;\n}\n\nfunction compactGitSha(sha: string | null | undefined): string | undefined {\n const trimmed = sha?.trim().toLowerCase();\n if (!trimmed || !GIT_SHA.test(trimmed)) {\n return undefined;\n }\n return trimmed.slice(0, 7);\n}\n\n/** True when a release workflow baked a publishable version (no `-dev+sha`). */\nexport function isReleaseBuild(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.HT_RELEASE === \"1\" || env.HARNESSTAP_RELEASE === \"1\";\n}\n\n/** Best-effort git SHA for the `-dev+sha` suffix. */\nexport function readGitSha(\n env: NodeJS.ProcessEnv = process.env,\n cwd: string = process.cwd(),\n): string | undefined {\n const fromEnv = compactGitSha(env.HT_GIT_SHA ?? env.GITHUB_SHA);\n if (fromEnv) {\n return fromEnv;\n }\n try {\n const sha = execFileSync(\"git\", [\"rev-parse\", \"HEAD\"], {\n cwd,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n return compactGitSha(sha);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Append `-dev+<sha>` on non-release builds so CLI and Desktop can tell a\n * local/CI binary from a published version. Release builds return `version`\n * unchanged. Desktop should call this helper when reporting a newer-schema DB.\n */\nexport function formatDevBuildVersion(\n version: string,\n options: DevBuildVersionOptions = {},\n): string {\n const trimmed = version.trim();\n if (options.isRelease) {\n return trimmed;\n }\n if (trimmed.includes(\"-dev+\")) {\n return trimmed;\n }\n const sha = compactGitSha(options.gitSha);\n if (!sha) {\n return `${trimmed}-dev`;\n }\n return `${trimmed}-dev+${sha}`;\n}\n\n/** Version baked into tsup and the compiled sidecar (`__HT_VERSION__`). */\nexport function resolveBuildVersion(env: NodeJS.ProcessEnv = process.env): string {\n return formatDevBuildVersion(packageJson.version, {\n isRelease: isReleaseBuild(env),\n gitSha: readGitSha(env),\n });\n}\n\nfunction resolvePackageVersion(): string {\n // tsup and the sidecar build define __HT_VERSION__; the JSON import is the\n // source/test fallback and is inlined by every bundler, never read at runtime.\n if (typeof __HT_VERSION__ === \"string\" && __HT_VERSION__.length > 0) {\n return __HT_VERSION__;\n }\n return resolveBuildVersion();\n}\n\nexport const PACKAGE_VERSION: string = resolvePackageVersion();\n","{\n \"name\": \"harnesstap\",\n \"version\": \"1.3.1\",\n \"description\": \"Agent harness configuration toolkit for Claude Code, Codex, Cursor, and other coding CLIs\",\n \"type\": \"module\",\n \"packageManager\": \"bun@1.3.9\",\n \"files\": [\n \"dist\",\n \"LICENSE\",\n \"README.md\",\n \"schemas\"\n ],\n \"bin\": {\n \"harnesstap\": \"./dist/bin.js\",\n \"ht\": \"./dist/bin.js\"\n },\n \"scripts\": {\n \"build\": \"bun scripts/generate-scenarios.ts && rm -rf dist && tsup\",\n \"generate:scenarios\": \"bun scripts/generate-scenarios.ts\",\n \"check:packaged-help\": \"bun scripts/check-packaged-help.ts\",\n \"snapshot:released-cli\": \"bun scripts/snapshot-released-cli.ts\",\n \"build:sidecar\": \"bash scripts/build-sidecar.sh\",\n \"check:compiled-sidecar\": \"bun scripts/check-compiled-sidecar.ts\",\n \"desktop:cleanup\": \"bash apps/desktop/scripts/cleanup-stale-dev.sh\",\n \"desktop:prepare-sidecar\": \"bash apps/desktop/scripts/prepare-sidecar.sh\",\n \"desktop:watch-sidecar\": \"bun apps/desktop/scripts/watch-sidecar.ts\",\n \"desktop:icons\": \"cd apps/desktop && bun run icons\",\n \"desktop:dev\": \"bash apps/desktop/scripts/desktop-dev.sh\",\n \"desktop:build\": \"bun run desktop:prepare-sidecar && cd apps/desktop && bun install && bun run tauri build && bash scripts/reseal-macos-app.sh\",\n \"desktop:install\": \"bun apps/desktop/scripts/install-local.ts\",\n \"desktop:e2e:build\": \"bash apps/desktop/scripts/e2e-build.sh\",\n \"desktop:e2e\": \"bash apps/desktop/scripts/e2e-run.sh\",\n \"desktop:demo-agent\": \"bash apps/desktop/scripts/demo-home.sh\",\n \"desktop:shots\": \"cd apps/desktop && bun run shots\",\n \"desktop:check\": \"bash apps/desktop/scripts/desktop-check.sh\",\n \"dev\": \"tsup --watch\",\n \"start\": \"bun src/bin.ts\",\n \"start:dist\": \"node dist/bin.js\",\n \"link\": \"bun run build && bun link\",\n \"unlink\": \"bun unlink\",\n \"test\": \"bun test --timeout 30000\",\n \"test:run\": \"bun test --dots --timeout 30000\",\n \"test:core\": \"bun test --dots test/models test/db test/config test/utils test/telemetry test/scripts\",\n \"test:platforms\": \"bun test --dots test/platforms\",\n \"test:plugins\": \"bun test --dots test/plugins\",\n \"test:services\": \"bun test --dots test/services test/integration test/agent/init-apply-noop.test.ts\",\n \"test:cli\": \"bun test --dots test/cli test/ui test/helpers\",\n \"test:docs\": \"bun test --dots test/docs\",\n \"lint\": \"biome lint .\",\n \"lint:fix\": \"biome lint --write --unsafe .\",\n \"lint:css\": \"bun scripts/check-css-tokens.ts\",\n \"check:cli-error-contract\": \"bun scripts/check-cli-error-contract.ts\",\n \"check:copy\": \"bun scripts/check-copy.ts\",\n \"typecheck\": \"tsc --noEmit\",\n \"clean\": \"rm -rf dist && find . -maxdepth 1 -name '*.bun-build' -delete\",\n \"preflight\": \"bun run lint && bun run lint:css && bun run check:cli-error-contract && bun run check:copy && bun run typecheck && bun run test:run && bun run build\",\n \"prepublishOnly\": \"bun run build\",\n \"docs:vhs\": \"bash scripts/generate-vhs-scenarios.sh\",\n \"check:scenario-docs\": \"bash scripts/check-scenario-docs.sh\",\n \"check:scenario-smoke\": \"bun test test/cli/scenario-smoke.test.ts\",\n \"check:sqlite-wal-smoke\": \"bun scripts/sqlite-wal-write-smoke.ts\",\n \"sync:cloud-docs\": \"bash scripts/sync-cloud-cli-docs.sh\"\n },\n \"keywords\": [\n \"ai\",\n \"coding-assistant\",\n \"cli\",\n \"configuration\",\n \"claude-code\",\n \"cursor\",\n \"codex\",\n \"skills\",\n \"layers\"\n ],\n \"license\": \"Apache-2.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/harnesstap/harnesstap.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/harnesstap/harnesstap/issues\"\n },\n \"homepage\": \"https://github.com/harnesstap/harnesstap#readme\",\n \"engines\": {\n \"node\": \">=22.12.0\"\n },\n \"dependencies\": {\n \"@inquirer/core\": \"^10.3.2\",\n \"@inquirer/search\": \"^3.2.2\",\n \"better-sqlite3\": \"^12.11.1\",\n \"chalk\": \"^5.4.1\",\n \"cli-table3\": \"^0.6.5\",\n \"commander\": \"^13.1.0\",\n \"gray-matter\": \"^4.0.3\",\n \"inquirer\": \"^12.3.0\",\n \"jsonc-parser\": \"^3.3.1\",\n \"ora\": \"^9.4.0\",\n \"picomatch\": \"^4.0.2\",\n \"semver\": \"^7.8.0\",\n \"smol-toml\": \"^1.3.1\",\n \"ulid\": \"^2.3.0\",\n \"yaml\": \"^2.7.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.4.10\",\n \"@inquirer/testing\": \"^3.3.8\",\n \"@types/better-sqlite3\": \"^7.6.12\",\n \"@types/node\": \"^22.10.0\",\n \"@types/semver\": \"^7.7.1\",\n \"tsup\": \"^8.3.5\",\n \"typescript\": \"^5.7.0\"\n }\n}\n","/**\n * User-facing CLI copy. ASCII punctuation only (DS-6).\n * Command hints always start with `ht`.\n */\n\nexport const DRY_RUN_NOTHING_CHANGED = \"Dry run. Nothing was changed.\";\n\nexport const NATIVE_MODULE_MISMATCH_MESSAGE =\n \"HarnessTap was installed under a different Node.js version. Run: npm rebuild -g harnesstap\";\n\n/** Quote a user-provided token so a pasted hint parses as one Commander argument. */\nexport function quoteCliArg(value: string): string {\n if (value.length === 0) {\n return '\"\"';\n }\n if (/^[A-Za-z0-9_./:@+=-]+$/.test(value)) {\n return value;\n }\n return `\"${value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`;\n}\n\nexport function formatHtCommand(path: string): string {\n return `ht ${path}`.trim();\n}\n\nexport function quoted(name: string): string {\n return `\"${name}\"`;\n}\n\nexport function skippedInvalidPluginExport(name: string): string {\n return `Warning: Skipped plugin ${quoted(name)}. Its version is not valid semver.`;\n}\n\nexport function marketplaceUnreachable(source: string): string {\n return `Error: Couldn't reach ${source}.`;\n}\n\nexport function marketplaceUnreachableHint(): string {\n return \"Check the URL, or sign in with ht github login if it's private.\";\n}\n\nexport function marketplacePathMissing(path: string): string {\n return `Error: Couldn't find a marketplace at ${quoted(path)}.`;\n}\n\nexport function marketplacePathNotMarketplace(path: string): string {\n return `Error: ${quoted(path)} is not a marketplace. It needs a marketplace.json file.`;\n}\n\nexport function marketplaceAddFailedNothingSaved(): string {\n return \"Nothing was saved.\";\n}\n\nexport function installPinnedPluginsPrompt(names: string[]): string {\n if (names.length === 1) {\n const only = names[0];\n return `Install pinned plugin ${quoted(only ?? \"\")} into the package cache?`;\n }\n return `Install ${String(names.length)} pinned plugins into the package cache?`;\n}\n\nexport function installPinnedPluginsNeedsYes(): string {\n return \"Error: Pass --yes to install pinned plugins without a prompt.\";\n}\n\nexport function installPinnedPluginsHint(profileName?: string): string {\n if (profileName) {\n return `Run ht profile use ${quoted(profileName)} --yes to install them.`;\n }\n return \"Run ht profile use --yes to install them.\";\n}\n\nexport function missingMarketplacePluginHint(pluginName: string): string {\n return `Run ht profile use to install ${quoted(pluginName)}.`;\n}\n\nexport function skippedHostPluginHook(hookName: string): string {\n return `Skipped hook ${hookName}. It only works when the plugin is installed as a host plugin.`;\n}\n\nexport function skippedDuplicateCommand(name: string): string {\n return `Skipped command ${quoted(name)}. A skill already uses that name.`;\n}\n\n/** Quote a user-provided name in error text (DS-6). */\nexport function quoteName(name: string): string {\n return `\"${name.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"\\\"\", \"\\\\\\\"\")}\"`;\n}\n\nfunction hintToken(value: string): string {\n if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value)) {\n return value;\n }\n return quoteName(value);\n}\n\nexport function ensureErrorPrefix(message: string): string {\n const stripped = message.replace(/^error:\\s*/i, \"\").trim();\n if (stripped.length === 0) {\n return \"Error: Something went wrong.\";\n }\n const sentence = /[.!?]$/.test(stripped) ? stripped : `${stripped}.`;\n return `Error: ${sentence}`;\n}\n\nexport function ensureWarningPrefix(message: string): string {\n const stripped = message.replace(/^warning:\\s*/i, \"\").trim();\n const sentence = /[.!?]$/.test(stripped) ? stripped : `${stripped}.`;\n return `Warning: ${sentence}`;\n}\n\nexport const CLI_HINTS = {\n seeOptions: (commandPath: string): string =>\n commandPath.trim().length > 0\n ? `Run ht ${commandPath.trim()} --help to see the options.`\n : \"Run ht --help to see the options.\",\n pluginList: \"Run ht plugin list to see your plugins.\",\n resourceList: \"Run ht resource list to see your resources.\",\n profileUseExample: 'For example: ht profile use \"global default\"',\n authLogin: \"Run ht auth login to sign in.\",\n githubLogin: marketplaceUnreachableHint(),\n onConflictReplace: \"Use --on-conflict replace to replace it.\",\n unsavedChanges: \"Run again with --changes save, stash or discard.\",\n updateNpm: \"Update with: npm i -g harnesstap\",\n mcpSearch: (name: string): string => `Run ht mcp search ${hintToken(name)} to find it.`,\n scopeAdd: (name: string, harnesses: string): string =>\n `Run ht resource scope ${hintToken(name)} --add ${hintToken(harnesses)}.`,\n portableMcpTip: (name: string, harnessList: string, command: string): string =>\n `Tip: ${quoteName(name)} also works on ${harnessList}. Run ${command}.`,\n forceRemove: \"To remove them too, run: ht apply --force-remove\",\n revert: \"Snapshot saved. Undo with: ht revert\",\n stashPop: \"Bring them back with: ht profile stash pop\",\n harnessSet: \"Run ht harness set to pick your harnesses.\",\n harnessSetOrFlag: \"Run ht harness set, or pass --harness <slugs>.\",\n} as const;\n\nexport const CLI_ERRORS = {\n pluginNotFound: (name: string): string => `No plugin named ${quoteName(name)}.`,\n resourceNotFound: (name: string): string => `No resource named ${quoteName(name)}.`,\n invalidResourceType: (value: string, valid: readonly string[]): string =>\n `${quoteName(value)} isn't a resource type. Valid: ${valid.join(\", \")}.`,\n conflictingResourceTypes: (a: string, b: string): string =>\n `Conflicting type filters: ${quoteName(a)} and ${quoteName(b)}.`,\n pluginAlreadyExists: (name: string): string =>\n `A plugin named ${quoteName(name)} already exists.`,\n environmentAlreadyExists: (name: string): string =>\n `An environment named ${quoteName(name)} already exists.`,\n notAuthenticated: \"Not authenticated to HarnessTap Cloud.\",\n directoryNotFound: (path: string): string => `Directory not found: ${path}.`,\n fileNotFound: (path: string): string => `File not found: ${path}.`,\n gitUnreachable: (url: string): string => `Couldn't reach ${url}.`,\n gitUnreachableGeneric: \"Couldn't reach that git repository.\",\n uniqueConstraintGeneric: \"That name already exists.\",\n missingProfileName: \"Pass a profile name.\",\n noProfileNamed: (name: string): string => `No profile named ${quoteName(name)}.`,\n invalidPluginName: (name: string): string =>\n `${quoteName(name)} isn't a valid plugin name. Use a non-empty name without /, \\\\, .. or control characters.`,\n emptyPluginName: \"Pass a plugin name.\",\n invalidFormat: (value: string): string => `Invalid --format value: ${value}. Use human or json.`,\n mcpNotInLibrary: (name: string): string => `${quoteName(name)} isn't in your library.`,\n newerSchema: \"This data was saved by a newer HarnessTap.\",\n noHarnesses: \"Not set up for any harness yet.\",\n unsavedChanges: (name: string, count: number): string =>\n `${quoteName(name)} has ${count} unsaved change${count === 1 ? \"\" : \"s\"}.`,\n resourceSyncStale: (count: number): string =>\n `${count} linked resource${count === 1 ? \"\" : \"s\"} ${count === 1 ? \"is\" : \"are\"} stale.`,\n} as const;\n\nexport const SCOPE_COPY = {\n allHarnesses: \"Applies to all your harnesses\",\n notSetUp: \"Not set up for any harness yet\",\n mainHarnessTooltip: \"Your main harness. It wins when harnesses disagree.\",\n} as const;\n\nexport const SWITCH_CHANGES_VALUES = [\"save\", \"stash\", \"discard\"] as const;\nexport type SwitchChangesValue = (typeof SWITCH_CHANGES_VALUES)[number];\n\nexport const SWITCH_CHANGES_FLAG_HELP =\n \"What to do with unsaved changes: save, stash or discard\";\n\nexport const DEVICE_LOGIN_WAITING =\n \"Waiting for you to approve in the browser. The code expires in 15 minutes. Press Ctrl+C to cancel.\";\n\nexport function initPickHarnessesLine(): string {\n return `Pick your harnesses: ${formatHtCommand(\"harness set\")}`;\n}\n\nexport function initCompletionHintLine(\n shell: \"bash\" | \"zsh\" | \"fish\" | undefined,\n): string {\n switch (shell) {\n case \"bash\":\n return `Enable tab completion: ${formatHtCommand(\"init completion bash >> ~/.bashrc\")}`;\n case \"zsh\":\n return `Enable tab completion: ${formatHtCommand(\"init completion zsh >> ~/.zshrc\")}`;\n case \"fish\":\n return `Enable tab completion: ${formatHtCommand(\"init completion fish > ~/.config/fish/completions/ht.fish\")}`;\n default:\n return `Enable tab completion: ${formatHtCommand(\"init completion <bash|zsh|fish>\")}`;\n }\n}\n\nexport const CLI_COPY = {\n dryRunNothingChanged: DRY_RUN_NOTHING_CHANGED,\n everythingUpToDate: \"Everything is up to date.\",\n snapshotSavedUndo: \"Snapshot saved. Undo with:\",\n forceRemoveHint: \"To remove them too, run:\",\n keptYouChanged: \"you changed it\",\n keptNotMade: \"not made by HarnessTap\",\n viewSnapshot: \"View snapshot\",\n keptFilesIntro:\n \"files you changed or that HarnessTap didn't create:\",\n} as const;\n\nexport function alreadyExistsOnConflictHint(kind: string, name: string): string {\n return `A ${kind} named \"${name}\" already exists. Use --on-conflict replace to replace it.`;\n}\n\nexport function unsavedChangesLine(profileName: string, count: number): string {\n return CLI_ERRORS.unsavedChanges(profileName, count);\n}\n\nexport function unsavedChangesFlagHint(): string {\n return CLI_HINTS.unsavedChanges;\n}\n\nexport function savedChangesLine(profileName: string, count: number): string {\n return `Saved ${count} changes to ${quoteName(profileName)}.`;\n}\n\nexport function stashedChangesLine(count: number, popCommand: string): string {\n return `Stashed ${count} changes. Bring them back with: ${popCommand}`;\n}\n\nexport function discardedChangesLine(count: number): string {\n return `Discarded ${count} changes.`;\n}\n\nexport function discardConfirm(count: number): string {\n return `Discard ${count} changes? A snapshot keeps a copy.`;\n}\n\nexport const PREVIEW_LABELS = {\n willWrite: \"Will write\",\n upToDate: \"Up to date\",\n notInProfile: \"Not in profile\",\n willRemove: \"Will remove\",\n keptChanged: \"Kept. You changed it.\",\n keptUnmanaged: \"Kept. Not made by HarnessTap.\",\n dryRunHeader: DRY_RUN_NOTHING_CHANGED,\n everythingUpToDate: (unchanged: number): string => `Everything is up to date. ${unchanged} unchanged.`,\n} as const;\n\nexport function applyWroteLine(input: {\n wrote: number;\n removed: number;\n kept: number;\n unchanged?: number;\n omitUnchanged?: boolean;\n}): string {\n const parts: string[] = [];\n if (input.wrote > 0) parts.push(`Wrote ${input.wrote}`);\n if (input.removed > 0) parts.push(`removed ${input.removed}`);\n if (input.wrote === 0 && input.removed === 0) {\n return input.unchanged !== undefined\n ? `${CLI_COPY.everythingUpToDate} ${input.unchanged} unchanged.`\n : CLI_COPY.everythingUpToDate;\n }\n if (input.kept > 0) parts.push(`kept ${input.kept}`);\n if (parts.length === 0) {\n return input.unchanged !== undefined\n ? `${CLI_COPY.everythingUpToDate} ${input.unchanged} unchanged.`\n : CLI_COPY.everythingUpToDate;\n }\n if (!input.omitUnchanged && input.unchanged !== undefined && input.unchanged > 0) {\n parts.push(`unchanged ${input.unchanged}`);\n }\n const [first, ...rest] = parts;\n const head = first ?? \"\";\n if (rest.length === 0) {\n return `${head}.`;\n }\n return `${head}, ${rest.join(\", \")}.`;\n}\n\nexport function applyHeaderLine(profileName: string, harnessCount: number): string {\n const noun = harnessCount === 1 ? \"harness\" : \"harnesses\";\n return `Applied \"${profileName}\" to ${harnessCount} ${noun}.`;\n}\n\nexport function dryRunWouldLine(input: {\n write: number;\n remove: number;\n keep: number;\n unchanged: number;\n}): string {\n return `Would write ${input.write}, remove ${input.remove}, keep ${input.keep}. ${input.unchanged} unchanged.`;\n}\n\nexport function dryRunStashLine(count: number, profileName: string): string {\n return `Dry run. Would stash ${count} changes from \"${profileName}\".`;\n}\n\nexport function snapshotSavedUndoLine(revertCommand: string): string {\n return `${CLI_COPY.snapshotSavedUndo} ${revertCommand}`;\n}\n\nexport function keptFilesHeader(count: number): string {\n return `Kept ${count} ${CLI_COPY.keptFilesIntro}`;\n}\n\nexport function restoredRemovedLine(\n restored: number,\n removed: number,\n options: { dryRun?: boolean } = {},\n): string {\n if (options.dryRun) {\n return `Would restore ${restored}, would remove ${removed}.`;\n }\n return `Restored ${restored}, removed ${removed}.`;\n}\n\nexport function dryRunSectionHeader(\n kind: \"write\" | \"remove\" | \"keep\",\n count: number,\n): string {\n switch (kind) {\n case \"write\":\n return `Would write (${count})`;\n case \"remove\":\n return `Would remove (${count})`;\n case \"keep\":\n return `Would keep (${count})`;\n default: {\n const _exhaustive: never = kind;\n return _exhaustive;\n }\n }\n}\n\nexport function keptReasonLabel(reason: \"modified\" | \"unmanaged\"): string {\n switch (reason) {\n case \"modified\":\n return CLI_COPY.keptYouChanged;\n case \"unmanaged\":\n return CLI_COPY.keptNotMade;\n default: {\n const _exhaustive: never = reason;\n return _exhaustive;\n }\n }\n}\n","import { NATIVE_MODULE_MISMATCH_MESSAGE } from \"../copy/cli.js\";\n\nexport { NATIVE_MODULE_MISMATCH_MESSAGE };\n\nfunction shouldShowNativeModuleDetails(): boolean {\n if (process.env.HARNESSTAP_DEBUG === \"1\") {\n return true;\n }\n return process.argv.includes(\"-v\") || process.argv.includes(\"--verbose\");\n}\n\nexport function isNativeModuleMismatch(error: unknown): boolean {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n const err = error as { code?: unknown; message?: unknown };\n const code = typeof err.code === \"string\" ? err.code : \"\";\n const message = typeof err.message === \"string\" ? err.message : String(error);\n if (code === \"ERR_DLOPEN_FAILED\") {\n return true;\n }\n return message.includes(\"NODE_MODULE_VERSION\") || message.includes(\"ERR_DLOPEN\");\n}\n\nexport function reportNativeModuleMismatch(cause?: unknown): never {\n if (shouldShowNativeModuleDetails() && cause !== undefined) {\n console.error(cause);\n }\n console.error(NATIVE_MODULE_MISMATCH_MESSAGE);\n process.exit(1);\n}\n\n/** Run a native sqlite load; print the DS-6 one-liner on ABI mismatch. */\nexport function withNativeModuleGuard<T>(load: () => T): T {\n try {\n return load();\n } catch (error) {\n if (isNativeModuleMismatch(error)) {\n reportNativeModuleMismatch(error);\n }\n throw error;\n }\n}\n","import { existsSync, mkdirSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { withNativeModuleGuard } from \"./native-module.js\";\nimport type { SqliteDatabase, SqliteDatabaseConstructor } from \"./types.js\";\n\nconst require = createRequire(import.meta.url);\n\nlet instance: SqliteDatabase | null = null;\nlet instancePath: string | null = null;\n\nfunction loadBetterSqlite3(): SqliteDatabaseConstructor {\n return withNativeModuleGuard(\n () => require(\"better-sqlite3\") as SqliteDatabaseConstructor,\n );\n}\n\nfunction resolveDatabaseConstructor(): SqliteDatabaseConstructor {\n if (\"Bun\" in globalThis) {\n return (require(\"bun:sqlite\") as { Database: SqliteDatabaseConstructor })\n .Database;\n }\n\n return loadBetterSqlite3();\n}\n\nfunction usesBunSqlite(): boolean {\n return \"Bun\" in globalThis;\n}\n\nfunction wrapDatabase(db: SqliteDatabase): SqliteDatabase {\n return {\n prepare<Row = unknown>(sql: string) {\n const statement = db.prepare<Row>(sql);\n return {\n run: (...params: unknown[]) => statement.run(...params),\n get: (...params: unknown[]) => {\n const row = statement.get(...params);\n return row ?? undefined;\n },\n all: (...params: unknown[]) => statement.all(...params),\n };\n },\n exec: (sql: string) => db.exec(sql),\n transaction: <T extends (...args: never[]) => unknown>(fn: T) =>\n db.transaction(fn),\n close: () => db.close(),\n };\n}\n\nfunction resolveHarnesstapDir(): string {\n if (process.env.HARNESSTAP_HOME) {\n return process.env.HARNESSTAP_HOME;\n }\n const homePath = process.env.HOME ?? process.env.USERPROFILE ?? homedir();\n return join(homePath, \".harnesstap\");\n}\n\n/** HarnessTap data dir for a given user home (isolates tests that pass a custom homeRoot). */\nexport function harnesstapDirForHomeRoot(homeRoot: string): string {\n if (process.env.HARNESSTAP_HOME) {\n return process.env.HARNESSTAP_HOME;\n }\n return join(homeRoot, \".harnesstap\");\n}\n\nfunction resolveDbPath(): string {\n return join(resolveHarnesstapDir(), \"harnesstap.db\");\n}\n\nfunction resolveConfigJsoncPath(): string {\n return join(resolveHarnesstapDir(), \"config.jsonc\");\n}\n\nfunction resolveLegacyConfigPath(): string {\n return join(resolveHarnesstapDir(), \"config.json\");\n}\n\nexport function getDbPath(): string {\n return resolveDbPath();\n}\n\nexport function getHarnesstapDir(): string {\n return resolveHarnesstapDir();\n}\n\nexport function getConfigJsoncPath(): string {\n return resolveConfigJsoncPath();\n}\n\nexport function getLegacyConfigPath(): string {\n return resolveLegacyConfigPath();\n}\n\nfunction isCompletionMode(): boolean {\n return process.env.HARNESSTAP_COMPLETE === \"1\";\n}\n\nexport function getDb(): SqliteDatabase {\n const dbPath = resolveDbPath();\n const completionMode = isCompletionMode();\n\n if (instance && instancePath === dbPath) {\n return instance;\n }\n\n if (instance) {\n instance.close();\n instance = null;\n instancePath = null;\n }\n\n if (completionMode) {\n if (!existsSync(dbPath)) {\n throw new Error(`HarnessTap database not found: ${dbPath}`);\n }\n } else {\n mkdirSync(resolveHarnesstapDir(), { recursive: true });\n }\n\n const Database = resolveDatabaseConstructor();\n const rawDb = withNativeModuleGuard(() =>\n completionMode\n ? new Database(dbPath, { readonly: true })\n : new Database(dbPath),\n );\n instance = usesBunSqlite() ? wrapDatabase(rawDb) : rawDb;\n instancePath = dbPath;\n if (!completionMode) {\n instance.exec(\"PRAGMA journal_mode = WAL\");\n instance.exec(\"PRAGMA busy_timeout = 5000\");\n }\n instance.exec(\"PRAGMA foreign_keys = ON\");\n\n return instance;\n}\n\nexport function closeDb(): void {\n if (instance) {\n instance.close();\n instance = null;\n instancePath = null;\n }\n}\n","export const DEFAULT_TIMEOUT_MS = 30_000;\nconst DEFAULT_RETRIES = 2;\n\nexport const CATALOG_LIST_TIMEOUT_MESSAGE =\n \"Catalog request timed out (30s). Try again, or list local plugins without --remote.\";\n\nexport async function fetchWithTimeout(\n input: string | URL,\n init?: RequestInit & { timeoutMs?: number; retries?: number },\n): Promise<Response> {\n const timeoutMs = init?.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const retries = init?.retries ?? DEFAULT_RETRIES;\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= retries; attempt += 1) {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n try {\n const { timeoutMs: _t, retries: _r, ...fetchInit } = init ?? {};\n return await fetch(input, { ...fetchInit, signal: controller.signal });\n } catch (error) {\n lastError = error;\n if (attempt === retries) break;\n await new Promise((r) => setTimeout(r, 250 * (attempt + 1)));\n } finally {\n clearTimeout(timer);\n }\n }\n\n throw new Error(\n `Request timed out after ${timeoutMs}ms (${retries + 1} attempts): ${String(input)}`,\n { cause: lastError },\n );\n}\n\nexport function isRequestTimeoutError(error: unknown): boolean {\n return error instanceof Error && error.message.startsWith(\"Request timed out after\");\n}\n\nexport function formatCatalogRequestError(error: unknown): string {\n if (isRequestTimeoutError(error)) {\n return CATALOG_LIST_TIMEOUT_MESSAGE;\n }\n return error instanceof Error ? error.message : String(error);\n}\n","export function mapGitStderr(stderr: string, url?: string): string {\n if (stderr.startsWith(\"Couldn't reach\")) {\n return stderr.endsWith(\".\") ? stderr : `${stderr}.`;\n }\n if (url) {\n return `Couldn't reach ${url}.`;\n }\n return \"Couldn't reach that git repository.\";\n}\n\nexport function gitFailureHint(): string {\n return \"Check the URL, or sign in with ht github login if it's private.\";\n}\n"],"mappings":";;;;;;;AAAA,SAAS,oBAAoB;;;ACA7B;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,gBAAkB;AAAA,EAClB,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,KAAO;AAAA,IACL,YAAc;AAAA,IACd,IAAM;AAAA,EACR;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,sBAAsB;AAAA,IACtB,uBAAuB;AAAA,IACvB,yBAAyB;AAAA,IACzB,iBAAiB;AAAA,IACjB,0BAA0B;AAAA,IAC1B,mBAAmB;AAAA,IACnB,2BAA2B;AAAA,IAC3B,yBAAyB;AAAA,IACzB,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB,eAAe;AAAA,IACf,sBAAsB;AAAA,IACtB,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,KAAO;AAAA,IACP,OAAS;AAAA,IACT,cAAc;AAAA,IACd,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,MAAQ;AAAA,IACR,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,MAAQ;AAAA,IACR,YAAY;AAAA,IACZ,YAAY;AAAA,IAC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AAA,IACR,2BAA2B,SAAS,OAAO,UAAU,CAAC,eAAe,OAAO,KAAK,CAAC;AAAA,IAClF,EAAE,OAAO,UAAU;AAAA,EACrB;AACF;AAEO,SAAS,sBAAsB,OAAyB;AAC7D,SAAO,iBAAiB,SAAS,MAAM,QAAQ,WAAW,yBAAyB;AACrF;AAEO,SAAS,0BAA0B,OAAwB;AAChE,MAAI,sBAAsB,KAAK,GAAG;AAChC,WAAO;AAAA,EACT;AACA,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;;AC5CO,SAAS,aAAa,QAAgB,KAAsB;AACjE,MAAI,OAAO,WAAW,gBAAgB,GAAG;AACvC,WAAO,OAAO,SAAS,GAAG,IAAI,SAAS,GAAG,MAAM;AAAA,EAClD;AACA,MAAI,KAAK;AACP,WAAO,kBAAkB,GAAG;AAAA,EAC9B;AACA,SAAO;AACT;AAEO,SAAS,iBAAyB;AACvC,SAAO;AACT;","names":["require"]}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CLI_ERRORS,
|
|
3
|
+
CLI_HINTS,
|
|
4
|
+
ensureErrorPrefix,
|
|
5
|
+
gitFailureHint,
|
|
6
|
+
mapGitStderr
|
|
7
|
+
} from "./chunk-DWVAR4BP.js";
|
|
8
|
+
|
|
9
|
+
// src/services/cli-errors.ts
|
|
10
|
+
var CliUsageError = class extends Error {
|
|
11
|
+
constructor(message, hints = [], exitCode = 1) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.hints = hints;
|
|
14
|
+
this.name = "CliUsageError";
|
|
15
|
+
this.exitCode = exitCode;
|
|
16
|
+
}
|
|
17
|
+
exitCode;
|
|
18
|
+
};
|
|
19
|
+
function missingRequiredArg(name, commandPath) {
|
|
20
|
+
return new CliUsageError(
|
|
21
|
+
`missing required argument '${name}'`,
|
|
22
|
+
[`Run ht ${commandPath} --help to see the options.`]
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function conflictingOptions(a, b) {
|
|
26
|
+
return new CliUsageError(`error: cannot use ${a} together with ${b}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/cli/on-conflict.ts
|
|
30
|
+
var ON_CONFLICT_HELP = "What to do when it already exists: replace, skip, prompt or cancel";
|
|
31
|
+
var ON_CONFLICT_PLUGIN_IMPORT_HELP = "What to do when it already exists: replace, skip, prompt, cancel or merge";
|
|
32
|
+
var ON_CONFLICT_APPLY_HELP = "What to do when it already exists: replace, skip, prompt or cancel. Non-interactive default: cancel";
|
|
33
|
+
var ON_CONFLICT_VALUE_HELP = {
|
|
34
|
+
replace: "Replace the existing one",
|
|
35
|
+
skip: "Keep the existing one and move on",
|
|
36
|
+
prompt: "Ask each time",
|
|
37
|
+
cancel: "Stop without changing anything",
|
|
38
|
+
merge: "Merge with the existing plugin (plugin import only)"
|
|
39
|
+
};
|
|
40
|
+
function mapAlias(value) {
|
|
41
|
+
switch (value) {
|
|
42
|
+
case "overwrite":
|
|
43
|
+
return "replace";
|
|
44
|
+
case "ignore":
|
|
45
|
+
return "skip";
|
|
46
|
+
case "fail":
|
|
47
|
+
return "cancel";
|
|
48
|
+
default:
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function parseOnConflict(value, opts) {
|
|
53
|
+
if (!value) {
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
const mapped = mapAlias(value);
|
|
57
|
+
switch (mapped) {
|
|
58
|
+
case "replace":
|
|
59
|
+
case "skip":
|
|
60
|
+
case "prompt":
|
|
61
|
+
case "cancel":
|
|
62
|
+
return mapped;
|
|
63
|
+
case "merge":
|
|
64
|
+
if (opts?.allowMerge) {
|
|
65
|
+
return "merge";
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Invalid --on-conflict value: ${value}. Use replace, skip, prompt or cancel.`);
|
|
68
|
+
default:
|
|
69
|
+
throw new Error(
|
|
70
|
+
opts?.allowMerge ? `Invalid --on-conflict value: ${value}. Use replace, skip, prompt, cancel or merge.` : `Invalid --on-conflict value: ${value}. Use replace, skip, prompt or cancel.`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function toResourceSyncOnConflict(value) {
|
|
75
|
+
if (!value || value === "merge" || value === "prompt") {
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
switch (value) {
|
|
79
|
+
case "replace":
|
|
80
|
+
return "overwrite";
|
|
81
|
+
case "skip":
|
|
82
|
+
return "ignore";
|
|
83
|
+
case "cancel":
|
|
84
|
+
return "fail";
|
|
85
|
+
default: {
|
|
86
|
+
const _exhaustive = value;
|
|
87
|
+
return _exhaustive;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function toPluginImportOnConflict(value) {
|
|
92
|
+
if (!value) {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
switch (value) {
|
|
96
|
+
case "replace":
|
|
97
|
+
return "overwrite";
|
|
98
|
+
case "cancel":
|
|
99
|
+
case "skip":
|
|
100
|
+
return "cancel";
|
|
101
|
+
case "merge":
|
|
102
|
+
return "merge";
|
|
103
|
+
case "prompt":
|
|
104
|
+
return "cancel";
|
|
105
|
+
default: {
|
|
106
|
+
const _exhaustive = value;
|
|
107
|
+
return _exhaustive;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/cli/shared.ts
|
|
113
|
+
import { basename } from "path";
|
|
114
|
+
|
|
115
|
+
// src/cli/user-errors.ts
|
|
116
|
+
function nodePathFromEnoent(error) {
|
|
117
|
+
if ("path" in error && typeof error.path === "string" && error.path.length > 0) {
|
|
118
|
+
return error.path;
|
|
119
|
+
}
|
|
120
|
+
const match = /ENOENT: no such file or directory, (?:stat|open|scandir|mkdir|unlink) '([^']+)'/.exec(
|
|
121
|
+
error.message
|
|
122
|
+
);
|
|
123
|
+
return match?.[1];
|
|
124
|
+
}
|
|
125
|
+
function isSqliteUniqueError(error) {
|
|
126
|
+
if (!error || typeof error !== "object") {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
const candidate = error;
|
|
130
|
+
const code = typeof candidate.code === "string" ? candidate.code : "";
|
|
131
|
+
const message = typeof candidate.message === "string" ? candidate.message : "";
|
|
132
|
+
return code === "SQLITE_CONSTRAINT_UNIQUE" || code === "SQLITE_CONSTRAINT" || message.includes("UNIQUE constraint failed");
|
|
133
|
+
}
|
|
134
|
+
function mapSqliteUnique(message) {
|
|
135
|
+
if (message.includes("plugins.")) {
|
|
136
|
+
return {
|
|
137
|
+
message: CLI_ERRORS.uniqueConstraintGeneric.replace(
|
|
138
|
+
"That name already exists.",
|
|
139
|
+
"A plugin with that name already exists."
|
|
140
|
+
),
|
|
141
|
+
hint: CLI_HINTS.onConflictReplace,
|
|
142
|
+
exitCode: 1
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (message.includes("environments")) {
|
|
146
|
+
return {
|
|
147
|
+
message: "An environment with that name already exists.",
|
|
148
|
+
hint: CLI_HINTS.onConflictReplace,
|
|
149
|
+
exitCode: 1
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
message: CLI_ERRORS.uniqueConstraintGeneric,
|
|
154
|
+
hint: CLI_HINTS.onConflictReplace,
|
|
155
|
+
exitCode: 1
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function commanderExitCode(error) {
|
|
159
|
+
if (error && typeof error === "object" && "exitCode" in error) {
|
|
160
|
+
const raw = error.exitCode;
|
|
161
|
+
if (typeof raw === "number" && raw > 0) {
|
|
162
|
+
return raw;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return 1;
|
|
166
|
+
}
|
|
167
|
+
function isCommanderError(error) {
|
|
168
|
+
if (!error || typeof error !== "object" || !("code" in error)) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return String(error.code ?? "").startsWith("commander.");
|
|
172
|
+
}
|
|
173
|
+
function mapUserFacingError(error) {
|
|
174
|
+
const exitCode = commanderExitCode(error);
|
|
175
|
+
if (error instanceof Error && isSqliteUniqueError(error)) {
|
|
176
|
+
return { ...mapSqliteUnique(error.message), exitCode };
|
|
177
|
+
}
|
|
178
|
+
if (error instanceof Error) {
|
|
179
|
+
const code = "code" in error ? String(error.code ?? "") : "";
|
|
180
|
+
if (code === "ENOENT") {
|
|
181
|
+
const filePath = nodePathFromEnoent(error);
|
|
182
|
+
return {
|
|
183
|
+
message: CLI_ERRORS.fileNotFound(filePath ?? "that path"),
|
|
184
|
+
exitCode
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const lower = error.message.toLowerCase();
|
|
188
|
+
if (lower.includes("could not read username") || lower.includes("terminal prompts disabled") || lower.includes("authentication failed") || /\bfatal:/.test(lower) || error.message.startsWith("Couldn't reach")) {
|
|
189
|
+
return {
|
|
190
|
+
message: mapGitStderr(error.message),
|
|
191
|
+
hint: gitFailureHint(),
|
|
192
|
+
exitCode
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return { message: error.message, exitCode };
|
|
196
|
+
}
|
|
197
|
+
return { message: String(error), exitCode };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/cli/shared.ts
|
|
201
|
+
var GUIDE_SCENARIOS_URL = "https://github.com/harnesstap/harnesstap/blob/main/docs/scenarios/scenarios.md";
|
|
202
|
+
var GIT_ORIGIN_HINTS = [
|
|
203
|
+
"Add a remote: git remote add origin <url>",
|
|
204
|
+
"Snapshots, drift, history, and revert require a git repository with origin configured."
|
|
205
|
+
];
|
|
206
|
+
function resolveInvocationName() {
|
|
207
|
+
return basename(process.argv[1] ?? "") === "ht" ? "ht" : "harnesstap";
|
|
208
|
+
}
|
|
209
|
+
function shellQuote(value) {
|
|
210
|
+
if (value.length === 0) {
|
|
211
|
+
return '""';
|
|
212
|
+
}
|
|
213
|
+
if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value)) {
|
|
214
|
+
return value;
|
|
215
|
+
}
|
|
216
|
+
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
217
|
+
}
|
|
218
|
+
function formatCommand(pathOrArgs) {
|
|
219
|
+
if (typeof pathOrArgs === "string") {
|
|
220
|
+
const trimmed = pathOrArgs.trim();
|
|
221
|
+
const stripped = trimmed.replace(/^(?:harnesstap|ht)\s+/, "");
|
|
222
|
+
return stripped.length > 0 ? `ht ${stripped}` : "ht";
|
|
223
|
+
}
|
|
224
|
+
return ["ht", ...pathOrArgs.map(shellQuote)].join(" ");
|
|
225
|
+
}
|
|
226
|
+
function formatHintCommand(args) {
|
|
227
|
+
return formatCommand(args);
|
|
228
|
+
}
|
|
229
|
+
function fail(message, opts) {
|
|
230
|
+
process.exitCode = opts?.exitCode ?? 1;
|
|
231
|
+
console.error(ensureErrorPrefix(message));
|
|
232
|
+
const hints = opts?.hints ?? (opts?.hint ? [opts.hint] : []);
|
|
233
|
+
for (const hint of hints) {
|
|
234
|
+
if (hint.trim().length > 0) {
|
|
235
|
+
console.error(hint);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function failCaught(error, opts) {
|
|
240
|
+
if (error instanceof CliUsageError) {
|
|
241
|
+
fail(error.message, {
|
|
242
|
+
hint: error.hints[0],
|
|
243
|
+
exitCode: opts?.exitCode ?? error.exitCode
|
|
244
|
+
});
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const mapped = mapUserFacingError(error);
|
|
248
|
+
const commanderHint = isCommanderError(error) ? void 0 : mapped.hint;
|
|
249
|
+
fail(mapped.message, {
|
|
250
|
+
hint: commanderHint,
|
|
251
|
+
exitCode: opts?.exitCode ?? mapped.exitCode
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function formatScenarioCommand(path) {
|
|
255
|
+
const trimmed = path.trim();
|
|
256
|
+
const stripped = trimmed.replace(/^(?:harnesstap|ht)\s+/, "");
|
|
257
|
+
return stripped.length > 0 ? `ht ${stripped}` : "ht";
|
|
258
|
+
}
|
|
259
|
+
function collectRepeatedOption(value, previous) {
|
|
260
|
+
return [...previous, value];
|
|
261
|
+
}
|
|
262
|
+
function reportNoGitOrigin(_retryCommand) {
|
|
263
|
+
fail("No git remote origin configured.", {
|
|
264
|
+
hint: GIT_ORIGIN_HINTS[0]
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function isVerboseMode(argv = process.argv) {
|
|
268
|
+
return argv.includes("-v") || argv.includes("--verbose");
|
|
269
|
+
}
|
|
270
|
+
function isGroupedCommandFallbackError(error) {
|
|
271
|
+
if (!error || typeof error !== "object") {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
const candidate = error;
|
|
275
|
+
return candidate.code === "commander.excessArguments" && candidate.exitCode === 1 && typeof candidate.message === "string" && /too many arguments for '(plugin|resource|plugin|auth|migrate|harness|environment|profile)'/i.test(candidate.message);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export {
|
|
279
|
+
CliUsageError,
|
|
280
|
+
missingRequiredArg,
|
|
281
|
+
conflictingOptions,
|
|
282
|
+
ON_CONFLICT_HELP,
|
|
283
|
+
ON_CONFLICT_PLUGIN_IMPORT_HELP,
|
|
284
|
+
ON_CONFLICT_APPLY_HELP,
|
|
285
|
+
ON_CONFLICT_VALUE_HELP,
|
|
286
|
+
parseOnConflict,
|
|
287
|
+
toResourceSyncOnConflict,
|
|
288
|
+
toPluginImportOnConflict,
|
|
289
|
+
isCommanderError,
|
|
290
|
+
GUIDE_SCENARIOS_URL,
|
|
291
|
+
resolveInvocationName,
|
|
292
|
+
formatCommand,
|
|
293
|
+
formatHintCommand,
|
|
294
|
+
fail,
|
|
295
|
+
failCaught,
|
|
296
|
+
formatScenarioCommand,
|
|
297
|
+
collectRepeatedOption,
|
|
298
|
+
reportNoGitOrigin,
|
|
299
|
+
isVerboseMode,
|
|
300
|
+
isGroupedCommandFallbackError
|
|
301
|
+
};
|
|
302
|
+
//# sourceMappingURL=chunk-DXKAKKLP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/cli-errors.ts","../src/cli/on-conflict.ts","../src/cli/shared.ts","../src/cli/user-errors.ts"],"sourcesContent":["export class CliUsageError extends Error {\n readonly exitCode: number;\n\n constructor(message: string, readonly hints: string[] = [], exitCode = 1) {\n super(message);\n this.name = \"CliUsageError\";\n this.exitCode = exitCode;\n }\n}\n\nexport function missingRequiredArg(name: string, commandPath: string): CliUsageError {\n return new CliUsageError(\n `missing required argument '${name}'`,\n [`Run ht ${commandPath} --help to see the options.`],\n );\n}\n\nexport function conflictingOptions(a: string, b: string): CliUsageError {\n return new CliUsageError(`error: cannot use ${a} together with ${b}`);\n}\n","/** Shared --on-conflict vocabulary (DS-6). Hidden aliases for one release: overwrite, ignore, fail. */\n\nexport const ON_CONFLICT_VALUES = [\"replace\", \"skip\", \"prompt\", \"cancel\"] as const;\nexport type OnConflictValue = (typeof ON_CONFLICT_VALUES)[number];\n\nexport const ON_CONFLICT_HELP =\n \"What to do when it already exists: replace, skip, prompt or cancel\";\n\nexport const ON_CONFLICT_PLUGIN_IMPORT_HELP =\n \"What to do when it already exists: replace, skip, prompt, cancel or merge\";\n\n/** Apply, profile, and project: non-interactive default is cancel. Pass --on-conflict replace in CI. */\nexport const ON_CONFLICT_APPLY_HELP =\n \"What to do when it already exists: replace, skip, prompt or cancel. Non-interactive default: cancel\";\n\nexport const ON_CONFLICT_VALUE_HELP = {\n replace: \"Replace the existing one\",\n skip: \"Keep the existing one and move on\",\n prompt: \"Ask each time\",\n cancel: \"Stop without changing anything\",\n merge: \"Merge with the existing plugin (plugin import only)\",\n} as const;\n\nfunction mapAlias(value: string): string {\n switch (value) {\n case \"overwrite\":\n return \"replace\";\n case \"ignore\":\n return \"skip\";\n case \"fail\":\n return \"cancel\";\n default:\n return value;\n }\n}\n\nexport function parseOnConflict(\n value: string | undefined,\n opts?: { allowMerge?: boolean },\n): OnConflictValue | \"merge\" | undefined {\n if (!value) {\n return undefined;\n }\n const mapped = mapAlias(value);\n switch (mapped) {\n case \"replace\":\n case \"skip\":\n case \"prompt\":\n case \"cancel\":\n return mapped;\n case \"merge\":\n if (opts?.allowMerge) {\n return \"merge\";\n }\n throw new Error(`Invalid --on-conflict value: ${value}. Use replace, skip, prompt or cancel.`);\n default:\n throw new Error(\n opts?.allowMerge\n ? `Invalid --on-conflict value: ${value}. Use replace, skip, prompt, cancel or merge.`\n : `Invalid --on-conflict value: ${value}. Use replace, skip, prompt or cancel.`,\n );\n }\n}\n\nexport function toResourceSyncOnConflict(\n value: OnConflictValue | \"merge\" | undefined,\n): \"overwrite\" | \"ignore\" | \"fail\" | undefined {\n if (!value || value === \"merge\" || value === \"prompt\") {\n return undefined;\n }\n switch (value) {\n case \"replace\":\n return \"overwrite\";\n case \"skip\":\n return \"ignore\";\n case \"cancel\":\n return \"fail\";\n default: {\n const _exhaustive: never = value;\n return _exhaustive;\n }\n }\n}\n\nexport function toPluginImportOnConflict(\n value: OnConflictValue | \"merge\" | undefined,\n): \"overwrite\" | \"cancel\" | \"merge\" | undefined {\n if (!value) {\n return undefined;\n }\n switch (value) {\n case \"replace\":\n return \"overwrite\";\n case \"cancel\":\n case \"skip\":\n return \"cancel\";\n case \"merge\":\n return \"merge\";\n case \"prompt\":\n return \"cancel\";\n default: {\n const _exhaustive: never = value;\n return _exhaustive;\n }\n }\n}\n","import { basename } from \"node:path\";\nimport { CliUsageError } from \"../services/cli-errors.js\";\nimport { ensureErrorPrefix } from \"./messages.js\";\nimport { isCommanderError, mapUserFacingError } from \"./user-errors.js\";\n\nexport const GUIDE_SCENARIOS_URL =\n \"https://github.com/harnesstap/harnesstap/blob/main/docs/scenarios/scenarios.md\";\n\nexport const GIT_ORIGIN_HINTS = [\n \"Add a remote: git remote add origin <url>\",\n \"Snapshots, drift, history, and revert require a git repository with origin configured.\",\n];\n\nexport function resolveInvocationName(): \"harnesstap\" | \"ht\" {\n return basename(process.argv[1] ?? \"\") === \"ht\" ? \"ht\" : \"harnesstap\";\n}\n\nexport function shellQuote(value: string): string {\n if (value.length === 0) {\n return '\"\"';\n }\n if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value)) {\n return value;\n }\n return `\"${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"\\\"\", \"\\\\\\\"\")}\"`;\n}\n\n/** DS-6: hints always say `ht` and shell-quote each argument (W2-1, W3-3). */\nexport function formatCommand(pathOrArgs: string | readonly string[]): string {\n if (typeof pathOrArgs === \"string\") {\n const trimmed = pathOrArgs.trim();\n const stripped = trimmed.replace(/^(?:harnesstap|ht)\\s+/, \"\");\n return stripped.length > 0 ? `ht ${stripped}` : \"ht\";\n }\n return [\"ht\", ...pathOrArgs.map(shellQuote)].join(\" \");\n}\n\nexport function formatHintCommand(args: readonly string[]): string {\n return formatCommand(args);\n}\n\nexport function fail(\n message: string,\n opts?: { hint?: string; hints?: string[]; exitCode?: number },\n): void {\n process.exitCode = opts?.exitCode ?? 1;\n console.error(ensureErrorPrefix(message));\n const hints = opts?.hints ?? (opts?.hint ? [opts.hint] : []);\n for (const hint of hints) {\n if (hint.trim().length > 0) {\n console.error(hint);\n }\n }\n}\n\nexport function failCaught(error: unknown, opts?: { exitCode?: number }): void {\n if (error instanceof CliUsageError) {\n fail(error.message, {\n hint: error.hints[0],\n exitCode: opts?.exitCode ?? error.exitCode,\n });\n return;\n }\n const mapped = mapUserFacingError(error);\n const commanderHint = isCommanderError(error)\n ? undefined\n : mapped.hint;\n fail(mapped.message, {\n hint: commanderHint,\n exitCode: opts?.exitCode ?? mapped.exitCode,\n });\n}\n\n/** DS-6: packaged help and scenario playbooks always show `ht`. */\nexport function formatScenarioCommand(path: string): string {\n const trimmed = path.trim();\n const stripped = trimmed.replace(/^(?:harnesstap|ht)\\s+/, \"\");\n return stripped.length > 0 ? `ht ${stripped}` : \"ht\";\n}\n\nexport function collectRepeatedOption(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nexport function reportNoGitOrigin(_retryCommand?: string): void {\n fail(\"No git remote origin configured.\", {\n hint: GIT_ORIGIN_HINTS[0],\n });\n}\n\nexport function isVerboseMode(argv: string[] = process.argv): boolean {\n return argv.includes(\"-v\") || argv.includes(\"--verbose\");\n}\n\nexport function isGroupedCommandFallbackError(error: unknown): error is {\n code: string;\n exitCode: number;\n message: string;\n} {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n\n const candidate = error as {\n code?: unknown;\n exitCode?: unknown;\n message?: unknown;\n };\n\n return candidate.code === \"commander.excessArguments\"\n && candidate.exitCode === 1\n && typeof candidate.message === \"string\"\n && /too many arguments for '(plugin|resource|plugin|auth|migrate|harness|environment|profile)'/i.test(candidate.message);\n}\n","import { CLI_ERRORS, CLI_HINTS } from \"./messages.js\";\nimport { gitFailureHint, mapGitStderr } from \"../utils/git-errors.js\";\n\nexport { gitFailureHint, mapGitStderr } from \"../utils/git-errors.js\";\n\nexport interface MappedCliError {\n message: string;\n hint?: string;\n exitCode: number;\n}\n\nfunction nodePathFromEnoent(error: Error): string | undefined {\n if (\"path\" in error && typeof error.path === \"string\" && error.path.length > 0) {\n return error.path;\n }\n const match = /ENOENT: no such file or directory, (?:stat|open|scandir|mkdir|unlink) '([^']+)'/.exec(\n error.message,\n );\n return match?.[1];\n}\n\nexport function isSqliteUniqueError(error: unknown): boolean {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n const candidate = error as { code?: unknown; message?: unknown };\n const code = typeof candidate.code === \"string\" ? candidate.code : \"\";\n const message = typeof candidate.message === \"string\" ? candidate.message : \"\";\n return (\n code === \"SQLITE_CONSTRAINT_UNIQUE\"\n || code === \"SQLITE_CONSTRAINT\"\n || message.includes(\"UNIQUE constraint failed\")\n );\n}\n\nfunction mapSqliteUnique(message: string): MappedCliError {\n if (message.includes(\"plugins.\")) {\n return {\n message: CLI_ERRORS.uniqueConstraintGeneric.replace(\n \"That name already exists.\",\n \"A plugin with that name already exists.\",\n ),\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n }\n if (message.includes(\"environments\")) {\n return {\n message: \"An environment with that name already exists.\",\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n }\n return {\n message: CLI_ERRORS.uniqueConstraintGeneric,\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n}\n\nfunction commanderExitCode(error: unknown): number {\n if (error && typeof error === \"object\" && \"exitCode\" in error) {\n const raw = (error as { exitCode?: unknown }).exitCode;\n if (typeof raw === \"number\" && raw > 0) {\n return raw;\n }\n }\n return 1;\n}\n\nexport function isCommanderError(error: unknown): boolean {\n if (!error || typeof error !== \"object\" || !(\"code\" in error)) {\n return false;\n }\n return String((error as { code?: unknown }).code ?? \"\").startsWith(\"commander.\");\n}\n\nexport function mapUserFacingError(error: unknown): MappedCliError {\n const exitCode = commanderExitCode(error);\n\n if (error instanceof Error && isSqliteUniqueError(error)) {\n return { ...mapSqliteUnique(error.message), exitCode };\n }\n\n if (error instanceof Error) {\n const code = \"code\" in error ? String((error as { code?: unknown }).code ?? \"\") : \"\";\n if (code === \"ENOENT\") {\n const filePath = nodePathFromEnoent(error);\n return {\n message: CLI_ERRORS.fileNotFound(filePath ?? \"that path\"),\n exitCode,\n };\n }\n const lower = error.message.toLowerCase();\n if (\n lower.includes(\"could not read username\")\n || lower.includes(\"terminal prompts disabled\")\n || lower.includes(\"authentication failed\")\n || /\\bfatal:/.test(lower)\n || error.message.startsWith(\"Couldn't reach\")\n ) {\n return {\n message: mapGitStderr(error.message),\n hint: gitFailureHint(),\n exitCode,\n };\n }\n return { message: error.message, exitCode };\n }\n\n return { message: String(error), exitCode };\n}\n\nexport function commanderHelpHint(commandPath: string): string {\n return CLI_HINTS.seeOptions(commandPath);\n}\n"],"mappings":";;;;;;;;;AAAO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAGvC,YAAY,SAA0B,QAAkB,CAAC,GAAG,WAAW,GAAG;AACxE,UAAM,OAAO;AADuB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