Skip to content

Move the examples to CGP v0.8.0 and add web-app - #1

Merged
soareschen merged 32 commits into
mainfrom
v0.8.0
Nov 18, 2026
Merged

soareschen merged 32 commits into
mainfrom
v0.8.0

Conversation

@soareschen

@soareschen soareschen commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Overview

[claude-opus-5-5] This PR moves the examples to CGP v0.8.0 and adds a web-app crate. The workspace takes cgp and cgp-error-anyhow 0.8.0 from crates.io, and each crate uses the release's idioms: namespaces and the open statement for wiring, #[use_type] for abstract types, and #[default_impl] for per-type defaults. web-app wires one social-media backend four ways, from one trait per domain up to namespace defaults.

The repository also gains a README that describes each crate and how to run it, an AGENTS.md, cargo metadata on every crate, and a Tests workflow that builds and tests the workspace on every push and pull request.

The PR fixes two defects as well: a self-transfer in transfer's mocked app no longer adds the amount, and builder opens its database pools and reads its API key without panicking.

Impact

Merging fixes the website's links to web-app. The Projects pages link this repository's main for their source, and main lacks the crate until this PR merges.

soareschen and others added 30 commits June 29, 2026 23:59
expression: wire every context with the open statement and path keys,
removing the per-operator bundles in add_mult_code; import provider
dependencies with #[uses] and the abstract types with #[use_type];
derive CgpData on the language enums; check Times in every context.

builder: read configuration as #[implicit] arguments instead of six
getter traits; use #[uses] and #[use_type(HasErrorType.Error)]; derive
CgpData on the output and application structs; dispatch the
multi-target builder with open HandlerComponent; and rename the
BuildAnthroicAndChatGptApp marker to BuildAnthropicAndChatGptApp.

transfer: import the request getters' abstract types with
#[use_type(... in App)].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
transfer: make a self-transfer through UseMockedApp a no-op, returning
once the sender's debit is known to succeed, instead of letting the
credit overwrite the debit and add the amount.

builder: enable sqlx's runtime-tokio feature so pools open without a
panic; read OPENAI_API_KEY with env::var and raise the error in
BuildDefaultOpenAiClient and App::new_with_default instead of calling
the panicking Client::from_env; and give both main functions a
mode=rwc connection string so they create db.sqlite.

web-app: stop CreatePostWithPostgres from filtering spam itself in the
stages that wrap it in FilterSpamMessage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… full

namespace.rs gains a TestApp that shares the Postgres core and swaps in
dummy content filters, the ProductionExtraComponents and
DummyExtraComponents bundles behind @app.extra, and the flat namespace
step as a commented block. Its AI filter bundle is renamed
AiContentFilterComponents, the name the worked example uses.

fine_grained.rs, namespace.rs, and default_impls.rs now check all nine
components on every context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Override `cgp` and `cgp-error-anyhow` with the `cgp` repository's `main`
branch instead of a local `../cgp` checkout, so the workspace builds
from a fresh clone, and lock it at the commit carrying the fixed error
backends. anyhow moves to 1.0.104, the minimum `cgp-error-anyhow` now
requires. The local-path entries stay commented out for testing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The repository had an empty README, so a visitor found no index of the
five crates. It now lists each crate with what it shows and how to run
it, and links the website's project pages. The transfer walkthrough
drops the word "capability" for CGP constructs and replaces its prose em
dashes with punctuation that names the relationship.
The workspace set no description, categories, or homepage, so its five
crates published with none of them. Each crate now describes the example
it holds, and the workspace names the project page and a category.
Each component, provider, and getter the examples define now carries a doc
comment, so a reader of the crate docs sees what the construct is for without
opening the source. The `transfer` crate's existing `//` notes become `///`
docs on the items they describe.
Every component, type, getter, and provider in the expression, web-app, and
greet crates now carries a doc comment saying what it is for, so the crate
docs explain the examples instead of listing their pieces bare. Each line
names what that module's item does and links the website page that walks
through it, and the hand-written expansion in `greet` gains a module doc
saying what it reproduces.
The repository had no workflow, so its build and test ran only on a
contributor's machine. Two jobs now run the README's Building commands on
the stable release `rust-toolchain.toml` pins, which the workspace declares
as its `rust-version`.

The workspace patches `cgp` to the repository's `main` branch by git URL,
so the jobs fetch that branch and need network access.
`cgp::prelude` now carries only the names users write, so the
`FromVariant` trait and the wiring traits in the hand-written greet
expansion come from their modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`cgp::prelude` no longer exports `cgp_handler`'s traits and component
keys or `UseContext`, so the examples import them from
`cgp::extra::handler` and `cgp::core::component`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The file gives agents the rules every CGP repository shares, sends them
to the `/cgp` skill and the knowledge base to learn CGP, points to the
knowledge base's section on this project before a change to what it
describes, and names the build and test commands CI runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README's Building section now sends contributors and agents to
AGENTS.md, as the other CGP repositories' READMEs do, and AGENTS.md
names the knowledge base's record of the website section that explains
this project, which a change to the code it shows must update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The universal writing rule now asks for natural writing in documents
people outside the project read, such as a repository or crate README,
beside point-first writing for internal prose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The writing rules name the `/point-first-writing` skill, which no CGP
repository publishes, so an outside contributor's agent cannot load it.
The rules keep the two styles and ask for the skill only when it is
available.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`cargo update` moves the lockfile to the newest versions each
requirement allows, which also moves the patched `cgp` to the newest
commit on its `main`, and every requirement on an external crate rises
to the version now locked, so a build never resolves an older release
than the one the checks ran against. Each change stays within semver
compatibility.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
soareschen and others added 2 commits November 18, 2026 12:17
The workspace requires cgp and cgp-error-anyhow 0.8.0 and drops the
[patch.crates-io] section that took both from the cgp repository's
main by git URL. The lockfile changes only the cgp crates. The README's
Building section shows the patch to add for testing a local cgp
checkout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Building section says what the patch is for before showing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@soareschen
soareschen marked this pull request as ready for review November 18, 2026 11:33
@soareschen
soareschen merged commit ecb4bc0 into main Nov 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant