@fresh-editor/fresh-editor 0.3.7 → 0.3.8
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/CHANGELOG.md +48 -0
- package/package.json +1 -1
- package/plugins/audit_mode.i18n.json +28 -0
- package/plugins/audit_mode.ts +34 -3
- package/plugins/config-schema.json +7 -0
- package/plugins/env-manager.ts +168 -0
- package/plugins/git_log.ts +58 -75
- package/plugins/lib/fresh.d.ts +109 -2
- package/plugins/live_diff.ts +12 -17
- package/plugins/orchestrator.ts +320 -182
- package/plugins/pkg.ts +168 -3
- package/plugins/schemas/theme.schema.json +53 -14
- package/plugins/theme_editor.i18n.json +84 -84
- package/plugins/tsconfig.json +1 -0
- package/themes/light.json +1 -1
- package/themes/terminal.json +3 -3
package/plugins/lib/fresh.d.ts
CHANGED
|
@@ -621,6 +621,50 @@ type TerminalResult = {
|
|
|
621
621
|
*/
|
|
622
622
|
splitId: number | null;
|
|
623
623
|
};
|
|
624
|
+
type CreateWindowWithTerminalOptions = {
|
|
625
|
+
/**
|
|
626
|
+
* Absolute path to the new session's worktree / project
|
|
627
|
+
* root. Relative paths are rejected (logged, no window
|
|
628
|
+
* created).
|
|
629
|
+
*/
|
|
630
|
+
root: string;
|
|
631
|
+
/**
|
|
632
|
+
* Human-readable label for the new session. When empty,
|
|
633
|
+
* defaults to the basename of `root`.
|
|
634
|
+
*/
|
|
635
|
+
label: string;
|
|
636
|
+
/**
|
|
637
|
+
* Working directory for the spawned terminal. Defaults to
|
|
638
|
+
* `root` when omitted.
|
|
639
|
+
*/
|
|
640
|
+
cwd?: string;
|
|
641
|
+
/**
|
|
642
|
+
* Argv to spawn directly inside the PTY. `None` keeps the
|
|
643
|
+
* shell-and-type behaviour; `Some([cmd, ...args])` runs the
|
|
644
|
+
* command as the PTY child (used by Orchestrator so the
|
|
645
|
+
* agent process is the PTY's direct child).
|
|
646
|
+
*/
|
|
647
|
+
command?: Array<string>;
|
|
648
|
+
/**
|
|
649
|
+
* Tab title override. Defaults to `command[0]`'s basename
|
|
650
|
+
* when `command` is set, or "Terminal N" otherwise.
|
|
651
|
+
*/
|
|
652
|
+
title?: string;
|
|
653
|
+
};
|
|
654
|
+
type SessionWithTerminalResult = {
|
|
655
|
+
/**
|
|
656
|
+
* The new window's id.
|
|
657
|
+
*/
|
|
658
|
+
windowId: number;
|
|
659
|
+
/**
|
|
660
|
+
* The seeded terminal's id (for `sendTerminalInput`, etc.).
|
|
661
|
+
*/
|
|
662
|
+
terminalId: number;
|
|
663
|
+
/**
|
|
664
|
+
* The seeded terminal buffer's id.
|
|
665
|
+
*/
|
|
666
|
+
bufferId: number;
|
|
667
|
+
};
|
|
624
668
|
type CreateTerminalOptions = {
|
|
625
669
|
/**
|
|
626
670
|
* Working directory for the terminal (defaults to editor cwd)
|
|
@@ -722,6 +766,13 @@ type OverlayOptions = {
|
|
|
722
766
|
*/
|
|
723
767
|
extendToLineEnd: boolean;
|
|
724
768
|
/**
|
|
769
|
+
* When `true`, `fg` is applied only on cells whose existing fg
|
|
770
|
+
* matches this overlay's resolved bg — i.e. a same-colour fg/bg
|
|
771
|
+
* collision. Lets a row-wide overlay stay legible on tokens that
|
|
772
|
+
* share the bg's colour without repainting unrelated tokens.
|
|
773
|
+
*/
|
|
774
|
+
fgOnCollisionOnly: boolean;
|
|
775
|
+
/**
|
|
725
776
|
* Optional URL for OSC 8 terminal hyperlinks.
|
|
726
777
|
* When set, the overlay text becomes a clickable hyperlink in terminals
|
|
727
778
|
* that support OSC 8 escape sequences.
|
|
@@ -1006,7 +1057,7 @@ type WidgetSpec = {
|
|
|
1006
1057
|
* `WidgetMutation::SetCompletions`. An empty `items`
|
|
1007
1058
|
* closes the popup.
|
|
1008
1059
|
*/
|
|
1009
|
-
completions?: Array<string>;
|
|
1060
|
+
completions?: Array<string | CompletionItem>;
|
|
1010
1061
|
/**
|
|
1011
1062
|
* How many candidate rows the popup paints at once
|
|
1012
1063
|
* when it opens. Excess candidates stay reachable
|
|
@@ -1091,7 +1142,7 @@ type WidgetMutation = {
|
|
|
1091
1142
|
} | {
|
|
1092
1143
|
"kind": "setCompletions";
|
|
1093
1144
|
widgetKey: string;
|
|
1094
|
-
items: Array<string>;
|
|
1145
|
+
items: Array<string | CompletionItem>;
|
|
1095
1146
|
} | {
|
|
1096
1147
|
"kind": "setChecked";
|
|
1097
1148
|
widgetKey: string;
|
|
@@ -1813,6 +1864,41 @@ interface EditorAPI {
|
|
|
1813
1864
|
*/
|
|
1814
1865
|
getAuthorityLabel(): string;
|
|
1815
1866
|
/**
|
|
1867
|
+
* Current Workspace Trust level for the active project:
|
|
1868
|
+
* `"restricted"`, `"trusted"`, or `"blocked"` (empty `""` when trust
|
|
1869
|
+
* state is unavailable, e.g. the default local authority).
|
|
1870
|
+
*
|
|
1871
|
+
* Trust is a per-project, user-granted decision. Plugins that run
|
|
1872
|
+
* repo-controlled work (env activation, project tooling, repo-local
|
|
1873
|
+
* binaries) MUST gate on this and treat anything other than
|
|
1874
|
+
* `"trusted"` as "do not execute".
|
|
1875
|
+
*/
|
|
1876
|
+
workspaceTrustLevel(): "restricted" | "trusted" | "blocked" | "";
|
|
1877
|
+
/**
|
|
1878
|
+
* Activate an environment by setting the live env recipe: an activation
|
|
1879
|
+
* shell `snippet` (e.g. `eval "$(direnv export bash)"`,
|
|
1880
|
+
* `source .venv/bin/activate`, or `""` for a pure login shell) run in
|
|
1881
|
+
* `dir` (defaults to the workspace). It is re-evaluated on demand on the
|
|
1882
|
+
* active backend and applied to every spawn — language servers,
|
|
1883
|
+
* formatters, `spawnProcess` — so they see the project environment. No
|
|
1884
|
+
* authority rebuild; the LSP is restarted to pick it up.
|
|
1885
|
+
*
|
|
1886
|
+
* Honored only when `workspaceTrustLevel() === "trusted"` (it runs
|
|
1887
|
+
* repo-controlled code). Call `clearEnv()` to deactivate.
|
|
1888
|
+
*/
|
|
1889
|
+
setEnv(snippet: string, dir?: string): void;
|
|
1890
|
+
/**
|
|
1891
|
+
* Deactivate the environment set by `setEnv` — spawns return to the
|
|
1892
|
+
* inherited environment.
|
|
1893
|
+
*/
|
|
1894
|
+
clearEnv(): void;
|
|
1895
|
+
/**
|
|
1896
|
+
* Whether an environment is currently active (a recipe was set via
|
|
1897
|
+
* `setEnv`). Survives the restart `setEnv` triggers, so a plugin can
|
|
1898
|
+
* re-establish its file watch and reflect activation after reloading.
|
|
1899
|
+
*/
|
|
1900
|
+
envActive(): boolean;
|
|
1901
|
+
/**
|
|
1816
1902
|
* Join path components (variadic - accepts multiple string arguments)
|
|
1817
1903
|
* Always uses forward slashes for cross-platform consistency (like Node.js path.posix.join)
|
|
1818
1904
|
*
|
|
@@ -2799,6 +2885,19 @@ interface EditorAPI {
|
|
|
2799
2885
|
*/
|
|
2800
2886
|
clearRemoteIndicatorState(): void;
|
|
2801
2887
|
/**
|
|
2888
|
+
* Fetch a URL over HTTP(S) and stream the response body into `target_path`.
|
|
2889
|
+
*
|
|
2890
|
+
* Resolves with a `SpawnResult`-shaped value: `exit_code` is `0` on a
|
|
2891
|
+
* 2xx response (file written), the HTTP status code on non-2xx
|
|
2892
|
+
* (target file untouched), and `-1` on transport errors. `stderr`
|
|
2893
|
+
* carries an error message in the non-success cases; `stdout` is
|
|
2894
|
+
* always empty.
|
|
2895
|
+
*
|
|
2896
|
+
* This uses the editor's built-in HTTP client (`ureq`), so plugins
|
|
2897
|
+
* don't need `curl`/`wget` on PATH.
|
|
2898
|
+
*/
|
|
2899
|
+
httpFetch(url: string, targetPath: string): ProcessHandle<SpawnResult>;
|
|
2900
|
+
/**
|
|
2802
2901
|
* Wait for a process to complete and get its result (async)
|
|
2803
2902
|
*/
|
|
2804
2903
|
spawnProcessWait(processId: number): Promise<SpawnResult>;
|
|
@@ -2851,6 +2950,14 @@ interface EditorAPI {
|
|
|
2851
2950
|
*/
|
|
2852
2951
|
createTerminal(opts?: CreateTerminalOptions): Promise<TerminalResult>;
|
|
2853
2952
|
/**
|
|
2953
|
+
* Create a new editor window seeded with an agent terminal as
|
|
2954
|
+
* its only buffer. Atomic — replaces the legacy
|
|
2955
|
+
* `createWindow` + `setActiveWindow` + `createTerminal`
|
|
2956
|
+
* chain that left a transient `[No Name]` tab alongside the
|
|
2957
|
+
* agent terminal.
|
|
2958
|
+
*/
|
|
2959
|
+
createWindowWithTerminal(opts: CreateWindowWithTerminalOptions): Promise<SessionWithTerminalResult>;
|
|
2960
|
+
/**
|
|
2854
2961
|
* Send input data to a terminal
|
|
2855
2962
|
*/
|
|
2856
2963
|
sendTerminalInput(terminalId: number, data: string): boolean;
|
package/plugins/live_diff.ts
CHANGED
|
@@ -38,19 +38,18 @@ const PRIORITY = 9;
|
|
|
38
38
|
|
|
39
39
|
// Theme keys for backgrounds and "on top of bg" foregrounds. These
|
|
40
40
|
// are resolved at render time by the editor, so the diff colors track
|
|
41
|
-
// the active theme automatically. The `editor.diff_*
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
// override `editor.diff_*_fg` to a contrasting color.
|
|
41
|
+
// the active theme automatically. The `editor.diff_*_collision_fg`
|
|
42
|
+
// keys pair with `fgOnCollisionOnly: true` below: themes that define
|
|
43
|
+
// them get a contrasting fg painted only on cells whose syntax fg
|
|
44
|
+
// happens to match the diff bg (e.g. ANSI Green-on-Green); every
|
|
45
|
+
// other cell keeps its syntax colour.
|
|
47
46
|
const THEME = {
|
|
48
47
|
addedBg: "editor.diff_add_bg",
|
|
49
|
-
addedFg: "editor.
|
|
48
|
+
addedFg: "editor.diff_add_collision_fg",
|
|
50
49
|
modifiedBg: "editor.diff_modify_bg",
|
|
51
|
-
modifiedFg: "editor.
|
|
50
|
+
modifiedFg: "editor.diff_modify_collision_fg",
|
|
52
51
|
removedBg: "editor.diff_remove_bg",
|
|
53
|
-
removedFg: "editor.
|
|
52
|
+
removedFg: "editor.diff_remove_collision_fg",
|
|
54
53
|
};
|
|
55
54
|
|
|
56
55
|
// `setLineIndicator` only accepts RGB triples (not theme keys), so the
|
|
@@ -845,14 +844,9 @@ function renderHunks(state: BufferDiffState, newLines: string[]): void {
|
|
|
845
844
|
for (const h of state.hunks) {
|
|
846
845
|
if (h.kind === "added" || h.kind === "modified") {
|
|
847
846
|
const bg = h.kind === "added" ? THEME.addedBg : THEME.modifiedBg;
|
|
848
|
-
//
|
|
849
|
-
//
|
|
850
|
-
//
|
|
851
|
-
// otherwise collide with same-named syntax colors) get a
|
|
852
|
-
// contrasting fg painted on; themes that don't define the key
|
|
853
|
-
// resolve to `None` in `OverlayFace::ThemedStyle`, so the
|
|
854
|
-
// overlay leaves the cell's fg alone and syntax highlighting
|
|
855
|
-
// shows through unchanged.
|
|
847
|
+
// `fgOnCollisionOnly` keeps syntax highlighting intact on the
|
|
848
|
+
// rest of the line and only paints `fg` where a token's colour
|
|
849
|
+
// would otherwise be invisible against the diff bg.
|
|
856
850
|
const fg = h.kind === "added" ? THEME.addedFg : THEME.modifiedFg;
|
|
857
851
|
for (let i = 0; i < h.newCount; i++) {
|
|
858
852
|
const line = h.newStart + i;
|
|
@@ -871,6 +865,7 @@ function renderHunks(state: BufferDiffState, newLines: string[]): void {
|
|
|
871
865
|
editor.addOverlay(bid, NS_OVERLAY, start, end, {
|
|
872
866
|
bg,
|
|
873
867
|
fg,
|
|
868
|
+
fgOnCollisionOnly: true,
|
|
874
869
|
underline: false,
|
|
875
870
|
bold: false,
|
|
876
871
|
italic: false,
|