archymedes-cli 2.2.0 → 2.3.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.
@@ -2,14 +2,14 @@ import {
2
2
  padToWidth,
3
3
  progressBar,
4
4
  sliceToWidth
5
- } from "./archymedes-r54qthg5.mjs";
5
+ } from "./archymedes-g8y3rt6t.mjs";
6
6
  import {
7
7
  ASCII_GLYPHS,
8
8
  UNICODE_GLYPHS,
9
9
  visibleWidth
10
- } from "./archymedes-5zn4zp84.mjs";
10
+ } from "./archymedes-a10k8yrk.mjs";
11
11
 
12
- // packages/archymedes-cli/src/canvas.ts
12
+ // src/render/canvas.ts
13
13
  var BRAILLE_DOTS = [
14
14
  [1, 2, 4, 64],
15
15
  [8, 16, 32, 128]
@@ -95,7 +95,7 @@ function seriesBounds(values) {
95
95
  return { low, high, span: high - low === 0 ? 1 : high - low };
96
96
  }
97
97
 
98
- // packages/archymedes-cli/src/charts.ts
98
+ // src/render/charts.ts
99
99
  function barChart(data, options) {
100
100
  if (data.length === 0)
101
101
  return [];
@@ -253,4 +253,4 @@ function heatStrip(data, options) {
253
253
  });
254
254
  }
255
255
 
256
- export { BrailleCanvas, dotRowFor, seriesBounds, barChart, lineChart, plotSeries, scatterChart, waveLine, StreamSeries, heatStrip };
256
+ export { barChart, lineChart, plotSeries, scatterChart, waveLine, StreamSeries, heatStrip };
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  diffLines,
3
3
  languageOf
4
- } from "./archymedes-sc3mwttb.mjs";
5
- import"./archymedes-cdgejs3p.mjs";
4
+ } from "./archymedes-dz59nvw7.mjs";
5
+ import"./archymedes-tsne2m7p.mjs";
6
6
  import {
7
7
  NO_COLOR_PALETTE
8
- } from "./archymedes-5zn4zp84.mjs";
8
+ } from "./archymedes-a10k8yrk.mjs";
9
9
  import {
10
10
  __require
11
11
  } from "./archymedes-x67v3n58.mjs";
12
12
 
13
- // packages/archymedes-cli/src/editor-screen.tsx
13
+ // src/ui/editor-screen.tsx
14
14
  import { useInput, useState } from "@termuijs/jsx";
15
15
  import { Box, Text } from "@termuijs/widgets";
16
16
 
17
- // packages/archymedes-cli/src/editor.ts
17
+ // src/ui/editor.ts
18
18
  function initialEditorState(path, content, viewportRows = 20) {
19
19
  const lines = content.split(`
20
20
  `);
@@ -347,7 +347,7 @@ function caretInto(text, cursorCol) {
347
347
  return `${padded.slice(0, cursorCol)}█${padded.slice(cursorCol + 1)}`;
348
348
  }
349
349
 
350
- // packages/archymedes-cli/src/explain-view.ts
350
+ // src/ui/explain-view.ts
351
351
  var PATTERNS = {
352
352
  typescript: {
353
353
  imports: /^\s*import\b.*from\s+["'](.+)["']/,
@@ -436,6 +436,7 @@ function cycleExplainTab(state, step = 1) {
436
436
  function withAiExplanation(state, ai) {
437
437
  return { ...state, ai };
438
438
  }
439
+ var DEFAULT_EXPLAIN_COLORS = { success: "green", warning: "yellow", error: "red" };
439
440
  var TAB_LABELS = { facts: "Structure", notes: "Notes", diff: "Diff", ai: "AI" };
440
441
  function tabStrip(active) {
441
442
  const text = EXPLAIN_TABS.map((tab) => tab === active ? `[${TAB_LABELS[tab]}]` : ` ${TAB_LABELS[tab]} `).join(" ");
@@ -482,47 +483,47 @@ function factsRows(facts, width) {
482
483
  return [{ text: "No imports, exports, functions or classes recognised.", dim: true }];
483
484
  return rows.slice(0, -1);
484
485
  }
485
- function notesRows(notes, width) {
486
+ function notesRows(notes, width, colors) {
486
487
  if (notes.length === 0)
487
488
  return [{ text: "Nothing flagged.", dim: true }];
488
489
  return notes.slice(0, 60).map((entry) => ({
489
490
  text: `${String(entry.line).padStart(4)} ${entry.note}`.slice(0, width),
490
- color: entry.severity === "warn" ? "yellow" : undefined
491
+ color: entry.severity === "warn" ? colors.warning : undefined
491
492
  }));
492
493
  }
493
- function diffRows(diff, width) {
494
+ function diffRows(diff, width, colors) {
494
495
  if (diff.length === 0 || diff.every((line) => line.kind === "context")) {
495
496
  return [{ text: "No changes yet.", dim: true }];
496
497
  }
497
498
  return diff.filter((line) => line.kind !== "context").slice(0, 200).map((line) => ({
498
499
  text: `${line.kind === "add" ? "+" : "-"} ${line.text}`.slice(0, width),
499
- color: line.kind === "add" ? "green" : "red"
500
+ color: line.kind === "add" ? colors.success : colors.error
500
501
  }));
501
502
  }
502
- function aiRows(ai, width) {
503
+ function aiRows(ai, width, colors) {
503
504
  switch (ai.status) {
504
505
  case "idle":
505
506
  return [{ text: "Press ? to ask the model to explain this file.", dim: true }];
506
507
  case "loading":
507
508
  return [{ text: "Thinking…", dim: true }];
508
509
  case "error":
509
- return [{ text: `Could not get an explanation: ${ai.message}`, color: "red" }];
510
+ return [{ text: `Could not get an explanation: ${ai.message}`, color: colors.error }];
510
511
  case "ready":
511
512
  return ai.text.split(`
512
513
  `).flatMap((line) => wrap(line, width)).map((text) => ({ text }));
513
514
  }
514
515
  }
515
- function composeExplainPanel(input, width, height) {
516
+ function composeExplainPanel(input, width, height, colors = DEFAULT_EXPLAIN_COLORS) {
516
517
  const body = (() => {
517
518
  switch (input.panel.tab) {
518
519
  case "facts":
519
520
  return factsRows(structuralFacts(input.after, input.path), width);
520
521
  case "notes":
521
- return notesRows(annotateLines(input.after), width);
522
+ return notesRows(annotateLines(input.after), width, colors);
522
523
  case "diff":
523
- return diffRows(diffLines(input.before, input.after), width);
524
+ return diffRows(diffLines(input.before, input.after), width, colors);
524
525
  case "ai":
525
- return aiRows(input.panel.ai, width);
526
+ return aiRows(input.panel.ai, width, colors);
526
527
  }
527
528
  })();
528
529
  const rows = [tabStrip(input.panel.tab), hintRow(input.panel.tab), { text: "" }, ...body];
@@ -530,7 +531,7 @@ function composeExplainPanel(input, width, height) {
530
531
  return padded;
531
532
  }
532
533
 
533
- // packages/archymedes-cli/src/editor-screen.tsx
534
+ // src/ui/editor-screen.tsx
534
535
  import { jsxDEV } from "@termuijs/jsx/jsx-dev-runtime";
535
536
  var Panel = Box;
536
537
  var Line = Text;
@@ -584,12 +585,12 @@ function EditorScreen({ columns, rows, path, content, onExit, palette = NO_COLOR
584
585
  return next;
585
586
  });
586
587
  });
587
- const frame = composeEditorFrame(state, codeWidth, palette.accent);
588
+ const frame = composeEditorFrame(state, codeWidth, palette.tokens.accent);
588
589
  const lastRow = frame.length - 1;
589
590
  if (!panel.open && lastRow >= 0 && frame[lastRow].text.length + " ^E explain".length <= codeWidth) {
590
591
  frame[lastRow] = { ...frame[lastRow], text: `${frame[lastRow].text} ^E explain` };
591
592
  }
592
- const panelRows = panelWidth > 0 ? composeExplainPanel({ path, before: content, after: editorContent(state), panel }, panelWidth - 2, rows) : [];
593
+ const panelRows = panelWidth > 0 ? composeExplainPanel({ path, before: content, after: editorContent(state), panel }, panelWidth - 2, rows, palette.tokens) : [];
593
594
  return /* @__PURE__ */ jsxDEV(Panel, {
594
595
  flexDirection: "row",
595
596
  width: columns,