trucontext 0.8.2 → 0.8.3

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.2",
3
+ "version": "0.8.3",
4
4
  "description": "TruContext CLI — contextual memory for AI applications",
5
5
  "type": "module",
6
6
  "bin": {
@@ -45,7 +45,7 @@ export async function usageCommand(options) {
45
45
  const params = [`period=${period}`];
46
46
  if (source) params.push(`source=${source}`);
47
47
  const res = await controlPlane('GET', `/billing/usage/${appId}?${params.join('&')}`);
48
- const usage = res.data?.data || res.data || {};
48
+ const usage = res.data || {};
49
49
 
50
50
  if (!usage || (!usage.apiCalls && !usage.llmInputTokens && !usage.processingMs)) {
51
51
  console.log(chalk.yellow('No usage data available.'));
@@ -92,7 +92,7 @@ export async function usageHistoryCommand(options) {
92
92
  const params = [`period=${period}`];
93
93
  if (source) params.push(`source=${source}`);
94
94
  const res = await controlPlane('GET', `/billing/usage/${appId}/history?${params.join('&')}`);
95
- const historyData = res.data?.data || res.data || {};
95
+ const historyData = res.data || {};
96
96
  const history = historyData.history || [];
97
97
 
98
98
  if (history.length === 0) {
@@ -135,7 +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?.data || res.data || {};
138
+ const plansData = res.data || {};
139
139
  const plans = plansData.plans || [];
140
140
 
141
141
  if (plans.length === 0) {
@@ -4,7 +4,7 @@ import { publicApi } from '../client.js';
4
4
  export async function docsListCommand() {
5
5
  try {
6
6
  const res = await publicApi('GET', '/public/docs');
7
- const sections = res.data?.sections || res.sections || [];
7
+ const sections = Array.isArray(res.data) ? res.data : [];
8
8
 
9
9
  if (sections.length === 0) {
10
10
  console.log(chalk.yellow('No documentation available.'));
@@ -49,7 +49,7 @@ export async function entitiesListCommand(options) {
49
49
  const path = `/apps/${appId}/entities${qs ? `?${qs}` : ''}`;
50
50
 
51
51
  const res = await controlPlane('GET', path);
52
- const entities = Array.isArray(res.data) ? res.data : (res.data?.entities || []);
52
+ const entities = Array.isArray(res.data) ? res.data : [];
53
53
 
54
54
  if (entities.length === 0) {
55
55
  console.log(chalk.yellow('No entities found.'));
@@ -201,7 +201,7 @@ export async function entitiesEdgesCommand(entityId) {
201
201
  try {
202
202
  const appId = getActiveApp();
203
203
  const res = await controlPlane('GET', `/apps/${appId}/entities/${entityId}/edges`);
204
- const edges = res.data?.edges || res.data || [];
204
+ const edges = Array.isArray(res.data) ? res.data : [];
205
205
 
206
206
  if (edges.length === 0) {
207
207
  console.log(chalk.yellow('No edges found.'));
@@ -76,7 +76,7 @@ export function registerRootsCommand(program) {
76
76
  try {
77
77
  const appId = getActiveApp();
78
78
  const res = await controlPlane('GET', `/apps/${appId}/roots`);
79
- const rootNodes = res.data?.roots || [];
79
+ const rootNodes = Array.isArray(res.data) ? res.data : [];
80
80
  if (rootNodes.length === 0) {
81
81
  console.log('No root nodes. Create one with: trucontext roots create');
82
82
  return;