@amirhosseinnateghi/vibed-cli 0.1.1 → 0.1.2

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/index.js +21 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10717,10 +10717,11 @@ async function bundleProject(projectDir, opts = {}) {
10717
10717
  rootDir: dirname(resolved.entry),
10718
10718
  allowedOrigins
10719
10719
  });
10720
- const result = validate(html, { maxBytes, allowedOrigins });
10720
+ const result = validate(html, { maxBytes, allowedOrigins, policy: opts.policy });
10721
10721
  return {
10722
10722
  ok: result.ok,
10723
10723
  html,
10724
+ policy: opts.policy,
10724
10725
  entry: resolved.entry,
10725
10726
  builtWith: resolved.builtWith,
10726
10727
  sizeBytes: Buffer.byteLength(html, "utf8"),
@@ -10785,6 +10786,12 @@ function formatReport(result) {
10785
10786
  out2.push(`\u2717 Not vibeable yet \u2014 ${result.blockers.length} blocker(s):`);
10786
10787
  out2.push(...summarize(result).lines);
10787
10788
  }
10789
+ if (result.policy && ruleActive("no_vertical_scroll", result.policy)) {
10790
+ out2.push(
10791
+ "",
10792
+ "\u2139 Single screen: the page can't scroll vertically (auto-clipped at publish) \u2014 design it to fit."
10793
+ );
10794
+ }
10788
10795
  if (result.warnings.length) {
10789
10796
  out2.push("", "Flags (published but sent to moderation):");
10790
10797
  for (const w of result.warnings) out2.push(` \u2022 ${w.message}`);
@@ -10844,6 +10851,13 @@ async function apiFetch({ apiBase, token }, method, path, body) {
10844
10851
  }
10845
10852
  return json.data;
10846
10853
  }
10854
+ async function fetchPolicy(apiBase) {
10855
+ try {
10856
+ return await apiFetch({ apiBase }, "GET", "/policy");
10857
+ } catch {
10858
+ return void 0;
10859
+ }
10860
+ }
10847
10861
 
10848
10862
  // src/login.ts
10849
10863
  function openBrowser(url) {
@@ -10997,9 +11011,13 @@ Publish only:
10997
11011
  async function cmdCheck(args) {
10998
11012
  const json = isTrue(args.flags.json);
10999
11013
  const dir2 = resolve2(args._[1] ?? ".");
11014
+ const cfg = await loadConfig({ api: str(args.flags.api) });
11015
+ const policy = isTrue(args.flags["local-policy"]) ? void 0 : await fetchPolicy(cfg.apiBase);
11016
+ if (!json && policy) console.error(`Rules: ${cfg.apiBase}`);
11000
11017
  const result = await bundleProject(dir2, {
11001
11018
  entry: str(args.flags.entry),
11002
11019
  build: !isTrue(args.flags["no-build"]),
11020
+ policy,
11003
11021
  onLog: (m) => !json && console.error(m)
11004
11022
  });
11005
11023
  out(json, formatReport(result), {
@@ -11022,9 +11040,11 @@ async function cmdPublish(args) {
11022
11040
  console.error("Not signed in. Run `vibed login` first.");
11023
11041
  return 1;
11024
11042
  }
11043
+ const policy = await fetchPolicy(cfg.apiBase);
11025
11044
  const result = await bundleProject(dir2, {
11026
11045
  entry: str(args.flags.entry),
11027
11046
  build: !isTrue(args.flags["no-build"]),
11047
+ policy,
11028
11048
  onLog: (m) => !json && console.error(m)
11029
11049
  });
11030
11050
  if (!result.ok || !result.html) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amirhosseinnateghi/vibed-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "make it vibed — check, bundle, and publish a project to vibed from the terminal",
5
5
  "license": "MIT",
6
6
  "type": "module",