Commit Graph
2668 Commits
Author SHA1 Message Date
Matt Godbolt fca3aa69bd Merge remote-tracking branch 'origin/main' into claude-mg/explain 2025-05-30 17:27:33 -05:00
Matt GodboltandClaude 239b3f470c Add DynamoDB support for Google URL shortener (#7724)
## Summary
- Add DynamoDB support to Google URL shortener to check in preference to goo.gl itself (which will be going away)
- Update ShortLinkResolver to accept AWS properties and use DynamoDB table `goo-gl-links`
- First check DynamoDB for fragment lookup before falling back to Google URL shortener (for now)
- Refactor resolve method to use async/await instead of raw promises for better readability
- Add awsProps to ServerDependencies and pass through component hierarchy
- Configure googleLinksDynamoTable property in AWS config files (defaults to empty)

## Implementation Details
- When `googleLinksDynamoTable` property is configured, `ShortLinkResolver` creates a DynamoDB client
- DynamoDB table uses `fragment` as the key and stores `expanded_url`
- Maintains backwards compatibility by falling back to Google URL (for now) shortener if DynamoDB is not configured or lookup fails
- Google URL shortener fallback will be removed in August 2025 when the service shuts down

## Test plan
- [x] All existing tests pass
- [x] TypeScript compilation succeeds
- [x] Linting passes
- [x] Updated tests to accommodate new awsProps parameter
- [x] Verify fallback to Google URL shortener when DynamoDB not
configured
- [x] Manual testing

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-30 17:27:29 -05:00
Spencer Fricke d066e773b4 Update Khronos Logos (#7726) 2025-05-30 17:27:29 -05:00
Patrick Quist f34c582637 Refactor objdump execution to use BaseObjdumper class (#7715) 2025-05-30 17:27:29 -05:00
Patrick Quist e3539e8652 Add Game Boy emulator support using WasmBoy (#7717) 2025-05-30 17:27:29 -05:00
Rob Parolin 157662eb31 [mojo-lang] Fixing LLVM IR panel due to calling the mojo compiler with incorrect args. (#7716)
This PR fixes the LLVM IR output for the Mojo compiler integration,
ensuring the LLVM IR panel works correctly and no longer shows "Internal
error; unable to open output path" errors.
2025-05-30 07:48:28 -05:00
narpfel 20bae12039 Add Miri tool for Rust (#7718)
Resolves
https://github.com/compiler-explorer/compiler-explorer/issues/2563.

`misc-builder` PR:
https://github.com/compiler-explorer/misc-builder/pull/112
`compiler-workflows` PR:
https://github.com/compiler-explorer/compiler-workflows/pull/36
`infra` PR: https://github.com/compiler-explorer/infra/pull/1631

Screenshot:

![miri-tool](https://github.com/user-attachments/assets/d866bb42-a242-445b-be52-6fd0b3c877bb)
2025-05-30 07:17:01 -05:00
Patrick Quist abe7d9c836 fixes for windows execution (#7740) 2025-05-30 04:53:20 +02:00
Partouf 2e0549b3fb more fixes 2025-05-28 15:21:02 +02:00
Partouf d16d717220 hotfix windows 2025-05-28 14:49:51 +02:00
Partouf de3e34bda8 windows hotfix 2025-05-28 14:00:09 +02:00
Patrick Quist 2e76639163 Windows library support (#7554)
Huray
2025-05-28 10:50:26 +02:00
Matt GodboltandClaude d27d59fc1e Add DynamoDB support for Google URL shortener (#7724)
## Summary
- Add DynamoDB support to Google URL shortener to check in preference to goo.gl itself (which will be going away)
- Update ShortLinkResolver to accept AWS properties and use DynamoDB table `goo-gl-links`
- First check DynamoDB for fragment lookup before falling back to Google URL shortener (for now)
- Refactor resolve method to use async/await instead of raw promises for better readability
- Add awsProps to ServerDependencies and pass through component hierarchy
- Configure googleLinksDynamoTable property in AWS config files (defaults to empty)

## Implementation Details
- When `googleLinksDynamoTable` property is configured, `ShortLinkResolver` creates a DynamoDB client
- DynamoDB table uses `fragment` as the key and stores `expanded_url`
- Maintains backwards compatibility by falling back to Google URL (for now) shortener if DynamoDB is not configured or lookup fails
- Google URL shortener fallback will be removed in August 2025 when the service shuts down

## Test plan
- [x] All existing tests pass
- [x] TypeScript compilation succeeds
- [x] Linting passes
- [x] Updated tests to accommodate new awsProps parameter
- [x] Verify fallback to Google URL shortener when DynamoDB not
configured
- [x] Manual testing

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-26 16:24:04 -05:00
Spencer Fricke c2a02c7d8f Update Khronos Logos (#7726) 2025-05-25 16:12:33 +00:00
Patrick Quist 7f393e6763 Refactor objdump execution to use BaseObjdumper class (#7715) 2025-05-25 17:21:01 +02:00
Patrick Quist 6fb3ab38e7 Add Game Boy emulator support using WasmBoy (#7717) 2025-05-24 18:43:41 +02:00
Matt Godbolt c38e6be044 Merge remote-tracking branch 'origin/main' into claude-mg/explain 2025-05-23 12:32:28 -05:00
Matt GodboltandClaude 5b3c487467 Migrate Claude Explain from Tool to Pane
This change converts Claude Explain from a backend "Tool" to a proper frontend "Pane",
providing a cleaner architecture and better user experience.

Major changes:
- Add Claude Explain as a pane in the "Add new..." dropdown for all languages
- Remove server-side ExplainTool and all tool configurations from property files
- Move API endpoint configuration to global options (explainApiEndpoint)
- Update event handling from tool events to pane-specific events (explainViewOpened/Closed)
- Make button visibility conditional on API endpoint configuration
- Trigger recompilation when Claude Explain pane is opened

Benefits:
- Universal availability across all languages without per-language configuration
- No need for fake binaries (/bin/true) or server-side stubs
- Cleaner architecture with all logic in the frontend
- Better UX with Claude Explain appearing alongside other analysis panes
- Automatic recompilation when opened, matching behavior of AST/Opt viewers

Technical details:
- Register EXPLAIN_VIEW_COMPONENT_NAME and factory in hub.ts
- Add button to compiler.pug with conditional visibility
- Update ExplainHtmlView to emit pane events and use global API endpoint
- Remove redundant getCurrentState() override
- Clean up all references to the old tool implementation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-23 09:25:54 -05:00
narpfel 91a2d58aa2 Make 2024 the default edition for Rust >= 1.85 (#7649)
Resolves #7472.
2025-05-23 03:01:26 +02:00
Matt GodboltandClaude 02ffbe5778 Fix Claude Explain view initialization and event handling
- Fix template structure to match framework expectations (no wrapper div)
- Use standard toolOpened/toolClosed events instead of custom ones
- This fixes automatic compilation trigger on view creation
- This enables proper singleton tracking (mostly)
- Add getCurrentState with toolId and selection for tool compatibility
- Remove unused explainViewOpened/Closed from event map

The view now properly integrates with the existing tool infrastructure,
triggering compilation when opened and preventing duplicate instances.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 15:12:14 -05:00
Matt GodboltandClaude 4dad57fcb5 Move API endpoint configuration to server-side
- Remove unused explain.defaults.properties file
- Use existing explainApiEndpoint from compiler-explorer properties
- Server-side tool now provides API endpoint in tool result
- Client gets endpoint from tool result instead of options
- Fail fast if endpoint not configured on server

This keeps tool-specific config out of global client options and
allows server-side control of the API endpoint.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 14:28:29 -05:00
Matt Godbolt 6ad92e9d43 Merge remote-tracking branch 'origin/main' into claude-mg/explain 2025-05-21 22:25:46 -05:00
Matt GodboltandClaude 8106ccdad9 Fix static URL double slash issue in CDN asset paths (#7709)
## Summary
Fix production CDN loading issues where URLs like
`https://static.ce-cdn.net//vendor.v57...css` (double slash) were being
generated when the `staticUrl` config has a trailing slash.

## Root Cause
PR #7681 refactored static asset handling and replaced
`urljoin(staticRoot, path)` with `${staticRoot}/${path}` string
interpolation, losing URL normalization that `urljoin` provides.

## Changes
- Replace string interpolation with `urljoin()` in
`createDefaultPugRequireHandler()`
- Add comprehensive tests covering all trailing slash scenarios
- Maintain full backward compatibility with existing configurations

## Test plan
- [x] All existing tests pass
- [x] Added 4 new test cases for static URL handling with various slash
scenarios
- [x] Verified TypeScript compilation and linting
- [x] Tested production CDN scenario where
`staticUrl=https://static.ce-cdn.net/`

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-21 17:27:06 -05:00
Matt Godbolt a5903c0867 Fix issues introduced in #7681 (#7707)
- healthcheck got accidentally unwired
- CSP was accidentially "done" (was a TODO)
2025-05-21 16:20:51 -05:00
Rob Parolin a0b48fb7e0 Add Mojo compiler (#7692)
This PR adds support for the Mojo programming language.

Explicitly tested viewing the generated assembly, LLVM IR, and running
the generated executable.
2025-05-21 13:53:05 -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
Matt GodboltandClaude b1623e70c5 Add Claude Explain feature for explaining compilation output
This feature adds a new 'Claude Explain' tool that uses Claude AI to provide natural
language explanations of assembly code generation. The implementation includes:

- Server-side configuration with minimal stub implementation
- Client-side UI component for consent management and API interaction
- Markdown formatting of explanations
- Session-persistent consent for improved user experience
- Error handling and loading states

The feature operates entirely client-side, with the browser directly contacting the
Claude Explain API after user consent, which helps distribute API load and maintains
user privacy.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-20 12:03:34 -05:00
Patrick Quist ac4642283c fix pascal execution (#7695)
Fixes #7224
2025-05-20 13:19:31 +02:00
Patrick Quist 447737db5b add ld info to CompilationInfo for tools (#7697)
Fixes #7306
2025-05-20 13:15:27 +02:00
Patrick Quist bd9e2d4cbc fix remote libraries listing backend and frontend (#7688) 2025-05-16 16:53:40 +02:00
Partouf ca5e088d1f skip stdver matching 2025-05-13 21:58:58 +02:00
narpfel 703b13ae01 Fix Rust edition argument parser (#7652)
* For `nightly` Rust (and 1.88+), the output format of `--help` was
changed in https://github.com/rust-lang/rust/pull/140152.
This PR changes the parser to parse the new format, so that edition
overrides are selectable for `nightly` Rust. Note the `<>`:
  ```
          --edition <2015|2018|2021|2024|future>
Specify which edition of the compiler to use when
compiling code. The default is 2015 and the latest
                          stable edition is 2024.
  ```
* Rust <= 1.34 (and >= 1.31) support the 2018 edition, but the help
message only includes `--edition` in verbose mode.
2025-05-12 12:54:48 -05:00
Abhilash Majumder 4649b3dd0e Add PTX as a separate module from assembler (#7615) 2025-05-12 12:51:03 -05:00
Matt GodboltandClaude 54c942ba76 Replace nopt with commander.js for argument parsing (#7673)
- Replace nopt with commander.js for better command-line argument parsing
- Add automatic help generation with detailed descriptions
- Maintain backward compatibility with existing arguments
- Remove unused nopt dependency from package.json

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-12 12:49:28 -05: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
Matt Godbolt eaa083edc3 Simplify noscript handling, and add types (#7677) 2025-05-12 08:32:21 -05:00
narpfel 1150078f7d Treat opt output as LLVM IR (#7670)
Resolves #7669.

`processAsm` didn’t recognise that `opt` generates LLVM IR, so it
invoked the generic `AsmParser` instead.
2025-05-11 23:38:31 -05:00
Matt GodboltandClaude 2f892583ba Remove global handler_config variable (#7675)
The global handler_config was being used to allow compilers to find
other compilers. This change replaces that global with a proper method
on the CompilationEnvironment class, allowing compilers to find other
compilers through the environment instead of using a global variable.

🤖 PR description generated with [Claude Code](https://claude.ai/code) -
code by @mattgodbolt though :)

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-11 19:47:58 -05:00
Matt GodboltandClaude ad5bec7626 Remove top-level global for base directory (#7674)
This PR removes the top-level global variable for the base directory and replaces it with a module-level variable managed through a setter function. Key changes include removing the global declaration in lib/global.ts, introducing a local ce_base_directory variable and setBaseDirectory function in lib/assert.ts, and updating app.ts to use the new setter.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-11 19:28:04 -05:00
Matt Godbolt 9a7e0d4ed8 Fix up import order 2025-05-11 16:15:21 -05:00
Rucadi aa5c02fa70 Add Nix Language (#6198) 2025-05-11 16:07:40 -05:00
partouf 50d044407b fixes for running CE on osx 2025-05-08 16:52:32 +02:00
Patrick Quist b7a35dedf6 Fix loading projects from zip file (#7639) 2025-05-07 19:32:18 +02:00
Anton Baliasnikov e5c982e7d9 Add solx, new Solidity LLVM-based compiler (#7633) 2025-05-05 13:05:17 +02:00
Matt Godbolt 04bcf21900 Bump to latest sentry; preload etc (#7617)
New node sentry prefers some node.js "preload" nonsense. I use this
"hack" to avoid having to make a lock-step change to the runner: tested
locally and then deployed to staging and tested there with both
server-side and client-side errors.
2025-04-26 13:36:11 -05:00
Detjon Mataj c79e41f77a Remove dependency on request and replace it with node's builtin fetch (#6800)
resolves #5289
2025-04-25 21:24:07 -05:00
Patrick Quist afdea17163 fix sway std path and build command (#7597) 2025-04-23 15:53:49 +02:00
c3ca289a05 Specifically allow OPTIONS for browser preflight CORS checks. (#7596)
Google AI suggested too (independently, I did this first then searched
and got:

---

1. Using Middleware
A middleware function can intercept OPTIONS requests and set the
appropriate CORS headers.

```js
app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS");
  res.header("Access-Control-Allow-Headers", "Content-Type, Authorization");
  if (req.method === 'OPTIONS') {
    res.sendStatus(200);
  } else {
    next();
  }
});
```
---

Tested locally with curl on GET, OPTIONS, and POST and correctly lets
OPTIONS return an empty CORS block, etc. And the site works too :)

---------

Co-authored-by: Mats Jun Larsen <mats@jun.codes>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-22 21:29:04 -05:00
narpfel 355d49ec63 [c2rust]: allow passing arguments to clang (#7583)
To pass arguments to `clang` (such as `-std=...`), `--` must be used to
separate these arguments from the arguments to `c2rust`:

```console
$ ./c2rust-transpile --help
transpile 0.20.0
[...]
USAGE:
    c2rust-transpile [OPTIONS] [COMPILE_COMMANDS]... [-- <EXTRA_CLANG_ARGS>...]
```

However, when doing this, the input file must be passed *before* the
`--`. Also, when libraries are enabled, the include and link flags must
be passed to `clang` (but duplicate `--` are not allowed).

Example for passing command line arguments:
https://godbolt.org/z/eqfa3T7WY
Example for activating a library: https://godbolt.org/z/srh55Y1hY
2025-04-22 13:55:17 -05:00
Andy Soffer 45af54f180 Make the Bronto Refactor Tool available for C++ compilations (#7555)
"Bronto Refactor" is a tool that reads annotations in C++ source code
and generates edits based on those annotations. For CE specifically, it
outputs a copy of the primary file with the modifications applied.
Documentation can be found
[here](https://github.com/brontosource/bronto/blob/main/include/bronto/bronto.hpp)
and will also be made available at http://brontosource.dev in a nicer
format before this PR is merged.

I've attached a screenshot which hopefully conveys the idea.

One question I have is about how to actually deliver the tool. It is not
publicly available, but we do want folks to be able to play around with
it. We're happy to have you build it from source or we can deliver a
prebuilt binary, whatever is preferable.

This is my first time contributing here. I think I've got everything set
up appropriately (including sibling PR
https://github.com/compiler-explorer/infra/pull/1569 to the infra
repository) but please let me know if I'm missing anything.


<img width="1723" alt="BrontoRefactorToolScreenshot"
src="https://github.com/user-attachments/assets/cd605358-b7f2-49e8-9845-b6f3056fa4ef"
/>
2025-04-22 13:48:57 -05:00