@savvy-web/mcp 0.3.0 → 0.4.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.
Files changed (41) hide show
  1. package/README.md +1 -0
  2. package/bin/savvy-mcp.js +40 -146
  3. package/package.json +42 -80
  4. package/{resources → public}/content/manifest.json +175 -250
  5. package/public/content/standards/turbo/best-practices.md +76 -0
  6. package/public/content/standards/turbo/boundaries.md +72 -0
  7. package/public/content/standards/turbo/ci.md +69 -0
  8. package/public/content/standards/turbo/environment.md +64 -0
  9. package/public/content/standards/turbo/filtering.md +72 -0
  10. package/public/content/standards/turbo/watch.md +64 -0
  11. package/{resources → public}/content/tags.json +3 -1
  12. package/547.js +0 -416
  13. package/index.d.ts +0 -126
  14. package/index.js +0 -3
  15. package/tsdoc-metadata.json +0 -11
  16. /package/{resources → public}/content/_templates/guides.md +0 -0
  17. /package/{resources → public}/content/_templates/packages.md +0 -0
  18. /package/{resources → public}/content/_templates/standards.md +0 -0
  19. /package/{resources → public}/content/guides/api-docs-from-api-extractor.md +0 -0
  20. /package/{resources → public}/content/guides/building-a-github-action.md +0 -0
  21. /package/{resources → public}/content/guides/choosing-a-builder.md +0 -0
  22. /package/{resources → public}/content/guides/llm-friendly-json-schemas.md +0 -0
  23. /package/{resources → public}/content/packages/cli/command-tree.md +0 -0
  24. /package/{resources → public}/content/packages/cli/init-and-check.md +0 -0
  25. /package/{resources → public}/content/packages/mcp/resource-taxonomy.md +0 -0
  26. /package/{resources → public}/content/packages/rslib-builder/overview.md +0 -0
  27. /package/{resources → public}/content/packages/silk/export-map.md +0 -0
  28. /package/{resources → public}/content/packages/silk/install-and-setup.md +0 -0
  29. /package/{resources → public}/content/packages/silk-effects/index.md +0 -0
  30. /package/{resources → public}/content/packages/silk-effects/managed-section.md +0 -0
  31. /package/{resources → public}/content/packages/silk-effects/platform-layers.md +0 -0
  32. /package/{resources → public}/content/standards/api-model-pipeline.md +0 -0
  33. /package/{resources → public}/content/standards/catalog-usage.md +0 -0
  34. /package/{resources → public}/content/standards/changeset-discipline.md +0 -0
  35. /package/{resources → public}/content/standards/changeset-format.md +0 -0
  36. /package/{resources → public}/content/standards/commit-contract.md +0 -0
  37. /package/{resources → public}/content/standards/dependency-conventions.md +0 -0
  38. /package/{resources → public}/content/standards/linting-conventions.md +0 -0
  39. /package/{resources → public}/content/standards/publishability.md +0 -0
  40. /package/{resources → public}/content/standards/semver.md +0 -0
  41. /package/{resources → public}/content/standards/test-classification.md +0 -0
@@ -0,0 +1,76 @@
1
+ ---
2
+ id: standards/turbo/best-practices
3
+ title: Turborepo task-graph best practices
4
+ summary: dependsOn topology, transit tasks, declaring outputs, and the prebuild/parallel anti-patterns.
5
+ tier: standards
6
+ source: hand
7
+ tags: [turbo, build, workspace]
8
+ priority: 0.7
9
+ related: [standards/turbo/environment, standards/turbo/filtering, standards/dependency-conventions]
10
+ ---
11
+
12
+ ## ^build vs build in dependsOn
13
+
14
+ The caret matters and is the single most misread part of `dependsOn`:
15
+
16
+ - `"^build"` — run **build in this package's dependencies first** (topological).
17
+ This is what a normal build wants: `dist/dev` of upstream packages must exist
18
+ before this one compiles.
19
+ - `"build"` — run **another task in the same package first** (e.g. a `test` that
20
+ `dependsOn: ["build"]`). No caret means same-package only.
21
+
22
+ ```jsonc
23
+ {
24
+ "tasks": {
25
+ "build:prod": { "dependsOn": ["^build:prod"], "outputs": ["dist/prod/**"] },
26
+ "test": { "dependsOn": ["build"] }
27
+ }
28
+ }
29
+ ```
30
+
31
+ Mixing these up gives you either packages compiling against unbuilt dependencies
32
+ (forgot the caret) or a needless full-topology rebuild (added one you didn't
33
+ need).
34
+
35
+ ## Transit tasks for parallel-but-correct invalidation
36
+
37
+ A "transit" task is a near-empty task that exists only to carry dependency edges:
38
+ it declares `dependsOn: ["^transit"]` and no real work. Downstream tasks depend on
39
+ it so they invalidate when any upstream source changes, while the actual heavy
40
+ tasks still run in parallel rather than serializing behind each other. Use this
41
+ when you want correct cache invalidation across the graph without forcing a
42
+ strict topological chain through every real task.
43
+
44
+ ## Always declare outputs
45
+
46
+ If a task writes files but its `outputs` glob is missing or wrong, turbo caches
47
+ **nothing** to restore — the next "cache hit" replays the log but leaves the
48
+ working tree without the artifacts, and the following task fails on a missing
49
+ `dist/`. Every build task here declares its real output dir (`dist/dev/**`,
50
+ `dist/prod/**`, `meta/**`). The `build:catalog`/`build:meta` tasks are the
51
+ exceptions that are deliberately uncached.
52
+
53
+ ## Don't over-broaden globalDependencies
54
+
55
+ Listing a frequently-touched file (a top-level `README`, a changelog) in
56
+ `globalDependencies` busts every package's cache on every unrelated edit. Scope
57
+ shared inputs to the configs that genuinely affect output.
58
+
59
+ ## Avoid --parallel for ordered work
60
+
61
+ `--parallel` ignores `dependsOn` entirely and runs everything at once. It is only
62
+ correct for independent tasks (linting every package). Using it for builds races
63
+ dependencies and produces flaky, order-dependent failures — let the dependency
64
+ graph schedule instead.
65
+
66
+ ## prebuild lifecycle scripts defeat caching
67
+
68
+ npm `prebuild`/`postbuild` lifecycle scripts run **outside** turbo's hash and
69
+ ordering, so their effects are neither cached nor invalidated correctly. Silk
70
+ forbids build-in-install hooks for exactly this reason; keep every build step as
71
+ a named turbo task, not a lifecycle shim.
72
+
73
+ ## See also
74
+
75
+ Env-hash correctness is at `silk://standards/turbo/environment`. Dependency
76
+ declaration rules are at `silk://standards/dependency-conventions`.
@@ -0,0 +1,72 @@
1
+ ---
2
+ id: standards/turbo/boundaries
3
+ title: Turborepo boundaries
4
+ summary: Tags and allow/deny rules for enforcing package dependency layering.
5
+ tier: standards
6
+ source: hand
7
+ tags: [turbo, workspace, dependencies]
8
+ priority: 0.5
9
+ related: [standards/dependency-conventions, standards/turbo/best-practices]
10
+ ---
11
+
12
+ ## Rule
13
+
14
+ `turbo boundaries` enforces **who may depend on whom** by tagging packages and
15
+ declaring allow/deny rules between tags. It turns an architectural invariant —
16
+ "the CLI must not import silk," "mcp depends on neither cli nor silk" — into a
17
+ checked rule rather than a convention people remember.
18
+
19
+ ## Tagging packages
20
+
21
+ Tag each package in its `turbo.json` (or the package's `turbo` config):
22
+
23
+ ```jsonc
24
+ // packages/cli/turbo.json
25
+ { "tags": ["app"] }
26
+
27
+ // packages/silk-effects/turbo.json
28
+ { "tags": ["lib"] }
29
+ ```
30
+
31
+ ## Allow / deny rules
32
+
33
+ Declare the permitted dependency directions at the root:
34
+
35
+ ```jsonc
36
+ {
37
+ "boundaries": {
38
+ "tags": {
39
+ "app": { "dependencies": { "allow": ["lib"] } },
40
+ "lib": { "dependencies": { "deny": ["app"] } }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ Run the check with:
47
+
48
+ ```bash
49
+ turbo boundaries
50
+ ```
51
+
52
+ It fails when an import crosses a denied edge — catching, for example, a stray
53
+ `@savvy-web/silk` import inside `@savvy-web/cli` that would violate the cli↔silk
54
+ non-import invariant, or an attempt to import cli/silk from mcp.
55
+
56
+ ## Why encode it
57
+
58
+ The cli↔silk↔mcp non-import invariant is load-bearing: the three packages depend
59
+ only on silk-effects within the repo. A reviewer can miss a new import; a
60
+ boundaries rule cannot. Encoding the layering also documents intent — the tag
61
+ graph is the dependency policy, version-controlled next to the code.
62
+
63
+ ## Anti-patterns
64
+
65
+ Do not tag packages so loosely that every package can depend on every other —
66
+ that yields green checks with zero protection. Tag by architectural layer
67
+ (`app`, `lib`, `tooling`) so the deny rules actually constrain the graph.
68
+
69
+ ## See also
70
+
71
+ The underlying import rules are at `silk://standards/dependency-conventions`.
72
+ Graph-correctness practices are at `silk://standards/turbo/best-practices`.
@@ -0,0 +1,69 @@
1
+ ---
2
+ id: standards/turbo/ci
3
+ title: Turborepo in CI
4
+ summary: Remote caching, --affected, turbo prune, and turbo-ignore in the Silk install→build→checks pipeline.
5
+ tier: standards
6
+ source: hand
7
+ tags: [turbo, ci, github-actions, build]
8
+ priority: 0.6
9
+ related: [standards/turbo/filtering, standards/turbo/environment, standards/turbo/best-practices]
10
+ ---
11
+
12
+ ## Rule
13
+
14
+ CI runs tasks through `turbo`, never by hand-iterating packages. The Silk job
15
+ order is fixed: **install → build → checks**. Install (`pnpm install
16
+ --frozen-lockfile`) never builds — there are no `prepare` build scripts — so an
17
+ explicit `pnpm build` (turbo `build:dev` + `build:prod`) must run before any
18
+ check that imports a `@savvy-web/*` package, because consumers resolve the built
19
+ `dist/dev` via `linkDirectory`.
20
+
21
+ ## Remote caching
22
+
23
+ Set `TURBO_TOKEN` and `TURBO_TEAM` in the job environment. With those present,
24
+ `turbo` reads and writes the remote cache automatically. In CI use
25
+ `--remote-only` so the run never trusts a stale local `.turbo` directory that a
26
+ runner image might carry:
27
+
28
+ ```bash
29
+ turbo run build --remote-only
30
+ turbo run lint test typecheck --remote-only
31
+ ```
32
+
33
+ A populated remote cache turns a no-change `build:prod` into a restore, which is
34
+ what makes the `build:prod → generate:api-docs → build:catalog → build` chain
35
+ cheap on unaffected PRs.
36
+
37
+ ## Only build what changed
38
+
39
+ Use `--affected` to scope a run to packages touched since the merge base. Turbo
40
+ auto-detects the base/head refs in GitHub Actions; locally pass them explicitly:
41
+
42
+ ```bash
43
+ turbo run test --affected
44
+ turbo run test --affected --filter=...[origin/main...HEAD] # explicit refs
45
+ ```
46
+
47
+ Pair this with a full-history checkout (`fetch-depth: 0` or a known base ref) so
48
+ the diff is accurate. A shallow clone makes `--affected` over-select.
49
+
50
+ ## Docker and skipping runs
51
+
52
+ For container builds, `turbo prune <pkg> --docker` emits a pruned subset
53
+ (`out/json` lockfile layer + `out/full` source layer) so the image only installs
54
+ and builds that package's slice — keep the two layers separate to preserve Docker
55
+ layer caching. To skip an entire workflow when nothing relevant changed, gate the
56
+ job on `turbo-ignore`, which exits non-zero only when the target package (and its
57
+ dependencies) changed.
58
+
59
+ ## Anti-patterns
60
+
61
+ Do not build inside an install hook to "warm" CI — mcp's `build:dev` pulls the
62
+ libraries' `build:prod`, which resolves `catalog:silkPeers` from the workspace
63
+ state file pnpm writes only after install scripts, so an install-time build fails
64
+ with `Catalog(s) not found: silkPeers`. Keep build a post-install turbo step.
65
+
66
+ ## See also
67
+
68
+ Scoping syntax is at `silk://standards/turbo/filtering`. Cache-correct env
69
+ declarations are at `silk://standards/turbo/environment`.
@@ -0,0 +1,64 @@
1
+ ---
2
+ id: standards/turbo/environment
3
+ title: Turborepo environment hashing
4
+ summary: env/globalEnv, passThroughEnv, globalDependencies, and why missing declarations corrupt the cache.
5
+ tier: standards
6
+ source: hand
7
+ tags: [turbo, ci, build]
8
+ priority: 0.7
9
+ related: [standards/turbo/best-practices, standards/turbo/ci]
10
+ ---
11
+
12
+ ## Rule
13
+
14
+ Any environment variable that changes a task's **output** must be declared in
15
+ that task's `env`, or the cache will hand back output built under a different
16
+ value. Turbo only hashes env vars you declare; an undeclared var is invisible to
17
+ the cache and is the most common source of "it worked on my machine, the cache
18
+ gave me stale bytes" bugs.
19
+
20
+ ## env vs globalEnv
21
+
22
+ - `env` (per task): vars that affect that task's output — e.g. `NODE_ENV` for a
23
+ build, registry tokens for a publish step.
24
+ - `globalEnv` (root `pipeline`/`globalEnv`): vars that affect **every** task's
25
+ hash. Use sparingly; an over-broad `globalEnv` busts every cache entry whenever
26
+ it changes.
27
+
28
+ ```jsonc
29
+ {
30
+ "globalEnv": ["NODE_ENV"],
31
+ "tasks": {
32
+ "build:prod": { "env": ["TURBO_TOKEN", "TURBO_TEAM"], "outputs": ["dist/prod/**"] }
33
+ }
34
+ }
35
+ ```
36
+
37
+ ## passThroughEnv
38
+
39
+ `passThroughEnv` / `globalPassThroughEnv` make a var **available to the task
40
+ process without adding it to the hash**. Use it for things that must reach the
41
+ process but must not invalidate the cache — e.g. `GITHUB_TOKEN` during a
42
+ network-only step. Pass-through is the deliberate escape hatch; reaching for it
43
+ to hide a genuine input is how you reintroduce the stale-cache bug.
44
+
45
+ ## globalDependencies
46
+
47
+ `globalDependencies` lists files outside any package whose contents should feed
48
+ every task hash — `tsconfig.base.json`, the root `biome.jsonc`, `.nvmrc`. When a
49
+ shared config changes, every cache entry should miss; that only happens if the
50
+ file is declared here.
51
+
52
+ ## The root .env anti-pattern
53
+
54
+ Turbo does not read a root `.env` into task hashes. A var set only in `.env`
55
+ silently changes output while the hash stays constant, so the cache returns bytes
56
+ built under the old value. If a value must affect a build, declare it in `env`
57
+ and let CI inject it — do not rely on a loose `.env`. Silk's install and build
58
+ are decoupled, so there is no install hook quietly sourcing env either; CI sets
59
+ exactly what each task declares.
60
+
61
+ ## See also
62
+
63
+ The anti-pattern catalog is at `silk://standards/turbo/best-practices`.
64
+ Remote-cache env wiring is at `silk://standards/turbo/ci`.
@@ -0,0 +1,72 @@
1
+ ---
2
+ id: standards/turbo/filtering
3
+ title: Turborepo task filtering
4
+ summary: --filter syntax, dependency/dependent expansion, changed-since filters, and --affected.
5
+ tier: standards
6
+ source: hand
7
+ tags: [turbo, workspace, build]
8
+ priority: 0.6
9
+ related: [standards/turbo/ci, standards/turbo/best-practices]
10
+ ---
11
+
12
+ ## Rule
13
+
14
+ `--filter` selects which packages a task runs in. Stack filters (each `--filter`
15
+ is a union) and lean on the dependency-expansion operators so you never have to
16
+ list packages by hand.
17
+
18
+ ## Package selectors
19
+
20
+ ```bash
21
+ turbo run build --filter=@savvy-web/mcp # one package
22
+ turbo run build --filter='./packages/*' # by directory glob
23
+ turbo run build --filter='@savvy-web/*' # by name glob
24
+ ```
25
+
26
+ ## Dependency / dependent expansion
27
+
28
+ The `...` operator pulls in the rest of the graph relative to a package:
29
+
30
+ | Selector | Meaning |
31
+ | :--- | :--- |
32
+ | `@savvy-web/mcp...` | mcp **and everything it depends on** |
33
+ | `...@savvy-web/mcp` | mcp **and everything that depends on it** |
34
+ | `...@savvy-web/silk-effects...` | the package plus dependents and dependencies |
35
+ | `@savvy-web/mcp^...` | mcp's dependencies only (exclude mcp itself) |
36
+
37
+ `...@savvy-web/silk-effects` is the practical way to rebuild the four libraries'
38
+ downstream consumers (cli, silk, mcp) after a shared-library edit, without
39
+ naming each one.
40
+
41
+ ## Changed-since filters
42
+
43
+ `[<git-ref>]` restricts to packages changed since a ref, and composes with `...`:
44
+
45
+ ```bash
46
+ turbo run test --filter='[origin/main]' # changed vs main
47
+ turbo run test --filter='...[origin/main...HEAD]' # changed + their dependents
48
+ turbo run build --filter='@savvy-web/mcp[HEAD^1]' # mcp, only if it changed
49
+ ```
50
+
51
+ ## --affected
52
+
53
+ `--affected` is the ergonomic shorthand for "changed vs the merge base, plus
54
+ dependents," with the base/head auto-detected in CI:
55
+
56
+ ```bash
57
+ turbo run lint test typecheck --affected
58
+ ```
59
+
60
+ Prefer `--affected` in CI and reserve explicit `[<ref>]` filters for cases where
61
+ you need a non-default base. Both need real git history — a shallow checkout
62
+ over-selects.
63
+
64
+ ## Anti-patterns
65
+
66
+ Do not chain `cd packages/foo && pnpm build` to scope a build; you lose turbo's
67
+ cache and topological ordering. Use `--filter` so dependencies still build first
68
+ and cache hits still count.
69
+
70
+ ## See also
71
+
72
+ Using filters in CI is at `silk://standards/turbo/ci`.
@@ -0,0 +1,64 @@
1
+ ---
2
+ id: standards/turbo/watch
3
+ title: Turborepo watch and persistent tasks
4
+ summary: turbo watch, persistent/dev tasks, interactive tasks, and watch-mode caveats.
5
+ tier: standards
6
+ source: hand
7
+ tags: [turbo, build, workspace]
8
+ priority: 0.5
9
+ related: [standards/turbo/best-practices, standards/turbo/filtering]
10
+ ---
11
+
12
+ ## Rule
13
+
14
+ `turbo watch <task>` re-runs a task across the workspace whenever its inputs
15
+ change, respecting the dependency graph — an edit in a library re-triggers its
16
+ dependents in topological order. This is distinct from a framework's own watcher:
17
+ turbo watch coordinates the **graph**, the per-package tool handles incremental
18
+ recompilation inside one package.
19
+
20
+ ```bash
21
+ turbo watch build:dev # rebuild dev artifacts on change, in dep order
22
+ turbo watch test --filter=@savvy-web/mcp...
23
+ ```
24
+
25
+ ## Persistent (dev) tasks
26
+
27
+ A long-running process — a dev server, a `tsc --watch`, a sidecar — is a
28
+ **persistent** task. Mark it so turbo never treats its exit as task completion
29
+ and never tries to cache it:
30
+
31
+ ```jsonc
32
+ {
33
+ "tasks": {
34
+ "dev": { "persistent": true, "cache": false }
35
+ }
36
+ }
37
+ ```
38
+
39
+ A persistent task may not appear in another task's `dependsOn` (it never
40
+ finishes, so nothing downstream could ever start). Model a needed background
41
+ service as a separate persistent task you start alongside, not as a dependency
42
+ edge.
43
+
44
+ ## Interactive tasks
45
+
46
+ Tasks that need a TTY (prompts, REPLs) must opt in with `"interactive": true` so
47
+ turbo gives them stdin and does not multiplex their output. Reserve this for
48
+ genuinely interactive tooling; most CI tasks should stay non-interactive so logs
49
+ stream cleanly.
50
+
51
+ ## Caveats
52
+
53
+ - Watch mode shines for iteration, not validation. CI still runs discrete
54
+ `turbo run` tasks so every step is hashed and cacheable.
55
+ - Newly added or deleted files may need a watcher restart if a tool's own
56
+ watcher does not pick up tree changes.
57
+ - `cache: false` on persistent tasks is required; a cached "dev server" is
58
+ meaningless and turbo will warn.
59
+
60
+ ## See also
61
+
62
+ The persistent-task / `dependsOn` interaction is covered under outputs and
63
+ parallelism at `silk://standards/turbo/best-practices`. Scoping watch to a subset
64
+ uses the syntax at `silk://standards/turbo/filtering`.
@@ -23,5 +23,7 @@
23
23
  "github-action-effects": ["gha-effects"],
24
24
  "github-action-builder": ["gha-builder"],
25
25
  "semver": ["versioning"],
26
- "github-actions": ["gha", "actions"]
26
+ "github-actions": ["gha", "actions"],
27
+ "turbo": ["turborepo"],
28
+ "ci": ["continuous-integration", "remote-cache"]
27
29
  }