trismegistus 0.1.0 → 1.0.1
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/dist/cli.js +88 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -37,14 +37,71 @@ IDLE_POLL_SECONDS=10
|
|
|
37
37
|
TASK_DELAY_SECONDS=5
|
|
38
38
|
`;
|
|
39
39
|
var STATUS_PRIORITY = [" ", "!", "!!"];
|
|
40
|
+
var CLAUDE_COMMANDS = [
|
|
41
|
+
{
|
|
42
|
+
name: "tmg.md",
|
|
43
|
+
content: `Start the Trismegistus daemon to continuously run tasks from the queue.
|
|
44
|
+
|
|
45
|
+
Run: \`tmg start\`
|
|
46
|
+
|
|
47
|
+
The daemon picks up pending tasks from \`.trismegistus/tasks.md\` and executes them one by one, idling and watching for new tasks when the queue is empty.
|
|
48
|
+
|
|
49
|
+
$ARGUMENTS
|
|
50
|
+
`
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "tmg-status.md",
|
|
54
|
+
content: `Show the current Trismegistus task queue status.
|
|
55
|
+
|
|
56
|
+
Run: \`tmg status\`
|
|
57
|
+
|
|
58
|
+
$ARGUMENTS
|
|
59
|
+
`
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "tmg-todo.md",
|
|
63
|
+
content: `Add a new task to the Trismegistus task queue.
|
|
64
|
+
|
|
65
|
+
Run: \`tmg add "<task description>"\`
|
|
66
|
+
|
|
67
|
+
Task to add: $ARGUMENTS
|
|
68
|
+
`
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "tmg-notes.md",
|
|
72
|
+
content: `Add notes to the Trismegistus notes file for the daemon's next task run.
|
|
73
|
+
|
|
74
|
+
Run: \`tmg notes "<notes text>"\`
|
|
75
|
+
|
|
76
|
+
The notes are appended to \`.trismegistus/notes.md\` without clearing existing content. Notes are only cleared by the daemon when it reads them during a task run.
|
|
77
|
+
|
|
78
|
+
Notes to add: $ARGUMENTS
|
|
79
|
+
`
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "tmg-remote.md",
|
|
83
|
+
content: `Start a VS Code tunnel for remote/mobile access to this workspace.
|
|
84
|
+
|
|
85
|
+
Run: \`tmg remote\`
|
|
86
|
+
|
|
87
|
+
If a tunnel name is provided, run: \`tmg remote --name <name>\`
|
|
88
|
+
|
|
89
|
+
Tunnel name (optional): $ARGUMENTS
|
|
90
|
+
`
|
|
91
|
+
}
|
|
92
|
+
];
|
|
40
93
|
|
|
41
94
|
// src/init.ts
|
|
42
95
|
function initProject(projectDir) {
|
|
43
96
|
const tmgDir = join(projectDir, DIR_NAME);
|
|
97
|
+
const claudeCommandsDir = join(projectDir, ".claude", "commands");
|
|
44
98
|
const result = { created: [], skipped: [] };
|
|
45
99
|
if (!existsSync(tmgDir)) {
|
|
46
100
|
mkdirSync(tmgDir, { recursive: true });
|
|
47
101
|
}
|
|
102
|
+
if (!existsSync(claudeCommandsDir)) {
|
|
103
|
+
mkdirSync(claudeCommandsDir, { recursive: true });
|
|
104
|
+
}
|
|
48
105
|
const files = [
|
|
49
106
|
{ name: CONFIG_FILE, content: CONFIG_TEMPLATE },
|
|
50
107
|
{ name: TASKS_FILE, content: TASKS_TEMPLATE },
|
|
@@ -59,6 +116,15 @@ function initProject(projectDir) {
|
|
|
59
116
|
result.created.push(file.name);
|
|
60
117
|
}
|
|
61
118
|
}
|
|
119
|
+
for (const cmd of CLAUDE_COMMANDS) {
|
|
120
|
+
const path = join(claudeCommandsDir, cmd.name);
|
|
121
|
+
if (existsSync(path)) {
|
|
122
|
+
result.skipped.push(`.claude/commands/${cmd.name}`);
|
|
123
|
+
} else {
|
|
124
|
+
writeFileSync(path, cmd.content);
|
|
125
|
+
result.created.push(`.claude/commands/${cmd.name}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
62
128
|
return result;
|
|
63
129
|
}
|
|
64
130
|
|
|
@@ -180,6 +246,19 @@ function getAttemptFromStatus(status) {
|
|
|
180
246
|
return 1;
|
|
181
247
|
}
|
|
182
248
|
}
|
|
249
|
+
function appendNotes(projectDir, text) {
|
|
250
|
+
const trimmed = text.trim();
|
|
251
|
+
if (!trimmed) {
|
|
252
|
+
throw new Error("Notes text cannot be empty.");
|
|
253
|
+
}
|
|
254
|
+
const path = notesPath(projectDir);
|
|
255
|
+
if (!existsSync2(path)) {
|
|
256
|
+
throw new Error("No notes file found. Run `tmg init` first.");
|
|
257
|
+
}
|
|
258
|
+
const content = readFileSync(path, "utf-8");
|
|
259
|
+
const separator = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
|
|
260
|
+
writeFileSync2(path, content + separator + trimmed + "\n");
|
|
261
|
+
}
|
|
183
262
|
function addTask(projectDir, text) {
|
|
184
263
|
const trimmed = text.trim();
|
|
185
264
|
if (!trimmed) {
|
|
@@ -527,6 +606,15 @@ program.command("add").description("Add a task to the queue").argument("<text>",
|
|
|
527
606
|
process.exit(1);
|
|
528
607
|
}
|
|
529
608
|
});
|
|
609
|
+
program.command("notes").description("Append notes for the daemon's next task run").argument("<text>", "Notes to add").action((text) => {
|
|
610
|
+
try {
|
|
611
|
+
appendNotes(process.cwd(), text);
|
|
612
|
+
console.log(`Added note: ${text}`);
|
|
613
|
+
} catch (e) {
|
|
614
|
+
console.error(e instanceof Error ? e.message : String(e));
|
|
615
|
+
process.exit(1);
|
|
616
|
+
}
|
|
617
|
+
});
|
|
530
618
|
program.command("reset").description("Reset all gave-up [!!!] tasks back to pending [ ]").action(() => {
|
|
531
619
|
const count = resetGaveUpTasks(process.cwd());
|
|
532
620
|
if (count === 0) {
|