refactor/v1.1.3#24
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR primarily applies a Prettier-driven formatting pass across the TypeScript/JS/YAML codebase, while also including a few behavior-affecting refactors in the engine and bootstrap layers (notably Docker image build temp handling and service-action error logging).
Changes:
- Standardize code style across the repo and add Prettier configuration (
prettier,.prettierrc,.prettierignore). - Refactor Docker image build temp directory creation to use
mkdirTemp(...)and remove the build worker file. - Improve
engine/middleerror logging/publishing behavior and simplify app boot options (remove worker-related toggles).
Reviewed changes
Copilot reviewed 97 out of 103 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Formatting only (JSON layout). |
| tests/testUtils.ts | Formatting only. |
| tests/engine/middle.test.ts | Formatting only. |
| tests/engine/image.test.ts | Formatting only. |
| tests/database/manager.test.ts | Formatting only. |
| tests/api/api.test.ts | Formatting and boot option usage update. |
| src/util/yaml.ts | Formatting only. |
| src/util/services.ts | Formatting only. |
| src/util/routes.ts | Formatting only. |
| src/util/promises.ts | Formatting only. |
| src/util/port.ts | Formatting only. |
| src/util/env.ts | Formatting only. |
| src/util/docker.ts | Formatting only. |
| src/util/clock.ts | Formatting only. |
| src/server.ts | Formatting only. |
| src/security/token/index.ts | Formatting only. |
| src/security/index.ts | Formatting only. |
| src/router/v1/status/index.ts | Formatting only. |
| src/router/v1/session/sessionLogsRoute.ts | Formatting only. |
| src/router/v1/service/stopRoute.ts | Formatting plus response payload consistency issue (status field). |
| src/router/v1/service/stopCmdRoute.ts | Formatting plus typo/unused import issues. |
| src/router/v1/service/sessionsRoute.ts | Formatting only. |
| src/router/v1/service/resumeRoute.ts | Formatting plus response payload consistency issue (status field). |
| src/router/v1/service/rebootRoute.ts | Formatting only. |
| src/router/v1/service/powerStatusRoute.ts | Formatting only. |
| src/router/v1/service/optionsRoute.ts | Formatting plus typo in error message. |
| src/router/v1/service/lookupRoute.ts | Formatting only. |
| src/router/v1/service/logsRoute.ts | Formatting only. |
| src/router/v1/service/listRoute.ts | Formatting only. |
| src/router/v1/service/deleteRoute.ts | Formatting only. |
| src/router/v1/service/createRoute.ts | Formatting only. |
| src/router/v1/index.ts | Formatting only. |
| src/router/util/preconditions.ts | Formatting only. |
| src/router/index.ts | Formatting + small refactor of route registration flow. |
| src/resources.ts | Formatting only. |
| src/profiler/index.ts | Formatting only. |
| src/networking/manager.ts | Formatting + introduces missing crypto import (breaks randomUUID() usage). |
| src/logger.ts | Formatting only. |
| src/lib/isInsideContainer.ts | Removed container-detection helper. |
| src/lib/isDocker.ts | Removed Docker-detection helper. |
| src/helpers.ts | Formatting only. |
| src/filestructure.ts | Add mkdirTemp(...) helper and formatting updates. |
| src/engine/template.ts | Formatting only. |
| src/engine/session.ts | Formatting only. |
| src/engine/monitoring/util.ts | Formatting only. |
| src/engine/monitoring/templateDirWatcher.ts | Formatting only. |
| src/engine/middle.ts | Functional changes to service-action error logging/publishing. |
| src/engine/index.ts | Formatting only. |
| src/engine/image.ts | Formatting only. |
| src/engine/ignore.ts | Formatting only. |
| src/engine/engine.ts | Formatting only. |
| src/engine/docker/util/logging.ts | Formatting only. |
| src/engine/docker/util/labels.ts | Formatting only. |
| src/engine/docker/util/env.ts | Formatting only. |
| src/engine/docker/index.ts | Adjust build initialization to match new build signature. |
| src/engine/docker/client.ts | Formatting only. |
| src/engine/docker/action/stop.ts | Formatting only. |
| src/engine/docker/action/statall.ts | Formatting only. |
| src/engine/docker/action/stat.ts | Formatting only. |
| src/engine/docker/action/run.ts | Formatting only. |
| src/engine/docker/action/reattach.ts | Formatting only. |
| src/engine/docker/action/listRunning.ts | Formatting only. |
| src/engine/docker/action/listp.ts | Formatting only. |
| src/engine/docker/action/listc.ts | Formatting only. |
| src/engine/docker/action/kill.ts | Formatting only. |
| src/engine/docker/action/getLabels.ts | Formatting only. |
| src/engine/docker/action/deletev.ts | Formatting only. |
| src/engine/docker/action/deletei.ts | Formatting only. |
| src/engine/docker/action/cmd.ts | Formatting only. |
| src/engine/docker/action/calcHostUsage.ts | Formatting only. |
| src/engine/docker/action/build.worker.ts | Removed worker-based image build implementation. |
| src/engine/docker/action/build.ts | Refactor archive dir creation to mkdirTemp(...), remove worker build path. |
| src/engine/asyncp.ts | Formatting only. |
| src/depend.ts | Formatting only. |
| src/database/session.ts | Formatting only. |
| src/database/serviceMeta.ts | Formatting only. |
| src/database/serviceLog.ts | Formatting only. |
| src/database/perma.ts | Formatting only. |
| src/database/models.ts | Formatting only. |
| src/database/meta.ts | Formatting only. |
| src/database/index.ts | Formatting only. |
| src/database/image.ts | Formatting only. |
| src/config.ts | Formatting only. |
| src/cleanup.ts | Small refactor of cleanup flow (preserves intent). |
| src/app.ts | Boot/options shape simplification (removes worker-related options/flags). |
| src/addon.ts | Formatting only. |
| resources/template/test/test_settings.yml | Quote/style formatting. |
| resources/template/example/example_settings.yml | Quote/style formatting. |
| resources/config.yml | Quote/style formatting. |
| README.md | Markdown spacing tweaks. |
| package.json | Add Prettier dependency. |
| openapi.yml | Formatting only. |
| jest.config.js | Formatting only. |
| installTempDeps.js | Formatting only. |
| index.ts | Formatting only. |
| docker-compose.yml | Quote/style formatting. |
| babel.config.js | Formatting only. |
| addons/example_addon/index.ts | Formatting only. |
| .prettierrc | New Prettier config. |
| .prettierignore | New Prettier ignore rules. |
| .github/workflows/push-image.yml | Formatting only. |
| .github/workflows/jest.yml | Quote/style formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
22
to
+24
| export async function createNetwork(client: DockerClient, ip: string) { | ||
| const uuid = crypto.randomUUID(); | ||
| return client.createNetwork({ | ||
| Name: uuid, | ||
| Driver: 'bridge', | ||
| Options: { | ||
| 'com.docker.network.bridge.enable_icc': 'true', // Inter-container connectivity, may disable | ||
| 'com.docker.network.bridge.enable_ip_masquerade': 'true', | ||
| 'com.docker.network.bridge.host_binding_ipv4': ip, | ||
| 'com.docker.network.bridge.name': uuid, | ||
| 'com.docker.network.driver.mtu': '1500' | ||
| }, | ||
| Labels: { | ||
| 'nsm': 'true', | ||
| } | ||
| }); | ||
| const uuid = crypto.randomUUID(); | ||
| return client.createNetwork({ |
Comment on lines
+33
to
+37
| if (!manager.isRunning(id)) { | ||
| res | ||
| .status(409) | ||
| .json({ status: 400, message: "Service is not running." }); | ||
| return; |
Comment on lines
+32
to
+36
| if (manager.isRunning(id)) { | ||
| res | ||
| .status(409) | ||
| .json({ status: 400, message: "Service is already running." }); | ||
| return; |
Comment on lines
+1
to
+5
| import { AppContext } from "@nsm/app"; | ||
| import { RouterHandler } from "@nsm/router"; | ||
| import { isServicePending } from "@nsm/engine/asyncp"; | ||
| import { handleErr } from "@nsm/util/routes"; | ||
| import { checkServicePending } from "@nsm/router/util/preconditions"; |
Comment on lines
+39
to
+43
| .status(404) | ||
| .json({ | ||
| status: 404, | ||
| message: "Service not found or unknown error occured.", | ||
| }); |
Comment on lines
+41
to
+45
| .status(404) | ||
| .json({ | ||
| status: 404, | ||
| message: "Service not found or unknown error occured.", | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO