Commit Graph
38 Commits
Author SHA1 Message Date
Karl Seguin db258bfec4 breaking: disable worker and iframe loading by default
By default, iframes and workers no longer loaded. Use `--load-resources iframe`
and `--load-resources worker` to restore the previous behavior. The disabling
makes resource loading more consistent.

To further make things more consistent, Config seems the following changes:

1. remove  `--timeout` from `serve` which does nothing but has printed a
   deprecation warning for a long time

2. added .deprecated field to CLI config flags which now logs the specified
   deprecated warning when used

3. `--log-filter-scopes` is deprecated in favor of `--log-scopes`

4. `--disable_subframes` is deprecated. Iframe loading is disabled by default,
    use `--load-resources iframe` to enable iframe loading

5. `--disable_workers` is deprecated. Worker loading is disabled by default,
    use `--load-resources worker` to enable worker loading

6. `--enable_external_stylesheets`  is deprecated. Stylesheets remain disabled
    by default. Use `--load-resources stylesheet` to enable loading external
    stylesheets

CLI log parameters now alter the logger behavior on parse. This helps minimze
the window where default log settings are in-play. It also means things like
this work:

```
./lightpanda --log-level fatal --disable_subframes --log-level warn
```

More seriously, there's now an optional `beforeParse` fired once the mode is
known. This is used by mcp to set the default log level to logfmt. Previously
this was done much later and could easily result in a mix of pretty and logfmt
logs.
2026-08-27 17:25:42 +08:00
Halil Durak a4ba95b3ad changes for Zig 0.16 (again) 2026-07-22 18:29:33 +03:00
Halil Durak 9d6c54ac81 changes for Zig 0.16 2026-07-22 18:29:32 +03:00
Halil Durak 83d3fb45e3 cli: introduce shared fields
Storage fields can now be shared by CLI arguments; also having a different type for internal representation and CLI is also added.
2026-07-22 18:29:31 +03:00
Karl Seguin 8e42d63c1c zig: Zig 0.16
Built against https://github.com/lightpanda-io/zig-v8-fork/tree/zig-0.16 but
it doesn't require a new v8 build.

Built against https://github.com/lightpanda-io/boringssl-zig/tree/zig-0.16
since the current fork we point to isn't updated.

A global std.Io instance, lp.io. Way easier this way and requires 0 changes to
our libcurl integration / event loop.

Network code uses a new layer that does what Zig 0.15's posix package used to
do. Again, quicker migration that way. But, as long as we have the global IO,
and given the half-baked nature of networking in std.Io 0.16, this just makes
sense. Things can be migrated as needed.

The std.time.* -> std.Io.Timestamp/Clock/Duration resulted in _a lot_ of
changes. ArrayList = .{} -> ArrayList -> .empty also resulted in a lot of
changes, but that's obviously superficial. As is the trimLeft/trimRight ->
trimStart/trimEnd rename.

Locking adopt the `Uncancelable` variants, e.g. mutex.lockUncancelable() to
preserve the error-free signature (and, because cancellation would be something
we'd have to put more thought into).

std.json.ObjectMap is now unmanaged, so the allocator had to be passed along.
However, there's still a deprecated managed variant of MemoryPool, so I switched
to it (we can do a small follow up PR to move to the unmanaged after).

I tried use_llvm = false, but it locks my computer, consuming RAM until MacOS
gives me a popup I've never seen before, begging me to start killing processes.

Agent and the networking stuff saw the most significant changes.
2026-07-22 13:26:03 +08:00
Karl Seguin 630826160e cli: fetch multiple urls
Modified the fetch command to support multiple URLs. Only allowed when --json
is specified (we can revisit this limitation if anyone asks for it, but for now
it's the only non-ambiguous way to get multiple results).

Probably not a big surprise, but the performance gain comes from being able to
concurrently fetch resources. On fast network, or with caching enabled, the
difference wouldn't be so significant:

```
time begin;
./lightpanda fetch "https://github.com/lightpanda-io/browser/" --json;
./lightpanda fetch "https://www.reddit.com/r/Zig/comments/1p0ur0d/i_started_learning_zig" --json;
end
10.28 secs
```

vs

```
time ./lightpanda fetch --json \
  "https://github.com/lightpanda-io/browser/" \
  "https://www.reddit.com/r/Zig/comments/1p0ur0d/i_started_learning_zig"
5.12 secs
```
2026-06-24 18:16:02 +08:00
Adrià Arrufat 8d102b8511 Merge branch 'main' into agent 2026-05-19 11:33:46 +02:00
Halil Durak 34557e3993 cli.zig: update doc comment 2026-05-15 18:31:10 +03:00
Halil Durak 658df6e500 cli.zig: support lightpanda help <command>
Another variation to receive `help` text for a specific command.
2026-05-15 18:31:10 +03:00
Halil Durak f361f12316 cli.zig: change the way help command and sub-command detected
`cli.zig` is now aware of `help` command at all situations and creates it by itself. Instead of using errors, it initializes `Command` union where `help` branch is active.
2026-05-15 18:31:09 +03:00
Halil Durak c993ba48a9 cli.zig: rewrite doc comment 2026-05-15 18:31:09 +03:00
Adrià Arrufat 7d312ce5e9 Merge branch 'main' into agent 2026-05-12 08:56:29 +02:00
Francis Bouvier 31ef5246bc Add per-subcommand help via help or --help argument
`lightpanda <subcommand> help`, `lightpanda <subcommand> --help`
now print only the relevant subcommand options plus common options,
instead of the full text.

`lightpanda help <subcommand>` is also supported
(and that's what use internally).
2026-05-11 22:16:52 +02:00
Adrià Arrufat 8e9e82b478 cli: support short flags and hide tool results in REPL 2026-05-07 14:22:26 +02:00
Halil Durak 604210fd8b cli: introduce variants
Also refactors parsing by moving value parsing functionality to `parseValue` function.
2026-04-27 16:05:40 +03:00
Karl Seguin 945e9597bf Propagate CLI parsing errors
Rather than continue on a failed argument parse, propagate the error so that
the program eventually exists.
2026-04-27 08:48:30 +08:00
Adrià Arrufat 6a65801527 cli: allow optional positional arguments in command builder 2026-04-24 13:08:40 +02:00
Karl Seguin 6ca9208260 Default command 'serve' for backwards compatibility 2026-04-23 17:31:25 +08:00
Halil Durak fa302a1db1 cli: report failure on lightpanda serve serve case 2026-04-22 16:37:37 +03:00
Halil Durak 1022875234 cli: improve failure messages 2026-04-22 16:08:15 +03:00
Halil Durak 59afb9e773 cli: --strip -> --strip-mode in sniff and doc-comment 2026-04-22 16:08:15 +03:00
Halil Durak 77a494f1fb cli: update doc-comment 2026-04-22 16:08:15 +03:00
Halil Durak 79319485ea cli: catch unknown arguments on options that take packed struct 2026-04-22 16:08:14 +03:00
Halil Durak 3619af2d4c cli: reintroduce old --help 2026-04-22 16:08:14 +03:00
Halil Durak 44849fdaf3 cli: splitScalar -> tokenizeScalar 2026-04-22 16:08:14 +03:00
Halil Durak baf97bb607 cli: remove shortcut bits in sniffCommand 2026-04-22 16:08:13 +03:00
Halil Durak 7acbd54172 cli: accept defaults for boolean
Setting a boolean option, instead of setting it to `true`, prefers the opposite of `default`. The `default` is `false` if not provided.
2026-04-22 16:08:13 +03:00
Halil Durak 4a4e3643f5 cli: prefer full over all to enable everything 2026-04-22 16:08:12 +03:00
Halil Durak 012fe40bb5 cli: remove aliases and shortcuts 2026-04-22 16:08:12 +03:00
Halil Durak 74a518c56f cli: reintroduce command sniffing 2026-04-22 16:07:04 +03:00
Halil Durak 07351f0e40 cli: add an explanatory doc-comment that goes in depth of the API 2026-04-22 16:07:04 +03:00
Halil Durak baa0d83fa7 cli: positional argument must not be null after parsing 2026-04-22 16:07:03 +03:00
Halil Durak 059d21f7fd cli: return errors if next argument not found 2026-04-22 16:07:03 +03:00
Halil Durak 1a68ea7370 cli: better handle unknown arguments 2026-04-22 16:07:02 +03:00
Halil Durak 10914d6288 cli: fix --log-filter-scopes regression 2026-04-22 16:07:02 +03:00
Halil Durak b01e93502e cli: revert enum specific peek ahead logic
This was needed before the introduction of `validator`; doesn't make sense now.
2026-04-22 16:07:01 +03:00
Halil Durak 56b6fbe011 cli: many improvements
* Options with optional types are introduced to null by default
* Options with boolean types cannot be optional (nullable)
* Options with boolean types are introduced with false by default
* introduce shortcuts for options that can be provided via single dash
* introduce validators; custom parsing logic can be inserted for niche cases
2026-04-22 16:07:01 +03:00
Halil Durak 9bf85214e3 cli: add support for command aliases and shared options 2026-04-22 16:03:18 +03:00