Implement FORGE-F002 context skill and snapshot commands
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
.test-worktrees/
|
.test-worktrees/
|
||||||
|
snapshots/
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
# Forge repository instructions
|
# Forge repository instructions
|
||||||
|
|
||||||
Read `docs/PROJECT_OVERVIEW.md`, `CURRENT_STATE.md`, `DECISIONS.md`, `TASKS.md`, and `HANDOFF.md` before task work. Inspect Git status and relevant code. One accepted implementation task uses a dedicated branch and separate worktree. Preserve unrelated changes and legacy skills. Task IDs use `FORGE-F###`; record implementation, validation, limitations, and handoff. Only mark a task complete after human acceptance. Never commit secrets. Do not modify external projects, production infrastructure, or installed skills as part of foundation work.
|
Read `docs/PROJECT_OVERVIEW.md`, `CURRENT_STATE.md`, `DECISIONS.md`, `TASKS.md`, and `HANDOFF.md` before task work. Inspect Git status and relevant code. One accepted implementation task uses a dedicated branch and separate worktree. Preserve unrelated changes and legacy skills. Task IDs use `FORGE-F###`; record implementation, validation, limitations, and handoff. Only mark a task complete after human acceptance. Never commit secrets. Do not modify external projects, production infrastructure, or installed skills as part of foundation work.
|
||||||
|
|
||||||
|
Script commands: `scripts/create-chatgpt-snapshot.sh` creates a current-worktree ZIP under ignored `snapshots/`; inspect contents before sharing. `scripts/testtask.sh FORGE-F###` is the task-ID entry point, currently provisioned but blocked because Forge has no application runtime or manual-test hook.
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# Current state
|
# Current state
|
||||||
|
|
||||||
FORGE-F001 foundation was human accepted and is present on `main` and `codex`. The repo initially contained only a five-byte README on `main`; no prior local task or decision files existed. Four skill directories are reserved with README files, so no Forge skills are installable. The installer, validator, specifications, profiles, and automated tests are present. No generator, design integration, or active skill migration has been implemented. Linux tests passed locally; Windows has not been tested. Decisions FORGE-001 through FORGE-006 and planning tasks FORGE-F002 through FORGE-F010 are recorded; none of those implementation tasks has been authorised or started.
|
FORGE-F001 foundation was human accepted and is present on `main` and `codex`. FORGE-F002 was accepted for commit and merge into `codex` on 2026-11-17. `bortstack-context` is implemented with a task-ID/worktree audit and ChatGPT snapshot command. The repository `testtask` entry point is provisioned but blocked because Forge has no application runtime or manual-test hook. Three other skill directories remain reserved. No generator, design integration, or active legacy-skill migration has been implemented. Windows has not been tested. Decisions FORGE-001 through FORGE-006 remain accepted.
|
||||||
|
|||||||
+8
-2
@@ -1,5 +1,11 @@
|
|||||||
# Handoff
|
# Handoff
|
||||||
|
|
||||||
Current work: documentation-only planning reconciliation in `/tmp/bortstack-forge-planning-reconciliation` on `codex-forge-planning-reconciliation`. FORGE-F001 was human accepted and is present on `main` and `codex`; its separate worktree remains at `/tmp/bortstack-forge-f001`. Decisions FORGE-001 through FORGE-006 and planned tasks FORGE-F002 through FORGE-F010 are recorded. No implementation task has been authorised by this planning work. Review the decision and task diff before separately accepting any implementation task. No Forge skill can currently be installed; existing `roborto-*` skills remain operational. Windows installer behavior remains unverified on Windows.
|
FORGE-F002 was human accepted for commit and merge on 2026-11-17. Its task branch/worktree is `codex-forge-f002` at `/tmp/bortstack-forge-f002`; integration target is `codex`. Previous F001 and planning worktrees remain intact.
|
||||||
|
|
||||||
No `testtask` or ChatGPT snapshot adapter is present. The installed Roborto context skill requires both for enrolled repositories; Forge has no application runtime or Docker test environment yet. F002 must reconcile ownership and the Forge-specific adapter; this documentation reconciliation does not provision one or claim manual-test readiness.
|
Implementation: canonical `bortstack-context` skill, lifecycle/profile/design/snapshot contract, `scripts/context_audit.py`, safe current-worktree ZIP command, and a Forge `testtask` entry point that reports its runtime blocker. No installed Roborto skills or external projects were changed.
|
||||||
|
|
||||||
|
Validation: `python3 -m unittest discover -s tests -v` passed 7 tests; `python3 scripts/validate-skills.py` validated the new package; `python3 scripts/context_audit.py docs/TASKS.md --worktrees` reported no ID collision and detected this changed worktree; shell syntax checks passed. A ZIP was generated from the uncommitted task worktree. Temporary-repository tests verified edited and untracked inclusion and `.env`/prior snapshot exclusion. The ZIP predates final documentation edits and is stale for sharing; refresh it if needed.
|
||||||
|
|
||||||
|
Limitations: `scripts/testtask.sh FORGE-F002` is provisioned but blocked because Forge has no application runtime or task-specific manual-test hook. Windows behavior has not been checked. Inspect archive contents before sharing. No push or deployment was performed.
|
||||||
|
|
||||||
|
Next action: F003 and F004 can be briefed separately after integration; neither is authorised for implementation by this merge.
|
||||||
|
|||||||
+3
-1
@@ -6,7 +6,7 @@ The following backlog entries are planning records, not implementation authorisa
|
|||||||
Status: Complete; human acceptance received 2026-11-17. Approved scope: structure, specifications, portable installer and validation. Acceptance: documented architecture and decisions; safe installer that ignores reserved skills; tests pass; legacy skills and external repositories remain untouched. Task branch/worktree: `codex-forge-f001` at `/tmp/bortstack-forge-f001`. Skill implementation and migration are excluded.
|
Status: Complete; human acceptance received 2026-11-17. Approved scope: structure, specifications, portable installer and validation. Acceptance: documented architecture and decisions; safe installer that ignores reserved skills; tests pass; legacy skills and external repositories remain untouched. Task branch/worktree: `codex-forge-f001` at `/tmp/bortstack-forge-f001`. Skill implementation and migration are excluded.
|
||||||
|
|
||||||
## FORGE-F002 — Implement `bortstack-context`
|
## FORGE-F002 — Implement `bortstack-context`
|
||||||
Status: Planned. Priority: High. Dependencies: FORGE-F001.
|
Status: Complete; human acceptance received 2026-11-17 through instruction to commit and merge. Priority: High. Dependencies: FORGE-F001. Branch/worktree: `codex-forge-f002` at `/tmp/bortstack-forge-f002`; integration target: `codex`.
|
||||||
|
|
||||||
Migrate `roborto-project-context` into the canonical skill for new and existing repositories. Preserve overview, current state, decisions, tasks, handoffs, isolated task branches/worktrees, and legacy Roborto compatibility. Support project-prefixed IDs with duplicate detection, business/personal contexts, and design references, approvals, and explicit overrides. Define the shared task finalisation lifecycle.
|
Migrate `roborto-project-context` into the canonical skill for new and existing repositories. Preserve overview, current state, decisions, tasks, handoffs, isolated task branches/worktrees, and legacy Roborto compatibility. Support project-prefixed IDs with duplicate detection, business/personal contexts, and design references, approvals, and explicit overrides. Define the shared task finalisation lifecycle.
|
||||||
|
|
||||||
@@ -14,6 +14,8 @@ Lifecycle states: In Progress, Ready to Finalise, Ready for Review, Merged, Clos
|
|||||||
|
|
||||||
Acceptance: demonstrate lifecycle and collision checks with new and legacy repository examples; preserve historical IDs and unfinished work. Reconcile context ownership of `testtask` and ChatGPT snapshot entry points without claiming Forge has an application runtime.
|
Acceptance: demonstrate lifecycle and collision checks with new and legacy repository examples; preserve historical IDs and unfinished work. Reconcile context ownership of `testtask` and ChatGPT snapshot entry points without claiming Forge has an application runtime.
|
||||||
|
|
||||||
|
Implementation record (2026-11-17): Added the canonical skill, snapshot command reference, read-only task ID/worktree audit, ZIP snapshot entry point, and explicit blocked `testtask` entry point. Tests cover collision handling for new and legacy IDs and safe snapshots of edited/untracked files. The skill defines lifecycle gates and preservation of unfinished work. Runtime manual testing remains unavailable until Forge has a task-specific hook; Windows is untested.
|
||||||
|
|
||||||
## FORGE-F003 — Implement `bortstack-design`
|
## FORGE-F003 — Implement `bortstack-design`
|
||||||
Status: Planned. Priority: High. Dependencies: FORGE-F002.
|
Status: Planned. Priority: High. Dependencies: FORGE-F002.
|
||||||
|
|
||||||
|
|||||||
Executable
+44
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Report duplicate task headings and unfinished Git worktrees without changing them."""
|
||||||
|
import argparse
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
TASK = re.compile(r"^##\s+((?:[A-Z][A-Z0-9]*-)?[A-Z]*\d{3,})\s+[—-]", re.M)
|
||||||
|
|
||||||
|
|
||||||
|
def ids(paths):
|
||||||
|
found = {}
|
||||||
|
for path in paths:
|
||||||
|
for match in TASK.finditer(Path(path).read_text(encoding="utf-8")):
|
||||||
|
line = Path(path).read_text(encoding="utf-8")[:match.start()].count("\n") + 1
|
||||||
|
found.setdefault(match.group(1), []).append(f"{path}:{line}")
|
||||||
|
return found
|
||||||
|
|
||||||
|
|
||||||
|
def git(*args):
|
||||||
|
return subprocess.check_output(["git", *args], text=True).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument("task_files", nargs="*", help="task registers to compare")
|
||||||
|
parser.add_argument("--worktrees", action="store_true", help="report worktree changes and handoffs")
|
||||||
|
args = parser.parse_args()
|
||||||
|
collisions = {key: loc for key, loc in ids(args.task_files).items() if len(loc) > 1}
|
||||||
|
for key, loc in sorted(collisions.items()):
|
||||||
|
print(f"COLLISION {key}: {', '.join(loc)}")
|
||||||
|
if args.worktrees:
|
||||||
|
for block in git("worktree", "list", "--porcelain").split("\n\n"):
|
||||||
|
if not block:
|
||||||
|
continue
|
||||||
|
path = Path(block.splitlines()[0].removeprefix("worktree "))
|
||||||
|
status = subprocess.check_output(["git", "-C", str(path), "status", "--porcelain"], text=True).strip()
|
||||||
|
handoff = path / "docs/HANDOFF.md"
|
||||||
|
print(f"WORKTREE {path}: {'CHANGES' if status else 'clean'}; handoff {'present' if handoff.is_file() and handoff.read_text().strip() else 'MISSING'}")
|
||||||
|
return 1 if collisions else 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Archive safe current-worktree source, including non-ignored untracked files."""
|
||||||
|
import datetime
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import zipfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
root = Path(sys.argv[1]).resolve()
|
||||||
|
deny_dirs = {".git", ".test-worktrees", "snapshots", "node_modules", ".venv", "venv", "__pycache__", "dist", "build", ".pytest_cache"}
|
||||||
|
deny_suffixes = (".db", ".sqlite", ".sqlite3", ".pem", ".key", ".p12", ".pfx")
|
||||||
|
|
||||||
|
|
||||||
|
def git(*args):
|
||||||
|
return subprocess.check_output(["git", "-C", str(root), *args], text=True).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def allowed(path):
|
||||||
|
parts = Path(path).parts
|
||||||
|
name = parts[-1]
|
||||||
|
return not (set(parts) & deny_dirs or any(p.startswith(".env") for p in parts) or name.endswith(deny_suffixes) or "credential" in name.lower() or "secret" in name.lower())
|
||||||
|
|
||||||
|
|
||||||
|
paths = subprocess.check_output(["git", "-C", str(root), "ls-files", "-co", "--exclude-standard", "-z"]).decode().split("\0")
|
||||||
|
selected = sorted({p for p in paths if p and allowed(p) and (root / p).is_file() and not (root / p).is_symlink()})
|
||||||
|
out_dir = root / "snapshots"
|
||||||
|
out_dir.mkdir(exist_ok=True)
|
||||||
|
stamp = datetime.datetime.now(datetime.timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
||||||
|
out = out_dir / f"{root.name}-chatgpt-{stamp}-{git('rev-parse', '--short', 'HEAD')}.zip"
|
||||||
|
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as archive:
|
||||||
|
for path in selected:
|
||||||
|
archive.write(root / path, path)
|
||||||
|
print(f"{out}\nbranch: {git('branch', '--show-current')}\nuncommitted: {bool(git('status', '--porcelain'))}\nfiles: {len(selected)}")
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||||
|
exec python3 "$repo/scripts/create-chatgpt-snapshot.py" "$repo"
|
||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
if [ "${1:-}" = "--help" ]; then
|
||||||
|
echo 'Usage: scripts/testtask.sh FORGE-F###'
|
||||||
|
echo 'Forge currently has no application runtime or manual-test hook.'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
case "${1:-}" in
|
||||||
|
FORGE-F[0-9][0-9][0-9]) ;;
|
||||||
|
*) echo 'Usage: scripts/testtask.sh FORGE-F###' >&2; exit 2 ;;
|
||||||
|
esac
|
||||||
|
echo 'testtask is provisioned but blocked: Forge has no application runtime or task-specific manual-test hook.' >&2
|
||||||
|
exit 3
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
name: bortstack-context
|
||||||
|
description: Manage project context, task lifecycle, isolated worktrees, design approvals, and safe handoffs in new or existing repositories.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Bortstack Context
|
||||||
|
|
||||||
|
Use this skill to bootstrap, reconcile, or operate a project context. It applies to business and personal projects across frameworks. The human project authority is Captain; Codex is Chief of Engineering. Contributor-specific authority belongs to `bortstack-contributor` when that skill is active. Existing `roborto-*` skills remain usable during migration; never remove or rewrite them as part of context adoption.
|
||||||
|
|
||||||
|
## Orientation and authority
|
||||||
|
|
||||||
|
Read repository `AGENTS.md`, `docs/PROJECT_OVERVIEW.md`, `docs/CURRENT_STATE.md`, `docs/DECISIONS.md`, `docs/TASKS.md`, and `docs/HANDOFF.md` before task work. Inspect actual code, Git status, branch, and worktrees. Code/configuration proves present behavior; maintained documents record intent; the human's latest explicit instruction controls changes. Report conflicts. Preserve existing context and uncommitted work.
|
||||||
|
|
||||||
|
Bootstrap missing records minimally and reconcile existing records without destructive replacement. Overview holds stable purpose and boundaries; current state holds verified facts and limitations; decisions hold accepted durable policy; tasks hold scope, acceptance, dependencies, and status; handoff holds the concise next action and exact candidate state. Never put secrets in these records.
|
||||||
|
|
||||||
|
## Task IDs and reconciliation
|
||||||
|
|
||||||
|
Use a project-specific prefix and sequential number for new tasks (for example `PI-042`). A repository may specify a historical convention such as `FORGE-F###`; retain it. Historical identifiers including `TASK-001` stay valid. Before importing or merging task records, inventory IDs in both sources with `scripts/context_audit.py` or an equivalent check, report any repeated identifier with its source locations, and pause that merge until the human resolves the collision. Do not silently renumber historical records. This is a local collision check, not a global allocator.
|
||||||
|
|
||||||
|
## Task lifecycle
|
||||||
|
|
||||||
|
Use the repository's accepted scope and authority. The shared states are **In Progress**, **Ready to Finalise**, **Ready for Review**, **Merged**, **Closed**, and **Blocked / Suspended**. A planned task is not authorised merely because its dependencies are ready. `lock on` briefs objective, scope, acceptance, dependencies, risks, validation, and unresolved decisions; `engage` implements the briefed accepted task. One accepted implementation task uses its own branch and separate worktree. Do not check the same branch out twice or switch another console's worktree.
|
||||||
|
|
||||||
|
Before starting another implementation task, audit active worktrees, changes, and handoffs. Previous work must be committed and submitted for review, integrated, or explicitly suspended with its exact state documented. Detect and report unfinished worktrees, uncommitted or untracked files, and missing or incomplete handoffs. Never automatically delete an unfinished worktree. An implementation passing automated tests is at most Ready to Finalise. Ready for Review requires the repository's review submission; Merged requires verified integration; Closed requires human acceptance and recorded cleanup. Blocked / Suspended preserves the branch, worktree, and resumption instructions. Commit, push, merge, rebase, reset, and deployment require repository-defined authority; do not infer it from `engage`.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Snapshots and validation
|
||||||
|
|
||||||
|
Context owns provisioning and maintenance of `scripts/create-chatgpt-snapshot.sh` and `scripts/testtask.sh` in enrolled repositories. Preserve functioning project-specific scripts. Read `references/snapshot-commands.md` before invoking, provisioning, or changing either. The ZIP shares the current working tree; `testtask` prepares an isolated exact-state manual-test candidate. They are distinct. A repository without an application runtime may provide a validated source snapshot but must report manual runtime testing as unavailable. Do not claim operational `testtask` based on a wrapper alone.
|
||||||
|
|
||||||
|
Run relevant checks, refresh a test candidate after edits, and document the exact branch/worktree, validation, limitations, and next human action in `HANDOFF.md`. Never mark a task Closed solely from tests, a snapshot, or a commit.
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# Snapshot command contract
|
||||||
|
|
||||||
|
Inspect repository scripts and `AGENTS.md` before use. Preserve a working local implementation.
|
||||||
|
|
||||||
|
`scripts/create-chatgpt-snapshot.sh` creates a portable ZIP from the **intended source worktree**, including staged, unstaged, and permitted untracked changes. It excludes Git metadata, test worktrees, old snapshots, dependencies, caches, builds, local databases, `.env*`, keys, and credentials. Audit archive contents before sharing. Report path, source branch, and uncommitted state.
|
||||||
|
|
||||||
|
`scripts/testtask.sh <repository-task-id>` prepares or invokes a disposable manual-test candidate for the given task. Determine supported arguments from the repository's script or `--help`. Its candidate must match the source branch's tracked changes and permitted untracked files without forcing a commit or checking the same branch out twice. A stale candidate must be refreshed after edits. Runtime startup, readiness, ports, and cleanup are project-specific. Missing engine or runtime means **provisioned but blocked**, not operational. Never delete unfinished work or unrelated containers.
|
||||||
|
|
||||||
|
For new projects, provision both entry points and adapt testtask to the actual stack. For retrofits, inspect and retain working scripts. Keep test artifacts out of Git. Record actual validation and remaining dependencies in handoff.
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
import zipfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
|
||||||
|
|
||||||
|
class ContextTests(unittest.TestCase):
|
||||||
|
def test_collision_preserves_legacy_ids(self):
|
||||||
|
with tempfile.TemporaryDirectory() as temp:
|
||||||
|
first, second = Path(temp) / "new.md", Path(temp) / "legacy.md"
|
||||||
|
first.write_text("## PI-042 — New\n## TASK-001 — Historical\n")
|
||||||
|
second.write_text("## PI-042 — Existing\n## FORGE-F001 — Forge\n")
|
||||||
|
result = subprocess.run(["python3", str(ROOT / "scripts/context_audit.py"), str(first), str(second)], capture_output=True, text=True)
|
||||||
|
self.assertEqual(result.returncode, 1)
|
||||||
|
self.assertIn("COLLISION PI-042", result.stdout)
|
||||||
|
self.assertNotIn("TASK-001", result.stdout)
|
||||||
|
self.assertNotIn("FORGE-F001", result.stdout)
|
||||||
|
|
||||||
|
def test_snapshot_includes_edits_and_excludes_local_data(self):
|
||||||
|
with tempfile.TemporaryDirectory() as temp:
|
||||||
|
repo = Path(temp)
|
||||||
|
subprocess.run(["git", "init", "-q", str(repo)], check=True)
|
||||||
|
(repo / "tracked.txt").write_text("old")
|
||||||
|
subprocess.run(["git", "-C", str(repo), "add", "tracked.txt"], check=True)
|
||||||
|
subprocess.run(["git", "-C", str(repo), "-c", "user.name=Test", "-c", "user.email=test@example.org", "commit", "-qm", "base"], check=True)
|
||||||
|
(repo / "tracked.txt").write_text("new")
|
||||||
|
(repo / "untracked.txt").write_text("safe")
|
||||||
|
(repo / ".env").write_text("private")
|
||||||
|
(repo / "snapshots").mkdir()
|
||||||
|
(repo / "snapshots/old.zip").write_text("old")
|
||||||
|
subprocess.run(["python3", str(ROOT / "scripts/create-chatgpt-snapshot.py"), str(repo)], check=True, capture_output=True)
|
||||||
|
with zipfile.ZipFile(next((repo / "snapshots").glob("*.zip"))) as archive:
|
||||||
|
self.assertEqual(archive.read("tracked.txt"), b"new")
|
||||||
|
self.assertEqual(archive.read("untracked.txt"), b"safe")
|
||||||
|
self.assertNotIn(".env", archive.namelist())
|
||||||
|
self.assertNotIn("snapshots/old.zip", archive.namelist())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in New Issue
Block a user