Skip to content

WIP: --local project-scoped age gating#2

Draft
SmileyChris wants to merge 1 commit into
mainfrom
local-flag
Draft

WIP: --local project-scoped age gating#2
SmileyChris wants to merge 1 commit into
mainfrom
local-flag

Conversation

@SmileyChris
Copy link
Copy Markdown
Member

Fixes #1.

Status: WIP / draft.

What

gestate set <days> --local writes each tool's native, committed-to-repo config in the current directory, so the minimum-release-age gate travels with the project and applies to anyone who clones it — including collaborators who never ran gestate. revert --local removes it.

This replaces the earlier .gestate.toml approach (an inert marker that gestate wrote and read, but no tool honored — so it enforced nothing).

Tool Project file (cwd) Key (unit)
npm .npmrc min-release-age (days)
pnpm pnpm-workspace.yaml minimumReleaseAge (minutes)
yarn .yarnrc.yml npmMinimalAgeGate (minutes)
bun bunfig.toml [install] minimumReleaseAge (seconds)
deno deno.json minimumDependencyAge (P<N>D)
uv uv.toml exclude-newer ("N days")

Behavior

  • Detection — only configures tools the repo gives evidence of (lockfile, manifest, or existing tool config). Won't litter a JS repo with uv.toml or a Python repo with bunfig.toml.
  • pip skipped — no per-project config exists, and no dependency-age gate.
  • Comment-safe.npmrc/YAML edits are line-based (preserve layout). A deno.json with comments (JSONC) is left untouched; gestate prints the line to add.
  • revert --local removes the key and deletes any file it leaves empty, preserving foreign content.
  • set --local --all is rejected (previously --all was silently ignored).

Tests

local.py rewritten with full coverage (formats, round-trips, detection, revert, JSONC fallback) plus CLI-level apply_local/revert_local tests. Full suite green (95), ruff clean.

Open questions / follow-ups (not in this PR)

  • Bare gestate now renders a "Project settings" table, but the pre-existing no-TTY guard means it only shows in a real terminal — verified the path, not integration-tested.
  • Separate from this PR: the global pip path uses global.uploaded-prior-to, which research suggests isn't a real pip config key. If so, global set silently no-ops for pip. Worth verifying independently.

Replace the inert .gestate.toml marker (written and read by gestate but
honored by no tool) with config the package managers actually enforce.

`set <days> --local` now writes each tool's committed-to-repo config in the
current directory, so the gate travels with the project and applies to
collaborators who never ran gestate:

  npm  -> .npmrc               min-release-age (days)
  pnpm -> pnpm-workspace.yaml  minimumReleaseAge (minutes)
  yarn -> .yarnrc.yml          npmMinimalAgeGate (minutes)
  bun  -> bunfig.toml          [install] minimumReleaseAge (seconds)
  deno -> deno.json            minimumDependencyAge (P<N>D)
  uv   -> uv.toml              exclude-newer ("N days")

Only tools the repo gives evidence of (lockfile/manifest/existing config)
are configured, so it won't litter unrelated ecosystems. pip is skipped:
it has no per-project config. ini/yaml edits are line-based to preserve
comments and layout; a deno.json with comments (JSONC) is left untouched
with the line to add printed instead. `revert --local` removes the key and
deletes any file it leaves empty. `--local` with `--all` is now rejected.

Refs #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support --local flag for project-scoped age gating

1 participant