ocerebro 0.1.0 → 0.1.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.
package/bin/ocerebro.js CHANGED
@@ -1,98 +1,107 @@
1
- #!/usr/bin/env node
2
- /**
3
- * OCerebro CLI - Node.js wrapper
4
- *
5
- * Este script chama a CLI Python do OCerebro.
6
- * Usa CommonJS para compatibilidade máxima.
7
- */
8
-
9
- const { execSync, spawn } = require('child_process');
10
- const path = require('path');
11
-
12
- // Determina o comando Python e valida versão
13
- function getPythonCmd() {
14
- const candidates = [];
15
-
16
- // Tenta python primeiro
17
- try {
18
- execSync('python --version', { stdio: 'ignore' });
19
- candidates.push('python');
20
- } catch {
21
- // Tenta python3
22
- try {
23
- execSync('python3 --version', { stdio: 'ignore' });
24
- candidates.push('python3');
25
- } catch {
26
- console.error('Erro: Python não encontrado. Por favor instale Python 3.10+');
27
- process.exit(1);
28
- }
29
- }
30
-
31
- // Valida versão do Python
32
- for (const cmd of candidates) {
33
- try {
34
- const versionOutput = execSync(`${cmd} --version`, {
35
- encoding: 'utf-8',
36
- stdio: ['ignore', 'pipe', 'pipe']
37
- });
38
- const match = versionOutput.match(/Python (\d+)\.(\d+)/);
39
- if (match) {
40
- const major = parseInt(match[1]);
41
- const minor = parseInt(match[2]);
42
- if (major < 3 || (major === 3 && minor < 10)) {
43
- console.error(`❌ Python ${major}.${minor} detectado.`);
44
- console.error(' OCerebro requer Python 3.10+');
45
- console.error(' Baixe em: https://python.org');
46
- process.exit(1);
47
- }
48
- return cmd;
49
- }
50
- } catch (err) {
51
- continue;
52
- }
53
- }
54
-
55
- // Fallback para o primeiro candidato
56
- return candidates[0];
57
- }
58
-
59
- // Encontra o caminho do pacote ocerebro
60
- function getOcerebroPath(pythonCmd) {
61
- try {
62
- // Tenta encontrar via pip show
63
- const output = execSync(`${pythonCmd} -m pip show ocerebro`, { encoding: 'utf-8' });
64
- const match = output.match(/Location: (.+)/);
65
- if (match) {
66
- return path.join(match[1].trim(), 'ocerebro');
67
- }
68
- } catch {
69
- // Se não estiver instalado via pip, usa path relativo
70
- return path.join(__dirname, '..');
71
- }
72
- return path.join(__dirname, '..');
73
- }
74
-
75
- // Argumentos da linha de comando
76
- const args = process.argv.slice(2);
77
-
78
- // Comando principal (chamado UMA única vez)
79
- const pythonCmd = getPythonCmd();
80
- const ocerebroPath = getOcerebroPath(pythonCmd);
81
- const cliScript = path.join(ocerebroPath, 'src', 'cli', 'main.py');
82
-
83
- // Executa a CLI Python
84
- const pythonArgs = [cliScript, ...args];
85
-
86
- const proc = spawn(pythonCmd, pythonArgs, {
87
- stdio: 'inherit',
88
- cwd: process.cwd()
89
- });
90
-
91
- proc.on('close', (code) => {
92
- process.exit(code);
93
- });
94
-
95
- proc.on('error', (err) => {
96
- console.error('Erro ao executar OCerebro:', err.message);
97
- process.exit(1);
98
- });
1
+ #!/usr/bin/env node
2
+ /**
3
+ * OCerebro CLI - Node.js wrapper
4
+ *
5
+ * Este script chama a CLI Python do OCerebro.
6
+ * Usa CommonJS para compatibilidade máxima.
7
+ */
8
+
9
+ const { execSync, spawn } = require('child_process');
10
+ const path = require('path');
11
+
12
+ // Determina o comando Python e valida versão
13
+ function getPythonCmd() {
14
+ const candidates = [];
15
+
16
+ // Tenta python primeiro
17
+ try {
18
+ execSync('python --version', { stdio: 'ignore' });
19
+ candidates.push('python');
20
+ } catch {
21
+ // Tenta python3
22
+ try {
23
+ execSync('python3 --version', { stdio: 'ignore' });
24
+ candidates.push('python3');
25
+ } catch {
26
+ console.error('Erro: Python não encontrado. Por favor instale Python 3.10+');
27
+ process.exit(1);
28
+ }
29
+ }
30
+
31
+ // Valida versão do Python
32
+ for (const cmd of candidates) {
33
+ try {
34
+ const versionOutput = execSync(`${cmd} --version`, {
35
+ encoding: 'utf-8',
36
+ stdio: ['ignore', 'pipe', 'pipe']
37
+ });
38
+ const match = versionOutput.match(/Python (\d+)\.(\d+)/);
39
+ if (match) {
40
+ const major = parseInt(match[1]);
41
+ const minor = parseInt(match[2]);
42
+ if (major < 3 || (major === 3 && minor < 10)) {
43
+ console.error(`❌ Python ${major}.${minor} detectado.`);
44
+ console.error(' OCerebro requer Python 3.10+');
45
+ console.error(' Baixe em: https://python.org');
46
+ process.exit(1);
47
+ }
48
+ return cmd;
49
+ }
50
+ } catch (err) {
51
+ continue;
52
+ }
53
+ }
54
+
55
+ // Fallback para o primeiro candidato
56
+ return candidates[0];
57
+ }
58
+
59
+ // Encontra o caminho do pacote ocerebro
60
+ function getOcerebroPath(pythonCmd) {
61
+ try {
62
+ // Usa -c para obter o path real do módulo instalado
63
+ const output = execSync(
64
+ `${pythonCmd} -c "import src.cli.main; import os; print(os.path.dirname(os.path.dirname(os.path.dirname(src.cli.main.__file__))))"`,
65
+ { encoding: 'utf-8' }
66
+ );
67
+ return output.trim();
68
+ } catch {
69
+ // Fallback: usa pip show para encontrar o Location
70
+ try {
71
+ const pipOutput = execSync(`${pythonCmd} -m pip show ocerebro`, { encoding: 'utf-8' });
72
+ const match = pipOutput.match(/Location: (.+)/);
73
+ if (match) {
74
+ return match[1].trim(); // sem subpasta "ocerebro/"
75
+ }
76
+ } catch {
77
+ // Se não estiver instalado via pip, usa path relativo ao bin/
78
+ return path.join(__dirname, '..');
79
+ }
80
+ }
81
+ return path.join(__dirname, '..');
82
+ }
83
+
84
+ // Argumentos da linha de comando
85
+ const args = process.argv.slice(2);
86
+
87
+ // Comando principal (chamado UMA única vez)
88
+ const pythonCmd = getPythonCmd();
89
+ const ocerebroPath = getOcerebroPath(pythonCmd);
90
+ const cliScript = path.join(ocerebroPath, 'src', 'cli', 'main.py');
91
+
92
+ // Executa a CLI Python
93
+ const pythonArgs = [cliScript, ...args];
94
+
95
+ const proc = spawn(pythonCmd, pythonArgs, {
96
+ stdio: 'inherit',
97
+ cwd: process.cwd()
98
+ });
99
+
100
+ proc.on('close', (code) => {
101
+ process.exit(code);
102
+ });
103
+
104
+ proc.on('error', (err) => {
105
+ console.error('Erro ao executar OCerebro:', err.message);
106
+ process.exit(1);
107
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocerebro",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "OCerebro - Sistema de Memoria para Agentes (Claude Code/MCP)",
5
5
  "main": "bin/ocerebro.js",
6
6
  "bin": {
package/pyproject.toml CHANGED
@@ -1,77 +1,77 @@
1
- [build-system]
2
- requires = ["setuptools>=61.0", "wheel"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "ocerebro"
7
- version = "0.1.0"
8
- description = "OCerebro - Sistema de Memoria para Agentes (Claude Code/MCP)"
9
- readme = "README.md"
10
- requires-python = ">=3.10"
11
- authors = [
12
- {name = "OARANHA", email = "seu-aranha.com@gmail.com"}
13
- ]
14
- keywords = [
15
- "claude",
16
- "claude-code",
17
- "memory",
18
- "ai",
19
- "agent",
20
- "mcp",
21
- "sqlite",
22
- "sqlite-vec",
23
- ]
24
- classifiers = [
25
- "Development Status :: 3 - Alpha",
26
- "Intended Audience :: Developers",
27
- "License :: OSI Approved :: MIT License",
28
- "Programming Language :: Python :: 3",
29
- "Programming Language :: Python :: 3.10",
30
- "Programming Language :: Python :: 3.11",
31
- "Programming Language :: Python :: 3.12",
32
- ]
33
- dependencies = [
34
- "pyyaml>=6.0",
35
- "pydantic>=2.0",
36
- "sqlite-vec>=0.1.0",
37
- "sentence-transformers>=2.2.0",
38
- "mcp>=1.0.0",
39
- "anthropic>=0.40.0",
40
- ]
41
-
42
- [project.optional-dependencies]
43
- test = [
44
- "pytest>=7.0",
45
- "pytest-cov>=4.0",
46
- ]
47
- dev = [
48
- "ocerebro[test]",
49
- "black>=23.0",
50
- "ruff>=0.1.0",
51
- ]
52
-
53
- [project.urls]
54
- Homepage = "https://github.com/OARANHA/ocerebro"
55
- Repository = "https://github.com/OARANHA/ocerebro.git"
56
- Documentation = "https://github.com/OARANHA/ocerebro#readme"
57
-
58
- [project.scripts]
59
- ocerebro = "src.cli.main:main"
60
- ocerebro-setup = "cerebro.cerebro_setup:main"
61
-
62
- [tool.setuptools.packages.find]
63
- where = ["."]
64
- include = ["src*", "cerebro*"]
65
-
66
- [tool.pytest.ini_options]
67
- testpaths = ["tests"]
68
- python_files = "test_*.py"
69
- addopts = "-v --tb=short"
70
-
71
- [tool.ruff]
72
- line-length = 100
73
- target-version = "py310"
74
-
75
- [tool.ruff.lint]
76
- select = ["E", "F", "W", "I"]
77
- ignore = ["E501"]
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ocerebro"
7
+ version = "0.1.1"
8
+ description = "OCerebro - Sistema de Memoria para Agentes (Claude Code/MCP)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ authors = [
12
+ {name = "OARANHA", email = "seu-aranha.com@gmail.com"}
13
+ ]
14
+ keywords = [
15
+ "claude",
16
+ "claude-code",
17
+ "memory",
18
+ "ai",
19
+ "agent",
20
+ "mcp",
21
+ "sqlite",
22
+ "sqlite-vec",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 3 - Alpha",
26
+ "Intended Audience :: Developers",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ ]
33
+ dependencies = [
34
+ "pyyaml>=6.0",
35
+ "pydantic>=2.0",
36
+ "sqlite-vec>=0.1.0",
37
+ "sentence-transformers>=2.2.0",
38
+ "mcp>=1.0.0",
39
+ "anthropic>=0.40.0",
40
+ ]
41
+
42
+ [project.optional-dependencies]
43
+ test = [
44
+ "pytest>=7.0",
45
+ "pytest-cov>=4.0",
46
+ ]
47
+ dev = [
48
+ "ocerebro[test]",
49
+ "black>=23.0",
50
+ "ruff>=0.1.0",
51
+ ]
52
+
53
+ [project.urls]
54
+ Homepage = "https://github.com/OARANHA/ocerebro"
55
+ Repository = "https://github.com/OARANHA/ocerebro.git"
56
+ Documentation = "https://github.com/OARANHA/ocerebro#readme"
57
+
58
+ [project.scripts]
59
+ ocerebro = "src.cli.main:main"
60
+ ocerebro-setup = "cerebro.cerebro_setup:main"
61
+
62
+ [tool.setuptools.packages.find]
63
+ where = ["."]
64
+ include = ["src*", "cerebro*"]
65
+
66
+ [tool.pytest.ini_options]
67
+ testpaths = ["tests"]
68
+ python_files = "test_*.py"
69
+ addopts = "-v --tb=short"
70
+
71
+ [tool.ruff]
72
+ line-length = 100
73
+ target-version = "py310"
74
+
75
+ [tool.ruff.lint]
76
+ select = ["E", "F", "W", "I"]
77
+ ignore = ["E501"]