chore: fix env variables (#1204)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Ralph Khreish
2025-09-13 01:34:50 +02:00
committed by GitHub
parent 83af314879
commit 799d1d2cce
9 changed files with 84 additions and 51 deletions

View File

@@ -61,7 +61,7 @@ jobs:
timeout-minutes: 5
- name: Typecheck
run: npm run typecheck
run: npm run turbo:typecheck
env:
FORCE_COLOR: 1
@@ -84,7 +84,7 @@ jobs:
timeout-minutes: 5
- name: Build
run: npm run build
run: npm run turbo:build
env:
NODE_ENV: production
FORCE_COLOR: 1

View File

@@ -105,9 +105,9 @@ export const TaskMetadataSidebar: React.FC<TaskMetadataSidebarProps> = ({
if (!currentTask || isStartingTask) {
return;
}
setIsStartingTask(true);
// Send message to extension to open terminal
if (vscode) {
vscode.postMessage({
@@ -116,7 +116,7 @@ export const TaskMetadataSidebar: React.FC<TaskMetadataSidebarProps> = ({
taskTitle: currentTask.title
});
}
// Reset loading state after a short delay
setTimeout(() => {
setIsStartingTask(false);
@@ -318,7 +318,13 @@ export const TaskMetadataSidebar: React.FC<TaskMetadataSidebarProps> = ({
variant="default"
size="sm"
className="w-full text-xs"
disabled={isRegenerating || isAppending || isStartingTask || currentTask?.status === 'done'}
disabled={
isRegenerating ||
isAppending ||
isStartingTask ||
currentTask?.status === 'done' ||
currentTask?.status === 'in-progress'
}
>
{isStartingTask ? (
<Loader2 className="w-4 h-4 mr-2 animate-spin" />

View File

@@ -202,16 +202,16 @@ export const TaskDetailsView: React.FC<TaskDetailsViewProps> = ({
/>
</div>
{/* Right column - Metadata (1/3 width) */}
<TaskMetadataSidebar
currentTask={currentTask}
tasks={allTasks}
complexity={complexity}
isSubtask={isSubtask}
sendMessage={sendMessage}
onStatusChange={handleStatusChange}
onDependencyClick={handleDependencyClick}
/>
{/* Right column - Metadata (1/3 width) */}
<TaskMetadataSidebar
currentTask={currentTask}
tasks={allTasks}
complexity={complexity}
isSubtask={isSubtask}
sendMessage={sendMessage}
onStatusChange={handleStatusChange}
onDependencyClick={handleDependencyClick}
/>
</div>
</div>
);

View File

@@ -363,20 +363,25 @@ export class WebviewManager {
case 'openTerminal':
// Open VS Code terminal for task execution
this.logger.info(`Opening terminal for task ${data.taskId}: ${data.taskTitle}`);
this.logger.log(
`Opening terminal for task ${data.taskId}: ${data.taskTitle}`
);
try {
const terminal = vscode.window.createTerminal({
name: `Task ${data.taskId}: ${data.taskTitle}`,
cwd: this.workspaceRoot
cwd: vscode.workspace.workspaceFolders?.[0]?.uri.fsPath
});
terminal.show();
this.logger.info('Terminal created and shown successfully');
this.logger.log('Terminal created and shown successfully');
response = { success: true };
} catch (error) {
this.logger.error('Failed to create terminal:', error);
response = { success: false, error: error.message };
response = {
success: false,
error: error instanceof Error ? error.message : 'Unknown error'
};
}
break;

3
package-lock.json generated
View File

@@ -31274,9 +31274,12 @@
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@tm/build-config": "*",
"@types/node": "^20.11.30",
"@vitest/coverage-v8": "^2.0.5",
"dotenv-mono": "^1.3.14",
"ts-node": "^10.9.2",
"tsup": "^8.5.0",
"typescript": "^5.4.3",
"vitest": "^2.0.5"
},

View File

@@ -15,6 +15,7 @@
"dev": "tsup --watch",
"turbo:dev": "turbo dev",
"turbo:build": "turbo build",
"turbo:typecheck": "turbo typecheck",
"dev:main": "tsup --watch --onSuccess 'echo \"📦 Main package built\" && npm link'",
"dev:legacy": "npm run build:build-config && concurrently -n \"core,cli,main\" -c \"blue,green,yellow\" \"npm run dev:core\" \"npm run dev:cli\" \"npm run dev:main\"",
"dev:core": "npm run dev -w @tm/core",
@@ -24,10 +25,6 @@
"build:build-config": "npm run build -w @tm/build-config",
"build:core": "npm run build -w @tm/core",
"build:cli": "npm run build -w @tm/cli",
"typecheck": "turbo typecheck",
"typecheck:all": "turbo typecheck",
"typecheck:core": "npm run typecheck -w @tm/core",
"typecheck:cli": "npm run typecheck -w @tm/cli",
"test": "node --experimental-vm-modules node_modules/.bin/jest",
"test:unit": "node --experimental-vm-modules node_modules/.bin/jest --testPathPattern=unit",
"test:integration": "node --experimental-vm-modules node_modules/.bin/jest --testPathPattern=integration",

View File

@@ -3,38 +3,17 @@
* Provides shared configuration that can be extended by individual packages
*/
import type { Options } from 'tsup';
import * as dotenv from 'dotenv-mono';
dotenv.load();
console.log(
'TM_PUBLIC_BASE_DOMAIN:',
process.env.TM_PUBLIC_BASE_DOMAIN,
'TM_PUBLIC_SUPABASE_URL:',
process.env.TM_PUBLIC_SUPABASE_URL,
'TM_PUBLIC_SUPABASE_ANON_KEY:',
process.env.TM_PUBLIC_SUPABASE_ANON_KEY
);
const isProduction = process.env.NODE_ENV === 'production';
const isDevelopment = !isProduction;
const envVariables = {
TM_PUBLIC_BASE_DOMAIN: process.env.TM_PUBLIC_BASE_DOMAIN ?? '',
TM_PUBLIC_SUPABASE_URL: process.env.TM_PUBLIC_SUPABASE_URL ?? '',
TM_PUBLIC_SUPABASE_ANON_KEY: process.env.TM_PUBLIC_SUPABASE_ANON_KEY ?? ''
};
console.log('envVariables:', envVariables);
/**
* Environment helpers
*/
export const env = {
isProduction,
isDevelopment,
NODE_ENV: process.env.NODE_ENV || 'development',
...envVariables
NODE_ENV: process.env.NODE_ENV || 'development'
};
/**
@@ -52,7 +31,6 @@ export const baseConfig: Partial<Options> = {
splitting: false,
// Don't bundle any other dependencies (auto-external all node_modules)
external: [/^[^./]/],
env: envVariables,
esbuildOptions(options) {
options.platform = 'node';
// Allow importing TypeScript from JavaScript

View File

@@ -53,8 +53,8 @@
}
},
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"build": "tsup",
"dev": "tsup --watch",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
@@ -71,9 +71,12 @@
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@tm/build-config": "*",
"@types/node": "^20.11.30",
"@vitest/coverage-v8": "^2.0.5",
"dotenv-mono": "^1.3.14",
"ts-node": "^10.9.2",
"tsup": "^8.5.0",
"typescript": "^5.4.3",
"vitest": "^2.0.5"
},

View File

@@ -0,0 +1,41 @@
import { defineConfig } from 'tsup';
import { baseConfig, mergeConfig } from '@tm/build-config';
import { load as dotenvLoad } from 'dotenv-mono';
dotenvLoad();
// Get all TM_PUBLIC_* env variables for build-time injection
const getBuildTimeEnvs = () => {
const envs: Record<string, string> = {};
for (const [key, value] of Object.entries(process.env)) {
if (key.startsWith('TM_PUBLIC_')) {
// Return the actual value, not JSON.stringify'd
envs[key] = value || '';
}
}
return envs;
};
export default defineConfig(
mergeConfig(baseConfig, {
entry: {
index: 'src/index.ts',
'auth/index': 'src/auth/index.ts',
'config/index': 'src/config/index.ts',
'errors/index': 'src/errors/index.ts',
'interfaces/index': 'src/interfaces/index.ts',
'logger/index': 'src/logger/index.ts',
'parser/index': 'src/parser/index.ts',
'providers/index': 'src/providers/index.ts',
'services/index': 'src/services/index.ts',
'storage/index': 'src/storage/index.ts',
'types/index': 'src/types/index.ts',
'utils/index': 'src/utils/index.ts'
},
format: ['esm'],
dts: true,
outDir: 'dist',
// Replace process.env.TM_PUBLIC_* with actual values at build time
env: getBuildTimeEnvs()
})
);