@fnndsc/chell 4.4.0 → 5.0.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.
- package/dist/builtins/sys/prompt.js +2 -2
- package/dist/builtins/sys/prompt.js.map +1 -1
- package/dist/chell.d.ts +2 -2
- package/dist/chell.js +2 -2
- package/dist/chell.js.map +1 -1
- package/dist/config/settings.d.ts +4 -2
- package/dist/config/settings.js +7 -2
- package/dist/config/settings.js.map +1 -1
- package/dist/core/boot.js +49 -60
- package/dist/core/boot.js.map +1 -1
- package/dist/core/cliSurface.d.ts +1 -1
- package/dist/core/cliSurface.js +1 -1
- package/dist/core/cliSurface.js.map +1 -1
- package/dist/core/progressRenderer.d.ts +2 -2
- package/dist/core/prompt/session.d.ts +26 -1
- package/dist/core/prompt/session.js +25 -20
- package/dist/core/prompt/session.js.map +1 -1
- package/dist/core/repl.d.ts +2 -2
- package/dist/core/repl.js +6 -4
- package/dist/core/repl.js.map +1 -1
- package/dist/core/surfaceDispatch.d.ts +21 -0
- package/dist/core/surfaceDispatch.js +33 -0
- package/dist/core/surfaceDispatch.js.map +1 -0
- package/dist/remote/client.js +2 -2
- package/dist/remote/client.js.map +1 -1
- package/dist/remote/remoteEngine.d.ts +3 -3
- package/dist/remote/remoteEngine.js +7 -4
- package/dist/remote/remoteEngine.js.map +1 -1
- package/package.json +5 -5
- package/dist/builtins/debug.d.ts +0 -8
- package/dist/builtins/debug.js +0 -39
- package/dist/builtins/debug.js.map +0 -1
- package/dist/builtins/executable.d.ts +0 -22
- package/dist/builtins/executable.js +0 -115
- package/dist/builtins/executable.js.map +0 -1
- package/dist/builtins/fs/cat.d.ts +0 -16
- package/dist/builtins/fs/cat.js +0 -266
- package/dist/builtins/fs/cat.js.map +0 -1
- package/dist/builtins/fs/cd.d.ts +0 -42
- package/dist/builtins/fs/cd.js +0 -193
- package/dist/builtins/fs/cd.js.map +0 -1
- package/dist/builtins/fs/cp.d.ts +0 -10
- package/dist/builtins/fs/cp.js +0 -86
- package/dist/builtins/fs/cp.js.map +0 -1
- package/dist/builtins/fs/download.d.ts +0 -6
- package/dist/builtins/fs/download.js +0 -45
- package/dist/builtins/fs/download.js.map +0 -1
- package/dist/builtins/fs/du.d.ts +0 -58
- package/dist/builtins/fs/du.js +0 -210
- package/dist/builtins/fs/du.js.map +0 -1
- package/dist/builtins/fs/edit.d.ts +0 -7
- package/dist/builtins/fs/edit.js +0 -104
- package/dist/builtins/fs/edit.js.map +0 -1
- package/dist/builtins/fs/ls.d.ts +0 -8
- package/dist/builtins/fs/ls.js +0 -68
- package/dist/builtins/fs/ls.js.map +0 -1
- package/dist/builtins/fs/mkdir.d.ts +0 -9
- package/dist/builtins/fs/mkdir.js +0 -52
- package/dist/builtins/fs/mkdir.js.map +0 -1
- package/dist/builtins/fs/mv.d.ts +0 -10
- package/dist/builtins/fs/mv.js +0 -88
- package/dist/builtins/fs/mv.js.map +0 -1
- package/dist/builtins/fs/pull.args.d.ts +0 -22
- package/dist/builtins/fs/pull.args.js +0 -30
- package/dist/builtins/fs/pull.args.js.map +0 -1
- package/dist/builtins/fs/pull.d.ts +0 -26
- package/dist/builtins/fs/pull.js +0 -445
- package/dist/builtins/fs/pull.js.map +0 -1
- package/dist/builtins/fs/pwd.d.ts +0 -10
- package/dist/builtins/fs/pwd.js +0 -73
- package/dist/builtins/fs/pwd.js.map +0 -1
- package/dist/builtins/fs/rm.d.ts +0 -37
- package/dist/builtins/fs/rm.js +0 -197
- package/dist/builtins/fs/rm.js.map +0 -1
- package/dist/builtins/fs/touch.d.ts +0 -9
- package/dist/builtins/fs/touch.js +0 -76
- package/dist/builtins/fs/touch.js.map +0 -1
- package/dist/builtins/fs/tree.d.ts +0 -15
- package/dist/builtins/fs/tree.js +0 -84
- package/dist/builtins/fs/tree.js.map +0 -1
- package/dist/builtins/fs/upload.d.ts +0 -6
- package/dist/builtins/fs/upload.js +0 -48
- package/dist/builtins/fs/upload.js.map +0 -1
- package/dist/builtins/help.d.ts +0 -74
- package/dist/builtins/help.js +0 -1217
- package/dist/builtins/help.js.map +0 -1
- package/dist/builtins/index.d.ts +0 -46
- package/dist/builtins/index.js +0 -46
- package/dist/builtins/index.js.map +0 -1
- package/dist/builtins/net/connect.d.ts +0 -7
- package/dist/builtins/net/connect.js +0 -42
- package/dist/builtins/net/connect.js.map +0 -1
- package/dist/builtins/net/cubepath.d.ts +0 -18
- package/dist/builtins/net/cubepath.js +0 -102
- package/dist/builtins/net/cubepath.js.map +0 -1
- package/dist/builtins/net/logout.d.ts +0 -6
- package/dist/builtins/net/logout.js +0 -24
- package/dist/builtins/net/logout.js.map +0 -1
- package/dist/builtins/net/pacs.d.ts +0 -24
- package/dist/builtins/net/pacs.js +0 -121
- package/dist/builtins/net/pacs.js.map +0 -1
- package/dist/builtins/net/pacsUtils.d.ts +0 -85
- package/dist/builtins/net/pacsUtils.js +0 -184
- package/dist/builtins/net/pacsUtils.js.map +0 -1
- package/dist/builtins/net/query.d.ts +0 -60
- package/dist/builtins/net/query.js +0 -324
- package/dist/builtins/net/query.js.map +0 -1
- package/dist/builtins/parametersofplugin.d.ts +0 -13
- package/dist/builtins/parametersofplugin.js +0 -43
- package/dist/builtins/parametersofplugin.js.map +0 -1
- package/dist/builtins/pluginExecute.d.ts +0 -27
- package/dist/builtins/pluginExecute.js +0 -165
- package/dist/builtins/pluginExecute.js.map +0 -1
- package/dist/builtins/proc.d.ts +0 -6
- package/dist/builtins/proc.helpers.d.ts +0 -68
- package/dist/builtins/proc.helpers.js +0 -102
- package/dist/builtins/proc.helpers.js.map +0 -1
- package/dist/builtins/proc.js +0 -289
- package/dist/builtins/proc.js.map +0 -1
- package/dist/builtins/res/compute.d.ts +0 -6
- package/dist/builtins/res/compute.js +0 -55
- package/dist/builtins/res/compute.js.map +0 -1
- package/dist/builtins/res/feed.d.ts +0 -6
- package/dist/builtins/res/feed.js +0 -244
- package/dist/builtins/res/feed.js.map +0 -1
- package/dist/builtins/res/feed.notes.d.ts +0 -28
- package/dist/builtins/res/feed.notes.js +0 -24
- package/dist/builtins/res/feed.notes.js.map +0 -1
- package/dist/builtins/res/files.d.ts +0 -18
- package/dist/builtins/res/files.js +0 -85
- package/dist/builtins/res/files.js.map +0 -1
- package/dist/builtins/res/group.d.ts +0 -6
- package/dist/builtins/res/group.js +0 -54
- package/dist/builtins/res/group.js.map +0 -1
- package/dist/builtins/res/pipeline.args.d.ts +0 -22
- package/dist/builtins/res/pipeline.args.js +0 -28
- package/dist/builtins/res/pipeline.args.js.map +0 -1
- package/dist/builtins/res/pipeline.d.ts +0 -20
- package/dist/builtins/res/pipeline.js +0 -252
- package/dist/builtins/res/pipeline.js.map +0 -1
- package/dist/builtins/res/plugin.d.ts +0 -13
- package/dist/builtins/res/plugin.js +0 -140
- package/dist/builtins/res/plugin.js.map +0 -1
- package/dist/builtins/res/plugininstance.d.ts +0 -6
- package/dist/builtins/res/plugininstance.js +0 -53
- package/dist/builtins/res/plugininstance.js.map +0 -1
- package/dist/builtins/res/pluginmeta.d.ts +0 -6
- package/dist/builtins/res/pluginmeta.js +0 -53
- package/dist/builtins/res/pluginmeta.js.map +0 -1
- package/dist/builtins/res/tag.d.ts +0 -6
- package/dist/builtins/res/tag.js +0 -53
- package/dist/builtins/res/tag.js.map +0 -1
- package/dist/builtins/res/workflow.d.ts +0 -6
- package/dist/builtins/res/workflow.js +0 -53
- package/dist/builtins/res/workflow.js.map +0 -1
- package/dist/builtins/store.d.ts +0 -6
- package/dist/builtins/store.js +0 -108
- package/dist/builtins/store.js.map +0 -1
- package/dist/builtins/sys/context.d.ts +0 -6
- package/dist/builtins/sys/context.js +0 -50
- package/dist/builtins/sys/context.js.map +0 -1
- package/dist/builtins/sys/physicalmode.d.ts +0 -8
- package/dist/builtins/sys/physicalmode.js +0 -34
- package/dist/builtins/sys/physicalmode.js.map +0 -1
- package/dist/builtins/sys/timing.d.ts +0 -8
- package/dist/builtins/sys/timing.js +0 -34
- package/dist/builtins/sys/timing.js.map +0 -1
- package/dist/builtins/sys/version.d.ts +0 -15
- package/dist/builtins/sys/version.js +0 -23
- package/dist/builtins/sys/version.js.map +0 -1
- package/dist/builtins/sys/whoami.d.ts +0 -17
- package/dist/builtins/sys/whoami.js +0 -44
- package/dist/builtins/sys/whoami.js.map +0 -1
- package/dist/builtins/utils.d.ts +0 -55
- package/dist/builtins/utils.js +0 -145
- package/dist/builtins/utils.js.map +0 -1
- package/dist/builtins/wildcard.d.ts +0 -26
- package/dist/builtins/wildcard.js +0 -120
- package/dist/builtins/wildcard.js.map +0 -1
- package/dist/calypso.d.ts +0 -13
- package/dist/calypso.js +0 -44
- package/dist/calypso.js.map +0 -1
- package/dist/command-keys.d.ts +0 -8
- package/dist/command-keys.js +0 -32
- package/dist/command-keys.js.map +0 -1
- package/dist/core/dispatch.d.ts +0 -101
- package/dist/core/dispatch.js +0 -636
- package/dist/core/dispatch.js.map +0 -1
- package/dist/core/engine.d.ts +0 -91
- package/dist/core/engine.js +0 -222
- package/dist/core/engine.js.map +0 -1
- package/dist/core/preprocess.d.ts +0 -46
- package/dist/core/preprocess.js +0 -146
- package/dist/core/preprocess.js.map +0 -1
- package/dist/core/progress.d.ts +0 -25
- package/dist/core/progress.js +0 -10
- package/dist/core/progress.js.map +0 -1
- package/dist/core/question.d.ts +0 -27
- package/dist/core/question.js +0 -33
- package/dist/core/question.js.map +0 -1
- package/dist/core/sink.d.ts +0 -201
- package/dist/core/sink.js +0 -300
- package/dist/core/sink.js.map +0 -1
- package/dist/core/surface.d.ts +0 -172
- package/dist/core/surface.js +0 -105
- package/dist/core/surface.js.map +0 -1
- package/dist/core/version.d.ts +0 -20
- package/dist/core/version.js +0 -82
- package/dist/core/version.js.map +0 -1
- package/dist/daemon/launch.d.ts +0 -9
- package/dist/daemon/launch.js +0 -82
- package/dist/daemon/launch.js.map +0 -1
- package/dist/lib/completer/index.d.ts +0 -15
- package/dist/lib/completer/index.js +0 -212
- package/dist/lib/completer/index.js.map +0 -1
- package/dist/lib/completer/pathComplete.helpers.d.ts +0 -22
- package/dist/lib/completer/pathComplete.helpers.js +0 -49
- package/dist/lib/completer/pathComplete.helpers.js.map +0 -1
- package/dist/lib/parser.d.ts +0 -13
- package/dist/lib/parser.js +0 -52
- package/dist/lib/parser.js.map +0 -1
- package/dist/lib/pipe.d.ts +0 -11
- package/dist/lib/pipe.js +0 -90
- package/dist/lib/pipe.js.map +0 -1
- package/dist/lib/prefetch.d.ts +0 -25
- package/dist/lib/prefetch.js +0 -64
- package/dist/lib/prefetch.js.map +0 -1
- package/dist/lib/semicolonParser.d.ts +0 -22
- package/dist/lib/semicolonParser.js +0 -53
- package/dist/lib/semicolonParser.js.map +0 -1
- package/dist/lib/spinner.d.ts +0 -23
- package/dist/lib/spinner.js +0 -71
- package/dist/lib/spinner.js.map +0 -1
- package/dist/lib/vfs/providers/static.d.ts +0 -65
- package/dist/lib/vfs/providers/static.js +0 -164
- package/dist/lib/vfs/providers/static.js.map +0 -1
- package/dist/lib/vfs/providers/static_content.d.ts +0 -27
- package/dist/lib/vfs/providers/static_content.js +0 -180
- package/dist/lib/vfs/providers/static_content.js.map +0 -1
- package/dist/lib/vfs/vfs.d.ts +0 -59
- package/dist/lib/vfs/vfs.js +0 -202
- package/dist/lib/vfs/vfs.js.map +0 -1
- package/dist/remote/discovery.d.ts +0 -23
- package/dist/remote/discovery.js +0 -55
- package/dist/remote/discovery.js.map +0 -1
- package/dist/session/index.d.ts +0 -76
- package/dist/session/index.js +0 -120
- package/dist/session/index.js.map +0 -1
package/dist/core/surface.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Surface capabilities: the input/interaction seam a host provides.
|
|
3
|
-
*
|
|
4
|
-
* The output sink (`./sink.js`) lets a host decide where a command's output
|
|
5
|
-
* goes. This module is its input-side counterpart: it lets a host declare
|
|
6
|
-
* what *interaction* it can offer — prompting for a line, reading a secret
|
|
7
|
-
* without echo, opening a local editor — and lets a builtin ask for a
|
|
8
|
-
* capability and fail with a clear message when the attached surface cannot
|
|
9
|
-
* provide it, rather than hanging on a standard input that is not there.
|
|
10
|
-
*
|
|
11
|
-
* The CLI host backs this with readline and the local `$EDITOR`; a future
|
|
12
|
-
* daemon backs it with request messages to a remote surface, and a surface
|
|
13
|
-
* that cannot (say) open a local editor simply declares `localEdit: false`.
|
|
14
|
-
*
|
|
15
|
-
* Capabilities the surface can act on directly (prompting) are methods here;
|
|
16
|
-
* capabilities a builtin still performs itself (local editing, whose editor
|
|
17
|
-
* mechanics remain in the `edit` builtin until a remote surface needs its
|
|
18
|
-
* own implementation) are declared as flags a builtin gates on via
|
|
19
|
-
* {@link capability_require}. This module is deliberately free of Node
|
|
20
|
-
* built-ins so it stays trivially testable and host-agnostic; the readline
|
|
21
|
-
* implementation lives in `./cliSurface.js`.
|
|
22
|
-
*
|
|
23
|
-
* @see docs/calypso.adoc — "Interactivity is a declared surface capability".
|
|
24
|
-
* @module
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Raised when a builtin requests an interaction the attached surface cannot
|
|
28
|
-
* provide. Carries the capability name so a host can present it uniformly.
|
|
29
|
-
*/
|
|
30
|
-
export class CapabilityError extends Error {
|
|
31
|
-
/** The capability that was required but absent. */
|
|
32
|
-
capability;
|
|
33
|
-
/**
|
|
34
|
-
* @param capability - The missing capability.
|
|
35
|
-
* @param message - Human-readable explanation.
|
|
36
|
-
*/
|
|
37
|
-
constructor(capability, message) {
|
|
38
|
-
super(message);
|
|
39
|
-
this.name = 'CapabilityError';
|
|
40
|
-
this.capability = capability;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The default surface for a host that has not installed one: it can do
|
|
45
|
-
* nothing interactive and says so clearly. This is the correct default for
|
|
46
|
-
* an unknown host — a CLI host replaces it (see `./cliSurface.js`), and any
|
|
47
|
-
* attempt to prompt or edit before a real surface is installed fails loudly
|
|
48
|
-
* instead of hanging.
|
|
49
|
-
*/
|
|
50
|
-
export class HeadlessSurface {
|
|
51
|
-
/** @inheritdoc */
|
|
52
|
-
capabilities = {
|
|
53
|
-
hiddenInput: false,
|
|
54
|
-
localEdit: false,
|
|
55
|
-
tty: false,
|
|
56
|
-
pipeSegments: false,
|
|
57
|
-
};
|
|
58
|
-
/** @inheritdoc */
|
|
59
|
-
prompt(_request) {
|
|
60
|
-
throw new CapabilityError('tty', 'This surface cannot prompt for input.');
|
|
61
|
-
}
|
|
62
|
-
/** @inheritdoc */
|
|
63
|
-
pipeSegment(_command, _input) {
|
|
64
|
-
throw new CapabilityError('pipeSegments', 'This surface cannot run pipeline segments.');
|
|
65
|
-
}
|
|
66
|
-
/** @inheritdoc */
|
|
67
|
-
localEdit(_request) {
|
|
68
|
-
throw new CapabilityError('localEdit', 'This surface cannot open a local editor.');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/** The active surface. Defaults to headless until a host installs one. */
|
|
72
|
-
let activeSurface = new HeadlessSurface();
|
|
73
|
-
/**
|
|
74
|
-
* Returns the currently installed surface.
|
|
75
|
-
*
|
|
76
|
-
* @returns The active surface.
|
|
77
|
-
*/
|
|
78
|
-
export function surface_get() {
|
|
79
|
-
return activeSurface;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Installs a surface. Called by the host that owns the interaction channel.
|
|
83
|
-
*
|
|
84
|
-
* @param surface - The surface to install.
|
|
85
|
-
* @returns The previously installed surface, so callers can restore it.
|
|
86
|
-
*/
|
|
87
|
-
export function surface_set(surface) {
|
|
88
|
-
const previous = activeSurface;
|
|
89
|
-
activeSurface = surface;
|
|
90
|
-
return previous;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Asserts that the active surface has a capability, throwing a
|
|
94
|
-
* {@link CapabilityError} with a clear message when it does not.
|
|
95
|
-
*
|
|
96
|
-
* @param capability - The capability the caller needs.
|
|
97
|
-
* @param message - The message to present when it is absent.
|
|
98
|
-
* @throws {CapabilityError} When the active surface lacks the capability.
|
|
99
|
-
*/
|
|
100
|
-
export function capability_require(capability, message) {
|
|
101
|
-
if (!activeSurface.capabilities[capability]) {
|
|
102
|
-
throw new CapabilityError(capability, message);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=surface.js.map
|
package/dist/core/surface.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/core/surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAyGH;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,mDAAmD;IACnC,UAAU,CAA4B;IAEtD;;;OAGG;IACH,YAAY,UAAqC,EAAE,OAAe;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IAC1B,kBAAkB;IACF,YAAY,GAAwB;QAClD,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,KAAK;QAChB,GAAG,EAAE,KAAK;QACV,YAAY,EAAE,KAAK;KACpB,CAAC;IAEF,kBAAkB;IACX,MAAM,CAAC,QAAuB;QACnC,MAAM,IAAI,eAAe,CAAC,KAAK,EAAE,uCAAuC,CAAC,CAAC;IAC5E,CAAC;IAED,kBAAkB;IACX,WAAW,CAAC,QAAgB,EAAE,MAAc;QACjD,MAAM,IAAI,eAAe,CAAC,cAAc,EAAE,4CAA4C,CAAC,CAAC;IAC1F,CAAC;IAED,kBAAkB;IACX,SAAS,CAAC,QAA0B;QACzC,MAAM,IAAI,eAAe,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;IACrF,CAAC;CACF;AAED,0EAA0E;AAC1E,IAAI,aAAa,GAAY,IAAI,eAAe,EAAE,CAAC;AAEnD;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,QAAQ,GAAY,aAAa,CAAC;IACxC,aAAa,GAAG,OAAO,CAAC;IACxB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAqC,EACrC,OAAe;IAEf,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
package/dist/core/version.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** The resolved version of every layer of the stack, in sandwich order. */
|
|
2
|
-
export interface StackVersions {
|
|
3
|
-
chell: string;
|
|
4
|
-
chili: string;
|
|
5
|
-
salsa: string;
|
|
6
|
-
cumin: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* The resolved version of every layer of the stack.
|
|
10
|
-
*
|
|
11
|
-
* @returns The chell/chili/salsa/cumin version strings.
|
|
12
|
-
*/
|
|
13
|
-
export declare function versions_get(): StackVersions;
|
|
14
|
-
/**
|
|
15
|
-
* Builds the multi-line version report shown by the `version` command and
|
|
16
|
-
* `--version`: chell itself plus the sandwich layers it runs with.
|
|
17
|
-
*
|
|
18
|
-
* @returns The version report string.
|
|
19
|
-
*/
|
|
20
|
-
export declare function versionReport_build(): string;
|
package/dist/core/version.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Version reporting for chell and its sandwich layers.
|
|
3
|
-
*
|
|
4
|
-
* Reads chell's own package.json and those of the cumin/salsa/chili layers, so
|
|
5
|
-
* the boot panel, the `version` command, and `--version` all report a
|
|
6
|
-
* consistent set of versions. In the standalone bundled binary — where no
|
|
7
|
-
* package.json exists on disk — the versions esbuild injected at build time are
|
|
8
|
-
* used instead.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
import { readFileSync } from 'fs';
|
|
13
|
-
import * as path from 'path';
|
|
14
|
-
import { fileURLToPath } from 'url';
|
|
15
|
-
import { createRequire } from 'module';
|
|
16
|
-
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
-
/**
|
|
18
|
-
* Reads chell's own package.json, falling back to the build-time version in the
|
|
19
|
-
* bundled binary where that file is not present on disk.
|
|
20
|
-
*
|
|
21
|
-
* @returns The parsed package.json (or a `{ name, version }` fallback).
|
|
22
|
-
*/
|
|
23
|
-
function selfPackageJson_load() {
|
|
24
|
-
try {
|
|
25
|
-
return JSON.parse(readFileSync(path.resolve(moduleDir, '../../package.json'), 'utf-8'));
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
const version = typeof __CHELL_VERSION__ !== 'undefined' ? __CHELL_VERSION__ : 'unknown';
|
|
29
|
-
return { name: '@fnndsc/chell', version };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Loads a dependency's package.json via node module resolution, so it works
|
|
34
|
-
* whether the dep is nested or hoisted to a workspace-root node_modules. In the
|
|
35
|
-
* bundled binary it falls back to the versions inlined at build time.
|
|
36
|
-
*
|
|
37
|
-
* @param name - The package name (e.g. `@fnndsc/cumin`).
|
|
38
|
-
* @returns The parsed package.json, or a fallback `{ name, version }`.
|
|
39
|
-
*/
|
|
40
|
-
function depPackageJson_load(name) {
|
|
41
|
-
try {
|
|
42
|
-
const req = createRequire(import.meta.url);
|
|
43
|
-
return req(`${name}/package.json`);
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
const version = typeof __CHELL_DEP_VERSIONS__ !== 'undefined' ? (__CHELL_DEP_VERSIONS__[name] ?? 'unknown') : 'unknown';
|
|
47
|
-
return { name, version };
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const chellJson = selfPackageJson_load();
|
|
51
|
-
const cuminJson = depPackageJson_load('@fnndsc/cumin');
|
|
52
|
-
const salsaJson = depPackageJson_load('@fnndsc/salsa');
|
|
53
|
-
const chiliJson = depPackageJson_load('@fnndsc/chili');
|
|
54
|
-
/**
|
|
55
|
-
* The resolved version of every layer of the stack.
|
|
56
|
-
*
|
|
57
|
-
* @returns The chell/chili/salsa/cumin version strings.
|
|
58
|
-
*/
|
|
59
|
-
export function versions_get() {
|
|
60
|
-
return {
|
|
61
|
-
chell: chellJson.version,
|
|
62
|
-
chili: chiliJson.version,
|
|
63
|
-
salsa: salsaJson.version,
|
|
64
|
-
cumin: cuminJson.version,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Builds the multi-line version report shown by the `version` command and
|
|
69
|
-
* `--version`: chell itself plus the sandwich layers it runs with.
|
|
70
|
-
*
|
|
71
|
-
* @returns The version report string.
|
|
72
|
-
*/
|
|
73
|
-
export function versionReport_build() {
|
|
74
|
-
const versions = versions_get();
|
|
75
|
-
return [
|
|
76
|
-
`chell ${versions.chell}`,
|
|
77
|
-
` chili ${versions.chili}`,
|
|
78
|
-
` salsa ${versions.salsa}`,
|
|
79
|
-
` cumin ${versions.cumin}`,
|
|
80
|
-
].join('\n');
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=version.js.map
|
package/dist/core/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/core/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AASvC,MAAM,SAAS,GAAW,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,C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OAAO;QACxB,KAAK,EAAE,SAAS,CAAC,OAAO;QACxB,KAAK,EAAE,SAAS,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,QAAQ,GAAkB,YAAY,EAAE,CAAC;IAC/C,OAAO;QACL,SAAS,QAAQ,CAAC,KAAK,EAAE;QACzB,WAAW,QAAQ,CAAC,KAAK,EAAE;QAC3B,WAAW,QAAQ,CAAC,KAAK,EAAE;QAC3B,WAAW,QAAQ,CAAC,KAAK,EAAE;KAC5B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/daemon/launch.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ChellEngine } from '../core/engine.js';
|
|
2
|
-
/**
|
|
3
|
-
* Starts the daemon over an engine and advertises it for same-user discovery.
|
|
4
|
-
*
|
|
5
|
-
* @param engine - The engine to host (already created and connected by boot).
|
|
6
|
-
* @returns A promise that resolves once the daemon is listening; the process
|
|
7
|
-
* then stays alive on the WebSocket server.
|
|
8
|
-
*/
|
|
9
|
-
export declare function daemon_launch(engine: ChellEngine): Promise<void>;
|
package/dist/daemon/launch.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file The `chell --daemon` launcher.
|
|
3
|
-
*
|
|
4
|
-
* Hosts the already-created chell engine behind a CALYPSO daemon. Two host
|
|
5
|
-
* concerns are handled here that the transport-agnostic daemon (in calypso)
|
|
6
|
-
* cannot: color is forced on (a daemon has no TTY, so chalk would otherwise
|
|
7
|
-
* strip it, and the rendered text must carry color for a remote terminal to
|
|
8
|
-
* reproduce the local experience), and the engine's live sink output is
|
|
9
|
-
* routed through the command's origin surface rather than rendered on the
|
|
10
|
-
* daemon's own console.
|
|
11
|
-
*
|
|
12
|
-
* @module
|
|
13
|
-
*/
|
|
14
|
-
import chalk from 'chalk';
|
|
15
|
-
import { CalypsoDaemon, token_generate } from '@fnndsc/calypso';
|
|
16
|
-
import { sink_set } from '../core/sink.js';
|
|
17
|
-
import { surface_set } from '../core/surface.js';
|
|
18
|
-
import { sessionPrompt_render } from '../core/prompt/session.js';
|
|
19
|
-
import { discovery_write, discovery_path } from '../remote/discovery.js';
|
|
20
|
-
/** The daemon sink forwards live command output to the executing surface. */
|
|
21
|
-
class DaemonSink {
|
|
22
|
-
daemon;
|
|
23
|
-
liveEnvelopeOutput = true;
|
|
24
|
-
constructor(daemon) {
|
|
25
|
-
this.daemon = daemon;
|
|
26
|
-
}
|
|
27
|
-
/** @inheritdoc */
|
|
28
|
-
data_write(chunk) { this.output_write('data', chunk); }
|
|
29
|
-
/** @inheritdoc */
|
|
30
|
-
err_write(chunk) { this.output_write('err', chunk); }
|
|
31
|
-
/** @inheritdoc */
|
|
32
|
-
status_write(text) { this.daemon.output_current('status', text); }
|
|
33
|
-
/** @inheritdoc */
|
|
34
|
-
progress_write(event) { this.daemon.progress_current(event); }
|
|
35
|
-
output_write(channel, chunk) {
|
|
36
|
-
const text = typeof chunk === 'string' ? chunk : chunk.toString('utf-8');
|
|
37
|
-
this.daemon.output_current(channel, text);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Starts the daemon over an engine and advertises it for same-user discovery.
|
|
42
|
-
*
|
|
43
|
-
* @param engine - The engine to host (already created and connected by boot).
|
|
44
|
-
* @returns A promise that resolves once the daemon is listening; the process
|
|
45
|
-
* then stays alive on the WebSocket server.
|
|
46
|
-
*/
|
|
47
|
-
export async function daemon_launch(engine) {
|
|
48
|
-
// Force color into the engine's rendered text: no TTY here to auto-detect.
|
|
49
|
-
if (chalk.level < 1) {
|
|
50
|
-
chalk.level = 3;
|
|
51
|
-
}
|
|
52
|
-
const token = token_generate();
|
|
53
|
-
const daemon = new CalypsoDaemon({
|
|
54
|
-
engine,
|
|
55
|
-
token,
|
|
56
|
-
host: '127.0.0.1',
|
|
57
|
-
port: 0,
|
|
58
|
-
// Only the daemon holds the session context, so it renders the themed
|
|
59
|
-
// prompt and pushes it to surfaces.
|
|
60
|
-
promptProvider: () => sessionPrompt_render(),
|
|
61
|
-
});
|
|
62
|
-
sink_set(new DaemonSink(daemon));
|
|
63
|
-
// Interactivity is a surface capability: a builtin that prompts, or a
|
|
64
|
-
// pipeline segment, reaches the surface running the command through the
|
|
65
|
-
// daemon's brokers, over the wire, without knowing the transport — and
|
|
66
|
-
// nothing ever spawns on the daemon host.
|
|
67
|
-
const surface = {
|
|
68
|
-
capabilities: { hiddenInput: true, localEdit: true, tty: true, pipeSegments: true },
|
|
69
|
-
prompt: (request) => daemon.prompt_current(request.message, request.hidden ?? false),
|
|
70
|
-
pipeSegment: (command, input) => daemon.pipe_current(command, input),
|
|
71
|
-
localEdit: (request) => daemon.edit_current(request.content, request.extension),
|
|
72
|
-
};
|
|
73
|
-
surface_set(surface);
|
|
74
|
-
const port = await daemon.start();
|
|
75
|
-
const url = `ws://127.0.0.1:${port}`;
|
|
76
|
-
discovery_write({ url, token });
|
|
77
|
-
console.log(chalk.green(`[+] CALYPSO daemon listening on ${url}`));
|
|
78
|
-
console.log(chalk.gray(` token: ${token}`));
|
|
79
|
-
console.log(chalk.gray(` discovery: ${discovery_path()}`));
|
|
80
|
-
console.log(chalk.gray(' attach a surface with: chell --remote'));
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=launch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/daemon/launch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAmB,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAiF,MAAM,oBAAoB,CAAC;AAChI,OAAO,EAAE,oBAAoB,E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K,CAAC,IAAI,CAAC,kBAAkB,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Callback function type for autocomplete results.
|
|
3
|
-
* @param err - Error if completion failed, null otherwise.
|
|
4
|
-
* @param result - Tuple of [matches array, original input string].
|
|
5
|
-
*/
|
|
6
|
-
type CompleterCallback = (err: Error | null, result: [string[], string]) => void;
|
|
7
|
-
/**
|
|
8
|
-
* Computes autocomplete suggestions for a given input line.
|
|
9
|
-
* Uses the callback style to support asynchronous operations (fetching files).
|
|
10
|
-
*
|
|
11
|
-
* @param line - The current input line.
|
|
12
|
-
* @param callback - The callback function to return results.
|
|
13
|
-
*/
|
|
14
|
-
export declare function input_complete(line: string, callback: CompleterCallback): void;
|
|
15
|
-
export {};
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file REPL Autocompletion.
|
|
3
|
-
*
|
|
4
|
-
* Provides tab-completion logic for the REPL, including built-in commands
|
|
5
|
-
* and path completion.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
import { session } from '../../session/index.js';
|
|
10
|
-
import { plugins_listAll, vfsDispatcher, context_getSingle } from '@fnndsc/salsa';
|
|
11
|
-
import { partialPath_split, completions_build } from './pathComplete.helpers.js';
|
|
12
|
-
import { listCache_get } from '@fnndsc/cumin';
|
|
13
|
-
import * as path from 'path';
|
|
14
|
-
import { builtinCommands_list } from '../../builtins/help.js';
|
|
15
|
-
import { args_tokenize } from '../parser.js';
|
|
16
|
-
function completionWord_get(line) {
|
|
17
|
-
let start = 0;
|
|
18
|
-
let quote = null;
|
|
19
|
-
let escapeNext = false;
|
|
20
|
-
for (let index = 0; index < line.length; index++) {
|
|
21
|
-
const char = line[index];
|
|
22
|
-
if (escapeNext) {
|
|
23
|
-
escapeNext = false;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
if (char === '\\' && quote !== "'") {
|
|
27
|
-
escapeNext = true;
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
if ((char === "'" || char === '"') && (!quote || quote === char)) {
|
|
31
|
-
quote = quote ? null : char;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (!quote && /\s/.test(char)) {
|
|
35
|
-
start = index + 1;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const raw = line.substring(start);
|
|
39
|
-
const tokens = args_tokenize(raw);
|
|
40
|
-
const value = tokens.length > 0 ? tokens[0] : '';
|
|
41
|
-
const openingQuote = raw.startsWith("'") ? "'" : raw.startsWith('"') ? '"' : null;
|
|
42
|
-
return { raw, value, quote: openingQuote };
|
|
43
|
-
}
|
|
44
|
-
function completion_format(completion, word) {
|
|
45
|
-
if (word.quote === "'") {
|
|
46
|
-
return `'${completion.replace(/'/g, `'\\''`)}`;
|
|
47
|
-
}
|
|
48
|
-
if (word.quote === '"') {
|
|
49
|
-
return `"${completion.replace(/(["\\])/g, '\\$1')}`;
|
|
50
|
-
}
|
|
51
|
-
return completion.replace(/([\\\s'"`])/g, '\\$1');
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Fetches available plugin names from /bin in the format: name-vVersion.
|
|
55
|
-
* This matches the display format used in /bin listings.
|
|
56
|
-
* Uses cache first for fast completion.
|
|
57
|
-
* @returns Array of plugin names with version suffixes.
|
|
58
|
-
*/
|
|
59
|
-
async function plugins_getNames() {
|
|
60
|
-
try {
|
|
61
|
-
// Check cache first for /bin
|
|
62
|
-
const listCache = listCache_get();
|
|
63
|
-
const cached = listCache.cache_get('/bin');
|
|
64
|
-
if (cached && cached.data) {
|
|
65
|
-
// Return cached plugin names immediately
|
|
66
|
-
return cached.data.map((item) => item.name);
|
|
67
|
-
}
|
|
68
|
-
// Cache miss - fetch from API (only on first tab completion)
|
|
69
|
-
const plugins = await plugins_listAll({});
|
|
70
|
-
if (plugins && plugins.tableData) {
|
|
71
|
-
const pluginNames = plugins.tableData.map((p) => {
|
|
72
|
-
const name = typeof p.name === 'string' ? p.name : String(p.name ?? '');
|
|
73
|
-
const version = typeof p.version === 'string' ? p.version : String(p.version ?? '');
|
|
74
|
-
// Format as name-vVersion to match /bin display format
|
|
75
|
-
return version ? `${name}-v${version}` : name;
|
|
76
|
-
});
|
|
77
|
-
// Cache it for next time
|
|
78
|
-
const lsItems = plugins.tableData.map((p) => {
|
|
79
|
-
const name = typeof p.name === 'string' ? p.name : String(p.name ?? '');
|
|
80
|
-
const version = typeof p.version === 'string' ? p.version : String(p.version ?? '');
|
|
81
|
-
return {
|
|
82
|
-
name: version ? `${name}-v${version}` : name,
|
|
83
|
-
type: 'plugin',
|
|
84
|
-
size: 0,
|
|
85
|
-
owner: 'system',
|
|
86
|
-
date: p.creation_date ? String(p.creation_date) : '',
|
|
87
|
-
};
|
|
88
|
-
});
|
|
89
|
-
listCache.cache_set('/bin', lsItems);
|
|
90
|
-
return pluginNames;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
// Silently fail if plugins cannot be fetched
|
|
95
|
-
}
|
|
96
|
-
return [];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Computes autocomplete suggestions for a given input line.
|
|
100
|
-
* Uses the callback style to support asynchronous operations (fetching files).
|
|
101
|
-
*
|
|
102
|
-
* @param line - The current input line.
|
|
103
|
-
* @param callback - The callback function to return results.
|
|
104
|
-
*/
|
|
105
|
-
export function input_complete(line, callback) {
|
|
106
|
-
const trimmed = line.trimStart();
|
|
107
|
-
const args = args_tokenize(trimmed);
|
|
108
|
-
// Case 1: Command Completion (First word)
|
|
109
|
-
// If we have only one token and the line doesn't end with space, we are typing the command
|
|
110
|
-
// Or if line is empty
|
|
111
|
-
const isCommandCompletion = args.length === 0 || (args.length === 1 && !line.endsWith(' '));
|
|
112
|
-
if (isCommandCompletion) {
|
|
113
|
-
// Check builtins first (instant, no async)
|
|
114
|
-
const builtinHits = builtinCommands_list().filter((c) => c.startsWith(trimmed));
|
|
115
|
-
// Always check plugins and combine results
|
|
116
|
-
plugins_getNames().then((pluginNames) => {
|
|
117
|
-
const pluginHits = pluginNames.filter((c) => c.startsWith(trimmed));
|
|
118
|
-
// Combine both builtins and plugins
|
|
119
|
-
const allHits = [...builtinHits, ...pluginHits];
|
|
120
|
-
callback(null, [allHits, trimmed]);
|
|
121
|
-
}).catch(() => {
|
|
122
|
-
// On error, return only builtin matches
|
|
123
|
-
callback(null, [builtinHits, trimmed]);
|
|
124
|
-
});
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
// Case 2: Path Completion (Argument to specific commands)
|
|
128
|
-
const cmd = args[0];
|
|
129
|
-
if (['cd', 'ls', 'mkdir', 'touch', 'cat', 'edit', 'cp', 'mv', 'rm', 'upload', 'download', 'du', 'tree', 'pull', 'cubepath', 'query'].includes(cmd)) {
|
|
130
|
-
const word = completionWord_get(line);
|
|
131
|
-
path_complete(word.value).then((matches) => {
|
|
132
|
-
callback(null, [matches.map((match) => completion_format(match, word)), word.raw]);
|
|
133
|
-
}).catch((err) => {
|
|
134
|
-
// On error, return no matches, don't crash REPL
|
|
135
|
-
callback(null, [[], word.raw]);
|
|
136
|
-
});
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
// Default: no completion
|
|
140
|
-
callback(null, [[], line]);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Resolves directory contents for completion.
|
|
144
|
-
* @param partial - The partial path string typed so far.
|
|
145
|
-
*/
|
|
146
|
-
async function path_complete(partial) {
|
|
147
|
-
// 1. Handle ~ expansion for the partial path base
|
|
148
|
-
let effectivePartial = partial;
|
|
149
|
-
if (partial.startsWith('~')) {
|
|
150
|
-
const context = await context_getSingle();
|
|
151
|
-
const user = context.user;
|
|
152
|
-
const home = user ? `/home/${user}` : '/';
|
|
153
|
-
if (partial === '~' || partial === '~/') {
|
|
154
|
-
effectivePartial = home + (partial.endsWith('/') ? '/' : '');
|
|
155
|
-
}
|
|
156
|
-
else if (partial.startsWith('~/')) {
|
|
157
|
-
effectivePartial = path.posix.join(home, partial.substring(2));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
// Resolve the directory to list and the prefix to match
|
|
161
|
-
const { dirToList, prefix } = partialPath_split(effectivePartial);
|
|
162
|
-
// 2. Resolve absolute path for listing
|
|
163
|
-
let absDirToList;
|
|
164
|
-
if (dirToList.startsWith('/')) {
|
|
165
|
-
absDirToList = dirToList;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
const cwd = await session.getCWD();
|
|
169
|
-
absDirToList = dirToList ? path.posix.resolve(cwd, dirToList) : cwd;
|
|
170
|
-
}
|
|
171
|
-
// 3. Fetch contents (check cache first)
|
|
172
|
-
let items = [];
|
|
173
|
-
const listCache = listCache_get();
|
|
174
|
-
// Check cache first
|
|
175
|
-
const cached = listCache.cache_get(absDirToList);
|
|
176
|
-
if (cached) {
|
|
177
|
-
items = cached.data;
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
try {
|
|
181
|
-
// Use vfsDispatcher for all path types — handles /pacs, /bin, native, etc.
|
|
182
|
-
const vfsResult = await vfsDispatcher.list(absDirToList);
|
|
183
|
-
if (vfsResult.ok) {
|
|
184
|
-
items = vfsResult.value;
|
|
185
|
-
}
|
|
186
|
-
// Inject virtual directories at root if missing
|
|
187
|
-
if (absDirToList === '/' || absDirToList === '') {
|
|
188
|
-
const hasItem = (name) => items.some((i) => i.name === name);
|
|
189
|
-
if (!hasItem('bin')) {
|
|
190
|
-
items.push({ name: 'bin', type: 'vfs', size: 0, owner: 'root', date: new Date().toISOString() });
|
|
191
|
-
}
|
|
192
|
-
if (!hasItem('usr')) {
|
|
193
|
-
items.push({ name: 'usr', type: 'vfs', size: 0, owner: 'root', date: new Date().toISOString() });
|
|
194
|
-
}
|
|
195
|
-
if (!hasItem('pacs')) {
|
|
196
|
-
items.push({ name: 'pacs', type: 'vfs', size: 0, owner: 'root', date: new Date().toISOString() });
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
// Cache the results
|
|
200
|
-
if (items.length > 0) {
|
|
201
|
-
listCache.cache_set(absDirToList, items);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch (e) {
|
|
205
|
-
// Ignore errors (e.g., perms, not a dir)
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
// 4. Filter and format matches, preserving the original partial's style
|
|
209
|
-
// (tilde/relative) and appending "/" to directory-like entries.
|
|
210
|
-
return completions_build(items, prefix, partial);
|
|
211
|
-
}
|
|
212
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/completer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAe7C,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,KAAK,GAAW,CAAC,CAAC;IACtB,IAAI,KAAK,GAAqB,IAAI,CAAC;IACnC,IAAI,UAAU,GAAY,KAAK,CAAC;IAEhC,KAAK,IAAI,KAAK,GAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAA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CAAU,EAAE,CAAC;YACpB,yCAAyC;QAC3C,CAAC;IACH,CAAC;IAED,wEAAwE;IACxE,gEAAgE;IAChE,OAAO,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ListingItem } from '@fnndsc/chili/models/listing.js';
|
|
2
|
-
/**
|
|
3
|
-
* Splits an (already tilde-expanded) partial path into the directory to list
|
|
4
|
-
* and the basename prefix to match against.
|
|
5
|
-
*
|
|
6
|
-
* @param effectivePartial - The tilde-expanded partial path.
|
|
7
|
-
* @returns The directory to list (empty = cwd) and the prefix.
|
|
8
|
-
*/
|
|
9
|
-
export declare function partialPath_split(effectivePartial: string): {
|
|
10
|
-
dirToList: string;
|
|
11
|
-
prefix: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Builds completion strings from listing items, preserving the original
|
|
15
|
-
* partial's style (tilde/relative) and appending `/` to directory-like entries.
|
|
16
|
-
*
|
|
17
|
-
* @param items - The listing items in the target directory.
|
|
18
|
-
* @param prefix - The basename prefix being completed.
|
|
19
|
-
* @param partial - The original (unexpanded) partial the user typed.
|
|
20
|
-
* @returns The completion strings for matching items.
|
|
21
|
-
*/
|
|
22
|
-
export declare function completions_build(items: ListingItem[], prefix: string, partial: string): string[];
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Pure helpers for filesystem path tab-completion.
|
|
3
|
-
*
|
|
4
|
-
* Splits a partial path into the directory to list and the prefix to match, and
|
|
5
|
-
* reconstructs completion strings from matching listing items. Dependency-free
|
|
6
|
-
* (path module only) for easy unit testing.
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import path from 'path';
|
|
11
|
-
/**
|
|
12
|
-
* Splits an (already tilde-expanded) partial path into the directory to list
|
|
13
|
-
* and the basename prefix to match against.
|
|
14
|
-
*
|
|
15
|
-
* @param effectivePartial - The tilde-expanded partial path.
|
|
16
|
-
* @returns The directory to list (empty = cwd) and the prefix.
|
|
17
|
-
*/
|
|
18
|
-
export function partialPath_split(effectivePartial) {
|
|
19
|
-
if (effectivePartial.endsWith('/')) {
|
|
20
|
-
return { dirToList: effectivePartial, prefix: '' };
|
|
21
|
-
}
|
|
22
|
-
let dirToList = path.posix.dirname(effectivePartial);
|
|
23
|
-
const prefix = path.posix.basename(effectivePartial);
|
|
24
|
-
if (dirToList === '.')
|
|
25
|
-
dirToList = ''; // Relative current dir
|
|
26
|
-
return { dirToList, prefix };
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Builds completion strings from listing items, preserving the original
|
|
30
|
-
* partial's style (tilde/relative) and appending `/` to directory-like entries.
|
|
31
|
-
*
|
|
32
|
-
* @param items - The listing items in the target directory.
|
|
33
|
-
* @param prefix - The basename prefix being completed.
|
|
34
|
-
* @param partial - The original (unexpanded) partial the user typed.
|
|
35
|
-
* @returns The completion strings for matching items.
|
|
36
|
-
*/
|
|
37
|
-
export function completions_build(items, prefix, partial) {
|
|
38
|
-
return items
|
|
39
|
-
.filter((i) => i.name.startsWith(prefix))
|
|
40
|
-
.map((hit) => {
|
|
41
|
-
const remainingSegment = hit.name.substring(prefix.length);
|
|
42
|
-
let completion = partial + remainingSegment;
|
|
43
|
-
if (hit.type === 'dir' || hit.type === 'vfs' || hit.type === 'link') {
|
|
44
|
-
completion += '/';
|
|
45
|
-
}
|
|
46
|
-
return completion;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=pathComplete.helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pathComplete.helpers.js","sourceRoot":"","sources":["../../../src/lib/completer/pathComplete.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,gBAAwB;IACxD,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACrD,CAAC;IACD,IAAI,SAAS,GAAW,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAW,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7D,IAAI,SAAS,KAAK,GAAG;QAAE,SAAS,GAAG,EAAE,CAAC,CAAC,uBAAuB;IAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAoB,EAAE,MAAc,EAAE,OAAe;IACrF,OAAO,KAAK;SACT,MAAM,CAAC,CAAC,CAAc,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SACrD,GAAG,CAAC,CAAC,GAAgB,EAAE,EAAE;QACxB,MAAM,gBAAgB,GAAW,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACnE,IAAI,UAAU,GAAW,OAAO,GAAG,gBAAgB,CAAC;QACpD,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACpE,UAAU,IAAI,GAAG,CAAC;QACpB,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/lib/parser.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Command line argument tokenizer.
|
|
3
|
-
*
|
|
4
|
-
* Splits a command line into tokens while respecting single/double quotes
|
|
5
|
-
* and backslash escapes. Quotes are stripped from the resulting tokens.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Tokenizes a command line preserving quoted segments with spaces.
|
|
9
|
-
*
|
|
10
|
-
* @param line - Raw command line input.
|
|
11
|
-
* @returns Array of tokens with quotes removed.
|
|
12
|
-
*/
|
|
13
|
-
export declare function args_tokenize(line: string): string[];
|