Skip to content

Commit d59b02c

Browse files
authored
v0.8.14: files finder, internal routes removal, tools audit, usage tab
2 parents a042b8f + 4b9c3b7 commit d59b02c

3,011 files changed

Lines changed: 196161 additions & 134234 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/add-block/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,10 @@ After creating the block, you MUST validate it against every tool it references:
10521052
4. **Verify conditions** — each subBlock should only show for the operations that actually use it
10531053
5. **Verify `{Service}BlockMeta` is exported** with at least 7 templates, each having `icon`, `title`, `prompt`, `modules`, `category`, and `tags`
10541054
6. **If any tool outputs are still unknown**, explicitly tell the user instead of guessing block outputs
1055+
7. **Verify the tool execution boundary** — blocks never create or call API routes. Every referenced
1056+
tool must already be either a registered `InternalToolConfig.operation` or an absolute external
1057+
HTTP(S) `ToolConfig.request`. If transport needs to change, use the `add-tools` skill; do not add a
1058+
same-origin `/api/...` hop from the block.
10551059

10561060
## Option Lists: `selectorKey` or `options`, never a per-block fetcher
10571061

.agents/skills/add-feature-flag/SKILL.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
name: add-feature-flag
3-
description: Add a runtime feature flag (AppConfig-backed on prod, secret fallback off-prod), global by default or optionally gated by org id, user id, or platform admin
3+
description: Add a runtime feature flag (AppConfig-backed on prod, secret fallback off-prod), global by default or optionally gated by workspace id, org id, user id, or platform admin
44
argument-hint: <flag-name>
55
---
66

77
# Add Feature Flag Skill
88

9-
You add a **runtime feature flag** to Sim that can change on prod with no redeploy (AWS AppConfig). Prefer a global on/off flag unless the rollout actually needs per-organization, per-user, or platform-admin targeting. When AppConfig isn't the source of truth, the flag falls back to a single **secret** (on/off only).
9+
You add a **runtime feature flag** to Sim that can change on prod with no redeploy (AWS AppConfig). Prefer a global on/off flag unless the rollout actually needs per-workspace, per-organization, per-user, or platform-admin targeting. When AppConfig isn't the source of truth, the flag falls back to a single **secret** (on/off only).
1010

1111
## When to use this vs `env-flags.ts`
1212

13-
- **Feature flag** (`@/lib/core/config/feature-flags.ts`): runtime global on/off by default, optionally scoped by `userId`/`orgId`/admin. This skill.
13+
- **Feature flag** (`@/lib/core/config/feature-flags.ts`): runtime global on/off by default, optionally scoped by `workspaceId`/`userId`/`orgId`/admin. This skill.
1414
- **Env flag** (`@/lib/core/config/env-flags.ts`): deploy-time capability/environment detection (`isProd`, `isHosted`, `isBillingEnabled`). A module-load boolean. **Do not add gated flags here.**
1515

1616
If the user wants a fixed per-deployment toggle, send them to `env-flags.ts` instead.
@@ -21,10 +21,11 @@ A flag's **gating rule lives only in the hosted AppConfig document**. It is ON f
2121

2222
```ts
2323
interface FeatureFlagRule {
24-
enabled?: boolean // global default for everyone
25-
orgIds?: string[] // allowlisted organization ids
26-
userIds?: string[] // allowlisted user ids
27-
adminEnabled?: boolean // platform admins (user.role === 'admin')
24+
enabled?: boolean // global default for everyone
25+
workspaceIds?: string[] // allowlisted workspace ids
26+
orgIds?: string[] // allowlisted organization ids
27+
userIds?: string[] // allowlisted user ids
28+
adminEnabled?: boolean // platform admins (user.role === 'admin')
2829
}
2930
```
3031

@@ -34,10 +35,10 @@ Critically, **none of this is expressible in code** — gating (especially `admi
3435

3536
1. **Confirm the granularity before editing code.** If the user has not already specified it, stop and ask:
3637

37-
> Should `<flag-name>` be a global on/off flag (recommended), or does it need rollout targeting by organization, user, and/or platform admin?
38+
> Should `<flag-name>` be a global on/off flag (recommended), or does it need rollout targeting by workspace, organization, user, and/or platform admin?
3839
39-
- Recommend **global**. Do not infer scoped gating merely because the call site already has a user or organization id.
40-
- If the user chooses scoped gating but does not name the dimensions, ask which of organization, user, and platform admin it needs. Wire only the selected dimensions.
40+
- Recommend **global**. Do not infer scoped gating merely because the call site already has a workspace, user, or organization id.
41+
- If the user chooses scoped gating but does not name the dimensions, ask which of workspace, organization, user, and platform admin it needs. Wire only the selected dimensions.
4142
- If the user wants a fixed per-deployment toggle rather than a runtime AppConfig flag, use `env-flags.ts` instead.
4243

4344
2. **Define the flag.** Add one entry to the `FEATURE_FLAGS` registry in `apps/sim/lib/core/config/feature-flags.ts`. Each entry is the flag's whole definition — name (kebab-case key), `description`, and the `fallback` secret consulted when AppConfig isn't the source of truth (truthy ⇒ on globally):
@@ -51,7 +52,7 @@ Critically, **none of this is expressible in code** — gating (especially `admi
5152
}
5253
```
5354

54-
`fallback` is the env/secret key (typed as `keyof typeof env`), so add `<FLAG_SECRET>` to `apps/sim/lib/core/config/env.ts` first (and the deployment's secret store) — it won't typecheck otherwise. Do **not** add org/user/admin defaults here — that gating exists only in AppConfig. Adding the entry makes `<flag-name>` a valid `FeatureFlagName`.
55+
`fallback` is the env/secret key (typed as `keyof typeof env`), so add `<FLAG_SECRET>` to `apps/sim/lib/core/config/env.ts` first (and the deployment's secret store) — it won't typecheck otherwise. Do **not** add workspace/org/user/admin defaults here — that gating exists only in AppConfig. Adding the entry makes `<flag-name>` a valid `FeatureFlagName`.
5556

5657
3. **Gate the call site at the chosen granularity.** For the recommended global mode, pass no context:
5758

@@ -70,17 +71,17 @@ Critically, **none of this is expressible in code** — gating (especially `admi
7071
```ts
7172
import { isFeatureEnabled } from '@/lib/core/config/feature-flags'
7273

73-
if (await isFeatureEnabled('<flag-name>', { userId, orgId })) {
74+
if (await isFeatureEnabled('<flag-name>', { workspaceId, userId, orgId })) {
7475
// gated behavior
7576
}
7677
```
7778

78-
- Organization targeting uses `orgId`; user and platform-admin targeting require `userId`.
79+
- Workspace targeting uses `workspaceId`; organization targeting uses `orgId`; user and platform-admin targeting require `userId`.
7980
- Missing ids are fine — a clause with no matching id is skipped; with no `userId`, the admin clause resolves to `false` without a DB read.
8081
- Admin routes that already know the caller is an admin may pass `{ userId, isAdmin: true }` to skip the role lookup.
8182
- **Client/UI flags:** resolve server-side (in a server component, route, or loader) and pass the boolean down as a prop. There is no client AppConfig.
8283

83-
4. **(Prod) configure in AppConfig.** The infra `feature-flags` profile schema is permissive, so a new flag needs **no infra change**. Operators add the flag to the hosted `feature-flags` document using `enabled` for global rollout or only the selected `orgIds`/`userIds`/`adminEnabled` clauses for scoped rollout, then start a `sim-<env>-fast` deployment (see the AppConfig runbook in the infra README — same flow as `access-control`). The fallback secret only applies when AppConfig is disabled.
84+
4. **(Prod) configure in AppConfig.** The infra `feature-flags` profile schema is permissive, so a new flag needs **no infra change**. Operators add the flag to the hosted `feature-flags` document using `enabled` for global rollout or only the selected `workspaceIds`/`orgIds`/`userIds`/`adminEnabled` clauses for scoped rollout, then start a `sim-<env>-fast` deployment (see the AppConfig runbook in the infra README — same flow as `access-control`). The fallback secret only applies when AppConfig is disabled.
8485

8586
5. **Test.** Add a case to `apps/sim/lib/core/config/feature-flags.test.ts` that matches the chosen granularity. For a global flag, exercise `isFeatureEnabled('<flag-name>')` with an AppConfig `enabled` rule and toggle the fallback secret for the off-AppConfig path. For scoped rollout, cover only the selected clauses and mock `isPlatformAdmin` when testing `adminEnabled`.
8687

@@ -90,6 +91,6 @@ Critically, **none of this is expressible in code** — gating (especially `admi
9091

9192
- Flag keys are `kebab-case`.
9293
- Never read flags via raw `fetch` or a new AppConfig client — always go through `isFeatureEnabled` / `getFeatureFlags`.
93-
- Never bake gating into code. The fallback is a single boolean secret; org/user/admin scoping is AppConfig-only.
94+
- Never bake gating into code. The fallback is a single boolean secret; workspace/org/user/admin scoping is AppConfig-only.
9495
- Never add or propagate request context unless the user chose scoped rollout.
9596
- The admin check reads the DB **replica** (`dbReplica`) and is resolved lazily, so an admin-gated flag adds at most one cheap replica read, and only when `adminEnabled` is the deciding clause.

0 commit comments

Comments
 (0)