trucontext 0.8.3 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trucontext",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "TruContext CLI — contextual memory for AI applications",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,7 +5,7 @@ import { getActiveApp, setActiveApp } from '../config.js';
5
5
  export async function appsCommand() {
6
6
  try {
7
7
  const res = await controlPlane('GET', '/apps');
8
- const apps = res.data?.apps || [];
8
+ const apps = Array.isArray(res.data) ? res.data : [];
9
9
  const activeApp = getActiveApp();
10
10
 
11
11
  if (apps.length === 0) {
@@ -27,7 +27,7 @@ export async function appsCommand() {
27
27
  export async function useCommand(appId) {
28
28
  try {
29
29
  const res = await controlPlane('GET', '/apps');
30
- const apps = res.data?.apps || [];
30
+ const apps = Array.isArray(res.data) ? res.data : [];
31
31
  const app = apps.find(a => a.appId === appId || a.name.toLowerCase() === appId.toLowerCase());
32
32
 
33
33
  if (!app) {
@@ -135,8 +135,7 @@ export async function usageHistoryCommand(options) {
135
135
  export async function plansCommand() {
136
136
  try {
137
137
  const res = await controlPlane('GET', '/billing/plans');
138
- const plansData = res.data || {};
139
- const plans = plansData.plans || [];
138
+ const plans = Array.isArray(res.data) ? res.data : [];
140
139
 
141
140
  if (plans.length === 0) {
142
141
  console.log(chalk.yellow('No plans available.'));
@@ -96,7 +96,7 @@ export async function loginCommand(options) {
96
96
  // Fetch apps and select or create one
97
97
  try {
98
98
  const res = await controlPlane('GET', '/apps');
99
- const apps = res.data?.apps || [];
99
+ const apps = Array.isArray(res.data) ? res.data : [];
100
100
 
101
101
  if (apps.length === 1) {
102
102
  setActiveApp(apps[0].appId);