@positronic/cli 0.0.74 → 0.0.75

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 CHANGED
@@ -781,7 +781,13 @@ export function buildCli(options) {
781
781
  describe: 'Cron expression for the schedule (e.g., "0 3 * * *" for daily at 3am)',
782
782
  type: 'string',
783
783
  demandOption: true
784
- }).example('$0 schedule create my-brain "0 3 * * *"', 'Run my-brain daily at 3am').example('$0 schedule c my-brain "0 3 * * *"', 'Run my-brain daily at 3am (shorthand)').example('$0 schedule create data-sync "*/30 * * * *"', 'Run data-sync every 30 minutes').example('$0 schedule create weekly-report "0 9 * * 1"', 'Run weekly-report every Monday at 9am');
784
+ }).option('options', {
785
+ describe: 'Options to pass to the brain on each run (key=value format)',
786
+ type: 'array',
787
+ alias: 'o',
788
+ string: true,
789
+ coerce: parseKeyValueOptions
790
+ }).example('$0 schedule create my-brain "0 3 * * *"', 'Run my-brain daily at 3am').example('$0 schedule c my-brain "0 3 * * *"', 'Run my-brain daily at 3am (shorthand)').example('$0 schedule create data-sync "*/30 * * * *"', 'Run data-sync every 30 minutes').example('$0 schedule create weekly-report "0 9 * * 1"', 'Run weekly-report every Monday at 9am').example('$0 schedule create my-brain "0 8 * * 1" -o notify=sean,jim', 'Run with options passed to the brain');
785
791
  }, function(argv) {
786
792
  var element = scheduleCommand.create(argv);
787
793
  render(element);
@@ -33,13 +33,14 @@ export var ScheduleCommand = /*#__PURE__*/ function() {
33
33
  {
34
34
  key: "create",
35
35
  value: function create(param) {
36
- var brain = param.brain, cronExpression = param.cronExpression;
36
+ var brain = param.brain, cronExpression = param.cronExpression, options = param.options;
37
37
  return React.createElement(BrainResolver, {
38
38
  identifier: brain,
39
39
  children: function(resolvedBrainTitle) {
40
40
  return React.createElement(ScheduleCreate, {
41
41
  identifier: resolvedBrainTitle,
42
- cronExpression: cronExpression
42
+ cronExpression: cronExpression,
43
+ options: options
43
44
  });
44
45
  }
45
46
  });
@@ -57,7 +57,7 @@ import { ProjectConfigManager } from '../commands/project-config-manager.js';
57
57
  import { discoverSSHKeys, generateSSHKey, convertSSHPubKeyToJWK } from '../lib/ssh-key-utils.js';
58
58
  import { resetJwtAuthProvider } from '../lib/jwt-auth.js';
59
59
  import { SelectList } from './select-list.js';
60
- import { appendFileSync, existsSync, writeFileSync } from 'fs';
60
+ import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'fs';
61
61
  import { join } from 'path';
62
62
  export var ProjectAuthSetup = function(param) {
63
63
  var projectDir = param.projectDir, onComplete = param.onComplete;
@@ -125,7 +125,10 @@ export var ProjectAuthSetup = function(param) {
125
125
  var envPath = join(projectDir, '.env');
126
126
  var envLine = "ROOT_PUBLIC_KEY='".concat(jwkString, "'\n");
127
127
  if (existsSync(envPath)) {
128
- appendFileSync(envPath, envLine);
128
+ // Ensure we start on a new line if the file doesn't end with one
129
+ var existing = readFileSync(envPath, 'utf-8');
130
+ var prefix = existing.length > 0 && !existing.endsWith('\n') ? '\n' : '';
131
+ appendFileSync(envPath, prefix + envLine);
129
132
  } else {
130
133
  writeFileSync(envPath, envLine);
131
134
  }
@@ -302,7 +302,13 @@ export var ProjectCreate = function(param) {
302
302
  bold: true
303
303
  }, "2."), " Install dependencies if you didn't choose to during setup (e.g., npm install)"), /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
304
304
  bold: true
305
- }, "3."), " Run the development server: px s or positronic server"), /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
305
+ }, "3."), " Add your AI provider API key to .env (e.g., GOOGLE_GENERATIVE_AI_API_KEY)"), /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
306
306
  bold: true
307
- }, "4."), " Open a new terminal in '", projectName, "' and run a brain: px run example --watch"))));
307
+ }, "4."), " Run the development server: px s or positronic server"), /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
308
+ bold: true
309
+ }, "5."), " Open a new terminal in '", projectName, "' and run a brain: px run example --watch")), /*#__PURE__*/ React.createElement(Box, {
310
+ marginTop: 1
311
+ }, /*#__PURE__*/ React.createElement(Text, {
312
+ dimColor: true
313
+ }, "See runner.ts to switch to a different AI provider (e.g., Anthropic, OpenAI)"))));
308
314
  };
@@ -169,7 +169,7 @@ import { Box, Text } from 'ink';
169
169
  import { ErrorComponent } from './error.js';
170
170
  import { useApiPost } from '../hooks/useApi.js';
171
171
  export var ScheduleCreate = function(param) {
172
- var identifier = param.identifier, cronExpression = param.cronExpression;
172
+ var identifier = param.identifier, cronExpression = param.cronExpression, options = param.options;
173
173
  var _useState = _sliced_to_array(useState(false), 2), created = _useState[0], setCreated = _useState[1];
174
174
  var _useState1 = _sliced_to_array(useState(null), 2), schedule = _useState1[0], setSchedule = _useState1[1];
175
175
  var _useApiPost = useApiPost('/brains/schedules', {
@@ -194,7 +194,8 @@ export var ScheduleCreate = function(param) {
194
194
  4,
195
195
  execute({
196
196
  identifier: identifier,
197
- cronExpression: cronExpression
197
+ cronExpression: cronExpression,
198
+ options: options
198
199
  })
199
200
  ];
200
201
  case 1:
@@ -248,7 +249,12 @@ export var ScheduleCreate = function(param) {
248
249
  bold: true
249
250
  }, "Timezone:"), " ", schedule.timezone), /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
250
251
  bold: true
251
- }, "Status:"), " ", schedule.enabled ? 'Enabled' : 'Disabled'), schedule.nextRunAt && /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
252
+ }, "Status:"), " ", schedule.enabled ? 'Enabled' : 'Disabled'), options && Object.keys(options).length > 0 && /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
253
+ bold: true
254
+ }, "Options:"), ' ', Object.entries(options).map(function(param) {
255
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
256
+ return "".concat(k, "=").concat(v);
257
+ }).join(', ')), schedule.nextRunAt && /*#__PURE__*/ React.createElement(Text, null, /*#__PURE__*/ React.createElement(Text, {
252
258
  bold: true
253
259
  }, "Next Run:"), ' ', new Date(schedule.nextRunAt).toLocaleString('en-US', {
254
260
  timeZone: schedule.timezone,
@@ -562,9 +562,7 @@ export var StoreExplorer = function() {
562
562
  inputHandlerRef.current(input, key);
563
563
  }, []);
564
564
  // Keyboard handling - uses stable callback to avoid stale closure issues
565
- useInput(stableInputHandler, {
566
- isActive: mode !== 'value'
567
- });
565
+ useInput(stableInputHandler);
568
566
  // Adjust selectedIndex if list shrinks
569
567
  useEffect(function() {
570
568
  var listLength = mode === 'brains' ? brains.length : mode === 'keys' ? keys.length : 0;
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,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,4BA04C3C"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,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,4BAq5C3C"}
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  interface ScheduleCreateArgs {
4
4
  brain: string;
5
5
  cronExpression: string;
6
+ options?: Record<string, string>;
6
7
  }
7
8
  interface ScheduleListArgs {
8
9
  brain?: string;
@@ -21,7 +22,7 @@ interface ScheduleTimezoneArgs {
21
22
  }
22
23
  export declare class ScheduleCommand {
23
24
  constructor();
24
- create({ brain, cronExpression, }: ArgumentsCamelCase<ScheduleCreateArgs>): React.ReactElement;
25
+ create({ brain, cronExpression, options, }: ArgumentsCamelCase<ScheduleCreateArgs>): React.ReactElement;
25
26
  list({ brain }: ArgumentsCamelCase<ScheduleListArgs>): React.ReactElement;
26
27
  delete({ scheduleId, force }: ArgumentsCamelCase<ScheduleDeleteArgs>): React.ReactElement;
27
28
  runs({ scheduleId, limit, status, }: ArgumentsCamelCase<ScheduleRunsArgs>): React.ReactElement;
@@ -1 +1 @@
1
- {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../src/commands/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,gBAAgB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,C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MAAM,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC9C;AAED,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,eAAe;;IAG1B,MAAM,CAAC,EACL,KAAK,EACL,cAAc,EACd,OAAO,GACR,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,YAAY;IAY9D,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,YAAY;IAMzE,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,YAAY;IAOzF,IAAI,CAAC,EACH,UAAU,EACV,KAAK,EACL,MAAM,GACP,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,YAAY;IAQ5D,QAAQ,CAAC,EACP,QAAQ,GACT,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,GAAG,KAAK,CAAC,YAAY;CAKjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"project-auth-setup.d.ts","sourceRoot":"","sources":["../../../src/components/project-auth-setup.tsx"],"names":[],"mappings":"AAcA,UAAU,qBAAqB;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAUD,eAAO,MAAM,gBAAgB,GAAI,4BAA4B,qBAAqB,mDAiMjF,CAAC"}
1
+ {"version":3,"file":"project-auth-setup.d.ts","sourceRoot":"","sources":["../../../src/components/project-auth-setup.tsx"],"names":[],"mappings":"AAcA,UAAU,qBAAqB;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAUD,eAAO,MAAM,gBAAgB,GAAI,4BAA4B,qBAAqB,mDAoMjF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"project-create.d.ts","sourceRoot":"","sources":["../../../src/components/project-create.tsx"],"names":[],"mappings":"AAMA,UAAU,kBAAkB;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAID,eAAO,MAAM,aAAa,GAAI,oBAAoB,kBAAkB,4CAqGnE,CAAC"}
1
+ {"version":3,"file":"project-create.d.ts","sourceRoot":"","sources":["../../../src/components/project-create.tsx"],"names":[],"mappings":"AAMA,UAAU,kBAAkB;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAID,eAAO,MAAM,aAAa,GAAI,oBAAoB,kBAAkB,4CA2GnE,CAAC"}
@@ -1,7 +1,8 @@
1
1
  interface ScheduleCreateProps {
2
2
  identifier: string;
3
3
  cronExpression: string;
4
+ options?: Record<string, string>;
4
5
  }
5
- export declare const ScheduleCreate: ({ identifier, cronExpression }: ScheduleCreateProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export declare const ScheduleCreate: ({ identifier, cronExpression, options }: ScheduleCreateProps) => import("react/jsx-runtime").JSX.Element | null;
6
7
  export {};
7
8
  //# sourceMappingURL=schedule-create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schedule-create.d.ts","sourceRoot":"","sources":["../../../src/components/schedule-create.tsx"],"names":[],"mappings":"AAKA,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACxB;AAYD,eAAO,MAAM,cAAc,GAAI,gCAAgC,mBAAmB,mDA6EjF,CAAC"}
1
+ {"version":3,"file":"schedule-create.d.ts","sourceRoot":"","sources":["../../../src/components/schedule-create.tsx"],"names":[],"mappings":"AAKA,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAYD,eAAO,MAAM,cAAc,GAAI,yCAAyC,mBAAmB,mDAmF1F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@positronic/cli",
3
- "version": "0.0.74",
3
+ "version": "0.0.75",
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.74",
27
- "@positronic/spec": "^0.0.74",
28
- "@positronic/template-new-project": "^0.0.74",
26
+ "@positronic/core": "^0.0.75",
27
+ "@positronic/spec": "^0.0.75",
28
+ "@positronic/template-new-project": "^0.0.75",
29
29
  "caz": "^2.0.0",
30
30
  "chokidar": "^3.6.0",
31
31
  "dotenv": "^16.4.7",