trucontext 0.1.0 → 0.1.2

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/bin/cli.js CHANGED
@@ -18,7 +18,7 @@ import { relationshipTypesListCommand } from '../src/commands/relationship-types
18
18
  program
19
19
  .name('trucontext')
20
20
  .description('TruContext CLI — contextual memory for AI applications')
21
- .version('0.1.0');
21
+ .version('0.1.2');
22
22
 
23
23
  // Auth
24
24
  program.command('login')
@@ -75,7 +75,7 @@ program.command('recall <query>')
75
75
  .action(recallCommand);
76
76
 
77
77
  // Contexts
78
- const contexts = program.command('contexts').description('Manage contexts');
78
+ const contexts = program.command('contexts').description('Manage contexts').action(function() { this.help(); });
79
79
  contexts.command('list').description('List contexts').action(contextsListCommand);
80
80
  contexts.command('create <name>')
81
81
  .description('Create a context')
@@ -84,7 +84,7 @@ contexts.command('create <name>')
84
84
  contexts.command('delete <id>').description('Delete a context').action(contextsDeleteCommand);
85
85
 
86
86
  // Entities
87
- const entities = program.command('entities').description('Manage entities');
87
+ const entities = program.command('entities').description('Manage entities').action(function() { this.help(); });
88
88
  entities.command('list')
89
89
  .description('List entities')
90
90
  .option('--type <type>', 'Filter by entity type')
@@ -120,7 +120,7 @@ entities.command('delete <entityId>')
120
120
  .action(entitiesDeleteCommand);
121
121
 
122
122
  // Recipes
123
- const recipes = program.command('recipes').description('Manage recipes');
123
+ const recipes = program.command('recipes').description('Manage recipes').action(function() { this.help(); });
124
124
  recipes.command('list')
125
125
  .description('List recipes')
126
126
  .action(recipesListCommand);
@@ -146,7 +146,7 @@ program.command('relationship-types')
146
146
  .action(relationshipTypesListCommand);
147
147
 
148
148
  // Schema
149
- const schema = program.command('schema').description('Manage app schema');
149
+ const schema = program.command('schema').description('Manage app schema').action(function() { this.help(); });
150
150
  schema.command('show').description('Show current schema').action(schemaShowCommand);
151
151
  schema.command('generate')
152
152
  .description('AI-generate a schema')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trucontext",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "TruContext CLI — contextual memory for AI applications",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,8 +29,10 @@ export async function contextsCreateCommand(name, options) {
29
29
  if (options.metadata) {
30
30
  try {
31
31
  body.metadata = JSON.parse(options.metadata);
32
- } catch {
33
- console.error(chalk.red('Invalid metadata JSON'));
32
+ } catch (parseErr) {
33
+ console.error(chalk.red(`Invalid metadata JSON: ${parseErr.message}`));
34
+ console.error(chalk.dim(`Received: ${options.metadata}`));
35
+ console.error(chalk.dim('Tip: use double quotes around the JSON and escape inner quotes, or use single quotes: --metadata \'{"key":"value"}\''));
34
36
  process.exit(1);
35
37
  }
36
38
  }
@@ -93,14 +93,14 @@ export async function loginCommand(options) {
93
93
  const creds = await performLogin({ provider });
94
94
  console.log(chalk.green(`\nLogged in as ${chalk.bold(creds.email)}`));
95
95
 
96
- // Fetch apps and select one
96
+ // Fetch apps and select or create one
97
97
  try {
98
98
  const res = await controlPlane('GET', '/apps');
99
99
  const apps = res.data?.apps || [];
100
100
 
101
101
  if (apps.length === 1) {
102
102
  setActiveApp(apps[0].appId);
103
- console.log(chalk.dim(`Active app: ${apps[0].name} (${apps[0].appId})`));
103
+ console.log(chalk.dim(`Active app: ${apps[0].name} (${apps[0].appId})\n`));
104
104
  } else if (apps.length > 1) {
105
105
  const chosen = await select({
106
106
  message: 'Select an app:',
@@ -111,13 +111,15 @@ export async function loginCommand(options) {
111
111
  });
112
112
  setActiveApp(chosen);
113
113
  const app = apps.find(a => a.appId === chosen);
114
- console.log(chalk.green(`Active app: ${app.name}`));
114
+ console.log(chalk.green(`Active app: ${app.name}\n`));
115
115
  } else {
116
- console.log(chalk.dim('\nNo apps yet. Create one with:'));
117
- console.log(chalk.cyan(' trucontext init "My App"'));
116
+ console.log(chalk.yellow('\nNo apps yet. Let\'s create your first one.\n'));
117
+ const { initCommand } = await import('./init.js');
118
+ await initCommand(undefined, {});
118
119
  }
119
120
  } catch {
120
121
  // Non-fatal — login still succeeded
122
+ console.log();
121
123
  }
122
124
  } catch (err) {
123
125
  console.error(chalk.red(`Login failed: ${err.message}`));
@@ -16,7 +16,7 @@ export async function relationshipTypesListCommand(options) {
16
16
  const path = `/apps/${appId}/relationship-types${qs ? `?${qs}` : ''}`;
17
17
 
18
18
  const res = await controlPlane('GET', path);
19
- const types = res.data?.relationshipTypes || res.data || [];
19
+ const types = res.data?.types || res.data?.relationshipTypes || res.data || [];
20
20
 
21
21
  if (Array.isArray(types) && types.length === 0) {
22
22
  console.log(chalk.yellow('No relationship types found.'));