Skip to content

Commit 21a149a

Browse files
Douglas JonesDouglas Jones
authored andcommitted
Pressure-test cleanup + project-directory rename script
Three small residues from the rename pass, plus the helper for the one rename I cannot do from inside the working tree. codifide/__main__.py — CLI module docstring still described files as .nm and was missing the verify and capability subcommands. Now accurate. tests/test_parser_fuzz.py — inner docstring said "random .nm-ish source"; now says "random .cod-ish source". docs/CANONICAL.md — opener still read "CBOR and a content-addressed store are planned". Both shipped. Now reads: "canonical form serializes to both JSON (primary, human-inspectable) and CBOR (binary, RFC 8949 §4.2 deterministic subset, about 25-30% smaller than JSON). Content addressing over either byte form is operational through the symbol store described below." scripts/rename-project-directory.sh — the parent directory on disk is still /Users/douglasjones/Projects/Noema. No file inside the repository depends on that path (imports and references are all relative), so the rename is purely a disk-layout change. The script verifies preconditions, performs the mv, and checks the result. Run from outside the project directory: cd ~/Projects bash Noema/scripts/rename-project-directory.sh This is the only remaining rename. After it runs, the project will live at ~/Projects/Codifide and every reference to "Noema" that should be historical stays historical (dispatches, session state), every reference that should be current is Codifide (code, docs, logos, governance). Tests: 122 Python, 10 Rust, still green.
1 parent b507458 commit 21a149a

4 files changed

Lines changed: 87 additions & 11 deletions

File tree

codifide/__main__.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
"""Codifide CLI.
22
33
Subcommands:
4-
run <file.nm> Parse and execute a Codifide program.
5-
canonical <file.nm> Print the canonical JSON projection.
6-
test Run the Codifide test suite.
7-
store put <file.nm> Store every symbol in a module by content hash.
8-
store get <hash> Print the canonical JSON for a stored symbol.
9-
store list List every stored symbol identity.
10-
store hash <file.nm> Print (name, hash) pairs for a module's symbols.
11-
store index name=<id>... Publish an index module bundling name->id pairs.
4+
run <file.cod> Parse and execute a Codifide program.
5+
canonical <file.cod> Print the canonical JSON projection.
6+
verify <file.cod> Verify a program parses, type-checks,
7+
and canonicalizes cleanly; print per-
8+
symbol content hashes.
9+
capability Print the capability manifest.
10+
test Run the Codifide test suite.
11+
store put <file.cod> Store every symbol in a module by content hash.
12+
store get <hash> Print the canonical JSON for a stored symbol.
13+
store list List every stored symbol identity.
14+
store hash <file.cod> Print (name, hash) pairs for a module's symbols.
15+
store index name=<id>... Publish an index module bundling name->id pairs.
16+
store verify <hash> Walk a stored module's imports and report
17+
any pointees missing from the store.
1218
1319
The CLI is deliberately minimal. Codifide's surface is a projection; a richer
1420
interaction is better done over the canonical form (see codifide.projection).

docs/CANONICAL.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ The canonical form is the source of truth. Surface text is a projection. Two
44
programs are the same program iff their canonical forms are equal under the
55
normalization rules below.
66

7-
In v0 we serialize canonical form as JSON. CBOR and a content-addressed store
8-
are planned.
7+
In v0.1 the canonical form serializes to both JSON (primary,
8+
human-inspectable) and CBOR (binary, RFC 8949 §4.2 deterministic
9+
subset, about 25-30% smaller than JSON). Content addressing over
10+
either byte form is operational through the symbol store described
11+
in §Symbol store below.
912

1013
This document is the specification an independent implementer should be able
1114
to follow without reading the reference Python source. Where the reference
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
# Rename the project's parent directory from Noema to Codifide.
3+
#
4+
# This script exists because the Codifide language codebase sits at
5+
# /Users/douglasjones/Projects/Noema — the parent directory still
6+
# carries the old name from before the rename. No file inside the
7+
# repository depends on that path (all imports and paths inside
8+
# the code are relative), so moving the directory is purely a
9+
# disk-layout change.
10+
#
11+
# Run this script from *outside* the project directory. It cannot
12+
# rename the directory it is executing inside. After the move, cd
13+
# into the new location and verify the test suite still passes.
14+
#
15+
# Usage:
16+
# cd ~/Projects (or wherever Noema/ lives)
17+
# bash Noema/scripts/rename-project-directory.sh
18+
19+
set -euo pipefail
20+
21+
OLD="Noema"
22+
NEW="Codifide"
23+
24+
here="$(pwd)"
25+
old_path="${here}/${OLD}"
26+
new_path="${here}/${NEW}"
27+
28+
if [ ! -d "$old_path" ]; then
29+
echo "error: ${old_path} does not exist."
30+
echo "Run this script from the directory that contains ${OLD}/"
31+
exit 1
32+
fi
33+
34+
if [ -e "$new_path" ]; then
35+
echo "error: ${new_path} already exists. Refusing to clobber."
36+
exit 1
37+
fi
38+
39+
# Guard against running from inside the directory we're moving.
40+
# `pwd -P` resolves symlinks, matching what macOS gives us.
41+
case "$here" in
42+
"$old_path"|"$old_path"/*)
43+
echo "error: you are inside ${old_path}. cd out before running."
44+
exit 1
45+
;;
46+
esac
47+
48+
echo "Moving ${old_path} -> ${new_path}"
49+
mv "$old_path" "$new_path"
50+
51+
echo "Verifying the move..."
52+
if [ -d "$new_path/codifide" ] && [ -f "$new_path/README.md" ]; then
53+
echo "OK: directory contents look right."
54+
else
55+
echo "warning: expected contents not found. Inspect ${new_path}."
56+
exit 1
57+
fi
58+
59+
echo
60+
echo "Done. Next steps:"
61+
echo " cd ${new_path}"
62+
echo " python3 -m codifide test # confirm 122 passing"
63+
echo " cargo test --release -p codifide-canonical # confirm 10 passing"
64+
echo
65+
echo "If you use shell history, IDE workspaces, or Git remotes that"
66+
echo "reference the old path, update those separately. Nothing inside"
67+
echo "the repository depends on the parent directory name."

tests/test_parser_fuzz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def _rand_cand_block(rng: random.Random) -> str:
456456

457457

458458
def _generate_grammar_adjacent_source(rng: random.Random) -> str:
459-
"""Compose a random .nm-ish source from mostly-valid fragments."""
459+
"""Compose a random .cod-ish source from mostly-valid fragments."""
460460
parts: list[str] = []
461461
# Maybe a module line.
462462
if rng.random() < 0.3:

0 commit comments

Comments
 (0)