Implement F007 explicit project profiles

This commit is contained in:
rob
2026-11-17 18:02:56 +00:00
parent 27dd40dd8f
commit d3a88fdeaf
9 changed files with 214 additions and 8 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
# Current state # Current state
FORGE-F001 and FORGE-F002 were human accepted and are present on `codex`. FORGE-F004 and FORGE-F003 implementation candidates are merged into local `codex`, with their external validation and human acceptance pending. `bortstack-context`, `bortstack-contributor`, and `bortstack-design` packages are present. The repository `testtask` entry point is provisioned but blocked because Forge has no application runtime or manual-test hook. One skill directory remains reserved. No generator or active legacy-skill migration has been implemented. Captain reports successful external validation of local Penpot 2.18 Docker and its integrated MCP connection, including editable shape/text creation and preservation of existing design elements during modification. The MCP container runs locally, but no Penpot connector or browser is exposed to this session, so current-session Penpot edits have not been verified. Windows and JJ's hands-on workflow have not been tested. Decisions FORGE-001 through FORGE-008 remain accepted. Captain has authorised direct `codex` work for future Forge tasks until further notice. FORGE-F001 and FORGE-F002 were human accepted and are present on `codex`. FORGE-F004 and FORGE-F003 implementation candidates are merged into local `codex`, with their external validation and human acceptance pending. FORGE-F007 has a profile configurator candidate directly on `codex`, with human acceptance pending. `bortstack-context`, `bortstack-contributor`, and `bortstack-design` packages are present; one skill directory remains reserved. The repository `testtask` entry point is provisioned but blocked because Forge has no application runtime or manual-test hook. No generator or active legacy-skill migration has been implemented. Captain reports successful external validation of local Penpot 2.18 Docker and its integrated MCP connection, including editable shape/text creation and preservation of existing design elements during modification. The MCP container runs locally, but no Penpot connector or browser is exposed to this session, so current-session Penpot edits have not been verified. Windows and JJ's hands-on workflow have not been tested. Decisions FORGE-001 through FORGE-008 remain accepted. Captain has authorised direct `codex` work for future Forge tasks until further notice.
+5 -5
View File
@@ -1,11 +1,11 @@
# Handoff # Handoff
FORGE-F003's candidate was committed on `codex-forge-f003` and merged into local `codex` at Captain's request. It remains open pending Captain design approval and Penpot/Windows/visual validation. The separate planning branch remains intact. F002 is Complete and does not block F003; F004's pending JJ validation also does not block it. No external application project, installed skill, distribution tooling, or production service was modified. Captain authorised direct `codex` work for future Forge tasks until further notice; FORGE-008 and `AGENTS.md` record this. Current work: FORGE-F007 profile configuration candidate on `codex`, starting from `27dd40d` under FORGE-008's direct-branch policy. The checkout was clean before implementation. F002 is Complete; F007 has no dependency blocker. The new command writes only to an explicitly named target directory; validation used temporary projects, not external applications.
Candidate: `bortstack-design` skill and references; a Forge-owned task-overview example with editable SVG concepts A and B, refined A, PNG previews, and an unapproved handoff draft. The example is not an application feature. Captain approval is pending and no design approval has been recorded in `bortstack-context`. Implementation: `forge/profile_config.py` and `scripts/configure-profile.py` record a selected business or personal profile at `.bortstack/profile.yaml` with explicit owner, brand, contributor policy, testing, and deployment values. The command supports dry-run, refuses placeholder values and overwrites, and leaves existing project files intact. The profile contract and `bortstack-context` now describe the record. No new dependency, generator, provider integration, access grant, or deployment was added.
Validation: `python3 -m unittest discover -s tests -v` passed 9 tests; `python3 scripts/validate-skills.py` accepted all three implemented skills; installer dry-run included `bortstack-design`; `git diff --check` and the task-ID/worktree audit passed. SVGs were rendered with ffmpeg, and A-refined and B were visually inspected. The SVG structure test confirms separate text/shapes and preservation of A's original IDs. This does not prove native Penpot editability or visual agreement with an approved implementation. Validation: `python3 -m unittest discover -s tests -v` passed 12 tests, including business and personal examples with different owners/brands and an existing-project preservation check. `python3 scripts/validate-skills.py` accepted three implemented packages; `git diff --check` passed. Windows invocation is documented but not exercised on Windows.
Limitations: Local Penpot containers run, including MCP, but this Codex session exposes no Penpot connector or browser. Current-session MCP edits and Penpot SVG import were not possible to verify. The non-MCP fallback is documented and its source files were exercised locally, but Penpot UI import remains pending. Windows setup and a post-approval implementation comparison remain unverified. Existing repository `testtask` remains blocked by lack of application runtime. Status: F007 is Ready to Finalise for Captain acceptance, not Complete. F003 remains merged with Captain design approval and Penpot/Windows/visual validation pending. F004 remains merged with JJ's external validation pending. The repository `testtask` remains blocked by lack of an application runtime. No push or deployment has occurred.
Next actions: Captain reviews the concepts and explicitly approves a named version or requests refinement; record that approval through `bortstack-context`. Once Penpot MCP or UI access is available, import/edit the Forge example and record file/board references, exercise the fallback, then perform the approved-source visual comparison. Keep F003 open until those acceptance gates pass. No push or deployment has occurred. Next action: Captain reviews F007's profile contract and temporary-project evidence, then accepts or requests changes. Future Forge work stays on `codex` until Captain says otherwise.
+3 -1
View File
@@ -59,12 +59,14 @@ Migrate `flask-react-auth-base` into Forge's template architecture. Preserve Fla
Acceptance: a generated application passes relevant checks and retains the listed capabilities before the existing bootstrap is retired. Acceptance: a generated application passes relevant checks and retains the listed capabilities before the existing bootstrap is retired.
## FORGE-F007 — Implement Business/Personal Profiles ## FORGE-F007 — Implement Business/Personal Profiles
Status: Planned. Priority: Medium. Dependencies: FORGE-F002. Status: Ready to Finalise (human acceptance pending). Priority: Medium. Dependencies: FORGE-F002. Implemented directly on `codex` under FORGE-008, starting from `27dd40d`.
Implement FORGE-005 for new and existing repositories: profile-specific documentation and conventions, independent ownership and branding, contributor access, and configurable testing/deployment expectations. Business profile does not imply Bortstack ownership. Implement FORGE-005 for new and existing repositories: profile-specific documentation and conventions, independent ownership and branding, contributor access, and configurable testing/deployment expectations. Business profile does not imply Bortstack ownership.
Acceptance: both profiles work with separately configured ownership and branding. Acceptance: both profiles work with separately configured ownership and branding.
Implementation record (2026-11-17): Added a dependency-free flat profile configurator and read/write module, updated the profile contract and context skill, and tested business and personal records in temporary new/existing directories with different owners and brands. The command requires explicit contributor, testing, and deployment values, preserves existing project files, and refuses to overwrite an existing profile. Linux tests passed; Windows command and filesystem behavior have not been exercised on Windows. No real external project was changed. Awaiting human acceptance; do not mark Complete from tests alone.
## FORGE-F008 — Standardise Local Testing and `act` ## FORGE-F008 — Standardise Local Testing and `act`
Status: Planned. Priority: Medium. Dependencies: FORGE-F006. Status: Planned. Priority: Medium. Dependencies: FORGE-F006.
+13
View File
@@ -1,3 +1,16 @@
# Project profile contract # Project profile contract
`profiles/business.yaml` and `profiles/personal.yaml` are flat records with `profile`, `development_context`, `ownership`, `branding`, `contributor_access`, `testing_expectations`, and `deployment_expectations`. The last five values are project-specific placeholders until explicit project configuration is recorded. Business does not imply Bortstack ownership. Profile selection is explicit for new or existing projects; existing repositories are never classified automatically. Profile, owner, brand, and contributor permissions are separate decisions. No inheritance or merge algorithm is defined. `profiles/business.yaml` and `profiles/personal.yaml` are flat records with `profile`, `development_context`, `ownership`, `branding`, `contributor_access`, `testing_expectations`, and `deployment_expectations`. The last five values are project-specific placeholders until explicit project configuration is recorded. Business does not imply Bortstack ownership. Profile selection is explicit for new or existing projects; existing repositories are never classified automatically. Profile, owner, brand, and contributor permissions are separate decisions. No inheritance or merge algorithm is defined.
F007 records a selected project profile at `.bortstack/profile.yaml` inside the target project. It requires the profile plus explicit owner, brand, contributor-access policy, testing expectation, and deployment expectation. `profile` and `development_context` must match `business` or `personal`. The file documents project context; it does not grant permissions, start tests, or deploy. The configurator uses a dependency-free, flat string-only YAML subset and refuses to overwrite an existing record or follow a symlinked profile directory. Existing projects retain their other files. Do not infer the selection from repository contents or copy the placeholder values as policy.
Example for an existing or newly created project directory:
```sh
python3 scripts/configure-profile.py --project /path/to/project --profile business \
--owner 'Independent Ltd' --brand 'Northstar' \
--contributor-access 'Captain approval required' \
--testing 'local unit tests' --deployment 'manual approval' --dry-run
```
Remove `--dry-run` to write the record. On Windows, use `py -3 scripts/configure-profile.py` with the same arguments. Run the command from the Forge checkout; it writes only to the explicitly named project. A future `bortstack-new` may invoke this interface after generating a project, but F007 does not generate projects.
+1
View File
@@ -0,0 +1 @@
"""Framework-independent Forge helpers."""
+80
View File
@@ -0,0 +1,80 @@
"""Explicit, framework-independent project profile records.
The bundled profiles describe supported contexts, not ownership or access defaults.
"""
import json
from pathlib import Path
FIELDS = (
"profile",
"development_context",
"ownership",
"branding",
"contributor_access",
"testing_expectations",
"deployment_expectations",
)
PROFILES = ("business", "personal")
def read_flat_record(path):
"""Read the repository's flat string-only YAML subset without extra dependencies."""
values = {}
for number, raw in enumerate(Path(path).read_text(encoding="utf-8").splitlines(), 1):
line = raw.strip()
if not line or line.startswith("#"):
continue
if ":" not in line:
raise ValueError(f"{path}:{number}: expected key: value")
key, value = (part.strip() for part in line.split(":", 1))
if key not in FIELDS or key in values or not value:
raise ValueError(f"{path}:{number}: invalid or duplicate field {key!r}")
if value.startswith('"'):
try:
value = json.loads(value)
except json.JSONDecodeError as exc:
raise ValueError(f"{path}:{number}: invalid quoted value") from exc
if not isinstance(value, str) or not value.strip():
raise ValueError(f"{path}:{number}: value must be nonempty text")
values[key] = value
if set(values) != set(FIELDS):
raise ValueError(f"{path}: expected exactly {', '.join(FIELDS)}")
return values
def build_record(template_path, *, profile, ownership, branding, contributor_access, testing_expectations, deployment_expectations):
if profile not in PROFILES:
raise ValueError("profile must be business or personal")
template = read_flat_record(template_path)
if template["profile"] != profile or template["development_context"] != profile:
raise ValueError("profile template identity does not match selection")
values = dict(profile=profile, development_context=profile, ownership=ownership,
branding=branding, contributor_access=contributor_access,
testing_expectations=testing_expectations,
deployment_expectations=deployment_expectations)
for key in FIELDS[2:]:
value = values[key]
if not isinstance(value, str) or not value.strip() or value.strip() == "project-specific":
raise ValueError(f"{key} requires an explicit project value")
values[key] = value.strip()
return values
def write_record(project, values):
project = Path(project)
if not project.is_dir() or project.is_symlink():
raise ValueError("project must be an existing, non-symlink directory")
config_dir = project / ".bortstack"
if config_dir.is_symlink():
raise ValueError("profile directory must not be a symlink")
target = config_dir / "profile.yaml"
if target.exists() or target.is_symlink():
raise FileExistsError(f"profile already exists: {target}")
config_dir.mkdir(exist_ok=True)
content = "# Explicit project context; values describe policy but grant no access.\n"
content += "".join(f"{key}: {json.dumps(values[key], ensure_ascii=False)}\n" for key in FIELDS)
with target.open("x", encoding="utf-8") as handle:
handle.write(content)
return target
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""Record an explicitly selected business or personal project profile."""
import argparse
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
from forge.profile_config import build_record, read_flat_record, write_record # noqa: E402
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--project", type=Path, required=True, help="existing new/legacy project directory")
parser.add_argument("--profile", choices=("business", "personal"), required=True)
parser.add_argument("--owner", required=True)
parser.add_argument("--brand", required=True)
parser.add_argument("--contributor-access", required=True, help="documented project policy, not an access grant")
parser.add_argument("--testing", required=True)
parser.add_argument("--deployment", required=True)
parser.add_argument("--dry-run", action="store_true")
args = parser.parse_args()
try:
record = build_record(ROOT / "profiles" / f"{args.profile}.yaml", profile=args.profile,
ownership=args.owner, branding=args.brand,
contributor_access=args.contributor_access,
testing_expectations=args.testing,
deployment_expectations=args.deployment)
if not args.project.is_dir() or args.project.is_symlink():
raise ValueError("project must be an existing, non-symlink directory")
target = args.project / ".bortstack" / "profile.yaml"
if target.parent.is_symlink():
raise ValueError("profile directory must not be a symlink")
if target.exists() or target.is_symlink():
raise FileExistsError(f"profile already exists: {target}")
if args.dry_run:
print(f"PLAN {args.profile} -> {target}")
else:
write_record(args.project, record)
print(f"WROTE {target}")
read_flat_record(target)
except (OSError, ValueError) as exc:
parser.exit(1, f"ERROR: {exc}\n")
if __name__ == "__main__":
main()
+1 -1
View File
@@ -27,7 +27,7 @@ For authorised direct-branch work, record the active task and starting commit, i
## Profiles and design ## Profiles and design
Record business or personal profile explicitly for new and existing projects. Profile, ownership, branding, contributor access, testing expectations, and deployment expectations are independent choices; business does not imply Bortstack ownership. Do not classify existing repositories automatically. `bortstack-new` delegates initial context to this skill; `bortstack-contributor` consumes this lifecycle. Record business or personal profile explicitly for new and existing projects. Profile, ownership, branding, contributor access, testing expectations, and deployment expectations are independent choices; business does not imply Bortstack ownership. Do not classify existing repositories automatically. In Forge-managed projects, inspect `.bortstack/profile.yaml` if present; for a new selection, collect all five project-specific values and use `scripts/configure-profile.py` from a Forge checkout, or create the same flat record under project rules. Never overwrite an existing profile silently. The record describes policy but grants no access or deployment authority. `bortstack-new` delegates initial context to this skill; `bortstack-contributor` consumes this lifecycle.
For design-dependent implementation, record the design reference, version, approval authority/date, and affected task in decisions or task records. An explicit override records who authorised it, when, its scope and rationale. Proceed only with an approved design or recorded explicit override. `bortstack-design` owns Penpot operations and visual handoffs; Penpot is optional and its absence does not block unrelated context work. For design-dependent implementation, record the design reference, version, approval authority/date, and affected task in decisions or task records. An explicit override records who authorised it, when, its scope and rationale. Proceed only with an approved design or recorded explicit override. `bortstack-design` owns Penpot operations and visual handoffs; Penpot is optional and its absence does not block unrelated context work.
+63
View File
@@ -0,0 +1,63 @@
import subprocess
import tempfile
import unittest
from pathlib import Path
from forge.profile_config import read_flat_record
ROOT = Path(__file__).resolve().parents[1]
COMMAND = ["python3", str(ROOT / "scripts/configure-profile.py")]
def configure(project, profile, owner, brand, *extra):
return subprocess.run(COMMAND + ["--project", str(project), "--profile", profile,
"--owner", owner, "--brand", brand,
"--contributor-access", "Captain approval required",
"--testing", "local unit tests",
"--deployment", "manual approval", *extra],
capture_output=True, text=True)
class ProfileTests(unittest.TestCase):
def test_both_profiles_keep_owner_and_brand_independent(self):
with tempfile.TemporaryDirectory() as temp:
business = Path(temp) / "existing-business"
personal = Path(temp) / "new-personal"
business.mkdir()
personal.mkdir()
(business / "README.md").write_text("existing work\n")
self.assertEqual(configure(business, "business", "Independent Ltd", "Northstar").returncode, 0)
self.assertEqual(configure(personal, "personal", "Alex", "Garden Notes").returncode, 0)
one = read_flat_record(business / ".bortstack/profile.yaml")
two = read_flat_record(personal / ".bortstack/profile.yaml")
self.assertEqual((one["ownership"], one["branding"]), ("Independent Ltd", "Northstar"))
self.assertEqual((two["ownership"], two["branding"]), ("Alex", "Garden Notes"))
self.assertEqual((one["profile"], two["profile"]), ("business", "personal"))
self.assertEqual((business / "README.md").read_text(), "existing work\n")
self.assertNotIn("Bortstack", one["ownership"])
def test_selection_is_explicit_and_existing_record_is_preserved(self):
with tempfile.TemporaryDirectory() as temp:
project = Path(temp)
dry = configure(project, "business", "Owner", "Brand", "--dry-run")
self.assertEqual(dry.returncode, 0)
self.assertFalse((project / ".bortstack").exists())
self.assertEqual(configure(project, "business", "Owner", "Brand").returncode, 0)
path = project / ".bortstack/profile.yaml"
original = path.read_bytes()
again = configure(project, "personal", "Other", "Other")
self.assertNotEqual(again.returncode, 0)
self.assertEqual(path.read_bytes(), original)
def test_rejects_placeholder_and_invalid_project(self):
with tempfile.TemporaryDirectory() as temp:
project = Path(temp) / "missing"
self.assertNotEqual(configure(project, "business", "Owner", "Brand").returncode, 0)
project.mkdir()
self.assertNotEqual(configure(project, "business", "project-specific", "Brand").returncode, 0)
self.assertFalse((project / ".bortstack").exists())
if __name__ == "__main__":
unittest.main()