@pedrocivita/tocket 1.2.0 → 2.0.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 +29 -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 +65 -0
- package/dist/commands/generate.cmd.js +81 -29
- package/dist/commands/init.cmd.js +31 -10
- package/dist/commands/sync.cmd.js +9 -13
- package/dist/commands/validate.cmd.js +7 -6
- package/dist/index.js +15 -2
- package/dist/tests/config.test.d.ts +1 -0
- package/dist/tests/config.test.js +68 -0
- package/dist/tests/git.test.d.ts +1 -0
- package/dist/tests/git.test.js +61 -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
package/README.md
CHANGED
|
@@ -32,10 +32,13 @@ The CLI just automates the scaffolding.
|
|
|
32
32
|
## Quick Start
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
+
# Interactive dashboard — guided entry point
|
|
36
|
+
npx @pedrocivita/tocket
|
|
37
|
+
|
|
35
38
|
# Scaffold a new workspace (creates .context/, TOCKET.md, CLAUDE.md, GEMINI.md)
|
|
36
39
|
npx @pedrocivita/tocket init
|
|
37
40
|
|
|
38
|
-
# Generate a payload XML
|
|
41
|
+
# Generate a payload XML with smart git integration
|
|
39
42
|
npx @pedrocivita/tocket generate
|
|
40
43
|
|
|
41
44
|
# Sync session progress into Memory Bank
|
|
@@ -44,12 +47,31 @@ npx @pedrocivita/tocket sync
|
|
|
44
47
|
|
|
45
48
|
## Commands
|
|
46
49
|
|
|
47
|
-
| Command | What it does
|
|
48
|
-
| ----------------- |
|
|
49
|
-
| `tocket
|
|
50
|
-
| `tocket
|
|
51
|
-
| `tocket
|
|
52
|
-
| `tocket
|
|
50
|
+
| Command | What it does |
|
|
51
|
+
| ----------------- | -------------------------------------------------------------------- |
|
|
52
|
+
| `tocket` | Interactive dashboard with guided menu |
|
|
53
|
+
| `tocket init` | Scaffolds `.context/`, `TOCKET.md`, `CLAUDE.md`, `GEMINI.md` |
|
|
54
|
+
| `tocket generate` | Smart payload builder — auto-fills scope from git, multi-task support |
|
|
55
|
+
| `tocket sync` | Appends session summary + git log to `.context/progress.md` |
|
|
56
|
+
| `tocket validate` | Checks if the current directory has a valid Tocket Memory Bank |
|
|
57
|
+
| `tocket config` | Manage global settings (`~/.tocketrc.json`) |
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
Set global defaults so you don't repeat yourself:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Interactive setup
|
|
65
|
+
tocket config
|
|
66
|
+
|
|
67
|
+
# Or use flags (CI-friendly)
|
|
68
|
+
tocket config --author "Your Name" --priority medium --skills "core,lsp"
|
|
69
|
+
|
|
70
|
+
# View current config
|
|
71
|
+
tocket config --show
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Config is stored at `~/.tocketrc.json` and pre-fills author, priority, and skills in all commands.
|
|
53
75
|
|
|
54
76
|
## How Triangulation works
|
|
55
77
|
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { input, select, confirm } from "@inquirer/prompts";
|
|
2
|
+
import { getConfig, saveConfig, resetConfig, getConfigPath, } from "../utils/config.js";
|
|
3
|
+
import { success, heading, dim } from "../utils/theme.js";
|
|
4
|
+
export function registerConfigCommand(program) {
|
|
5
|
+
program
|
|
6
|
+
.command("config")
|
|
7
|
+
.description("Manage global Tocket configuration (~/.tocketrc.json)")
|
|
8
|
+
.option("--author <name>", "Set default author name")
|
|
9
|
+
.option("--agent <name>", "Set default agent name")
|
|
10
|
+
.option("--priority <level>", "Set default priority (high|medium|low)")
|
|
11
|
+
.option("--skills <list>", "Set default skills (comma-separated)")
|
|
12
|
+
.option("--show", "Display current configuration")
|
|
13
|
+
.option("--path", "Show config file path")
|
|
14
|
+
.option("--reset", "Reset configuration to defaults")
|
|
15
|
+
.action(async (options) => {
|
|
16
|
+
// --path: print and exit
|
|
17
|
+
if (options.path) {
|
|
18
|
+
console.log(getConfigPath());
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
// --show: display current config
|
|
22
|
+
if (options.show) {
|
|
23
|
+
const config = await getConfig();
|
|
24
|
+
console.log(heading("\n Current Configuration\n"));
|
|
25
|
+
console.log(JSON.stringify(config, null, 2)
|
|
26
|
+
.split("\n")
|
|
27
|
+
.map((l) => " " + l)
|
|
28
|
+
.join("\n"));
|
|
29
|
+
console.log(dim(`\n Path: ${getConfigPath()}\n`));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// --reset: clear config
|
|
33
|
+
if (options.reset) {
|
|
34
|
+
const ok = await confirm({
|
|
35
|
+
message: "Reset all configuration to defaults?",
|
|
36
|
+
default: false,
|
|
37
|
+
});
|
|
38
|
+
if (ok) {
|
|
39
|
+
await resetConfig();
|
|
40
|
+
console.log(success("Configuration reset."));
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Non-interactive: handle individual flags
|
|
45
|
+
const hasFlags = options.author || options.agent || options.priority || options.skills;
|
|
46
|
+
if (hasFlags) {
|
|
47
|
+
const config = await getConfig();
|
|
48
|
+
if (options.author)
|
|
49
|
+
config.author = options.author;
|
|
50
|
+
if (options.agent)
|
|
51
|
+
config.defaultAgent = options.agent;
|
|
52
|
+
if (options.priority) {
|
|
53
|
+
if (!config.defaults)
|
|
54
|
+
config.defaults = {};
|
|
55
|
+
config.defaults.priority = options.priority;
|
|
56
|
+
}
|
|
57
|
+
if (options.skills) {
|
|
58
|
+
if (!config.defaults)
|
|
59
|
+
config.defaults = {};
|
|
60
|
+
config.defaults.skills = options.skills;
|
|
61
|
+
}
|
|
62
|
+
await saveConfig(config);
|
|
63
|
+
console.log(success("Configuration updated."));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// Interactive TUI mode
|
|
67
|
+
const current = await getConfig();
|
|
68
|
+
console.log(heading("\n Tocket Configuration\n"));
|
|
69
|
+
const author = await input({
|
|
70
|
+
message: "Author name:",
|
|
71
|
+
default: current.author || undefined,
|
|
72
|
+
});
|
|
73
|
+
const agent = await input({
|
|
74
|
+
message: "Default agent name:",
|
|
75
|
+
default: current.defaultAgent || undefined,
|
|
76
|
+
});
|
|
77
|
+
const priority = await select({
|
|
78
|
+
message: "Default priority:",
|
|
79
|
+
choices: [
|
|
80
|
+
{ value: "high", name: "high" },
|
|
81
|
+
{ value: "medium", name: "medium" },
|
|
82
|
+
{ value: "low", name: "low" },
|
|
83
|
+
],
|
|
84
|
+
default: current.defaults?.priority ?? "medium",
|
|
85
|
+
});
|
|
86
|
+
const skills = await input({
|
|
87
|
+
message: "Default skills (comma-separated):",
|
|
88
|
+
default: current.defaults?.skills || undefined,
|
|
89
|
+
});
|
|
90
|
+
await saveConfig({
|
|
91
|
+
...current,
|
|
92
|
+
author: author || undefined,
|
|
93
|
+
defaultAgent: agent || undefined,
|
|
94
|
+
defaults: {
|
|
95
|
+
priority: priority,
|
|
96
|
+
skills: skills || undefined,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
console.log("\n" + success("Configuration saved."));
|
|
100
|
+
console.log(dim(` Path: ${getConfigPath()}\n`));
|
|
101
|
+
});
|
|
102
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { select } from "@inquirer/prompts";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { banner, heading, success, dim, warn } from "../utils/theme.js";
|
|
6
|
+
import { getConfig } from "../utils/config.js";
|
|
7
|
+
function extractFocus(content) {
|
|
8
|
+
const match = content.match(/## Current Focus\s*\n+(.+)/);
|
|
9
|
+
if (!match?.[1])
|
|
10
|
+
return "";
|
|
11
|
+
const line = match[1].trim();
|
|
12
|
+
if (line.startsWith("_") || line.includes("No active tasks"))
|
|
13
|
+
return "";
|
|
14
|
+
return line.length > 80 ? line.substring(0, 77) + "..." : line;
|
|
15
|
+
}
|
|
16
|
+
export async function showDashboard(program) {
|
|
17
|
+
const config = await getConfig();
|
|
18
|
+
const cwd = process.cwd();
|
|
19
|
+
const hasWorkspace = existsSync(join(cwd, ".context"));
|
|
20
|
+
if (!config.theme?.disableBanner) {
|
|
21
|
+
console.log(banner());
|
|
22
|
+
}
|
|
23
|
+
console.log(heading(" Dashboard\n"));
|
|
24
|
+
if (hasWorkspace) {
|
|
25
|
+
console.log(" " + success("Workspace detected"));
|
|
26
|
+
try {
|
|
27
|
+
const ctx = await readFile(join(cwd, ".context", "activeContext.md"), "utf-8");
|
|
28
|
+
const focus = extractFocus(ctx);
|
|
29
|
+
if (focus) {
|
|
30
|
+
console.log(" " + dim(`Focus: ${focus}`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// activeContext.md missing or unreadable — ignore
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log(" " + warn("No workspace in this directory"));
|
|
39
|
+
console.log(" " + dim("Run init to scaffold a Tocket workspace here.\n"));
|
|
40
|
+
}
|
|
41
|
+
console.log();
|
|
42
|
+
const choices = hasWorkspace
|
|
43
|
+
? [
|
|
44
|
+
{ value: "generate", name: "Generate payload" },
|
|
45
|
+
{ value: "sync", name: "Sync progress" },
|
|
46
|
+
{ value: "validate", name: "Validate workspace" },
|
|
47
|
+
{ value: "config", name: "Configure settings" },
|
|
48
|
+
{ value: "exit", name: "Exit" },
|
|
49
|
+
]
|
|
50
|
+
: [
|
|
51
|
+
{ value: "init", name: "Initialize workspace" },
|
|
52
|
+
{ value: "config", name: "Configure settings" },
|
|
53
|
+
{ value: "exit", name: "Exit" },
|
|
54
|
+
];
|
|
55
|
+
const action = await select({
|
|
56
|
+
message: "What would you like to do?",
|
|
57
|
+
choices,
|
|
58
|
+
});
|
|
59
|
+
if (action === "exit") {
|
|
60
|
+
console.log(dim("\n Goodbye!\n"));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
console.log();
|
|
64
|
+
await program.parseAsync(["node", "tocket", action]);
|
|
65
|
+
}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import { input, select } from "@inquirer/prompts";
|
|
1
|
+
import { input, select, confirm } from "@inquirer/prompts";
|
|
2
2
|
import clipboard from "clipboardy";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { success, heading, dim, banner } from "../utils/theme.js";
|
|
4
|
+
import { getConfig } from "../utils/config.js";
|
|
5
|
+
import { getStagedFiles, getModifiedFiles } from "../utils/git.js";
|
|
6
|
+
function buildPayloadXml(tasks) {
|
|
7
|
+
const first = tasks[0];
|
|
8
|
+
const skillsAttr = first.skills.trim()
|
|
9
|
+
? `\n <skills>${first.skills.trim()}</skills>`
|
|
6
10
|
: "";
|
|
11
|
+
const taskBlocks = tasks
|
|
12
|
+
.map((t, i) => ` <task id="${i + 1}" type="create | edit | delete">
|
|
13
|
+
<target><!-- file/path --></target>
|
|
14
|
+
<action>${t.intent}</action>
|
|
15
|
+
<spec><!-- Detailed specification --></spec>
|
|
16
|
+
<done><!-- Definition of done --></done>
|
|
17
|
+
</task>`)
|
|
18
|
+
.join("\n");
|
|
7
19
|
return `<payload version="2.0">
|
|
8
20
|
<meta>
|
|
9
|
-
<intent>${
|
|
10
|
-
<scope>${
|
|
11
|
-
<priority>${
|
|
21
|
+
<intent>${first.intent}</intent>
|
|
22
|
+
<scope>${first.scope}</scope>${skillsAttr}
|
|
23
|
+
<priority>${first.priority}</priority>
|
|
12
24
|
</meta>
|
|
13
25
|
|
|
14
26
|
<context>
|
|
@@ -16,12 +28,7 @@ function buildPayloadXml(opts) {
|
|
|
16
28
|
</context>
|
|
17
29
|
|
|
18
30
|
<tasks>
|
|
19
|
-
|
|
20
|
-
<target><!-- file/path --></target>
|
|
21
|
-
<action><!-- What to do --></action>
|
|
22
|
-
<spec><!-- Detailed specification --></spec>
|
|
23
|
-
<done><!-- Definition of done --></done>
|
|
24
|
-
</task>
|
|
31
|
+
${taskBlocks}
|
|
25
32
|
</tasks>
|
|
26
33
|
|
|
27
34
|
<validate>
|
|
@@ -29,26 +36,71 @@ function buildPayloadXml(opts) {
|
|
|
29
36
|
</validate>
|
|
30
37
|
</payload>`;
|
|
31
38
|
}
|
|
39
|
+
function suggestScope() {
|
|
40
|
+
const staged = getStagedFiles();
|
|
41
|
+
const modified = getModifiedFiles();
|
|
42
|
+
const all = [...new Set([...staged, ...modified])];
|
|
43
|
+
return all.join(", ");
|
|
44
|
+
}
|
|
32
45
|
export function registerGenerateCommand(program) {
|
|
33
46
|
program
|
|
34
47
|
.command("generate")
|
|
35
48
|
.description("Build payload XMLs interactively for Architect-Executor handoff")
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
.option("--no-preview", "Skip payload preview before copying")
|
|
50
|
+
.action(async (options) => {
|
|
51
|
+
const config = await getConfig();
|
|
52
|
+
if (!config.theme?.disableBanner) {
|
|
53
|
+
console.log(banner());
|
|
54
|
+
}
|
|
55
|
+
const tasks = [];
|
|
56
|
+
const suggestedScope = suggestScope();
|
|
57
|
+
const defaultPriority = config.defaults?.priority ?? "medium";
|
|
58
|
+
const defaultSkills = config.defaults?.skills ?? "";
|
|
59
|
+
let addMore = true;
|
|
60
|
+
while (addMore) {
|
|
61
|
+
const taskNum = tasks.length + 1;
|
|
62
|
+
if (taskNum > 1) {
|
|
63
|
+
console.log(heading(`\n Task ${taskNum}\n`));
|
|
64
|
+
}
|
|
65
|
+
const intent = await input({ message: "Intent (goal in one line):" });
|
|
66
|
+
const scope = await input({
|
|
67
|
+
message: "Scope (files/folders affected):",
|
|
68
|
+
default: taskNum === 1 && suggestedScope ? suggestedScope : undefined,
|
|
69
|
+
});
|
|
70
|
+
const priority = await select({
|
|
71
|
+
message: "Priority:",
|
|
72
|
+
choices: [
|
|
73
|
+
{ value: "high", name: "high" },
|
|
74
|
+
{ value: "medium", name: "medium" },
|
|
75
|
+
{ value: "low", name: "low" },
|
|
76
|
+
],
|
|
77
|
+
default: defaultPriority,
|
|
78
|
+
});
|
|
79
|
+
const skills = await input({
|
|
80
|
+
message: "Skills/plugins (comma-separated, optional):",
|
|
81
|
+
default: taskNum === 1 && defaultSkills ? defaultSkills : undefined,
|
|
82
|
+
});
|
|
83
|
+
tasks.push({ intent, scope, priority, skills });
|
|
84
|
+
addMore = await confirm({
|
|
85
|
+
message: "Add another task?",
|
|
86
|
+
default: false,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const xml = buildPayloadXml(tasks);
|
|
90
|
+
// Preview
|
|
91
|
+
if (options.preview !== false) {
|
|
92
|
+
console.log(dim("\n--- Payload Preview ---"));
|
|
93
|
+
const lines = xml.split("\n");
|
|
94
|
+
const preview = lines.length > 20
|
|
95
|
+
? lines.slice(0, 20).join("\n") + dim("\n ... (" + (lines.length - 20) + " more lines)")
|
|
96
|
+
: lines.join("\n");
|
|
97
|
+
console.log(dim(preview));
|
|
98
|
+
console.log(dim("--- End Preview ---\n"));
|
|
99
|
+
}
|
|
51
100
|
clipboard.writeSync(xml);
|
|
52
|
-
console.log(
|
|
101
|
+
console.log(success(`Payload XML (v2.0) copied to clipboard!`) +
|
|
102
|
+
dim(` ${tasks.length} task(s).`) +
|
|
103
|
+
"\n" +
|
|
104
|
+
dim(" Paste it into your Architect to continue.\n"));
|
|
53
105
|
});
|
|
54
106
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { input } from "@inquirer/prompts";
|
|
1
|
+
import { input, confirm } from "@inquirer/prompts";
|
|
2
2
|
import { mkdir, readFile, writeFile, access } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import { banner, heading, info, success, dim } from "../utils/theme.js";
|
|
5
|
+
import { getConfig } from "../utils/config.js";
|
|
4
6
|
import { claudeMd, geminiMd, tocketMd, activeContextMd, systemPatternsMd, productContextMd, techContextMd, progressMd, cursorrulesMd, } from "../templates/memory-bank.js";
|
|
5
7
|
async function fileExists(path) {
|
|
6
8
|
try {
|
|
@@ -116,22 +118,28 @@ export function registerInitCommand(program) {
|
|
|
116
118
|
program
|
|
117
119
|
.command("init")
|
|
118
120
|
.description("Scaffold an agentic workspace with Memory Bank and triangulation config")
|
|
119
|
-
.
|
|
121
|
+
.option("-f, --force", "Overwrite existing files without prompting")
|
|
122
|
+
.action(async (options) => {
|
|
123
|
+
const force = options.force ?? false;
|
|
120
124
|
const cwd = process.cwd();
|
|
125
|
+
const globalConfig = await getConfig();
|
|
126
|
+
if (!globalConfig.theme?.disableBanner) {
|
|
127
|
+
console.log(banner());
|
|
128
|
+
}
|
|
121
129
|
const { stack, detectedName, detectedDescription } = await detectStack(cwd);
|
|
122
130
|
const hasDetection = Boolean(stack.language);
|
|
123
131
|
if (hasDetection) {
|
|
124
|
-
console.log("
|
|
132
|
+
console.log(heading(" Auto-detected stack:\n"));
|
|
125
133
|
if (stack.language)
|
|
126
|
-
console.log(`
|
|
134
|
+
console.log(info(`Language: ${stack.language}`));
|
|
127
135
|
if (stack.runtime)
|
|
128
|
-
console.log(`
|
|
136
|
+
console.log(info(`Runtime: ${stack.runtime}`));
|
|
129
137
|
if (stack.build)
|
|
130
|
-
console.log(`
|
|
138
|
+
console.log(info(`Build: ${stack.build}`));
|
|
131
139
|
if (stack.framework)
|
|
132
|
-
console.log(`
|
|
140
|
+
console.log(info(`Framework: ${stack.framework}`));
|
|
133
141
|
if (stack.extras.length)
|
|
134
|
-
console.log(`
|
|
142
|
+
console.log(info(`Extras: ${stack.extras.join(", ")}`));
|
|
135
143
|
console.log();
|
|
136
144
|
}
|
|
137
145
|
const projectName = await input({
|
|
@@ -163,9 +171,22 @@ export function registerInitCommand(program) {
|
|
|
163
171
|
];
|
|
164
172
|
for (const [filePath, content] of files) {
|
|
165
173
|
const fullPath = join(cwd, filePath);
|
|
174
|
+
const exists = await fileExists(fullPath);
|
|
175
|
+
if (exists && !force) {
|
|
176
|
+
const overwrite = await confirm({
|
|
177
|
+
message: `${filePath} already exists. Overwrite?`,
|
|
178
|
+
default: false,
|
|
179
|
+
});
|
|
180
|
+
if (!overwrite) {
|
|
181
|
+
console.log(" " + dim(`skipped ${filePath}`));
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
166
185
|
await writeFile(fullPath, content, "utf-8");
|
|
167
|
-
console.log(
|
|
186
|
+
console.log(" " + success(`${exists ? "updated" : "created"} ${filePath}`));
|
|
168
187
|
}
|
|
169
|
-
console.log(
|
|
188
|
+
console.log("\n" + success(`Workspace initialized for ${projectName}!`) +
|
|
189
|
+
(hasDetection ? dim(" Stack pre-populated from package.json.") : "") +
|
|
190
|
+
"\n" + dim(" Next: run tocket generate to create your first payload.\n"));
|
|
170
191
|
});
|
|
171
192
|
}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { input } from "@inquirer/prompts";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { appendFile, writeFile } from "node:fs/promises";
|
|
4
|
-
import { execSync } from "node:child_process";
|
|
5
4
|
import { join } from "node:path";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
catch {
|
|
11
|
-
return "_No commits found or not a git repository._";
|
|
12
|
-
}
|
|
13
|
-
}
|
|
5
|
+
import { success, error as themeError } from "../utils/theme.js";
|
|
6
|
+
import { getRecentCommitsRaw } from "../utils/git.js";
|
|
7
|
+
import { getConfig } from "../utils/config.js";
|
|
14
8
|
export function registerSyncCommand(program) {
|
|
15
9
|
program
|
|
16
10
|
.command("sync")
|
|
@@ -19,16 +13,18 @@ export function registerSyncCommand(program) {
|
|
|
19
13
|
const progressPath = join(process.cwd(), ".context", "progress.md");
|
|
20
14
|
const contextDir = join(process.cwd(), ".context");
|
|
21
15
|
if (!existsSync(contextDir)) {
|
|
22
|
-
console.error("
|
|
16
|
+
console.error(themeError("Memory Bank not found. Run 'tocket init' first."));
|
|
23
17
|
process.exitCode = 1;
|
|
24
18
|
return;
|
|
25
19
|
}
|
|
20
|
+
const config = await getConfig();
|
|
26
21
|
const summary = await input({
|
|
27
22
|
message: "What did you accomplish in this session?",
|
|
28
23
|
});
|
|
29
|
-
const commits =
|
|
24
|
+
const commits = getRecentCommitsRaw();
|
|
30
25
|
const date = new Date().toISOString().split("T")[0];
|
|
31
|
-
const
|
|
26
|
+
const authorTag = config.author ? ` (${config.author})` : "";
|
|
27
|
+
const block = `## Session: ${date}${authorTag}
|
|
32
28
|
|
|
33
29
|
**Summary**: ${summary}
|
|
34
30
|
|
|
@@ -46,6 +42,6 @@ ${commits}
|
|
|
46
42
|
else {
|
|
47
43
|
await appendFile(progressPath, block, "utf-8");
|
|
48
44
|
}
|
|
49
|
-
console.log("\n
|
|
45
|
+
console.log("\n" + success("Memory Bank synchronized!"));
|
|
50
46
|
});
|
|
51
47
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { existsSync, statSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
import { success as themePass, warn as themeWarn, error as themeFail, heading } from "../utils/theme.js";
|
|
4
|
+
const PASS = themePass("");
|
|
5
|
+
const WARN = themeWarn("");
|
|
6
|
+
const FAIL = themeFail("");
|
|
6
7
|
function checkFile(basePath, relativePath, required) {
|
|
7
8
|
const fullPath = join(basePath, relativePath);
|
|
8
9
|
if (existsSync(fullPath)) {
|
|
@@ -55,7 +56,7 @@ export function registerValidateCommand(program) {
|
|
|
55
56
|
const cwd = process.cwd();
|
|
56
57
|
const results = [];
|
|
57
58
|
let hasFailure = false;
|
|
58
|
-
console.log("\nValidating Tocket workspace...\n");
|
|
59
|
+
console.log(heading("\nValidating Tocket workspace...\n"));
|
|
59
60
|
// Required files
|
|
60
61
|
results.push(checkFile(cwd, join(".context"), true));
|
|
61
62
|
results.push(checkFile(cwd, join(".context", "activeContext.md"), true));
|
|
@@ -80,11 +81,11 @@ export function registerValidateCommand(program) {
|
|
|
80
81
|
}
|
|
81
82
|
console.log("");
|
|
82
83
|
if (hasFailure) {
|
|
83
|
-
console.log("
|
|
84
|
+
console.log(themeFail("Workspace has issues.") + " Run tocket init to scaffold missing files.");
|
|
84
85
|
process.exitCode = 1;
|
|
85
86
|
}
|
|
86
87
|
else {
|
|
87
|
-
console.log("
|
|
88
|
+
console.log(themePass("Workspace is healthy."));
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
91
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
2
4
|
import { Command } from "commander";
|
|
3
5
|
import { registerInitCommand } from "./commands/init.cmd.js";
|
|
4
6
|
import { registerGenerateCommand } from "./commands/generate.cmd.js";
|
|
5
7
|
import { registerSyncCommand } from "./commands/sync.cmd.js";
|
|
6
8
|
import { registerValidateCommand } from "./commands/validate.cmd.js";
|
|
9
|
+
import { registerConfigCommand } from "./commands/config.cmd.js";
|
|
10
|
+
const pkg = JSON.parse(readFileSync(join(import.meta.dirname, "..", "package.json"), "utf-8"));
|
|
7
11
|
const program = new Command();
|
|
8
12
|
program
|
|
9
13
|
.name("tocket")
|
|
10
14
|
.description("The Context Engineering Framework for Multi-Agent Workspaces")
|
|
11
|
-
.version(
|
|
15
|
+
.version(pkg.version);
|
|
12
16
|
registerInitCommand(program);
|
|
13
17
|
registerGenerateCommand(program);
|
|
14
18
|
registerSyncCommand(program);
|
|
15
19
|
registerValidateCommand(program);
|
|
16
|
-
program
|
|
20
|
+
registerConfigCommand(program);
|
|
21
|
+
// No-args: show interactive dashboard (TTY) or help (non-TTY)
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
if (args.length === 0 && process.stdin.isTTY) {
|
|
24
|
+
const { showDashboard } = await import("./commands/dashboard.js");
|
|
25
|
+
await showDashboard(program);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
program.parse();
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, it, before, after } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { getConfig, saveConfig, updateConfig, resetConfig, } from "../utils/config.js";
|
|
7
|
+
describe("config - read and write", () => {
|
|
8
|
+
let tempDir;
|
|
9
|
+
let configPath;
|
|
10
|
+
before(() => {
|
|
11
|
+
tempDir = mkdtempSync(join(tmpdir(), "tocket-config-test-"));
|
|
12
|
+
configPath = join(tempDir, ".tocketrc.json");
|
|
13
|
+
});
|
|
14
|
+
after(() => {
|
|
15
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
16
|
+
});
|
|
17
|
+
it("getConfig returns empty object when file does not exist", async () => {
|
|
18
|
+
const config = await getConfig(configPath);
|
|
19
|
+
assert.deepEqual(config, {});
|
|
20
|
+
});
|
|
21
|
+
it("saveConfig writes a valid config", async () => {
|
|
22
|
+
const data = { author: "Test User" };
|
|
23
|
+
await saveConfig(data, configPath);
|
|
24
|
+
const config = await getConfig(configPath);
|
|
25
|
+
assert.equal(config.author, "Test User");
|
|
26
|
+
});
|
|
27
|
+
it("saveConfig preserves all fields", async () => {
|
|
28
|
+
const data = {
|
|
29
|
+
author: "Alice",
|
|
30
|
+
defaultAgent: "Claude",
|
|
31
|
+
defaults: { priority: "high", skills: "core,lsp" },
|
|
32
|
+
theme: { disableBanner: true },
|
|
33
|
+
};
|
|
34
|
+
await saveConfig(data, configPath);
|
|
35
|
+
const config = await getConfig(configPath);
|
|
36
|
+
assert.equal(config.author, "Alice");
|
|
37
|
+
assert.equal(config.defaultAgent, "Claude");
|
|
38
|
+
assert.equal(config.defaults?.priority, "high");
|
|
39
|
+
assert.equal(config.defaults?.skills, "core,lsp");
|
|
40
|
+
assert.equal(config.theme?.disableBanner, true);
|
|
41
|
+
});
|
|
42
|
+
it("updateConfig merges without overwriting", async () => {
|
|
43
|
+
await saveConfig({ author: "Bob", defaultAgent: "Gemini" }, configPath);
|
|
44
|
+
await updateConfig({ author: "Charlie" }, configPath);
|
|
45
|
+
const config = await getConfig(configPath);
|
|
46
|
+
assert.equal(config.author, "Charlie");
|
|
47
|
+
assert.equal(config.defaultAgent, "Gemini");
|
|
48
|
+
});
|
|
49
|
+
it("updateConfig merges nested defaults", async () => {
|
|
50
|
+
await saveConfig({ defaults: { priority: "low", skills: "a,b" } }, configPath);
|
|
51
|
+
await updateConfig({ defaults: { priority: "high" } }, configPath);
|
|
52
|
+
const config = await getConfig(configPath);
|
|
53
|
+
assert.equal(config.defaults?.priority, "high");
|
|
54
|
+
assert.equal(config.defaults?.skills, "a,b");
|
|
55
|
+
});
|
|
56
|
+
it("resetConfig clears all data", async () => {
|
|
57
|
+
await saveConfig({ author: "Remove Me" }, configPath);
|
|
58
|
+
await resetConfig(configPath);
|
|
59
|
+
const config = await getConfig(configPath);
|
|
60
|
+
assert.deepEqual(config, {});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
describe("config - error handling", () => {
|
|
64
|
+
it("getConfig returns empty object for non-existent path", async () => {
|
|
65
|
+
const config = await getConfig("/nonexistent/path/.tocketrc.json");
|
|
66
|
+
assert.deepEqual(config, {});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, it, after } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { isGitRepo, getStagedFiles, getModifiedFiles, getRecentCommits, getRecentCommitsRaw, getCurrentBranch, } from "../utils/git.js";
|
|
7
|
+
// Use the Tocket repo itself for "in git" tests
|
|
8
|
+
const tocketRoot = join(import.meta.dirname, "..", "..");
|
|
9
|
+
describe("git - in a git repository", () => {
|
|
10
|
+
it("isGitRepo returns true", () => {
|
|
11
|
+
assert.equal(isGitRepo(tocketRoot), true);
|
|
12
|
+
});
|
|
13
|
+
it("getRecentCommits returns an array with items", () => {
|
|
14
|
+
const commits = getRecentCommits(3, tocketRoot);
|
|
15
|
+
assert.ok(Array.isArray(commits));
|
|
16
|
+
assert.ok(commits.length > 0);
|
|
17
|
+
});
|
|
18
|
+
it("getRecentCommitsRaw returns a non-empty string", () => {
|
|
19
|
+
const raw = getRecentCommitsRaw(3, tocketRoot);
|
|
20
|
+
assert.ok(raw.length > 0);
|
|
21
|
+
assert.ok(!raw.includes("No commits found"));
|
|
22
|
+
});
|
|
23
|
+
it("getCurrentBranch returns a non-empty string", () => {
|
|
24
|
+
const branch = getCurrentBranch(tocketRoot);
|
|
25
|
+
assert.ok(typeof branch === "string");
|
|
26
|
+
assert.ok(branch.length > 0);
|
|
27
|
+
});
|
|
28
|
+
it("getStagedFiles returns an array", () => {
|
|
29
|
+
const files = getStagedFiles(tocketRoot);
|
|
30
|
+
assert.ok(Array.isArray(files));
|
|
31
|
+
});
|
|
32
|
+
it("getModifiedFiles returns an array", () => {
|
|
33
|
+
const files = getModifiedFiles(tocketRoot);
|
|
34
|
+
assert.ok(Array.isArray(files));
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe("git - in a non-git directory", () => {
|
|
38
|
+
const tempDir = mkdtempSync(join(tmpdir(), "tocket-git-test-"));
|
|
39
|
+
after(() => {
|
|
40
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
41
|
+
});
|
|
42
|
+
it("isGitRepo returns false", () => {
|
|
43
|
+
assert.equal(isGitRepo(tempDir), false);
|
|
44
|
+
});
|
|
45
|
+
it("getStagedFiles returns empty array", () => {
|
|
46
|
+
assert.deepEqual(getStagedFiles(tempDir), []);
|
|
47
|
+
});
|
|
48
|
+
it("getModifiedFiles returns empty array", () => {
|
|
49
|
+
assert.deepEqual(getModifiedFiles(tempDir), []);
|
|
50
|
+
});
|
|
51
|
+
it("getRecentCommits returns empty array", () => {
|
|
52
|
+
assert.deepEqual(getRecentCommits(5, tempDir), []);
|
|
53
|
+
});
|
|
54
|
+
it("getRecentCommitsRaw returns fallback message", () => {
|
|
55
|
+
const raw = getRecentCommitsRaw(5, tempDir);
|
|
56
|
+
assert.ok(raw.includes("No commits found"));
|
|
57
|
+
});
|
|
58
|
+
it("getCurrentBranch returns empty string", () => {
|
|
59
|
+
assert.equal(getCurrentBranch(tempDir), "");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, it } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { success, error, warn, info, heading, dim, banner } from "../utils/theme.js";
|
|
4
|
+
describe("theme - success", () => {
|
|
5
|
+
it("returns a string containing the message", () => {
|
|
6
|
+
const result = success("done");
|
|
7
|
+
assert.ok(result.includes("done"));
|
|
8
|
+
});
|
|
9
|
+
it("contains a checkmark character", () => {
|
|
10
|
+
const result = success("ok");
|
|
11
|
+
assert.ok(result.includes("\u2713"));
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
describe("theme - error", () => {
|
|
15
|
+
it("returns a string containing the message", () => {
|
|
16
|
+
const result = error("fail");
|
|
17
|
+
assert.ok(result.includes("fail"));
|
|
18
|
+
});
|
|
19
|
+
it("contains an X character", () => {
|
|
20
|
+
const result = error("bad");
|
|
21
|
+
assert.ok(result.includes("\u2717"));
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe("theme - warn", () => {
|
|
25
|
+
it("returns a string containing the message", () => {
|
|
26
|
+
const result = warn("caution");
|
|
27
|
+
assert.ok(result.includes("caution"));
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe("theme - info", () => {
|
|
31
|
+
it("returns a string containing the message", () => {
|
|
32
|
+
const result = info("notice");
|
|
33
|
+
assert.ok(result.includes("notice"));
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("theme - heading", () => {
|
|
37
|
+
it("returns a non-empty string", () => {
|
|
38
|
+
const result = heading("Title");
|
|
39
|
+
assert.ok(result.length > 0);
|
|
40
|
+
assert.ok(result.includes("Title"));
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
describe("theme - dim", () => {
|
|
44
|
+
it("returns a string containing the message", () => {
|
|
45
|
+
const result = dim("faded");
|
|
46
|
+
assert.ok(result.includes("faded"));
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe("theme - banner", () => {
|
|
50
|
+
it("returns a long string", () => {
|
|
51
|
+
const result = banner();
|
|
52
|
+
assert.ok(result.length > 100);
|
|
53
|
+
});
|
|
54
|
+
it("contains framework tagline", () => {
|
|
55
|
+
const result = banner();
|
|
56
|
+
assert.ok(result.includes("Context Engineering Framework"));
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -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": "
|
|
3
|
+
"version": "2.0.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
|
},
|