@agentsfleet/orly 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.githooks/pre-commit +42 -0
- package/.githooks/pre-push +67 -0
- package/AGENTS.md +348 -0
- package/LICENSE +21 -0
- package/README.md +249 -0
- package/SOUL.md +90 -0
- package/audits/agents-md.md +497 -0
- package/audits/agents-md.sh +353 -0
- package/audits/cross-tier-rates.sh +105 -0
- package/audits/data.sh +185 -0
- package/audits/deinit-pairs.sh +224 -0
- package/audits/design-tokens.sh +143 -0
- package/audits/doc-read.sh +183 -0
- package/audits/error-codes.sh +221 -0
- package/audits/fixtures/clean.diff +15 -0
- package/audits/fixtures/dirty.diff +16 -0
- package/audits/lifecycle-anchors.sh +22 -0
- package/audits/logging.sh +217 -0
- package/audits/msid-ui.sh +144 -0
- package/audits/parity-dispatch.sh +51 -0
- package/audits/rule-ledger-lib.sh +264 -0
- package/audits/rule-ledger.sh +225 -0
- package/audits/rule-paths.sh +108 -0
- package/audits/spec-template.sh +258 -0
- package/audits/sql-mod.sh +102 -0
- package/audits/ufs.sh +303 -0
- package/bin/orly +26 -0
- package/core/operating-model.md +256 -0
- package/dispatch/edit_rules.md +69 -0
- package/dispatch/lib.sh +213 -0
- package/dispatch/lifecycle.md +187 -0
- package/dispatch/name_architecture.md +93 -0
- package/dispatch/verify.md +111 -0
- package/dispatch/write_any.md +740 -0
- package/dispatch/write_any.sh +49 -0
- package/dispatch/write_auth.md +36 -0
- package/dispatch/write_changelog.md +64 -0
- package/dispatch/write_documentation.md +45 -0
- package/dispatch/write_go.md +24 -0
- package/dispatch/write_http.md +45 -0
- package/dispatch/write_mdx.md +7 -0
- package/dispatch/write_python.md +8 -0
- package/dispatch/write_rust.md +38 -0
- package/dispatch/write_shell.md +8 -0
- package/dispatch/write_spec.md +105 -0
- package/dispatch/write_sql.md +112 -0
- package/dispatch/write_sql.sh +36 -0
- package/dispatch/write_ts_adhere_bun.md +493 -0
- package/dispatch/write_ts_adhere_bun.sh +37 -0
- package/dispatch/write_zig.md +852 -0
- package/dispatch/write_zig.sh +40 -0
- package/docs/CHANGELOG_VOICE.md +18 -0
- package/docs/DISPATCH_ARCHITECTURE.md +664 -0
- package/docs/DISPATCH_REVIEW_DISPOSITION.md +65 -0
- package/docs/DOCUMENTATION_RULES.md +209 -0
- package/docs/EXECUTE_DOC_READS.md +29 -0
- package/docs/HARNESS_VERIFY_OUTPUT.md +40 -0
- package/docs/LIFECYCLE_PATTERNS.md +316 -0
- package/docs/LOGGING_STANDARD.md +397 -0
- package/docs/ORLY_ARCHITECTURE.md +129 -0
- package/docs/REST_API_DESIGN_GUIDELINES.md +783 -0
- package/docs/RULE_ENFORCEMENT.md +41 -0
- package/docs/SCHEMA_CONVENTIONS.md +93 -0
- package/docs/TEMPLATE.md +411 -0
- package/docs/VERIFY_TIERS.md +57 -0
- package/docs/greptile-learnings/README.md +51 -0
- package/docs/greptile-learnings/RULES.md +1045 -0
- package/fixtures/registry-invalid.json +1 -0
- package/fixtures/registry-valid.json +18 -0
- package/fixtures/unclosed-pack-block.md +8 -0
- package/package.json +63 -0
- package/packs/language/go/rules.md +24 -0
- package/packs/language/mdx/rules.md +7 -0
- package/packs/language/python/rules.md +8 -0
- package/packs/language/rust/rules.md +38 -0
- package/packs/language/shell/rules.md +8 -0
- package/registry.json +405 -0
- package/schemas/evidence.schema.json +43 -0
- package/schemas/profile.schema.json +12 -0
- package/schemas/registry.schema.json +12 -0
- package/skills/orly-babysit-prs/SKILL.md +326 -0
- package/skills/orly-spec-new/SKILL.md +157 -0
- package/skills/orly-write-integration-test/SKILL.md +470 -0
- package/skills/orly-write-unit-test/SKILL.md +520 -0
- package/src/cli.test.ts +70 -0
- package/src/cli.ts +287 -0
- package/src/config.test.ts +226 -0
- package/src/config.ts +288 -0
- package/src/criteria.test.ts +137 -0
- package/src/criteria.ts +166 -0
- package/src/criteria_spec.ts +127 -0
- package/src/criteria_support.ts +53 -0
- package/src/gates.test.ts +183 -0
- package/src/gates.ts +169 -0
- package/src/gates_spec.test.ts +98 -0
- package/src/gates_test_support.ts +194 -0
- package/src/git_env.ts +20 -0
- package/src/install.test.ts +514 -0
- package/src/install.ts +447 -0
- package/src/install_nested.test.ts +32 -0
- package/src/model.test.ts +31 -0
- package/src/model.ts +245 -0
- package/src/references.test.ts +47 -0
- package/src/references.ts +147 -0
- package/src/render.test.ts +60 -0
- package/src/render.ts +94 -0
- package/src/surfaces.test.ts +43 -0
- package/src/surfaces.ts +89 -0
- package/src/validation.test.ts +11 -0
- package/src/validation.ts +87 -0
- package/src/verify.test.ts +13 -0
- package/src/verify.ts +59 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# dispatch/write_any.sh β the cross-cutting authoring dispatch, DETERMINISTIC faΓ§ade.
|
|
3
|
+
#
|
|
4
|
+
# Pairs with dispatch/write_any.md (the LATENT faΓ§ade β prose the agent reads).
|
|
5
|
+
# Fires for ANY source file, IN ADDITION to the language faΓ§ade (write_zig /
|
|
6
|
+
# write_ts_adhere_bun / write_sql). Runs the mechanically-checkable cross-cutting
|
|
7
|
+
# subset and emits ONE verdict block.
|
|
8
|
+
#
|
|
9
|
+
# dispatch/write_any.sh <file> [...] # explicit targets (EXECUTE)
|
|
10
|
+
# dispatch/write_any.sh --staged # staged source (CONFORM, pre-commit)
|
|
11
|
+
#
|
|
12
|
+
# Layering: AGENTS.md β write_any.md (latent) β write_any.sh (this) β audits/*.sh
|
|
13
|
+
# Signals: π’ pass Β· π΄ fail (blocks) Β· π€ DECIDE (judgment; blocks the TURN, not the script) Β· π£ delegated
|
|
14
|
+
# Exit: 0 = mechanical gates pass Β· 1 = β₯1 failed Β· 2 = usage error.
|
|
15
|
+
#
|
|
16
|
+
# Leaf modes are verified against each script's own arg-parser (lib.sh warns the
|
|
17
|
+
# contracts are NON-UNIFORM): ufs.sh accepts --all + --staged (--diff retired
|
|
18
|
+
# M70); logging.sh / error-codes.sh / msid-ui.sh all accept --staged.
|
|
19
|
+
# The fnβ€50/methodβ€70 sub-cap (write_any.md, file-length card) is a TODO-CHECK:
|
|
20
|
+
# dispatch_length_gate enforces only the file cap; no fn/method leaf is wired yet.
|
|
21
|
+
|
|
22
|
+
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
|
23
|
+
|
|
24
|
+
dispatch_init "ANY" '*.zig' '*.ts' '*.tsx' '*.js' '*.jsx' '*.py' '*.rs' '*.go' '*.sh' '*.sql'
|
|
25
|
+
dispatch_resolve_files "$@"
|
|
26
|
+
dispatch_add_shebang_files "$@" # extensionless executables β ambiguous extension β gate fires
|
|
27
|
+
dispatch_header
|
|
28
|
+
|
|
29
|
+
# ββ deterministic gates ββββββββββββββββββββββββββββββββββββββββββββ
|
|
30
|
+
dispatch_length_gate 350 # FLL β file cap (fn/method 50/70 = TODO-CHECK)
|
|
31
|
+
dispatch_run_helper "UFS" "ufs.sh" "--all" # full-tree on purpose: the per-edit lens must not be blind to an unstaged edit
|
|
32
|
+
dispatch_run_helper "LOG" "logging.sh" "--staged"
|
|
33
|
+
dispatch_run_helper "MSID" "msid-ui.sh" "--staged"
|
|
34
|
+
|
|
35
|
+
# ββ delegations (run only in the product repo β need state absent from dotfiles) ββ
|
|
36
|
+
# ERR's leaf hard-exits if src/agentsfleetd/errors/error_registry.zig is absent (it
|
|
37
|
+
# cross-references emitted codes against the registry), unlike UFS/LOG/MSID which
|
|
38
|
+
# pass gracefully on empty input. So it can't run in dotfiles β delegate it; the
|
|
39
|
+
# product repo's `make harness-verify` runs error-codes.sh against the real
|
|
40
|
+
# registry. The .md keeps [DETERMINISTIC β ERR]: deterministic, just not run here.
|
|
41
|
+
dispatch_delegate "ERR" "make harness-verify (error-codes.sh β needs src/agentsfleetd/errors/error_registry.zig)"
|
|
42
|
+
|
|
43
|
+
# ββ judgment gates (no script can decide; agent states verdict in chat) ββ
|
|
44
|
+
dispatch_judgment "GRP" "per-iteration (diff langs change) + end-of-turn: audit the diff against docs/greptile-learnings/RULES.md β one row per applicable code (UFS/ORP/TST-NAM/PRI/EMS/β¦); \"it's just a label\" is not an exception"
|
|
45
|
+
dispatch_judgment "NLR" "touching a file with legacy framing / dead code? clean it in the same diff (touch-it-fix-it), or state the surviving legacy + why β never retain silently"
|
|
46
|
+
dispatch_judgment "NLG" "new legacy_* / V2 twin / compat shim / tracking-list while VERSION < 2.0.0? rename to the what-is-wrong form; no new legacy framing pre-2.0"
|
|
47
|
+
dispatch_judgment "LDC" "patching / keeping / testing a legacy-design path? consult Indy β A (remove) / B (patch) / C (keep) β before proceeding; no unilateral call"
|
|
48
|
+
|
|
49
|
+
dispatch_verdict
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# write_auth.md β auth-flow surface dispatch (LATENT faΓ§ade, fully delegated)
|
|
2
|
+
|
|
3
|
+
This is the prose the AGENT reads **before touching any auth-flow, token-minting,
|
|
4
|
+
or credential-typed code**. It is **fully π£ delegated**: the canonical rule doc
|
|
5
|
+
`AUTH.md` lives in the **product repo**, not in dotfiles, so dotfiles cannot
|
|
6
|
+
mechanically prove its coverage. This faΓ§ade carries only the trigger + the routing
|
|
7
|
+
+ the cross-cutting auth invariants that hold regardless of repo.
|
|
8
|
+
|
|
9
|
+
**Signal legend:**
|
|
10
|
+
|
|
11
|
+
- π£ delegated β the auth rules + their checks live and run in the product repo
|
|
12
|
+
(agentsfleet `docs/AUTH.md`). Dotfiles routes to them and enforces the
|
|
13
|
+
always-forbidden credential rules (below) that apply everywhere.
|
|
14
|
+
|
|
15
|
+
## Trigger β read the product repo's `docs/AUTH.md` before
|
|
16
|
+
|
|
17
|
+
- Editing `src/auth/**`, `ui/packages/app/lib/auth/**`, token-minting handlers,
|
|
18
|
+
or any credential-typed spec dimension.
|
|
19
|
+
|
|
20
|
+
**Override:** none β auth is a security boundary.
|
|
21
|
+
|
|
22
|
+
## Always-forbidden (these hold in dotfiles too, per AGENTS.md Hard Safety)
|
|
23
|
+
|
|
24
|
+
- **Plaintext secrets in entity tables** β store a vault `key_name` ref, resolve
|
|
25
|
+
via `crypto_store.load()` at runtime.
|
|
26
|
+
- **Resolving/printing credentials** β never `op read 'op://...'` into logs or
|
|
27
|
+
output at runtime; never paste a resolved secret.
|
|
28
|
+
- **Static credential strings in SQL schema** β no `DEFAULT 'value'` /
|
|
29
|
+
`CHECK (col IN (...))`; enforce in app via named constants.
|
|
30
|
+
|
|
31
|
+
## What it routes to
|
|
32
|
+
|
|
33
|
+
`docs/AUTH.md` **in the product repo** β token lifecycle, session shape, the
|
|
34
|
+
auth middleware chain, and credential storage rules. Read it first for any
|
|
35
|
+
auth-flow change; this faΓ§ade exists so the dispatch table has a home for the
|
|
36
|
+
trigger even though the rule body ships with the product, not dotfiles.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# write_changelog.md β changelog-voice dispatch (LATENT faΓ§ade)
|
|
2
|
+
|
|
3
|
+
This is the prose the AGENT reads after `write_documentation.md` and
|
|
4
|
+
`docs/DOCUMENTATION_RULES.md`, **before writing any `<Update>` entry in the
|
|
5
|
+
changelog** (`~/Projects/docs/changelog.mdx`). Like `verify` and
|
|
6
|
+
`name_architecture`, it has **no deterministic `.sh` half** β voice is a judgment
|
|
7
|
+
call no script can grade. It is a pure **π€ judgment** dispatch: the agent reads
|
|
8
|
+
this, drafts the entry, and self-audits against the rules below. The deep
|
|
9
|
+
reference is `docs/CHANGELOG_VOICE.md` (Mintlify-style) β read it before writing.
|
|
10
|
+
|
|
11
|
+
**Signal legend:**
|
|
12
|
+
|
|
13
|
+
- π€ DECIDE β judgment-only; the agent writes to the voice below and self-audits.
|
|
14
|
+
No script gates it β it blocks the *turn* (the changelog entry), not a commit.
|
|
15
|
+
- π£ delegated β the changelog itself lives in `~/Projects/docs` (its own repo +
|
|
16
|
+
own-branch flow per AGENTS.md Operational defaults); dotfiles carries only the
|
|
17
|
+
voice discipline.
|
|
18
|
+
|
|
19
|
+
## Trigger β read `docs/DOCUMENTATION_RULES.md`, then `docs/CHANGELOG_VOICE.md`
|
|
20
|
+
|
|
21
|
+
Fires before adding or editing an `<Update>` block in `changelog.mdx`, or any
|
|
22
|
+
user-visible release note. Internal-only changes get **no** changelog entry β the
|
|
23
|
+
Changelog Claim Challenge applies: *"Would this be true if the test file
|
|
24
|
+
vanished?"* Only test evidence (not a middleware/handler/CLI path) β an earned
|
|
25
|
+
user-visible claim.
|
|
26
|
+
|
|
27
|
+
**Override:** none needed β judgment-only. A voice exception (e.g. quoting a
|
|
28
|
+
vendor's marketing term verbatim) is stated inline in the entry, never dressed as
|
|
29
|
+
a gate skip.
|
|
30
|
+
|
|
31
|
+
## The voice (summary β `docs/CHANGELOG_VOICE.md` is canonical)
|
|
32
|
+
|
|
33
|
+
- **One headline per entry.** The lead paragraph states *the change*, not the
|
|
34
|
+
announcement ("X now does Y", not "We're excited to announce Y").
|
|
35
|
+
- **No marketing words** β use the canonical banned-word lists in
|
|
36
|
+
`docs/CHANGELOG_VOICE.md` and `docs/DOCUMENTATION_RULES.md`; do not duplicate
|
|
37
|
+
either list here.
|
|
38
|
+
- **Bullets** follow `**Bold lead-noun** β consequence-first clause`.
|
|
39
|
+
- **Never drop load-bearing facts** β error codes, endpoints, env vars, schema
|
|
40
|
+
names, money amounts stay verbatim.
|
|
41
|
+
- **Internal cleanup** gets aggressive trimming, not a paragraph.
|
|
42
|
+
- **History is archived, not rewritten** β past entries are an immutable record.
|
|
43
|
+
- **Rate constants** stay pinned across the three files (`tenant_billing.zig`,
|
|
44
|
+
`rates.ts`, `rates.mdx`) β a changelog money/rate claim must match all three.
|
|
45
|
+
|
|
46
|
+
## Required output (self-audit line before committing the changelog)
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
π CHANGELOG: <N> bullet(s) Β· no marketing words Β· load-bearing facts kept Β· history append-only
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
If the change is internal-only, emit instead:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
π CHANGELOG: skipped β internal-only (no user-visible behaviour change)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Family
|
|
59
|
+
|
|
60
|
+
- `docs/CHANGELOG_VOICE.md` β the canonical Mintlify-style voice rules (deep reference).
|
|
61
|
+
- `skills/release-template.md` β release template + version-bump matrix; re-source
|
|
62
|
+
each release, never paraphrase.
|
|
63
|
+
- `verify` β runs before CHORE(close); a changelog claim must be backed by the
|
|
64
|
+
verification that dispatch reports.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# write_documentation.md β published-documentation dispatch
|
|
2
|
+
|
|
3
|
+
Read `docs/DOCUMENTATION_RULES.md` before
|
|
4
|
+
writing customer-facing documentation. This general rule runs before narrower
|
|
5
|
+
guides selected by domain-specific packs (changelog voice, when selected) and
|
|
6
|
+
before prose about the dispatch model.
|
|
7
|
+
|
|
8
|
+
## Trigger
|
|
9
|
+
|
|
10
|
+
- Editing a published Markdown JSX (MDX) page.
|
|
11
|
+
- Editing a reusable `snippets/*.mdx` fragment.
|
|
12
|
+
- Editing public OpenAPI summaries, descriptions, examples, options, or errors.
|
|
13
|
+
- Editing a customer-facing readme or reference page.
|
|
14
|
+
<!-- oracle-packs:start domain.changelog -->
|
|
15
|
+
- Editing `docs/CHANGELOG_VOICE.md` or `docs/DISPATCH_ARCHITECTURE.md`.
|
|
16
|
+
|
|
17
|
+
`changelog.mdx` history remains excluded from the general page shape. New
|
|
18
|
+
changelog entries read this dispatch first, then `write_changelog.md`.
|
|
19
|
+
<!-- oracle-packs:end -->
|
|
20
|
+
|
|
21
|
+
## Required order
|
|
22
|
+
|
|
23
|
+
1. Read `docs/DOCUMENTATION_RULES.md` and identify the page scope.
|
|
24
|
+
2. Read the repository glossary and content boundaries.
|
|
25
|
+
3. Verify claims against runtime code, OpenAPI, and command help.
|
|
26
|
+
4. Write the smallest complete page.
|
|
27
|
+
5. Run the repository-owned pre-commit checker.
|
|
28
|
+
|
|
29
|
+
## Enforcement
|
|
30
|
+
|
|
31
|
+
π£ **Delegated.** Each repository owns its checker: rules resolve from this
|
|
32
|
+
repository's own `docs/`, materialised here by `orly init`. Dotfiles owns the
|
|
33
|
+
rule and the read trigger. Repository hooks own mechanical enforcement.
|
|
34
|
+
|
|
35
|
+
Before committing, cite the applied Documentation (DOC) rule identifiers:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
π DOC READ: docs/DOCUMENTATION_RULES.md β scope <page|fragment|OpenAPI|changelog>; DOC-<rules applied>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Family
|
|
42
|
+
|
|
43
|
+
- `docs/DOCUMENTATION_RULES.md` β general customer-documentation rules.
|
|
44
|
+
- Selected changelog and HTTP packs provide their narrower archive, voice, and
|
|
45
|
+
API design rules.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Go authoring
|
|
2
|
+
|
|
3
|
+
Return errors, do not panic across a package boundary. Wrap with `%w` so the
|
|
4
|
+
caller can still match the cause, and add context the caller does not already
|
|
5
|
+
have β never re-wrap the same fact twice.
|
|
6
|
+
|
|
7
|
+
Every goroutine needs a stated exit: a `context.Context` it honours, a channel
|
|
8
|
+
close, or a `WaitGroup` the caller waits on. A goroutine with no exit path is a
|
|
9
|
+
leak whatever the test says. Take a `context.Context` as the first parameter on
|
|
10
|
+
anything that blocks, and pass it down rather than storing it in a struct.
|
|
11
|
+
|
|
12
|
+
Defer the release beside the acquire β `defer file.Close()`, `defer mu.Unlock()`
|
|
13
|
+
β so the pairing survives an early return. Check the error from a deferred
|
|
14
|
+
`Close` on a writer; a dropped flush is a silent truncation.
|
|
15
|
+
|
|
16
|
+
Accept interfaces, return structs, and define the interface where it is
|
|
17
|
+
consumed. Keep zero values usable so a caller need not call a constructor to get
|
|
18
|
+
a working value.
|
|
19
|
+
|
|
20
|
+
Table-driven tests are the default shape. Concurrency work needs a `-race` run,
|
|
21
|
+
and a deterministic contention test rather than a sleep.
|
|
22
|
+
|
|
23
|
+
The repository owns formatting, vet, lint, build, and test commands β it
|
|
24
|
+
declares them in `.oracle/orly.json`.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# write_http.md β HTTP/REST surface dispatch (LATENT faΓ§ade, route-and-delegate)
|
|
2
|
+
|
|
3
|
+
This is the prose the AGENT reads **before adding, modifying, or removing any HTTP
|
|
4
|
+
endpoint**. Unlike `write_zig`, it does **not** merge its rule doc β the canonical
|
|
5
|
+
checklist `docs/REST_API_DESIGN_GUIDELINES.md` is a
|
|
6
|
+
self-contained product-surface design guide, so this faΓ§ade *routes* to it rather
|
|
7
|
+
than duplicating it. **Residence vs enforcement:** `orly init` materialises the
|
|
8
|
+
guide into this repository under the `domain.http` pack β it is a real local
|
|
9
|
+
file, not something read through another checkout. Its checks are *enforced*
|
|
10
|
+
in the product repo (`make lint` / `/review` against the guide) β hence
|
|
11
|
+
**π£ delegated**.
|
|
12
|
+
|
|
13
|
+
**Signal legend:**
|
|
14
|
+
|
|
15
|
+
- π£ delegated β the REST checklist is enforced in the product repo (agentsfleet),
|
|
16
|
+
by `make lint` + adversarial `/review` against the guide. Dotfiles carries the
|
|
17
|
+
doc itself, the routing, and the discipline that the guide is a *checklist, not
|
|
18
|
+
background reading*.
|
|
19
|
+
|
|
20
|
+
## Trigger β read `docs/REST_API_DESIGN_GUIDELINES.md` before
|
|
21
|
+
|
|
22
|
+
- Editing `src/http/handlers/**`, `public/openapi/**`, or any `route_*` file.
|
|
23
|
+
- Adding, modifying, or removing an HTTP endpoint or its OpenAPI shape.
|
|
24
|
+
|
|
25
|
+
**Override:** none from dotfiles β the REST guide's own `MUST`/`SHOULD`
|
|
26
|
+
semantics govern (a `MUST` violation blocks merge; a `SHOULD` deviation needs a
|
|
27
|
+
one-line PR rationale).
|
|
28
|
+
|
|
29
|
+
## What it routes to
|
|
30
|
+
|
|
31
|
+
`docs/REST_API_DESIGN_GUIDELINES.md` β canonical instruction
|
|
32
|
+
set covering URL design (plural-noun resources, no verbs, allowed `:verb`
|
|
33
|
+
categories), path params + trailing-slash rules, HTTP-method semantics + PATCH
|
|
34
|
+
idempotency, the `202 + /v1/operations/{id}` long-running shape, request/response
|
|
35
|
+
body shapes, error envelopes, pagination, and the pre-PR Β§10 gate. Treat it as a
|
|
36
|
+
checklist run at `CHORE(close)` before `gh pr create`.
|
|
37
|
+
|
|
38
|
+
## Why route, not merge
|
|
39
|
+
|
|
40
|
+
REST design rules bind the *product repo's* HTTP surface, but the doc has one
|
|
41
|
+
canonical source in dotfiles β `orly init`/`orly update` materialise it here,
|
|
42
|
+
so this repository's copy tracks that source. Merging its full text into
|
|
43
|
+
this faΓ§ade would create a second source of truth. The guide stays canonical;
|
|
44
|
+
this faΓ§ade is the dispatch entry that points the agent at it when the trigger
|
|
45
|
+
fires.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Markdown JSX authoring
|
|
2
|
+
|
|
3
|
+
Treat Markdown JSX (MDX) as a language, not generic prose. Validate front matter,
|
|
4
|
+
component nesting, links, code fences, and accessible image descriptions.
|
|
5
|
+
|
|
6
|
+
Mintlify behavior belongs to the Mintlify domain pack. An MDX repository that
|
|
7
|
+
does not use Mintlify must not receive Mintlify-specific rules.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Python authoring
|
|
2
|
+
|
|
3
|
+
Use standard-library parsers for structured input. Keep resource ownership in
|
|
4
|
+
context managers. Validate data at parse boundaries and preserve specific
|
|
5
|
+
exception classes until the caller can decide how to respond.
|
|
6
|
+
|
|
7
|
+
The repository owns formatting, linting, type checking, and tests β it declares
|
|
8
|
+
them in `.oracle/orly.json`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Rust authoring
|
|
2
|
+
|
|
3
|
+
Use ownership and borrowing to make resource lifetime visible. Keep `unsafe`
|
|
4
|
+
blocks small and state the invariant they rely on. Preserve error variants until
|
|
5
|
+
the caller has enough information to decide whether to retry or stop.
|
|
6
|
+
|
|
7
|
+
Test the feature combinations the repository actually builds. Concurrency work
|
|
8
|
+
needs a deterministic contention test, not only a happy-path asynchronous test.
|
|
9
|
+
|
|
10
|
+
The repository owns formatting, Clippy, build, test, security, and benchmark
|
|
11
|
+
commands β it declares them in `.oracle/orly.json`.
|
|
12
|
+
|
|
13
|
+
## Reference guideline (mandatory in review)
|
|
14
|
+
|
|
15
|
+
Microsoft's Pragmatic Rust Guidelines are this pack's depth β thorough,
|
|
16
|
+
agent-facing, and continuously maintained upstream. The local copy lives at
|
|
17
|
+
`~/Projects/oss/rust-guidelines/all.txt`; fetch it when absent:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
mkdir -p ~/Projects/oss/rust-guidelines && \
|
|
21
|
+
curl -fsSL https://microsoft.github.io/rust-guidelines/agents/all.txt \
|
|
22
|
+
-o ~/Projects/oss/rust-guidelines/all.txt
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Every Rust REVIEW β and any adversarial pass over `*.rs` β reads it
|
|
26
|
+
**sectioned, never whole-file** (186 sections):
|
|
27
|
+
`grep -nE "^#+ " ~/Projects/oss/rust-guidelines/all.txt`, read the sections
|
|
28
|
+
the diff touches, and cite the guideline IDs (`M-β¦` mnemonics, e.g.
|
|
29
|
+
`M-UNSOUND`, `M-SIMPLE-ABSTRACTIONS`) applied or consciously diverged from.
|
|
30
|
+
Local convention wins on conflict, but the divergence is named in the review
|
|
31
|
+
output. Refresh the copy when the user asks or a cited rule looks stale
|
|
32
|
+
(re-run the fetch; upstream updates continuously).
|
|
33
|
+
|
|
34
|
+
## Evolution
|
|
35
|
+
|
|
36
|
+
This pack is young next to the Zig faΓ§ade and grows the same way: a Rust
|
|
37
|
+
incident worth keeping becomes a rule or **Example:** line via the
|
|
38
|
+
rule-extension protocol β never a memory file, never a milestone cite.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Shell authoring
|
|
2
|
+
|
|
3
|
+
Quote expansions, use arrays for argument lists, and clean temporary files on
|
|
4
|
+
every exit path. Avoid `eval` for external input. Match the repository's required
|
|
5
|
+
shell and macOS Bash compatibility level.
|
|
6
|
+
|
|
7
|
+
The repository owns ShellCheck and executable tests β it declares them in
|
|
8
|
+
`.oracle/orly.json`.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# write_spec.md β spec-authoring dispatch (LATENT faΓ§ade)
|
|
2
|
+
|
|
3
|
+
This is the prose the AGENT reads **before writing or editing a spec** under
|
|
4
|
+
`docs/v*/{pending,active,done}/`. It pairs with the deterministic half
|
|
5
|
+
`audits/spec-template.sh`, which runs in `make lint`. (This is the former Spec Template gate absorbed into
|
|
6
|
+
the dispatch model β `docs/TEMPLATE.md` remains the canonical section source.)
|
|
7
|
+
|
|
8
|
+
**Signal legend:**
|
|
9
|
+
|
|
10
|
+
- π’ / π΄ β `audits/spec-template.sh` mechanically passes/fails the prohibited-pattern and
|
|
11
|
+
required-section checks.
|
|
12
|
+
- π€ DECIDE β whether a required section is *meaningfully filled* (not just
|
|
13
|
+
present) is the agent's judgment at author time.
|
|
14
|
+
|
|
15
|
+
## Trigger β every Edit/Write to
|
|
16
|
+
|
|
17
|
+
- Any spec under `docs/v*/{pending,active,done}/**/*.md`.
|
|
18
|
+
- `docs/TEMPLATE.md` itself.
|
|
19
|
+
- Any `*.md` whose body carries the spec frontmatter pattern (`^**Milestone:** M\d+`).
|
|
20
|
+
|
|
21
|
+
**Override:** `SPEC TEMPLATE GATE: SKIPPED per user override (reason: ...)`.
|
|
22
|
+
**User-invokable only.** Auto-mode does NOT cover it; reasons must cite a concrete
|
|
23
|
+
external constraint (vendor doc requirement, regulatory format), never internal
|
|
24
|
+
preference.
|
|
25
|
+
|
|
26
|
+
## What this covers
|
|
27
|
+
|
|
28
|
+
**Family 1 β prohibited patterns (negative space).** `docs/TEMPLATE.md`
|
|
29
|
+
"Prohibited" forbids: time/effort estimates, effort columns, complexity ratings,
|
|
30
|
+
percentage-complete fields, assigned owners, implementation dates. Specs created
|
|
31
|
+
from the template don't carry the Prohibited section forward β only the body
|
|
32
|
+
below the divider gets copied β so without enforcement these drift back in.
|
|
33
|
+
|
|
34
|
+
**Family 2 β required-present + no-placeholder (positive space).** The
|
|
35
|
+
agent-facing template mandates the determinism sections the executing agent reads
|
|
36
|
+
to emit invariant output: PR Intent & comprehension handshake, Applicable Rules,
|
|
37
|
+
Applicable Gates, Overview, Prior-Art / Reference Implementations, Files Changed,
|
|
38
|
+
Decomposition & alternatives, Sections, Metrics & Observability, Interfaces,
|
|
39
|
+
Failure Modes, Invariants, Test Specification, Acceptance Rubric (legacy heading `Acceptance Criteria` accepted), Product Clarity (authoring record), Discovery. A spec missing one β or
|
|
40
|
+
leaving template residue (`path/to/file.ext`, `test_<short_name>`,
|
|
41
|
+
`{one-line reason}`, any surviving `tpl:` guidance comment β the template's fill
|
|
42
|
+
grammar deletes them all at authoring) β forces the agent to guess intent.
|
|
43
|
+
|
|
44
|
+
**Family 2b β declared-command parity.** A staged `pending/` or `active/`
|
|
45
|
+
spec's Acceptance Rubric must quote the repository's declared `conform` and
|
|
46
|
+
`verify.unit` commands (`.oracle/orly.json`) **verbatim** β the same set
|
|
47
|
+
`orly gate` runs, so the rubric and the mechanical PR gate grade one boundary.
|
|
48
|
+
Missing β BLOCK. No config, no bun, or no declared commands β NOTE + skip.
|
|
49
|
+
Done specs are historical records and are never retrofitted.
|
|
50
|
+
|
|
51
|
+
**Scope (no legacy carve-out).** Family 2 fires in `--staged` only β the spec
|
|
52
|
+
being authored now (the agent's own output): BLOCK. Bulk scans (`--all` /
|
|
53
|
+
`--include-done`, which `make harness-verify` runs) execute Family 1 only, so they
|
|
54
|
+
behave identically over the corpus and never break an existing spec.
|
|
55
|
+
|
|
56
|
+
## Pre-edit check
|
|
57
|
+
|
|
58
|
+
| Pattern | Rule |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `## Estimated effort` (any heading variant) | Forbidden. Delete the section. |
|
|
61
|
+
| `## Effort` / `## Complexity` / `## Sizing` | Forbidden. Use Priority. |
|
|
62
|
+
| `\b\d+\s*[-β]\s*\d+\s*h\b` (hour ranges like "10-14h") | Forbidden. |
|
|
63
|
+
| `\b\d+\s*hours?\b` / `\b\d+\s*days?\b` / `\b\d+\s*min(utes?)?\b` | Forbidden. |
|
|
64
|
+
| `\b(low|medium|high|small|large)\s*[:|-]\s*(effort|complexity)\b` | Forbidden. |
|
|
65
|
+
| `\d+%\s*complete` / `\b\d+/\d+\b\s*tasks` | Forbidden β binary PENDING/IN_PROGRESS/DONE. |
|
|
66
|
+
| `**Owner:**` / `**Assigned to:**` | Forbidden β use git history. |
|
|
67
|
+
| `**Due:**` / `**Deadline:**` (with date) | Forbidden β use Priority. |
|
|
68
|
+
| Missing a required determinism section in a **staged** spec | BLOCK β add it. |
|
|
69
|
+
| Rubric missing a declared `conform`/`verify.unit` command (**staged** pending/active) | BLOCK β copy it verbatim from `.oracle/orly.json`. |
|
|
70
|
+
| Unfilled template residue in a **staged** spec | BLOCK β fill the section. |
|
|
71
|
+
| Surviving `tpl:` guidance comment in a **staged** spec | BLOCK β delete it; the executor reads instance content only. |
|
|
72
|
+
| Spec without the SPEC AUTHORING RULES banner | Informational β reminds future edits. |
|
|
73
|
+
|
|
74
|
+
## Required output (default β one line)
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
SPEC TEMPLATE GATE: <file> | prohibited:<0|list> required-sections:<all-present|missing-list β staged only> placeholders:<0|list> banner:<yes|no>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Full multi-line block fires on violation (prohibited sections / time estimates /
|
|
81
|
+
effort fields / %-complete / owner-date fields, each with line numbers, plus the
|
|
82
|
+
`audits/spec-template.sh` staged-diff finding count).
|
|
83
|
+
|
|
84
|
+
## Scope
|
|
85
|
+
|
|
86
|
+
`audits/spec-template.sh` walks the **full pending+active spec set** via `git ls-files`;
|
|
87
|
+
the index includes staged-but-uncommitted content, so a fix staged in pre-commit
|
|
88
|
+
satisfies the check on the same hook run. `--staged` is the opt-in narrowing mode.
|
|
89
|
+
|
|
90
|
+
## Authoring discipline (judgment layer)
|
|
91
|
+
|
|
92
|
+
Incident-derived rules the deterministic half can't check β apply while writing the spec, not after:
|
|
93
|
+
|
|
94
|
+
- **Validate intent against the repo, not the words.** Grep the codebase for the existing meaning of the spec's key nouns ("e2e", "acceptance", "live") before encoding them. The **duplicate-target smell**: a new target/recipe that comes out byte-identical to an existing one means the abstraction is wrong β STOP and surface (one incident's new e2e umbrella came out byte-identical to the existing integration target). And verify lanes in the real CI environment β a green local `docker compose` run proves nothing about a compose-less CI container.
|
|
95
|
+
- **Teardown / rename / flip specs open with a blast-radius grep.** `git grep -rn -w '<token>'` from repo root, no path or file-type filter; every surviving hit lands in Files Changed with production and test files separated. Word-boundary, never quoted-literal (YAML / multiline-string refs carry no quotes); grep filenames as tokens, never path-anchored (same-directory `@import("foo.zig")` has no path prefix); separate true targets from same-spelling-different-meaning hits (skill ref vs repo slug). The spec's invariant/rubric greps must use the same pattern as the discovery grep.
|
|
96
|
+
- **Grep-gate carve-outs for English.** A `\b(word)\b` zero-match gate overreaches when the word has a common English meaning ("run" is the usual offender). Encode the intent as enumerated product phrases (`run interrupt`, `spec init`, `gate loop`); when a literal gate fires on legitimate English, amend the spec β don't contort the prose.
|
|
97
|
+
- **No pre-/post-milestone or "production today" framing while pre-launch** β there is no production baseline to anchor a current-vs-future split against. Describe the target design as *the* design; mark a superseded model neutrally ("this file describes the single-process model; the M80 split supersedes it"), never as "pre-M80 / operational truth".
|
|
98
|
+
- **Security-boundary or backend-heavy follow-ups get their own spec + PR.** RBAC, secret reveal, account/tenant deletion, auth webhooks, new endpoints/scheduled jobs/billing policy β they carry a different review profile (AUTH chain, focused diff, own greptile pass) and never fold into a UI-polish PR, even after a "just fold it in". Small pure-UI items bundle fine; restoring a folded spec to `pending/` is cheap.
|
|
99
|
+
- **Rubric rows are outcomes, not Dimensions.** The Acceptance Rubric is the spec's single scoring surface: 5β12 rows (Section outcomes, failure classes, hygiene gates); every Expected mechanically checkable (exit code / literal substring / match count); Graded = β
/β + one decisive output line. Per-Dimension proof lives in the Test Specification; evidence walls and per-Dimension rubric rows are violations.
|
|
100
|
+
|
|
101
|
+
## Family
|
|
102
|
+
|
|
103
|
+
- `docs/TEMPLATE.md` β canonical Prohibited section + required sections.
|
|
104
|
+
- `orly-spec-new` skill β creates specs from the template; inserts the banner.
|
|
105
|
+
- `audits/spec-template.sh` β mechanical regex enforcement, runs in `make lint`.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# write_sql.md β SQL / schema latent faΓ§ade
|
|
2
|
+
|
|
3
|
+
This is the prose the AGENT reads before writing any `schema/*.sql` file. It pairs with the deterministic faΓ§ade `dispatch/write_sql.sh` β the machine half that runs the mechanically-checkable subset and emits one verdict block. **Read `docs/SCHEMA_CONVENTIONS.md` first** β it is the source-of-truth for table/column naming, type choices, and schema-qualification (the analogue of `docs/REST_API_DESIGN_GUIDELINES.md` for `write_http`). The dissolving **Schema Table Removal Guard** card is merged verbatim below, while the durable SQL rules (`NSQ`, `STS`, `SGR`, `ITF`) stay in `docs/greptile-learnings/RULES.md` (retained) β referenced here, enforced by the GREPTILE GATE. Mechanical thresholds live once in the `.sh`; this file references rule codes, never restates the numbers.
|
|
4
|
+
|
|
5
|
+
**Signal legend** (printed by `write_sql.sh`):
|
|
6
|
+
|
|
7
|
+
- π’ pass β deterministic check passed.
|
|
8
|
+
- π΄ fail β deterministic check failed (or helper absent); STOP, fix, rerun.
|
|
9
|
+
- π€ DECIDE β judgment-only; no script can decide, the agent reads the section and makes the call (blocks the TURN, not the script).
|
|
10
|
+
- π£ delegated β the checker runs only in the product repo, not in dotfiles.
|
|
11
|
+
|
|
12
|
+
**Tag legend** β each section heading below carries one of:
|
|
13
|
+
|
|
14
|
+
- `> [DETERMINISTIC β <CODE>]` β a machine can pass/fail it; the `.sh` row for `<CODE>` (e.g. `FLL`) enforces it. `TODO-CHECK` marks a mechanizable rule with no helper wired yet (build-the-check). `NEW:<name>` marks a proposed-but-not-yet-existing code.
|
|
15
|
+
- `> [JUDGMENT β <CODE>]` β no script can decide; the agent decides at write time against the prose.
|
|
16
|
+
- `> [container]` β a non-enforcement wrapper heading (e.g. "Merged from dissolved gate cards"); its tagged subsections carry the real codes, and the coherence audit (Β§6.3) skips it.
|
|
17
|
+
|
|
18
|
+
The tag grammar and semantic-anchor model are defined by the tagged sections and
|
|
19
|
+
deterministic faΓ§ade in this snapshot.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# SQL & schema authoring discipline
|
|
24
|
+
|
|
25
|
+
## Scope
|
|
26
|
+
|
|
27
|
+
> [JUDGMENT β SCH]
|
|
28
|
+
|
|
29
|
+
Triggers on every `Edit`/`Write` to `schema/*.sql`, `schema/embed.zig` (`@embedFile` constants), and the canonical migration array in `src/cmd/common.zig`. **Before authoring DDL, read `docs/SCHEMA_CONVENTIONS.md`** (naming, types, schema-qualification). SQL embedded in handlers (`*.zig`) and integration-test fixtures is also governed by the companion rules below β those surfaces additionally fire `write_zig.md` and the GREPTILE GATE.
|
|
30
|
+
|
|
31
|
+
## Merged from dissolved gate cards
|
|
32
|
+
|
|
33
|
+
> [container]
|
|
34
|
+
|
|
35
|
+
The **Schema Table Removal Guard** card dissolves into this faΓ§ade; its prose is preserved verbatim below (title demoted to a tagged `###`, its subsections demoted to `####` and tagged `SCH`).
|
|
36
|
+
|
|
37
|
+
### Schema Table Removal Guard (SCHEMA GUARD)
|
|
38
|
+
|
|
39
|
+
> [JUDGMENT β SCH]
|
|
40
|
+
|
|
41
|
+
**Family:** Schema discipline. **Source:** `AGENTS.md` (project-side guard). Related: **RULE STS** (no static strings in SQL schema), **RULE NSQ** (named constants, schema-qualified SQL) β both in `docs/greptile-learnings/RULES.md`.
|
|
42
|
+
|
|
43
|
+
**Triggers** β before any of these, run `cat VERSION` and print the guard output:
|
|
44
|
+
|
|
45
|
+
- Creating, editing, or deleting any file under `schema/*.sql`.
|
|
46
|
+
- Editing `schema/embed.zig` (any `@embedFile` constant).
|
|
47
|
+
- Editing the canonical migration array in `src/cmd/common.zig`.
|
|
48
|
+
- Writing `DROP TABLE`, `ALTER TABLE`, or `SELECT 1;` into any SQL file.
|
|
49
|
+
- Accepting a spec dimension prescribing a "DROP migration", "ALTER migration", or "version marker".
|
|
50
|
+
|
|
51
|
+
**Override:** `SCHEMA GUARD: SKIPPED per user override (reason: ...)`. **User-invokable only.** Spec violates the guard β amend the spec first.
|
|
52
|
+
|
|
53
|
+
#### Pre-v2.0.0 (teardown-rebuild era)
|
|
54
|
+
|
|
55
|
+
> [JUDGMENT β SCH]
|
|
56
|
+
|
|
57
|
+
To remove a table:
|
|
58
|
+
|
|
59
|
+
1. `rm schema/NNN_foo.sql`
|
|
60
|
+
2. Remove `@embedFile` from `schema/embed.zig`
|
|
61
|
+
3. Remove the entry from the migration array in `src/cmd/common.zig` and update length + index-based tests.
|
|
62
|
+
|
|
63
|
+
**Forbidden:** `ALTER TABLE`, `DROP TABLE`, `SELECT 1;` markers, comment-only files, "keep file for slot numbering". Slot gaps are fine β the DB is wiped on rebuild.
|
|
64
|
+
|
|
65
|
+
#### v2.0.0+
|
|
66
|
+
|
|
67
|
+
> [JUDGMENT β SCH]
|
|
68
|
+
|
|
69
|
+
Proper `ALTER`/`DROP` migrations in new numbered files. No teardown.
|
|
70
|
+
|
|
71
|
+
#### Required output
|
|
72
|
+
|
|
73
|
+
> [JUDGMENT β SCH]
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
SCHEMA GUARD: VERSION=<v> (<2.0.0 ? teardown : alter)
|
|
77
|
+
rm:schema/<file>.sql
|
|
78
|
+
rm-embed:<const>
|
|
79
|
+
rm-migration:v<N>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For pre-v2.0.0 path, all three rm- lines appear. For v2.0.0+, replace with `migration:schema/<NNN>_<change>.sql`.
|
|
83
|
+
|
|
84
|
+
## Companion SQL rules (retained in `docs/greptile-learnings/RULES.md`)
|
|
85
|
+
|
|
86
|
+
> [container]
|
|
87
|
+
|
|
88
|
+
These rules are **not** dissolved β they remain in `docs/greptile-learnings/RULES.md`. STS/NSQ/SGR are enforced by the GREPTILE GATE until a leaf check is wired (`TODO-CHECK`); ITF additionally surfaces as a `π€ DECIDE` judgment row in `write_sql.sh`. Summarised here so the SQL author sees the full surface in one place; RULES.md stays canonical (read it for the full text + `Ref:` provenance).
|
|
89
|
+
|
|
90
|
+
### RULE STS β No static strings in SQL schema
|
|
91
|
+
|
|
92
|
+
> [DETERMINISTIC β TODO-CHECK]
|
|
93
|
+
|
|
94
|
+
No string literal in `schema/**.sql` may name a value or identifier the application also names β SQL cannot reference Zig/JS constants, so schema strings drift from code. The surface is every literal, not two syntactic forms: `DEFAULT`, `CHECK (β¦ IN (β¦))`, **trigger-body comparisons against a column**, **`current_setting()` parameter names**, and **`RAISE EXCEPTION` text a caller matches on**. Enforce value constraints via application constants; where SQL cannot import the constant, pin the pair with a slot-grep test. Carve-out: a literal encoding a structural identity rather than a vocabulary value (`'{}'::jsonb`, `'{}'::text[]`) stays, reason stated inline. A drifted `DEFAULT` yields wrong data; a drifted trigger predicate or setting name fails **silently** β the guard stops guarding. (RULES.md `RULE STS`.)
|
|
95
|
+
|
|
96
|
+
### RULE NSQ β Named constants, schema-qualified SQL
|
|
97
|
+
|
|
98
|
+
> [DETERMINISTIC β TODO-CHECK]
|
|
99
|
+
|
|
100
|
+
No magic numbers; all SQL in handlers is schema-qualified (`core.table`, not `table`) β unqualified names fail when `search_path` differs across environments. (RULES.md `RULE NSQ`.)
|
|
101
|
+
|
|
102
|
+
### RULE SGR β Migrations include GRANT statements
|
|
103
|
+
|
|
104
|
+
> [DETERMINISTIC β TODO-CHECK]
|
|
105
|
+
|
|
106
|
+
Every `CREATE TABLE` migration ends with `GRANT`s for every role that queries the table (`api_runtime` / `worker_runtime`), mirroring the table's callers. PostgreSQL denies by default β a missing grant fails only at first runtime use. (RULES.md `RULE SGR`.)
|
|
107
|
+
|
|
108
|
+
### RULE ITF β Integration tests use the real schema
|
|
109
|
+
|
|
110
|
+
> [JUDGMENT β ITF]
|
|
111
|
+
|
|
112
|
+
An integration test touching a production table seeds rows through a shared `src/db/test_fixtures_<scope>.zig` module against the real schema β never a session-local `CREATE TEMP TABLE` mocking the production shape (the mock drifts and hides schema changes). Fixtures use semantic scope names, never milestone-numbered ones. (RULES.md `RULE ITF`.)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# dispatch/write_sql.sh β the SQL / schema dispatch, DETERMINISTIC faΓ§ade.
|
|
3
|
+
#
|
|
4
|
+
# Pairs with dispatch/write_sql.md (the LATENT faΓ§ade β prose the agent reads).
|
|
5
|
+
# This .sh runs the mechanically-checkable subset of the SQL/schema discipline and
|
|
6
|
+
# emits ONE verdict block. The latent trigger ("about to write a schema/*.sql file")
|
|
7
|
+
# dispatches here; everything below is deterministic and re-runnable.
|
|
8
|
+
#
|
|
9
|
+
# dispatch/write_sql.sh <schema/file.sql> [...] # explicit targets (EXECUTE)
|
|
10
|
+
# dispatch/write_sql.sh --staged # staged schema/*.sql (CONFORM, pre-commit)
|
|
11
|
+
#
|
|
12
|
+
# Layering: AGENTS.md β write_sql.md (latent) β write_sql.sh (this) β audits/*.sh
|
|
13
|
+
# Signals: π’ pass Β· π΄ fail (blocks) Β· π€ DECIDE (judgment; blocks the TURN, not the script) Β· π£ delegated
|
|
14
|
+
# Exit: 0 = mechanical gates pass Β· 1 = β₯1 failed Β· 2 = usage error.
|
|
15
|
+
#
|
|
16
|
+
# Note: STS/NSQ/SGR are mechanizable SQL-hygiene rules with no leaf check wired yet
|
|
17
|
+
# (write_sql.md tags them TODO-CHECK). They stay in docs/greptile-learnings/RULES.md
|
|
18
|
+
# (retained) and the GREPTILE GATE enforces them by review until a leaf exists.
|
|
19
|
+
# SCH's pre-2.0 forbidden-token floor (no ALTER/DROP/SELECT 1; in schema/*.sql) is
|
|
20
|
+
# itself a build-the-check (TODO-CHECK) candidate; the teardown-vs-ALTER disposition
|
|
21
|
+
# call above it stays JUDGMENT (which file to rm, which @embedFile, which migration index).
|
|
22
|
+
|
|
23
|
+
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
|
24
|
+
|
|
25
|
+
dispatch_init "SQL" 'schema/*.sql'
|
|
26
|
+
dispatch_resolve_files "$@"
|
|
27
|
+
dispatch_header
|
|
28
|
+
|
|
29
|
+
# ββ deterministic gates ββββββββββββββββββββββββββββββββββββββββββββ
|
|
30
|
+
dispatch_length_gate 350 # FLL β file β€ 350
|
|
31
|
+
|
|
32
|
+
# ββ judgment gates (no script can decide; agent states verdict in chat) ββ
|
|
33
|
+
dispatch_judgment "SCH" "removing/altering a table? cat VERSION β pre-2.0.0 = full teardown (rm schema/NNN.sql + @embedFile + migration-array entry + index tests), never ALTER/DROP/SELECT 1; β₯2.0.0 = numbered ALTER/DROP migration. print the SCHEMA GUARD block"
|
|
34
|
+
dispatch_judgment "ITF" "integration test touching a production table? seed via src/db/test_fixtures_<scope>.zig against the real schema β never CREATE TEMP TABLE mocking the production shape"
|
|
35
|
+
|
|
36
|
+
dispatch_verdict
|