getaura 0.1.8 → 0.1.9

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.
package/dist/index.js CHANGED
@@ -20536,8 +20536,21 @@ var supabase = {
20536
20536
  return cache.get(endpoint);
20537
20537
  }
20538
20538
  };
20539
- const project = await ctx.get(`/v1/projects/${ref}`);
20540
- if (!project?.name) return { ok: false, problem: `Couldn\u2019t read the Supabase project ${ref}. Check your account can open it.`, errorType: "NoProject" };
20539
+ const read2 = await call("GET", `/v1/projects/${ref}`);
20540
+ if (read2.status === 401)
20541
+ return { ok: false, problem: "Your Supabase login has expired. Run `npx supabase login`, then try again.", errorType: "CliNotSignedIn" };
20542
+ if (read2.status !== 200 || !read2.json?.name)
20543
+ return {
20544
+ ok: false,
20545
+ // Projects created through Vercel's Supabase integration live in a Supabase account linked to Vercel.
20546
+ problem: [
20547
+ `The Supabase account you\u2019re signed in to can\u2019t open this project (${ref}).`,
20548
+ "If you created the database through Vercel: in Vercel open Storage, click the database, then Open in Supabase. In that same browser, run `npx supabase login` and approve it. Then try again.",
20549
+ "Otherwise run `npx supabase login` with the Supabase account that owns the project."
20550
+ ].join("\n "),
20551
+ errorType: "NoAccess"
20552
+ };
20553
+ const project = read2.json;
20541
20554
  return { ok: true, ctx, target: project.name };
20542
20555
  },
20543
20556
  settings: [
@@ -21033,7 +21046,7 @@ function pmCommands(pm) {
21033
21046
  // package.json
21034
21047
  var package_default = {
21035
21048
  name: "getaura",
21036
- version: "0.1.8",
21049
+ version: "0.1.9",
21037
21050
  description: "Aura helps you and your coding agent follow best practices while you vibe code.",
21038
21051
  type: "module",
21039
21052
  bin: {
@@ -22623,6 +22636,15 @@ var foundationChecks = [ciWorkflow, tests, readme, envExample, lockfile, lintFor
22623
22636
 
22624
22637
  // src/connectors/snapshot.ts
22625
22638
  import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
22639
+ var REFUSAL_MS = 30 * 24 * 60 * 60 * 1e3;
22640
+ function withRefusals(states, snap, now = Date.now()) {
22641
+ return Object.fromEntries(
22642
+ Object.entries(states).map(([id, s]) => {
22643
+ const refusal = snap?.refused?.[id];
22644
+ return [id, s.state === "off" && refusal && now - Date.parse(refusal.at) < REFUSAL_MS ? { state: "unavailable", why: refusal.why } : s];
22645
+ })
22646
+ );
22647
+ }
22626
22648
  var FILE2 = "cache/connectors.json";
22627
22649
  function loadSnapshots(root) {
22628
22650
  try {
@@ -22631,9 +22653,17 @@ function loadSnapshots(root) {
22631
22653
  return {};
22632
22654
  }
22633
22655
  }
22634
- function saveSnapshot(root, toolId, states) {
22656
+ function saveSnapshot(root, toolId, states, refusedNow = {}) {
22635
22657
  const all = loadSnapshots(root);
22636
- all[toolId] = { checkedAt: (/* @__PURE__ */ new Date()).toISOString(), settings: Object.fromEntries(Object.entries(states).map(([id, s]) => [id, s.state])) };
22658
+ const now = (/* @__PURE__ */ new Date()).toISOString();
22659
+ const refused = { ...all[toolId]?.refused };
22660
+ for (const [id, why] of Object.entries(refusedNow)) refused[id] = { why, at: now };
22661
+ for (const [id, s] of Object.entries(states)) if (s.state === "on") delete refused[id];
22662
+ all[toolId] = {
22663
+ checkedAt: now,
22664
+ settings: Object.fromEntries(Object.entries(states).map(([id, s]) => [id, s.state])),
22665
+ ...Object.keys(refused).length ? { refused } : {}
22666
+ };
22637
22667
  writeAuraFile(root, FILE2, `${JSON.stringify(all, null, 2)}
22638
22668
  `);
22639
22669
  }
@@ -24662,7 +24692,7 @@ async function secureCommand(connector, flags, report = {}, fake) {
24662
24692
  return 1;
24663
24693
  }
24664
24694
  const { ctx, target } = connection;
24665
- const states = await readSettings(connector, ctx);
24695
+ const states = withRefusals(await readSettings(connector, ctx), loadSnapshots(root)[connector.id]);
24666
24696
  saveSnapshot(root, connector.id, states);
24667
24697
  const toTurnOn = connector.settings.filter((s) => states[s.id].state === "off").map((s) => s.id);
24668
24698
  console.log(`
@@ -24726,10 +24756,17 @@ Nothing was changed. Show the user the changes above, and once they agree run: a
24726
24756
  }
24727
24757
  report.outcome = results.some((r) => r.result === "failed") ? "failed" : "settings_changed";
24728
24758
  }
24759
+ const refusedNow = Object.fromEntries(results.filter((r) => r.result === "unavailable" && states[r.id].state === "off" && r.why).map((r) => [r.id, r.why]));
24729
24760
  saveSnapshot(
24730
24761
  root,
24731
24762
  connector.id,
24732
- Object.fromEntries(Object.entries(states).map(([id, s]) => [id, results.find((r) => r.id === id)?.result === "turned-on" ? { state: "on" } : s]))
24763
+ Object.fromEntries(
24764
+ Object.entries(states).map(([id, s]) => {
24765
+ const r = results.find((x) => x.id === id);
24766
+ return [id, r?.result === "turned-on" ? { state: "on" } : refusedNow[id] ? { state: "unavailable", why: refusedNow[id] } : s];
24767
+ })
24768
+ ),
24769
+ refusedNow
24733
24770
  );
24734
24771
  const left = await connector.leftForYou(ctx, results);
24735
24772
  if (left.length) {
@@ -25199,7 +25236,7 @@ async function refreshToolSettings(root) {
25199
25236
  for (const connector of CONNECTORS) {
25200
25237
  if (!(previous ? connector.detect(previous) : connector.id === "github") || !isStale(snapshots[connector.id])) continue;
25201
25238
  const connection = await connector.connect(root).catch(() => null);
25202
- if (connection?.ok) saveSnapshot(root, connector.id, await readSettings(connector, connection.ctx));
25239
+ if (connection?.ok) saveSnapshot(root, connector.id, withRefusals(await readSettings(connector, connection.ctx), snapshots[connector.id]));
25203
25240
  }
25204
25241
  }
25205
25242