From 80b0325b371e4e92e4c679680ce72f91e0fb2ace Mon Sep 17 00:00:00 2001 From: Chris Hatch Date: Sat, 14 Mar 2026 05:42:04 +1000 Subject: [PATCH 1/3] type check improvements and fixes add typecheck and test to pre-commit --- .husky/pre-commit | 1 + package.json | 1 + src/execute-sql.ts | 10 ++++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 5ee7abd..10a68e8 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,2 @@ pnpm exec lint-staged +pnpm typecheck diff --git a/package.json b/package.json index 76bf497..39de9d0 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "lint": "pnpm lint:eslint && pnpm lint:prettier", "lint:eslint": "eslint '**/*.{ts,tsx,js,jsx}' --ignore-pattern '**/eslint.config.js'", "lint:prettier": "prettier '**/*.{ts,tsx,js,jsx,json,md,yaml,yml}' --check || echo '⚠️ Warning: Prettier formatting issues found. Run \"pnpm fixstyle\" to fix them.'", + "typecheck": "tsc --noEmit", "fixall": "pnpm fixstyle && pnpm fixsrc", "fixsrc": "eslint '**/*.{ts,tsx,js,jsx}' --ignore-pattern '**/eslint.config.js' --fix", "fixstyle": "prettier '**/*.{ts,tsx,js,jsx,json,md,yaml,yml}' --write", diff --git a/src/execute-sql.ts b/src/execute-sql.ts index b51de95..592d96f 100644 --- a/src/execute-sql.ts +++ b/src/execute-sql.ts @@ -6,8 +6,11 @@ const executeSql = async (req: { }): Promise> => { console.log("\n=== Executing Custom SQL Query ==="); - if (getAppContext()?.environmentType === `PRODUCTION`) { - const errorMsg = `executeSql is disabled in PRODUCTION for security.`; + const appContext = getAppContext(); + if (!appContext || appContext.environmentType === `PRODUCTION`) { + const errorMsg = !appContext + ? `executeSql requires a valid Forge context.` + : `executeSql is disabled in PRODUCTION for security.`; console.log(errorMsg); return getHttpResponse(403, { success: false, @@ -16,11 +19,10 @@ const executeSql = async (req: { } const payload = req.body; - let sqlRequest: { query?: string } | null = null; let query: string | undefined; try { - sqlRequest = JSON.parse(payload); + const sqlRequest: { query?: string } | null = JSON.parse(payload); query = sqlRequest?.query; if (!query) { From cc6cbdc8b73e044377ee5cd92e23785e2f0e45fd Mon Sep 17 00:00:00 2001 From: Chris Hatch Date: Sat, 14 Mar 2026 05:43:03 +1000 Subject: [PATCH 2/3] README.md - small markdown lint fix - newline --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e816b58..db97826 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Interactive CLI for querying Atlassian Forge SQL databases via web triggers. Announcement and discussion on dev forum: [here](https://community.developer.atlassian.com/t/introducing-fsql-an-interactive-cli-for-querying-forge-sql-databases-via-web-triggers/98076) + ## Demo ![demo](demo-usage.gif) From 7adffb6c6d398cbd581a6cd4e19079712bac8200 Mon Sep 17 00:00:00 2001 From: Chris Hatch Date: Sat, 14 Mar 2026 05:56:37 +1000 Subject: [PATCH 3/3] Add typecheck step to CI workflow --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab42638..8ba5b6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,5 +31,8 @@ jobs: - name: Run lint run: pnpm lint + - name: Run typecheck + run: pnpm typecheck + - name: Run tests run: pnpm vitest run