Live data from Hacker News

Claude Code's source code has been leaked via a map file in their NPM registry

twitter.com

51–60 of 1001 posts

Re: Claude Code's source code has been leaked via a map file in their NPM registry

#51
post #9

The code looks, at a glance, as bad as you expect.

It really doesn’t matter anymore. I’m saying this as a person who used to care about it. It does what it’s generally supposed to do, it has users. Two things that matter at this day and age.

Re: Claude Code's source code has been leaked via a map file in their NPM registry

#53

Earlier quoted context omitted.

Can you give an example? Looks fairly decent to me

the "useCanUseTool.tsx" hook, is definitely something I would hate seeing in any code base I come across. It's extremely nested, it's basically an if statement soup `useTypeahead.tsx` is even worse, extremely nested, a ton of "if else" statements, I doubt you'd look at it and think this is sane code

  export function extractSearchToken(completionToken: {
    token: string;
    isQuoted?: boolean;
  }): string {
    if (completionToken.isQuoted) {
      // Remove @" prefix and optional closing "
      return completionToken.token.slice(2).replace(/"$/, '');
    } else if (completionToken.token.startsWith('@')) {
      return completionToken.token.substring(1);
    } else {
      return completionToken.token;
    }
  }
Why even use else if with return...

Re: Claude Code's source code has been leaked via a map file in their NPM registry

#54
post #50
post #9

The code looks, at a glance, as bad as you expect.

Honestly when using it, it feels vibe coded to the bone, together with the matching weird UI footgun quirks

Team has been extremely open how it has been vibe coded from day 1. Given the insane amount of releases, I don’t think it would be possible without it.

Re: Claude Code's source code has been leaked via a map file in their NPM registry

#55
post #21

Earlier quoted context omitted.

1. Randomly peeking at process.argv and process.env all around. Other weird layering violations, too. 2. Tons of repeat code, eg. multiple ad-hoc implementations of hash functions / PRNGs. 3. Almost no high-level comments about structure - I assume all that lives in some CLAUDE.md instead.

You're right about process.argv - wow, that looks like a maintenance and testability nightmare.

They use claude code to code it. Makes sense

Re: Claude Code's source code has been leaked via a map file in their NPM registry

#59

Earlier quoted context omitted.

Can you give an example? Looks fairly decent to me

the "useCanUseTool.tsx" hook, is definitely something I would hate seeing in any code base I come across. It's extremely nested, it's basically an if statement soup `useTypeahead.tsx` is even worse, extremely nested, a ton of "if else" statements, I doubt you'd look at it and think this is sane code

Lol even the name is crazy

Re: Claude Code's source code has been leaked via a map file in their NPM registry

#60

Why is Claude Code, a desktop tool, written in JS? Is the future of all software JS or Typescript?

Original author of Claude Code is expert on TypeScript [1]

[1] https://www.amazon.com/Programming-TypeScript-Making-JavaScr...

Post reply on HN