@aabadin/project-memory-context 0.1.2 → 0.1.3
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/cli/setup.mjs +9 -4
- package/package.json +1 -1
- package/src/doctor.mjs +1 -1
- package/src/setup-bootstrap.mjs +10 -11
package/cli/setup.mjs
CHANGED
|
@@ -18,7 +18,10 @@ function installGraphify() {
|
|
|
18
18
|
const result = spawnSync(command, ['-m', 'pip', 'install', 'graphifyy'], { stdio: 'inherit' });
|
|
19
19
|
if (result.status === 0) return command;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
const pythonUrl = 'https://www.python.org/downloads/';
|
|
22
|
+
console.warn(`\n⚠ Could not install graphifyy automatically.`);
|
|
23
|
+
console.warn(` Python not found? Download it from: ${pythonUrl}`);
|
|
24
|
+
console.warn(` Then run: pip install graphifyy\n`);
|
|
22
25
|
return null;
|
|
23
26
|
}
|
|
24
27
|
|
|
@@ -54,16 +57,18 @@ try {
|
|
|
54
57
|
|
|
55
58
|
installGraphify();
|
|
56
59
|
|
|
60
|
+
const agent = detectSetupAgentType(cwd, { requestedAgent });
|
|
61
|
+
const { globalConfig } = resolveConfigDirs(cwd);
|
|
62
|
+
console.log(`\n Detected agent: ${agent}`);
|
|
63
|
+
|
|
57
64
|
const result = await bootstrapProjectInstall({
|
|
58
65
|
projectRoot: cwd,
|
|
59
66
|
packageRoot,
|
|
60
67
|
ollamaBaseUrl,
|
|
61
68
|
ollamaModel,
|
|
69
|
+
agent,
|
|
62
70
|
});
|
|
63
71
|
|
|
64
|
-
const agent = detectSetupAgentType(cwd, { requestedAgent });
|
|
65
|
-
const { globalConfig } = resolveConfigDirs(cwd);
|
|
66
|
-
console.log(`\n Detected agent: ${agent}`);
|
|
67
72
|
await installAgentTemplates({
|
|
68
73
|
projectRoot: cwd,
|
|
69
74
|
agent,
|
package/package.json
CHANGED
package/src/doctor.mjs
CHANGED
|
@@ -34,7 +34,7 @@ async function checkNodeVersion() {
|
|
|
34
34
|
async function checkPython(resolvePythonBin, spawnCheck) {
|
|
35
35
|
const bin = resolvePythonBin?.() ?? null;
|
|
36
36
|
if (!bin) {
|
|
37
|
-
return { name: 'python', status: 'fail', message: 'Python 3 not found
|
|
37
|
+
return { name: 'python', status: 'fail', message: 'Python 3 not found — download from https://www.python.org/downloads/ or set PATH' };
|
|
38
38
|
}
|
|
39
39
|
if (!spawnCheck) {
|
|
40
40
|
return { name: 'python', status: 'ok', message: `${bin} found (not verified — no spawn check provided)` };
|
package/src/setup-bootstrap.mjs
CHANGED
|
@@ -63,12 +63,11 @@ async function writeMcpJson(projectRoot, installState) {
|
|
|
63
63
|
return mcpPath;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
async function ensureAgentConfigRegistration(projectRoot, installState) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const configPath = join(projectConfig, 'opencode.json');
|
|
66
|
+
async function ensureAgentConfigRegistration(projectRoot, installState, agentType) {
|
|
67
|
+
if (agentType === 'opencode') {
|
|
68
|
+
const opencodeDir = join(projectRoot, '.opencode');
|
|
69
|
+
await mkdir(opencodeDir, { recursive: true });
|
|
70
|
+
const configPath = join(opencodeDir, 'opencode.json');
|
|
72
71
|
const config = await readJson(configPath, { $schema: 'https://opencode.ai/config.json' });
|
|
73
72
|
const existing = Array.isArray(config.plugin) ? config.plugin : [];
|
|
74
73
|
if (!existing.includes('@aabadin/project-memory-context')) {
|
|
@@ -80,15 +79,15 @@ async function ensureAgentConfigRegistration(projectRoot, installState) {
|
|
|
80
79
|
};
|
|
81
80
|
await mkdir(dirname(configPath), { recursive: true });
|
|
82
81
|
await writeFile(configPath, `${JSON.stringify(config, null, 2)}\n`, 'utf8');
|
|
83
|
-
// Also write .mcp.json so agent-memory is available immediately
|
|
84
82
|
await writeMcpJson(projectRoot, installState);
|
|
85
83
|
return configPath;
|
|
86
84
|
}
|
|
87
85
|
|
|
86
|
+
const { projectConfig } = resolveConfigDirs(projectRoot);
|
|
87
|
+
const agentDir = basename(projectConfig);
|
|
88
|
+
|
|
88
89
|
if (agentDir === '.claude' || agentDir === '.cursor' || agentDir === '.pmc') {
|
|
89
|
-
// For Claude Code, Cursor, and generic PMC setups: write .mcp.json directly
|
|
90
90
|
const mcpPath = await writeMcpJson(projectRoot, installState);
|
|
91
|
-
// Also persist enrichment config
|
|
92
91
|
const enrichPath = join(projectConfig, PMC_ENRICHMENT_CONFIG_FILE);
|
|
93
92
|
const existingConfig = await readJson(enrichPath, {});
|
|
94
93
|
const config = {
|
|
@@ -107,7 +106,6 @@ async function ensureAgentConfigRegistration(projectRoot, installState) {
|
|
|
107
106
|
return mcpPath;
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
// Fallback: no agent dir detected — write .mcp.json at project root
|
|
111
109
|
return writeMcpJson(projectRoot, installState);
|
|
112
110
|
}
|
|
113
111
|
|
|
@@ -126,6 +124,7 @@ export async function bootstrapProjectInstall({
|
|
|
126
124
|
ollamaBaseUrl,
|
|
127
125
|
ollamaModel,
|
|
128
126
|
embeddingCachePath,
|
|
127
|
+
agent,
|
|
129
128
|
}) {
|
|
130
129
|
const dirs = await ensureProjectMemoryContextDirs(projectRoot);
|
|
131
130
|
const memoryDbPath = join(dirs.base, 'memory-db');
|
|
@@ -140,7 +139,7 @@ export async function bootstrapProjectInstall({
|
|
|
140
139
|
|
|
141
140
|
await mkdir(memoryDbPath, { recursive: true });
|
|
142
141
|
await writeJsonArtifact(join(dirs.base, 'install.json'), installState);
|
|
143
|
-
const configPath = await ensureAgentConfigRegistration(projectRoot, installState);
|
|
142
|
+
const configPath = await ensureAgentConfigRegistration(projectRoot, installState, agent);
|
|
144
143
|
const commandPath = await copyTemplate(packageRoot, 'project-memory-context.md', projectRoot);
|
|
145
144
|
const workflowPath = await copyTemplate(packageRoot, 'project-memory-context workflow.md', projectRoot);
|
|
146
145
|
|