algomath-extract 1.0.11 → 1.0.13
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 +35 -7
- package/bin/install.js +28 -4
- package/commands/algo-extract.md +12 -4
- package/commands/algo-generate.md +0 -4
- package/commands/algo-help.md +0 -3
- package/commands/algo-list.md +0 -3
- package/commands/algo-run.md +0 -3
- package/commands/algo-status.md +0 -3
- package/commands/algo-verify.md +0 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
```
|
|
2
|
+
█████╗ ██╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗
|
|
3
|
+
██╔══██╗██║ ██╔════╝ ██╔═══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║
|
|
4
|
+
███████║██║ ██║ ███╗██║ ██║██╔████╔██║███████║ ██║ ███████║
|
|
5
|
+
██╔══██║██║ ██║ ██║██║ ██║██║╚██╔╝██║██╔══██║ ██║ ██╔══██║
|
|
6
|
+
██║ ██║███████╗╚██████╔╝╚██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║
|
|
7
|
+
╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
|
|
8
|
+
```
|
|
9
|
+
|
|
1
10
|
# AlgoMath Framework
|
|
2
11
|
|
|
3
12
|
**AlgoMath** transforms mathematical algorithm descriptions from PDFs and text files into executable Python code through an intuitive workflow integrated with opencode.
|
|
@@ -8,23 +17,28 @@
|
|
|
8
17
|
|
|
9
18
|
## Installation
|
|
10
19
|
|
|
11
|
-
### Quick Install
|
|
20
|
+
### Quick Install (Recommended)
|
|
12
21
|
```bash
|
|
13
|
-
|
|
22
|
+
# Global install (no sudo needed)
|
|
23
|
+
sudo npx algomath-extract@latest
|
|
14
24
|
```
|
|
15
25
|
|
|
16
|
-
The installer will:
|
|
26
|
+
The interactive installer will:
|
|
17
27
|
1. Check for Python 3.11+ (auto-install guidance if missing)
|
|
18
|
-
2.
|
|
19
|
-
3.
|
|
28
|
+
2. Ask which runtime to install to (OpenCode, Claude Code, or both)
|
|
29
|
+
3. Ask for installation location (global or local)
|
|
30
|
+
4. Install Python dependencies (pdfplumber, pydantic)
|
|
31
|
+
5. Copy command files to the selected runtime
|
|
32
|
+
|
|
33
|
+
> **Note:** Use `sudo` when installing globally or locally if your `.opencode` directory was previously created with elevated permissions.
|
|
20
34
|
|
|
21
35
|
### Manual Install
|
|
22
36
|
```bash
|
|
23
37
|
# Global install
|
|
24
|
-
npm install -g algomath
|
|
38
|
+
sudo npm install -g algomath-extract
|
|
25
39
|
|
|
26
40
|
# Or local install per-project
|
|
27
|
-
npm install algomath
|
|
41
|
+
npm install algomath-extract
|
|
28
42
|
```
|
|
29
43
|
|
|
30
44
|
---
|
|
@@ -82,6 +96,20 @@ Verifies correctness with:
|
|
|
82
96
|
| `/algo-list` | List saved algorithms | Info |
|
|
83
97
|
| `/algo-help` | Show help | Info |
|
|
84
98
|
|
|
99
|
+
### CLI Commands (via npm)
|
|
100
|
+
|
|
101
|
+
After installation, you can also use these CLI commands:
|
|
102
|
+
|
|
103
|
+
| Command | Description |
|
|
104
|
+
|---------|-------------|
|
|
105
|
+
| `npx algoextract <file>` | Extract from command line |
|
|
106
|
+
| `npx algogenerate` | Generate code from CLI |
|
|
107
|
+
| `npx algorun` | Run from CLI |
|
|
108
|
+
| `npx algoverify` | Verify from CLI |
|
|
109
|
+
| `npx algostatus` | Check status |
|
|
110
|
+
| `npx algolist` | List algorithms |
|
|
111
|
+
| `npx algohelp` | Show help |
|
|
112
|
+
|
|
85
113
|
---
|
|
86
114
|
|
|
87
115
|
## Workflow Modes
|
package/bin/install.js
CHANGED
|
@@ -62,10 +62,20 @@ async function checkForUpdates() {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
async function main() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
// Green ANSI color codes
|
|
66
|
+
const GREEN = '\x1b[32m';
|
|
67
|
+
const RESET = '\x1b[0m';
|
|
68
|
+
|
|
69
|
+
console.log(GREEN + `
|
|
70
|
+
█████╗ ██╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗
|
|
71
|
+
██╔══██╗██║ ██╔════╝ ██╔═══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║
|
|
72
|
+
███████║██║ ██║ ███╗██║ ██║██╔████╔██║███████║ ██║ ███████║
|
|
73
|
+
██╔══██║██║ ██║ ██║██║ ██║██║╚██╔╝██║██╔══██║ ██║ ██╔══██║
|
|
74
|
+
██║ ██║███████╗╚██████╔╝╚██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║
|
|
75
|
+
╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
|
|
76
|
+
Framework Installer v1.0.11
|
|
77
|
+
Mathematical Algorithm Extraction & Code
|
|
78
|
+
` + RESET + '\n');
|
|
69
79
|
|
|
70
80
|
// Check for updates
|
|
71
81
|
await checkForUpdates();
|
|
@@ -358,6 +368,20 @@ execSync(`sudo chown -R $(whoami) "${parentDir}"`, { stdio: 'inherit' });
|
|
|
358
368
|
needsElevated = !isWritable(commandDir);
|
|
359
369
|
}
|
|
360
370
|
|
|
371
|
+
// Clean old algo-*.md files first (to remove outdated commands)
|
|
372
|
+
const existingFiles = fs.readdirSync(commandDir).filter(f => f.startsWith('algo-') && f.endsWith('.md'));
|
|
373
|
+
for (const oldFile of existingFiles) {
|
|
374
|
+
const oldPath = path.join(commandDir, oldFile);
|
|
375
|
+
try {
|
|
376
|
+
fs.unlinkSync(oldPath);
|
|
377
|
+
} catch (e) {
|
|
378
|
+
// If can't delete, try with sudo
|
|
379
|
+
if (!isWindows) {
|
|
380
|
+
execSync(`sudo rm -f "${oldPath}"`, { stdio: 'pipe' });
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
361
385
|
// Copy command files
|
|
362
386
|
const sourceDir = path.join(__dirname, '..', 'commands');
|
|
363
387
|
const files = fs.readdirSync(sourceDir).filter(f => f.endsWith('.md'));
|
package/commands/algo-extract.md
CHANGED
|
@@ -4,6 +4,7 @@ argument-hint: "[file-path] [--auto] [--step] [--name <name>]"
|
|
|
4
4
|
tools:
|
|
5
5
|
read: true
|
|
6
6
|
write: true
|
|
7
|
+
Bash: true
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
<objective>
|
|
@@ -11,10 +12,17 @@ Extract algorithm from PDF or text file using LLM-powered parsing.
|
|
|
11
12
|
Supports automatic extraction or step-by-step with review points.
|
|
12
13
|
</objective>
|
|
13
14
|
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
<execution>
|
|
16
|
+
Execute the extraction by running the Node.js wrapper:
|
|
17
|
+
```bash
|
|
18
|
+
npx algoextract "$@"
|
|
19
|
+
```
|
|
20
|
+
This will:
|
|
21
|
+
1. Parse the provided file or arguments
|
|
22
|
+
2. Extract algorithm steps using LLM
|
|
23
|
+
3. Save the structured algorithm to .algomath/algorithms/
|
|
24
|
+
4. Display the extraction summary
|
|
25
|
+
</execution>
|
|
18
26
|
|
|
19
27
|
<process>
|
|
20
28
|
Execute extraction workflow:
|
|
@@ -11,10 +11,6 @@ Generate executable Python code from structured algorithm steps.
|
|
|
11
11
|
Supports template-based generation (fast, reliable) or LLM-enhanced (for complex expressions).
|
|
12
12
|
</objective>
|
|
13
13
|
|
|
14
|
-
<execution_context>
|
|
15
|
-
@/home/milgraph/Projects/algo_framework/src/generation/code_generator.py
|
|
16
|
-
@/home/milgraph/Projects/algo_framework/src/generation/llm_generator.py
|
|
17
|
-
</execution_context>
|
|
18
14
|
|
|
19
15
|
<process>
|
|
20
16
|
Execute code generation workflow:
|
package/commands/algo-help.md
CHANGED
package/commands/algo-list.md
CHANGED
package/commands/algo-run.md
CHANGED
|
@@ -11,9 +11,6 @@ Execute generated Python code in a safe sandboxed environment.
|
|
|
11
11
|
Captures stdout, stderr, and execution results.
|
|
12
12
|
</objective>
|
|
13
13
|
|
|
14
|
-
<execution_context>
|
|
15
|
-
@/home/milgraph/Projects/algo_framework/src/execution/sandbox.py
|
|
16
|
-
</execution_context>
|
|
17
14
|
|
|
18
15
|
<process>
|
|
19
16
|
Execute code in sandbox:
|
package/commands/algo-status.md
CHANGED
|
@@ -11,9 +11,6 @@ Display current algorithm state, progress, and available next steps.
|
|
|
11
11
|
Shows workflow state, completion status, and suggestions.
|
|
12
12
|
</objective>
|
|
13
13
|
|
|
14
|
-
<execution_context>
|
|
15
|
-
@/home/milgraph/Projects/algo_framework/src/cli/commands.py
|
|
16
|
-
</execution_context>
|
|
17
14
|
|
|
18
15
|
<process>
|
|
19
16
|
Display status:
|
package/commands/algo-verify.md
CHANGED
|
@@ -11,11 +11,6 @@ Verify execution results, compare to expected values, explain algorithm behavior
|
|
|
11
11
|
and identify potential edge cases.
|
|
12
12
|
</objective>
|
|
13
13
|
|
|
14
|
-
<execution_context>
|
|
15
|
-
@/home/milgraph/Projects/algo_framework/src/verification/checker.py
|
|
16
|
-
@/home/milgraph/Projects/algo_framework/src/verification/explainer.py
|
|
17
|
-
@/home/milgraph/Projects/algo_framework/src/verification/edge_cases.py
|
|
18
|
-
</execution_context>
|
|
19
14
|
|
|
20
15
|
<process>
|
|
21
16
|
Execute verification workflow:
|