@ornexus/neocortex-cli 4.5.1 → 4.6.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/LICENSE CHANGED
@@ -5,7 +5,7 @@ Copyright (c) 2026 OrNexus AI
5
5
  Parameters
6
6
 
7
7
  Licensor: OrNexus AI
8
- Licensed Work: Synapse CLI
8
+ Licensed Work: Neocortex CLI
9
9
  The Licensed Work is (c) 2026 OrNexus AI.
10
10
  Additional Use Grant: You may make production use of the Licensed Work,
11
11
  provided such use does not include offering the
package/install.js CHANGED
@@ -10,7 +10,6 @@
10
10
  */
11
11
 
12
12
  const https = require('https');
13
- const http = require('http');
14
13
  const fs = require('fs');
15
14
  const path = require('path');
16
15
  const os = require('os');
@@ -71,9 +70,17 @@ function getPlatformInfo() {
71
70
  // HTTP HELPERS
72
71
  // ═══════════════════════════════════════════════════════════════════
73
72
 
74
- function fetch(url, options = {}) {
73
+ function fetch(url, options = {}, _redirectCount = 0) {
75
74
  return new Promise((resolve, reject) => {
76
- const protocol = url.startsWith('https') ? https : http;
75
+ if (_redirectCount > 5) {
76
+ return reject(new Error('Too many redirects (max 5)'));
77
+ }
78
+
79
+ const parsedUrl = new URL(url);
80
+ if (parsedUrl.protocol !== 'https:') {
81
+ return reject(new Error(`Insecure protocol blocked: ${parsedUrl.protocol} - only HTTPS is allowed`));
82
+ }
83
+
77
84
  const headers = {
78
85
  'User-Agent': `neocortex-cli/${VERSION}`,
79
86
  'Accept': options.accept || 'application/json',
@@ -83,10 +90,19 @@ function fetch(url, options = {}) {
83
90
  if (GITHUB_TOKEN && url.includes('github.com')) {
84
91
  headers['Authorization'] = `Bearer ${GITHUB_TOKEN}`;
85
92
  }
86
- const req = protocol.get(url, { headers }, (res) => {
87
- // Follow redirects
93
+ const req = https.get(url, { headers }, (res) => {
94
+ // Follow redirects (with limit and HTTPS validation)
88
95
  if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
89
- return fetch(res.headers.location, options).then(resolve).catch(reject);
96
+ const redirectUrl = res.headers.location;
97
+ try {
98
+ const redirectParsed = new URL(redirectUrl);
99
+ if (redirectParsed.protocol !== 'https:') {
100
+ return reject(new Error(`Redirect to insecure protocol blocked: ${redirectParsed.protocol}`));
101
+ }
102
+ } catch {
103
+ return reject(new Error(`Invalid redirect URL: ${redirectUrl}`));
104
+ }
105
+ return fetch(redirectUrl, options, _redirectCount + 1).then(resolve).catch(reject);
90
106
  }
91
107
 
92
108
  if (res.statusCode !== 200) {
@@ -248,7 +264,12 @@ async function install() {
248
264
  process.exit(1);
249
265
  }
250
266
  } else {
251
- console.log(' (no checksum available, skipped)');
267
+ console.log(' FAILED');
268
+ fs.unlinkSync(tmpPath);
269
+ console.error('\n ERRO: SHA256SUMS.txt nao encontrado na release.');
270
+ console.error(' Checksum verification is MANDATORY for security.');
271
+ console.error(` Baixe manualmente: https://github.com/${REPO}/releases\n`);
272
+ process.exit(1);
252
273
  }
253
274
 
254
275
  // Atomic move
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornexus/neocortex-cli",
3
- "version": "4.5.1",
3
+ "version": "4.6.1",
4
4
  "description": "Neocortex CLI - AI Agent Orchestrator for multi-platform development (Claude Code, Cursor, VS Code, Gemini, Codex)",
5
5
  "keywords": [
6
6
  "claude",
@@ -43,13 +43,12 @@
43
43
  "files": [
44
44
  "README.md",
45
45
  "install.js",
46
- "sync-version.js",
47
46
  ".env.example"
48
47
  ],
49
48
  "scripts": {
50
49
  "postinstall": "node -e \"console.log('\\nNeocortex CLI v'+require('./package.json').version+' instalado!\\n\\nSetup: npx @ornexus/neocortex-cli\\nBinarios: https://github.com/OrNexus-AI/neocortex-cli/releases\\n')\"",
51
50
  "sync": "node sync-version.js",
52
- "prepublishOnly": "node sync-version.js && node -e \"console.log('Publishing Neocortex CLI v'+require('./package.json').version)\"",
51
+ "prepublishOnly": "node -e \"console.log('Publishing Neocortex CLI v'+require('./package.json').version)\"",
53
52
  "version": "npm run sync && echo '🔖 Nova versão:' && cat package.json | grep version",
54
53
  "test": "vitest run",
55
54
  "typecheck": "tsc --noEmit",
@@ -64,6 +63,9 @@
64
63
  "compile:darwin-x64": "bun build packages/cli/src/index.ts --compile --target=bun-darwin-x64 --outfile dist/bin/neocortex-cli-darwin-x64",
65
64
  "compile:windows-x64": "bun build packages/cli/src/index.ts --compile --target=bun-windows-x64 --outfile dist/bin/neocortex-cli-windows-x64.exe",
66
65
  "build:publish": "bun run scripts/build-publish.ts",
66
+ "validate:npm": "bun run scripts/validate-npm-package.ts",
67
+ "validate:binaries": "bun run scripts/validate-binaries.ts",
68
+ "validate:release": "bun run scripts/validate-npm-package.ts && bun run scripts/validate-binaries.ts",
67
69
  "release": "bun run scripts/release.ts",
68
70
  "check": "bun run lint && bun run typecheck && bun run test"
69
71
  },
@@ -106,6 +108,8 @@
106
108
  },
107
109
  "devDependencies": {
108
110
  "@vitest/coverage-v8": "^3.2.4",
111
+ "audit-ci": "^7.1.0",
112
+ "javascript-obfuscator": "^4.1.1",
109
113
  "react-devtools-core": "7.0.1",
110
114
  "vitest": "^3.2.4"
111
115
  }
package/sync-version.js DELETED
@@ -1,200 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Neocortex - Version Sync Script
4
- *
5
- * Sincroniza a versão do package.json em todos os arquivos do projeto.
6
- * Executado automaticamente no prepublishOnly.
7
- *
8
- * Uso: node sync-version.js
9
- */
10
-
11
- const fs = require('fs');
12
- const path = require('path');
13
-
14
- // Ler versão do package.json (fonte única de verdade)
15
- const pkg = require('./package.json');
16
- const VERSION = pkg.version;
17
- const VERSION_MAJOR_MINOR = VERSION.split('.').slice(0, 2).join('.');
18
-
19
- console.log(`\n🔄 Sincronizando versão ${VERSION} em todos os arquivos...\n`);
20
-
21
- // Definição dos arquivos e padrões a substituir
22
- const replacements = [
23
- // Sub-package versions (shared, core, cli)
24
- {
25
- file: 'packages/shared/package.json',
26
- patterns: [
27
- [/"version": "[\d.]+"/g, `"version": "${VERSION}"`],
28
- ]
29
- },
30
- {
31
- file: 'packages/core/package.json',
32
- patterns: [
33
- [/"version": "[\d.]+"/g, `"version": "${VERSION}"`],
34
- ]
35
- },
36
- {
37
- file: 'packages/cli/package.json',
38
- patterns: [
39
- [/"version": "[\d.]+"/g, `"version": "${VERSION}"`],
40
- ]
41
- },
42
- // neocortex-cli.md
43
- {
44
- file: 'targets/claude-code/neocortex-cli.md',
45
- patterns: [
46
- [/# Neocortex v[\d.]+ -/g, `# Neocortex v${VERSION} -`],
47
- [/NEOCORTEX-CLI v[\d.]+ \(state\.json\)/g, `NEOCORTEX-CLI v${VERSION} (state.json)`],
48
- ]
49
- },
50
- // neocortex-cli.agent.yaml
51
- {
52
- file: 'targets/claude-code/neocortex-cli.agent.yaml',
53
- patterns: [
54
- [/version: '[\d.]+'/g, `version: '${VERSION}'`],
55
- [/NEOCORTEX-CLI v[\d.]+ \(External Claude CLI\)/g, `NEOCORTEX-CLI v${VERSION} (External Claude CLI)`],
56
- ]
57
- },
58
- // install.sh
59
- {
60
- file: 'install.sh',
61
- patterns: [
62
- [/VERSION="[\d.]+"/g, `VERSION="${VERSION}"`],
63
- ]
64
- },
65
- // install.ps1
66
- {
67
- file: 'install.ps1',
68
- patterns: [
69
- [/\$VERSION = "[\d.]+"/g, `$VERSION = "${VERSION}"`],
70
- ]
71
- },
72
- // core/data/state-template.json
73
- {
74
- file: 'core/data/state-template.json',
75
- patterns: [
76
- [/"version": "[\d.]+"/g, `"version": "${VERSION}"`],
77
- [/"neocortex_cli_version": "[\d.]+"/g, `"neocortex_cli_version": "${VERSION}"`],
78
- ]
79
- },
80
- // core/data/step-registry.json
81
- {
82
- file: 'core/data/step-registry.json',
83
- patterns: [
84
- [/"version": "[\d.]+"/g, `"version": "${VERSION}"`],
85
- ]
86
- },
87
- // core/data/state-utils.md
88
- {
89
- file: 'core/data/state-utils.md',
90
- patterns: [
91
- [/# State Utilities - Neocortex v[\d.]+/g, `# State Utilities - Neocortex v${VERSION}`],
92
- ]
93
- },
94
- // core/data/worktree-sync.md
95
- {
96
- file: 'core/data/worktree-sync.md',
97
- patterns: [
98
- [/# Worktree Synchronization Utilities - Neocortex v[\d.]+/g, `# Worktree Synchronization Utilities - Neocortex v${VERSION}`],
99
- ]
100
- },
101
- // core/data/worktree-sync-functions.sh
102
- {
103
- file: 'core/data/worktree-sync-functions.sh',
104
- patterns: [
105
- [/# Neocortex - Worktree Sync Functions v[\d.]+/g, `# Neocortex - Worktree Sync Functions v${VERSION}`],
106
- ]
107
- },
108
- // targets/claude-code/workflow.md
109
- {
110
- file: 'targets/claude-code/workflow.md',
111
- patterns: [
112
- [/Neocortex v[\d.]+/g, `Neocortex v${VERSION}`],
113
- ]
114
- },
115
- // Platform agent files
116
- {
117
- file: 'targets/cursor/agent.md',
118
- patterns: [
119
- [/# Neocortex v[\d.]+ -/g, `# Neocortex v${VERSION} -`],
120
- ]
121
- },
122
- {
123
- file: 'targets/vscode/agent.md',
124
- patterns: [
125
- [/# Neocortex v[\d.]+ -/g, `# Neocortex v${VERSION} -`],
126
- ]
127
- },
128
- {
129
- file: 'targets/gemini-cli/agent.md',
130
- patterns: [
131
- [/# Neocortex v[\d.]+ -/g, `# Neocortex v${VERSION} -`],
132
- ]
133
- },
134
- {
135
- file: 'targets/codex/agents.md',
136
- patterns: [
137
- [/# Neocortex v[\d.]+ -/g, `# Neocortex v${VERSION} -`],
138
- ]
139
- },
140
- {
141
- file: 'targets/antigravity/gemini.md',
142
- patterns: [
143
- [/Neocortex v[\d.]+/g, `Neocortex v${VERSION}`],
144
- ]
145
- },
146
- {
147
- file: 'targets/antigravity/skill/SKILL.md',
148
- patterns: [
149
- [/Neocortex v[\d.]+/g, `Neocortex v${VERSION}`],
150
- ]
151
- },
152
- // Source code VERSION constant
153
- {
154
- file: 'packages/shared/src/index.ts',
155
- patterns: [
156
- [/export const VERSION = '[\d.]+' as const;/g, `export const VERSION = '${VERSION}' as const;`],
157
- ]
158
- },
159
- // Init memory command version
160
- {
161
- file: 'packages/cli/src/commands/init-memory.ts',
162
- patterns: [
163
- [/const NEOCORTEX_VERSION = '[\d.]+';/g, `const NEOCORTEX_VERSION = '${VERSION}';`],
164
- ]
165
- },
166
- ];
167
-
168
- let filesUpdated = 0;
169
- let totalReplacements = 0;
170
-
171
- for (const { file, patterns } of replacements) {
172
- const filePath = path.join(__dirname, file);
173
-
174
- if (!fs.existsSync(filePath)) {
175
- console.log(` ⚠️ ${file} não encontrado, pulando...`);
176
- continue;
177
- }
178
-
179
- let content = fs.readFileSync(filePath, 'utf8');
180
- let fileReplacements = 0;
181
-
182
- for (const [pattern, replacement] of patterns) {
183
- const matches = content.match(pattern);
184
- if (matches) {
185
- content = content.replace(pattern, replacement);
186
- fileReplacements += matches.length;
187
- }
188
- }
189
-
190
- if (fileReplacements > 0) {
191
- fs.writeFileSync(filePath, content);
192
- console.log(` ✅ ${file} (${fileReplacements} substituição(ões))`);
193
- filesUpdated++;
194
- totalReplacements += fileReplacements;
195
- } else {
196
- console.log(` ⏭️ ${file} (já atualizado)`);
197
- }
198
- }
199
-
200
- console.log(`\n✨ Sincronização completa: ${filesUpdated} arquivo(s), ${totalReplacements} substituição(ões)\n`);