fix(#4): rename shared org from org-shared to internal
This commit is contained in:
parent
6044cd4d79
commit
9bd37d4df3
1 changed files with 7 additions and 7 deletions
|
|
@ -45,9 +45,9 @@ const CONFIG_ORG: &str = "agent-configs";
|
||||||
/// common reference without the operator having to bake content into
|
/// common reference without the operator having to bake content into
|
||||||
/// the system prompt or rely on `/shared`. Only the manager + operator
|
/// the system prompt or rely on `/shared`. Only the manager + operator
|
||||||
/// (i.e. `core` user) can push.
|
/// (i.e. `core` user) can push.
|
||||||
const SHARED_ORG: &str = "org-shared";
|
const SHARED_ORG: &str = "internal";
|
||||||
/// The shared docs repo inside `SHARED_ORG`. Cloneable by every agent
|
/// The shared docs repo inside `SHARED_ORG`. Cloneable by every agent
|
||||||
/// at `{FORGE_HTTP}/org-shared/docs.git`.
|
/// at `{FORGE_HTTP}/internal/docs.git`.
|
||||||
const SHARED_DOCS_REPO: &str = "docs";
|
const SHARED_DOCS_REPO: &str = "docs";
|
||||||
/// Forgejo orgs hive-c0re ensures on startup. The meta repo lives at
|
/// Forgejo orgs hive-c0re ensures on startup. The meta repo lives at
|
||||||
/// `core/meta` (the `core` user's own namespace — no org needed).
|
/// `core/meta` (the `core` user's own namespace — no org needed).
|
||||||
|
|
@ -540,14 +540,14 @@ pub async fn ensure_config_repo(name: &str) -> Result<()> {
|
||||||
ensure_org_repo(CONFIG_ORG, name, &token).await
|
ensure_org_repo(CONFIG_ORG, name, &token).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure the `org-shared/docs` repo exists. Called once at startup
|
/// Ensure the `internal/docs` repo exists. Called once at startup
|
||||||
/// after `ensure_org(SHARED_ORG)`. Idempotent — `ensure_org_repo`
|
/// after `ensure_org(SHARED_ORG)`. Idempotent — `ensure_org_repo`
|
||||||
/// treats 409 as success.
|
/// treats 409 as success.
|
||||||
pub async fn ensure_shared_docs_repo(core_token: &str) -> Result<()> {
|
pub async fn ensure_shared_docs_repo(core_token: &str) -> Result<()> {
|
||||||
ensure_org_repo(SHARED_ORG, SHARED_DOCS_REPO, core_token).await
|
ensure_org_repo(SHARED_ORG, SHARED_DOCS_REPO, core_token).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Grant agent `name` read-only collaborator access to `org-shared/docs`.
|
/// Grant agent `name` read-only collaborator access to `internal/docs`.
|
||||||
/// Idempotent: HTTP 204 (already a collaborator) is treated as success.
|
/// Idempotent: HTTP 204 (already a collaborator) is treated as success.
|
||||||
/// Mirrors `meta_read_access` so agents can clone the shared docs repo
|
/// Mirrors `meta_read_access` so agents can clone the shared docs repo
|
||||||
/// without authentication hassle.
|
/// without authentication hassle.
|
||||||
|
|
@ -575,7 +575,7 @@ pub async fn shared_docs_access(name: &str, core_token: &str) -> Result<()> {
|
||||||
])
|
])
|
||||||
.output()
|
.output()
|
||||||
.await
|
.await
|
||||||
.context("invoke curl PUT org-shared/docs/collaborators")?;
|
.context("invoke curl PUT internal/docs/collaborators")?;
|
||||||
let code = String::from_utf8_lossy(&out.stdout).trim().to_owned();
|
let code = String::from_utf8_lossy(&out.stdout).trim().to_owned();
|
||||||
match code.as_str() {
|
match code.as_str() {
|
||||||
"204" => {
|
"204" => {
|
||||||
|
|
@ -760,7 +760,7 @@ pub async fn sync_agent(name: &str, core_token: Option<&str>) {
|
||||||
if let Err(e) = ensure_meta_remote(name).await {
|
if let Err(e) = ensure_meta_remote(name).await {
|
||||||
tracing::warn!(%name, error = ?e, "forge: ensure_meta_remote failed");
|
tracing::warn!(%name, error = ?e, "forge: ensure_meta_remote failed");
|
||||||
}
|
}
|
||||||
// Grant read-only access to org-shared/docs so the agent can clone
|
// Grant read-only access to internal/docs so the agent can clone
|
||||||
// the operator-curated shared skills/runbook repo. Best-effort.
|
// the operator-curated shared skills/runbook repo. Best-effort.
|
||||||
if let Some(token) = core_token
|
if let Some(token) = core_token
|
||||||
&& let Err(e) = shared_docs_access(name, token).await
|
&& let Err(e) = shared_docs_access(name, token).await
|
||||||
|
|
@ -800,7 +800,7 @@ pub async fn ensure_all() {
|
||||||
if let Err(e) = ensure_repo("meta", token).await {
|
if let Err(e) = ensure_repo("meta", token).await {
|
||||||
tracing::warn!(error = ?e, "forge: ensure_repo core/meta failed");
|
tracing::warn!(error = ?e, "forge: ensure_repo core/meta failed");
|
||||||
}
|
}
|
||||||
// Seed the shared docs repo. org-shared is already in
|
// Seed the shared docs repo. internal is already in
|
||||||
// SEEDED_ORGS above so the org exists; ensure the repo itself.
|
// SEEDED_ORGS above so the org exists; ensure the repo itself.
|
||||||
if let Err(e) = ensure_shared_docs_repo(token).await {
|
if let Err(e) = ensure_shared_docs_repo(token).await {
|
||||||
tracing::warn!(error = ?e, "forge: ensure_shared_docs_repo failed");
|
tracing::warn!(error = ?e, "forge: ensure_shared_docs_repo failed");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue