psyche-ai 10.2.0 → 10.2.1
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.
- package/dist/cli.js +130 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
// psyche upgrade [--check]
|
|
16
16
|
// psyche probe [--json]
|
|
17
17
|
// psyche profiles [--json] [--mbti TYPE]
|
|
18
|
+
// psyche setup [--name NAME] [--mbti TYPE] [--locale LOCALE] [--dry-run]
|
|
18
19
|
// ============================================================
|
|
19
|
-
import { resolve } from "node:path";
|
|
20
|
+
import { resolve, join } from "node:path";
|
|
21
|
+
import { homedir } from "node:os";
|
|
20
22
|
import { parseArgs } from "node:util";
|
|
21
|
-
import { readFile } from "node:fs/promises";
|
|
23
|
+
import { readFile, writeFile, mkdir, access } from "node:fs/promises";
|
|
22
24
|
import { loadState, saveState, decayAndSave, initializeState, mergeUpdates, generatePsycheMd, getRelationship, } from "./psyche-file.js";
|
|
23
25
|
import { describeEmotionalState, getExpressionHint, detectEmotions } from "./chemistry.js";
|
|
24
26
|
import { generateReport, formatReport, toGitHubIssueBody } from "./diagnostics.js";
|
|
@@ -459,7 +461,117 @@ async function cmdProbe(json) {
|
|
|
459
461
|
console.log(` replyEnvelope: ${result.canonicalHostSurface ? "present" : "missing"}`);
|
|
460
462
|
console.log(` externalContinuity: ${result.externalContinuityAvailable ? "present" : "missing"}`);
|
|
461
463
|
}
|
|
462
|
-
|
|
464
|
+
function getMCPTargets() {
|
|
465
|
+
const home = homedir();
|
|
466
|
+
const isMac = process.platform === "darwin";
|
|
467
|
+
const isWin = process.platform === "win32";
|
|
468
|
+
const targets = [];
|
|
469
|
+
// Claude Desktop
|
|
470
|
+
if (isMac) {
|
|
471
|
+
targets.push({
|
|
472
|
+
name: "Claude Desktop",
|
|
473
|
+
configPath: join(home, "Library/Application Support/Claude/claude_desktop_config.json"),
|
|
474
|
+
mcpKey: "mcpServers",
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
else if (isWin) {
|
|
478
|
+
targets.push({
|
|
479
|
+
name: "Claude Desktop",
|
|
480
|
+
configPath: join(process.env.APPDATA ?? join(home, "AppData/Roaming"), "Claude/claude_desktop_config.json"),
|
|
481
|
+
mcpKey: "mcpServers",
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
// Cursor
|
|
485
|
+
targets.push({
|
|
486
|
+
name: "Cursor",
|
|
487
|
+
configPath: join(home, ".cursor/mcp.json"),
|
|
488
|
+
mcpKey: "mcpServers",
|
|
489
|
+
});
|
|
490
|
+
// Claude Code
|
|
491
|
+
targets.push({
|
|
492
|
+
name: "Claude Code",
|
|
493
|
+
configPath: join(home, ".claude/settings.json"),
|
|
494
|
+
mcpKey: "mcpServers",
|
|
495
|
+
});
|
|
496
|
+
// Windsurf
|
|
497
|
+
targets.push({
|
|
498
|
+
name: "Windsurf",
|
|
499
|
+
configPath: join(home, ".windsurf/mcp.json"),
|
|
500
|
+
mcpKey: "mcpServers",
|
|
501
|
+
});
|
|
502
|
+
return targets;
|
|
503
|
+
}
|
|
504
|
+
async function fileExists(path) {
|
|
505
|
+
try {
|
|
506
|
+
await access(path);
|
|
507
|
+
return true;
|
|
508
|
+
}
|
|
509
|
+
catch {
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
async function cmdSetup(name, mbti, locale, dryRun) {
|
|
514
|
+
const targets = getMCPTargets();
|
|
515
|
+
const psycheEntry = {
|
|
516
|
+
command: "npx",
|
|
517
|
+
args: ["-y", "psyche-mcp"],
|
|
518
|
+
env: {
|
|
519
|
+
...(name ? { PSYCHE_NAME: name } : {}),
|
|
520
|
+
...(mbti ? { PSYCHE_MBTI: mbti.toUpperCase() } : {}),
|
|
521
|
+
...(locale ? { PSYCHE_LOCALE: locale } : {}),
|
|
522
|
+
},
|
|
523
|
+
};
|
|
524
|
+
let configured = 0;
|
|
525
|
+
let skipped = 0;
|
|
526
|
+
for (const target of targets) {
|
|
527
|
+
// Check if the config file's parent directory exists (= client is installed)
|
|
528
|
+
const configDir = resolve(target.configPath, "..");
|
|
529
|
+
if (!(await fileExists(configDir)))
|
|
530
|
+
continue;
|
|
531
|
+
// Read existing config or start fresh
|
|
532
|
+
let config = {};
|
|
533
|
+
if (await fileExists(target.configPath)) {
|
|
534
|
+
try {
|
|
535
|
+
config = JSON.parse(await readFile(target.configPath, "utf-8"));
|
|
536
|
+
}
|
|
537
|
+
catch {
|
|
538
|
+
config = {};
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
// Check if already configured
|
|
542
|
+
const servers = config[target.mcpKey] ?? {};
|
|
543
|
+
if (servers["psyche"]) {
|
|
544
|
+
console.log(` ✓ ${target.name} — already configured`);
|
|
545
|
+
skipped++;
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
// Add psyche entry
|
|
549
|
+
servers["psyche"] = psycheEntry;
|
|
550
|
+
config[target.mcpKey] = servers;
|
|
551
|
+
if (dryRun) {
|
|
552
|
+
console.log(` → ${target.name} — would write to ${target.configPath}`);
|
|
553
|
+
configured++;
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
// Write config
|
|
557
|
+
await mkdir(configDir, { recursive: true });
|
|
558
|
+
await writeFile(target.configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
559
|
+
console.log(` ✓ ${target.name} — configured (${target.configPath})`);
|
|
560
|
+
configured++;
|
|
561
|
+
}
|
|
562
|
+
if (configured === 0 && skipped === 0) {
|
|
563
|
+
console.log(" No MCP clients detected. Install Claude Desktop, Cursor, or Claude Code first.");
|
|
564
|
+
console.log(" Or run psyche-proxy for universal LLM proxy integration.");
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
console.log("");
|
|
568
|
+
if (configured > 0 && !dryRun) {
|
|
569
|
+
console.log(`Done. Restart your MCP client${configured > 1 ? "s" : ""} to activate Psyche.`);
|
|
570
|
+
}
|
|
571
|
+
if (configured > 0 && dryRun) {
|
|
572
|
+
console.log(`Dry run complete. Run without --dry-run to apply.`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
463
575
|
function usage() {
|
|
464
576
|
console.log(`
|
|
465
577
|
psyche — Artificial Psyche CLI (v0.2)
|
|
@@ -663,6 +775,21 @@ async function main() {
|
|
|
663
775
|
await cmdProbe(values.json ?? false);
|
|
664
776
|
break;
|
|
665
777
|
}
|
|
778
|
+
case "setup": {
|
|
779
|
+
const { values } = parseArgs({
|
|
780
|
+
args: rest,
|
|
781
|
+
options: {
|
|
782
|
+
name: { type: "string", short: "n" },
|
|
783
|
+
mbti: { type: "string" },
|
|
784
|
+
locale: { type: "string", short: "l" },
|
|
785
|
+
"dry-run": { type: "boolean", default: false },
|
|
786
|
+
},
|
|
787
|
+
allowPositionals: true,
|
|
788
|
+
});
|
|
789
|
+
console.log("\npsyche setup — auto-configuring MCP clients\n");
|
|
790
|
+
await cmdSetup(values.name ?? "", values.mbti ?? "", values.locale ?? "", values["dry-run"] ?? false);
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
666
793
|
default:
|
|
667
794
|
die(`unknown command: ${command}. Run 'psyche help' for usage.`);
|
|
668
795
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "psyche-ai",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.1",
|
|
4
4
|
"description": "AI-first subjectivity kernel for agents with continuous appraisal, relation dynamics, and adaptive reply loops",
|
|
5
5
|
"mcpName": "io.github.Shangri-la-0428/psyche-ai",
|
|
6
6
|
"type": "module",
|