yamlite 0.41.1 → 0.43.0

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/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { B as check, I as createHandler, R as isLoopback, a as query, c as exportSite, i as formatTable, n as formatCsv, o as generateConfig, r as formatJson, s as init, t as open, z as loopbackHosts } from "./src-ChJZPkg9.mjs";
3
- import { n as guide, r as envKeys, t as createWorkspace } from "./workspace-D7xHlBPc.mjs";
2
+ import { B as check, I as createHandler, R as isLoopback, a as query, c as exportSite, i as formatTable, n as formatCsv, o as generateConfig, r as formatJson, s as init, t as open, z as loopbackHosts } from "./src-H6E5YDao.mjs";
3
+ import { n as guide, r as envKeys, t as createWorkspace } from "./workspace-BR6jiILy.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { relative, resolve } from "node:path";
6
6
  import { homedir } from "node:os";
package/dist/core.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as parseConfig, B as HistoryEntry, C as Decision, D as OpenOptions, E as DeclaredTable, F as ColumnType, G as Rec, H as IndexSpec, I as ConflictInfo, J as ViewRecord, K as SchemaChange, L as DbRow, M as Capture, N as Change, O as TableInput, P as ChangeOp, R as DbValue, S as BaseHashes, T as Config, U as PageAccess, V as HistoryPage, W as PageSpec, _ as check, a as formatCsv, b as Watcher, c as query, d as init, f as ExportOptions, g as CheckTable, h as CheckResult, i as QueryResult, j as readsFile, k as TableLocation, l as InitOptions, m as exportSite, n as open, o as formatJson, p as ExportResult, q as TableSpec, r as QueryOptions, s as formatTable, t as Yamlite, u as generateConfig, v as WatchHandlers, w as CONFIG_NAMES, x as TableResult, y as WatchOptions, z as FieldChange } from "./index-Bd2ctbJm.mjs";
1
+ import { A as parseConfig, B as HistoryEntry, C as Decision, D as OpenOptions, E as DeclaredTable, F as ColumnType, G as Rec, H as IndexSpec, I as ConflictInfo, J as ViewRecord, K as SchemaChange, L as DbRow, M as Capture, N as Change, O as TableInput, P as ChangeOp, R as DbValue, S as BaseHashes, T as Config, U as PageAccess, V as HistoryPage, W as PageSpec, _ as check, a as formatCsv, b as Watcher, c as query, d as init, f as ExportOptions, g as CheckTable, h as CheckResult, i as QueryResult, j as readsFile, k as TableLocation, l as InitOptions, m as exportSite, n as open, o as formatJson, p as ExportResult, q as TableSpec, r as QueryOptions, s as formatTable, t as Yamlite, u as generateConfig, v as WatchHandlers, w as CONFIG_NAMES, x as TableResult, y as WatchOptions, z as FieldChange } from "./index-CDeSOWZt.mjs";
2
2
  import { DatabaseSync } from "node:sqlite";
3
3
  import { LanguageModel, ModelMessage } from "ai";
4
4
  //#region src/store.d.ts
package/dist/core.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { B as check, C as describeChange, K as DENIED_FILES, L as HttpError, T as worthShowing, U as parseConfig, V as CONFIG_NAMES, W as readsFile, X as fileGranted, Z as normalizeFilePath, a as query, c as exportSite, f as ReviewRefused, h as templatePath, i as formatTable, n as formatCsv, o as generateConfig, q as MAX_PAGE_FILE_BYTES, r as formatJson, s as init, t as open, w as fieldChanges } from "./src-ChJZPkg9.mjs";
2
- import { t as createWorkspace } from "./workspace-D7xHlBPc.mjs";
1
+ import { B as check, C as describeChange, K as DENIED_FILES, L as HttpError, T as worthShowing, U as parseConfig, V as CONFIG_NAMES, W as readsFile, X as fileGranted, Z as normalizeFilePath, a as query, c as exportSite, f as ReviewRefused, h as templatePath, i as formatTable, n as formatCsv, o as generateConfig, q as MAX_PAGE_FILE_BYTES, r as formatJson, s as init, t as open, w as fieldChanges } from "./src-H6E5YDao.mjs";
2
+ import { t as createWorkspace } from "./workspace-BR6jiILy.mjs";
3
3
  export { CONFIG_NAMES, DENIED_FILES, HttpError, MAX_PAGE_FILE_BYTES, ReviewRefused, check, createWorkspace, describeChange, exportSite, fieldChanges, fileGranted, formatCsv, formatJson, formatTable, generateConfig, init, normalizeFilePath, open, parseConfig, query, readsFile, templatePath, worthShowing };
@@ -178,6 +178,7 @@ interface Config {
178
178
  tables: DeclaredTable[];
179
179
  pages: PageSpec[];
180
180
  ai: AiInstructions;
181
+ ignore: string[];
181
182
  }
182
183
  declare function readsFile(l: TableLocation, file: string): boolean;
183
184
  declare function parseConfig(text: string, name?: string): Config;
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { C as Decision, D as OpenOptions, F as ColumnType, H as IndexSpec, I as ConflictInfo, K as SchemaChange, N as Change, O as TableInput, P as ChangeOp, W as PageSpec, _ as check, a as formatCsv, b as Watcher, c as query, d as init, f as ExportOptions, g as CheckTable, h as CheckResult, i as QueryResult, l as InitOptions, m as exportSite, n as open, o as formatJson, p as ExportResult, q as TableSpec, r as QueryOptions, s as formatTable, t as Yamlite, u as generateConfig, v as WatchHandlers, x as TableResult, y as WatchOptions } from "./index-Bd2ctbJm.mjs";
1
+ import { C as Decision, D as OpenOptions, F as ColumnType, H as IndexSpec, I as ConflictInfo, K as SchemaChange, N as Change, O as TableInput, P as ChangeOp, W as PageSpec, _ as check, a as formatCsv, b as Watcher, c as query, d as init, f as ExportOptions, g as CheckTable, h as CheckResult, i as QueryResult, l as InitOptions, m as exportSite, n as open, o as formatJson, p as ExportResult, q as TableSpec, r as QueryOptions, s as formatTable, t as Yamlite, u as generateConfig, v as WatchHandlers, x as TableResult, y as WatchOptions } from "./index-CDeSOWZt.mjs";
2
2
  export { type Change, type ChangeOp, type CheckResult, type CheckTable, type ColumnType, type ConflictInfo, type Decision, type ExportOptions, type ExportResult, type IndexSpec, type InitOptions, type OpenOptions, type PageSpec, type QueryOptions, type QueryResult, type SchemaChange, type TableInput, type TableResult, type TableSpec, type WatchHandlers, type WatchOptions, type Watcher, Yamlite, check, exportSite, formatCsv, formatJson, formatTable, generateConfig, init, open, query };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { B as check, c as exportSite, n as formatCsv, r as formatJson, i as formatTable, o as generateConfig, s as init, t as open, a as query } from "./src-ChJZPkg9.mjs";
1
+ export { B as check, c as exportSite, n as formatCsv, r as formatJson, i as formatTable, o as generateConfig, s as init, t as open, a as query } from "./src-H6E5YDao.mjs";
@@ -1327,11 +1327,13 @@ function notAList(path) {
1327
1327
  const doc = parseDocument(text);
1328
1328
  return doc.errors.length === 0 && doc.contents !== null && !isSeq(doc.contents);
1329
1329
  }
1330
- function scanRoot(root) {
1330
+ const ignoredEntry = (name, ignore) => ignore.some((p) => matchesGlob(name, p) || matchesGlob(`${name}/`, p));
1331
+ function scanRoot(root, ignore) {
1331
1332
  const out = [];
1332
1333
  for (const entry of readdirSync(root, { withFileTypes: true })) {
1333
1334
  const name = entry.name;
1334
1335
  if (name.startsWith(".") || name === "node_modules" || CONFIG_NAMES.includes(name)) continue;
1336
+ if (ignoredEntry(name, ignore)) continue;
1335
1337
  const path = join(root, name);
1336
1338
  let kind = entry;
1337
1339
  if (entry.isSymbolicLink()) try {
@@ -1403,7 +1405,8 @@ function readRootConfig(root, text) {
1403
1405
  if (path === null) return {
1404
1406
  tables: [],
1405
1407
  pages: [],
1406
- ai: NO_AI
1408
+ ai: NO_AI,
1409
+ ignore: []
1407
1410
  };
1408
1411
  return parseConfig(text ?? readFileSync(path, "utf8"), basename(path));
1409
1412
  }
@@ -1441,9 +1444,20 @@ function parseConfig(text, name = "yamlite.yaml") {
1441
1444
  return {
1442
1445
  tables,
1443
1446
  pages: toPages(raw?.pages, (p) => p),
1444
- ai: toAi(raw?.ai)
1447
+ ai: toAi(raw?.ai),
1448
+ ignore: toIgnore(raw?.ignore)
1445
1449
  };
1446
1450
  }
1451
+ function toIgnore(raw) {
1452
+ if (raw === void 0 || raw === null) return [];
1453
+ if (!isStringList(raw)) throw new Error("ignore must be a list of globs");
1454
+ return raw.map((entry) => {
1455
+ if (entry.startsWith("!")) throw new Error(`ignore entry "${entry}" cannot start with !`);
1456
+ const glob = entry.replace(/^(\.\/)+/, "").replace(/\/+$/, "");
1457
+ if (isAbsolute(glob) || glob.startsWith("~") || glob.split("/").some((s) => s === ".." || s === ".") || glob === "") throw new Error(`ignore entry "${entry}" must be relative to the root`);
1458
+ return glob;
1459
+ });
1460
+ }
1447
1461
  const AI_INSTRUCTIONS_MAX = 4e3;
1448
1462
  const NO_AI = {
1449
1463
  instructions: null,
@@ -1541,7 +1555,7 @@ function toSpec(t, persisted) {
1541
1555
  captures
1542
1556
  };
1543
1557
  }
1544
- function withClaims(tables, configFiles) {
1558
+ function withClaims(tables, configFiles, ignored = []) {
1545
1559
  return tables.map((t) => {
1546
1560
  if (t.mode !== "files") return t;
1547
1561
  const inside = (o) => o !== t && (o.mode === "files" && o.path === t.path ? true : o.path.startsWith(t.path + sep));
@@ -1559,7 +1573,7 @@ function withClaims(tables, configFiles) {
1559
1573
  });
1560
1574
  return {
1561
1575
  ...t,
1562
- exclude
1576
+ exclude: [...exclude, ...ignored]
1563
1577
  };
1564
1578
  });
1565
1579
  }
@@ -1830,8 +1844,8 @@ function resolveConfig(opts, { requireConfig = true } = {}) {
1830
1844
  const root = resolve(opts.root);
1831
1845
  if (!existsSync(root) || !statSync(root).isDirectory()) throw new Error(`root is not a directory: ${root}`);
1832
1846
  if (requireConfig && configPath(root) === null) throw new Error(`no yamlite.yaml in ${root}; run "yamlite init" to create it`);
1833
- const scanned = scanRoot(root);
1834
1847
  const config = readRootConfig(root, opts.configText);
1848
+ const scanned = scanRoot(root, config.ignore);
1835
1849
  const declared = /* @__PURE__ */ new Map();
1836
1850
  const pathErrors = [];
1837
1851
  for (const t of config.tables) {
@@ -1878,7 +1892,13 @@ function resolveConfig(opts, { requireConfig = true } = {}) {
1878
1892
  }
1879
1893
  for (const [name, d] of declared) if (!merged.has(name)) merged.set(name, d);
1880
1894
  const configFiles = CONFIG_NAMES.map((name) => join(root, name));
1881
- const tables = checkViewNames(withClaims([...merged.values()].map((t) => "mode" in t ? t : toSpec(t, true)), configFiles));
1895
+ const ignored = config.ignore.flatMap((glob) => [glob, `${glob}/**`].map((g) => ({
1896
+ owner: `ignore entry "${glob}"`,
1897
+ path: root,
1898
+ glob: g,
1899
+ tie: false
1900
+ })));
1901
+ const tables = checkViewNames(withClaims([...merged.values()].map((t) => "mode" in t ? t : toSpec(t, true)), configFiles, ignored));
1882
1902
  return {
1883
1903
  db: opts.db ? expandPath(opts.db, process.cwd()) : join(root, ".yamlite", "db.sqlite"),
1884
1904
  stateDir: opts.stateDir ? expandPath(opts.stateDir, process.cwd()) : join(root, ".yamlite"),