Fix memlog Python floor and exclude tests from install
- memlog.py: add 'from __future__ import annotations' so PEP 585/604 hints stay lazy; the script runs on Python 3.8+ instead of crashing below 3.10. Correct the requires-python header to >=3.8. - installer.js: filter tests/, __pycache__/, .pytest_cache/, and *.pyc out of _installSharedScripts so dev-only files never ship to users.
This commit is contained in:
parent
ba0365b750
commit
0757f2f396
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# /// script
|
# /// script
|
||||||
# requires-python = ">=3.10"
|
# requires-python = ">=3.8"
|
||||||
# ///
|
# ///
|
||||||
"""memlog — an append-only memory log: LLM-optimal working memory for a skill.
|
"""memlog — an append-only memory log: LLM-optimal working memory for a skill.
|
||||||
|
|
||||||
|
|
@ -66,6 +66,8 @@ Commands:
|
||||||
Addressing: `--workspace` is the run folder, and the memlog is always {workspace}/.memlog.md.
|
Addressing: `--workspace` is the run folder, and the memlog is always {workspace}/.memlog.md.
|
||||||
`--path` points straight at the memlog file instead, for callers that already hold the path.
|
`--path` points straight at the memlog file instead, for callers that already hold the path.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import annotations # keep type-hint syntax lazy so the script runs on 3.8+
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -630,6 +630,7 @@ class Installer {
|
||||||
/**
|
/**
|
||||||
* Sync src/scripts/* → _bmad/scripts/ so shared Python scripts
|
* Sync src/scripts/* → _bmad/scripts/ so shared Python scripts
|
||||||
* (e.g. resolve_customization.py) are available at install time.
|
* (e.g. resolve_customization.py) are available at install time.
|
||||||
|
* Excludes dev-only tests and Python caches so they don't ship to users.
|
||||||
* Wipes the destination first so files removed or renamed in source
|
* Wipes the destination first so files removed or renamed in source
|
||||||
* don't linger and get recorded as installed. Also seeds
|
* don't linger and get recorded as installed. Also seeds
|
||||||
* _bmad/custom/.gitignore on fresh installs so *.user.toml overrides
|
* _bmad/custom/.gitignore on fresh installs so *.user.toml overrides
|
||||||
|
|
@ -643,7 +644,12 @@ class Installer {
|
||||||
|
|
||||||
await fs.remove(paths.scriptsDir);
|
await fs.remove(paths.scriptsDir);
|
||||||
await fs.ensureDir(paths.scriptsDir);
|
await fs.ensureDir(paths.scriptsDir);
|
||||||
await fs.copy(srcScriptsDir, paths.scriptsDir, { overwrite: true });
|
// Ship only the runtime scripts — dev-only tests and Python caches must not land in user projects.
|
||||||
|
const isInstallable = (srcPath) => {
|
||||||
|
const base = path.basename(srcPath);
|
||||||
|
return base !== 'tests' && base !== '__pycache__' && base !== '.pytest_cache' && !base.endsWith('.pyc');
|
||||||
|
};
|
||||||
|
await fs.copy(srcScriptsDir, paths.scriptsDir, { overwrite: true, filter: isInstallable });
|
||||||
await this._trackFilesRecursive(paths.scriptsDir);
|
await this._trackFilesRecursive(paths.scriptsDir);
|
||||||
|
|
||||||
const customGitignore = path.join(paths.customDir, '.gitignore');
|
const customGitignore = path.join(paths.customDir, '.gitignore');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue