@stan-chen/simple-cli 0.2.3 → 0.2.5

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.
Files changed (136) hide show
  1. package/README.md +62 -63
  2. package/dist/anyllm.py +62 -0
  3. package/dist/builtins.d.ts +726 -0
  4. package/dist/builtins.js +481 -0
  5. package/dist/cli.d.ts +0 -4
  6. package/dist/cli.js +34 -493
  7. package/dist/engine.d.ts +33 -0
  8. package/dist/engine.js +138 -0
  9. package/dist/learnings.d.ts +15 -0
  10. package/dist/learnings.js +54 -0
  11. package/dist/llm.d.ts +18 -0
  12. package/dist/llm.js +73 -0
  13. package/dist/mcp.d.ts +132 -0
  14. package/dist/mcp.js +43 -0
  15. package/dist/skills.d.ts +5 -16
  16. package/dist/skills.js +91 -253
  17. package/dist/tui.d.ts +1 -0
  18. package/dist/tui.js +15 -0
  19. package/package.json +10 -6
  20. package/dist/claw/jit.d.ts +0 -5
  21. package/dist/claw/jit.js +0 -138
  22. package/dist/claw/management.d.ts +0 -3
  23. package/dist/claw/management.js +0 -107
  24. package/dist/commands/add.d.ts +0 -9
  25. package/dist/commands/add.js +0 -50
  26. package/dist/commands/git/commit.d.ts +0 -12
  27. package/dist/commands/git/commit.js +0 -98
  28. package/dist/commands/git/status.d.ts +0 -6
  29. package/dist/commands/git/status.js +0 -42
  30. package/dist/commands/index.d.ts +0 -16
  31. package/dist/commands/index.js +0 -377
  32. package/dist/commands/mcp/status.d.ts +0 -6
  33. package/dist/commands/mcp/status.js +0 -31
  34. package/dist/commands/swarm.d.ts +0 -36
  35. package/dist/commands/swarm.js +0 -236
  36. package/dist/commands.d.ts +0 -32
  37. package/dist/commands.js +0 -427
  38. package/dist/context.d.ts +0 -116
  39. package/dist/context.js +0 -337
  40. package/dist/index.d.ts +0 -6
  41. package/dist/index.js +0 -109
  42. package/dist/lib/agent.d.ts +0 -99
  43. package/dist/lib/agent.js +0 -313
  44. package/dist/lib/editor.d.ts +0 -74
  45. package/dist/lib/editor.js +0 -441
  46. package/dist/lib/git.d.ts +0 -164
  47. package/dist/lib/git.js +0 -356
  48. package/dist/lib/shim.d.ts +0 -4
  49. package/dist/lib/shim.js +0 -30
  50. package/dist/lib/ui.d.ts +0 -159
  51. package/dist/lib/ui.js +0 -277
  52. package/dist/mcp/client.d.ts +0 -22
  53. package/dist/mcp/client.js +0 -81
  54. package/dist/mcp/manager.d.ts +0 -186
  55. package/dist/mcp/manager.js +0 -446
  56. package/dist/prompts/provider.d.ts +0 -22
  57. package/dist/prompts/provider.js +0 -79
  58. package/dist/providers/index.d.ts +0 -31
  59. package/dist/providers/index.js +0 -93
  60. package/dist/providers/multi.d.ts +0 -12
  61. package/dist/providers/multi.js +0 -28
  62. package/dist/registry.d.ts +0 -29
  63. package/dist/registry.js +0 -443
  64. package/dist/repoMap.d.ts +0 -5
  65. package/dist/repoMap.js +0 -79
  66. package/dist/router.d.ts +0 -41
  67. package/dist/router.js +0 -118
  68. package/dist/swarm/coordinator.d.ts +0 -86
  69. package/dist/swarm/coordinator.js +0 -257
  70. package/dist/swarm/index.d.ts +0 -28
  71. package/dist/swarm/index.js +0 -29
  72. package/dist/swarm/task.d.ts +0 -104
  73. package/dist/swarm/task.js +0 -221
  74. package/dist/swarm/types.d.ts +0 -132
  75. package/dist/swarm/types.js +0 -37
  76. package/dist/swarm/worker.d.ts +0 -109
  77. package/dist/swarm/worker.js +0 -369
  78. package/dist/tools/analyzeFile.d.ts +0 -16
  79. package/dist/tools/analyzeFile.js +0 -43
  80. package/dist/tools/analyze_file.d.ts +0 -16
  81. package/dist/tools/analyze_file.js +0 -43
  82. package/dist/tools/clawBrain.d.ts +0 -23
  83. package/dist/tools/clawBrain.js +0 -136
  84. package/dist/tools/claw_brain.d.ts +0 -23
  85. package/dist/tools/claw_brain.js +0 -139
  86. package/dist/tools/deleteFile.d.ts +0 -19
  87. package/dist/tools/deleteFile.js +0 -36
  88. package/dist/tools/delete_file.d.ts +0 -19
  89. package/dist/tools/delete_file.js +0 -36
  90. package/dist/tools/fileOps.d.ts +0 -22
  91. package/dist/tools/fileOps.js +0 -43
  92. package/dist/tools/file_ops.d.ts +0 -22
  93. package/dist/tools/file_ops.js +0 -43
  94. package/dist/tools/git.d.ts +0 -40
  95. package/dist/tools/git.js +0 -236
  96. package/dist/tools/glob.d.ts +0 -34
  97. package/dist/tools/glob.js +0 -165
  98. package/dist/tools/grep.d.ts +0 -53
  99. package/dist/tools/grep.js +0 -296
  100. package/dist/tools/linter.d.ts +0 -35
  101. package/dist/tools/linter.js +0 -407
  102. package/dist/tools/listDir.d.ts +0 -29
  103. package/dist/tools/listDir.js +0 -50
  104. package/dist/tools/list_dir.d.ts +0 -29
  105. package/dist/tools/list_dir.js +0 -50
  106. package/dist/tools/memory.d.ts +0 -34
  107. package/dist/tools/memory.js +0 -215
  108. package/dist/tools/organizer.d.ts +0 -1
  109. package/dist/tools/organizer.js +0 -65
  110. package/dist/tools/readFiles.d.ts +0 -25
  111. package/dist/tools/readFiles.js +0 -31
  112. package/dist/tools/read_files.d.ts +0 -25
  113. package/dist/tools/read_files.js +0 -31
  114. package/dist/tools/reloadTools.d.ts +0 -11
  115. package/dist/tools/reloadTools.js +0 -22
  116. package/dist/tools/reload_tools.d.ts +0 -11
  117. package/dist/tools/reload_tools.js +0 -22
  118. package/dist/tools/runCommand.d.ts +0 -32
  119. package/dist/tools/runCommand.js +0 -79
  120. package/dist/tools/run_command.d.ts +0 -32
  121. package/dist/tools/run_command.js +0 -103
  122. package/dist/tools/scheduler.d.ts +0 -25
  123. package/dist/tools/scheduler.js +0 -65
  124. package/dist/tools/scraper.d.ts +0 -31
  125. package/dist/tools/scraper.js +0 -211
  126. package/dist/tools/writeFiles.d.ts +0 -63
  127. package/dist/tools/writeFiles.js +0 -87
  128. package/dist/tools/write_files.d.ts +0 -84
  129. package/dist/tools/write_files.js +0 -91
  130. package/dist/tools/write_to_file.d.ts +0 -15
  131. package/dist/tools/write_to_file.js +0 -21
  132. package/dist/ui/server.d.ts +0 -5
  133. package/dist/ui/server.js +0 -74
  134. package/dist/watcher.d.ts +0 -35
  135. package/dist/watcher.js +0 -164
  136. /package/{docs/assets → assets}/logo.jpeg +0 -0
@@ -1,107 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { platform } from 'os';
3
- import pc from 'picocolors';
4
- import { readdir, readFile } from 'fs/promises';
5
- import { join } from 'path';
6
- export async function listClawAssets() {
7
- console.log(pc.cyan('\n🔍 Claw Mode Assets & Ghost Tasks:\n'));
8
- // 1. List Skills
9
- console.log(pc.yellow('🛠️ Available Skills:'));
10
- const { getMeta } = await import('../registry.js').catch(() => ({ getMeta: null }));
11
- async function printSkill(path, type) {
12
- try {
13
- const files = await readdir(path);
14
- for (const f of files) {
15
- if (f.endsWith('.md') || f.endsWith('.ts') || f.endsWith('.js')) {
16
- const content = await readFile(join(path, f), 'utf-8');
17
- const meta = getMeta?.(content, f);
18
- if (meta) {
19
- console.log(pc.green(` - ${meta.name} `) + pc.dim(`(${f}, ${type}): ${meta.description || ''}`));
20
- }
21
- else {
22
- console.log(pc.dim(` - ${f} (${type})`));
23
- }
24
- }
25
- }
26
- }
27
- catch (e) { }
28
- }
29
- await printSkill('skills', 'local');
30
- const home = process.env.HOME || process.env.USERPROFILE || '';
31
- await printSkill(join(home, '.openclaw', 'workspace', 'skills'), 'global');
32
- // 2. List Ghost Tasks
33
- console.log(pc.yellow('\n👻 Active Ghost Tasks (Scheduled):'));
34
- const isWindows = platform() === 'win32';
35
- try {
36
- if (isWindows) {
37
- const tasks = execSync('schtasks /query /fo LIST', { encoding: 'utf-8' });
38
- const simpleTasks = tasks.split('\n\n').filter(t => t.includes('simple -claw'));
39
- if (simpleTasks.length === 0)
40
- console.log(pc.dim(' None found.'));
41
- else {
42
- simpleTasks.forEach(t => {
43
- const name = t.match(/TaskName:\s+(.+)/)?.[1];
44
- const nextRun = t.match(/Next Run Time:\s+(.+)/)?.[1];
45
- if (name)
46
- console.log(pc.green(` - ${name.trim()} `) + pc.dim(`(Next: ${nextRun})`));
47
- });
48
- }
49
- }
50
- else {
51
- let cron = '';
52
- try {
53
- cron = execSync('crontab -l', { encoding: 'utf-8' });
54
- }
55
- catch (e) { /* ignore empty crontab */ }
56
- const simpleCron = cron.split('\n').filter(l => l.includes('simple -claw'));
57
- if (simpleCron.length === 0)
58
- console.log(pc.dim(' None found.'));
59
- else
60
- simpleCron.forEach(l => console.log(pc.green(` - ${l}`)));
61
- }
62
- }
63
- catch (e) {
64
- console.log(pc.dim(' Error querying scheduler.'));
65
- }
66
- }
67
- export async function showGhostLogs(id) {
68
- const logDir = '.simple/workdir/memory/logs';
69
- console.log(pc.cyan(`\n📜 Ghost Logs (${id || 'latest'}):\n`));
70
- try {
71
- const files = await readdir(logDir);
72
- const logFiles = files.filter(f => f.endsWith('.log')).sort().reverse();
73
- if (logFiles.length === 0) {
74
- console.log(pc.dim(' No logs found.'));
75
- return;
76
- }
77
- const fileToRead = id ? logFiles.find(f => f.includes(id)) : logFiles[0];
78
- if (!fileToRead) {
79
- console.log(pc.red(` No log matching "${id}" found.`));
80
- return;
81
- }
82
- const content = await readFile(join(logDir, fileToRead), 'utf-8');
83
- console.log(pc.dim(`-- ${fileToRead} --`));
84
- console.log(content);
85
- }
86
- catch (e) {
87
- console.log(pc.red(' Error reading logs. Ensure you are in a Simple-CLI workspace.'));
88
- }
89
- }
90
- export async function killGhostTask(id) {
91
- const isWindows = platform() === 'win32';
92
- console.log(pc.cyan(`\n🛑 Terminating Ghost Task: ${id}...`));
93
- try {
94
- if (isWindows) {
95
- execSync(`schtasks /delete /tn "${id}" /f`);
96
- }
97
- else {
98
- const cron = execSync('crontab -l').toString();
99
- const newCron = cron.split('\n').filter(l => !l.includes(id)).join('\n');
100
- execSync(`echo "${newCron}" | crontab -`);
101
- }
102
- console.log(pc.green(`✅ Task "${id}" removed.`));
103
- }
104
- catch (e) {
105
- console.log(pc.red(`❌ Failed to kill task "${id}".`));
106
- }
107
- }
@@ -1,9 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- export default class Add extends Command {
3
- static description: string;
4
- static args: {
5
- files: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
- };
7
- static examples: string[];
8
- run(): Promise<void>;
9
- }
@@ -1,50 +0,0 @@
1
- import { Command, Args } from '@oclif/core';
2
- import * as ui from '../lib/ui.js';
3
- import { getContextManager } from '../context.js';
4
- import { resolve } from 'path';
5
- import { existsSync } from 'fs';
6
- export default class Add extends Command {
7
- static description = 'Add files to the chat context';
8
- static args = {
9
- files: Args.string({
10
- description: 'Files to add (supports glob patterns)',
11
- required: true,
12
- }),
13
- };
14
- static examples = [
15
- '<%= config.bin %> add src/index.ts',
16
- '<%= config.bin %> add "src/**/*.ts"',
17
- '<%= config.bin %> add package.json tsconfig.json',
18
- ];
19
- async run() {
20
- const { args, argv } = await this.parse(Add);
21
- const ctx = getContextManager();
22
- // Handle multiple files from argv
23
- const files = argv;
24
- let added = 0;
25
- for (const file of files) {
26
- const fullPath = resolve(process.cwd(), file);
27
- if (file.includes('*')) {
28
- // Handle glob pattern
29
- const { execute } = await import('../tools/glob.js');
30
- const result = await execute({ pattern: file, cwd: process.cwd(), maxResults: 1000, includeDirectories: false });
31
- for (const match of result.matches) {
32
- if (ctx.addFile(match)) {
33
- ui.success(`Added ${match}`);
34
- added++;
35
- }
36
- }
37
- }
38
- else if (existsSync(fullPath)) {
39
- if (ctx.addFile(file)) {
40
- ui.success(`Added ${file}`);
41
- added++;
42
- }
43
- }
44
- else {
45
- ui.error(`File not found: ${file}`);
46
- }
47
- }
48
- ui.log(`Added ${added} file(s) to context`);
49
- }
50
- }
@@ -1,12 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import 'dotenv/config';
3
- export default class GitCommit extends Command {
4
- static description: string;
5
- static flags: {
6
- message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
- ai: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
- all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
- };
10
- static examples: string[];
11
- run(): Promise<void>;
12
- }
@@ -1,98 +0,0 @@
1
- import { Command, Flags } from '@oclif/core';
2
- import * as ui from '../../lib/ui.js';
3
- import { getGitManager, generateCommitMessage } from '../../lib/git.js';
4
- import { createProvider } from '../../providers/index.js';
5
- import 'dotenv/config';
6
- export default class GitCommit extends Command {
7
- static description = 'Commit changes with optional AI-generated message';
8
- static flags = {
9
- message: Flags.string({
10
- char: 'm',
11
- description: 'Commit message',
12
- }),
13
- ai: Flags.boolean({
14
- description: 'Generate commit message using AI',
15
- default: false,
16
- }),
17
- all: Flags.boolean({
18
- char: 'a',
19
- description: 'Stage all changes',
20
- default: false,
21
- }),
22
- };
23
- static examples = [
24
- '<%= config.bin %> git commit -m "feat: add new feature"',
25
- '<%= config.bin %> git commit --ai',
26
- '<%= config.bin %> git commit -a --ai',
27
- ];
28
- async run() {
29
- const { flags } = await this.parse(GitCommit);
30
- const git = getGitManager();
31
- if (!(await git.isRepo())) {
32
- ui.error('Not a git repository');
33
- return;
34
- }
35
- // Stage all if requested
36
- if (flags.all) {
37
- await git.addAll();
38
- }
39
- // Get diff
40
- const diff = await git.stagedDiff();
41
- if (!diff) {
42
- const status = await git.status();
43
- if (status.modified.length === 0 && status.created.length === 0) {
44
- ui.error('Nothing to commit');
45
- return;
46
- }
47
- // Auto-stage if no staged changes
48
- await git.addAll();
49
- }
50
- // Get or generate message
51
- let message = flags.message;
52
- if (!message && flags.ai) {
53
- const provider = createProvider();
54
- const currentDiff = await git.stagedDiff() || await git.diff();
55
- message = await ui.spin('Generating commit message...', async () => {
56
- return generateCommitMessage(currentDiff, async (prompt) => {
57
- const res = await provider.generateResponse(prompt, []);
58
- return res.message || res.thought || res.raw || '';
59
- });
60
- });
61
- ui.log(`Generated message: ${message}`);
62
- const confirmed = await ui.confirm({
63
- message: 'Use this message?',
64
- initialValue: true,
65
- });
66
- if (ui.isCancel(confirmed) || !confirmed) {
67
- const custom = await ui.text({
68
- message: 'Enter commit message:',
69
- placeholder: message,
70
- });
71
- if (ui.isCancel(custom)) {
72
- ui.cancel('Commit cancelled');
73
- return;
74
- }
75
- message = custom;
76
- }
77
- }
78
- if (!message) {
79
- const input = await ui.text({
80
- message: 'Enter commit message:',
81
- validate: (v) => (v.trim() ? undefined : 'Message required'),
82
- });
83
- if (ui.isCancel(input)) {
84
- ui.cancel('Commit cancelled');
85
- return;
86
- }
87
- message = input;
88
- }
89
- // Commit
90
- const result = await git.commit({ message });
91
- if (result) {
92
- ui.success(`Committed: ${result.hash} ${result.message}`);
93
- }
94
- else {
95
- ui.error('Commit failed');
96
- }
97
- }
98
- }
@@ -1,6 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- export default class GitStatus extends Command {
3
- static description: string;
4
- static examples: string[];
5
- run(): Promise<void>;
6
- }
@@ -1,42 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import * as ui from '../../lib/ui.js';
3
- import { getGitManager } from '../../lib/git.js';
4
- export default class GitStatus extends Command {
5
- static description = 'Show git repository status';
6
- static examples = ['<%= config.bin %> git status'];
7
- async run() {
8
- const git = getGitManager();
9
- if (!(await git.isRepo())) {
10
- ui.error('Not a git repository');
11
- return;
12
- }
13
- const status = await git.status();
14
- ui.log(`Branch: ${status.current || 'detached HEAD'}`);
15
- if (status.ahead > 0) {
16
- ui.log(`Ahead of origin by ${status.ahead} commit(s)`);
17
- }
18
- if (status.behind > 0) {
19
- ui.log(`Behind origin by ${status.behind} commit(s)`);
20
- }
21
- const changes = [];
22
- for (const file of status.created) {
23
- changes.push({ path: file, status: 'added' });
24
- }
25
- for (const file of status.modified) {
26
- changes.push({ path: file, status: 'modified' });
27
- }
28
- for (const file of status.deleted) {
29
- changes.push({ path: file, status: 'deleted' });
30
- }
31
- for (const file of status.not_added) {
32
- changes.push({ path: file, status: 'added' });
33
- }
34
- if (changes.length > 0) {
35
- ui.log('\nChanges:');
36
- ui.showFileStatus(changes);
37
- }
38
- else {
39
- ui.success('Working tree clean');
40
- }
41
- }
42
- }
@@ -1,16 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import 'dotenv/config';
3
- export default class Chat extends Command {
4
- static description: string;
5
- static flags: {
6
- yolo: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
- moe: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
- watch: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
- skill: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
- 'auto-commit': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
- 'auto-lint': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
- 'auto-test': import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
- 'test-cmd': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
- };
15
- run(): Promise<void>;
16
- }