@positronic/cli 0.0.3 → 0.0.5
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/commands/helpers.js +57 -27
- package/dist/types/commands/helpers.d.ts.map +1 -1
- package/package.json +5 -1
- package/dist/src/commands/brain.test.js +0 -2936
- package/dist/src/commands/helpers.test.js +0 -832
- package/dist/src/commands/project.test.js +0 -1201
- package/dist/src/commands/resources.test.js +0 -2511
- package/dist/src/commands/schedule.test.js +0 -1235
- package/dist/src/commands/secret.test.d.js +0 -1
- package/dist/src/commands/secret.test.js +0 -761
- package/dist/src/commands/server.test.js +0 -1237
- package/dist/src/commands/test-utils.js +0 -737
- package/dist/src/components/secret-sync.js +0 -303
- package/dist/src/test/mock-api-client.js +0 -371
- package/dist/src/test/test-dev-server.js +0 -1376
- package/dist/types/commands/test-utils.d.ts +0 -45
- package/dist/types/commands/test-utils.d.ts.map +0 -1
- package/dist/types/components/secret-sync.d.ts +0 -9
- package/dist/types/components/secret-sync.d.ts.map +0 -1
- package/dist/types/test/mock-api-client.d.ts +0 -25
- package/dist/types/test/mock-api-client.d.ts.map +0 -1
- package/dist/types/test/test-dev-server.d.ts +0 -129
- package/dist/types/test/test-dev-server.d.ts.map +0 -1
- package/src/cli.ts +0 -997
- package/src/commands/backend.ts +0 -63
- package/src/commands/brain.test.ts +0 -1004
- package/src/commands/brain.ts +0 -215
- package/src/commands/helpers.test.ts +0 -487
- package/src/commands/helpers.ts +0 -870
- package/src/commands/project-config-manager.ts +0 -152
- package/src/commands/project.test.ts +0 -502
- package/src/commands/project.ts +0 -109
- package/src/commands/resources.test.ts +0 -1052
- package/src/commands/resources.ts +0 -97
- package/src/commands/schedule.test.ts +0 -481
- package/src/commands/schedule.ts +0 -65
- package/src/commands/secret.test.ts +0 -210
- package/src/commands/secret.ts +0 -50
- package/src/commands/server.test.ts +0 -493
- package/src/commands/server.ts +0 -353
- package/src/commands/test-utils.ts +0 -324
- package/src/components/brain-history.tsx +0 -198
- package/src/components/brain-list.tsx +0 -105
- package/src/components/brain-rerun.tsx +0 -111
- package/src/components/brain-show.tsx +0 -92
- package/src/components/error.tsx +0 -24
- package/src/components/project-add.tsx +0 -59
- package/src/components/project-create.tsx +0 -83
- package/src/components/project-list.tsx +0 -83
- package/src/components/project-remove.tsx +0 -55
- package/src/components/project-select.tsx +0 -200
- package/src/components/project-show.tsx +0 -58
- package/src/components/resource-clear.tsx +0 -127
- package/src/components/resource-delete.tsx +0 -160
- package/src/components/resource-list.tsx +0 -177
- package/src/components/resource-sync.tsx +0 -170
- package/src/components/resource-types.tsx +0 -55
- package/src/components/resource-upload.tsx +0 -182
- package/src/components/schedule-create.tsx +0 -90
- package/src/components/schedule-delete.tsx +0 -116
- package/src/components/schedule-list.tsx +0 -186
- package/src/components/schedule-runs.tsx +0 -151
- package/src/components/secret-bulk.tsx +0 -79
- package/src/components/secret-create.tsx +0 -49
- package/src/components/secret-delete.tsx +0 -41
- package/src/components/secret-list.tsx +0 -41
- package/src/components/watch.tsx +0 -155
- package/src/hooks/useApi.ts +0 -183
- package/src/positronic.ts +0 -40
- package/src/test/data/resources/config.json +0 -1
- package/src/test/data/resources/data/config.json +0 -1
- package/src/test/data/resources/data/logo.png +0 -2
- package/src/test/data/resources/docs/api.md +0 -3
- package/src/test/data/resources/docs/readme.md +0 -3
- package/src/test/data/resources/example.md +0 -3
- package/src/test/data/resources/file with spaces.txt +0 -1
- package/src/test/data/resources/readme.md +0 -3
- package/src/test/data/resources/test.txt +0 -1
- package/src/test/mock-api-client.ts +0 -145
- package/src/test/test-dev-server.ts +0 -1003
- package/tsconfig.json +0 -11
|
@@ -48,6 +48,13 @@ function _define_property(obj, key, value) {
|
|
|
48
48
|
}
|
|
49
49
|
return obj;
|
|
50
50
|
}
|
|
51
|
+
function _instanceof(left, right) {
|
|
52
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
53
|
+
return !!right[Symbol.hasInstance](left);
|
|
54
|
+
} else {
|
|
55
|
+
return left instanceof right;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
51
58
|
function _iterable_to_array_limit(arr, i) {
|
|
52
59
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
53
60
|
if (_i == null) return;
|
|
@@ -225,7 +232,7 @@ import { isText } from 'istextorbinary';
|
|
|
225
232
|
import * as http from 'http';
|
|
226
233
|
import * as https from 'https';
|
|
227
234
|
import { URL } from 'url';
|
|
228
|
-
import {
|
|
235
|
+
import { execSync } from 'child_process';
|
|
229
236
|
// Singleton API client instance
|
|
230
237
|
export var apiClient = {
|
|
231
238
|
fetch: function(apiPath, options) {
|
|
@@ -245,36 +252,23 @@ export var apiClient = {
|
|
|
245
252
|
};
|
|
246
253
|
export function generateProject(projectName, projectDir) {
|
|
247
254
|
return _async_to_generator(function() {
|
|
248
|
-
var devPath, newProjectTemplatePath, cazOptions, originalNewProjectPkg, copiedNewProjectPkg;
|
|
255
|
+
var devPath, newProjectTemplatePath, cazOptions, tempDir, originalNewProjectPkg, copiedNewProjectPkg, files, tarball, tarballPath;
|
|
249
256
|
return _ts_generator(this, function(_state) {
|
|
250
257
|
switch(_state.label){
|
|
251
258
|
case 0:
|
|
252
|
-
if (!(process.env.NODE_ENV === 'test')) return [
|
|
253
|
-
3,
|
|
254
|
-
2
|
|
255
|
-
];
|
|
256
|
-
return [
|
|
257
|
-
4,
|
|
258
|
-
createMinimalProject(projectDir)
|
|
259
|
-
];
|
|
260
|
-
case 1:
|
|
261
|
-
_state.sent();
|
|
262
|
-
return [
|
|
263
|
-
2
|
|
264
|
-
];
|
|
265
|
-
case 2:
|
|
266
259
|
devPath = process.env.POSITRONIC_LOCAL_PATH;
|
|
267
260
|
newProjectTemplatePath = '@positronic/template-new-project';
|
|
268
261
|
cazOptions = {
|
|
269
262
|
name: projectName
|
|
270
263
|
};
|
|
271
|
-
|
|
272
|
-
|
|
264
|
+
tempDir = null;
|
|
265
|
+
_state.label = 1;
|
|
266
|
+
case 1:
|
|
273
267
|
_state.trys.push([
|
|
274
|
-
|
|
268
|
+
1,
|
|
275
269
|
,
|
|
276
|
-
|
|
277
|
-
|
|
270
|
+
3,
|
|
271
|
+
4
|
|
278
272
|
]);
|
|
279
273
|
if (devPath) {
|
|
280
274
|
// Copying templates, why you ask?
|
|
@@ -296,13 +290,41 @@ export function generateProject(projectName, projectDir) {
|
|
|
296
290
|
install: true,
|
|
297
291
|
pm: 'npm'
|
|
298
292
|
};
|
|
293
|
+
} else if (newProjectTemplatePath.startsWith('@')) {
|
|
294
|
+
// Handle npm package template
|
|
295
|
+
// Create a temp directory for the npm package
|
|
296
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'positronic-npm-template-'));
|
|
297
|
+
// Download the npm package to the temp directory
|
|
298
|
+
try {
|
|
299
|
+
execSync("npm pack ".concat(newProjectTemplatePath, ' --pack-destination="').concat(tempDir, '"'), {
|
|
300
|
+
stdio: 'pipe'
|
|
301
|
+
});
|
|
302
|
+
// Find the packed tarball
|
|
303
|
+
files = fs.readdirSync(tempDir);
|
|
304
|
+
tarball = files.find(function(f) {
|
|
305
|
+
return f.endsWith('.tgz');
|
|
306
|
+
});
|
|
307
|
+
if (!tarball) {
|
|
308
|
+
throw new Error("Failed to find packed tarball for ".concat(newProjectTemplatePath));
|
|
309
|
+
}
|
|
310
|
+
// Extract the tarball
|
|
311
|
+
tarballPath = path.join(tempDir, tarball);
|
|
312
|
+
execSync('tar -xzf "'.concat(tarballPath, '" -C "').concat(tempDir, '"'), {
|
|
313
|
+
stdio: 'pipe'
|
|
314
|
+
});
|
|
315
|
+
// The extracted content is in a 'package' directory
|
|
316
|
+
newProjectTemplatePath = path.join(tempDir, 'package');
|
|
317
|
+
} catch (error) {
|
|
318
|
+
throw new Error("Failed to download template package ".concat(newProjectTemplatePath, ": ").concat(_instanceof(error, Error) ? error.message : String(error)));
|
|
319
|
+
}
|
|
299
320
|
}
|
|
300
321
|
// In test or CI environments, skip interactive prompts and dependency installation
|
|
301
322
|
if (process.env.NODE_ENV === 'test') {
|
|
302
323
|
cazOptions = _object_spread_props(_object_spread({}, cazOptions), {
|
|
303
324
|
backend: 'none',
|
|
304
325
|
install: false,
|
|
305
|
-
pm: 'npm'
|
|
326
|
+
pm: 'npm',
|
|
327
|
+
claudemd: false
|
|
306
328
|
});
|
|
307
329
|
}
|
|
308
330
|
return [
|
|
@@ -311,25 +333,33 @@ export function generateProject(projectName, projectDir) {
|
|
|
311
333
|
force: false
|
|
312
334
|
}))
|
|
313
335
|
];
|
|
314
|
-
case
|
|
336
|
+
case 2:
|
|
315
337
|
_state.sent();
|
|
316
338
|
return [
|
|
317
339
|
3,
|
|
318
|
-
|
|
340
|
+
4
|
|
319
341
|
];
|
|
320
|
-
case
|
|
342
|
+
case 3:
|
|
321
343
|
// Clean up the temporary copied new project package
|
|
322
|
-
if (devPath) {
|
|
344
|
+
if (devPath && newProjectTemplatePath !== '@positronic/template-new-project') {
|
|
323
345
|
fs.rmSync(newProjectTemplatePath, {
|
|
324
346
|
recursive: true,
|
|
325
347
|
force: true,
|
|
326
348
|
maxRetries: 3
|
|
327
349
|
});
|
|
328
350
|
}
|
|
351
|
+
// Clean up the npm temp directory if it was created
|
|
352
|
+
if (tempDir) {
|
|
353
|
+
fs.rmSync(tempDir, {
|
|
354
|
+
recursive: true,
|
|
355
|
+
force: true,
|
|
356
|
+
maxRetries: 3
|
|
357
|
+
});
|
|
358
|
+
}
|
|
329
359
|
return [
|
|
330
360
|
7
|
|
331
361
|
];
|
|
332
|
-
case
|
|
362
|
+
case 4:
|
|
333
363
|
return [
|
|
334
364
|
2
|
|
335
365
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/commands/helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQtD,MAAM,WAAW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MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;IAC9C,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;CAC5B,KAAK,IAAI,CAAC;AAEX;;GAEG;AACH,wBAAsB,aAAa,CACjC,eAAe,EAAE,MAAM,EACvB,MAAM,GAAE,SAAqB,EAC7B,UAAU,CAAC,EAAE,oBAAoB,GAChC,OAAO,CAAC,UAAU,CAAC,CA+KrB;AAqKD;;GAEG;AACH,wBAAsB,aAAa,CACjC,eAAe,EAAE,MAAM,EACvB,MAAM,GAAE,SAAqB,mBAoB9B;AAsCD;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,SAAO,GACf,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,SAAqB,EAC7B,UAAU,CAAC,EAAE,gBAAgB,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA2If"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positronic/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"positronic": "./dist/src/positronic.js",
|
|
12
12
|
"px": "./dist/src/positronic.js"
|
|
13
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"package.json"
|
|
17
|
+
],
|
|
14
18
|
"scripts": {
|
|
15
19
|
"tsc": "tsc --project tsconfig.json",
|
|
16
20
|
"swc": "swc src -d dist",
|