fix: CLI syntax error and add conversation remove command
- Fixed bin/brainy.js to import compiled TypeScript CLI - Added conversation remove command to clean up MCP setup - Fixed tsconfig.json to include CLI in compilation - Fixed package.json import in CLI using readFileSync - Fixed storage config structure in conversation setup Fixes the 'Unexpected identifier as' syntax error when running brainy conversation setup globally. Version: 3.19.1
This commit is contained in:
parent
ced639cab1
commit
bc5aa37dd0
7 changed files with 126 additions and 2345 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [3.19.1](https://github.com/soulcraftlabs/brainy/compare/v3.19.0...v3.19.1) (2025-09-29)
|
||||||
|
|
||||||
## [3.19.0](https://github.com/soulcraftlabs/brainy/compare/v3.18.0...v3.19.0) (2025-09-29)
|
## [3.19.0](https://github.com/soulcraftlabs/brainy/compare/v3.18.0...v3.19.0) (2025-09-29)
|
||||||
|
|
||||||
## [3.17.0](https://github.com/soulcraftlabs/brainy/compare/v3.16.0...v3.17.0) (2025-09-27)
|
## [3.17.0](https://github.com/soulcraftlabs/brainy/compare/v3.16.0...v3.17.0) (2025-09-27)
|
||||||
|
|
|
||||||
2342
bin/brainy.js
2342
bin/brainy.js
File diff suppressed because it is too large
Load diff
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraft/brainy",
|
||||||
"version": "3.19.0",
|
"version": "3.19.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraft/brainy",
|
||||||
"version": "3.19.0",
|
"version": "3.19.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.540.0",
|
"@aws-sdk/client-s3": "^3.540.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@soulcraft/brainy",
|
"name": "@soulcraft/brainy",
|
||||||
"version": "3.19.0",
|
"version": "3.19.1",
|
||||||
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export const conversationCommand = {
|
||||||
.positional('action', {
|
.positional('action', {
|
||||||
describe: 'Conversation operation to perform',
|
describe: 'Conversation operation to perform',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
choices: ['setup', 'search', 'context', 'thread', 'stats', 'export', 'import']
|
choices: ['setup', 'remove', 'search', 'context', 'thread', 'stats', 'export', 'import']
|
||||||
})
|
})
|
||||||
.option('conversation-id', {
|
.option('conversation-id', {
|
||||||
describe: 'Conversation ID',
|
describe: 'Conversation ID',
|
||||||
|
|
@ -82,6 +82,9 @@ export const conversationCommand = {
|
||||||
case 'setup':
|
case 'setup':
|
||||||
await handleSetup(argv)
|
await handleSetup(argv)
|
||||||
break
|
break
|
||||||
|
case 'remove':
|
||||||
|
await handleRemove(argv)
|
||||||
|
break
|
||||||
case 'search':
|
case 'search':
|
||||||
await handleSearch(argv)
|
await handleSearch(argv)
|
||||||
break
|
break
|
||||||
|
|
@ -230,7 +233,15 @@ async function main() {
|
||||||
main()
|
main()
|
||||||
`
|
`
|
||||||
|
|
||||||
await fs.writeFile(serverPath, serverScript, { encoding: 'utf8', mode: 0o755 })
|
await fs.writeFile(serverPath, serverScript, 'utf8')
|
||||||
|
// Make executable on Unix systems
|
||||||
|
try {
|
||||||
|
await import('fs').then(fsModule => {
|
||||||
|
fsModule.promises.chmod(serverPath, 0o755).catch(() => {})
|
||||||
|
})
|
||||||
|
} catch {
|
||||||
|
// Windows doesn't need chmod
|
||||||
|
}
|
||||||
spinner.succeed('Created MCP server script')
|
spinner.succeed('Created MCP server script')
|
||||||
|
|
||||||
// Create Claude Code config
|
// Create Claude Code config
|
||||||
|
|
@ -262,7 +273,9 @@ main()
|
||||||
const brain = new Brainy({
|
const brain = new Brainy({
|
||||||
storage: {
|
storage: {
|
||||||
type: 'filesystem',
|
type: 'filesystem',
|
||||||
path: dataDir
|
options: {
|
||||||
|
path: dataDir
|
||||||
|
}
|
||||||
},
|
},
|
||||||
silent: true
|
silent: true
|
||||||
})
|
})
|
||||||
|
|
@ -289,6 +302,94 @@ main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle remove command - Remove MCP server and optionally data
|
||||||
|
*/
|
||||||
|
async function handleRemove(argv: CommandArguments) {
|
||||||
|
console.log(chalk.bold.cyan('\n🗑️ Brainy Infinite Memory Removal\n'))
|
||||||
|
|
||||||
|
const homeDir = process.env.HOME || process.env.USERPROFILE || '~'
|
||||||
|
const brainyDir = path.join(homeDir, '.brainy-memory')
|
||||||
|
const configPath = path.join(homeDir, '.config', 'claude-code', 'mcp-servers.json')
|
||||||
|
|
||||||
|
// Check if setup exists
|
||||||
|
const brainyExists = await fs.exists(brainyDir)
|
||||||
|
const configExists = await fs.exists(configPath)
|
||||||
|
|
||||||
|
if (!brainyExists && !configExists) {
|
||||||
|
console.log(chalk.yellow('No Brainy memory setup found. Nothing to remove.'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show what will be removed
|
||||||
|
console.log(chalk.white('The following will be removed:'))
|
||||||
|
if (brainyExists) {
|
||||||
|
console.log(chalk.dim(` • ${brainyDir} (memory data and MCP server)`))
|
||||||
|
}
|
||||||
|
if (configExists) {
|
||||||
|
console.log(chalk.dim(` • MCP config entry in ${configPath}`))
|
||||||
|
}
|
||||||
|
console.log()
|
||||||
|
|
||||||
|
// Confirm removal
|
||||||
|
const { confirm } = await inquirer.prompt([
|
||||||
|
{
|
||||||
|
type: 'confirm',
|
||||||
|
name: 'confirm',
|
||||||
|
message: 'Are you sure you want to remove Brainy infinite memory?',
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
if (!confirm) {
|
||||||
|
console.log(chalk.yellow('Removal cancelled'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const spinner = ora('Removing Brainy memory setup...').start()
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Remove Brainy directory
|
||||||
|
if (brainyExists) {
|
||||||
|
// Use Node.js fs for rm operation as universal fs doesn't have it
|
||||||
|
const nodefs = await import('fs')
|
||||||
|
await nodefs.promises.rm(brainyDir, { recursive: true, force: true })
|
||||||
|
spinner.text = 'Removed memory directory...'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove MCP config entry
|
||||||
|
if (configExists) {
|
||||||
|
try {
|
||||||
|
const configContent = await fs.readFile(configPath, 'utf8')
|
||||||
|
const mcpConfig = JSON.parse(configContent)
|
||||||
|
|
||||||
|
if (mcpConfig['brainy-memory']) {
|
||||||
|
delete mcpConfig['brainy-memory']
|
||||||
|
await fs.writeFile(configPath, JSON.stringify(mcpConfig, null, 2), 'utf8')
|
||||||
|
spinner.text = 'Removed MCP configuration...'
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// If config file is corrupted or empty, skip
|
||||||
|
spinner.warn('Could not update MCP config file')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spinner.succeed('Successfully removed Brainy infinite memory')
|
||||||
|
|
||||||
|
console.log()
|
||||||
|
console.log(chalk.bold('✅ Cleanup complete'))
|
||||||
|
console.log()
|
||||||
|
console.log(chalk.white('All conversation data and MCP configuration have been removed.'))
|
||||||
|
console.log(chalk.dim('Run "brainy conversation setup" to set up again.'))
|
||||||
|
console.log()
|
||||||
|
|
||||||
|
} catch (error: any) {
|
||||||
|
spinner.fail('Removal failed')
|
||||||
|
console.error(chalk.red('Error:'), error.message)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle search command - Search messages
|
* Handle search command - Search messages
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,13 @@ import { neuralCommands } from './commands/neural.js'
|
||||||
import { coreCommands } from './commands/core.js'
|
import { coreCommands } from './commands/core.js'
|
||||||
import { utilityCommands } from './commands/utility.js'
|
import { utilityCommands } from './commands/utility.js'
|
||||||
import conversationCommand from './commands/conversation.js'
|
import conversationCommand from './commands/conversation.js'
|
||||||
import { version } from '../package.json'
|
import { readFileSync } from 'fs'
|
||||||
|
import { fileURLToPath } from 'url'
|
||||||
|
import { dirname, join } from 'path'
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
|
const packageJson = JSON.parse(readFileSync(join(__dirname, '..', '..', 'package.json'), 'utf8'))
|
||||||
|
const version = packageJson.version
|
||||||
|
|
||||||
// CLI Configuration
|
// CLI Configuration
|
||||||
const program = new Command()
|
const program = new Command()
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"dist",
|
"dist",
|
||||||
"**/*.test.ts",
|
"**/*.test.ts",
|
||||||
"src/cli/**/*",
|
"src/scripts/**/*"
|
||||||
"src/scripts/**/*",
|
|
||||||
"src/mcp/**/*"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue