dislop 0.9.1 → 1.0.1

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 (124) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/.codex-plugin/plugin.json +7 -8
  4. package/.cursor-plugin/plugin.json +2 -3
  5. package/.pre-commit-hooks.yaml +5 -12
  6. package/PRODUCT.md +19 -63
  7. package/README.md +360 -252
  8. package/README.zh-CN.md +390 -240
  9. package/action.yml +30 -39
  10. package/bin/dislop-mcp.mjs +3 -4
  11. package/bin/dislop.mjs +4 -4594
  12. package/gemini-extension.json +2 -2
  13. package/llms-install.md +68 -0
  14. package/package.json +17 -63
  15. package/packs/common/artifact-qa/pack.json +5 -0
  16. package/packs/common/artifact-qa/prompts/rules.md +11 -0
  17. package/packs/common/artifact-qa/scripts/index.mjs +173 -0
  18. package/packs/common/slide-deck/pack.json +6 -0
  19. package/packs/common/slide-deck/prompts/rules.md +11 -0
  20. package/packs/common/slide-deck/scripts/index.mjs +62 -0
  21. package/packs/common/web-ui/pack.json +6 -0
  22. package/packs/common/web-ui/prompts/rules.md +11 -0
  23. package/packs/common/web-ui/scripts/index.mjs +80 -0
  24. package/packs/en/artifact-qa/pack.json +6 -0
  25. package/packs/en/artifact-qa/prompts/rules.md +14 -0
  26. package/packs/en/artifact-qa/scripts/index.mjs +90 -0
  27. package/packs/en/prose/pack.json +7 -0
  28. package/packs/en/prose/prompts/rules.md +26 -0
  29. package/packs/en/prose/scripts/index.mjs +290 -0
  30. package/packs/en/slide-deck/pack.json +7 -0
  31. package/packs/en/slide-deck/prompts/rules.md +17 -0
  32. package/packs/en/slide-deck/scripts/index.mjs +81 -0
  33. package/packs/en/web-ui/pack.json +7 -0
  34. package/packs/en/web-ui/prompts/rules.md +20 -0
  35. package/packs/en/web-ui/scripts/index.mjs +103 -0
  36. package/packs/zh/artifact-qa/pack.json +6 -0
  37. package/packs/zh/artifact-qa/prompts/rules.md +14 -0
  38. package/packs/zh/artifact-qa/scripts/index.mjs +89 -0
  39. package/packs/zh/prose/pack.json +7 -0
  40. package/packs/zh/prose/prompts/rules.md +26 -0
  41. package/packs/zh/prose/scripts/index.mjs +305 -0
  42. package/packs/zh/slide-deck/pack.json +7 -0
  43. package/packs/zh/slide-deck/prompts/rules.md +17 -0
  44. package/packs/zh/slide-deck/scripts/index.mjs +75 -0
  45. package/packs/zh/web-ui/pack.json +7 -0
  46. package/packs/zh/web-ui/prompts/rules.md +20 -0
  47. package/packs/zh/web-ui/scripts/index.mjs +98 -0
  48. package/plugin.json +5 -6
  49. package/server.json +2 -2
  50. package/skills/deslop-docs/SKILL.md +10 -8
  51. package/skills/deslop-slides-docx/SKILL.md +7 -8
  52. package/skills/deslop-verify/SKILL.md +7 -8
  53. package/skills/deslop-web-ui/SKILL.md +7 -8
  54. package/skills/dislop/SKILL.md +16 -28
  55. package/skills/dislop/references/essay.md +1 -1
  56. package/skills/dislop/references/essay.zh-CN.md +1 -1
  57. package/skills/dislop/references/office.md +1 -1
  58. package/skills/dislop/references/office.zh-CN.md +1 -1
  59. package/skills/dislop/references/web-ui.md +1 -1
  60. package/skills/dislop/references/web-ui.zh-CN.md +1 -1
  61. package/skills/dislop/references/work-docs.md +1 -1
  62. package/skills/dislop/references/work-docs.zh-CN.md +1 -1
  63. package/src/cli-main.mjs +210 -0
  64. package/src/commands/check-fix.mjs +169 -0
  65. package/src/commands/doctor.mjs +110 -0
  66. package/src/commands/init.mjs +49 -0
  67. package/src/commands/login.mjs +82 -0
  68. package/src/commands/model.mjs +130 -0
  69. package/src/commands/packs.mjs +44 -0
  70. package/src/commands/verify.mjs +133 -0
  71. package/src/commands/voice.mjs +84 -0
  72. package/src/kernel/config.mjs +232 -0
  73. package/src/kernel/document-model.mjs +1412 -0
  74. package/src/kernel/fact-gate.mjs +615 -0
  75. package/src/kernel/file-discovery.mjs +139 -0
  76. package/src/{binary-node.mjs → kernel/ooxml-binary.mjs} +532 -893
  77. package/src/kernel/pack-loader.mjs +715 -0
  78. package/src/kernel/patcher.mjs +341 -0
  79. package/src/kernel/pipeline.mjs +267 -0
  80. package/src/kernel/prompt-assembler.mjs +307 -0
  81. package/src/kernel/voice-profile.mjs +177 -0
  82. package/src/mcp/stdio-server.mjs +372 -0
  83. package/src/runners/auto-fix.mjs +59 -0
  84. package/src/runners/interactive-tty.mjs +461 -0
  85. package/src/runners/reporters.mjs +256 -0
  86. package/src/runtime/chunker.mjs +87 -0
  87. package/src/runtime/json-extract.mjs +144 -0
  88. package/src/runtime/privacy-gate.mjs +97 -0
  89. package/src/runtime/providers/anthropic.mjs +65 -0
  90. package/src/runtime/providers/cloud.mjs +136 -0
  91. package/src/runtime/providers/gemini.mjs +91 -0
  92. package/src/runtime/providers/local-model.mjs +139 -0
  93. package/src/runtime/providers/openai-compat.mjs +130 -0
  94. package/src/runtime/router.mjs +315 -0
  95. package/src/sdk/index.mjs +137 -0
  96. package/models/manifest.json +0 -90
  97. package/models/pocket-slop-v1.json +0 -1
  98. package/packs/business-brief/pack.json +0 -937
  99. package/packs/core/pack.json +0 -209
  100. package/packs/deck-and-ui/pack.json +0 -539
  101. package/packs/engineering-spec/pack.json +0 -144
  102. package/packs/executive-deck/pack.json +0 -98
  103. package/packs/literary-essay/pack.json +0 -344
  104. package/packs/regulated-comms/pack.json +0 -99
  105. package/patterns/ai-tic-rubric.json +0 -252
  106. package/patterns/banks/composite-fusion.json +0 -48
  107. package/patterns/banks/discourse-rhythm.json +0 -95
  108. package/patterns/banks/lexical-signals.json +0 -92
  109. package/patterns/banks/syntactic-frames.json +0 -52
  110. package/patterns/banks/visual-deck.json +0 -44
  111. package/patterns/dimensions/artifacts.json +0 -121
  112. package/patterns/dimensions/discourse.json +0 -438
  113. package/patterns/dimensions/lexical.json +0 -198
  114. package/patterns/dimensions/rhythm.json +0 -258
  115. package/patterns/dimensions/syntactic.json +0 -285
  116. package/patterns/dimensions/visual-and-deck.json +0 -530
  117. package/patterns/taxonomy.json +0 -112
  118. package/src/core.mjs +0 -5497
  119. package/src/dislop/review-picker.vim +0 -114
  120. package/src/local-model.mjs +0 -997
  121. package/src/pattern-engine.mjs +0 -1003
  122. package/src/pocket-model.mjs +0 -729
  123. package/src/review-apply.mjs +0 -151
  124. package/src/review-client.mjs +0 -1073
@@ -0,0 +1,139 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { DislopConfigError } from "./config.mjs";
4
+ import { detectFormatFromPath } from "./document-model.mjs";
5
+
6
+ const DEFAULT_IGNORED_DIRS = new Set([
7
+ ".git",
8
+ "node_modules",
9
+ "dist",
10
+ "build",
11
+ ".next",
12
+ "coverage",
13
+ "__pycache__",
14
+ ".venv",
15
+ "venv",
16
+ ]);
17
+
18
+ function expandBraces(pattern) {
19
+ const m = String(pattern || "").match(/\{([^{}]+)\}/);
20
+ if (!m) return [String(pattern || "")];
21
+ const prefix = pattern.slice(0, m.index);
22
+ const suffix = pattern.slice(m.index + m[0].length);
23
+ return m[1].split(",").flatMap((part) => expandBraces(prefix + part.trim() + suffix));
24
+ }
25
+
26
+ function globToRegExp(glob) {
27
+ const norm = String(glob || "")
28
+ .replace(/\\/g, "/")
29
+ .replace(/^\.\//, "");
30
+ let rx = "^";
31
+ for (let i = 0; i < norm.length; i += 1) {
32
+ const ch = norm[i];
33
+ if (ch === "*" && norm[i + 1] === "*") {
34
+ if (norm[i + 2] === "/") {
35
+ rx += "(?:.+/)?";
36
+ i += 2;
37
+ } else {
38
+ rx += ".*";
39
+ i += 1;
40
+ }
41
+ } else if (ch === "*") {
42
+ rx += "[^/]*";
43
+ } else if (ch === "?") {
44
+ rx += "[^/]";
45
+ } else if ("+.^$|()[]{}".includes(ch)) {
46
+ rx += `\\${ch}`;
47
+ } else {
48
+ rx += ch;
49
+ }
50
+ }
51
+ rx += "$";
52
+ return new RegExp(rx);
53
+ }
54
+
55
+ function walkDirectorySupportedFiles(rootDir, collector) {
56
+ for (const entry of fs.readdirSync(rootDir, { withFileTypes: true })) {
57
+ if (entry.isDirectory()) {
58
+ if (DEFAULT_IGNORED_DIRS.has(entry.name)) continue;
59
+ walkDirectorySupportedFiles(path.join(rootDir, entry.name), collector);
60
+ } else if (entry.isFile()) {
61
+ const full = path.join(rootDir, entry.name);
62
+ if (detectFormatFromPath(full)) {
63
+ collector.push(full);
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+ function walkAllFilesRelative(baseDir, relPrefix, collector) {
70
+ if (!fs.existsSync(baseDir)) return;
71
+ for (const entry of fs.readdirSync(baseDir, { withFileTypes: true })) {
72
+ const rel = relPrefix ? `${relPrefix}/${entry.name}` : entry.name;
73
+ const full = path.join(baseDir, entry.name);
74
+ if (entry.isDirectory()) {
75
+ if (DEFAULT_IGNORED_DIRS.has(entry.name)) continue;
76
+ walkAllFilesRelative(full, rel, collector);
77
+ } else if (entry.isFile()) {
78
+ collector.push({ rel, full });
79
+ }
80
+ }
81
+ }
82
+
83
+ function hasGlobMagic(input) {
84
+ return /[*?{}]/.test(input);
85
+ }
86
+
87
+ /**
88
+ * Expand positional file, directory, and glob targets into sorted absolute file paths.
89
+ */
90
+ export function expandTargetInputs(inputs, { cwd = process.cwd() } = {}) {
91
+ if (!inputs || inputs.length === 0) {
92
+ throw new DislopConfigError("Missing target <files/globs...>. Example: dislop check README.md");
93
+ }
94
+
95
+ const found = new Set();
96
+
97
+ for (const rawInput of inputs) {
98
+ const input = String(rawInput || "").trim();
99
+ if (!input) continue;
100
+
101
+ if (!hasGlobMagic(input)) {
102
+ const abs = path.resolve(cwd, input);
103
+ if (!fs.existsSync(abs)) {
104
+ throw new DislopConfigError(`Target path does not exist: '${input}'`);
105
+ }
106
+ const stat = fs.statSync(abs);
107
+ if (stat.isDirectory()) {
108
+ const dirFiles = [];
109
+ walkDirectorySupportedFiles(abs, dirFiles);
110
+ for (const f of dirFiles) found.add(f);
111
+ } else if (stat.isFile()) {
112
+ if (!detectFormatFromPath(abs)) {
113
+ throw new DislopConfigError(`Unsupported file extension: '${input}'`);
114
+ }
115
+ found.add(abs);
116
+ }
117
+ continue;
118
+ }
119
+
120
+ // Glob pattern expansion
121
+ const expandedPatterns = expandBraces(input);
122
+ const regexes = expandedPatterns.map(globToRegExp);
123
+ const candidates = [];
124
+ walkAllFilesRelative(cwd, "", candidates);
125
+
126
+ let matchedAny = false;
127
+ for (const cand of candidates) {
128
+ if (regexes.some((rx) => rx.test(cand.rel)) && detectFormatFromPath(cand.full)) {
129
+ found.add(cand.full);
130
+ matchedAny = true;
131
+ }
132
+ }
133
+ if (!matchedAny) {
134
+ throw new DislopConfigError(`Glob pattern matched no supported files: '${input}'`);
135
+ }
136
+ }
137
+
138
+ return Array.from(found).sort();
139
+ }