@biffo/cli 0.337.0 → 0.338.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.
@@ -176,6 +176,13 @@ jobs:
176
176
  # invokes `uv run --no-sync`, i.e. it expects a synced .venv, not a
177
177
  # fresh one) and because biffo.plugin.json's own tables/permissions
178
178
  # are exactly what the harness conforms against.
179
+ # The manifest's ingress `required_group`s are `setting:` references
180
+ # (biffo-template#1517): verify fails closed unless the instance-
181
+ # supplied values exist, exactly as `biffo plugin install` does, so
182
+ # supply stand-ins here (placeholders — never a real instance's groups).
183
+ env:
184
+ BIFFO_PLUGIN_EXAMPLE_PLUGIN_FOUNDER_GROUP: founder
185
+ BIFFO_PLUGIN_EXAMPLE_PLUGIN_ADMIN_GROUP: admin
179
186
  run: sh scripts/biffo.sh plugin verify
180
187
  - uses: codecov/codecov-action@v5
181
188
  if: always()
@@ -138,10 +138,17 @@ in `biffo.plugin.json`:
138
138
  ```json
139
139
  "user_frontend": {
140
140
  "dir": "web/dist",
141
- "required_group": "founder"
141
+ "required_group": "setting:founder_group"
142
142
  }
143
143
  ```
144
144
 
145
+ `required_group` is a **reference**, not a group name: `setting:<name>` names a
146
+ `kind: "setting"` entry in the manifest's `config:` list, which the instance
147
+ supplies at install time (`biffo plugin install --config founder_group=<group>`)
148
+ and the shared host resolves per plugin. The same form applies to
149
+ `user_ingress` and `admin_ingress`. A literal group name still validates but is
150
+ deprecated (the SDK emits a `LegacyRequiredGroupWarning`).
151
+
145
152
  and ships **`web/` and nothing else** — a built static bundle (`index.html`
146
153
  plus hashed `assets/*`, the ordinary Vite build-output shape) at the
147
154
  repo-relative path `dir` names. That is the entire contract. In particular a
@@ -90,16 +90,30 @@
90
90
  "dependencies": {
91
91
  "biffo-plugin-sdk": "^1.0"
92
92
  },
93
+ "config": [
94
+ {
95
+ "name": "founder_group",
96
+ "kind": "setting",
97
+ "required": true,
98
+ "description": "Cognito group allowed on the user ingress and the user frontend. Supplied by the instance at install time (e.g. --config founder_group=<group>)."
99
+ },
100
+ {
101
+ "name": "admin_group",
102
+ "kind": "setting",
103
+ "required": true,
104
+ "description": "Cognito group allowed on the admin ingress. Supplied by the instance at install time (e.g. --config admin_group=<group>)."
105
+ }
106
+ ],
93
107
  "user_ingress": {
94
- "required_group": "founder",
108
+ "required_group": "setting:founder_group",
95
109
  "app": "example_plugin.user_app:app"
96
110
  },
97
111
  "admin_ingress": {
98
- "required_group": "admin",
112
+ "required_group": "setting:admin_group",
99
113
  "app": "example_plugin.admin_app:app"
100
114
  },
101
115
  "user_frontend": {
102
116
  "dir": "web/dist",
103
- "required_group": "founder"
117
+ "required_group": "setting:founder_group"
104
118
  }
105
119
  }
@@ -38,24 +38,42 @@ def _resolve_app(app_ref: str) -> FastAPI:
38
38
  return getattr(module, attr)
39
39
 
40
40
 
41
+ class TestRequiredGroupsAreSettingReferences:
42
+ """Every surface's `required_group` names a declared `kind: setting` config
43
+ entry (biffo-template#1517) — never a literal Cognito group baked into the
44
+ manifest. `PluginManifest` already rejects a dangling/non-setting reference
45
+ (and warns on a literal); this pins that the skeleton uses the setting form.
46
+ """
47
+
48
+ def test_no_surface_carries_a_literal_group(self) -> None:
49
+ manifest = load_manifest(MANIFEST_PATH)
50
+ settings = {c.name for c in manifest.config if c.kind == "setting"}
51
+ for surface in (manifest.user_ingress, manifest.admin_ingress, manifest.user_frontend):
52
+ assert surface is not None
53
+ # Plain string handling, not an SDK helper: the skeleton's locked SDK
54
+ # may predate the helper (the pin is raised separately, #2168).
55
+ assert surface.required_group.startswith("setting:"), surface.required_group
56
+ assert surface.required_group.removeprefix("setting:") in settings
57
+
58
+
41
59
  class TestManifestDeclaresAllThreeSurfaces:
42
60
  def test_manifest_validates_and_declares_user_ingress(self) -> None:
43
61
  manifest = load_manifest(MANIFEST_PATH)
44
62
  assert manifest.user_ingress is not None
45
- assert manifest.user_ingress.required_group == "founder"
63
+ assert manifest.user_ingress.required_group == "setting:founder_group"
46
64
  assert manifest.user_ingress.app == "example_plugin.user_app:app"
47
65
 
48
66
  def test_manifest_declares_admin_ingress(self) -> None:
49
67
  manifest = load_manifest(MANIFEST_PATH)
50
68
  assert manifest.admin_ingress is not None
51
- assert manifest.admin_ingress.required_group == "admin"
69
+ assert manifest.admin_ingress.required_group == "setting:admin_group"
52
70
  assert manifest.admin_ingress.app == "example_plugin.admin_app:app"
53
71
 
54
72
  def test_manifest_declares_user_frontend(self) -> None:
55
73
  manifest = load_manifest(MANIFEST_PATH)
56
74
  assert manifest.user_frontend is not None
57
75
  assert manifest.user_frontend.dir == "web/dist"
58
- assert manifest.user_frontend.required_group == "founder"
76
+ assert manifest.user_frontend.required_group == "setting:founder_group"
59
77
 
60
78
  def test_ui_components_no_longer_point_at_a_dead_admin_path(self) -> None:
61
79
  """The old `/admin/example-plugin` paths matched none of the three real
package/dist/index.js CHANGED
@@ -6800,6 +6800,10 @@ var RouteDefSchema = z6.object({
6800
6800
  }
6801
6801
  });
6802
6802
  var REL_DIR = /^[\w][\w./-]*$/;
6803
+ var SETTING_REF_PREFIX = "setting:";
6804
+ function parseSettingRef(value) {
6805
+ return value.startsWith(SETTING_REF_PREFIX) ? value.slice(SETTING_REF_PREFIX.length).trim() : null;
6806
+ }
6803
6807
  var NON_EMPTY_GROUP = "required_group must be a non-empty Cognito group name.";
6804
6808
  var APP_REF = /^[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*:[a-zA-Z_]\w*$/;
6805
6809
  var UserIngressSchema = z6.object({
@@ -6915,6 +6919,23 @@ var PluginManifestSchema = z6.object({
6915
6919
  const settingNames = new Set(
6916
6920
  manifest.config.filter((c) => c.kind === "setting").map((c) => c.name)
6917
6921
  );
6922
+ const configKinds = new Map(manifest.config.map((c) => [c.name, c.kind]));
6923
+ const surfaces = [
6924
+ ["user_ingress", manifest.user_ingress],
6925
+ ["admin_ingress", manifest.admin_ingress],
6926
+ ["user_frontend", manifest.user_frontend]
6927
+ ];
6928
+ for (const [label, surface] of surfaces) {
6929
+ const ref = surface ? parseSettingRef(surface.required_group) : null;
6930
+ if (ref === null) continue;
6931
+ const kind = configKinds.get(ref);
6932
+ if (kind !== "setting") {
6933
+ ctx.addIssue({
6934
+ code: z6.ZodIssueCode.custom,
6935
+ message: `${label}.required_group '${surface.required_group}' references config entry '${ref}', which ${kind === void 0 ? "this manifest does not declare" : `is kind '${kind}', not "setting"`}. Declared setting config names: ${[...settingNames].sort().join(", ") || "none"}`
6936
+ });
6937
+ }
6938
+ }
6918
6939
  for (const agent of manifest.chat_agents) {
6919
6940
  if (!settingNames.has(agent.required_group)) {
6920
6941
  ctx.addIssue({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.337.0",
3
+ "version": "0.338.0",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",