@aman_asmuei/aman 0.5.1 → 0.5.2

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/dist/index.js +56 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -76,9 +76,18 @@ function detectRole(cwd) {
76
76
  function isMcpPlatform(platform) {
77
77
  return platform === "claude-code" || platform === "cursor" || platform === "windsurf";
78
78
  }
79
+ function resolveLayerFile(layerDir, filename, home) {
80
+ const homeDir = home ?? os.homedir();
81
+ const scopedPath = path.join(homeDir, layerDir, "dev", "plugin", filename);
82
+ const legacyPath = path.join(homeDir, layerDir, filename);
83
+ if (fs.existsSync(scopedPath)) return scopedPath;
84
+ if (fs.existsSync(legacyPath)) return legacyPath;
85
+ return null;
86
+ }
79
87
  function detectEcosystem() {
80
88
  const home = os.homedir();
81
- const acorePath = path.join(home, ".acore", "core.md");
89
+ const acoreResolvedPath = resolveLayerFile(".acore", "core.md");
90
+ const acorePath = acoreResolvedPath ?? path.join(home, ".acore", "dev", "plugin", "core.md");
82
91
  const akitPath = path.join(home, ".akit", "kit.md");
83
92
  const akitInstalledPath = path.join(home, ".akit", "installed.json");
84
93
  let akitToolCount = 0;
@@ -113,11 +122,12 @@ function detectEcosystem() {
113
122
  } catch {
114
123
  }
115
124
  }
116
- const arulesPath = path.join(home, ".arules", "rules.md");
125
+ const arulesResolvedPath = resolveLayerFile(".arules", "rules.md");
126
+ const arulesPath = arulesResolvedPath ?? path.join(home, ".arules", "dev", "plugin", "rules.md");
117
127
  let arulesRuleCount = 0;
118
- if (fs.existsSync(arulesPath)) {
128
+ if (arulesResolvedPath) {
119
129
  try {
120
- const content = fs.readFileSync(arulesPath, "utf-8");
130
+ const content = fs.readFileSync(arulesResolvedPath, "utf-8");
121
131
  arulesRuleCount = (content.match(/^- /gm) || []).length;
122
132
  } catch {
123
133
  }
@@ -142,11 +152,11 @@ function detectEcosystem() {
142
152
  }
143
153
  }
144
154
  return {
145
- acore: { installed: fs.existsSync(acorePath), path: acorePath },
155
+ acore: { installed: acoreResolvedPath !== null, path: acorePath },
146
156
  amem: { installed: amemInstalled },
147
157
  akit: { installed: fs.existsSync(akitPath), path: akitPath, toolCount: akitToolCount },
148
158
  aflow: { installed: fs.existsSync(aflowPath), path: aflowPath, workflowCount: aflowWorkflowCount },
149
- arules: { installed: fs.existsSync(arulesPath), path: arulesPath, ruleCount: arulesRuleCount },
159
+ arules: { installed: arulesResolvedPath !== null, path: arulesPath, ruleCount: arulesRuleCount },
150
160
  aeval: { installed: fs.existsSync(aevalPath), path: aevalPath, sessions: aevalSessions },
151
161
  askill: { installed: fs.existsSync(askillPath), path: askillPath, skillCount: askillCount }
152
162
  };
@@ -374,8 +384,39 @@ var ARCHETYPES = {
374
384
  async function setupCommand() {
375
385
  p.intro(pc.bold("aman") + " \u2014 your complete AI companion");
376
386
  const ecosystem = detectEcosystem();
387
+ const scopedCorePath = path3.join(os2.homedir(), ".acore", "dev", "plugin", "core.md");
388
+ const legacyCorePath = path3.join(os2.homedir(), ".acore", "core.md");
377
389
  if (ecosystem.acore.installed) {
378
- p.log.success(`Identity: ${pc.dim("~/.acore/core.md")} already exists`);
390
+ const scopedExists = fs4.existsSync(scopedCorePath);
391
+ const legacyExists = fs4.existsSync(legacyCorePath);
392
+ if (legacyExists) {
393
+ const legacyContent = fs4.readFileSync(legacyCorePath, "utf-8");
394
+ const legacyIsTemplate = /\[your name\]|\[YOUR_NAME\]|\[AI_NAME\]/.test(legacyContent);
395
+ if (!legacyIsTemplate) {
396
+ if (!scopedExists) {
397
+ fs4.mkdirSync(path3.dirname(scopedCorePath), { recursive: true });
398
+ fs4.writeFileSync(scopedCorePath, legacyContent, "utf-8");
399
+ p.log.success(
400
+ `Identity: migrated ${pc.dim("~/.acore/core.md")} \u2192 ${pc.dim("~/.acore/dev/plugin/core.md")}`
401
+ );
402
+ } else {
403
+ const scopedContent = fs4.readFileSync(scopedCorePath, "utf-8");
404
+ const scopedIsTemplate = /\[your name\]|\[YOUR_NAME\]|\[AI_NAME\]/.test(scopedContent);
405
+ if (scopedIsTemplate) {
406
+ fs4.writeFileSync(scopedCorePath, legacyContent, "utf-8");
407
+ p.log.success(
408
+ `Identity: replaced unfilled template at ${pc.dim("~/.acore/dev/plugin/core.md")} with your personalized identity`
409
+ );
410
+ } else {
411
+ p.log.success(`Identity: ${pc.dim(ecosystem.acore.path)} already exists`);
412
+ }
413
+ }
414
+ } else {
415
+ p.log.success(`Identity: ${pc.dim(ecosystem.acore.path)} already exists`);
416
+ }
417
+ } else {
418
+ p.log.success(`Identity: ${pc.dim(ecosystem.acore.path)} already exists`);
419
+ }
379
420
  } else {
380
421
  p.log.step("Setting up your AI identity...");
381
422
  let userName = detectUserName();
@@ -421,10 +462,10 @@ async function setupCommand() {
421
462
  DATE: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
422
463
  UPDATE_INSTRUCTIONS: getUpdateInstructions(platform)
423
464
  });
424
- const globalDir = path3.join(os2.homedir(), ".acore");
425
- fs4.mkdirSync(globalDir, { recursive: true });
426
- fs4.writeFileSync(path3.join(globalDir, "core.md"), content, "utf-8");
427
- p.log.success(`Created ${pc.dim("~/.acore/core.md")} (identity)`);
465
+ const scopedAcoreDir = path3.join(os2.homedir(), ".acore", "dev", "plugin");
466
+ fs4.mkdirSync(scopedAcoreDir, { recursive: true });
467
+ fs4.writeFileSync(path3.join(scopedAcoreDir, "core.md"), content, "utf-8");
468
+ p.log.success(`Created ${pc.dim("~/.acore/dev/plugin/core.md")} (identity)`);
428
469
  if (stack) {
429
470
  const localDir = path3.join(process.cwd(), ".acore");
430
471
  fs4.mkdirSync(localDir, { recursive: true });
@@ -454,9 +495,8 @@ async function setupCommand() {
454
495
  }
455
496
  const platformFile = getPlatformFile(platform);
456
497
  if (platformFile) {
457
- const globalContent = fs4.readFileSync(path3.join(globalDir, "core.md"), "utf-8");
458
498
  const filePath = path3.join(process.cwd(), platformFile);
459
- const result = injectIntoFile(filePath, globalContent);
499
+ const result = injectIntoFile(filePath, content);
460
500
  if (result.created) {
461
501
  p.log.success(`Created ${pc.dim(platformFile)} with identity`);
462
502
  } else {
@@ -518,10 +558,10 @@ async function setupCommand() {
518
558
  p.log.success(`Workflows: ${ecosystem.aflow.workflowCount} defined`);
519
559
  }
520
560
  if (doRules) {
521
- const arulesDir = path3.join(home, ".arules");
561
+ const arulesDir = path3.join(home, ".arules", "dev", "plugin");
522
562
  fs4.mkdirSync(arulesDir, { recursive: true });
523
563
  fs4.writeFileSync(path3.join(arulesDir, "rules.md"), STARTER_RULES, "utf-8");
524
- p.log.success(`Guardrails: created ${pc.dim("~/.arules/rules.md")} (24 rules)`);
564
+ p.log.success(`Guardrails: created ${pc.dim("~/.arules/dev/plugin/rules.md")} (24 rules)`);
525
565
  } else if (arulesExists) {
526
566
  p.log.success(`Guardrails: ${ecosystem.arules.ruleCount} rules`);
527
567
  }
@@ -1032,7 +1072,7 @@ async function hereCommand(opts = {}) {
1032
1072
 
1033
1073
  // src/index.ts
1034
1074
  var program = new Command();
1035
- program.name("aman").description("Your complete AI companion \u2014 identity, memory, and tools in one command").version("0.5.1").action(() => {
1075
+ program.name("aman").description("Your complete AI companion \u2014 identity, memory, and tools in one command").version("0.5.2").action(() => {
1036
1076
  const ecosystem = detectEcosystem();
1037
1077
  if (ecosystem.acore.installed) {
1038
1078
  statusCommand();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aman_asmuei/aman",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Your complete AI companion — identity, memory, and tools in one command",
5
5
  "type": "module",
6
6
  "bin": {