@chrisdudek/yg 5.1.0 → 5.1.1

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 (2) hide show
  1. package/dist/bin.js +20 -7
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -1657,6 +1657,10 @@ function parseTier(name, raw, filename) {
1657
1657
  temperature: typeof c.temperature === "number" ? c.temperature : 0,
1658
1658
  consensus: consensusRaw,
1659
1659
  timeout: typeof c.timeout === "number" ? c.timeout * 1e3 : void 0,
1660
+ // api_key is read from the tier's config: block (most often supplied via the
1661
+ // gitignored yg-secrets.yaml overlay). Excluded from the verdict hash
1662
+ // (tierHashView folds only the tier NAME), so rotating it invalidates nothing.
1663
+ ...typeof c.api_key === "string" ? { api_key: c.api_key } : {},
1660
1664
  ...max_prompt_chars !== void 0 ? { max_prompt_chars } : {}
1661
1665
  };
1662
1666
  }
@@ -3973,6 +3977,7 @@ async function runReviewerConfigFlow() {
3973
3977
  }
3974
3978
  return { provider, model, apiKey: apiKey || void 0, endpoint };
3975
3979
  }
3980
+ var BOOTSTRAP_TIER_NAME = "standard";
3976
3981
  async function writeReviewerConfig(yggRoot, config) {
3977
3982
  const configPath = path14.join(yggRoot, "yg-config.yaml");
3978
3983
  let raw = {};
@@ -3995,7 +4000,7 @@ async function writeReviewerConfig(yggRoot, config) {
3995
4000
  }
3996
4001
  raw.reviewer = {
3997
4002
  tiers: {
3998
- standard: {
4003
+ [BOOTSTRAP_TIER_NAME]: {
3999
4004
  provider: config.provider,
4000
4005
  consensus: 1,
4001
4006
  max_prompt_chars: 5e4,
@@ -4005,7 +4010,7 @@ async function writeReviewerConfig(yggRoot, config) {
4005
4010
  };
4006
4011
  await writeFile5(configPath, yamlStringify(raw), "utf-8");
4007
4012
  }
4008
- async function writeSecretsFile(yggRoot, provider, apiKey) {
4013
+ async function writeSecretsFile(yggRoot, apiKey) {
4009
4014
  const secretsPath = path14.join(yggRoot, "yg-secrets.yaml");
4010
4015
  let raw = {};
4011
4016
  try {
@@ -4022,10 +4027,18 @@ async function writeSecretsFile(yggRoot, provider, apiKey) {
4022
4027
  raw.reviewer = {};
4023
4028
  }
4024
4029
  const reviewerSection = raw.reviewer;
4025
- if (!reviewerSection[provider] || typeof reviewerSection[provider] !== "object") {
4026
- reviewerSection[provider] = {};
4030
+ if (!reviewerSection.tiers || typeof reviewerSection.tiers !== "object") {
4031
+ reviewerSection.tiers = {};
4027
4032
  }
4028
- reviewerSection[provider].api_key = apiKey;
4033
+ const tiers = reviewerSection.tiers;
4034
+ if (!tiers[BOOTSTRAP_TIER_NAME] || typeof tiers[BOOTSTRAP_TIER_NAME] !== "object") {
4035
+ tiers[BOOTSTRAP_TIER_NAME] = {};
4036
+ }
4037
+ const tier = tiers[BOOTSTRAP_TIER_NAME];
4038
+ if (!tier.config || typeof tier.config !== "object") {
4039
+ tier.config = {};
4040
+ }
4041
+ tier.config.api_key = apiKey;
4029
4042
  await writeFile5(secretsPath, yamlStringify(raw), { encoding: "utf-8", mode: 384 });
4030
4043
  }
4031
4044
  async function freshInit(projectRoot) {
@@ -4054,7 +4067,7 @@ async function freshInit(projectRoot) {
4054
4067
  await createYggdrasilStructure(projectRoot, yggRoot, platform);
4055
4068
  await writeReviewerConfig(yggRoot, reviewerConfig);
4056
4069
  if (reviewerConfig.apiKey) {
4057
- await writeSecretsFile(yggRoot, reviewerConfig.provider, reviewerConfig.apiKey);
4070
+ await writeSecretsFile(yggRoot, reviewerConfig.apiKey);
4058
4071
  }
4059
4072
  await ensureGitattributes(projectRoot);
4060
4073
  p.outro(chalk2.green("Yggdrasil initialized. Run yg check to get started."));
@@ -4144,7 +4157,7 @@ async function existingInit(projectRoot) {
4144
4157
  const reviewerConfig = await runReviewerConfigFlow();
4145
4158
  await writeReviewerConfig(yggRoot, reviewerConfig);
4146
4159
  if (reviewerConfig.apiKey) {
4147
- await writeSecretsFile(yggRoot, reviewerConfig.provider, reviewerConfig.apiKey);
4160
+ await writeSecretsFile(yggRoot, reviewerConfig.apiKey);
4148
4161
  }
4149
4162
  p.outro(chalk2.green("Reviewer configured."));
4150
4163
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisdudek/yg",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "Architecture rules your AI coding agent can't ignore. It gets the rules for a file before it edits, and every change is checked — by a free local script or an LLM reviewer — before it moves on. Works with Claude Code, Cursor, Copilot, Codex, Cline.",
5
5
  "type": "module",
6
6
  "bin": {