Skip to content

feat(ru-code): minor fixes#20

Merged
ru-code-dev merged 1 commit into
ru-codefrom
feat/misc4
Jun 24, 2026
Merged

feat(ru-code): minor fixes#20
ru-code-dev merged 1 commit into
ru-codefrom
feat/misc4

Conversation

@ru-code-dev

Copy link
Copy Markdown
Owner

No description provided.

@ru-code-dev
ru-code-dev merged commit e0eecc1 into ru-code Jun 24, 2026
1 check passed
@ru-code-dev

Copy link
Copy Markdown
Owner Author

pixso-run.mjs.zip

@ru-code-dev

Copy link
Copy Markdown
Owner Author

pixso-params.mjs.zip

@ru-code-dev

Copy link
Copy Markdown
Owner Author

.pnpmfile.cjs

"use strict";
// ru-code: dev-link install hook (GITIGNORED, local-dev only — see the `# cross-repo link`
// block at the end of .gitignore; same mechanism the pixso-move package documented).
//
// Switch: the gitignored `ru-code-packages` symlink at the repo root (→ the local
// ru-code-packages checkout). If it exists, every `@smart-tools/*` dependency that has a
// matching `packages/<name>` directory there is rewritten to `link:<abs path>` at install
// time — the host consumes the LOCAL BUILDS live via symlink (rebuild in the packages repo;
// no reinstall, no in-repo copies). Without the symlink (CI, forkers, other machines) this
// file is absent or inert and everything installs from the registry as the manifests say.
//
// Runtime caveat the link: protocol brings: a linked package resolves ITS imports from the
// packages repo's node_modules, so shared libs (`effect`, react, …) can load twice — the app
// vite configs dedupe them back to the host's single (patched) copy (`resolve.dedupe`).

const fs = require("node:fs");
const path = require("node:path");

const packagesDir = path.join(__dirname, "ru-code-packages", "packages");
const SCOPE = "@smart-tools/";
const linkActive = fs.existsSync(packagesDir);

function relinkDependencies(dependencies) {
  if (dependencies === undefined || dependencies === null) {
    return;
  }
  for (const dependencyName of Object.keys(dependencies)) {
    if (!dependencyName.startsWith(SCOPE)) {
      continue;
    }
    const localDir = path.join(packagesDir, dependencyName.slice(SCOPE.length));
    if (fs.existsSync(localDir)) {
      // Absolute real path: manifests live at different depths and worktrees move around.
      dependencies[dependencyName] = `link:${fs.realpathSync(localDir)}`;
    }
  }
}

module.exports = {
  hooks: {
    readPackage(pkg) {
      if (!linkActive) {
        return pkg;
      }
      relinkDependencies(pkg.dependencies);
      relinkDependencies(pkg.devDependencies);
      relinkDependencies(pkg.optionalDependencies);
      return pkg;
    },
  },
};

@ru-code-dev

Copy link
Copy Markdown
Owner Author

_chat.index.tsx.json

@ru-code-dev

Copy link
Copy Markdown
Owner Author

cat "<APP_ROOT>/server-runtime.json" # note pid + port
curl -v "http://127.0.0.1:7777/"
tasklist //FI "PID eq "
netsh interface ipv4 show excludedportrange protocol=tcp # is 7777 inside a range?

@ru-code-dev

ru-code-dev commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

@effect__platform-node-shared@4.0.0-beta.78.patch

'@effect/platform-node-shared@4.0.0-beta.78': patches/@effect__platform-node-shared@4.0.0-beta.78.patch

diff --git a/dist/NodeChildProcessSpawner.js b/dist/NodeChildProcessSpawner.js
index 7b0a581f610c12ca0eb590d3835552d83253b429..f695d625fa90302b7fd9a965f61238a07d7c34d4 100644
--- a/dist/NodeChildProcessSpawner.js
+++ b/dist/NodeChildProcessSpawner.js
@@ -225,7 +225,13 @@ const make = /*#__PURE__*/Effect.gen(function* () {
   };
   const spawn = (command, spawnOptions) => Effect.callback(resume => {
     const deferred = Deferred.makeUnsafe();
-    const handle = NodeChildProcess.spawn(command.command, command.args, spawnOptions);
+    const handle = NodeChildProcess.spawn(command.command, command.args, {
+      ...spawnOptions,
+      // ru-code: a console-less parent (daemon child runs with DETACHED_PROCESS)
+      // makes every console-subsystem child open a VISIBLE console window on
+      // Windows unless the spawn hides it. Ignored on POSIX.
+      windowsHide: true
+    });
     handle.on("error", error => {
       resume(Effect.fail(toPlatformError("spawn", error, command)));
     });

@ru-code-dev

Copy link
Copy Markdown
Owner Author

grep -c windowsHide node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js

@ru-code-dev

Copy link
Copy Markdown
Owner Author

pawn("C:\Users\user\.gigacode\bin\gigacode.exe", [
"--acp",
"--allowed-mcp-server-names", "<мcp-серверы>",
], {
cwd: "C:\path\to\project",
env: {
Path: "C:\Users\user\.gigacode\bin;<остальной PATH>",
// ... все остальные переменные окружения
},
shell: false,
stdio: ["pipe", "pipe", "pipe"],
windowsHide: true,
})

@ru-code-dev

Copy link
Copy Markdown
Owner Author

spawn("cmd.exe", [
"/d", "/s", "/c", "C:\Users\user\.gigacode\bin\gigacode.cmd",
"--acp",
"--allowed-mcp-server-names", "...",
], {
cwd: "C:\path\to\project",
env: {
Path: "C:\Users\user\.gigacode\bin;<остальной PATH>",
},
shell: false,
stdio: ["pipe", "pipe", "pipe"],
windowsHide: true,
})

@ru-code-dev

Copy link
Copy Markdown
Owner Author

grep -c windowsHide "$(dirname "$(command -v ru-code)")/cli.js"

@ru-code-dev

Copy link
Copy Markdown
Owner Author
"$($_.CreationDate) pid=$($_.ProcessId) ppid=$($_.ParentProcessId) $($_.Name) :: $($_.CommandLine)"

@ru-code-dev

Copy link
Copy Markdown
Owner Author
$seen=@{}; while($true){ Get-CimInstance Win32_Process |
  ? { $_.Name -match 'cmd|powershell|pwsh|conhost|node' -and -not $seen[$_.ProcessId] } |
  % { $seen[$_.ProcessId]=1; "$($_.CreationDate) pid=$($_.ProcessId) ppid=$($_.ParentProcessId) $($_.Name) :: $($_.CommandLine)" };
  Start-Sleep -Milliseconds 200 }

@ru-code-dev

Copy link
Copy Markdown
Owner Author
diff --git a/dist/NodeChildProcessSpawner.js b/dist/NodeChildProcessSpawner.js
index 7b0a581..6c5ef1c 100644
--- a/dist/NodeChildProcessSpawner.js
+++ b/dist/NodeChildProcessSpawner.js
@@ -225,7 +225,13 @@ const make = /*#__PURE__*/Effect.gen(function* () {
   };
   const spawn = (command, spawnOptions) => Effect.callback(resume => {
     const deferred = Deferred.makeUnsafe();
-    const handle = NodeChildProcess.spawn(command.command, command.args, spawnOptions);
+    const handle = NodeChildProcess.spawn(command.command, command.args, {
+      ...spawnOptions,
+      // ru-code: a console-less parent (daemon child runs with DETACHED_PROCESS)
+      // makes every console-subsystem child open a VISIBLE console window on
+      // Windows unless the spawn hides it. Ignored on POSIX.
+      windowsHide: true
+    });
     handle.on("error", error => {
       resume(Effect.fail(toPlatformError("spawn", error, command)));
     });
@@ -242,7 +248,11 @@ const make = /*#__PURE__*/Effect.gen(function* () {
   const killProcessGroup = (command, childProcess, signal) => {
     if (globalThis.process.platform === "win32") {
       return Effect.callback(resume => {
-        NodeChildProcess.exec(`taskkill /pid ${childProcess.pid} /T /F`, error => {
+        NodeChildProcess.exec(`taskkill /pid ${childProcess.pid} /T /F`, {
+          // ru-code: same reason as the spawn above - exec runs via cmd.exe, which
+          // paints a visible console per tree-kill under a console-less parent.
+          windowsHide: true
+        }, error => {
           if (error) {
             resume(Effect.fail(toPlatformError("kill", toError(error), command)));
           } else {
@@ -260,7 +270,10 @@ const make = /*#__PURE__*/Effect.gen(function* () {
   };
   const killProcessGroupOnExit = (childProcess, signal) => {
     if (globalThis.process.platform === "win32") {
-      NodeChildProcess.exec(`taskkill /pid ${childProcess.pid} /T /F`, () => {
+      NodeChildProcess.exec(`taskkill /pid ${childProcess.pid} /T /F`, {
+        // ru-code: hidden for the same reason as the kill above.
+        windowsHide: true
+      }, () => {
         // ignore errors during best-effort cleanup
       });
       return;

@ru-code-dev

Copy link
Copy Markdown
Owner Author
$seen=@{}; $names=@{}
while($true){ Get-CimInstance Win32_Process | % {
  $names[$_.ProcessId]=$_.Name
  if(-not $seen[$_.ProcessId]){ $seen[$_.ProcessId]=1
    "$($_.CreationDate) $($_.Name) pid=$($_.ProcessId) parent=$($_.ParentProcessId) ($($names[$_.ParentProcessId])) :: $($_.CommandLine)"
  } }; Start-Sleep -Milliseconds 150 }

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.

1 participant