Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions bundle/capture.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bundle/commands/auth-login.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions bundle/post-tool-use.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bundle/pre-tool-use.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions bundle/session-end.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 22 additions & 10 deletions bundle/session-start.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions bundle/shell/deeplake-shell.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deeplake-claude-code-plugins",
"version": "0.3.1",
"version": "0.3.2",
"description": "Claude Code plugin for Deeplake memory — captures file ops and syncs to Deeplake cloud",
"type": "module",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export async function login(apiUrl = DEFAULT_API_URL): Promise<Credentials> {

// Step 2: Get user info
const user = await apiGet("/me", authToken, apiUrl) as { id: string; name: string; email?: string };
const userName = user.name || (user.email ? user.email.split("@")[0] : "user");
const userName = user.name || (user.email ? user.email.split("@")[0] : "unknown");
process.stderr.write(`\nLogged in as: ${userName}\n`);

// Step 3: List orgs and select
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFileSync, existsSync } from "node:fs";
import { join } from "node:path";
import { homedir } from "node:os";
import { homedir, userInfo } from "node:os";

export interface Config {
token: string;
Expand Down Expand Up @@ -43,7 +43,7 @@ export function loadConfig(): Config | null {
token,
orgId,
orgName: creds?.orgName ?? orgId,
userName: creds?.userName ?? "user",
userName: creds?.userName || userInfo().username || "unknown",
workspaceId: process.env.DEEPLAKE_WORKSPACE_ID ?? creds?.workspaceId ?? "default",
apiUrl: process.env.DEEPLAKE_API_URL ?? creds?.apiUrl ?? "https://api.deeplake.ai",
tableName: process.env.DEEPLAKE_TABLE ?? "memory",
Expand Down
16 changes: 4 additions & 12 deletions src/hooks/capture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { readdirSync, readFileSync } from "node:fs";
import { join } from "node:path";
import { homedir, userInfo } from "node:os";
import { homedir } from "node:os";
import { readStdin } from "../utils/stdin.js";
import { loadConfig } from "../config.js";
import { DeeplakeApi } from "../deeplake-api.js";
Expand Down Expand Up @@ -35,17 +35,9 @@ const CAPTURE = process.env.DEEPLAKE_CAPTURE !== "false";

/** Build the session JSONL path matching the CLI convention:
* /sessions/<username>/<username>_<org>_<workspace>_<slug>.jsonl */
function buildSessionPath(config: { orgId: string; workspaceId: string }, sessionId: string): string {
// Try to get userName from credentials.json (may have been saved by auth flow)
let userName = "user";
let orgName = "org";
try {
const creds = JSON.parse(readFileSync(join(homedir(), ".deeplake", "credentials.json"), "utf-8"));
userName = creds.userName ?? creds.orgName ?? userInfo().username ?? "user";
orgName = creds.orgName ?? "org";
} catch {
userName = userInfo().username ?? "user";
}
function buildSessionPath(config: { userName: string; orgName: string; workspaceId: string }, sessionId: string): string {
const userName = config.userName;
const orgName = config.orgName;
const workspace = config.workspaceId ?? "default";

// Try to extract slug from local Claude JSONL
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/post-tool-use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function main(): Promise<void> {
const api = new DeeplakeApi(config.token, config.apiUrl, config.orgId, config.workspaceId, table);
const fs = await DeeplakeFs.create(api, table, "/");

const userName = config.userName ?? "user";
const userName = config.userName;
const sessionPath = `/sessions/${userName}/${userName}_${config.orgName ?? config.orgId}_${config.workspaceId}_${input.session_id}.jsonl`;

const entry = {
Expand Down
Loading
Loading