create-max-framework 4.0.1 → 6.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 +9 -0
- package/bin/create-max-framework.js +68 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ claude
|
|
|
15
15
|
- Downloads the latest framework release from GitHub
|
|
16
16
|
- Sets up the project directory with all skills, commands, object database, and Python library
|
|
17
17
|
- Initializes a git repository and prints getting-started instructions
|
|
18
|
+
- Checks Python 3.10+, the Python packages below and git, and warns about anything missing
|
|
18
19
|
|
|
19
20
|
## Prerequisites
|
|
20
21
|
|
|
@@ -22,6 +23,14 @@ claude
|
|
|
22
23
|
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (for using the framework)
|
|
23
24
|
- [MAX 9](https://cycling74.com/products/max) (for opening and testing generated patches)
|
|
24
25
|
- [Python 3.10+](https://www.python.org/) (for the validation and editing engine)
|
|
26
|
+
- [git](https://git-scm.com/) (every patch save is committed)
|
|
27
|
+
- numpy, scipy and pytest (the DSP simulation, smoke tests and the DSP pre-flight gate; validation works without them). Install them from the project directory:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python3 -m pip install -r requirements-dev.txt
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Run `npx create-max-framework --check-deps` to repeat the checks without installing.
|
|
25
34
|
|
|
26
35
|
## Links
|
|
27
36
|
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
const { spawn, execSync } = require('child_process');
|
|
5
|
+
const { spawn, execSync, execFileSync } = require('child_process');
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const https = require('https');
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// The release workflow stamps package.json from the tag before publishing.
|
|
11
|
+
const VERSION = require('../package.json').version;
|
|
11
12
|
const RELEASE_URL = 'https://github.com/taylorbrook/MAX-MSP_CC_Framework/releases/latest/download/framework.tar.gz';
|
|
12
13
|
const MAX_REDIRECTS = 5;
|
|
13
14
|
|
|
@@ -22,6 +23,10 @@ if (args.includes('--version') || args.includes('-v')) {
|
|
|
22
23
|
process.exit(0);
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
if (args.includes('--check-deps')) {
|
|
27
|
+
process.exit(checkDeps() ? 0 : 1);
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
if (args.includes('--help') || args.includes('-h') || args.length === 0) {
|
|
26
31
|
printUsage();
|
|
27
32
|
process.exit(args.length === 0 ? 1 : 0);
|
|
@@ -52,25 +57,21 @@ fs.mkdirSync(targetDir, { recursive: true });
|
|
|
52
57
|
|
|
53
58
|
downloadAndExtract(RELEASE_URL, targetDir)
|
|
54
59
|
.then(() => {
|
|
55
|
-
// Create patches directory
|
|
60
|
+
// Create the patches directory. No active-project pointer is written: a fresh install has no active project until /max-new or /max-switch sets one.
|
|
56
61
|
const patchesDir = path.join(targetDir, 'patches');
|
|
57
62
|
if (!fs.existsSync(patchesDir)) {
|
|
58
63
|
fs.mkdirSync(patchesDir, { recursive: true });
|
|
59
64
|
}
|
|
60
|
-
fs.writeFileSync(
|
|
61
|
-
path.join(patchesDir, '.active-project.json'),
|
|
62
|
-
JSON.stringify({ active_project: null }, null, 2) + '\n'
|
|
63
|
-
);
|
|
64
65
|
|
|
65
66
|
// Initialize git repo
|
|
66
67
|
try {
|
|
67
68
|
execSync('git init', { cwd: targetDir, stdio: 'ignore' });
|
|
68
69
|
} catch (_) {
|
|
69
|
-
// git not available --
|
|
70
|
+
// git not available -- checkDeps() warns
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
// Check Python
|
|
73
|
-
|
|
73
|
+
// Check Python, its packages and git (warnings only)
|
|
74
|
+
checkDeps();
|
|
74
75
|
|
|
75
76
|
// Success message
|
|
76
77
|
console.log(`Done! Your MAX/MSP Claude Code Framework project is ready.\n`);
|
|
@@ -107,6 +108,7 @@ Create a new MAX/MSP Claude Code Framework project.
|
|
|
107
108
|
Options:
|
|
108
109
|
-h, --help Show this help message
|
|
109
110
|
-v, --version Show version number
|
|
111
|
+
--check-deps Only check Python 3.10+, its packages and git
|
|
110
112
|
|
|
111
113
|
Examples:
|
|
112
114
|
npx create-max-framework my-synth
|
|
@@ -184,21 +186,65 @@ function followRedirects(url, count, callback) {
|
|
|
184
186
|
});
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
// Prints "<major>.<minor> <1 if >= 3.10 else 0> <comma-separated missing modules>".
|
|
190
|
+
// Valid on any Python, so an old interpreter still reports its version.
|
|
191
|
+
// A function, not a const: --check-deps runs before this line is reached.
|
|
192
|
+
function pyProbe() {
|
|
193
|
+
return [
|
|
194
|
+
'import sys',
|
|
195
|
+
'missing = []',
|
|
196
|
+
'for m in ("numpy", "scipy", "pytest"):',
|
|
197
|
+
' try:',
|
|
198
|
+
' __import__(m)',
|
|
199
|
+
' except Exception:',
|
|
200
|
+
' missing.append(m)',
|
|
201
|
+
'print("%d.%d %d %s" % (sys.version_info[0], sys.version_info[1],',
|
|
202
|
+
' int(sys.version_info >= (3, 10)), ",".join(missing)))',
|
|
203
|
+
].join('\n');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function onPath(cmd) {
|
|
207
|
+
try {
|
|
208
|
+
execFileSync(cmd, ['--version'], { stdio: 'ignore' });
|
|
209
|
+
return true;
|
|
210
|
+
} catch (err) {
|
|
211
|
+
return err.code !== 'ENOENT';
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
187
215
|
/**
|
|
188
|
-
* Check for Python 3.10
|
|
216
|
+
* Check for Python 3.10+, the Python packages the DSP simulation, smoke tests
|
|
217
|
+
* and pre-flight gate need (numpy, scipy, pytest), and git (Rule #7
|
|
218
|
+
* auto-commits every save). Warns only; returns false when Python 3.10+ is
|
|
219
|
+
* missing (review IN-06).
|
|
189
220
|
*/
|
|
190
|
-
function
|
|
221
|
+
function checkDeps() {
|
|
222
|
+
if (!onPath('git')) {
|
|
223
|
+
console.warn('WARNING: git not found. The framework commits every patch save (Rule #7); install git.');
|
|
224
|
+
}
|
|
225
|
+
let info;
|
|
191
226
|
try {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
227
|
+
info = execFileSync('python3', ['-c', pyProbe()], {
|
|
228
|
+
encoding: 'utf8',
|
|
229
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
230
|
+
}).trim();
|
|
231
|
+
} catch (err) {
|
|
232
|
+
if (err.code === 'ENOENT') {
|
|
233
|
+
console.warn('WARNING: Python 3 not found. The framework requires Python 3.10+ for the validation engine.');
|
|
234
|
+
} else {
|
|
235
|
+
console.warn('WARNING: python3 did not run. The framework requires Python 3.10+ for the validation engine.');
|
|
200
236
|
}
|
|
201
|
-
|
|
202
|
-
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
const [version, ok, missing = ''] = info.split(/\s+/);
|
|
240
|
+
let good = true;
|
|
241
|
+
if (ok !== '1') {
|
|
242
|
+
console.warn(`WARNING: Python 3.10+ required. Found Python ${version}`);
|
|
243
|
+
good = false;
|
|
244
|
+
}
|
|
245
|
+
if (missing) {
|
|
246
|
+
console.warn(`WARNING: Python packages missing: ${missing.split(',').join(', ')} (needed by the DSP simulation, smoke tests and the DSP pre-flight gate; validation works without them).`);
|
|
247
|
+
console.warn(' Install them from the project directory: python3 -m pip install -r requirements-dev.txt');
|
|
203
248
|
}
|
|
249
|
+
return good;
|
|
204
250
|
}
|