fix review: rename hive-knowledge → knowledge throughout, drop false re-clone claim from pull() doc
This commit is contained in:
parent
a176d675cf
commit
cfd677ae7d
2 changed files with 10 additions and 10 deletions
|
|
@ -56,7 +56,7 @@ const SHARED_ORG: &str = "internal";
|
|||
/// at `{FORGE_HTTP}/internal/docs.git`.
|
||||
const SHARED_DOCS_REPO: &str = "docs";
|
||||
/// The hive-wide knowledge repo inside `SHARED_ORG`. Bind-mounted
|
||||
/// read-only into every container at `/hive-knowledge`. Agents
|
||||
/// read-only into every container at `/knowledge`. Agents
|
||||
/// contribute by forking + opening PRs; direct writes to main are
|
||||
/// not granted. See `hive-c0re/src/knowledge.rs`.
|
||||
const KNOWLEDGE_REPO: &str = crate::knowledge::REPO;
|
||||
|
|
@ -611,7 +611,7 @@ pub async fn shared_docs_access(name: &str, core_token: &str) -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Ensure the `internal/hive-knowledge` repo exists. Called once at
|
||||
/// Ensure the `internal/knowledge` repo exists. Called once at
|
||||
/// startup after `ensure_org(SHARED_ORG)`. Idempotent — `ensure_org_repo`
|
||||
/// treats 409 as success.
|
||||
pub async fn ensure_knowledge_repo(core_token: &str) -> Result<()> {
|
||||
|
|
@ -619,7 +619,7 @@ pub async fn ensure_knowledge_repo(core_token: &str) -> Result<()> {
|
|||
}
|
||||
|
||||
/// Grant agent `name` read-only collaborator access to
|
||||
/// `internal/hive-knowledge`. Agents read documents from the bind-mounted
|
||||
/// `internal/knowledge`. Agents read documents from the bind-mounted
|
||||
/// clone and contribute by forking + opening PRs — no write to main.
|
||||
/// Idempotent: HTTP 204 (already a collaborator) is treated as success.
|
||||
pub async fn knowledge_access(name: &str, core_token: &str) -> Result<()> {
|
||||
|
|
@ -630,7 +630,7 @@ pub async fn knowledge_access(name: &str, core_token: &str) -> Result<()> {
|
|||
let status = forge_http(reqwest::Method::PUT, &url, core_token, body).await?;
|
||||
match status.as_u16() {
|
||||
204 => {
|
||||
tracing::info!(%name, "forge: granted hive-knowledge read access");
|
||||
tracing::info!(%name, "forge: granted knowledge read access");
|
||||
Ok(())
|
||||
}
|
||||
other => anyhow::bail!(
|
||||
|
|
@ -818,7 +818,7 @@ pub async fn sync_agent(name: &str, core_token: Option<&str>) {
|
|||
{
|
||||
tracing::warn!(%name, error = ?e, "forge: shared_docs_access failed");
|
||||
}
|
||||
// Grant read-only access to internal/hive-knowledge so the agent can
|
||||
// Grant read-only access to internal/knowledge so the agent can
|
||||
// read the bind-mounted knowledge repo and fork it to open PRs.
|
||||
if let Some(token) = core_token
|
||||
&& let Err(e) = knowledge_access(name, token).await
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
//! Hive-wide knowledge repository management.
|
||||
//!
|
||||
//! `internal/hive-knowledge` on the forge is cloned to
|
||||
//! `internal/knowledge` on the forge is cloned to
|
||||
//! [`LOCAL_DIR`] and bind-mounted read-only into every agent container
|
||||
//! at `/hive-knowledge`. Agents read documents from it directly and
|
||||
//! at `/knowledge`. Agents read documents from it directly and
|
||||
//! contribute by forking the repo and opening PRs — they never write
|
||||
//! to the bind-mounted path inside the container.
|
||||
//!
|
||||
|
|
@ -134,9 +134,9 @@ async fn seed_readme(core_token: &str) -> Result<()> {
|
|||
}
|
||||
|
||||
/// Pull the latest changes in the local clone. Called from the webhook
|
||||
/// handler on every push to `internal/hive-knowledge` main. Uses
|
||||
/// handler on every push to `internal/knowledge` main. Uses
|
||||
/// `--ff-only` so a force-push to the knowledge repo never wedges the
|
||||
/// local copy silently; an error triggers a re-clone fallback.
|
||||
/// local copy silently.
|
||||
pub async fn pull() -> Result<()> {
|
||||
// Sanity: if the clone is missing (e.g. storage was wiped), refuse
|
||||
// to pull and let the caller decide whether to re-clone.
|
||||
|
|
@ -148,7 +148,7 @@ pub async fn pull() -> Result<()> {
|
|||
.args(["-C", LOCAL_DIR, "pull", "--ff-only"])
|
||||
.output()
|
||||
.await
|
||||
.context("git pull hive-knowledge")?;
|
||||
.context("git pull knowledge")?;
|
||||
if out.status.success() {
|
||||
let stdout = String::from_utf8_lossy(&out.stdout).trim().to_owned();
|
||||
tracing::info!(result = %stdout, "knowledge: pull succeeded");
|
||||
|
|
|
|||
Loading…
Reference in a new issue