Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ InKCre is a system of heterogeneous peers sharing one info-base. Extensions add

The Extension Registry is the public control plane for extension Releases and native Distributions. Registry, Toolkit, Host SDKs, and first-party Extensions are independent release units. The Toolkit must not create reverse dependencies into the Registry service.

Registry Release, deployment `installed`, Peer `enabled`, and process/browser `running` are four distinct authorities. Conflating them produces broken lifecycle behavior.
The Registry owns releases. The info-base records deployment Extension identity, each Peer's exact distribution selection, and enablement intent. The Host reports what actually runs.

## Knowledge Owners

Expand All @@ -24,11 +24,11 @@ Registry Release, deployment `installed`, Peer `enabled`, and process/browser `r

## Repository Map

- `src/inkcre_extension_registry/`: Registry contracts and Worker service (Python)
- `src/worker.py`: Cloudflare Worker entrypoint
- `src/inkcre_extension_registry/`: Registry contracts, CPython service, and command entry point
- `src/inkcre_extension_registry/migrations/`: active PostgreSQL migrations
- `toolkit/`: independently released developer and delivery tooling (Python, `inkcre_extension_toolkit`)
- `contracts/`: generated schemas and OpenAPI; never edit by hand
- `migrations/`: checked-in D1 schema history (append-only after deployment)
- `migrations/`: legacy D1 schema retained for import and recovery
- `scripts/`: contract generation, verification, and release tooling
- `runtimes/`: runtime topology for local and preview
- `docs/30-unit-tdd/`: internal design
Expand All @@ -39,9 +39,9 @@ Registry Release, deployment `installed`, Peer `enabled`, and process/browser `r

- Default to Python. Use TypeScript only at a browser or `impl-ts` seam.
- Keep manifest and protocol truth language-neutral.
- Install with `uv sync --frozen && pnpm install --frozen-lockfile`. Exact commands live in `package.json` and `pyproject.toml`.
- Follow the [pinned PDM and pnpm setup](CONTRIBUTING.md). The [local development guide](docs/40-deployment/local-development.md) owns test database and service startup.
- Never hand-edit `contracts/*`; change the source model or route and run `pnpm contracts:generate`.
- Treat checked-in D1 migrations as append-only after deployment. Production resource mutation requires a separate, explicit authorization.
- Use append-only changes for deployed PostgreSQL migrations. Production resource mutation requires separate, explicit authorization.

## Governance And Workflow

Expand Down
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Do not edit `docs/_shared/**` from this repository. The repo-root
`.agents/skills/edit-svc-shared-docs` wrapper points coding Agents to the
canonical Hub-first edit and isolated ref-bump workflow.

`pnpm check` verifies generated contracts, formatting, lint, types,
the Registry packages, and the real Pyodide Worker build. To update an executable
contract intentionally:
`pnpm check` verifies generated contracts, formatting, lint, types, independently installable
packages, and Registry behavior with disposable PostgreSQL. Follow the [local development guide](docs/40-deployment/local-development.md)
to configure the test database. Regenerate an intentional contract change with these commands.

```bash
pnpm contracts:generate
Expand All @@ -42,7 +42,7 @@ Pull requests target protected `main`, preserve linear history, and include the
scope, verification evidence, risk, and rollback. CI and previews may publish
ephemeral evidence, but canonical packages and production deployment only come
from an exact successful current-`main` revision. Do not commit credentials,
local Wrangler state, generated dependency directories, or unrelated changes.
generated dependency directories, or unrelated changes.

Package release intent uses the ecosystem-native release tool:

Expand Down Expand Up @@ -74,8 +74,7 @@ Package publication runs static and generated-contract checks, then builds its
own release assets. The Registry database journey remains in repository CI; it
is not a dependency of Toolkit or Runtime publication.

Registry, Toolkit publication, Runtime publication and Cloudflare production changes are separate
privileged operations. Extension publishers install the independent
Registry production deployment, Toolkit publication, and Runtime publication are separate privileged operations. Extension publishers install the independent
`inkcre-extension-toolkit[cli]` distribution, prepare typed associations with
`inkcre-ext prepare-release`, use PDM/Twine for wheels or
`inkcre-ext upload-module-federation` for a native Remote snapshot, and publish
Expand Down
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ The public control plane and native Distribution host for InKCre Extensions —

`ext-reg` 是 InKCre 扩展的公共注册中心——负责扩展身份、Release 生命周期、发布者权威,以及 Python 包 / Module Federation Remote 的原生关联。

The public Registry origin is [`https://registry.inkcre.dev`](https://registry.inkcre.dev); its root page is a read-only Extension catalog. Python consumers use the Simple Repository API; browser consumers use the producer's native `mf-manifest.json`. Deployment installation, per-Peer enablement, and running state remain outside this repository.
The public Registry at [registry.inkcre.dev](https://registry.inkcre.dev) exposes an Extension catalog and publisher tooling. Python consumers use the Simple Repository API. Browser consumers use the producer's native `mf-manifest.json`. The info-base owns deployment Extension identity and each Peer owns its exact distribution selection and enablement intent.

The service runs as a Python Cloudflare Worker with D1 metadata and private R2 bytes.
Production runs the CPython Registry service on Heroku, with Neon PostgreSQL for metadata and private R2 storage for uploaded objects. See the [production runbook](docs/40-deployment/production-registry.md).

## Quickstart

Expand All @@ -15,19 +15,15 @@ The service runs as a Python Cloudflare Worker with D1 metadata and private R2 b
The independent `inkcre-extension-toolkit` developer/CD distribution exposes `inkcre-ext` for inspecting native artifacts, publishing Releases, and building deterministic static preview facades:

```bash
pip install 'inkcre-extension-toolkit[cli]'
python -m pip install 'inkcre-extension-toolkit[cli] @ https://github.com/InKCre/ext-reg/releases/download/toolkit-v0.5.0/inkcre_extension_toolkit-0.5.0-py3-none-any.whl'
inkcre-ext --help
```

### Develop locally
See the [GitHub Releases](https://github.com/InKCre/ext-reg/releases) for Toolkit wheel versions.

```bash
uv sync --frozen
pnpm install --frozen-lockfile
pnpm check
```
### Develop locally

`pnpm check` is the required local/CI gate. See [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow.
Use the [pinned PDM and pnpm setup](CONTRIBUTING.md) before running `pnpm check`. The [local development guide](docs/40-deployment/local-development.md) covers disposable PostgreSQL, migrations, and starting the service.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion docs/40-deployment/production-registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Heroku ACM 已为 `registry.inkcre.dev` 与 `*.inkcre.dev` 分别签发公开受

1. 明确来源 D1、目标 PostgreSQL、R2 桶、Heroku app、公开路由和获准变更窗口。先验证空库迁移、快照导入及整个发布流程;保存旧 Worker 版本与现有路由配置。
2. 暂停旧入口的发布写入并等待在途请求结束。本次使用 hostname 级临时 WAF 规则,拒绝 `registry.inkcre.dev` 的非 GET / HEAD / OPTIONS 请求,并实测规则生效;旧 Worker 的 workers.dev 和版本预览入口均关闭。停止 Web、Toolkit、CI publisher 等所有写入来源;只读分发可以继续。不要在旧入口仍接收写入时进行最终导入,也不要引入临时双写。
3. 使用 Wrangler 的 `d1 export <database> --remote --output <private-snapshot.sql>` 保存最终快照。来源 ID 显式传入,不从已删除的 Worker 配置猜测。限制快照文件权限;它包含凭据哈希和私有元数据。用 SQLite 将这份受信任导出转换成临时 SQLite 文件,执行完整性与外键检查。原始 token 从不进入快照。
3. 使用 `pnpm dlx wrangler@4.120.0 d1 export <database> --remote --output <private-snapshot.sql>` 保存最终快照。来源 ID 显式传入,不从已删除的 Worker 配置猜测。限制快照文件权限;它包含凭据哈希和私有元数据。用 SQLite 将这份受信任导出转换成临时 SQLite 文件,执行完整性与外键检查。原始 token 从不进入快照。
4. 对空目标运行 `pnpm db:migrate`,然后运行 `pdm run python -m inkcre_extension_registry.import_d1 <snapshot.sqlite>`。导入器拒绝非空目标,在同一事务中转换内部 ID 并核验每张表全部逻辑字段的规范化内容摘要;任何失败回滚全部导入。旧时间戳、空值、JSON、凭据哈希、release 状态及 R2 key 都参与比较。
5. 再运行同一命令并加 `--verify-only`。保存仅含行数和摘要的报告;抽查既有 wheel、Core Metadata、MF manifest / assets 的实际 R2 内容与公开身份。导入不移动、重写或公开 R2 对象。旧 `migrations/` 是来源 schema 历史,包内 Tortoise 迁移是新库 schema 历史。
6. 启动已验证镜像,先通过 app origin 验证只读目录、详情、私有认证和原生协议。预先完成 Heroku 域名及回源证书配置并校验证书与主机名,再移除 Worker Custom Domain、创建上述代理 CNAME。按 hostname 清除旧缓存,等待路由收敛,并验证缓存、ETag、GET / HEAD、Simple 内容协商及下载。再次导出旧 D1,确认隔离后摘要仍与导入来源相等,随后移除临时 WAF 写入暂停规则,恢复新服务的发布能力。
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@inkcre/ui-web": "github:InKCre/ui#4eceec4c60345a52a08545555ebce9ab95053beb&path:/packages/web",
"prettier": "3.6.2",
"sass": "1.94.2",
"typescript": "5.9.3",
"wrangler": "4.120.0"
"typescript": "5.9.3"
}
}
Loading