Inf7, a CLI project manager for Inform 7

inf7’s goals are to:

  • make it easy to create and compile projects on the command-line
  • make usable Project Indices available to CLI users (including links to documentation)

The documentation-handling it has to do for the latter offers a couple of benefits of potential interest beyond just to command-line users. It generates one big web page of all of Writing in Inform and The Recipe Book, facilitating searching the whole of the documentation. And it can create an epub of the whole thing that’s almost 2/3 smaller than the epub included with the IDE packages’ documentation.

Full documentation and the code is available at the inf7 github repo.

Once you’ve set it up, e.g., with

$ inf7 setup --internal /usr/local/share/inform7/Internal --external ~/external --resources /usr/share/gnome-inform7/Resources --docs /usr/share/gnome-inform7/Documentation --author "Zed Lopez"

creating and compiling a project would look like:

$ cd ~/inform
$ inf7 init "A Walk in the Park"
Created /home/zed/inform/A Walk in the Park.inform
$ emacs A\ Walk\ in\ the\ Park.inform/Source/story.ni
$ inf7 compile A\ Walk\ in\ the\ Park
/usr/local/bin/ni --noprogress --internal /usr/local/share/inform7/Internal --external /home/zed/external --project /home/zed/inform/A Walk in the Park.inform
Compiled 23-word source.

/usr/local/bin/inform6 -wE2SDG /home/zed/inform/A Walk in the Park.inform/Build/auto.inf /home/zed/inform/A Walk in the Park.inform/Build/output.ulx
Inform 6.34 for Linux (21st May 2020)
In:  1 source code files             66296 syntactic lines
Out:   Glulx story file 1.210503 (537.5K long):

/usr/local/bin/cBlorb -unix /home/zed/inform/A Walk in the Park.inform/Release.blurb /home/zed/inform/A Walk in the Park.inform/Build/output.gblorb
cBlorb 1.2 [executing on Monday 3 May 2021 at 13:44.58]
Completed: wrote blorb file of size 642210 bytes (1 picture(s), 0 sound(s))

and the project’s Index would be viewable with, e.g.,

$ firefox "A Walk in the Park.inform/index.html"

This is barely-tested alpha code that I haven’t yet used to develop a real Inform 7 project. I don’t know of any bugs, but I’m sure they’re there.

5 Likes

Looks admirably thorough, just from looking at the docs.

  i6flagstest: -wE2~SD
  i6flagsrelease: -wE2~S

The Mac IDE uses -kE2SDwG for test, -kE2~S~DwG for release. I strongly recommend S (rather than ~S) for testing – that adds a lot of checks for errors that might otherwise crash the interpreter.

I also recommend including ~D for release mode. You don’t need it (since ~D is the default), but it’s better to be explicit.

The k option isn’t a big deal. It generates debug info, but at present not much makes use of that debug info, and it can be slow to generate.

2 Likes

Thanks; I’ve changed the defaults accordingly.

1 Like

Any chance of getting this on Windows?
Edit: My bad, I thought this was native code, rather than using Ruby. Guess it pays to RTFM.

If you try it, let me know how it goes. I don’t know any reason it wouldn’t work on Windows – I used File and Pathname join methods throughout, and TTY::Which, which it uses to find executables, is supposed to work on Windows – but I haven’t tried it on anything but Linux.

I failed my saving throw against adding more features. I just pushed a new version.

You can now specify a plain .ni file with compile instead of a project name. In this case, it’ll create a temporary project to compile it and leave the resulting .ulx or .z8 file (if compilation was successful) in the current directory.

There’s a new subcommand, smoketest whose --ext flag you pass an extension filename. It’ll create a temporary project with a storyfile that includes that extension and try to compile it. You’ll either see error messages or the successful compilation output (nothing is saved).

And I fixed a bug: it wasn’t considering extensions when compilation was checking whether auto.inf was up-to-date. Now if story.ni or any extension in the extension project dir has a modification time after auto.inf, it’ll compile. It’s still insensitive to potential changes to the external or internal extension dirs; use the --force flag to compensate as needed.

Another new version pushed.

“smoketest” was renamed just “test”.

If it’s configured, it’ll use a hacked version of @zarf’s i7tohtml.py to pretty print the Inform 7 source code for the story file and Extensions as available through the Project Index. Installing and configuring is a little cumbersome, but is explained in the INSTALL doc.

There’s now a “clean” subcommand to clean up a project’s build and index dirs.

I just pushed version 0.1.6. One big new feature:

You can run setup without an existing Inform 7 installation with:

$ inf7 setup --download

For everyone, this obviates specifying the --internal, --docs, and --resources flags; it downloads an archive and creates/configures them appropriately. If you’re on Linux, it further downloads the CLI package and uses its binaries; you wouldn’t need anything else. Mac and Windows users are on their own to supply ni, inform6, and cBlorb, but at least they don’t have to look up where their Internal, Documentation, and Resources directories are.

Once you get inf7 itself installed (which I need to make easier), there’s now a very easy route to a working Inform 7 development environment for Linux users.

Small changes (including from 0.1.5; I haven’t been posting about every update):

  • several improvements to Inform 7 pretty-printing
  • it no longer transforms the extension pages in the external dir’s Documentation/Extensions: it just uses its own, which now have Javascript to copy examples to the clipboard
  • references to e.g., “next chapter”, “chapter on Activities”, “the chapter on Actions” in documentation are now links (unlike the original)
1 Like

New version, 0.2.0, with several nifty things:

It used to be when you navigated from a Project Index into the docs you lost the navbar. Now the navbar is maintained appropriately and you can get back to the project.

If you configure “browser”, “zterp”, and “gterp” to appropriate executables, when you compile a program then, on failure, it’ll automatically launch the browser with problems.html; on success, it’ll launch the appropriate interpreter. There’s also a play subcommand that will invoke gterp or zterp; mostly of interest to test they’re configured properly.

You’ll be using an independent editor, of course, and dropping to the command-line to compile, but otherwise this offers a similar edit-compile-run/check things in the Project Index/docs development cycle that IDE users get, and access to all the same information barring the skein.

More improvements to Inform 7 pretty-printing and there’s now a ‘pp’ subcommand that will output pretty-printed source code as plain text (and though tables look good in its output, their presence makes the output unusable as source code itself because currently tabs are destroyed) or html (but this is probably less useful because it depends on inf7 css).

Compiling a project no longer checks source code and output modification times – it always tries to compile. It checks only the project’s own extensions to consider reformatting their HTML. By default it skips them if modification time says they don’t need it; --force makes it rewrite all of them. If you want to rewrite the HTML for the External and Internal directories, use the new census subcommand. As with compile, it skips things whose modification times indicate they’re up to date unless you use --force.

The new update subcommand freshly copies the extensions from your .config/inf7/extensions directory to a given project.

The set and settings subcommands can be used without a project. With --init, set lets you update .config/inf/inf7.yml.

I’ve re-styled the Project Index somewhat. Some of the results are better than others; this will need more work.

This will probably be the last update for a while. As the original README noted, the code needs refactoring. I now have a better idea of what I want it to be and want to re-organize some fundamental things.

1 Like

Just pushed 0.2.1. Changes:

  • back-ported the script that generates the the Standard Rules web page; now that’s the same version of the SR inf7 users get (but with local links to documentation)
  • pp --html now produces a standalone web page with its CSS in the head and no external dependencies
  • setup --download now updates Quixe and Parchment (in external)
  • added ‘Definitions’ to the navbar with content per the IDEs
  • revised HTML formatting of source; line-numbers via CSS now, so copy-pasting code would work (where tabs aren’t relevant, at least)
  • much improved re-styling of the Project Index, all the ugliest bits of previous re-styling fixed
  • no longer defaults to $HOME/Inform for your external dir; if none is specified it uses a temp dir every time
  • various bugfixes
1 Like