@solidactions/cli 0.2.4 → 0.2.6

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.
@@ -129,15 +129,23 @@ function parseYamlEnvVars(config) {
129
129
  for (const item of config.env) {
130
130
  if (typeof item === 'string') {
131
131
  // Simple string: - VAR_NAME (declared only, needs configuration)
132
- parsedVars.push({ key: item, mappedTo: null });
132
+ parsedVars.push({ key: item, mappedTo: null, oauthName: null });
133
133
  }
134
134
  else if (typeof item === 'object' && item !== null) {
135
- // Object: - VAR_NAME: GLOBAL_NAME (mapped to global)
135
+ // Object: - VAR_NAME: GLOBAL_NAME or - VAR_NAME: { oauth: connection-name }
136
136
  const keys = Object.keys(item);
137
137
  if (keys.length === 1) {
138
138
  const key = keys[0];
139
- const mappedTo = item[key];
140
- parsedVars.push({ key, mappedTo: mappedTo || null });
139
+ const value = item[key];
140
+ if (typeof value === 'object' && value !== null && 'oauth' in value) {
141
+ if (typeof value.oauth !== 'string' || !value.oauth) {
142
+ throw new Error(`Invalid env config for ${key}: 'oauth' must be a non-empty string`);
143
+ }
144
+ parsedVars.push({ key, mappedTo: null, oauthName: value.oauth });
145
+ }
146
+ else {
147
+ parsedVars.push({ key, mappedTo: value || null, oauthName: null });
148
+ }
141
149
  }
142
150
  }
143
151
  }
@@ -171,6 +179,7 @@ async function pushYamlDeclarations(host, apiKey, projectSlug, yamlConfig) {
171
179
  const declarations = parsedVars.map(v => ({
172
180
  env_name: v.key,
173
181
  yaml_default_global_key: v.mappedTo,
182
+ yaml_default_oauth_name: v.oauthName,
174
183
  source: 'yaml',
175
184
  }));
176
185
  try {
@@ -52,18 +52,45 @@ async function envList(projectName, options = {}) {
52
52
  return;
53
53
  }
54
54
  console.log('');
55
- console.log(chalk_1.default.gray('KEY'.padEnd(30) + 'VALUE'.padEnd(30) + 'SOURCE'.padEnd(12) + 'GLOBAL KEY'));
56
- console.log(chalk_1.default.gray('-'.repeat(100)));
55
+ console.log(chalk_1.default.gray('KEY'.padEnd(28) + 'VALUE'.padEnd(24) + 'TYPE'.padEnd(14) + 'SOURCE'));
56
+ console.log(chalk_1.default.gray('-'.repeat(90)));
57
57
  for (const mapping of mappings) {
58
58
  const key = mapping.env_name || '?';
59
- const value = mapping.is_secret ? chalk_1.default.yellow('********') : (mapping.value || '-');
60
- const source = mapping.source || 'manual';
61
- const globalKey = mapping.global_variable_key || chalk_1.default.gray('(local)');
62
- const sourceColor = source === 'yaml' ? chalk_1.default.cyan : (source === 'override' ? chalk_1.default.yellow : chalk_1.default.gray);
63
- console.log(key.padEnd(30) +
64
- (mapping.is_secret ? chalk_1.default.yellow('********'.padEnd(30)) : (mapping.value || '-').toString().substring(0, 28).padEnd(30)) +
65
- sourceColor(source.padEnd(12)) +
66
- (mapping.global_variable_key || chalk_1.default.gray('(local)')));
59
+ // Value display (resolved_value includes global/oauth resolution)
60
+ const rawValue = mapping.resolved_value ?? mapping.value;
61
+ let value;
62
+ if (mapping.is_secret) {
63
+ value = chalk_1.default.yellow('••••••');
64
+ }
65
+ else if (rawValue) {
66
+ value = rawValue.toString().substring(0, 22);
67
+ }
68
+ else {
69
+ value = chalk_1.default.gray('-');
70
+ }
71
+ // Type & source (mirrors UI getMappingType)
72
+ let type;
73
+ let source;
74
+ if (mapping.source_type === 'oauth_connection' && mapping.oauth_connection_id) {
75
+ type = chalk_1.default.blue('oauth');
76
+ source = chalk_1.default.blue(mapping.oauth_connection_name || 'OAuth');
77
+ }
78
+ else if (mapping.global_variable_key) {
79
+ type = chalk_1.default.green('global');
80
+ source = chalk_1.default.green(mapping.global_variable_key);
81
+ }
82
+ else if (mapping.has_value) {
83
+ type = chalk_1.default.gray('project var');
84
+ source = chalk_1.default.gray('local');
85
+ }
86
+ else {
87
+ type = chalk_1.default.gray('-');
88
+ source = chalk_1.default.gray('-');
89
+ }
90
+ console.log(key.padEnd(28) +
91
+ value.padEnd(24) +
92
+ type.padEnd(14) +
93
+ source);
67
94
  }
68
95
  console.log('');
69
96
  console.log(chalk_1.default.gray(`${mappings.length} variable(s)`));
@@ -32,8 +32,8 @@ async function logs(runId, options) {
32
32
  'Accept': 'application/json',
33
33
  },
34
34
  });
35
- let logEntries = logsResponse.data.logs || [];
36
- displayLogs(logEntries);
35
+ const logData = logsResponse.data.logs || '';
36
+ let printed = displayLogs(logData);
37
37
  if (options.follow && runData.status === 'running') {
38
38
  console.log(chalk_1.default.gray('\n--- Following logs (Ctrl+C to stop) ---\n'));
39
39
  const pollInterval = setInterval(async () => {
@@ -44,10 +44,11 @@ async function logs(runId, options) {
44
44
  'Accept': 'application/json',
45
45
  },
46
46
  });
47
- const newLogs = refreshResponse.data.logs || [];
48
- const newEntries = newLogs.slice(logEntries.length);
49
- displayLogs(newEntries);
50
- logEntries = newLogs;
47
+ const newLogData = refreshResponse.data.logs || '';
48
+ if (newLogData.length > printed) {
49
+ const newContent = newLogData.substring(printed);
50
+ printed += displayLogs(newContent);
51
+ }
51
52
  // Check if run is complete
52
53
  const runStatus = await axios_1.default.get(`${config.host}/api/v1/runs/${runId}`, {
53
54
  headers: {
@@ -85,19 +86,27 @@ async function logs(runId, options) {
85
86
  process.exit(1);
86
87
  }
87
88
  }
88
- function displayLogs(entries) {
89
- for (const entry of entries) {
89
+ /**
90
+ * Display log content. Handles both string logs and array-of-entry logs.
91
+ * Returns the number of characters printed (for follow-mode diffing).
92
+ */
93
+ function displayLogs(logData) {
94
+ if (typeof logData === 'string') {
95
+ if (logData.trim()) {
96
+ console.log(logData);
97
+ }
98
+ return logData.length;
99
+ }
100
+ // Handle array format in case the API changes
101
+ for (const entry of logData) {
102
+ const message = entry.message || entry.content || '';
103
+ if (!message.trim())
104
+ continue;
90
105
  const timestamp = entry.timestamp ? new Date(entry.timestamp).toLocaleTimeString() : '??:??:??';
91
106
  const stream = entry.stream || 'stdout';
92
- const message = entry.message || entry.content || '';
93
- let coloredMessage;
94
- if (stream === 'stderr') {
95
- coloredMessage = chalk_1.default.red(message);
96
- }
97
- else {
98
- coloredMessage = chalk_1.default.white(message);
99
- }
100
107
  const streamIndicator = stream === 'stderr' ? chalk_1.default.red('[err]') : chalk_1.default.gray('[out]');
108
+ const coloredMessage = stream === 'stderr' ? chalk_1.default.red(message) : chalk_1.default.white(message);
101
109
  console.log(`${chalk_1.default.gray(`[${timestamp}]`)} ${streamIndicator} ${coloredMessage}`);
102
110
  }
111
+ return logData.length;
103
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidactions/cli",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "SolidActions CLI - Deploy and manage workflow automation",
5
5
  "main": "dist/index.js",
6
6
  "bin": {