@pedrocivita/tocket 1.2.0 → 2.1.0
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/README.md +38 -7
- package/dist/commands/config.cmd.d.ts +2 -0
- package/dist/commands/config.cmd.js +102 -0
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.js +68 -0
- package/dist/commands/eject.cmd.d.ts +6 -0
- package/dist/commands/eject.cmd.js +65 -0
- package/dist/commands/focus.cmd.d.ts +7 -0
- package/dist/commands/focus.cmd.js +52 -0
- package/dist/commands/generate.cmd.js +81 -29
- package/dist/commands/init.cmd.js +31 -10
- package/dist/commands/status.cmd.d.ts +2 -0
- package/dist/commands/status.cmd.js +85 -0
- package/dist/commands/sync.cmd.js +9 -13
- package/dist/commands/validate.cmd.js +7 -6
- package/dist/index.js +21 -2
- package/dist/tests/config.test.d.ts +1 -0
- package/dist/tests/config.test.js +68 -0
- package/dist/tests/eject.test.d.ts +1 -0
- package/dist/tests/eject.test.js +88 -0
- package/dist/tests/focus.test.d.ts +1 -0
- package/dist/tests/focus.test.js +130 -0
- package/dist/tests/git.test.d.ts +1 -0
- package/dist/tests/git.test.js +61 -0
- package/dist/tests/status.test.d.ts +1 -0
- package/dist/tests/status.test.js +34 -0
- package/dist/tests/theme.test.d.ts +1 -0
- package/dist/tests/theme.test.js +58 -0
- package/dist/utils/config.d.ts +16 -0
- package/dist/utils/config.js +33 -0
- package/dist/utils/git.d.ts +6 -0
- package/dist/utils/git.js +79 -0
- package/dist/utils/theme.d.ts +13 -0
- package/dist/utils/theme.js +38 -0
- package/package.json +2 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface TocketConfig {
|
|
2
|
+
author?: string;
|
|
3
|
+
defaultAgent?: string;
|
|
4
|
+
defaults?: {
|
|
5
|
+
priority?: "high" | "medium" | "low";
|
|
6
|
+
skills?: string;
|
|
7
|
+
};
|
|
8
|
+
theme?: {
|
|
9
|
+
disableBanner?: boolean;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function getConfigPath(): string;
|
|
13
|
+
export declare function getConfig(configPath?: string): Promise<TocketConfig>;
|
|
14
|
+
export declare function saveConfig(config: TocketConfig, configPath?: string): Promise<void>;
|
|
15
|
+
export declare function updateConfig(partial: Partial<TocketConfig>, configPath?: string): Promise<void>;
|
|
16
|
+
export declare function resetConfig(configPath?: string): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
4
|
+
export function getConfigPath() {
|
|
5
|
+
return join(homedir(), ".tocketrc.json");
|
|
6
|
+
}
|
|
7
|
+
export async function getConfig(configPath) {
|
|
8
|
+
const path = configPath ?? getConfigPath();
|
|
9
|
+
try {
|
|
10
|
+
const content = await readFile(path, "utf-8");
|
|
11
|
+
return JSON.parse(content);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function saveConfig(config, configPath) {
|
|
18
|
+
const path = configPath ?? getConfigPath();
|
|
19
|
+
await writeFile(path, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
20
|
+
}
|
|
21
|
+
export async function updateConfig(partial, configPath) {
|
|
22
|
+
const current = await getConfig(configPath);
|
|
23
|
+
const merged = {
|
|
24
|
+
...current,
|
|
25
|
+
...partial,
|
|
26
|
+
defaults: { ...current.defaults, ...partial.defaults },
|
|
27
|
+
theme: { ...current.theme, ...partial.theme },
|
|
28
|
+
};
|
|
29
|
+
await saveConfig(merged, configPath);
|
|
30
|
+
}
|
|
31
|
+
export async function resetConfig(configPath) {
|
|
32
|
+
await saveConfig({}, configPath);
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function isGitRepo(cwd?: string): boolean;
|
|
2
|
+
export declare function getStagedFiles(cwd?: string): string[];
|
|
3
|
+
export declare function getModifiedFiles(cwd?: string): string[];
|
|
4
|
+
export declare function getRecentCommits(n?: number, cwd?: string): string[];
|
|
5
|
+
export declare function getRecentCommitsRaw(n?: number, cwd?: string): string;
|
|
6
|
+
export declare function getCurrentBranch(cwd?: string): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
export function isGitRepo(cwd = process.cwd()) {
|
|
5
|
+
return existsSync(join(cwd, ".git"));
|
|
6
|
+
}
|
|
7
|
+
export function getStagedFiles(cwd = process.cwd()) {
|
|
8
|
+
if (!isGitRepo(cwd))
|
|
9
|
+
return [];
|
|
10
|
+
try {
|
|
11
|
+
const output = execSync("git diff --name-only --cached", {
|
|
12
|
+
cwd,
|
|
13
|
+
encoding: "utf-8",
|
|
14
|
+
}).trim();
|
|
15
|
+
return output ? output.split("\n") : [];
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function getModifiedFiles(cwd = process.cwd()) {
|
|
22
|
+
if (!isGitRepo(cwd))
|
|
23
|
+
return [];
|
|
24
|
+
try {
|
|
25
|
+
const output = execSync("git status --porcelain", {
|
|
26
|
+
cwd,
|
|
27
|
+
encoding: "utf-8",
|
|
28
|
+
}).trim();
|
|
29
|
+
if (!output)
|
|
30
|
+
return [];
|
|
31
|
+
return output
|
|
32
|
+
.split("\n")
|
|
33
|
+
.filter((line) => line.length > 3)
|
|
34
|
+
.map((line) => line.substring(3).trim());
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function getRecentCommits(n = 5, cwd = process.cwd()) {
|
|
41
|
+
if (!isGitRepo(cwd))
|
|
42
|
+
return [];
|
|
43
|
+
try {
|
|
44
|
+
const output = execSync(`git log --oneline -${n}`, {
|
|
45
|
+
cwd,
|
|
46
|
+
encoding: "utf-8",
|
|
47
|
+
}).trim();
|
|
48
|
+
return output ? output.split("\n") : [];
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function getRecentCommitsRaw(n = 5, cwd = process.cwd()) {
|
|
55
|
+
if (!isGitRepo(cwd))
|
|
56
|
+
return "_No commits found or not a git repository._";
|
|
57
|
+
try {
|
|
58
|
+
return execSync(`git log --oneline -${n}`, {
|
|
59
|
+
cwd,
|
|
60
|
+
encoding: "utf-8",
|
|
61
|
+
}).trim();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return "_No commits found or not a git repository._";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function getCurrentBranch(cwd = process.cwd()) {
|
|
68
|
+
if (!isGitRepo(cwd))
|
|
69
|
+
return "";
|
|
70
|
+
try {
|
|
71
|
+
return execSync("git branch --show-current", {
|
|
72
|
+
cwd,
|
|
73
|
+
encoding: "utf-8",
|
|
74
|
+
}).trim();
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const purple: import("chalk").ChalkInstance;
|
|
2
|
+
export declare const green: import("chalk").ChalkInstance;
|
|
3
|
+
export declare const red: import("chalk").ChalkInstance;
|
|
4
|
+
export declare const yellow: import("chalk").ChalkInstance;
|
|
5
|
+
export declare const dimmed: import("chalk").ChalkInstance;
|
|
6
|
+
export declare const bold: import("chalk").ChalkInstance;
|
|
7
|
+
export declare function banner(): string;
|
|
8
|
+
export declare function success(msg: string): string;
|
|
9
|
+
export declare function error(msg: string): string;
|
|
10
|
+
export declare function warn(msg: string): string;
|
|
11
|
+
export declare function info(msg: string): string;
|
|
12
|
+
export declare function heading(msg: string): string;
|
|
13
|
+
export declare function dim(msg: string): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
// ── Brand colors ──────────────────────────────────────────────────────
|
|
3
|
+
export const purple = chalk.hex("#7C3AED");
|
|
4
|
+
export const green = chalk.green;
|
|
5
|
+
export const red = chalk.red;
|
|
6
|
+
export const yellow = chalk.yellow;
|
|
7
|
+
export const dimmed = chalk.dim;
|
|
8
|
+
export const bold = chalk.bold;
|
|
9
|
+
// ── ASCII banner ──────────────────────────────────────────────────────
|
|
10
|
+
export function banner() {
|
|
11
|
+
const art = `
|
|
12
|
+
████████╗ ██████╗ ██████╗██╗ ██╗███████╗████████╗
|
|
13
|
+
╚══██╔══╝██╔═══██╗██╔════╝██║ ██╔╝██╔════╝╚══██╔══╝
|
|
14
|
+
██║ ██║ ██║██║ █████╔╝ █████╗ ██║
|
|
15
|
+
██║ ██║ ██║██║ ██╔═██╗ ██╔══╝ ██║
|
|
16
|
+
██║ ╚██████╔╝╚██████╗██║ ██╗███████╗ ██║
|
|
17
|
+
╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝`;
|
|
18
|
+
return purple(art) + "\n" + dimmed(" Context Engineering Framework\n");
|
|
19
|
+
}
|
|
20
|
+
// ── Semantic helpers ──────────────────────────────────────────────────
|
|
21
|
+
export function success(msg) {
|
|
22
|
+
return `${green("\u2713")} ${msg}`;
|
|
23
|
+
}
|
|
24
|
+
export function error(msg) {
|
|
25
|
+
return `${red("\u2717")} ${msg}`;
|
|
26
|
+
}
|
|
27
|
+
export function warn(msg) {
|
|
28
|
+
return `${yellow("\u26A0")} ${msg}`;
|
|
29
|
+
}
|
|
30
|
+
export function info(msg) {
|
|
31
|
+
return `${purple("\u203A")} ${msg}`;
|
|
32
|
+
}
|
|
33
|
+
export function heading(msg) {
|
|
34
|
+
return bold(purple(msg));
|
|
35
|
+
}
|
|
36
|
+
export function dim(msg) {
|
|
37
|
+
return dimmed(msg);
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pedrocivita/tocket",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "The Context Engineering Framework for Multi-Agent Workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@inquirer/prompts": "^8.3.0",
|
|
40
|
+
"chalk": "^5.6.2",
|
|
40
41
|
"clipboardy": "^5.3.0",
|
|
41
42
|
"commander": "^14.0.3"
|
|
42
43
|
},
|