Commit Graph

39 Commits

Author SHA1 Message Date
Patrick Quist
ee3e261bb3 Make libs= property optional via auto-discovery (#8552) 2026-03-11 21:40:54 +01:00
Partouf
2395dae3e3 Fix Go library annotation URLs and suppress spurious include path warnings
Go libraries on Conan use a `go_` prefix (e.g. `go_uuid`) but the frontend
was constructing annotation URLs without it. Add library-level `lookupname`
support in options-handler so versions inherit it, and set `lookupname` and
`packagedheaders` on Go libraries. Also suppress the "no include paths"
warning for `packagedheaders` libraries since their paths are resolved at
build time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:07:58 +01:00
Matt Godbolt
53c7dd328b Configure Biome import organiser with grouped imports (#8431)
Enable Biome's `organizeImports` with groups matching the original
ESLint `import/order` configuration:

1. **Node builtins** (`node:fs`, `path`, etc.)
2. *(blank line)*
3. **Third-party packages** (`express`, `@sentry/node`, etc.)
4. *(blank line)*
5. **Local/relative imports** (`../foo.js`, `./bar.js`, aliases)

This resolves the inconsistency where Biome wasn't enforcing import
grouping, meaning new files would lose the blank-line separation that
the old ESLint config enforced.

### Impact
- **354 files** updated out of 738 checked (~48%)
- **+188 / -240 lines** (net -52) — almost entirely single blank line
additions/removals between import groups
- No import reordering; purely group separator consistency

Fixes #7373

🤖 Generated by LLM (Claude, via OpenClaw)
2026-02-01 20:50:46 -06:00
Matt Godbolt
f49ed02cfb Fix ClientOptionsType.tools to use proper Tool type (#8407)
## Summary
- Changes `ClientOptionsType.tools` from `Record<any, any>` to
`Record<LanguageKey, Record<string, Tool>>`
- This prevents bugs like the one fixed in #8406 where `tool.name` was
used instead of `tool.tool.name`
- The `any` type was escaping type checking entirely

## Test plan
- [x] `npm run ts-check` passes
- [x] `npm run test-min` passes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 20:28:16 -05:00
Matt Godbolt
c29ad46f3a [Not Live; disabled by default] Add Claude Explain feature for AI-powered assembly explanations (#7749)
Add Claude Explain feature for AI-powered code explanations

This PR introduces Claude Explain, a new feature that provides AI-powered explanations of compiler output directly within Compiler Explorer.

Key features:

Claude Explain functionality:
  - New explain view pane
  - Explains compiler output with full context of source code and compilation output
  - Configurable audience level and explanation type
  - Response caching to improve performance and reduce API calls
  - Usage statistics display showing requests used and token counts

User experience:
  - Consent flow on first use explaining data handling and privacy
  - AI disclaimer banner warning about potential LLM inaccuracies
  - Respects "no-ai" directive in source code for users who don't want AI processing

Privacy and security:
  - Data sent to Anthropic's Claude API as documented in privacy policy
  - No data used for model training
  - Clear consent required before first use
  - Support for opting out via "no-ai" directive

The feature is marked as beta and can be enabled via configuration.

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-05 09:31:48 -05:00
Matt Godbolt
8734c3e492 Update biome (#7956)
- latest biome, and fix its configuration
- fixes "static" content to be globally configured too (instead of
per-line)
- fixes issues:
  - imports fixed up
  - `Date.now()` vs `+new Date()`
  - some unused things `_` prefixed
 
After discussion with the team, turned off the unused parameter warning.
2025-07-28 10:34:46 -05:00
Matt Godbolt
f94ff8332a Refactor: Split app.ts into smaller modules (#7681)
## Summary
This PR significantly improves maintainability by breaking up the 880+ line monolithic app.ts file into smaller, focused modules with proper testing. The code is now organized into dedicated modules under the lib/app/ directory, making the codebase more maintainable and testable.

## Key changes
- Extract functionality into modules under lib/app/ directory:
  - Command-line handling (cli.ts)
  - Configuration loading (config.ts)
  - Web server setup and middleware (server.ts)
  - Core application initialization (main.ts)
  - URL handlers, routing, rendering, and controllers
- Add comprehensive unit tests for all new modules
- Make compilationQueue non-optional in the compilation environment
- Improve separation of concerns with dedicated interfaces
- Ensure backward compatibility with existing functionality
- Maintain cross-platform compatibility (Windows/Linux)

## Benefits
- Improved code organization and modularity
- Enhanced testability with proper unit tests
- Better separation of concerns
- Reduced complexity in individual files
- Easier maintenance and future development

This refactoring is a significant step toward a more maintainable codebase while preserving all existing functionality.
2025-05-20 17:53:24 -05:00
Patrick Quist
bd9e2d4cbc fix remote libraries listing backend and frontend (#7688) 2025-05-16 16:53:40 +02:00
Matt Godbolt
59aceae9c4 Simplify and extract types (#7680)
- prevents anything importing from `app.js`
- generally tidies up and removes unused stuff
- makes typing a bit more correct
2025-05-12 10:28:51 -05:00
Ofek
e01aa3e691 Various type improvements 2025-02-26 02:07:09 +02:00
Matt Godbolt
5a309652f1 More relatively uncontentious fs changes (#7450)
- use node libraries instead of fs-extra
2025-02-25 15:27:45 -06:00
Mats Jun Larsen
5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00:00
Patrick Quist
7234169c86 Attempt to fix remote library fetching (#7303)
Libraries were being fetched from wrong URL (on startup);
`Fetching remote libraries from
https://godbolt.org:443/api/libraries/c++`

Ended up refactoring a bunch of things to get some unittesting going on

I did not test actual startup and compilation with CE, I might have
broken something. (but @mattgodbolt tested and it looked great)
2025-01-25 09:27:03 -06:00
Matt Godbolt
02951a20db Unify types for tool args (#7199)
- Uses strings across the board in the UI part (no functional change
here from before; all state is the same as it was before).
- Sends _arrays_ in the POST, using the same `splitArguments` code as
the backend.
- Backend _still supports_ strings (though doesn't advertise), also
using same `splitArguments`.
- Moves `splitArguments` into common utils, and rephrases to avoid
unnecessary use of underscore and ES2021+ code.

Tested locally:
- with both old and new client code (ran new backend and old webcode to
show sending strings still works)
- with creating and removing tool windows (checked with `ldd` locally)
- with various strings on the client `moo foo "this is bad" #moo` and
even "error" things like `this is "badger` (with a missing close quote).
All works as you'd expect

Happy to break the "move the splitArguments" code into a separate PR if
that'd be easier to review separately.

Fixes #7195
2024-12-07 14:44:42 -06:00
Mats
ea29a6e9d6 Separate list and load actions for source API (#7090)
This is the first PR in API consistency with more to come:

1. The source API urls have been properly defined with
`/source/:source/list` and `/source/:source/load/:language/:filename`
- These used to be two API endpoints mushed together into one `handle()`
function. They are now separate
- While it may appear from the tests that this is an API breakage,
there's currently no way to have the source API spit out responses for
stuff like `/source/moose/load/Grunkle`.
2. The frontend code calling the list api now has shared types
3. Code has been migrated to `/lib/handlers/api/source.ts`
- I've moved code here, because I would like to separate the stuff
that's under the API and the stuff that isn't (e.g., healthcheck)
- The source endpoint is currently not under /api, but I believe it
makes sense to move it.
4. GitHub is terrible at showing the diff, but the `browser.ts` file has
been removed, since it's never actually used. Our frontend only calls
`/source/builtin/...` and it never had any entries. Besides, the type
used on the frontend for the locally stored stuff is different...
2024-11-27 13:54:47 +09:00
Ofek
c1985d64a1 Tsification binge #7 (#6974) 2024-10-25 12:19:04 +03:00
Ofek
2df8d32758 Tsify #6 (#6941)
Another tsification batch. 347 to go and I'm running out of easy fixes
:(
2024-10-22 21:41:44 +03:00
Ofek
dbd1134c39 Small options cleanup (#6981)
Remove the unused googleShortLinkRewrite and gapiKey
2024-10-19 22:12:41 +03:00
Ofek
d23b327153 A few leftovers that escaped the google-analytics cleanup (#6979)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->
2024-10-19 22:00:12 +03:00
Ofek
fecd0fbf11 tsification + small package upgrade (semver) (#6841) 2024-09-10 17:18:48 +03:00
Ofek
9ef46fbafe Binge of (mostly) mindless tsification (#6838)
Turned on `noImplicitAny` in tsconfig, then went around fixing some
random easy stuff.
Hopefully tsification-PRs with more real content coming up.
2024-09-07 14:36:43 +03:00
Patrick Quist
3a278ad3b3 Add library lookupname to support binary builds for boost (#6814) 2024-09-04 19:18:37 +02:00
Patrick Quist
b8325cf0c6 eslint root setting and fixes (#6307) 2024-04-16 21:26:53 +02:00
Jeremy Rifkin
c43e69bfdd Use CompilerInfo[] in a couple places that were previously any or never (#6029)
Depends on #6028
2024-01-22 21:47:45 -06:00
Patrick Quist
730437464d Fix semver ordering for libraries (#5959)
Fix #5951
Fix #5085

Extended the fictitious version number for non-numbers, so that trunk
can be listed higher than a `yyyymmdd` as a version (EVE uses this)
2024-01-08 22:10:25 -06:00
Patrick Quist
4481bd0f3a Show up to date version for trunk compilers (#5571) 2023-10-15 15:56:43 +02:00
Jeremy Rifkin
4260313e13 Common utilities and type work (#5200)
This PR refactors some common utilities out of lib/ and into shared/ and
eliminates some use of underscore.js, as well as general type
improvements done along the way.
2023-06-28 20:13:10 -04:00
Patrick Quist
40ae2261e0 Headers via conan (#5179) 2023-06-23 12:25:30 +02:00
Patrick Quist
16b96169b3 no warning about paths if library version is autodetect (#5108)
Fixes #5053
2023-06-05 20:27:45 -05:00
Mats Jun Larsen
633eb82d18 Transition to ECMAScript Modules (#4780)
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:

1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)

A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-02-27 18:06:38 -06:00
Jeremy Rifkin
384c297906 Fix trailing comma issue (#4775)
Make trailing commas more consistent throughout the project, fixes
config conflict between eslint and prettier. Resolves an oversight in
#4766.
2023-02-26 12:21:35 -05:00
Jeremy Rifkin
2b06c69111 Turn some auto-fixable eslint rules back on (#4766)
This PR turns comma-dangle and indent eslint rules on for lib/. These
are rules inherited from the eslint config for static/, this PR just
makes things more consistent. Also turned
@typescript-eslint/no-var-requires back on while I was here.
2023-02-23 17:16:17 -05:00
Jeremy Rifkin
33167a3024 Tsify main (#4520) 2023-01-13 19:52:00 -05:00
Marc Poulhiès
69055681d9 Support for compiling to binary object (#3232) 2023-01-11 19:39:25 +01:00
Matt Godbolt
749319f791 Slightly more controversial bumpings (#4503)
- latest sentry, tar-stream, which, some yamljs versions
- latest eslint-* stuff
- latest webpack manifest
- Applies all the automatic fixes for newer lint rules
- Bump the webpack version

applies new tslint stuff
2022-12-28 11:42:14 -06:00
Matt Godbolt
57a647b8a3 Add the result inside the CompilationResult (#4475) 2022-12-20 08:15:39 -06:00
Matt Godbolt
6348917e15 Separate shareable tool type from server ITool (#4472)
* Separate shareable tool type from server ITool

I realised we were using the "Tool" on both client and server, but the client only has the JSON-able data of Tool, not the interface/object Tool (now renamed to `ITool`).

* Fix tests
2022-12-19 22:40:27 -06:00
Jeremy Rifkin
e1fb48714c Updated CompilerProps.get typing (#4397)
* Updated CompilerProps.get typing

* Get rid of two any casts in options-handler.ts

* Fixed mistaken types
2022-12-06 19:56:58 -05:00
Jeremy Rifkin
e7b10519f7 Tsify options-handler (#4396)
* First pass conversion of options-handler to ts

* Small tweaks

* Fix tests
2022-12-03 19:37:57 -05:00