The opsci command¶
opsci is the command-line tool the skills call. It lives in tools/ of the framework
repository and needs Python 3.11 or later.
pip install "git+<URL of the framework repository>@<tag>#subdirectory=tools"
pip install -e tools # or, from a clone of the framework repository
opsci --help
In the framework repository itself, pixi run opsci ... runs it in the pinned environment.
Every command prints error: ... on standard error and exits with status 1 when it fails or
refuses (exceptions are noted). A ROOT argument is the project root and defaults to the
current directory.
| command | what |
|---|---|
opsci template |
copy the project template; check a project made from it |
opsci task |
create a task directory |
opsci map |
build the project graph and the list of dead ends |
opsci context |
check the context files against their line caps |
opsci publish |
export, check and push the public part of a project |
opsci site |
build the project website |
opsci zenodo |
release data to Zenodo |
opsci notify |
send a message, and optionally a file, to the user |
opsci projects-page |
check the personal projects page |
opsci migrate |
check that a migration lost no file |
opsci guide |
check the framework's user guide |
opsci template¶
opsci template instantiate DEST --name NAME --title TITLE --author AUTHOR
[--template TEMPLATE] [--date DATE]
[--framework-repo FRAMEWORK_REPO] [--no-context-management]
[--notion] [--framework-line]
opsci template check [ROOT]
instantiatecopies the template intoDESTand fills its placeholders.--nameis the project slug (lower case, digits, hyphens).--templateis the framework'stemplate/directory (default: the one next to the installedopsci, if there is one).--dateis the creation date,YYYY-MM-DD(default today).--framework-repois the repository URL to record (default: the template checkout'sorigin, orlocal copy).--no-context-managementleaves out the context-management component.--framework-lineadds the README line naming the framework, with a link to its web page; pass it only with the user's consent. It refuses a non-emptyDESTand leaves nothing behind on failure.checkreports missing required files, unfilled placeholders, leftover component markers, absolute paths, and.gitignorerules that do not ignore what they should.
See Project template and layout.
opsci task¶
opsci task new ID --title TITLE [--summary SUMMARY] [--goal GOAL]
[--depends-on [ID ...]] [--related [ID ...]] [--supersedes [ID ...]]
[--plan] [--autonomy {autonomous,checkpoints,collaborative}]
[--hold-at [POINT ...]] [--verifies ID [ID ...]] [--root ROOT]
Creates tasks/ID/ with context.md (node header), map.md, results/README.md, log.md, subcontext/ and, with
--plan, plan.md from the plan template. --summary is the header's one-sentence summary
(default a TODO); --goal fills the Goal section of context.md. --hold-at needs
--autonomy checkpoints. --root is the project root (default .). It refuses a directory
that is not a project root, a bad or existing id, a title that is not one non-empty line,
and an edge to a node that does not exist.
--verifies makes a verification task (an audit, check or adverse review of finished work)
of the named nodes. It goes in tasks/<id>/verifications/ID/ when every named node lies in
that one task, else in verifications/ID/, and its privacy defaults to the strictest privacy
of the named nodes. See Verification tasks.
opsci map¶
opsci map build [--check] [ROOT]
Reads every node header and writes map/graph.md, map/dead_ends.md and map/claims.md (the
claims graph), and the same three files in brainstorm/map/ for the brainstorm nodes alone.
It writes the results pages: results/README.md (the milestone results) and
tasks/<id>/results/README.md for every task. It warns about every live result that rests
on failed or superseded work, and about a committed artifact that changed after its result
file. Brainstorm nodes are part of the
project graph, drawn in a box of their own. ROOT may be the project or its brainstorm/
directory; both build the same files. It also writes a starting map.md (the task's graph,
one node) for any task that has none, and never rewrites an existing one. It reports header
errors and writes nothing if there are any. Verification tasks are drawn as cards with a
double border, with a dashed "verified by" arrow from each node they check; it warns when one
is not where opsci task new would put it, or is less private than a node it verifies.
--check writes nothing and fails if the generated files are out of date.
The project graph and the claims graph are images beside their pages: map/graph.svg and
map/claims.svg (for the project site and GitHub), and a PNG of each (for Notion). Graphviz
places the cards and arrows and pdflatex typesets them, so $...$ in a title is set as
LaTeX (a title whose LaTeX does not compile is set as plain text). The math may use ordinary
math commands only (Greek letters, \frac, \mathrm, operators, arrows, ...); math with any
other command, such as \input or \def, is set as plain text, so a title cannot read a
file into the image. Every arrow points
forward: from a node to what depends on it ("used by"), from a node to the node that
superseded it ("superseded by"), and from a node to the verification task that checked it
("verified by"). Task boxes have a solid grey border, brainstorm boxes a dashed orange one.
The committed images, which the Notion mirror shows, label every node and task box by
privacy: "public" (its files are exported), "soft private" (the public map names it, but its
task or header is not public or the manifest does not include it) or "hard private" (the
public map leaves it out). The exported images leave out the hard-private nodes and label
the soft-private ones "not published". In the claims graph, assumptions and the nodes
the results start from are drawn quieter and milestones stronger than other results. An
image is redrawn only when its graph or the drawing code changed. Drawing needs Graphviz
(dot), pdflatex with the TikZ, standalone, lmodern and xcolor packages, and Poppler
(pdftocairo, pdftoppm); without them map build warns and leaves the images out of date,
and opsci publish check refuses the export. opsci publish redraws each exported image
from the published nodes only.
opsci context¶
opsci context check [-v] [ROOT]
Fails if the project context.md or a task context.md (verification tasks included) is over 200 lines, or
map/README.md over 150. -v prints every file with its line count.
opsci publish¶
opsci publish status [--public-repo PUBLIC_REPO] [ROOT]
opsci publish check [--commit COMMIT] [ROOT]
opsci publish push --export-id EXPORT_ID --message MESSAGE [--public-repo PUBLIC_REPO] [--commit COMMIT] [ROOT]
opsci publish export --out OUT [--commit COMMIT] [ROOT]
opsci publish pull-public [--public-repo PUBLIC_REPO] [ROOT]
status: public changes the private repository lacks (drift; exit status 1), and unpublished changes.check: export, run every check, write the review report and diff underpublish/reports/. Prints the report path and the export id.push: after the user approves the report, push the export with that id to the public repository.--messagesays what the publish adds; the files it changes and the private commit are appended.--public-repodefaults topublic_repoin the manifest.export: write the files the manifest allows, from one commit, into the empty directoryOUT.pull-public: bring public-side changes into a new private branch for review.
--commit defaults to HEAD. See Publishing and the filter.
opsci site¶
opsci site build [--out OUT] [--banner TEXT] [--allow-leak PATTERN ...] [SRC]
opsci site preview [--commit COMMIT] [--out OUT] [ROOT]
build: build the website of a public repository checkoutSRC(default.) with MkDocs intoOUT(default_site), in strict mode, and leak-scan the result.--allow-leak(repeatable) accepts the hits of a leak pattern you overrode inpublish/manifest.yaml(slurm-job-id,slurm-array-id,slurm-out-fileonly); the site workflow passes them.preview: the same for the export of this project'sCOMMIT(defaultHEAD), before publishing, with the manifest's banner and overridden leak patterns.
opsci zenodo¶
opsci zenodo release [--version VERSION] [--dry-run] [--production] [--api-url API_URL]
[--token-file TOKEN_FILE] [--build-dir BUILD_DIR] [--write-citation] [ROOT]
opsci zenodo check-token [--production] [--api-url API_URL] [--token-file TOKEN_FILE]
opsci zenodo checksum [--root ROOT] PATHS...
release: packdata/into tar groups and publish a Zenodo version, on the sandbox unless--production.--versionis required except with--dry-run, which prints the plan with no network access and writes nothing.--token-filedefaults to~/.config/opsci/zenodo-sandbox.token, orzenodo.tokenwith--production; it must be mode 600.--build-dirdefaults todata/.zenodo-build/<server>.--write-citationalso writes the DOIs toCITATION.cffand the datasets for a sandbox release.check-token: check that the token file is private and that Zenodo accepts the token. Creates nothing.checksum: the sha256 and size of the reproducible tar of each path underdata/.
See Zenodo releases.
opsci notify¶
opsci notify [--backend BACKEND] [--project-root PROJECT_ROOT] TEXT [FILE]
Sends TEXT, and optionally one FILE, to the user. --backend is file or slack
(default: notify.backend in the config, else file). --project-root defaults to the git
top level of the current directory. Exit status: 0 sent; 2 misconfiguration or bad input;
3 the Slack send failed. See Notifications.
opsci projects-page¶
opsci projects-page check [DIR]
Validates projects.yaml and checks index.html for the banned styles, in DIR (default
.). See Personal projects page.
opsci migrate¶
opsci migrate inventory -o OUTPUT [ROOT]
opsci migrate compare [-v] INVENTORY [ROOT]
inventory: before a migration, record every file (tracked, plus untracked files git does not ignore) with its hash inOUTPUT. Keep the file outside the project.compare: after the migration, report kept, moved, modified and lost files; fail if any inventoried file's content is found nowhere.-vlists moved files.
See open-science-project:migrate-project in Project skills.
opsci guide¶
opsci guide check [--repo REPO] [--max-words MAX_WORDS] [FILE]
Checks the framework's USER_GUIDE.md (or FILE): at most MAX_WORDS words (default 600),
and every path, opsci command and plugin skill it names exists. --repo is the framework
repository root (default: the checkout opsci runs from). This is a check for the framework
itself, not for projects.