feat(#2170): split docs/ into its own meta-flake input
This commit is contained in:
parent
9b607e2857
commit
b5acd60cf5
5 changed files with 148 additions and 18 deletions
|
|
@ -3,6 +3,7 @@
|
|||
hyperhiveFrontend,
|
||||
hyperhiveAssets,
|
||||
hyperhiveFlake,
|
||||
hyperhiveDocs,
|
||||
agentBaseToplevel,
|
||||
managerToplevel,
|
||||
}:
|
||||
|
|
@ -39,6 +40,7 @@ let
|
|||
serveConfig = pkgs.writeText "hive-c0re-serve.json" (
|
||||
builtins.toJSON {
|
||||
hyperhive_flake = cfg.hyperhiveFlake;
|
||||
hyperhive_docs_flake = cfg.hyperhiveDocs;
|
||||
nixpkgs_flake = cfg.nixpkgsFlake;
|
||||
dashboard_port = cfg.dashboardPort;
|
||||
operator_pronouns = cfg.operatorPronouns;
|
||||
|
|
@ -558,6 +560,19 @@ in
|
|||
only override if you want agents tracking a different ref.
|
||||
'';
|
||||
};
|
||||
hyperhiveDocs = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = hyperhiveDocs;
|
||||
defaultText = lib.literalMD "the docs/ tree's own store path";
|
||||
description = ''
|
||||
URL of the narrow `docs/` source (no fragment). Inlined into the
|
||||
generated meta `flake.nix` at `inputs.hyperhive-docs.url` and
|
||||
threaded to each agent as `hyperhive.docs.source`, from which the
|
||||
harness resolves `$HIVE_DOCS_DIR`. Its own store path — separate
|
||||
from `hyperhiveFlake` — so a doc edit only re-locks this input
|
||||
instead of rebuilding every agent container.
|
||||
'';
|
||||
};
|
||||
nixpkgsFlake = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "path:${pkgs.path}";
|
||||
|
|
|
|||
|
|
@ -100,19 +100,21 @@ let
|
|||
iconPng = pkgs.runCommand "hive-agent-icon.png" { nativeBuildInputs = [ pkgs.librsvg ]; } ''
|
||||
rsvg-convert -f png -w 512 -h 512 ${config.hyperhive.icon} -o $out
|
||||
'';
|
||||
# hyperhive.docs.enable: the reference-docs tree (`pkgs.hyperhive-docs`,
|
||||
# the repo `docs/` verbatim) with a generic `CLAUDE.md` pointer dropped
|
||||
# at the root. The harness passes this dir to claude via `--add-dir`;
|
||||
# paired with `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` claude
|
||||
# loads `<dir>/CLAUDE.md` ADDITIVELY (alongside, never replacing, the
|
||||
# agent's own `~/.claude/CLAUDE.md`). The pointer prose lives in
|
||||
# hyperhive.docs.enable: the reference-docs tree (from
|
||||
# `config.hyperhive.docs.source` — the narrow `hyperhive-docs` meta-flake
|
||||
# input in a hive deployment, or `pkgs.hyperhive-docs` for standalone
|
||||
# builds) with a generic `CLAUDE.md` pointer dropped at the root. The
|
||||
# harness passes this dir to claude via `--add-dir`; paired with
|
||||
# `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` claude loads
|
||||
# `<dir>/CLAUDE.md` ADDITIVELY (alongside, never replacing, the agent's
|
||||
# own `~/.claude/CLAUDE.md`). The pointer prose lives in
|
||||
# `hive-ag3nt/prompts/docs-pointer.md` (prompts belong in prompts/, not
|
||||
# nix/) and is shipped via `hyperhive-assets`. `hyperhive-docs` itself
|
||||
# nix/) and is shipped via `hyperhive-assets`. The docs source itself
|
||||
# stays pure (no CLAUDE.md) so the website can reuse the same tree.
|
||||
# Lazy: only forced when `hyperhive.docs.enable` references it below.
|
||||
agentDocs = pkgs.runCommand "hyperhive-agent-docs" { } ''
|
||||
mkdir -p $out
|
||||
cp -r ${pkgs.hyperhive-docs}/. $out/
|
||||
cp -r ${config.hyperhive.docs.source}/. $out/
|
||||
chmod -R u+w $out
|
||||
cp ${pkgs.hyperhive-assets}/share/hyperhive/prompts/docs-pointer.md $out/CLAUDE.md
|
||||
'';
|
||||
|
|
@ -269,6 +271,22 @@ in
|
|||
elsewhere; any agent can flip it from its `agent.nix`.
|
||||
'';
|
||||
|
||||
options.hyperhive.docs.source = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = pkgs.hyperhive-docs;
|
||||
defaultText = lib.literalMD "`pkgs.hyperhive-docs` (built from `../docs`)";
|
||||
description = ''
|
||||
Store path of the reference-docs tree exposed at `$HIVE_DOCS_DIR`
|
||||
when `hyperhive.docs.enable` is set. Defaults to the overlay's
|
||||
`pkgs.hyperhive-docs` (the `nix/reference-docs.nix` build from
|
||||
`../docs`) so a standalone container build from a full checkout
|
||||
works unchanged. The generated meta flake overrides this with the
|
||||
narrow `hyperhive-docs` flake input so a doc edit only
|
||||
re-locks that input instead of rebuilding the container from a
|
||||
re-hashed `hyperhive` source.
|
||||
'';
|
||||
};
|
||||
|
||||
options.hyperhive.allowedBashPatterns = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
|
|
@ -1408,7 +1426,10 @@ in
|
|||
# `--add-dir` so the docs are readable; with
|
||||
# `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` claude also loads
|
||||
# the pointer additively, telling the agent the docs exist without
|
||||
# clobbering its own memory. See hive-ag3nt::turn.
|
||||
# clobbering its own memory. See hive-ag3nt::turn. The docs tree
|
||||
# itself comes from `hyperhive.docs.source` (the narrow
|
||||
# `hyperhive-docs` meta-flake input, or `pkgs.hyperhive-docs` for
|
||||
# standalone builds) via `agentDocs`.
|
||||
HIVE_DOCS_DIR = "${agentDocs}";
|
||||
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD = "1";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue