youiyoux 0.1.14 → 0.1.15

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.
@@ -4,7 +4,7 @@ import { createRequire as __youiRequire } from "node:module"; import { dirname a
4
4
  var PACKAGES = {
5
5
  core: () => import("./src-4BOFDAZD.js"),
6
6
  scanner: () => import("./src-6JO73FOS.js"),
7
- discover: () => import("./src-7LETTRRF.js"),
7
+ discover: () => import("./src-IMWXYWQK.js"),
8
8
  tokens: () => import("./src-WMGLZKYK.js")
9
9
  };
10
10
  var loadPackage = (name) => PACKAGES[name]();
@@ -574,7 +574,10 @@ var nodeFetcher = async (url, init) => {
574
574
  if (!location) throw new Error("redirect missing location");
575
575
  const next = new URL(location, url);
576
576
  if (!publicHttps(next.href)) throw new Error("redirect must use https on a public host");
577
- if (next.origin !== new URL(url).origin) delete headers.authorization;
577
+ if (next.origin !== new URL(url).origin) {
578
+ delete headers.authorization;
579
+ delete headers["x-figma-token"];
580
+ }
578
581
  url = next.href;
579
582
  }
580
583
  throw new Error("too many redirects");
@@ -2009,7 +2012,7 @@ function bodyComponents(body) {
2009
2012
  return found;
2010
2013
  }
2011
2014
  async function readDesignMd(target, client, fetchedAt, readLocal) {
2012
- const text2 = target.local ? await readLocal(target.location).then((body2) => ({ body: body2, sha256: digestOf(body2) }), () => {
2015
+ const text2 = target.local ? await readLocal(target.location).then((body2) => ({ body: cleanText(body2), sha256: digestOf(body2) }), () => {
2013
2016
  throw new IngestError(`could not read ${basename(target.location)}`);
2014
2017
  }) : await fetchText(client, target.location, "the DESIGN.md");
2015
2018
  const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(text2.body);
@@ -2151,7 +2154,7 @@ async function readGithub(target, client, fetchedAt) {
2151
2154
  throw new IngestError(`${repo}'s ${registry} is not JSON`);
2152
2155
  }
2153
2156
  const { items, invalid } = parseRegistryItems(value);
2154
- const built = new Set(files.filter((f) => /(^|\/)public\/r\/[^/]+\.json$/.test(f)));
2157
+ const built = new Set(files.filter((f) => /(^|\/)public\/r\/[^/]+\.json$/.test(f) && /^[A-Za-z0-9._/-]+$/.test(f)));
2155
2158
  const inputs2 = items.filter(isCandidate).map((item) => {
2156
2159
  const servedAt = [...built].find((f) => f.endsWith(`/r/${item.name}.json`));
2157
2160
  return {
@@ -2216,7 +2219,7 @@ async function readStorybook(target, client, fetchedAt) {
2216
2219
  const value = got.value;
2217
2220
  const found = value.entries ?? value.stories;
2218
2221
  if (found && typeof found === "object" && !Array.isArray(found)) {
2219
- entries = found;
2222
+ entries = cleanData(found);
2220
2223
  index = { body: got.result.body, url, sha256: got.result.sha256 };
2221
2224
  break;
2222
2225
  }
@@ -2340,12 +2343,12 @@ var digestOf = (value) => sha256(typeof value === "string" ? value : JSON.string
2340
2343
  async function fetchJson(client, url, what) {
2341
2344
  const got = await client.json(url, false);
2342
2345
  if (!got.ok) throw new IngestError(`could not read ${what} (${url}): ${got.status === 404 ? "not found" : got.message}`);
2343
- return got.value;
2346
+ return cleanData(got.value);
2344
2347
  }
2345
2348
  async function fetchText(client, url, what) {
2346
2349
  const got = await client.get(url, "text/plain, text/markdown, */*");
2347
2350
  if (!got.ok) throw new IngestError(`could not read ${what} (${url}): ${got.status === 404 ? "not found" : got.message}`);
2348
- return { body: got.body, sha256: got.sha256, fetchedAt: got.fetchedAt };
2351
+ return { body: cleanText(got.body), sha256: got.sha256, fetchedAt: got.fetchedAt };
2349
2352
  }
2350
2353
  async function ingestLink(link, options) {
2351
2354
  const now = options.now ?? (() => /* @__PURE__ */ new Date());
@@ -2353,13 +2356,13 @@ async function ingestLink(link, options) {
2353
2356
  const fetchedAt = now().toISOString();
2354
2357
  const result = await (target.kind === "github" ? readGithub(target, options.client, fetchedAt) : target.kind === "storybook" ? readStorybook(target, options.client, fetchedAt) : target.kind === "figma" ? options.figma ? readFigma(target, options.client, fetchedAt) : Promise.reject(new IngestError("a Figma file is read through Figma's API: set FIGMA_TOKEN to a personal access token that can read the file (Figma > Settings > Security > Personal access tokens)")) : readDesignMd(target, options.client, fetchedAt, (path) => readFile3(path, "utf8")));
2355
2358
  const over = result.entries.length - INGEST_CAP;
2356
- return {
2359
+ return cleanData({
2357
2360
  ...result,
2358
2361
  link: link.trim(),
2359
2362
  fetchedAt,
2360
2363
  entries: result.entries.slice(0, INGEST_CAP),
2361
2364
  notes: [...result.notes, ...over > 0 ? [`${over} more item${over === 1 ? "" : "s"} not read: at most ${INGEST_CAP} come from one link`] : []]
2362
- };
2365
+ });
2363
2366
  }
2364
2367
 
2365
2368
  export {
@@ -4,7 +4,7 @@ import {
4
4
  loadPackage,
5
5
  readTryIndex,
6
6
  send
7
- } from "./chunk-F3KCL226.js";
7
+ } from "./chunk-CZJFEND6.js";
8
8
  import {
9
9
  writeFileAtomic
10
10
  } from "./chunk-S7UN5KQK.js";
@@ -57,7 +57,7 @@ import { homedir, userInfo } from "node:os";
57
57
  import { join, resolve } from "node:path";
58
58
  async function swapImpact(candidate, family) {
59
59
  try {
60
- const { discoverIndexPath, sharedStore } = await import("./src-7LETTRRF.js");
60
+ const { discoverIndexPath, sharedStore } = await import("./src-IMWXYWQK.js");
61
61
  const path = discoverIndexPath();
62
62
  if (!process.env.DATABASE_URL && !existsSync(path)) return null;
63
63
  const impact = await (await sharedStore(path, process.env, { readOnly: true })).swapImpact(candidate, family);
@@ -68,7 +68,7 @@ async function swapImpact(candidate, family) {
68
68
  }
69
69
  async function libraryLicence(id) {
70
70
  try {
71
- const { discoverCacheDir, findListing } = await import("./src-7LETTRRF.js");
71
+ const { discoverCacheDir, findListing } = await import("./src-IMWXYWQK.js");
72
72
  const { entry } = await findListing(discoverCacheDir(void 0, process.env), id);
73
73
  return entry.id === id ? entry.license : null;
74
74
  } catch {
@@ -79,7 +79,7 @@ function workflowStateDir(project, state) {
79
79
  return resolve(state ?? join(homedir(), ".youi", "workflow", shortHash(`${project.repo.root}\0${project.root}`)));
80
80
  }
81
81
  async function ingest(link) {
82
- const { readLink } = await import("./ingest-OF4Z33L2.js");
82
+ const { readLink } = await import("./ingest-R2TM3QBM.js");
83
83
  return readLink(link, { allowLocal: false });
84
84
  }
85
85
  async function startRuleEditor(options) {
@@ -9,7 +9,7 @@ import {
9
9
  startRuleEditor,
10
10
  style,
11
11
  truncate
12
- } from "./chunk-FTF4MBV5.js";
12
+ } from "./chunk-QEUZDGIF.js";
13
13
  import {
14
14
  BASELINE_FILE,
15
15
  DEFAULT_EXCLUDE,
@@ -96,7 +96,7 @@ import {
96
96
  sharedStore,
97
97
  showFromCatalog,
98
98
  syncIndex
99
- } from "./chunk-TPP4HLDB.js";
99
+ } from "./chunk-DAGYR4NV.js";
100
100
  import {
101
101
  checkpointSqlite,
102
102
  indexHome,
@@ -6001,7 +6001,7 @@ async function cmdLibrary(values, positionals) {
6001
6001
  return 0;
6002
6002
  }
6003
6003
  if (action === "ingest" && query && positionals.length === 2) {
6004
- const { fileIngestDraft, readLink, renderIngest } = await import("./ingest-OF4Z33L2.js");
6004
+ const { fileIngestDraft, readLink, renderIngest } = await import("./ingest-R2TM3QBM.js");
6005
6005
  const p = values.draft ? await project(values) : null;
6006
6006
  const reading = await readLink(query, { allowLocal: true });
6007
6007
  const filed = p ? await fileIngestDraft(p, reading, values.state) : null;
@@ -6517,7 +6517,7 @@ async function cmdReport(values, positionals, io) {
6517
6517
  return result.code;
6518
6518
  }
6519
6519
  async function cmdMcp(values) {
6520
- const { startStdioServer } = await import("./src-3LEBH7E3.js");
6520
+ const { startStdioServer } = await import("./src-OHHZY3TA.js");
6521
6521
  await startStdioServer({ projectRoot: values.project ?? process.cwd(), ...loadOptions(values), ...values.cache ? { discoverCache: values.cache } : {} });
6522
6522
  return -1;
6523
6523
  }
@@ -4,7 +4,7 @@ import {
4
4
  plural,
5
5
  style,
6
6
  workflowStateDir
7
- } from "./chunk-FTF4MBV5.js";
7
+ } from "./chunk-QEUZDGIF.js";
8
8
  import "./chunk-HII2I2PI.js";
9
9
  import "./chunk-42YJX3W5.js";
10
10
  import "./chunk-HIXGUALJ.js";
@@ -14,7 +14,7 @@ import "./chunk-WNTS7ZO4.js";
14
14
  // ../cli/src/ingest.ts
15
15
  import { userInfo } from "node:os";
16
16
  async function readLink(link, options) {
17
- const { githubBuckets, ingestLink, PoliteClient } = await import("./src-7LETTRRF.js");
17
+ const { githubBuckets, ingestLink, PoliteClient } = await import("./src-IMWXYWQK.js");
18
18
  const env = options.env ?? process.env;
19
19
  const token = env.GITHUB_TOKEN || void 0;
20
20
  const figmaToken = env.FIGMA_TOKEN || void 0;
@@ -127,7 +127,7 @@ import {
127
127
  writeHttpCache,
128
128
  writeJson,
129
129
  writeSources
130
- } from "./chunk-TPP4HLDB.js";
130
+ } from "./chunk-DAGYR4NV.js";
131
131
  import "./chunk-A2IZOTJG.js";
132
132
  import "./chunk-S7UN5KQK.js";
133
133
  import "./chunk-WNTS7ZO4.js";
@@ -51,7 +51,7 @@ import {
51
51
  searchCatalog,
52
52
  sharedStore,
53
53
  showFromCatalog
54
- } from "./chunk-TPP4HLDB.js";
54
+ } from "./chunk-DAGYR4NV.js";
55
55
  import {
56
56
  storeLocation
57
57
  } from "./chunk-A2IZOTJG.js";
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  discoverCacheDir,
8
8
  loadIndex
9
- } from "./chunks/chunk-TPP4HLDB.js";
9
+ } from "./chunks/chunk-DAGYR4NV.js";
10
10
  import "./chunks/chunk-A2IZOTJG.js";
11
11
  import {
12
12
  THUMBS_PATH,
@@ -17,8 +17,8 @@ import {
17
17
  selectCandidates,
18
18
  thumbsDir,
19
19
  writeThumbIndex
20
- } from "./chunks/chunk-JGEVNQ5R.js";
21
- import "./chunks/chunk-F3KCL226.js";
20
+ } from "./chunks/chunk-FTL53MU3.js";
21
+ import "./chunks/chunk-CZJFEND6.js";
22
22
  import "./chunks/chunk-FVVL5JCY.js";
23
23
  import "./chunks/chunk-S7UN5KQK.js";
24
24
  import "./chunks/chunk-WNTS7ZO4.js";
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __youiRequire } from "node:module"; import { dirname as __youiDir } from "node:path"; import { fileURLToPath as __youiPath } from "node:url"; const require = __youiRequire(import.meta.url); const __youiDirname = __youiDir(__youiPath(import.meta.url));
3
3
  import {
4
4
  discoverThumbsMiddleware
5
- } from "./chunks/chunk-JGEVNQ5R.js";
5
+ } from "./chunks/chunk-FTL53MU3.js";
6
6
  import {
7
7
  isLocalHost,
8
8
  loadPackage,
@@ -10,7 +10,7 @@ import {
10
10
  readTryIndex,
11
11
  send,
12
12
  tryMiddleware
13
- } from "./chunks/chunk-F3KCL226.js";
13
+ } from "./chunks/chunk-CZJFEND6.js";
14
14
  import "./chunks/chunk-FVVL5JCY.js";
15
15
  import "./chunks/chunk-S7UN5KQK.js";
16
16
  import "./chunks/chunk-WNTS7ZO4.js";
@@ -3,7 +3,7 @@ import { createRequire as __youiRequire } from "node:module"; import { dirname a
3
3
  import {
4
4
  loadPackage,
5
5
  tryProject
6
- } from "./chunks/chunk-F3KCL226.js";
6
+ } from "./chunks/chunk-CZJFEND6.js";
7
7
  import "./chunks/chunk-FVVL5JCY.js";
8
8
  import "./chunks/chunk-WNTS7ZO4.js";
9
9
 
package/dist/youi.js CHANGED
@@ -2,12 +2,12 @@
2
2
  import { createRequire as __youiRequire } from "node:module"; import { dirname as __youiDir } from "node:path"; import { fileURLToPath as __youiPath } from "node:url"; const require = __youiRequire(import.meta.url); const __youiDirname = __youiDir(__youiPath(import.meta.url));
3
3
  import {
4
4
  main
5
- } from "./chunks/chunk-EN64OSUT.js";
6
- import "./chunks/chunk-FTF4MBV5.js";
5
+ } from "./chunks/chunk-T4EHV4XY.js";
6
+ import "./chunks/chunk-QEUZDGIF.js";
7
7
  import "./chunks/chunk-HII2I2PI.js";
8
8
  import "./chunks/chunk-42YJX3W5.js";
9
9
  import "./chunks/chunk-ALQVHSF2.js";
10
- import "./chunks/chunk-TPP4HLDB.js";
10
+ import "./chunks/chunk-DAGYR4NV.js";
11
11
  import "./chunks/chunk-A2IZOTJG.js";
12
12
  import "./chunks/chunk-FVVL5JCY.js";
13
13
  import "./chunks/chunk-HIXGUALJ.js";
package/dist/youiyoux.js CHANGED
@@ -3,12 +3,12 @@ import { createRequire as __youiRequire } from "node:module"; import { dirname a
3
3
  import {
4
4
  COMMAND_NAMES,
5
5
  main
6
- } from "./chunks/chunk-EN64OSUT.js";
7
- import "./chunks/chunk-FTF4MBV5.js";
6
+ } from "./chunks/chunk-T4EHV4XY.js";
7
+ import "./chunks/chunk-QEUZDGIF.js";
8
8
  import "./chunks/chunk-HII2I2PI.js";
9
9
  import "./chunks/chunk-42YJX3W5.js";
10
10
  import "./chunks/chunk-ALQVHSF2.js";
11
- import "./chunks/chunk-TPP4HLDB.js";
11
+ import "./chunks/chunk-DAGYR4NV.js";
12
12
  import "./chunks/chunk-A2IZOTJG.js";
13
13
  import "./chunks/chunk-FVVL5JCY.js";
14
14
  import "./chunks/chunk-HIXGUALJ.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "youiyoux",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Your agent rebuilds components you already have. youiyoux catches it: npx youiyoux turns any repo into a shareable report of near-duplicate components, hardcoded token values and off-library imports, with the fixes.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -46,9 +46,9 @@
46
46
  "typescript": "6.0.3"
47
47
  },
48
48
  "devDependencies": {
49
- "@youiyoux/cli": "0.1.14",
50
- "@youiyoux/core": "0.1.14",
51
- "@youiyoux/scanner": "0.1.14"
49
+ "@youiyoux/cli": "0.1.15",
50
+ "@youiyoux/core": "0.1.15",
51
+ "@youiyoux/scanner": "0.1.15"
52
52
  },
53
53
  "exports": {
54
54
  "./package.json": "./package.json"