@engineeros/connector 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/runner.mjs +22 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engineeros/connector",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "Connect a local Codex CLI workspace to EngineerOS over an outbound WebSocket.",
5
5
  "private": false,
6
6
  "type": "module",
package/src/runner.mjs CHANGED
@@ -585,20 +585,17 @@ function runCodexCommand(command, args, cwd) {
585
585
  async function changedFilePaths(workspace) {
586
586
  const tracked = await run(
587
587
  "git",
588
- ["diff", "--name-only", "HEAD", "--"],
588
+ ["diff", "--name-only", "-z", "HEAD", "--"],
589
589
  workspace,
590
590
  );
591
591
  const untracked = await run(
592
592
  "git",
593
- ["ls-files", "--others", "--exclude-standard"],
593
+ ["ls-files", "-z", "--others", "--exclude-standard"],
594
594
  workspace,
595
595
  );
596
596
  return [
597
597
  ...new Set(
598
- `${tracked.stdout}\n${untracked.stdout}`
599
- .split(/\r?\n/)
600
- .map(normalizePath)
601
- .filter(Boolean),
598
+ [...gitPathList(tracked.stdout), ...gitPathList(untracked.stdout)],
602
599
  ),
603
600
  ].sort();
604
601
  }
@@ -610,16 +607,15 @@ async function boundedDiff(workspace, changedFiles) {
610
607
  workspace,
611
608
  );
612
609
  const untracked = new Set(
613
- (
614
- await run(
615
- "git",
616
- ["ls-files", "--others", "--exclude-standard"],
617
- workspace,
618
- )
619
- ).stdout
620
- .split(/\r?\n/)
621
- .map(normalizePath)
622
- .filter(Boolean),
610
+ gitPathList(
611
+ (
612
+ await run(
613
+ "git",
614
+ ["ls-files", "-z", "--others", "--exclude-standard"],
615
+ workspace,
616
+ )
617
+ ).stdout,
618
+ ),
623
619
  );
624
620
  const parts = [tracked.stdout];
625
621
  for (const relative of changedFiles.filter((item) => untracked.has(item))) {
@@ -638,15 +634,13 @@ async function boundedDiff(workspace, changedFiles) {
638
634
  return diff;
639
635
  }
640
636
 
641
- async function repositoryArchive(workspace) {
637
+ export async function repositoryArchive(workspace) {
642
638
  const listed = await run(
643
639
  "git",
644
- ["ls-files", "-co", "--exclude-standard"],
640
+ ["ls-files", "-z", "-co", "--exclude-standard"],
645
641
  workspace,
646
642
  );
647
- const files = [
648
- ...new Set(listed.stdout.split(/\r?\n/).map(normalizePath).filter(Boolean)),
649
- ].sort();
643
+ const files = [...new Set(gitPathList(listed.stdout))].sort();
650
644
  return createZip(
651
645
  await Promise.all(
652
646
  files.map(async (relative) => ({
@@ -801,6 +795,13 @@ function normalizePath(value) {
801
795
  .replace(/^\.\//, "");
802
796
  }
803
797
 
798
+ function gitPathList(value) {
799
+ return String(value ?? "")
800
+ .split("\0")
801
+ .map(normalizePath)
802
+ .filter(Boolean);
803
+ }
804
+
804
805
  function run(command, args, cwd, options = {}) {
805
806
  return new Promise((resolve, reject) => {
806
807
  const child = spawn(command, args, {