Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions UPSTREAM_SYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ em volta. Use `git grep "VERBOO-BRAND"` para localizar todos os pontos editados.
- `src/commands/provider/` — arquivos **NÃO foram deletados** (upstream
continua mexendo neles; deletar gera conflitos "deleted file modified upstream").

#### Nada da Anthropic na inicialização
- `src/utils/plugins/officialMarketplaceStartupCheck.ts` —
`checkAndInstallNativeMarketplaces` não instala `claude-plugins-official`
(sob demanda: instalar um plugin dela ou `/lsp recommend` ainda funcionam).
- `src/utils/plugins/schemas.ts` — `isMarketplaceAutoUpdate`: só a loja da
Verboo se atualiza sozinha por padrão.
- `src/utils/nativeInstaller/installer.ts` — `NATIVE_BUILDS_PUBLISHED = false`:
`installLatest`, `cleanupNpmInstallations` e `manualRemoveNpmPackage` não
baixam, desinstalam nem apagam nada.
- `src/utils/nativeInstaller/download.ts` e `src/utils/autoUpdater.ts` —
`GCS_BUCKET_URL = ''` (o bucket upstream é o do Claude Code).
- `src/utils/doctorDiagnostic.ts` — só procura `MACRO.PACKAGE_URL`; nunca
sugere desinstalar `@anthropic-ai/claude-code`.

#### Mensagens reescritas
- `src/utils/providerValidation.ts` (3 ocorrências)
- `src/services/api/withRetry.ts`
Expand Down
3 changes: 3 additions & 0 deletions scripts/verify-no-phone-home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const BANNED_PATTERNS = [
'infra.ant.dev',
'claude-code-feedback',
'C07VBSHV7EV',
// Anthropic's Claude Code release buckets: there are no native @verboo/code builds.
'claude-code-dist-86c565f3',
'claude-code-ci-sentinel',
] as const

if (!existsSync(DIST)) {
Expand Down
7 changes: 4 additions & 3 deletions src/services/mcp/officialRegistry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ describe('prefetchOfficialMcpUrls', () => {
expect(getSpy).not.toHaveBeenCalled()
})

test('fetches registry in first-party mode', async () => {
// VERBOO-BRAND: startup does not call Anthropic, even in first-party mode.
test('never fetches the registry', async () => {
delete process.env.CLAUDE_CODE_USE_OPENAI
delete process.env.CLAUDE_CODE_USE_GEMINI
delete process.env.CLAUDE_CODE_USE_GITHUB
Expand All @@ -66,7 +67,7 @@ describe('prefetchOfficialMcpUrls', () => {
const { prefetchOfficialMcpUrls, isOfficialMcpUrl } = await importFreshModule()
await prefetchOfficialMcpUrls()

expect(getSpy).toHaveBeenCalledTimes(1)
expect(isOfficialMcpUrl('https://example.com/mcp')).toBe(true)
expect(getSpy).not.toHaveBeenCalled()
expect(isOfficialMcpUrl('https://example.com/mcp')).toBe(false)
})
})
7 changes: 7 additions & 0 deletions src/services/mcp/officialRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios'
import { isVerbooMode } from '../../constants/oauth.js'
import { logForDebugging } from '../../utils/debug.js'
import { errorMessage } from '../../utils/errors.js'
import { getAPIProvider } from '../../utils/model/providers.js'
Expand Down Expand Up @@ -36,6 +37,12 @@ export async function prefetchOfficialMcpUrls(): Promise<void> {
return
}

// VERBOO-BRAND: nothing calls Anthropic at startup. The only consumer of this
// list is analytics metadata, which Verboo does not send.
if (isVerbooMode()) {
return
}

// The official first-party MCP registry is only relevant for first-party mode.
if (getAPIProvider() !== 'firstParty') {
return
Expand Down
20 changes: 20 additions & 0 deletions src/services/mcp/officialRegistry.verboo.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { afterEach, expect, spyOn, test } from 'bun:test'
import axios from 'axios'

import { isOfficialMcpUrl, prefetchOfficialMcpUrls } from './officialRegistry.js'

const savedTraffic = process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC

afterEach(() => {
if (savedTraffic === undefined) delete process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
else process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = savedTraffic
})

test('startup does not call the Anthropic MCP registry', async () => {
delete process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
const get = spyOn(axios, 'get')
await prefetchOfficialMcpUrls()
expect(get).not.toHaveBeenCalled()
expect(isOfficialMcpUrl('https://example.com/mcp')).toBe(false)
get.mockRestore()
})
17 changes: 17 additions & 0 deletions src/services/plugins/pluginOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* - Return result objects indicating success/failure with messages
* - Can throw errors for unexpected failures
*/
import { OFFICIAL_MARKETPLACE_NAME } from '../../utils/plugins/officialMarketplace.js'
import { checkAndInstallOfficialMarketplace } from '../../utils/plugins/officialMarketplaceStartupCheck.js'
import { dirname, join } from 'path'
import { getOriginalCwd } from '../../bootstrap/state.js'
import { isBuiltinPluginId } from '../../plugins/builtinPlugins.js'
Expand Down Expand Up @@ -345,6 +347,21 @@ export async function installPluginOp(
}
}

// VERBOO-BRAND: Anthropic's marketplace is on demand, not fetched at startup.
// Installing a plugin from it is the explicit request that brings it in.
if (marketplaceName?.toLowerCase() === OFFICIAL_MARKETPLACE_NAME) {
const result = await checkAndInstallOfficialMarketplace()
if (!result.installed && result.reason !== 'already_installed') {
return {
success: false,
message:
`Could not add the "${OFFICIAL_MARKETPLACE_NAME}" marketplace to install "${pluginName}"` +
(result.reason ? ` (${result.reason})` : '') +
`. Add it with /plugin marketplace add and try again.`,
}
}
}

// ── Search materialized marketplaces for the plugin ──
let foundPlugin: PluginMarketplaceEntry | undefined
let foundMarketplace: string | undefined
Expand Down
6 changes: 4 additions & 2 deletions src/utils/autoUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import {
} from './shellConfig.js'
import { jsonParse } from './slowOperations.js'

const GCS_BUCKET_URL =
'https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases'
// VERBOO-BRAND: o bucket upstream é o do Claude Code; o @verboo/code é
// publicado só no npm, então não há canal GCS para consultar.
const GCS_BUCKET_URL = ''

class AutoUpdaterError extends ClaudeError {}

Expand Down Expand Up @@ -428,6 +429,7 @@ export async function getNpmDistTags(): Promise<NpmDistTags> {
export async function getLatestVersionFromGcs(
channel: ReleaseChannel,
): Promise<string | null> {
if (!GCS_BUCKET_URL) return null // VERBOO-BRAND
try {
const response = await axios.get(`${GCS_BUCKET_URL}/${channel}`, {
timeout: 5000,
Expand Down
21 changes: 10 additions & 11 deletions src/utils/doctorDiagnostic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ export function getInvokedBinary(): string {
}
}

async function detectMultipleInstallations(): Promise<
// VERBOO-BRAND: exportada para testar que o Claude Code do usuário não vira "órfão".
export async function detectMultipleInstallations(): Promise<
Array<{ type: string; path: string }>
> {
const fs = getFsImplementation()
Expand All @@ -271,8 +272,10 @@ async function detectMultipleInstallations(): Promise<
}

// Check for global npm installation
const packagesToCheck = ['@anthropic-ai/claude-code']
if (MACRO.PACKAGE_URL && MACRO.PACKAGE_URL !== '@anthropic-ai/claude-code') {
// VERBOO-BRAND: só o próprio pacote. Um @anthropic-ai/claude-code instalado é
// outro produto do usuário, não uma instalação da Verboo.
const packagesToCheck: string[] = []
if (MACRO.PACKAGE_URL) {
packagesToCheck.push(MACRO.PACKAGE_URL)
}
const npmResult = await execFileNoThrow('npm', [
Expand Down Expand Up @@ -578,13 +581,8 @@ export async function getDoctorDiagnostic(): Promise<DiagnosticInfo> {

for (const install of npmInstalls) {
if (install.type === 'npm-global') {
let uninstallCmd = 'npm -g uninstall @anthropic-ai/claude-code'
if (
MACRO.PACKAGE_URL &&
MACRO.PACKAGE_URL !== '@anthropic-ai/claude-code'
) {
uninstallCmd += ` && npm -g uninstall ${MACRO.PACKAGE_URL}`
}
// VERBOO-BRAND: nunca sugerir desinstalar o Claude Code do usuário.
const uninstallCmd = `npm -g uninstall ${MACRO.PACKAGE_URL}`
warnings.push({
issue: `Leftover npm global installation at ${install.path}`,
fix: `Run: ${uninstallCmd}`,
Expand Down Expand Up @@ -622,7 +620,8 @@ export async function getDoctorDiagnostic(): Promise<DiagnosticInfo> {
if (!hasUpdatePermissions && !getAutoUpdaterDisabledReason()) {
warnings.push({
issue: 'Insufficient permissions for auto-updates',
fix: `Do one of: (1) Re-install node without sudo, or (2) Use \`${getCliBinaryName()} install\` for native installation`,
// VERBOO-BRAND: não há instalação nativa; orientar um prefixo npm do usuário.
fix: 'Do one of: (1) Re-install node without sudo, or (2) Point npm to a user-writable prefix (npm config set prefix ~/.local) and reinstall',
})
}
}
Expand Down
59 changes: 59 additions & 0 deletions src/utils/doctorDiagnostic.verboo.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* VERBOO-BRAND: `verboo doctor` must only look for @verboo/code. A globally
* installed @anthropic-ai/claude-code is the user's other product and must
* never be reported as a leftover/orphaned Verboo installation.
*/
import { afterEach, expect, mock, test } from 'bun:test'
import { mkdirSync, mkdtempSync, rmSync } from 'fs'
import { tmpdir } from 'os'
import { join } from 'path'
import * as realLocalInstaller from './localInstaller.js'

const originalMacro = (globalThis as Record<string, unknown>).MACRO
let prefix: string | undefined

afterEach(() => {
;(globalThis as Record<string, unknown>).MACRO = originalMacro
if (prefix) rmSync(prefix, { recursive: true, force: true })
prefix = undefined
mock.restore()
})

async function detectWithGlobalPackages(packages: string[]) {
prefix = mkdtempSync(join(tmpdir(), 'verboo-doctor-'))
for (const name of packages) {
mkdirSync(join(prefix, 'lib', 'node_modules', name), { recursive: true })
}
;(globalThis as Record<string, unknown>).MACRO = { PACKAGE_URL: '@verboo/code' }
const npmPrefix = prefix
mock.module('./execFileNoThrow.js', () => ({
execFileNoThrow: async () => ({ code: 0, stdout: `${npmPrefix}\n`, stderr: '' }),
}))
mock.module('./localInstaller.js', () => ({
...realLocalInstaller,
getDetectedLocalInstallDir: async () => null,
}))
const { detectMultipleInstallations } = await import(
`./doctorDiagnostic.ts?ts=${Date.now()}-${Math.random()}`
)
const installations = (await detectMultipleInstallations()) as Array<{ type: string; path: string }>
// Native/local entries depend on the machine running the test; only the npm
// prefix built above is under test here.
return installations.filter(installation => installation.type.startsWith('npm-global'))
}

test('an installed Claude Code is not reported as a Verboo installation', async () => {
const installations = await detectWithGlobalPackages(['@anthropic-ai/claude-code'])
expect(installations).toEqual([])
})

test('an orphaned @verboo/code package is still reported', async () => {
const installations = await detectWithGlobalPackages([
'@anthropic-ai/claude-code',
'@verboo/code',
])
expect(installations.map(installation => installation.type)).toEqual([
'npm-global-orphan',
])
expect(installations[0]?.path).toEndWith(join('node_modules', '@verboo', 'code'))
})
12 changes: 9 additions & 3 deletions src/utils/nativeInstaller/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import { sleep } from '../sleep.js'
import { jsonStringify, writeFileSync_DEPRECATED } from '../slowOperations.js'
import { getBinaryName, getPlatform } from './installer.js'

const GCS_BUCKET_URL =
'https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases'
// VERBOO-BRAND: o bucket upstream é o do Claude Code. Não há binários do
// @verboo/code publicados, então nenhuma URL de download existe aqui.
const GCS_BUCKET_URL = ''
export const ARTIFACTORY_REGISTRY_URL =
process.env.CLAUDE_CODE_INTERNAL_ARTIFACTORY_REGISTRY_URL ?? ''

Expand Down Expand Up @@ -148,6 +149,7 @@ export async function getLatestVersion(
}

// Use GCS for external users
if (!GCS_BUCKET_URL) return null // VERBOO-BRAND: sem builds nativos publicados
return getLatestVersionFromBinaryRepo(channel, GCS_BUCKET_URL)
}

Expand Down Expand Up @@ -506,7 +508,7 @@ export async function downloadVersion(
await downloadVersionFromBinaryRepo(
version,
stagingPath,
'https://storage.googleapis.com/claude-code-ci-sentinel',
'', // VERBOO-BRAND: sentinel de CI da Anthropic removido
{ headers: { Authorization: `Bearer ${stdout.trim()}` } },
)
return 'binary'
Expand All @@ -519,6 +521,10 @@ export async function downloadVersion(
}

// Use GCS for external users
if (!GCS_BUCKET_URL) {
// VERBOO-BRAND
throw new Error('Native binaries are not published for @verboo/code; install it with npm.')
}
await downloadVersionFromBinaryRepo(version, stagingPath, GCS_BUCKET_URL)
return 'binary'
}
Expand Down
15 changes: 15 additions & 0 deletions src/utils/nativeInstaller/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,9 @@ export async function checkInstall(
return messages
}

// VERBOO-BRAND: @verboo/code só é publicado no npm; não há binários nativos.
const NATIVE_BUILDS_PUBLISHED = false

type InstallLatestResult = {
latestVersion: string | null
wasUpdated: boolean
Expand All @@ -966,6 +969,12 @@ export function installLatest(
channelOrVersion: string,
forceReinstall: boolean = false,
): Promise<InstallLatestResult> {
// VERBOO-BRAND: não existe build nativo do @verboo/code. O caminho upstream
// baixava o binário do Claude Code do bucket da Anthropic; aqui nada é
// baixado nem instalado (a CLI é distribuída pelo npm).
if (!NATIVE_BUILDS_PUBLISHED) {
return Promise.resolve({ latestVersion: null, wasUpdated: false })
}
if (forceReinstall) {
return installLatestImpl(channelOrVersion, forceReinstall)
}
Expand Down Expand Up @@ -1559,6 +1568,9 @@ export async function cleanupShellAliases(): Promise<SetupMessage[]> {
async function manualRemoveNpmPackage(
packageName: string,
): Promise<{ success: boolean; error?: string; warning?: string }> {
// VERBOO-BRAND: nunca remove pacotes nem binários (podia apagar
// <prefix>/bin/claude do Claude Code do usuário).
if (!NATIVE_BUILDS_PUBLISHED) return { success: false }
try {
// Get npm global prefix
const prefixResult = await execFileNoThrowWithCwd('npm', [
Expand Down Expand Up @@ -1692,6 +1704,9 @@ export async function cleanupNpmInstallations(): Promise<{
errors: string[]
warnings: string[]
}> {
// VERBOO-BRAND: a limpeza upstream desinstalava @anthropic-ai/claude-code e o
// próprio @verboo/code. Sem build nativo, não há nada a limpar.
if (!NATIVE_BUILDS_PUBLISHED) return { removed: 0, errors: [], warnings: [] }
const errors: string[] = []
const warnings: string[] = []
let removed = 0
Expand Down
Loading
Loading