@jhizzard/termdeck 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ // Sprint 37 T2 — Shared template loader.
4
+ //
5
+ // `init-project.js` (T2) and the dashboard orchestration-preview endpoint (T3)
6
+ // both render the same set of project-scaffolding templates. This module is
7
+ // the single source of truth for where they live, what they're named, what
8
+ // dest path they map to inside a generated project tree, and how
9
+ // `{{placeholder}}` substitution works.
10
+ //
11
+ // Naming convention for templates in packages/cli/templates/:
12
+ // - Files are flat in this dir (no subdirs).
13
+ // - Subdirectory placement in the GENERATED project tree is encoded by a
14
+ // hyphenated prefix (e.g. `docs-orchestration-README.md.tmpl` lands at
15
+ // `docs/orchestration/README.md`). The MANIFEST below is the only
16
+ // authoritative source for those mappings — the `name` field is the
17
+ // human-readable identifier used in tests and UI, the `file` field is
18
+ // the on-disk template filename, and `targetPath` is the dest path
19
+ // RELATIVE to the project root.
20
+
21
+ const fs = require('fs');
22
+ const path = require('path');
23
+
24
+ const TEMPLATES_DIR = path.join(__dirname, '..', 'templates');
25
+
26
+ // The 8 templates that compose the project-scaffolding tree. Order is the
27
+ // order the init-project generator writes them and the order the dashboard
28
+ // preview surfaces them. T3 — iterate this directly via listTemplates().
29
+ const MANIFEST = [
30
+ { name: 'CLAUDE.md', file: 'CLAUDE.md.tmpl', targetPath: 'CLAUDE.md' },
31
+ { name: 'CONTRADICTIONS.md', file: 'CONTRADICTIONS.md.tmpl', targetPath: 'CONTRADICTIONS.md' },
32
+ { name: 'project_facts.md', file: 'project_facts.md.tmpl', targetPath: 'project_facts.md' },
33
+ { name: 'README.md', file: 'README.md.tmpl', targetPath: 'README.md' },
34
+ { name: 'docs/orchestration/README.md', file: 'docs-orchestration-README.md.tmpl', targetPath: path.join('docs', 'orchestration', 'README.md') },
35
+ { name: 'docs/orchestration/RESTART-PROMPT.md.tmpl', file: 'RESTART-PROMPT.md.tmpl', targetPath: path.join('docs', 'orchestration', 'RESTART-PROMPT.md.tmpl') },
36
+ { name: '.claude/settings.json', file: '.claude-settings.json.tmpl', targetPath: path.join('.claude', 'settings.json') },
37
+ { name: '.gitignore', file: '.gitignore.tmpl', targetPath: '.gitignore' },
38
+ ];
39
+
40
+ // name → manifest entry, for callers that want lookup by name (T3's preview UI).
41
+ const BY_NAME = Object.fromEntries(MANIFEST.map((e) => [e.name, e]));
42
+
43
+ // Replace {{key}} occurrences with vars[key]. Unknown keys are left untouched
44
+ // so a typo is visible in the output rather than silently rendering empty.
45
+ function renderString(source, vars) {
46
+ return source.replace(/\{\{(\w+)\}\}/g, (match, key) => {
47
+ if (Object.prototype.hasOwnProperty.call(vars, key)) return String(vars[key]);
48
+ return match;
49
+ });
50
+ }
51
+
52
+ // Resolve a caller-supplied identifier to a manifest entry. Accepts the
53
+ // human-readable `name` ('CLAUDE.md') OR the on-disk template filename
54
+ // ('CLAUDE.md.tmpl') so both conventions work from caller code.
55
+ function resolveEntry(identifier) {
56
+ const direct = BY_NAME[identifier];
57
+ if (direct) return direct;
58
+ const byFile = MANIFEST.find((e) => e.file === identifier);
59
+ if (byFile) return byFile;
60
+ throw new Error(`Unknown template: ${identifier}`);
61
+ }
62
+
63
+ function readTemplate(identifier) {
64
+ const entry = resolveEntry(identifier);
65
+ return fs.readFileSync(path.join(TEMPLATES_DIR, entry.file), 'utf8');
66
+ }
67
+
68
+ function renderTemplate(identifier, vars) {
69
+ return renderString(readTemplate(identifier), vars || {});
70
+ }
71
+
72
+ // Returns the manifest entries (cloned so callers can't mutate state).
73
+ function listTemplates() {
74
+ return MANIFEST.map((e) => ({ ...e }));
75
+ }
76
+
77
+ module.exports = {
78
+ TEMPLATES_DIR,
79
+ MANIFEST,
80
+ readTemplate,
81
+ renderTemplate,
82
+ listTemplates,
83
+ _renderString: renderString,
84
+ };
@@ -0,0 +1,32 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(ls:*)",
5
+ "Bash(cat:*)",
6
+ "Bash(pwd)",
7
+ "Bash(git status:*)",
8
+ "Bash(git diff:*)",
9
+ "Bash(git log:*)",
10
+ "Bash(git branch:*)",
11
+ "Bash(grep:*)",
12
+ "Bash(rg:*)",
13
+ "Bash(find:*)",
14
+ "Bash(wc:*)",
15
+ "Bash(head:*)",
16
+ "Bash(tail:*)",
17
+ "Bash(node --version)",
18
+ "Bash(npm --version)",
19
+ "Bash(npm view:*)",
20
+ "Bash(npm test:*)",
21
+ "Bash(npm run:*)",
22
+ "Bash(npm ls:*)",
23
+ "Read(//{{project_path}}/**)"
24
+ ],
25
+ "deny": [
26
+ "Bash(rm -rf:*)",
27
+ "Bash(git push --force:*)",
28
+ "Bash(git reset --hard:*)",
29
+ "Bash(npm publish:*)"
30
+ ]
31
+ }
32
+ }
@@ -0,0 +1,28 @@
1
+ # Node
2
+ node_modules/
3
+ npm-debug.log*
4
+ yarn-debug.log*
5
+ yarn-error.log*
6
+ .pnpm-debug.log*
7
+
8
+ # Env / secrets
9
+ .env
10
+ .env.local
11
+ .env.*.local
12
+
13
+ # Editor / OS
14
+ .DS_Store
15
+ .idea/
16
+ .vscode/
17
+ *.swp
18
+ *.swo
19
+
20
+ # TermDeck local state (per-session logs, sqlite)
21
+ .termdeck/
22
+
23
+ # Build / dist
24
+ dist/
25
+ build/
26
+ .next/
27
+ .turbo/
28
+ coverage/
@@ -0,0 +1,35 @@
1
+ # {{project_name}} — agent read-order
2
+
3
+ This is the project router for AI coding agents (Claude Code, Codex, etc.) working in `{{project_name}}`. It points at the rest of the docs in the order an agent should read them.
4
+
5
+ ## Before any task — read order
6
+
7
+ 1. **`memory_recall(project="{{project_name}}", query="<task topic>")`** — always first if a memory MCP is wired up.
8
+ 2. **`~/.claude/CLAUDE.md`** — your global rules (memory-first, time check, session-end rituals, message-inject mandates).
9
+ 3. **This file** — you already are.
10
+ 4. **`project_facts.md`** — stable facts about this project: paths, conventions, dependencies, deployment target.
11
+ 5. **`CONTRADICTIONS.md`** — audit trail of facts/decisions that have changed over time. If something here contradicts `project_facts.md`, the entry here is more recent.
12
+ 6. **`docs/orchestration/README.md`** — index of orchestration docs (4+1 sprint plans, restart prompts, etc.) if you're running multi-agent work.
13
+ 7. **The ONE task-doc that applies:**
14
+
15
+ | If you're going to... | Read |
16
+ |---|---|
17
+ | Add a feature, fix a bug, refactor | (project's own architecture doc, e.g. `docs/ARCHITECTURE.md` once you create it) |
18
+ | Ship a release | (project's own release doc, e.g. `docs/RELEASE.md` once you create it) |
19
+ | Run or coordinate a 4+1 sprint | `docs/orchestration/README.md` + active `docs/sprint-N-<name>/PLANNING.md` |
20
+
21
+ 8. **Then begin.**
22
+
23
+ ## Hard rules
24
+
25
+ - **Never publish or push to a shared branch without reading the project's release doc first** (if one exists). Publish-order, auth-method, and any audit-trail bumps are easy to get wrong from memory.
26
+ - **Inside a 4+1 sprint lane: no version bumps, no CHANGELOG edits, no commits.** The orchestrator handles those at sprint close.
27
+ - Add project-specific hard rules (language choices, build-step decisions, off-limits files) below this line as the project takes shape.
28
+
29
+ ## Current state pointer
30
+
31
+ For the live state of this project (versions, branches, deploy URLs), prefer `git log -1`, `npm view`, or whatever ground-truth source applies — over anything written here. This file is intentionally a pointer, not a source of truth.
32
+
33
+ ---
34
+
35
+ _Generated by `termdeck init --project` on {{generated_at}} (TermDeck v{{termdeck_version}})._
@@ -0,0 +1,30 @@
1
+ # {{project_name}} — Contradictions ledger
2
+
3
+ Append-only record of facts and decisions in this project that have **changed** over time. The most recent entry on a topic is the current truth. Older entries are kept for the trail, not for reference.
4
+
5
+ ## Why this file exists
6
+
7
+ Memory systems (and humans) accumulate stale beliefs. When an agent reads `project_facts.md` and acts on something that's no longer true, the failure mode is silent — the wrong code ships, the wrong link gets sent, the wrong assumption hardens. This ledger is the place to record the *correction* the moment a fact flips, so the next session can compare.
8
+
9
+ ## How to use this file
10
+
11
+ When you discover that a previously-recorded fact is wrong (in `project_facts.md`, in a memory store, in your own assumptions), append an entry below. Keep the old fact visible — don't rewrite history.
12
+
13
+ ## Entry format
14
+
15
+ ```
16
+ ## YYYY-MM-DD — <one-line topic>
17
+
18
+ **Old:** <what we used to believe>
19
+ **New:** <what's true now>
20
+ **Why it changed:** <discovery, decision, external change>
21
+ **Where the old belief lives:** <file/path/memory-id, so future sessions know what to also update>
22
+ ```
23
+
24
+ ---
25
+
26
+ _(no entries yet — append above this line as contradictions surface)_
27
+
28
+ ---
29
+
30
+ _Generated by `termdeck init --project` on {{generated_at}} (TermDeck v{{termdeck_version}})._
@@ -0,0 +1,15 @@
1
+ # {{project_name}}
2
+
3
+ _(One-line description of this project goes here.)_
4
+
5
+ ## For humans
6
+
7
+ _(Quickstart, install, usage. Edit this section as the project takes shape.)_
8
+
9
+ ## For AI agents
10
+
11
+ Read **`CLAUDE.md`** first. It's the agent read-order: which docs to read in which order before doing any work in this repo.
12
+
13
+ ---
14
+
15
+ _Scaffolded with TermDeck v{{termdeck_version}} on {{generated_at}}._
@@ -0,0 +1,38 @@
1
+ # {{project_name}} — Restart prompt template
2
+
3
+ Copy this file to `RESTART-PROMPT-YYYY-MM-DD.md` at the end of a session, fill in the blanks, and the next agent will be able to resume cleanly by reading just this one document.
4
+
5
+ ---
6
+
7
+ You are picking up work on **{{project_name}}** at `{{project_path}}`.
8
+
9
+ ## Boot sequence
10
+
11
+ 1. `memory_recall(project="{{project_name}}", query="<topic the user signaled at session start>")` — if a memory MCP is wired up.
12
+ 2. `memory_recall(query="recent decisions and bugs")` — broader context across all projects.
13
+ 3. Read `~/.claude/CLAUDE.md` (global rules).
14
+ 4. Read `{{project_path}}/CLAUDE.md` (this project's read-order).
15
+ 5. Read `{{project_path}}/project_facts.md` and `{{project_path}}/CONTRADICTIONS.md`.
16
+ 6. Read this file in full (the rest of the sections below).
17
+ 7. Then begin.
18
+
19
+ ## What was done in the last session
20
+
21
+ _(Bullet list. Concrete items: files changed, decisions locked, versions shipped, bugs fixed. No fluff.)_
22
+
23
+ ## What is queued next
24
+
25
+ _(What the next session should pick up. The smaller and more concrete, the better.)_
26
+
27
+ ## Open follow-ups / known issues
28
+
29
+ _(Things deliberately deferred, things flagged as broken, anything the next session should be aware of before touching related code.)_
30
+
31
+ ## Where to find more context
32
+
33
+ - `{{project_path}}/docs/orchestration/` — sprint plans, restart prompts.
34
+ - _(Add: links to relevant tickets, dashboards, deploy URLs.)_
35
+
36
+ ---
37
+
38
+ _Template generated by `termdeck init --project` on {{generated_at}} (TermDeck v{{termdeck_version}})._
@@ -0,0 +1,29 @@
1
+ # {{project_name}} — Orchestration docs
2
+
3
+ This directory holds the artifacts of multi-agent orchestration work in `{{project_name}}` — primarily 4+1 sprint plans and restart prompts.
4
+
5
+ ## What lives here
6
+
7
+ - **`RESTART-PROMPT.md.tmpl`** — template for per-session restart prompts. Copy to `RESTART-PROMPT-YYYY-MM-DD.md` at the end of a session; the next agent reads the latest dated restart prompt to pick up where you left off.
8
+ - **`sprint-N-<name>/PLANNING.md`** _(when sprints exist)_ — the single source of truth for what a sprint is doing, divided into T1–T4 lane briefings.
9
+ - **`sprint-N-<name>/STATUS.md`** _(when sprints exist)_ — append-only status log. Each lane posts FINDING / FIX-PROPOSED / DONE entries.
10
+ - **`sprint-N-<name>/T<n>-<lane>.md`** _(when sprints exist)_ — full briefing for one lane.
11
+
12
+ ## The 4+1 sprint pattern (short version)
13
+
14
+ Four parallel agent panels (T1–T4) each work in a single lane (a tightly scoped set of files). A fifth orchestrator panel coordinates: spawns the four, monitors STATUS.md, handles version bumps + CHANGELOG + commits at sprint close.
15
+
16
+ Lane discipline matters:
17
+ - T1–T4 stay in their lane. No version bumps, no CHANGELOG edits, no commits inside a lane.
18
+ - All cross-lane communication happens through `STATUS.md` (append-only).
19
+ - The orchestrator is the only panel that ships.
20
+
21
+ If you're running TermDeck, the orchestrator can spawn and inject the four panels through the dashboard sprint runner. If you're not, the orchestrator manually opens four terminals and pastes (or scripts) the boot prompts.
22
+
23
+ ## Restart prompts
24
+
25
+ At the end of every working session, write a `RESTART-PROMPT-YYYY-MM-DD.md` containing exactly what the next session needs to read (in order) to resume cleanly. The template here is a starting point — adapt as the project gets specific.
26
+
27
+ ---
28
+
29
+ _Generated by `termdeck init --project` on {{generated_at}} (TermDeck v{{termdeck_version}})._
@@ -0,0 +1,39 @@
1
+ # {{project_name}} — Project facts
2
+
3
+ Stable, slow-changing facts about this project. The kind of thing an agent needs to know up front to avoid asking obvious questions or making bad assumptions.
4
+
5
+ If a fact here goes stale, do **not** silently rewrite it. Append to `CONTRADICTIONS.md` first (so the change is recorded), then update this file.
6
+
7
+ ## Identity
8
+
9
+ - **Name:** {{project_name}}
10
+ - **Path:** `{{project_path}}`
11
+ - **Created:** {{generated_at}}
12
+ - **Scaffolded with:** TermDeck v{{termdeck_version}}
13
+
14
+ ## Stack
15
+
16
+ - **Language / runtime:** _(fill in once chosen)_
17
+ - **Package manager:** _(npm, pnpm, uv, cargo, etc.)_
18
+ - **Test runner:** _(node:test, vitest, pytest, etc.)_
19
+ - **Linter / formatter:** _(eslint, ruff, etc.)_
20
+
21
+ ## Deployment
22
+
23
+ - **Target:** _(npm, Vercel, Supabase Edge, self-hosted, internal-only, etc.)_
24
+ - **Current live version:** _(see `git log` / `npm view` / deploy dashboard for ground truth)_
25
+
26
+ ## Conventions
27
+
28
+ - **Branching:** _(trunk-based, feature branches, etc.)_
29
+ - **Commit style:** _(conventional commits, free-form, etc.)_
30
+ - **Sprint pattern:** _(if running 4+1 sprints, point at `docs/orchestration/`)_
31
+ - **Release process:** _(point at `docs/RELEASE.md` if/when one exists)_
32
+
33
+ ## Off-limits / be-careful zones
34
+
35
+ - _(list any files, branches, or systems that need extra caution — e.g. "production database is shared with X")_
36
+
37
+ ---
38
+
39
+ _Generated by `termdeck init --project` on {{generated_at}} (TermDeck v{{termdeck_version}})._