-
Notifications
You must be signed in to change notification settings - Fork 6
feat(cli): add the stash-postgres and stash-edge skills — raw-SQL predicates and the WASM entry #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
coderdan
wants to merge
9
commits into
remove-v2
Choose a base branch
from
feat/stash-sql-edge-skills
base: remove-v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(cli): add the stash-postgres and stash-edge skills — raw-SQL predicates and the WASM entry #777
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
35004f3
feat(cli): add the stash-sql and stash-edge skills — raw-SQL predicat…
coderdan cb4b50a
refactor(skills): rename stash-sql to stash-postgres
coderdan 38e9929
docs(skills): scope stash-postgres against Proxy and cite EQL upstream
coderdan beedea2
docs(skills): drop the usesProxy pointer from the stash-postgres Prox…
coderdan c9bc70d
docs(skills): separate the database domain from its language mappings
coderdan b351200
docs(skills): send agents to EQL for the current type surface
coderdan 4fdad2c
docs(skills): stop teaching native-entry bundling in the edge skill
coderdan 51bb130
docs(skills): correct the lock-context explanation in stash-edge
coderdan 94ba032
docs(skills): address CodeRabbit review on #777
coderdan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| 'stash': minor | ||
| '@cipherstash/wizard': minor | ||
| '@cipherstash/stack': patch | ||
| --- | ||
|
|
||
| Two new bundled agent skills for the integrations that don't use an ORM — | ||
| `stash-postgres` and `stash-edge` (#754). | ||
|
|
||
| Everything a raw-SQL or edge integration needed was reachable only from | ||
| `dist/*.d.ts` JSDoc, the Postgres catalog, or experiment: grepping the skills | ||
| `stash init` installs for `postgres-js|::jsonb::eql|sql.json|query_text_search` | ||
| returned a single hit, in an unrelated code comment. | ||
|
|
||
| **`stash-postgres`** — hand-written SQL over `pg` / `postgres-js`, no ORM. The | ||
| column-domain-to-query-domain operator matrix (which of `=`, `<>`, `<`, `>=`, | ||
| `@@`, `@>` each encrypted domain accepts, and against which `eql_v3.query_*` | ||
| operand), the storage-vs-query payload distinction, per-driver parameter | ||
| binding, recipes for equality / free-text / range / `ORDER BY` / JSON | ||
| containment / JSON field selectors, and the `information_schema` drift check. | ||
| Two failure modes get their mechanism spelled out: pre-stringifying a payload | ||
| on postgres-js double-encodes it into a jsonb *string* scalar, tripping the | ||
| domain CHECK with a message naming neither JSON nor encoding; and leaving an | ||
| operand as bare `jsonb` silently selects a different operator overload — one | ||
| that coerces to the *storage* domain and so rejects the ciphertext-free query | ||
| term. It also scopes itself against the two things a hand-written-SQL reader | ||
| is otherwise left to infer: **CipherStash Proxy** (where you write plaintext | ||
| SQL and none of the skill applies — the `usesProxy` fork `stash init` already | ||
| asked about), and the provenance of the operator surface itself (the EQL | ||
| bundle from `cipherstash/encrypt-query-language`, version-checkable with | ||
| `SELECT eql_v3.version()`, and where operator gaps should be filed). Its | ||
| domain and operator tables are explicitly marked as a snapshot of a versioned | ||
| surface, with a ranked list of authorities to confirm current types against — | ||
| the EQL skill first, then the generated `@cipherstash/eql` types and install | ||
| SQL, both of which need only `node_modules` and no database. | ||
|
|
||
| **`stash-edge`** — the `@cipherstash/stack/wasm-inline` entry for Deno, | ||
| Supabase Edge Functions, Cloudflare Workers, and Bun. Import specifier per | ||
| runtime, the four mandatory `CS_*` variables and minting them with | ||
| `stash env`, how the WASM client surface differs from the native typed client | ||
| (no `.audit()`, no `.withLockContext()`, per-item bulk shape, ESM-only), and | ||
| the auth-strategy `Result` that must be unwrapped before it reaches | ||
| `config.authStrategy`. | ||
|
|
||
| Both carry **the credential-identity rule**, a silent data-loss footgun now | ||
| also stated in `stash-cli` (under `env` and `encrypt backfill`) and | ||
| `stash-supabase`: EQL index terms derive from the ZeroKMS client key, so rows | ||
| written under one credential and queried under another decrypt correctly and | ||
| never match a query, with no error. | ||
|
|
||
| `stash-encryption` now states that the two entries' schema types **do not | ||
| interchange** — their column classes carry private fields, so TypeScript | ||
| compares them nominally and rejects a shared schema module in both directions. | ||
| It works at runtime, which makes a type assertion the tempting fix; the | ||
| guidance is to author the schema against exactly one entry instead. | ||
|
|
||
| `stash init` / `stash impl` handoffs and the `@cipherstash/wizard` skills | ||
| prompt install both skills for the `postgresql` and `supabase` integrations. | ||
| Drizzle and Prisma Next get cross-links from their own skills instead, since | ||
| those integrations emit correctly-typed operands themselves. | ||
|
|
||
| Also fixes the `@cipherstash/stack/wasm-inline` module JSDoc, which showed | ||
| `OidcFederationStrategy.create(...)`'s `Result` being passed straight to | ||
| `config.authStrategy` without unwrapping — the same JSDoc the raw-SQL surface | ||
| was being reverse-engineered from. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Add example coverage and a documentation-site follow-up.
These changes alter the public
stash init/ wizard handoff workflow and introduce raw-SQL/WASM usage guidance. Add or update repository examples and explicitly track corresponding updates for the separately maintained documentation site.As per coding guidelines, “When public APIs or user-facing workflows change, update repository examples and flag that the separately maintained documentation site needs corresponding updates.”
🤖 Prompt for AI Agents
Source: Coding guidelines