agent-enderun 0.1.2 → 0.1.4

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.2"
5
+ "version": "0.1.4"
6
6
  }
package/bin/cli.js CHANGED
@@ -369,6 +369,12 @@ async function initCommand(selectedAdapter) {
369
369
  for (const item of filesToProcess) {
370
370
  const src = path.join(sourceDir, item);
371
371
  let dest = path.join(targetDir, item);
372
+
373
+ // Detect target project scope
374
+ let targetScope = "";
375
+ if (targetPkg.name && targetPkg.name.startsWith("@")) {
376
+ targetScope = targetPkg.name.split("/")[0];
377
+ }
372
378
 
373
379
  // FORCED CLEANUP: Delete existing framework directories in target before copying
374
380
  if (["packages/framework-mcp", "packages/shared-types", ".enderun", ".gemini", ".claude"].includes(item)) {
@@ -403,7 +409,7 @@ async function initCommand(selectedAdapter) {
403
409
  // When copying framework dir, skip logs and project-specific state
404
410
  const skipFiles = (item === ".enderun") ? ["logs", "PROJECT_MEMORY.md", "BRAIN_DASHBOARD.md", "PROJECT_MEMORY.lock"] : [];
405
411
  const isDocs = item === "docs";
406
- copyDir(src, dest, new Set(skipFiles), isDocs, targetBase);
412
+ copyDir(src, dest, new Set(skipFiles), isDocs, targetBase, targetScope);
407
413
  } else {
408
414
  // Special files handling
409
415
  if (item === "package.json") continue;
@@ -428,7 +434,7 @@ async function initCommand(selectedAdapter) {
428
434
  if (ext === ".json") {
429
435
  try {
430
436
  const json = JSON.parse(content);
431
- content = JSON.stringify(sanitizeJson(json), null, 2);
437
+ content = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
432
438
  } catch (e) {
433
439
  content = content.replace(/workspace:[^"'\s]*/g, "*");
434
440
  }
@@ -449,10 +455,11 @@ async function initCommand(selectedAdapter) {
449
455
  mergePackageJson(path.join(targetDir, "package.json"), path.join(sourceDir, "package.json"));
450
456
  updateGitIgnore(path.join(targetDir, ".gitignore"), targetBase);
451
457
 
458
+ const finalMemoryPath = path.join(targetDir, targetBase, "PROJECT_MEMORY.md");
452
459
  initializeMemory(finalMemoryPath, targetBase);
453
460
 
454
461
  // Deep clean ALL package.json files in target packages directory
455
- deepCleanProtocols(path.join(targetDir, "packages"));
462
+ deepCleanProtocols(path.join(targetDir, "packages"), targetScope);
456
463
 
457
464
  // Initialize git if missing
458
465
  if (!fs.existsSync(path.join(targetDir, ".git"))) {
@@ -529,19 +536,19 @@ async function initCommand(selectedAdapter) {
529
536
  /**
530
537
  * Recursively scans a directory for package.json files and removes workspace: protocols.
531
538
  */
532
- function deepCleanProtocols(dir) {
539
+ function deepCleanProtocols(dir, targetScope = "") {
533
540
  if (!fs.existsSync(dir)) return;
534
541
 
535
542
  const entries = fs.readdirSync(dir, { withFileTypes: true });
536
543
  for (const entry of entries) {
537
544
  const fullPath = path.join(dir, entry.name);
538
545
  if (entry.isDirectory()) {
539
- deepCleanProtocols(fullPath);
546
+ deepCleanProtocols(fullPath, targetScope);
540
547
  } else if (entry.name === "package.json") {
541
548
  try {
542
549
  const content = fs.readFileSync(fullPath, "utf8");
543
550
  const json = JSON.parse(content);
544
- const cleaned = JSON.stringify(sanitizeJson(json), null, 2);
551
+ const cleaned = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
545
552
  fs.writeFileSync(fullPath, cleaned);
546
553
  } catch (e) {
547
554
  // ignore malformed json
@@ -622,21 +629,36 @@ function checkCommand() {
622
629
  }
623
630
  }
624
631
 
625
- function sanitizeJson(obj) {
632
+ function sanitizeJson(obj, targetScope = "") {
626
633
  if (typeof obj !== "object" || obj === null) return obj;
627
- if (Array.isArray(obj)) return obj.map(sanitizeJson);
634
+ if (Array.isArray(obj)) return obj.map(item => sanitizeJson(item, targetScope));
628
635
  const cleaned = {};
629
636
  for (const [key, value] of Object.entries(obj)) {
630
- if (typeof value === "string" && value.startsWith("workspace:")) {
631
- cleaned[key] = "*";
632
- } else {
633
- cleaned[key] = sanitizeJson(value);
637
+ let finalKey = key;
638
+ let finalValue = value;
639
+
640
+ // Replace scope if needed
641
+ if (targetScope) {
642
+ if (typeof key === "string" && key.startsWith("@ai-enderun/")) {
643
+ finalKey = key.replace("@ai-enderun/", `${targetScope}/`);
644
+ }
645
+ if (typeof value === "string") {
646
+ if (value.startsWith("@ai-enderun/")) {
647
+ finalValue = value.replace("@ai-enderun/", `${targetScope}/`);
648
+ } else if (value.startsWith("workspace:")) {
649
+ finalValue = "*";
650
+ }
651
+ }
652
+ } else if (typeof value === "string" && value.startsWith("workspace:")) {
653
+ finalValue = "*";
634
654
  }
655
+
656
+ cleaned[finalKey] = (typeof finalValue === "object") ? sanitizeJson(finalValue, targetScope) : finalValue;
635
657
  }
636
658
  return cleaned;
637
659
  }
638
660
 
639
- function copyDir(src, dest, skipSet = new Set(), nonDestructive = false, frameworkDir = ".enderun") {
661
+ function copyDir(src, dest, skipSet = new Set(), nonDestructive = false, frameworkDir = ".enderun", targetScope = "") {
640
662
  const DEFAULT_SKIP = new Set(["node_modules", ".git", ".DS_Store", "package-lock.json"]);
641
663
  const actualSkip = new Set([...DEFAULT_SKIP, ...skipSet]);
642
664
 
@@ -651,7 +673,7 @@ function copyDir(src, dest, skipSet = new Set(), nonDestructive = false, framewo
651
673
  const destPath = path.join(dest, entry.name);
652
674
 
653
675
  if (entry.isDirectory()) {
654
- copyDir(srcPath, destPath, skipSet, nonDestructive, frameworkDir);
676
+ copyDir(srcPath, destPath, skipSet, nonDestructive, frameworkDir, targetScope);
655
677
  } else {
656
678
  if (nonDestructive && fs.existsSync(destPath)) {
657
679
  return;
@@ -668,7 +690,7 @@ function copyDir(src, dest, skipSet = new Set(), nonDestructive = false, framewo
668
690
  if (ext === ".json") {
669
691
  try {
670
692
  const json = JSON.parse(content);
671
- content = JSON.stringify(sanitizeJson(json), null, 2);
693
+ content = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
672
694
  } catch (e) {
673
695
  content = content.replace(/workspace:[^"'\s]*/g, "*");
674
696
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-enderun",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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.2",
20
+ "version": "0.1.4",
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.2",
3
+ "version": "0.1.4",
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.2",
2
+ "version": "0.1.4",
3
3
  "last_updated": "2026-05-09T13:04:00Z",
4
4
  "contract_hash": "daf1d688875061ef66697f39ac2449a34631e9b93926ed3e694b4e4ac7423d98",
5
5
  "breaking_changes": [
6
- { "version": "0.1.2", "description": "Initial framework setup" }
6
+ { "version": "0.1.4", "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.2",
3
+ "version": "0.1.4",
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",