@positronic/cli 0.0.63 → 0.0.65
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/src/cli.js +2 -2
- package/dist/src/commands/auth.js +11 -5
- package/dist/src/components/auth-list.js +13 -3
- package/dist/src/components/auth-login.js +13 -4
- package/dist/src/components/auth-logout.js +31 -1
- package/dist/src/components/auth-status.js +30 -5
- package/dist/src/components/event-detail.js +0 -11
- package/dist/src/components/events-view.js +0 -6
- package/dist/src/lib/jwt-auth.js +41 -3
- package/dist/src/lib/local-auth.js +32 -0
- package/dist/src/positronic.js +5 -1
- package/dist/types/cli.d.ts +1 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/commands/auth.d.ts +2 -1
- package/dist/types/commands/auth.d.ts.map +1 -1
- package/dist/types/components/auth-list.d.ts +2 -1
- package/dist/types/components/auth-list.d.ts.map +1 -1
- package/dist/types/components/auth-login.d.ts +2 -1
- package/dist/types/components/auth-login.d.ts.map +1 -1
- package/dist/types/components/auth-logout.d.ts +2 -1
- package/dist/types/components/auth-logout.d.ts.map +1 -1
- package/dist/types/components/auth-status.d.ts +2 -1
- package/dist/types/components/auth-status.d.ts.map +1 -1
- package/dist/types/components/event-detail.d.ts.map +1 -1
- package/dist/types/components/events-view.d.ts.map +1 -1
- package/dist/types/lib/jwt-auth.d.ts +10 -0
- package/dist/types/lib/jwt-auth.d.ts.map +1 -1
- package/dist/types/lib/local-auth.d.ts +14 -0
- package/dist/types/lib/local-auth.d.ts.map +1 -0
- package/package.json +4 -4
package/dist/src/cli.js
CHANGED
|
@@ -197,7 +197,7 @@ function parseKeyValueOptions(opts) {
|
|
|
197
197
|
return parsed;
|
|
198
198
|
}
|
|
199
199
|
export function buildCli(options) {
|
|
200
|
-
var _options_argv = options.argv, argv = _options_argv === void 0 ? hideBin(process.argv) : _options_argv, server = options.server, _options_exitProcess = options.exitProcess, exitProcess = _options_exitProcess === void 0 ? false : _options_exitProcess, render = options.render;
|
|
200
|
+
var _options_argv = options.argv, argv = _options_argv === void 0 ? hideBin(process.argv) : _options_argv, server = options.server, _options_exitProcess = options.exitProcess, exitProcess = _options_exitProcess === void 0 ? false : _options_exitProcess, render = options.render, projectRootPath = options.projectRootPath;
|
|
201
201
|
var isLocalDevMode = server !== undefined;
|
|
202
202
|
// Get version from package.json
|
|
203
203
|
var version = 'TEST'; // Default version for test environment where package.json path differs
|
|
@@ -955,7 +955,7 @@ export function buildCli(options) {
|
|
|
955
955
|
return yargsUsers;
|
|
956
956
|
});
|
|
957
957
|
// --- Auth Commands (Available in both local and global mode) ---
|
|
958
|
-
var authCommand = new AuthCommand();
|
|
958
|
+
var authCommand = new AuthCommand(undefined, projectRootPath);
|
|
959
959
|
{
|
|
960
960
|
cli = cli.command('auth', 'Manage authentication configuration\n', function(yargsAuth) {
|
|
961
961
|
yargsAuth.command('status', 'Show current auth configuration\n', function() {}, function() {
|
|
@@ -39,10 +39,12 @@ import { AuthFormatJwkKey } from '../components/auth-format-jwk-key.js';
|
|
|
39
39
|
import { ProjectConfigManager } from './project-config-manager.js';
|
|
40
40
|
export var AuthCommand = /*#__PURE__*/ function() {
|
|
41
41
|
"use strict";
|
|
42
|
-
function AuthCommand(configManager) {
|
|
42
|
+
function AuthCommand(configManager, projectRootPath) {
|
|
43
43
|
_class_call_check(this, AuthCommand);
|
|
44
44
|
_define_property(this, "configManager", void 0);
|
|
45
|
+
_define_property(this, "projectRootPath", void 0);
|
|
45
46
|
this.configManager = configManager || new ProjectConfigManager();
|
|
47
|
+
this.projectRootPath = projectRootPath;
|
|
46
48
|
}
|
|
47
49
|
_create_class(AuthCommand, [
|
|
48
50
|
{
|
|
@@ -52,7 +54,8 @@ export var AuthCommand = /*#__PURE__*/ function() {
|
|
|
52
54
|
*/ key: "status",
|
|
53
55
|
value: function status() {
|
|
54
56
|
return React.createElement(AuthStatus, {
|
|
55
|
-
configManager: this.configManager
|
|
57
|
+
configManager: this.configManager,
|
|
58
|
+
projectRootPath: this.projectRootPath
|
|
56
59
|
});
|
|
57
60
|
}
|
|
58
61
|
},
|
|
@@ -66,7 +69,8 @@ export var AuthCommand = /*#__PURE__*/ function() {
|
|
|
66
69
|
return React.createElement(AuthLogin, {
|
|
67
70
|
configManager: this.configManager,
|
|
68
71
|
keyPath: path,
|
|
69
|
-
forProject: project || false
|
|
72
|
+
forProject: project || false,
|
|
73
|
+
projectRootPath: this.projectRootPath
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
},
|
|
@@ -79,7 +83,8 @@ export var AuthCommand = /*#__PURE__*/ function() {
|
|
|
79
83
|
var project = param.project;
|
|
80
84
|
return React.createElement(AuthLogout, {
|
|
81
85
|
configManager: this.configManager,
|
|
82
|
-
forProject: project || false
|
|
86
|
+
forProject: project || false,
|
|
87
|
+
projectRootPath: this.projectRootPath
|
|
83
88
|
});
|
|
84
89
|
}
|
|
85
90
|
},
|
|
@@ -90,7 +95,8 @@ export var AuthCommand = /*#__PURE__*/ function() {
|
|
|
90
95
|
*/ key: "list",
|
|
91
96
|
value: function list() {
|
|
92
97
|
return React.createElement(AuthList, {
|
|
93
|
-
configManager: this.configManager
|
|
98
|
+
configManager: this.configManager,
|
|
99
|
+
projectRootPath: this.projectRootPath
|
|
94
100
|
});
|
|
95
101
|
}
|
|
96
102
|
},
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
3
|
import { discoverSSHKeys, resolvePrivateKeyPath } from '../lib/ssh-key-utils.js';
|
|
4
|
+
import { readLocalAuth } from '../lib/local-auth.js';
|
|
4
5
|
export var AuthList = function(param) {
|
|
5
|
-
var configManager = param.configManager;
|
|
6
|
+
var configManager = param.configManager, projectRootPath = param.projectRootPath;
|
|
6
7
|
var discoveredKeys = discoverSSHKeys();
|
|
7
|
-
// Get the currently active key path for comparison
|
|
8
|
-
var
|
|
8
|
+
// Get the currently active key path for comparison, including local auth
|
|
9
|
+
var envPath = process.env.POSITRONIC_PRIVATE_KEY;
|
|
10
|
+
var configuredPath;
|
|
11
|
+
if (envPath) {
|
|
12
|
+
configuredPath = envPath;
|
|
13
|
+
} else if (projectRootPath) {
|
|
14
|
+
var localKeyPath = readLocalAuth(projectRootPath);
|
|
15
|
+
configuredPath = localKeyPath || configManager.getPrivateKeyPath();
|
|
16
|
+
} else {
|
|
17
|
+
configuredPath = configManager.getPrivateKeyPath();
|
|
18
|
+
}
|
|
9
19
|
var activeKeyPath = resolvePrivateKeyPath(configuredPath);
|
|
10
20
|
if (discoveredKeys.length === 0) {
|
|
11
21
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
@@ -48,10 +48,12 @@ import React, { useState } from 'react';
|
|
|
48
48
|
import { Box, Text, useApp } from 'ink';
|
|
49
49
|
import { discoverSSHKeys, expandPath } from '../lib/ssh-key-utils.js';
|
|
50
50
|
import { resetJwtAuthProvider } from '../lib/jwt-auth.js';
|
|
51
|
+
import { writeLocalAuth } from '../lib/local-auth.js';
|
|
51
52
|
import { SelectList } from './select-list.js';
|
|
52
53
|
import { existsSync } from 'fs';
|
|
53
54
|
export var AuthLogin = function(param) {
|
|
54
|
-
var configManager = param.configManager, keyPath = param.keyPath, forProject = param.forProject;
|
|
55
|
+
var configManager = param.configManager, keyPath = param.keyPath, forProject = param.forProject, projectRootPath = param.projectRootPath;
|
|
56
|
+
var isDevMode = !!projectRootPath;
|
|
55
57
|
var exit = useApp().exit;
|
|
56
58
|
var _useState = _sliced_to_array(useState(keyPath ? 'success' : 'selecting'), 2), state = _useState[0], setState = _useState[1];
|
|
57
59
|
var _useState1 = _sliced_to_array(useState(null), 2), error = _useState1[0], setError = _useState1[1];
|
|
@@ -99,11 +101,14 @@ export var AuthLogin = function(param) {
|
|
|
99
101
|
color: "red"
|
|
100
102
|
}, "Error: ", result.error));
|
|
101
103
|
}
|
|
104
|
+
} else if (isDevMode) {
|
|
105
|
+
writeLocalAuth(projectRootPath, keyPath);
|
|
102
106
|
} else {
|
|
103
107
|
configManager.setDefaultPrivateKeyPath(keyPath);
|
|
104
108
|
}
|
|
105
109
|
// Reset request signer to use new key
|
|
106
110
|
resetJwtAuthProvider();
|
|
111
|
+
var scope = forProject && currentProject ? 'project "'.concat(currentProject.name, '"') : isDevMode ? 'local project' : 'global';
|
|
107
112
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
108
113
|
flexDirection: "column",
|
|
109
114
|
paddingTop: 1,
|
|
@@ -119,7 +124,7 @@ export var AuthLogin = function(param) {
|
|
|
119
124
|
paddingLeft: 2
|
|
120
125
|
}, /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
|
|
121
126
|
bold: true
|
|
122
|
-
}, "Scope:"),
|
|
127
|
+
}, "Scope:"), " ", scope)));
|
|
123
128
|
}
|
|
124
129
|
// Interactive key selection
|
|
125
130
|
if (state === 'selecting') {
|
|
@@ -159,6 +164,8 @@ export var AuthLogin = function(param) {
|
|
|
159
164
|
setState('error');
|
|
160
165
|
return;
|
|
161
166
|
}
|
|
167
|
+
} else if (isDevMode) {
|
|
168
|
+
writeLocalAuth(projectRootPath, displayPath);
|
|
162
169
|
} else {
|
|
163
170
|
configManager.setDefaultPrivateKeyPath(displayPath);
|
|
164
171
|
}
|
|
@@ -170,15 +177,17 @@ export var AuthLogin = function(param) {
|
|
|
170
177
|
var handleCancel = function() {
|
|
171
178
|
exit();
|
|
172
179
|
};
|
|
180
|
+
var headerSuffix = forProject && currentProject ? ' for project "'.concat(currentProject.name, '"') : isDevMode ? ' (local project)' : ' (global)';
|
|
173
181
|
return /*#__PURE__*/ React.createElement(SelectList, {
|
|
174
182
|
items: items,
|
|
175
|
-
header: "Select an SSH key".concat(
|
|
183
|
+
header: "Select an SSH key".concat(headerSuffix),
|
|
176
184
|
onSelect: handleSelect,
|
|
177
185
|
onCancel: handleCancel,
|
|
178
186
|
footer: "Use arrow keys to navigate, Enter to select, q to cancel"
|
|
179
187
|
});
|
|
180
188
|
}
|
|
181
189
|
if (state === 'success' && selectedPath) {
|
|
190
|
+
var scope1 = forProject && currentProject ? 'project "'.concat(currentProject.name, '"') : isDevMode ? 'local project' : 'global';
|
|
182
191
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
183
192
|
flexDirection: "column",
|
|
184
193
|
paddingTop: 1,
|
|
@@ -194,7 +203,7 @@ export var AuthLogin = function(param) {
|
|
|
194
203
|
paddingLeft: 2
|
|
195
204
|
}, /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
|
|
196
205
|
bold: true
|
|
197
|
-
}, "Scope:"),
|
|
206
|
+
}, "Scope:"), " ", scope1)));
|
|
198
207
|
}
|
|
199
208
|
if (state === 'error') {
|
|
200
209
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
3
|
import { resetJwtAuthProvider } from '../lib/jwt-auth.js';
|
|
4
|
+
import { readLocalAuth, clearLocalAuth } from '../lib/local-auth.js';
|
|
4
5
|
export var AuthLogout = function(param) {
|
|
5
|
-
var configManager = param.configManager, forProject = param.forProject;
|
|
6
|
+
var configManager = param.configManager, forProject = param.forProject, projectRootPath = param.projectRootPath;
|
|
6
7
|
var currentProject = configManager.getCurrentProject();
|
|
8
|
+
var isDevMode = !!projectRootPath;
|
|
7
9
|
// If --project flag is used but no project is selected, show error
|
|
8
10
|
if (forProject && !currentProject) {
|
|
9
11
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
@@ -46,6 +48,34 @@ export var AuthLogout = function(param) {
|
|
|
46
48
|
dimColor: true
|
|
47
49
|
}, "The project will now use the global default key (if configured).")));
|
|
48
50
|
}
|
|
51
|
+
// In dev mode, clear local auth by default
|
|
52
|
+
if (isDevMode) {
|
|
53
|
+
var localKeyPath = readLocalAuth(projectRootPath);
|
|
54
|
+
if (!localKeyPath) {
|
|
55
|
+
return /*#__PURE__*/ React.createElement(Box, {
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
paddingTop: 1,
|
|
58
|
+
paddingBottom: 1
|
|
59
|
+
}, /*#__PURE__*/ React.createElement(Text, null, "No local project SSH key configured."), /*#__PURE__*/ React.createElement(Box, {
|
|
60
|
+
marginTop: 1
|
|
61
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
62
|
+
dimColor: true
|
|
63
|
+
}, "Nothing to clear.")));
|
|
64
|
+
}
|
|
65
|
+
clearLocalAuth(projectRootPath);
|
|
66
|
+
resetJwtAuthProvider();
|
|
67
|
+
return /*#__PURE__*/ React.createElement(Box, {
|
|
68
|
+
flexDirection: "column",
|
|
69
|
+
paddingTop: 1,
|
|
70
|
+
paddingBottom: 1
|
|
71
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
72
|
+
color: "green"
|
|
73
|
+
}, "Local project SSH key configuration cleared."), /*#__PURE__*/ React.createElement(Box, {
|
|
74
|
+
marginTop: 1
|
|
75
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
76
|
+
dimColor: true
|
|
77
|
+
}, "Requests will now use the global default key (if configured).")));
|
|
78
|
+
}
|
|
49
79
|
// Clear global default key
|
|
50
80
|
var globalKeyPath = configManager.getDefaultPrivateKeyPath();
|
|
51
81
|
if (!globalKeyPath) {
|
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
3
|
import { resolvePrivateKeyPath } from '../lib/ssh-key-utils.js';
|
|
4
|
+
import { readLocalAuth } from '../lib/local-auth.js';
|
|
4
5
|
import { existsSync } from 'fs';
|
|
5
6
|
export var AuthStatus = function(param) {
|
|
6
|
-
var configManager = param.configManager;
|
|
7
|
+
var configManager = param.configManager, projectRootPath = param.projectRootPath;
|
|
7
8
|
var envPath = process.env.POSITRONIC_PRIVATE_KEY;
|
|
8
9
|
var globalKeyPath = configManager.getDefaultPrivateKeyPath();
|
|
9
10
|
var currentProject = configManager.getCurrentProject();
|
|
10
11
|
var projectKeyPath = currentProject ? configManager.getProjectPrivateKeyPath(currentProject.name) : undefined;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
var localKeyPath = projectRootPath ? readLocalAuth(projectRootPath) : null;
|
|
13
|
+
// Determine the active key path following the full priority chain:
|
|
14
|
+
// 1. Env var
|
|
15
|
+
// 2. Local project auth (.positronic-auth.json)
|
|
16
|
+
// 3. Per-project key from global config
|
|
17
|
+
// 4. Global default key
|
|
18
|
+
// 5. Fallback
|
|
19
|
+
var configuredPath;
|
|
20
|
+
if (envPath) {
|
|
21
|
+
configuredPath = envPath;
|
|
22
|
+
} else if (localKeyPath) {
|
|
23
|
+
configuredPath = localKeyPath;
|
|
24
|
+
} else {
|
|
25
|
+
configuredPath = configManager.getPrivateKeyPath();
|
|
26
|
+
}
|
|
13
27
|
var activeKeyPath = resolvePrivateKeyPath(configuredPath);
|
|
14
28
|
var keyExists = existsSync(activeKeyPath);
|
|
15
29
|
// Determine which source is being used
|
|
16
30
|
var activeSource;
|
|
17
31
|
if (envPath) {
|
|
18
32
|
activeSource = 'environment variable';
|
|
33
|
+
} else if (localKeyPath) {
|
|
34
|
+
activeSource = 'local project';
|
|
19
35
|
} else if (projectKeyPath && currentProject) {
|
|
20
36
|
activeSource = 'project "'.concat(currentProject.name, '"');
|
|
21
37
|
} else if (globalKeyPath) {
|
|
@@ -46,7 +62,16 @@ export var AuthStatus = function(param) {
|
|
|
46
62
|
paddingLeft: 2
|
|
47
63
|
}, /*#__PURE__*/ React.createElement(Text, {
|
|
48
64
|
dimColor: true
|
|
49
|
-
}, "(POSITRONIC_PRIVATE_KEY - highest priority)"))), /*#__PURE__*/ React.createElement(Box, {
|
|
65
|
+
}, "(POSITRONIC_PRIVATE_KEY - highest priority)"))), projectRootPath && /*#__PURE__*/ React.createElement(Box, {
|
|
66
|
+
flexDirection: "column",
|
|
67
|
+
marginBottom: 1
|
|
68
|
+
}, /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
|
|
69
|
+
bold: true
|
|
70
|
+
}, "Local Project Key:"), ' ', localKeyPath ? /*#__PURE__*/ React.createElement(Text, {
|
|
71
|
+
color: "cyan"
|
|
72
|
+
}, localKeyPath) : /*#__PURE__*/ React.createElement(Text, {
|
|
73
|
+
dimColor: true
|
|
74
|
+
}, "not configured"))), /*#__PURE__*/ React.createElement(Box, {
|
|
50
75
|
flexDirection: "column",
|
|
51
76
|
marginBottom: 1
|
|
52
77
|
}, /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
|
|
@@ -80,7 +105,7 @@ export var AuthStatus = function(param) {
|
|
|
80
105
|
color: "green"
|
|
81
106
|
}, "key file found") : /*#__PURE__*/ React.createElement(Text, {
|
|
82
107
|
color: "red"
|
|
83
|
-
}, "key file not found"))))), !globalKeyPath && !envPath && !projectKeyPath && /*#__PURE__*/ React.createElement(Box, {
|
|
108
|
+
}, "key file not found"))))), !globalKeyPath && !envPath && !projectKeyPath && !localKeyPath && /*#__PURE__*/ React.createElement(Box, {
|
|
84
109
|
marginTop: 1
|
|
85
110
|
}, /*#__PURE__*/ React.createElement(Text, {
|
|
86
111
|
dimColor: true
|
|
@@ -84,11 +84,6 @@ function getEventSymbol(event) {
|
|
|
84
84
|
symbol: '[+]',
|
|
85
85
|
color: 'green'
|
|
86
86
|
};
|
|
87
|
-
case BRAIN_EVENTS.STEP_RETRY:
|
|
88
|
-
return {
|
|
89
|
-
symbol: '[?]',
|
|
90
|
-
color: 'yellow'
|
|
91
|
-
};
|
|
92
87
|
case BRAIN_EVENTS.STEP_STATUS:
|
|
93
88
|
return {
|
|
94
89
|
symbol: '[-]',
|
|
@@ -276,12 +271,6 @@ function getEventDetailContent(event) {
|
|
|
276
271
|
"Step: ".concat(event.stepTitle),
|
|
277
272
|
"Step ID: ".concat(event.stepId)
|
|
278
273
|
].join('\n');
|
|
279
|
-
case BRAIN_EVENTS.STEP_RETRY:
|
|
280
|
-
return [
|
|
281
|
-
"Step: ".concat(event.stepTitle),
|
|
282
|
-
"Step ID: ".concat(event.stepId),
|
|
283
|
-
"Attempt: ".concat(event.attempt)
|
|
284
|
-
].join('\n');
|
|
285
274
|
case BRAIN_EVENTS.COMPLETE:
|
|
286
275
|
return [
|
|
287
276
|
"Brain: ".concat(event.brainTitle),
|
|
@@ -109,12 +109,6 @@ function formatEvent(event) {
|
|
|
109
109
|
text: 'Step completed: "'.concat(event.stepTitle, '"'),
|
|
110
110
|
color: 'green'
|
|
111
111
|
};
|
|
112
|
-
case BRAIN_EVENTS.STEP_RETRY:
|
|
113
|
-
return {
|
|
114
|
-
symbol: '[?]',
|
|
115
|
-
text: 'Step retry: "'.concat(event.stepTitle, '" (attempt ').concat(event.attempt, ")"),
|
|
116
|
-
color: 'yellow'
|
|
117
|
-
};
|
|
118
112
|
case BRAIN_EVENTS.STEP_STATUS:
|
|
119
113
|
return {
|
|
120
114
|
symbol: '[-]',
|
package/dist/src/lib/jwt-auth.js
CHANGED
|
@@ -202,6 +202,9 @@ import { createPrivateKey } from 'crypto';
|
|
|
202
202
|
import { loadPrivateKey, getPrivateKeyFingerprint, getPublicKeyFingerprint, resolvePrivateKeyPath } from './ssh-key-utils.js';
|
|
203
203
|
import { ProjectConfigManager } from '../commands/project-config-manager.js';
|
|
204
204
|
import { AgentSigner } from './ssh-agent-signer.js';
|
|
205
|
+
import { readLocalAuth } from './local-auth.js';
|
|
206
|
+
// Module-level state: project root path for local auth resolution
|
|
207
|
+
var authProjectRootPath = null;
|
|
205
208
|
/**
|
|
206
209
|
* Check if an error indicates an encrypted key
|
|
207
210
|
*/ function isEncryptedKeyError(error) {
|
|
@@ -236,7 +239,23 @@ import { AgentSigner } from './ssh-agent-signer.js';
|
|
|
236
239
|
try {
|
|
237
240
|
// Get configured path from project config manager
|
|
238
241
|
var configManager = new ProjectConfigManager();
|
|
239
|
-
|
|
242
|
+
// Build resolved path with local auth in the priority chain:
|
|
243
|
+
// 1. POSITRONIC_PRIVATE_KEY env var (handled inside resolvePrivateKeyPath)
|
|
244
|
+
// 2. Local project auth file (.positronic-auth.json)
|
|
245
|
+
// 3. Project-specific key from global config
|
|
246
|
+
// 4. Global default key from global config
|
|
247
|
+
// 5. Fallback (~/.ssh/id_rsa)
|
|
248
|
+
var configuredPath;
|
|
249
|
+
if (!process.env.POSITRONIC_PRIVATE_KEY && authProjectRootPath) {
|
|
250
|
+
var localKeyPath = readLocalAuth(authProjectRootPath);
|
|
251
|
+
if (localKeyPath) {
|
|
252
|
+
configuredPath = localKeyPath;
|
|
253
|
+
} else {
|
|
254
|
+
configuredPath = configManager.getPrivateKeyPath();
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
configuredPath = configManager.getPrivateKeyPath();
|
|
258
|
+
}
|
|
240
259
|
var keyPath = resolvePrivateKeyPath(configuredPath);
|
|
241
260
|
if (!existsSync(keyPath)) {
|
|
242
261
|
this.initError = new Error("Private key not found at ".concat(keyPath, ". Run 'px auth login' to configure your SSH key, or set POSITRONIC_PRIVATE_KEY environment variable."));
|
|
@@ -249,8 +268,14 @@ import { AgentSigner } from './ssh-agent-signer.js';
|
|
|
249
268
|
if (isEncryptedKeyError(error)) {
|
|
250
269
|
// Store the path for agent fallback - we'll try the agent in createToken()
|
|
251
270
|
var configManager1 = new ProjectConfigManager();
|
|
252
|
-
var
|
|
253
|
-
|
|
271
|
+
var configuredPathForAgent;
|
|
272
|
+
if (!process.env.POSITRONIC_PRIVATE_KEY && authProjectRootPath) {
|
|
273
|
+
var localKeyPath1 = readLocalAuth(authProjectRootPath);
|
|
274
|
+
configuredPathForAgent = localKeyPath1 || configManager1.getPrivateKeyPath();
|
|
275
|
+
} else {
|
|
276
|
+
configuredPathForAgent = configManager1.getPrivateKeyPath();
|
|
277
|
+
}
|
|
278
|
+
this.encryptedKeyPath = resolvePrivateKeyPath(configuredPathForAgent);
|
|
254
279
|
this.initError = _instanceof(error, Error) ? error : new Error('Key is encrypted');
|
|
255
280
|
} else {
|
|
256
281
|
this.initError = _instanceof(error, Error) ? error : new Error('Failed to initialize JWT auth provider');
|
|
@@ -633,6 +658,19 @@ var providerInstance = null;
|
|
|
633
658
|
});
|
|
634
659
|
})();
|
|
635
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Set the project root path for local auth resolution.
|
|
663
|
+
* Called once at startup from positronic.ts when in dev mode.
|
|
664
|
+
* Nulls the singleton so it reinitializes on next use with the new path.
|
|
665
|
+
*/ export function setAuthProjectRootPath(projectRoot) {
|
|
666
|
+
authProjectRootPath = projectRoot;
|
|
667
|
+
providerInstance = null;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Get the current auth project root path (for use by auth components).
|
|
671
|
+
*/ export function getAuthProjectRootPath() {
|
|
672
|
+
return authProjectRootPath;
|
|
673
|
+
}
|
|
636
674
|
/**
|
|
637
675
|
* Authenticated fetch wrapper for use with EventSource or other
|
|
638
676
|
* consumers that need a fetch function with automatic JWT authentication.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, unlinkSync, existsSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
var LOCAL_AUTH_FILENAME = '.positronic-auth.json';
|
|
4
|
+
/**
|
|
5
|
+
* Read the local auth config from a project root directory.
|
|
6
|
+
* Returns the private key path if configured, or null.
|
|
7
|
+
*/ export function readLocalAuth(projectRoot) {
|
|
8
|
+
var filePath = join(projectRoot, LOCAL_AUTH_FILENAME);
|
|
9
|
+
if (!existsSync(filePath)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
var raw = readFileSync(filePath, 'utf-8');
|
|
13
|
+
var data = JSON.parse(raw);
|
|
14
|
+
return data.privateKeyPath || null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Write the local auth config to a project root directory.
|
|
18
|
+
*/ export function writeLocalAuth(projectRoot, keyPath) {
|
|
19
|
+
var filePath = join(projectRoot, LOCAL_AUTH_FILENAME);
|
|
20
|
+
var data = {
|
|
21
|
+
privateKeyPath: keyPath
|
|
22
|
+
};
|
|
23
|
+
writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Clear the local auth config from a project root directory.
|
|
27
|
+
*/ export function clearLocalAuth(projectRoot) {
|
|
28
|
+
var filePath = join(projectRoot, LOCAL_AUTH_FILENAME);
|
|
29
|
+
if (existsSync(filePath)) {
|
|
30
|
+
unlinkSync(filePath);
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/src/positronic.js
CHANGED
|
@@ -6,6 +6,7 @@ import { render } from 'ink';
|
|
|
6
6
|
import { createDevServer } from './commands/backend.js';
|
|
7
7
|
import { configureApiClient } from './commands/helpers.js';
|
|
8
8
|
import { ProjectConfigManager } from './commands/project-config-manager.js';
|
|
9
|
+
import { setAuthProjectRootPath } from './lib/jwt-auth.js';
|
|
9
10
|
function findProjectRootSync(startDir) {
|
|
10
11
|
var currentDir = path.resolve(startDir);
|
|
11
12
|
while(true){
|
|
@@ -40,11 +41,14 @@ if (projectRootPath) {
|
|
|
40
41
|
// If no project is selected, leave apiClient unconfigured
|
|
41
42
|
// Commands will show appropriate errors when they try to connect
|
|
42
43
|
}
|
|
44
|
+
// Set the project root path for local auth resolution
|
|
45
|
+
setAuthProjectRootPath(projectRootPath);
|
|
43
46
|
// Build and parse the CLI
|
|
44
47
|
var cli = buildCli({
|
|
45
48
|
server: server,
|
|
46
49
|
exitProcess: true,
|
|
47
|
-
render: render
|
|
50
|
+
render: render,
|
|
51
|
+
projectRootPath: projectRootPath || undefined
|
|
48
52
|
});
|
|
49
53
|
// Parse the arguments
|
|
50
54
|
cli.parse();
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface CliOptions {
|
|
|
5
5
|
server?: PositronicDevServer;
|
|
6
6
|
exitProcess?: boolean;
|
|
7
7
|
render: (element: React.ReactElement) => any;
|
|
8
|
+
projectRootPath?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare function buildCli(options: CliOptions): import("yargs").Argv<{}>;
|
|
10
11
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAK5D,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,KAAK,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAK5D,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,KAAK,GAAG,CAAC;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAoBD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,UAAU,4BAw5C3C"}
|
|
@@ -13,7 +13,8 @@ interface FormatJwkKeyArgs {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class AuthCommand {
|
|
15
15
|
private configManager;
|
|
16
|
-
|
|
16
|
+
private projectRootPath?;
|
|
17
|
+
constructor(configManager?: ProjectConfigManager, projectRootPath?: string);
|
|
17
18
|
/**
|
|
18
19
|
* Handles the 'px auth' or 'px auth status' command.
|
|
19
20
|
* Shows current auth configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,UAAU,SAAS;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,UAAU;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,aAAa,CAAuB;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,UAAU,SAAS;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,UAAU;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,eAAe,CAAC,CAAS;gBAErB,aAAa,CAAC,EAAE,oBAAoB,EAAE,eAAe,CAAC,EAAE,MAAM;IAK1E;;;OAGG;IACH,MAAM,IAAI,KAAK,CAAC,YAAY;IAO5B;;;OAGG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,kBAAkB,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY;IAS3E;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,YAAY;IAQvE;;;OAGG;IACH,IAAI,IAAI,KAAK,CAAC,YAAY;IAO1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,YAAY;CAKnF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ProjectConfigManager } from '../commands/project-config-manager.js';
|
|
2
2
|
interface AuthListProps {
|
|
3
3
|
configManager: ProjectConfigManager;
|
|
4
|
+
projectRootPath?: string;
|
|
4
5
|
}
|
|
5
|
-
export declare const AuthList: ({ configManager }: AuthListProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const AuthList: ({ configManager, projectRootPath }: AuthListProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
7
8
|
//# sourceMappingURL=auth-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-list.d.ts","sourceRoot":"","sources":["../../../src/components/auth-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-list.d.ts","sourceRoot":"","sources":["../../../src/components/auth-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAIlF,UAAU,aAAa;IACrB,aAAa,EAAE,oBAAoB,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,QAAQ,GAAI,oCAAoC,aAAa,4CAyEzE,CAAC"}
|
|
@@ -3,7 +3,8 @@ interface AuthLoginProps {
|
|
|
3
3
|
configManager: ProjectConfigManager;
|
|
4
4
|
keyPath?: string;
|
|
5
5
|
forProject: boolean;
|
|
6
|
+
projectRootPath?: string;
|
|
6
7
|
}
|
|
7
|
-
export declare const AuthLogin: ({ configManager, keyPath, forProject }: AuthLoginProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export declare const AuthLogin: ({ configManager, keyPath, forProject, projectRootPath }: AuthLoginProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=auth-login.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-login.d.ts","sourceRoot":"","sources":["../../../src/components/auth-login.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-login.d.ts","sourceRoot":"","sources":["../../../src/components/auth-login.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAOlF,UAAU,cAAc;IACtB,aAAa,EAAE,oBAAoB,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAID,eAAO,MAAM,SAAS,GAAI,yDAAyD,cAAc,mDA8LhG,CAAC"}
|
|
@@ -2,7 +2,8 @@ import type { ProjectConfigManager } from '../commands/project-config-manager.js
|
|
|
2
2
|
interface AuthLogoutProps {
|
|
3
3
|
configManager: ProjectConfigManager;
|
|
4
4
|
forProject: boolean;
|
|
5
|
+
projectRootPath?: string;
|
|
5
6
|
}
|
|
6
|
-
export declare const AuthLogout: ({ configManager, forProject }: AuthLogoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const AuthLogout: ({ configManager, forProject, projectRootPath }: AuthLogoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=auth-logout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-logout.d.ts","sourceRoot":"","sources":["../../../src/components/auth-logout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-logout.d.ts","sourceRoot":"","sources":["../../../src/components/auth-logout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAIlF,UAAU,eAAe;IACvB,aAAa,EAAE,oBAAoB,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,UAAU,GAAI,gDAAgD,eAAe,4CA+GzF,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ProjectConfigManager } from '../commands/project-config-manager.js';
|
|
2
2
|
interface AuthStatusProps {
|
|
3
3
|
configManager: ProjectConfigManager;
|
|
4
|
+
projectRootPath?: string;
|
|
4
5
|
}
|
|
5
|
-
export declare const AuthStatus: ({ configManager }: AuthStatusProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const AuthStatus: ({ configManager, projectRootPath }: AuthStatusProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
7
8
|
//# sourceMappingURL=auth-status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-status.d.ts","sourceRoot":"","sources":["../../../src/components/auth-status.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-status.d.ts","sourceRoot":"","sources":["../../../src/components/auth-status.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAKlF,UAAU,eAAe;IACvB,aAAa,EAAE,oBAAoB,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,UAAU,GAAI,oCAAoC,eAAe,4CAuI7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-detail.d.ts","sourceRoot":"","sources":["../../../src/components/event-detail.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,UAAU,gBAAgB;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"event-detail.d.ts","sourceRoot":"","sources":["../../../src/components/event-detail.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,UAAU,gBAAgB;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA4ND,eAAO,MAAM,WAAW,GAAI,oDAA2D,gBAAgB,4CAqDtG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events-view.d.ts","sourceRoot":"","sources":["../../../src/components/events-view.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE9D,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAE5C,UAAU,eAAe;IACvB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACxD;
|
|
1
|
+
{"version":3,"file":"events-view.d.ts","sourceRoot":"","sources":["../../../src/components/events-view.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE9D,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAE5C,UAAU,eAAe;IACvB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACxD;AAiOD,eAAO,MAAM,UAAU,GAAI,8HAQxB,eAAe,4CA+HjB,CAAC"}
|
|
@@ -83,6 +83,16 @@ export declare function isAuthAvailable(): boolean;
|
|
|
83
83
|
* Only throws for unexpected errors during token creation
|
|
84
84
|
*/
|
|
85
85
|
export declare function getAuthHeader(): Promise<Record<string, string>>;
|
|
86
|
+
/**
|
|
87
|
+
* Set the project root path for local auth resolution.
|
|
88
|
+
* Called once at startup from positronic.ts when in dev mode.
|
|
89
|
+
* Nulls the singleton so it reinitializes on next use with the new path.
|
|
90
|
+
*/
|
|
91
|
+
export declare function setAuthProjectRootPath(projectRoot: string | null): void;
|
|
92
|
+
/**
|
|
93
|
+
* Get the current auth project root path (for use by auth components).
|
|
94
|
+
*/
|
|
95
|
+
export declare function getAuthProjectRootPath(): string | null;
|
|
86
96
|
/**
|
|
87
97
|
* Authenticated fetch wrapper for use with EventSource or other
|
|
88
98
|
* consumers that need a fetch function with automatic JWT authentication.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt-auth.d.ts","sourceRoot":"","sources":["../../../src/lib/jwt-auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwt-auth.d.ts","sourceRoot":"","sources":["../../../src/lib/jwt-auth.ts"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAsB;IAGvC,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,QAAQ,CAAS;;IAMzB,OAAO,CAAC,UAAU;IA4DlB;;;;OAIG;IACH,OAAO,IAAI,OAAO;IAYlB;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACH,QAAQ,IAAI,KAAK,GAAG,IAAI;IAIxB;;OAEG;IACH,cAAc,IAAI,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAqB9B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAiCnB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAoBpC;;OAEG;YACW,iBAAiB;IAwB/B;;OAEG;YACW,gBAAgB;IAwC9B;;;OAGG;YACW,oBAAoB;CAuCnC;AAKD;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAKpD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;;;GAIG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiBrE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAGvE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAEtD;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,KAYvC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the local auth config from a project root directory.
|
|
3
|
+
* Returns the private key path if configured, or null.
|
|
4
|
+
*/
|
|
5
|
+
export declare function readLocalAuth(projectRoot: string): string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Write the local auth config to a project root directory.
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeLocalAuth(projectRoot: string, keyPath: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Clear the local auth config from a project root directory.
|
|
12
|
+
*/
|
|
13
|
+
export declare function clearLocalAuth(projectRoot: string): void;
|
|
14
|
+
//# sourceMappingURL=local-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-auth.d.ts","sourceRoot":"","sources":["../../../src/lib/local-auth.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQhE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIzE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAKxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positronic/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"clean": "rm -rf tsconfig.tsbuildinfo dist node_modules"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@positronic/core": "^0.0.
|
|
27
|
-
"@positronic/spec": "^0.0.
|
|
28
|
-
"@positronic/template-new-project": "^0.0.
|
|
26
|
+
"@positronic/core": "^0.0.65",
|
|
27
|
+
"@positronic/spec": "^0.0.65",
|
|
28
|
+
"@positronic/template-new-project": "^0.0.65",
|
|
29
29
|
"caz": "^2.0.0",
|
|
30
30
|
"chokidar": "^3.6.0",
|
|
31
31
|
"dotenv": "^16.4.7",
|