knodin 0.5.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 (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +590 -0
  3. package/dist/bin/cli.js +1704 -0
  4. package/dist/src/agent-integration.js +250 -0
  5. package/dist/src/artifact-refresh.js +81 -0
  6. package/dist/src/cli-args.js +267 -0
  7. package/dist/src/cli-model.js +324 -0
  8. package/dist/src/compact-structural.js +96 -0
  9. package/dist/src/competitive-constraints.js +20 -0
  10. package/dist/src/competitive-manifest.js +330 -0
  11. package/dist/src/competitive-measurement.js +183 -0
  12. package/dist/src/competitive-runner.js +453 -0
  13. package/dist/src/competitive-sandbox.js +108 -0
  14. package/dist/src/context-export.js +422 -0
  15. package/dist/src/context.js +102 -0
  16. package/dist/src/docs-sections.js +141 -0
  17. package/dist/src/doctor.js +380 -0
  18. package/dist/src/engine/ann-hnsw.js +271 -0
  19. package/dist/src/engine/embeddings.js +193 -0
  20. package/dist/src/engine/file-walker.js +43 -0
  21. package/dist/src/engine/index.js +13030 -0
  22. package/dist/src/engine/perf.js +115 -0
  23. package/dist/src/engine/prune.js +112 -0
  24. package/dist/src/engine/source-policy.js +69 -0
  25. package/dist/src/engine/sqlite.js +71 -0
  26. package/dist/src/engine/symbol-delete.js +58 -0
  27. package/dist/src/failure-diagnosis.js +590 -0
  28. package/dist/src/fleet.js +7 -0
  29. package/dist/src/git-executable.js +31 -0
  30. package/dist/src/graph-query-health.js +115 -0
  31. package/dist/src/index-activity.js +125 -0
  32. package/dist/src/init-progress-worker.js +107 -0
  33. package/dist/src/init-progress.js +155 -0
  34. package/dist/src/init.js +985 -0
  35. package/dist/src/lifecycle-health.js +213 -0
  36. package/dist/src/lsp-readonly.js +217 -0
  37. package/dist/src/output-compression.js +629 -0
  38. package/dist/src/output-telemetry.js +359 -0
  39. package/dist/src/pr-triage.js +638 -0
  40. package/dist/src/relationship-adapters.js +370 -0
  41. package/dist/src/release-attestation.js +533 -0
  42. package/dist/src/repair-progress-worker.js +121 -0
  43. package/dist/src/repair-progress.js +262 -0
  44. package/dist/src/repository-init-process.js +173 -0
  45. package/dist/src/repository-management.js +1089 -0
  46. package/dist/src/response-budget.js +184 -0
  47. package/dist/src/server.js +53 -0
  48. package/dist/src/system-config.js +615 -0
  49. package/dist/src/terminal-help.js +83 -0
  50. package/dist/src/tools/knodin-tools.js +1438 -0
  51. package/dist/src/tools/reckon-tools.js +5 -0
  52. package/dist/src/update-policy.js +944 -0
  53. package/dist/src/update-trust.js +503 -0
  54. package/dist/src/version.js +13 -0
  55. package/dist/src/visualization.js +162 -0
  56. package/dist/src/wait-for-fresh.js +98 -0
  57. package/dist/src/worktree-lifecycle.js +231 -0
  58. package/docs/CLI.md +39 -0
  59. package/docs/COMMAND-OUTPUT-COMPRESSION.md +194 -0
  60. package/docs/DEAD-CODE-AND-IMPACT.md +27 -0
  61. package/docs/DOCTOR-AND-UPDATES.md +84 -0
  62. package/docs/INDEXING-POLICY-AND-PROVENANCE.md +37 -0
  63. package/docs/INSTALLATION.md +208 -0
  64. package/docs/MCP.md +100 -0
  65. package/docs/PT-ACCESS-RECOMMENDATION.md +91 -0
  66. package/docs/RELEASE-0.3-EVIDENCE.md +73 -0
  67. package/docs/REPOSITORIES-AND-WORKTREES.md +81 -0
  68. package/docs/SIGNED-UPDATES.md +146 -0
  69. package/docs/SYSTEMS-AND-RELATIONSHIPS.md +45 -0
  70. package/docs/TELEMETRY.md +42 -0
  71. package/docs/releases/0.3.0.md +46 -0
  72. package/docs/releases/0.4.0.md +68 -0
  73. package/docs/releases/0.4.1.md +28 -0
  74. package/docs/releases/0.4.2.md +27 -0
  75. package/docs/releases/0.4.3.md +23 -0
  76. package/docs/releases/0.5.0.md +29 -0
  77. package/package.json +110 -0
  78. package/schemas/release-attestation-v1.schema.json +210 -0
  79. package/tree-sitter-prisma.wasm +0 -0
  80. package/tree-sitter-sql.wasm +0 -0
  81. package/tree-sitter-xml.wasm +0 -0
@@ -0,0 +1,83 @@
1
+ const DEFAULT_HELP_WIDTH = 100;
2
+ const MIN_HELP_WIDTH = 60;
3
+ function leadingWidth(line) {
4
+ return line.length - line.trimStart().length;
5
+ }
6
+ function logicalLines(template) {
7
+ const logical = [];
8
+ let current = null;
9
+ for (const raw of template.replaceAll("\t", " ").split("\n")) {
10
+ if (raw.trim() === "") {
11
+ if (current)
12
+ logical.push(current);
13
+ current = null;
14
+ logical.push(null);
15
+ continue;
16
+ }
17
+ if (current && leadingWidth(raw) >= 4) {
18
+ current.continuations.push(raw);
19
+ continue;
20
+ }
21
+ if (current)
22
+ logical.push(current);
23
+ current = { first: raw.trimEnd(), continuations: [] };
24
+ }
25
+ if (current)
26
+ logical.push(current);
27
+ return logical;
28
+ }
29
+ function wrapWords(text, firstPrefix, continuationPrefix, width) {
30
+ const words = text.trim().split(/\s+/);
31
+ const lines = [];
32
+ let line = firstPrefix;
33
+ for (const word of words) {
34
+ const separator = line.trim().length > 0 ? " " : "";
35
+ if (line.length + separator.length + word.length > width && line.trim().length > 0) {
36
+ lines.push(line.trimEnd());
37
+ line = `${continuationPrefix}${word}`;
38
+ }
39
+ else {
40
+ line += `${separator}${word}`;
41
+ }
42
+ }
43
+ if (line.trim().length > 0)
44
+ lines.push(line.trimEnd());
45
+ return lines;
46
+ }
47
+ function renderLogicalLine(line, width) {
48
+ const firstIndent = " ".repeat(leadingWidth(line.first));
49
+ const firstText = line.first.trim();
50
+ if (line.continuations.length === 0 && line.first.length <= width)
51
+ return [line.first];
52
+ const continuationColumn = line.continuations.length > 0
53
+ ? Math.min(...line.continuations.map(leadingWidth))
54
+ : leadingWidth(line.first);
55
+ const joined = [firstText, ...line.continuations.map((value) => value.trim())].join(" ");
56
+ if (line.continuations.length > 0 && firstIndent.length + firstText.length > width * 0.55) {
57
+ return wrapWords(joined, firstIndent, `${firstIndent} `, width);
58
+ }
59
+ const separator = /\s{2,}/.exec(firstText);
60
+ if (separator?.index !== undefined) {
61
+ const left = firstText.slice(0, separator.index).trimEnd();
62
+ const description = joined.slice(separator.index + separator[0].length).trim();
63
+ const descriptionColumn = Math.max(firstIndent.length + left.length + 2, continuationColumn);
64
+ return wrapWords(description, `${firstIndent}${left}${" ".repeat(Math.max(2, descriptionColumn - firstIndent.length - left.length))}`, " ".repeat(descriptionColumn), width);
65
+ }
66
+ if (line.continuations.length > 0) {
67
+ const commandWidth = firstIndent.length + firstText.length;
68
+ const descriptionColumn = Math.max(commandWidth + 2, continuationColumn);
69
+ const description = line.continuations.map((value) => value.trim()).join(" ");
70
+ return wrapWords(description, `${firstIndent}${firstText}${" ".repeat(Math.max(2, descriptionColumn - commandWidth))}`, " ".repeat(descriptionColumn), width);
71
+ }
72
+ return wrapWords(firstText, firstIndent, firstIndent, width);
73
+ }
74
+ /** Reflow authored help to the active TTY, with a deterministic width for piped output. */
75
+ export function formatTerminalHelp(template, columns) {
76
+ const width = columns === undefined || !Number.isFinite(columns)
77
+ ? DEFAULT_HELP_WIDTH
78
+ : Math.max(MIN_HELP_WIDTH, Math.floor(columns) - 1);
79
+ const rendered = logicalLines(template).flatMap((line) => line === null ? [""] : renderLogicalLine(line, width));
80
+ while (rendered.at(-1) === "")
81
+ rendered.pop();
82
+ return `${rendered.join("\n")}\n`;
83
+ }