600 Commits

Author SHA1 Message Date
Michel Roegl-Brunner
114bf21444 Merge pull request #10 from michelroegl-brunner/feature/add-vitest-testing
Fix: Resolve failing tests by fixing mock setup
2025-09-11 11:40:18 +02:00
Michel Roegl-Brunner
170d4b71f7 fix: resolve TypeScript linting errors in test files
- Fix unsafe return of any type in ScriptsGrid.test.tsx
- Fix unsafe argument type in scripts.test.ts
- Remove unused variable warning in scripts.test.ts
- All tests now pass TypeScript strict mode validation
2025-09-11 11:38:35 +02:00
Michel Roegl-Brunner
b0af1c8c4a Changes to Readme 2025-09-11 11:35:11 +02:00
Michel Roegl-Brunner
1378a10d69 fix: resolve failing tests by fixing mock setup
- Fixed fs/promises mocks using vi.hoisted() for proper hoisting
- Fixed child_process spawn mocks with proper default exports
- Updated test cases to use direct mock function references
- All 55 tests now passing successfully

The main issues were:
1. Mock functions not properly hoisted causing reference errors
2. Missing default exports in module mocks
3. Incorrect mock function usage in test assertions

Tests now properly mock:
- readdir, stat, readFile from fs/promises
- spawn from child_process
- localScriptsService.getScriptBySlug
2025-09-11 11:32:56 +02:00
Michel Roegl-Brunner
b883a0c3b8 Add comprehensive Vitest testing infrastructure
- Install Vitest, @vitest/ui, @vitest/coverage-v8, and testing libraries
- Configure Vitest with jsdom environment and path aliases
- Add test scripts to package.json (test, test:ui, test:run, test:coverage)
- Create comprehensive test suites:
  - ScriptManager class tests (file operations, validation, execution)
  - React component tests (ScriptsGrid, ResyncButton, Home page)
  - tRPC API router tests (all endpoints with success/error scenarios)
  - Environment configuration tests
- Set up proper mocking infrastructure for fs, child_process, tRPC, and services
- 41/55 tests currently passing with full coverage of core functionality

Test commands:
- npm run test - Run tests in watch mode
- npm run test:run - Run tests once
- npm run test:ui - Run tests with web UI
- npm run test:coverage - Run tests with coverage report
2025-09-11 11:22:51 +02:00
Michel Roegl-Brunner
7f4dc2a820 Fix dependencie issues 2025-09-11 11:01:31 +02:00
Michel Roegl-Brunner
459040863c Change .env 2025-09-11 10:43:39 +02:00
Michel Roegl-Brunner
28603a8f2a Remove postinstall 2025-09-11 10:41:32 +02:00
Michel Roegl-Brunner
e2f48a00d4 Merge pull request #7 from michelroegl-brunner/dependabot/npm_and_yarn/t3-oss/env-nextjs-0.13.8
build(deps): Bump @t3-oss/env-nextjs from 0.12.0 to 0.13.8
2025-09-11 10:40:28 +02:00
dependabot[bot]
3201f56640 build(deps): Bump @t3-oss/env-nextjs from 0.12.0 to 0.13.8
Bumps [@t3-oss/env-nextjs](https://github.com/t3-oss/t3-env/tree/HEAD/packages/nextjs) from 0.12.0 to 0.13.8.
- [Release notes](https://github.com/t3-oss/t3-env/releases)
- [Changelog](https://github.com/t3-oss/t3-env/blob/main/packages/nextjs/CHANGELOG.md)
- [Commits](https://github.com/t3-oss/t3-env/commits/@t3-oss/env-nextjs@0.13.8/packages/nextjs)

---
updated-dependencies:
- dependency-name: "@t3-oss/env-nextjs"
  dependency-version: 0.13.8
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-11 08:40:12 +00:00
Michel Roegl-Brunner
c4e1558773 Merge pull request #6 from michelroegl-brunner/dependabot/npm_and_yarn/tanstack/react-query-5.87.4
build(deps): Bump @tanstack/react-query from 5.87.1 to 5.87.4
2025-09-11 10:38:58 +02:00
Michel Roegl-Brunner
a053275d70 Remove debug console.log statements from WebSocket handler
- Removed verbose debug output from WebSocket connection logs
- Removed script execution debug messages
- Removed input handling debug logs
- Kept important error logging and server startup messages
- WebSocket functionality remains fully intact
2025-09-11 10:38:31 +02:00
Michel Roegl-Brunner
a2f8a2bf75 Update Node.js version matrix in workflow 2025-09-11 09:59:16 +02:00
Michel Roegl-Brunner
a1ea65ac64 Add Node.js CI workflow
This workflow sets up a CI process for Node.js applications, including installation of dependencies, building the code, and running tests across multiple Node.js versions.
2025-09-11 09:58:48 +02:00
dependabot[bot]
a0e08fd5d3 build(deps): Bump @tanstack/react-query from 5.87.1 to 5.87.4
Bumps [@tanstack/react-query](https://github.com/TanStack/query/tree/HEAD/packages/react-query) from 5.87.1 to 5.87.4.
- [Release notes](https://github.com/TanStack/query/releases)
- [Commits](https://github.com/TanStack/query/commits/v5.87.4/packages/react-query)

---
updated-dependencies:
- dependency-name: "@tanstack/react-query"
  dependency-version: 5.87.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-11 07:52:33 +00:00
Michel Roegl-Brunner
39f26477ad Merge pull request #3 from michelroegl-brunner/dependabot/npm_and_yarn/types/node-24.3.1
build(deps-dev): Bump @types/node from 20.19.13 to 24.3.1
2025-09-11 09:51:30 +02:00
Michel Roegl-Brunner
7dd6b3030f Merge pull request #4 from michelroegl-brunner/dependabot/npm_and_yarn/prisma/client-6.16.0
build(deps): Bump @prisma/client from 6.15.0 to 6.16.0
2025-09-11 09:51:22 +02:00
Michel Roegl-Brunner
9cfc319645 Merge pull request #9 from michelroegl-brunner/feature/script-execution
feat: improve script execution and local file handling
2025-09-11 09:32:22 +02:00
Michel Roegl-Brunner
89ab32e1b0 feat: improve script execution and local file handling
- Fix lxc-attach command in build.func line 1341 to use pct exec for consistency
- Add alternative lxc-attach method for script execution using local files
- Fix FUNCTIONS_FILE_PATH to include core.func, tools.func, and install.func content
- Replace GitHub curl downloads with local file sources in build.func
- Update install.func to work with FUNCTIONS_FILE_PATH approach
- Add support for local config-file.func and alpine-install.func
- Add new install scripts: 2fauth-install.sh and alpine-install.sh
- Add new CT scripts: 2fauth.sh and alpine.sh

This improves script execution reliability and removes dependency on GitHub downloads.
2025-09-11 09:28:43 +02:00
dependabot[bot]
168957dcd6 build(deps): Bump @prisma/client from 6.15.0 to 6.16.0
Bumps [@prisma/client](https://github.com/prisma/prisma/tree/HEAD/packages/client) from 6.15.0 to 6.16.0.
- [Release notes](https://github.com/prisma/prisma/releases)
- [Commits](https://github.com/prisma/prisma/commits/6.16.0/packages/client)

---
updated-dependencies:
- dependency-name: "@prisma/client"
  dependency-version: 6.16.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-10 18:40:19 +00:00
dependabot[bot]
2c0c005bdf build(deps-dev): Bump @types/node from 20.19.13 to 24.3.1
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.19.13 to 24.3.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 24.3.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-10 18:39:36 +00:00
Michel Roegl-Brunner
167d5ab262 Set package ecosystem to 'npm' in dependabot config 2025-09-10 20:09:17 +02:00
Michel Roegl-Brunner
61c6a27365 Change Dependabot update schedule to daily 2025-09-10 20:07:15 +02:00
Michel Roegl-Brunner
2a642549f5 Merge pull request #2 from michelroegl-brunner/feature/script-list-from-github
Feature/script list from GitHub
2025-09-10 16:27:37 +02:00
Michel Roegl-Brunner
57293b9e59 Fix script execution issues and improve container creation
- Fixed syntax errors in build.func (duplicate export, unmatched quotes)
- Fixed color variable initialization by calling load_functions in core.func
- Replaced undefined function calls (post_to_api, post_update_to_api) with echo statements
- Fixed install script execution by copying scripts into container first
- Made create_lxc.sh executable
- Improved error handling and script sourcing
- Added missing core functions and tools
- Enhanced script downloader and local script management
2025-09-10 16:26:29 +02:00
Michel Roegl-Brunner
e941e212a8 fix: Make TextViewer scrollable for long scripts
- Add proper flex layout with overflow handling
- Use flex-1 and overflow-auto for scrollable content area
- Change height to minHeight for SyntaxHighlighter
- Ensure content can scroll when scripts are longer than viewport
- Maintain proper layout structure for both tabs
2025-09-10 15:19:35 +02:00
Michel Roegl-Brunner
d945053014 fix: Fix TextViewer tRPC hook usage error
- Replace direct tRPC hook calls with fetch requests
- Fix 'hooks[lastArg] is not a function' error
- Use proper tRPC API endpoint format with JSON encoding
- Remove unused tRPC import from TextViewer component
2025-09-10 15:18:31 +02:00
Michel Roegl-Brunner
93f51ddbe9 feat: Add Text Viewer component with bash syntax highlighting
- Create TextViewer component for displaying script code
- Add react-syntax-highlighter for bash syntax highlighting
- Implement tabbed interface for CT and install scripts
- Add getScriptContent tRPC endpoint for secure file reading
- Update ScriptsList to use TextViewer for View button
- Include security checks to prevent path traversal
- Support both CT and install script viewing in same modal
- Add line numbers and proper code formatting
2025-09-10 15:17:15 +02:00
Michel Roegl-Brunner
2e743490c9 feat: Remove executable check and add logo support for local scripts
- Remove executable check from ScriptsList component
- All scripts now show as runnable regardless of permissions
- Add logo support using JSON data from script metadata
- Update ScriptInfo interface to include logo and slug fields
- Modify getCtScripts to fetch logo from corresponding JSON files
- Update ScriptsList UI to display logos with fallback to file icons
- Fix TypeScript errors for proper type safety
2025-09-10 15:13:08 +02:00
Michel Roegl-Brunner
7258f7bcfd fix: Update local scripts tab to scan /scripts/ct directory
- Add getCtScripts() method to ScriptManager to scan ct subdirectory
- Add getCtScripts tRPC endpoint for local scripts tab
- Update ScriptsList component to use getCtScripts instead of getScripts
- Fix script path construction to use relative paths for terminal
- Local scripts tab now correctly shows scripts from /scripts/ct folder
2025-09-10 15:10:10 +02:00
Michel Roegl-Brunner
c739196dc2 fix: Use resolved absolute path for script execution
- Fix script execution by using resolvedPath instead of scriptPath
- This ensures the correct absolute path is used when spawning bash
- Previously was looking for scripts/ct/script.sh inside scripts/ directory
- Now correctly uses /root/Dev/PVESciptslocal/scripts/ct/script.sh
2025-09-10 15:06:40 +02:00
Michel Roegl-Brunner
c60e5e6a1d feat: Add Install button to script detail modal
- Add Install button that appears when script files are loaded
- Integrate with existing terminal component for script execution
- Pass correct script path to terminal (scripts/ct/script.sh)
- Close modal when installation starts
- Add proper TypeScript handling for union types
- Install button only shows when CT script is available locally
2025-09-10 15:04:02 +02:00
Michel Roegl-Brunner
17e0cea16b fix: Update script files status after successful loading
- Add refetchScriptFiles to checkScriptFiles query
- Call refetchScriptFiles after successful script loading
- This ensures the status indicators update immediately after loading
2025-09-10 15:00:41 +02:00
Michel Roegl-Brunner
2539957639 feat: Add Load Script functionality to script detail modal
- Create ScriptDownloaderService to download and modify script files from GitHub
- Add tRPC routes for loading scripts and checking file existence
- Add Load Script button to ScriptDetailModal with loading states
- Implement sed replacement for build.func source line in CT scripts
- Download CT scripts to scripts/ct/ and install scripts to scripts/install/
- Add visual indicators for script file availability
- Show success/error messages for script loading operations
2025-09-10 14:58:37 +02:00
Michel Roegl-Brunner
97753f7647 fix: Handle notes as objects with text and type properties
- Update Script type to handle notes as objects with text and type
- Add ScriptNote interface for structured note format
- Update ScriptDetailModal to render notes with proper styling based on type
- Add backward compatibility for string notes
- Fix React error 'Objects are not valid as a React child'
2025-09-10 14:54:07 +02:00
Michel Roegl-Brunner
d7d532069a fix: Make GitHub service optional and add debug logging
- Make GitHub service work without REPO_URL environment variable
- Add debug logging to ScriptsGrid to troubleshoot rendering issues
- Improve error handling for missing GitHub configuration
2025-09-10 14:50:16 +02:00
Michel Roegl-Brunner
78144d2641 fix: Add defensive programming and error handling to ScriptCard and ScriptsGrid
- Add null checks for script properties to prevent undefined errors
- Add proper key props to prevent React warnings
- Add validation for script objects before rendering
- Improve error handling for missing or malformed data
2025-09-10 14:49:19 +02:00
Michel Roegl-Brunner
bd1af66828 added json files 2025-09-10 14:47:48 +02:00
Michel Roegl-Brunner
43b4b30415 cleanup: Remove debug information from ScriptsGrid component 2025-09-10 14:44:38 +02:00
Michel Roegl-Brunner
18f6ebae18 feat: Switch to local JSON files as primary source with GitHub resync
- Create LocalScriptsService to read from scripts/json directory
- Update tRPC routes to use local files by default
- Implement resync functionality to download from GitHub and save locally
- Make GitHub optional - only needed for resyncing
- Update UI to reflect local-first approach
- Add proper error handling for missing local files
2025-09-10 14:44:02 +02:00
Michel Roegl-Brunner
4059b5a12f fix: Fix card click functionality and add environment variable validation
- Fix ScriptsGrid to properly handle card clicks by using selectedSlug state
- Add proper error handling for missing REPO_URL environment variable
- Add debug information for development mode
- Improve error messages to guide users on environment setup
2025-09-10 14:40:50 +02:00
Michel Roegl-Brunner
996fce1e11 feat: Add GitHub script list functionality with cards and modal
- Add JSON_FOLDER environment variable for GitHub repo JSON path
- Create TypeScript types for script JSON structure
- Implement GitHub API service to fetch scripts from repository
- Add tRPC routes for script management (getScriptCards, getAllScripts, getScriptBySlug, resyncScripts)
- Create ScriptCard component for displaying script information
- Create ScriptDetailModal for full script details view
- Create ScriptsGrid component with loading and error states
- Add ResyncButton component for refreshing scripts from upstream
- Update main page with tabbed interface (GitHub Scripts vs Local Scripts)
- Add proper error handling and loading states throughout
2025-09-10 14:37:37 +02:00
Michel Roegl-Brunner
69eec5f2ab Ammend Readme 2025-09-09 16:06:44 +02:00
Michel Roegl-Brunner
1ea37e5ce7 Ammend Readme 2025-09-09 16:06:17 +02:00
Michel Roegl-Brunner
76d702c999 Ammend .env.example 2025-09-09 16:03:49 +02:00
Michel Roegl-Brunner
030cd9ec9a Got the terminal working 2025-09-09 16:03:17 +02:00
Michel Roegl-Brunner
bd7a85789b Merge pull request #1 from michelroegl-brunner/PoC
Proof Of Concept
2025-09-09 14:25:52 +02:00
Rögl-Brunner Michel
6ee5c5c017 PoC 2025-09-09 14:24:36 +02:00
Rögl-Brunner Michel
cc47399e0c Remove Read Me content 2025-09-09 14:05:35 +02:00
Rögl-Brunner Michel
178eee664a initial commit 2025-09-09 14:04:07 +02:00