251148c3ff
## Summary - add repository-wide quality tooling and verification scaffolding, including CI workflows, pnpm workspace setup, ESLint/Prettier/markdown checks, and generated-output verification helpers - reorganize skill sources and generation flow by introducing canonical `_source` variants, generator/manifests, reusable helper abstractions, and shared web-automation/browser utilities - clean up and expand documentation so the root README flows into docs and skill docs, with clearer development, reviewer, installer, and workflow guidance ## Notable changes - docs flow and consistency cleanup across `README.md`, `docs/README.md`, and related docs - new scripts for `check`, docs verification, generated-file verification, shell portability, and safe directory replacement - refactors in Atlassian and web-automation skill runtimes to reduce duplication and centralize reusable code - changelog, development documentation, and CI surface updates ## Test Plan - [ ] `pnpm run check` - [ ] review generated/manifests and skill sync outputs - [ ] smoke-check docs flow from `README.md` to `docs/README.md` to skill docs ## Notes - this branch currently includes tracked `skills/web-automation/shared/node_modules` content that should be reviewed carefully as potentially noisy/accidental committed artifacts Co-authored-by: Stefano Fiorini <stefano.fiorini@firsthorizon.com> Reviewed-on: #1
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`.
|
||
import path from "node:path";
|
||
|
||
import { config as loadDotEnv } from "dotenv";
|
||
|
||
import type { AtlassianConfig } from "./types.js";
|
||
|
||
function normalizeBaseUrl(value: string) {
|
||
return value.replace(/\/+$/, "");
|
||
}
|
||
|
||
function readRequired(env: NodeJS.ProcessEnv, key: string) {
|
||
const value = env[key]?.trim();
|
||
|
||
if (!value) {
|
||
throw new Error(`Missing required environment variable: ${key}`);
|
||
}
|
||
|
||
return value;
|
||
}
|
||
|
||
export function loadConfig(
|
||
env: NodeJS.ProcessEnv = process.env,
|
||
options?: {
|
||
cwd?: string;
|
||
},
|
||
): AtlassianConfig {
|
||
loadDotEnv({
|
||
path: path.resolve(options?.cwd ?? process.cwd(), ".env"),
|
||
processEnv: env as Record<string, string>,
|
||
override: false,
|
||
});
|
||
|
||
const baseUrl = normalizeBaseUrl(readRequired(env, "ATLASSIAN_BASE_URL"));
|
||
|
||
return {
|
||
baseUrl,
|
||
jiraBaseUrl: normalizeBaseUrl(env.ATLASSIAN_JIRA_BASE_URL?.trim() || baseUrl),
|
||
confluenceBaseUrl: normalizeBaseUrl(env.ATLASSIAN_CONFLUENCE_BASE_URL?.trim() || baseUrl),
|
||
email: readRequired(env, "ATLASSIAN_EMAIL"),
|
||
apiToken: readRequired(env, "ATLASSIAN_API_TOKEN"),
|
||
defaultProject: env.ATLASSIAN_DEFAULT_PROJECT?.trim() || undefined,
|
||
defaultSpace: env.ATLASSIAN_DEFAULT_SPACE?.trim() || undefined,
|
||
};
|
||
}
|
||
|
||
export function createBasicAuthHeader(config: {
|
||
email: string;
|
||
apiToken: string;
|
||
[key: string]: unknown;
|
||
}) {
|
||
return `Basic ${Buffer.from(`${config.email}:${config.apiToken}`).toString("base64")}`;
|
||
}
|