코드 정리 및 시스템 프롬프트 수정#122
Conversation
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Bumps the general group with 2 updates: [openai](https://github.com/openai/openai-node) and [wrangler](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler). Updates `openai` from 5.10.1 to 5.10.2 - [Release notes](https://github.com/openai/openai-node/releases) - [Changelog](https://github.com/openai/openai-node/blob/master/CHANGELOG.md) - [Commits](openai/openai-node@v5.10.1...v5.10.2) Updates `wrangler` from 4.25.0 to 4.25.1 - [Release notes](https://github.com/cloudflare/workers-sdk/releases) - [Changelog](https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/CHANGELOG.md) - [Commits](https://github.com/cloudflare/workers-sdk/commits/wrangler@4.25.1/packages/wrangler) --- updated-dependencies: - dependency-name: openai dependency-version: 5.10.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: general - dependency-name: wrangler dependency-version: 4.25.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: general ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the general group with 2 updates: [redis](https://github.com/redis/node-redis) and [wrangler](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler). Updates `redis` from 5.6.0 to 5.6.1 - [Release notes](https://github.com/redis/node-redis/releases) - [Changelog](https://github.com/redis/node-redis/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/node-redis/compare/redis@5.6.0...redis@5.6.1) Updates `wrangler` from 4.25.1 to 4.26.0 - [Release notes](https://github.com/cloudflare/workers-sdk/releases) - [Changelog](https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/CHANGELOG.md) - [Commits](https://github.com/cloudflare/workers-sdk/commits/wrangler@4.26.0/packages/wrangler) --- updated-dependencies: - dependency-name: redis dependency-version: 5.6.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: general - dependency-name: wrangler dependency-version: 4.26.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: general ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the general group with 1 update: [dotenv](https://github.com/motdotla/dotenv). Updates `dotenv` from 17.2.0 to 17.2.1 - [Changelog](https://github.com/motdotla/dotenv/blob/master/CHANGELOG.md) - [Commits](motdotla/dotenv@v17.2.0...v17.2.1) --- updated-dependencies: - dependency-name: dotenv dependency-version: 17.2.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: general ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Bumps the general group with 2 updates: [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) and [wrangler](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler). Updates `@biomejs/biome` from 2.1.2 to 2.1.3 - [Release notes](https://github.com/biomejs/biome/releases) - [Changelog](https://github.com/biomejs/biome/blob/main/packages/@biomejs/biome/CHANGELOG.md) - [Commits](https://github.com/biomejs/biome/commits/@biomejs/biome@2.1.3/packages/@biomejs/biome) Updates `wrangler` from 4.26.0 to 4.26.1 - [Release notes](https://github.com/cloudflare/workers-sdk/releases) - [Changelog](https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/CHANGELOG.md) - [Commits](https://github.com/cloudflare/workers-sdk/commits/wrangler@4.26.1/packages/wrangler) --- updated-dependencies: - dependency-name: "@biomejs/biome" dependency-version: 2.1.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: general - dependency-name: wrangler dependency-version: 4.26.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: general ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the general group with 1 update: [openai](https://github.com/openai/openai-node). Updates `openai` from 5.10.2 to 5.11.0 - [Release notes](https://github.com/openai/openai-node/releases) - [Changelog](https://github.com/openai/openai-node/blob/master/CHANGELOG.md) - [Commits](openai/openai-node@v5.10.2...v5.11.0) --- updated-dependencies: - dependency-name: openai dependency-version: 5.11.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: general ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the general group with 2 updates: [redis](https://github.com/redis/node-redis) and [wrangler](https://github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler). Updates `redis` from 5.6.1 to 5.7.0 - [Release notes](https://github.com/redis/node-redis/releases) - [Changelog](https://github.com/redis/node-redis/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/node-redis/compare/redis@5.6.1...redis@5.7.0) Updates `wrangler` from 4.26.1 to 4.27.0 - [Release notes](https://github.com/cloudflare/workers-sdk/releases) - [Changelog](https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/CHANGELOG.md) - [Commits](https://github.com/cloudflare/workers-sdk/commits/wrangler@4.27.0/packages/wrangler) --- updated-dependencies: - dependency-name: redis dependency-version: 5.7.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: general - dependency-name: wrangler dependency-version: 4.27.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: general ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
한번만 사용되는 코드를 함수화시켜 놓은 것을 삭제함.
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Deprecated code
가독성 향상을 위한 확실한 문단 구분을 시스템 프롬프트에 추가.
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR performs code cleanup and system prompt modifications for better maintainability and functionality. The changes include removing deprecated middleware, updating error response codes, and enhancing AI response formatting.
- Return 204 No Content when planner has no tasks instead of 404 Not Found
- Remove deprecated security and logging middleware functions
- Add markdown formatting system prompt for AI responses
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/services/ai.mjs | Added system prompt for markdown formatting in AI responses |
| src/routes/api/planner.mjs | Changed empty tasks response from 404 to 204 status code |
| src/routes/admin/system.mjs | Optimized system info collection by caching values |
| src/routes/admin/stats.mjs | Added memory heap snapshot endpoint |
| src/middleware/security.mjs | Removed deprecated authentication and security middleware |
| src/middleware/logging.mjs | Removed entire deprecated logging middleware file |
| src/config/sessionConfig.mjs | Removed deprecated session storage function |
| src/config/security.mjs | Removed deprecated security configuration file |
| src/config/app.mjs | Inlined security configuration from deleted file |
| package.json | Updated dev dependencies versions |
| } catch (error) { | ||
| if (error.message === "TASKS_NOT_FOUND") { | ||
| return res.status(404).json({ message: "작업을 찾을 수 없습니다" }); | ||
| return res.status(204).send("작업이 없습니다"); |
There was a problem hiding this comment.
HTTP 204 No Content responses should not include a response body. Consider using res.status(204).send() without the message, or use status 200 with an empty array/object if you need to include a message.
| return res.status(204).send("작업이 없습니다"); | |
| return res.status(204).send(); |
| */ | ||
| router.get("/memory", async (req, res) => { | ||
| try { | ||
| writeHeapSnapshot(); |
There was a problem hiding this comment.
The writeHeapSnapshot() function can throw errors, but there's no indication to the caller about the filename or location where the snapshot was written. Consider providing more informative feedback about the operation's success.
| writeHeapSnapshot(); | |
| const snapshotFilename = writeHeapSnapshot(); | |
| res.json({ | |
| success: true, | |
| message: "메모리 사용량 스냅샷이 생성되었습니다.", | |
| filename: snapshotFilename, | |
| }); |
| export const setupSecurityMiddleware = (app) => { | ||
| const securityConfig = getSecurityConfig(); | ||
| const securityConfig = { | ||
| contentSecurityPolicy: { | ||
| directives: { | ||
| defaultSrc: ["'self'"], | ||
| scriptSrc: ["'self'", "'unsafe-inline'"], | ||
| styleSrc: ["'self'", "'unsafe-inline'"], | ||
| imgSrc: ["'self'", "data:", "https:"], | ||
| connectSrc: ["'self'"], | ||
| fontSrc: ["'self'", "data:", "https:"], | ||
| baseUri: ["'self'"], | ||
| objectSrc: ["'none'"], | ||
| frameSrc: ["'none'"], | ||
| mediaSrc: ["'self'"], | ||
| manifestSrc: ["'self'"], | ||
| }, | ||
| reportOnly: false, | ||
| }, | ||
|
|
||
| crossOriginEmbedderPolicy: { | ||
| policy: "require-corp", | ||
| }, | ||
|
|
||
| crossOriginOpenerPolicy: { | ||
| policy: "same-origin", | ||
| }, | ||
|
|
||
| crossOriginResourcePolicy: { | ||
| policy: "cross-origin", | ||
| }, | ||
|
|
||
| dnsPrefetchControl: { | ||
| allow: false, | ||
| }, | ||
|
|
||
| frameguard: { | ||
| action: "deny", | ||
| }, | ||
|
|
||
| hidePoweredBy: true, | ||
|
|
||
| hsts: { | ||
| maxAge: 31536000, | ||
| includeSubDomains: true, | ||
| preload: true, | ||
| }, | ||
|
|
||
| ieNoOpen: true, | ||
|
|
||
| noSniff: true, | ||
|
|
||
| originAgentCluster: true, | ||
|
|
||
| permittedCrossDomainPolicies: { | ||
| permittedPolicies: "none", | ||
| }, | ||
|
|
||
| referrerPolicy: { | ||
| policy: ["no-referrer", "strict-origin-when-cross-origin"], | ||
| }, | ||
|
|
||
| xssFilter: true, | ||
| }; |
There was a problem hiding this comment.
The security configuration is now inlined in this function, making it harder to maintain and test. Consider extracting it to a separate constant or function within this file to improve readability and maintainability.
코드 정리 및 시스템 프롬프트 수정
주요 변화