@intentic/fileq 1.318.0 → 1.320.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.
Files changed (84) hide show
  1. package/NOTICE +4 -4
  2. package/README.md +16 -10
  3. package/dist/app.d.ts.map +1 -1
  4. package/dist/app.js +4 -6
  5. package/dist/app.js.map +1 -1
  6. package/dist/commands/derive.command.js +1 -1
  7. package/dist/commands/derive.command.js.map +1 -1
  8. package/dist/commands/read.command.d.ts.map +1 -1
  9. package/dist/commands/read.command.js +26 -45
  10. package/dist/commands/read.command.js.map +1 -1
  11. package/dist/lib/check/{docx.d.ts → check-docx.d.ts} +1 -1
  12. package/dist/lib/check/check-docx.d.ts.map +1 -0
  13. package/dist/lib/check/{docx.js → check-docx.js} +46 -14
  14. package/dist/lib/check/check-docx.js.map +1 -0
  15. package/dist/lib/check/{pdf.d.ts → check-pdf.d.ts} +1 -1
  16. package/dist/lib/check/check-pdf.d.ts.map +1 -0
  17. package/dist/lib/check/{pdf.js → check-pdf.js} +4 -2
  18. package/dist/lib/check/check-pdf.js.map +1 -0
  19. package/dist/lib/check/{pptx.d.ts → check-pptx.d.ts} +1 -1
  20. package/dist/lib/check/check-pptx.d.ts.map +1 -0
  21. package/dist/lib/check/{pptx.js → check-pptx.js} +18 -5
  22. package/dist/lib/check/check-pptx.js.map +1 -0
  23. package/dist/lib/check/{xlsx.d.ts → check-xlsx.d.ts} +1 -1
  24. package/dist/lib/check/check-xlsx.d.ts.map +1 -0
  25. package/dist/lib/check/{xlsx.js → check-xlsx.js} +17 -6
  26. package/dist/lib/check/check-xlsx.js.map +1 -0
  27. package/dist/lib/check/check.js +4 -4
  28. package/dist/lib/check/check.js.map +1 -1
  29. package/dist/lib/content-cache.d.ts +12 -0
  30. package/dist/lib/content-cache.d.ts.map +1 -0
  31. package/dist/lib/content-cache.js +33 -0
  32. package/dist/lib/content-cache.js.map +1 -0
  33. package/dist/lib/derive.d.ts +10 -0
  34. package/dist/lib/derive.d.ts.map +1 -1
  35. package/dist/lib/derive.js +40 -4
  36. package/dist/lib/derive.js.map +1 -1
  37. package/dist/lib/sidecar.d.ts +11 -2
  38. package/dist/lib/sidecar.d.ts.map +1 -1
  39. package/dist/lib/sidecar.js +28 -16
  40. package/dist/lib/sidecar.js.map +1 -1
  41. package/dist/skill.d.ts.map +1 -1
  42. package/dist/skill.js +8 -7
  43. package/dist/skill.js.map +1 -1
  44. package/package.json +7 -7
  45. package/src/app.ts +4 -6
  46. package/src/cli.integration.test.ts +52 -29
  47. package/src/commands/check.command.ts +1 -1
  48. package/src/commands/derive.command.ts +1 -1
  49. package/src/commands/read.command.ts +30 -52
  50. package/src/lib/archives.ts +1 -1
  51. package/src/lib/check/{docx.ts → check-docx.ts} +112 -27
  52. package/src/lib/check/{pdf.ts → check-pdf.ts} +23 -4
  53. package/src/lib/check/{pptx.ts → check-pptx.ts} +48 -11
  54. package/src/lib/check/{xlsx.ts → check-xlsx.ts} +20 -6
  55. package/src/lib/check/check.test.ts +99 -27
  56. package/src/lib/check/check.ts +4 -4
  57. package/src/lib/content-cache.ts +58 -0
  58. package/src/lib/derive.integration.test.ts +198 -0
  59. package/src/lib/derive.ts +69 -7
  60. package/src/lib/derivers/archive.ts +1 -1
  61. package/src/lib/derivers/load-cost.test.ts +1 -1
  62. package/src/lib/derivers/pdf.ts +1 -1
  63. package/src/lib/derivers/xlsx.ts +1 -1
  64. package/src/lib/sidecar.ts +42 -22
  65. package/src/render.integration.test.ts +80 -56
  66. package/src/skill.ts +8 -7
  67. package/dist/commands/sweep.command.d.ts +0 -3
  68. package/dist/commands/sweep.command.d.ts.map +0 -1
  69. package/dist/commands/sweep.command.js +0 -41
  70. package/dist/commands/sweep.command.js.map +0 -1
  71. package/dist/lib/check/docx.d.ts.map +0 -1
  72. package/dist/lib/check/docx.js.map +0 -1
  73. package/dist/lib/check/pdf.d.ts.map +0 -1
  74. package/dist/lib/check/pdf.js.map +0 -1
  75. package/dist/lib/check/pptx.d.ts.map +0 -1
  76. package/dist/lib/check/pptx.js.map +0 -1
  77. package/dist/lib/check/xlsx.d.ts.map +0 -1
  78. package/dist/lib/check/xlsx.js.map +0 -1
  79. package/dist/lib/sweep.d.ts +0 -7
  80. package/dist/lib/sweep.d.ts.map +0 -1
  81. package/dist/lib/sweep.js +0 -56
  82. package/dist/lib/sweep.js.map +0 -1
  83. package/src/commands/sweep.command.ts +0 -48
  84. package/src/lib/sweep.ts +0 -72
package/src/lib/sweep.ts DELETED
@@ -1,72 +0,0 @@
1
- import { readdir, stat } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { IGNORED_DIRS, isAgentWorktreePath, REFERENCE_DIR } from "@intentic/workspace-ignore";
4
- import { STATE_DIR } from "@intentic/constants";
5
- import { ensureSidecar, type Outcome } from "./derive.js";
6
- import { isCandidatePath } from "./formats.js";
7
- import { DERIVED_DIR, removeSidecar } from "./sidecar.js";
8
-
9
- // Whole-workspace pass: converges every derivable file and removes every orphaned shadow, making the sidecar tree a
10
- // statement about the workspace as it is now, not as the watcher's incremental view has it.
11
- // Sequential on purpose, since it shares the box with the agent it's shadowing; parallel parses would cost that
12
- // argument.
13
- // Skips what the daemon's watcher skips (machine subtrees, the state dir, the reference shelf), so the two never
14
- // disagree about what's workspace.
15
-
16
- const skipDir = (relPath: string, name: string, childRel: string): boolean =>
17
- IGNORED_DIRS.has(name) || name === STATE_DIR || (relPath === "" && name === REFERENCE_DIR) || isAgentWorktreePath(childRel);
18
-
19
- const walk = async (root: string, relPath: string, found: string[]): Promise<void> => {
20
- const entries = await readdir(join(root, relPath), { withFileTypes: true }).catch(() => []);
21
- for (const entry of entries) {
22
- const childRel = relPath === "" ? entry.name : `${relPath}/${entry.name}`;
23
- if (entry.isDirectory()) {
24
- if (!skipDir(relPath, entry.name, childRel)) {
25
- await walk(root, childRel, found);
26
- }
27
- } else if (entry.isFile() && isCandidatePath(entry.name)) {
28
- found.push(childRel);
29
- }
30
- }
31
- };
32
-
33
- // Shadow tree's own walk, for orphan pruning: every `<rel>.md` under derived/ names the source it shadows.
34
- const walkSidecars = async (root: string, relPath: string, found: string[]): Promise<void> => {
35
- const entries = await readdir(join(root, DERIVED_DIR, relPath), { withFileTypes: true }).catch(() => []);
36
- for (const entry of entries) {
37
- const childRel = relPath === "" ? entry.name : `${relPath}/${entry.name}`;
38
- if (entry.isDirectory()) {
39
- await walkSidecars(root, childRel, found);
40
- } else if (entry.isFile() && entry.name.endsWith(".md")) {
41
- found.push(childRel.slice(0, -3));
42
- }
43
- }
44
- };
45
-
46
- export interface SweepResult {
47
- readonly outcomes: Outcome[];
48
- /** Sources of shadows whose file vanished since they were derived, removed by this sweep. */
49
- readonly pruned: string[];
50
- }
51
-
52
- export const sweep = async (workspaceRoot: string, onOutcome?: (outcome: Outcome) => void): Promise<SweepResult> => {
53
- const candidates: string[] = [];
54
- await walk(workspaceRoot, "", candidates);
55
- const outcomes: Outcome[] = [];
56
- for (const relPath of candidates) {
57
- const outcome = await ensureSidecar(workspaceRoot, join(workspaceRoot, relPath));
58
- outcomes.push(outcome);
59
- onOutcome?.(outcome);
60
- }
61
- const shadowed: string[] = [];
62
- await walkSidecars(workspaceRoot, "", shadowed);
63
- const alive = new Set(candidates);
64
- const pruned: string[] = [];
65
- for (const relPath of shadowed) {
66
- if (!alive.has(relPath) && (await stat(join(workspaceRoot, relPath)).catch(() => undefined)) === undefined) {
67
- await removeSidecar(workspaceRoot, relPath);
68
- pruned.push(relPath);
69
- }
70
- }
71
- return { outcomes, pruned };
72
- };