@positronic/cli 0.0.2 → 0.0.4
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 +16 -1
- package/dist/src/commands/helpers.js +11 -25
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/commands/helpers.d.ts.map +1 -1
- package/package.json +11 -4
- 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 -981
- 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
package/dist/src/cli.js
CHANGED
|
@@ -133,16 +133,31 @@ import { BrainCommand } from './commands/brain.js';
|
|
|
133
133
|
import { ResourcesCommand } from './commands/resources.js';
|
|
134
134
|
import { ScheduleCommand } from './commands/schedule.js';
|
|
135
135
|
import { SecretCommand } from './commands/secret.js';
|
|
136
|
+
import { readFileSync } from 'fs';
|
|
137
|
+
import { fileURLToPath } from 'url';
|
|
138
|
+
import { dirname, join } from 'path';
|
|
136
139
|
export function buildCli(options) {
|
|
137
140
|
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;
|
|
138
141
|
var isLocalDevMode = server !== undefined;
|
|
142
|
+
// Get version from package.json
|
|
143
|
+
var version = 'TEST'; // Default version for test environment where package.json path differs
|
|
144
|
+
try {
|
|
145
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
146
|
+
var __dirname = dirname(__filename);
|
|
147
|
+
var packageJsonPath = join(__dirname, '..', '..', 'package.json');
|
|
148
|
+
var packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
149
|
+
version = packageJson.version;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
// In test environment, the relative path to package.json is different
|
|
152
|
+
// so we use 'TEST' as the version to avoid breaking tests
|
|
153
|
+
}
|
|
139
154
|
// Instantiate command classes, passing the determined mode and path
|
|
140
155
|
var projectCommand = new ProjectCommand();
|
|
141
156
|
var brainCommand = new BrainCommand();
|
|
142
157
|
var scheduleCommand = new ScheduleCommand();
|
|
143
158
|
var secretCommand = new SecretCommand(server);
|
|
144
159
|
// Main CLI definition
|
|
145
|
-
var cli = yargs(argv).scriptName('positronic').usage('Usage: $0 <command> [options]').version().alias('v', 'version').help('h').alias('h', 'help').wrap(null).strictCommands().exitProcess(exitProcess);
|
|
160
|
+
var cli = yargs(argv).scriptName('positronic').usage('Usage: $0 <command> [options]').version(version).alias('v', 'version').help('h').alias('h', 'help').wrap(null).strictCommands().exitProcess(exitProcess);
|
|
146
161
|
// --- Project Management Commands (Global Mode Only) ---
|
|
147
162
|
cli = cli.command('project', 'Manage your Positronic projects\n', function(yargsProject) {
|
|
148
163
|
if (!isLocalDevMode) {
|
|
@@ -225,7 +225,6 @@ import { isText } from 'istextorbinary';
|
|
|
225
225
|
import * as http from 'http';
|
|
226
226
|
import * as https from 'https';
|
|
227
227
|
import { URL } from 'url';
|
|
228
|
-
import { createMinimalProject } from './test-utils.js';
|
|
229
228
|
// Singleton API client instance
|
|
230
229
|
export var apiClient = {
|
|
231
230
|
fetch: function(apiPath, options) {
|
|
@@ -249,32 +248,18 @@ export function generateProject(projectName, projectDir) {
|
|
|
249
248
|
return _ts_generator(this, function(_state) {
|
|
250
249
|
switch(_state.label){
|
|
251
250
|
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
251
|
devPath = process.env.POSITRONIC_LOCAL_PATH;
|
|
267
252
|
newProjectTemplatePath = '@positronic/template-new-project';
|
|
268
253
|
cazOptions = {
|
|
269
254
|
name: projectName
|
|
270
255
|
};
|
|
271
|
-
_state.label =
|
|
272
|
-
case
|
|
256
|
+
_state.label = 1;
|
|
257
|
+
case 1:
|
|
273
258
|
_state.trys.push([
|
|
274
|
-
|
|
259
|
+
1,
|
|
275
260
|
,
|
|
276
|
-
|
|
277
|
-
|
|
261
|
+
3,
|
|
262
|
+
4
|
|
278
263
|
]);
|
|
279
264
|
if (devPath) {
|
|
280
265
|
// Copying templates, why you ask?
|
|
@@ -302,7 +287,8 @@ export function generateProject(projectName, projectDir) {
|
|
|
302
287
|
cazOptions = _object_spread_props(_object_spread({}, cazOptions), {
|
|
303
288
|
backend: 'none',
|
|
304
289
|
install: false,
|
|
305
|
-
pm: 'npm'
|
|
290
|
+
pm: 'npm',
|
|
291
|
+
claudemd: false
|
|
306
292
|
});
|
|
307
293
|
}
|
|
308
294
|
return [
|
|
@@ -311,13 +297,13 @@ export function generateProject(projectName, projectDir) {
|
|
|
311
297
|
force: false
|
|
312
298
|
}))
|
|
313
299
|
];
|
|
314
|
-
case
|
|
300
|
+
case 2:
|
|
315
301
|
_state.sent();
|
|
316
302
|
return [
|
|
317
303
|
3,
|
|
318
|
-
|
|
304
|
+
4
|
|
319
305
|
];
|
|
320
|
-
case
|
|
306
|
+
case 3:
|
|
321
307
|
// Clean up the temporary copied new project package
|
|
322
308
|
if (devPath) {
|
|
323
309
|
fs.rmSync(newProjectTemplatePath, {
|
|
@@ -329,7 +315,7 @@ export function generateProject(projectName, projectDir) {
|
|
|
329
315
|
return [
|
|
330
316
|
7
|
|
331
317
|
];
|
|
332
|
-
case
|
|
318
|
+
case 4:
|
|
333
319
|
return [
|
|
334
320
|
2
|
|
335
321
|
];
|
package/dist/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAQA,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;CAC9C;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,UAAU,4BAg9B3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../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,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,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positronic/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "A CLI for AI Brains",
|
|
5
8
|
"type": "module",
|
|
6
9
|
"license": "MIT",
|
|
@@ -8,6 +11,10 @@
|
|
|
8
11
|
"positronic": "./dist/src/positronic.js",
|
|
9
12
|
"px": "./dist/src/positronic.js"
|
|
10
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"package.json"
|
|
17
|
+
],
|
|
11
18
|
"scripts": {
|
|
12
19
|
"tsc": "tsc --project tsconfig.json",
|
|
13
20
|
"swc": "swc src -d dist",
|
|
@@ -16,9 +23,9 @@
|
|
|
16
23
|
"clean": "rm -rf tsconfig.tsbuildinfo dist node_modules"
|
|
17
24
|
},
|
|
18
25
|
"dependencies": {
|
|
19
|
-
"@positronic/core": "^0.0.
|
|
20
|
-
"@positronic/spec": "^0.0.
|
|
21
|
-
"@positronic/template-new-project": "^0.0.
|
|
26
|
+
"@positronic/core": "^0.0.3",
|
|
27
|
+
"@positronic/spec": "^0.0.3",
|
|
28
|
+
"@positronic/template-new-project": "^0.0.3",
|
|
22
29
|
"caz": "^2.0.0",
|
|
23
30
|
"chokidar": "^3.6.0",
|
|
24
31
|
"eventsource": "^3.0.6",
|