agent-enderun 0.1.3 → 0.1.5

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.
@@ -2,5 +2,5 @@
2
2
  "logLevel": "info",
3
3
  "outputFormat": "text",
4
4
  "defaultProfile": "Lightweight",
5
- "version": "0.1.3"
5
+ "version": "0.1.5"
6
6
  }
package/bin/cli.js CHANGED
@@ -366,6 +366,20 @@ async function initCommand(selectedAdapter) {
366
366
  Object.values(ADAPTERS).forEach(list => filesToProcess.push(...list));
367
367
  }
368
368
 
369
+ // Detect target project scope
370
+ let targetPkg = {};
371
+ try {
372
+ const targetPkgPath = path.join(targetDir, "package.json");
373
+ if (fs.existsSync(targetPkgPath)) {
374
+ targetPkg = JSON.parse(fs.readFileSync(targetPkgPath, "utf8"));
375
+ }
376
+ } catch (e) {}
377
+
378
+ let targetScope = "";
379
+ if (targetPkg.name && targetPkg.name.startsWith("@")) {
380
+ targetScope = targetPkg.name.split("/")[0];
381
+ }
382
+
369
383
  for (const item of filesToProcess) {
370
384
  const src = path.join(sourceDir, item);
371
385
  let dest = path.join(targetDir, item);
@@ -403,7 +417,7 @@ async function initCommand(selectedAdapter) {
403
417
  // When copying framework dir, skip logs and project-specific state
404
418
  const skipFiles = (item === ".enderun") ? ["logs", "PROJECT_MEMORY.md", "BRAIN_DASHBOARD.md", "PROJECT_MEMORY.lock"] : [];
405
419
  const isDocs = item === "docs";
406
- copyDir(src, dest, new Set(skipFiles), isDocs, targetBase);
420
+ copyDir(src, dest, new Set(skipFiles), isDocs, targetBase, targetScope);
407
421
  } else {
408
422
  // Special files handling
409
423
  if (item === "package.json") continue;
@@ -428,7 +442,7 @@ async function initCommand(selectedAdapter) {
428
442
  if (ext === ".json") {
429
443
  try {
430
444
  const json = JSON.parse(content);
431
- content = JSON.stringify(sanitizeJson(json), null, 2);
445
+ content = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
432
446
  } catch (e) {
433
447
  content = content.replace(/workspace:[^"'\s]*/g, "*");
434
448
  }
@@ -453,7 +467,7 @@ async function initCommand(selectedAdapter) {
453
467
  initializeMemory(finalMemoryPath, targetBase);
454
468
 
455
469
  // Deep clean ALL package.json files in target packages directory
456
- deepCleanProtocols(path.join(targetDir, "packages"));
470
+ deepCleanProtocols(path.join(targetDir, "packages"), targetScope);
457
471
 
458
472
  // Initialize git if missing
459
473
  if (!fs.existsSync(path.join(targetDir, ".git"))) {
@@ -530,19 +544,19 @@ async function initCommand(selectedAdapter) {
530
544
  /**
531
545
  * Recursively scans a directory for package.json files and removes workspace: protocols.
532
546
  */
533
- function deepCleanProtocols(dir) {
547
+ function deepCleanProtocols(dir, targetScope = "") {
534
548
  if (!fs.existsSync(dir)) return;
535
549
 
536
550
  const entries = fs.readdirSync(dir, { withFileTypes: true });
537
551
  for (const entry of entries) {
538
552
  const fullPath = path.join(dir, entry.name);
539
553
  if (entry.isDirectory()) {
540
- deepCleanProtocols(fullPath);
554
+ deepCleanProtocols(fullPath, targetScope);
541
555
  } else if (entry.name === "package.json") {
542
556
  try {
543
557
  const content = fs.readFileSync(fullPath, "utf8");
544
558
  const json = JSON.parse(content);
545
- const cleaned = JSON.stringify(sanitizeJson(json), null, 2);
559
+ const cleaned = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
546
560
  fs.writeFileSync(fullPath, cleaned);
547
561
  } catch (e) {
548
562
  // ignore malformed json
@@ -623,21 +637,36 @@ function checkCommand() {
623
637
  }
624
638
  }
625
639
 
626
- function sanitizeJson(obj) {
640
+ function sanitizeJson(obj, targetScope = "") {
627
641
  if (typeof obj !== "object" || obj === null) return obj;
628
- if (Array.isArray(obj)) return obj.map(sanitizeJson);
642
+ if (Array.isArray(obj)) return obj.map(item => sanitizeJson(item, targetScope));
629
643
  const cleaned = {};
630
644
  for (const [key, value] of Object.entries(obj)) {
631
- if (typeof value === "string" && value.startsWith("workspace:")) {
632
- cleaned[key] = "*";
633
- } else {
634
- cleaned[key] = sanitizeJson(value);
645
+ let finalKey = key;
646
+ let finalValue = value;
647
+
648
+ // Replace scope if needed
649
+ if (targetScope) {
650
+ if (typeof key === "string" && key.startsWith("@ai-enderun/")) {
651
+ finalKey = key.replace("@ai-enderun/", `${targetScope}/`);
652
+ }
653
+ if (typeof value === "string") {
654
+ if (value.startsWith("@ai-enderun/")) {
655
+ finalValue = value.replace("@ai-enderun/", `${targetScope}/`);
656
+ } else if (value.startsWith("workspace:")) {
657
+ finalValue = "*";
658
+ }
659
+ }
660
+ } else if (typeof value === "string" && value.startsWith("workspace:")) {
661
+ finalValue = "*";
635
662
  }
663
+
664
+ cleaned[finalKey] = (typeof finalValue === "object") ? sanitizeJson(finalValue, targetScope) : finalValue;
636
665
  }
637
666
  return cleaned;
638
667
  }
639
668
 
640
- function copyDir(src, dest, skipSet = new Set(), nonDestructive = false, frameworkDir = ".enderun") {
669
+ function copyDir(src, dest, skipSet = new Set(), nonDestructive = false, frameworkDir = ".enderun", targetScope = "") {
641
670
  const DEFAULT_SKIP = new Set(["node_modules", ".git", ".DS_Store", "package-lock.json"]);
642
671
  const actualSkip = new Set([...DEFAULT_SKIP, ...skipSet]);
643
672
 
@@ -652,7 +681,7 @@ function copyDir(src, dest, skipSet = new Set(), nonDestructive = false, framewo
652
681
  const destPath = path.join(dest, entry.name);
653
682
 
654
683
  if (entry.isDirectory()) {
655
- copyDir(srcPath, destPath, skipSet, nonDestructive, frameworkDir);
684
+ copyDir(srcPath, destPath, skipSet, nonDestructive, frameworkDir, targetScope);
656
685
  } else {
657
686
  if (nonDestructive && fs.existsSync(destPath)) {
658
687
  return;
@@ -669,7 +698,7 @@ function copyDir(src, dest, skipSet = new Set(), nonDestructive = false, framewo
669
698
  if (ext === ".json") {
670
699
  try {
671
700
  const json = JSON.parse(content);
672
- content = JSON.stringify(sanitizeJson(json), null, 2);
701
+ content = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
673
702
  } catch (e) {
674
703
  content = content.replace(/workspace:[^"'\s]*/g, "*");
675
704
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-enderun",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  "packages/*"
@@ -17,7 +17,7 @@
17
17
  "dependencies": {},
18
18
  "devDependencies": {},
19
19
  "enderun": {
20
- "version": "0.1.3",
20
+ "version": "0.1.5",
21
21
  "initializedAt": "2026-05-09T13:24:27.472Z"
22
22
  }
23
23
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-enderun-mcp",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Enterprise-grade MCP Server for AI Agent Framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,9 +1,9 @@
1
1
  {
2
- "version": "0.1.3",
2
+ "version": "0.1.5",
3
3
  "last_updated": "2026-05-09T13:04:00Z",
4
4
  "contract_hash": "daf1d688875061ef66697f39ac2449a34631e9b93926ed3e694b4e4ac7423d98",
5
5
  "breaking_changes": [
6
- { "version": "0.1.3", "description": "Initial framework setup" }
6
+ { "version": "0.1.5", "description": "Initial framework setup" }
7
7
  ],
8
8
  "deprecated_versions": []
9
9
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-enderun/shared-types",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Shared TypeScript types for AI-Enderun Framework. Ensures Contract-First synchronization between agents.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",