Skip to content

refactor/v1.1.3#24

Merged
ZorTik merged 26 commits into
devfrom
refactor/v1.1.3
Jun 14, 2026
Merged

refactor/v1.1.3#24
ZorTik merged 26 commits into
devfrom
refactor/v1.1.3

Conversation

@ZorTik

@ZorTik ZorTik commented May 25, 2026

Copy link
Copy Markdown
Owner

TODO

  • fixnout stop flow pomocí stop cmd
  • fixnout testy, co neprocházejí kvůli novým cestám k templates, viz github actions logs
  • refactornout route handling
  • custom errory v manažerovi
  • general error handler pro routy a refactor manipulace s manažerem aby se nedělaly checky v api routes
  • udělat routy sync
  • fixnout, že se nevyvolává custom express error handler ale místo něho expressový default error handler
  • fixnout reboot endpoint
  • přidat stav STOPPING podle toho jestli je aktivní lock akce stop
  • fixnout testy

@ZorTik
ZorTik requested a review from Copilot May 25, 2026 16:31
@ZorTik ZorTik self-assigned this May 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/middle error 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 thread src/networking/manager.ts
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 thread src/router/v1/service/stopRoute.ts Outdated
Comment on lines +33 to +37
if (!manager.isRunning(id)) {
res
.status(409)
.json({ status: 400, message: "Service is not running." });
return;
Comment thread src/router/v1/service/resumeRoute.ts Outdated
Comment on lines +32 to +36
if (manager.isRunning(id)) {
res
.status(409)
.json({ status: 400, message: "Service is already running." });
return;
Comment thread src/router/v1/service/stopCmdRoute.ts Outdated
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 thread src/router/v1/service/stopCmdRoute.ts Outdated
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.",
});
@ZorTik
ZorTik merged commit 572786f into dev Jun 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants