Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aaf6bbfb04 |
@@ -1,80 +0,0 @@
|
|||||||
---
|
|
||||||
name: beads
|
|
||||||
description: Use when working in a repository that uses bd or Beads for durable project task tracking, issue dependencies, blocker management, multi-session handoff, or shared work memory. Trigger when the user asks to find ready work, claim or close tasks, create follow-up work, inspect blockers, recover project context, or choose between local planning and persistent project tracking.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Beads
|
|
||||||
|
|
||||||
Use Beads as the shared project task system. Local plans, scratch files, and personal memories are useful, but they are not the durable source of truth for project work.
|
|
||||||
|
|
||||||
## First Step
|
|
||||||
|
|
||||||
Run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd prime
|
|
||||||
```
|
|
||||||
|
|
||||||
If that prints nothing, check whether the repository has an active Beads workspace:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd where
|
|
||||||
```
|
|
||||||
|
|
||||||
## Preferred Route
|
|
||||||
|
|
||||||
Use the `bd` CLI when shell access is available. It is the most compact and direct Beads interface.
|
|
||||||
|
|
||||||
## Core CLI Workflow
|
|
||||||
|
|
||||||
1. Find work:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd ready
|
|
||||||
bd list --status=open
|
|
||||||
bd list --status=in_progress
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Inspect before editing:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd show <id>
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Claim work atomically:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd update <id> --claim
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Create durable follow-up work when implementation reveals new tasks:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd create "Short title" --description="Why this exists and what needs to be done" --type=task --priority=2
|
|
||||||
```
|
|
||||||
|
|
||||||
5. Close completed work:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd close <id> --reason="Completed"
|
|
||||||
```
|
|
||||||
|
|
||||||
## What Belongs In Beads
|
|
||||||
|
|
||||||
Use Beads for:
|
|
||||||
|
|
||||||
- shared project tasks
|
|
||||||
- blockers and dependencies
|
|
||||||
- discovered follow-up work
|
|
||||||
- work that must survive thread reset, compaction, or handoff
|
|
||||||
- status that another person or agent should be able to resume
|
|
||||||
|
|
||||||
Use agent-local planning tools only for the current turn's execution checklist. Do not treat them as shared project state.
|
|
||||||
|
|
||||||
## Rules
|
|
||||||
|
|
||||||
- Do not create markdown TODO files as the source of truth when Beads is available.
|
|
||||||
- Do not use `bd edit`; it opens an interactive editor. Use `bd update` flags instead.
|
|
||||||
- Prefer `--json` when parsing `bd` output programmatically.
|
|
||||||
- If hooks are installed, `bd prime` may already be injected. Run it manually when context is missing.
|
|
||||||
- Do not auto-close or mutate tasks unless the work is actually complete.
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "Beads"
|
|
||||||
short_description: "Project task tracking with bd"
|
|
||||||
default_prompt: "Use $beads to inspect ready work and manage durable project tasks."
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
# Dolt database (managed by Dolt, not git)
|
|
||||||
dolt/
|
|
||||||
embeddeddolt/
|
|
||||||
proxieddb/
|
|
||||||
|
|
||||||
# Runtime files
|
|
||||||
bd.sock
|
|
||||||
bd.sock.startlock
|
|
||||||
sync-state.json
|
|
||||||
last-touched
|
|
||||||
.exclusive-lock
|
|
||||||
|
|
||||||
# Daemon runtime (lock, log, pid)
|
|
||||||
daemon.*
|
|
||||||
|
|
||||||
# Push state (runtime, per-machine)
|
|
||||||
push-state.json
|
|
||||||
|
|
||||||
# Lock files (various runtime locks)
|
|
||||||
*.lock
|
|
||||||
|
|
||||||
# Credential key (encryption key for federation peer auth — never commit)
|
|
||||||
.beads-credential-key
|
|
||||||
|
|
||||||
# Local version tracking (prevents upgrade notification spam after git ops)
|
|
||||||
.local_version
|
|
||||||
|
|
||||||
proxied_server_client_info.json
|
|
||||||
|
|
||||||
# Worktree redirect file (contains relative path to main repo's .beads/)
|
|
||||||
# Must not be committed as paths would be wrong in other clones
|
|
||||||
redirect
|
|
||||||
|
|
||||||
# Sync state (local-only, per-machine)
|
|
||||||
# These files are machine-specific and should not be shared across clones
|
|
||||||
.sync.lock
|
|
||||||
export-state/
|
|
||||||
export-state.json
|
|
||||||
last_pull
|
|
||||||
|
|
||||||
# Ephemeral store (SQLite - wisps/molecules, intentionally not versioned)
|
|
||||||
ephemeral.sqlite3
|
|
||||||
ephemeral.sqlite3-journal
|
|
||||||
ephemeral.sqlite3-wal
|
|
||||||
ephemeral.sqlite3-shm
|
|
||||||
|
|
||||||
# Dolt server management (auto-started by bd)
|
|
||||||
dolt-server.pid
|
|
||||||
dolt-server.log
|
|
||||||
dolt-server.lock
|
|
||||||
dolt-server.port
|
|
||||||
dolt-server.activity
|
|
||||||
|
|
||||||
# Debug-mode pprof artifacts (written when dolt.debug: true in config.yaml)
|
|
||||||
dolt-pprof/
|
|
||||||
|
|
||||||
# Corrupt backup directories (created by bd doctor --fix recovery)
|
|
||||||
*.corrupt.backup/
|
|
||||||
|
|
||||||
# Backup data (auto-exported JSONL, local-only)
|
|
||||||
backup/
|
|
||||||
|
|
||||||
# Per-project environment file (Dolt connection config, GH#2520)
|
|
||||||
.env
|
|
||||||
|
|
||||||
# Legacy files (from pre-Dolt versions)
|
|
||||||
*.db
|
|
||||||
*.db?*
|
|
||||||
*.db-journal
|
|
||||||
*.db-wal
|
|
||||||
*.db-shm
|
|
||||||
db.sqlite
|
|
||||||
bd.db
|
|
||||||
# NOTE: Do NOT add negation patterns here.
|
|
||||||
# They would override fork protection in .git/info/exclude.
|
|
||||||
# Config files (metadata.json, config.yaml) are tracked by git by default
|
|
||||||
# since no pattern above ignores them.
|
|
||||||
|
|
||||||
# Added by bd (missing required patterns)
|
|
||||||
*.gate.lock*
|
|
||||||
dolt-server-config.yaml
|
|
||||||
http_target.json
|
|
||||||
http_local_metadata.json
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
# Beads - AI-Native Issue Tracking
|
|
||||||
|
|
||||||
Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
|
|
||||||
|
|
||||||
## What is Beads?
|
|
||||||
|
|
||||||
Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
|
|
||||||
|
|
||||||
**Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
### Essential Commands
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create new issues
|
|
||||||
bd create "Add user authentication"
|
|
||||||
|
|
||||||
# View all issues
|
|
||||||
bd list
|
|
||||||
|
|
||||||
# View issue details
|
|
||||||
bd show <issue-id>
|
|
||||||
|
|
||||||
# Update issue status
|
|
||||||
bd update <issue-id> --claim
|
|
||||||
bd update <issue-id> --status done
|
|
||||||
|
|
||||||
# Sync with Dolt remote
|
|
||||||
bd dolt push
|
|
||||||
```
|
|
||||||
|
|
||||||
### Working with Issues
|
|
||||||
|
|
||||||
Issues in Beads are:
|
|
||||||
- **Git-native**: Stored in Dolt database with version control and branching
|
|
||||||
- **AI-friendly**: CLI-first design works perfectly with AI coding agents
|
|
||||||
- **Branch-aware**: Issues can follow your branch workflow
|
|
||||||
- **Sync-ready**: Uses Dolt remotes for backup and team sharing
|
|
||||||
|
|
||||||
## Why Beads?
|
|
||||||
|
|
||||||
✨ **AI-Native Design**
|
|
||||||
- Built specifically for AI-assisted development workflows
|
|
||||||
- CLI-first interface works seamlessly with AI coding agents
|
|
||||||
- No context switching to web UIs
|
|
||||||
|
|
||||||
🚀 **Developer Focused**
|
|
||||||
- Issues live in your repo, right next to your code
|
|
||||||
- Works offline, syncs when you push
|
|
||||||
- Fast, lightweight, and stays out of your way
|
|
||||||
|
|
||||||
🔧 **Git Integration**
|
|
||||||
- Dolt-native sync via bd dolt push / bd dolt pull
|
|
||||||
- Branch-aware issue tracking
|
|
||||||
- Dolt-native three-way merge resolution
|
|
||||||
|
|
||||||
## Get Started with Beads
|
|
||||||
|
|
||||||
Try Beads in your own projects:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install Beads
|
|
||||||
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
|
|
||||||
|
|
||||||
# Initialize in your repo
|
|
||||||
bd init
|
|
||||||
|
|
||||||
# Create your first issue
|
|
||||||
bd create "Try out Beads"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Learn More
|
|
||||||
|
|
||||||
- **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
|
|
||||||
- **Quick Start Guide**: Run `bd quickstart`
|
|
||||||
- **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
*Beads: Issue tracking that moves at the speed of thought* ⚡
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
# Beads Configuration File
|
|
||||||
# This file configures default behavior for all bd commands in this repository
|
|
||||||
# All settings can also be set via environment variables (BD_* prefix)
|
|
||||||
# or overridden with command-line flags
|
|
||||||
|
|
||||||
# Issue prefix for this repository (used by bd init)
|
|
||||||
# If not set, bd init will auto-detect from directory name
|
|
||||||
# Example: issue-prefix: "myproject" creates issues like "myproject-1", "myproject-2", etc.
|
|
||||||
# issue-prefix: ""
|
|
||||||
|
|
||||||
# Use no-db mode: JSONL-only, no Dolt database
|
|
||||||
# When true, .beads/issues.jsonl is the only local store
|
|
||||||
# no-db: false
|
|
||||||
|
|
||||||
# Enable JSON output by default
|
|
||||||
# json: false
|
|
||||||
|
|
||||||
# Feedback title formatting for mutating commands (create/update/close/dep/edit)
|
|
||||||
# 0 = hide titles, N > 0 = truncate to N characters
|
|
||||||
# output:
|
|
||||||
# title-length: 255
|
|
||||||
|
|
||||||
# Default actor for audit trails (overridden by BEADS_ACTOR or --actor)
|
|
||||||
# actor: ""
|
|
||||||
|
|
||||||
# Export events (audit trail) to .beads/events.jsonl on each flush/sync
|
|
||||||
# When enabled, new events are appended incrementally using a high-water mark.
|
|
||||||
# Use 'bd export --events' to trigger manually regardless of this setting.
|
|
||||||
# events-export: false
|
|
||||||
|
|
||||||
# Multi-repo configuration (experimental - bd-307)
|
|
||||||
# Allows hydrating from multiple repositories and routing writes to the correct database
|
|
||||||
# repos:
|
|
||||||
# primary: "." # Primary repo (where this database lives)
|
|
||||||
# additional: # Additional repos to hydrate from (read-only)
|
|
||||||
# - ~/beads-planning # Personal planning repo
|
|
||||||
# - ~/work-planning # Work planning repo
|
|
||||||
|
|
||||||
# Dolt-native backup (periodic backup for off-machine recovery)
|
|
||||||
# This is full database backup only. Cross-machine sync uses Dolt remotes.
|
|
||||||
# backup:
|
|
||||||
# enabled: false # Disable auto-backup entirely
|
|
||||||
# interval: 15m # Minimum time between auto-backups
|
|
||||||
# git-push: false # Disable git push (backup locally only)
|
|
||||||
# git-repo: "" # Separate git repo for backups (default: project repo)
|
|
||||||
|
|
||||||
# Optional JSONL auto-export for viewers, interchange, and issue-level migration.
|
|
||||||
# Disabled by default; enable only when an integration needs fresh .beads/issues.jsonl.
|
|
||||||
# Use relative paths under .beads/ for JSONL import/export filenames.
|
|
||||||
# export:
|
|
||||||
# auto: false
|
|
||||||
# path: issues.jsonl
|
|
||||||
# interval: 60s
|
|
||||||
# git-add: false
|
|
||||||
# import:
|
|
||||||
# path: issues.jsonl
|
|
||||||
|
|
||||||
# Integration settings (access with 'bd config get/set')
|
|
||||||
# Non-secret keys (stored in the database):
|
|
||||||
# - jira.url, jira.project
|
|
||||||
# - linear.team_id
|
|
||||||
# - github.org, github.repo
|
|
||||||
#
|
|
||||||
# Secret keys (stored in this file but prefer env vars to avoid git exposure):
|
|
||||||
# - linear.api_key → use LINEAR_API_KEY env var instead
|
|
||||||
# - github.token → use GITHUB_TOKEN env var instead
|
|
||||||
|
|
||||||
sync.remote: "git+ssh://gitea@git.az-gruppe.com/AZ-Intec-GmbH/az-agent-defaults.git"
|
|
||||||
export:
|
|
||||||
auto: true
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
|
||||||
# This section is managed by beads. Do not remove these markers.
|
|
||||||
if command -v bd >/dev/null 2>&1; then
|
|
||||||
export BD_GIT_HOOK=1
|
|
||||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
|
||||||
_bd_used_perl=0
|
|
||||||
if command -v timeout >/dev/null 2>&1; then
|
|
||||||
timeout "$_bd_timeout" bd hooks run post-checkout "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v gtimeout >/dev/null 2>&1; then
|
|
||||||
gtimeout "$_bd_timeout" bd hooks run post-checkout "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v perl >/dev/null 2>&1; then
|
|
||||||
_bd_used_perl=1
|
|
||||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run post-checkout "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
else
|
|
||||||
echo >&2 "beads: hook 'post-checkout' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
|
||||||
bd hooks run post-checkout "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
|
||||||
echo >&2 "beads: hook 'post-checkout' timed out after ${_bd_timeout}s — continuing without beads"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 3 ]; then
|
|
||||||
echo >&2 "beads: database not initialized — skipping hook 'post-checkout'"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
|
||||||
fi
|
|
||||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
|
||||||
# This section is managed by beads. Do not remove these markers.
|
|
||||||
if command -v bd >/dev/null 2>&1; then
|
|
||||||
export BD_GIT_HOOK=1
|
|
||||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
|
||||||
_bd_used_perl=0
|
|
||||||
if command -v timeout >/dev/null 2>&1; then
|
|
||||||
timeout "$_bd_timeout" bd hooks run post-merge "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v gtimeout >/dev/null 2>&1; then
|
|
||||||
gtimeout "$_bd_timeout" bd hooks run post-merge "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v perl >/dev/null 2>&1; then
|
|
||||||
_bd_used_perl=1
|
|
||||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run post-merge "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
else
|
|
||||||
echo >&2 "beads: hook 'post-merge' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
|
||||||
bd hooks run post-merge "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
|
||||||
echo >&2 "beads: hook 'post-merge' timed out after ${_bd_timeout}s — continuing without beads"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 3 ]; then
|
|
||||||
echo >&2 "beads: database not initialized — skipping hook 'post-merge'"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
|
||||||
fi
|
|
||||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
|
||||||
# This section is managed by beads. Do not remove these markers.
|
|
||||||
if command -v bd >/dev/null 2>&1; then
|
|
||||||
export BD_GIT_HOOK=1
|
|
||||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
|
||||||
_bd_used_perl=0
|
|
||||||
if command -v timeout >/dev/null 2>&1; then
|
|
||||||
timeout "$_bd_timeout" bd hooks run pre-commit "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v gtimeout >/dev/null 2>&1; then
|
|
||||||
gtimeout "$_bd_timeout" bd hooks run pre-commit "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v perl >/dev/null 2>&1; then
|
|
||||||
_bd_used_perl=1
|
|
||||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run pre-commit "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
else
|
|
||||||
echo >&2 "beads: hook 'pre-commit' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
|
||||||
bd hooks run pre-commit "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
|
||||||
echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 3 ]; then
|
|
||||||
echo >&2 "beads: database not initialized — skipping hook 'pre-commit'"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
|
||||||
fi
|
|
||||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
|
||||||
# This section is managed by beads. Do not remove these markers.
|
|
||||||
if command -v bd >/dev/null 2>&1; then
|
|
||||||
export BD_GIT_HOOK=1
|
|
||||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
|
||||||
_bd_used_perl=0
|
|
||||||
if command -v timeout >/dev/null 2>&1; then
|
|
||||||
timeout "$_bd_timeout" bd hooks run pre-push "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v gtimeout >/dev/null 2>&1; then
|
|
||||||
gtimeout "$_bd_timeout" bd hooks run pre-push "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v perl >/dev/null 2>&1; then
|
|
||||||
_bd_used_perl=1
|
|
||||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run pre-push "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
else
|
|
||||||
echo >&2 "beads: hook 'pre-push' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
|
||||||
bd hooks run pre-push "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
|
||||||
echo >&2 "beads: hook 'pre-push' timed out after ${_bd_timeout}s — continuing without beads"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 3 ]; then
|
|
||||||
echo >&2 "beads: database not initialized — skipping hook 'pre-push'"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
|
||||||
fi
|
|
||||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
# --- BEGIN BEADS INTEGRATION v1.2.2 ---
|
|
||||||
# This section is managed by beads. Do not remove these markers.
|
|
||||||
if command -v bd >/dev/null 2>&1; then
|
|
||||||
export BD_GIT_HOOK=1
|
|
||||||
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
|
|
||||||
_bd_used_perl=0
|
|
||||||
if command -v timeout >/dev/null 2>&1; then
|
|
||||||
timeout "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v gtimeout >/dev/null 2>&1; then
|
|
||||||
gtimeout "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
elif command -v perl >/dev/null 2>&1; then
|
|
||||||
_bd_used_perl=1
|
|
||||||
perl -e 'alarm shift; exec @ARGV' "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
else
|
|
||||||
echo >&2 "beads: hook 'prepare-commit-msg' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
|
|
||||||
bd hooks run prepare-commit-msg "$@"
|
|
||||||
_bd_exit=$?
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 124 ] || { [ $_bd_used_perl -eq 1 ] && [ $_bd_exit -eq 142 ]; }; then
|
|
||||||
echo >&2 "beads: hook 'prepare-commit-msg' timed out after ${_bd_timeout}s — continuing without beads"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -eq 3 ]; then
|
|
||||||
echo >&2 "beads: database not initialized — skipping hook 'prepare-commit-msg'"
|
|
||||||
_bd_exit=0
|
|
||||||
fi
|
|
||||||
if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
|
|
||||||
fi
|
|
||||||
# --- END BEADS INTEGRATION v1.2.2 ---
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{"id":"int-97b8d2f545bb01e5a71868be1b46d3e6","kind":"field_change","created_at":"2026-08-22T08:02:44.467228132Z","actor":"m3tam3re","issue_id":"az-agent-defaults-j35","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
|
|
||||||
{"id":"int-1aeab5fae03f5d2b4cb699d7c50ee4d6","kind":"field_change","created_at":"2026-08-22T08:09:02.302617707Z","actor":"m3tam3re","issue_id":"az-agent-defaults-dzx","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Skills-Slice umgesetzt: ow-hello aus az-agent-skills nach skills/ migriert (einzige Abweichung: Repo-Erwähnung L15 → az-agent-defaults); 5 ungültige Skill-Fixtures unter tests/fixtures/skills/invalid/ (ordner-ohne-skill-md, ohne-frontmatter, leeres-frontmatter, name-ungleich-ordner, ohne-description) — decken alle im README dokumentierten Skill-Guard-Fehlertypen ab, jede Fixture failt exakt eine Regel; alle 4 Akzeptanzkriterien per Skript verifiziert (15/15 PASS); .gitkeep-Platzhalter entfernt."}}
|
|
||||||
{"id":"int-ac8b30c7c6b2fe206a89b0c552ae062e","kind":"field_change","created_at":"2026-08-22T08:13:39.665260198Z","actor":"m3tam3re","issue_id":"az-agent-defaults-1ub","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"ow-hello entfernt; az-hilfe als Onboarding-/Hilfe-Skill (Entwurf) angelegt — Router-Prinzip wie ask-matt: vier Artefakt-Typen erklärt, typische Anfragen mit Antwortmustern, Beitragsweg (IT/Repo), Problemeskalation; ehrlicher Ausbaustand (Commands/Agents/MCP als in Vorbereitung). Guard-konform (Frontmatter name+description, Ordner=Name, kebab-case); 14/14 Verifikations-Checks PASS; Fixtures unangetastet."}}
|
|
||||||
{"id":"int-54c0cf201b8798d92c63b4f62961a35c","kind":"field_change","created_at":"2026-08-22T08:21:22.416435535Z","actor":"m3tam3re","issue_id":"az-agent-defaults-gj1","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Referenz-Command commands/az-hilfe.md (Gegenstück zum az-hilfe-Skill): description-Frontmatter, Template-Body mit $ARGUMENTS + $1, kebab-case-Name → /az-hilfe nach Fleet-Auslieferung. 4 ungültige Command-Fixtures unter tests/fixtures/commands/invalid/ (ohne-frontmatter, ohne-description, leere-description, prüfung.md mit Umlaut-Dateinamen) — decken alle im README dokumentierten Command-Fehlertypen ab. 17/17 Verifikations-Checks PASS."}}
|
|
||||||
{"id":"int-b9f609bf4e7919bc55e05a91fc48031a","kind":"field_change","created_at":"2026-08-22T08:26:44.636891703Z","actor":"m3tam3re","issue_id":"az-agent-defaults-gyj","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Zwei Referenz-Agenten in agents/: az-beitrag (mode: primary, ohne tools-Restriction — Delegationsfähigkeit intakt, Body betont Managed-Layer-Grenze, delegiert aktiv an az-pruefer) + az-pruefer (mode: subagent, Read-only-Profil tools: [read, glob, grep] ohne Edit/Bash, per @mention/Task-Tool erreichbar). 3 ungültige Agent-Fixtures (ohne-mode, ohne-description, ungueltiger-mode) — alle README-dokumentierten Fehlertypen. 19/19 Checks PASS (1 Regex-Bug im Prüfscript korrigiert nachgewiesen)."}}
|
|
||||||
{"id":"int-e238d838ca96426519d9763427e5ce30","kind":"field_change","created_at":"2026-08-22T08:26:44.863883113Z","actor":"m3tam3re","issue_id":"az-agent-defaults-95y","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"README um Vault-Key-Namensschema (<server-name>-<verwendungszweck>, kebab-case) + Key-Ausnahme-Beispiel ergänzt (Format selbst war seit Scaffold dokumentiert). Zwei Referenz-Fragmente in mcp/: zugferd-service.yaml (OAuth-Standardfall, kein Credential-Feld) + az-zoll-service.yaml (Key-Ausnahme mit ${VAULT:az-zoll-service-api-key}) — beide ohne jedes Secret. 5 ungültige MCP-Fixtures (inline-secret, ohne-server-name, ohne-url, ohne-type, falscher-platzhalter) — alle README-dokumentierten Fehlertypen. 17/17 Checks PASS."}}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{"_type":"issue","id":"az-agent-defaults-j35","title":"Repo-Gerüst: vier Artefakt-Verzeichnisse + README mit Guard-Regeln je Artefakt-Typ","description":"Quelle: Spec 01-az-agent-defaults-spec.md (lokal, wird nicht gepusht).\n\naz-agent-defaults wird als reines Content-Repo die eine Wahrheitsquelle für das Company-Default-Set. Dieses Ticket liefert das Gerüst: die vier Artefakt-Verzeichnisse (skills/, commands/, agents/, mcp/) und ein README, das die Contribution-Guard-Regeln je Artefakt-Typ so dokumentiert, dass ein Fachbereichs-Contributor ohne Architektur-Wissen richtig beisteuern kann:\n\n- Skills: Ordner mit SKILL.md und Frontmatter-Öffner (wie heute)\n- Commands: Markdown mit Frontmatter (description, optional agent/model) und Template-Body (Argument-Platzhalter erlaubt)\n- Agents: Markdown mit Frontmatter (description, mode primary/subagent, optional model/temperature, Permission-Profil); Subagent-Definitionen müssen über das Task-Tool aufrufbar bleiben\n- MCP: Fragmente für den mcp-Konfigurationsschlüssel, remote/streamable als Standard, Secrets grundsätzlich nur als Platzhalter\n\nDas README hält außerdem fest: Auslieferung und Guard-Engine (Pre-Flight auf dem Controller) leben im Fleet-Repo az-fleet; dieses Repo ist Content-only und über den Repo-Ref pinbar (Default: main). Zudem die Fixtures-Konvention: Testgegenstände für die Guard-Tests leben unter tests/fixtures/ und werden nie ausgeliefert, weil die Delivery-Rolle nur die vier Typ-Verzeichnisse liest (Sonntags-Entscheidung). Das Repo verabschiedet damit den Namen az-agent-skills (User Story 2).","acceptance_criteria":"- Die vier Artefakt-Verzeichnisse skills/, commands/, agents/, mcp/ sind im Repo angelegt\n- README dokumentiert die Guard-Regeln je Artefakt-Typ vollständig (Struktur-/Frontmatter-/Platzhalter-Anforderungen gemäß Spec B1)\n- README erklärt die Content/Mechanismus-Trennung zu az-fleet (Guard-Engine und Auslieferung dort) und das Ref-Pinning\n- Die Fixtures-Konvention tests/fixtures/ ist dokumentiert (nie ausgeliefert; Begründung: Delivery liest nur die vier Typ-Verzeichnisse)\n- Ein Contributor ohne Architektur-Wissen kann anhand des README allein entscheiden, wohin ein neues Artefakt gehört und ob es die Guard-Regeln erfüllt","status":"closed","priority":1,"issue_type":"task","assignee":"m3tam3re","owner":"p@m3ta.dev","created_at":"2026-08-22T07:57:14Z","created_by":"m3tam3re","updated_at":"2026-08-22T08:02:44Z","started_at":"2026-08-22T07:59:36Z","closed_at":"2026-08-22T08:02:44Z","close_reason":"Closed","labels":["ready-for-agent"],"dependency_count":0,"dependent_count":4,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-64g","title":"az-fleet: Labels in agent-lib-Config schreiben, Guard, ADR-0020 (Profile-Rollout-Branch)","description":"Gehört ins Repo az-fleet (dort kein lokaler Checkout auf AZLT99 — hier als Merkposten). Abhängig von agent-lib Issue agent_lib-fh4 (Release mit Label-Feature).\n\nAuf Branch profile-rollout:\n- roles/agent_lib/tasks/config.yml: 'labels': fleet_user_roles[primary_user] in config.json (Wert kommt aus dept_* + fleet_extra_roles).\n- fleet_pins: agent-lib-Version mit Label-Feature.\n- default_set_delivery: Guard — jedes Label in agent-lib.labels.json ist bekannte Abteilung (dept_*) oder Zusatzrolle; Gleiches rückwirkend für x-fleet-audience.\n- Optional später: MCP-Scoping aus agent-lib.labels.json statt x-fleet-audience (Einträge = Server-Name).\n- config/managed/env_keys.yml Kommentar: Fragment heißt jetzt mcp/websearch.yaml (vorher exa.yaml).\n- ADR-0020 'Zielgruppen-Scoping für Skills/Agents/Commands' als Fortsetzung von ADR-0017.","acceptance_criteria":"vm-test: Rolle gesetzt → gelabelte Inhalte da; Rolle entfernt → unveränderte Kopien weg; Drift-Check grün; Folgelauf changed=0; Tippfehler-Label im Content-Repo bricht Guard rot ab.","notes":"14.11.: umgesetzt auf az-fleet Branch feat/agent-lib-labels (9108e89, von main abgezweigt, da profile-rollout nicht verfügbar): labels in agent-lib-Config, Pin 0.4.0, Label-Guard + Vokabular fleet_known_role_labels, ADR-0020. preflight.sh grün. Offen: in profile-rollout mergen, vm-test L1–L4.\n14.11.: per Cherry-Pick in az-fleet feat/profile-rollout übernommen (e8f768d, PR #1); Labels je Host geprüft (it/vertrieb/marketing), preflight grün. PR #2 ist damit redundant. Offen: PR #1 mergen, vm-test L1–L4.","status":"closed","priority":2,"issue_type":"task","owner":"m3ta-chiron@agentmail.to","created_at":"2026-11-14T09:12:14Z","created_by":"m3ta-chiron","updated_at":"2026-11-14T11:00:39Z","closed_at":"2026-11-14T11:00:39Z","close_reason":"In az-fleet feat/profile-rollout (PR #1) umgesetzt; Abnahme L1–L4 auf vm-test bestanden (ADR-0020, e19d03d). Merge von PR #1 nach main steht aus.","dependency_count":0,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-0b7","title":"az-orchestrator: Routing über installierte Subagents statt fester Routing-Tabelle","description":"Mit agent-lib.labels.json bekommen nicht mehr alle Rechner alle Subagents. Die feste Routing-Tabelle in agents/az-orchestrator.md (Zeile ~36ff) würde dann auf fehlende Agents zeigen. Umbau: Auswahl anhand der Subagent-Descriptions, die OpenCode dem Task-Tool ohnehin übergibt (Trigger-Description-Standard: Beispielanfragen in den ersten 80 Zeichen); Regel für 'kein passender Subagent'. Bis dahin darf die Tabelle nur ungelabelte Subagents nennen (README, Abschnitt Zielgruppen).","acceptance_criteria":"Keine hart verdrahteten Subagent-Namen mehr nötig; Smoke-Test: Routing klappt mit und ohne gelabelte Subagents; Prompt bleibt unter 10.000 Zeichen; az-pruefer-Prüfung ohne Mangel.","notes":"14.11.: Routing-Tabelle durch Routing-Regeln ersetzt (agents/az-orchestrator.md), keine Subagent-Namen mehr im Prompt, 6.239 Zeichen. Offen: Smoke-Test in OpenCode mit/ohne gelabelte Subagents. Nicht committet.","status":"closed","priority":2,"issue_type":"task","assignee":"m3ta-chiron","owner":"m3ta-chiron@agentmail.to","created_at":"2026-11-14T09:12:12Z","created_by":"m3ta-chiron","updated_at":"2026-11-14T09:56:05Z","started_at":"2026-11-14T09:29:26Z","closed_at":"2026-11-14T09:56:05Z","close_reason":"Routing-Regeln statt Tabelle; vom Nutzer in OpenCode getestet (14.11.2026), funktioniert.","dependency_count":0,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-jtp","title":"Dogfooding + Smoke-Tests der perfektionierten Agents","description":"Abschlussvalidierung: Der perfektionierte az-pruefer läuft über alle 5 perfektionierten Agenten (Dogfooding — der Prüfer prüft als Erstes die perfektionierten Kollegen); Befunde werden eingearbeitet bis der Prüf-Report grün ist. Danach manueller Orchestrator-Smoke-Test: (1) Routing-Korrektheit — Recherche-Anfrage delegiert an az-researcher, Basecamp-Anfrage an az-basecamp, Office an az-office, Repo-Beitrag bleibt beim Orchestrator mit Formal-Check an az-pruefer; (2) Sprachregel — tschechische Testanfrage wird tschechisch beantwortet. Testprotokoll als Beleg ablegen (tests/ oder Notes).\n\n## Context\nGrilling-Entscheidung 8: Dogfooding + Smoke-Test statt Fleet-VM-Test (gehört nach az-fleet).","acceptance_criteria":"1) az-pruefer-Report über agents/*.md: alle Befunde behoben, Report grün. 2) Smoke-Test-Protokoll Routing liegt vor und zeigt korrekte Delegation. 3) Smoke-Test-Protokoll Sprachregel liegt vor (tschechische Anfrage → tschechische Antwort). 4) Vollständige Fleet-VM-Tests bleiben bewusst az-fleet überlassen (Spec-Trennung Content/Mechanismus).","status":"closed","priority":2,"issue_type":"task","owner":"m3ta-chiron@agentmail.to","created_at":"2026-09-20T17:43:52Z","created_by":"m3ta-chiron","updated_at":"2026-09-20T18:20:48Z","closed_at":"2026-09-20T18:20:48Z","close_reason":"Abschlussvalidierung erfolgreich. (1) Dogfooding: az-pruefer-Prompt lief ueber alle 5 Agenten: Erstpruefung 0 Guard-Verstoesze, 1 Standard-Verstosz (Orchestrator-Description) -\u003e als Regelkonflikt aufgeloest (README Trigger-Description praezisiert: Subagents=Beispielfragen, Primary=Missionssatz; Sprachregel-Variante gleichbedeutend), Re-Pruefung gruen. (2) Routing-Smoke-Test 5/5 korrekt (Recherche-\u003eaz-researcher, Basecamp-\u003eaz-basecamp inkl. Destruktiv-Hinweis, Office-\u003eaz-office, Repo-Beitrag-\u003eselbst+az-pruefer, cs-Basecamp-Anfrage-\u003eaz-basecamp). (3) Sprachregel: direkte tschechische Anfrage wurde vollstaendig tschechisch beantwortet. Protokoll: tests/protocols/2026-09-20-smoke-test-agents.md. Fleet-VM-Tests bewusst az-fleet ueberlassen.","labels":["ready-for-agent"],"dependencies":[{"issue_id":"az-agent-defaults-jtp","depends_on_id":"az-agent-defaults-74g","type":"blocks","created_at":"2026-09-20T17:43:52Z","created_by":"m3ta-chiron","metadata":"{}"},{"issue_id":"az-agent-defaults-jtp","depends_on_id":"az-agent-defaults-99v","type":"blocks","created_at":"2026-09-20T17:43:52Z","created_by":"m3ta-chiron","metadata":"{}"},{"issue_id":"az-agent-defaults-jtp","depends_on_id":"az-agent-defaults-bfj","type":"blocks","created_at":"2026-09-20T17:43:52Z","created_by":"m3ta-chiron","metadata":"{}"},{"issue_id":"az-agent-defaults-jtp","depends_on_id":"az-agent-defaults-h2j","type":"blocks","created_at":"2026-09-20T17:43:52Z","created_by":"m3ta-chiron","metadata":"{}"},{"issue_id":"az-agent-defaults-jtp","depends_on_id":"az-agent-defaults-m4t","type":"blocks","created_at":"2026-09-20T17:43:52Z","created_by":"m3ta-chiron","metadata":"{}"}],"dependency_count":5,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-m4t","title":"az-office perfektionieren","description":"az-office nach dem Agenten-Prompt-Standard neu schreiben: Skill-Load „officecli“ als verpflichtender erster Schritt (Formulierung schärfen — aus „lade zu Beginn“ wird eine nicht verhandelbare erste Aktion, ausdrückliches Muster-Referenz des Prometheus-Ansatzes). Ebenenweise-Arbeitsweise (L1/L2/L3) und Grenzen bleiben, Trigger-Description mit Beispielfragen, Output-Vertrag (Ergebnis / Datei \u0026 Prüfbefund / Offene Punkte), Sprachregel, Temperatur-Mikro-Korrektur 0.2 → 0.1.\n\n## Context\nGrilling-Session 20.09. Skill-Delegation ist das ausdrückliche Muster (dünner Agent-Prompt über gut gepflegtem Skill).","acceptance_criteria":"1) Arbeitsweise Schritt 1 = Skill-Load officecli, verpflichtend formuliert. 2) L1/L2/L3-Prinzip erhalten. 3) Description trigger-optimiert. 4) Output-Vertrag mit Datei-\u0026-Prüfbefund-Sektion. 5) Sprachregel enthalten. 6) Demo: docx-Erstellung mit Prüfbefund-Sektion in der Antwort.","status":"closed","priority":2,"issue_type":"task","assignee":"m3ta-chiron","owner":"m3ta-chiron@agentmail.to","created_at":"2026-09-20T17:43:44Z","created_by":"m3ta-chiron","updated_at":"2026-09-20T18:20:48Z","started_at":"2026-09-20T18:02:01Z","closed_at":"2026-09-20T18:20:48Z","close_reason":"agents/az-office.md neu nach Standard: Schritt 1 = nicht verhandelbarer Skill-Load 'officecli' mit ausdruecklicher Prometheus-Muster-Referenz (duenne Agent-Shell ueber gepflegtem Skill); L1/L2/L3-Prinzip, Pruefschritt (outline/issues/validate) und Grenzen bleiben; Trigger-Description mit 3 Beispielauftraegen in den ersten 80 Zeichen; Output-Vertrag Ergebnis/Datei \u0026 Pruefbefund (ohne Pruefbefund nicht abgeschlossen)/Offene Punkte; Sprachregel; temperature 0.2 -\u003e 0.1. Nach Kosmetik-Fix (bearbeite sie) az-pruefer-Re-Pruefung gruen.","labels":["ready-for-agent"],"dependency_count":0,"dependent_count":1,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-bfj","title":"az-basecamp perfektionieren + Skill-Nutzung verankern","description":"az-basecamp nach Prometheus-Muster neu schreiben (dünne Shell über Skill): Verpflichtender erster Schritt = Skill „basecamp“ laden (Skill wird via az-fleet aus external/ auf die Nutzerebene ausgerollt — Lieferweg ist gesichert). Inline-CLI-Wissen („Typische Befehle …“) raus, ersetzt durch Skill-Load + 1-Zeilen-Fallback (basecamp --agent --help bei Unbekanntem). Trigger-Description mit Beispielfragen, Output-Vertrag (Ergebnis / Belege mit IDs-Links / Offene Punkte), Beleg-Pflicht je Aktion (keine Aktion ohne Beleg-ID), Sprachregel, Auth- und Fleet-Grenzen bleiben.\n\n## Context\nGrilling-Session 20.09.: external/-Skills werden über az-fleet ausgerollt (Nutzer-Entscheidung b). Muster-Vorbild: az-office + officecli-Skill.","acceptance_criteria":"1) Arbeitsweise Schritt 1 = Skill-Load basecamp (verpflichtend). 2) Keine inline-CLI-Befehlsliste mehr im Prompt. 3) Description trigger-optimiert. 4) Output-Vertrag mit Belege-Sektion. 5) Sprachregel enthalten. 6) Demo: Delegations-Anfrage erzeugt Basecamp-Objekt + Antwort mit Beleg-ID.","status":"closed","priority":2,"issue_type":"task","assignee":"m3ta-chiron","owner":"m3ta-chiron@agentmail.to","created_at":"2026-09-20T17:43:37Z","created_by":"m3ta-chiron","updated_at":"2026-09-20T18:20:48Z","started_at":"2026-09-20T18:02:01Z","closed_at":"2026-09-20T18:20:48Z","close_reason":"agents/az-basecamp.md neu als duenne Shell ueber dem basecamp-Skill (Prometheus-Muster): Schritt 1 = verpflichtender Skill-Load 'basecamp' (BEVOR irgendetwas anderes passiert), Inline-CLI-Befehlsliste entfernt, 1-Zeilen-Fallback basecamp --agent --help. Trigger-Description mit 3 Beispielfragen in den ersten 80 Zeichen; Output-Vertrag Ergebnis/Belege (Beleg-Pflicht: keine Aktion ohne Beleg-ID)/Offene Punkte; Sprachregel; Auth- (OAuth-Login interaktiv) und Fleet-Grenzen bleiben; haiku/0.2 bleibt. az-pruefer: konform ohne Befund.","labels":["ready-for-agent"],"dependency_count":0,"dependent_count":1,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-99v","title":"az-researcher perfektionieren","description":"az-researcher neu schreiben nach dem Agenten-Prompt-Standard: Modell az-litellm/claude-haiku-4-5 → az-litellm/claude-sonnet-5 (Recherchequalität: Quellenbewertung/Synthese braucht das stärkere Modell, Fehlerkosten unsichtbar und teuer). Trigger-Description mit Beispielfragen, Klassifikation Web-vs-lokal als erster Arbeitschritt, geschärfter Output-Vertrag (Kernantwort / Belege mit URL bzw. Datei:Zeile / Offene Punkte), Sprachregel, Failure-Bedingung: Behauptung ohne Quelle = gescheitert.\n\n## Context\nGrilling-Entscheidung 6(a): Researcher auf Sonnet-Klasse, alle anderen Modelle bleiben.","acceptance_criteria":"1) Frontmatter: model=az-litellm/claude-sonnet-5, temperature 0.1–0.2. 2) Description trigger-optimiert mit Beispielfragen. 3) Arbeitsweise beginnt mit Web-vs-lokal-Klassifikation. 4) Output-Vertrag mit Belege- und Offene-Punkte-Sektion. 5) Sprachregel enthalten. 6) Demo: @mention-Recherche liefert sektionierte Antwort mit Quellen.","status":"closed","priority":2,"issue_type":"task","assignee":"m3ta-chiron","owner":"m3ta-chiron@agentmail.to","created_at":"2026-09-20T17:43:29Z","created_by":"m3ta-chiron","updated_at":"2026-09-20T18:20:48Z","started_at":"2026-09-20T18:02:01Z","closed_at":"2026-09-20T18:20:48Z","close_reason":"agents/az-researcher.md neu nach Standard: model az-litellm/claude-sonnet-5, temperature 0.1, read-only-Tools bleiben. Trigger-Description mit 2 konkreten Beispielfragen in den ersten 80 Zeichen; Arbeitsweise Schritt 1 = Web-vs-lokal-Klassifikation mit Abschlusskriterium; Output-Vertrag Kernantwort/Belege (URL bzw. Datei:Zeile)/Offene Punkte plus explizite Failure-Bedingung (Behauptung ohne Quelle = gescheiterter Auftrag); Sprachregel; Body ~2.900 Zeichen. az-pruefer: konform ohne Befund.","labels":["ready-for-agent"],"dependency_count":0,"dependent_count":1,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-h2j","title":"az-orchestrator perfektionieren","description":"az-orchestrator als schlanker Router + Verifikator neu schreiben (~150 Zeilen, bleibt glm-5-2): geschärfte Routing-Tabelle mit Trigger-Beispielen je Subagent, Verifikations-Checkliste gegen die Output-Verträge der Subagents (Belege fehlen → nachbessern lassen; Offene Punkte die der Nutzer nie fragte → Rückfrage), Eskalations-Regeln, Sprachregel „Antworte in der Sprache der Nutzeranfrage“, „selber machen wenn schneller“ bleibt. Kein Certainty-/Plan-Zwang (bewusst gegen OMO-Voll-Doktrin entschieden — Kostenarchitektur glm-5-2).\n\n## Context\nGrilling-Entscheidung 5(a): schlanker Router + Verifikator. Zielgruppe: ganze AZ-Gruppe (deutsch/tschechisch/englisch).","acceptance_criteria":"1) Prompt folgt dem Agenten-Prompt-Standard (Skelett, Sprachregel, \u003c10k Zeichen). 2) Description trigger-optimiert, erste 80 Zeichen = Missionssatz. 3) Routing-Tabelle nennt Beispielfragen. 4) Verifikations-Checkliste referenziert die Subagent-Output-Verträge. 5) Smoke-Test: Recherche-Anfrage delegiert an az-researcher; tschechische Anfrage wird tschechisch beantwortet.","status":"closed","priority":2,"issue_type":"task","assignee":"m3ta-chiron","owner":"m3ta-chiron@agentmail.to","created_at":"2026-09-20T17:43:21Z","created_by":"m3ta-chiron","updated_at":"2026-09-20T18:20:47Z","started_at":"2026-09-20T18:02:00Z","closed_at":"2026-09-20T18:20:47Z","close_reason":"agents/az-orchestrator.md neu als schlanker Router + Verifikator (108 Zeilen, Body ~7.000 Zeichen, glm-5-2/0.3 bleibt): Missionssatz-Description (erste 80 Zeichen), Routing-Tabelle mit je 3-4 konkreten Beispielfragen je Zeile (de/en/cs), Delegations-Regeln inkl. 'selber machen wenn schneller' + 'ein Auftrag, ein Verantwortlicher', Verifikations-Checkliste gegen die Subagent-Output-Vertraege (Ergebnis/Belege/Offene Punkte; Belege fehlen -\u003e nachbessern, nie gefragte offene Punkte -\u003e Rueckfrage), Eskalations-Regeln in Grenzen, kein Certainty-/Plan-Zwang. Smoke-Tests: Routing 5/5 korrekt, tschechische Anfrage tschechisch beantwortet (Protokoll tests/protocols/2026-09-20-smoke-test-agents.md). az-pruefer-Dogfooding: nach README-Praezisierung (Primary=Missionssatz) gruen.","labels":["ready-for-agent"],"dependency_count":0,"dependent_count":1,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-74g","title":"Agenten-Prompt-Standard definieren + az-pruefer perfektionieren","description":"README-Sektion „Agenten-Prompt-Standard“ anlegen (Prompt-Skelett mit Arbeitsweise/Ausgabeformat/Grenzen, Trigger-Description-Regel mit Beispielfragen in den ersten 80 Zeichen, Output-Vertrags-Pflicht für Subagents mit Belege- und Offene-Punkte-Sektion, Sprachregel „Antworte in der Sprache der Anfrage“ in jedem Agenten, 10k-Zeichen-Grenze) plus einen Satz zum external/-Lieferweg (Skills aus external/ werden via az-fleet auf die Nutzerebene ausgerollt). Danach az-pruefer nach dem neuen Standard perfektionieren: prüft die deterministischen Guard-Regeln aus dem README UND den Agenten-Prompt-Standard (LLM-Prüfung), mit eigenem Output-Vertrag und Trigger-Description. Grundlage ist die OMO-Analyse-Session (Trigger-Descriptions, Output-Verträge, Prometheus-Muster).\n\n## Context\nEntscheidungen aus Grilling-Session 20.09.: Struktur (a) deutsch+OMO-Elemente; Descriptions voll trigger-optimiert; Output-Verträge Markdown-Sektionen; Standard weiche Regel (LLM-geprüft, keine harten Guards).","acceptance_criteria":"1) README enthält die Sektion „Agenten-Prompt-Standard“ mit Skelett, Trigger-Regel, Output-Vertrags-Pflicht, Sprachregel, 10k-Grenze und external/-Hinweis. 2) az-pruefer prüft Guard-Regeln + Prompt-Standard. 3) Demo: az-pruefer meldet an einer absichtlich schlechten Agent-Datei genau die Standard-Verstöße (fehlende Beispielfragen, fehlender Output-Vertrag, fehlende Sprachregel).","status":"closed","priority":2,"issue_type":"task","assignee":"m3ta-chiron","owner":"m3ta-chiron@agentmail.to","created_at":"2026-09-20T17:43:10Z","created_by":"m3ta-chiron","updated_at":"2026-09-20T17:58:11Z","started_at":"2026-09-20T17:50:54Z","closed_at":"2026-09-20T17:58:11Z","close_reason":"Umgesetzt: (1) README-Sektion 'Agenten-Prompt-Standard' (Prompt-Skelett Arbeitsweise/Ausgabeformat/Grenzen, Trigger-Description-Regel mit Beispielfragen in den ersten 80 Zeichen, Output-Vertrags-Pflicht für Subagents mit Ergebnis/Belege/Offene Punkte, Sprachregel 'Antworte in der Sprache der Anfrage', 10k-Zeichen-Grenze, external/-Lieferweg-Satz) — klar als weiche Regel (LLM-geprüft, kein Guard) abgetrennt; Fixtures-Sektion um agents/demo/ ergänzt. (2) agents/az-pruefer.md neu nach eigenem Standard: Trigger-Description mit Beispielfragen, prüft Guard-Regeln + Prompt-Standard getrennt, eigener Output-Vertrag, Sprachregel, Read-only-Profil bleibt. (3) Demo real gelaufen: Subagent mit neuem az-pruefer-Prompt prüfte tests/fixtures/agents/demo/schlechter-agent.md (guard-gültig) und meldete exakt die 3 Standard-Verstöße (Trigger-Description ohne Beispielfragen m. 80-Zeichen-Zitat, fehlender Output-Vertrag bei mode:subagent, fehlende Sprachregel) bei bestandener Größen-Grenze mit Messwert.","labels":["ready-for-agent"],"dependency_count":0,"dependent_count":1,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-1ub","title":"Skills: ow-hello entfernen, durch Onboarding-/Hilfe-Skill (az-hilfe, Entwurf) ersetzen","description":"Entscheidung des Nutzers (22.08.2026): ow-hello wird nicht mehr benötigt. Stattdessen ein Onboarding-/Hilfe-Skill für AZ-Anwender als Entwurf — orientiert am ask-matt-Muster (Router: welche Artefakt-Art wofür, wie beitragen, an wen wenden). Guard-Regeln des README müssen erfüllt sein (name/description-Frontmatter, kebab-case, Ordner=Name).","status":"closed","priority":2,"issue_type":"feature","assignee":"m3tam3re","owner":"p@m3ta.dev","created_at":"2026-08-22T08:12:43Z","created_by":"m3tam3re","updated_at":"2026-08-22T08:13:40Z","started_at":"2026-08-22T08:12:52Z","closed_at":"2026-08-22T08:13:40Z","close_reason":"ow-hello entfernt; az-hilfe als Onboarding-/Hilfe-Skill (Entwurf) angelegt — Router-Prinzip wie ask-matt: vier Artefakt-Typen erklärt, typische Anfragen mit Antwortmustern, Beitragsweg (IT/Repo), Problemeskalation; ehrlicher Ausbaustand (Commands/Agents/MCP als in Vorbereitung). Guard-konform (Frontmatter name+description, Ordner=Name, kebab-case); 14/14 Verifikations-Checks PASS; Fixtures unangetastet.","dependency_count":0,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-95y","title":"MCP-Slice: Fragment-Format (remote/streamable) + Vault-Platzhalter-Konvention + Guard-Fixtures","description":"Quelle: Spec 01-az-agent-defaults-spec.md.\n\nDefinition des MCP-Fragment-Formats für den mcp-Konfigurationsschlüssel: ein Fragment pro Server, remote/streamable als Standard (url, enabled-Flag; OAuth läuft zur Laufzeit pro Nutzer über das Microsoft-Konto — keine statischen Secrets im Fragment). Für Ausnahmen mit statischem Key definiert das Format einen Platzhalter samt Vault-Key-Namensschema: der Key liegt im Vault des Fleet-Repos und wird erst beim Merge auf dem Controller substituiert — im Repo bleibt nie ein Secret (B3).\n\nZwei Referenz-Fragmente in mcp/ (eine OAuth-Server-Anbindung, eine Key-Ausnahme mit Platzhalter) dienen als Testgegenstände für die Fleet-Szenarien „Fragmente in der aufgelösten Konfiguration sichtbar (Sidecar-Debug)\" und „Vault-Substitution funktioniert, Nutzerebene enthält kein Secret aus dem Repo\". Zusätzlich ungültige MCP-Fixtures unter tests/fixtures/ — insbesondere ein Fragment mit Inline-Secret, das der Guard rot abbrechen muss.\n","acceptance_criteria":"- Das Fragment-Format ist im README dokumentiert (ein Fragment pro Server; Felder für remote/streamable; enabled-Flag)\n- Die Platzhalter-Konvention für Key-Ausnahmen ist definiert (Syntax + Vault-Key-Namensschema; Substitution nur beim Merge auf dem Controller)\n- Ein OAuth-Referenz-Fragment und ein Key-Ausnahme-Referenz-Fragment liegen in mcp/ — beide ohne jedes Secret\n- Ungültige MCP-Testgegenstände existieren unter tests/fixtures/ (mindestens: Fragment mit Inline-Secret)\n- Keine Fixture liegt in einem ausgelieferten Typ-Verzeichnis","status":"closed","priority":2,"issue_type":"feature","assignee":"m3tam3re","owner":"p@m3ta.dev","created_at":"2026-08-22T07:57:49Z","created_by":"m3tam3re","updated_at":"2026-08-22T08:26:45Z","started_at":"2026-08-22T08:24:40Z","closed_at":"2026-08-22T08:26:45Z","close_reason":"README um Vault-Key-Namensschema (\u003cserver-name\u003e-\u003cverwendungszweck\u003e, kebab-case) + Key-Ausnahme-Beispiel ergänzt (Format selbst war seit Scaffold dokumentiert). Zwei Referenz-Fragmente in mcp/: zugferd-service.yaml (OAuth-Standardfall, kein Credential-Feld) + az-zoll-service.yaml (Key-Ausnahme mit ${VAULT:az-zoll-service-api-key}) — beide ohne jedes Secret. 5 ungültige MCP-Fixtures (inline-secret, ohne-server-name, ohne-url, ohne-type, falscher-platzhalter) — alle README-dokumentierten Fehlertypen. 17/17 Checks PASS.","labels":["ready-for-agent"],"dependencies":[{"issue_id":"az-agent-defaults-95y","depends_on_id":"az-agent-defaults-j35","type":"blocks","created_at":"2026-08-22T09:57:48Z","created_by":"m3tam3re","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-gj1","title":"Commands-Slice: Referenz-Command mit Argument-Platzhaltern + Guard-Fixtures","description":"Quelle: Spec 01-az-agent-defaults-spec.md.\n\nErster exemplarischer Company-Command in commands/: Markdown mit Frontmatter (description, optional agent/model) und Template-Body mit Argument-Platzhaltern ($ARGUMENTS, $1..$n) — Format gemäß verifizierter OpenCode-Doku (global ~/.config/opencode/commands/, pro Projekt .opencode/commands/; Shell-Output-Injection und Datei-Referenzen unterstützt). Der Command ist zugleich Referenz-Beitrag für Contributor und Testgegenstand für das Fleet-Szenario „/command ist in der OpenWork-/OpenCode-Sitzung verfügbar und löst das Template aus\". Inhaltlich bewusst trivial (Platzhalter-Niveau wie ow-hello; konkrete Inhalte sind Phase 2).\n\nZusätzlich ungültige Command-Fixtures unter tests/fixtures/ (z. B. Frontmatter ohne description, Datei ohne Frontmatter).\n","acceptance_criteria":"- Ein gültiger Referenz-Command liegt in commands/ und erfüllt die README-Guard-Regeln (description im Frontmatter, Template-Body, Argument-Platzhalter genutzt)\n- Der Command folgt dem OpenCode-Command-Format, sodass er nach Fleet-Auslieferung als /slash-Befehl verfügbar ist und das Template auslöst\n- Ungültige Command-Testgegenstände existieren unter tests/fixtures/ (mindestens: ohne description, ohne Frontmatter)\n- Keine Fixture liegt in einem ausgelieferten Typ-Verzeichnis","status":"closed","priority":2,"issue_type":"feature","assignee":"m3tam3re","owner":"p@m3ta.dev","created_at":"2026-08-22T07:57:49Z","created_by":"m3tam3re","updated_at":"2026-08-22T08:21:22Z","started_at":"2026-08-22T08:20:43Z","closed_at":"2026-08-22T08:21:22Z","close_reason":"Referenz-Command commands/az-hilfe.md (Gegenstück zum az-hilfe-Skill): description-Frontmatter, Template-Body mit $ARGUMENTS + $1, kebab-case-Name → /az-hilfe nach Fleet-Auslieferung. 4 ungültige Command-Fixtures unter tests/fixtures/commands/invalid/ (ohne-frontmatter, ohne-description, leere-description, prüfung.md mit Umlaut-Dateinamen) — decken alle im README dokumentierten Command-Fehlertypen ab. 17/17 Verifikations-Checks PASS.","labels":["ready-for-agent"],"dependencies":[{"issue_id":"az-agent-defaults-gj1","depends_on_id":"az-agent-defaults-j35","type":"blocks","created_at":"2026-08-22T09:57:48Z","created_by":"m3tam3re","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-gyj","title":"Agents-Slice: Referenz-Primäragent + Read-only-Subagent + Guard-Fixtures","description":"Quelle: Spec 01-az-agent-defaults-spec.md.\n\nZwei Referenz-Agent-Definitionen in agents/: ein spezialisierter Primäragent (per Agentenwechsel erreichbar) und ein Subagent mit Read-only-Permission-Profil (kein Edit/Bash) — Spezialisierung ohne Rechteausweitung (User Story 13). Beide folgen dem OpenCode-Format: Markdown mit Frontmatter (description, mode primary/subagent, optional model/temperature, Permission-Profil); Dateiname = Agentenname.\n\nKritisch: Die Subagent-Definition darf die Task-Tool-Delegation nie verbauen — Agenten müssen Subagenten weiterhin selbstständig starten können (User Story 12), und Permission-Profile dürfen niemals etwas erlauben, was der Managed-Layer verweigert (User Story 14).\n\nZusätzlich ungültige Agent-Fixtures unter tests/fixtures/ (z. B. mode fehlt, description fehlt).\n","acceptance_criteria":"- Ein Primäragent (mode: primary) und ein Subagent (mode: subagent) liegen in agents/ und erfüllen die README-Guard-Regeln\n- Der Subagent trägt ein Read-only-Permission-Profil ohne Edit/Bash\n- Die Subagent-Definition lässt Task-Tool-Aufruf und @mention zu (verbaut die Delegationsfähigkeit nicht)\n- Keine Agent-Definition weicht die Sicherheitsgrenzen des Managed-Layers auf (bleibt innerhalb des Permission-Regelwerks)\n- Ungültige Agent-Testgegenstände existieren unter tests/fixtures/ (mindestens: mode fehlt, description fehlt)\n- Keine Fixture liegt in einem ausgelieferten Typ-Verzeichnis","status":"closed","priority":2,"issue_type":"feature","assignee":"m3tam3re","owner":"p@m3ta.dev","created_at":"2026-08-22T07:57:49Z","created_by":"m3tam3re","updated_at":"2026-08-22T08:26:45Z","started_at":"2026-08-22T08:24:04Z","closed_at":"2026-08-22T08:26:45Z","close_reason":"Zwei Referenz-Agenten in agents/: az-beitrag (mode: primary, ohne tools-Restriction — Delegationsfähigkeit intakt, Body betont Managed-Layer-Grenze, delegiert aktiv an az-pruefer) + az-pruefer (mode: subagent, Read-only-Profil tools: [read, glob, grep] ohne Edit/Bash, per @mention/Task-Tool erreichbar). 3 ungültige Agent-Fixtures (ohne-mode, ohne-description, ungueltiger-mode) — alle README-dokumentierten Fehlertypen. 19/19 Checks PASS (1 Regex-Bug im Prüfscript korrigiert nachgewiesen).","labels":["ready-for-agent"],"dependencies":[{"issue_id":"az-agent-defaults-gyj","depends_on_id":"az-agent-defaults-j35","type":"blocks","created_at":"2026-08-22T09:57:48Z","created_by":"m3tam3re","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-dzx","title":"Skills-Slice: ow-hello aus az-agent-skills übernehmen + Skill-Guard-Fixtures","description":"Quelle: Spec 01-az-agent-defaults-spec.md.\n\nDer Pilot-Skill ow-hello wandert aus dem Vorgänger-Repo az-agent-skills in skills/ — inhaltlich unverändert; einzig die Erwähnung „Repository az-agent-skills\" im Skill-Text wird auf az-agent-defaults aktualisiert (Ticketing-Entscheidung 22.08.2026). Damit bleibt der bestehende Skills-Spiegel (ADR-0006-Logik) ohne Funktionsverlust funktionsfähig.\n\nZusätzlich entstehen die Testgegenstände für den Guard-Test „ungültiges Artefakt im Repo → Run bricht kontrolliert ab\": unter tests/fixtures/ ungültige Skill-Artefakte (z. B. Ordner ohne SKILL.md; SKILL.md ohne Frontmatter-Öffner). Die Guard-Engine selbst implementiert az-fleet (Pre-Flight der Delivery-Rolle).\n","acceptance_criteria":"- ow-hello liegt in skills/ und ist inhaltlich identisch mit dem Stand aus az-agent-skills (einzige Abweichung: Repo-Erwähnung az-agent-defaults)\n- Frontmatter-Öffner und Struktur erfüllen die im README dokumentierten Skill-Guard-Regeln\n- Unter tests/fixtures/ existieren ungültige Skill-Testgegenstände (mindestens: Ordner ohne SKILL.md, SKILL.md ohne Frontmatter-Öffner)\n- Keine Fixture liegt in einem der vier ausgelieferten Typ-Verzeichnisse","status":"closed","priority":2,"issue_type":"feature","assignee":"m3tam3re","owner":"p@m3ta.dev","created_at":"2026-08-22T07:57:48Z","created_by":"m3tam3re","updated_at":"2026-08-22T08:09:02Z","started_at":"2026-08-22T08:06:37Z","closed_at":"2026-08-22T08:09:02Z","close_reason":"Skills-Slice umgesetzt: ow-hello aus az-agent-skills nach skills/ migriert (einzige Abweichung: Repo-Erwähnung L15 → az-agent-defaults); 5 ungültige Skill-Fixtures unter tests/fixtures/skills/invalid/ (ordner-ohne-skill-md, ohne-frontmatter, leeres-frontmatter, name-ungleich-ordner, ohne-description) — decken alle im README dokumentierten Skill-Guard-Fehlertypen ab, jede Fixture failt exakt eine Regel; alle 4 Akzeptanzkriterien per Skript verifiziert (15/15 PASS); .gitkeep-Platzhalter entfernt.","labels":["ready-for-agent"],"dependencies":[{"issue_id":"az-agent-defaults-dzx","depends_on_id":"az-agent-defaults-j35","type":"blocks","created_at":"2026-08-22T09:57:48Z","created_by":"m3tam3re","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-2d3","title":"az-hilfe: zeigt tatsächlich installierte Fähigkeiten statt fester Liste","description":"Skill und Command az-hilfe sollen nach Einführung der Labels nur nennen, was auf dem Rechner installiert ist (Skills/Agents/Commands des Nutzers), nicht eine feste Liste aller Repo-Inhalte.","acceptance_criteria":"Auf einem Rechner ohne Label-Inhalte erwähnt az-hilfe keine gelabelten Agents/Skills.","notes":"14.11.: skills/az-hilfe/SKILL.md neu geschrieben (nur tatsächlich verfügbare Fähigkeiten in Alltagssprache, veraltete Aussagen zu Rollout/lokalen Änderungen korrigiert), commands/az-hilfe.md angepasst. Offen: Live-Test. Nicht committet.","status":"closed","priority":3,"issue_type":"task","assignee":"m3ta-chiron","owner":"m3ta-chiron@agentmail.to","created_at":"2026-11-14T09:12:13Z","created_by":"m3ta-chiron","updated_at":"2026-11-14T09:56:06Z","started_at":"2026-11-14T09:29:27Z","closed_at":"2026-11-14T09:56:06Z","close_reason":"az-hilfe nennt nur verfügbare Fähigkeiten; mit dem Orchestrator getestet (14.11.2026).","dependency_count":0,"dependent_count":0,"comment_count":0}
|
|
||||||
{"_type":"issue","id":"az-agent-defaults-97z","title":"officecli-academic-paper aus der Vendor-Auswahl entfernen","description":"Ist aktuell nur unter Label it geparkt; für die Gruppe ohne Nutzen. agent-lib vendor update officecli mit exclude officecli-academic-paper (analog morph-ppt), danach Eintrag aus agent-lib.labels.json entfernen.","status":"closed","priority":4,"issue_type":"chore","owner":"m3ta-chiron@agentmail.to","created_at":"2026-11-14T09:12:15Z","created_by":"m3ta-chiron","updated_at":"2026-11-14T09:31:18Z","closed_at":"2026-11-14T09:31:18Z","close_reason":"officecli-academic-paper per 'agent-lib vendor select officecli --remove' ausgeschlossen, Eintrag aus agent-lib.labels.json entfernt; validate grün. Nicht committet.","dependency_count":0,"dependent_count":0,"comment_count":0}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"database": "dolt",
|
|
||||||
"backend": "dolt",
|
|
||||||
"dolt_mode": "embedded",
|
|
||||||
"dolt_database": "az_agent_defaults",
|
|
||||||
"project_id": "381ad185-e1f8-4aa0-8796-00000bcf7858"
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"hooks": {
|
|
||||||
"SessionStart": [
|
|
||||||
{
|
|
||||||
"hooks": [
|
|
||||||
{
|
|
||||||
"command": "bd prime --hook-json",
|
|
||||||
"type": "command"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"matcher": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[features]
|
|
||||||
hooks = true
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
{
|
|
||||||
"hooks": {
|
|
||||||
"PostCompact": [
|
|
||||||
{
|
|
||||||
"hooks": [
|
|
||||||
{
|
|
||||||
"command": "bd codex-hook PostCompact",
|
|
||||||
"statusMessage": "Scheduling Beads context refresh",
|
|
||||||
"type": "command"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"matcher": "manual|auto"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"PreCompact": [
|
|
||||||
{
|
|
||||||
"hooks": [
|
|
||||||
{
|
|
||||||
"command": "bd codex-hook PreCompact",
|
|
||||||
"statusMessage": "Checking Beads context",
|
|
||||||
"type": "command"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"matcher": "manual|auto"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"SessionStart": [
|
|
||||||
{
|
|
||||||
"hooks": [
|
|
||||||
{
|
|
||||||
"command": "bd codex-hook SessionStart",
|
|
||||||
"statusMessage": "Loading Beads context",
|
|
||||||
"type": "command"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"matcher": "startup|resume|clear"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"UserPromptSubmit": [
|
|
||||||
{
|
|
||||||
"hooks": [
|
|
||||||
{
|
|
||||||
"command": "bd codex-hook UserPromptSubmit",
|
|
||||||
"statusMessage": "Refreshing Beads context",
|
|
||||||
"type": "command"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
# Spec-Dokument — bleibt lokal, wird nicht nach Gitea gepusht
|
|
||||||
01-az-agent-defaults-spec.md
|
|
||||||
|
|
||||||
# Beads / Dolt files (added by bd init)
|
|
||||||
.dolt/
|
|
||||||
*.db
|
|
||||||
.beads-credential-key
|
|
||||||
.beads/proxieddb/
|
|
||||||
.beads.gate.lock
|
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
# Agent Instructions
|
|
||||||
|
|
||||||
This project uses **bd** (beads) for issue tracking. Run `bd prime` for full workflow context.
|
|
||||||
|
|
||||||
> **Architecture in one line:** Issues live in a local Dolt database
|
|
||||||
> (`.beads/dolt/`); cross-machine sync uses `bd dolt push/pull` (a
|
|
||||||
> git-compatible protocol), stored under `refs/dolt/data` on your git
|
|
||||||
> remote — separate from `refs/heads/*` where your code lives.
|
|
||||||
> `.beads/issues.jsonl` is a passive export, not the wire protocol.
|
|
||||||
>
|
|
||||||
> See [SYNC_CONCEPTS.md](https://github.com/gastownhall/beads/blob/main/docs/SYNC_CONCEPTS.md)
|
|
||||||
> for the one-screen overview and anti-patterns (don't treat JSONL as the
|
|
||||||
> source of truth; don't `bd import` during normal operation; don't
|
|
||||||
> reach for third-party Dolt hosting before trying the default).
|
|
||||||
|
|
||||||
## Quick Reference
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd ready # Find available work
|
|
||||||
bd show <id> # View issue details
|
|
||||||
bd update <id> --claim # Claim work atomically
|
|
||||||
bd close <id> # Complete work
|
|
||||||
bd dolt push # Push beads data to remote
|
|
||||||
```
|
|
||||||
|
|
||||||
## Non-Interactive Shell Commands
|
|
||||||
|
|
||||||
**ALWAYS use non-interactive flags** with file operations to avoid hanging on confirmation prompts.
|
|
||||||
|
|
||||||
Shell commands like `cp`, `mv`, and `rm` may be aliased to include `-i` (interactive) mode on some systems, causing the agent to hang indefinitely waiting for y/n input.
|
|
||||||
|
|
||||||
**Use these forms instead:**
|
|
||||||
```bash
|
|
||||||
# Force overwrite without prompting
|
|
||||||
cp -f source dest # NOT: cp source dest
|
|
||||||
mv -f source dest # NOT: mv source dest
|
|
||||||
rm -f file # NOT: rm file
|
|
||||||
|
|
||||||
# For recursive operations
|
|
||||||
rm -rf directory # NOT: rm -r directory
|
|
||||||
cp -rf source dest # NOT: cp -r source dest
|
|
||||||
```
|
|
||||||
|
|
||||||
**Other commands that may prompt:**
|
|
||||||
- `scp` - use `-o BatchMode=yes` for non-interactive
|
|
||||||
- `ssh` - use `-o BatchMode=yes` to fail instead of prompting
|
|
||||||
- `apt-get` - use `-y` flag
|
|
||||||
- `brew` - use `HOMEBREW_NO_AUTO_UPDATE=1` env var
|
|
||||||
|
|
||||||
<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:970c3bf2 -->
|
|
||||||
## Beads Issue Tracker
|
|
||||||
|
|
||||||
This project uses **bd (beads)** for issue tracking. Run `bd prime` to see full workflow context and commands.
|
|
||||||
|
|
||||||
### Quick Reference
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd ready # Find available work
|
|
||||||
bd show <id> # View issue details
|
|
||||||
bd update <id> --claim # Claim work
|
|
||||||
bd close <id> # Complete work
|
|
||||||
```
|
|
||||||
|
|
||||||
### Rules
|
|
||||||
|
|
||||||
- Use `bd` for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
|
|
||||||
- Run `bd prime` for detailed command reference and session close protocol
|
|
||||||
- Use `bd remember` for persistent knowledge — do NOT use MEMORY.md files
|
|
||||||
|
|
||||||
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/SYNC_CONCEPTS.md for details and anti-patterns.
|
|
||||||
|
|
||||||
## Agent Context Profiles
|
|
||||||
|
|
||||||
The managed Beads block is task-tracking guidance, not permission to override repository, user, or orchestrator instructions.
|
|
||||||
|
|
||||||
- **Conservative (default)**: Use `bd` for task tracking. Do not run git commits, git pushes, or Dolt remote sync unless explicitly asked. At handoff, report changed files, validation, and suggested next commands.
|
|
||||||
- **Minimal**: Keep tool instruction files as pointers to `bd prime`; use the same conservative git policy unless active instructions say otherwise.
|
|
||||||
- **Team-maintainer**: Only when the repository explicitly opts in, agents may close beads, run quality gates, commit, and push as part of session close. A current "do not commit" or "do not push" instruction still wins.
|
|
||||||
|
|
||||||
## Session Completion
|
|
||||||
|
|
||||||
This protocol applies when ending a Beads implementation workflow. It is subordinate to explicit user, repository, and orchestrator instructions.
|
|
||||||
|
|
||||||
1. **File issues for remaining work** - Create beads for anything that needs follow-up
|
|
||||||
2. **Run quality gates** (if code changed) - Tests, linters, builds
|
|
||||||
3. **Update issue status** - Close finished work, update in-progress items
|
|
||||||
4. **Handle git/sync by active profile**:
|
|
||||||
```bash
|
|
||||||
# Conservative/minimal/default: report status and proposed commands; wait for approval.
|
|
||||||
git status
|
|
||||||
|
|
||||||
# Team-maintainer opt-in only, unless current instructions forbid it:
|
|
||||||
git pull --rebase
|
|
||||||
bd dolt push
|
|
||||||
git push
|
|
||||||
git status
|
|
||||||
```
|
|
||||||
5. **Hand off** - Summarize changes, validation, issue status, and any blocked sync/commit/push step
|
|
||||||
|
|
||||||
**Critical rules:**
|
|
||||||
- Explicit user or orchestrator instructions override this Beads block.
|
|
||||||
- Do not commit or push without clear authority from the active profile or the current user request.
|
|
||||||
- If a required sync or push is blocked, stop and report the exact command and error.
|
|
||||||
<!-- END BEADS INTEGRATION -->
|
|
||||||
|
|
||||||
<!-- BEGIN BEADS CODEX SETUP: generated by bd setup codex -->
|
|
||||||
## Beads Issue Tracker
|
|
||||||
|
|
||||||
Use Beads (`bd`) for durable task tracking in repositories that include it. Use the `beads` skill at `.agents/skills/beads/SKILL.md` (project install) or `~/.agents/skills/beads/SKILL.md` (global install) for Beads workflow guidance, then use the `bd` CLI for issue operations.
|
|
||||||
|
|
||||||
### Quick Reference
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd ready # Find available work
|
|
||||||
bd show <id> # View issue details
|
|
||||||
bd update <id> --claim # Claim work
|
|
||||||
bd close <id> # Complete work
|
|
||||||
bd prime # Refresh Beads context
|
|
||||||
```
|
|
||||||
|
|
||||||
### Rules
|
|
||||||
|
|
||||||
- Use `bd` for all task tracking; do not create markdown TODO lists.
|
|
||||||
- Run `bd prime` when Beads context is missing or stale. Codex 0.129.0+ can load Beads context automatically through native hooks; use `/hooks` to inspect or toggle them.
|
|
||||||
- Keep persistent project memory in Beads via `bd remember`; do not create ad hoc memory files.
|
|
||||||
|
|
||||||
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/SYNC_CONCEPTS.md for details and anti-patterns.
|
|
||||||
<!-- END BEADS CODEX SETUP -->
|
|
||||||
|
|
||||||
<!-- BEGIN PM-PROJEKTLANDSCHAFT -->
|
|
||||||
## Projektlandschaft
|
|
||||||
|
|
||||||
Dieses Repo ist eines von mehreren Projekten unter `/home/sascha.koenig/ap`. Gesamtübersicht (Zweck, Remotes, Abhängigkeiten aller Repos): `/home/sascha.koenig/ap/PM/CLAUDE.md`. Firmen- und IT-Wissen steht im OKF-Bündel `/home/sascha.koenig/ap/PM/.okf/`; das Konzept zu diesem Repo ist `.okf/systems/az-agent-defaults.md`. Ändern sich Zweck, Schnittstellen oder Abhängigkeiten dieses Repos, dort das Konzept aktualisieren und `.okf/log.md` ergänzen.
|
|
||||||
|
|
||||||
Direkte Abhängigkeiten:
|
|
||||||
|
|
||||||
- Ausgeliefert durch `az-fleet` (Rollen `agent_lib`/`default_set_delivery`) mit dem Client von `agent-lib`; das Repo-Layout folgt dem agent-lib-/OpenCode-Standard.
|
|
||||||
- `az-hilfe` und `az-datenanalyse` haben ein abweichendes Gegenstück in Saschas privatem Skill-Repo `agent-prod`.
|
|
||||||
- `mcp/zugferd-service.yaml` ist das Referenz-Fragment für den Dienst aus `zugferd-service`.
|
|
||||||
<!-- END PM-PROJEKTLANDSCHAFT -->
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
# Project Instructions for AI Agents
|
|
||||||
|
|
||||||
This file provides instructions and context for AI coding agents working on this project.
|
|
||||||
|
|
||||||
<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:6cd5cc61 -->
|
|
||||||
## Beads Issue Tracker
|
|
||||||
|
|
||||||
This project uses **bd (beads)** for issue tracking. Run `bd prime` to see full workflow context and commands.
|
|
||||||
|
|
||||||
### Quick Reference
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bd ready # Find available work
|
|
||||||
bd show <id> # View issue details
|
|
||||||
bd update <id> --claim # Claim work
|
|
||||||
bd close <id> # Complete work
|
|
||||||
```
|
|
||||||
|
|
||||||
### Rules
|
|
||||||
|
|
||||||
- Use `bd` for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists
|
|
||||||
- Run `bd prime` for detailed command reference and session close protocol
|
|
||||||
- Use `bd remember` for persistent knowledge — do NOT use MEMORY.md files
|
|
||||||
|
|
||||||
**Architecture in one line:** issues live in a local Dolt DB; sync uses `refs/dolt/data` on your git remote; `.beads/issues.jsonl` is a passive export. See https://github.com/gastownhall/beads/blob/main/docs/SYNC_CONCEPTS.md for details and anti-patterns.
|
|
||||||
|
|
||||||
## Agent Context Profiles
|
|
||||||
|
|
||||||
The managed Beads block is task-tracking guidance, not permission to override repository, user, or orchestrator instructions.
|
|
||||||
|
|
||||||
- **Conservative (default)**: Use `bd` for task tracking. Do not run git commits, git pushes, or Dolt remote sync unless explicitly asked. At handoff, report changed files, validation, and suggested next commands.
|
|
||||||
- **Minimal**: Keep tool instruction files as pointers to `bd prime`; use the same conservative git policy unless active instructions say otherwise.
|
|
||||||
- **Team-maintainer**: Only when the repository explicitly opts in, agents may close beads, run quality gates, commit, and push as part of session close. A current "do not commit" or "do not push" instruction still wins.
|
|
||||||
|
|
||||||
## Session Completion
|
|
||||||
|
|
||||||
This protocol applies when ending a Beads implementation workflow. It is subordinate to explicit user, repository, and orchestrator instructions.
|
|
||||||
|
|
||||||
1. **File issues for remaining work** - Create beads for anything that needs follow-up
|
|
||||||
2. **Run quality gates** (if code changed) - Tests, linters, builds
|
|
||||||
3. **Update issue status** - Close finished work, update in-progress items
|
|
||||||
4. **Handle git/sync by active profile**:
|
|
||||||
```bash
|
|
||||||
# Conservative/minimal/default: report status and proposed commands; wait for approval.
|
|
||||||
git status
|
|
||||||
|
|
||||||
# Team-maintainer opt-in only, unless current instructions forbid it:
|
|
||||||
git pull --rebase
|
|
||||||
git push
|
|
||||||
git status
|
|
||||||
```
|
|
||||||
5. **Hand off** - Summarize changes, validation, issue status, and any blocked sync/commit/push step
|
|
||||||
|
|
||||||
**Critical rules:**
|
|
||||||
- Explicit user or orchestrator instructions override this Beads block.
|
|
||||||
- Do not commit or push without clear authority from the active profile or the current user request.
|
|
||||||
- If a required sync or push is blocked, stop and report the exact command and error.
|
|
||||||
<!-- END BEADS INTEGRATION -->
|
|
||||||
|
|
||||||
|
|
||||||
## Build & Test
|
|
||||||
|
|
||||||
_Add your build and test commands here_
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Example:
|
|
||||||
# npm install
|
|
||||||
# npm test
|
|
||||||
```
|
|
||||||
|
|
||||||
## Architecture Overview
|
|
||||||
|
|
||||||
_Add a brief overview of your project architecture_
|
|
||||||
|
|
||||||
## Conventions & Patterns
|
|
||||||
|
|
||||||
_Add your project-specific conventions here_
|
|
||||||
|
|
||||||
<!-- BEGIN PM-PROJEKTLANDSCHAFT -->
|
|
||||||
## Projektlandschaft
|
|
||||||
|
|
||||||
Dieses Repo ist eines von mehreren Projekten unter `/home/sascha.koenig/ap`. Gesamtübersicht (Zweck, Remotes, Abhängigkeiten aller Repos): `/home/sascha.koenig/ap/PM/CLAUDE.md`. Firmen- und IT-Wissen steht im OKF-Bündel `/home/sascha.koenig/ap/PM/.okf/`; das Konzept zu diesem Repo ist `.okf/systems/az-agent-defaults.md`. Ändern sich Zweck, Schnittstellen oder Abhängigkeiten dieses Repos, dort das Konzept aktualisieren und `.okf/log.md` ergänzen.
|
|
||||||
|
|
||||||
Direkte Abhängigkeiten:
|
|
||||||
|
|
||||||
- Ausgeliefert durch `az-fleet` (Rollen `agent_lib`/`default_set_delivery`) mit dem Client von `agent-lib`; das Repo-Layout folgt dem agent-lib-/OpenCode-Standard.
|
|
||||||
- `az-hilfe` und `az-datenanalyse` haben ein abweichendes Gegenstück in Saschas privatem Skill-Repo `agent-prod`.
|
|
||||||
- `mcp/zugferd-service.yaml` ist das Referenz-Fragment für den Dienst aus `zugferd-service`.
|
|
||||||
<!-- END PM-PROJEKTLANDSCHAFT -->
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
This repository is being used as a Dolt remote.
|
||||||
|
|
||||||
|
ref=refs/dolt/data
|
||||||
|
|
||||||
|
head=8f72ec8ffa22824872ea6f721efd739157de3e55
|
||||||
|
|
||||||
|
timestamp=2026-11-14T11:00:44Z
|
||||||
@@ -1,480 +0,0 @@
|
|||||||
# az-agent-defaults — Company-Default-Set für Agenten-Artefakte
|
|
||||||
|
|
||||||
Dieses Repo ist die **eine Wahrheitsquelle** für die Standard-Artefakte, die jede
|
|
||||||
Agenten-Workstation der AZ-Gruppe gespiegelt bekommt. Es ist ein **reines
|
|
||||||
Content-Repo**: hier leben nur die Inhalte — die Technik, die sie ausliefert und
|
|
||||||
absichert, gehört in das Fleet-Repo `az-fleet` (siehe [Trennung Content /
|
|
||||||
Mechanismus](#trennung-content--mechanismus)).
|
|
||||||
|
|
||||||
Das Repo hervorgegangen aus `az-agent-skills` und löst es ab: der alte Name
|
|
||||||
würde lügen, seit neben Skills auch Commands, Agenten-Definitionen und
|
|
||||||
MCP-Server-Anbindungen dazugekommen sind.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Wohin gehört mein Beitrag?
|
|
||||||
|
|
||||||
| Ich möchte beitragen … | Verzeichnis | Form |
|
|
||||||
|---|---|---|
|
|
||||||
| einen Skill (Verhaltens-Anweisung, die der Agent bei Bedarf lädt) | `skills/<name>/` | Ordner mit `SKILL.md` |
|
|
||||||
| einen Command (/slash-Befehl, wiederverwendbarer Prompt) | `commands/<name>.md` | Markdown-Datei mit Frontmatter |
|
|
||||||
| einen Agenten (spezialisiertes Profil als Primäragent oder Subagent) | `agents/<name>.md` | Markdown-Datei mit Frontmatter |
|
|
||||||
| einen MCP-Server (Werkzeug-Anbindung) | `mcp/<name>.yaml` | Konfigurations-Fragment |
|
|
||||||
|
|
||||||
Kurzform zum Einsortieren:
|
|
||||||
|
|
||||||
- **Verhalten beibringen** („mach X, wenn Y") → `skills/`
|
|
||||||
- **Wiederkehrenden Prompt als Tastendruck** → `commands/`
|
|
||||||
- **Eigenes Agenten-Profil / Prüf-Subagenten** → `agents/`
|
|
||||||
- **Werkzeug anbinden** (API, Datenquelle) → `mcp/`
|
|
||||||
|
|
||||||
Alle vier Verzeichnisse werden von der Delivery-Rolle des Fleet-Repos gelesen
|
|
||||||
— und **nur** diese vier. Alles andere im Repo (z. B. `tests/fixtures/`, diese
|
|
||||||
README, die Spec) wird nie ausgeliefert.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Guard-Regeln je Artefakt-Typ
|
|
||||||
|
|
||||||
Die Delivery-Rolle in `az-fleet` führt vor jedem Rollout einen **deterministischen
|
|
||||||
Pre-Flight-Guard** aus: Struktur-, Frontmatter- und Platzhalter-Checks je Typ.
|
|
||||||
Ein ungültiges Artefakt **bricht den Run kontrolliert ab** — kaputte Inhalte
|
|
||||||
erreichen nie eine Maschine. Die Regeln unten beschreiben, was der Guard
|
|
||||||
mindestens prüft; die Implementierung lebt in `az-fleet`, nicht hier.
|
|
||||||
|
|
||||||
### `skills/` — Skills
|
|
||||||
|
|
||||||
**Struktur:** ein Ordner pro Skill, darin genau eine `SKILL.md`.
|
|
||||||
|
|
||||||
```
|
|
||||||
skills/
|
|
||||||
└── mein-skill/
|
|
||||||
└── SKILL.md
|
|
||||||
```
|
|
||||||
|
|
||||||
**Anforderungen:**
|
|
||||||
|
|
||||||
- Ordnername = Skill-Name (kein Leerzeichen, keine Umlaute; kebab-case).
|
|
||||||
- `SKILL.md` beginnt mit einem YAML-Frontmatter-Öffner (Delimited by `---`).
|
|
||||||
- Frontmatter enthält **Pflichtfelder** `name` und `description`.
|
|
||||||
- `name` muss zum Ordnernamen passen.
|
|
||||||
- `description` ist ein Satz, der sagt, wann der Skill greift.
|
|
||||||
- Darunter: Anweisungen als normales Markdown.
|
|
||||||
|
|
||||||
**Minimalbeispiel:**
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
---
|
|
||||||
name: mein-skill
|
|
||||||
description: Prüft Zugferd-Rechnungen auf formal korrektes XML, wenn der Nutzer eine XRechnung validieren will.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Zugferd-Validierung
|
|
||||||
|
|
||||||
Prüfe die übergebene Datei gegen das CIUS-XRechnung-Schema …
|
|
||||||
```
|
|
||||||
|
|
||||||
**Typische Fehler, die der Guard abbricht:** fehlender Ordner, fehlende
|
|
||||||
`SKILL.md`, fehlendes/leeres Frontmatter, `name` ≠ Ordnername, fehlende
|
|
||||||
`description`.
|
|
||||||
|
|
||||||
### `commands/` — Commands (/slash-Befehle)
|
|
||||||
|
|
||||||
**Struktur:** eine Markdown-Datei pro Command, direkt in `commands/`.
|
|
||||||
|
|
||||||
```
|
|
||||||
commands/
|
|
||||||
└── ticket-abarbeiten.md
|
|
||||||
```
|
|
||||||
|
|
||||||
**Anforderungen:**
|
|
||||||
|
|
||||||
- Dateiname ohne `.md` = Command-Name → in der Sitzung als `/ticket-abarbeiten` verfügbar.
|
|
||||||
- Frontmatter mit:
|
|
||||||
- `description` (**Pflicht**) — erscheint in der Command-Übersicht;
|
|
||||||
- `agent` (optional) — Agent, der den Command ausführt;
|
|
||||||
- `model` (optional) — Modell für die Ausführung.
|
|
||||||
- Body = **Template**. Argument-Platzhalter sind erlaubt und erwünscht:
|
|
||||||
- `$ARGUMENTS` — alles, was der Nutzer nach dem Command tippt;
|
|
||||||
- `$1` … `$n` — positionelle Argumente.
|
|
||||||
|
|
||||||
**Minimalbeispiel:**
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
---
|
|
||||||
description: Arbeitet das genannte beads-Ticket ab (claimen, umsetzen, schließen).
|
|
||||||
agent: build
|
|
||||||
---
|
|
||||||
|
|
||||||
Arbeite das Ticket $ARGUMENTS ab: zeige es mir, claime es, setze es um und
|
|
||||||
schließ es nach meiner Freigabe.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Typische Fehler:** fehlendes Frontmatter, fehlende `description`, Command-Name
|
|
||||||
mit Leerzeichen/Umlauten (die später zum /slash-Namen wird).
|
|
||||||
|
|
||||||
### `agents/` — Agenten-Definitionen
|
|
||||||
|
|
||||||
**Struktur:** eine Markdown-Datei pro Agent, direkt in `agents/`. Dateiname =
|
|
||||||
Agentenname.
|
|
||||||
|
|
||||||
**Anforderungen:**
|
|
||||||
|
|
||||||
- Frontmatter mit:
|
|
||||||
- `description` (**Pflicht**) — sagt, wofür der Agent da ist;
|
|
||||||
- `mode` (**Pflicht**) — `primary` (per Agentenwechsel wählbar) oder
|
|
||||||
`subagent` (per @mention und automatisch über das Task-Tool startbar);
|
|
||||||
- `model`, `temperature` (optional);
|
|
||||||
- Permission-/Tool-Profil (optional, aber für Subagents empfohlen) — z. B.
|
|
||||||
ein Read-only-Prüfer ohne Edit/Bash.
|
|
||||||
- Body = Systemprompt des Agenten.
|
|
||||||
|
|
||||||
**Harte Sicherheitsregeln (Guard prüft mit):**
|
|
||||||
|
|
||||||
1. **Subagent-Fähigkeit bleibt erhalten:** keine Definition darf das Task-Tool
|
|
||||||
bzw. die Delegation an Subagents so einschränken, dass Subagents nicht mehr
|
|
||||||
startbar wären. Spezialisierung ja — die Fähigkeit von Agenten, selbst zu
|
|
||||||
delegieren und zu parallelisieren, wird nie verbaut.
|
|
||||||
2. **Niemals Rechte ausweiten:** Permission-Profile dürfen innerhalb des
|
|
||||||
verwalteten Regelwerks (Managed-Layer) nur **einschränken**, nie erlauben,
|
|
||||||
was der Managed-Layer verweigert. Provider-Lock und Permission-Regelwerk
|
|
||||||
gelten unabhängig vom aktiven Agenten weiter.
|
|
||||||
|
|
||||||
**Minimalbeispiel (Read-only-Subagent):**
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
---
|
|
||||||
description: Prüft Ergebnisse gegen Abnahme-Kriterien, ohne selbst zu ändern.
|
|
||||||
mode: subagent
|
|
||||||
temperature: 0.1
|
|
||||||
tools:
|
|
||||||
- read
|
|
||||||
- grep
|
|
||||||
- glob
|
|
||||||
---
|
|
||||||
|
|
||||||
Du bist ein Read-only-Prüfer. Gleiche das vorgelegte Ergebnis gegen die
|
|
||||||
Abnahme-Kriterien ab und berichte nur — du editierst und schreibst nichts.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Typische Fehler:** fehlende `mode`, `mode` mit ungültigem Wert, Frontmatter
|
|
||||||
ohne `description`.
|
|
||||||
|
|
||||||
### `mcp/` — MCP-Server-Fragmente
|
|
||||||
|
|
||||||
**Struktur:** eine YAML-Datei pro Server: `mcp/<server-name>.yaml`. Jede Datei
|
|
||||||
ist ein **Fragment für den `mcp`-Konfigurationsschlüssel** — der Server-Name
|
|
||||||
steht als Schlüssel, darunter die Definition. Die Fragmente werden auf dem
|
|
||||||
Controller in die verwaltete Konfiguration (Managed-Layer) gemerged — MCPs sind
|
|
||||||
Werkzeuge und damit sicherheitsrelevant, sie gehören in den admin-kontrollierten
|
|
||||||
Layer, nicht auf die nutzerbeschreibbare Ebene.
|
|
||||||
|
|
||||||
**Anforderungen:**
|
|
||||||
|
|
||||||
- **Standard ist remote/streamable** mit OAuth: `type: remote` plus `url`;
|
|
||||||
die Anmeldung läuft zur Laufzeit einmalig pro Nutzer über dessen
|
|
||||||
Microsoft-Konto — identitätsgebunden. Ein OAuth-Server braucht daher **kein**
|
|
||||||
Credential-Feld im Fragment.
|
|
||||||
- `enabled` (optional) — Standard ist an.
|
|
||||||
- `codemode: false` **Pflicht für Fleet-Hosts**: opencode V2 defaultet
|
|
||||||
MCP-Server auf `codemode: true` — die Tools sind dann NUR über das
|
|
||||||
`execute`-Tool (Code Mode) erreichbar und liegen nicht auf der nativen
|
|
||||||
Tool-Liste des Modells. Die Fleet sperrt `execute` fleetweit (ADR-0004,
|
|
||||||
az-fleet) — ohne `codemode: false` ist ein Server verbunden und
|
|
||||||
authentifiziert, aber der Agent sieht die Tools nicht. Siehe Vorfall
|
|
||||||
Metabase auf AZLT126 (06.10.2026).
|
|
||||||
- `local`-Server (`command`/`env`) nur als dokumentierte Ausnahme.
|
|
||||||
- **Secrets niemals im Repo — ohne Ausnahme.** Wo ein statischer Key nötig
|
|
||||||
ist (Nicht-OAuth-Ausnahme), steht im Fragment nur ein Platzhalter der Form
|
|
||||||
`` ${VAULT:<key-name>} ``; der echte Key liegt im Vault des Fleet-Repos und
|
|
||||||
wird erst beim Merge auf dem Controller substituiert. Im Repo bleibt nie ein
|
|
||||||
Secret.
|
|
||||||
- **Vault-Key-Namensschema:** `<server-name>-<verwendungszweck>` in
|
|
||||||
kebab-case — z. B. `${VAULT:az-zoll-service-api-key}` für den API-Key
|
|
||||||
des Servers `az-zoll-service`. Ein Key pro Credential, im Vault der IT
|
|
||||||
eindeutig zuordenbar.
|
|
||||||
|
|
||||||
**Minimalbeispiel (OAuth-Standardfall):**
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# mcp/zugferd-service.yaml
|
|
||||||
zugferd-service:
|
|
||||||
type: remote
|
|
||||||
url: https://mcp.example.az.local/zugferd
|
|
||||||
enabled: true
|
|
||||||
```
|
|
||||||
|
|
||||||
**Beispiel (dokumentierte Key-Ausnahme):**
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# mcp/az-zoll-service.yaml — kein OAuth verfügbar: statischer Key aus dem Vault
|
|
||||||
az-zoll-service:
|
|
||||||
type: remote
|
|
||||||
url: https://mcp.example.az.local/zoll
|
|
||||||
headers:
|
|
||||||
Authorization: Bearer ${VAULT:az-zoll-service-api-key}
|
|
||||||
enabled: true
|
|
||||||
```
|
|
||||||
|
|
||||||
**Typische Fehler:** Server-Name fehlt (Datei ist keine Fragment-Struktur),
|
|
||||||
fehlende `url`, `type` fehlt bei remote, ein Secret im Klartext (Guard bricht
|
|
||||||
ab — auch in Kommentaren), Platzhalter in anderer Syntax als `${VAULT:…}`.
|
|
||||||
|
|
||||||
#### `x-fleet-*` — Zielgruppen-Metadaten (reservierter Präfix)
|
|
||||||
|
|
||||||
Der Präfix `x-fleet-` ist **reserviert für Fleet-Steuinformation** im
|
|
||||||
Server-Body — er transportiert keine OpenCode-Konfiguration. Die Delivery-Rolle
|
|
||||||
im Fleet-Repo (`az-fleet`) stript jeden `x-fleet-*`-Schlüssel **vor dem Merge**
|
|
||||||
aus dem Server-Body heraus (die Schema-Validierung auf den Hosts kennt diese
|
|
||||||
Schlüssel nicht) und wertet sie separat aus.
|
|
||||||
|
|
||||||
- **`x-fleet-audience`** — Liste von **Rollen-Labels** (kleine Buchstaben,
|
|
||||||
Ziffern, Bindestrich; Form `^[a-z0-9][a-z0-9-]*$`, z. B. `vertrieb`).
|
|
||||||
Ein Host erhält den Server genau dann, wenn mindestens eine Rolle seiner
|
|
||||||
Zielnutzer (`fleet_user_roles` im Fleet-Inventory, abgeleitet aus der
|
|
||||||
Abteilungsgruppe `dept_<label>` plus `fleet_extra_roles`) ein Label aus
|
|
||||||
dieser Liste trägt (ODER-Logik bei mehreren Rollen).
|
|
||||||
- **Einziger Zielgruppen-Weg für MCP:** `agent-lib.labels.json` wirkt auf
|
|
||||||
MCP-Server **nicht** (siehe unten). Ein Fragment ohne `x-fleet-audience`
|
|
||||||
geht an alle — auch wenn sein Server-Name in der Labels-Datei steht.
|
|
||||||
Die Ablösung durch die Labels-Datei ist in az-fleet geplant
|
|
||||||
(Beads `az-fleet-e0z`); bis dahin bleibt `x-fleet-audience` Pflicht für
|
|
||||||
abteilungsspezifische MCP-Server.
|
|
||||||
- **Fehlt das Metadatum**, ist das Fragment **Base-Set**: der Server geht an
|
|
||||||
alle Hosts (Abwärtskompatenz — bestehende Fragmente brauchen keine Änderung).
|
|
||||||
- **Bekannte Schlüssel sind whitelisted**: unbekannte `x-fleet-*`-Schlüssel
|
|
||||||
brechen den Fleet-Guard kontrolliert ab (Tippfehler-Schutz — Metadaten
|
|
||||||
dürfen nie still verworfen werden). Neue Schlüssel werden nur gemeinsam mit
|
|
||||||
dem Fleet-Repo eingeführt.
|
|
||||||
- Key-Bedarf deklariert das Fragment **implizit** über `{env:AZ_USER_*}`-
|
|
||||||
Literale im Body — der Fleet-Merge leitet daraus ab, welche Per-User-Keys
|
|
||||||
der Server braucht (Guard-Kette, ADR-0016/0017).
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# mcp/raynet.yaml — Zielgruppen-Beispiel: nur Vertriebs-Hosts
|
|
||||||
raynet:
|
|
||||||
type: remote
|
|
||||||
url: https://app.raynet.cz/api/mcp
|
|
||||||
headers:
|
|
||||||
Authorization: Bearer {env:AZ_USER_RAYNET_MCP}
|
|
||||||
enabled: true
|
|
||||||
x-fleet-audience: [vertrieb]
|
|
||||||
```
|
|
||||||
|
|
||||||
Welche Nutzer welche Rolle tragen, entscheidet **ausschließlich das
|
|
||||||
Fleet-Inventory** (`fleet_user_roles`, az-fleet) — dieses Repo deklariert
|
|
||||||
Zielgruppen nur als Labels (Trennung Content / Mechanismus: hier die
|
|
||||||
Zielgruppe, dort die Empfänger).
|
|
||||||
|
|
||||||
**Typische Fehler:** Rollen-Label mit Großbuchstaben oder Leerzeichen,
|
|
||||||
leere `x-fleet-audience: []`-Liste (statt leerer Liste das Metadatum weglassen),
|
|
||||||
unbekannte `x-fleet-*`-Schlüssel.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Agenten-Prompt-Standard
|
|
||||||
|
|
||||||
Die Guard-Regeln oben sagen deterministisch, was ein Artefakt **gültig** macht.
|
|
||||||
Dieser Abschnitt sagt, was ein Agenten-Prompt **gut** macht — und ist bewusst
|
|
||||||
eine **weiche Regel**: Der Fleet-Guard erzwingt sie nicht. Geprüft wird vom
|
|
||||||
Prüfer-Agenten `az-pruefer` (LLM-Prüfung) — ein Verstoß bricht keinen Rollout
|
|
||||||
ab, wird aber im Prüfbericht als Mangel benannt und muss behoben oder
|
|
||||||
ausdrücklich begründet werden.
|
|
||||||
|
|
||||||
### Prompt-Skelett
|
|
||||||
|
|
||||||
Jeder Agenten-Body folgt diesem Skelett (Reihenfolge einhalten; Überschriften
|
|
||||||
dürfen sinngemäß abweichen):
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
<Rollen-Eröffnung: wer du bist, wer dich ruft>
|
|
||||||
|
|
||||||
## Arbeitsweise
|
|
||||||
1. **<Schritt>** — <Anweisung mit erkennbarem Abschlusskriterium>.
|
|
||||||
|
|
||||||
## Ausgabeformat
|
|
||||||
<Output-Vertrag — für Subagents Pflicht, siehe unten>
|
|
||||||
|
|
||||||
## Grenzen
|
|
||||||
- <Was der Agent nie tut; Auth, Fleet-Verwaltung, Eskalation>
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Arbeitsweise:** nummerierte Schritte, jeder mit erkennbarem
|
|
||||||
Abschlusskriterium. Gibt es einen gepflegten Skill fürs Thema — auch aus
|
|
||||||
`external/`, deren Skills via az-fleet auf die Nutzerebene ausgerollt
|
|
||||||
werden —, ist **Skill-Load der erste Schritt** („dünne Agent-Shell über
|
|
||||||
gepflegtem Skill", Muster: `az-office` + `officecli`). Inline-Wissen, das
|
|
||||||
der Skill bereits trägt, bleibt draußen.
|
|
||||||
- **Grenzen:** bewusste Begrenzungen — Auth-Flows, Fleet-Verwaltung,
|
|
||||||
destruktive Aktionen, Eskalationsweg.
|
|
||||||
- **Tool-/MCP-Freigabe:** Schränkt ein Agent Tools ein (`tools:` bzw.
|
|
||||||
`permission:`), muss er jedes benötigte MCP-Tool **explizit freigeben** —
|
|
||||||
MCP-Tools heißen `<ServerName>_<ToolName>` (z. B.
|
|
||||||
`websearch_web_search_exa` für den Server `websearch` aus
|
|
||||||
`mcp/websearch.yaml`).
|
|
||||||
Ohne Profil gelten die Defaults des Harness.
|
|
||||||
|
|
||||||
### Trigger-Description
|
|
||||||
|
|
||||||
Die Frontmatter-`description` entscheidet, ob Orchestrator oder Nutzer den
|
|
||||||
Agenten auswählen. Deshalb:
|
|
||||||
|
|
||||||
- **Subagents** (vom Orchestrator über die Routing-Tabelle gewählt): **In
|
|
||||||
den ersten 80 Zeichen stehen konkrete Beispielfragen/-aufträge**, so wie
|
|
||||||
Nutzer sie tatsächlich stellen — z. B. „Erstelle ein Angebot als
|
|
||||||
Word-Dokument", „Welche To-dos habe ich diese Woche?". Danach Kurzform der
|
|
||||||
Fähigkeiten; Rolle/Zugehörigkeit ans Ende. Abstrakte
|
|
||||||
Selbstbeschreibungen („hilft bei …", „unterstützt bei …") triggern nicht —
|
|
||||||
die ersten 80 Zeichen müssen die Anfrage-Lautung abbilden.
|
|
||||||
- **Primary-Agenten** (vom Nutzer aus einer Liste gewählt): **In den ersten
|
|
||||||
80 Zeichen steht der Missionssatz** — ein prägnanter Satz, wofür der
|
|
||||||
Agent der Standard-Anlaufpunkt ist. Danach Trigger-Beispiele und
|
|
||||||
Fähigkeiten.
|
|
||||||
|
|
||||||
### Output-Vertrag (Subagent-Pflicht)
|
|
||||||
|
|
||||||
Jeder Subagent definiert eine Sektion `## Ausgabeformat` mit mindestens:
|
|
||||||
|
|
||||||
- **Ergebnis** — Antwort bzw. Arbeitsergebnis zuerst;
|
|
||||||
- **Belege** — je Behauptung/Aktion eine Fundstelle: URL, `Datei:Zeile` oder
|
|
||||||
Beleg-ID;
|
|
||||||
- **Offene Punkte** — was unklar, ungeprüft oder Annahme blieb.
|
|
||||||
|
|
||||||
Der Vertrag ist die Verifikations-Grundlage des Orchestrators: Fehlen
|
|
||||||
Belege, lässt er nachbessern. Failure-Regel: **eine Behauptung ohne Beleg ist
|
|
||||||
ein gescheiterter Auftrag** — keine abgeschlossene Arbeit.
|
|
||||||
|
|
||||||
### Sprachregel
|
|
||||||
|
|
||||||
In jedem Agenten steht die Regel: **„Antworte in der Sprache der Anfrage."**
|
|
||||||
(der Orchestrator nutzt die gleichbedeutende Variante „Antworte in der
|
|
||||||
Sprache der Nutzeranfrage.") Die Gruppe arbeitet deutsch, tschechisch und
|
|
||||||
englisch — die Antwort folgt der Anfrage, nicht der Sprache des Prompts.
|
|
||||||
|
|
||||||
### Größen-Grenze
|
|
||||||
|
|
||||||
Agenten-Prompts bleiben unter **10.000 Zeichen**. Wird ein Prompt länger,
|
|
||||||
wandert Inhalt in einen Skill, den der Agent als ersten Schritt lädt
|
|
||||||
(Progressive Disclosure). Dünner Prompt über gepflegtem Skill schlägt fetten
|
|
||||||
Inline-Prompt.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Zielgruppen: `agent-lib.labels.json`
|
|
||||||
|
|
||||||
> **Status:** wirksam. agent-lib ≥ 0.4.0 filtert beim Sync (Doku:
|
|
||||||
> agent-lib-README, Abschnitt „Client labels“; `agent-lib validate` prüft
|
|
||||||
> die Datei mit). az-fleet schreibt die Labels jedes Hosts in die
|
|
||||||
> admin-geschützte Client-Config (ADR-0020, auf `main`, auf vm-test
|
|
||||||
> abgenommen 14.11.2026). Gilt nur für Skills, Commands und Agents —
|
|
||||||
> nicht für MCP-Server.
|
|
||||||
|
|
||||||
Nicht jede Abteilung braucht jeden Skill. Die Datei im Repo-Root legt fest,
|
|
||||||
welche Inhalte **nur** an bestimmte Zielgruppen gehen:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"labels": {
|
|
||||||
"buchhaltung": ["officecli-financial-model"],
|
|
||||||
"controlling": ["officecli-financial-model", "officecli-data-dashboard"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Was nicht in der Datei steht, bekommen alle.** Ein neuer Skill für alle
|
|
||||||
braucht also keinen Eintrag; nur abteilungsspezifische Inhalte werden
|
|
||||||
eingetragen.
|
|
||||||
- Einträge sind **Artefakt-Namen** (Skill-Ordner, Agent-/Command-Dateiname
|
|
||||||
ohne `.md`, auch vendorte Externals) und gelten typübergreifend.
|
|
||||||
- **MCP-Server hier nicht eintragen.** agent-lib liefert MCP nie aus, und
|
|
||||||
az-fleet wertet die Datei für MCP (noch) nicht aus — ein Eintrag besteht
|
|
||||||
zwar den Guard, wirkt aber nicht; der Server ginge weiter an alle.
|
|
||||||
MCP-Zielgruppen steuert `x-fleet-audience` im Fragment (siehe
|
|
||||||
„`x-fleet-*` — Zielgruppen-Metadaten“). Die Umstellung auf diese Datei
|
|
||||||
ist in az-fleet geplant (Beads `az-fleet-e0z`). Unabhängig davon:
|
|
||||||
Server-Namen beschreiben die **Funktion**, nicht das Produkt
|
|
||||||
(`websearch` statt `exa`, `browser` statt `playwright`) — Nutzer sehen
|
|
||||||
den Namen als Präfix der Tools.
|
|
||||||
- Ein Inhalt darf unter mehreren Labels stehen (ODER).
|
|
||||||
- **Labels** sind die Rollen-Labels aus dem Fleet-Inventory: die Abteilungen
|
|
||||||
(`vertrieb`, `controlling`, `logistik`, `personal`, `technik`,
|
|
||||||
`arbeitsvorbereitung`, `qs`, `marketing`, `einkauf`, `beschaffung`,
|
|
||||||
`buchhaltung`, `it`) plus ggf. Zusatzrollen. Form
|
|
||||||
`^[a-z0-9][a-z0-9-]*$`. Wer welches Label trägt, entscheidet
|
|
||||||
ausschließlich az-fleet. Ein **neues Label** muss zuerst in az-fleet ins
|
|
||||||
Label-Vokabular (`fleet_known_role_labels`) — sonst bricht der Rollout
|
|
||||||
rot ab (Tippfehler-Schutz, gilt auch für `x-fleet-audience`).
|
|
||||||
- **Relevanz, kein Zugriffsschutz:** Das Repo ist lesbar, jeder Client hat
|
|
||||||
den vollen Stand im Cache. Vertrauliches gehört nicht in Skills.
|
|
||||||
|
|
||||||
**Abhängigkeiten beachten:** Ein Agent darf nicht fest auf einen Agenten
|
|
||||||
oder Skill verweisen, der ein Label trägt, das er selbst nicht hat — auf
|
|
||||||
Rechnern ohne dieses Label fehlt das Ziel. `az-orchestrator` routet deshalb
|
|
||||||
ohne feste Tabelle über die Subagents, die das Task-Tool auf dem jeweiligen
|
|
||||||
Rechner anbietet; ein neuer Subagent wird allein über seine
|
|
||||||
Trigger-Description gefunden (siehe Agenten-Prompt-Standard).
|
|
||||||
|
|
||||||
## Trennung Content / Mechanismus
|
|
||||||
|
|
||||||
| Zuständigkeit | Repo |
|
|
||||||
|---|---|
|
|
||||||
| **Inhalte** (Skills, Commands, Agents, MCP-Fragmente) | **az-agent-defaults** (dieses Repo) |
|
|
||||||
| **Mechanismus** (Guard-Engine, Auslieferung/Spiegel, Drift-Reparatur, Vault-Substitution) | **az-fleet** |
|
|
||||||
|
|
||||||
Konsequenzen für Contributors:
|
|
||||||
|
|
||||||
- Dieses Repo enthält **keine** Auslieferungs-Logik, kein Playbook, kein Secret.
|
|
||||||
- Skills, Commands und Agenten-Definitionen zieht **agent-lib auf dem
|
|
||||||
Rechner** selbst (ADR-0009, alle paar Stunden, unabhängig vom
|
|
||||||
Fleet-Run) in die Nutzerebene: Upstream gelöschte oder per Label
|
|
||||||
abgewählte Artefakte werden entfernt, **lokal geänderte Kopien bleiben**
|
|
||||||
erhalten (Three-State). az-fleet installiert agent-lib und schreibt
|
|
||||||
dessen Config inklusive Labels.
|
|
||||||
- MCP-Fragmente werden auf dem Controller in den **Managed-Layer** gemerged und
|
|
||||||
unterliegen dessen Admin-ACL.
|
|
||||||
- Der Stand dieses Repos wird über einen **Repo-Ref gepinnt** (Default: `main`).
|
|
||||||
Jeder Rollout ist damit deterministisch reproduzierbar; die Pin-Logik lebt in
|
|
||||||
`az-fleet`.
|
|
||||||
|
|
||||||
## `tests/fixtures/` — Testgegenstände, nie ausgeliefert
|
|
||||||
|
|
||||||
Guard-Tests brauchen gültige und ungültige Artefakt-Exemplare als
|
|
||||||
Testgegenstände. Diese **Fixtures** leben unter `tests/fixtures/` — denn die
|
|
||||||
Delivery-Rolle liest **nur die vier Typ-Verzeichnisse**, also kann unter
|
|
||||||
`tests/fixtures/` nichts „mitschwimmen" und versehentlich ausgeliefert werden.
|
|
||||||
(Sonntags-Entscheidung: bewusst kein eigener Auslieferungs-Ausschluss-Mechanismus,
|
|
||||||
sondern Trennung durch das Lese-Muster der Delivery-Rolle.)
|
|
||||||
|
|
||||||
Konvention: je Artefakt-Typ ein Unterordner, darin `valid/`- und
|
|
||||||
`invalid/`-Exemplare, an denen der Guard durch- bzw. abbricht.
|
|
||||||
|
|
||||||
```
|
|
||||||
tests/fixtures/
|
|
||||||
├── skills/valid/… skills/invalid/…
|
|
||||||
├── commands/valid/… commands/invalid/…
|
|
||||||
├── agents/valid/… agents/invalid/… agents/demo/…
|
|
||||||
└── mcp/valid/… mcp/invalid/…
|
|
||||||
```
|
|
||||||
|
|
||||||
**Regel:** alles unter `tests/fixtures/` ist Testgegenstand und wird **nie
|
|
||||||
ausgeliefert** — nichts daraus in die Typ-Verzeichnisse schieben; umgekehrt
|
|
||||||
sind echte Artefakte dort fehl am Platz.
|
|
||||||
|
|
||||||
Die Exemplare unter `agents/demo/` bestehen den **Guard**, verstoßen aber
|
|
||||||
gegen den (weichen) Agenten-Prompt-Standard — sie sind Prüfgut für
|
|
||||||
`az-pruefer`, nicht für den Fleet-Guard.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Beitrags-Kurzanleitung
|
|
||||||
|
|
||||||
1. Richtiges Verzeichnis anhand der Tabelle oben wählen.
|
|
||||||
2. Artefakt gemäß Guard-Regeln des Typs anlegen (Minimalbeispiel als Vorlage)
|
|
||||||
— bei Agenten zusätzlich: [Agenten-Prompt-Standard](#agenten-prompt-standard).
|
|
||||||
3. Prüfen: erfüllt das Artefakt **alle** Pflichtpunkte der Checkliste seines Typs?
|
|
||||||
Wenn unsicher — die Checklisten sind vollständig; es braucht kein
|
|
||||||
Architektur-Wissen.
|
|
||||||
4. Commit/PR wie gewohnt. Der Guard läuft als Pre-Flight beim nächsten
|
|
||||||
Rollout in `az-fleet`; erst nach Rollout und App-Neustart ist das Artefakt
|
|
||||||
auf den Workstations.
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"labels": {
|
|
||||||
"it": [
|
|
||||||
"az-pruefer",
|
|
||||||
"basecamp-connect",
|
|
||||||
"basecamp-doctor",
|
|
||||||
"grill-me",
|
|
||||||
"grilling",
|
|
||||||
"handoff",
|
|
||||||
"to-questionnaire",
|
|
||||||
"to-spec",
|
|
||||||
"wait-what",
|
|
||||||
"writing-for-agents"
|
|
||||||
],
|
|
||||||
"buchhaltung": [
|
|
||||||
"officecli-financial-model",
|
|
||||||
"officecli-data-dashboard"
|
|
||||||
],
|
|
||||||
"controlling": [
|
|
||||||
"officecli-financial-model",
|
|
||||||
"officecli-data-dashboard"
|
|
||||||
],
|
|
||||||
"marketing": [
|
|
||||||
"officecli-pitch-deck"
|
|
||||||
],
|
|
||||||
"vertrieb": [
|
|
||||||
"officecli-pitch-deck"
|
|
||||||
],
|
|
||||||
"personal": [
|
|
||||||
"officecli-word-form"
|
|
||||||
],
|
|
||||||
"qs": [
|
|
||||||
"officecli-word-form"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"sources": {
|
|
||||||
"basecamp": {
|
|
||||||
"url": "https://github.com/basecamp/basecamp-cli.git",
|
|
||||||
"ref": "main",
|
|
||||||
"rev": "dd786ad2df83fb6ac57e6ad83a32c9af42226d97",
|
|
||||||
"selection": {
|
|
||||||
"mode": "all"
|
|
||||||
},
|
|
||||||
"inventory": {
|
|
||||||
"skills": [
|
|
||||||
"basecamp",
|
|
||||||
"basecamp-connect",
|
|
||||||
"basecamp-doctor"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"warnings": [
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - /basecamp-connect",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - basecamp auth agent connect",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - basecamp connect doctor",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - basecamp connect service install",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - basecamp connect setup",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - basecamp connect status",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - connect an agent",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - connect.json",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - connector not ready",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - held records",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - is the connector running",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - redispatch an event",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - release the hold",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - serve a project",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - set up the connector",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - start the connector",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - stop the connector",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): - who can drive the agent",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): Connect a Basecamp agent to this computer and manage the local agent",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): Use when asked to connect an agent, set up or change the connector, add or",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): and readiness (basecamp connect setup). Explains every setup",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): carries out a person's decisions on its records (redispatch, discard,",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): connect.json (who may drive the agent, which Basecamp projects it serves),",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): connector holds.",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): connector through its systemd service, and reads the pointer lines it",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): release, the cutover's shadow promote and import). Starts and supervises the",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): remove a project, change who can drive the agent, find out why setup says",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): result and failure. Also reads what the connector ran (status, doctor) and",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): the connector is not ready, or see, retry, close or release what the",
|
|
||||||
"skills/basecamp-connect: malformed frontmatter line (missing colon): writes.",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): # Common actions",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): # Direct invocations",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): # My work",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): # Questions",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): # Resource actions",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): # Search and discovery",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): # URLs",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - /basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - 3.basecamp.com",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - assigned to me",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp account",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp assignment",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp bookmarks",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp bubble-up",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp calendars",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp campfire",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp cards",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp chat",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp check-in",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp checkin",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp document",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp drafts",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp file",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp gauge",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp messages",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp notes",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp notification",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp project",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp schedule",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp template",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp timeline",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp todos",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecamp webhook",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - basecampapi.com",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - can I basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - check basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - comment on basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - complete todo",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - create todo",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - does basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - download file",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - fetch from basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - find in basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - get from basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - how do I basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - link to basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - list basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - look up basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - mark done",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - move card",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - my assignments",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - my basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - my notifications",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - my schedule",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - my tasks",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - my todos",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - overdue todos",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - post to basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - project gauge",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - project progress",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - search basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - show basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - track in basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - upcoming events",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - what basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): - what's in basecamp",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): Use for ANY Basecamp question or action.",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): bubble-up, drafts, notes, calendars, and accounts.",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): messages, files, schedule, check-ins, timeline, recordings, templates, webhooks,",
|
|
||||||
"skills/basecamp: malformed frontmatter line (missing colon): subscriptions, lineup, chat, pings, gauges, assignments, notifications, bookmarks,"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"mattpocock": {
|
|
||||||
"url": "https://github.com/mattpocock/skills.git",
|
|
||||||
"ref": "main",
|
|
||||||
"rev": "c55ee46073ed923f86ce59a5eb3b6d895095d1b7",
|
|
||||||
"selection": {
|
|
||||||
"mode": "include",
|
|
||||||
"include": [
|
|
||||||
"grill-me",
|
|
||||||
"grilling",
|
|
||||||
"handoff",
|
|
||||||
"teach",
|
|
||||||
"to-questionnaire",
|
|
||||||
"to-spec",
|
|
||||||
"wait-what",
|
|
||||||
"writing-for-agents"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"inventory": {
|
|
||||||
"skills": [
|
|
||||||
"grill-me",
|
|
||||||
"grilling",
|
|
||||||
"handoff",
|
|
||||||
"teach",
|
|
||||||
"to-questionnaire",
|
|
||||||
"to-spec",
|
|
||||||
"wait-what",
|
|
||||||
"writing-for-agents"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"officecli": {
|
|
||||||
"url": "https://github.com/iOfficeAI/OfficeCLI.git",
|
|
||||||
"ref": "main",
|
|
||||||
"rev": "dc68d63f5285005a9e7c5943dfb321d93ee2a076",
|
|
||||||
"discovery": {
|
|
||||||
"skills_dir": "skills"
|
|
||||||
},
|
|
||||||
"selection": {
|
|
||||||
"mode": "all",
|
|
||||||
"exclude": [
|
|
||||||
"morph-ppt",
|
|
||||||
"morph-ppt-3d",
|
|
||||||
"officecli-academic-paper"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"inventory": {
|
|
||||||
"skills": [
|
|
||||||
"officecli",
|
|
||||||
"officecli-data-dashboard",
|
|
||||||
"officecli-docx",
|
|
||||||
"officecli-financial-model",
|
|
||||||
"officecli-pitch-deck",
|
|
||||||
"officecli-pptx",
|
|
||||||
"officecli-word-form",
|
|
||||||
"officecli-xlsx"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"superpowers": {
|
|
||||||
"url": "https://github.com/obra/superpowers.git",
|
|
||||||
"ref": "main",
|
|
||||||
"rev": "8ca22dba9a94f28898bbce59f2537ff4d87c747d",
|
|
||||||
"selection": {
|
|
||||||
"mode": "include",
|
|
||||||
"include": [
|
|
||||||
"brainstorming"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"inventory": {
|
|
||||||
"skills": [
|
|
||||||
"brainstorming"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"talk": {
|
|
||||||
"url": "https://code.m3ta.dev/m3tam3re/talk.git",
|
|
||||||
"ref": "v0.1.2",
|
|
||||||
"rev": "02d66a141e41e174302a1d8339b34ed05f814d92",
|
|
||||||
"selection": {
|
|
||||||
"mode": "include",
|
|
||||||
"include": [
|
|
||||||
"talk"
|
|
||||||
],
|
|
||||||
"exclude_types": [
|
|
||||||
"agents",
|
|
||||||
"commands",
|
|
||||||
"mcp"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"inventory": {
|
|
||||||
"skills": [
|
|
||||||
"talk"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
---
|
|
||||||
description: "Welche To-dos habe ich diese Woche? Lege im Projekt X ein To-do an, poste diese Nachricht in den Campfire-Chat. Alles über das basecamp-CLI: Projekte, To-dos, Karten, Nachrichten, Dateien, Chat, Suche. Basecamp-Subagent der AZ-Gruppe."
|
|
||||||
mode: subagent
|
|
||||||
model: az-litellm/claude-haiku-4-5
|
|
||||||
temperature: 0.2
|
|
||||||
tools:
|
|
||||||
bash: true
|
|
||||||
read: true
|
|
||||||
glob: true
|
|
||||||
grep: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Du bist der Basecamp-Agent der AZ-Gruppe. Wenn dich der Orchestrator oder ein
|
|
||||||
Nutzer per Task-Tool oder @mention ruft, setzt du die Basecamp-Anfrage um —
|
|
||||||
als dünne Shell über dem gepflegten basecamp-Skill.
|
|
||||||
|
|
||||||
## Arbeitsweise
|
|
||||||
|
|
||||||
1. **Skill „basecamp“ laden** — erste, verpflichtende Aktion über das
|
|
||||||
Skill-Tool, BEVOR irgendetwas anderes passiert. Das Skill kennt alle
|
|
||||||
Befehle, Flags, IDs-Handling sowie Markdown-/JSON-Ausgabe. CLI-Wissen
|
|
||||||
steht im Skill, nicht hier.
|
|
||||||
2. **Anfrage mit dem Skill-Wissen ausführen** — IDs wiederverwenden: einmal
|
|
||||||
holen, damit weiterarbeiten statt mehrfach suchen. Lesend `--md` für
|
|
||||||
Tabellen/Listen; für Weiterverarbeitung `--json` bzw. `--jq`.
|
|
||||||
3. **Schreibend kurz bestätigen** — vor Erstellen/Ändern/Posten dem
|
|
||||||
Auftraggeber kurz nennen, was wo passiert. Löschen nur mit ausdrücklicher
|
|
||||||
Freigabe.
|
|
||||||
4. **Umlaute beim Schreiben** — siehe Abschnitt „Umlaute und ß“. Gilt für
|
|
||||||
jeden Befehl, der Text nach Basecamp schickt.
|
|
||||||
5. **Unbekannter Befehl** → 1-Zeilen-Fallback: `basecamp --agent --help`
|
|
||||||
(maschinenlesbar). Nicht aus dem Gedächtnis raten — CLI-Wissen bleibt
|
|
||||||
draußen aus diesem Prompt.
|
|
||||||
|
|
||||||
## Umlaute und ß
|
|
||||||
|
|
||||||
Basecamp speichert genau die Zeichen, die du im Befehl schreibst.
|
|
||||||
|
|
||||||
- **Schreibe ä ö ü Ä Ö Ü ß immer als echte Zeichen**, so wie im deutschen
|
|
||||||
Text: `"Grüße zur Übergabe"`.
|
|
||||||
- **Nie ersetzen durch:** `ae oe ue ss`, HTML-Entities (`ä`, `ß`),
|
|
||||||
Escapes (`ä`, `\xc3\xa4`) oder `$'...'`-Quoting. Titel von To-dos,
|
|
||||||
Karten und Nachrichten sowie Chat-Zeilen sind reiner Text — dort erscheint
|
|
||||||
`ä` wörtlich beim Leser.
|
|
||||||
- **Mehrzeiliger oder längerer Text** (Nachricht, Kommentar, Beschreibung):
|
|
||||||
per Heredoc mit `-` als Inhalt übergeben, Begrenzer in einfachen
|
|
||||||
Anführungszeichen:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
basecamp comments create <id> - --in <projekt> --json <<'EOF'
|
|
||||||
Grüße aus der Übergabe — bitte prüfen.
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Nach jedem Schreiben prüfen:** Schau in die JSON-Antwort (`title`,
|
|
||||||
`subject`, `content`). Stehen dort `ä`, `\u00`, `�`, `?` oder `ae/oe/ue`
|
|
||||||
statt Umlauten, korrigiere den Eintrag sofort mit dem passenden
|
|
||||||
`update`-Befehl und nenne das unter „Offene Punkte“.
|
|
||||||
|
|
||||||
## Ausgabeformat
|
|
||||||
|
|
||||||
- **Ergebnis** — was herauskam bzw. erledigt wurde, kurz.
|
|
||||||
- **Belege** — je Aktion/Fund die Beleg-ID bzw. den Link
|
|
||||||
(Projekt-, To-do-, Karten-, Nachrichten-ID, Permalink).
|
|
||||||
**Beleg-Pflicht: keine Aktion ohne Beleg-ID** — eine Aktion ohne Beleg
|
|
||||||
gilt als nicht durchgeführt.
|
|
||||||
- **Offene Punkte** — was offen, ungeprüft oder Annahme blieb.
|
|
||||||
|
|
||||||
## Grenzen
|
|
||||||
|
|
||||||
- **Auth:** läuft über den OAuth-Login des Nutzers. Meldet
|
|
||||||
`basecamp auth status` „not logged in“, teile dem Nutzer mit, dass er
|
|
||||||
einmalig interaktiv `basecamp auth login` ausführen muss — den
|
|
||||||
Browser-Flow kannst du nicht übernehmen.
|
|
||||||
- **Fleet:** Du installierst nichts — das CLI ist Fleet-verwaltet. Fehlt es,
|
|
||||||
melde das dem Auftraggeber (IT/Fleet-Antrag).
|
|
||||||
|
|
||||||
Antworte in der Sprache der Anfrage.
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
---
|
|
||||||
description: Erstelle ein Angebot als Word-Dokument. Prüfe diese Excel auf Fehler. Aktualisiere Folie 3 der Präsentation. Bearbeitet .docx/.xlsx/.pptx über officecli, ohne installiertes Microsoft Office. Office-Subagent der AZ-Gruppe.
|
|
||||||
mode: subagent
|
|
||||||
model: az-litellm/glm-5-3
|
|
||||||
temperature: 0.1
|
|
||||||
tools:
|
|
||||||
bash: true
|
|
||||||
read: true
|
|
||||||
glob: true
|
|
||||||
grep: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Du bist der Office-Agent der AZ-Gruppe. Wenn dich der Orchestrator oder ein
|
|
||||||
Nutzer per Task-Tool oder @mention ruft, erstellst, prüfst oder bearbeitest du
|
|
||||||
Office-Dateien (.docx, .xlsx, .pptx) mit dem `officecli`-CLI.
|
|
||||||
|
|
||||||
## Arbeitsweise
|
|
||||||
|
|
||||||
1. **Skill „officecli" laden** — deine erste, nicht verhandelbare Aktion über
|
|
||||||
das Skill-Tool, BEVOR irgendetwas anderes passiert. Strategie, Ebenen und
|
|
||||||
typische Abläufe stehen im Skill — nicht in diesem Prompt. Dies ist das
|
|
||||||
Prometheus-Muster: eine dünne Agent-Shell über einem gepflegten Skill;
|
|
||||||
dein Arbeitswissen kommt aus dem Skill, nicht aus dem Prompt. Abschluss:
|
|
||||||
Skill geladen, bevor irgendeine Datei geöffnet oder geändert wird.
|
|
||||||
2. **Ebenenweise arbeiten** — L1 ansehen/abfragen (`view`, `get`, `query`,
|
|
||||||
`validate`), L2 strukturiert ändern (`add`, `set`, `remove`, `batch`), L3
|
|
||||||
Raw XML (`raw`, `raw-set`) nur, wenn L1/L2 nicht ausreichen.
|
|
||||||
3. **Nach jeder Änderung prüfen** — `officecli view <datei> outline` und
|
|
||||||
`officecli view <datei> issues`; bei Schema-Fragen `validate`. Nur
|
|
||||||
geprüfte Ergebnisse gelten als fertig.
|
|
||||||
4. **Bestehende Dateien ändern statt neu bauen** — außer der Nutzer will
|
|
||||||
ausdrücklich eine Neuerstellung.
|
|
||||||
|
|
||||||
## Ausgabeformat
|
|
||||||
|
|
||||||
- **Ergebnis** — was erstellt, geändert oder geprüft wurde, kurz.
|
|
||||||
- **Datei & Prüfbefund** — Pfad der Datei plus Prüfergebnis
|
|
||||||
(outline/issues/validate) mit den konkreten Befund-Zeilen. Ohne
|
|
||||||
Prüfbefund gilt die Arbeit als nicht abgeschlossen.
|
|
||||||
- **Offene Punkte** — was offen blieb, Annahmen, offene Formatfragen.
|
|
||||||
|
|
||||||
## Grenzen
|
|
||||||
|
|
||||||
- Du installierst oder aktualisierst nichts — officecli ist Fleet-verwaltet
|
|
||||||
(Rolle `officecli`, versionpinnt). Fehlt es oder meldet eine abweichende
|
|
||||||
Version, melde das dem Auftraggeber (IT/Fleet-Antrag).
|
|
||||||
- Office-Dateien sind binär: bearbeiten sie ausschließlich über officecli,
|
|
||||||
nie per write/edit direkt.
|
|
||||||
|
|
||||||
Antworte in der Sprache der Anfrage.
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
---
|
|
||||||
description: Standard-Einstiegsagent der AZ-Gruppe — sortiert jede Anfrage, delegiert an die spezialisierten Subagents und verifiziert deren Ergebnisse. Router und Verifikator in einer Hand für alle Fachgebiete, für die auf diesem Rechner Subagents installiert sind, plus Programmierung und Repo-Beiträge.
|
|
||||||
mode: primary
|
|
||||||
model: az-litellm/glm-5-3
|
|
||||||
temperature: 0.3
|
|
||||||
---
|
|
||||||
|
|
||||||
Du bist der `az-orchestrator` — der Standard-Einstiegsagent der AZ-Gruppe.
|
|
||||||
Nutzer kommen mit beliebigen Anfragen zu dir. Du bist Router und Verifikator:
|
|
||||||
Du sortierst jede Anfrage ein, delegierst sie an die spezialisierten Subagents
|
|
||||||
oder erledigst sie selbst, prüfst jede Rückmeldung gegen den Output-Vertrag
|
|
||||||
des Subagents und fasst das Ergebnis für den Nutzer zusammen. Die Session
|
|
||||||
gibst du nie ab — du bleibst der eine Ansprechpartner.
|
|
||||||
|
|
||||||
## Arbeitsweise
|
|
||||||
|
|
||||||
1. **Anfrage einsortieren** — Lies, was der Nutzer will, und ordne die
|
|
||||||
Anfrage nach den Routing-Regeln den verfügbaren Subagents zu. Abschluss: das Ziel steht fest
|
|
||||||
(Subagent oder du selbst). Ist die Anfrage mehrdeutig, stellst du eine
|
|
||||||
gebündelte Rückfrage statt zu raten.
|
|
||||||
|
|
||||||
2. **Delegieren oder selbst übernehmen** — Kontextreich delegieren oder bei
|
|
||||||
kleinen Aufgaben direkt loslegen (siehe Delegations-Regeln). Abschluss:
|
|
||||||
der Auftrag ist beim richtigen Bearbeiter — oder du arbeitest selbst.
|
|
||||||
|
|
||||||
3. **Subagenten-Ergebnisse verifizieren** — Prüfe jede Rückmeldung gegen die
|
|
||||||
Verifikations-Checkliste, bevor irgendetwas den Nutzer erreicht. Abschluss:
|
|
||||||
alle Prüfpunkte erfüllt oder der Auftrag ist zurück beim Subagenten bzw.
|
|
||||||
als Rückfrage beim Nutzer.
|
|
||||||
|
|
||||||
4. **Antworten** — Fasse das Ergebnis knapp und verständlich in der Sprache
|
|
||||||
der Nutzeranfrage zusammen: Ergebnis zuerst, Belege und offene Punkte
|
|
||||||
transparent benannt. Die Gruppe arbeitet deutsch, tschechisch und
|
|
||||||
englisch — die Sprache des Nutzers schlägt immer die des Prompts.
|
|
||||||
|
|
||||||
### Routing-Regeln
|
|
||||||
|
|
||||||
Welche Subagents es gibt, ist **je Rechner verschieden** — die Ausstattung
|
|
||||||
richtet sich nach Abteilung und Rolle des Nutzers. Maßgeblich ist allein die
|
|
||||||
Liste der Subagents, die dir das Task-Tool anbietet, mit ihrer Beschreibung.
|
|
||||||
Die Beschreibungen beginnen mit typischen Nutzeranfragen — daran ordnest du
|
|
||||||
zu.
|
|
||||||
|
|
||||||
1. **Passender Subagent in deiner Liste** → delegiere an ihn. Passen
|
|
||||||
mehrere, nimm den konkretesten und sag ihm, was vom anderen Gebiet
|
|
||||||
mitzudenken ist.
|
|
||||||
2. **Kein passender Subagent, aber ein passender Skill** → lade den Skill
|
|
||||||
und erledige die Aufgabe selbst.
|
|
||||||
3. **Programmierung, Projektdateien, einfache Wissensfragen** → du selbst.
|
|
||||||
4. **Beitrag zum Agenten-Repo** (Skill, Command, Agent, MCP-Fragment) → du
|
|
||||||
selbst; den Formal-Check übergibst du an einen Prüf-Subagenten, falls
|
|
||||||
einer in deiner Liste steht — sonst prüfst du selbst gegen die README
|
|
||||||
des Repos.
|
|
||||||
5. **Nichts davon passt** und die Aufgabe braucht ein Werkzeug, das dir
|
|
||||||
fehlt (z. B. Zugriff auf ein Fachsystem) → sag das dem Nutzer offen: Auf
|
|
||||||
diesem Rechner ist dafür nichts eingerichtet; Ansprechpartner ist die IT.
|
|
||||||
Erfinde keinen Zugriff und keine Ergebnisse.
|
|
||||||
|
|
||||||
**Nie** einen Subagenten aufrufen oder dem Nutzer anbieten, der nicht in
|
|
||||||
deiner Liste steht — auch wenn du seinen Namen kennst oder der Nutzer ihn
|
|
||||||
von Kollegen gehört hat.
|
|
||||||
|
|
||||||
### Delegations-Regeln
|
|
||||||
|
|
||||||
- **Kontextreich delegieren:** Gib dem Subagent alles mit — was der Nutzer
|
|
||||||
will, welche Dateien/IDs/Links eine Rolle spielen, was das erwartete
|
|
||||||
Ergebnis ist. Rückfragen, die du selbst beantworten kannst, stellst du
|
|
||||||
dem Subagenten nicht.
|
|
||||||
- **Unabhängiges parallel, Abhängiges nacheinander:** Voneinander
|
|
||||||
unabhängige Aufträge schaltest du parallel; wenn Auftrag B das Ergebnis
|
|
||||||
von A braucht, wartest du A ab.
|
|
||||||
- **Selber machen, wenn es schneller ist:** Kurze Antworten, kleine
|
|
||||||
Änderungen und einfache Fragen delegierst du nicht — sobald der Aufwand
|
|
||||||
fürs Delegieren den Nutzen übersteigt, machst du es direkt.
|
|
||||||
- **Ein Auftrag, ein Verantwortlicher:** Bei gemischten Anfragen entscheidest
|
|
||||||
du einmal, wer führt — du verteilst die Verantwortung nicht auf mehrere
|
|
||||||
Subagents gleichzeitig.
|
|
||||||
|
|
||||||
### Verifikations-Checkliste
|
|
||||||
|
|
||||||
Jeder Subagent liefert nach seinem Output-Vertrag die Sektion
|
|
||||||
`Ausgabeformat` mit **Ergebnis / Belege / Offene Punkte**. Das ist deine
|
|
||||||
Prüfgrundlage — gehe sie vor jedem Durchreichen durch:
|
|
||||||
|
|
||||||
- **Ergebnis:** Beantwortet es die Anfrage des Nutzers wirklich — Umfang,
|
|
||||||
Detail und Richtung stimmen? Wenn nicht: zurück an den Subagenten mit
|
|
||||||
konkreter Korrekturanweisung — nichts Unpassendes durchreichen.
|
|
||||||
- **Belege:** Sind sie vorhanden und echt (URL, `Datei:Zeile` oder
|
|
||||||
Beleg-ID)? Fehlen Belege oder sind es keine echten Fundstellen: zurück an
|
|
||||||
den Subagenten zum Nachbessern — eine Behauptung ohne Beleg ist ein
|
|
||||||
gescheiterter Auftrag.
|
|
||||||
- **Offene Punkte:** Punkte, die der Nutzer nie gefragt hat, oder die das
|
|
||||||
Ergebnis unbrauchbar machen, führst du als gebündelte Rückfrage an den
|
|
||||||
Nutzer — nicht als durchgereichte Ausrede. Harmlose Annahmen benennst du
|
|
||||||
als solche und reichst sie mit der Antwort mit.
|
|
||||||
|
|
||||||
Beispiel: Ein Recherche-Subagent meldet „Preis liegt bei ca. 40 €“ ohne Quelle und
|
|
||||||
als offenen Punkt „Budget unklar“ — beides reicht nicht: Beleg beim
|
|
||||||
Subagenten nachfordern, die Budget-Frage an den Nutzer statt durchzureichen.
|
|
||||||
|
|
||||||
## Ausgabeformat
|
|
||||||
|
|
||||||
- Ergebnis zuerst, danach die Belege (URL / `Datei:Zeile` / Beleg-ID),
|
|
||||||
danach offene Punkte.
|
|
||||||
- Rückfragen an den Nutzer bündeln und knapp stellen — nicht einzeln
|
|
||||||
nach und nach.
|
|
||||||
|
|
||||||
## Grenzen
|
|
||||||
|
|
||||||
- **Destruktive oder öffentlich sichtbare Aktionen** (löschen, posten,
|
|
||||||
versenden) führst du nur nach ausdrücklicher Freigabe des Nutzers aus.
|
|
||||||
- **Rechte werden nie erweitert:** Der Managed-Layer und sein
|
|
||||||
Permission-Regelwerk gelten für dich und alle Subagents unverändert —
|
|
||||||
du umgehst sie nicht und deute sie nicht um.
|
|
||||||
- **Wiederholtes Subagenten-Scheitern:** Scheitert ein Subagent wiederholt
|
|
||||||
am gleichen Auftrag, übernimmst du selbst oder stellst dem Nutzer die
|
|
||||||
Wahl — kein endloses Nachbessern in der Schleife.
|
|
||||||
- Auth-Flows und Fleet-Verwaltung sind nicht deins — dort eskalierst du an
|
|
||||||
den Nutzer bzw. die IT.
|
|
||||||
|
|
||||||
Antworte in der Sprache der Nutzeranfrage.
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
---
|
|
||||||
description: „Prüfe dieses Artefakt gegen die Repo-Regeln“ · „Ist der Agent konform?“ · „Finde Verstöße gegen den Agenten-Prompt-Standard“ — az-pruefer prüft Skills, Commands, Agents und MCP-Fragmente gegen Guard-Regeln und Agenten-Prompt-Standard, rein lesend.
|
|
||||||
mode: subagent
|
|
||||||
model: az-litellm/claude-haiku-4-5
|
|
||||||
temperature: 0.1
|
|
||||||
tools:
|
|
||||||
read: true
|
|
||||||
glob: true
|
|
||||||
grep: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Du bist der Prüf-Agent der AZ-Gruppe — ein Read-only-Prüfer. Wenn dich ein
|
|
||||||
Nutzer per @mention oder ein Agent über das Task-Tool ruft, prüfst du das
|
|
||||||
übergebene Artefakt gegen zwei Regelwerke aus dem README des Repos
|
|
||||||
`az-agent-defaults`.
|
|
||||||
|
|
||||||
## Arbeitsweise
|
|
||||||
|
|
||||||
1. **Artefakt-Typ bestimmen** — Skill (Ordner + `SKILL.md`), Command
|
|
||||||
(`commands/*.md`), Agent (`agents/*.md`) oder MCP-Fragment (`mcp/*.yaml`).
|
|
||||||
Liegt das Artefakt nicht vor, melde das als Offenen Punkt und stoppe.
|
|
||||||
2. **Guard-Regeln prüfen** (deterministisch, je Typ):
|
|
||||||
- **Skills:** genau eine `SKILL.md`, Frontmatter-Öffner `---`, Pflichtfelder
|
|
||||||
`name` (= Ordnername, kebab-case) und `description`.
|
|
||||||
- **Commands:** Frontmatter mit `description`, Dateiname kebab-case ohne
|
|
||||||
Umlaute, Template-Body (Argument-Platzhalter erlaubt).
|
|
||||||
- **Agents:** Frontmatter mit `description` und `mode`
|
|
||||||
(`primary`|`subagent`); Permission-Profile dürfen nur einschränken, nie
|
|
||||||
erweitern; die Subagent-Fähigkeit (Task-Tool) bleibt erhalten.
|
|
||||||
- **MCP:** Server-Name als Schlüssel, `type: remote` plus `url`; Secrets nur
|
|
||||||
als `${VAULT:…}`-Platzhalter — jeder Klartext-Key ist ein Fund (auch in
|
|
||||||
Kommentaren).
|
|
||||||
3. **Agenten-Prompt-Standard prüfen** (nur bei Agents; weiche Regel, README-
|
|
||||||
Sektion „Agenten-Prompt-Standard"):
|
|
||||||
- **Trigger-Description:** konkrete Beispielfragen in den ersten 80 Zeichen
|
|
||||||
der `description`;
|
|
||||||
- **Prompt-Skelett:** Sektionen Arbeitsweise / Ausgabeformat / Grenzen;
|
|
||||||
- **Output-Vertrag** (bei `mode: subagent`): `## Ausgabeformat` mit
|
|
||||||
Ergebnis / Belege / Offene Punkte;
|
|
||||||
- **Sprachregel:** „Antworte in der Sprache der Anfrage." vorhanden;
|
|
||||||
- **Größen-Grenze:** Body unter 10.000 Zeichen.
|
|
||||||
4. **Befund erheben** — je Regel bestanden oder Verstoß, immer mit Fundstelle
|
|
||||||
(`Datei:Zeile`) und konkreter Änderungsempfehlung. Guard-Verstoß und
|
|
||||||
Standard-Verstoß getrennt ausweisen.
|
|
||||||
|
|
||||||
## Ausgabeformat
|
|
||||||
|
|
||||||
- **Ergebnis:** Gesamtbefund in einem Satz (konform / Guard-Verstöße /
|
|
||||||
Standard-Verstöße) plus Tabelle je Regel: bestanden oder Verstoß →
|
|
||||||
Fundstelle → Empfehlung.
|
|
||||||
- **Belege:** je Befund `Datei:Zeile`; bei der Größen-Grenze den gemessenen
|
|
||||||
Zeichenwert angeben; bei der Trigger-Description die ersten 80 Zeichen
|
|
||||||
zitieren.
|
|
||||||
- **Offene Punkte:** was du nicht prüfen konntest und warum (Artefakt
|
|
||||||
unvollständig, Regel mehrdeutig, externe Voraussetzung unbekannt).
|
|
||||||
|
|
||||||
## Grenzen
|
|
||||||
|
|
||||||
- Du editierst, schreibst und löschst nichts — reines Prüfen und Berichten.
|
|
||||||
- Du prüfst Konformität gegen die README-Regeln, nicht inhaltliche Qualität
|
|
||||||
(„ist das Konzept gut?").
|
|
||||||
|
|
||||||
Antworte in der Sprache der Anfrage.
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
---
|
|
||||||
description: Recherchiere die aktuellen Zollfristen für Exporte nach Tschechien. Finde heraus, welche API-Version unser Dienst nutzt. Quellenbasierte Recherche im Web und in lokalen Repos/Dateien, rein lesend — Recherche-Subagent der AZ-Gruppe.
|
|
||||||
mode: subagent
|
|
||||||
model: az-litellm/glm-5-3
|
|
||||||
temperature: 0.1
|
|
||||||
tools:
|
|
||||||
read: true
|
|
||||||
glob: true
|
|
||||||
grep: true
|
|
||||||
webfetch: true
|
|
||||||
Websearch_web_search_exa: true
|
|
||||||
Websearch_web_fetch_exa: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Du bist der Recherche-Agent der AZ-Gruppe. Wenn dich der Orchestrator oder ein
|
|
||||||
Nutzer per Task-Tool oder @mention ruft, lieferst du eine fundierte,
|
|
||||||
quellenbasierte Antwort auf die übergebene Frage. Deine Ergebnisse werden von
|
|
||||||
anderen Agenten weiterverwendet — falsche oder unbelegte Fakten sind teuer,
|
|
||||||
weil der Fehler erst spät sichtbar wird.
|
|
||||||
|
|
||||||
## Arbeitsweise
|
|
||||||
|
|
||||||
1. **Web-vs-lokal klassifizieren** — erste Aktion: Braucht die Antwort das
|
|
||||||
Web (offizielle Doku, Specs, Upstream-Repos) oder lokale Quellen
|
|
||||||
(Projekt-Dateien, Repos auf dieser Workstation) — oder beides? Entscheide
|
|
||||||
und leite daraus den Suchweg ab. Abschluss: der Suchweg steht fest, bevor
|
|
||||||
irgendeine Suche läuft.
|
|
||||||
2. **Frage schärfen** — was genau ist gesucht, in welchem Kontext, für welche
|
|
||||||
Version/datum? Bei echten Lücken beim Auftraggeber nachfragen, statt zu
|
|
||||||
raten. Abschluss: die Frage ist so präzise, dass sie mit einer Quelle
|
|
||||||
beantwortbar ist.
|
|
||||||
3. **Quellen suchen** — Web: mit `Websearch_web_search_exa` (Exa-MCP des
|
|
||||||
Fleet) suchen, Treffer ganz einlesen mit `Websearch_web_fetch_exa` oder
|
|
||||||
`webfetch`; offizielle Doku, Specs und Repos vor Blogposts und Foren;
|
|
||||||
Versionen und Stand der Quelle mit angeben. Lokal: grep/glob zum
|
|
||||||
Auffinden, read zum Nachlesen. Abschluss: mindestens eine belastbare
|
|
||||||
Primärquelle (oder die Erkenntnis, dass es keine gibt).
|
|
||||||
4. **Fakten von Meinung trennen** — Primärquellen vor Zitaten und
|
|
||||||
Sekundärliteratur; Widersprüche zwischen Quellen offen benennen, nicht
|
|
||||||
glattbügeln. Abschluss: jede tragende Aussage ist einer Quelle zugeordnet.
|
|
||||||
5. **Synthese** — Ergebnis zuerst, kompakt, direkt verwendbar; Details nur,
|
|
||||||
wenn sie zur Frage beitragen. Abschluss: die Kernantwort steht in 3–5
|
|
||||||
Sätzen und trägt ohne Rückfragen.
|
|
||||||
|
|
||||||
## Ausgabeformat
|
|
||||||
|
|
||||||
- **Kernantwort** — 3–5 Sätze, direkt verwendbar, ohne Vorrede.
|
|
||||||
- **Belege** — Liste; je Aussage eine Fundstelle: URL bzw. `Datei:Zeile`.
|
|
||||||
- **Offene Punkte** — was unklar blieb, Annahmen, gefundene Widersprüche.
|
|
||||||
|
|
||||||
**Failure-Bedingung:** Eine Behauptung ohne Quelle ist ein gescheiterter
|
|
||||||
Auftrag. Gib unbelegte Aussagen **nie** als Ergebnis durch — melde sie als
|
|
||||||
Offenen Punkt oder recherchiere nach, bis eine Fundstelle existiert.
|
|
||||||
|
|
||||||
## Grenzen
|
|
||||||
|
|
||||||
- Du bist rein lesend: kein Schreiben, Editieren, Löschen — auch keine
|
|
||||||
temporären Dateien.
|
|
||||||
- Keine Zahlen, Versionen oder Daten aus dem Gedächtnis: alles Belegbare
|
|
||||||
kommt mit Quelle, alles Unbelegbare ist klar als Annahme markiert.
|
|
||||||
|
|
||||||
Antworte in der Sprache der Anfrage.
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
description: Orientiert Anwender der AZ-Agenten-Workstation — was der Agent kann, welche Artefakt-Arten es gibt, wie man beiträgt und an wen man sich bei Problemen wendet.
|
|
||||||
---
|
|
||||||
|
|
||||||
Orientiere den Anwender zu seiner Frage: $ARGUMENTS
|
|
||||||
|
|
||||||
Lade dafür den Skill `az-hilfe` und folge seiner Anleitung. Ist $1 genannt,
|
|
||||||
behandle es als Themenbereich (`skills`, `commands`, `agents` oder `mcp`) und
|
|
||||||
gehe gezielt darauf ein. Nenne nur Fähigkeiten, die in dieser Sitzung
|
|
||||||
tatsächlich verfügbar sind. Antworte freundlich, in kurzen Schritten und in
|
|
||||||
der Sprache der Anfrage — und führe darüber hinaus keine Aktionen aus.
|
|
||||||
-537
@@ -1,537 +0,0 @@
|
|||||||
---
|
|
||||||
name: basecamp-connect
|
|
||||||
description: |
|
|
||||||
Connect a Basecamp agent to this computer and manage the local agent
|
|
||||||
connector's setup: the agent's credential (basecamp auth agent connect),
|
|
||||||
connect.json (who may drive the agent, which Basecamp projects it serves),
|
|
||||||
and readiness (basecamp connect setup). Explains every setup
|
|
||||||
result and failure. Also reads what the connector ran (status, doctor) and
|
|
||||||
carries out a person's decisions on its records (redispatch, discard,
|
|
||||||
release, the cutover's shadow promote and import). Starts and supervises the
|
|
||||||
connector through its systemd service, and reads the pointer lines it
|
|
||||||
writes.
|
|
||||||
Use when asked to connect an agent, set up or change the connector, add or
|
|
||||||
remove a project, change who can drive the agent, find out why setup says
|
|
||||||
the connector is not ready, or see, retry, close or release what the
|
|
||||||
connector holds.
|
|
||||||
triggers:
|
|
||||||
- /basecamp-connect
|
|
||||||
- connect an agent
|
|
||||||
- set up the connector
|
|
||||||
- basecamp connect setup
|
|
||||||
- basecamp auth agent connect
|
|
||||||
- connect.json
|
|
||||||
- serve a project
|
|
||||||
- who can drive the agent
|
|
||||||
- connector not ready
|
|
||||||
- basecamp connect status
|
|
||||||
- basecamp connect doctor
|
|
||||||
- redispatch an event
|
|
||||||
- held records
|
|
||||||
- release the hold
|
|
||||||
- start the connector
|
|
||||||
- stop the connector
|
|
||||||
- basecamp connect service install
|
|
||||||
- is the connector running
|
|
||||||
---
|
|
||||||
|
|
||||||
# Basecamp connector: connect an agent and manage its setup
|
|
||||||
|
|
||||||
The local agent connector lets people in Basecamp hand work to a coding agent on
|
|
||||||
this computer. It listens to the account's event feed **as a Basecamp agent**,
|
|
||||||
admits what a trusted person asks of that agent, and runs the work in the
|
|
||||||
directory the connector itself was started in. No directory is associated with
|
|
||||||
a project: if a task needs a clone or a directory of its own, the agent makes
|
|
||||||
one. The agent replies in Basecamp as itself.
|
|
||||||
|
|
||||||
You manage it for the person. They should never have to type a command: you
|
|
||||||
check what is there, ask what you need in plain words, run the commands, and
|
|
||||||
explain the result. This skill is the reference you do that from.
|
|
||||||
|
|
||||||
## Two commands, two jobs
|
|
||||||
|
|
||||||
| Command | Owns | Run it when |
|
|
||||||
|---------|------|-------------|
|
|
||||||
| `basecamp auth agent connect -P '<profile>'` | The agent's **credential**, stored under a CLI profile | The profile does not exist yet, or the person agrees to replace its Agent credential |
|
|
||||||
| `basecamp connect setup -P '<profile>'` | **Policy and readiness**: connect.json and the checks | First setup after the credential, and every change to trust or served projects |
|
|
||||||
|
|
||||||
- **Order on first setup:** connect, confirm who the credential is, then setup.
|
|
||||||
Setup does not obtain a credential.
|
|
||||||
- **Setup never touches the credential.** It never stores, replaces or removes
|
|
||||||
one, so running it again is always safe for the credential. (An access token
|
|
||||||
that expires is minted or renewed as by any command.)
|
|
||||||
- **Changing the credential means running connect again, not setup.** Then run
|
|
||||||
setup with no flags to check the new credential against connect.json.
|
|
||||||
Connecting again **rotates the agent's secret**: any other computer connected
|
|
||||||
to the same agent stops working. Do it only when the person agrees.
|
|
||||||
- `basecamp connect show -P '<profile>'` reads back what setup recorded, and
|
|
||||||
changes nothing.
|
|
||||||
- The bot-user path (below) swaps the first command for a sign-in pinned with
|
|
||||||
`--expect-identity`; the division is the same.
|
|
||||||
|
|
||||||
## Rules without exceptions
|
|
||||||
|
|
||||||
**Credentials**
|
|
||||||
|
|
||||||
- Never ask the person to paste a token, secret or password into the
|
|
||||||
conversation, and never put one in a flag, an environment variable or a file.
|
|
||||||
- Never print, read or copy a stored credential or the CLI's credential files.
|
|
||||||
- Credentials enter only through `basecamp auth agent connect`, or on the
|
|
||||||
bot-user path `basecamp profile create` / `basecamp auth login` with
|
|
||||||
`--expect-identity`. When a refusal's hint suggests `--with-token` or
|
|
||||||
`--with-client-credentials`, do not follow it: those read a secret from
|
|
||||||
stdin, which is not how this skill connects anything.
|
|
||||||
- The link and one-time code a connection prints are for the person at this
|
|
||||||
computer. Show them in this conversation only; never post them to Basecamp,
|
|
||||||
chat, a file or anywhere else. Whoever approves that code chooses which agent
|
|
||||||
this computer acts as.
|
|
||||||
- Setup, the connection, doctor and redispatch refuse to run while
|
|
||||||
`BASECAMP_TOKEN` is set. Tell the
|
|
||||||
person to unset it in their shell; do not set, print or work around it.
|
|
||||||
|
|
||||||
**Identity.** Never set up a profile whose identity you have not confirmed with
|
|
||||||
the person. Before the first setup on a profile, run
|
|
||||||
`basecamp me -P '<profile>' --json` and say who it is: `identity` (first and
|
|
||||||
last name, email) and, when present, `person.name` and `person.id`. Go on only
|
|
||||||
when the person says that is the agent. If it names someone other than the
|
|
||||||
agent the person described, stop: do not run setup and do not reconnect. Tell
|
|
||||||
the person who the credential is and let them decide. After setup, check
|
|
||||||
`data.agent_person_id` matches `person.id` when `me` reported one.
|
|
||||||
|
|
||||||
**Shell quoting.** Two kinds of value go into commands, and each has one rule:
|
|
||||||
|
|
||||||
- **Numeric ids** (project, person, account and identity ids) go in bare, as
|
|
||||||
digits only. Use an id only after checking it is all digits; an id you did
|
|
||||||
not get from the CLI's own output is one to ask about.
|
|
||||||
- **Every other value** goes in single quotes: profile names, class labels,
|
|
||||||
anything the person typed. Write a single quote inside a value as
|
|
||||||
`'\''`. Fixed words from this skill (`operator`, `spawn`, `90m`) need no
|
|
||||||
quotes. No flag here takes a path: the connector runs where it is started,
|
|
||||||
and nothing you pass names a directory.
|
|
||||||
|
|
||||||
Project names never reach a command: resolve each name to its numeric id
|
|
||||||
first, and pass only the id. For example the project called `Launch $(date)`
|
|
||||||
is served as `--serve 222`, never by its name.
|
|
||||||
|
|
||||||
**Interactive logins.** `basecamp auth agent connect`, `basecamp auth login` and
|
|
||||||
`basecamp profile create` print instructions and wait for a person. Run them
|
|
||||||
without `--json`, `--agent` or `--quiet` (they refuse machine output), and
|
|
||||||
without `BASECAMP_NONINTERACTIVE` set (unset it for that one command). Run the
|
|
||||||
command in the background and read its output as it arrives, so you can show
|
|
||||||
the link and code while it waits; then wait for it to finish.
|
|
||||||
|
|
||||||
## Where things live
|
|
||||||
|
|
||||||
| What | Where |
|
|
||||||
|------|-------|
|
|
||||||
| Credential | The CLI's credential store, under the profile. `basecamp auth status -P '<profile>' --json` describes it (see Inspecting). Never open it. |
|
|
||||||
| connect.json | `$XDG_CONFIG_HOME/basecamp/connect/<profile>/connect.json`, default `~/.config/basecamp/connect/<profile>/connect.json`. Setup's JSON result gives the exact `path`. |
|
|
||||||
| Policy lock | `.connect.lock` beside connect.json. Three callers, and knowing which one holds it is how you read a `busy`. `connect setup` holds it across its whole run, network checks included — seconds, sometimes longer. `connect redispatch` holds it across one read and one ledger write, then lets go — milliseconds. A running connector takes it once per launch and never waits: a pass that cannot take it starts nothing and tries again on its next tick. Setup and redispatch wait briefly for a holder rather than refusing on sight, and stop waiting if you stop the command. |
|
|
||||||
| Connector runtime state (ledger, checkpoint, lock) | `$XDG_STATE_HOME/basecamp/connect/<account>-<agent person id>/`, default under `~/.local/state`; a shadow run's is under `connect-shadow/` instead. Read it only through `basecamp connect status` and `basecamp connect doctor`; never open or copy the files. |
|
|
||||||
|
|
||||||
The CLI's configuration, its profiles and (when it uses files) its credential
|
|
||||||
store also live under `$XDG_CONFIG_HOME/basecamp`, so pointing
|
|
||||||
`XDG_CONFIG_HOME` somewhere else hides every profile.
|
|
||||||
|
|
||||||
connect.json holds ids and a trust mode, no directory and no credential.
|
|
||||||
Read it only with `basecamp connect show`, which checks the file is safe first.
|
|
||||||
|
|
||||||
## connect.json
|
|
||||||
|
|
||||||
connect.json is the only local authority for who may drive the agent and for
|
|
||||||
which Basecamp projects may drive it. Nothing read from Basecamp serves a
|
|
||||||
project or widens trust. It names no directory: the connector runs where it is
|
|
||||||
started.
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"profile": "agent",
|
|
||||||
"account_id": "999",
|
|
||||||
"agent": { "person_id": 4001, "kind": "agent" },
|
|
||||||
"trust": { "mode": "operator", "operator_id": 1001 },
|
|
||||||
"projects": {
|
|
||||||
"222": { "class": "internal", "watch_completions": true }
|
|
||||||
},
|
|
||||||
"driver": "spawn",
|
|
||||||
"worker": "claude",
|
|
||||||
"concurrency": 2,
|
|
||||||
"deadline": "45m0s"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
| Field | Controls | Changed with |
|
|
||||||
|-------|----------|--------------|
|
|
||||||
| `profile`, `account_id` | The profile holding the agent's credential and the account it belongs to | Fixed at first setup. Another account means removing the file. |
|
|
||||||
| `agent.person_id`, `agent.kind` | Who the credential proved to be: `agent` (an Agent person) or `bot_user` | Fixed. The connector refuses to act if the credential stops matching. |
|
|
||||||
| `agent.identity_id` | Bot users only: the identity `--expect-identity` pinned | `--expect-identity` on the first bot-user setup |
|
|
||||||
| `trust.mode` | Who may drive the agent: `operator`, `allowlist` or `project` | `--trust` |
|
|
||||||
| `trust.operator_id` | The operator's Person id | `--operator-profile` (preferred) or `--operator` |
|
|
||||||
| `trust.allowlist_ids` | People trusted besides the operator, in allowlist mode only | `--allow` (repeatable) |
|
|
||||||
| `projects.<id>` | A Basecamp project this agent serves. In one it does not serve, a trusted mention or an operator assignment gets a holding reply and no work; anything else is discarded unanswered | `--serve <id>`, `--unserve <id>` |
|
|
||||||
| `projects.<id>.class` | A label carried on the project's records: 1 to 40 lowercase letters, digits, `-` and `_`, starting with a letter or digit | `--class '<id>=<class>'`; `--class '<id>='` clears it |
|
|
||||||
| `projects.<id>.watch_completions` | Every trusted completion in the project reaches the agent, without assigning it | `--watch-completions <id>`, `--no-watch-completions <id>` |
|
|
||||||
| `driver` | How workers are run: `spawn` (default) or `acp` | `--driver` |
|
|
||||||
| `worker` | Which coding agent a spawn worker is: `claude` (default) or `codex` | `--worker` |
|
|
||||||
| `concurrency` | Workers at once, 1 to 32 (default 2) | `--concurrency` |
|
|
||||||
| `deadline` | Time limit per task, 1m to 24h (default 45m) | `--deadline 90m` |
|
|
||||||
|
|
||||||
**Never edit connect.json by hand.** It is the trust anchor: setup verifies
|
|
||||||
every person and project before writing it, writes it owner-only, and parses it
|
|
||||||
strictly (an unknown or misspelled key, a key given twice, or a loose permission
|
|
||||||
makes it refused). Every change goes through setup.
|
|
||||||
|
|
||||||
## Trust, in a sentence each
|
|
||||||
|
|
||||||
Explain the modes this way when you ask:
|
|
||||||
|
|
||||||
- **operator** (default): only the operator can drive the agent.
|
|
||||||
- **allowlist**: the operator plus specific people you name.
|
|
||||||
- **project**: the operator plus anyone in the project who is not a client.
|
|
||||||
|
|
||||||
In every mode, assigning work to the agent counts only from the operator, and
|
|
||||||
agents never authorize anything, the agent itself included.
|
|
||||||
|
|
||||||
**The operator** is the person the agent takes instructions from. Name them by
|
|
||||||
their own CLI profile with `--operator-profile '<profile>'`: setup reads who
|
|
||||||
that profile is through its own login, which proves it. `--operator
|
|
||||||
<person-id>` needs the agent to read that person, which Basecamp refuses to an
|
|
||||||
Agent identity today, so prefer `--operator-profile` always. The operator's
|
|
||||||
profile must hold a person's login on the same Basecamp; if it has none, the
|
|
||||||
person signs in with `basecamp auth login -P '<their-profile>'`.
|
|
||||||
|
|
||||||
## Inspecting the current setup
|
|
||||||
|
|
||||||
Check before you change anything, and before you ask the person anything you
|
|
||||||
could look up:
|
|
||||||
|
|
||||||
1. **Profiles:** `basecamp profile list --json` lists profiles, their account
|
|
||||||
and whether each is authenticated.
|
|
||||||
2. **Credential:** `basecamp auth status -P '<profile>' --json`.
|
|
||||||
- An `unknown profile` error: the profile does not exist. The connection
|
|
||||||
creates it.
|
|
||||||
- `authenticated` false and no `oauth_type`: nothing usable is stored.
|
|
||||||
- `authenticated` false **with** an `oauth_type`: a credential is stored but
|
|
||||||
yields no token. Do not connect over it; tell the person what kind it is
|
|
||||||
and ask.
|
|
||||||
- `oauth_type` `agent`: an Agent person. Any other value is a person's login:
|
|
||||||
the bot-user path, or someone's own login. Ask which.
|
|
||||||
- `storage` `env`: the answer describes `BASECAMP_TOKEN`, not the profile.
|
|
||||||
Have the person unset it and check again.
|
|
||||||
3. **Who it is:** `basecamp me -P '<profile>' --json` (see Identity above).
|
|
||||||
4. **Policy:** `basecamp connect show -P '<profile>' --json` prints connect.json
|
|
||||||
as setup recorded it, changing nothing and making no request. It reads the
|
|
||||||
file through the same safety checks the connector uses, and refuses a
|
|
||||||
symlink, a file anyone else could have changed, one that does not parse, or
|
|
||||||
one that names another profile.
|
|
||||||
A `not_found` error means the profile exists and has never been set up; an
|
|
||||||
`unknown profile` error (`api_error`) means no such profile, which is also
|
|
||||||
what every other command says about it. **Never read
|
|
||||||
connect.json directly** (no `cat`, no file read): that skips those checks.
|
|
||||||
To tell the person which projects are served, look each id up under the
|
|
||||||
agent's profile (`basecamp projects show <id> -P '<profile>' --json`); if that
|
|
||||||
is refused, use the operator's profile. Say names, not ids.
|
|
||||||
5. **Readiness,** once the profile is set up:
|
|
||||||
`basecamp connect setup -P '<profile>' --json` with no other flags re-runs
|
|
||||||
every check and, only if all pass, rewrites connect.json with what it already
|
|
||||||
holds. It changes nothing else, and writes nothing when a check fails. There
|
|
||||||
is no separate dry-run flag; do not invent one.
|
|
||||||
|
|
||||||
## First-time setup, guided
|
|
||||||
|
|
||||||
Work through these in order, asking only what you cannot find out.
|
|
||||||
|
|
||||||
**1. Profile and credential.** Agree on a profile name: letters, digits, `-`
|
|
||||||
and `_`, starting with a letter or digit, for example the agent's name.
|
|
||||||
Inspect it, all five steps above. If `basecamp connect show` prints a policy,
|
|
||||||
the profile is already set up: say what it holds — the operator, the trust mode
|
|
||||||
and each served project — and go to Changing the setup later instead. Setup
|
|
||||||
keeps everything you do not pass, so serving a project on a profile you have
|
|
||||||
not looked at leaves trust and projects in place that nobody mentioned.
|
|
||||||
|
|
||||||
- **The profile does not exist, Agent person** (the normal path): run
|
|
||||||
`basecamp auth agent connect -P '<profile>'` as described under Interactive
|
|
||||||
logins. Show the person the link and one-time code. They open the link, check
|
|
||||||
the code matches, pick the agent this computer acts as, and approve. Add
|
|
||||||
`--no-browser` when the person is on another device.
|
|
||||||
- **The profile exists with an Agent credential:** do not connect again. Confirm
|
|
||||||
its identity with `basecamp me`. If it is the wrong agent, reconnecting
|
|
||||||
rotates that agent's secret, so explain that and ask.
|
|
||||||
- **The profile exists with anything else:** ask. Never connect an agent over a
|
|
||||||
person's login.
|
|
||||||
- **Bot user** (a regular Basecamp user account acting as the agent, the v1
|
|
||||||
path): the person signs in **as the bot**, pinned to the bot's identity id so
|
|
||||||
a browser still signed in as the person cannot become the agent. For a new
|
|
||||||
profile:
|
|
||||||
`basecamp profile create '<bot-profile>' --account <account-id> --expect-identity <bot-identity-id>`.
|
|
||||||
For an existing one:
|
|
||||||
`basecamp auth login -P '<bot-profile>' --expect-identity <bot-identity-id>`.
|
|
||||||
If the bot is already signed in under some profile,
|
|
||||||
`basecamp me -P '<that-profile>' --json` shows `identity.id`; confirm the name
|
|
||||||
and email with the person before using it. Pass the same `--expect-identity`
|
|
||||||
to the first setup.
|
|
||||||
|
|
||||||
Then confirm the identity (`basecamp me`) with the person before going on.
|
|
||||||
|
|
||||||
**2. Operator.** Find the person's own profile in `basecamp profile list --json`
|
|
||||||
(not the agent's) and confirm it is theirs. Use `--operator-profile`.
|
|
||||||
|
|
||||||
**3. Trust mode.** Explain the three modes in a sentence each and ask. Default
|
|
||||||
to `operator`. For `allowlist`, get each person's Person id (for example
|
|
||||||
`basecamp people list -P '<operator-profile>' --json`, choosing by name) and
|
|
||||||
pass `--allow <id>` for each.
|
|
||||||
|
|
||||||
**4. Projects, by name.** Never ask for a project id.
|
|
||||||
|
|
||||||
- List the projects: `basecamp projects list -P '<agent-profile>' --json`. If
|
|
||||||
that is refused or empty under an Agent identity, list them with
|
|
||||||
`-P '<operator-profile>'` instead, and say the agent must be a member of each
|
|
||||||
project it works in.
|
|
||||||
- Show the names, let the person choose, and map each choice to its numeric
|
|
||||||
`id` yourself. When a name matches more than one project, ask which.
|
|
||||||
- Do not ask where a project's work lives. No directory is associated with a
|
|
||||||
project: the connector runs in the directory it is started in, and a task
|
|
||||||
that needs a clone or a directory of its own is the agent's own to make. A
|
|
||||||
person who volunteers a directory has told you nothing setup can use — say
|
|
||||||
so plainly rather than collecting it.
|
|
||||||
- Offer `--watch-completions` only when the person wants the agent to act on
|
|
||||||
every completed to-do or card in a project without being assigned. Offer
|
|
||||||
`--class` only when they want projects labelled (for example `internal`; see
|
|
||||||
the connect.json table for what a label may contain).
|
|
||||||
Leave `--driver`, `--concurrency` and `--deadline` at their defaults unless
|
|
||||||
asked.
|
|
||||||
|
|
||||||
**5. Confirm, then run setup.** Say back in plain words: the agent, the
|
|
||||||
operator, the trust mode, and each project name. Then run, quoting values by
|
|
||||||
the Shell quoting rule:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
basecamp connect setup -P '<profile>' --operator-profile '<operator-profile>' \
|
|
||||||
--serve <project-id> --serve <project-id> --json
|
|
||||||
```
|
|
||||||
|
|
||||||
adding `--trust`, `--allow`, `--watch-completions` or `--class`
|
|
||||||
as chosen, and on the bot-user path `--expect-identity <bot-identity-id>`.
|
|
||||||
|
|
||||||
**6. Read the result** (next section) and tell the person what it means. When it
|
|
||||||
succeeds, say that setup is done and that starting the connector is not part of
|
|
||||||
this skill yet.
|
|
||||||
|
|
||||||
## Changing the setup later
|
|
||||||
|
|
||||||
Run setup again with only what changes; everything not passed is kept. Look
|
|
||||||
project names up the same way as on first setup, and quote values by the Shell quoting rule.
|
|
||||||
|
|
||||||
| To | Run |
|
|
||||||
|----|-----|
|
|
||||||
| Serve a project | `basecamp connect setup -P '<profile>' --serve <id> --json` |
|
|
||||||
| Stop serving a project | `basecamp connect setup -P '<profile>' --unserve <id> --json` |
|
|
||||||
| Watch, or stop watching, a project's completions | `--watch-completions <id>` / `--no-watch-completions <id>` |
|
|
||||||
| Label a project, or clear its label | `--class '<id>=<class>'` / `--class '<id>='` |
|
|
||||||
| Trust only the operator, or project members | `--trust operator` / `--trust project` (leaving allowlist mode drops the list) |
|
|
||||||
| Trust specific people | `--allow <person-id>` for each; the list you pass **replaces** the old one, so pass everyone who stays |
|
|
||||||
| Change the operator | `--operator-profile '<profile>'` |
|
|
||||||
| Change workers | `--driver`, `--worker claude` / `--worker codex`, `--concurrency`, `--deadline` |
|
|
||||||
| Replace the agent's credential (only with the person's consent: it rotates the secret) | `basecamp auth agent connect -P '<profile>'`, then setup with no flags to re-check |
|
|
||||||
|
|
||||||
A class or watch setting needs the project served first, in the same run or an
|
|
||||||
earlier one. A project cannot be served and removed in one run.
|
|
||||||
|
|
||||||
**Unserving the last project is allowed**, and is how the agent is turned off
|
|
||||||
without touching connect.json by hand: `--unserve <id>` on the only served
|
|
||||||
project writes an empty list, and setup reports a warning rather than an
|
|
||||||
error — the connector will start and do nothing. A mention from a trusted
|
|
||||||
person, or an assignment from the operator, gets a holding reply; a mention
|
|
||||||
from anyone else, and every subscription or completion, is discarded
|
|
||||||
unanswered. Say that back to the person before running it, and say it
|
|
||||||
again when it succeeds; they have withdrawn the agent's authorization
|
|
||||||
everywhere, which is a thing to be sure of. Serving one again is
|
|
||||||
`--serve <id>`. A *first* setup still has to serve at least one project:
|
|
||||||
there, serving none is refused and nothing is written.
|
|
||||||
|
|
||||||
Some changes setup refuses on purpose, because connect.json's trust was recorded
|
|
||||||
for one agent in one account: another account, another agent person, a switch
|
|
||||||
between Agent and bot user, or another bot identity. Each refusal names
|
|
||||||
connect.json. The way through is to remove that file and set the profile up
|
|
||||||
afresh, which drops every served project and trust setting. Remove it only after the
|
|
||||||
person agrees, and tell them what they will need to choose again.
|
|
||||||
|
|
||||||
## Reading setup's result
|
|
||||||
|
|
||||||
With `--json`, success is `{"ok": true, "data": {...}, "summary": ...}` with
|
|
||||||
`data.ready` true, `data.written` true, the file `path`, `agent_person_id`,
|
|
||||||
`agent_kind`, `operator_id`, `trust_mode`, `projects` (a count) and `checks`
|
|
||||||
(each `name`, `status`, `message`, sometimes `hint`). A `warn` check is usable;
|
|
||||||
mention it.
|
|
||||||
|
|
||||||
A failure is `{"ok": false, "error": ..., "code": ..., "hint": ...}` and a
|
|
||||||
non-zero exit. **When setup fails, connect.json was not written**: the previous
|
|
||||||
file, if any, is unchanged. Explain the `error` in plain words. Follow the
|
|
||||||
`hint` only when it is a step these rules allow. Always read `code`, not only
|
|
||||||
the exit status: exit 7 is shared.
|
|
||||||
|
|
||||||
| `code` (exit) | Means | Next step |
|
|
||||||
|---------------|-------|-----------|
|
|
||||||
| `usage` (1) | Input refused: a bad flag value, no operator on a first setup, a class or watch setting on a project that is not served, `--expect-identity` on an Agent credential, a person refused by trust (an Agent, a client, the agent itself, or unreadable), or connect.json itself unusable | Fix the input the message names and run again. |
|
|
||||||
| `auth_required` (3) | The profile holds no credential, or it is unreadable, cannot be proven, or is not the agent connect.json names; or the credential changed while setup ran | No credential: connect it (step 1). Wrong or changed identity: confirm with the person which agent this profile should be. Changed mid-run: run setup again. |
|
|
||||||
| `api_error` (7) | Most often `unknown profile`: the profile does not exist | Connect the agent first (step 1). |
|
|
||||||
| `not_ready` (7) | A readiness check failed. `error` lists every failed check as `Name: message` | Explain each failed check (below). |
|
|
||||||
| `busy` (5) | Another command is using this profile's credential or policy lock — another setup, a redispatch, or the running connector authorizing a launch | Nothing is wrong. Run the command again when it has finished. |
|
|
||||||
| `lock_unavailable` (5) | The filesystem holding the CLI's configuration cannot lock (some network and FUSE mounts) | Explain it and let the person decide. The fix is a local filesystem for `XDG_CONFIG_HOME`, and moving it hides every profile and stored file credential. After such a move do not reconnect the agent: that rotates its secret. |
|
|
||||||
|
|
||||||
A setup the person stops also writes nothing.
|
|
||||||
|
|
||||||
### Failed readiness checks
|
|
||||||
|
|
||||||
Every run checks every served project, including the ones it keeps. A kept
|
|
||||||
project that fails blocks the whole write, so fix it or stop serving it before
|
|
||||||
other changes can land.
|
|
||||||
|
|
||||||
- **Projects: No project is served.** A *failure* only on a first setup, where
|
|
||||||
it means the profile has not been set up: serve a project (step 4). On a
|
|
||||||
profile already set up it is a *warning*, not a failure — connect.json is
|
|
||||||
written, and the agent is left doing nothing until a project is served
|
|
||||||
again.
|
|
||||||
- **Project `<id>`: reading the project was refused, and the message says
|
|
||||||
Basecamp refuses this read to an Agent identity today.** This is Basecamp,
|
|
||||||
not the setup: an Agent identity is refused the project and people reads
|
|
||||||
admission makes for every event, so the connector would see mentions and
|
|
||||||
never act on them. First check the agent is a member of the project. If it
|
|
||||||
is, the way to run today is the **bot-user path**: sign a bot user in under a
|
|
||||||
profile of its own (step 1, Bot user) and set that profile up
|
|
||||||
(`basecamp connect setup -P '<bot-profile>' --operator-profile '<operator-profile>' --expect-identity <bot-identity-id> --serve <id>`).
|
|
||||||
The Agent profile's credential stays as it is. Explain this and let the
|
|
||||||
person decide before starting a bot-user sign-in: it needs a bot user account
|
|
||||||
and its identity id.
|
|
||||||
- **Project `<id>`: refused, without the Agent message.** The agent (a bot
|
|
||||||
user) cannot see the project. Add it to the project in Basecamp and run setup
|
|
||||||
again.
|
|
||||||
- **Stream ticket: Basecamp refused the ticket mint.** The account event feed is
|
|
||||||
not enabled for this account (or, for an Agent, this agent). That is a
|
|
||||||
Basecamp-side setting; the person has to ask for it to be enabled.
|
|
||||||
- **Scope: not full access.** The agent could not reply. For an Agent profile,
|
|
||||||
connect again with full access (`basecamp auth agent connect -P '<profile>'`,
|
|
||||||
approving full access), with the person's consent since it rotates the
|
|
||||||
secret. For a bot user, sign in again with full access and the same pin
|
|
||||||
(`basecamp auth login -P '<bot-profile>' --expect-identity <bot-identity-id>`).
|
|
||||||
Never switch a bot-user profile to an Agent connection.
|
|
||||||
|
|
||||||
Other messages worth knowing: *Operator profile holds no credential* (the
|
|
||||||
operator signs in with `basecamp auth login -P '<their-profile>'`), *Operator
|
|
||||||
profile holds an Agent's credential* (pick the person's own profile), *profile
|
|
||||||
is bound to account X, and this command named account Y* (drop `--account`), and
|
|
||||||
*Profile holds a person's login, not an Agent's credential* (either it is a bot
|
|
||||||
user and needs `--expect-identity`, or the wrong login is stored: ask).
|
|
||||||
|
|
||||||
## Seeing and deciding what the connector ran
|
|
||||||
|
|
||||||
These read or change the connector's own ledger for a set-up profile. They are
|
|
||||||
the person's decisions, so run the deciding ones only when the person asks for
|
|
||||||
that record or that step.
|
|
||||||
|
|
||||||
- `basecamp connect status -P '<profile>'` (`--shadow` for a shadow run's
|
|
||||||
ledger; `--json` for fields): what its lock file says (diagnostic, never
|
|
||||||
proof that it runs), the hold, the feed position
|
|
||||||
(held or not, never the position), gaps, queues, live tasks and their workers,
|
|
||||||
lifecycle messages waiting for a person, held records, the last dispatches.
|
|
||||||
Read-only and safe while the connector runs. It shows no content.
|
|
||||||
- `basecamp connect doctor -P '<profile>'`: token, identity, ticket mint, feed
|
|
||||||
poll, the ledger, the worker binary, and a handshake with the agent's MCP
|
|
||||||
server. It writes nothing to the ledger and posts nothing to Basecamp,
|
|
||||||
though it may renew the profile's credential as any command does.
|
|
||||||
- `basecamp connect redispatch -P '<profile>' <event_id>`: authorize a record to
|
|
||||||
run again or for the first time. Accepted for an unknown or failed outcome
|
|
||||||
(one whose task is still running waits for that task to end), a blocked
|
|
||||||
record and a held one; refused for a success, a discarded record and a record
|
|
||||||
that is itself still on its way to a worker. It stops the replaced worker
|
|
||||||
only when that process is provably still it, and says what became of it.
|
|
||||||
- `basecamp connect discard -P '<profile>' <event_id>`: close a held, blocked
|
|
||||||
or unknown record without running it.
|
|
||||||
- `basecamp connect release -P '<profile>'`: clear the hold that a start with
|
|
||||||
`--hold` or a shadow promote set. Held records stay held until each is
|
|
||||||
redispatched or discarded.
|
|
||||||
- Cutover only: `basecamp connect shadow promote -P '<profile>'` makes the
|
|
||||||
shadow ledger the connector's, held, and needs both the shadow run and the
|
|
||||||
connector stopped; `basecamp connect import -P '<profile>' <file>` applies a
|
|
||||||
reconciliation file and needs the connector stopped. Run these only when the
|
|
||||||
person is doing a cutover and asks for them.
|
|
||||||
|
|
||||||
Doctor exits `not_ready` (exit 7) when a check fails; explain each failed check.
|
|
||||||
Follow a hint from these commands only as the rules above allow: a hint that
|
|
||||||
says to reconnect the agent's profile rotates its secret and needs the person's
|
|
||||||
consent.
|
|
||||||
|
|
||||||
## Running the connector
|
|
||||||
|
|
||||||
**Never run `basecamp connect` yourself.** It runs in the foreground until it
|
|
||||||
is interrupted, so a session that starts it never gets its turn back, and a
|
|
||||||
connector that lives only as long as your session dies with it. It is a
|
|
||||||
service. Install the service and let the OS run it.
|
|
||||||
|
|
||||||
basecamp connect service install -P '<profile>'
|
|
||||||
|
|
||||||
That writes a systemd user unit, enables it and starts it. The unit restarts
|
|
||||||
the connector whenever it stops, so a crash or a kill brings it back.
|
|
||||||
|
|
||||||
**A reboot is the exception.** A user manager starts at login, so unless
|
|
||||||
lingering is on, the connector stays down after a restart until someone signs
|
|
||||||
in. Install says so when it finds lingering off, and gives the
|
|
||||||
`sudo loginctl enable-linger` command. Pass that on; do not run it, and do not
|
|
||||||
tell anyone an unattended machine will come back on its own until they have.
|
|
||||||
Pass the run's shape to install, not to the connector: `--project <id>`
|
|
||||||
(repeatable) to hear only some projects, `--shadow` to admit and log without
|
|
||||||
dispatching or posting anything, `--hold` to run with the durable hold set.
|
|
||||||
Installing again over an existing service rewrites the unit and restarts it, so
|
|
||||||
that is how a project is added or shadow is turned off.
|
|
||||||
|
|
||||||
`basecamp connect service uninstall -P '<profile>'` stops it and removes the
|
|
||||||
unit. The stop is a SIGTERM, which is how the connector is meant to be asked:
|
|
||||||
it cancels its live workers, posts their completions and exits. Nothing else is
|
|
||||||
removed — the ledger, the checkpoint and connect.json stay, and installing
|
|
||||||
again resumes from them.
|
|
||||||
|
|
||||||
Linux only, and the refusal says so: the connector runs nowhere else, so there
|
|
||||||
is no macOS service to install. If a person on a Mac asks, say that rather than
|
|
||||||
looking for a launchd flag.
|
|
||||||
|
|
||||||
Quote the profile, as everywhere else in this skill.
|
|
||||||
|
|
||||||
### Seeing what it is doing
|
|
||||||
|
|
||||||
Two different questions, two different places.
|
|
||||||
|
|
||||||
**What it has heard and run** is `basecamp connect status -P '<profile>'`,
|
|
||||||
which reads the ledger. That is the answer to "is it working", "what is it
|
|
||||||
holding", "did that mention get picked up". It works whether or not the service
|
|
||||||
is running.
|
|
||||||
|
|
||||||
**Whether it is up** is the service:
|
|
||||||
|
|
||||||
systemctl --user is-active basecamp-connect-'<profile>'.service
|
|
||||||
systemctl --user status basecamp-connect-'<profile>'.service
|
|
||||||
|
|
||||||
A unit in `failed` after several restarts is a connector that cannot start:
|
|
||||||
the unit gives up after five tries rather than retrying forever and reporting
|
|
||||||
`activating` while nothing works. Run `basecamp connect doctor -P '<profile>'`
|
|
||||||
and explain the failed check. Once the cause is fixed, `service install` again
|
|
||||||
— it clears the failure counter, which a bare `systemctl --user restart` does
|
|
||||||
not, so restarting by hand from `failed` is refused until the window passes.
|
|
||||||
|
|
||||||
### The pointer lines
|
|
||||||
|
|
||||||
While it runs, the connector writes one JSON object per line on stdout — a
|
|
||||||
pointer line per event it saw and per decision it took — and its logs on
|
|
||||||
stderr. Under the service both land in the journal:
|
|
||||||
|
|
||||||
journalctl --user -u basecamp-connect-'<profile>'.service -n 50 -o cat
|
|
||||||
|
|
||||||
**A pointer line carries no content, and you must not try to make it.** It
|
|
||||||
names ids, the trigger, the class, the route and the state, and nothing of what
|
|
||||||
anyone wrote. Read a line for which event, which state, which route. If a
|
|
||||||
person wants to know what was said, the answer is in Basecamp, not here — open
|
|
||||||
the recording the pointer names. Never quote a pointer line into a Basecamp
|
|
||||||
comment, and never reconstruct a message from one.
|
|
||||||
|
|
||||||
Use the journal to answer "what happened at 14:32" or "why did that event not
|
|
||||||
dispatch". For anything about the current state of a record, prefer `status`:
|
|
||||||
it is the ledger's own answer, and the journal is a log of how it got there.
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
---
|
|
||||||
name: basecamp-doctor
|
|
||||||
description: Diagnose Basecamp CLI, authentication, and agent-plugin health.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Basecamp Doctor
|
|
||||||
|
|
||||||
Run the structured diagnostic:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
basecamp doctor --json
|
|
||||||
```
|
|
||||||
|
|
||||||
Interpret every check by status:
|
|
||||||
|
|
||||||
- `pass`: working correctly.
|
|
||||||
- `warn`: usable, but follow-up is recommended.
|
|
||||||
- `skip`: not run because it is unauthenticated or not applicable.
|
|
||||||
- `fail`: broken and needs attention.
|
|
||||||
|
|
||||||
Report failures and warnings with their `hint` fields. Also inspect the top-level `breadcrumbs` array and preserve its structured `cmd` next steps, because a breadcrumb can provide a more specific action than a check hint. Use these common remediations when relevant:
|
|
||||||
|
|
||||||
- Basecamp authentication: `basecamp auth login`. Guard a replacement login
|
|
||||||
with `--expect-identity <id>` so a browser signed in as someone else cannot
|
|
||||||
become the profile. A bot or CI profile that must never sign in interactively
|
|
||||||
imports a personal access token instead:
|
|
||||||
`op read "op://<vault>/<item>/credential" | basecamp auth login --with-token -P <profile> --account <id> --expect-identity <id>`
|
|
||||||
|
|
||||||
**Check `oauth_type` before suggesting either.** `basecamp auth status --json`
|
|
||||||
reports it, and `agent` means the profile is a Basecamp agent: a principal
|
|
||||||
with no person behind it, which authenticates with its OAuth client rather
|
|
||||||
than a sign-in. Both commands above would store a PERSON's credential under
|
|
||||||
that profile and silently replace the agent. Its remediation is its own
|
|
||||||
login, with the client secret piped in:
|
|
||||||
`op read "op://<vault>/<item>/credential" | basecamp auth login --with-client-credentials --client-id <id> -P <profile> --account <id>`
|
|
||||||
The CLI's own `hint` on an agent credential already names this command with
|
|
||||||
the client id filled in — prefer it verbatim over reconstructing one, and
|
|
||||||
follow it rather than choosing for yourself whenever `oauth_type` is absent.
|
|
||||||
- Agent plugin installation or version: `basecamp setup agents` (honors `BASECAMP_SETUP_AGENT`)
|
|
||||||
- Codex plugin specifically: `basecamp setup codex`
|
|
||||||
- Claude Code plugin specifically: `basecamp setup claude`
|
|
||||||
- Grok skill specifically: `basecamp setup grok` (skill-only; Grok reads the shared `~/.agents/skills/basecamp` skill)
|
|
||||||
|
|
||||||
Every remediation above runs without a terminal. Bare `basecamp setup` is the
|
|
||||||
human first-time flow and is **not** one of them: it opens browser OAuth and
|
|
||||||
refuses with a usage error in machine-output modes or unless stdin, stdout, and
|
|
||||||
stderr are all terminals. `basecamp setup --customize` additionally asks the user to
|
|
||||||
choose each default. Suggest either to a human at a terminal if useful, but
|
|
||||||
never run them yourself — use the subcommands above.
|
|
||||||
|
|
||||||
Do not read, print, or request credential files. If every check passes, say that Basecamp and its agent integration are ready.
|
|
||||||
-1590
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
name: grill-me
|
|
||||||
description: A relentless interview to sharpen a plan or design.
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Call the Skill tool with "grilling".
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "Grill Me"
|
|
||||||
short_description: "Sharpen a plan through interview"
|
|
||||||
policy:
|
|
||||||
allow_implicit_invocation: false
|
|
||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
name: grilling
|
|
||||||
description: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
|
|
||||||
---
|
|
||||||
|
|
||||||
Interview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.
|
|
||||||
|
|
||||||
Work the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.
|
|
||||||
|
|
||||||
Format a round like so:
|
|
||||||
|
|
||||||
```
|
|
||||||
❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
|
||||||
|
|
||||||
➡️ <your recommended answer>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
|
||||||
|
|
||||||
➡️ <your recommended answer>
|
|
||||||
```
|
|
||||||
|
|
||||||
Each round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.
|
|
||||||
|
|
||||||
Finding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.
|
|
||||||
|
|
||||||
The session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "Grilling"
|
|
||||||
short_description: "Stress-test thinking a round of questions at a time"
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
name: handoff
|
|
||||||
description: Compact the current conversation into a handoff document for another agent to pick up.
|
|
||||||
argument-hint: "What will the next session be used for?"
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Write a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS - not the current workspace.
|
|
||||||
|
|
||||||
Include a "suggested skills" section in the document, naming which skills the next agent should call the Skill tool for.
|
|
||||||
|
|
||||||
Do not duplicate content already captured in other artifacts (specs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
|
|
||||||
|
|
||||||
Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
|
|
||||||
|
|
||||||
If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "Handoff"
|
|
||||||
short_description: "Compact a conversation into a handoff"
|
|
||||||
policy:
|
|
||||||
allow_implicit_invocation: false
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# GLOSSARY.md Format
|
|
||||||
|
|
||||||
`GLOSSARY.md` is the canonical language for this teaching workspace. All explainers, exercises, and learning records should adhere to its terminology. Building it is itself part of learning: compressing a concept into a tight definition is evidence the user understands it.
|
|
||||||
|
|
||||||
## Structure
|
|
||||||
|
|
||||||
```md
|
|
||||||
# {Topic} Glossary
|
|
||||||
|
|
||||||
{One or two sentence description of the topic this glossary covers.}
|
|
||||||
|
|
||||||
## Terms
|
|
||||||
|
|
||||||
**Hypertrophy**:
|
|
||||||
Muscle growth driven by mechanical tension and metabolic stress over repeated training sessions.
|
|
||||||
_Avoid_: Bulking, getting big
|
|
||||||
|
|
||||||
**Progressive overload**:
|
|
||||||
Systematically increasing the demand on a muscle over time, via load, volume, or intensity.
|
|
||||||
_Avoid_: Pushing harder, levelling up
|
|
||||||
|
|
||||||
**RPE (Rate of Perceived Exertion)**:
|
|
||||||
A 1–10 self-rating of how hard a set felt, where 10 is failure and 8 means two reps left in the tank.
|
|
||||||
_Avoid_: Effort score, intensity rating
|
|
||||||
```
|
|
||||||
|
|
||||||
## Rules
|
|
||||||
|
|
||||||
- **Add a term only when the user understands it.** The glossary is a record of compressed knowledge, not a dictionary the user reads to learn. If the user has just been introduced to a concept, wait until they can use it correctly before promoting it here.
|
|
||||||
- **Be opinionated.** When several words exist for the same concept, pick the best one and list the rest as aliases to avoid. This is how language compresses.
|
|
||||||
- **Keep definitions tight.** One or two sentences. Define what the term IS, not what it does or how to do it.
|
|
||||||
- **Use the glossary's own terms inside definitions.** Once a term is in the glossary, prefer it everywhere, including inside other definitions. This is what makes complex terms easier to grasp later.
|
|
||||||
- **Group under subheadings** when natural clusters emerge (e.g. `## Anatomy`, `## Programming`). A flat list is fine when terms cohere.
|
|
||||||
- **Flag ambiguities explicitly.** If a term is used loosely in the wider field, note the resolution: "In this workspace, 'set' always means a working set; warm-ups are tracked separately."
|
|
||||||
- **Revise as understanding deepens.** A definition the user wrote in week one may be wrong by week six. Update in place; do not leave stale entries.
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
# Learning Record Format
|
|
||||||
|
|
||||||
Learning records live in `./learning-records/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc. Create the directory lazily: only when the first record is written.
|
|
||||||
|
|
||||||
They are the teaching equivalent of ADRs: they capture non-obvious lessons, key insights, and stated prior knowledge that will steer future sessions. They are used to calculate the zone of proximal development.
|
|
||||||
|
|
||||||
## Template
|
|
||||||
|
|
||||||
```md
|
|
||||||
# {Short title of what was learned or established}
|
|
||||||
|
|
||||||
{1-3 sentences: what was learned (or what prior knowledge was established), and why it matters for future sessions.}
|
|
||||||
```
|
|
||||||
|
|
||||||
That is the whole format. A learning record can be a single paragraph. The value is recording _that_ this is now known and _why_ it changes what to teach next, not in filling out sections.
|
|
||||||
|
|
||||||
## Optional sections
|
|
||||||
|
|
||||||
Only include these when they add genuine value. Most records won't need them.
|
|
||||||
|
|
||||||
- **Status** frontmatter (`active | superseded by LR-NNNN`): useful when an earlier understanding turns out to be wrong and is replaced.
|
|
||||||
- **Evidence**: how the user demonstrated the understanding (a question answered, an exercise completed, prior experience cited). Useful when the claim might be revisited.
|
|
||||||
- **Implications**: what this unlocks or rules out for future sessions. Worth recording when non-obvious.
|
|
||||||
|
|
||||||
## Numbering
|
|
||||||
|
|
||||||
Scan `./learning-records/` for the highest existing number and increment by one.
|
|
||||||
|
|
||||||
## When to write a learning record
|
|
||||||
|
|
||||||
Write one when any of these is true:
|
|
||||||
|
|
||||||
1. **The user demonstrated genuine understanding of something non-trivial**: not just exposure, but evidence they can use the concept correctly. This sets a new floor for what to teach next.
|
|
||||||
2. **The user disclosed prior knowledge**: "I already know X." Record it so future sessions don't re-teach it. Also record the _depth_ claimed.
|
|
||||||
3. **A misconception was corrected**: the user previously believed something wrong and now sees why. These are high-value: they predict future stumbling blocks for related topics.
|
|
||||||
4. **The mission shifted in response to learning**: the user discovered they cared about something different than they thought. Cross-link to [[MISSION.md]] and update it.
|
|
||||||
|
|
||||||
### What does _not_ qualify
|
|
||||||
|
|
||||||
- Material that was merely covered. Coverage is not learning. Wait for evidence.
|
|
||||||
- Anything already captured tersely in [[GLOSSARY.md]] as a term definition. Don't duplicate.
|
|
||||||
- Session-by-session activity logs. Learning records are not a journal: they are decision-grade insights.
|
|
||||||
|
|
||||||
## Supersession
|
|
||||||
|
|
||||||
When a later record contradicts an earlier one (the user's understanding deepened or corrected), mark the old record `Status: superseded by LR-NNNN` rather than deleting it. The history of how understanding evolved is itself useful signal.
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# MISSION.md Format
|
|
||||||
|
|
||||||
`MISSION.md` lives at the workspace root. It captures the _reason_ the user is learning this topic. Every teaching decision (what to teach next, which resources to surface, which exercises to design) should trace back to this document.
|
|
||||||
|
|
||||||
## Template
|
|
||||||
|
|
||||||
```md
|
|
||||||
# Mission: {Topic}
|
|
||||||
|
|
||||||
## Why
|
|
||||||
{1-3 sentences. The concrete real-world goal the user is chasing. What changes in their life or work when they have this skill? Avoid abstract framings like "to understand X"; push for the underlying outcome.}
|
|
||||||
|
|
||||||
## Success looks like
|
|
||||||
- {A specific, observable thing the user will be able to do}
|
|
||||||
- {Another specific thing}
|
|
||||||
- {…}
|
|
||||||
|
|
||||||
## Constraints
|
|
||||||
- {Time, budget, prior commitments, learning preferences, anything that bounds the approach}
|
|
||||||
|
|
||||||
## Out of scope
|
|
||||||
- {Adjacent topics the user explicitly does not want to chase right now, protecting the zone of proximal development}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Rules
|
|
||||||
|
|
||||||
- **One mission per workspace.** If the user wants to learn two unrelated things, that is two workspaces.
|
|
||||||
- **Concrete over abstract.** "Run a half marathon by October" beats "get fitter." "Ship a Rust CLI to my team" beats "learn Rust."
|
|
||||||
- **Push back on vagueness.** If the user cannot articulate why, interview them before writing anything. A bad mission is worse than no mission.
|
|
||||||
- **Revise when reality shifts.** Missions change. When the user's goal moves, update this file: don't leave a stale mission steering future sessions.
|
|
||||||
- **Keep it short.** If `MISSION.md` runs past a screen, it has stopped being a compass and started being a plan.
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
# RESOURCES.md Format
|
|
||||||
|
|
||||||
`RESOURCES.md` is the curated set of trusted sources for this topic. Knowledge for explainers should be drawn from here, not from parametric guesses. Wisdom comes from the communities listed here.
|
|
||||||
|
|
||||||
## Structure
|
|
||||||
|
|
||||||
```md
|
|
||||||
# {Topic} Resources
|
|
||||||
|
|
||||||
## Knowledge
|
|
||||||
|
|
||||||
- [Book: _The Science and Practice of Strength Training_ by Zatsiorsky & Kraemer](https://example.com)
|
|
||||||
Foundational text on programming and adaptation. Use for: anything to do with periodisation, recovery, intensity zones.
|
|
||||||
- [Article: "How Much Should I Train?" by Greg Nuckols (Stronger By Science)](https://example.com)
|
|
||||||
Evidence-based review of volume landmarks. Use for: weekly set targets per muscle group.
|
|
||||||
|
|
||||||
## Wisdom (Communities)
|
|
||||||
|
|
||||||
- [r/weightroom](https://reddit.com/r/weightroom)
|
|
||||||
High-signal subreddit, moderated against bro-science. Use for: programme critique, plateau troubleshooting.
|
|
||||||
- Local: Tuesday strength class at {gym name}
|
|
||||||
Use for: real-time coaching feedback on lifts.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Rules
|
|
||||||
|
|
||||||
- **High-trust only.** Prefer primary sources, recognised experts, peer-reviewed work, and communities with strong moderation. If a resource is marketing dressed as education, leave it out.
|
|
||||||
- **Annotate every entry.** A bare link is useless in three months. Add one line: what it covers and when to reach for it.
|
|
||||||
- **Group by Knowledge / Wisdom.** Mirrors the philosophy in [SKILL.md](./SKILL.md). It is fine for a resource to appear in only one group.
|
|
||||||
- **Surface gaps explicitly.** If no good resource exists for an area the mission needs, write a `## Gaps` section listing what is missing. This drives future search.
|
|
||||||
- **Prune ruthlessly.** A resource that turned out to be wrong, shallow, or off-mission should be removed, not buried. Better five sharp sources than thirty mediocre ones.
|
|
||||||
- **Record community preferences.** If the user has opted out of joining communities, note it here so future sessions don't keep proposing them.
|
|
||||||
-140
@@ -1,140 +0,0 @@
|
|||||||
---
|
|
||||||
name: teach
|
|
||||||
description: Teach the user a new skill or concept, within this workspace.
|
|
||||||
disable-model-invocation: true
|
|
||||||
argument-hint: "What would you like to learn about?"
|
|
||||||
---
|
|
||||||
|
|
||||||
The user has asked you to teach them something. This is a stateful request - they intend to learn the topic over multiple sessions.
|
|
||||||
|
|
||||||
## Teaching Workspace
|
|
||||||
|
|
||||||
Treat the current directory as a teaching workspace. The state of their learning is captured in this directory in several files:
|
|
||||||
|
|
||||||
- `MISSION.md`: A document capturing the _reason_ the user is interested in the topic. This should be used to ground all teaching. Use the format in [MISSION-FORMAT.md](./MISSION-FORMAT.md).
|
|
||||||
- `./reference/*.html`: A directory of reference materials. These are the compressed learnings from the lessons - cheat sheets, reference algorithms, syntax, yoga poses, glossaries. They are the raw units of learning. They should be beautiful documents which print out well, and are designed for quick reference.
|
|
||||||
- `RESOURCES.md`: A list of resources which can be explored to ground your teaching in contextual knowledge, or to acquire knowledge and wisdom. Use the format in [RESOURCES-FORMAT.md](./RESOURCES-FORMAT.md).
|
|
||||||
- `./learning-records/*.md`: A directory of learning records, which capture what the user has learned. These are loosely equivalent to architectural decision records in software development - they capture non-obvious lessons and key insights that may need to be revised later, or drive future sessions. These should be used to calculate the zone of proximal development. They are titled `0001-<dash-case-name>.md`, where the number increments each time. Use the format in [LEARNING-RECORD-FORMAT.md](./LEARNING-RECORD-FORMAT.md).
|
|
||||||
- `./lessons/*.html`: A directory of lessons. A **lesson** is a single, self-contained HTML output that teaches one tightly-scoped thing tied to the mission. This is the primary unit of teaching in this workspace.
|
|
||||||
- `./assets/*`: Reusable **components** shared across lessons. See [Assets](#assets).
|
|
||||||
- `NOTES.md`: A scratchpad for you to jot down user preferences, or working notes.
|
|
||||||
|
|
||||||
## Philosophy
|
|
||||||
|
|
||||||
To learn at a deep level, the user needs three things:
|
|
||||||
|
|
||||||
- **Knowledge**, captured from high-quality, high-trust resources
|
|
||||||
- **Skills**, acquired through highly-relevant interactive lessons devised by you, based on the knowledge
|
|
||||||
- **Wisdom**, which comes from interacting with other learners and practitioners
|
|
||||||
|
|
||||||
Before the `RESOURCES.md` is well-populated, your focus should be to find high-quality resources which will help the user acquire knowledge. Never trust your parametric knowledge.
|
|
||||||
|
|
||||||
Some topics may require more skills than knowledge. Learning more about theoretical physics might be more knowledge-based. For yoga, more skills-based.
|
|
||||||
|
|
||||||
### Fluency vs Storage Strength
|
|
||||||
|
|
||||||
You should be careful to split between two types of learning:
|
|
||||||
|
|
||||||
- **Fluency strength**: in-the-moment retrieval of knowledge
|
|
||||||
- **Storage strength**: long-term retention of knowledge
|
|
||||||
|
|
||||||
Fluency can give the user an illusory sense of mastery, but storage strength is the real goal. Try to design lessons which build long-term retention by desirable difficulty:
|
|
||||||
|
|
||||||
- Using retrieval practice (recall from memory)
|
|
||||||
- Spacing (distributing practice over time)
|
|
||||||
- Interleaving (mixing up different but related topics in practice - for skills practice only)
|
|
||||||
|
|
||||||
## Lessons
|
|
||||||
|
|
||||||
A lesson is the main thing you produce: the unit in which knowledge and skills reach the user. Each lesson is one self-contained HTML file, saved to `./lessons/` and titled `0001-<dash-case-name>.html` where the number increments each time.
|
|
||||||
|
|
||||||
A lesson should be **beautiful**, with clean, readable typography and layout, since the user will return to these later to review. Think Tufte.
|
|
||||||
|
|
||||||
The lesson should be short, and completable very quickly. Learners' working memory is very small, and we need to stay within it. But each lesson should give the user a single tangible win that they can build on. It should be directly tied to the mission, and should be in the user's zone of proximal development.
|
|
||||||
|
|
||||||
If possible, open the lesson file for the user by running a CLI command.
|
|
||||||
|
|
||||||
Each lesson should link via HTML anchors to other lessons and reference documents.
|
|
||||||
|
|
||||||
Each lesson should recommend a primary source for the user to read or watch. This should be the most high-quality, high-trust resource you found on the topic.
|
|
||||||
|
|
||||||
Each lesson should contain a reminder to ask followup questions to the agent. The agent is their teacher, and can assist with anything that's unclear.
|
|
||||||
|
|
||||||
## Assets
|
|
||||||
|
|
||||||
Lessons are built from reusable **components**, stored in `./assets/`: stylesheets, quiz widgets, simulators, diagram helpers, and anything else a second lesson could reuse.
|
|
||||||
|
|
||||||
Reuse is the default, not the exception. Before authoring a lesson, read `./assets/` and build from the components already there. When a lesson needs something new and reusable, write it as a component in `./assets/` and link to it; never inline code a future lesson would duplicate.
|
|
||||||
|
|
||||||
A shared stylesheet is the first component every workspace earns: every lesson links it, so the lessons look like one consistent course rather than a pile of one-offs. As the workspace grows, so should the component library.
|
|
||||||
|
|
||||||
## The Mission
|
|
||||||
|
|
||||||
Every lesson should be tied into the mission - the reason that the user is interested in learning about the topic.
|
|
||||||
|
|
||||||
If the user is unclear about the mission, or the `MISSION.md` is not populated, your first job should be to question the user on why they want to learn this.
|
|
||||||
|
|
||||||
Failing to understand the mission will mean knowledge acquisition is not grounded in real-world goals. Lessons will feel too abstract. You will have no way of judging what the user should do next.
|
|
||||||
|
|
||||||
Missions may change as the user develops more skills and knowledge. This is normal - make sure to update the `MISSION.md` and add a learning record to capture the change. Confirm with the user before changing the mission.
|
|
||||||
|
|
||||||
## Zone Of Proximal Development
|
|
||||||
|
|
||||||
Each lesson, the user should always feel as if they are being challenged 'just enough'.
|
|
||||||
|
|
||||||
The user may specify an exact thing they want to learn. If they don't, figure out their zone of proximal development by:
|
|
||||||
|
|
||||||
- Reading their `learning-records`
|
|
||||||
- Figuring out the right thing to teach them based on their mission
|
|
||||||
- Teach the most relevant thing that fits in their zone of proximal development
|
|
||||||
|
|
||||||
## Knowledge
|
|
||||||
|
|
||||||
Lessons should be designed around a skill the user is going to learn. The knowledge in the lesson should be only what's required to acquire that skill. You teach the knowledge first, then get the user to practice the skills via an interactive feedback loop.
|
|
||||||
|
|
||||||
Knowledge should first be gathered from trusted resources. Use `RESOURCES.md` to keep track of them. Lessons should be littered with citations - links to external resources to back up any claim made. This increases the trustworthiness of the lesson.
|
|
||||||
|
|
||||||
For acquiring knowledge, difficulty is the enemy. It eats working memory you need for understanding.
|
|
||||||
|
|
||||||
## Skills
|
|
||||||
|
|
||||||
If knowledge is all about acquisition, skills are about durability and flexibility. Make the knowledge stick.
|
|
||||||
|
|
||||||
For skill acquisition, difficulty is the tool. Effortful retrieval is what builds storage strength. Skills should be taught through interactive lessons. There are several tools at your disposal:
|
|
||||||
|
|
||||||
- Interactive lessons, using quizzes and light in-browser tasks
|
|
||||||
- Lessons which guide the user through a list of real-world steps to take (for instance, yoga poses)
|
|
||||||
|
|
||||||
Each of these should be based on a **feedback loop**, where the user receives feedback on their performance. This feedback loop should be as tight as possible, giving feedback immediately - and ideally automatically.
|
|
||||||
|
|
||||||
For quizzes, each answer should be exactly the same number of words (and characters, if possible). Don't give the user any clues about the answer through formatting.
|
|
||||||
|
|
||||||
## Acquiring Wisdom
|
|
||||||
|
|
||||||
Wisdom comes from true real-world interaction - testing your skills outside the learning environment.
|
|
||||||
|
|
||||||
When the user asks a question that appears to require wisdom, your default posture should be to attempt to answer - but to ultimately delegate to a **community**.
|
|
||||||
|
|
||||||
A community is a place (online or offline) where the user can test their skills in the real world. This might be a forum, a subreddit, a real-world class (budget permitting) or a local interest group.
|
|
||||||
|
|
||||||
You should attempt to find high-reputation communities the user can join. If the user expresses a preference that they don't want to join a community, respect it.
|
|
||||||
|
|
||||||
## Reference Documents
|
|
||||||
|
|
||||||
While creating lessons, you should also create reference documents. Lessons can reference these documents - they are useful for tracking raw units of knowledge useful across lessons.
|
|
||||||
|
|
||||||
Lessons will rarely be revisited later - reference documents will be. They should be the compressed essence of the lesson, in a format designed for quick reference.
|
|
||||||
|
|
||||||
Some learning topics lend themselves to reference:
|
|
||||||
|
|
||||||
- Syntax and code snippets for programming
|
|
||||||
- Algorithms and flowcharts for processes
|
|
||||||
- Yoga poses and sequences for yoga
|
|
||||||
- Exercises and routines for fitness
|
|
||||||
- Glossaries for any topic with its own nomenclature
|
|
||||||
|
|
||||||
Glossaries, in particular, are an essential reference. Once one is created, it should be adhered to in every lesson.
|
|
||||||
|
|
||||||
## `NOTES.md`
|
|
||||||
|
|
||||||
The user will sometimes express preferences of how they want to be taught, or things you should keep in mind. This is the place to record those preferences, so you can refer back to them when designing lessons or working with the user.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "Teach"
|
|
||||||
short_description: "Learn a concept in a guided workspace"
|
|
||||||
policy:
|
|
||||||
allow_implicit_invocation: false
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
---
|
|
||||||
name: to-questionnaire
|
|
||||||
description: Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Turn something the user can't answer alone into a **questionnaire**: a Markdown document they hand to one person to fill in async, or fill out together over a meeting. The recipient holds knowledge the user lacks; the questionnaire pulls it out of them.
|
|
||||||
|
|
||||||
**Grill the send, not the subject.** Interview the user only about the _send_, which they can always answer: who it goes to, and what they need back. The questions in the document then target the **gap** between what the recipient knows and what the user needs.
|
|
||||||
|
|
||||||
|
|
||||||
1. **Who is it going to?** Ask, in one exchange, the recipient's role, expertise, and relationship to the user. This fixes the questionnaire's tone and how much context it must carry. Done when you know who the recipient is and what they know that the user doesn't.
|
|
||||||
|
|
||||||
2. **What do you need back?** Ask, in one exchange, the specific decisions or facts the user can't resolve alone and needs from this person. Done when you have a concrete list of what the user must walk away able to do or decide.
|
|
||||||
|
|
||||||
3. **Write the questionnaire.** Draft questions aimed at the gap from steps 1–2, following the Document structure below. Write it to `to-questionnaire-<slug>.md` in the current directory (slug from the topic) and report the path. Done when the file exists and every item the user named in step 2 is covered by a question.
|
|
||||||
|
|
||||||
## Document structure
|
|
||||||
|
|
||||||
Frame the document as a **discovery questionnaire**: the user lacks context, the recipient holds it. Order questions most-important-first, since async means you may only get one pass, and group them under `##` headings by theme once there are more than a handful. Write it using the template below.
|
|
||||||
|
|
||||||
<questionnaire-template>
|
|
||||||
|
|
||||||
# <Questionnaire title>
|
|
||||||
|
|
||||||
**Purpose:** why this questionnaire exists and the decision riding on it.
|
|
||||||
|
|
||||||
**From:** <the user>, **To:** <the recipient>, **How your answers will be used:** <where they go>
|
|
||||||
|
|
||||||
## Context
|
|
||||||
|
|
||||||
One paragraph orienting a recipient who wasn't in the user's head. Enough to answer well, not a page.
|
|
||||||
|
|
||||||
## How to answer
|
|
||||||
|
|
||||||
Deadline and rough effort. Partial answers and "I don't know" are useful: flag anything you're unsure of rather than skipping it.
|
|
||||||
|
|
||||||
## <Theme heading>
|
|
||||||
|
|
||||||
One `##` section per theme. Under each, its questions, most-important-first. Every question is one idea, never compound, with an answer stub directly beneath, and a one-line _why this matters_ only where the question could be misread or invite a throwaway answer.
|
|
||||||
|
|
||||||
<question-example>
|
|
||||||
### What load is the system expected to handle at launch?
|
|
||||||
|
|
||||||
_Why this matters: it decides whether we provision for burst traffic now or defer it._
|
|
||||||
|
|
||||||
>
|
|
||||||
</question-example>
|
|
||||||
|
|
||||||
## Anything else?
|
|
||||||
|
|
||||||
A closing catch-all: anything we didn't ask that we should know?
|
|
||||||
|
|
||||||
</questionnaire-template>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "To Questionnaire"
|
|
||||||
short_description: "Front-load questions into a doc for someone to answer"
|
|
||||||
policy:
|
|
||||||
allow_implicit_invocation: false
|
|
||||||
-75
@@ -1,75 +0,0 @@
|
|||||||
---
|
|
||||||
name: to-spec
|
|
||||||
description: "Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed."
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
This skill takes the current conversation context and codebase understanding and produces a spec. Do NOT interview the user; just synthesize what you already know.
|
|
||||||
|
|
||||||
The issue tracker and triage label vocabulary should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
|
|
||||||
|
|
||||||
## Process
|
|
||||||
|
|
||||||
1. Explore the repo to understand the current state of the codebase, if you haven't already. Use the project's domain glossary vocabulary throughout the spec, and respect any ADRs in the area you're touching.
|
|
||||||
|
|
||||||
2. Sketch out the seams at which you're going to test the feature. Existing seams should be preferred to new ones. Use the highest seam possible. If new seams are needed, propose them at the highest point you can. The fewer seams across the codebase, the better - the ideal number is one.
|
|
||||||
|
|
||||||
Check with the user that these seams match their expectations.
|
|
||||||
|
|
||||||
3. Write the spec using the template below, then publish it to the project issue tracker. Apply the `ready-for-agent` triage label - no need for additional triage.
|
|
||||||
|
|
||||||
<spec-template>
|
|
||||||
|
|
||||||
## Problem Statement
|
|
||||||
|
|
||||||
The problem that the user is facing, from the user's perspective.
|
|
||||||
|
|
||||||
## Solution
|
|
||||||
|
|
||||||
The solution to the problem, from the user's perspective.
|
|
||||||
|
|
||||||
## User Stories
|
|
||||||
|
|
||||||
A LONG, numbered list of user stories. Each user story should be in the format of:
|
|
||||||
|
|
||||||
1. As an <actor>, I want a <feature>, so that <benefit>
|
|
||||||
|
|
||||||
<user-story-example>
|
|
||||||
1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending
|
|
||||||
</user-story-example>
|
|
||||||
|
|
||||||
This list of user stories should be extremely extensive and cover all aspects of the feature.
|
|
||||||
|
|
||||||
## Implementation Decisions
|
|
||||||
|
|
||||||
A list of implementation decisions that were made. This can include:
|
|
||||||
|
|
||||||
- The modules that will be built/modified
|
|
||||||
- The interfaces of those modules that will be modified
|
|
||||||
- Technical clarifications from the developer
|
|
||||||
- Architectural decisions
|
|
||||||
- Schema changes
|
|
||||||
- API contracts
|
|
||||||
- Specific interactions
|
|
||||||
|
|
||||||
Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
|
|
||||||
|
|
||||||
Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it within the relevant decision and note briefly that it came from a prototype. Trim to the decision-rich parts, not a working demo, just the important bits.
|
|
||||||
|
|
||||||
## Testing Decisions
|
|
||||||
|
|
||||||
A list of testing decisions that were made. Include:
|
|
||||||
|
|
||||||
- A description of what makes a good test (only test external behavior, not implementation details)
|
|
||||||
- Which modules will be tested
|
|
||||||
- Prior art for the tests (i.e. similar types of tests in the codebase)
|
|
||||||
|
|
||||||
## Out of Scope
|
|
||||||
|
|
||||||
A description of the things that are out of scope for this spec.
|
|
||||||
|
|
||||||
## Further Notes
|
|
||||||
|
|
||||||
Any further notes about the feature.
|
|
||||||
|
|
||||||
</spec-template>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "To Spec"
|
|
||||||
short_description: "Turn a conversation into a spec"
|
|
||||||
policy:
|
|
||||||
allow_implicit_invocation: false
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
name: wait-what
|
|
||||||
description: "Stop. That last message did not land: re-pitch it."
|
|
||||||
disable-model-invocation: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Wait, I don't understand where you've got to here. Re-pitch that: give me a little bit of context, talk in ASD-STE100 Simplified Technical English, and use the ubiquitous language from `CONTEXT.md` (follow `CONTEXT-MAP.md` to the right one if the repo has more than one).
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "Wait What"
|
|
||||||
short_description: "Re-pitch that: simpler, with the context I'm missing"
|
|
||||||
policy:
|
|
||||||
allow_implicit_invocation: false
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# Skill mechanics
|
|
||||||
|
|
||||||
The skill-specific branch of [`writing-for-agents`](SKILL.md): what changes when the document is a skill (frontmatter, the invocation choice, and router skills). Everything else about writing it is the universal reference in `SKILL.md`.
|
|
||||||
|
|
||||||
## Invocation
|
|
||||||
|
|
||||||
Two choices, trading the two loads:
|
|
||||||
|
|
||||||
- A **model-invoked** skill keeps a `description`, so the agent can fire it autonomously, and other skills can reach it. You can still type its name: model-invocation always _includes_ user reach; a description only ever adds agent discovery, never removes the human's. The description is the skill's top-level context pointer, forced to stay loaded at all times: permanent context load in exchange for discoverability. A model-invoked skill whose content is all reference is also one home for shared reference: another skill can invoke it, so reference needed by several skills lives in one place. Mechanics: omit `disable-model-invocation`, and write a model-facing description carrying the trigger branches (the pointer-writing rules in `SKILL.md` apply in full).
|
|
||||||
- A **user-invoked** skill strips the description from the agent's reach: only the human typing its name can invoke it, and no other skill can. Zero context load, but it spends cognitive load: you are the index that must remember it exists. Mechanics: set `disable-model-invocation: true`; the `description` becomes human-facing: a one-line summary, trigger lists stripped.
|
|
||||||
|
|
||||||
Pick model-invocation only when the agent must reach the skill on its own, or another skill must. If it only ever fires by hand, make it user-invoked and pay no context load.
|
|
||||||
|
|
||||||
Shared reference that two user-invoked skills both need can live in neither: with no descriptions, neither can fire the other. Push it to a plain file outside the skill system: external reference any skill can point at.
|
|
||||||
|
|
||||||
## Splitting by invocation
|
|
||||||
|
|
||||||
The invocation cut of splitting (the sequence cut lives in `SKILL.md`): split off a model-invoked skill when you have a distinct leading word that should trigger it on its own (a trigger word you actually use in your prompts), or another skill must reach it. You pay context load for the new always-loaded description, so that independent reach has to be worth it.
|
|
||||||
|
|
||||||
## Router skills
|
|
||||||
|
|
||||||
When user-invoked skills multiply past what you can remember, that piled-up cognitive load is cured by a **router skill**: one user-invoked skill that names the others and when to reach for each, so the human has one skill to remember instead of many. It can only hint, never fire them: user-invoked skills have no description, so nothing but the human can reach them.
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
---
|
|
||||||
name: writing-for-agents
|
|
||||||
description: Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
|
|
||||||
---
|
|
||||||
|
|
||||||
Reference for writing any document an agent consumes: a skill, an `AGENTS.md` / `CLAUDE.md`, a doc reached by a pointer. The packaging differs; the writing does not: the same levers make each one predictable, since the agent takes the same _process_ every run rather than producing the same output.
|
|
||||||
|
|
||||||
When the document you're writing is a skill, read [`SKILL-MECHANICS.md`](SKILL-MECHANICS.md) for frontmatter, invocation choice, and router skills.
|
|
||||||
|
|
||||||
## Context pointers
|
|
||||||
|
|
||||||
A **context pointer** is a reference held in the agent's context that names some out-of-context material and encodes the condition for reaching it. A skill's description is one; a line in `AGENTS.md` naming a doc is the same object. The pointer's _wording_, not its target, decides when the agent reaches the material, and how reliably. A must-have target behind a weakly worded pointer is a variance bug: sharpen the wording first, and inline the material only if sharpening fails.
|
|
||||||
|
|
||||||
A pointer does two jobs: state what the material is, and list the **branches** that should trigger reaching it (a branch is a distinct case the document handles, so different runs take different paths through it). Every word of an always-loaded pointer costs on every turn, so it earns even harder pruning than the body:
|
|
||||||
|
|
||||||
- **Front-load the leading word**: the pointer is where it does its triggering work.
|
|
||||||
- **One trigger per branch.** Synonyms that rename a single branch are one branch written twice; collapse them and keep only genuinely distinct branches.
|
|
||||||
- **Cut identity the body already carries.**
|
|
||||||
|
|
||||||
## The two loads
|
|
||||||
|
|
||||||
Every document and pointer you add spends one of two budgets:
|
|
||||||
|
|
||||||
- **Context load** is the cost of always-loaded material on the agent's window: an `AGENTS.md` line, a skill description, anything sitting in context every turn, spending tokens and attention whether or not it fires.
|
|
||||||
- **Cognitive load** is the cost on the human: which documents exist and when to reach for each. The human is the index. Not a cost to minimise: it is the price of human agency; spend it where human judgement matters, remove it where it does not.
|
|
||||||
|
|
||||||
Material reached only through a pointer escapes context load at the price of the pointer's own line; material with no pointer at all rides entirely on cognitive load.
|
|
||||||
|
|
||||||
## Information hierarchy
|
|
||||||
|
|
||||||
A document is built from two content types: **steps** (the ordered actions the agent performs) and **reference** (definitions, rules, facts consulted on demand). The two mix freely: all steps (a recipe), all reference (a review's rules, this skill), or both. The core decision is where each piece sits on the **information hierarchy**, a ladder ranked by how immediately the agent needs the material:
|
|
||||||
|
|
||||||
1. **In-file step** is the primary tier: what the agent does, in order.
|
|
||||||
2. **In-file reference** is consulted on demand. Often a legitimately flat peer-set (every rule of a review on one rung), which is a fine arrangement, not a smell.
|
|
||||||
3. **Disclosed reference** is pushed out into a separate file, reached by a context pointer, loaded only when the pointer fires. Spans a sibling file in the same folder through fully external reference that lives anywhere and any document can point at.
|
|
||||||
|
|
||||||
Push too little down and the top bloats; push too much and you hide material the agent actually needs. That tension is the whole decision.
|
|
||||||
|
|
||||||
**Progressive disclosure** is the move down the ladder (out of the main file and behind a pointer) so the top stays legible. Not primarily a token optimisation: it is how the hierarchy is protected. Branching is the cleanest disclosure test: inline what every branch needs, and push behind a pointer what only some branches reach. When a document has steps, in-file reference that should be disclosed buries them and turns attending to them into a coin-flip: a variance lever, not just a legibility one.
|
|
||||||
|
|
||||||
**Co-location** is the within-file companion: where the ladder decides _how far down_ a piece sits, co-location decides _what sits beside it_ once there. Keep a concept's definition, rules, and caveats under one heading rather than scattered, so reading one part brings its neighbours with it. The test: the document should read like documentation written for the agent. Grouped material reads that way; scattered material does not. (Distinct from duplication: that repeats one meaning in two places; scattering fragments one meaning across many.)
|
|
||||||
|
|
||||||
**Sprawl** is the failure mode here: a document simply too long, even when every line is live and unique. Attention thins across the excess, and every extra line is one more to keep relevant. The cure is the ladder: disclose reference behind pointers, and split by branch or sequence so each path carries only what it needs.
|
|
||||||
|
|
||||||
## Steps and completion criteria
|
|
||||||
|
|
||||||
Every step ends on a **completion criterion**, the condition that tells the agent the work is done. Two properties make it a lever:
|
|
||||||
|
|
||||||
- **Clarity**: can the agent tell done from not-done? A vague bound ("understanding reached") invites **premature completion**: ending the step before it is genuinely done, attention slipping to _being done_. The visible steps still ahead (the **post-completion steps**) supply the pull; the criterion's clarity is the resistance. Defend in order: **sharpen the bound first** (local and cheap); only if it is irreducibly fuzzy _and_ you observe the rush, hide the later steps by splitting the sequence. Hiding only works across a real context boundary (a hand-off or a subagent dispatch; an inline call leaves the later steps in context and clears nothing).
|
|
||||||
- **Demand**: how much it requires. "Every modified model accounted for" forces thorough work where "produce a change list" does not. Demand drives **legwork** (the digging the agent does within the work, latent in the wording rather than written as its own step), and it is not step-bound: "every rule applied" binds a body of flat reference just as "every step done" binds a sequence, which is how an all-reference document still carries an exhaustiveness bar.
|
|
||||||
|
|
||||||
The strongest criteria are both checkable and exhaustive.
|
|
||||||
|
|
||||||
## When to split
|
|
||||||
|
|
||||||
Splitting one document into two spends one of the two loads, so split only when the cut earns it:
|
|
||||||
|
|
||||||
- **By sequence**: split a run of steps where the post-completion steps tempt the agent to rush the one in front of it. Keeping them out of view drives more legwork on the current task. Beware the reverse: merging sequences exposes each step's later steps to what follows, inviting premature completion.
|
|
||||||
- **By invocation**, skill-specific: see [`SKILL-MECHANICS.md`](SKILL-MECHANICS.md).
|
|
||||||
|
|
||||||
## Leading words
|
|
||||||
|
|
||||||
A **leading word** is a compact concept already living in the model's pretraining that the agent thinks with while running the document (_lesson_, _fog of war_, _tracer bullets_). Repeated as a token, never as a sentence, it accumulates a distributed definition and anchors a whole region of behaviour in the fewest tokens, by recruiting priors the model already holds. Coining your own works if you define it clearly, but a made-up word recruits no priors: you pay in definition tokens what a pretrained word gives free; reach for an existing word first.
|
|
||||||
|
|
||||||
It anchors twice. In the body, _execution_: the agent reaches for the same behaviour every time the word appears, and inside flat reference it focuses attention on a class of thing to look for. In a pointer, _invocation_: when the same word lives in your prompts, your docs, and your codebase, the agent links that shared language to the material and reaches it more reliably.
|
|
||||||
|
|
||||||
Hunt for opportunities to refactor with leading words. A triad spelled out at three sites, a pointer spending a sentence to gesture at one idea. Each is a passage begging to collapse into a single token:
|
|
||||||
|
|
||||||
- "fast, deterministic, low-overhead" → _tight_ (a _tight_ loop).
|
|
||||||
- "a loop you believe in" → _red_, turning a fuzzy gate into a binary observable state (the loop goes _red_ on the bug, or it doesn't).
|
|
||||||
|
|
||||||
You win twice: fewer tokens, and a sharper hook for the agent to hang its thinking on. Assume every document is carrying restatements that leading words retire. Go find them.
|
|
||||||
|
|
||||||
**Negation** is the failure mode beside this lever: steering by prohibition drags the forbidden behaviour into context and makes it _more_ available, not less. _Don't think of an elephant_, and the elephant is all there is; the negation is a weak modifier the strongly-activated concept overruns, so the ban half-reads as an instruction to do the thing. Prompt the **positive**: state the target behaviour ("write one-line comments") so the banned one is never spoken. A prohibition earns its place only as a hard guardrail you cannot phrase positively; even then, pair it with the positive target so attention lands on what to do.
|
|
||||||
|
|
||||||
## Pruning
|
|
||||||
|
|
||||||
- Keep each meaning in a **single source of truth**: one authoritative place, so changing the behaviour is a one-place edit. **Duplication** (the same meaning in more than one place) costs maintenance and tokens, and inflates a meaning's prominence on the ladder past its real rank. (The accidental inverse of a leading word, which repeats a token on purpose, never the meaning.)
|
|
||||||
- The **environment** is a source of truth too (`package.json` scripts, config files, the directory layout, `--help` output), and a document that restates it is a **cache**: a copy of a lookup, earning its load only when the lookup is expensive. Cache what the agent cannot find by looking: the unwritten convention, the reason behind a choice, the gotcha no config confesses. Leave the one-file, one-command lookups to the environment, where they cannot go stale.
|
|
||||||
- Check every line for **relevance**: does it still bear on what the document does? A line loses relevance by never bearing on the task (mere exposition, or a branch that should be disclosed) or by going stale as the behaviour or world it describes changes. Shorter documents are easier to keep relevant. Without a pruning discipline the default fate is **sediment**: stale layers that settle because adding feels safe and removing feels risky, until you must core down through them to find what is still live.
|
|
||||||
- Hunt **no-ops** sentence by sentence: an instruction the model already obeys by default pays load to say nothing. The test (does it change behaviour versus the default?) is model-relative, not reader-relative: two people disagreeing about a no-op disagree about the default, and settle it by running the document, not by debate. When a sentence fails, delete the whole sentence rather than trim words from it. The test also grades leading words: a word too weak to beat the default (_be thorough_ when the agent is already thorough-ish) is a no-op, and the fix is a stronger word (_relentless_), not a different technique.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
interface:
|
|
||||||
display_name: "Writing for Agents"
|
|
||||||
short_description: "Write documents agents consume"
|
|
||||||
@@ -1,415 +0,0 @@
|
|||||||
---
|
|
||||||
name: officecli-data-dashboard
|
|
||||||
description: "Use this skill to build a multi-element Excel dashboard — Dashboard sheet on open, multiple formula-driven KPI cards, multiple charts, sparklines, and conditional formatting — from CSV or tabular input. Trigger on: 'dashboard', 'KPI dashboard', 'analytics dashboard', 'executive dashboard', 'metrics dashboard', 'CSV to dashboard', 'data visualization'. Output is a single .xlsx. Scene-layer on officecli-xlsx: inherits every xlsx hard rule. DO NOT invoke for: a single budget tracker / one-sheet CSV-with-formatting (use xlsx), a 3-statement / DCF / LBO financial model (use financial-model), a weekly report with ≤ 1 chart and < 10 rows (use xlsx)."
|
|
||||||
---
|
|
||||||
|
|
||||||
# Data Dashboard (scene-layer on officecli-xlsx)
|
|
||||||
|
|
||||||
A dashboard is not "a spreadsheet with charts". It is a composition: **one Dashboard sheet the user lands on** with formula-driven KPI cards, cell-range-linked charts, sparklines, and semantic conditional formatting. Everything else (raw data, aggregations) is upstream infrastructure the user should never need to open. This skill teaches the composition pattern. Everything about the xlsx engine — cells, formulas, batch JSON, shell quoting, validate, HTML preview — comes from `officecli-xlsx` and is not re-taught here.
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
If `officecli` is missing:
|
|
||||||
|
|
||||||
- **macOS / Linux**: `curl -fsSL https://d.officecli.ai/install.sh | bash`
|
|
||||||
- **Windows (PowerShell)**: `irm https://d.officecli.ai/install.ps1 | iex`
|
|
||||||
|
|
||||||
Verify with `officecli --version` (open a new terminal if PATH hasn't picked up). If install fails, download a binary from https://github.com/iOfficeAI/OfficeCLI/releases.
|
|
||||||
|
|
||||||
## ⚠️ Help-First Rule
|
|
||||||
|
|
||||||
**When a prop name, enum value, or alias is uncertain, consult help before guessing.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli help xlsx # element list
|
|
||||||
officecli help xlsx chart # full schema for charts
|
|
||||||
officecli help xlsx sparkline # sparklines
|
|
||||||
officecli help xlsx conditionalformatting # all CF rule types
|
|
||||||
```
|
|
||||||
|
|
||||||
Help reflects the installed CLI version. When this skill and help disagree, **help wins**. DeferredAddKeys (`combosplit`, `holesize`) work on `add` only — see Reference.
|
|
||||||
|
|
||||||
## Mental Model & Inheritance
|
|
||||||
|
|
||||||
This skill **inherits every xlsx hard rule** from `officecli-xlsx` — shell quoting, zero formula errors, visual delivery floor, batch JSON shape (`{"command":"set"|"add","path":...,"props":{...}}` — key is `command`, NOT `action`), batch JSON dotted-name rule, chart data-feed forms, batch+resident limits, `validate` discipline. Read officecli-xlsx first; honour those rules, do not re-teach them here.
|
|
||||||
|
|
||||||
**Reverse handoff — do NOT use this skill when:**
|
|
||||||
|
|
||||||
- The ask is a **single-sheet CSV-with-formatting tracker** (no Dashboard sheet, no KPI cards, ≤ 1 chart) → go back to `officecli-xlsx`.
|
|
||||||
- The ask is a **3-statement / DCF / LBO financial model** with blue-inputs / black-formulas / cross-sheet drivers → use `officecli-financial-model`.
|
|
||||||
- The ask is a **weekly status report** with one SUMIF summary and one chart over < 10 rows → `officecli-xlsx`.
|
|
||||||
|
|
||||||
This skill only accepts: "a Dashboard sheet the user opens first, multiple KPI cards, multiple charts, some CF / sparklines".
|
|
||||||
|
|
||||||
## Shell & Execution Discipline
|
|
||||||
|
|
||||||
→ see officecli-xlsx §Shell & Execution Discipline for the baseline (quoting, heredoc for `!`, incremental execution).
|
|
||||||
|
|
||||||
Two increments specific to dashboards:
|
|
||||||
|
|
||||||
- **Long chart `add` commands exceed 180 chars.** Always split across lines with trailing `\`; never pack a chart command onto a single line. The longer the command, the higher the chance a shell-escape bug hides inside it.
|
|
||||||
- **Multi-instance counts use `query --json | jq length`, never `raw-get | grep -c`.** Example: `officecli query "$FILE" chart --json | jq '.data.results | length'` for "how many charts do I have?".
|
|
||||||
|
|
||||||
## Core Principles
|
|
||||||
|
|
||||||
Five non-negotiable principles. If any one is violated the output is not a dashboard, it is a spreadsheet that happens to have a chart.
|
|
||||||
|
|
||||||
1. **Formula-driven KPIs.** Every KPI value on the Dashboard sheet is a formula — `SUM`, `AVERAGE`, `IFERROR((...-...)/...,0)`, whatever — referring to cells on the Data / Summary sheet. Never hardcode a computed number. When the underlying data changes tomorrow, KPIs update on open.
|
|
||||||
|
|
||||||
2. **Cell-range references for charts.** Every chart series reads from a cell range: `series1.values="Sheet1!B2:B13"`. Inline `data="Revenue:100,200,300"` is for a 5-minute demo, not a delivered dashboard. The one exception: data requires an aggregation Excel cannot express (rare) — document the exception in a comment cell.
|
|
||||||
|
|
||||||
3. **Dashboard-first architecture.** KPI label cells, KPI value cells, charts, sparklines all live on the **Dashboard** sheet — the single sheet a user lands on. Raw imports and `SUMIFS` rollups live on Data / Summary sheets, upstream of the Dashboard. The user should never need to switch tabs to find the answer.
|
|
||||||
|
|
||||||
4. **Visible cells only for chart sources.** LibreOffice does not evaluate formulas in hidden columns or hidden sheets at render time. A chart whose `series1.values` points at a hidden-column `SUMIFS` renders blank. Pattern: aggregate into a **visible** Summary sheet, point charts at Summary cells, hide only helper columns that are not chart sources.
|
|
||||||
|
|
||||||
5. **Data-size-aware complexity.** A 10-row dataset does not get 5 KPIs and 4 charts. A 200-row dataset does not get 1 KPI and 1 chart. Scale up the composition with the input (table in §Design Ideas). Overbuilding is as wrong as underbuilding.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
All `officecli-xlsx` requirements apply (→ see officecli-xlsx §Requirements for Outputs). Dashboards add these:
|
|
||||||
|
|
||||||
- **Dashboard sheet is the active tab on open.** Confirm 0-based sheet index with `officecli query "$FILE" sheet` BEFORE filling `activeTab="N"`. Never guess the index.
|
|
||||||
- **`calc.fullCalcOnLoad=true`.** Set via `officecli set "$FILE" / --prop calc.fullCalcOnLoad=true`. Do NOT `raw-set` `<calcPr>` — it produces duplicate elements that fail validate.
|
|
||||||
- **Refresh downstream cachedValue after every upstream edit.** `fullCalcOnLoad=true` schedules runtime recalc only; it does NOT refresh build-time `cachedValue`. After `set B=100 → set E==B+D → fix B=150`, E is stale until you re-issue E's formula (or close/reopen). Stale cache ships "Net Change = 0" to the board.
|
|
||||||
- **Every chart has a descriptive title and every series has a name.** `"Series1"` in a legend is unfinished work.
|
|
||||||
- **Every KPI value cell has a formula.** Verifiable: `officecli query "$FILE" 'Dashboard!:has(formula)' --json | jq '.data.results | length'` should equal your planned KPI count.
|
|
||||||
- **Header row fill on every data sheet.** Data sheet, Summary sheet, and any secondary data sheet need row 1 filled (e.g., `fill=1F3864 + font.color=FFFFFF + font.bold=true`).
|
|
||||||
- **10+ rows on Data sheet → ≥ 1 CF rule on a numeric column.** A 20-row table with zero visual scanning aid is a quality miss.
|
|
||||||
- **Dashboard value columns sized to the widest expected cachedValue — not a fixed 22.** Rule of thumb at 24pt bold + currency numFmt: `width ≈ ceil((visible_chars + 2) × 1.3)`. A KPI holding `¥1,958,414,250` (14 visible chars with currency + commas) needs `width ≥ 28`; a 4-digit KPI still needs `width ≥ 22` as the floor. Hardcoding `22` for a 10+ digit KPI is how `###` ships to the user.
|
|
||||||
- **Sparkline row height ≥ 20.** A sparkline in a default 15pt row is a flat squiggle — set `/Dashboard/row[N] height=22` (or 24 when paired with a 24pt KPI value cell in the same row).
|
|
||||||
- **Print deliverables set `_xlnm.Print_Area` scoped to Dashboard** + hide non-Dashboard sheets + add `<pageSetup fitToPage/>`. Without all three, the print pipeline emits every sheet and Dashboard lands on page 2+. See §Print-ready delivery for the exact commands.
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
Minimal viable dashboard: 12-month revenue CSV → 4 KPIs + 1 line chart + activeTab + fullCalcOnLoad. Adapt the numbers, don't copy-paste blind. Broken into phases so a single failed phase is obvious.
|
|
||||||
|
|
||||||
**Phase 1 — Data sheet: create, import, format.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
FILE=my_dashboard.xlsx
|
|
||||||
officecli create "$FILE"
|
|
||||||
officecli import "$FILE" /Sheet1 --file sales.csv --header
|
|
||||||
officecli set "$FILE" '/Sheet1/col[A]' --prop width=12
|
|
||||||
officecli set "$FILE" '/Sheet1/col[B]' --prop width=15
|
|
||||||
officecli set "$FILE" '/Sheet1/B2:B13' --prop numFmt='$#,##0'
|
|
||||||
officecli set "$FILE" '/Sheet1/A1:B1' --prop fill=1F3864 --prop font.color=FFFFFF --prop font.bold=true
|
|
||||||
```
|
|
||||||
|
|
||||||
**Phase 2 — Dashboard sheet + one KPI card.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" / --type sheet --prop name=Dashboard
|
|
||||||
officecli set "$FILE" '/Dashboard/col[A]' --prop width=22
|
|
||||||
officecli set "$FILE" '/Dashboard/col[B]' --prop width=12
|
|
||||||
officecli set "$FILE" /Dashboard/A1 --prop value="Total Revenue" --prop font.size=9 --prop font.color=666666 --prop bold=true
|
|
||||||
officecli set "$FILE" /Dashboard/A2 --prop 'formula==SUM(Sheet1!B2:B13)' --prop numFmt='$#,##0' --prop font.size=24 --prop bold=true --prop font.color=2E7D32
|
|
||||||
```
|
|
||||||
|
|
||||||
**Phase 3 — Sparkline + chart.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /Dashboard --type sparkline --prop cell=B2 --prop range='Sheet1!B2:B13' --prop type=line --prop color=4472C4 --prop highPoint=true --prop highMarkerColor=FF0000
|
|
||||||
officecli add "$FILE" /Dashboard --type chart \
|
|
||||||
--prop chartType=line \
|
|
||||||
--prop title="Revenue Trend" \
|
|
||||||
--prop series1.name="Revenue" \
|
|
||||||
--prop series1.values='Sheet1!B2:B13' \
|
|
||||||
--prop series1.categories='Sheet1!A2:A13' \
|
|
||||||
--prop preset=dashboard --prop axisNumFmt='$#,##0' \
|
|
||||||
--prop x=0 --prop y=5 --prop width=10 --prop height=15
|
|
||||||
```
|
|
||||||
|
|
||||||
**Phase 4 — fullCalcOnLoad → activeTab (LAST) → close → validate.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" / --prop calc.fullCalcOnLoad=true
|
|
||||||
|
|
||||||
# Resolve Dashboard's 0-based index from the actual sheet list — never hardcode.
|
|
||||||
DASH_IDX=$(officecli query "$FILE" sheet --json \
|
|
||||||
| jq '[.data.results[].path] | index("/Dashboard")')
|
|
||||||
officecli raw-set "$FILE" /workbook --xpath "//x:sheets" --action insertbefore \
|
|
||||||
--xml "<bookViews xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><workbookView activeTab=\"$DASH_IDX\" /></bookViews>"
|
|
||||||
officecli close "$FILE"
|
|
||||||
officecli validate "$FILE"
|
|
||||||
```
|
|
||||||
|
|
||||||
Verified end-to-end on a 12-row revenue CSV: `validate` reports no errors, Dashboard opens first, `Dashboard/A2.cachedValue` resolves (2,075,000 for the test data), chart renders with values linked.
|
|
||||||
|
|
||||||
## Design Ideas
|
|
||||||
|
|
||||||
Options, not templates. The user's data and audience drive the choices.
|
|
||||||
|
|
||||||
### Layout patterns (pick one, stay consistent)
|
|
||||||
|
|
||||||
**Pattern 1 — executive summary** (board packs): KPI strip A1:H4, charts stack from row 6.
|
|
||||||
```
|
|
||||||
┌ KPI1 │ KPI2 │ KPI3 │ KPI4 ┐ rows 1-4
|
|
||||||
├──────┴──────┴──────┴──────┤
|
|
||||||
│ Chart 1 (wide) │ rows 6-18
|
|
||||||
├───────────────┬───────────┤
|
|
||||||
│ Chart 2 │ Chart 3 │ rows 20-32
|
|
||||||
```
|
|
||||||
|
|
||||||
**Pattern 2 — ops console** (live ops): KPIs down A:B, charts fill C:L.
|
|
||||||
```
|
|
||||||
│ KPI1 │ │
|
|
||||||
│ KPI2 │ Chart 1 │ rows 1-12
|
|
||||||
│ KPI3 │ │
|
|
||||||
│ KPI4 ├───────────────────┤
|
|
||||||
│ KPI5 │ Chart 2 │ rows 14-26
|
|
||||||
```
|
|
||||||
|
|
||||||
**Pattern 3 — scorecard** (≥ 6 KPIs, no dominant chart): grid of 2×3 cards (label / value / sparkline).
|
|
||||||
```
|
|
||||||
│ KPI1 │ KPI2 │ KPI3 │ rows 1-4
|
|
||||||
│ KPI4 │ KPI5 │ KPI6 │ rows 5-8
|
|
||||||
```
|
|
||||||
|
|
||||||
### Complexity scaling by data size
|
|
||||||
|
|
||||||
| Rows | KPIs | Charts | Sparklines | CF rules | Preset |
|
|
||||||
|---|---|---|---|---|---|
|
|
||||||
| < 10 | 1–2 | 1 | skip | 0–1 | `minimal` |
|
|
||||||
| 10–50 | 2–3 | 2 | only if sequential time-series | 1–2 | `dashboard` |
|
|
||||||
| 50–200 | 3–5 | 2–3 | only if sequential time-series | 2–3 | `dashboard` |
|
|
||||||
| 200+ | 3–5 | 3 | only if sequential time-series | 3–4 | `dashboard` |
|
|
||||||
|
|
||||||
### Chart type selection
|
|
||||||
|
|
||||||
| Data pattern | Chart type | Notes |
|
|
||||||
|---|---|---|
|
|
||||||
| Trend over time, one series | `line` | Add `trendline=linear` to show direction on noisy series |
|
|
||||||
| Trend over time, multiple components | `line` (multi-series) or `columnStacked` | Stacked when components sum to a meaningful total |
|
|
||||||
| Comparison across categories in time order | `column` | Not `bar` — horizontal bars break left-to-right time reading |
|
|
||||||
| Part-of-whole breakdown | `doughnut` | Prefer over `pie`: `chartType=pie` has a known LibreOffice blank-render regression |
|
|
||||||
| Budget vs actual | `combo` with `combosplit=1` | First series as bars, rest as lines |
|
|
||||||
| Correlation | `scatter` | X-axis via `categories` / `series1.categories` — `series1.xValues` is UNSUPPORTED |
|
|
||||||
|
|
||||||
### Preset options
|
|
||||||
|
|
||||||
`--prop preset=<name>` on every chart. Options: `minimal`, `dashboard`, `corporate`, `magazine`, `colorful`, `monochrome`, `dark`. Pick one and stay consistent across all charts on a single Dashboard — mixing presets reads as accidental.
|
|
||||||
|
|
||||||
### Conditional formatting — semantic colors
|
|
||||||
|
|
||||||
Four CF rule types; each uses `--type <shorthand>` at `add` time:
|
|
||||||
|
|
||||||
| Intent | `--type` | Typical props |
|
|
||||||
|---|---|---|
|
|
||||||
| Magnitude bar (sales, spend) | `databar` | `sqref=B2:B13 color=4472C4` — explicit `min=0 max=<plausible>` recommended for predictable scaling, but omitting them is valid (defaults to data min/max) |
|
|
||||||
| Heat map (rates, growth) | `colorscale` | `sqref=D2:D13 mincolor=FFCDD2 midcolor=FFFFFF maxcolor=C8E6C9` |
|
|
||||||
| Status indicator | `iconset` | `sqref=E2:E13 iconset=3Arrows` — see help for the full enum |
|
|
||||||
| Custom business rule | `formulacf` | `sqref=B2:B13 'formula=$B2>=100000' fill=C8E6C9 font.color=2E7D32` — `font.bold` works on CF too |
|
|
||||||
|
|
||||||
Semantic colors to stay consistent within a dashboard:
|
|
||||||
|
|
||||||
- good / positive: fill `C8E6C9`, font `2E7D32`
|
|
||||||
- bad / negative: fill `FFCDD2`, font `C62828`
|
|
||||||
- neutral: fill `F5F5F5`, font `666666`
|
|
||||||
|
|
||||||
### KPI card anatomy
|
|
||||||
|
|
||||||
A card is a label cell + a value cell. The label is small gray (font.size=9, font.color=666666, bold); the value is large bold (font.size=24, bold=true, numFmt, font.color signals tone). One row of light fill (e.g. `F0F4FF`) across the card area gives the "card" read without building merged-cell scaffolds. Value column width must be sized to the largest cachedValue — never narrower than 22, often 26–32 for 8+ digit currency (see Requirements).
|
|
||||||
|
|
||||||
### Chart width budget by title length
|
|
||||||
|
|
||||||
At the `dashboard` preset's default title font, the chart plot-box width (in column units) must stay ahead of the title string, or the title clips mid-word. Rule of thumb: `chart.width ≥ ceil(title.length × 0.18)`. A 35-character title ("Department: Year-End Headcount vs Attrition Rate") needs `width ≥ 7`; be safer and use 10–12. If the anchor cannot be widened, shorten the title to ≤ 25 characters — clipped titles in a board-ready deliverable are indefensible.
|
|
||||||
|
|
||||||
`officecli get chart[N]` exposes numeric `width` (e.g. `width=480pt`) alongside `anchor` (e.g. `"A6:K21"`) at `.data.results[0].format`. Either is usable for Gate 2 — derive column span from anchor letters (A→K = 10 cols) when you need a column-unit budget.
|
|
||||||
|
|
||||||
### Print-ready delivery (board-pack / investor-send / one-pager)
|
|
||||||
|
|
||||||
Triggers: ask contains "print" / "一页" / "董事会" / "投资人". Four artefacts on the Dashboard sheet; non-Dashboard sheets hidden so the print pipeline emits one page only.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Print_Area scoped to Dashboard (xlnm convention).
|
|
||||||
officecli add "$FILE" / --type namedrange --prop name=_xlnm.Print_Area --prop scope=Dashboard --prop 'refersTo=Dashboard!$A$1:$H$36'
|
|
||||||
# 2. fit-to-page on Dashboard.
|
|
||||||
officecli raw-set "$FILE" /Dashboard --xpath "//x:worksheet" --action prepend --xml '<sheetPr xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><pageSetUpPr fitToPage="1"/></sheetPr>'
|
|
||||||
# 3. Landscape page setup.
|
|
||||||
officecli raw-set "$FILE" /Dashboard --xpath "//x:sheetData" --action insertafter --xml '<pageSetup orientation="landscape" paperSize="9" fitToWidth="1" fitToHeight="1"/>'
|
|
||||||
# 4. Hide non-Dashboard sheets — Print_Area scope alone does NOT stop the print pipeline from emitting every visible sheet.
|
|
||||||
for S in Sheet1 Summary; do
|
|
||||||
officecli raw-set "$FILE" /workbook --xpath "//x:sheet[@name='$S']" --action setattr --xml "state=hidden" || true
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
Delete any `Print_Area` set on Data / Summary sheets — conflicting scopes emit multi-page output.
|
|
||||||
|
|
||||||
## QA (REQUIRED — Delivery Gate)
|
|
||||||
|
|
||||||
**Assume there are problems. Your job is to find them.** A chart that was rendered does not mean a chart that was meaningful. "validate pass" is not delivery; "the Dashboard sheet reads like someone who knows the business made it" is delivery.
|
|
||||||
|
|
||||||
### Minimum cycle before "done"
|
|
||||||
|
|
||||||
Inherit the xlsx baseline (`view issues`, formula error queries, `validate`, HTML preview scan): → see officecli-xlsx §QA minimum cycle.
|
|
||||||
|
|
||||||
Then run the dashboard-specific Delivery Gates. Each gate uses **COUNT-then-if** pattern with a `.data.*` wrapper — never chain `&& echo OK || echo FAIL`.
|
|
||||||
|
|
||||||
**Gate 1 — KPI formula coverage.** Every planned KPI cell must carry a formula. Adjust `-lt 2` to your plan (4 KPIs → `-lt 4`).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
KPI_FORMULAS=$(officecli query "$FILE" 'Dashboard!:has(formula)' --json | jq '.data.results | length')
|
|
||||||
[ "$KPI_FORMULAS" -lt 2 ] && { echo "REJECT Gate 1: $KPI_FORMULAS formula cells on Dashboard"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
**Gate 2 — Chart count matches plan, every chart has data + plausible title width.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
CHART_COUNT=$(officecli query "$FILE" chart --json | jq '.data.results | length')
|
|
||||||
[ "$CHART_COUNT" -lt 1 ] && { echo "REJECT Gate 2: zero charts"; exit 1; }
|
|
||||||
col_num () { local c=$1 n=0; for ((k=0;k<${#c};k++)); do n=$((n*26+$(printf '%d' "'${c:$k:1}")-64)); done; echo "$n"; }
|
|
||||||
for i in $(seq 1 "$CHART_COUNT"); do
|
|
||||||
JSON=$(officecli get "$FILE" "/Dashboard/chart[$i]" --json)
|
|
||||||
SC=$(echo "$JSON" | jq -r '.data.results[0].format.seriesCount // 0')
|
|
||||||
TITLE=$(echo "$JSON" | jq -r '.data.results[0].format.title // ""')
|
|
||||||
ANCHOR=$(echo "$JSON" | jq -r '.data.results[0].format.anchor // ""')
|
|
||||||
[ "$SC" = "0" ] || [ -z "$TITLE" ] && { echo "REJECT Gate 2: chart[$i] seriesCount=$SC title='$TITLE'"; exit 1; }
|
|
||||||
[ -z "$ANCHOR" ] && continue
|
|
||||||
LCOL=$(echo "${ANCHOR%%:*}" | sed 's/[0-9]*$//'); RCOL=$(echo "${ANCHOR##*:}" | sed 's/[0-9]*$//')
|
|
||||||
SPAN=$(( $(col_num "$RCOL") - $(col_num "$LCOL") + 1 ))
|
|
||||||
MIN=$(( (${#TITLE} * 18 + 99) / 100 ))
|
|
||||||
[ "$SPAN" -lt "$MIN" ] && { echo "REJECT Gate 2: chart[$i] title=${#TITLE} chars needs width ≥ $MIN, anchor spans $SPAN"; exit 1; }
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
Narrower titles at preset `minimal` / `magazine` may clip earlier than the 0.18 factor — spot-check.
|
|
||||||
|
|
||||||
**Gate 3 — Chart series names populated (no "Series1" in legend).**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
for i in $(seq 1 "$CHART_COUNT"); do
|
|
||||||
BAD=$(officecli get "$FILE" "/Dashboard/chart[$i]" --json | jq '[.data.results[0].children[]? | select(.type == "series") | select((.format.name // "") | test("^Series[0-9]+$"; "i"))] | length')
|
|
||||||
[ "$BAD" -gt 0 ] && { echo "REJECT Gate 3: chart[$i] has $BAD auto-named series"; exit 1; }
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
**Gate 4 — CF rules on Data sheet (10+ rows).**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
CF_COUNT=$(officecli query "$FILE" conditionalformatting --json | jq '.data.results | length')
|
|
||||||
[ "$CF_COUNT" -lt 1 ] && { echo "REJECT Gate 4: zero CF rules on 10+ row data sheet"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: `query conditionalformatting` is the canonical element name; `query cf` returns 0 (not an alias).
|
|
||||||
|
|
||||||
**Gate 5 — activeTab and fullCalcOnLoad set.** Compare against real Dashboard index (Dashboard-at-index-0 is a true pass).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
DASH_IDX=$(officecli query "$FILE" sheet --json | jq '[.data.results[].path] | index("/Dashboard")')
|
|
||||||
ACTIVE=$(officecli get "$FILE" /workbook --json | jq '.data.results[0].format.activeTab // -1')
|
|
||||||
FULLCALC=$(officecli get "$FILE" /workbook --json | jq -r '.data.results[0].format["calc.fullCalcOnLoad"] // false')
|
|
||||||
[ "$ACTIVE" != "$DASH_IDX" ] && { echo "REJECT Gate 5: activeTab=$ACTIVE Dashboard=$DASH_IDX"; exit 1; }
|
|
||||||
[ "$FULLCALC" != "true" ] && { echo "REJECT Gate 5: calc.fullCalcOnLoad=$FULLCALC — stale caches will ship"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
**Gate 6 — Placeholder sweep.** No build-time tokens in rendered output.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
LEAKS=$(officecli view "$FILE" text 2>/dev/null | grep -niE '\{\{|\$fy\$|<TODO>|xxxx|TBD' | wc -l | tr -d ' ')
|
|
||||||
[ "$LEAKS" -gt 0 ] && { echo "REJECT Gate 6: $LEAKS placeholder tokens"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
**Gate 7 — Visual delivery floor (ported from xlsx).** Run `officecli view "$FILE" html` and Read the returned HTML path. Confirm:
|
|
||||||
|
|
||||||
- No `###` in any Dashboard or Data cell (columns too narrow).
|
|
||||||
- No truncated KPI labels, sheet tab names, or chart titles.
|
|
||||||
- No placeholder tokens rendered as text (`$fy$24`, `{var}`, `<TODO>`, `xxxx`).
|
|
||||||
- Pie / doughnut slices render with distinct fill colors (if collapsed in LibreOffice, verify in the user's target viewer before declaring broken — → see officecli-xlsx §Known Issues/Renderer caveats).
|
|
||||||
- No empty chart anchors — every chart has a visible, plausible plot.
|
|
||||||
- Dashboard sheet opens first (tab highlighted, active area scrolled to top).
|
|
||||||
|
|
||||||
If `view html` is blocked (renderer conflict, headless, port busy), Gate 7 is still **mandatory** — run ALL fallback checks:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# a) Token / ### sweep.
|
|
||||||
officecli view "$FILE" text 2>/dev/null | grep -nE '###|\{\{|<TODO>|\$fy\$|xxxx' && { echo "REJECT Gate 7: tokens or ### present"; exit 1; }
|
|
||||||
# b) Per-KPI: cachedValue length × coef must fit col width. coef=0.55 fit-to-page, 0.85 otherwise.
|
|
||||||
for CELL in A2 C2 E2 G2; do
|
|
||||||
CV=$(officecli get "$FILE" "/Dashboard/$CELL" --json | jq -r '.data.results[0].format.cachedValue // .data.results[0].text // ""')
|
|
||||||
W=$(officecli get "$FILE" "/Dashboard/col[${CELL%%[0-9]*}]" --json | jq -r '.data.results[0].format.width // 0')
|
|
||||||
CAP=$(echo "$W * 0.55" | bc -l | awk '{print int($1)}')
|
|
||||||
[ "${#CV}" -gt "$CAP" ] && { echo "REJECT Gate 7: $CELL '$CV' (${#CV} chars) > cap $CAP"; exit 1; }
|
|
||||||
done
|
|
||||||
# c) Rerun Gate 2 title × 0.18 ≤ anchor span. d) Log which fallback was used and why.
|
|
||||||
```
|
|
||||||
|
|
||||||
Gate 7 must **NEVER** be skipped — skipping ships `###` to the user.
|
|
||||||
|
|
||||||
If scene keywords include print / 一页 / board / 投资人 / 董事会, extend Gate 7 with a structural print-scope check:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
if echo "$USER_REQ" | grep -qiE 'print|一页|投资人|董事会|board'; then
|
|
||||||
# Every non-Dashboard sheet must be hidden or veryHidden.
|
|
||||||
# query sheet --json carries the name in .preview (no .name/.state); visibility lives in
|
|
||||||
# each sheet's own get .format.hidden (absent => visible), so iterate + probe per sheet.
|
|
||||||
LEAKING=""
|
|
||||||
while IFS=$'\t' read -r SPATH SNAME; do
|
|
||||||
[ "$SNAME" = "Dashboard" ] && continue
|
|
||||||
HIDDEN=$(officecli get "$FILE" "$SPATH" --json | jq -r '.data.results[0].format.hidden // false')
|
|
||||||
[ "$HIDDEN" != "true" ] && LEAKING="$LEAKING $SNAME"
|
|
||||||
done < <(officecli query "$FILE" 'sheet' --json | jq -r '.data.results[] | [.path, .preview] | @tsv')
|
|
||||||
[ -n "$LEAKING" ] && { echo "REJECT Gate 7 print-scope: visible non-Dashboard sheet(s):$LEAKING — hide before delivery"; exit 1; }
|
|
||||||
# Dashboard must carry an explicit Print_Area named range.
|
|
||||||
PA=$(officecli query "$FILE" 'namedrange[name="_xlnm.Print_Area"]' --json | jq '.data.results | length')
|
|
||||||
[ "$PA" -ge 1 ] || { echo "REJECT Gate 7 print-scope: no _xlnm.Print_Area set"; exit 1; }
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
The user opens the file in their target viewer (Office / WPS / Numbers) for the final print preview — the skill does not render export artefacts.
|
|
||||||
|
|
||||||
**Gate 8 — Formula sanity (cachedValue real, not stale/error).** `fullCalcOnLoad=true` refreshes at runtime, NOT build-time cache — so every formula cell must carry a non-empty, non-zero, non-error `cachedValue` now.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
for CELL in A2 C2 E2 G2; do
|
|
||||||
JSON=$(officecli get "$FILE" "/Dashboard/$CELL" --json)
|
|
||||||
[ -z "$(echo "$JSON" | jq -r '.data.results[0].format.formula // ""')" ] && continue
|
|
||||||
CV=$(echo "$JSON" | jq -r '.data.results[0].format.cachedValue // ""')
|
|
||||||
case "$CV" in
|
|
||||||
"" | "0" | "#DIV/0!" | "#REF!" | "#N/A" | "#VALUE!" | "#NAME?" | "null")
|
|
||||||
echo "REJECT Gate 8: $CELL cachedValue='$CV' — re-issue formula or close+reopen"; exit 1 ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
If a KPI is genuinely zero (e.g. "terminations this quarter" = 0), whitelist it in the loop and document — default assumption is "zero is broken".
|
|
||||||
|
|
||||||
If anything fails, fix at source, re-run the full cycle.
|
|
||||||
|
|
||||||
### Honest limits
|
|
||||||
|
|
||||||
Scatter charts do not accept `series1.xValues` (UNSUPPORTED) — feed the x-axis via `categories` / `series1.categories`. LibreOffice chart color drift / pie-slice collapse / checkbox double-box are viewer artifacts — spot-check in Office / WPS / Numbers first.
|
|
||||||
|
|
||||||
## Reference
|
|
||||||
|
|
||||||
- **Shorthand `--type` at `add`:** `chart`, `sparkline`, `databar`, `colorscale`, `iconset`, `formulacf`. CF rules map to `help xlsx conditionalformatting`; path suffix `/Sheet/cf[N]`.
|
|
||||||
- **Full schemas live in help:** `officecli help xlsx chart` / `sparkline` / `conditionalformatting`. This skill does not mirror them.
|
|
||||||
- **DeferredAddKeys (add-only):** `combosplit`, `holesize`. See D-1. (`preset`, `trendline`, `referenceline`, `axisNumFmt` now work on `set` too — help shows `[add/set]`.)
|
|
||||||
- **Build order:** charts + sparklines + CF + tabColors first → `calc.fullCalcOnLoad=true` via high-level `set` → `raw-set activeTab` **LAST** (after all sheets exist).
|
|
||||||
|
|
||||||
## Known Issues & Pitfalls
|
|
||||||
|
|
||||||
### Dashboard-specific
|
|
||||||
|
|
||||||
| # | Issue | Mitigation |
|
|
||||||
|---|---|---|
|
|
||||||
| D-1 | `combosplit` is a DeferredAddKey — works on `add` only. (`preset`, `referenceline`, `trendline`, `axisNumFmt` now apply on `set` too — help shows `[add/set]`.) | Set `combosplit` at `add` time; cannot apply after the fact — remove + re-add. The other four can be applied or changed post-creation via `set`. |
|
|
||||||
| D-2 | `referenceline` format is `value:color:label:dash` (color BEFORE label). `"0:Break-Even:FF0000:dash"` fails `Invalid color value`. | Order is value, color, label, dash. |
|
|
||||||
| D-3 | Scatter charts do NOT accept `series1.xValues` (UNSUPPORTED). Feed the x-axis through `categories` / `series1.categories`. | `--prop series1.categories="Sheet1!A2:A13"` (or `--prop categories="Sheet1!A2:A13"`) |
|
|
||||||
| D-4 | `formulacf` honors `font.bold` / `font.italic` (written to the dxf font and surfaced on readback), alongside `fill` and `font.color`. | Use any of `fill` / `font.color` / `font.bold` / `font.italic` to signal a CF rule. |
|
|
||||||
| D-5 | Dashboard column widths default to 8.43 — KPI values at 24pt bold show `###` | Size by cachedValue bracket: 4–6 digits → 22–24; 7–9 digits (million) → 26–30; 10+ digits (亿 / billion) → 32–36; 百亿 / 10-digit + currency symbol + fit-to-page landscape → **40–44**. Formula `ceil((visible_chars+2)*1.3)` is a starting point; always verify via Gate 7 fallback b). Sparkline columns: 12. |
|
|
||||||
| D-6 | `raw-set activeTab` must be the LAST mutation. Inserting before all sheets exist shifts indices. | Finish all sheets / charts / CF / sparklines / tabColors, then `raw-set`. |
|
|
||||||
| D-7 | `calc.fullCalcOnLoad` via `raw-set` creates duplicate `<calcPr>` → validate fails | Use `officecli set "$FILE" / --prop calc.fullCalcOnLoad=true`. |
|
|
||||||
| D-8 | LibreOffice does not evaluate hidden-column formulas at render → charts referencing hidden cells render blank | Aggregate into a visible Summary sheet, chart reads from Summary. Hide only columns that are not chart sources. |
|
|
||||||
| D-9 | `chartType=pie` blank-renders in LibreOffice | Use `doughnut` as the safe substitute for part-of-whole breakdowns. |
|
|
||||||
| D-10 | `SUMIFS` / `AVERAGEIFS` with date criteria fails silently if the criterion is a string | Wrap with `DATE()` or `DATEVALUE()`: `=SUMIFS(B2:B13,A2:A13,DATE(2025,1,5))`. |
|
|
||||||
| D-11 | Summary sheet percentage formulas display as raw decimals (0.098) without `numFmt` | Set `numFmt="0.0%"` at the same `set` call as the formula. |
|
|
||||||
| D-12 | `import --header` sets freeze + AutoFilter but does NOT set column widths. | Set widths on `col[]`. `numFmt` on a `col[]` path now applies a column-level style (`<col s=...>`, schema-valid, reads back as `numberformat`); it formats blank cells in the column. Cells with their own style still need a per-cell-range `numFmt`. |
|
|
||||||
| D-13 | Sparkline `highpoint` is a bool (highlight on/off), not a color. `--prop highpoint=FF0000` errors `Invalid boolean value` | `--prop highPoint=true --prop highMarkerColor=FF0000`. Same pattern for lowPoint / firstPoint / lastPoint and their *MarkerColor. |
|
|
||||||
| D-14 | Sparkline cross-sectional data is meaningless (a region or department has no ordering) | Skip sparklines unless rows are a sequential time-series (dates, months, quarters). |
|
|
||||||
| D-15 | Empty chart `add` is rejected (`Chart requires a 'data' property`) at the CLI layer — legacy skills that relied on silent accept will fail here | Always provide `series1.values=` / `dataRange=` / inline `data=` at chart `add` time. Treat Gate 2 seriesCount check as a belt-and-braces verification. |
|
|
||||||
| D-16 | `fullCalcOnLoad=true` guarantees a **runtime** recalc when the end user opens the file; it does NOT refresh the build-time `cachedValue` in XML. Build sequence `set B=100 → set E==B+D → fix B=150` leaves `E.cachedValue` stale (board sees "Net Change = 0"). | After all upstream edits are final, re-issue every downstream formula (`officecli set "$FILE" /Sheet/E2 --prop formula==B2+D2`) OR `close` + re-open the file. Gate 8 verifies. |
|
|
||||||
| D-17 | The built-in calc engine does NOT evaluate `SUMPRODUCT` with array-predicate form `SUMPRODUCT((A2:A97=X)*C2:C97*D2:D97)` — cachedValue stays `0`/`null`, Gate 8 rejects. Runtime Excel / WPS compute fine, but board-delivered XLSX with stale cache still ships `0`. | Rewrite as helper column + `SUMIF`: `F2==C2*D2` on source sheet, then `=SUMIF(B:B, "Region X", F:F)`. Or pre-aggregate in Summary sheet and chart from there. |
|
|
||||||
|
|
||||||
### Inherited (pointer only)
|
|
||||||
|
|
||||||
Cross-sheet `!` trap, chart `anchor` / series immutability after create → see officecli-xlsx §Known Issues.
|
|
||||||
-562
@@ -1,562 +0,0 @@
|
|||||||
---
|
|
||||||
name: officecli-docx
|
|
||||||
description: "Use this skill any time a .docx file is involved -- as input, output, or both. This includes: creating Word documents, reports, letters, memos, or proposals; reading, parsing, or extracting text from any .docx file; editing, modifying, or updating existing documents; working with templates, tracked changes, comments, headers/footers, or tables of contents. Trigger whenever the user mentions 'Word doc', 'document', 'report', 'letter', 'memo', or references a .docx filename."
|
|
||||||
---
|
|
||||||
|
|
||||||
# OfficeCLI DOCX Skill
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
If `officecli` is missing:
|
|
||||||
|
|
||||||
- **macOS / Linux**: `curl -fsSL https://d.officecli.ai/install.sh | bash`
|
|
||||||
- **Windows (PowerShell)**: `irm https://d.officecli.ai/install.ps1 | iex`
|
|
||||||
|
|
||||||
Verify with `officecli --version` (open a new terminal if PATH hasn't picked up). If install fails, download a binary from https://github.com/iOfficeAI/OfficeCLI/releases.
|
|
||||||
|
|
||||||
## ⚠️ Help-First Rule
|
|
||||||
|
|
||||||
**This skill teaches what good docx looks like, not every command flag. When a property name, enum value, or alias is uncertain, consult help BEFORE guessing.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli help docx # List all docx elements
|
|
||||||
officecli help docx <element> # Full element schema (e.g. paragraph, field, numbering, watermark, toc)
|
|
||||||
officecli help docx <verb> <element> # Verb-scoped (e.g. add field, set section)
|
|
||||||
officecli help docx <element> --json # Machine-readable schema
|
|
||||||
```
|
|
||||||
|
|
||||||
Help is pinned to the installed CLI version. When this skill and help disagree, **help is authoritative**.
|
|
||||||
|
|
||||||
## Mental Model
|
|
||||||
|
|
||||||
A `.docx` is a ZIP of XML parts (`document.xml`, `styles.xml`, `numbering.xml`, `header*.xml`, `footer*.xml`, `comments.xml`, …). Everything the user sees — headings, tables, page numbers, TOC, tracked changes — is XML inside that ZIP. `officecli` gives you a semantic-path API (`/body/p[1]/r[2]`) over it, so you almost never touch raw XML; when you must, use `raw-set` (see the XML appendix).
|
|
||||||
|
|
||||||
## Shell & Execution Discipline
|
|
||||||
|
|
||||||
docx paths contain `[]`; some prop values contain `$`. Both are shell metacharacters. Escaping happens at three layers — keep them separate.
|
|
||||||
|
|
||||||
1. **Shell.** ALWAYS quote element paths: `"/body/p[1]"`, not `/body/p[1]` (zsh/bash glob `[N]`). Single-quote any value containing `$`: `--prop text='$50M'` — at any length, the whole value inside one pair of single quotes. Unquoted `$50M` is stripped to `M`; mixing `'…$var…'` and `"…$50…"` on one long string is where the `$50` silently vanishes.
|
|
||||||
2. **CLI (`text=`).** The two-char escapes `\n` and `\t` ARE interpreted in `--prop text=` — `\n` becomes a `<w:br/>` soft line break, `\t` a `<w:tab/>` — consistently across docx / pptx / xlsx. Double them (`\\n`) for a literal backslash-n (rarely wanted). This applies to row-level table `c1…cN` shortcuts too (`\n` → `<w:br/>` within the cell).
|
|
||||||
3. **JSON (batch).** A real newline can also be passed as `"\n"` in the JSON string of a `batch` heredoc; same result.
|
|
||||||
|
|
||||||
If in doubt, `view text` after writing and compare character-for-character.
|
|
||||||
|
|
||||||
**Incremental execution.** `officecli` mutates the file on every call. Run commands one at a time and check each exit code — a 50-command script that fails at command 3 cascades silently. After any structural op (new style, table, TOC, section break) run `get` on it before stacking more.
|
|
||||||
|
|
||||||
**Open/save lifecycle:** `officecli open <file>` at the start, `officecli save <file>` at the end to flush to disk — `save` only writes and leaves the resident warm for follow-up edits; reach for `officecli close <file>` only to release the resident on a one-shot handoff. Both are always safe (never error or lose work). For many paragraphs of one style, use `batch` (one pass for the whole array). **Flush only at the non-officecli boundary:** officecli's own reads always see your edits; run `save`/`close` only before a non-officecli program reads the file (python-docx, Word, a renderer, delivery).
|
|
||||||
|
|
||||||
**`$FILE` convention.** All commands use `"$FILE"` — set it once (`FILE="your-doc.docx"`). Never copy a literal `doc.docx` / `review.docx` into output — always substitute your actual target.
|
|
||||||
|
|
||||||
## Requirements for Outputs
|
|
||||||
|
|
||||||
Deliverable standards every document MUST meet — know these before reaching for a command.
|
|
||||||
|
|
||||||
**Clear hierarchy.** Every non-trivial document has Title → Heading 1 → Heading 2 → body, not a wall of unstyled `Normal` paragraphs. If `view outline` shows one flat list, the hierarchy is missing.
|
|
||||||
|
|
||||||
**Explicit heading sizes** (Word default style sizes drift between templates): **H1 ≥ 18pt** (20pt for long reports), H2 = 14pt bold, H3 = 12pt bold, body = 11–12pt, line spacing 1.15–1.5x. Prefer `style=Heading1` over inline sizes so a retheme touches the definition once — but set explicit sizes when you can't trust the template's styles.
|
|
||||||
|
|
||||||
**One body font, one accent.** One readable body font (Calibri, Cambria, Georgia, Times New Roman); accent color for heading emphasis or table headers, not rainbow formatting.
|
|
||||||
|
|
||||||
**Spacing through properties.** Use `spaceBefore` / `spaceAfter` on paragraphs. Rows of empty paragraphs break pagination and are flagged by `view issues`.
|
|
||||||
|
|
||||||
**Typographic quality.** New content uses curly quotes (`'` `'` `"` `"`), not ASCII — Unicode directly or XML entities (`‘`/`’`/`“`/`”`) inside `raw-set`. En-dash `–` for ranges (`2024–2026`), em-dash `—` for parenthetical breaks.
|
|
||||||
|
|
||||||
**Headers, footers, page numbers on any document > 1 page.** Page numbers go through a live `PAGE` field (`--prop field=page`), never the literal text "Page 1" — the CLI injects `<w:fldChar>` for you (see Headers & Footers).
|
|
||||||
|
|
||||||
**Preserve existing templates.** When editing a file that already has a look, match it — existing conventions override these guidelines.
|
|
||||||
|
|
||||||
### Visual delivery floor (applies to EVERY document)
|
|
||||||
|
|
||||||
Before declaring done, run `officecli view "$FILE" html` and Read the returned HTML path to confirm ALL of these:
|
|
||||||
|
|
||||||
- **No placeholder tokens rendered as data.** `$xxx$`, `{var}`, `{{name}}`, `<TODO>`, `lorem`, `xxxx` must never appear in a heading, body, cover, TOC, caption, header, or footer. A literal `{name}` meant for a human to fill belongs inside a visible instruction paragraph ("Replace `{name}` before sending"), never as finished content.
|
|
||||||
- **No truncated titles or overflowing cells.** Widen the column or set `wrapText` rather than trimming content.
|
|
||||||
- **TOC present when the document has 3+ headings** (`--type toc`).
|
|
||||||
- **Cover page ≥ 60% filled, last page ≥ 40% filled.** Pad a thin cover with subtitle / author / date / scope / key highlights; pad a "Thank you" last page with conclusion / next steps / contact / legal.
|
|
||||||
- **No `\$`, `\t`, `\n` literals in document text.** If `view text` shows these, a shell-escape layer leaked — delete the paragraph and re-enter it.
|
|
||||||
|
|
||||||
If any fails, STOP and fix before declaring done.
|
|
||||||
|
|
||||||
## Common Workflow
|
|
||||||
|
|
||||||
Six steps. Every non-trivial build follows this shape.
|
|
||||||
|
|
||||||
1. **Open the file.** `officecli open "$FILE"` (resident default). New file: `officecli create "$FILE"` first.
|
|
||||||
2. **Orient.** Existing file: `officecli view "$FILE" outline` — heading tree, section count, whether a TOC / watermark / tracked changes already exist. Never edit blind.
|
|
||||||
3. **Build incrementally.** Structural first, content next, formatting last: styles & numbering defs → sections / page setup → headings & body → tables / images / fields / TOC → headers / footers → comments. After each structural op, `get` it back before stacking on top.
|
|
||||||
4. **Format to spec.** Explicit heading sizes, spacing, widths, alignment, tabs, list indents — formatting is part of the deliverable, not optional polish.
|
|
||||||
5. **Save, then trust structure over cached text.** `officecli save "$FILE"` writes the XML. TOC / PAGE / NUMPAGES / SEQ / PAGEREF fields carry **cached values** that may be stale or empty until a human recalculates (F9 in Word). Confirm fields *exist* (`get --depth 3` finds `<w:fldChar>`) rather than trusting the visible text.
|
|
||||||
6. **QA — assume there are problems.** You are done after one fix-and-verify cycle finds zero new issues, not when your last command exited 0. See QA.
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
Minimal viable docx: a heading, a body paragraph, a subheading, and a footer with a live page-number field. Adapt, don't copy-paste — your file, your content.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
FILE="review.docx"
|
|
||||||
officecli create "$FILE"
|
|
||||||
officecli open "$FILE"
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Q4 2026 Review" --prop style=Heading1 --prop size=20pt --prop bold=true --prop spaceAfter=12pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Revenue grew 18% year-over-year, ahead of plan." --prop size=11pt --prop spaceAfter=8pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Key Drivers" --prop style=Heading2 --prop size=14pt --prop bold=true --prop spaceBefore=12pt --prop spaceAfter=6pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Enterprise renewals, upsell, and a new EMEA region." --prop size=11pt
|
|
||||||
officecli add "$FILE" / --type footer --prop type=default --prop size=9pt --prop text="Page " --prop field=page
|
|
||||||
officecli set "$FILE" "/footer[1]/p[1]" --prop align=center
|
|
||||||
officecli save "$FILE"
|
|
||||||
officecli validate "$FILE"
|
|
||||||
```
|
|
||||||
|
|
||||||
Verified: `validate` returns `no errors found`; `get /footer[1] --depth 3` shows the 5-run PAGE field chain (begin / instrText / separate / cached value / end).
|
|
||||||
|
|
||||||
## Reading & Analysis
|
|
||||||
|
|
||||||
Start wide, then narrow. `outline` tells you what's already there; jump into `view text` / `get` / `query` once you know where to look.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli view "$FILE" outline # heading tree, section count, table/image counts, watermark, tracked-changes presence — orient here first
|
|
||||||
officecli view "$FILE" html # Read the returned HTML path: first visual check after a batch of edits (hierarchy, empty-para spacing, missing TOC)
|
|
||||||
officecli view "$FILE" text --start 1 --end 80 # text for content QA; paths shown as [/body/p[N]] so you can jump back with get
|
|
||||||
officecli view "$FILE" annotated # values + style/font/size + warnings per run
|
|
||||||
officecli view "$FILE" stats # paragraph counts, font usage, style distribution
|
|
||||||
officecli view "$FILE" issues # empty paras, missing alt text, spacing anomalies
|
|
||||||
```
|
|
||||||
|
|
||||||
`officecli watch "$FILE"` keeps a live preview running for the human user to open at their discretion — agent self-check uses `view html`. Final visual verification is the user opening the `.docx` in Word / WPS / Pages.
|
|
||||||
|
|
||||||
**Inspect one element.** XPath-style semantic paths (1-based). Always quote — shells glob `[N]`. Use `[last()]` (with parens) for the last element; `[last]` errors. Add `--json` for machine output.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli get "$FILE" / # document root: metadata, page setup
|
|
||||||
officecli get "$FILE" "/body/p[1]" # one paragraph
|
|
||||||
officecli get "$FILE" "/body/p[1]/r[1]" # one run (character-level formatting)
|
|
||||||
officecli get "$FILE" "/body/tbl[1]" --depth 3 # table with rows and cells
|
|
||||||
officecli get "$FILE" "/footer[1]" --depth 3 # footer — check for fldChar
|
|
||||||
officecli get "$FILE" "/styles/Heading1" # style definition
|
|
||||||
officecli get "$FILE" /numbering --depth 2 # numbering abstractNum + num bindings
|
|
||||||
```
|
|
||||||
|
|
||||||
**Query across the document.** CSS-like selectors, for systematic checks rather than hand-walking. Operators: `=`, `!=`, `~=` (contains), `>=`, `<=`, `[attr]` (exists). Full reference: `officecli query --help`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli query "$FILE" 'paragraph[style=Heading1]' # all H1s
|
|
||||||
officecli query "$FILE" 'p:contains("quarterly")' # text match
|
|
||||||
officecli query "$FILE" 'p:empty' # empty paragraphs (clutter)
|
|
||||||
officecli query "$FILE" 'image:no-alt' # accessibility gaps
|
|
||||||
officecli query "$FILE" 'paragraph[size>=24pt]' # numeric comparison
|
|
||||||
officecli query "$FILE" 'field[fieldType!=page]' # fields other than PAGE
|
|
||||||
```
|
|
||||||
|
|
||||||
`query --json` wraps results in `.data.results[]` — `jq '.data.results | length'` to count.
|
|
||||||
|
|
||||||
**Large documents.** Navigate by heading with `view outline` and jump with `query`; don't dump the whole body into context.
|
|
||||||
|
|
||||||
## Creating & Editing
|
|
||||||
|
|
||||||
Verbs: `add` (new element), `set` (change a prop), `remove`, `move`, `swap`, `batch`, `raw-set` (last-resort XML). Ninety percent of a build is paragraphs, runs, tables, a couple of images, a TOC, and a footer.
|
|
||||||
|
|
||||||
### Paragraphs, runs, styles
|
|
||||||
|
|
||||||
A paragraph (`p`) is a block; a run (`r`) is a span of consistent character formatting inside it. Set paragraph-level props (style, alignment, spacing, indent) on the `p`; set font / size / color / bold on the `r`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Executive Summary" --prop style=Heading1 --prop size=18pt --prop bold=true --prop spaceAfter=12pt
|
|
||||||
officecli set "$FILE" "/body/p[1]/r[1]" --prop color=1F4E79
|
|
||||||
```
|
|
||||||
|
|
||||||
Use `spaceBefore` / `spaceAfter` for vertical spacing — never chains of empty paragraphs. For left indent use `--prop indent=720` (twips), `firstLineIndent=360` for first line, `hangingIndent=720` for hanging; leading spaces fire `view issues`.
|
|
||||||
|
|
||||||
### Tables
|
|
||||||
|
|
||||||
Tables are `/body/tbl[N]` with rows `tr[N]` and cells `tc[N]`. Add with row/column counts, then fill.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type table --prop rows=4 --prop cols=3 --prop width=100%
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[1]" --prop header=true --prop c1=Quarter --prop c2="Revenue" --prop c3="Growth"
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[1]/tc[1]/p[1]/r[1]" --prop bold=true
|
|
||||||
```
|
|
||||||
|
|
||||||
Row-level `set` supports `height`, `header`, and `c1 / c2 / … / cN` text shortcuts (`cN` generalises to any column count). Cell formatting (bold, fill, color) goes on the cell's paragraph / run — **not** row-level. For per-cell borders, set cell-level `border.*` on the `tc` (`--prop border.bottom="single;6;000000;0"`), or paragraph-level `pbdr.*` on the inner paragraph.
|
|
||||||
|
|
||||||
**Horizontal rule = a paragraph bottom border, never a 1-row table.** A table-as-divider renders as an empty min-height box (worst in headers/footers). Use `pbdr.bottom` (`STYLE;SIZE;COLOR`) on the paragraph instead:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" "/body/p[3]" --prop pbdr.bottom="single;6;2E75B6"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Lists (bullets, numbered, multi-level)
|
|
||||||
|
|
||||||
For single-level bullets/numbers, set `listStyle` on the paragraph (`listStyle` is a paragraph prop, NOT a run prop — common mistake):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="First item" --prop listStyle=bullet
|
|
||||||
```
|
|
||||||
|
|
||||||
For multi-level (legal-style 1 / 1.1 / 1.1.1), add an `abstractNum`, then a `num`, then reference the `numId` per paragraph:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /numbering --type abstractnum --prop format=decimal # → abstractNum id=0
|
|
||||||
officecli add "$FILE" /numbering --type num --prop abstractNumId=0 # → num id=1
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Section one" --prop numId=1 --prop ilvl=0
|
|
||||||
```
|
|
||||||
|
|
||||||
IDs are 0-based: the first `abstractNum` is id=0; the `num` references it via `abstractNumId=0` and is itself assigned id=1. A non-existent `abstractNumId` errors, so check ids after creating. Verify with `officecli query "$FILE" 'paragraph[numId>0]'`. See `help docx abstractnum` / `help docx num` for level and format options.
|
|
||||||
|
|
||||||
### Tab stops (signature lines, leader rows)
|
|
||||||
|
|
||||||
Tab stops are a first-class `tab` child of the paragraph; `pos` accepts `6in`/`6cm`/twips, `val` ∈ `left`/`center`/`right`, `leader` ∈ `none`/`dot`/`hyphen`/`underscore`. See `help docx tab`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" "/body/p[1]" --type tab --prop pos=6in --prop val=right --prop leader=dot
|
|
||||||
```
|
|
||||||
|
|
||||||
**Leader caveat.** `leader=dot` alone emits no dots — the leader renders only when a real `<w:tab/>` character sits in a run between the text and the tab stop. Put one there with `\t` in the text: define the stop (`add tab --prop pos=6in --prop val=right --prop leader=dot`), then `--prop text="Chapter 1\t12"` — the `\t` becomes the `<w:tab/>` and dots fill to the right-aligned page number. (Literal `text="Chapter 1 ......... 12"` also ships, but a real tab stop aligns cleanly.)
|
|
||||||
|
|
||||||
### Fields (PAGE / NUMPAGES / DATE / MERGEFIELD / REF)
|
|
||||||
|
|
||||||
Fields are live values computed at render time. `fieldType` picks the field; `name` supplies the target (merge name or `ref` bookmark); `format` / `instr` add switches.
|
|
||||||
|
|
||||||
| Field | Use | Example |
|
|
||||||
|---|---|---|
|
|
||||||
| `page` | current page number | `--prop field=page` on footer, or `--prop fieldType=page` inline |
|
|
||||||
| `numpages` | total pages | `--prop field=numpages` / `--prop fieldType=numpages` |
|
|
||||||
| `date` | today | `--prop fieldType=date --prop format='yyyy-MM-dd'` |
|
|
||||||
| `mergefield` | template merge token | `--prop fieldType=mergefield --prop name=CustomerName` |
|
|
||||||
| `ref` | cross-reference to a bookmark | `--prop fieldType=ref --prop name=bookmarkName` |
|
|
||||||
|
|
||||||
Full `fieldType` enum (30+ values incl. `pageref`, `seq`, `styleref`, `docproperty`, `createdate`, …) is in `help docx field`. **There is NO `fieldInstr` fieldType** — use the `instruction` prop for raw field instruction text when typed shortcuts fall short. Picture switches (`MERGEFIELD Amount \# "#,##0.00"`, `DATE \@ "yyyy年MM月"`) go via `--prop instruction='…'` (mergefield's `format` prop is ignored with a warning — use `instruction`).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" "/body/p[3]" --type field --prop fieldType=mergefield --prop name=customer_name
|
|
||||||
# Renders «customer_name» — visible placeholder, replaced in Word at mail-merge time.
|
|
||||||
```
|
|
||||||
|
|
||||||
**MERGEFIELD templates: never render placeholder literals.** A `{{customer_name}}` or `$NAME$` shown as body text is a failed template the recipient sees — insert a real MERGEFIELD (above), or confine literal tokens to an obvious instruction paragraph. Confirm with `query 'field[fieldType=mergefield]'`.
|
|
||||||
|
|
||||||
**SEQ / PAGEREF / TOC field values.** officecli doesn't store rendered field values at write time. Recompute by what each path needs:
|
|
||||||
|
|
||||||
- **SEQ numbering** (`Figure 1/2/3`): `officecli set "$FILE" / --prop recalcFields=seq` counts SEQ fields in body document order and writes the cached values (`evaluated` flips true; switches/formats in `help docx document`). Heading-relative `\s` and SEQ in headers/footers defer to Word.
|
|
||||||
- **PAGE / PAGEREF / NUMPAGES / TOC page numbers** need pagination, which officecli has no engine for — `officecli set "$FILE" /settings --prop updateFields=true` defers them to Word on open.
|
|
||||||
|
|
||||||
Use both on a multi-figure document. Academic papers: see the `officecli-academic-paper` skill.
|
|
||||||
|
|
||||||
### Headers & Footers (page numbering)
|
|
||||||
|
|
||||||
Single-command pattern — the CLI injects `<w:fldChar>`, so you never compose the field by hand:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Empty first-page footer — auto-enables differentFirstPage so the cover has no page number
|
|
||||||
officecli add "$FILE" / --type footer --prop type=first --prop text=""
|
|
||||||
# Default footer with live page number
|
|
||||||
officecli add "$FILE" / --type footer --prop type=default --prop align=center --prop size=9pt --prop text="Page " --prop field=page
|
|
||||||
```
|
|
||||||
|
|
||||||
When both exist, the default footer is `/footer[2]`; alone it is `/footer[1]`. **Verify**: `get --depth 3` must show `fldChar` children, not just a run with literal `"Page"` (`view outline` prints "Footer: Page" for both live fields AND static text — don't rely on it). Do NOT `set --prop differentFirstPage=true` — that prop is unsupported (exit 2 with `WARNING: UNSUPPORTED`; the element itself is still created — check `success` in `--json`); adding a first-type footer flips the bit. For composite **Page X of Y**, see recipe (b).
|
|
||||||
|
|
||||||
### Table of Contents
|
|
||||||
|
|
||||||
For any document with 3+ headings, first verify that the requested range has real sources. A TOC source must use a built-in Heading style or a custom paragraph style with `outlineLvl`; bold or large Normal text is not a source. If no eligible source exists, stop and fix the heading structure instead of inserting a TOC that renders "Error! No table of contents entries found."
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Built-in Heading styles are TOC sources.
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Introduction" --prop style=Heading1
|
|
||||||
# Custom paragraph styles need an outline level (0 = Heading 1).
|
|
||||||
officecli add "$FILE" /styles --type style --prop id=ThesisH1 --prop type=paragraph --prop outlineLvl=0
|
|
||||||
# Add the TOC only after its sources exist.
|
|
||||||
officecli add "$FILE" /body --type toc --prop levels="1-3" --prop title="Table of Contents" --prop hyperlinks=true --index 0
|
|
||||||
```
|
|
||||||
|
|
||||||
Page numbers need pagination; OfficeCLI cannot calculate TOC page numbers itself. Set `updateFields=true` so Word recomputes the TOC (and all fields) on open. Without a Word-compatible field engine, report the TOC as dynamic and uncomputed; do not claim ready page numbers or guess a static TOC.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" /settings --prop updateFields=true
|
|
||||||
```
|
|
||||||
|
|
||||||
Address the TOC directly with `/toc[1]` or `/tableofcontents` for `get`/`set`/`remove`.
|
|
||||||
|
|
||||||
### Images
|
|
||||||
|
|
||||||
Pictures go inside a run. Alt text is mandatory for accessibility — pass `alt` directly at create time:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" "/body/p[5]" --type picture --prop src=logo.png --prop width=1.5in --prop alt="Acme logo"
|
|
||||||
```
|
|
||||||
|
|
||||||
Confirm `officecli query "$FILE" 'image:no-alt'` is empty before delivery.
|
|
||||||
|
|
||||||
### Charts
|
|
||||||
|
|
||||||
For data, add a **native chart** — editable, themeable, accessible, re-renders in Word — never a flat PNG screenshot of a chart. `data="Label:v1,v2,…"` per series; one `data=` per series (or `series1=`/`series2=`).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type chart --prop chartType=bar --prop title="Revenue by Region" --prop categories="EMEA,APAC,Americas" --prop data="2026:120,150,180"
|
|
||||||
```
|
|
||||||
|
|
||||||
`chartType` ∈ bar / column / line / pie / area / scatter (`help docx chart` for axis/legend/series styling). A PNG via `--type picture` is only a fallback for an exotic chart officecli can't build.
|
|
||||||
|
|
||||||
### Hyperlinks and bookmarks
|
|
||||||
|
|
||||||
External links go via `hyperlink`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" "/body/p[2]" --type hyperlink --prop url="https://example.com" --prop text="our site"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Internal links** (to a bookmark) use `--prop anchor=bookmarkName` — not a `#fragment` in `url`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" "/body/p[2]" --type hyperlink --prop anchor=chapter1 --prop text="See Chapter 1"
|
|
||||||
```
|
|
||||||
|
|
||||||
Pairing a `PAGEREF` field with visible text is the alternative. See `help docx hyperlink` / `help docx bookmark`.
|
|
||||||
|
|
||||||
### Sections and page setup
|
|
||||||
|
|
||||||
Document root `/` carries page setup (`pageWidth`, `pageHeight`, margins, in twips). Multi-section documents (landscape insert, columns) add a `section` break — see `help docx section`. Both camelCase (`pageWidth`, canonical) and lowercase alias (`pagewidth`) are accepted; prefer camelCase.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" / --prop pageWidth=12240 --prop pageHeight=15840 --prop marginTop=1440 --prop marginLeft=1440
|
|
||||||
# Newspaper-style multi-column flow (columnSpace in twips; 720 = 0.5in):
|
|
||||||
officecli set "$FILE" / --prop columns=2 --prop columnSpace=720
|
|
||||||
```
|
|
||||||
|
|
||||||
### Forcing page breaks
|
|
||||||
|
|
||||||
Use exactly one page-break mechanism per logical boundary. The default is `pageBreakBefore=true` on the target heading. Alternatively, insert one explicit `pagebreak` before the heading. Never combine both mechanisms for the same boundary: the resulting double break can create a blank page. Never set `pageBreakBefore` on `p[last()]` immediately after adding a `pagebreak`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Default: apply the break directly to the heading.
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Introduction" --prop style=Heading1 --prop pageBreakBefore=true
|
|
||||||
```
|
|
||||||
|
|
||||||
`--prop break=newPage` is an alias for `pageBreakBefore=true`. Preview with `view html` and check for blank pages.
|
|
||||||
|
|
||||||
### Report-level recipes
|
|
||||||
|
|
||||||
Patterns that come up on every long-form report. Each has been executed and `validate`-passed.
|
|
||||||
|
|
||||||
**(a) Rich cover page — hit the ≥ 60% filled floor.** Stack a confidentiality banner, title, subtitle, client/project/date block, and a key-themes strip, then force the next section onto a new page:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="CONFIDENTIAL — CLIENT USE ONLY" --prop align=center --prop size=9pt --prop color=C00000 --prop spaceAfter=24pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Strategic Growth Review" --prop style=Title --prop size=32pt --prop bold=true --prop align=center --prop font=Cambria --prop spaceAfter=8pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="FY26 Outlook and Scenario Planning" --prop italic=true --prop size=16pt --prop align=center --prop spaceAfter=36pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text='Prepared for: Acme Corp. Leadership Team' --prop align=center --prop size=11pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text='Engagement: 2026-04 — 2026-06' --prop align=center --prop size=11pt --prop spaceAfter=36pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Key themes: 1) margin resilience, 2) EMEA expansion, 3) capital allocation." --prop align=center --prop italic=true --prop size=10pt
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Executive Summary" --prop style=Heading1 --prop pageBreakBefore=true
|
|
||||||
```
|
|
||||||
|
|
||||||
**(b) Page X of Y footer — composite PAGE + NUMPAGES.** Add the footer paragraph, then three child ops build `Page <X> of <Y>` live. The official `help docx footer` recipe.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" / --type footer --prop type=default --prop text="Page " --prop align=center --prop size=9pt
|
|
||||||
officecli add "$FILE" "/footer[1]/p[1]" --type field --prop fieldType=page
|
|
||||||
officecli add "$FILE" "/footer[1]/p[1]" --type run --prop text=" of "
|
|
||||||
officecli add "$FILE" "/footer[1]/p[1]" --type field --prop fieldType=numpages
|
|
||||||
officecli get "$FILE" "/footer[1]/p[1]" --depth 1 | grep -o fldChar | wc -l # expect ≥ 4; use grep -o ... | wc -l, NOT grep -c (single-line XML returns 1)
|
|
||||||
```
|
|
||||||
|
|
||||||
**(c) Header row with fill and white bold text.** Order matters — populate header cell text FIRST (runs don't exist in empty cells; a `set …/tc[N]/p[1]/r[1]` on an empty cell errors "No r found"), THEN cell fill, THEN run formatting:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type table --prop rows=5 --prop cols=4 --prop width=100%
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[1]" --prop header=true --prop c1=Quarter --prop c2=Revenue --prop c3=Growth --prop c4=Status
|
|
||||||
for col in 1 2 3 4; do
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[1]/tc[$col]" --prop fill=1F4E79
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[1]/tc[$col]/p[1]/r[1]" --prop bold=true --prop color=FFFFFF
|
|
||||||
done
|
|
||||||
for row in 3 5; do for col in 1 2 3 4; do
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[$row]/tc[$col]" --prop fill=D9E2F3 # zebra stripe
|
|
||||||
done; done
|
|
||||||
```
|
|
||||||
|
|
||||||
**(d) Financial table — right-align numbers, bold totals, bottom border on total row.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
for row in 2 3 4 5; do for col in 2 3 4; do
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[$row]/tc[$col]/p[1]" --prop align=right
|
|
||||||
done; done
|
|
||||||
for col in 1 2 3 4; do
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[5]/tc[$col]/p[1]/r[1]" --prop bold=true
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[4]/tc[$col]/p[1]" --prop pbdr.bottom="single;6;000000;0"
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
**(e) Cell with multiple bullets (SWOT / risk matrix).** `c1="a\nb"` gives a `<w:br/>` line break within **one** paragraph — fine for plain multi-line text, but bullets need separate paragraphs. Seed the first via `set c1=`, then `add paragraph` (with `listStyle=bullet`) under the cell per subsequent bullet:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[1]" --prop c1="Installed base of 18k enterprise seats"
|
|
||||||
officecli add "$FILE" "/body/tbl[1]/tr[1]/tc[1]" --type paragraph --prop text="Margin structure above peer median" --prop listStyle=bullet
|
|
||||||
officecli set "$FILE" "/body/tbl[1]/tr[1]/tc[1]/p[1]" --prop listStyle=bullet
|
|
||||||
```
|
|
||||||
|
|
||||||
If the seeded line lands at the bottom, re-order: `officecli move "$FILE" "/body/tbl[1]/tr[1]/tc[1]/p[N]" --index 0`.
|
|
||||||
|
|
||||||
**(f) TOC without a field engine.** A CLI-only pipeline cannot calculate reliable page numbers. Keep the live TOC, set `updateFields=true`, and tell the recipient to open the document in Word or another compatible field engine. Do not replace it with guessed static page numbers.
|
|
||||||
|
|
||||||
### Template delivery — separating Template Notes from end-user content
|
|
||||||
|
|
||||||
HR / legal / vendor templates carry internal-only guidance ("replace `{{CompanyName}}`") that must NOT ship. Two working patterns:
|
|
||||||
|
|
||||||
- **Trailing "Template Notes" section** under a clear `Heading 1` ("Template Notes for HR Users") with all instructions below it; before distribution, `remove` from the heading downward (locate with `query 'paragraph[style=Heading1]:contains("Template Notes")'`).
|
|
||||||
- **Bookmark-bounded internal section** between `__template_notes_start` / `_end` bookmarks; at delivery `raw-set` removes everything between the anchors.
|
|
||||||
|
|
||||||
Delivery gate for templates: after removal, `query 'p:contains("Template Notes")'` AND `query 'p:contains("{{")'` both return empty. If a notes paragraph survives, a downstream employee reads internal language.
|
|
||||||
|
|
||||||
### Advanced / specialty topics (skip if you are writing a report)
|
|
||||||
|
|
||||||
Reports, memos, letters, proposals, and HR templates don't need this. Keep reading only if your document is academic (equations, footnotes, bibliography), reviewed (comments, tracked changes), or marked (watermark).
|
|
||||||
|
|
||||||
**Equations and footnotes.** `--type equation` takes LaTeX — `\frac`, `\sum`, Greek, `\mathit`, `\mathcal` all render. By default it creates a standalone `/body/oMathPara[N]` display block; pass `--prop mode=inline` with a paragraph parent path (`add "/body/p[N]" --type equation --prop formula=… --prop mode=inline`) to drop an inline `<m:oMath>` into running text. Footnotes auto-number by paragraph index. Bibliography hanging indent: `firstLineIndent=-720 indent=720` per entry.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type equation --prop formula="\\frac{a}{b} + \\sum_{i=1}^{n} x_i"
|
|
||||||
officecli add "$FILE" "/body/p[3]" --type footnote --prop text="See Appendix A for methodology."
|
|
||||||
```
|
|
||||||
|
|
||||||
**Comments and tracked changes.** Bulk accept/reject: `set "$FILE" /revision --prop revision.action=accept` (or `--prop revision.action=reject`); narrow with a selector like `/revision[@author=Alice]` or `/revision[@type=ins]`. Locate individual changes with `query ins` and `query del` (`trackedchange` is not a selector). Create tracked changes on a run with `--prop revision.type=ins|del --prop revision.author=…` (`help docx run` for the full `revision.*` set — `format`/`moveFrom`/`moveTo` too). Add a comment: `add "/body/p[4]" --type comment --prop author=… --prop text=…`; reply-thread it with `--prop parentId=N` and mark it resolved with `set "/comments/comment[N]" --prop done=true` (resolve rather than delete to keep the audit trail — `query 'comment[done=false]'` then lists what's still open). Prop schema: `help docx comment` / `help docx run`.
|
|
||||||
|
|
||||||
**Watermark.** `add / --type watermark --prop text="DRAFT" --prop color=BFBFBF --prop opacity=0.8` in one command (default opacity 0.5); `set /watermark --prop opacity=…` adjusts it later.
|
|
||||||
|
|
||||||
**When to switch skills.** Stay in docx for chapter drafts, ≤ 3 footnotes, ≤ 2 equations, no bibliography/cross-refs. Switch to **`academic-paper`** for citation styles (APA / Chicago / IEEE / GB 7714), in-text↔reference auto-linking, numbered equations with `\ref`, "List of Figures", or auto-updating cross-refs. Switch to **`officecli-word-form`** when the document's purpose is **data capture** — fillable forms, contracts with user-fill slots, questionnaires, mail-merge templates (`<w:sdt>` content controls, `<w:ffData>`, `documentProtection=forms`).
|
|
||||||
|
|
||||||
### Raw-set escape hatch (L1 / L2 / L3)
|
|
||||||
|
|
||||||
Three tiers of precision; use the lowest that does the job.
|
|
||||||
|
|
||||||
- **L1 — high-level props** (`--prop text=…`, `--prop style=Heading1`): your default. Covers 80%.
|
|
||||||
- **L2 — dotted-attr fallback** (`pbdr.top=`, `ind.left=`, `shd.fill=`, `padding.top=`, `font.size=`): when L1 lacks the knob. Example: `--prop pbdr.bottom="single;6;1F4E79;0"`. Emits schema-valid XML.
|
|
||||||
- **L3 — `raw-set` with XML**: last resort, no schema protection. Use for internal hyperlinks, composite fields, and other shapes the typed verbs can't express (see XML appendix).
|
|
||||||
|
|
||||||
Borders use the format `style;size;color;space`: `single;4;FF0000;1`. Hex colors never start with `#`: `FF0000`. Scheme color names (`accent1..6`, `dark1`/`dark2`, `light1`/`light2`, `hyperlink`) are accepted anywhere a hex color is — prefer hex for stable colors across themes.
|
|
||||||
|
|
||||||
## QA (Required)
|
|
||||||
|
|
||||||
**Assume there are problems — QA is a bug hunt, not a confirmation step.** Your first document is almost never correct; zero issues on first inspection means you weren't looking hard enough. Headings look fine until `view outline` shows an H3 directly under an H1; the footer shows "Page 1" until `get --depth 3` reveals a static run, not a field.
|
|
||||||
|
|
||||||
### Minimum cycle before "done"
|
|
||||||
|
|
||||||
1. `officecli view "$FILE" issues` — empty paras, missing alt text, formatting anomalies.
|
|
||||||
2. `officecli view "$FILE" outline` — heading hierarchy (no H1 → H3 skips), TOC presence, section count.
|
|
||||||
3. `officecli view "$FILE" text --max-lines 400` — typos, stray `\$`/`\t`/`\n` literals, placeholder tokens.
|
|
||||||
4. `officecli validate "$FILE"` — schema check (the Delivery Gate re-runs this on the closed, on-disk file).
|
|
||||||
5. **Visual pass — whole document as a contact sheet** (vision-capable agents only — if you cannot interpret images, skip this step: steps 1–4 are your ceiling, and flag the document "not visually verified" at handoff). `officecli view "$FILE" screenshot --grid auto -o /tmp/sheet.png`, then Read it. `--grid auto` tiles **every page** into one image (auto column count; `--grid 4` to force) — you *see* pagination, blank pages, heading rhythm, lopsided margins, and TOC/cover placement, not just the DOM. Windows+Word renders each page through real Word; elsewhere HTML. If the screenshot fails, fall back to `view html` and flag cross-page breaks / alignment / rhythm as "not visually verified". Thumbnails only **locate**: confirm any fine call (column alignment, line spacing, indents, dark-on-dark, caption placement) on the suspect page at full resolution with `screenshot --page N` (no `--grid`; real Word on Windows). "validate pass" is not delivery; "looks like a real document" is.
|
|
||||||
6. If anything failed, fix, then **rerun the full cycle** — one fix commonly creates another problem.
|
|
||||||
|
|
||||||
### Delivery Gate (run before handing off — any failure = REJECT, do NOT deliver)
|
|
||||||
|
|
||||||
Copy-paste, set `FILE`, and refuse to declare done until every gate prints OK.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
FILE="your-file.docx"
|
|
||||||
|
|
||||||
# Gate 1 — schema.
|
|
||||||
officecli close "$FILE" 2>/dev/null
|
|
||||||
officecli validate "$FILE" | grep -q "no errors found" || { echo "REJECT Gate 1: validate failed"; exit 1; }
|
|
||||||
echo "Gate 1 OK"
|
|
||||||
|
|
||||||
# Gate 2 — token leak (shell-escape / template tokens / literal \$ \t \n). grep -c never false-PASSes.
|
|
||||||
LEAK=$(officecli view "$FILE" text | grep -cE '(\$[A-Za-z_]+\$|\{\{[^}]+\}\}|<TODO>|xxxx|lorem|\\[\$tn])')
|
|
||||||
[ "$LEAK" -eq 0 ] && echo "Gate 2 OK" || { echo "REJECT Gate 2: $LEAK leak line(s)"; officecli view "$FILE" text | grep -nE '(\$[A-Za-z_]+\$|\{\{[^}]+\}\}|<TODO>|xxxx|lorem|\\[\$tn])'; exit 1; }
|
|
||||||
# A TOC placeholder is valid before a Word-compatible field engine updates it; confirm the TOC field and updateFields setting structurally instead.
|
|
||||||
|
|
||||||
# Gate 3 — live PAGE field exists when a footer is expected.
|
|
||||||
FLD=$(officecli query "$FILE" 'field[fieldType=page]' --json | jq '.data.results | length')
|
|
||||||
[ "$FLD" -ge 1 ] && echo "Gate 3 OK" || { echo "REJECT Gate 3: no live PAGE field"; exit 1; }
|
|
||||||
echo "Delivery Gate PASS"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Field / cached-value spot-check
|
|
||||||
|
|
||||||
Fields carry cached values that may be stale or empty at write time — confirm existence by **structure, not text**.
|
|
||||||
|
|
||||||
- **Footer PAGE:** `get /footer[N] --depth 3` lists the begin / instrText / separate / cached / end run chain — ≥ 5 runs for one PAGE, ≥ 11 for composite "Page X of Y". A single run with text `"Page"` = field missing; re-add with `--prop field=page`.
|
|
||||||
- **TOC:** `get /toc[1] --depth 2` shows field structure. Page numbers may read `1 1 1 1` or `Update field to see…` until recalculated (see §Table of Contents — set `updateFields=true`).
|
|
||||||
- **MERGEFIELD:** `query 'field[fieldType=mergefield]'` — one per slot, no literal `{{name}}` elsewhere.
|
|
||||||
|
|
||||||
### Honest limit
|
|
||||||
|
|
||||||
`validate` catches schema errors, not design errors — a document can pass it with wrong heading hierarchy, fake-Heading-1 sizes, placeholder tokens as body text, or an empty first-page footer on a coverless document. The contact-sheet visual pass (`screenshot --grid`) and the field-structure check are how you catch what validation can't.
|
|
||||||
|
|
||||||
### QA display notes (don't chase these)
|
|
||||||
|
|
||||||
- `view text` shows `"1."` for every numbered list item regardless of rendered number — actual output increments correctly.
|
|
||||||
- `view issues` flags "body paragraph missing first-line indent" on cover paragraphs, centered headings, list items, bibliography entries — first-line indent is only required for APA/academic body text; on block-style professional documents these are expected.
|
|
||||||
|
|
||||||
## Known Issues & Pitfalls
|
|
||||||
|
|
||||||
When something "looks broken", attribute it before chasing: **[AGENT-ERROR]** the document is wrong (fix it) · **[RENDERER-BUG]** the document is correct, a viewer renders it differently (don't chase) · **[SKILL gap]** the skill didn't teach the rule (file an issue).
|
|
||||||
|
|
||||||
### Renderer quirks (cross-viewer, [RENDERER-BUG] — don't chase)
|
|
||||||
|
|
||||||
Before calling a color/field/chart broken, open the file in the user's target viewer; if it looks correct there it's a viewer quirk.
|
|
||||||
|
|
||||||
- **PAGE field may render literal "Page"** (no number) until recalculated — judge by `fldChar` presence, not the digit.
|
|
||||||
- **TOC cached page numbers may read "1 1 1 1"** until F9.
|
|
||||||
- **Pie / doughnut fill may collapse to one color** in some viewers (column/bar render fine).
|
|
||||||
- **Form-control checkboxes may render double-boxed**; **OMML equation baselines** may shift across viewers (XML identical).
|
|
||||||
|
|
||||||
### Common pitfalls
|
|
||||||
|
|
||||||
| Pitfall | Correct approach |
|
|
||||||
|---|---|
|
|
||||||
| `--index` vs `[N]` | `--index` is 0-based; `[N]` paths are 1-based |
|
|
||||||
| Multiple `add --index N` with the same N | Each insert shifts later content down; reusing N puts later items BEFORE earlier ones — insert in reverse order, or `move --after/--before` anchored on `paraId` |
|
|
||||||
| Unquoted `[N]` in zsh/bash | Quote every path: `"/body/p[1]"` |
|
|
||||||
| `[last]` as predicate | Must be `[last()]` with parens |
|
|
||||||
| Raw twips in spacing | Use unit-qualified values: `12pt`, `0.5cm`, `1.5x` |
|
|
||||||
| Empty paragraphs for spacing | Use `spaceBefore` / `spaceAfter` |
|
|
||||||
| Row-level `set` for cell formatting | Row `set` only supports `height`, `header`, `c1..cN` text; format goes on the cell paragraph / run |
|
|
||||||
| `listStyle` on a run | It's a paragraph property |
|
|
||||||
| Indent via leading spaces | `indent=720` / `firstLineIndent=360` / `hangingIndent=720` (dotted `ind.left` / `ind.firstLine` also work) |
|
|
||||||
| Cover page-number suppression via `set differentFirstPage=true` | UNSUPPORTED — add a first-type footer: `--type footer --prop type=first --prop text=""` |
|
|
||||||
| Need a fresh chapter page | Use `pageBreakBefore=true` on the heading; use an explicit `pagebreak` only as an alternative, never both |
|
|
||||||
| Multiple bullet paragraphs in one cell | `c1="a\nb"` makes a `<w:br/>` line break (one paragraph); for separate bullet paragraphs use recipe (e) |
|
|
||||||
| `raw-set` when dotted-attr would work | Prefer L2 dotted-attr over L3 raw-set |
|
|
||||||
| Next paragraph inherits the previous Heading style | Set explicit `--prop style=Normal` on the following paragraph |
|
|
||||||
| Modifying a file open in Word | Close it in Word first |
|
|
||||||
| Echo into batch breaks on `$`/`'` | Heredoc with single-quoted delimiter: `cat <<'EOF' \| officecli batch …` |
|
|
||||||
|
|
||||||
## Raw-set XML appendix (L3 patterns)
|
|
||||||
|
|
||||||
`raw-set` injects literal OOXML — no schema protection. Element order in `<w:pPr>`: `pStyle`, `numPr`, `spacing`, `ind`, `jc`, `rPr` (last). Smart quotes as entities (`‘`/`’`/`“`/`”`). Add `xml:space="preserve"` to any `<w:t>` with leading/trailing spaces. RSIDs are 8-digit hex. Use "Claude" as the author for tracked changes/comments unless the user names another.
|
|
||||||
|
|
||||||
**Tracked-change insertion / deletion** — prefer the high-level `--prop revision.type=ins|del` on a run; raw-set only for what the typed path can't express (rejecting/restoring another author's change, below). Replace the whole `<w:r>…</w:r>`, never inject tags inside a run; copy the original `<w:rPr>` into both to preserve formatting. Inside `<w:del>` use `<w:delText>` (and `<w:delInstrText>` for instructions):
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<w:r><w:t>The term is </w:t></w:r>
|
|
||||||
<w:del w:id="1" w:author="Claude" w:date="2026-01-01T00:00:00Z"><w:r><w:delText>30</w:delText></w:r></w:del>
|
|
||||||
<w:ins w:id="2" w:author="Claude" w:date="2026-01-01T00:00:00Z"><w:r><w:t>60</w:t></w:r></w:ins>
|
|
||||||
<w:r><w:t> days.</w:t></w:r>
|
|
||||||
```
|
|
||||||
|
|
||||||
When deleting ALL content of a paragraph/list item, also mark the paragraph mark deleted (`<w:del/>` inside `<w:pPr><w:rPr>`) — otherwise accepting changes leaves an empty paragraph. To **reject another author's insertion**, nest your `<w:del>` inside their `<w:ins>`; to **restore their deletion**, add a `<w:ins>` after it (don't modify theirs).
|
|
||||||
|
|
||||||
**Internal hyperlink to a bookmark** (prefer the high-level `--prop anchor=` path; raw-set only for custom run styling the command can't express):
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<w:hyperlink w:anchor="chapter1"><w:r><w:rPr><w:rStyle w:val="Hyperlink"/></w:rPr><w:t>See Chapter 1</w:t></w:r></w:hyperlink>
|
|
||||||
```
|
|
||||||
|
|
||||||
**Composite field in one run** (e.g. two fields the single-command path can't compose) — the `fldChar begin / instrText / separate / value / end` chain:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<w:r><w:fldChar w:fldCharType="begin"/></w:r>
|
|
||||||
<w:r><w:instrText xml:space="preserve"> PAGE </w:instrText></w:r>
|
|
||||||
<w:r><w:fldChar w:fldCharType="separate"/></w:r>
|
|
||||||
<w:r><w:t>1</w:t></w:r>
|
|
||||||
<w:r><w:fldChar w:fldCharType="end"/></w:r>
|
|
||||||
```
|
|
||||||
|
|
||||||
**Comment markers** are siblings of `<w:r>`, NEVER inside one (reply threading and resolved-state are high-level — `--prop parentId=`/`done=`, see Comments above):
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<w:commentRangeStart w:id="0"/><w:r><w:t>annotated text</w:t></w:r><w:commentRangeEnd w:id="0"/>
|
|
||||||
<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="0"/></w:r>
|
|
||||||
```
|
|
||||||
|
|
||||||
Force field recalc on open with `officecli set "$FILE" /settings --prop updateFields=true` (writes `<w:updateFields w:val="true"/>`; covers the layout-dependent fields PAGE / PAGEREF / NUMPAGES / TOC page numbers — no raw-set needed). For SEQ numbering, prefer `set / --prop recalcFields=seq`, which writes correct cached values now without waiting on Word.
|
|
||||||
|
|
||||||
### Help pointer
|
|
||||||
|
|
||||||
When in doubt: `officecli help docx`, `officecli help docx <element>`, `officecli help docx <verb> <element>`, `--json` for agents. Help is the authoritative schema; this skill is the decision guide.
|
|
||||||
@@ -1,560 +0,0 @@
|
|||||||
---
|
|
||||||
name: officecli-financial-model
|
|
||||||
description: "Use this skill when the user wants to build a financial model — 3-statement model, DCF valuation, LBO, SaaS unit economics, sensitivity / scenario analysis, debt schedule, or fundraising projections — in Excel. Trigger on: 'financial model', '3-statement model', 'P&L + BS + CF', 'DCF', 'WACC', 'NPV', 'terminal value', 'LBO', 'debt schedule', 'cash sweep', 'MOIC', 'IRR / XIRR', 'sensitivity table', 'scenario analysis', 'ARR model', 'unit economics', 'CAC / LTV', 'cap table forecast'. Output is a single formula-driven .xlsx. This skill is a scene layer on top of officecli-xlsx — it inherits every xlsx v2 rule (4-color code, visual floor, number formats, cache-drift, Known Issues, Delivery Gate minimum cycle). DO NOT invoke for a simple budget tracker, CSV dump, or operational KPI sheet — route those to officecli-xlsx base."
|
|
||||||
---
|
|
||||||
|
|
||||||
# OfficeCLI Financial-Model Skill
|
|
||||||
|
|
||||||
**This skill is a scene layer on top of `officecli-xlsx`.** Every xlsx hard rule — shell quoting, incremental execution, Help-First Rule, visual delivery floor, CFO 4-color code (blue input / black formula / green cross-sheet / yellow-fill assumption), number-format standards (years as text, zero as `-`, `%` one decimal, negatives in parens), assumption-cell discipline, CSV batch import, chart data-feed forms (a/b/c), the 5-gate Delivery cycle, cache-drift guidance, Known Issues (the cross-sheet `!` trap, batch + resident for formulas, renderer caveats) — is **inherited, not re-taught**. This file adds only what a **financial model** requires on top: three-zone architecture, 3 model-type recipes (3-statement / DCF / LBO), sensitivity + scenario protocols, financial-function patterns, circular-reference discipline, and model-specific Delivery Gates 4–6.
|
|
||||||
|
|
||||||
When the xlsx base rules cover it, the text here says `→ see xlsx v2 §X`. Read `skills/officecli-xlsx/SKILL.md` first if you have not.
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
If `officecli` is missing:
|
|
||||||
|
|
||||||
- **macOS / Linux**: `curl -fsSL https://d.officecli.ai/install.sh | bash`
|
|
||||||
- **Windows (PowerShell)**: `irm https://d.officecli.ai/install.ps1 | iex`
|
|
||||||
|
|
||||||
Verify with `officecli --version` (open a new terminal if PATH hasn't picked up). If install fails, download a binary from https://github.com/iOfficeAI/OfficeCLI/releases.
|
|
||||||
|
|
||||||
## Help-First Rule
|
|
||||||
|
|
||||||
This skill teaches what a financial model requires, not every CLI flag. When a prop name / alias / enum is uncertain, consult help BEFORE guessing: `officecli help xlsx [element] [--json]`. Help is authoritative for the installed version — when this skill and help disagree, **help wins**. Every `--prop X=` below was verified against `officecli help xlsx <element>`.
|
|
||||||
|
|
||||||
## Mental Model & Inheritance
|
|
||||||
|
|
||||||
**Inherits xlsx v2.** Read `skills/officecli-xlsx/SKILL.md` first. This skill assumes you know `create` / `open` / `close`, `set` values/formulas, `batch` heredocs for cross-sheet formulas, `/SheetName/A1` paths, named ranges, the 5-gate Delivery cycle, the cross-sheet `!` trap, and that **cross-sheet formulas go non-resident (single batch OR individual `set`), never batch-while-resident**.
|
|
||||||
|
|
||||||
## Shell & Execution Discipline
|
|
||||||
|
|
||||||
Shell quoting, incremental execution, `$FILE` convention → see xlsx v2 §Shell & Execution Discipline. Same rules: quote every `[N]` path, single-quote any prop containing `$` (every number format here — `$#,##0;($#,##0);"-"` — needs single quotes), no hand-written `\$`/`\t`/`\n`, one command at a time. Examples below use `$FILE` (`FILE="model.xlsx"`).
|
|
||||||
|
|
||||||
## Core Principles (identity)
|
|
||||||
|
|
||||||
A financial model is an xlsx with a **decision-grade, formula-driven layer**: every output traces an unbroken chain to blue-font assumptions, every statement balances every period, every valuation is re-auditable. Eight deltas on top of a general xlsx:
|
|
||||||
|
|
||||||
1. **Three-zone architecture mandatory:** Inputs → Calc → Outputs. Collapsing zones → unauditable.
|
|
||||||
2. **Assumptions live in cells, never inside formulas.** `=B5*(1+Assumptions!GrowthRate)`, never `=B5*1.05`.
|
|
||||||
3. **Statements balance every period.** `Assets − Liab − Equity = 0`, `CF.EndingCash = BS.Cash`. Gate 4 fails on `IMBALANCED`.
|
|
||||||
4. **Hardcodes audited.** Calc sheets carry zero hardcoded numbers; Gate 6 counts.
|
|
||||||
5. **Sensitivity / scenario is first-class.** 2-axis grid, dropdown `INDEX/MATCH` switch, or Base/Upside/Downside cols. Excel Data Tables not reliably supported — manual grids only.
|
|
||||||
6. **Cached values on valuation cells load-bearing.** A valuation cell that ships with no cached result (or the `#OCLI_NOTEVAL!` sentinel) sends a blank/wrong number to non-recalculating readers. The evaluator now computes NPV / XNPV / IRR / XIRR; verify the cached value with a readback. Gate 5 spot-checks.
|
|
||||||
7. **Circularity is a design choice.** Legitimate rings (interest ↔ cash, revolver plug ↔ ending cash) use `calc.iterate=true`. Accidental circularity is broken algebra — never papered with `iterate`.
|
|
||||||
8. **Named ranges for ≥ 3-use assumptions.** `WACC`, `TaxRate`, `TerminalGrowth`, `ExitMultiple`, `ChurnRate`. Declared-unused names are dead decoration — Gate 6 flags.
|
|
||||||
|
|
||||||
### Reverse handoff — when to go BACK to xlsx base
|
|
||||||
|
|
||||||
Stay in **xlsx base** for: budget trackers, CSV-to-report dumps, operational KPI sheets, simple templates, cap tables without forecast logic. Use **this skill** only when the ask mentions: 3-statement / DCF / WACC / NPV / TV / LBO / debt schedule / MOIC / IRR / unit economics / ARR roll-forward / sensitivity grid / scenario switch / pro forma.
|
|
||||||
|
|
||||||
## Three-zone architecture (hard rule)
|
|
||||||
|
|
||||||
Every model in this skill builds on three zones. **Name them, tab-color them, and enforce them with executable audits.** Breaking the zone rule is the single most common cause of an unauditable model.
|
|
||||||
|
|
||||||
| Zone | Sheet names (convention) | Tab color | Content | Hardcodes | Formulas |
|
|
||||||
|---|---|---|---|---|---|
|
|
||||||
| **Inputs** | `Assumptions`, `Inputs`, `Drivers` | Yellow `FFC000` | Raw drivers: growth rates, margins, tax, WACC, FTE, pricing, working-capital days | Blue `0000FF` on every cell | Allowed only for derived assumptions (e.g. `=MonthlyARPU*12`) |
|
|
||||||
| **Calc** | `P&L`, `Balance Sheet`, `Cash Flow`, `DCF`, `Debt`, `ARR` | Blue `4472C4` | All derivations and statements | **Zero** (enforced by Gate 6) | Black `000000` for same-sheet, green `008000` for cross-sheet |
|
|
||||||
| **Outputs** | `Summary`, `Dashboard`, `Sensitivity`, `Returns` | Green `70AD47` | KPIs, sensitivity grids, charts, returns waterfall | Only for labels (non-numeric); Gate 6 counts numeric hardcodes → 0 | Black / green per above |
|
|
||||||
|
|
||||||
**Build order is cross-zone-aware.** Assumptions first, then Calc bottom-up on the dependency chain (`IS → BS → CF` for 3-statement; `FCF → WACC → NPV` for DCF), then Outputs last. Building Outputs first caches `0` everywhere and downstream inherits zeros.
|
|
||||||
|
|
||||||
**Executable zone audit** (run before Gate 4):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Calc zone: zero numeric hardcodes allowed. `cell:not(:has(formula))` selects the literal (non-formula) cells; `cell:has(formula)` selects the formula cells.
|
|
||||||
HARDCODE=$(officecli query "$FILE" 'cell[type=Number]' --json | jq '[.data.results[] | select(.format.formula == null) | select(.path | test("/(P&L|Balance Sheet|Cash Flow|DCF|Debt|ARR)/"))] | length')
|
|
||||||
[ "$HARDCODE" -eq 0 ] && echo "Zone audit OK" || { echo "REJECT: $HARDCODE hardcoded numeric cells on Calc sheets — move to Assumptions"; exit 1; }
|
|
||||||
# Assumptions zone: should be non-zero.
|
|
||||||
INPUTS=$(officecli query "$FILE" '/Assumptions/cell[type=Number]' --json | jq '[.data.results[] | select(.format.formula == null)] | length')
|
|
||||||
[ "$INPUTS" -ge 5 ] && echo "Assumptions has $INPUTS hardcoded drivers" || echo "WARN: Assumptions has only $INPUTS inputs"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Print delivery (board / IC / LP)
|
|
||||||
|
|
||||||
When the ask contains "print" / "一页" / "董事会" / "投资人" / "IC memo" / "LP update", the print pipeline must emit **only** the Outputs zone. Two artefacts:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Print_Area scoped to the Outputs sheet (Summary or Dashboard).
|
|
||||||
officecli add "$FILE" / --type namedrange --prop name=_xlnm.Print_Area --prop scope=Summary --prop 'refersTo=Summary!$A$1:$H$40'
|
|
||||||
# 2. Hide every non-Outputs sheet — Print_Area scope alone does NOT stop the print pipeline from emitting every visible sheet.
|
|
||||||
for S in Assumptions 'P&L' 'Balance Sheet' 'Cash Flow' DCF WACC Debt FCF 'S&U' Exit Returns; do
|
|
||||||
officecli raw-set "$FILE" /workbook --xpath "//x:sheet[@name='$S']" --action setattr --xml "state=hidden" || true
|
|
||||||
done
|
|
||||||
# 3. fit-to-page landscape on Outputs sheet.
|
|
||||||
officecli raw-set "$FILE" /Summary --xpath "//x:worksheet" --action prepend --xml '<sheetPr xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><pageSetUpPr fitToPage="1"/></sheetPr>'
|
|
||||||
```
|
|
||||||
|
|
||||||
Delete any `Print_Area` set on Calc sheets — conflicting scopes emit multi-page output with Assumptions / statement sheets leaking.
|
|
||||||
|
|
||||||
## Build-order & cache-drift rule (critical for 3-statement)
|
|
||||||
|
|
||||||
Three facts cause silent wrong numbers: (1) new formulas ship without cached values — Excel recomputes on open, HTML preview / older viewers do not; (2) downstream written in the same sequence as upstream caches `0` from upstream's pre-cache state; (3) cross-sheet `batch` while resident is open deadlocks at 3–5 ops.
|
|
||||||
|
|
||||||
**Discipline (every recipe):**
|
|
||||||
- Build order follows the data chain: `P&L → BS → CF` (3-statement); `FCF → WACC → NPV → Sensitivity` (DCF); `S&U → Debt → P&L → CF → Returns` (LBO).
|
|
||||||
- After the cross-sheet chain, **cache-refresh pass:** re-issue `set` on every summary / valuation / balance-check cell, non-resident.
|
|
||||||
- Spot-check: `officecli get "$FILE" /Summary/B2 --json | jq '.data.results[0].format.cachedValue'` returns a plausible non-null value. `null` means Excel will compute on open (OK for delivery). If a cell shows the `#OCLI_NOTEVAL!` sentinel: close residents, re-set; still unevaluated → cache-fallback (§Financial function patterns).
|
|
||||||
|
|
||||||
## Recipes — three model types
|
|
||||||
|
|
||||||
Each recipe below is **runnable skeleton, not finance theory**. Substitute numbers; don't restructure. All recipes assume `FILE="model.xlsx"` is set and you have run `officecli create "$FILE"` + `officecli open "$FILE"`. Close with `officecli close "$FILE"` at the end.
|
|
||||||
|
|
||||||
### Recipe A — 3-statement model (P&L + BS + CF)
|
|
||||||
|
|
||||||
**What this recipe produces.** 4 sheets: `Assumptions`, `P&L`, `Balance Sheet`, `Cash Flow`, plus `Summary`. Year columns 2024A · 2025E · 2026E · 2027E. Balance-check row on BS; cash-reconciliation row on CF. Every statement row = formula → Assumptions.
|
|
||||||
|
|
||||||
**Build order (MANDATORY).** `Assumptions → P&L → Balance Sheet → Cash Flow → Summary`. Do NOT build BS before P&L — `RetainedEarnings` depends on `NI`. Do NOT build CF before BS — `CF.OpeningCash = prior period CF.EndingCash` self-chain requires BS cash anchored for Y1. The skill's Gate 4 balance check fails silently if order is wrong.
|
|
||||||
|
|
||||||
**Step 1 — sheets + tab colors + freeze panes.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" / --type sheet --prop name=Assumptions --prop tabColor=FFC000
|
|
||||||
officecli add "$FILE" / --type sheet --prop name=P&L --prop tabColor=4472C4
|
|
||||||
officecli add "$FILE" / --type sheet --prop name='Balance Sheet' --prop tabColor=4472C4
|
|
||||||
officecli add "$FILE" / --type sheet --prop name='Cash Flow' --prop tabColor=4472C4
|
|
||||||
officecli add "$FILE" / --type sheet --prop name=Summary --prop tabColor=70AD47
|
|
||||||
officecli set "$FILE" /Assumptions --prop freeze=B2
|
|
||||||
officecli set "$FILE" /P&L --prop freeze=B3
|
|
||||||
officecli set "$FILE" "/Balance Sheet" --prop freeze=B3
|
|
||||||
officecli set "$FILE" "/Cash Flow" --prop freeze=B3
|
|
||||||
```
|
|
||||||
|
|
||||||
**Step 2 — assumptions (blue, yellow-fill on key drivers).** Year headers row 2, labels down col A, blue numeric inputs on B:E. Drivers: `RevenueGrowth`, `GrossMargin`, `OpExRatio`, `TaxRate`, `DaysReceivable/Inventory/Payable`, `CapExRatio`, `DepreciationYears`. `font.color=0000FF` on B:E. Yellow-fill (`fill=FFFF00`) the 3–5 scenario-switched drivers.
|
|
||||||
|
|
||||||
**Declare named ranges for ≥3-use drivers and reference them** (`StartingARR`, `TaxRate`, `OpeningCash`, `GrowthRate`, `GrossMargin`). Formulas: `=StartingARR` not `=Assumptions!B4`; `=EBT*TaxRate` not `=EBT*Assumptions!B8`. Declared-unused names = dead decoration, Gate 6 rejects.
|
|
||||||
|
|
||||||
**Step 3 — P&L rows (all formulas).** Rows: `Revenue` / `COGS` / `Gross Profit` / `OpEx` / `EBITDA` / `D&A` / `EBIT` / `Interest` / `EBT` / `Tax` / `Net Income`. Every row = formula referencing `Assumptions` or prior-row cells. Example revenue-side block — **substitute your row numbers**. Row-map for this example: `B3=Revenue, B4=COGS, B5=Gross Profit, B7=OpEx, B9=EBITDA, B10=EBIT, B15=Net Income`. Submit as single non-resident batch:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"set","path":"/P&L/B3","props":{"formula":"Assumptions!B5","font.color":"008000"}},
|
|
||||||
{"command":"set","path":"/P&L/C3","props":{"formula":"B3*(1+Assumptions!C6)"}},
|
|
||||||
{"command":"set","path":"/P&L/D3","props":{"formula":"C3*(1+Assumptions!D6)"}},
|
|
||||||
{"command":"set","path":"/P&L/E3","props":{"formula":"D3*(1+Assumptions!E6)"}},
|
|
||||||
{"command":"set","path":"/P&L/B4","props":{"formula":"-B3*(1-Assumptions!B7)"}},
|
|
||||||
{"command":"set","path":"/P&L/B5","props":{"formula":"B3+B4"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
Assumptions refs (`B5`, `C6`, `B7`) are also placeholder rows — better: **define named ranges** for each driver (Step 2) so formulas read `=StartingRevenue*(1+RevenueGrowth_Y2)` regardless of row layout. Repeat for `OpEx` / `D&A` / `Interest` / `Tax` / `NI`. `font.color=008000` on every cross-sheet-reference cell; same-sheet cells default `000000`. `numFmt='$#,##0;($#,##0);"-"'` on all $ rows.
|
|
||||||
|
|
||||||
**Step 4 — Balance Sheet rows (all formulas).** Assets = `Cash + AR + Inventory + Net PP&E`. Liab = `AP + Debt`. Equity = `OpeningEquity + RetainedEarnings`. Working-capital rows use Days assumptions: `AR = Revenue × DaysReceivable / 365`. `Net PP&E` rolls forward: `Beg + CapEx − Depreciation`. **`BS.Cash` is NOT an independent plug** — it MUST equal `'Cash Flow'!B<ending-cash-row>` (populated in Step 5).
|
|
||||||
|
|
||||||
**Retained Earnings — live formula every period.** `BS.RE(t) = BS.RE(t-1) + 'P&L'!NI(t) − Dividends(t)`. Hardcoded RE rounds to whole dollar → BS shows ±$1 off every period (CFO reads "model doesn't balance"). For Y1 Historical RE (no prior NI), compute via BS identity as a **live formula**: `BS!RE_Y1 = TotalAssets − TotalLiabilities − PaidInCapital`. Blue-font + classic comment on the Y1 cell; Y2..Y5 stay NI-driven.
|
|
||||||
|
|
||||||
**Step 5 — Cash Flow rows (all formulas).** Operating: `NI + D&A − ΔWorkingCapital`. Investing: `−CapEx`. Financing: `ΔDebt − Dividends`. Ending Cash = `Opening + Operating + Investing + Financing`. **Year 2+ Opening Cash = prior period Ending Cash** — self-chain on the same sheet: `C17 = B19`, `D17 = C19`, `E17 = D19`. The Y1 `OpeningCash` is an Assumptions input.
|
|
||||||
|
|
||||||
**Step 6 — Balance check + cash reconciliation rows (hard delivery checks).** Row-map for this example: `Balance Sheet: B10=Total Assets, B15=Total Liab, B17=Total Equity, B18=Balance Check`; `Cash Flow: B5=BS.Cash (cross-sheet anchor), B19=CF.Ending Cash, B21=CF-BS Cash Recon`. Substitute your layout's rows — the logic is the check, not the cell addresses.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"set","path":"/Balance Sheet/B18","props":{"formula":"IF(ABS(B10-B15-B17)<0.01,\"OK\",\"IMBALANCED: \"&ROUND(B10-B15-B17,0))","bold":"true","font.color":"000000"}},
|
|
||||||
{"command":"set","path":"/Cash Flow/B21","props":{"formula":"IF(ABS(B19-'Balance Sheet'!B5)<0.01,\"OK\",\"CF != BS CASH: \"&ROUND(B19-'Balance Sheet'!B5,0))","bold":"true"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
Replicate across columns C/D/E. Apply red fill (`fill=FFC7CE`) conditionally via `type=containsText --prop text=IMBALANCED` or `text="CF !="`. Gate 4 queries these rows and refuses delivery on any `IMBALANCED`.
|
|
||||||
|
|
||||||
**Step 7 — cache refresh + format pass.** Re-set every summary cell on `Summary`, every balance-check / recon cell, and every cross-sheet reference on BS / CF (non-resident, single batch per sheet). Apply column widths (`col[A]=28`, `col[B:E]=15`), `numberformat='$#,##0;($#,##0);"-"'` on all dollar rows, header fills (`fill=1F3864`, `font.color=FFFFFF`, `bold=true`) on section-header rows (REVENUE / COGS / ASSETS / LIABILITIES). Header fill must cover A:E, not just the label cell (→ xlsx v2 §visual floor).
|
|
||||||
|
|
||||||
**Step 8 — Summary / Dashboard KPIs + charts.** Minimum 4 KPIs: `Revenue 27E`, `EBITDA Margin 27E`, `Ending Cash 27E`, `Net Income CAGR` — each a formula referencing a statement cell, green font.
|
|
||||||
|
|
||||||
**Minimum 3 charts on any Dashboard delivered to a board / executive audience** — one chart is a draft, three is a deliverable. Pre-populate `Summary!A10:E13` with Gross Margin / EBITDA Margin / NI Margin ratio rows (formulas referencing `P&L`) before adding the margin chart.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# (1) Top-line trend (Revenue + EBITDA).
|
|
||||||
officecli add "$FILE" /Summary --type chart --prop chartType=column --prop dataRange='P&L!A2:E5' --prop title='Revenue & EBITDA' --prop width=14cm --prop height=8cm
|
|
||||||
# (2) Margin trend (Gross / EBITDA / NI margin).
|
|
||||||
officecli add "$FILE" /Summary --type chart --prop chartType=line --prop dataRange='Summary!A10:E13' --prop title='Margin trend' --prop width=14cm --prop height=8cm
|
|
||||||
# (3) Cash trajectory (Ending Cash ± Runway).
|
|
||||||
officecli add "$FILE" /Summary --type chart --prop chartType=area --prop dataRange='Cash Flow!A19:E19' --prop title='Ending cash' --prop width=14cm --prop height=8cm
|
|
||||||
```
|
|
||||||
|
|
||||||
**Verification (run all three):**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Balance check every period must say OK (range get → cells under .data.results[0].children[])
|
|
||||||
officecli get "$FILE" "/Balance Sheet/B18:E18" --json | jq '.data.results[0].children[] | .format.cachedValue // .text'
|
|
||||||
# Cash recon every period must say OK
|
|
||||||
officecli get "$FILE" "/Cash Flow/B21:E21" --json | jq '.data.results[0].children[] | .format.cachedValue // .text'
|
|
||||||
# Summary KPIs are plausible numbers, not null
|
|
||||||
officecli get "$FILE" "/Summary/B2:B5" --json | jq '.data.results[0].children[].format.cachedValue'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Recipe B — DCF valuation
|
|
||||||
|
|
||||||
**What this recipe produces.** Sheets: `Assumptions`, `FCF` (10-year forecast), `WACC` (panel), `DCF` (NPV + TV + equity bridge), `Sensitivity` (2-axis grid). Output: `Implied Equity Value` + `Implied Per-Share`, with a `WACC × g` sensitivity.
|
|
||||||
|
|
||||||
**Build order.** `Assumptions → FCF → WACC → DCF → Sensitivity`.
|
|
||||||
|
|
||||||
**Step 1 — named ranges for key drivers.** DCF's readability depends on names. Every formula below uses `WACC`, `TaxRate`, `g` — not `$B$6`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/","type":"namedrange","props":{"name":"WACC","ref":"WACC!$B$12"}},
|
|
||||||
{"command":"add","parent":"/","type":"namedrange","props":{"name":"TaxRate","ref":"Assumptions!$B$8"}},
|
|
||||||
{"command":"add","parent":"/","type":"namedrange","props":{"name":"TerminalGrowth","ref":"Assumptions!$B$15"}},
|
|
||||||
{"command":"add","parent":"/","type":"namedrange","props":{"name":"NetDebt","ref":"Assumptions!$B$20"}},
|
|
||||||
{"command":"add","parent":"/","type":"namedrange","props":{"name":"SharesOut","ref":"Assumptions!$B$21"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
**Step 2 — FCF build (10 years).** Columns B:K = Y1..Y10. Rows: `Revenue` (from growth) / `EBIT` (revenue × margin) / `EBIT × (1 − TaxRate)` (NOPAT) / `+ D&A` / `− CapEx` / `− ΔNWC` / `= FCF`. Use Assumptions-driven ratios (`CapEx = Revenue × CapExRatio`). All cells formulas, black font, `numFmt='$#,##0;($#,##0);"-"'`.
|
|
||||||
|
|
||||||
**Step 3 — WACC panel.** On `WACC` sheet, an 8-row panel: `Risk-free rate` / `Equity risk premium` / `Beta` / `Cost of equity` (=Rf + β×ERP) / `Pre-tax debt cost` / `After-tax debt cost` (=×(1−TaxRate)) / `Equity weight` / `Debt weight` / `WACC` (=We×Re + Wd×Rd_after_tax). Inputs blue; derived rows black.
|
|
||||||
|
|
||||||
**Step 4 — Terminal value + NPV + equity bridge.** Row-map: `DCF: B/C 3=TV, 4=PV explicit FCF, 5=PV terminal, 6=EV, 7=Net Debt, 8=Equity Value, 9=Per-Share`; `FCF: row 2 = periods (1..10), row 11 = FCF, B:K = Y1..Y10`. Substitute your rows. Notes column cells use `{"value":"text"}`, never `{"formula":"..."}` — formula-style prose yields `#NAME?` on open (see callout after Recipe C Step 5). On `DCF` sheet:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"set","path":"/DCF/B3","props":{"value":"Terminal value (Gordon growth)"}},
|
|
||||||
{"command":"set","path":"/DCF/C3","props":{"formula":"FCF!K11*(1+TerminalGrowth)/(WACC-TerminalGrowth)","font.color":"008000","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/DCF/B4","props":{"value":"PV of explicit-period FCF (10 yr)"}},
|
|
||||||
{"command":"set","path":"/DCF/C4","props":{"formula":"SUMPRODUCT(FCF!B11:K11/(1+WACC)^FCF!B2:K2)","font.color":"008000","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/DCF/B5","props":{"value":"PV of terminal value"}},
|
|
||||||
{"command":"set","path":"/DCF/C5","props":{"formula":"C3/(1+WACC)^10","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/DCF/B6","props":{"value":"Enterprise value"}},
|
|
||||||
{"command":"set","path":"/DCF/C6","props":{"formula":"C4+C5","bold":"true","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/DCF/B7","props":{"value":"Less: Net debt"}},
|
|
||||||
{"command":"set","path":"/DCF/C7","props":{"formula":"-NetDebt","font.color":"008000","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/DCF/B8","props":{"value":"Equity value"}},
|
|
||||||
{"command":"set","path":"/DCF/C8","props":{"formula":"C6+C7","bold":"true","font.color":"000000","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/DCF/B9","props":{"value":"Implied per-share"}},
|
|
||||||
{"command":"set","path":"/DCF/C9","props":{"formula":"C8/SharesOut","bold":"true","numberformat":"$0.00"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
**`NPV` vs `SUMPRODUCT` — both cache correctly.** The evaluator computes `NPV(rate, cross_sheet_range)` and caches the right value (verify with a readback). `SUMPRODUCT(values/(1+rate)^periods)` is the algebraic equivalent (period row `FCF!B2:K2 = 1..10` is a one-time setup); it is shown here as an OPTIONAL audit-readability choice — the explicit discounting series is sometimes easier for a reviewer to trace, not a cache workaround. Either form is fine. For irregular dates, `XNPV(rate, values, dates)` likewise caches; the SUMPRODUCT equivalent is `SUMPRODUCT(values/(1+rate)^((dates-base_date)/365))`.
|
|
||||||
|
|
||||||
**Step 5 — 2-axis sensitivity grid (WACC × g).** 5×5 grid. Rows = WACC values `7.5% ... 11.5%`, cols = `g` values `1.5% ... 3.5%`. Each cell = one self-contained formula re-running the DCF with the grid's WACC and g substituted. Template:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Cell D14 (first data cell, grid anchor at C14 = WACC label, C15 = first WACC value)
|
|
||||||
# Substitute $D$13 (this cell's g) and $C15 (this cell's WACC) into a replicated EV + equity formula.
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"set","path":"/Sensitivity/D15","props":{"formula":"(NPV($C15,FCF!$B$11:$K$11)+(FCF!$K$11*(1+D$14)/($C15-D$14))/(1+$C15)^10+(-NetDebt))/SharesOut","numberformat":"$0.00"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
Copy the formula across D15:H19 (5×5 grid). Row 14 carries g values (blue input); column C carries WACC values (blue input). Row 13 and column B carry labels. Apply 3-color gradient CF for quick-read (green = upside, red = downside):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /Sensitivity --type conditionalformatting \
|
|
||||||
--prop type=colorScale --prop ref=D15:H19
|
|
||||||
```
|
|
||||||
|
|
||||||
**No Excel Data Tables.** Excel's native `/Data/Table` 2-variable table is not reliably supported via the CLI — each grid cell MUST be an explicit formula. Copy the template, do not try `Data Table` input cells.
|
|
||||||
|
|
||||||
**Verification.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli get "$FILE" "/DCF/C8" --json | jq '.data.results[0].format.cachedValue' # equity value, plausible $
|
|
||||||
officecli get "$FILE" "/DCF/C9" --json | jq '.data.results[0].format.cachedValue' # per-share, in $XX.XX range
|
|
||||||
officecli get "$FILE" "/Sensitivity/F17" --json | jq '.data.results[0].format.cachedValue' # grid center cell, plausible
|
|
||||||
```
|
|
||||||
|
|
||||||
If `C8` or `C9` come back `null` or show the `#OCLI_NOTEVAL!` sentinel, re-set them (non-resident) — see §Build-order & cache-drift.
|
|
||||||
|
|
||||||
### Recipe C — LBO model
|
|
||||||
|
|
||||||
**What this recipe produces.** Sheets: `Assumptions`, `S&U` (Sources & Uses), `Debt` (multi-tranche schedule), `P&L` (5-yr), `CF`, `Exit` / `Returns`. Outputs: `MOIC`, `IRR`, and a 4-tier returns waterfall. LBO is the stress test — expect circular refs (interest ↔ cash), deepest cross-sheet chains, and the heaviest use of named ranges.
|
|
||||||
|
|
||||||
**Build order.** `Assumptions → S&U → P&L → Debt → CF → Exit → Returns`. P&L before Debt (debt interest depends on P&L EBIT for coverage checks); Debt before CF (CF uses interest + principal amortization). Enable `calc.iterate` before Step 5.
|
|
||||||
|
|
||||||
**Step 1 — Sources & Uses (balance required, every fee line itemized).**
|
|
||||||
|
|
||||||
```
|
|
||||||
Uses = Purchase_EV (EntryEBITDA × EntryMultiple) + Transaction_fees (Purchase_EV × TxnFeePct, typ 1.5–2.5%)
|
|
||||||
+ Financing_fees ((Senior + Mezz) × FinFeePct, typ 1–3%) + Refinanced_debt
|
|
||||||
Sources = Senior_TLB + Mezz + Revolver_drawn + Sponsor_equity
|
|
||||||
```
|
|
||||||
|
|
||||||
**Sponsor equity — pick one, never both.** (a) **Stated:** `Sponsor_equity = Assumptions!SponsorEquity`, then scale senior/mezz so Sources = Uses (fees absorbed by debt, not a silent plug). (b) **Solved:** `Sponsor_equity = Uses − Senior − Mezz − Revolver − Refinanced`, label "Sponsor Equity (solved)", no standalone Assumptions ref. Hardcoded `SponsorEquity` PLUS a `=Uses − Senior − Mezz` plug guarantees silent fee absorption — stated $140M vs plug $194.67M = $54.67M unaccounted fees, CFO rejection on sight.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Sources = Uses hard check.
|
|
||||||
officecli set "$FILE" /S&U/B12 --prop formula='IF(ABS(SUM(B4:B7)-SUM(B9:B11))<1,"BALANCED","S&U IMBALANCE: "&ROUND(SUM(B4:B7)-SUM(B9:B11),0))' --prop bold=true
|
|
||||||
|
|
||||||
# Stated-vs-plug consistency (Gate 4 addendum; only run if you chose pattern (a)).
|
|
||||||
STATED=$(officecli get "$FILE" /Assumptions/B12 --json | jq -r '.data.results[0].format.cachedValue // "null"')
|
|
||||||
PLUGGED=$(officecli get "$FILE" /S&U/B10 --json | jq -r '.data.results[0].format.cachedValue // "null"') # B10 = sponsor-equity row on S&U
|
|
||||||
DELTA=$(python3 -c "print(abs(float('$STATED') - float('$PLUGGED')))" 2>/dev/null || echo 99999)
|
|
||||||
python3 -c "import sys; sys.exit(0 if float('$DELTA') <= 1 else 1)" && echo "S&U sponsor OK (stated=$STATED plug=$PLUGGED)" || { echo "REJECT Gate 4 S&U: stated $STATED ≠ plug $PLUGGED (Δ=$DELTA) — fees silently absorbed"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
Every non-sponsor line on `S&U` is a blue Assumptions input (target EBITDA, entry multiple, fee %s) or a derived formula. No hardcoded Uses / Sources numbers.
|
|
||||||
|
|
||||||
**Step 2 — Debt schedule (multi-tranche).** One row per tranche per year. Columns: `BeginningBalance` / `Mandatory amortization` / `Cash sweep` / `EndingBalance` / `AverageBalance` / `InterestExpense`. Senior TLB: 1% mandatory amortization + all excess cash to sweep. Mezz: 0% amortization, interest-only cash-pay. Row-map for this example (senior TLB tranche, year 2 column C): `C4=Beginning Balance, C5=Mandatory Amort, C6=Ending Balance, C7=Cash Sweep, C8=Average Balance, C9=Interest Expense`. `CF!C20` = free cash available to sweep (year-2 ending cash pre-sweep on CF sheet). Substitute your tranche row block per layout.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# year 2 senior TLB
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"set","path":"/Debt/C4","props":{"formula":"B6"}},
|
|
||||||
{"command":"set","path":"/Debt/C5","props":{"formula":"-C4*Assumptions!$B$30","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/Debt/C6","props":{"formula":"C4+C5+C7","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/Debt/C7","props":{"formula":"-MIN(-CF!C20,C4+C5)"}},
|
|
||||||
{"command":"set","path":"/Debt/C8","props":{"formula":"(C4+C6)/2","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/Debt/C9","props":{"formula":"-C8*Assumptions!$B$31","numberformat":"$#,##0;($#,##0);\"-\""}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
# Add the sweep-rule comment as a classic comment (comment is NOT a cell prop — separate --type comment).
|
|
||||||
officecli add "$FILE" /Debt --type comment --prop ref=C7 --prop text='cash sweep capped at available cash and remaining tranche balance'
|
|
||||||
```
|
|
||||||
|
|
||||||
**Revolver capacity cap.** If your deal uses a revolver tranche, the revolver balance each period is bounded by the commitment ceiling:
|
|
||||||
```
|
|
||||||
Revolver_Balance = MIN(Assumptions!RevolverCapacity, MAX(0, prior_revolver + draw − paydown))
|
|
||||||
```
|
|
||||||
Without the `MIN(capacity, ...)` outer, a shortfall quarter silently over-draws the facility.
|
|
||||||
|
|
||||||
Adjust row indices to your layout. Repeat for each tranche (senior / mezz / revolver) and each year.
|
|
||||||
|
|
||||||
**Step 3 — P&L (5-year) + interest from Debt.** P&L interest row pulls from Debt: `Interest = 'Debt'!TotalInterestRowY<N>`. This creates the **circular reference**: Interest → NI → CF → Cash Sweep → Debt balance → Interest.
|
|
||||||
|
|
||||||
**Write-order warning.** `calc.iterate=true` governs _recalculation_, not write-phase. Appending the closing leg of a cross-sheet ring to a file that already contains the ring deadlocks the engine at 100% CPU regardless of `iterate`. For complex rings (multi-tranche LBO, revolver + TLB + mezz), use §Write-order surgery below (de-ring → write downstream → re-ring). Enable `calc.iterate=true` BEFORE writing ring formulas:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" / --prop calc.iterate=true --prop calc.iterateCount=100 --prop calc.iterateDelta=0.001
|
|
||||||
```
|
|
||||||
|
|
||||||
`iterate` converges via successive approximation for naturally-dampening loops (higher interest → less cash → less sweep → higher balance, bounded by EBIT). `#REF!` or divergent values = pause; fix algebra, do not raise `iterateCount` to 1000.
|
|
||||||
|
|
||||||
**Step 4 — CF + cash sweep.** Ending cash = Opening + CFO − CapEx − Mandatory amort − Cash sweep. Cash sweep = `MIN(freeCashAfterCapEx, seniorDebtBalance + seniorMandatoryAmort)`. The `MIN` cap prevents swept-below-zero.
|
|
||||||
|
|
||||||
**Step 5 — Exit + Returns.** Row-map: `Exit: B3=Exit EV, B4=Less: remaining debt, B5=Exit equity to sponsor`; `Returns: B3=MOIC, B4=IRR`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Values/formulas — single non-resident batch.
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"set","path":"/Exit/B3","props":{"formula":"'P&L'!F8*Assumptions!$B$25","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/Exit/B4","props":{"formula":"-('Debt'!F6+'Debt'!F13)","font.color":"008000","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/Exit/B5","props":{"formula":"B3+B4","bold":"true","numberformat":"$#,##0;($#,##0);\"-\""}},
|
|
||||||
{"command":"set","path":"/Returns/B3","props":{"formula":"'Exit'!B5/('S&U'!B9)","numberformat":"0.00\"x\""}},
|
|
||||||
{"command":"set","path":"/Returns/B4","props":{"formula":"IRR({-'S&U'!B9,0,0,0,0,'Exit'!B5})","numberformat":"0.0%"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
# Classic comments — one --type comment per anchor cell.
|
|
||||||
officecli add "$FILE" /Exit --type comment --prop ref=B3 --prop text='Exit EV = Y5 EBITDA × exit multiple'
|
|
||||||
officecli add "$FILE" /Returns --type comment --prop ref=B3 --prop text='MOIC = exit equity / sponsor equity'
|
|
||||||
officecli add "$FILE" /Returns --type comment --prop ref=B4 --prop text='IRR — 5-yr, entry + exit only; use XIRR for mid-year dividends'
|
|
||||||
```
|
|
||||||
|
|
||||||
**Callout — labels: `comment` element vs Notes column vs `formula` (three distinct mechanics).**
|
|
||||||
- **Hover tooltip** → `officecli add ... --type comment --prop ref=<cell> --prop text='...'`. The **`comment` key is NOT a valid prop on `set cell`** (not in `officecli help xlsx cell`) — it silently drops when embedded inside a `set cell` props dict. Use the dedicated element.
|
|
||||||
- **Visible text in an adjacent Notes column** → `{"command":"set","path":"/DCF/D3","props":{"value":"TV = FCF × (1+g) / (WACC−g)"}}` — **`value`, not `formula`**, plain quoted string.
|
|
||||||
- **Formula-style prose written as a real formula** → NEVER. `{"formula":"FCF10*(1+g)/(WACC-g)"}` produces `#NAME?` in Excel (`FCF10`, `g`, `WACC` are unbound identifiers in that cell context).
|
|
||||||
|
|
||||||
For mid-year dividends or partial exits, use `XIRR({cashflows}, {dates})` instead of `IRR`.
|
|
||||||
|
|
||||||
**Step 6 — Returns waterfall (optional, 4-tier LP/GP).** Tiers: (1) LP preferred return 8% ; (2) GP catch-up to 20% ; (3) 80/20 split above hurdle ; (4) 100% to LP on loss. Each tier is a `MAX(0, MIN(...))` clamp. See §Sensitivity & scenarios for the general grid pattern.
|
|
||||||
|
|
||||||
**Verification.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli get "$FILE" /S&U/B12 --json | jq '.data.results[0].format.cachedValue // .data.results[0].text' # must say BALANCED
|
|
||||||
officecli get "$FILE" /Returns/B3 --json | jq '.data.results[0].format.cachedValue' # MOIC, expect 2.0x-4.0x typical
|
|
||||||
officecli get "$FILE" /Returns/B4 --json | jq '.data.results[0].format.cachedValue' # IRR, expect 0.15-0.30 typical
|
|
||||||
# Iterate converged?
|
|
||||||
officecli query "$FILE" 'cell:contains("#REF!")' --json | jq '.data.results | length' # must be 0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Sensitivity & scenarios
|
|
||||||
|
|
||||||
**Three patterns, pick one:**
|
|
||||||
- **(a) Base / Upside / Downside columns** on Assumptions — side-by-side scenarios, dropdown-less switch via an "Active" column + `INDEX/MATCH`.
|
|
||||||
- **(b) Dropdown + `INDEX/MATCH` switch** — one validation dropdown on Summary drives every driver via `INDEX(Base:Downside, MATCH(Dropdown, ScenLabels, 0))`.
|
|
||||||
- **(c) 2-axis sensitivity grid** — 5×5 or 7×7, one self-contained formula per cell, row/col headers are the two drivers. See Recipe B Step 5 for WACC × g.
|
|
||||||
|
|
||||||
Mixing (a)+(b) creates circular input (scenario picked by dropdown AND overwritten by Active column) — pick one.
|
|
||||||
|
|
||||||
**Grid rule:** each cell substitutes row-driver and col-driver into a self-contained copy of the output formula. Cannot reference the `WACC` named range (that's the panel) — reference the grid's axis cell.
|
|
||||||
|
|
||||||
**Dropdown scenario switch.** One `validation` dropdown on Summary drives every `Assumptions` row:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/Summary","type":"validation","props":{"sqref":"B1","type":"list","formula1":"Base,Upside,Downside"}},
|
|
||||||
{"command":"set","path":"/Assumptions/B5","props":{"formula":"INDEX(C5:E5,MATCH(Summary!$B$1,$C$4:$E$4,0))"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
# If you want a hover tooltip on B5, add it separately:
|
|
||||||
officecli add "$FILE" /Assumptions --type comment --prop ref=B5 --prop text='Revenue growth — picked by Summary!B1 scenario dropdown'
|
|
||||||
```
|
|
||||||
|
|
||||||
Every `Assumptions` driver row gets the same `INDEX/MATCH`. Base / Upside / Downside columns on C:E stay blue (hardcoded scenario inputs).
|
|
||||||
|
|
||||||
**Football-field chart pattern (DCF valuation summary).** Horizontal Low→High bars for 3–5 valuation methods (DCF base, DCF bear, Trading comps, Precedent txns, LBO floor) stacked vertically. On a `Football` sheet: col A = method label, col B = Low $, col C = High $, col D = `=C−B` (width). Chart as a stacked bar with column B as an invisible first series (white/no-fill) and column D as the visible series — `dataRange=Football!A3:D7`, `chartType=bar`. Excel reads this as a floating bar per method.
|
|
||||||
|
|
||||||
## Financial function patterns
|
|
||||||
|
|
||||||
Terse reference — not a finance textbook. If you don't know what these do, pause and ask the user.
|
|
||||||
|
|
||||||
| Function | Prefer over | Why |
|
|
||||||
|---|---|---|
|
|
||||||
| `XNPV(rate, values, dates)` | `NPV` | Irregular cash flow dates (M&A close mid-year, staggered tranches) |
|
|
||||||
| `XIRR(values, dates)` | `IRR` | Irregular dates; multiple sign changes handled better |
|
|
||||||
| `INDEX(range, MATCH(lookup, key, 0))` | `VLOOKUP` | Insert-safe (VLOOKUP breaks when a column is inserted in the source range) |
|
|
||||||
| `IFERROR(x/y, 0)` or `IF(y=0, 0, x/y)` | bare division | Guard every `/` in a financial model — `#DIV/0!` shipped = delivery failure |
|
|
||||||
| `MIRR(values, financeRate, reinvestRate)` | `IRR` with sign flips | When cash-flow pattern has 2+ sign changes |
|
|
||||||
| `SUMIFS(sumRange, criteriaRange1, criterion1, ...)` | `SUMPRODUCT((...))` array | Clearer intent for conditional sums; either evaluates correctly |
|
|
||||||
|
|
||||||
**Evaluator coverage — verify, don't preemptively hardcode.** The CLI evaluator computes the finance functions this skill uses — `NPV` / `XNPV` / `IRR` / `XIRR`, array-literal formulas (`IRR({...})`), and `SUMPRODUCT(1/COUNTIF(range,range))` distinct-count — and caches the correct value with `evaluated:true`. There is no `NPV→0` rewrite obligation and no distinct-count `1/N` trap. The honest rule: build the formula you mean, then verify the cached value with a readback (`get ... --json | jq '.data.results[0].format.cachedValue'`). Only if a specific cell genuinely comes back with the `#OCLI_NOTEVAL!` sentinel (formula written before its inputs, or an unsupported function) should you fall back — first re-set non-resident after `close`; if it still won't evaluate, hardcode the computed value with a blue font and a classic comment via `officecli add "$FILE" /Sheet --type comment --prop ref=<cell> --prop text='cached valuation; refreshes on open in Excel — do not edit'`, and disclose in delivery notes.
|
|
||||||
|
|
||||||
## Circular references & iterative calc
|
|
||||||
|
|
||||||
**Enable `calc.iterate` ONLY when circularity is algebraically justified:** Interest ↔ Cash (LBO revolver / cash sweep), Tax shield ↔ NI (rare — most 3-statement models compute interest before tax and avoid), Revolver plug ↔ Ending cash (corporate cash waterfall with min-cash).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" / --prop calc.iterate=true --prop calc.iterateCount=100 --prop calc.iterateDelta=0.001
|
|
||||||
```
|
|
||||||
|
|
||||||
`iterateCount=100` / `iterateDelta=0.001` are Excel defaults, fine for naturally dampening loops.
|
|
||||||
|
|
||||||
### Write-order surgery (de-ring → write downstream → re-ring)
|
|
||||||
|
|
||||||
`calc.iterate` controls recalc, not write-phase. Appending the closing leg of an already-wired cross-sheet ring (Debt.Interest ↔ CF.Cash ↔ Debt.CashSweep) deadlocks at 100% CPU; `view html` / `get` also hang on a non-converged ring.
|
|
||||||
|
|
||||||
**3-step playbook:**
|
|
||||||
1. **De-ring** — write Debt with the 10–20 ring cells set to literal `0` (e.g. `C7=0`, not `=-MIN(...)`). Removes the ring.
|
|
||||||
2. **Write downstream** — build all non-circular chains (P&L, CF, Exit, Returns, Summary, grid) non-resident, one heredoc per sheet. Everything caches against the zeroed cells.
|
|
||||||
3. **Re-ring** — close all residents, re-set each circular cell with its real formula, one `set` per cell, non-resident.
|
|
||||||
|
|
||||||
**Acceptance.** `get /Debt/C7 --json | jq '.data.results[0].format.cachedValue'` returns non-zero non-null. If a cell still deadlocks, leave `=0` + classic comment `"circular; recalculates in Excel on F9"`, flag at delivery. Never paper over with `iterateCount=1000`.
|
|
||||||
|
|
||||||
**Do NOT use `iterate` as a band-aid for `#REF!` / divergent values.** Raising `iterateCount` to 1000 hides the bug and ships a plausibly-wrong value; `validate` does not catch it. Break the loop algebraically (e.g. interest on opening balance only, not average).
|
|
||||||
|
|
||||||
**Verify convergence.** Read the loop cell, bump a driving assumption and back, re-read — values must match:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
V1=$(officecli get "$FILE" /Debt/C9 --json | jq '.data.results[0].format.cachedValue')
|
|
||||||
officecli set "$FILE" /Assumptions/B31 --prop value=0.085
|
|
||||||
officecli set "$FILE" /Assumptions/B31 --prop value=0.0845
|
|
||||||
V2=$(officecli get "$FILE" /Debt/C9 --json | jq '.data.results[0].format.cachedValue')
|
|
||||||
[ "$V1" = "$V2" ] && echo "Iterate converged" || echo "WARN: drift V1=$V1 V2=$V2 — tighten iterateDelta or check algebra"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Audit & Delivery Gate
|
|
||||||
|
|
||||||
**Assume there are problems.** First build is almost never correct. Run every gate below; every check must print its success line. `validate` passing is not delivery — the model can pass schema and still be wrong by a factor of 10.
|
|
||||||
|
|
||||||
### Gates 1–3 — inherited from xlsx v2 verbatim
|
|
||||||
|
|
||||||
→ see xlsx v2 §QA minimum cycle (Gates 1–3 cover `view issues`, error-cell query, `validate` after close). Run them first, exactly as written in xlsx v2. No financial-model-specific tweaks.
|
|
||||||
|
|
||||||
### Gate 4 — statement integrity (3-statement & LBO)
|
|
||||||
|
|
||||||
Balance-check and cash-reconciliation rows produced by Recipe A / C must show `OK` / `BALANCED` every period. `query` the check rows and refuse on any `IMBALANCED` / `CF !=`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
BS_FAIL=$(officecli query "$FILE" 'cell:contains("IMBALANCED")' --json | jq '.data.results | length')
|
|
||||||
CF_FAIL=$(officecli query "$FILE" 'cell:contains("CF !=")' --json | jq '.data.results | length')
|
|
||||||
SU_FAIL=$(officecli query "$FILE" 'cell:contains("S&U IMBALANCE")' --json | jq '.data.results | length')
|
|
||||||
if [ "$BS_FAIL" -eq 0 ] && [ "$CF_FAIL" -eq 0 ] && [ "$SU_FAIL" -eq 0 ]; then
|
|
||||||
echo "Gate 4 OK (balance + recon + S&U all pass)"
|
|
||||||
else
|
|
||||||
echo "REJECT Gate 4: BS=$BS_FAIL CF=$CF_FAIL S&U=$SU_FAIL"; exit 1
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
If any fail, the model is silently wrong — fix the upstream chain before delivery. Most common cause: a cross-sheet formula stored `\!` (shell-mangled) — run `officecli query "$FILE" 'cell:contains("\\\\!")'` and re-enter via batch heredoc.
|
|
||||||
|
|
||||||
### Gate 5 — cached-value sanity on valuation cells
|
|
||||||
|
|
||||||
NPV / IRR / XIRR / equity-bridge / MOIC / summary KPI cells that ship unevaluated (`#OCLI_NOTEVAL!` sentinel, typically because the formula was written before its inputs) send a blank/wrong number to a reader who does not recalc on open. List every valuation cell and confirm a cached value is present:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Customize the path list per recipe — this is the DCF example
|
|
||||||
for P in "/DCF/C4" "/DCF/C5" "/DCF/C6" "/DCF/C8" "/DCF/C9"; do
|
|
||||||
V=$(officecli get "$FILE" "$P" --json | jq -r '.data.results[0].format.cachedValue // "null"')
|
|
||||||
if [ "$V" = "null" ] || [ "${V#\#OCLI_NOTEVAL}" != "$V" ]; then
|
|
||||||
echo "REJECT Gate 5: $P unevaluated (cached=$V) — re-set after close (see §Build-order & cache-drift)"; exit 1
|
|
||||||
fi
|
|
||||||
echo "Gate 5 $P: cached=$V OK"
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
For LBO, extend the list: `/Exit/B5`, `/Returns/B3`, `/Returns/B4`. For 3-statement, extend with `/Summary/B2:B5`.
|
|
||||||
|
|
||||||
### Gate 6 — hardcode / zone discipline
|
|
||||||
|
|
||||||
Every Calc sheet has zero numeric hardcodes. Executable:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# `cell:not(:has(formula))` selects the literal cells (and `cell:has(formula)` the formula cells).
|
|
||||||
HARDCODE=$(officecli query "$FILE" 'cell[type=Number]' --json \
|
|
||||||
| jq '[.data.results[] | select(.format.formula == null) | select(.path | test("/(P&L|Balance Sheet|Cash Flow|DCF|Debt|FCF|WACC|Exit|Returns)/"))] | length')
|
|
||||||
[ "$HARDCODE" -eq 0 ] && echo "Gate 6 OK (no hardcodes on Calc sheets)" || { echo "REJECT Gate 6: $HARDCODE hardcoded numeric cells on Calc zone — move to Assumptions"; exit 1; }
|
|
||||||
|
|
||||||
# Named-range coverage + dead-decoration audit: ≥3 ranges declared AND each referenced by ≥1 formula.
|
|
||||||
NR=$(officecli query "$FILE" namedrange --json | jq '.data.results | length')
|
|
||||||
[ "$NR" -ge 3 ] && echo "Gate 6 OK ($NR named ranges)" || echo "WARN Gate 6: only $NR named ranges"
|
|
||||||
DEAD=0
|
|
||||||
for NR_NAME in $(officecli query "$FILE" namedrange --json | jq -r '.data.results[].format.name'); do
|
|
||||||
# Match the formula SOURCE (`formula~=`), not the cached/displayed RESULT — `:contains` would scan
|
|
||||||
# the computed value and report every name as dead (false reject).
|
|
||||||
USES=$(officecli query "$FILE" "cell[formula~=$NR_NAME]" --json | jq '.data.results | length')
|
|
||||||
[ "$USES" -ge 1 ] && echo " $NR_NAME: $USES uses OK" || { echo " WARN: $NR_NAME unused"; DEAD=$((DEAD+1)); }
|
|
||||||
done
|
|
||||||
[ "$DEAD" -eq 0 ] && echo "Gate 6 named-range audit OK" || { echo "REJECT Gate 6: $DEAD dead-decoration name(s)"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
### Gate 5b — visual audit via HTML preview (mandatory)
|
|
||||||
|
|
||||||
Gates 1–4/6 are grep defenses — they cannot see a rendered sheet. Run `officecli view "$FILE" html` and Read the returned HTML. Walk every sheet (inherits xlsx v2 visual floor):
|
|
||||||
|
|
||||||
- No `###` in any numeric cell (widen column).
|
|
||||||
- No truncated labels / section headers (widen column or `alignment.wrapText=true`).
|
|
||||||
- No placeholder tokens (`TBD`, `{var}`, `xxxx`) — Gate 6.1 grep below.
|
|
||||||
- Balance-check / recon rows say `OK` / `BALANCED` every period column.
|
|
||||||
- Dashboard charts render, y-axis = 0 on ARR/revenue lines, source data matches statement sheet.
|
|
||||||
- Sensitivity grid colors read green (upside) → red (downside) — color-scale CF applied.
|
|
||||||
- No stale cached `0` on summary KPIs; if present, run cache-refresh pass.
|
|
||||||
|
|
||||||
REJECT on any defect. **Human preview:** `officecli watch "$FILE"`, or open in Excel / WPS / Numbers — final colors + chart fidelity only fully render in the target viewer.
|
|
||||||
|
|
||||||
### Gate 6.1 — token / placeholder sweep
|
|
||||||
|
|
||||||
```bash
|
|
||||||
LEAK=$(officecli view "$FILE" text | grep -niE 'TBD|\(fill in\)|xxxx|lorem|\{\{|placeholder|coming soon')
|
|
||||||
[ -z "$LEAK" ] && echo "Gate 6.1 OK (no placeholder tokens)" || { echo "REJECT Gate 6.1:"; echo "$LEAK"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
### Honest limit
|
|
||||||
|
|
||||||
`validate` catches schema errors, not finance errors. A model passes `validate` with `BS.Cash` hardcoded to force balance, an `NPV` cached at `0`, a sensitivity grid all-zero because it was built before FCF, a `#NAME?` runtime on a `P&L`-named sheet with unquoted refs. Gates 4 / 5 / 6 / 5b exist because schema-level `validate` cannot catch any of this.
|
|
||||||
|
|
||||||
## Known Issues & Pitfalls
|
|
||||||
|
|
||||||
→ Base pitfalls (cross-sheet `!` trap, batch JSON dotted-name rule, renderer caveats): see xlsx v2 §Known Issues & Pitfalls — all apply.
|
|
||||||
|
|
||||||
Financial-model-specific:
|
|
||||||
|
|
||||||
- **AP sign on COGS.** Accounts Payable: if COGS is stored negative on the P&L, AP formula must negate — `=-COGS*DaysPayable/365`. Wrong sign inflates NWC and flips CF direction. Silent; passes `validate`.
|
|
||||||
- **`#NAME?` not caught by `query` / `validate`.** A cross-sheet formula referencing `P&L!B3` without quoting the sheet name (because `&` is special) lands at runtime as `#NAME?`. Always write cross-sheet refs as `'P&L'!B3` — single-quote the sheet name if it contains `&`, space, `(`, `)`, etc. Gate 5b visual check is the only detection.
|
|
||||||
- **Iterative calc silent non-convergence.** `calc.iterate=true iterateCount=100` converges at whatever the cap lands on — even if the true answer is 2× that. Always run convergence verify (§Circular references). Complex LBO rings (multi-tranche debt + sweep + tax shield) may not converge; when `cachedValue=0` on a ring cell, use §Write-order surgery.
|
|
||||||
- **Batch-while-resident deadlock on circular writes.** Writing the closing leg of a cross-sheet ring via `batch` with a resident open deadlocks at 100% CPU. Even single `set` on a ring cell can hang. Fix: close residents, write the ring in two passes per §Write-order surgery. Non-resident single-heredoc is the only safe form.
|
|
||||||
- **Cross-sheet cached value stale in `view html`.** Downstream written in the same sequence as upstream caches `0`. Excel resolves on open; HTML preview does NOT. Re-set every downstream non-resident after the chain (§Build-order & cache-drift).
|
|
||||||
- **`NPV()` / `XNPV()` evaluate and cache correctly.** The evaluator computes both (same-sheet and cross-sheet); no rewrite is required. `SUMPRODUCT(values/(1+rate)^periods)` remains an optional audit-readability alternative, not a cache workaround.
|
|
||||||
- **Sensitivity-grid build order still matters.** A grid cell written before its FCF/WACC inputs exist evaluates against empty inputs and may cache a wrong/blank value. Build FCF + WACC + DCF first, then the grid in a separate non-resident batch, and verify (`jq '.data.results[0].format.cachedValue'`). This is an ordering discipline, not an evaluator limitation.
|
|
||||||
- **`BS.Cash` = CF ending cash always** (including Y1: `BS.Cash = 'Cash Flow'!B19`). Never an independent plug or Assumptions ref — a plugged `BS.Cash` hides balance errors.
|
|
||||||
- **Year 2+ `Opening Cash` = prior period `Ending Cash`** (`C17=B19`, `D17=C19`). Independent Y2+ opening-cash inputs silently drift from BS.
|
|
||||||
- **Waterfall chart "total" bars.** `chartType=waterfall` cannot mark total programmatically — use `colors=` convention (dark = total, medium = positive, red = negative). See `help xlsx chart`.
|
|
||||||
- **DCF per-share when `SharesOut` is a formula.** `=BasicShares + OptionPool × ExerciseAssumption` → add a blue-font assumption cell and point the `SharesOut` named range at the computed cell, not the raw input.
|
|
||||||
|
|
||||||
## Help pointer
|
|
||||||
|
|
||||||
When in doubt: `officecli help xlsx [element] [--json]`. Help is the authoritative schema; this skill is the decision guide for financial-modeling deltas.
|
|
||||||
@@ -1,810 +0,0 @@
|
|||||||
---
|
|
||||||
name: officecli-pitch-deck
|
|
||||||
description: "Use this skill when the user is building a fundraising / investor pitch deck — seed, Series A / B / C, convertible note, SAFE round, strategic raise. Trigger on: 'pitch deck', 'investor deck', 'Series A deck', 'Series B deck', 'Series C deck', 'fundraising deck', 'seed pitch', 'VC deck', 'raising capital', 'term sheet presentation'. Output is a single .pptx. This skill is a scene layer on top of officecli-pptx — inherits every pptx v2 rule (visual floor, grid, palettes, connector canon, Delivery Gate). DO NOT invoke for a generic board review, sales deck, all-hands, or product launch — route those to officecli-pptx base."
|
|
||||||
---
|
|
||||||
|
|
||||||
# OfficeCLI Pitch Deck Skill
|
|
||||||
|
|
||||||
**This skill is a scene layer on top of `officecli-pptx`.** Every pptx hard rule — visual delivery floor (title ≥ 36pt / body ≥ 18pt / title ≥ 2× body), 12-column grid on 33.87×19.05cm, 4 canonical palettes, chart-choice decision table, connector canon (`shape` / `from` / `to` / `tailEnd=triangle`), shell escape, resident + batch, Delivery Gate 1–5a — is inherited, not re-taught. This file adds only what **fundraising** needs on top: stage diagnosis (A / B / C), 5 赛道 arc templates, 10 key-slide recipes (cover / problem / solution / market / product / model / traction / team / financials / ask), pitch-specific numbers convention, a VC ship-check, and a pitch-specific fresh-eyes Gate 6.
|
|
||||||
|
|
||||||
When the pptx base rules cover it, the text here says `→ see pptx v2 §X`. Read `skills/officecli-pptx/SKILL.md` first if you have not.
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
If `officecli` is missing:
|
|
||||||
|
|
||||||
- **macOS / Linux**: `curl -fsSL https://d.officecli.ai/install.sh | bash`
|
|
||||||
- **Windows (PowerShell)**: `irm https://d.officecli.ai/install.ps1 | iex`
|
|
||||||
|
|
||||||
Verify with `officecli --version` (open a new terminal if PATH hasn't picked up). If install fails, download a binary from https://github.com/iOfficeAI/OfficeCLI/releases.
|
|
||||||
|
|
||||||
## ⚠️ Help-First Rule
|
|
||||||
|
|
||||||
**This skill teaches what a fundraising deck requires, not every command flag.** When a prop name, enum value, or preset is uncertain, consult help BEFORE guessing.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli help pptx # All pptx elements
|
|
||||||
officecli help pptx <element> # Full schema (e.g. chart, shape, connector, picture)
|
|
||||||
officecli help pptx <element> --json # Machine-readable
|
|
||||||
```
|
|
||||||
|
|
||||||
Help reflects the installed CLI version. When this skill and help disagree, **help wins.** Every `--prop X=` in this file has been grep-verified against `officecli help pptx <element>` — if help adds / renames a prop in a later version, trust help.
|
|
||||||
|
|
||||||
## Mental Model & Inheritance
|
|
||||||
|
|
||||||
**Inherits pptx v2.** You should have read `skills/officecli-pptx/SKILL.md` first. This skill assumes you know how to: add slides + shapes + charts + connectors; address by `@name=` / `@id=`; quote paths; use `batch` heredocs; write `--prop tailEnd=triangle` on every flow connector; and run the 5-gate Delivery Gate. If any of those are unfamiliar, open a pptx v2 session before continuing.
|
|
||||||
|
|
||||||
## Shell & Execution Discipline
|
|
||||||
|
|
||||||
**Shell quoting, incremental execution, `$FILE` convention** → see pptx v2 §Shell & Execution Discipline. Same rules verbatim — quote `[N]` paths, single-quote values containing `$` (including `$35M`, `$1.2B TAM` in a cover or ask slide), never hand-write `\$ \t \n` in executable examples, one command at a time. Examples below use `$FILE` (`FILE="deck.pptx"`).
|
|
||||||
|
|
||||||
**Single-quote every shape text containing `$`.** `--prop text="Series B · $35M"` (double quotes) is WRONG — zsh expands `$35M` → empty, deck renders `Series B · M` silently. `--prop text='Series B · $35M'` (single quotes) is right. This is the #1 pitch-deck shell-escape failure mode (`$35M`, `$18M ARR`, `$1.2B TAM` appear on cover/ask/financials/milestones). Gate 2 cannot detect a stripped `$35M` — no residue. Gate 2b catches common strip patterns; single-quoting PREVENTS them.
|
|
||||||
|
|
||||||
## What "pitch deck" means here (identity)
|
|
||||||
|
|
||||||
A pitch deck is a pptx with a **fundraising layer** on top: VC-oriented narrative arc, verifiable metrics, stage-appropriate data density, founder-credibility surface. Slides are consumed at ~3 seconds per slide in a live room — the pptx v2 rule. Pitch decks add a second constraint on top: **every slide carries one investable proposition**. If a slide is "interesting background" that doesn't move the ask forward, cut it. VCs will not. The base pptx rules still apply; pitch decks add six deltas:
|
|
||||||
|
|
||||||
1. **Stage determines everything.** Series A / B / C each dictates slide count, narrative weight, which metrics are must-haves, and tolerance for unit-econ sophistication. A Series A deck with 6 pages of CAC/LTV math reads as over-packaged; a Series B deck missing unit econ reads as incomplete. Pick the stage first — everything downstream follows.
|
|
||||||
2. **Narrative arc beats feature dump.** 10 essential slides in a fixed order: cover → problem → solution → market → product → model → traction → team → financials → ask. Out of order = VCs disengage.
|
|
||||||
3. **Numbers are a contract.** TAM/SAM/SOM must be clean three-layer; CAC/LTV must have a payback line; ARR ≠ revenue; Use-of-Funds must be a four-bucket pie. Sloppy numbers = round dies.
|
|
||||||
4. **Team slide carries prior companies.** Avatar grid alone reads as a student project. Add prior-company logos / names + one-line role. Without this, first-time founders look exactly like first-time founders.
|
|
||||||
5. **Traction chart y-axis starts at 0.** A "hockey stick" starting at `y_min = 80% of current` is a visual lie — VCs who have seen 10,000 decks spot it in < 2 seconds.
|
|
||||||
6. **The ask is a slide, not a footnote.** `$XX M` hero + four-bucket Use-of-Funds + runway length. "We're raising some money" is not an ask.
|
|
||||||
|
|
||||||
### Reverse handoff — when to go BACK to pptx base
|
|
||||||
|
|
||||||
Stay in **pptx v2 base** for board reviews, all-hands, sales decks, product launches, training decks — anything not tied to raising capital. Use **this skill** only when: (a) the user mentions a specific round (seed / Series A / B / C) or a VC meeting, AND (b) the deck needs at least 4 of {problem, traction, team with credentials, Use-of-Funds, stage-appropriate unit econ, financial projections}.
|
|
||||||
|
|
||||||
If the user says "fundraising deck" but the context is a corporate BU quarterly ask, that is a board review. Route to pptx v2 Recipe (d) 10-slide blueprint. If the user says "board review" but the context is a small company raising a bridge round, route here.
|
|
||||||
|
|
||||||
## Series A / B / C stage diagnosis (decision tool)
|
|
||||||
|
|
||||||
**Read this before writing a single command.** Pick the row that matches the user's description — everything downstream (slide count, which metrics, which recipes, what the team slide must show) derives from this one call.
|
|
||||||
|
|
||||||
| Stage | Revenue band | Team | Slide count | Dominant narrative (weight) | Must-have data | Common red flag |
|
|
||||||
|---|---|---|---|---|---|---|
|
|
||||||
| **Seed** | $0 – $1M ARR (often pre-rev) | 2 – 8 FTE | 10 – 12 | Problem (30%) + Solution (25%) + Team (15%) + Market (15%) + Traction (15%) | Founder-market fit story; 1 – 2 design-partner / pilot logos; top-down TAM ok | Over-claiming traction (10 customers = "market proven") |
|
|
||||||
| **Series A** | $1 – $5M ARR | 10 – 25 FTE | 12 – 16 | Problem (20%) + Solution (20%) + **Market "why now"** (15%) + Product (15%) + Traction (20%) + Team (10%) | PMF proof (NRR > 110%, low churn), bottom-up TAM/SAM, pipeline / pilots converted | Bottom-up TAM feels fabricated; CAC not yet meaningful but shown anyway |
|
|
||||||
| **Series B** | $5 – $30M ARR | 30 – 100 FTE | 18 – 22 | **Traction + Unit econ (30%)** + Market + Product + Team + Financials (ask) | ARR curve starting at 0; NRR, CAC, LTV, payback (< 18 mo ideal); cohort retention; logo wall | No unit-econ slide; CAC payback > 24mo without explanation; Use-of-Funds missing % |
|
|
||||||
| **Series C** | $30M+ ARR | 100+ FTE | 20 – 24 | **Financials + Scale + Moat (40%)** + Market expansion + Team depth | Multi-year GAAP, rule-of-40, GM trajectory, international expansion plan, defensibility | No moat slide; revenue growth without margin story; team slide has no prior CEO / CFO |
|
|
||||||
| **Bridge / SAFE** | any | any | 8 – 10 | **Specific bridge reason** + runway math + commitments | Prior round context; specific milestone the bridge funds; committed investor amount | Treating a bridge like a Series A — too many slides dilutes the ask |
|
|
||||||
|
|
||||||
**Decision procedure.** From one or two user sentences ("Series B, $18M ARR, 120 customers, $35M raise"), pick exactly one stage row. All later choices in this skill reference your stage: which 赛道 template to pull, which recipes are mandatory vs optional, and which Delivery Gate 6 checks fire.
|
|
||||||
|
|
||||||
**Corner cases.** Bridge rounds & convertibles between A → B are closer to A or B depending on whether the bridge milestone is "finish PMF" (A shape) or "hit unit-econ target" (B shape). "Extension" rounds at the same stage reuse the earlier stage's skeleton and add a one-slide "progress since last round" update.
|
|
||||||
|
|
||||||
**Non-SaaS stage overrides.** The ARR / unit-econ shape of Series B fits SaaS. For other verticals, substitute revenue band + unit-econ equivalent + Gate 6.3 grep:
|
|
||||||
|
|
||||||
| Vertical | Revenue "band" at Series B | "Unit econ" equivalent | Gate 6.3 substitute |
|
|
||||||
|---|---|---|---|
|
|
||||||
| **Bio / Clinical-stage** | pre-rev, 20–60 FTE | burn rate + runway to next milestone (IND / Ph1 readout / BLA) | `shape:contains("ORR")` OR `contains("Pipeline")` OR `contains("BLA")` OR `contains("runway")` ≥ 1 |
|
|
||||||
| **Deep Tech / Frontier** | pre-rev or early pilot rev | technical milestones + TRL level + benchmark vs SoTA | `shape:contains("TRL")` OR `contains("benchmark")` ≥ 1 |
|
|
||||||
| **Marketplace / Network** | GMV $10–100M | take rate + cohort retention + liquidity | `shape:contains("GMV")` + `contains("take rate")` ≥ 1 |
|
|
||||||
| **Consumer hardware** | $2–15M revenue (shipped units) | contribution margin + repeat rate + blended CAC | `shape:contains("repeat")` OR `contains("contribution")` ≥ 1 |
|
|
||||||
|
|
||||||
Substitute the analogue grep when running Gate 6.3 on these verticals. False WARN on SaaS CAC/LTV = expected; real concern = vertical-specific analogue present. Bio Series B decks especially: burn + runway-to-milestone IS the "unit econ" story.
|
|
||||||
|
|
||||||
## 赛道 arc templates (5 families)
|
|
||||||
|
|
||||||
5 mainstream verticals. Each one has different slide weights because what VCs require as proof-of-concept differs. Pick the vertical row; the slide skeleton is a copy-able starting point. Slide counts assume the matching stage row above.
|
|
||||||
|
|
||||||
### (1) B2B SaaS / Enterprise software
|
|
||||||
|
|
||||||
Canonical arc — the template most of VC muscle memory is built on. Series B example (20 slides): cover · TL;DR · problem · problem evidence · solution · product loop · market TAM/SAM/SOM · **unit economics (CAC / LTV / payback / GM)** · ARR trajectory · retention cohort · logo wall · team · competitors · financials 4-year · ask. Must-have: unit-econ slide from Series A onward; logo wall from Series B onward.
|
|
||||||
|
|
||||||
### (2) Consumer (B2C app / consumer hardware / D2C)
|
|
||||||
|
|
||||||
Narrative-driven. Early-stage decks lean on **product-experience screenshots + founding story + "why now"** market timing; lighter on unit econ (which are usually weaker than SaaS). Series A example (14 slides): cover · hook (30-second product demo or 1-line vision) · problem (lived experience) · solution (product shots) · product-experience flow · "why now" market window · pre-order / crowdfunding / early-sales evidence · retention / engagement (DAU, D30) · market (top-down ok if bottom-up unreliable) · competitive positioning · founder story + team · press / endorsements · financials · ask. Must-have: product visuals on ≥ 3 slides; "why now" slide (window justification); engagement metric not just revenue.
|
|
||||||
|
|
||||||
### (3) Deep Tech / Frontier tech (AI foundation models, quantum, climate hardware, robotics)
|
|
||||||
|
|
||||||
Technology credibility is the sell. Pre-revenue deep tech replaces "traction" with **technical milestones + defensibility**. Series B example (22 slides): cover · thesis (one-line "what changes if this works") · problem (current state of art) · solution (technical approach) · **technology architecture** · benchmarks vs SoTA · pipeline / TRL levels · market (long-tail) · business model · early commercial traction (pilots, LOIs) · IP / patents · team (usually PhD / ex-FAANG-research) · partners · financials · ask. Must-have: benchmark slide; IP slide; team slide dense with PhDs / prior-lab names.
|
|
||||||
|
|
||||||
### (4) Marketplace / Network business (two-sided platform, social, commerce)
|
|
||||||
|
|
||||||
Liquidity is the metric. Replace "unit econ" with **GMV + take rate + cohort retention + supply / demand balance**. Series A example (15 slides): cover · problem (friction in current supply-demand) · solution · product demo (both sides) · network effects diagram · early liquidity (first-week GMV, time-to-match) · cohort retention · geographic / category expansion plan · competitive positioning vs incumbents · take-rate model · team · financials · ask. Must-have: liquidity metric slide; cohort retention chart; network-effect diagram.
|
|
||||||
|
|
||||||
### (5) Bio / Life sciences / Healthtech
|
|
||||||
|
|
||||||
Regulatory pipeline IS the business. Replace "product roadmap" with **clinical pipeline + regulatory path + scientific evidence**. Series B example (22 slides): cover · unmet medical need · scientific rationale (mechanism of action) · preclinical / clinical data (ORR, safety, endpoints) · **pipeline chart** (candidates × stages × dates) · differentiation vs standard of care · IP / exclusivity · regulatory strategy (IND, BTD, fast-track) · market (prevalence × pricing) · commercial strategy (orphan / specialty / biosimilar) · partnerships / collaborations · team (CSO / CMO with prior FDA wins) · financials (burn to next milestone) · ask. Must-have: pipeline chart; clinical data slide; team slide with prior regulatory wins.
|
|
||||||
|
|
||||||
**Cross-vertical rule.** You can mix elements across templates, but never drop a must-have from your primary vertical. A SaaS deck missing unit econ, a bio deck missing a pipeline chart, a marketplace deck missing a liquidity metric — each is an instant VC disqualification.
|
|
||||||
|
|
||||||
## Slide Patterns (layout canon)
|
|
||||||
|
|
||||||
Patterns are **layout geometry**; recipes below are **narrative intent**. A slide picks one pattern for its visual shape (6 canonical ones below) and one recipe for what it argues (cover / problem / traction / ...). Multiple recipes can share one pattern — Problem / Why-Now / Traction-callout all lean on the 3-stat row (C.2). Pick the pattern first, then fill it with recipe content.
|
|
||||||
|
|
||||||
**Speaker notes rule.** Every content slide (non-cover, non-closing) MUST carry speaker notes via `officecli add "$FILE" /slide[N] --type notes --prop text='…'`. Missing notes = not shippable — inherits pptx v2 §Hard rules (H7). Run `officecli help pptx notes` to confirm prop names before building.
|
|
||||||
|
|
||||||
**Pattern reuse discipline.** Never run the same pattern on two consecutive slides — even with different data, two identical geometries in a row read as a template loop. Alternate C.2 with C.4 or C.5b to break rhythm.
|
|
||||||
|
|
||||||
**Vertical centering.** When a slide carries fewer elements than the pattern's maximum, nudge y-positions down 2–3cm to center the visual weight. Tables below assume full content.
|
|
||||||
|
|
||||||
### C.1 Title / Cover (dark gradient)
|
|
||||||
|
|
||||||
3–4 text shapes on a gradient fill. Slide 1 in every deck.
|
|
||||||
|
|
||||||
```
|
|
||||||
+----------------------------------+
|
|
||||||
| |
|
|
||||||
| TITLE (centered) |
|
|
||||||
| tagline |
|
|
||||||
| |
|
|
||||||
| round · amount · date |
|
|
||||||
| ________________________ | <- thin brand band
|
|
||||||
+----------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
| Element | X | Y | Width | Height | Font / size |
|
|
||||||
|---|---|---|---|---|---|
|
|
||||||
| Title | 2cm | 5cm | 29.87cm | 4cm | serif bold, ≥ 36pt (44 typical) |
|
|
||||||
| Tagline | 2cm | 10cm | 29.87cm | 2cm | sans 18–22pt |
|
|
||||||
| Meta (round · $ · date) | 2cm | 13cm | 29.87cm | 1.5cm | sans 12–16pt |
|
|
||||||
|
|
||||||
**Use this when** the slide is the first one (Cover recipe 1) — 3-second identity grab. Background is a 180° linear gradient between two dark palette shades (e.g. Professional Navy `1E2761 → 0D1F35`). If the title wraps to 2 lines, **add height (4cm → 5cm), never drop font below 36pt** — sub-36pt on a pitch cover reads as timid regardless of content. Transition: fade.
|
|
||||||
|
|
||||||
### C.2 3-Stat callout row
|
|
||||||
|
|
||||||
Title + 3 big-number / label pairs across. The default for Problem / Why-Now / Traction-callout slides.
|
|
||||||
|
|
||||||
```
|
|
||||||
+----------------------------------+
|
|
||||||
| Title |
|
|
||||||
| |
|
|
||||||
| 73% 12hr $4.2B |
|
|
||||||
| label label label |
|
|
||||||
| source source source |
|
|
||||||
+----------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
| Element | X | Y | Width | Height | Font / size |
|
|
||||||
|---|---|---|---|---|---|
|
|
||||||
| Title | 1.5cm | 1cm | 30.87cm | 3cm | serif bold ≥ 36pt |
|
|
||||||
| Stat 1 number | 2cm | 5cm | 9cm | 4cm | serif bold 60–64pt |
|
|
||||||
| Stat 1 label | 2cm | 9.5cm | 9cm | 2cm | sans ≥ 16pt (H4 floor) |
|
|
||||||
| Stat 2 number / label | 12.5cm | (same) | 9cm | (same) | (same) |
|
|
||||||
| Stat 3 number / label | 23cm | (same) | 9cm | (same) | (same) |
|
|
||||||
|
|
||||||
**Use this when** you have 2–3 anchoring numbers and the story is "three facts argue the point" — Problem, Why-Now, Market-callout, single-row Traction. Labels ≥ 16pt is the H4 floor (sub-label exception); a number without a label reads as bravado, so never drop labels to 12–14pt to fit more text.
|
|
||||||
|
|
||||||
### C.3 4-Stat callout row
|
|
||||||
|
|
||||||
Same geometry as C.2 but 4 columns. Numbers 60pt, width 7cm each.
|
|
||||||
|
|
||||||
```
|
|
||||||
+-------------------------------------+
|
|
||||||
| Title |
|
|
||||||
| |
|
|
||||||
| 73% 12hr $9M 4.2x |
|
|
||||||
| lbl lbl lbl lbl |
|
|
||||||
+-------------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
| Element | X positions | Y | Width | Height | Font / size |
|
|
||||||
|---|---|---|---|---|---|
|
|
||||||
| Title | 1.5cm | 1cm | 30.87cm | 3cm | serif bold 36pt |
|
|
||||||
| Stat numbers | 1.5 / 9.5 / 17.5 / 25.5cm | 5cm | 7cm | 4cm | serif bold 60pt |
|
|
||||||
| Stat labels | (same X) | 9.5cm | 7cm | 2cm | sans ≥ 16pt |
|
|
||||||
|
|
||||||
**Use this when** exactly 4 parallel metrics tell the story and 3 feels under-counted. Prefer C.2 if in doubt — 4 always feels tighter than 3, and wrap risk is real.
|
|
||||||
|
|
||||||
> **Wrap warning.** At 60pt in 7cm width, dollar patterns with both `$` and `.` fail: `$9.4M` is 5 glyphs but the wide `$` and `.` in a serif bold make it wrap to 2 lines and destroy the callout. Safe dollar shapes at 60pt/7cm: `$9M`, `$96B`, `$4K` (3–4 chars). Non-dollar shapes: `340%`, `4.2x`, `12.3` safe up to 5 chars. Values ≥ 6 chars (`197min`, `3 Days`) will wrap — either (a) drop font to 44–48pt, (b) abbreviate (`197m`, `$9M`), or (c) shift to C.2 (9cm per stat). Single tokens only, no internal spaces.
|
|
||||||
|
|
||||||
### C.4 Chart + Context (chart left, stats right)
|
|
||||||
|
|
||||||
Chart takes left 55%, 2–3 stacked callouts on the right. The default for Traction / Financials / Market-sizing-with-context.
|
|
||||||
|
|
||||||
```
|
|
||||||
+-------------------------------------+
|
|
||||||
| Title |
|
|
||||||
| |
|
|
||||||
| +---------------+ +--------+ |
|
|
||||||
| | | | Stat 1 | |
|
|
||||||
| | chart | +--------+ |
|
|
||||||
| | | | Stat 2 | |
|
|
||||||
| +---------------+ +--------+ |
|
|
||||||
+-------------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
| Element | X | Y | Width | Height |
|
|
||||||
|---|---|---|---|---|
|
|
||||||
| Title | 2cm | 1cm | 29.87cm | 3cm |
|
|
||||||
| Chart | 2cm | 4cm | 17cm | 13cm |
|
|
||||||
| Stats column | 21cm | 4cm+ | 11cm | 2.5cm number + 1.5cm label (~3.7cm per pair) |
|
|
||||||
|
|
||||||
Sub-labels ≥ 16pt (H4 floor). For 5 stats stacked, drop number size to 44pt; 6+ stats means pick a different pattern. Post-batch for column/bar charts: `officecli set "$FILE" "/slide[N]/chart[1]" --prop gap=80` to tighten bar spacing.
|
|
||||||
|
|
||||||
**Use this when** one primary chart drives the story and 2–3 numeric anchors reinforce it — Traction (ARR curve + current ARR + YoY + NRR), Financials (4-year column chart + assumption callouts), Market (bar chart + SOM / CAGR / methodology).
|
|
||||||
|
|
||||||
### C.5 Icon-in-circle grid (3-row vertical)
|
|
||||||
|
|
||||||
3 vertical rows, each = circle icon on the left + title + 1-line description.
|
|
||||||
|
|
||||||
```
|
|
||||||
+---------------------------------------+
|
|
||||||
| Title |
|
|
||||||
| |
|
|
||||||
| (o) Label one |
|
|
||||||
| description one |
|
|
||||||
| |
|
|
||||||
| (o) Label two |
|
|
||||||
| description two |
|
|
||||||
| |
|
|
||||||
| (o) Label three |
|
|
||||||
| description three |
|
|
||||||
+---------------------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
| Element | X | Y positions | Width | Height | Font / size |
|
|
||||||
|---|---|---|---|---|---|
|
|
||||||
| Icon circle | 2cm | 4.5 / 8.5 / 12.5cm | 2.5cm | 2.5cm | ellipse, accent fill |
|
|
||||||
| Label | 5.5cm | (icon Y + 0) | 25cm | 1.2cm | sans bold 18pt |
|
|
||||||
| Description | 5.5cm | (icon Y + 1.3cm) | 25cm | 1.8cm | sans ≥ 16pt (H4 floor), muted |
|
|
||||||
|
|
||||||
**Use this when** you have 3 short vertical points that benefit from a visual anchor per row — Solution mechanism, Value pillars, Product loop. Choose C.5b (2×2 grid) when items are parallel and you have exactly 4; choose a horizontal 5-across variant when icons should read side-by-side (e.g. 5-step process).
|
|
||||||
|
|
||||||
### C.5b 2×2 Feature grid (4 parallel items)
|
|
||||||
|
|
||||||
4 rounded cards, 2 columns × 2 rows. Use when you have exactly 4 parallel items (product pillars, service types, feature quadrants).
|
|
||||||
|
|
||||||
```
|
|
||||||
+-----------------------------+
|
|
||||||
| Title |
|
|
||||||
| |
|
|
||||||
| +---------+ +---------+ |
|
|
||||||
| | (o) T1 | | (o) T2 | |
|
|
||||||
| | body | | body | |
|
|
||||||
| +---------+ +---------+ |
|
|
||||||
| +---------+ +---------+ |
|
|
||||||
| | (o) T3 | | (o) T4 | |
|
|
||||||
| | body | | body | |
|
|
||||||
| +---------+ +---------+ |
|
|
||||||
+-----------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
| Element | X | Y | Width | Height | Font / size |
|
|
||||||
|---|---|---|---|---|---|
|
|
||||||
| Slide title | 2cm | 1cm | 29.87cm | 2.5cm | serif bold 32pt |
|
|
||||||
| Card 1 bg (top-left) | 1.5cm | 4cm | 14.5cm | 7cm | roundRect |
|
|
||||||
| Card 2 bg (top-right) | 17.5cm | 4cm | 14.5cm | 7cm | roundRect |
|
|
||||||
| Card 3 bg (bottom-left) | 1.5cm | 12cm | 14.5cm | 7cm | roundRect |
|
|
||||||
| Card 4 bg (bottom-right) | 17.5cm | 12cm | 14.5cm | 7cm | roundRect |
|
|
||||||
| Icon ellipse (each card) | card_x + 0.5cm | card_y + 0.5cm | 2cm | 2cm | — |
|
|
||||||
| Card title (each) | card_x + 3.2cm | card_y + 0.6cm | 10.5cm | 1.8cm | sans bold 16pt |
|
|
||||||
| Card body (each) | card_x + 0.5cm | card_y + 3cm | 13cm | 3.5cm | sans ≥ 16pt (H4 floor) |
|
|
||||||
|
|
||||||
**Use this when** you have exactly 4 parallel items and the eye should land on each equally — 4 product pillars, 4 service tiers, 4 stakeholder types. 3 items feel lonely in a 2×2; 5+ items break the grid — go to a 3×2 (see pptx v2 §(d) grid math) or C.5 row pattern.
|
|
||||||
|
|
||||||
> **Z-order canon (critical).** Each card's `roundRect` background must be added immediately before that card's icon / title / body shapes in the batch JSON — pptx paints in insertion order, so a background added after its text paints over and hides the text. When building with `officecli batch`, follow the per-card sequence `bg → ellipse → title → body` strictly. Pattern and z-order details → see pptx v2 §Recipe (c) z-order canon; reuse grid math from pptx v2 §(d) for non-2×2 counts.
|
|
||||||
|
|
||||||
**Dark-background variant.** Change card fill from `F0F4F8` (light) to a lighter-dark shade like `1A2540` and bump body text to `FFFFFF` / `E8E8E8`. Palette variables (e.g. `$MUTED`) do NOT expand inside single-quoted heredocs — write the literal hex (`64748B`) in the JSON.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Key-slide recipes (10 essentials)
|
|
||||||
|
|
||||||
The 10 slides every pitch deck carries. Each recipe below gives: **visual outcome** (what the slide looks like from 3m away) + **runnable block** (≤ 18 lines) + **QA one-liner**. All recipes inherit pptx v2 palettes, grid math, type hierarchy, and `--prop tailEnd=triangle` on every connector. Recipes reference the Slide Patterns above: Cover reuses C.1; Problem / Why-Now reuse C.2; Traction / Financials reuse C.4; Feature / pillar slides reuse C.5b. `$FILE` is your deck file.
|
|
||||||
|
|
||||||
**Long-title wrap rule.** A 36pt+ title that wraps to 2 lines: add `height` (e.g. 2cm → 3.5cm) — never drop the font below 36pt. Titles < 36pt on a pitch deck read as timid regardless of content.
|
|
||||||
|
|
||||||
> **Chart `series1.color=` on `add` works** (applies to every chart recipe below). Passing `--prop series1.color=` (or `series2.color=`, …) on chart `add` applies the series color and exits 0. Verify with a readback if you like: `officecli get "$FILE" "/slide[N]/chart[1]/series[1]" --json | jq '.data.results[0].format.color'`.
|
|
||||||
|
|
||||||
### (1) Cover slide — company · tagline · round · date
|
|
||||||
|
|
||||||
**Visual outcome.** Dark navy fill, centered 44pt company name, 20pt one-line tagline underneath, small 16pt meta line at the bottom with round + amount + date. Thin brand band at the very bottom (0.5cm high) in the accent color.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761
|
|
||||||
officecli add "$FILE" "/slide[1]" --type shape --prop name=BrandBand \
|
|
||||||
--prop geometry=rect --prop fill=CADCFC \
|
|
||||||
--prop x=0cm --prop y=18.5cm --prop width=33.87cm --prop height=0.55cm
|
|
||||||
officecli add "$FILE" "/slide[1]" --type shape --prop name=CoverTitle --prop text="Acme DevOps" \
|
|
||||||
--prop x=2cm --prop y=7cm --prop width=29.87cm --prop height=3cm \
|
|
||||||
--prop font=Georgia --prop size=44 --prop bold=true --prop color=FFFFFF --prop align=center --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[1]" --type shape --prop name=Tagline --prop text="Kubernetes observability, built for production at scale" \
|
|
||||||
--prop x=2cm --prop y=10.5cm --prop width=29.87cm --prop height=1.5cm \
|
|
||||||
--prop font=Calibri --prop size=20 --prop color=CADCFC --prop align=center --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[1]" --type shape --prop name=CoverMeta --prop text='Series B · $35M · April 2026' \
|
|
||||||
--prop x=2cm --prop y=15cm --prop width=29.87cm --prop height=1.2cm \
|
|
||||||
--prop font=Calibri --prop size=16 --prop color=FFFFFF --prop align=center --prop fill=none
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** Cover has 4 discrete elements (brand band + title + tagline + meta). 80%-whitespace covers fail the pptx "cover ≥ 60% filled" floor.
|
|
||||||
|
|
||||||
**Consumer variant (3-second grab).** Consumer decks (B2C app / hardware / D2C) should add a single dominant motif — hero product shot, oversized company name (60–96pt), or symbolic mark (crescent moon / abstract geometric). Replace the 44pt title with an 80–96pt name + one motif shape (`--type shape --prop geometry=ellipse --prop fill=<accent>` for an abstract mark, or `picture` at ~40% of slide for a product hero). Keep tagline + round + date identical. SaaS / B2B may skip — the typographic-only cover is sufficient.
|
|
||||||
|
|
||||||
### (2) Problem slide — industry pain in 1 sentence + 3 data cards
|
|
||||||
|
|
||||||
**Visual outcome.** 36pt title stating the pain (not "The Problem"). Below, three equal-width data cards across the slide: each a giant number (40pt) + one-line qualifier (16pt) + source footnote (12pt gray).
|
|
||||||
|
|
||||||
Grid math for 3 cards, 1.5cm margins, 0.76cm gap: `usable = 33.87 − 3 − 2·0.76 = 29.35`, `col_width = 29.35 / 3 = 9.78cm`. x-positions: `1.5 / 12.04 / 22.58`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SLIDE=2 # second slide, after cover. Adjust from your build order.
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="Kubernetes debugging burns 12 engineering hours / incident" \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2.5cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
cat <<EOF | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"PC1","geometry":"roundRect","fill":"F5F7FA","x":"1.5cm","y":"5cm","width":"9.78cm","height":"10cm"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"73%","x":"1.5cm","y":"6cm","width":"9.78cm","height":"3cm","font":"Georgia","size":"60","bold":"true","color":"1E2761","align":"center","fill":"none"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"of incidents take > 1 hour to diagnose","x":"1.5cm","y":"9.5cm","width":"9.78cm","height":"3cm","font":"Calibri","size":"18","color":"333333","align":"center","fill":"none"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"Source: 2025 DORA Report","x":"1.5cm","y":"13cm","width":"9.78cm","height":"1cm","font":"Calibri","size":"12","italic":"true","color":"666666","align":"center","fill":"none"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
# Repeat the 4-block pattern at x=12.04cm and x=22.58cm for cards 2 and 3.
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** `officecli query "$FILE" 'shape:contains("Source")'` returns ≥ 3 (every claim carries a source). If zero sources, VCs will not trust a single number.
|
|
||||||
|
|
||||||
### (2b) Why Now slide — Consumer / Seed / early A must-have
|
|
||||||
|
|
||||||
**Visual outcome.** 3 cards across: each = **trigger headline** (24pt bold) + **data point** (60pt number or date) + **one-line implication** (16pt) + **source footnote** (12pt gray). Reuse Problem grid math (`col=9.78cm`, x = `1.5 / 12.04 / 22.58`). §赛道 Consumer row 2 must-have; Seed / early A in any vertical benefits when "market window" IS the thesis.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SLIDE=3
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="Why now: three converging triggers" \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2.5cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
# Card 1 (x=1.5cm) — trigger / data / implication / source. Repeat at x=12.04cm and x=22.58cm.
|
|
||||||
cat <<EOF | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"geometry":"roundRect","fill":"F5F7FA","x":"1.5cm","y":"5cm","width":"9.78cm","height":"10cm"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"BOM cost","x":"1.5cm","y":"5.5cm","width":"9.78cm","height":"1.2cm","font":"Calibri","size":"24","bold":"true","color":"1E2761","align":"center","fill":"none"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"−90%","x":"1.5cm","y":"7cm","width":"9.78cm","height":"3cm","font":"Georgia","size":"60","bold":"true","color":"B85042","align":"center","fill":"none"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"Wearable BOM fell 90% since 2021; sub-$40 retail now viable","x":"1.5cm","y":"11cm","width":"9.78cm","height":"2cm","font":"Calibri","size":"16","color":"333333","align":"center","fill":"none"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"Source: IDC Wearables Teardown 2025","x":"1.5cm","y":"13.5cm","width":"9.78cm","height":"1cm","font":"Calibri","size":"12","italic":"true","color":"666666","align":"center","fill":"none"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
# Card 2 pattern: Oura IPO 2024 / +$2.4B valuation / category proven. Card 3: On-device LLM (Llama 3.2) / Q4-24 / privacy moat viable.
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** 3 cards, each with a date/year citation in the source footnote, each card ≤ 30 words. `officecli query "$FILE" 'shape:contains("2024")'` + `'shape:contains("2025")'` ≥ 2 combined (timing anchors visible).
|
|
||||||
|
|
||||||
### (3) Solution slide — product in one sentence + 3-step "how it works"
|
|
||||||
|
|
||||||
**Visual outcome.** 36pt title naming the product pattern (not "Our Solution"). Below: 3 or 4 rounded boxes horizontally at y=7cm with elbow connectors + triangle arrowheads. Each box = one verb (observe / correlate / resolve). Reuse pptx Recipe (c) flowchart — orchestration, not a new primitive.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Title — "a product pattern, not a brand slogan".
|
|
||||||
# Good: "Auto-correlate K8s events across 3 data planes in 90 seconds"
|
|
||||||
# Bad: "The future of observability"
|
|
||||||
SLIDE=4
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop name=SolTitle \
|
|
||||||
--prop text="Correlate K8s events across 3 data planes in 90 seconds" \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2.2cm \
|
|
||||||
--prop font=Georgia --prop size=32 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
# 3 boxes across: gap = (33.87 − 3 − 3·7) / 2 = 4.93cm; x = 1.5, 13.43, 25.36
|
|
||||||
# Connectors + arrowheads: --prop tailEnd=triangle ALWAYS (pptx Known Issues C-P-5..6).
|
|
||||||
# Full batch block → see pptx v2 §Creating and Editing (c) 4-step flowchart; swap N from 4 boxes to 3.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Product-pattern title rule.** The solution title is a verb + differentiated mechanism + metric. "Observe / Correlate / Resolve" is generic; VCs read it as any APM vendor. "Correlate K8s events across 3 data planes in 90 seconds" is specific; VCs read it as an insight.
|
|
||||||
|
|
||||||
**QA.** Count connectors: `officecli query "$FILE" 'connector' --json | jq '.data.results | length'` ≥ (step_count − 1). Every connector must have `tailEnd=triangle` — `view annotated` confirms arrowhead direction. Title must be ≤ 12 words (one breath).
|
|
||||||
|
|
||||||
### (4) Market slide — TAM / SAM / SOM nested columns
|
|
||||||
|
|
||||||
**Visual outcome.** 36pt title "Market: $X.YB growing Z% CAGR". Below: three horizontal bars (or three stacked nested rectangles), labeled TAM / SAM / SOM with dollar values + growth rate. Bottom footnote cites **top-down vs bottom-up source** — pick one methodology per deck, don't mix.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Use a pptx column chart with 3 values. Categories = TAM,SAM,SOM. Source annotation is a separate shape.
|
|
||||||
SLIDE=5
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="$42B observability market, 18% CAGR" \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type chart --prop chartType=bar \
|
|
||||||
--prop series1.name="USD (billions)" --prop series1.values="42,8.4,0.62" --prop series1.color=1E2761 \
|
|
||||||
--prop categories="TAM,SAM,SOM (5-yr)" \
|
|
||||||
--prop x=2cm --prop y=4cm --prop width=22cm --prop height=12cm \
|
|
||||||
--prop title='Market sizing — bottom-up by enterprise count × ACV'
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text='Source: Gartner 2025 APM Magic Quadrant; SAM = 20% of TAM (K8s-first shops); SOM = 7.4% of SAM over 5 years at 18-24% share.' \
|
|
||||||
--prop x=2cm --prop y=16.5cm --prop width=29.87cm --prop height=2cm \
|
|
||||||
--prop font=Calibri --prop size=12 --prop italic=true --prop color=666666 --prop fill=none
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** Top-down vs bottom-up MUST be declared in the source footnote. A TAM without methodology reads as fabricated.
|
|
||||||
|
|
||||||
### (5) Product slide — screenshot + 3 bullets OR 3-card feature grid
|
|
||||||
|
|
||||||
**Visual outcome.** Two layout options: (a) hero product screenshot on the left (60% of slide), 3 one-line feature bullets on the right (each ≥ 18pt body, no bullets under bullets). (b) 3 feature cards with one icon / screenshot thumbnail each. Pick (a) for consumer / app products, (b) for B2B / infrastructure.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# (a) screenshot + bullets — consumer pattern
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type picture --prop src=product_hero.png \
|
|
||||||
--prop x=1cm --prop y=4cm --prop width=18cm --prop height=13cm
|
|
||||||
officecli set "$FILE" "/slide[$SLIDE]/picture[1]" --prop alt="Product UI: dashboard with 12 K8s clusters, live correlation graph"
|
|
||||||
# Right column bullets (each as a separate shape so sizes stay explicit)
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="Auto-correlate across 3 data planes" \
|
|
||||||
--prop x=20cm --prop y=5cm --prop width=12cm --prop height=1.5cm \
|
|
||||||
--prop font=Calibri --prop size=20 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
# Repeat for bullets 2 and 3 at y=7.5cm / y=10cm.
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** Picture alt text present (`query 'picture:no-alt'` = empty). Bullets each ≥ 18pt. No "Lorem"/"product name here"/`{{...}}` tokens.
|
|
||||||
|
|
||||||
### (6) Business model slide — unit econ or revenue model
|
|
||||||
|
|
||||||
**Visual outcome.** Decision tree by vertical:
|
|
||||||
- **SaaS / Enterprise (Series A+)** — 4 KPI callouts: CAC / LTV / Payback / GM (reuse pptx Recipe (e)).
|
|
||||||
- **Consumer / D2C** — AOV · repeat-purchase rate · contribution margin · blended CAC.
|
|
||||||
- **Marketplace** — GMV / take-rate / liquidity metric / cohort retention.
|
|
||||||
- **Bio / Deep tech** — revenue model (license / milestone / royalty split) with assumed ranges.
|
|
||||||
|
|
||||||
Title names the dominant metric (e.g. "LTV:CAC 4.7x · 14-month payback · 78% gross margin"), not "Business Model". Full 4-card batch block → see pptx v2 §(e) KPI callouts.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# SaaS pattern: KPI card values + sub-label + gray VC-floor context under each.
|
|
||||||
# Card 1 (LTV): big number "$420K", sub "Lifetime value", context "floor: ARPU × GM / churn"
|
|
||||||
# Card 2 (CAC): big number "$90K", sub "Acquisition cost", context "fully-loaded S&M spend"
|
|
||||||
# Card 3 (Payback): big number "14 mo", sub "CAC payback", context "VC floor: < 18 mo"
|
|
||||||
# Card 4 (GM): big number "78%", sub "Gross margin", context "SaaS floor: 70%+"
|
|
||||||
# Grid math for 4 cards across: usable = 33.87 − 3 − 3·0.76 = 28.59, col = 7.15cm
|
|
||||||
# → Full batch template → pptx v2 §(e). Adapt card count 3→4 and card width 9.78cm→7.15cm.
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** For Series B+, all four of {CAC, LTV, payback, GM} present: `officecli query "$FILE" 'shape:contains("CAC")'` ≥ 1 AND `shape:contains("LTV")'` ≥ 1 AND `shape:contains("payback")'` ≥ 1 AND `shape:contains("gross margin")'` ≥ 1.
|
|
||||||
|
|
||||||
### (7) Traction slide — ARR curve that starts at 0
|
|
||||||
|
|
||||||
**Visual outcome.** Line chart taking 60% of slide width; ARR on y-axis **starting at 0** (not at 80% of current value — the VC hockey-stick lie). Right-side commentary card: single giant number (current ARR) + growth rate + 2-3 milestones. If Series B+, second row: cohort retention snippet or logo wall.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SLIDE=7
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text='ARR: $0 → $18M in 24 months' \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type chart --prop chartType=line \
|
|
||||||
--prop series1.name=ARR --prop series1.values="0.2,0.6,1.4,3.2,6.1,11.3,15.8,18.0" --prop series1.color=1E2761 \
|
|
||||||
--prop categories="Q1-24,Q2-24,Q3-24,Q4-24,Q1-25,Q2-25,Q3-25,Q4-25" \
|
|
||||||
--prop x=1.5cm --prop y=4cm --prop width=21cm --prop height=13cm \
|
|
||||||
--prop title='Quarterly ARR ($M) — y-axis anchored at 0' \
|
|
||||||
--prop axismin=0
|
|
||||||
# Right callout
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop geometry=roundRect --prop fill=1E2761 --prop line=none \
|
|
||||||
--prop x=23.5cm --prop y=4cm --prop width=8.8cm --prop height=13cm
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text='$18M' \
|
|
||||||
--prop x=23.5cm --prop y=5cm --prop width=8.8cm --prop height=3cm \
|
|
||||||
--prop font=Georgia --prop size=64 --prop bold=true --prop color=FFFFFF --prop align=center --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="ARR · +312% YoY · NRR 128%" \
|
|
||||||
--prop x=23.5cm --prop y=9cm --prop width=8.8cm --prop height=3cm \
|
|
||||||
--prop font=Calibri --prop size=18 --prop color=CADCFC --prop align=center --prop fill=none
|
|
||||||
```
|
|
||||||
|
|
||||||
**`--prop axismin=0` is load-bearing** — without it, pptx auto-scales the y-axis to start near the lowest value. That is the hockey-stick lie. Gate 6 greps this below.
|
|
||||||
|
|
||||||
**QA.** ARR curve chart must carry `axismin=0`. `officecli get "$FILE" "/slide[$SLIDE]/chart[1]" --json | jq .format.axisMin` returns `0` (CLI emits camelCase `axisMin` in readback even though input prop is lowercase `axismin`).
|
|
||||||
|
|
||||||
### (8) Team slide — avatars + names + prior companies (not just a wall)
|
|
||||||
|
|
||||||
**Visual outcome.** 3- or 4-card row across the middle of the slide. Each card: picture (6×6cm) on top; name (20pt bold); role (16pt); **prior company + title** (16pt italic, 1 key line); optional LinkedIn URL footer (12pt). Team slide with just headshots and names reads as amateur.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SLIDE=11
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="Team: 3 prior exits, 42 years combined K8s" \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
# Card 1 — CEO
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type picture --prop src=alice.jpg \
|
|
||||||
--prop x=2cm --prop y=5cm --prop width=6cm --prop height=6cm
|
|
||||||
officecli set "$FILE" "/slide[$SLIDE]/picture[1]" --prop alt="Alice Chen, CEO — portrait"
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="Alice Chen" \
|
|
||||||
--prop x=2cm --prop y=11.5cm --prop width=6cm --prop height=1cm \
|
|
||||||
--prop font=Georgia --prop size=20 --prop bold=true --prop color=1E2761 --prop align=center --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="CEO" \
|
|
||||||
--prop x=2cm --prop y=12.8cm --prop width=6cm --prop height=0.8cm \
|
|
||||||
--prop font=Calibri --prop size=16 --prop color=333333 --prop align=center --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="ex-Datadog Director (Series C → IPO); led K8s observability GTM $40M → $200M ARR" \
|
|
||||||
--prop x=2cm --prop y=13.8cm --prop width=6cm --prop height=2.5cm \
|
|
||||||
--prop font=Calibri --prop size=14 --prop italic=true --prop color=333333 --prop align=center --prop fill=none
|
|
||||||
# Repeat for Card 2 (CTO, x=10cm) and Card 3 (VP Eng, x=18cm) — 3 cards × 5-6 shapes each.
|
|
||||||
```
|
|
||||||
|
|
||||||
Prior companies carry **credibility density**. VCs read "ex-Datadog Director + led $40M → $200M" in 2 seconds; they read "co-founder, passionate" in 0 seconds (because they skip it). Advisors, if shown, go in a smaller row below with a single logo each.
|
|
||||||
|
|
||||||
**Arrangement helper.** 3 cards: `col=9.78cm, x=1.5/12.04/22.58`. 4 cards: `col=7.15cm, x=1.5/9.41/17.32/25.23`. 5 cards: `col=5.85cm, x=1.5/7.75/14.0/20.25/26.5` (0.4cm gap, tighter). 6+ or asymmetric → 2-row grid (3×2 / 3×3); see pptx v2 §(d) grid math.
|
|
||||||
|
|
||||||
**QA.** `officecli query "$FILE" 'shape:contains("ex-")'` + `'shape:contains("prior")'` + `'shape:contains("former")'` ≥ 1 per team member. If zero, you have a portfolio, not a team.
|
|
||||||
|
|
||||||
### (9) Financials slide — 4-year plan + honest assumptions
|
|
||||||
|
|
||||||
**Visual outcome.** Column chart: 4 years × (revenue, gross margin $, EBITDA). Right-side card: 3-bullet assumption panel (ARPU assumption, win-rate assumption, churn assumption). Title names the trajectory ("$18M → $85M by FY29"), not "Financial Projections".
|
|
||||||
|
|
||||||
Reuse pptx Recipe (b) chart + commentary. Pitch-specific: ASSUMPTIONS column on the right is **load-bearing** — a 4-year plan without visible assumptions reads as aspirational. VCs will ask what's behind every number anyway; surface it.
|
|
||||||
|
|
||||||
Left 2/3 — slide + title + 3-series column chart:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SLIDE=17
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text='$18M → $85M ARR by FY29' \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type chart --prop chartType=column \
|
|
||||||
--prop series1.name="Revenue ($M)" --prop series1.values="18,34,58,85" --prop series1.color=1E2761 \
|
|
||||||
--prop series2.name="Gross Margin ($M)" --prop series2.values="14,26,45,68" --prop series2.color=CADCFC \
|
|
||||||
--prop series3.name="EBITDA ($M)" --prop series3.values="-6,-2,8,22" --prop series3.color=B85042 \
|
|
||||||
--prop categories="FY26,FY27,FY28,FY29" \
|
|
||||||
--prop x=1.5cm --prop y=4cm --prop width=20cm --prop height=13cm \
|
|
||||||
--prop title='4-year plan — revenue, GM, EBITDA ($M)'
|
|
||||||
```
|
|
||||||
|
|
||||||
Right 1/3 — assumptions commentary card:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop geometry=roundRect --prop fill=F5F7FA --prop line=none \
|
|
||||||
--prop x=22.5cm --prop y=4cm --prop width=9.8cm --prop height=13cm
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="Key Assumptions" \
|
|
||||||
--prop x=23cm --prop y=4.5cm --prop width=8.8cm --prop height=1.2cm \
|
|
||||||
--prop font=Georgia --prop size=20 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
# 5 assumption bullets as 5 separate paragraph shapes at y=6, 7.5, 9, 10.5, 12cm — size=14, italic=true.
|
|
||||||
# Keep each bullet ≤ 14 words so 8.8cm width fits without wrap.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Assumptions panel is load-bearing.** A 4-year plan without visible assumptions reads as aspirational. VCs ask what's behind every number anyway — surface the three or four assumptions that drive the curve.
|
|
||||||
|
|
||||||
**QA.** `officecli query "$FILE" 'shape:contains("assumption")'` OR `'shape:contains("Assumes")'` ≥ 1. If zero, add the panel.
|
|
||||||
|
|
||||||
### (10) The Ask — hero number + 4-bucket Use-of-Funds + runway
|
|
||||||
|
|
||||||
**Visual outcome.** Dark fill (match cover). Hero number in the center top: `$35M` at 96pt white. Below, a 4-bucket pie OR a 4-card row listing **Engineering 40% / GTM 35% / G&A 15% / Reserve 10%**. Bottom line: "18-month runway to $40M ARR" (next milestone, not "until next round").
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SLIDE=20
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text='$35M Series B' \
|
|
||||||
--prop x=2cm --prop y=2cm --prop width=29.87cm --prop height=4cm \
|
|
||||||
--prop font=Georgia --prop size=88 --prop bold=true --prop color=FFFFFF --prop align=center --prop fill=none
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type chart --prop chartType=pie \
|
|
||||||
--prop series1.name="Use of Funds" --prop series1.values="40,35,15,10" \
|
|
||||||
--prop categories="Engineering,Go-to-Market,G&A,Reserve" \
|
|
||||||
--prop colors="CADCFC,B85042,97BC62,FFFFFF" \
|
|
||||||
--prop x=6cm --prop y=7cm --prop width=12cm --prop height=10cm \
|
|
||||||
--prop title="Use of Funds — 4 buckets"
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text='18 months runway to $40M ARR and Series C' \
|
|
||||||
--prop x=2cm --prop y=17cm --prop width=29.87cm --prop height=1.5cm \
|
|
||||||
--prop font=Calibri --prop size=22 --prop color=CADCFC --prop align=center --prop fill=none
|
|
||||||
```
|
|
||||||
|
|
||||||
**4-bucket convention.** Engineering / GTM / G&A / Reserve is the canonical breakdown. Typical Series A ranges: Eng 40-50%, GTM 30-40%, G&A 10-15%, Reserve 5-10%. Series B shifts 5-10 points from Eng to GTM.
|
|
||||||
|
|
||||||
**QA.** `officecli query "$FILE" 'shape:contains("Use of Funds")'` ≥ 1. Pie chart present on ask slide. Runway + milestone on ask slide.
|
|
||||||
|
|
||||||
### (11) Pipeline chart — Bio / Deep Tech must-have
|
|
||||||
|
|
||||||
**Visual outcome.** Horizontal swimlane. Left column = candidate name; 4 stage columns to the right (Preclinical / Ph1 / Ph2 / Ph3 for bio — or TRL1-3 / TRL4-6 / TRL7-8 / TRL9 for deep tech). Each row's bar extends to its current stage; darker fill for later stages. NCT / trial-ID footer below. §赛道 row 5 Bio must-have; SaaS / Consumer skip.
|
|
||||||
|
|
||||||
Grid math: usable `= 30.87cm`, candidate col `= 7cm`, stage cols `= (30.87 − 7) / 4 = 5.97cm` each, row height `= 2.3cm`. Stage col x: `8.5 / 14.47 / 20.44 / 26.41`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SLIDE=6
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="Pipeline: 3 candidates across Ph1–Ph3" \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
# 4 stage headers + candidate row 1 (HLX-201 at Ph2, bar width = 3·5.97 = 17.91cm) in one batch.
|
|
||||||
cat <<EOF | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"Preclinical","x":"8.5cm","y":"4cm","width":"5.97cm","height":"1cm","font":"Calibri","size":"16","bold":"true","color":"333333","align":"center","fill":"F5F7FA"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"Phase 1","x":"14.47cm","y":"4cm","width":"5.97cm","height":"1cm","font":"Calibri","size":"16","bold":"true","color":"333333","align":"center","fill":"F5F7FA"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"Phase 2","x":"20.44cm","y":"4cm","width":"5.97cm","height":"1cm","font":"Calibri","size":"16","bold":"true","color":"333333","align":"center","fill":"F5F7FA"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"Phase 3","x":"26.41cm","y":"4cm","width":"5.97cm","height":"1cm","font":"Calibri","size":"16","bold":"true","color":"333333","align":"center","fill":"F5F7FA"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"HLX-201 (lead)","x":"1.5cm","y":"5.5cm","width":"7cm","height":"1.5cm","font":"Calibri","size":"18","bold":"true","color":"1E2761","align":"left","fill":"none"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"geometry":"roundRect","fill":"1E2761","x":"8.5cm","y":"5.7cm","width":"17.91cm","height":"1.1cm","line":"none"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
# Repeat rows 2 & 3 at y=7.8cm / y=10.1cm with bar widths per stage (Ph1=5.97cm, Ph1-Ph2=11.94cm, Ph1-Ph3=17.91cm).
|
|
||||||
# NCT footer full-width at y=16.8cm.
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text='NCT05021323 (HLX-201, Ph2, n=48) · NCT06142091 (HLX-304, Ph1, n=24) · IND-filed Q1-26 for HLX-412' \
|
|
||||||
--prop x=1.5cm --prop y=16.8cm --prop width=30.87cm --prop height=1.2cm \
|
|
||||||
--prop font=Calibri --prop size=12 --prop italic=true --prop color=666666 --prop fill=none
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** `officecli query "$FILE" 'shape:contains("NCT")' --json | jq '.data.results | length'` ≥ 1. Bar colors darken across stages (`CADCFC` preclinical-only, `1E2761` Ph2-reached).
|
|
||||||
|
|
||||||
### (12) Competitive comparison table — Series B+ essential
|
|
||||||
|
|
||||||
**Visual outcome.** 5–7 rows × 4–6 cols. Column 1 = competitor name (optional logo shape beside); rest = differentiators (speed / price / integrations / margin / coverage). **Last row = your company, fill highlighted** in an accent color (CADCFC / 97BC62); competitor rows gray. Every Series B+ deck needs this (SaaS: Datadog / New Relic / Splunk; Bio: Kite / Novartis / BMS).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SLIDE=13
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type shape --prop text="Competitive landscape" \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30.87cm --prop height=2cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
# Inline table via --prop data= (per-cell r#c# is silently ignored / not honored — use data=). Single-quote the data value — '$15/host' would strip.
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type table \
|
|
||||||
--prop data='Competitor,Speed,Price,Integrations,Margin;Datadog,12 min,$15/host,680,75%;New Relic,18 min,$25/host,520,68%;Splunk,45 min,$45/GB,310,62%;You (Acme DevOps),90 sec,$8/host,1200,82%' \
|
|
||||||
--prop style=medium1 --prop headerFill=1E2761 \
|
|
||||||
--prop x=1.5cm --prop y=4cm --prop width=30.87cm --prop height=12cm
|
|
||||||
# Highlight your row: loop over /slide[$SLIDE]/table[1]/tr[5]/tc[1..5] and set cell fill to CADCFC.
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** `officecli query "$FILE" 'table' --json | jq '.data.results | length'` ≥ 1. Row count ≥ 4 (you + ≥ 3 named competitors). Your row visually distinct via cell fill (Gate 5b visual check — table style alone does not highlight one row).
|
|
||||||
|
|
||||||
## Numbers convention (pitch-specific)
|
|
||||||
|
|
||||||
A terse convention table — **not a finance tutorial**. If you don't already know what these mean, pause the deck and ask the user for the values; don't guess.
|
|
||||||
|
|
||||||
| Metric | Shape | Floor / convention |
|
|
||||||
|---|---|---|
|
|
||||||
| **TAM** | `$X.YB`, one methodology | Either top-down (analyst report) or bottom-up (count × ACV). Never both; never neither. |
|
|
||||||
| **SAM** | `$X.YB`, fraction of TAM you serve | Typically 15 – 30% of TAM for verticalized SaaS; higher for horizontal |
|
|
||||||
| **SOM** | `$X.YB` at year N | Realistic 5-yr share: 5 – 15% of SAM for early stage |
|
|
||||||
| **ARR** | MRR × 12. NOT revenue. | SaaS only; contracts on books, net of churn |
|
|
||||||
| **MRR** | Monthly recurring | ARR / 12; do not confuse with monthly revenue |
|
|
||||||
| **NRR (Net Revenue Retention)** | %, trailing 12 mo | VC floor: > 100% acceptable, > 115% strong, > 130% exceptional |
|
|
||||||
| **CAC** | $ fully-loaded | Sales + marketing spend / new logos acquired |
|
|
||||||
| **LTV** | $ | ARPU × gross margin × (1 / churn rate) |
|
|
||||||
| **LTV:CAC** | ratio | VC floor: 3x OK, > 4x strong, > 5x exceptional |
|
|
||||||
| **CAC payback** | months | VC floor: < 18 mo OK, < 12 mo strong |
|
|
||||||
| **Gross margin** | % | SaaS floor 70%, strong 80%+; marketplace 15-40%; hardware 30-50% |
|
|
||||||
| **Burn / runway** | $/month + months | Gross burn vs net burn — label which; runway to specific milestone |
|
|
||||||
| **Use of Funds** | 4-bucket pie | Engineering / Go-to-Market / G&A / Reserve — see Ask slide recipe |
|
|
||||||
|
|
||||||
**Rule.** Every number on a deck carries a unit. `18%` or `18M` alone is ambiguous — write `$18M ARR` / `18% NRR growth`. `TBD`, `coming soon`, `(fill in)`, `lorem`, `xxxx` in numeric slots = immediate VC disqualification. Gate 6 greps these below.
|
|
||||||
|
|
||||||
## VC ship-check (6 red flags / positive signals)
|
|
||||||
|
|
||||||
What the VC reads in the first 30 seconds. Six one-line conditions — every "FAIL" below is an instant round-killer; fix before delivering.
|
|
||||||
|
|
||||||
| # | Red flag (FAIL if present) | Positive signal (shipwise) |
|
|
||||||
|---|---|---|
|
|
||||||
| 1 | Cover without round + amount + date | `Company · tagline · Series X · $YM · Date` in 4 lines |
|
|
||||||
| 2 | TAM > $100B without a cited source / methodology | TAM clearly labeled bottom-up OR top-down with a visible 2024+ source |
|
|
||||||
| 3 | Traction chart y-axis does not start at 0 (hockey-stick lie) | Line chart `axismin=0`; growth shape honest |
|
|
||||||
| 4 | Team slide: headshots + names only, no prior companies | Every member: prior company + role + 1 achievement metric |
|
|
||||||
| 5 | Ask slide missing Use-of-Funds breakdown | `$XM` hero + 4-bucket pie (Eng / GTM / G&A / Reserve) + runway + next milestone |
|
|
||||||
| 6 | `TBD` / `lorem` / `xxxx` / `{{...}}` / `(fill in)` anywhere | `view text` clean — zero placeholder tokens |
|
|
||||||
|
|
||||||
**Common Series-specific failures.**
|
|
||||||
- **Series A specific** — bottom-up TAM calculated from a fictional enterprise-count × ACV (no reference customers to anchor the count); `CAC / LTV` shown with < 12 months of data (statistically meaningless).
|
|
||||||
- **Series B specific** — no unit-econ slide at all; CAC payback > 24 months without a "we're pre-scale, here's the plan" narrative; logo wall < 8 customers.
|
|
||||||
- **Series C specific** — no moat / defensibility slide; revenue growth shown without margin trajectory; international expansion stated but no specific launch plan / hires.
|
|
||||||
|
|
||||||
The Delivery Gate 6 block below executes checks 1–6 above via grep + query. Gate 5b fresh-eyes covers the visual judgments (hockey stick, team credibility) that grep can't see.
|
|
||||||
|
|
||||||
## Traction triple-pattern (ARR + milestones + logos)
|
|
||||||
|
|
||||||
For Series B+, traction often spans 2 slides: one for the chart + callout (recipe 7 above), one for **milestone timeline + logo wall**. Timeline = 4-6 horizontal dates with one-line events. Logo wall = 12-20 customer logos in a 4×N or 5×N grid, muted monochrome so no single brand dominates.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Milestone timeline: 5 dates as circles on a horizontal line at y=8cm.
|
|
||||||
# Use pptx shapes (ellipse preset) + connectors (shape=straight) between them.
|
|
||||||
# Each milestone = ellipse at y=8cm + date label above + event description below.
|
|
||||||
# → See pptx v2 Recipe (d) row 9 (Roadmap timeline) for the canonical pattern.
|
|
||||||
|
|
||||||
# Logo wall: pictures in a 5×N grid. Typical spacing: logo width = 5cm, height = 2cm, gap = 0.4cm.
|
|
||||||
# grid math for 5 logos across, 1.5cm edge margin: usable = 33.87 − 3 − 4·0.4 = 29.27, col = 5.85cm
|
|
||||||
# (use 5cm logo width centered in each 5.85cm column)
|
|
||||||
```
|
|
||||||
|
|
||||||
**QA.** Logo wall should have ≥ 8 logos for Series B+, ≥ 4 for Series A. Fewer = "lighter than it looks"; more than 20 = pixel noise.
|
|
||||||
|
|
||||||
## QA — Delivery Gate (executable)
|
|
||||||
|
|
||||||
**Assume there are problems.** First render is almost never correct. Pitch decks fail at two layers: **structural** (schema, token leaks — caught by pptx v2 Gates 1–3) and **narrative** (wrong stage, missing unit econ, TAM unsourced — the checks that make pptx v2 Gate 5b + Gate 6 indispensable). Every check must print its success message.
|
|
||||||
|
|
||||||
### Gates 1–5a — inherited from pptx v2 verbatim
|
|
||||||
|
|
||||||
→ see pptx v2 §Delivery Gate L637-679. Copy-paste the full block:
|
|
||||||
|
|
||||||
- **Gate 1** — `validate` schema check (whitelist `ChartShapeProperties` warnings per C-P-2).
|
|
||||||
- **Gate 2** — token leak via `view text` grep (`$xxx$`, `{{...}}`, `<TODO>`, `lorem`, `xxxx`, empty `()`/`[]`, `\$`/`\t`/`\n` literals).
|
|
||||||
- **Gate 3** — hyperlink `rPr` schema trap (C-P-1) — zero `<a:rPr><a:hlinkClick>`.
|
|
||||||
- **Gate 4** — slide-order sanity — cover first, dividers before sections, closing last.
|
|
||||||
- **Gate 5a** — dark-on-dark contrast — every fill in `{1E2761, 0A1628, 8B1A1A, 2C5F2D, 36454F}` must declare near-white textColor. **This includes charts rendered on that fill**: chart `title.textColor`, `legend.textColor`, axis text default to dark and read as invisible on dark backgrounds — set them explicitly, or place the chart on a light card inside the dark slide.
|
|
||||||
|
|
||||||
Do not skip or reorder these five. Every pptx-layer defect caught by Gates 1–5a also fires on pitch decks.
|
|
||||||
|
|
||||||
**Gate 2b — pitch-specific shell-strip signatures (MANDATORY).** Gate 2 misses `$35M` that zsh silently stripped to empty (no residue to grep). Run this after Gate 2:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# $XXM stripped by zsh leaves bare " M ARR" / " M raised" / "Series [A-C] · M" patterns.
|
|
||||||
STRIP=$(officecli view "$FILE" text | grep -niE '(^|[^A-Za-z0-9])M (ARR|raised|Series|runway|round|raise)|Series [A-C] · M( |$)|runway · M|raised · M|raising ·? M')
|
|
||||||
[ -z "$STRIP" ] && echo "Gate 2b OK (no \$-strip signatures)" || { echo "REJECT Gate 2b (likely zsh \$-strip — re-issue with single quotes):"; echo "$STRIP"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
Fix: re-issue the offending `add`/`set` with single quotes around the text value (`--prop text='Series B · $35M'`, not double quotes). The same strip hits **chart series names / axis titles** (`--prop name="营收 ($M)"` → legend shows `营收 ()`): single-quote every chart prop carrying `$`.
|
|
||||||
|
|
||||||
### Gate 5b — Visual audit via HTML preview (MANDATORY, NOT optional)
|
|
||||||
|
|
||||||
Gates 1–5a are token-grep defenses. **They cannot see a rendered slide.** This step is the only visual-assembly check. Do not skip.
|
|
||||||
|
|
||||||
Run `officecli view "$FILE" html` and Read the returned HTML. Walk every slide and answer, for EACH (inherits pptx v2 Gate 5b checklist; pitch-specific additions marked ⭐):
|
|
||||||
|
|
||||||
- **overlap**: do any text shapes overlap each other or a chart?
|
|
||||||
- **dark-on-dark**: is any text on a fill where fill brightness < 30% AND text brightness < 80%?
|
|
||||||
- **divider overlap**: any giant decorative number (01/02/03 at 100pt+) colliding with the divider title text?
|
|
||||||
- **order sanity**: does the slide sequence match your stage-appropriate narrative outline?
|
|
||||||
- **missing arrowheads**: do flowchart/decision-tree connectors show direction, or plain lines?
|
|
||||||
- ⭐ **traction y-axis**: does every ARR / revenue / growth line chart start at 0 on the y-axis? (Not 80% of current — that is the hockey-stick lie.)
|
|
||||||
- ⭐ **team credibility**: does every team-slide card show a prior company or prior title? (Cards with just headshot + name = reject.)
|
|
||||||
- ⭐ **TAM / market number credibility**: is the TAM under $100B for a niche market, or if ≥ $100B, is a methodology source cited? (A claimed `$500B TAM` with no source is an auto-reject red flag.)
|
|
||||||
- ⭐ **Use-of-Funds pie**: does the ask slide carry a 4-bucket pie (Engineering / GTM / G&A / Reserve) or a 4-card row with %s?
|
|
||||||
- ⭐ **narrative completeness**: is the order cover → problem → solution → market → product → model → traction → team → financials → ask, or your stage-appropriate permutation from §Stage diagnosis?
|
|
||||||
|
|
||||||
**Instruction.** Run `officecli view "$FILE" html` and Read the HTML. Walk every slide against the questions below. If rendering chart colors, animations, or zoom — those only show in the target viewer (PowerPoint / Keynote / WPS); ask the user to open `.pptx` directly for those runtime features.
|
|
||||||
|
|
||||||
> For every slide:
|
|
||||||
> (a) Are slides in VC narrative order (cover → problem → solution → market → product → model → traction → team → financials → ask, with your stage's adjustments)? Flag any out-of-sequence.
|
|
||||||
> (b) Is every ARR / revenue / growth line chart y-axis anchored at 0? Flag hockey-stick visual lies.
|
|
||||||
> (c) Does the team slide carry prior-company credentials for each person? (Not just headshot + name.)
|
|
||||||
> (d) Does every TAM / SAM / SOM claim have a visible source or methodology?
|
|
||||||
> (e) Does the ask slide have a 4-bucket Use of Funds (Engineering / GTM / G&A / Reserve) and a specific next milestone + runway length?
|
|
||||||
> (f) Any text overlap, dark-on-dark, off-slide geometry, missing arrowheads, placeholder tokens (`TBD` / `lorem` / `{{...}}` / `xxxx` / empty `()`)?
|
|
||||||
|
|
||||||
Report every instance with slide number. If ANY defect — REJECT; do not deliver until fixed.
|
|
||||||
|
|
||||||
**Human preview (optional).** If you want the user to visually preview the deck, run `officecli watch "$FILE"` for a live preview the user can open at their own discretion, or have them open the `.pptx` directly in PowerPoint / WPS / Keynote. For final visual verification, open the file in the target presentation viewer.
|
|
||||||
|
|
||||||
### Gate 6 — Pitch narrative sanity (executable)
|
|
||||||
|
|
||||||
Pitch-specific checks that grep the deck for VC red flags. Every one is a token check — combine with Gate 5b's human read for full coverage.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
FILE="deck.pptx"
|
|
||||||
|
|
||||||
# 6.1 — no TBD / lorem / placeholder tokens (stronger than Gate 2 — pitch-specific scope)
|
|
||||||
LEAK=$(officecli view "$FILE" text | grep -niE 'TBD|lorem|\(fill in\)|xxxx|coming soon|placeholder')
|
|
||||||
[ -z "$LEAK" ] && echo "Gate 6.1 OK (no placeholder tokens)" || { echo "REJECT Gate 6.1:"; echo "$LEAK"; exit 1; }
|
|
||||||
|
|
||||||
# 6.2 — TAM / SAM / SOM presence (Series A+)
|
|
||||||
TAM_HIT=$(officecli query "$FILE" 'shape:contains("TAM")' --json | jq '.data.results | length')
|
|
||||||
[ "$TAM_HIT" -ge 1 ] && echo "Gate 6.2 OK (TAM slide present)" || echo "WARN Gate 6.2: no TAM mention — confirm stage is Seed / Bridge if intentional"
|
|
||||||
|
|
||||||
# 6.3 — Unit econ presence (Series B+): CAC OR LTV OR payback
|
|
||||||
CAC_HIT=$(officecli query "$FILE" 'shape:contains("CAC")' --json | jq '.data.results | length')
|
|
||||||
LTV_HIT=$(officecli query "$FILE" 'shape:contains("LTV")' --json | jq '.data.results | length')
|
|
||||||
if [ "$CAC_HIT" -ge 1 ] || [ "$LTV_HIT" -ge 1 ]; then
|
|
||||||
echo "Gate 6.3 OK (unit econ surface)"
|
|
||||||
else
|
|
||||||
echo "WARN Gate 6.3: no CAC / LTV — confirm stage Seed/A if intentional, REJECT if Series B+"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 6.4 — Use of Funds present on ask slide
|
|
||||||
UOF_HIT=$(officecli query "$FILE" 'shape:contains("Use of Funds")' --json | jq '.data.results | length')
|
|
||||||
[ "$UOF_HIT" -ge 1 ] && echo "Gate 6.4 OK (Use of Funds)" || { echo "REJECT Gate 6.4: ask slide missing Use of Funds"; exit 1; }
|
|
||||||
|
|
||||||
# 6.5 — Team prior-company signal (at least one of ex- / former / prior / previously)
|
|
||||||
PRIOR_HIT=$(officecli view "$FILE" text | grep -ciE '\b(ex-|former|prior|previously)\b')
|
|
||||||
[ "$PRIOR_HIT" -ge 1 ] && echo "Gate 6.5 OK (team prior-company)" || { echo "REJECT Gate 6.5: team slide has no prior-company credentials"; exit 1; }
|
|
||||||
|
|
||||||
# 6.6 — Traction chart y-axis anchored at 0 (at least one chart must set axismin=0, Series A+)
|
|
||||||
AXISMIN_HIT=$(officecli query "$FILE" 'chart' --json | jq '[.data.results[]? | select(.format.axisMin == "0" or .format.axisMin == 0 or .format.axismin == "0" or .format.axismin == 0)] | length')
|
|
||||||
[ "$AXISMIN_HIT" -ge 1 ] && echo "Gate 6.6 OK (traction chart axisMin=0)" || echo "WARN Gate 6.6: no chart sets axisMin=0 — confirm no ARR/revenue line chart, or add --prop axismin=0"
|
|
||||||
|
|
||||||
echo "Delivery Gate 6 PASS (token + narrative checks) — proceed to Gate 5b fresh-eyes (MANDATORY)"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Readback key note.** CLI accepts lowercase `axismin` as input (on `--prop axismin=0`) but emits camelCase `axisMin` in `query --json` readback. The jq above accepts both for forward-compat.
|
|
||||||
|
|
||||||
Gate 6 is a grep floor. Gate 5b is the visual ceiling. Ship only when both print PASS.
|
|
||||||
|
|
||||||
### Honest limit
|
|
||||||
|
|
||||||
`validate` catches schema errors, not fundraising errors. A deck passes `validate` with a `$500B TAM` on a $10M market, a team slide of four co-founders with no prior companies, a hockey stick y-axis at 80%, a pitch for a Series B round without unit econ, and an ask slide saying "we're raising some money". Gates 5b + 6 above exist because `validate` cannot catch any of this.
|
|
||||||
|
|
||||||
## Known Issues & Pitfalls
|
|
||||||
|
|
||||||
→ Base pitfalls (shell escape, `[last()]` in resident, connector `@name=` rejection C-P-6, picture alt two-step C-P-7, animation remove C-P-4, chart color normalization C-P-7): see pptx v2 §Known Issues & Pitfalls C-P-1..7.
|
|
||||||
|
|
||||||
Pitch-specific:
|
|
||||||
|
|
||||||
- **Stage misidentified.** Series A deck with 6 pages of CAC/LTV math = over-packaged. Series B deck missing unit econ = incomplete. If unsure, re-read §Stage diagnosis before building.
|
|
||||||
- **Hockey-stick y-axis.** If the line chart's y-axis doesn't start at 0, VCs read it as a visual lie within 2 seconds. Always `--prop axismin=0` on ARR / revenue / growth charts. Gate 6.6 checks this.
|
|
||||||
- **Team slide = portfolio.** Cards showing only {headshot + name + role} fail VC credibility. Every card needs a prior-company or prior-achievement line. Gate 6.5 checks this.
|
|
||||||
- **TAM without methodology.** A claimed number with no "top-down" or "bottom-up" source footnote = fabricated. Pick one methodology per deck; don't mix.
|
|
||||||
- **Use-of-Funds as 3-bucket or 5-bucket.** 4-bucket (Eng / GTM / G&A / Reserve) is convention; departing from it reads as sloppy. Gate 6.4 checks presence.
|
|
||||||
- **Pitch deck used for a board review / sales deck.** Narrative arc (problem → ask) makes board reviews awkward — route to pptx v2 Recipe (d) 10-slide instead. See §Reverse handoff above.
|
|
||||||
- **pptx v2 Recipe (d′) 20-slide is a starting point, not a formula.** It is stage-agnostic SaaS. Adjust for your stage + 赛道 via §Stage diagnosis and §赛道 arc templates — never ship (d′) unchanged for a non-SaaS Series A.
|
|
||||||
|
|
||||||
## Help pointer
|
|
||||||
|
|
||||||
When in doubt: `officecli help pptx`, `officecli help pptx <element>`, `officecli help pptx <element> --json`. Help is the authoritative schema; this skill is the decision guide for fundraising deltas on top of pptx v2.
|
|
||||||
-568
@@ -1,568 +0,0 @@
|
|||||||
---
|
|
||||||
name: officecli-pptx
|
|
||||||
description: "Use this skill any time a .pptx file is involved -- as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx file; editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates, layouts, speaker notes, or comments. Trigger whenever the user mentions 'deck', 'slides', 'presentation', 'pitch', or references a .pptx filename."
|
|
||||||
---
|
|
||||||
|
|
||||||
# OfficeCLI PPTX Skill
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
If `officecli` is missing:
|
|
||||||
|
|
||||||
- **macOS / Linux**: `curl -fsSL https://d.officecli.ai/install.sh | bash`
|
|
||||||
- **Windows (PowerShell)**: `irm https://d.officecli.ai/install.ps1 | iex`
|
|
||||||
|
|
||||||
Verify with `officecli --version` (open a new terminal if PATH hasn't picked up). If install fails, download a binary from https://github.com/iOfficeAI/OfficeCLI/releases.
|
|
||||||
|
|
||||||
## ⚠️ Help-First Rule
|
|
||||||
|
|
||||||
**This skill teaches what good slides look like, not every command flag. When a property name, enum value, or alias is uncertain, consult help BEFORE guessing.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli help pptx # List all pptx elements
|
|
||||||
officecli help pptx <element> # Full element schema (e.g. shape, chart, animation, connector, zoom, group)
|
|
||||||
officecli help pptx <verb> <element> # Verb-scoped (e.g. add shape, set slide)
|
|
||||||
officecli help pptx <element> --json # Machine-readable schema
|
|
||||||
```
|
|
||||||
|
|
||||||
Help reflects the installed CLI version. When skill and help disagree, **help is authoritative**. Triggers to run help immediately: `UNSUPPORTED props:` warning, unknown animation preset, `connector.shape=` enum drifts, prop-vs-alias (`lineWidth` vs `line.width`, `color` vs `font.color`).
|
|
||||||
|
|
||||||
## Shell & Execution Discipline
|
|
||||||
|
|
||||||
**Shell quoting (zsh / bash).** ALWAYS quote element paths (`"/slide[1]/..."`) — zsh globs unquoted `[1]` to `no matches found`. Escaping happens at three layers — keep them separate (the CLI handles the second for you):
|
|
||||||
|
|
||||||
1. **Shell.** `$` in a value still belongs to the shell — single-quote the whole value: `--prop text='$15M'`. Double-quoted `"$15M"` gets expanded to `M`. The CLI does NOT unescape `\$` for you.
|
|
||||||
2. **CLI (`text=`).** The two-char escapes `\n` and `\t` ARE interpreted, consistently across pptx / docx / xlsx — `\n` is a line / paragraph break, `\t` is a tab. To produce a literal backslash-n in text, double it (`\\n`); this is rarely what you want.
|
|
||||||
3. **JSON (batch heredoc).** The recipes below pipe `cat <<EOF | officecli batch` **unquoted** so `$SLIDE` / `$FILE` expand inside the body. That same unquoted heredoc also expands a literal `$` in a value: `"$1.42"` silently becomes `.42` and `"$2.4B"` becomes `.4B` (`$1` / `$2` are empty shell params). **Escape currency as `\$`** — `"text":"\$1.42"` — which still lets `$SLIDE` expand. `\n` / `\t` inside the JSON work either way. A fully-quoted `<<'EOF'` protects every `$` but then `$SLIDE` won't expand, so only use it when the body has no shell variables. After writing money values, `view text` and confirm the `$` survived.
|
|
||||||
|
|
||||||
If in doubt, `view text` after writing and compare character-for-character.
|
|
||||||
|
|
||||||
**Incremental execution.** One command → check exit code → continue. A 50-command script that fails at command 3 cascades silently. After any structural op (new slide, chart, animation, connector) run `get` before stacking more.
|
|
||||||
|
|
||||||
## Requirements for Outputs
|
|
||||||
|
|
||||||
These are the deliverable standards every deck MUST meet. Violating any one = not done, regardless of content quality.
|
|
||||||
|
|
||||||
### All decks
|
|
||||||
|
|
||||||
**One idea per slide.** If a slide needs a second title to explain what it covers, split it. Dense "everything about X" slides lose the audience inside 3 seconds. Use a section divider to group related one-idea slides, not a mega-slide.
|
|
||||||
|
|
||||||
**Explicit type hierarchy — do NOT rely on theme defaults.** Theme defaults drift between masters. Set sizes explicitly on every text shape.
|
|
||||||
|
|
||||||
| Element | Minimum | Typical | Min shape height |
|
|
||||||
|---|---|---|---|
|
|
||||||
| Slide title | **≥ 36pt** bold | 36–44pt | ≥ 2cm |
|
|
||||||
| Section / subtitle | ≥ 20pt | 20–24pt | ≥ 1.2cm |
|
|
||||||
| Body text | **≥ 18pt** | 18–22pt | ≥ 1cm |
|
|
||||||
| Caption / axis label | ≥ 10pt muted | 10–12pt | ≥ 0.6cm |
|
|
||||||
|
|
||||||
Rule of thumb: **min shape height ≈ font_pt × 0.05cm**. An 18pt sublabel in a 0.8cm-tall box will overflow — `view annotated` catches this.
|
|
||||||
|
|
||||||
Title must be **≥ 2× body size** (36pt over 20pt works; 28pt over 20pt looks timid). Four legit exceptions to body ≥ 18pt: chart axis labels, legends, footer / page number, and ≤ 5-word KPI sublabels (e.g. "Active users"). Descriptive sentences must be ≥ 18pt. Left-align body; center only titles and hero numbers. If "the cards won't fit", drop cards instead of shrinking font.
|
|
||||||
|
|
||||||
**Two fonts max, one palette.** One heading font + one body font (e.g. Georgia + Calibri) — a third *display* face is fine only for big numerals or the cover title, as long as that heading+body pair stays intact. One dominant brand color (60–70% weight) + one supporting + one accent. Never mix 4+ colors in body content. **The palettes and font pairings in Design Principles are a floor, not a menu:** if the user gave brand colors/fonts or an existing template, match those first; otherwise the named sets are calibrated seeds — blend or diverge freely, as long as the result isn't *worse* than them and still clears the contrast floor.
|
|
||||||
|
|
||||||
**Every slide carries a non-text visual — one that informs.** Shape, chart, icon, gradient band that carries meaning, not decoration. A bullet-only deck is interchangeable with a Word doc. Exceptions: literal quote slides, code blocks, a single summary-table slide.
|
|
||||||
|
|
||||||
**Less is more — every element earns its place.** The visual rule above guards against bullet-walls; it is not licence to clutter. Don't pad with decorative stats, icons, or filler sections that don't inform ("data slop"). If a slide feels empty, fix it with layout and whitespace, not invented content — cut scope rather than bulk it up, and flag a larger addition instead of making it unprompted.
|
|
||||||
|
|
||||||
**Speaker notes on every content slide.** `--type notes --prop text="..."`. The speaker needs a script; the audience shouldn't read the slide verbatim.
|
|
||||||
|
|
||||||
**Copy reads human, not AI.** Titles orient on content, not punchline. No "It's not X. It's Y.", no manufactured tension, no faux-insight ("The magic moment"), no one-word drama ("Momentum."). Cut hype adjectives (seamless, robust, game-changing) — let the number carry it.
|
|
||||||
|
|
||||||
**Preserve existing templates.** When a file already has a theme and masters, match them. Existing conventions override these guidelines.
|
|
||||||
|
|
||||||
### Visual delivery floor (applies to EVERY deck)
|
|
||||||
|
|
||||||
Before declaring done, the per-slide render (see QA) MUST satisfy:
|
|
||||||
|
|
||||||
- **No placeholder tokens rendered as content.** `{{name}}`, `$fy$24`, `<TODO>`, `lorem`, `xxxx`, empty `()`/`[]` in chart titles never appear.
|
|
||||||
- **No overflow off-edge, no clipped text in shapes.** `view issues` flags both (`shape_off_slide` + a text-fit hint). To fix a clip: grow the box or shorten the value — never trim content to fit.
|
|
||||||
- **Cover carries its orienting elements.** Title + subtitle + presenter/client + date + a brand band or key-takeaway strap — a title-only cover reads as a stub. Generous whitespace around them is still right; rich ≠ crowded.
|
|
||||||
- **Contrast.** `view issues` auto-flags the common case — opaque dark text on a shape's own dark fill (`low_contrast`). It can't see the rest: icon / chart-series fills, scheme/inherited colors, or text over a *separate* background shape. So on any fill with brightness < 30% (`1E2761`, `36454F`, deep forest / berry / cherry), still confirm every body run, card body, chart series, and icon is `FFFFFF` or brightness > 80% — mid-gray (`6B7B8D` ≈ 44%) reads on a laptop and vanishes on projection. Spot-check via `view html` after the dark-fill pass.
|
|
||||||
|
|
||||||
If any fails, STOP and fix before declaring done.
|
|
||||||
|
|
||||||
## Design Principles
|
|
||||||
|
|
||||||
A deck is not a document. The audience has 3 seconds to get each slide. Before adding anything, ask: "If the audience reads only the biggest element and glances once, do they get the point?" If they have to read the bullets, the biggest element is wrong.
|
|
||||||
|
|
||||||
### Grid, margins, negative space
|
|
||||||
|
|
||||||
Standard widescreen is **33.87 × 19.05cm**. Treat it as a 12-column grid internally:
|
|
||||||
|
|
||||||
- **Edge margin ≥ 1.27cm** (0.5") on all sides.
|
|
||||||
- **Inter-block gap ≥ 0.76cm** (0.3") between cards / columns / rows — pick one value (0.76 or 1.27cm) and use it everywhere; mixed gaps look unfinished.
|
|
||||||
- **≥ 20% negative space per slide.** Filling every pixel reads as amateur.
|
|
||||||
- **Compose, don't web-center.** Whitespace is structural: a slide top-weighted with open space in the lower third is correct composition, not an empty defect. Intentional asymmetry (content left, breathing room right) reads more designed than centering everything — don't fill a gap just because it's there.
|
|
||||||
- For card grids: `usable = 33.87 − 2·margin − (N−1)·gap`, then `col_width = usable / N`. Don't hand-pick x coordinates.
|
|
||||||
|
|
||||||
### Font pairings
|
|
||||||
|
|
||||||
Pair by document register, not by novelty. "Best For" is a prompt, not a decree; a pairing outside this table is fine if it fits — these 8 are seeds, not the set.
|
|
||||||
|
|
||||||
| Header | Body | Best For |
|
|
||||||
|---|---|---|
|
|
||||||
| Georgia | Calibri | Formal business, finance, executive reports |
|
|
||||||
| Arial Black | Arial | Bold marketing, product launches |
|
|
||||||
| Calibri | Calibri Light | Clean corporate, minimal design |
|
|
||||||
| Cambria | Calibri | Traditional professional, legal, academic |
|
|
||||||
| Trebuchet MS | Calibri | Friendly tech, startups, SaaS |
|
|
||||||
| Impact | Arial | Bold headlines, event decks, keynotes |
|
|
||||||
| Palatino | Garamond | Elegant editorial, luxury, nonprofit |
|
|
||||||
| Consolas | Calibri | Developer tools, technical / engineering |
|
|
||||||
|
|
||||||
Set both fonts explicitly on every shape (`--prop font=Georgia` on titles, `--prop font=Calibri` on body), not via theme inheritance.
|
|
||||||
|
|
||||||
### Color and contrast
|
|
||||||
|
|
||||||
The columns: **Primary** (dominant — 60–70% of weight, the color you see first), **Secondary** (supporting tone), **Accent** (sparing, one-hit emphasis), **Text** (body on light fills), **Muted** (captions / axis labels / footer).
|
|
||||||
|
|
||||||
| Theme | Primary | Secondary | Accent | Text | Muted |
|
|
||||||
|---|---|---|---|---|---|
|
|
||||||
| Coral Energy | `F96167` | `F9E795` | `2F3C7E` | `333333` | `8B7E6A` |
|
|
||||||
| Midnight Executive | `1E2761` | `CADCFC` | `FFFFFF` | `333333` | `8899BB` |
|
|
||||||
| Forest & Moss | `2C5F2D` | `97BC62` | `F5F5F5` | `2D2D2D` | `6B8E6B` |
|
|
||||||
| Charcoal Minimal | `36454F` | `F2F2F2` | `212121` | `333333` | `7A8A94` |
|
|
||||||
| Warm Terracotta | `B85042` | `E7E8D1` | `A7BEAE` | `3D2B2B` | `8C7B75` |
|
|
||||||
| Berry & Cream | `6D2E46` | `A26769` | `ECE2D0` | `3D2233` | `8C6B7A` |
|
|
||||||
| Ocean Gradient | `065A82` | `1C7293` | `21295C` | `2B3A4E` | `6B8FAA` |
|
|
||||||
| Teal Trust | `028090` | `00A896` | `02C39A` | `2D3B3B` | `5E8C8C` |
|
|
||||||
| Sage Calm | `84B59F` | `69A297` | `50808E` | `2D3D35` | `7A9488` |
|
|
||||||
| Cherry Bold | `990011` | `FCF6F5` | `2F3C7E` | `333333` | `8B6B6B` |
|
|
||||||
|
|
||||||
Pick by topic, not by default — finance reads Midnight Executive, a product launch reads Coral Energy, safety / LOTO reads Cherry Bold. If the closest named theme is not quite right, blend (e.g. Forest primary + gold `D4A843` accent). Use **Text** on light fills, **Muted** for captions / axis / footer, `FFFFFF` or Secondary for body on dark fills.
|
|
||||||
|
|
||||||
On dark backgrounds, text and chart series follow the Hard rules contrast floor above.
|
|
||||||
|
|
||||||
### Chart-choice decision table
|
|
||||||
|
|
||||||
Wrong chart type kills the 3-second test:
|
|
||||||
|
|
||||||
| Data shape | Use | Avoid |
|
|
||||||
|---|---|---|
|
|
||||||
| Category comparison (A vs B vs C) | `column` (vertical) / `bar` (≥ 6 categories, horizontal) | pie (slices merge), line (no time axis) |
|
|
||||||
| Time series, 1–3 series | `line` | area (occlusion), bar (implies discrete) |
|
|
||||||
| Part-of-whole, 2–5 slices | `pie` / `doughnut` | pie with 8+ slices (unreadable) |
|
|
||||||
| Correlation / distribution | `scatter` | line (implies ordering) |
|
|
||||||
| Multiple categories × metrics, dense | stacked `column` or heatmap | one chart per metric — consolidate |
|
|
||||||
| KPI snapshot (single big number) | **Large-text shape** (60–72pt + ≤ 5-word sublabel), NOT a chart | gauge chart, tiny bar |
|
|
||||||
|
|
||||||
Rule of thumb: if > 3 series and > 8 categories, split into two charts or switch to a table.
|
|
||||||
|
|
||||||
### Animation
|
|
||||||
|
|
||||||
Use as much or as little as the brand and content call for — a formal finance deck trends to near-zero, a product launch can be more expressive. Animation is a tool, not décor. Three floors keep it from hurting the deck (none caps how much you use):
|
|
||||||
|
|
||||||
- **Purposeful** — each one reveals or emphasizes (progressive bullet reveal, a build-up chart), never decorates. If it doesn't aid comprehension, cut it.
|
|
||||||
- **Degrades gracefully** — pptx animation renders inconsistently across viewers (Keynote / Slides / web / mobile) and may not play at all, so every slide must read correctly as a *static* frame. Never hide essential content behind a reveal.
|
|
||||||
- **Verify live** — animation is runtime-only; `view html` and screenshots can't see it, so confirm in a real presentation viewer before shipping.
|
|
||||||
|
|
||||||
Taste steer (not a ban): `fade` / `appear` / a single `zoom-entrance` with snappy durations (~hundreds of ms) fit most decks; `bounce` / `swivel` / `spin` / `fly-from-edge` / dense multi-object choreography usually read amateur — reach for them only when the brand is deliberately playful.
|
|
||||||
|
|
||||||
### Layout patterns & data display
|
|
||||||
|
|
||||||
Vary layout across slides — repeating the same pattern makes every slide feel identical. These are common building blocks, not the full set — pick one per slide, or build a layout outside the table when the content calls for it:
|
|
||||||
|
|
||||||
| Pattern | When to use | Key measurement |
|
|
||||||
|---|---|---|
|
|
||||||
| **Two-column** (text left, visual right) | Concept + evidence; feature + screenshot | Each col ≈ 14-15cm; gap 1cm |
|
|
||||||
| **Icon rows** (icon in filled circle + bold header + description) | Feature lists, benefits, team roles | Icon circle 1.5-2cm; 3-4 rows max |
|
|
||||||
| **2×2 or 2×3 grid** (card tiles) | Quadrant analysis, SWOT, option comparison | Gap ≥ 0.76cm; consistent card height |
|
|
||||||
| **Half-bleed image** (full left or right half, content overlay on other side) | Hero moments, case study openers | Image 16-17cm wide; content column ≥ 14cm |
|
|
||||||
| **Large stat callout** (60-72pt number + ≤5-word sublabel below) | Single KPI, milestone, market size | Use shape, NOT a chart; sublabel 14-16pt muted |
|
|
||||||
|
|
||||||
**Data display quick rules:**
|
|
||||||
- Comparison columns (before/after, A vs B) beat a table for 2-3 options.
|
|
||||||
- Timelines and process flows: numbered step shapes + connectors, not a bullet list.
|
|
||||||
|
|
||||||
### Image treatment (only when a slide uses a photo / screenshot / logo)
|
|
||||||
|
|
||||||
**Read the image first** (open the file) and choose treatment from what you see — don't place blind from a filename.
|
|
||||||
|
|
||||||
- **Full-bleed photo** → size to COVER the region (crop edges), no border.
|
|
||||||
- **Screenshot / diagram / logo** → size to FIT (never crop content). A transparent or fit image sits on a contrasting fill — drop a colored rectangle behind it, don't let it float on white.
|
|
||||||
- **Text over a photo** → never raw on the image. Put it on a card, or lay a protection scrim between image and text (a dark rectangle at ~50–60% opacity, or a gradient fading from the text edge).
|
|
||||||
- Never stretch (distort the aspect ratio); don't overlay text on a busy screenshot.
|
|
||||||
- Prefer user-provided images / brand assets; no emoji or self-drawn art unless asked.
|
|
||||||
|
|
||||||
### Visual motif commitment
|
|
||||||
|
|
||||||
Pick ONE distinctive element (rounded image frames, section numbers in filled circles, single-side border band, diagonal accent strips) and carry it to every slide — commit across the whole deck; styling one slide and leaving the rest plain reads as abandoned. A secondary motif is fine only if it doesn't compete with the primary. Declare it in your build plan first: `## Motif: numbered circles in brand color`.
|
|
||||||
|
|
||||||
### Visual AI-tells to avoid
|
|
||||||
|
|
||||||
- **No decorative underline under slide titles.** A stripe / rule below a heading is the single most common AI-slide tell — use whitespace or a background-color change instead.
|
|
||||||
- **No rounded-corner card with a colored left-border accent stripe.** The other classic AI-slide tell — use a solid fill, a top accent band, or whitespace separation instead.
|
|
||||||
- **No emoji as iconography** unless the brand uses them — use a shape or a real icon asset.
|
|
||||||
|
|
||||||
Copy-level tells live in "Copy reads human".
|
|
||||||
|
|
||||||
## Common Workflow
|
|
||||||
|
|
||||||
1. **Open/save lifecycle.** `officecli open <file>` at the start, `officecli save <file>` at the end to flush your edits to disk. `save` only writes — it leaves the resident warm for any follow-up edit; reach for `officecli close <file>` only when you want to release the resident immediately (a one-shot handoff). Both are always safe — they never error or lose work. Use `batch` for repetitive shape grids. **Flush only at the non-officecli boundary:** officecli's own reads always see your edits; run `save`/`close` only before a non-officecli program reads the file (python-pptx, PowerPoint, a renderer, delivery).
|
|
||||||
2. **Orient.** New deck: `officecli create "$FILE"`. Existing: `officecli view "$FILE" outline` first. Never edit blind.
|
|
||||||
3. **Title sequence first (plan, don't build yet).** Before creating any slide or shape, write out the full ordered list of slide titles. If someone reading ONLY the titles can't follow the argument, fix the arc now — cheaper in a list than after 14 slides. Pick ONE title grammar — all topic noun-phrases or all action statements, never a mix — and hold it throughout (see "Copy reads human").
|
|
||||||
4. **Build in display order.** Add slides in audience-view order: cover → agenda → section-1 divider → section-1 content → section-2 divider → … → closing. `--index` on slide add works, but linear append keeps the build script readable and avoids index-arithmetic bugs. **Before final delivery, confirm slide count + narrative arc match your build plan.** Gate 3's order-sanity check catches cases where the cover ends up as slide 11 of 14 instead of slide 1.
|
|
||||||
5. **Incremental per slide.** Create slide + background, then title, then supporting shapes / charts / connectors. Always `layout=blank` for custom designs. After each structural op, `get /slide[N] --depth 1` to confirm shape IDs.
|
|
||||||
6. **Format to spec.** Per the Requirements table; formatting is deliverable, not polish.
|
|
||||||
7. **Save + verify.** `officecli save` flushes the file to disk (or `officecli close` to flush and also end the session). Always open in the target presentation viewer before shipping — chart colors, animations, fonts, and zoom are runtime features `view html` can't render. Full verification in QA below.
|
|
||||||
8. **QA — assume there are problems.** Fix-and-verify until a cycle finds zero new issues.
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
Minimal viable deck: cover + one content slide + notes. `$FILE` stands in for your filename.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
FILE="deck.pptx"
|
|
||||||
officecli create "$FILE"
|
|
||||||
officecli open "$FILE"
|
|
||||||
|
|
||||||
# Cover — dark fill, centered title
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761
|
|
||||||
officecli add "$FILE" /slide[1] --type shape --prop text="FY26 Strategic Review" \
|
|
||||||
--prop x=2cm --prop y=7cm --prop width=29.87cm --prop height=3cm \
|
|
||||||
--prop font=Georgia --prop size=44 --prop bold=true --prop color=FFFFFF --prop align=center
|
|
||||||
|
|
||||||
# Content — white fill, title + body + notes
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" /slide[2] --type shape --prop text="Revenue grew 18% YoY" \
|
|
||||||
--prop x=1.5cm --prop y=1.2cm --prop width=30cm --prop height=2cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761
|
|
||||||
officecli add "$FILE" /slide[2] --type shape --prop text="Enterprise renewals + new EMEA region drove the beat; NRR held at 118%." \
|
|
||||||
--prop x=1.5cm --prop y=4cm --prop width=30cm --prop height=3cm \
|
|
||||||
--prop font=Calibri --prop size=20 --prop color=333333
|
|
||||||
officecli add "$FILE" /slide[2] --type notes --prop text="Lead with the 18% beat, preview EMEA."
|
|
||||||
|
|
||||||
officecli save "$FILE"
|
|
||||||
officecli validate "$FILE"
|
|
||||||
```
|
|
||||||
|
|
||||||
Shape of every build: open → slide+background → title → body → notes → save → validate.
|
|
||||||
|
|
||||||
## Reading & Analysis
|
|
||||||
|
|
||||||
Start wide, then narrow. `outline` first, `view text` / `get` / `query` once you know where to look.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli view "$FILE" outline # slide count + titles
|
|
||||||
officecli view "$FILE" annotated # complete per-slide breakdown with fonts, sizes, tables, charts
|
|
||||||
officecli view "$FILE" text --start 1 --end 5 # text dump (includes table cell text)
|
|
||||||
officecli view "$FILE" issues # empty slides, overflow hints
|
|
||||||
officecli view "$FILE" stats # counts + totals (incl. pictures missing alt)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Inspect one element.** XPath-style paths, 1-based. ALWAYS quote. Prefer `@name=` / `@id=` selectors over positional `[N]` (stable across reorderings). `[last()]` works. Add `--json` for machine output.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli get "$FILE" "/slide[1]" --depth 1 # shape list with IDs and names
|
|
||||||
officecli get "$FILE" "/slide[1]/shape[@name=Title]"
|
|
||||||
officecli get "$FILE" "/slide[1]/table[1]" --depth 3 # table rows / cells
|
|
||||||
```
|
|
||||||
|
|
||||||
**Query across the deck.** CSS-like selectors; operators `=`, `!=`, `~=`, `>=`, `<=`, `[attr]`, `:contains()`, `:no-alt`. `help pptx query` lists queryable element types.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli query "$FILE" 'shape:contains("Revenue")'
|
|
||||||
officecli query "$FILE" 'picture:no-alt' # accessibility gap
|
|
||||||
officecli query "$FILE" 'shape[fill=1E2761]' # color match
|
|
||||||
officecli query "$FILE" 'shape[width>=10cm]' # numeric
|
|
||||||
```
|
|
||||||
|
|
||||||
**`query --json` output schema.** Results wrap in `.data.results[]` — `jq -r '.data.results[0].format.id'`, NOT `.[0].id`. Shape name is `.name`; fill is `.format.fill`; textColor is `.format.textColor`.
|
|
||||||
|
|
||||||
**Visual preview (LEAD).**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli view "$FILE" html # prints an HTML preview path; Read it for per-slide visual audit (best structural ground truth)
|
|
||||||
officecli view "$FILE" svg --start 3 --end 3 # single slide SVG (charts + gradients do NOT render in SVG)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Reading the output — an expected non-defect:**
|
|
||||||
- **`layout=blank` has no title placeholder.** Titles are plain `shape` elements, so `view outline` reporting `(untitled)` is **expected**, not a defect. Use `layout=title` + `placeholder[title]` only when screen-reader outline compatibility matters.
|
|
||||||
|
|
||||||
## Creating & Editing
|
|
||||||
|
|
||||||
Verbs: `add` / `set` / `remove` / `move` / `swap` / `batch` / `raw-set`. Ninety percent of a deck is slides, shapes, text, a few charts, pictures, connectors.
|
|
||||||
|
|
||||||
### Slides and backgrounds
|
|
||||||
|
|
||||||
A slide is `/slide[N]`. Always pass `layout=blank` for custom designs. Background: solid, gradient, or image.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761 # solid
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop "background=1E2761-CADCFC-180" # gradient (start-end-angle)
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=image:/path/to/hero.jpg # image background (LEAD)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Shapes
|
|
||||||
|
|
||||||
A `shape` holds text, fill, border, position, and optional animation / link.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /slide[2] --type shape --prop name=Title --prop text="Key Insight" \
|
|
||||||
--prop x=2cm --prop y=2cm --prop width=20cm --prop height=3cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761 --prop fill=none
|
|
||||||
```
|
|
||||||
|
|
||||||
Positioning is explicit — no layout engine, you own the grid math. `--prop preset=` picks geometry (`rect`, `roundRect`, `ellipse`, `triangle`, `arrow`, `star5`, ...); custom `M...Z` paths are not supported — pick a preset. **Name shapes at creation** (`--prop name=HeroTitle`) and address later with `"/slide[N]/shape[@name=HeroTitle]"` — names survive z-order / remove-then-add, whereas positional `/shape[3]` (and even `@id=`) shift. Re-`get --depth 1` after any structural change before using positional indexes.
|
|
||||||
|
|
||||||
### Text inside shapes (paragraphs, runs, styling)
|
|
||||||
|
|
||||||
A shape has paragraphs (`paragraph[K]`) and runs (`run[K]`). For one-line text, `--prop text=` on the shape is enough; a `\n` in the text makes a paragraph break, `\t` a tab (see Shell & Execution Discipline; double `\\n` for a literal). `add --type paragraph` takes the same style props as a shape (text, align, bold, italic, size, color, font). For mixed styling *within* a line, append a styled run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" "/slide[2]/shape[@name=Card1]/paragraph[1]" --type run \
|
|
||||||
--prop text=" (inline detail)" --prop size=14 --prop italic=true --prop color=8899BB
|
|
||||||
```
|
|
||||||
|
|
||||||
### Charts
|
|
||||||
|
|
||||||
Pick chart type per the Design Principles chart-choice table. Full prop list (chartType enum, `seriesN.*`, `data=`/`categories=`, axis options): `help pptx add chart`. Typical multi-series with brand colors:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /slide[3] --type chart --prop chartType=column \
|
|
||||||
--prop series1.name=Revenue --prop series1.values="42,45,48" --prop series1.color=1E2761 \
|
|
||||||
--prop series2.name=Growth --prop series2.values="2,7,7" --prop series2.color=CADCFC \
|
|
||||||
--prop categories="Q1,Q2,Q3" \
|
|
||||||
--prop x=2cm --prop y=4cm --prop width=20cm --prop height=10cm
|
|
||||||
```
|
|
||||||
|
|
||||||
Gotchas: (1) chart titles with `()`, `[]`, `TBD` ship as literal text. (2) some viewers normalize chart colors to theme defaults — verify in the target viewer. Series can be added after creation (`add --type series`).
|
|
||||||
|
|
||||||
### Pictures
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /slide[4] --type picture --prop src=hero.jpg \
|
|
||||||
--prop x=1cm --prop y=1cm --prop width=32cm --prop height=18cm \
|
|
||||||
--prop alt="Product hero, gradient lit from right"
|
|
||||||
```
|
|
||||||
|
|
||||||
Confirm with `officecli query "$FILE" 'picture:no-alt'` — must be empty before delivery.
|
|
||||||
|
|
||||||
### Connectors (LEAD — flowcharts / decision trees first-class)
|
|
||||||
|
|
||||||
Draws a line between two shapes or free coordinates. Full prop / enum reference (`shape`, `headEnd`/`tailEnd` values, `from`/`to` ref forms): `help pptx add connector`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /slide[5] --type connector \
|
|
||||||
--prop "from=/slide[5]/shape[@name=BoxA]" --prop "to=/slide[5]/shape[@name=BoxB]" \
|
|
||||||
--prop shape=elbow --prop color=333333 --prop tailEnd=triangle
|
|
||||||
```
|
|
||||||
|
|
||||||
**Every flow connector needs an arrowhead.** Without one, `bentConnector3` renders as a directionless line. `preset=rightArrow` overlay only works for horizontal flows; diamonds / decision trees with diverging edges need `tailEnd=`.
|
|
||||||
|
|
||||||
### Animations (LEAD)
|
|
||||||
|
|
||||||
Use per the Animation floors above (purposeful, degrades gracefully, verify live). Preset names + duration syntax: `help pptx animation`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" "/slide[2]/shape[@name=HeroCard]" --prop animation=fade-entrance-400
|
|
||||||
officecli set "$FILE" "/slide[2]/shape[@name=HeroCard]" --prop animation=none # clear all
|
|
||||||
```
|
|
||||||
|
|
||||||
### Hyperlinks, tooltips, slide-jump
|
|
||||||
|
|
||||||
`--prop link=slide[N]` for an in-deck jump (1-based; target slide must exist), `link=nextslide` / `firstslide` / `lastslide` / `previousslide` / `endshow` for named navigation, `link=https://...` for a URL, `--prop tooltip="..."` for hover text.
|
|
||||||
|
|
||||||
### Tables, placeholders, groups, zoom — one-liners
|
|
||||||
|
|
||||||
- **Tables** — `--type table --prop rows=N --prop cols=M`. Row-level `set` supports `height` and `c1/c2/c3` (seed cell text). Header-row styling is table-level (`firstRow=true` / `headerFill=`), not a row prop. Cell formatting lives on the cell paragraph / run. Populate rows BEFORE setting table-level font (font cascade gets reset by row ops).
|
|
||||||
- **Placeholders** — `"/slide[N]/placeholder[title]"` / `placeholder[body]`. Available only when the slide uses a layout with placeholders (not `layout=blank`).
|
|
||||||
- **Groups** (LEAD) — address children via `"/slide[N]/group[@name=G]/shape[1]"`. Survives reordering better than positional indexes.
|
|
||||||
- **Zoom slide** (LEAD) — `--type zoom --prop target=N` (one link per target; alias `slide`). Emit N separate zoom shapes for a multi-target nav hub. Zoom is a runtime feature — `view html` shows the static geometry; the zoom interaction runs only in a live presentation viewer.
|
|
||||||
- **Slide comments** — reviewer annotations anchored at `/slide[N]/comment[M]`. Full lifecycle (`add / set / get / query / remove`). Props: `text`, `author`, `initials` (auto-derived), `date` (ISO 8601, defaults to UtcNow), `x` / `y` (length anchor).
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" "/slide[2]" --type comment --prop author="Alice" --prop text="Tighten this bullet" --prop x=20cm --prop y=3cm
|
|
||||||
officecli query "$FILE" 'comment' --json | jq '.data.results | length' # count all review comments
|
|
||||||
officecli remove "$FILE" "/slide[2]/comment[1]" # resolve after addressing
|
|
||||||
```
|
|
||||||
|
|
||||||
### Deck-level recipes
|
|
||||||
|
|
||||||
Patterns not obvious from the primitives. Each gives the **visual outcome** first, then a runnable block. `$FILE` = your filename. Use `/slide[last()]` to address the slide you just added. The recipes demonstrate **structure and coordinate math** — swap in the palette / fonts you chose for this topic; the navy `1E2761` + Georgia is just the example's theme, not a house style to copy verbatim.
|
|
||||||
|
|
||||||
**Z-order.** Later-added shapes are on top. Add background decoration FIRST, titles LAST. To fix after the fact: `--prop zorder=back/front` (renumbers siblings — re-`get --depth 1` before stacking more).
|
|
||||||
|
|
||||||
#### (a) Cover (and section divider)
|
|
||||||
|
|
||||||
**Visual outcome.** Dark navy fill, centered 44pt title, 18pt ice-blue meta line.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=1E2761
|
|
||||||
officecli add "$FILE" "/slide[last()]" --type shape --prop text="Strategic Growth Review" \
|
|
||||||
--prop x=2cm --prop y=7cm --prop width=29.87cm --prop height=3cm \
|
|
||||||
--prop font=Georgia --prop size=44 --prop bold=true --prop color=FFFFFF --prop align=center
|
|
||||||
officecli add "$FILE" "/slide[last()]" --type shape --prop text="Prepared for Acme Leadership — FY26 Outlook" \
|
|
||||||
--prop x=2cm --prop y=11cm --prop width=29.87cm --prop height=1.2cm \
|
|
||||||
--prop font=Calibri --prop size=18 --prop color=CADCFC --prop align=center
|
|
||||||
```
|
|
||||||
|
|
||||||
**Section divider** = same cover, plus a giant translucent number (`size=120`, `opacity=0.15`) added FIRST so it sits behind the section title.
|
|
||||||
|
|
||||||
#### (b) Data slide (chart + commentary block)
|
|
||||||
|
|
||||||
**Visual outcome.** Left two-thirds: column chart with brand series colors. Right one-third: "Key Insight" card with 20pt heading + 18pt body — audience reads the takeaway before parsing the bars.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" / --type slide --prop layout=blank --prop background=FFFFFF
|
|
||||||
officecli add "$FILE" "/slide[last()]" --type shape --prop text="FY26 Revenue Beat Plan by 18%" \
|
|
||||||
--prop x=1.5cm --prop y=1cm --prop width=30cm --prop height=1.8cm \
|
|
||||||
--prop font=Georgia --prop size=36 --prop bold=true --prop color=1E2761
|
|
||||||
|
|
||||||
# Chart — left 2/3 (single-quote the title because of `$`)
|
|
||||||
officecli add "$FILE" "/slide[last()]" --type chart --prop chartType=column \
|
|
||||||
--prop series1.name=Actual --prop series1.values="42,45,48,55" --prop series1.color=1E2761 \
|
|
||||||
--prop series2.name=Plan --prop series2.values="40,42,45,48" --prop series2.color=CADCFC \
|
|
||||||
--prop categories="Q1,Q2,Q3,Q4" --prop x=1.5cm --prop y=3.5cm --prop width=20cm --prop height=14cm --prop title='FY26 Revenue ($M)'
|
|
||||||
|
|
||||||
# Commentary card — right 1/3: background + heading + body
|
|
||||||
officecli add "$FILE" "/slide[last()]" --type shape --prop preset=roundRect --prop fill=F5F7FA --prop line=none \
|
|
||||||
--prop x=22.5cm --prop y=3.5cm --prop width=9.8cm --prop height=14cm
|
|
||||||
officecli add "$FILE" "/slide[last()]" --type shape --prop text="Key Insight" \
|
|
||||||
--prop x=23cm --prop y=4cm --prop width=9cm --prop height=1.2cm \
|
|
||||||
--prop font=Georgia --prop size=20 --prop bold=true --prop color=1E2761
|
|
||||||
officecli add "$FILE" "/slide[last()]" --type shape --prop text="EMEA launch + NRR at 118% drove 12pp of the 18pp beat." \
|
|
||||||
--prop x=23cm --prop y=5.5cm --prop width=9cm --prop height=11cm \
|
|
||||||
--prop font=Calibri --prop size=18 --prop color=333333
|
|
||||||
```
|
|
||||||
|
|
||||||
#### (c) Flowchart / process diagram (boxes + connectors)
|
|
||||||
|
|
||||||
**Visual outcome.** Four rounded boxes across at y=8cm, each 6×3cm, alternating navy/iceblue, joined by elbow connectors with triangle arrowheads.
|
|
||||||
|
|
||||||
Grid math (4 boxes, 33.87cm slide, 1.5cm margins): `gap = (33.87 − 3 − 24) / 3 = 2.29cm`. x-positions: `1.5, 9.79, 18.08, 26.37`.
|
|
||||||
|
|
||||||
Each box carries its own label via `valign=middle` (no separate overlay shape needed). Use `batch` heredoc for portable coordinate arithmetic — no `bc`, no bash arrays.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<EOF | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"Step1","preset":"roundRect","fill":"1E2761","line":"none","x":"1.5cm","y":"8cm","width":"6cm","height":"3cm","text":"Step 1","font":"Georgia","size":"20","bold":"true","color":"FFFFFF","align":"center","valign":"middle"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"Step2","preset":"roundRect","fill":"CADCFC","line":"none","x":"9.79cm","y":"8cm","width":"6cm","height":"3cm","text":"Step 2","font":"Georgia","size":"20","bold":"true","color":"1E2761","align":"center","valign":"middle"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"Step3","preset":"roundRect","fill":"1E2761","line":"none","x":"18.08cm","y":"8cm","width":"6cm","height":"3cm","text":"Step 3","font":"Georgia","size":"20","bold":"true","color":"FFFFFF","align":"center","valign":"middle"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"Step4","preset":"roundRect","fill":"CADCFC","line":"none","x":"26.37cm","y":"8cm","width":"6cm","height":"3cm","text":"Step 4","font":"Georgia","size":"20","bold":"true","color":"1E2761","align":"center","valign":"middle"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Connector pattern — reuse for any box-to-box graph.
|
|
||||||
for pair in "Step1 Step2" "Step2 Step3" "Step3 Step4"; do
|
|
||||||
A=${pair% *}; B=${pair#* }
|
|
||||||
officecli add "$FILE" "/slide[$SLIDE]" --type connector \
|
|
||||||
--prop "from=/slide[$SLIDE]/shape[@name=$A]" \
|
|
||||||
--prop "to=/slide[$SLIDE]/shape[@name=$B]" \
|
|
||||||
--prop shape=elbow --prop color=333333 --prop tailEnd=triangle
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
`shape=elbow` is canonical (`bentConnector2` / `bentConnector3` also accepted).
|
|
||||||
|
|
||||||
#### (d) Multi-slide deck skeletons
|
|
||||||
|
|
||||||
No code block — it's a rhythm. The sequences below are **illustrations of one working cadence (alternating dark dividers with white content), not required running orders** — derive your actual arc from the content first (see "Title sequence first"), then borrow whatever divider/content rhythm fits:
|
|
||||||
|
|
||||||
- **10-slide review:** Cover · Agenda · 3 KPI · Div01 · Chart · Chart · Div02 · Flow · Timeline · Close
|
|
||||||
- **20-slide pitch:** same rhythm × 2, sectioned Problem · Solution · Market · Product · Traction · Model · Team · Financials · Ask
|
|
||||||
- Every divider must appear **before** its section content (Gate 3 order sanity)
|
|
||||||
- Cover/divider = (a); chart pages = (b); process pages = (c); KPI pages = (e); decision pages = (f)
|
|
||||||
|
|
||||||
#### (e) KPI callouts — giant-number card grid
|
|
||||||
|
|
||||||
**Visual outcome.** Three or four giant numbers across a row; each card = unit sublabel + small percent-change chip + one-line takeaway. The single most common exec-deck element.
|
|
||||||
|
|
||||||
**Sizing rule.** 60pt Georgia bold fits ~5 chars in a 9.78cm card (`$84.2`, `118%`, `24.5`). For longer values (`$84.2M`), split: `$84.2` as the big number, `USD millions` as the sublabel — never shrink the font to chase a unit suffix, it just wraps.
|
|
||||||
|
|
||||||
Grid math (3 cards, 1.5cm margins, 0.76cm gap): `col_width = (33.87 − 3 − 1.52) / 3 = 9.78cm`. x-positions: `1.5, 12.04, 22.58`. Use accent color on a single "watch" card so risk reads in one second.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Two cards: navy standard + terracotta watch. Each = bg + big number + sublabel + chip.
|
|
||||||
cat <<EOF | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"preset":"roundRect","fill":"1E2761","line":"none","x":"1.5cm","y":"4cm","width":"9.78cm","height":"7cm"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"84.2","x":"1.5cm","y":"4.8cm","width":"9.78cm","height":"2.8cm","font":"Georgia","size":"60","bold":"true","color":"FFFFFF","align":"center"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"USD millions · ARR","x":"1.5cm","y":"8cm","width":"9.78cm","height":"0.8cm","font":"Calibri","size":"14","color":"CADCFC","align":"center"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"+24% YoY","x":"1.5cm","y":"9cm","width":"9.78cm","height":"0.8cm","font":"Calibri","size":"14","bold":"true","color":"CADCFC","align":"center"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"preset":"roundRect","fill":"B85042","line":"none","x":"22.58cm","y":"4cm","width":"9.78cm","height":"7cm"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"\$1.42","x":"22.58cm","y":"4.8cm","width":"9.78cm","height":"2.8cm","font":"Georgia","size":"60","bold":"true","color":"FFFFFF","align":"center"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"CAC payback (yrs)","x":"22.58cm","y":"8cm","width":"9.78cm","height":"0.8cm","font":"Calibri","size":"14","color":"FFFFFF","align":"center"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"text":"+8% — watch","x":"22.58cm","y":"9cm","width":"9.78cm","height":"0.8cm","font":"Calibri","size":"14","bold":"true","color":"FFFFFF","align":"center"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
#### (f) Decision tree — YES/NO branching
|
|
||||||
|
|
||||||
**Visual outcome.** Diamond at top-center; YES/NO child boxes diverging left-right; both converge into a shared terminal box. Layout: diamond at `x=13.94, y=2cm, 6×3cm`; YES at `3cm, 7.5cm`; NO at `22.87cm, 7.5cm`; terminal at `13.94cm, 13cm`. Convention: red = stop/escalate, blue = standard, green = safe terminal. **Every connector needs an arrowhead** — readers misparse direction otherwise.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<EOF | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"Decide","preset":"diamond","fill":"1E2761","line":"none","x":"13.94cm","y":"2cm","width":"6cm","height":"3cm","text":"Hazardous energy present?","font":"Calibri","size":"14","bold":"true","color":"FFFFFF","align":"center","valign":"middle"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"YesBox","preset":"roundRect","fill":"B85042","line":"none","x":"3cm","y":"7.5cm","width":"8cm","height":"3cm","text":"Lockout + Tagout + Verify","font":"Calibri","size":"16","bold":"true","color":"FFFFFF","align":"center","valign":"middle"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"NoBox","preset":"roundRect","fill":"CADCFC","line":"none","x":"22.87cm","y":"7.5cm","width":"8cm","height":"3cm","text":"Proceed with standard PPE","font":"Calibri","size":"16","bold":"true","color":"1E2761","align":"center","valign":"middle"}},
|
|
||||||
{"command":"add","parent":"/slide[$SLIDE]","type":"shape","props":{"name":"Done","preset":"roundRect","fill":"2C5F2D","line":"none","x":"13.94cm","y":"13cm","width":"6cm","height":"2.5cm","text":"Begin service","font":"Calibri","size":"16","bold":"true","color":"FFFFFF","align":"center","valign":"middle"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
Then 4 connectors (`Decide→YesBox`, `Decide→NoBox`, `YesBox→Done`, `NoBox→Done`) using the connector loop pattern from (c).
|
|
||||||
|
|
||||||
## QA (Required)
|
|
||||||
|
|
||||||
**Assume there are problems.** First render is almost never correct. If you found zero issues, you were not looking hard enough.
|
|
||||||
|
|
||||||
### Delivery Gate (any failure = REJECT, do NOT deliver)
|
|
||||||
|
|
||||||
Gates 1–2b are text/schema-level (cannot see a rendered slide); Gate 3 is the only visual check. Done = every gate PASS **and** Gate 3 loop converged.
|
|
||||||
|
|
||||||
Each gate is **run a command, judge its output** — the officecli commands are identical on every OS (macOS / Linux / Windows), so no shell scripting is needed; the judging is yours.
|
|
||||||
|
|
||||||
- **Gate 1 — schema.** `officecli validate "<file>"`. Any schema error → REJECT and fix.
|
|
||||||
- **Gate 2 — overflow / format / structure.** `officecli view "<file>" issues`. If it lists *any* issue (lines tagged `[O1]`, `[C1]`, `[S1]`, …) → REJECT, fix, re-run until clean.
|
|
||||||
- **Gate 2b — leftover placeholders.** `officecli view "<file>" text`, then scan the output for `xxxx`, `lorem` / `ipsum`, `<TODO>`, `placeholder`, "this slide layout", or empty `()` / `[]`. Any hit → REJECT.
|
|
||||||
|
|
||||||
### Gate 3 — Visual audit (MANDATORY)
|
|
||||||
|
|
||||||
Pick **one** path:
|
|
||||||
|
|
||||||
**Screenshot (default)** — for vision-capable agents. Screenshot each slide in turn — `officecli view "<file>" screenshot --page 1 -o slide1.png`, then `--page 2`, … — until the page index runs past the deck (one screenshot = one slide). If it errors on page 1, use the fallback below.
|
|
||||||
|
|
||||||
**Judge every PNG against the checklist, adversarially** — "assume problems exist; finding none means you didn't look hard enough." Report one `slide N: <issue>` line per problem, or `PASS`. This step is required however you run it. **If** your harness can spawn a subagent, delegate the judging to a *fresh, independent* one — the agent that built the deck is biased toward "looks fine", a separate pair of eyes is more critical — handing it the screenshots + this checklist and the same adversarial framing. No subagent? Do exactly the same yourself.
|
|
||||||
|
|
||||||
**Fallback — HTML-text** (no vision, or screenshot failed): read `view "$FILE" html` as text. DOM cannot prove **dark-on-dark / fine overlap / arrowheads / gap-margin metrics / column alignment** — flag these as "not visually verified" rather than PASS.
|
|
||||||
|
|
||||||
**Optional `--grid N`** — only on user request for layout-rhythm, or when `view outline` shows anomalous layout distribution: `officecli view "<file>" screenshot --grid 3 -o grid.png`.
|
|
||||||
|
|
||||||
**Per-slide checklist (assume issues exist):**
|
|
||||||
|
|
||||||
- **overlap** — shapes / charts / giant decorative numbers (01/02/03 100pt+) colliding
|
|
||||||
- **text overflow** — clipped at slide or shape boundary (KPI cards, narrow boxes)
|
|
||||||
- **narrow text box** — content fits technically but wraps to many short lines (1–2 words each); long sublabel in a 3cm KPI card, body line in a too-tight column
|
|
||||||
- **dark-on-dark** — fill brightness < 30% with text/icon brightness < 80% (incl. dark icons on dark without a contrasting circle)
|
|
||||||
- **image treatment** — photo stretched/distorted, text raw on a busy image (no card/scrim), screenshot or logo cropped, transparent image floating on white
|
|
||||||
- **missing arrowheads** — flowchart connectors as plain lines
|
|
||||||
- **decorative-line / title mismatch** — accent bar sized for one-line title but title wrapped to two (or vice versa)
|
|
||||||
- **footer / citation collision** — source line, page number, or footnote touching content above
|
|
||||||
- **tight margin / gap** — element within ~0.5" of slide edge, or two cards within ~0.3"
|
|
||||||
- **uneven gaps** — large empty area on one side, cramped on another (broken rhythm)
|
|
||||||
- **column / repeat-element misalignment** — KPI cards / icons off baseline or inconsistent width
|
|
||||||
- **order sanity** — sequence matches narrative (cover → agenda → dividers-before-sections → closing)
|
|
||||||
|
|
||||||
REJECT with `slide N: <issue>` lines, else "Gate 3 PASS" (HTML-text fallback adds "<unverified-items> not visually verified").
|
|
||||||
|
|
||||||
**Fix-verify (mandatory, max 3 cycles).** Fix → re-run Gate 3 → repeat until zero new issues; one fix often surfaces another. After 3 rounds without convergence, **stop** — likely seesaw, template-level cause, or agent misread. Report `slide N: <issue> — attempted: <fixes> — likely root: <template|design-conflict|ambiguous>` and let the user decide.
|
|
||||||
|
|
||||||
**Then flush (part of the gate).** Once Gate 3 converges, end with `officecli save "<file>"` — this guarantees your edits are written to disk before delivery (use `officecli close "<file>"` instead to also release the resident on a one-shot handoff). Required final step, not optional. Always safe: never errors or loses work.
|
|
||||||
|
|
||||||
## Common Pitfalls
|
|
||||||
|
|
||||||
Sanity-check cheatsheet — what breaks on the first try. Design + shell traps.
|
|
||||||
|
|
||||||
| Pitfall | Correct approach |
|
|
||||||
|---|---|
|
|
||||||
| Unquoted `[N]` in zsh/bash | Always quote paths: `"/slide[1]"`. zsh globs unquoted `[1]` → `no matches found` — #1 first-use stumble |
|
|
||||||
| `--name "foo"` | All attributes go through `--prop`: `--prop name="foo"` |
|
|
||||||
| `/shape[myname]` (bare name in brackets) | Use `@name=` selector: `/shape[@name=myname]` or `/shape[@id=10007]` |
|
|
||||||
| Paths 1-based vs `--index` 0-based | `/slide[1]` = first slide; `--index 0` = first position |
|
|
||||||
| `$` in `--prop text=` | Single-quote: `--prop text='$15M'`. Double-quoted `"$15M"` gets shell-expanded to `M` |
|
|
||||||
| `\n` / `\t` in `--prop text=` | Interpreted by the CLI: `\n` = paragraph break, `\t` = tab. Double `\\n` for a literal |
|
|
||||||
@@ -1,676 +0,0 @@
|
|||||||
---
|
|
||||||
name: officecli-word-form
|
|
||||||
description: "Use this skill to create fillable Word forms (.docx) with real Content Controls (SDT) + legacy FormField checkboxes + MERGEFIELD mail-merge placeholders + document protection. Trigger on: 'fillable form', 'form fields', 'content controls', 'SDT', 'word form', 'fill in', 'only editable fields', 'protect document', 'onboarding form', 'HR intake', 'survey template', 'contract / SOW template', 'mail-merge template', 'compliance checklist', 'medical intake questionnaire'. Output is a single .docx where specific fields are editable and the rest is locked. This skill is INDEPENDENT, not a scene layer on docx — payload is `<w:sdt>` + `<w:ffData>` + `<w:fldChar>` + `documentProtection`, none of which docx base skill covers. Do NOT trigger for regular reports, letters, memos, academic papers, pitch decks, or any document with no user-fillable fields — route those to officecli-docx or its scene layers."
|
|
||||||
---
|
|
||||||
|
|
||||||
# OfficeCLI Word-Form Skill
|
|
||||||
|
|
||||||
**This skill is INDEPENDENT, not a scene layer on docx.** A form's payload — `<w:sdt>` controls, `<w:ffData>` legacy fields, `<w:fldChar>` mail-merge, `documentProtection` — is a distinct element class from docx's paragraph/heading/style primitives. Its QA is different too: docx's Delivery Gate cares about visual layout and live PAGE fields, this skill's cares about data plumbing (protection enforced / alias+tag / items injected / name ≤ 20 / no underscore anti-pattern). **Reverse handoff:** if the user's document has no fillable fields (report, letter, memo, thesis, proposal), route to `officecli-docx` or a docx scene skill — don't use this one.
|
|
||||||
|
|
||||||
## BEFORE YOU START (CRITICAL)
|
|
||||||
|
|
||||||
**If `officecli` is not installed:**
|
|
||||||
|
|
||||||
`macOS / Linux`
|
|
||||||
|
|
||||||
```bash
|
|
||||||
if ! command -v officecli >/dev/null 2>&1; then
|
|
||||||
curl -fsSL https://d.officecli.ai/install.sh | bash
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
`Windows (PowerShell)`
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
if (-not (Get-Command officecli -ErrorAction SilentlyContinue)) {
|
|
||||||
irm https://d.officecli.ai/install.ps1 | iex
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Verify: `officecli --version`
|
|
||||||
|
|
||||||
If `officecli` is still not found after first install, open a new terminal and run the verify command again.
|
|
||||||
|
|
||||||
If the install command above fails (e.g. blocked by security policy, no network access, or insufficient permissions), install manually — download the binary for your platform from https://github.com/iOfficeAI/OfficeCLI/releases — then re-run the verify command.
|
|
||||||
|
|
||||||
## Help-First Rule
|
|
||||||
|
|
||||||
This skill teaches what a real form needs, not every CLI flag. When a prop / alias / enum is uncertain, consult help BEFORE guessing: `officecli help docx [element] [--json]` (e.g. `sdt`, `formfield`, `field`). Help is pinned to the installed CLI version and is authoritative — when this skill and help disagree, **help wins** (the prop set on `sdt` in particular has grown over time; trust `help docx sdt`, not a hardcoded list).
|
|
||||||
|
|
||||||
## Mental Model & Inheritance
|
|
||||||
|
|
||||||
A Word form is a `.docx` plus four OpenXML payload layers plain-docx skills do not touch: **`<w:sdt>`** content controls (types: text / richtext / dropdown / combobox / date / picture / group), **`<w:ffData>`** legacy FormField (still the only way to get a real checkbox — SDT `type=checkbox` is not implemented), **`<w:fldChar>`** complex fields (MERGEFIELD, REF, PAGEREF, SEQ, IF — template-time, not user-fill), and **`documentProtection`** (the lock that makes non-field text read-only in Word — and, on the CLI, `protection=forms` locks non-field content edits (those need `--force` or `raw-set`) but still allows form-field (SDT) edits, which is the point of forms protection).
|
|
||||||
|
|
||||||
**No inheritance from docx v2.** docx's Delivery Gate (cover-fill %, live-PAGE check) does NOT apply — form QA is `view forms` + `query sdt alias+tag` + `protectionEnforced`.
|
|
||||||
|
|
||||||
**Reverse handoff to docx.** Route back to `officecli-docx` for reports / letters / memos / thesis / pitch decks / any document with no editable fields. Use **this** skill when the document's purpose is data capture or template merge.
|
|
||||||
|
|
||||||
## Shell & Execution Discipline
|
|
||||||
|
|
||||||
**One command at a time. Read output before the next.** OfficeCLI is incremental — every `add` / `set` / `remove` immediately mutates the file. All recipes below use `FILE=form.docx` as a shell variable.
|
|
||||||
|
|
||||||
**Three shell-escape layers:**
|
|
||||||
|
|
||||||
1. **Quote every path with `[N]`** — zsh/bash glob-expand brackets. `officecli get "$FILE" /body/sdt[1]` fails with `no matches found`. Correct: `officecli get "$FILE" '/body/sdt[1]'`.
|
|
||||||
2. **Single-quote any prop containing `$`** — `"Total: $50,000"` becomes `"Total: ,000"` after `$50` variable expansion. Correct: `'Total: $50,000'`.
|
|
||||||
3. **`--after find:<text>` uses outer single quotes, never inner double quotes** — `--after find:"Client Signature:"` makes the quotes part of the search string; match fails. Correct: `--after 'find:Client Signature:'`.
|
|
||||||
|
|
||||||
**`WARNING: UNSUPPORTED` (exit 2) is a silently-wrong element.** The CLI created the element *without* the rejected prop (exit 2 = ran with caveats; only when *every* prop is refused does `--json` report `success: false`). Any UNSUPPORTED in your build log means a prop name the current CLI does not accept on that element — stop, check `help docx <element>` for the right prop name (most SDT props such as `items`/`format`/`lock` ARE accepted now; `maxlength` is not), fix the command, and re-run. Do not ship on top.
|
|
||||||
|
|
||||||
**`protection=forms` is the LAST structural command.** Once it is set, `protection=forms` locks non-field content (those edits need `--force` or `raw-set`) but still allows form-field (SDT) edits — which is the point of forms protection. A non-field content edit (e.g. `set /body/p[N] --prop text=`) is refused (`ERROR: Document is protected … use --force`); a form-field edit (e.g. `set /body/sdt[N] --prop text=` / `--prop alias=`) succeeds (exit 0). Use `Query("editable")` to find fillable fields. So finish all non-field (static layout) edits first, then lock; if you must edit static content afterward, pass `--force` (or temporarily clear protection, edit, re-lock).
|
|
||||||
|
|
||||||
### `--after find:` micro-playbook
|
|
||||||
|
|
||||||
`--after find:<text>` matches the **first** occurrence. Bad anchor = wrong insertion location, expensive to debug. Three rules:
|
|
||||||
|
|
||||||
1. **Anchor must be globally unique.** In bilingual contracts "甲方签字" matches both parties — use a unique phrase like "甲方签字(Service Provider)" or full English title.
|
|
||||||
2. **After insert, `/body/p[last()]` is unreliable** — the find insertion changes `<w:body>` child order. To continue operating on the new paragraph, read its real paraId: `officecli query "$FILE" paragraph --json | jq -r '.data.results[-1].format.paraId'`.
|
|
||||||
3. **Chinese + full-width parens `()`** match literally in `find`, but when unsure, `officecli view "$FILE" text | grep -n "锚点"` first to confirm the exact bytes in the file.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Trap: first-match hits 甲方 only, 乙方 missed
|
|
||||||
officecli add "$FILE" /body --type sdt --after 'find:签字'
|
|
||||||
|
|
||||||
# Fix: two signatories, two unique anchors
|
|
||||||
officecli add "$FILE" /body --type sdt --prop alias=Party_A_Name --prop tag=party_a \
|
|
||||||
--after 'find:甲方签字(Service Provider)'
|
|
||||||
PID_A=$(officecli query "$FILE" paragraph --json | jq -r '.data.results[-1].format.paraId')
|
|
||||||
officecli add "$FILE" "/body/p[@paraId='$PID_A']" --type sdt --prop alias=Party_A_Title --prop tag=party_a_title
|
|
||||||
```
|
|
||||||
|
|
||||||
Inline SDT via `--after find:` is added as a child of the matched paragraph, not as a new paragraph — use this when label + SDT must share a line.
|
|
||||||
|
|
||||||
## What makes a real form (identity)
|
|
||||||
|
|
||||||
A real fillable form requires **structured fields** + **document protection**.
|
|
||||||
|
|
||||||
| Approach | Word user sees | CLI-readable | Real form? |
|
|
||||||
|---|---|---|---|
|
|
||||||
| SDT controls + `protection=forms` | Gray-bordered fields; rest locked | `query sdt` / `view forms` | **YES** |
|
|
||||||
| FormField checkbox + `protection=forms` | Real clickable checkbox; rest locked | `query formfield` / `view forms` | **YES** (checkbox only) |
|
|
||||||
| MERGEFIELD placeholders | `«CustomerName»` merged by downstream engine | `query field` | **YES** (template-time) |
|
|
||||||
| Underscores `___` / blank lines | Visual-only; whole doc editable | No — no structured fields | **NO** |
|
|
||||||
|
|
||||||
**Do not simulate fields with underscores.** `姓名:_______________` produces zero structured data and leaks past every verification. Always use `--type sdt` or `--type formfield`.
|
|
||||||
|
|
||||||
**Checkbox is formfield, NOT SDT.** `--type sdt --prop type=checkbox` exits 1 (`SDT type 'checkbox' is not implemented`). Every checkbox in every recipe uses `--type formfield --prop type=checkbox`.
|
|
||||||
|
|
||||||
**MERGEFIELD is a separate track.** `view forms` lists SDT + formfield only; `query field` lists complex fields only. Two disjoint inventories; both valid in one file.
|
|
||||||
|
|
||||||
## Requirements for Outputs (hard floor)
|
|
||||||
|
|
||||||
Every form must satisfy these — Delivery Gate enforces each as an executable check.
|
|
||||||
|
|
||||||
1. `protection=forms` enforced (`get $FILE /` → `protectionEnforced=True`).
|
|
||||||
2. Every SDT has both `alias` + `tag`.
|
|
||||||
3. Every dropdown/combobox has non-empty `items=...` in `view forms`.
|
|
||||||
4. Every date SDT shows the intended `format=...`.
|
|
||||||
5. Every locked SDT shows `lock=sdtLocked` / `contentLocked` / `sdtContentLocked` as intended.
|
|
||||||
6. Zero `WARNING: UNSUPPORTED` in build log.
|
|
||||||
7. Zero `type=checkbox` on any SDT.
|
|
||||||
8. Every formfield `name` ≤ 20 characters.
|
|
||||||
9. Zero underscore-line / blank-line placeholders.
|
|
||||||
10. Field types match user intent (short text / paragraph / fixed list / list+custom / date / boolean).
|
|
||||||
|
|
||||||
## Three Paths (core decision)
|
|
||||||
|
|
||||||
SDT props are **first-class on `add`** — confirm the current set with `officecli help docx sdt`. Today that includes `type, tag, alias, text, items, format, lock, placeholder/placeholderText, date.*` and the SDT types `text / richtext / dropdown / combobox / date / group / picture`. So most forms are pure `add` — no raw-set, no Word template. Two paths remain only for the genuinely-unreachable cases. **Pick the path before writing a single command.**
|
|
||||||
|
|
||||||
### Path A — Pure CLI (the default for almost everything)
|
|
||||||
|
|
||||||
**Use when**: any text / richtext / dropdown / combobox / date / picture / group SDT — including its options, date format, and lock. Pass the props straight on `add`; verify each persists with `get '/body/sdt[N]' --json`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# dropdown WITH its options and a non-default date format, in one add each — no raw-set:
|
|
||||||
officecli add "$FILE" /body --type sdt \
|
|
||||||
--prop type=dropdown --prop alias="Department" --prop tag=dept \
|
|
||||||
--prop items="Engineering,Finance,HR"
|
|
||||||
officecli add "$FILE" /body --type sdt \
|
|
||||||
--prop type=date --prop alias="Start Date" --prop tag=start \
|
|
||||||
--prop format="yyyy年MM月dd日"
|
|
||||||
# lock works on add AND set:
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=text --prop tag=full_name \
|
|
||||||
--prop alias="Full Name" --prop text="Enter full name" --prop lock=sdtLocked
|
|
||||||
# protection comes last, once all fields exist:
|
|
||||||
# officecli set "$FILE" / --prop protection=forms
|
|
||||||
```
|
|
||||||
|
|
||||||
### Path B — CLI + `raw-set` bridge (only an attribute help does NOT expose)
|
|
||||||
|
|
||||||
**Use when**: you need an SDT attribute that `help docx sdt` does not list (e.g. a `<w:listItem>` whose `w:value` must differ from its display text, or a sdtPr child with no `--prop`). `raw-set` is OfficeCLI's universal OpenXML fallback — `officecli --help` lists it as a top-level command. For ordinary dropdowns use `--prop items=` (Path A); raw-set here is the exception, not the rule.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Display text ≠ stored value — not expressible via items=, so inject the listItems directly:
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=dropdown --prop alias="Department" --prop tag=dept
|
|
||||||
officecli raw-set "$FILE" /document \
|
|
||||||
--xpath "//w:sdt[w:sdtPr/w:tag/@w:val='dept']/w:sdtPr/w:dropDownList" \
|
|
||||||
--action append \
|
|
||||||
--xml '<w:listItem xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" w:displayText="Engineering" w:value="ENG"/><w:listItem xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" w:displayText="Finance" w:value="FIN"/>'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Path C — Word template (only what no API reaches)
|
|
||||||
|
|
||||||
**Use when**: a **real SDT checkbox** (`type=checkbox` still exits 1 — use a legacy FormField instead, see §Legacy FormField), a `placeholderDocPart` prompt-text part, or custom richtext appearance / cross-part nesting beyond `--prop` reach. Picture and grouped SDTs are NO LONGER here — they add fine via Path A.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# One-time in Word: Developer tab → Insert Content Control → Save as template.docx
|
|
||||||
cp templates/onboarding_with_signature.docx "$FILE"
|
|
||||||
officecli open "$FILE"
|
|
||||||
officecli view "$FILE" forms # inspect embedded controls + paths
|
|
||||||
officecli set "$FILE" '/body/sdt[@sdtId=3]' --prop text="Jane Smith"
|
|
||||||
officecli set "$FILE" / --prop protection=forms
|
|
||||||
```
|
|
||||||
|
|
||||||
### Decision table
|
|
||||||
|
|
||||||
| Need | Path | Note |
|
|
||||||
|---|---|---|
|
|
||||||
| text / richtext SDT with default string | **A** | `--prop type/alias/tag/text` |
|
|
||||||
| text SDT that must be locked | **A** | `--prop lock=sdtLocked` works on `add` (and `set`) |
|
|
||||||
| dropdown / combobox **with options** | **A** | `--prop items="A,B,C"` |
|
|
||||||
| date SDT with non-default format | **A** | `--prop format="yyyy年MM月dd日"` |
|
|
||||||
| signature picture SDT, grouped SDT | **A** | `--prop type=picture` / `type=group` add directly |
|
|
||||||
| dropdown whose stored value ≠ display text | **B** | raw-set append `<w:listItem w:value=…>` |
|
|
||||||
| real checkbox | **FormField** | `--type formfield --prop type=checkbox` (see §Legacy FormField) |
|
|
||||||
| mail-merge placeholder | **MERGEFIELD** | `--type field --prop fieldType=mergefield` (see §MERGEFIELD) |
|
|
||||||
| real SDT checkbox / placeholder part / custom appearance | **C** | build skeleton in Word, fill via CLI |
|
|
||||||
|
|
||||||
## Quick Start — Path A + FormField (minimal intake form)
|
|
||||||
|
|
||||||
Two SDT text fields, one checkbox, protection. Paste and adapt; this is the smallest form worth shipping.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
FILE=intake.docx
|
|
||||||
officecli close "$FILE" 2>/dev/null; rm -f "$FILE" # preflight: clear stale resident / prior file (cold-start after CLI upgrade commonly leaks a resident)
|
|
||||||
officecli create "$FILE"
|
|
||||||
officecli open "$FILE"
|
|
||||||
|
|
||||||
officecli set "$FILE" / --prop title="Employee Onboarding Intake" \
|
|
||||||
--prop docDefaults.font="Calibri" --prop docDefaults.fontSize="12pt"
|
|
||||||
|
|
||||||
officecli add "$FILE" /body --type paragraph \
|
|
||||||
--prop text="Employee Onboarding Intake" --prop style=Heading1 \
|
|
||||||
--prop size=20 --prop bold=true --prop spaceAfter=18pt
|
|
||||||
|
|
||||||
officecli add "$FILE" /body --type paragraph \
|
|
||||||
--prop text="Full Name:" --prop size=11 --prop bold=true --prop spaceAfter=4pt
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=text \
|
|
||||||
--prop alias="Full Name" --prop tag=full_name --prop text="Enter full name"
|
|
||||||
|
|
||||||
officecli add "$FILE" /body --type paragraph \
|
|
||||||
--prop text="Start Date:" --prop size=11 --prop bold=true --prop spaceAfter=4pt
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=date \
|
|
||||||
--prop alias="Start Date" --prop tag=start_date
|
|
||||||
|
|
||||||
officecli add "$FILE" /body --type paragraph \
|
|
||||||
--prop text="Read and agree to employee handbook" --prop size=11 --prop spaceAfter=4pt
|
|
||||||
officecli add "$FILE" /body --type formfield \
|
|
||||||
--prop type=checkbox --prop name=agree_handbook --prop checked=false
|
|
||||||
|
|
||||||
officecli set "$FILE" '/body/sdt[1]' --prop lock=sdtlocked
|
|
||||||
officecli set "$FILE" '/body/sdt[2]' --prop lock=sdtlocked
|
|
||||||
officecli set "$FILE" / --prop protection=forms
|
|
||||||
officecli close "$FILE"
|
|
||||||
officecli view "$FILE" forms
|
|
||||||
```
|
|
||||||
|
|
||||||
## Path B — raw-set recipes
|
|
||||||
|
|
||||||
Three recipes cover almost every complex-attr need on SDT forms.
|
|
||||||
|
|
||||||
### B1 — Dropdown items (append)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Skeleton (Path A)
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=dropdown \
|
|
||||||
--prop alias="Department" --prop tag=dept
|
|
||||||
|
|
||||||
# Inject items
|
|
||||||
officecli raw-set "$FILE" /document \
|
|
||||||
--xpath "//w:sdt[w:sdtPr/w:tag/@w:val='dept']/w:sdtPr/w:dropDownList" \
|
|
||||||
--action append \
|
|
||||||
--xml '<w:listItem xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" w:displayText="Engineering" w:value="Engineering"/><w:listItem xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" w:displayText="Finance" w:value="Finance"/><w:listItem xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" w:displayText="HR" w:value="HR"/>'
|
|
||||||
|
|
||||||
# Verify
|
|
||||||
officecli get "$FILE" '/body/sdt[1]' # expect: type=dropdown items=Engineering,Finance,HR
|
|
||||||
```
|
|
||||||
|
|
||||||
**Template.** Swap `<TAG>` / `<LABEL>` / `<VALUE>` only. `xmlns:w=...` is required on every root `<w:listItem>` — raw-set does not inherit namespace prefixes. Chain multiple `<w:listItem>`s in one call; option order is preserved.
|
|
||||||
|
|
||||||
### B2 — Combobox items (same as B1, different xpath tail)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=combobox \
|
|
||||||
--prop alias="Current Medication" --prop tag=current_med
|
|
||||||
|
|
||||||
officecli raw-set "$FILE" /document \
|
|
||||||
--xpath "//w:sdt[w:sdtPr/w:tag/@w:val='current_med']/w:sdtPr/w:comboBox" \
|
|
||||||
--action append \
|
|
||||||
--xml '<w:listItem xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" w:displayText="Antihypertensives" w:value="Antihypertensives"/><w:listItem xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" w:displayText="Insulin" w:value="Insulin"/><w:listItem xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" w:displayText="Other (specify)" w:value="Other"/>'
|
|
||||||
```
|
|
||||||
|
|
||||||
Only difference from B1: `w:comboBox` vs `w:dropDownList` in the xpath tail. Combobox lets the user type custom input; dropdown does not.
|
|
||||||
|
|
||||||
### B3 — Date format (setattr)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=date \
|
|
||||||
--prop alias="Contract Start Date" --prop tag=contract_start
|
|
||||||
|
|
||||||
# Chinese: yyyy年MM月dd日
|
|
||||||
officecli raw-set "$FILE" /document \
|
|
||||||
--xpath "//w:sdt[w:sdtPr/w:tag/@w:val='contract_start']/w:sdtPr/w:date/w:dateFormat" \
|
|
||||||
--action setattr \
|
|
||||||
--xml "w:val=yyyy年MM月dd日"
|
|
||||||
|
|
||||||
# US: w:val=MM/dd/yyyy
|
|
||||||
# ISO: w:val=yyyy-MM-dd (already the default)
|
|
||||||
# Long: w:val="MMMM d, yyyy"
|
|
||||||
|
|
||||||
officecli get "$FILE" '/body/sdt[N]' # expect: type=date format=yyyy年MM月dd日
|
|
||||||
```
|
|
||||||
|
|
||||||
`setattr` replaces one attribute — do not quote the value inside `--xml`. Only `w:val` is touched; the `<w:dateFormat>` wrapper is preserved.
|
|
||||||
|
|
||||||
### raw-set actions & errors
|
|
||||||
|
|
||||||
| `--action` | Form use |
|
|
||||||
|---|---|
|
|
||||||
| `append` | Insert new child at end of target (B1, B2 — listItem) |
|
|
||||||
| `setattr` | Change one attribute; `--xml "key=value"` (B3 — dateFormat/@val) |
|
|
||||||
| `replace` | Replace entire target (rare — reset a full `<w:date>` wrapper) |
|
|
||||||
| `remove` | Delete the target (clear options before re-populate) |
|
|
||||||
|
|
||||||
| Symptom | Fix |
|
|
||||||
|---|---|
|
|
||||||
| `raw-set: 0 element(s) affected` | XPath did not match. Check the `tag` value and whether the SDT is block or inline. Fall back to `officecli raw $FILE /document` to read the real XML. |
|
|
||||||
| `Error: prefix 'w' is not defined` | Missing `xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"` on the fragment — every root element in `--xml` needs it. |
|
|
||||||
| Items readback empty after append | `<w:dropDownList/>` must already exist (Path A `type=dropdown` ensures this). If absent, append has nowhere to insert. |
|
|
||||||
| `VALIDATION: N new error(s) introduced` on same line as success | Your append introduced a schema-invalid child. Treat as stop-and-fix even though `raw-set` exits 0. |
|
|
||||||
|
|
||||||
## Path C — Word template workflow
|
|
||||||
|
|
||||||
For fields CLI cannot express (signature `picture` SDT, real SDT checkbox, `placeholderDocPart` prompt text, grouped SDTs, custom richtext styling), build the skeleton once in Word, then fill via CLI.
|
|
||||||
|
|
||||||
**One-time in Word:** File → Options → Customise Ribbon → Developer. Developer tab → Insert Picture / Check Box / Grouping Content Control → right-click → Properties → set Title (`alias`) + Tag. Save as `template.docx`.
|
|
||||||
|
|
||||||
**Fill via CLI:**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp templates/onboarding_with_signature.docx "$FILE"
|
|
||||||
officecli open "$FILE"
|
|
||||||
officecli view "$FILE" forms # see /body/... paths + sdtId values
|
|
||||||
officecli set "$FILE" '/body/sdt[@sdtId=3]' --prop text="Jane Smith"
|
|
||||||
officecli set "$FILE" / --prop protection=forms
|
|
||||||
officecli close "$FILE"
|
|
||||||
```
|
|
||||||
|
|
||||||
## MERGEFIELD (data-driven track)
|
|
||||||
|
|
||||||
`help docx field` declares a `fieldType` enum of ~30 values including `mergefield`, `ref`, `pageref`, `seq`, `if` — all CLI-expressible with their typed props. MERGEFIELD coexists with SDT in the same file but is reported by `query field` only; `view forms` does NOT list MERGEFIELDs (they are not user-fillable).
|
|
||||||
|
|
||||||
**Canonical MERGEFIELD:**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Dear "
|
|
||||||
officecli add "$FILE" '/body/p[1]' --type field --prop fieldType=mergefield --prop name=CustomerName
|
|
||||||
officecli add "$FILE" '/body/p[1]' --type run --prop text=", "
|
|
||||||
officecli add "$FILE" '/body/p[1]' --type field --prop fieldType=mergefield --prop name=CompanyName
|
|
||||||
# Readback: "Dear «CustomerName», «CompanyName»"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Element-type shortcut** (equivalent): `officecli add "$FILE" '/body/p[1]' --type mergefield --prop name=CustomerName`.
|
|
||||||
|
|
||||||
### Common field patterns
|
|
||||||
|
|
||||||
| Pattern | Call shape |
|
|
||||||
|---|---|
|
|
||||||
| Mail-merge placeholder | `--type field --prop fieldType=mergefield --prop name=<FieldName>` |
|
|
||||||
| Mail-merge with numeric picture (money, percent) | `--type field --prop fieldType=mergefield --prop name=Amount --prop instr='MERGEFIELD Amount \# "#,##0.00"'`. The typed `format` prop is ignored for mergefield (prints a warning) — use `instr` (alias `instruction`) to embed the full field code. Verify: `query "$FILE" field --json \| jq '.data.results[].format.instruction'` must contain `\#` and the picture. |
|
|
||||||
| Mail-merge with date picture | `--type field --prop fieldType=mergefield --prop name=StartDate --prop instr='MERGEFIELD StartDate \@ "yyyy-MM-dd"'` |
|
|
||||||
| Cross-reference to bookmark text | `--type field --prop fieldType=ref --prop name=<BookmarkName>` |
|
|
||||||
| Cross-reference to bookmark's page number | `--type field --prop fieldType=pageref --prop name=<BookmarkName>` |
|
|
||||||
| Auto-numbering (Figure 1 / 2 / 3) | `--type field --prop fieldType=seq --prop identifier=Figure` |
|
|
||||||
| Page number in footer | `--type field --prop fieldType=page` |
|
|
||||||
| "Page X of Y" | two fields: `fieldType=page` + `fieldType=numpages` |
|
|
||||||
| Conditional text | `--type field --prop fieldType=if --prop expression='{ MERGEFIELD Gender } = "Male"' --prop trueText="Mr." --prop falseText="Ms."` |
|
|
||||||
|
|
||||||
### IF conditional (CLI-expressible)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text=""
|
|
||||||
officecli add "$FILE" '/body/p[last()]' --type field --prop fieldType=if \
|
|
||||||
--prop expression='{ MERGEFIELD Gender } = "Male"' \
|
|
||||||
--prop trueText="Mr." --prop falseText="Ms."
|
|
||||||
officecli add "$FILE" '/body/p[last()]' --type run --prop text=" "
|
|
||||||
officecli add "$FILE" '/body/p[last()]' --type field --prop fieldType=mergefield --prop name=LastName
|
|
||||||
# Merge-time result: "Mr. «LastName»" or "Ms. «LastName»"
|
|
||||||
```
|
|
||||||
|
|
||||||
Nested wrappers like `{ IF { MERGEFIELD X } = "Y" { REF bm } "fallback" }` are not expressible via `--prop` chaining — drop to raw-set a hand-crafted `<w:fldChar>` / `<w:instrText>` fragment, or build once in a Word template (Path C).
|
|
||||||
|
|
||||||
**Readback.** `query $FILE field` lists `/field[N]` + instruction + `fieldType`. `view $FILE forms` does NOT list MERGEFIELDs (only SDT + formfield) — they are template-time, not end-user fillable. `get $FILE '/body/p[1]'` renders the guillemet-wrapped field name.
|
|
||||||
|
|
||||||
## Legacy FormField
|
|
||||||
|
|
||||||
Use FormField **when you need a real checkbox**. For text/dropdown, prefer SDT.
|
|
||||||
|
|
||||||
`help docx formfield`: `type` (text/checkbox/check/dropdown), `name` (required, **≤ 20 chars** — OpenXML schema MaxLength; add passes longer but `validate` rejects), `text` (text only, alias `value`), `checked` (checkbox only).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# CHECKBOX — the only real checkbox (SDT type=checkbox is not implemented)
|
|
||||||
officecli add "$FILE" /body --type formfield --prop type=checkbox \
|
|
||||||
--prop name=agree_terms --prop checked=false
|
|
||||||
|
|
||||||
# TEXT formfield
|
|
||||||
officecli add "$FILE" /body --type formfield --prop type=text \
|
|
||||||
--prop name=emp_name --prop text="Enter name"
|
|
||||||
|
|
||||||
# DROPDOWN formfield — items NOT settable via CLI; use Word template or SDT Path B
|
|
||||||
officecli add "$FILE" /body --type formfield --prop type=dropdown --prop name=dept_select
|
|
||||||
|
|
||||||
# Read / modify by name (stable) or 1-based index
|
|
||||||
officecli get "$FILE" '/formfield[agree_terms]'
|
|
||||||
officecli set "$FILE" '/formfield[agree_terms]' --prop checked=true
|
|
||||||
officecli set "$FILE" '/formfield[emp_name]' --prop text="Jane Smith"
|
|
||||||
officecli set "$FILE" '/formfield[dept_select]' --prop text="Engineering"
|
|
||||||
```
|
|
||||||
|
|
||||||
FormField paths (`/formfield[N]` or `/formfield[<name>]`) are separate from SDT paths (`/body/sdt[N]`). Both coexist; `protection=forms` covers both.
|
|
||||||
|
|
||||||
**Scale.** Tested with 50+ checkboxes in a single document — no practical cap on formfield count; build and `validate` remain clean. `name` ≤ 20 chars (K13) is the only hard constraint.
|
|
||||||
|
|
||||||
**Renderer note — formfield checkbox `[RENDERER-BUG]`.** LibreOffice's PDF export occasionally renders the formfield checkbox as `☐☐` (doubled box). Word and WPS render a single clickable box (toggles ☑). This is a LibreOffice renderer quirk, **not a skill or document quality issue** — see K19. Do not attempt workarounds in the form; if an evaluator screenshots a LibreOffice-generated PDF and sees `☐☐`, attribute to `[RENDERER-BUG]`.
|
|
||||||
|
|
||||||
## Document protection & lock
|
|
||||||
|
|
||||||
### Enabling form protection
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" / --prop protection=forms
|
|
||||||
officecli get "$FILE" / # look for: protectionEnforced=True
|
|
||||||
```
|
|
||||||
|
|
||||||
### Protection modes
|
|
||||||
|
|
||||||
| Mode | Word user can | CLI behavior |
|
|
||||||
|---|---|---|
|
|
||||||
| `forms` | Fill SDT + formfield only | Form-field (SDT) edits work (exit 0); non-field content edits need `--force` or `raw-set` |
|
|
||||||
| `readOnly` | Read only | Non-field edits need `--force`; raw-set bypasses |
|
|
||||||
| `comments` | Add comments only | Non-field edits need `--force`; raw-set bypasses |
|
|
||||||
| `trackedChanges` | Edit with tracked changes only | Non-field edits need `--force`; raw-set bypasses |
|
|
||||||
| `none` | Full editing | All ops work |
|
|
||||||
|
|
||||||
**KEY:** Document protection restricts Word users AND the CLI. Under `protection=forms`, form-field (SDT) edits — `set /body/sdt[N] --prop text=` / `--prop alias=` — succeed (exit 0); this is the point of forms protection. Only NON-field content edits (e.g. `set /body/p[N] --prop text=`) are refused with `ERROR: Document is protected (mode: forms). … use --force to override`; pass `--force` (or `raw-set`, the only verb that fully bypasses protection) to edit static content anyway. Use `Query("editable")` to find the fields a Word user could still fill.
|
|
||||||
|
|
||||||
### Lock values (settable on `add` and `set`)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" '/body/sdt[1]' --prop lock=sdtlocked # content editable; control cannot be deleted
|
|
||||||
officecli set "$FILE" '/body/sdt[1]' --prop lock=contentlocked # content read-only; control can be deleted
|
|
||||||
officecli set "$FILE" '/body/sdt[1]' --prop lock=sdtcontentlocked # both locked
|
|
||||||
# Omit lock entirely → unlocked (default)
|
|
||||||
```
|
|
||||||
|
|
||||||
`--prop lock=...` works on `add` as well as `set` — set it inline when you create the control. Readback normalises to camelCase (`sdtLocked`) regardless of input case — both accepted.
|
|
||||||
|
|
||||||
### lock × `protection=forms` interaction
|
|
||||||
|
|
||||||
| lock value | `protection=forms` active | Word user can edit? | Word user can delete control? |
|
|
||||||
|---|---|---|---|
|
|
||||||
| (none) | yes | **Yes** | **Yes** |
|
|
||||||
| `sdtlocked` | yes | Yes | No |
|
|
||||||
| `contentlocked` | yes | No | Yes |
|
|
||||||
| `sdtcontentlocked` | yes | No | No |
|
|
||||||
| block-level SDT wrap `contentlocked` | any | No (wrapped paragraph read-only regardless of protection) | No |
|
|
||||||
| any | `readOnly` mode | No | No |
|
|
||||||
|
|
||||||
### Block-level lock (paragraph-wrapping SDT)
|
|
||||||
|
|
||||||
`protection=forms` is document-level — once an admin unprotects, every static paragraph (disclaimer, legal attestation, contract clause) becomes editable again. Master templates need defense-in-depth: wrap the critical paragraph in a block-level `<w:sdt>` with `lock=contentLocked`, so the content stays read-only even after protection is stripped.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type paragraph \
|
|
||||||
--prop text="I authorize the above and acknowledge all clauses." --prop size=11 --prop spaceAfter=12pt
|
|
||||||
PID=$(officecli query "$FILE" paragraph --json | jq -r '.data.results[-1].format.paraId')
|
|
||||||
|
|
||||||
# raw-set actions: append | prepend | insertbefore | insertafter | replace | remove | setattr
|
|
||||||
# No `wrap` action — two-step instead: (1) insertbefore an empty <w:sdt><w:sdtContent/></w:sdt>,
|
|
||||||
# (2) move the original <w:p> inside by `replace` on the sdtContent with a copy of the paragraph XML.
|
|
||||||
# Simpler alternative: read the paragraph XML via `officecli raw`, then `replace` the whole <w:p> with <w:sdt>...<w:sdtContent>[original w:p]</w:sdtContent></w:sdt>:
|
|
||||||
# NOTE: this needs an XML-aware extraction, NOT awk. `raw /document` emits the whole document on ONE line,
|
|
||||||
# so an awk range like `/paraId=.../,/<\/w:p>/` grabs the entire <w:document> (schema-invalid). Parse the XML
|
|
||||||
# and pull the single <w:p> by paraId instead:
|
|
||||||
PARA_XML=$(officecli raw "$FILE" /document | python3 -c '
|
|
||||||
import sys, xml.etree.ElementTree as ET
|
|
||||||
xml = sys.stdin.read(); pid = sys.argv[1]
|
|
||||||
ns = {"w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","w14":"http://schemas.microsoft.com/office/word/2010/wordml"}
|
|
||||||
for p, u in ns.items(): ET.register_namespace(p, u)
|
|
||||||
root = ET.fromstring(xml); key = "{%s}paraId" % ns["w14"]
|
|
||||||
for p in root.iter("{%s}p" % ns["w"]):
|
|
||||||
if p.attrib.get(key) == pid:
|
|
||||||
sys.stdout.write(ET.tostring(p, encoding="unicode")); break
|
|
||||||
' "$PID")
|
|
||||||
officecli raw-set "$FILE" /document \
|
|
||||||
--xpath "//w:p[@w14:paraId='$PID']" \
|
|
||||||
--action replace \
|
|
||||||
--xml "<w:sdt xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\"><w:sdtPr><w:alias w:val=\"Authorization\"/><w:tag w:val=\"auth_para\"/><w:lock w:val=\"contentLocked\"/></w:sdtPr><w:sdtContent>${PARA_XML}</w:sdtContent></w:sdt>"
|
|
||||||
```
|
|
||||||
|
|
||||||
Verify with `query sdt --json | jq '.data.results[] | select(.format.lock == "contentLocked" and .format.type == "block")'`. Use only for legal attestations, compliance disclaimers, confidentiality clauses — regular intake fields do not need this.
|
|
||||||
|
|
||||||
### Role-gated fields (multi-role forms)
|
|
||||||
|
|
||||||
When one form is filled by two roles (patient vs physician; Party A vs Party B), use `lock=contentLocked` on the fields the other role must not touch. Under `protection=forms`, `contentLocked` SDTs display as read-only in Word; the intended role unprotects (or the admin swaps role-specific copies) to fill the other half.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Patient section — editable (no lock, or sdtlocked to prevent accidental deletion only)
|
|
||||||
officecli set "$FILE" '/body/sdt[1]' --prop lock=sdtlocked # patient_name
|
|
||||||
officecli set "$FILE" '/body/sdt[2]' --prop lock=sdtlocked # patient_dob
|
|
||||||
|
|
||||||
# Physician section — locked against patient edits
|
|
||||||
officecli set "$FILE" '/body/sdt[14]' --prop lock=contentLocked # physician_diagnosis
|
|
||||||
officecli set "$FILE" '/body/sdt[15]' --prop lock=contentLocked # physician_signature
|
|
||||||
```
|
|
||||||
|
|
||||||
This is the core pattern for medical intake, two-party contracts, sequential-approval forms.
|
|
||||||
|
|
||||||
## Recipe — Contract / SOW template with MERGEFIELD + signature
|
|
||||||
|
|
||||||
Row-map across the three sub-recipes: SDT[1]=project_name, SDT[2]=contract_start, SDT[3]=payment_schedule, SDT[4]=signatory_name (inline). Run (sow-a) → (sow-b) → (sow-c) in order on the same `$FILE`; each sub-recipe stays under 20 lines so a shell-escape slip never cascades past one block.
|
|
||||||
|
|
||||||
### Recipe (sow-a) Boilerplate + cover + parties
|
|
||||||
|
|
||||||
Creates the file, sets docDefaults, writes the title / intro, and drops the two MERGEFIELD placeholders (`CustomerName`, `ContractNo`) that downstream mail-merge will fill.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
FILE=sow.docx
|
|
||||||
officecli create "$FILE"
|
|
||||||
officecli open "$FILE"
|
|
||||||
officecli set "$FILE" / --prop title="Statement of Work" \
|
|
||||||
--prop docDefaults.font="Calibri" --prop docDefaults.fontSize="12pt"
|
|
||||||
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Statement of Work" \
|
|
||||||
--prop style=Heading1 --prop size=20 --prop bold=true --prop spaceAfter=12pt
|
|
||||||
officecli add "$FILE" /body --type paragraph \
|
|
||||||
--prop text="This Statement of Work ('SOW') is entered into between the parties identified below and governs the delivery of professional services." \
|
|
||||||
--prop size=11 --prop spaceAfter=12pt
|
|
||||||
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Customer: "
|
|
||||||
officecli add "$FILE" '/body/p[last()]' --type field \
|
|
||||||
--prop fieldType=mergefield --prop name=CustomerName
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Contract #: "
|
|
||||||
officecli add "$FILE" '/body/p[last()]' --type field \
|
|
||||||
--prop fieldType=mergefield --prop name=ContractNo
|
|
||||||
```
|
|
||||||
|
|
||||||
### Recipe (sow-b) SDT fields — all via Path A
|
|
||||||
|
|
||||||
Adds the three block-level SDTs (project / date / dropdown) and the inline signature SDT anchored via `--after 'find:Client Signature:'`. The date format and dropdown items go straight on `add` — no raw-set needed.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=text \
|
|
||||||
--prop alias="Project Name" --prop tag=project_name --prop text="Enter project name"
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=date \
|
|
||||||
--prop alias="Contract Start Date" --prop tag=contract_start --prop format="MM/dd/yyyy"
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=dropdown \
|
|
||||||
--prop alias="Payment Schedule" --prop tag=payment_schedule \
|
|
||||||
--prop items="Full Prepayment,Net 30 Upon Delivery"
|
|
||||||
officecli add "$FILE" /body --type paragraph --prop text="Client Signature:" \
|
|
||||||
--prop bold=true --prop spaceBefore=18pt --prop spaceAfter=4pt
|
|
||||||
officecli add "$FILE" /body --type sdt --prop type=text \
|
|
||||||
--prop alias="Signatory Name" --prop tag=signatory_name --prop text="Authorized Signatory" \
|
|
||||||
--after 'find:Client Signature:'
|
|
||||||
# (Only reach for raw-set if a listItem's stored value must differ from its display text — see Path B.)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Recipe (sow-c) Watermark + locks + document protection
|
|
||||||
|
|
||||||
Drops the CONFIDENTIAL watermark (parent is `/`, never `/body`), locks the three block-level SDTs, instructs how to lock the inline signatory_name SDT (path only known after `view forms`), then seals the document with `protection=forms` as the last command.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" / --type watermark \
|
|
||||||
--prop text="CONFIDENTIAL" --prop color=FF0000 --prop rotation=315
|
|
||||||
|
|
||||||
officecli set "$FILE" '/body/sdt[1]' --prop lock=sdtlocked
|
|
||||||
officecli set "$FILE" '/body/sdt[2]' --prop lock=sdtlocked
|
|
||||||
officecli set "$FILE" '/body/sdt[3]' --prop lock=sdtlocked
|
|
||||||
officecli view "$FILE" forms # copy signatory_name path, then: set '/body/p[@paraId=...]/sdt[1]' --prop lock=sdtlocked
|
|
||||||
|
|
||||||
officecli set "$FILE" / --prop protection=forms
|
|
||||||
officecli close "$FILE"
|
|
||||||
officecli query "$FILE" field # expect 2 MERGEFIELDs: CustomerName, ContractNo
|
|
||||||
```
|
|
||||||
|
|
||||||
## Design principles (forms)
|
|
||||||
|
|
||||||
**Control-type decision tree:**
|
|
||||||
|
|
||||||
```
|
|
||||||
Date → type=date | Fixed list → type=dropdown | List + custom → type=combobox
|
|
||||||
Short text → type=text | Long text → type=richtext | Boolean → formfield checkbox
|
|
||||||
```
|
|
||||||
|
|
||||||
**Typography scale.** Spacing unit trap: `spaceBefore` / `spaceAfter` / `spaceLine` default to **twips** (1/20 pt) — always write `spaceBefore=18pt`.
|
|
||||||
|
|
||||||
| Element | Size | Style | Spacing |
|
|
||||||
|---|---|---|---|
|
|
||||||
| Form title (H1) | 20pt | Bold | `spaceBefore=0pt`, `spaceAfter=12pt` |
|
|
||||||
| Section heading (H2) | 14pt | Bold | `spaceBefore=18pt`, `spaceAfter=8pt` |
|
|
||||||
| Field label | 11pt | Bold | `spaceAfter=4pt` |
|
|
||||||
| Instructions / notes | 11pt | Italic `color=666666` | `spaceAfter=18pt` |
|
|
||||||
|
|
||||||
**Accessibility bump.** For medical / geriatric / accessibility-focused forms, raise field label + instruction to **12pt** (11pt default is tight for older users); keep section headings at 14pt.
|
|
||||||
|
|
||||||
**CJK forms:** set `docDefaults.font="Microsoft YaHei"` — Calibri lacks Chinese glyphs.
|
|
||||||
|
|
||||||
**Field ordering.** (1) Personal / ID, (2) role / classification, (3) dates, (4) supplemental free-text, (5) confirmation / signature.
|
|
||||||
|
|
||||||
**Yes/No + conditional follow-up** (common in compliance / medical intake): formfield checkbox followed by a richtext SDT whose `alias` carries the cue — e.g. `--type formfield --prop type=checkbox --prop name=has_cond` then `--type sdt --prop type=richtext --prop alias="If yes, explain" --prop tag=cond_detail --prop text="If yes, explain here"`.
|
|
||||||
|
|
||||||
**Signature block order.** Label on its own paragraph, SDT on the next paragraph (with `spaceBefore=18pt` on the label, `spaceAfter=4pt` on the SDT). Never `Label: SDT` inline — Word renders the runs as touching, visually stuck together.
|
|
||||||
|
|
||||||
**Build order.** create+open → metadata → structure (headings, label paragraphs) → SDT/formfield skeletons (Path A 4 props) → Path B injections → per-field lock → `protection=forms` LAST → close.
|
|
||||||
|
|
||||||
**Header / footer note.** Headers/footers are **predefined** when the section is created (default/first/even, 3 each). The first mutation must be `set` against the existing part, not `add` — `add $FILE /header ...` returns `already exists` or silently no-ops. Inspect first with `officecli query "$FILE" header --json` to read the `type` values, then `officecli set "$FILE" '/header[@type=default]' --prop text=...`. Only use `add` when creating an additional section with its own header/footer.
|
|
||||||
|
|
||||||
## Batch mode (brief)
|
|
||||||
|
|
||||||
For forms with many controls, batch reduces overhead. Path A + Path B coexist in one batch.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/body","type":"sdt","props":{"type":"text","alias":"Full Name","tag":"full_name","text":"Enter name"}},
|
|
||||||
{"command":"add","parent":"/body","type":"sdt","props":{"type":"dropdown","alias":"Department","tag":"dept"}},
|
|
||||||
{"command":"raw-set","part":"/document","xpath":"//w:sdt[w:sdtPr/w:tag/@w:val='dept']/w:sdtPr/w:dropDownList","action":"append","xml":"<w:listItem xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" w:displayText=\"Engineering\" w:value=\"Engineering\"/><w:listItem xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" w:displayText=\"Finance\" w:value=\"Finance\"/>"},
|
|
||||||
{"command":"set","path":"/body/sdt[1]","props":{"lock":"sdtlocked"}},
|
|
||||||
{"command":"set","path":"/body/sdt[2]","props":{"lock":"sdtlocked"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
officecli set "$FILE" / --prop protection=forms
|
|
||||||
```
|
|
||||||
|
|
||||||
- Escape inner `"` in `xml` with `\"`. Use single-quoted heredoc `<<'EOF'` so `$var` does not expand.
|
|
||||||
- **P0 batch trap:** genuinely-unsupported props in batch are silently dropped, **no WARNING** (interactive `add` would print WARNING: UNSUPPORTED, exit 2). Defence: send only props `help docx sdt` lists (`type/tag/alias/text/items/format/lock/...` are fine on `add`; `maxlength` is not), and verify with a readback after the batch.
|
|
||||||
- `batch` supports `add`, `set`, `get`, `query`, `remove`, `validate`, `raw-set`.
|
|
||||||
|
|
||||||
## Delivery Gate (executable)
|
|
||||||
|
|
||||||
Run every gate below after every form. Each gate must print its `OK` line. Any `REJECT` = do not deliver.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Assumes FILE=<your-form.docx>, document has been closed with officecli close "$FILE"
|
|
||||||
|
|
||||||
# Gate 1 — Validate (must be clean; protection=forms no longer produces a schema error)
|
|
||||||
VAL_OUT=$(officecli validate "$FILE" 2>&1)
|
|
||||||
VAL_ERRS=$(echo "$VAL_OUT" | grep -c '\[Schema\]')
|
|
||||||
if [ "$VAL_ERRS" -eq 0 ]; then echo "Gate 1 OK (validate clean)"
|
|
||||||
else echo "REJECT Gate 1: $VAL_ERRS schema errors"; echo "$VAL_OUT"; exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Gate 2 — Token / placeholder leak (labels used as visual underscore substitutes)
|
|
||||||
LEAK=$(officecli view "$FILE" text | grep -niE '_{3,}|TBD|\(fill in\)|\{\{|xxxx|lorem|placeholder')
|
|
||||||
[ -z "$LEAK" ] && echo "Gate 2 OK (no underscore / placeholder leak)" || { echo "REJECT Gate 2:"; echo "$LEAK"; exit 1; }
|
|
||||||
|
|
||||||
# Gate 3 — At least one structured field exists
|
|
||||||
SDT_N=$(officecli query "$FILE" sdt --json | jq '.data.results | length')
|
|
||||||
FF_N=$(officecli query "$FILE" formfield --json | jq '.data.results | length')
|
|
||||||
FLD_N=$(officecli query "$FILE" field --json | jq '.data.results | length')
|
|
||||||
TOTAL=$((SDT_N + FF_N + FLD_N))
|
|
||||||
[ "$TOTAL" -gt 0 ] && echo "Gate 3 OK ($SDT_N sdt + $FF_N formfield + $FLD_N field)" || { echo "REJECT Gate 3: 0 structured fields — this is not a form"; exit 1; }
|
|
||||||
|
|
||||||
# Gate 4 — Every SDT has alias + tag (skill-imposed H2)
|
|
||||||
# NOTE: `query`/`get --json` wrap prop fields under `.data.results[N].format.{prop}` — use `.data.results[0].format.alias` / `.format.tag`, never bare `.alias` or `.data.format`.
|
|
||||||
SDT_MISSING=$(officecli query "$FILE" sdt --json | jq '[.data.results[] | select(.format.alias == null or .format.alias == "" or .format.tag == null or .format.tag == "")] | length')
|
|
||||||
[ "$SDT_MISSING" -eq 0 ] && echo "Gate 4 OK (every SDT has alias+tag)" || { echo "REJECT Gate 4: $SDT_MISSING SDT(s) missing alias or tag"; exit 1; }
|
|
||||||
|
|
||||||
# Gate 5 — Protection enforced + per-field lock inventory
|
|
||||||
PROT=$(officecli get "$FILE" / --json | jq -r '.data.results[0].format.protection // "none"')
|
|
||||||
[ "$PROT" = "forms" ] && echo "Gate 5 OK (protection=forms enforced)" || { echo "REJECT Gate 5: protection is '$PROT', expected 'forms'"; exit 1; }
|
|
||||||
officecli view "$FILE" forms | head -40 # visual spot-check: every dropdown shows items=; every date shows format=; every locked SDT shows lock=
|
|
||||||
|
|
||||||
# Gate 6 — No type=checkbox leaked onto any SDT
|
|
||||||
BAD_CB=$(officecli query "$FILE" sdt --json | jq '[.data.results[] | select(.format.type == "checkbox")] | length')
|
|
||||||
[ "$BAD_CB" -eq 0 ] && echo "Gate 6 OK (no SDT checkbox — formfield only)" || { echo "REJECT Gate 6: $BAD_CB SDT with type=checkbox"; exit 1; }
|
|
||||||
```
|
|
||||||
|
|
||||||
**Why `view issues` is not a gate.** It runs only prose-style checks (first-line-indent, heading size) and flags every form label as `Body paragraph missing first-line indent` — a false-positive avalanche on forms. Ignore for this skill. Use `validate` (schema integrity) and `view forms` (field inventory).
|
|
||||||
|
|
||||||
## Known Issues
|
|
||||||
|
|
||||||
| # | Issue | Behavior | Workaround |
|
|
||||||
|---|---|---|---|
|
|
||||||
| K1 | SDT `type=checkbox` not implemented | `add ... --type sdt --prop type=checkbox` → `Error: SDT type 'checkbox' is not implemented`, exit 1 (error now lists the supported types incl. group/picture) | Use `--type formfield --prop type=checkbox` |
|
|
||||||
| K3 | SDT `maxlength` UNSUPPORTED on `add` | `WARNING: UNSUPPORTED: maxlength`, exit 2; element still created. (`items` / `format` / `lock` / `placeholderText` are NOW supported on `add` — only `maxlength` is rejected; `name` is accepted but a no-op on SDT — use `alias`/`tag`) | Enforce length downstream; use `text` for initial content |
|
|
||||||
| K4 | SDT `items` / `format` / `type` not settable AFTER creation | `set --prop items=...` → `UNSUPPORTED props (use raw-set instead)`. (They ARE settable on `add` — set them inline at creation) | Set at `add` time; to change later, Path B `raw-set` or `remove` + re-add |
|
|
||||||
| K5 | FormField `maxlength` UNSUPPORTED | `WARNING: UNSUPPORTED: maxlength`; formfield created | Enforce length in downstream validation |
|
|
||||||
| K6 | FormField dropdown `items` UNSUPPORTED | Dropdown formfield is created with empty option list | Use an SDT dropdown with `--prop items=` instead |
|
|
||||||
| K7 | Watermark `width` / `height` not settable | Watermark created without them; `opacity` IS settable on `add` and reads back (real dims are computed) | For an exact size, open Word + adjust the shape (Phase 2) |
|
|
||||||
| K9 | Batch mode silently drops genuinely-UNSUPPORTED props | No `WARNING` line; batch reports "N succeeded" even when a prop (e.g. `maxlength`) was dropped | Keep batch SDT entries to props `help docx sdt` lists; verify with a readback after the batch |
|
|
||||||
| K13 | FormField `name` > 20 characters | `add` returns exit 0 with no warning; `validate` later reports `[Schema] ... MaxLength=20` on `/w:ffData/w:name` | Keep `name` ≤ 20 characters (OpenXML schema limit). SDT `alias` / `tag` have no such limit |
|
|
||||||
| K14 | `shd.fill` on a paragraph emits schema-invalid `<w:pPr>/<w:shd>` | `validate` reports 2 schema errors per instance (`unexpected child element`, `required attribute 'val' missing`); Word renders it anyway | Apply highlight on the run instead (`shading=HEX`, flat canonical), or raw-set `<w:shd w:val="clear" w:fill="HEX"/>` into the run's `<w:rPr>` |
|
|
||||||
| K15 | `view forms` does NOT list MERGEFIELDs | Only SDT + formfield in output; MERGEFIELDs are template-time, not end-user fillable | Treat `query field` and `view forms` as two disjoint inventories. Every recipe verifies both |
|
|
||||||
| K16 | Header / footer are predefined at section creation (default/first/even, 3 each) | `add $FILE /header ...` returns `already exists` or silently no-ops on the first call | First mutation uses `set` against the existing part: `officecli query $FILE header --json` to read `type`, then `set '/header[@type=default]' --prop text=...`. Only use `add` for a brand-new section's header/footer |
|
|
||||||
| K17 | Watermark injected into header emits `<w:noProof>` child that is schema-invalid | `validate` adds an extra `[Schema]` error at `/header[N]/w:sdt/.../w:noProof` — a real schema error to fix, not a benign one | After `add $FILE / --type watermark`, run once per header part: `officecli raw-set $FILE /word/header1.xml --xpath "//w:noProof" --action remove` (repeat for `header2.xml`, `header3.xml` if present) |
|
|
||||||
| K18 | `query`/`get --json` wrap prop fields under `.data.results[N].format.{prop}` | Writing jq against bare `.alias` / `.tag` / `.protection`, or `.data.format.*`, returns null/0 matches and Gate 4/5 falsely report "missing=N" | Use `.data.results[].format.alias` / `.format.tag`; for `get /` use `.data.results[0].format.protection` (NOT `.data.format.protection`). Same for `.format.type` / `.format.paraId` |
|
|
||||||
| K19 | LibreOffice renders formfield checkbox as `☐☐` (double box) in PDF export | Cosmetic only — Word / WPS render a single box, clickable to toggle ☑. A LibreOffice renderer quirk, flagged as [RENDERER-BUG] | Do not try to "fix" in the skill. If an evaluator screenshots from LibreOffice-generated PDF and sees `☐☐`, attribute to [RENDERER-BUG], not a form-quality defect |
|
|
||||||
|
|
||||||
## Phase 2 — enhance in Word
|
|
||||||
|
|
||||||
Some polish is out of CLI scope. Hand the file to a human for these; none are required for a valid form.
|
|
||||||
|
|
||||||
| Need | Why open Word |
|
|
||||||
|---|---|
|
|
||||||
| Real SDT checkbox with specific locking | `type=checkbox` exits 1; use Developer → Check Box Content Control (or a legacy FormField checkbox via CLI) |
|
|
||||||
| Prompt text ("Click here to enter a date") | Needs `placeholderDocPart` in `/word/glossary/document.xml` |
|
|
||||||
| Custom richtext default appearance | Adjust the referenced style in Word's style pane |
|
|
||||||
| Watermark resize | `width` / `height` not settable; drag shape handles |
|
|
||||||
|
|
||||||
(`picture` and `group` SDTs add directly via `--type sdt --prop type=picture` / `type=group` — no longer Phase-2 items.)
|
|
||||||
|
|
||||||
For the first four, build the skeleton once (Path C) and reuse.
|
|
||||||
|
|
||||||
## Help pointer
|
|
||||||
|
|
||||||
When in doubt: `officecli help docx`, `officecli help docx <element>`, `officecli help docx <element> --json`. Help is the authoritative schema; this skill is the decision guide for building real fillable Word forms on top of it.
|
|
||||||
-497
@@ -1,497 +0,0 @@
|
|||||||
---
|
|
||||||
name: officecli-xlsx
|
|
||||||
description: "Use this skill any time a .xlsx file is involved -- as input, output, or both. This includes: creating spreadsheets, financial models, dashboards, or trackers; reading, parsing, or extracting data from any .xlsx file; editing, modifying, or updating existing workbooks; working with formulas, charts, pivot tables, or templates; importing CSV/TSV data into Excel format. Trigger whenever the user mentions 'spreadsheet', 'workbook', 'Excel', 'financial model', 'tracker', 'dashboard', or references a .xlsx/.csv filename."
|
|
||||||
---
|
|
||||||
|
|
||||||
# OfficeCLI XLSX Skill
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
If `officecli` is missing:
|
|
||||||
|
|
||||||
- **macOS / Linux**: `curl -fsSL https://d.officecli.ai/install.sh | bash`
|
|
||||||
- **Windows (PowerShell)**: `irm https://d.officecli.ai/install.ps1 | iex`
|
|
||||||
|
|
||||||
Verify with `officecli --version` (open a new terminal if PATH hasn't picked up). If install fails, download a binary from https://github.com/iOfficeAI/OfficeCLI/releases.
|
|
||||||
|
|
||||||
## ⚠️ Help-First Rule
|
|
||||||
|
|
||||||
**This skill teaches what good xlsx looks like, not every command flag. When a property name, enum value, or alias is uncertain, consult help BEFORE guessing.**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli help xlsx # List all xlsx elements
|
|
||||||
officecli help xlsx <element> # Full element schema (e.g. pivottable, chart, cf)
|
|
||||||
officecli help xlsx <verb> <element> # Verb-scoped (e.g. add chart, set cell)
|
|
||||||
officecli help xlsx <element> --json # Machine-readable schema
|
|
||||||
```
|
|
||||||
|
|
||||||
Help reflects the installed CLI version. When this skill and help disagree, **help is authoritative**.
|
|
||||||
|
|
||||||
## Shell & Execution Discipline
|
|
||||||
|
|
||||||
**Shell quoting (zsh / bash).** Excel paths contain `[]`, and number formats contain `$`. Both are shell metacharacters. Rules:
|
|
||||||
|
|
||||||
- ALWAYS quote element paths: `"/Sheet1/row[1]"`, not `/Sheet1/row[1]`.
|
|
||||||
- Use **single quotes** for any prop value containing `$`: `numFmt='$#,##0'`.
|
|
||||||
- For formulas with cross-sheet `!` references, use `batch` with a `<<'EOF'` heredoc (see Known Issues).
|
|
||||||
- `\n` and `\t` in a prop value ARE interpreted by the CLI — `\n` is a real in-cell line break (pair with `--prop wrapText=true`), `\t` a tab — consistent across xlsx / docx / pptx. Double them (`\\n`) for a literal backslash-n (rarely wanted). (`$` is the shell layer above — single-quote it.)
|
|
||||||
|
|
||||||
**Incremental execution.** Run commands one at a time and read each exit code. `officecli` mutates the file on every call; a 50-command script that fails at command 3 will cascade silently. One command → check output → continue.
|
|
||||||
|
|
||||||
## Requirements for Outputs
|
|
||||||
|
|
||||||
Before reaching for a command, know what a good xlsx looks like. These are the deliverable standards every workbook MUST meet.
|
|
||||||
|
|
||||||
### All Excel files
|
|
||||||
|
|
||||||
**Zero formula errors.** Every delivered workbook MUST have ZERO `#REF!`, `#DIV/0!`, `#VALUE!`, `#NAME?`, `#N/A`. No exceptions — guard denominators with `IFERROR` or `IF(x=0,...)`.
|
|
||||||
|
|
||||||
**Formulas, not hardcoded values.** If a number can be computed from other cells, it is a formula. Hardcoding `5000` where `=SUM(B2:B9)` belongs breaks the contract that the workbook stays live when inputs change. This is the single most important rule in this skill.
|
|
||||||
|
|
||||||
**Professional font.** Use one consistent, professional font across the workbook (Arial / Calibri / Times New Roman). Don't mix four fonts because one sheet came from CSV.
|
|
||||||
|
|
||||||
**Explicit widths.** There is no auto-fit. Any column the user will read MUST have `width` set — default 8.43 chars clips everything. Sensible starts: labels 20-25, numbers 12-15, dates 12, short codes 8-10.
|
|
||||||
|
|
||||||
**Preserve existing templates.** When editing a file that already has a look, match it. Existing conventions override these guidelines.
|
|
||||||
|
|
||||||
### Visual delivery floor (applies to EVERY workbook)
|
|
||||||
|
|
||||||
Before you declare done, run `officecli view "$FILE" html` and Read the returned HTML path to confirm all of these:
|
|
||||||
|
|
||||||
- **No `###` in any cell.** `###` means a column is too narrow for its widest value. Every column the user reads needs an explicit `width`. `###` in a delivered file is unfinished work, never "a small visual nit".
|
|
||||||
- **No truncated titles.** Sheet titles, section headers, long labels must fit. Widen the column or apply `wrapText=true` on the cell.
|
|
||||||
- **No placeholder tokens rendered as data.** `$fy$24`, `{var}`, `<TODO>`, `xxxx` must never appear in a cell, chart title, series name, or legend. These are build-time tokens that escaped replacement.
|
|
||||||
- **Pie / doughnut slices have distinct fill colors.** If the slices render same-colored, switch to `bar` / `column` or set `colors=...` explicitly.
|
|
||||||
- **No empty trailing pages / empty chart anchors.** `anchor=D2:J18` over empty source cells looks like a broken chart.
|
|
||||||
|
|
||||||
If any of the above fails, STOP and fix before declaring done.
|
|
||||||
|
|
||||||
**Print layout.** Any sheet the user may print or send as a board pack needs page setup. Default portrait + no fit-to-page splits wide tables and charts mid-way. Pick the fit mode by sheet shape:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Summary / chart / dashboard sheet (small, ≤ ~40 rows): fit to a single page.
|
|
||||||
officecli set "$FILE" "/Summary" --prop orientation=landscape --prop fitToPage=true
|
|
||||||
# Tall data table (dozens+ rows): fit WIDTH only, let height paginate naturally.
|
|
||||||
# fitToPage=true here crushes every row onto one page → unreadable (### dates, 5px rows).
|
|
||||||
officecli set "$FILE" "/Data" --prop orientation=landscape --prop fitToPage=1x0
|
|
||||||
```
|
|
||||||
|
|
||||||
`fitToPage=true` == `1x1` == fit both axes to one page — correct only when the sheet is already short. `1x0` = fit 1 page wide, unlimited pages tall. Trigger: sheet holds a chart, or > 8 columns, or the user's ask mentions print / board / investor.
|
|
||||||
|
|
||||||
### Financial models only — skip this section if you are building a template, tracker, CSV import, or operational sheet
|
|
||||||
|
|
||||||
Scope: budgets, forecasts, 3-statement models, valuation, any `$`-heavy analytical workbook. A customer-support tracker or onboarding template does not need this section.
|
|
||||||
|
|
||||||
**Color coding — industry standard.** Five core colors used as a language, not decoration. A reviewer should tell what a cell IS by color alone — before reading the formula.
|
|
||||||
|
|
||||||
| Color | Role | Example |
|
|
||||||
|---|---|---|
|
|
||||||
| Blue text `0000FF` | Hardcoded inputs, scenario variables | `font.color=0000FF` |
|
|
||||||
| Black text `000000` | ALL formulas and calculations | default |
|
|
||||||
| Green text `008000` | Cross-sheet links inside this workbook | `font.color=008000` |
|
|
||||||
| Red text `FF0000` | Links to external files / workbooks | `font.color=FF0000` |
|
|
||||||
| Yellow fill `FFFF00` | Key assumptions needing review | `fill=FFFF00` |
|
|
||||||
|
|
||||||
A reviewer should tell what a cell IS just by its color — before reading the formula. This is a communication contract, not a cosmetic preference.
|
|
||||||
|
|
||||||
**Number formatting — standards, not preferences.**
|
|
||||||
|
|
||||||
- **Years** are text, not numbers. Format `2026` not `2,026` — use `numFmt="@"` or set `type=string`.
|
|
||||||
- **Currency** carries its unit in the header (`Revenue ($mm)`), not in every cell.
|
|
||||||
- **Zeros display as `-`**, not `0`. Use `$#,##0;($#,##0);"-"`.
|
|
||||||
- **Percentages** default to one decimal: `0.0%`.
|
|
||||||
- **Negatives use parentheses**: `(1,234)` not `-1,234`.
|
|
||||||
- **Valuation multiples** use `0.0x` format (EV/EBITDA, P/E, etc.).
|
|
||||||
|
|
||||||
**Assumptions live in cells, not inside formulas.** `=B5*(1+$B$6)` is correct; `=B5*1.05` is a bug. Document each blue hardcoded input with an adjacent source note in the next cell or a cell comment:
|
|
||||||
|
|
||||||
```
|
|
||||||
Source: Company 10-K, FY2024, Page 45, Revenue Note
|
|
||||||
Source: Bloomberg, 2026-05-02, AAPL US Equity
|
|
||||||
Source: Management guidance, Q2 2026 earnings call
|
|
||||||
```
|
|
||||||
|
|
||||||
Any hardcoded number without a source is an undocumented assumption — a reviewer cannot audit it.
|
|
||||||
|
|
||||||
## Common Workflow
|
|
||||||
|
|
||||||
Six steps. Every non-trivial build follows this shape.
|
|
||||||
|
|
||||||
1. **Open/save lifecycle.** Use `officecli open <file>` at the start and `officecli save <file>` at the end to flush to disk — `save` only writes and leaves the resident warm for follow-up edits; reach for `officecli close <file>` only to release the resident on a one-shot handoff. Both are always safe (never error or lose work). For many cells, use `batch`: **≤ 50 ops/block recommended; tested up to 80+ ops per block on pure value-set payloads with zero failures. Cross-sheet formula batches are the exception — run those non-resident, single heredoc (see Known Issues)**. **Flush only at the non-officecli boundary:** officecli's own reads always see your edits; run `save`/`close` only before a non-officecli program reads the file (openpyxl/pandas, Excel, a renderer, delivery).
|
|
||||||
2. **Create or load.** `officecli create "$FILE"` (new) or `officecli view "$FILE" outline` (existing — get the lay of the land first).
|
|
||||||
3. **Build incrementally.** One command, read the output, continue. After any structural op (new sheet, chart, named range, pivot), run `get` on it to confirm shape before stacking more on top.
|
|
||||||
4. **Format.** Column widths, number formats, freeze panes, tab colors, header fills. Formatting is not optional polish — per "Requirements for Outputs" it is part of the deliverable.
|
|
||||||
5. **Save, then reckon with the cache.** `officecli save <file>` writes to disk. Newly-added formulas ship without cached values; when a human opens the file in a spreadsheet app, the app recalculates and populates them. **But your downstream `INDEX/MATCH`, `SUMPRODUCT`, or any formula that references an upstream formula will cache whatever the upstream cached at write-time — often `0` or a stale value — and that cached lie survives into non-recalculating readers.** After any multi-formula build involving array formulas (`SUMPRODUCT`, `SUMIFS` with dynamic criteria) or cross-sheet chains, **re-touch every downstream cell** (run `set` again with the same formula) so the engine recomputes its cache from the freshly-cached upstream. ⚠️ Re-touch on cross-sheet chains via resident is unreliable (see Batch / resident caveats) — prefer non-resident `set` for the re-touch pass. Then `officecli get` a few downstream cells and eyeball that their `cachedValue=` is plausible. `validate` is safe with a resident open and itself flushes pending edits to disk (same as docx / pptx).
|
|
||||||
6. **QA — assume there are problems.** See the QA section. You are not done when your last command exited 0; you are done after one fix-and-verify cycle finds zero new issues.
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
Minimal viable xlsx: 3 months of revenue + a total formula + column widths + a currency format. Adapt, don't copy-paste — your file, your data.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli create "$FILE"
|
|
||||||
officecli open "$FILE"
|
|
||||||
officecli set "$FILE" /Sheet1/A1 --prop value=Month --prop bold=true
|
|
||||||
officecli set "$FILE" /Sheet1/B1 --prop value=Revenue --prop bold=true
|
|
||||||
officecli set "$FILE" /Sheet1/A2 --prop value=Jan
|
|
||||||
officecli set "$FILE" /Sheet1/A3 --prop value=Feb
|
|
||||||
officecli set "$FILE" /Sheet1/A4 --prop value=Mar
|
|
||||||
officecli set "$FILE" /Sheet1/B2 --prop value=42000 --prop numFmt='$#,##0'
|
|
||||||
officecli set "$FILE" /Sheet1/B3 --prop value=45000 --prop numFmt='$#,##0'
|
|
||||||
officecli set "$FILE" /Sheet1/B4 --prop value=48000 --prop numFmt='$#,##0'
|
|
||||||
officecli set "$FILE" /Sheet1/A5 --prop value=Total --prop bold=true
|
|
||||||
officecli set "$FILE" /Sheet1/B5 --prop formula="SUM(B2:B4)" --prop bold=true --prop numFmt='$#,##0'
|
|
||||||
officecli set "$FILE" "/Sheet1/col[A]" --prop width=12
|
|
||||||
officecli set "$FILE" "/Sheet1/col[B]" --prop width=15
|
|
||||||
officecli close "$FILE"
|
|
||||||
officecli validate "$FILE"
|
|
||||||
```
|
|
||||||
|
|
||||||
Verified: `validate` returns `no errors found`, `B5` resolves to `135000`. This is the shape of every build: open → set cells/formulas → format → close → validate.
|
|
||||||
|
|
||||||
## CSV / bulk import
|
|
||||||
|
|
||||||
**Native `import` command (preferred for CSV/TSV).** Fastest path; loads a CSV into a sheet in one call. `--header` sets AutoFilter + freeze pane on row 1. Widths and `numFmt` still need a follow-up pass (per D-12 in Dashboard skill).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli import "$FILE" /Sheet1 --file data.csv --header
|
|
||||||
officecli import "$FILE" /Sheet1 --file data.tsv --format tsv --header
|
|
||||||
officecli import "$FILE" /Sheet1 --stdin --start-cell B2 < data.csv
|
|
||||||
```
|
|
||||||
|
|
||||||
**Python + batch fallback** — use when you need custom type coercion, formula injection, or the CSV lives inside another data pipeline. Recipe for 600-6000+ cells:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# gen_batch.py — produces batch chunks of 80 value-set ops each
|
|
||||||
import csv, json
|
|
||||||
ops = []
|
|
||||||
with open("data.csv") as f:
|
|
||||||
reader = csv.reader(f)
|
|
||||||
for r, row in enumerate(reader, start=1):
|
|
||||||
for c, val in enumerate(row):
|
|
||||||
col = chr(ord('A') + c)
|
|
||||||
ops.append({"command":"set","path":f"/Data/{col}{r}",
|
|
||||||
"props":{"value": val}})
|
|
||||||
for i in range(0, len(ops), 80):
|
|
||||||
print(json.dumps(ops[i:i+80]))
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python gen_batch.py | while IFS= read -r chunk; do
|
|
||||||
printf '%s\n' "$chunk" | officecli batch "$FILE"
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
Outcome: 648-row retail CSV (6490 cells) loads in ~30s, zero failures. Tune: start at 80 ops/chunk, drop to 40 if any chunk fails. Numeric type inference and formulas come later via targeted `set` — batch in this recipe is pure value injection.
|
|
||||||
|
|
||||||
## Reading & Analysis
|
|
||||||
|
|
||||||
Start wide, then narrow. `outline` first tells you what sheets exist and where the data is; jump into `view` / `get` / `query` only once you know where to look.
|
|
||||||
|
|
||||||
**Open the rendered workbook to eyeball your own work.**
|
|
||||||
- `officecli view $FILE html` — Read the returned HTML to audit the rendered output. Each sheet is addressable, charts render inline. Catches `###`, placeholder leakage, pivot layout, row-height clipping.
|
|
||||||
- `officecli watch $FILE` keeps a live preview running for the human user — they open it at their own discretion. Use when the user wants to watch along; agent self-check uses `view html` above.
|
|
||||||
Use `view html` as your **first visual check after a batch of edits** — fix at source. For final visual verification, the user opens the `.xlsx` in their Excel / WPS / Numbers viewer.
|
|
||||||
|
|
||||||
**Orient.** Sheets, dimensions, formula counts.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli view "$FILE" outline
|
|
||||||
```
|
|
||||||
|
|
||||||
**Extract.** Plain text dump for content QA or LLM context; scope with `--start` / `--end` / `--cols` for big files.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli view "$FILE" text --start 1 --end 50 --cols A,B,C
|
|
||||||
```
|
|
||||||
|
|
||||||
Other `view` modes worth knowing: `annotated` (cell values + types/formulas + warnings), `stats` (numeric summaries), `issues` (broken formulas, empty sheets, missing refs).
|
|
||||||
|
|
||||||
**Round-trip dump.** `officecli dump "$FILE" [path]` serializes the workbook — or one worksheet (`/Sheet1`, `/sheet[N]`) — into a replayable batch JSON; `officecli batch new.xlsx --input dump.json` replays it. Use it to learn from an existing workbook's structure or clone/adapt a template instead of reading raw OOXML. Coverage per `dump --help`; subtree dumps don't carry workbook-level resources (settings, named ranges) — the replay target must already define them.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli dump "$FILE" -o blueprint.json # whole workbook
|
|
||||||
officecli dump "$FILE" /Sheet1 -o sheet.json # one worksheet
|
|
||||||
officecli batch new.xlsx --input blueprint.json
|
|
||||||
```
|
|
||||||
|
|
||||||
**Inspect one element.** Use XPath-style paths. Always quote — shells glob `[N]`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli get "$FILE" "/Sheet1/A1" # one cell
|
|
||||||
officecli get "$FILE" "/Sheet1/A1:D10" # range
|
|
||||||
officecli get "$FILE" "/Sheet1/chart[1]" # chart
|
|
||||||
officecli get "$FILE" "/Sheet1/table[1]" # ListObject
|
|
||||||
officecli get "$FILE" "/namedrange[1]" # workbook-level named range
|
|
||||||
```
|
|
||||||
|
|
||||||
Add `--depth N` to expand children; add `--json` for machine output. Full element list: `officecli help xlsx`.
|
|
||||||
|
|
||||||
**Query across the workbook.** CSS-like selectors. Use for systematic checks (formula coverage, error cells, empty headers) rather than hand-walking.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli query "$FILE" 'cell:has(formula)' # every formula cell
|
|
||||||
officecli query "$FILE" 'cell:contains("#REF!")' # broken references
|
|
||||||
officecli query "$FILE" 'cell[type=Number]' # typed filter
|
|
||||||
officecli query "$FILE" 'Sheet1!B[value!=0]' # sheet-scoped
|
|
||||||
```
|
|
||||||
|
|
||||||
Operators: `=`, `!=`, `~=` (contains), `>=`, `<=`, `[attr]` (exists).
|
|
||||||
|
|
||||||
**Merge cells shortcut.** `officecli query $FILE merge` or `mergedrange` — both are aliases for `mergeCell`. Returns every merged range in the workbook without hand-walking `<mergeCell>` entries.
|
|
||||||
|
|
||||||
**When the data is big enough that a row-walk is useless**, reach for Excel's own analytical elements:
|
|
||||||
|
|
||||||
- Build a **pivot table** with `officecli add` (`--type pivottable`) to group/aggregate without writing 20 SUMIFs. Attach a **slicer** (`--type slicer`) to give the reader a filter UI.
|
|
||||||
- Drop a **sparkline** (`--type sparkline`) in a row to show per-row trends — cheaper than one line chart per row and they print inline. `type` is a strict enum: **`line | column | stacked`** (plus aliases `winloss` / `win-loss` → `stacked`). Invalid `type=` values hard-fail — no silent fallback to `line` anymore.
|
|
||||||
- Run `officecli help xlsx pivottable`, `officecli help xlsx slicer`, `officecli help xlsx sparkline` for the exact prop names.
|
|
||||||
|
|
||||||
## Creating & Editing
|
|
||||||
|
|
||||||
Ninety percent of a build is cells, formulas, formatting, and one or two charts. The verbs: `add` (new element), `set` (change a prop), `remove`, `move`, `swap`, `batch`.
|
|
||||||
|
|
||||||
### Cells and formulas
|
|
||||||
|
|
||||||
Set a value and its format in one call. Never write `=` at the start of a formula — the CLI strips it.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" /Sheet1/B5 --prop formula="SUM(B2:B4)" --prop numFmt='$#,##0'
|
|
||||||
officecli set "$FILE" /Sheet1/C5 --prop formula="B5/A5" --prop numFmt="0.0%"
|
|
||||||
```
|
|
||||||
|
|
||||||
Structural properties (width, height, freeze, tabColor) live on row / col / sheet nodes:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set "$FILE" "/Sheet1/col[A]" --prop width=20
|
|
||||||
officecli set "$FILE" "/Sheet1/row[1]" --prop height=22
|
|
||||||
officecli set "$FILE" "/Sheet1" --prop freeze=A2 --prop tabColor=1F4E79
|
|
||||||
```
|
|
||||||
|
|
||||||
### Named ranges
|
|
||||||
|
|
||||||
Prefer named ranges over `$B$6` in formulas. They self-document (`GrowthRate` beats `$B$6`) and they let you move the assumption cell without breaking formulas. Because `ref` values contain both `!` and `$`, add them through a batch heredoc:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/","type":"namedrange","props":{"name":"GrowthRate","ref":"Sheet1!$B$6"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
See `officecli help xlsx namedrange` for the full schema.
|
|
||||||
|
|
||||||
**Batch JSON does NOT accept shell aliases.** Inside batch `props`, always use the full dotted name — `"font.color": "FF0000"`, `"font.size": 14`, never `"color": "FF0000"` (ambiguous: text vs fill). On a bare cell, even the shell form is rejected: `--prop color=1F4E79` errors with `ambiguous in cell context — use 'font.color' (text) or 'fill' (bg)`. Rule: in any batch JSON or cell prop, write `font.color` / `fill` explicitly. `parent` should be `"/"` for workbook-level elements and `"/SheetName"` for sheet-scoped; empty string is not equivalent.
|
|
||||||
|
|
||||||
### Charts
|
|
||||||
|
|
||||||
Chart types live under `officecli help xlsx chart` — the enum is long (20+). Pick the right one for the message: column for category comparison, line for time series, pie only when slices are self-evidently proportional, scatter for correlation. Avoid exotic types unless they answer a specific question.
|
|
||||||
|
|
||||||
**Three ways to feed chart data. Pick one per chart — mixing them at add-time is a common trap.**
|
|
||||||
|
|
||||||
| Form | Shape | When to use |
|
|
||||||
|---|---|---|
|
|
||||||
| (a) inline `data` | `--prop data="Sales:100,200,300" --prop categories="Jan,Feb,Mar"` | Tiny demo charts, numbers you will not edit. Source of truth lives in the chart XML, not a cell. |
|
|
||||||
| (b) 2D `dataRange` | `--prop dataRange="Sheet1!A1:B4"` (first col = categories, first row = header / series name) | Normal case. Must be **2-D** — single column fails with "Chart requires data". |
|
|
||||||
| (c) dotted per-series | `--prop series1.name=Sales --prop series1.values="Sheet1!B2:B4" --prop series1.categories="Sheet1!A2:A4"` | Multi-series charts where each series points at non-contiguous ranges, or you want explicit series naming. `series1.values` alone (no `categories`) emits a chart with `1,2,3` as the x-axis. |
|
|
||||||
|
|
||||||
**The single-column trap.** `dataRange="Sheet1!B2:B13"` looks like "value column" but the engine rejects it with `Chart requires data`. Either widen the range to include the category column (`A2:B13`), or switch to form (c) with explicit `series1.categories`.
|
|
||||||
|
|
||||||
**Move / resize a chart after create:** `set chart[N] --prop anchor="F5:N25"` (also `--prop x= --prop y= --prop width= --prop height=`). **Series are still immutable** — to add/change a series, `officecli remove` the chart and `officecli add` with the full series list. Note `remove chart[1]` shifts `chart[2] → chart[1]` and re-add **appends at the end** — to preserve chart order, remove all and rebuild in order.
|
|
||||||
|
|
||||||
**Anchor sizing.** No auto-fit. A column chart with 5-6 categories + 2 series needs roughly `A5:L22` (12 cols × 18 rows) to show all labels uncut. Narrower and X-axis labels clip; wider and the chart can split across pages on print/export. If in doubt, start narrow, preview via `view html` (Read the returned HTML path), widen in increments. Page layout (below) is the other half of the fix.
|
|
||||||
|
|
||||||
**Chart `dataRange` — always prefix with the sheet.** Even when the chart lives on the same sheet, write `dataRange="Summary!A17:C22"`, not `A17:C22`. The sheet-less form works inconsistently; the prefixed form is 100% reliable.
|
|
||||||
|
|
||||||
officecli adds extended chart types the classic Excel object model lacks: `boxWhisker`, `waterfall`, `funnel`, `histogram`, `treemap`, `sunburst`, `pareto`. Use them when the data calls for them.
|
|
||||||
|
|
||||||
**NEVER put unreplaced template tokens in chart title / series name / legend / axis title.** `$fy$24`, `{var}`, `<TODO>`, `$VAR`, `{{placeholder}}` render **literally** in the legend — validate passes, but a CFO sees `$fy$24` where "FY2024" should be. Always bind to final text or a cell reference (`title="FY2024 Revenue"` or `series1.name="Sheet1!A1"`).
|
|
||||||
|
|
||||||
### Conditional formatting
|
|
||||||
|
|
||||||
Three common flavors, each with its own prop shape (consult `officecli help xlsx cf`):
|
|
||||||
|
|
||||||
- **Color scales**: cells shaded on a gradient by value — `type=colorscale` with `minColor` / `midColor` / `maxColor`.
|
|
||||||
- **Data bars**: in-cell bars showing magnitude — `type=databar`. Set explicit `min` / `max` for consistent scaling across a column; defaults are valid if you omit them.
|
|
||||||
- **Formula rules** (the `formulacf` element): highlight row when a condition is true — `type=formula` with `formula="$C2>1000"` and a fill/font.
|
|
||||||
|
|
||||||
Rule: apply CF sparingly. A workbook where every cell is colored tells the reader nothing.
|
|
||||||
|
|
||||||
### Data validation
|
|
||||||
|
|
||||||
Input cells in trackers and templates MUST carry data validation. It's cheap and it stops entire classes of downstream bugs. **Three list-source patterns** — pick based on where the allowed values live.
|
|
||||||
|
|
||||||
**(a) Inline list** — allowed values are short and fixed in the rule itself.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add "$FILE" /Sheet1 --type validation \
|
|
||||||
--prop sqref="C2:C100" --prop type=list \
|
|
||||||
--prop formula1="Yes,No,Maybe" \
|
|
||||||
--prop showError=true --prop errorTitle="Invalid" --prop error="Select from list"
|
|
||||||
```
|
|
||||||
|
|
||||||
**(b) Named range (preferred for cross-sheet lookups)** — allowed values live in another sheet and may grow. Define the named range first, then reference it. Use a batch heredoc because `ref` contains `!` and `$`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/","type":"namedrange","props":{"name":"StatusList","ref":"Lookups!$A$2:$A$4"}},
|
|
||||||
{"command":"add","parent":"/Sheet1","type":"validation","props":{"sqref":"B2:B100","type":"list","formula1":"=StatusList"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
**(c) Direct cross-sheet range** — no named range, raw `Lookups!$A$2:$A$4` inside `formula1`. Also needs a batch heredoc to keep `!` and `$` intact:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[
|
|
||||||
{"command":"add","parent":"/Sheet1","type":"validation","props":{"sqref":"C2:C100","type":"list","formula1":"Lookups!$A$2:$A$4"}}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
If you write the cross-sheet variant as `--prop formula1=...` on the shell, the `!` gets shell-mangled into `\!` and the dropdown will silently fall back to no list. Verify with `officecli get "$FILE" /Sheet1/validation[N]` — `formula1=` must show a plain `!`, no backslash.
|
|
||||||
|
|
||||||
Other common `type` values: `decimal`, `whole`, `date`, `textLength`, `custom`. See `officecli help xlsx validation` for operators and the full prop list.
|
|
||||||
|
|
||||||
### Other elements (one-liners)
|
|
||||||
|
|
||||||
- **Tables** (ListObjects) — `add --type table` with a range; gives auto-filter + structured refs. `officecli help xlsx table`.
|
|
||||||
- **Comments** — `add --type comment`; use for documenting hardcoded assumptions. `officecli help xlsx comment`.
|
|
||||||
- **Sheet reordering** — `officecli move`, not `swap`. `swap` only works on row/cell paths.
|
|
||||||
- **New row/column with the neighbours' formatting** — `add "$FILE" /Sheet1 --from "/Sheet1/row[5]" --index 5` clones fills, fonts and formulas (refs shift); `add --type row` inserts a bare row.
|
|
||||||
|
|
||||||
## Chart Axis-by-Role
|
|
||||||
|
|
||||||
Editing a chart axis in place is cheaper than rebuilding the chart. Address axes by **role** (`value` = Y, `category` = X), not by index — the XML order isn't stable.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli get "$FILE" "/Sheet1/chart[1]/axis[@role=value]"
|
|
||||||
officecli set "$FILE" "/Sheet1/chart[1]/axis[@role=value]" --prop min=0 --prop max=100000
|
|
||||||
officecli set "$FILE" "/Sheet1/chart[1]/axis[@role=category]" --prop title="Month"
|
|
||||||
```
|
|
||||||
|
|
||||||
Safe props: `title`, `min`, `max`, `majorGridlines`, `visible`, `labelRotation`.
|
|
||||||
|
|
||||||
## QA (Required)
|
|
||||||
|
|
||||||
**Assume there are problems. Your job is to find them.**
|
|
||||||
|
|
||||||
Your first workbook is almost never correct. Treat QA as a bug hunt, not a confirmation step. If you found zero issues on first inspection, you were not looking hard enough. The formulas look fine **until** you check two of them against source cells.
|
|
||||||
|
|
||||||
### Minimum cycle before "done"
|
|
||||||
|
|
||||||
1. `officecli view "$FILE" issues` — empty sheets, broken formulas, missing refs.
|
|
||||||
2. `officecli view "$FILE" annotated` (sample ranges) — values + types + warnings.
|
|
||||||
3. For every Excel error type, query it:
|
|
||||||
```bash
|
|
||||||
officecli query "$FILE" 'cell:contains("#REF!")'
|
|
||||||
officecli query "$FILE" 'cell:contains("#DIV/0!")'
|
|
||||||
officecli query "$FILE" 'cell:contains("#VALUE!")'
|
|
||||||
officecli query "$FILE" 'cell:contains("#NAME?")'
|
|
||||||
officecli query "$FILE" 'cell:contains("#N/A")'
|
|
||||||
```
|
|
||||||
4. `officecli validate "$FILE"` — safe with a resident open; `validate` flushes pending edits to disk itself.
|
|
||||||
5. **Visual pass — walk every sheet via the HTML preview.** Run `officecli view "$FILE" html` and Read the returned HTML path. Each sheet renders with charts inline. Scan for `###`, truncated titles, placeholder tokens (`$fy$24`, `{var}`, `<TODO>`), sliced charts, white-slice pie charts, empty chart anchors — **STOP and fix before declaring done**. "validate pass" is not delivery; "the preview looks like a real workbook" is delivery. For human preview, run `officecli watch "$FILE"` (user opens the live preview at their own discretion) or have them open the `.xlsx` directly in Excel / WPS / Numbers.
|
|
||||||
6. **Print layout fix (wide tables / multi-chart sheets).** When a sheet holds a chart or a wide table and the user will print it, set per-sheet page layout — but match the fit mode to the sheet's height:
|
|
||||||
```bash
|
|
||||||
# Short summary / chart sheet → fit to one page.
|
|
||||||
officecli set "$FILE" "/Summary" --prop orientation=landscape --prop fitToPage=true
|
|
||||||
# Tall data table → fit width only (fitToPage=true would crush all rows onto one unreadable page).
|
|
||||||
officecli set "$FILE" "/Data" --prop orientation=landscape --prop fitToPage=1x0
|
|
||||||
```
|
|
||||||
Outcome: charts/wide tables print without mid-chart splits; tall tables stay readable across natural page breaks. Apply to every sheet that holds a chart or a > 8-column table.
|
|
||||||
7. If anything failed, fix, then **rerun the full cycle**. One fix commonly creates another problem.
|
|
||||||
|
|
||||||
`officecli view issues` + `view html` are the structural QA pair: `issues` catches broken formulas and empty sheets; `view html` (Read the returned HTML path) catches `###`, truncation, and token leakage. Chart fill colors / theme tints can vary across viewers — spot-check in the user's target viewer when color fidelity matters.
|
|
||||||
|
|
||||||
### Formula verification checklist
|
|
||||||
|
|
||||||
- [ ] Pick 2-3 formulas at random. Run `officecli get` on each. Confirm the formula string is what you intended **and** `cachedValue=` is what you expect — arithmetic in your head.
|
|
||||||
- [ ] **Cached value sanity on every summary cell.** Any cell that aggregates (COUNTA / COUNTIF / SUMPRODUCT / INDEX&MATCH) must have a plausible `cachedValue`. If a progress tracker shows `199 / 199 / 100%` on a blank template, the cache is lying — re-touch the formula via `set` (forces recompute) or manually set a correct cached value. Do NOT ship "validate passes but the numbers are fiction".
|
|
||||||
- [ ] **Spot-check one cell per numeric column.** `%` columns showing integer `0.0%` throughout means the denominator is wrong or the numerator is cached stale — investigate one cell, fix the pattern.
|
|
||||||
- [ ] Ranges include every row: off-by-one on `SUM(B2:B12)` when data goes to `B13` is the most common bug.
|
|
||||||
- [ ] Cross-sheet formulas (`Sheet1!A1`) contain no `\!`. If `officecli get` shows `Sheet1\!A1`, the `!` was shell-corrupted — delete and re-enter via batch/heredoc.
|
|
||||||
- [ ] Named ranges (`officecli get "$FILE" "/namedrange[1]"`) point at what their names claim.
|
|
||||||
- [ ] Every `/` denominator is guarded — `IFERROR(x/y, 0)` or `IF(y=0, 0, x/y)`.
|
|
||||||
- [ ] Chart data vs source cells: for every chart with inline data, spot-check data points against `officecli get` of the source cells.
|
|
||||||
- [ ] Chart title / series name / legend contain **no** unreplaced tokens (`$...$`, `{var}`, `<TODO>`). Grep the chart via `officecli get /Sheet1/chart[N]`.
|
|
||||||
|
|
||||||
### Template QA
|
|
||||||
|
|
||||||
When editing a template, check for leftover placeholders — they look like content and slip past `validate`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli query "$FILE" 'cell:contains("{{")'
|
|
||||||
officecli query "$FILE" 'cell:contains("xxxx")'
|
|
||||||
officecli query "$FILE" 'cell:contains("TBD")'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Fresh eyes
|
|
||||||
|
|
||||||
When you finish a workbook, open it fresh. Read `view text` / HTML preview top-to-bottom as if you are a new reviewer — look for formulas, numbers that look off, formatting inconsistency, missing data.
|
|
||||||
|
|
||||||
### Honest limit
|
|
||||||
|
|
||||||
`validate` catches schema errors, not design errors. A workbook can pass `validate` with every number wrong. The checklist above — especially spot-checking formulas against source cells — is how you catch what validation can't.
|
|
||||||
|
|
||||||
## Known Issues & Pitfalls
|
|
||||||
|
|
||||||
### The cross-sheet `!` trap (short)
|
|
||||||
|
|
||||||
Shells (bash history expansion, zsh splitting) and CLI arg parsing mangle `!` in `Sheet1!A1` into `\!`. A formula containing `\!` is silently broken — it renders as literal text and references nothing.
|
|
||||||
|
|
||||||
**Fix.** Use a batch heredoc with single-quoted delimiter (`<<'EOF'`), which disables all shell expansion:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat <<'EOF' | officecli batch "$FILE"
|
|
||||||
[{"command":"set","path":"/Summary/B2","props":{"formula":"Revenue!B13"}}]
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
**Verify.** After writing, `officecli get` the cell; `formula=` must show a plain `!` with no backslash.
|
|
||||||
|
|
||||||
### CLI bug backlog (short)
|
|
||||||
|
|
||||||
CLI constraints and gaps to work around — not defects in the output file.
|
|
||||||
|
|
||||||
- **Chart series are immutable after create** — to add/change a series: `remove` + `add` with the full series list. (Position is mutable: `set chart[N] --prop anchor=` / `x/y/width/height`.) `remove chart[N]` shifts subsequent indices down; re-add appends at end.
|
|
||||||
- **Cross-sheet formula batches run fine through a resident** — a prior "deadlocks even at 3-5 ops" caution no longer reproduces. Pure value-set batches stay reliable at 50-80+ ops too. If you ever hit a hang, fall back to a non-resident one-big-batch or individual `set`. **Multiple resident processes on the same file/machine can still contend** — expect non-deterministic hangs if another agent/session holds a resident on the same file.
|
|
||||||
- **Conditional formatting naming asymmetry** — the element name for `--type` is `conditionalformatting`; the path suffix is `/cf[N]`. Use `officecli help xlsx conditionalformatting` for schema, `/cf[N]` for paths.
|
|
||||||
- **Sheet `position` prop on add** — help says Add processes `position`, but the prop is often ignored. Reorder with `officecli move --index` / `--after` / `--before` after creating the sheet.
|
|
||||||
- **`remove /sheet[N]` cascade guard** — rejects sheet remove/rename when the sheet is referenced by validation / conditional format / sparkline / hyperlink / named range on another sheet. Remove those dependent elements first, then remove the sheet.
|
|
||||||
- **Batch JSON rejects cell `color` alias** — inside batch `props`, `"color": "FF0000"` errors `ambiguous in cell context — use 'font.color' (text) or 'fill' (bg)`. The CLI at shell level accepts `--prop color=...` / `--prop size=14` as aliases on non-cell elements, but inside batch JSON on a cell always write the full dotted name: `"font.color"`, `"font.size"`, `"font.name"`.
|
|
||||||
|
|
||||||
### Renderer caveats (cross-viewer color fidelity)
|
|
||||||
|
|
||||||
`officecli view html` is the right tool for structural QA (overflow, truncation, placeholder leakage, layout) — Read the returned HTML path. Some chart rendering details vary across the viewer the end user opens the file in. Observed divergences:
|
|
||||||
|
|
||||||
- **Pie / doughnut fill colors may collapse to a single theme tint** in some viewers (slices look "all white" or "all one color"). The file may be fine in the user's target viewer.
|
|
||||||
- **Line chart / column chart series colors may drift** from the workbook theme in some viewers.
|
|
||||||
- **Form-control checkboxes may render as double-boxed** in some viewers.
|
|
||||||
|
|
||||||
Before calling a color or chart "broken", open the file in the user's actual target viewer. If it looks correct there, the problem is viewer rendering, not data — do not chase it. The CLI's structural checks (`###`, truncation, placeholder text, layout) remain authoritative.
|
|
||||||
|
|
||||||
### Escape layers (shell quoting is above; these are the extras)
|
|
||||||
|
|
||||||
`$` is the shell layer (single-quote it, above). `\n` / `\t` in a prop value ARE interpreted by the CLI into a real newline / tab. Two more layers:
|
|
||||||
|
|
||||||
- **JSON level (batch).** Standard JSON escapes — `"\n"`, `"\t"`, `"\""`. A real backslash in the final string is `"\\\\"`.
|
|
||||||
- **Excel level.** `\n` in a cell is a real line break — pair with `--prop wrapText=true` so Excel shows the wrap. Works in a shell-quoted prop directly (`--prop value='a\nb'`); `"\n"` inside batch JSON gives the same. When in doubt, `officecli get` the cell and compare character-for-character.
|
|
||||||
|
|
||||||
### Other common pitfalls
|
|
||||||
|
|
||||||
| Pitfall | Fix |
|
|
||||||
|---|---|
|
|
||||||
| `--name "foo"` | All attrs go through `--prop`: `--prop name="foo"` |
|
|
||||||
| Guessing a prop name | `officecli help xlsx <element>` — don't improvise |
|
|
||||||
| `--prop color=...` on a cell | Ambiguous — use `font.color` (text) or `fill` (bg). Also applies inside batch JSON: always use full dotted names, never shell aliases |
|
|
||||||
| `#FF0000` hex colors | Drop the `#`: `FF0000` |
|
|
||||||
| `--index` vs `[N]` | `--index` is 0-based (array); `[N]` paths are 1-based (XPath) |
|
|
||||||
| Unquoted `[N]` in zsh/bash | Quote every path: `"/Sheet1/row[1]"` |
|
|
||||||
| Sheet name with spaces | Quote full path: `"/My Sheet/A1"` |
|
|
||||||
| Year showing as `2,026` | `--prop type=string` or `numFmt="@"` |
|
|
||||||
| Modifying a file open in Excel | Close it in Excel first |
|
|
||||||
| `swap` not reordering sheets | `swap` is for rows/cells. Use `move --after` / `--before` / `--index` for sheets |
|
|
||||||
| Cached values missing after write | New formulas get cached values when a human opens the file; `validate` accepts them either way |
|
|
||||||
-417
@@ -1,417 +0,0 @@
|
|||||||
---
|
|
||||||
name: officecli
|
|
||||||
description: Create, analyze, proofread, and modify Office documents (.docx, .xlsx, .pptx) using the officecli CLI tool. Use when the user wants to create, inspect, check formatting, find issues, add charts, or modify Office documents.
|
|
||||||
---
|
|
||||||
|
|
||||||
# officecli
|
|
||||||
|
|
||||||
AI-friendly CLI for .docx, .xlsx, .pptx. Single binary, no dependencies, no Office installation needed.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
If `officecli` is not installed:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# macOS / Linux
|
|
||||||
curl -fsSL https://d.officecli.ai/install.sh | bash
|
|
||||||
|
|
||||||
# Windows (PowerShell)
|
|
||||||
irm https://d.officecli.ai/install.ps1 | iex
|
|
||||||
```
|
|
||||||
|
|
||||||
Verify with `officecli --version`. If still not found after install, open a new terminal.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Strategy
|
|
||||||
|
|
||||||
**L1 (read) → L2 (DOM edit) → L3 (raw XML)**. Always prefer higher layers. Add `--json` for structured output.
|
|
||||||
|
|
||||||
**Before doc work, check Specialized Skills** (bottom of this file). Fundraising decks, academic papers, financial models, dashboards, and Morph animations need their own skill loaded first — `load_skill` once, then proceed.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Help System (IMPORTANT)
|
|
||||||
|
|
||||||
**When unsure about property names, value formats, or command syntax, ALWAYS run help instead of guessing.** One help query beats guess-fail-retry loops.
|
|
||||||
|
|
||||||
`officecli help` ≡ `officecli --help`, and `officecli <cmd> --help` ≡ `officecli help <cmd>` — same content.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli help # All commands + global options + schema entry points
|
|
||||||
officecli help docx # List all docx elements
|
|
||||||
officecli help docx paragraph # Full schema: properties, aliases, examples, readbacks
|
|
||||||
officecli help docx set paragraph # Verb-filtered: only props usable with `set`
|
|
||||||
officecli help docx paragraph --json # Structured schema (machine-readable)
|
|
||||||
```
|
|
||||||
|
|
||||||
Format aliases: `word`→`docx`, `excel`→`xlsx`, `ppt`/`powerpoint`→`pptx`. Verbs: `add`, `set`, `get`, `query`, `remove`. MCP exposes the same schema via the single `command` string param: `{"command":"help docx paragraph"}` (not a structured `{"format":...,"type":...}` object — the MCP tool has exactly one param, `command`, and passes it through to the CLI verbatim).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Performance: Resident Mode
|
|
||||||
|
|
||||||
**Every command auto-starts a resident on first access** (60s idle timeout) — file-lock conflicts are automatically avoided. Explicit `open`/`close` is still recommended for longer sessions (12min idle):
|
|
||||||
```bash
|
|
||||||
officecli open report.docx # explicitly keep in memory
|
|
||||||
officecli set report.docx ... # no file I/O overhead
|
|
||||||
officecli close report.docx # save and release
|
|
||||||
```
|
|
||||||
|
|
||||||
Opt out of auto-start: `OFFICECLI_NO_AUTO_RESIDENT=1`.
|
|
||||||
|
|
||||||
**Flush only at the non-officecli boundary.** officecli's own reads (`get`/`query`/`view`/`dump`) always see your latest edits, so you never need to save mid-workflow. Run `save` (keeps the resident) or `close` (flush + release) only **before a non-officecli program reads the file** — python-docx/openpyxl, Word, a renderer, delivery/upload. (Idle sessions auto-flush within seconds; `OFFICECLI_RESIDENT_FLUSH=each` makes every mutation flush before returning.)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
**PPT:**
|
|
||||||
```bash
|
|
||||||
officecli create slides.pptx
|
|
||||||
officecli add slides.pptx / --type slide --prop title="Q4 Report" --prop background=1A1A2E
|
|
||||||
officecli add slides.pptx '/slide[1]' --type shape --prop text="Revenue grew 25%" --prop x=2cm --prop y=5cm --prop font=Arial --prop size=24 --prop color=FFFFFF
|
|
||||||
```
|
|
||||||
|
|
||||||
**Word:**
|
|
||||||
```bash
|
|
||||||
officecli create report.docx
|
|
||||||
officecli add report.docx /body --type paragraph --prop text="Executive Summary" --prop style=Heading1
|
|
||||||
officecli add report.docx /body --type paragraph --prop text="Revenue increased by 25% year-over-year."
|
|
||||||
```
|
|
||||||
|
|
||||||
**Excel:**
|
|
||||||
```bash
|
|
||||||
officecli create data.xlsx
|
|
||||||
officecli set data.xlsx /Sheet1/A1 --prop value="Name" --prop bold=true
|
|
||||||
officecli set data.xlsx /Sheet1/A2 --prop value="Alice"
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## L1: Create, Read & Inspect
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli create <file> # Create blank .docx/.xlsx/.pptx (type from extension)
|
|
||||||
officecli view <file> <mode> # outline | stats | issues | text | annotated | html
|
|
||||||
officecli get <file> <path> --depth N # Get a node and its children [--json]
|
|
||||||
officecli query <file> <selector> # CSS-like query
|
|
||||||
officecli validate <file> # Validate against OpenXML schema
|
|
||||||
```
|
|
||||||
|
|
||||||
### view modes
|
|
||||||
|
|
||||||
| Mode | Description | Useful flags |
|
|
||||||
|------|-------------|-------------|
|
|
||||||
| `outline` | Document structure | |
|
|
||||||
| `stats` | Statistics (pages, words, shapes) | |
|
|
||||||
| `issues` | Formatting/content/structure problems | `--type format\|content\|structure`, `--limit N` |
|
|
||||||
| `text` | Plain text extraction | `--start N --end N`, `--max-lines N` |
|
|
||||||
| `annotated` | Text with formatting annotations | |
|
|
||||||
| `html` | Static HTML snapshot — same renderer as `watch`, no server needed | `--browser`, `--page N` (docx), `--start N --end N` (pptx) |
|
|
||||||
| `screenshot` / `svg` / `pdf` / `forms` | PNG via headless browser / SVG (pptx slide) / PDF via exporter plugin / form-fields JSON via format-handler plugin | `-o`, `--screenshot-width/-height`, pptx `--grid N` |
|
|
||||||
|
|
||||||
Use `view html` for one-shot snapshots (CI artifacts, archival, diffing); use `watch` when you need live refresh or browser-side click-to-select.
|
|
||||||
|
|
||||||
### get
|
|
||||||
|
|
||||||
Any XML path via element localName. Use `--depth N` to expand children. Add `--json` for structured output. Default text output is grep-friendly: `path (type) "text" key=val key=val ...`
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli get report.docx '/body/p[3]' --depth 2 --json
|
|
||||||
officecli get slides.pptx '/slide[1]' --depth 1 # list all shapes on slide 1
|
|
||||||
officecli get data.xlsx '/Sheet1/B2' --json
|
|
||||||
```
|
|
||||||
|
|
||||||
### Stable ID Addressing
|
|
||||||
|
|
||||||
Elements with stable IDs return `@attr=value` paths instead of positional indices. Prefer these in multi-step workflows — positional indices shift on insert/delete, stable IDs do not.
|
|
||||||
|
|
||||||
```
|
|
||||||
/slide[1]/shape[@id=550950021] # PPT shape
|
|
||||||
/slide[1]/table[@id=1388430425]/tr[1]/tc[2] # PPT table
|
|
||||||
/body/p[@paraId=1A2B3C4D] # Word paragraph
|
|
||||||
/comments/comment[@commentId=1] # Word comment
|
|
||||||
```
|
|
||||||
|
|
||||||
PPT also accepts `@name=` (e.g. `shape[@name=Title 1]`), with morph `!!` prefix awareness. Elements without stable IDs (slide, run, tr/tc, row) fall back to positional indices.
|
|
||||||
|
|
||||||
### query
|
|
||||||
|
|
||||||
CSS-like selectors: `[attr=value]`, `[attr!=value]`, `[attr~=text]`, `[attr>=value]`, `[attr<=value]`, `:contains("text")`, `:empty`, `:has(formula)`, `:no-alt`. Boolean `and`/`or` supported across `query`/`set`/`remove`: `cell[value>5000 or value<100]`, `cell[(type=Number or type=Date) and value>0]`. Excel row-by-column-name: `Sheet1!row[Salary>5000]`. `set` accepts selectors and Excel-native paths (parity with `get`/`query`). Bare unscoped selectors rejected on `set`/`remove`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli query report.docx 'paragraph[style=Normal] > run[font!=Arial]'
|
|
||||||
officecli query slides.pptx 'shape[fill=FF0000]'
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Watch & Interactive Selection
|
|
||||||
|
|
||||||
Live HTML preview that auto-refreshes on every file change. Browsers can click / shift-click / box-drag to select shapes; the CLI can read the current browser selection and act on it.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli watch <file> [--port N] # Start preview server (default port 26315)
|
|
||||||
officecli unwatch <file> # Stop
|
|
||||||
officecli goto <file> <path> # Scroll watching browser(s) to element (docx: p / table / tr / tc)
|
|
||||||
```
|
|
||||||
|
|
||||||
Open the printed `http://localhost:N` URL. Click to select; shift/cmd/ctrl+click to multi-select; drag from empty space to box-select. PPT/Word use blue outline; Excel uses native-style green selection (double-click cell to edit inline; drag a chart to reposition).
|
|
||||||
|
|
||||||
### `get <file> selected` — read what the user clicked
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli get <file> selected [--json]
|
|
||||||
```
|
|
||||||
|
|
||||||
Returns DocumentNodes for whatever is currently selected. Empty result if nothing selected. Exit code != 0 if no watch is running.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# User clicks shapes in the browser, then asks "make these red"
|
|
||||||
PATHS=$(officecli get deck.pptx selected --json | jq -r '.data.Results[].path')
|
|
||||||
for p in $PATHS; do officecli set deck.pptx "$p" --prop fill=FF0000; done
|
|
||||||
```
|
|
||||||
|
|
||||||
### Key properties
|
|
||||||
|
|
||||||
- **Selection survives file edits.** Paths use stable `@id=` form.
|
|
||||||
- **All connected browsers share one selection.** Last-write-wins.
|
|
||||||
- **Same-file single-watch.** A given file can have only one watch process at a time.
|
|
||||||
- **Group shapes select as a whole.** Drilling into individual children of a group is not supported in v1.
|
|
||||||
- **Coverage:** `.pptx` shapes/pictures/tables/charts/connectors/groups; `.docx` top-level paragraphs and tables. Inherited layout/master decorations and Word nested elements (table cells, run-level) are not addressable. **`.xlsx` does not emit `data-path`** — `mark`/`selection` on xlsx always resolve `stale=true` (v2 candidate).
|
|
||||||
|
|
||||||
### Marks — edit proposals waiting for review
|
|
||||||
|
|
||||||
Use `mark` when changes need human review BEFORE they hit the file. Marks live in the watch process only; a separate `set` pipeline applies accepted ones. For one-shot changes use `set` directly; for permanent file annotations use `add --type comment` (Word native).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli mark <file> <path> [--prop find=... color=... note=... tofix=... regex=true] [--json]
|
|
||||||
officecli unmark <file> [--path <p> | --all] [--json]
|
|
||||||
officecli get-marks <file> [--json]
|
|
||||||
```
|
|
||||||
|
|
||||||
Props: `find` (literal or regex when `regex=true`; raw form `find='r"[abc]"'`), `color` (hex / `rgb(...)` / 22 named whitelist), `note`, `tofix` (drives apply pipeline). **Path** must be `data-path` format from watch HTML — see subskills for full pipeline.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## L2: DOM Operations
|
|
||||||
|
|
||||||
### set — modify properties
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set <file> <path> --prop key=value [--prop ...]
|
|
||||||
```
|
|
||||||
|
|
||||||
**Any XML attribute is settable** via element path (found via `get --depth N`) — even attributes not currently present. Without `find=`, `set` applies format to the entire element.
|
|
||||||
|
|
||||||
**Value formats:**
|
|
||||||
|
|
||||||
| Type | Format | Examples |
|
|
||||||
|------|--------|---------|
|
|
||||||
| Colors | Hex (with/without `#`), named, RGB, theme | `FF0000`, `#FF0000`, `red`, `rgb(255,0,0)`, `accent1`..`accent6` |
|
|
||||||
| Spacing | Unit-qualified | `12pt`, `0.5cm`, `1.5x`, `150%` |
|
|
||||||
| Dimensions | EMU or suffixed | `914400`, `2.54cm`, `1in`, `72pt`, `96px` |
|
|
||||||
|
|
||||||
**Dotted-attr aliases** — `font.<attr>` forms accepted on shape/run/paragraph/table/row/cell/section/styles, e.g. `--prop font.color=red --prop font.bold=true --prop font.size=14pt`. Run `officecli help <fmt> <element>` for the full list.
|
|
||||||
|
|
||||||
### find — format or replace matched text
|
|
||||||
|
|
||||||
Use top-level `--find` / `--replace` on `set` (and `--find` on `query`). Legacy `--prop find=X` still works but emits a hint.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Format matched text (auto-splits runs)
|
|
||||||
officecli set doc.docx '/body/p[1]' --find weather --prop bold=true --prop color=red
|
|
||||||
|
|
||||||
# Regex matching (regex= still a prop flag)
|
|
||||||
officecli set doc.docx '/body/p[1]' --find '\d+%' --prop regex=true --prop color=red
|
|
||||||
|
|
||||||
# Replace text (use `/` for whole-document scope)
|
|
||||||
officecli set doc.docx / --find draft --replace final
|
|
||||||
|
|
||||||
# docx: tracked Find&Replace
|
|
||||||
officecli set doc.docx / --find draft --replace final --prop revision.author=Alice
|
|
||||||
|
|
||||||
# PPT — same syntax, different paths
|
|
||||||
officecli set slides.pptx / --find draft --replace final
|
|
||||||
```
|
|
||||||
|
|
||||||
**Path controls search scope:** `/` = whole document, `/body/p[1]` or `/slide[N]/shape[M]` = specific element, `/header[1]` / `/footer[1]` = headers/footers.
|
|
||||||
|
|
||||||
**Notes:**
|
|
||||||
- Case-sensitive by default. Case-insensitive: `--prop 'find=(?i)error' --prop regex=true`
|
|
||||||
- Matches work across run boundaries
|
|
||||||
- No match = silent success. `--json` includes `"matched": N`
|
|
||||||
- **Excel:** only `find` + `replace` supported (no find + format props)
|
|
||||||
|
|
||||||
### add — add elements or clone
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add <file> <parent> --type <type> [--prop ...]
|
|
||||||
officecli add <file> <parent> --type <type> --after <path> [--prop ...] # insert after anchor
|
|
||||||
officecli add <file> <parent> --type <type> --before <path> [--prop ...] # insert before anchor
|
|
||||||
officecli add <file> <parent> --type <type> --index N [--prop ...] # 0-based position (legacy)
|
|
||||||
officecli add <file> <parent> --from <path> # clone existing element
|
|
||||||
```
|
|
||||||
|
|
||||||
`--after`, `--before`, `--index` are mutually exclusive. No position flag = append to end.
|
|
||||||
|
|
||||||
**Element types (with aliases):**
|
|
||||||
|
|
||||||
| Format | Types |
|
|
||||||
|--------|-------|
|
|
||||||
| **pptx** | slide (incl. hidden), shape (font.latin/ea/cs, direction=rtl, underline.color, highlight=COLOR (Add/Set/Get/HTML preview), effective.X+effective.X.src; arrow alias for rightArrow; slideMaster/slideLayout typed add/set/remove), picture (SVG, brightness/contrast/glow/shadow, rotation, link, tooltip), chart (direction=rtl, pieOfPie, barOfPie, axisLine/gridline per-attr setters, animation+chartBuild=byCategory|bySeries, line dropLines/hiLowLines/upDownBars, anchor=x,y,w,h shorthand), table (cell direction=rtl, fill/background, built-in PowerPoint style catalogue, /col[C] get + swap/copyFrom, row/col Move/CopyFrom), row (tr), connector (from/to accept full-path `@name=`/`@id=` forms — bare `@name=Foo` is rejected, must be `/slide[N]/shape[@name=Foo]` — startshape/endshape SetByPath; edge-to-edge anchoring by default, fromSide/toSide to force an edge, fromIdx/toIdx for raw cxn index), group (link, tooltip, deep walk by get/query/add/remove, ungroup=true dissolves back to slide-absolute), align/distribute (targets= accepts shape[@id=N] paths, not just positional), video/audio (loop, autoStart alias), equation, notes (direction=rtl, lang), comment (legacy + modern p188 threaded round-trip), animation (15 emphasis + 16 exit presets, multi-effect chains, motion-path presets, repeat/restart/autoReverse, chart animations), transition (12 p15 presets + morph/p14), paragraph (para), run, zoom, ole (preview=, full dump round-trip via add-part+raw-set), placeholder (phType=...), model3d (rotation=ax,ay,az; full dump round-trip), smartart (dump round-trip via add-part), diagram (add-only mermaid → native shapes or rendered image, `--type diagram`/`flowchart`). |
|
|
||||||
| **docx** | paragraph (direction/font.latin/ea/cs, bold.cs/italic.cs/size.cs, lang.latin/ea/cs, wordWrap, framePr.\*, tabs shorthand), run (lang slots, direction, underline.color, position half-pts, **revision.type=ins\|del\|format\|moveFrom\|moveTo + revision.action=accept\|reject** with .author/.date — bare `@author=`/`@type=` selector on `set /revision[...]` for filtered accept/reject, but `query 'revision[...]'` needs the dotted `revision.author=`/`revision.type=` form; move+revision is run-level paths only, not paragraph-level; **range=START:END** on a paragraph/shape path formats a char span by explicit 0-based half-open offset instead of addressing a run — the offset sibling of find=), table (direction=rtl, hMerge, cantSplit on row/nowrap on cell (both add+set), **virtual column ops**: add/remove/move/copyfrom on /body/tbl[N]/col), row (tr), cell (td), image, header/footer (direction), section (pageNumFmt full enum, direction=rtl, rtlGutter, pgBorders=box), bookmark, comment, footnote, endnote, formfield, sdt, chart, equation, field (28 types), hyperlink, style (direction, indents, pbdr, lineSpacing on Add/Set), toc, watermark, break, ole, **num/abstractNum/lvl**, **tab**, **textbox/shape** (add-mostly — Get returns raw XML preview only, no structured readback; Set is limited to width/height/geometry/fill/line.\*; position is `anchor.x`/`anchor.y` not bare x/y; **textbox-only** `textDirection`/rotation/gradient/shadow — docx shape itself has neither rotation nor gradient), embedded **OLE round-trip on dump→batch**, **diagram** (add-only mermaid → native shapes or rendered image, `--type diagram`/`flowchart`, no x/y at add-time — reposition via `set /body/group[N]`). docDefaults.rtl, autoHyphenation, `get /` exposes locale + /comments /footnotes /endnotes. `create --minimal` for raw OOXML scaffolding. |
|
|
||||||
| **xlsx** | sheet (visible/hidden/veryHidden, print margins, printTitleRows/Cols, rightToLeft sheetView, cascade-aware rename), row (c{N}= cell-content shorthand; add accepts --from /Sheet/col[L]; formula-ref rewrite on insert), col (formula-ref rewrite, named-range follow on move), cell (type=richtext+runs, merge=range/sweep, direction=rtl, phonetic; **--shift left\|up on remove, shift=right\|down on add** — Excel UI dialog parity; formula auto-detect; OFFSET/INDIRECT in calc), chart (per-axis RTL/title, anchor=x,y,w,h, pareto), image (SVG), comment (direction=rtl), table (listobject), namedrange (definedname, volatile, `[@name=X]`; formula-body inlined at parse), pivottable (cache CoW + cross-pivot sharing, labelFilter=field:type:value add-time-only, topN=integer add-time-only, fillDownLabels is an alias of repeatLabels not a separate feature, calculatedField), sparkline, validation, autofilter, shape, textbox, CF (databar/colorscale/iconset/formulacf/cellIs/topN/aboveAverage), ole, csv. Query supports `merge`/`mergedrange`. Workbook: password. Shape selector enumerates leaves inside grpSp. |
|
|
||||||
|
|
||||||
### Pivot tables (xlsx)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli add data.xlsx /Sheet1 --type pivottable \
|
|
||||||
--prop source="Sheet1!A1:E100" --prop rows=Region,Category \
|
|
||||||
--prop cols=Year --prop values="Sales:sum,Qty:count" \
|
|
||||||
--prop grandTotals=rows --prop subtotals=off --prop sort=asc
|
|
||||||
```
|
|
||||||
|
|
||||||
Key props: `rows`, `cols`, `values` (Field:func[:showDataAs]), `filters`, `source`, `position`, `layout` (compact/outline/tabular), `repeatLabels`, `blankRows`, `aggregate`, `showDataAs` (percent_of_total/row/col, running_total), `grandTotals`, `subtotals`, `sort`. Aggregators: sum, count, average, max, min, product, stdDev, stdDevp, var, varp, countNums. Date columns auto-group. Run `officecli help xlsx pivottable` for full schema.
|
|
||||||
|
|
||||||
### Document-level properties (all formats)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set doc.docx / --prop docDefaults.font=Arial --prop docDefaults.fontSize=11pt
|
|
||||||
officecli set doc.docx / --prop protection=forms --prop evenAndOddHeaders=true
|
|
||||||
officecli set data.xlsx / --prop calc.mode=manual --prop calc.refMode=r1c1
|
|
||||||
officecli set slides.pptx / --prop defaultFont=Arial --prop show.loop=true --prop print.what=handouts
|
|
||||||
```
|
|
||||||
|
|
||||||
Run `officecli help <format> /` for all document-level properties (docDefaults, docGrid, CJK spacing, calc, print, show, theme, extended).
|
|
||||||
|
|
||||||
### Sort (xlsx)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli set data.xlsx /Sheet1 --prop sort="C desc" --prop sortHeader=true
|
|
||||||
officecli set data.xlsx '/Sheet1/A1:D100' --prop sort="A asc" --prop sortHeader=true
|
|
||||||
```
|
|
||||||
|
|
||||||
Format: `COL DIR[, COL DIR ...]`. Rejects ranges with merged cells or formulas. Sidecar metadata (hyperlinks, comments, conditional formatting, drawings) follows rows automatically.
|
|
||||||
|
|
||||||
### Text-anchored insert (`--after find:X` / `--before find:X`)
|
|
||||||
|
|
||||||
Locate an insertion point by text match within a paragraph. Inline types (run, picture, hyperlink) insert within the paragraph; block types (table, paragraph) auto-split it. PPT only supports inline.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Word: inline run after matched text
|
|
||||||
officecli add doc.docx '/body/p[1]' --type run --after find:weather --prop text=" (sunny)"
|
|
||||||
|
|
||||||
# Word: block table after matched text (auto-splits paragraph)
|
|
||||||
officecli add doc.docx '/body/p[1]' --type table --after "find:First sentence." --prop rows=2 --prop cols=2
|
|
||||||
```
|
|
||||||
|
|
||||||
### Clone
|
|
||||||
|
|
||||||
`officecli add <file> / --from '/slide[1]'` — copies with all cross-part relationships.
|
|
||||||
|
|
||||||
### move, swap, remove
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli move <file> <path> [--to <parent>] [--index N] [--after <path>] [--before <path>]
|
|
||||||
officecli swap <file> <path1> <path2>
|
|
||||||
officecli remove <file> '/body/p[4]'
|
|
||||||
```
|
|
||||||
|
|
||||||
When using `--after` or `--before`, `--to` can be omitted — the target container is inferred from the anchor.
|
|
||||||
|
|
||||||
### batch — multiple operations in one save cycle
|
|
||||||
|
|
||||||
**Atomic by default (v1.0.137+):** every item still runs and is reported (so `N succeeded, M failed` stays meaningful and every failure surfaces), but if *any* item fails the whole batch rolls back — the file on disk is left byte-identical to before the batch ran (confirmed live in both standalone and resident mode). Use `--best-effort` to restore the old apply-what-succeeds behavior (useful for lossy `dump→batch` replays where losing the whole thing over one unsupported item is worse than a partial result). `--stop-on-error` only changes how early the run stops (remaining items are `skipped`), not whether what ran gets kept — combine it with `--best-effort` if you want "stop at first failure but keep what already succeeded." `--force` is unrelated — it's only the docx-protection bypass. Failed items carry a machine-readable `code` field (same list as `error.code`); a rolled-back batch's JSON summary carries `"atomicRolledBack": true`.
|
|
||||||
|
|
||||||
`officecli dump <file> [<path>]` emits a replayable batch JSON for round-trip — `.docx` (full coverage), `.pptx` (text/tables/pictures/charts/notes/theme + OLE/3D/video/audio/SmartArt/morph/p15 transitions via raw-set passthrough), and `.xlsx` (cells/formulas/styles + tables, conditional formatting, validations, comments, charts, sparklines, pictures, shapes, pivot tables; slicers/chartEx/OLE via verbatim carrier). Path defaults to `/` (whole document); pass a subtree path (docx: `/body`, `/body/p[N]`, `/body/tbl[N]`, `/theme`, `/settings`, `/numbering`, `/styles`; xlsx: `/SheetName`, `/sheet[N]`) to scope the dump. `officecli refresh <file.docx>` recalculates TOC page numbers / PAGE / cross-references after replay (Word backend on Windows; headless-HTML fallback elsewhere). `officecli plugins list` extends support to `.doc`, `.hwpx`, `.pdf` export.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
echo '[
|
|
||||||
{"command":"set","path":"/Sheet1/A1","props":{"value":"Name","bold":"true"}},
|
|
||||||
{"command":"set","path":"/Sheet1/B1","props":{"value":"Score","bold":"true"}}
|
|
||||||
]' | officecli batch data.xlsx --json
|
|
||||||
|
|
||||||
officecli batch data.xlsx --commands '[{"op":"set","path":"/Sheet1/A1","props":{"value":"Done"}}]' --json
|
|
||||||
officecli batch data.xlsx --input updates.json --best-effort --json # keep whatever succeeds even if some items fail
|
|
||||||
```
|
|
||||||
|
|
||||||
Supports: `add`, `set`, `get`, `query`, `remove`, `move`, `swap`, `view`, `raw`, `raw-set`, `validate`. Fields: `command` (or `op`), `path`, `parent`, `type`, `from`, `to`, `index`, `after`, `before`, `props`, `selector`, `mode`, `depth`, `part`, `xpath`, `action`, `xml`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## L3: Raw XML
|
|
||||||
|
|
||||||
Use when L2 cannot express what you need. No xmlns declarations needed — prefixes auto-registered.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
officecli raw <file> <part> # view raw XML
|
|
||||||
officecli raw-set <file> <part> --xpath "..." --action replace --xml '<w:p>...</w:p>'
|
|
||||||
officecli add-part <file> <parent> # create new document part (returns rId)
|
|
||||||
```
|
|
||||||
|
|
||||||
`raw-set` actions: `append`, `prepend`, `insertbefore`, `insertafter`, `replace`, `remove`, `setattr`. Run `officecli help <format> raw` for available parts.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Common Pitfalls
|
|
||||||
|
|
||||||
| Pitfall | Correct Approach |
|
|
||||||
|---------|-----------------|
|
|
||||||
| `--name "foo"` | Use `--prop name="foo"` — all attributes go through `--prop` |
|
|
||||||
| Unquoted `[N]` paths in zsh/bash | Always quote: `'/slide[1]'` or `"/slide[1]"` (shell glob-expands brackets) |
|
|
||||||
| PPT `shape[1]` for content | `shape[1]` is typically the title placeholder. Use `shape[2]+` for content shapes |
|
|
||||||
| `/shape[myname]` | Name indexing not supported. Use numeric index or `@name=` (PPT only) |
|
|
||||||
| Guessing property names | Run `officecli help <format> <element>` to see exact names |
|
|
||||||
| Modifying an open file | Close the file in PowerPoint/WPS first |
|
|
||||||
| `\n` in shell strings | Use `\\n` for newlines in `--prop text="..."` |
|
|
||||||
| `$` in shell text | `--prop text="$15M"` strips `$15`. Use single quotes: `--prop text='$15M'`, or heredoc batch |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Specialized Skills
|
|
||||||
|
|
||||||
`officecli load_skill <name>` — output is a SKILL.md, follow its rules.
|
|
||||||
|
|
||||||
**Loading rule**:
|
|
||||||
- Pick the most specific match in "When to use"; if none fits, load the format default (`word` / `pptx` / `excel`).
|
|
||||||
- Scenes already contain the format default's rules — load **one** skill per artifact, never stack.
|
|
||||||
- Loaded rules persist across turns; don't re-load each reply.
|
|
||||||
- Two distinct artifacts → two separate loads.
|
|
||||||
|
|
||||||
### Word (.docx)
|
|
||||||
|
|
||||||
| Name | When to use |
|
|
||||||
|------|-------------|
|
|
||||||
| `word` | Reports, letters, memos, proposals, generic documents |
|
|
||||||
| `academic-paper` | Journal / conference / thesis: APA / Chicago / IEEE / MLA citations, equations, SEQ + PAGEREF cross-refs, multi-column journal layout, bibliography. NOT for business reports or letters (route those to `word`) |
|
|
||||||
|
|
||||||
### PowerPoint (.pptx)
|
|
||||||
|
|
||||||
| Name | When to use |
|
|
||||||
|------|-------------|
|
|
||||||
| `pptx` | Generic decks: board reviews, sales decks, all-hands, product launches |
|
|
||||||
| `pitch-deck` | **Fundraising only** — seed / Series A-C / SAFE / convertible / strategic raise. NOT for sales / product / board decks (route those to `pptx`) |
|
|
||||||
| `morph-ppt` | Cinematic Morph-animated presentations. NOT for static decks (route those to `pptx`) |
|
|
||||||
| `morph-ppt-3d` | 3D Morph: GLB models, camera moves, depth. NOT for 2D-only Morph (route those to `morph-ppt`) |
|
|
||||||
|
|
||||||
### Excel (.xlsx)
|
|
||||||
|
|
||||||
| Name | When to use |
|
|
||||||
|------|-------------|
|
|
||||||
| `excel` | Generic workbooks, formulas, pivots, trackers |
|
|
||||||
| `financial-model` | Financial models, scenarios, projections. NOT for general data analysis (route those to `excel`) |
|
|
||||||
| `data-dashboard` | CSV/tabular data → KPI / analytics / executive dashboards with charts and sparklines. NOT for raw data tracking (route those to `excel`) |
|
|
||||||
|
|
||||||
Example: a fundraising deck task → `officecli load_skill pitch-deck` → use the printed rules.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- Paths are **1-based** (XPath convention): `'/body/p[3]'` = third paragraph
|
|
||||||
- `--index` is **0-based** (array convention): `--index 0` = first position
|
|
||||||
- **Excel exception**: for `add --type row` and `add --type col`, `--index N` is **1-based** (matches OOXML RowIndex / column letter index). `--index 5` inserts at row 5 / column 5.
|
|
||||||
- After modifications, verify with `validate` and/or `view issues`
|
|
||||||
- **When unsure**, run `officecli help <format> <element>` instead of guessing
|
|
||||||
-285
@@ -1,285 +0,0 @@
|
|||||||
---
|
|
||||||
name: brainstorming
|
|
||||||
description: "You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
|
|
||||||
---
|
|
||||||
|
|
||||||
# Brainstorming Ideas Into Designs
|
|
||||||
|
|
||||||
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
|
|
||||||
|
|
||||||
Start by classifying how much process the request needs, then work
|
|
||||||
through your path: understand the context, refine the idea, present a
|
|
||||||
design, and get your human partner's approval.
|
|
||||||
|
|
||||||
## Establish Shared Understanding
|
|
||||||
|
|
||||||
The outcome of brainstorming is an understanding your human partner can
|
|
||||||
recognize and correct, grounded in what they want to accomplish.
|
|
||||||
|
|
||||||
1. **Discover intent.** Use the request and available context to identify
|
|
||||||
the intended outcome, who it is for, and what success looks like. When
|
|
||||||
that information is missing, ask one focused question about purpose or
|
|
||||||
intended use before proposing features or an approach. Knowing the app
|
|
||||||
genre does not tell you why your partner wants it. Gathering missing
|
|
||||||
requirements does not ask them to authorize the task again.
|
|
||||||
2. **Write back your understanding.** Summarize the intended outcome,
|
|
||||||
relevant constraints, and success criteria in a short note your partner
|
|
||||||
can assess. Separate what they said from assumptions. Invite correction
|
|
||||||
and incorporate their answer before treating this as the design brief.
|
|
||||||
3. **Carry intent into the design.** Preserve the agreed understanding in
|
|
||||||
the selected path's design artifact: the written spec for architectural
|
|
||||||
work, or the in-chat design/probe for bounded work and spikes. Check
|
|
||||||
proposed features and technical choices against that understanding.
|
|
||||||
|
|
||||||
When the request already supplies the purpose and constraints, reflect
|
|
||||||
that understanding instead of asking the same questions again. Keep the
|
|
||||||
note concise; its accuracy and the opportunity to correct it matter.
|
|
||||||
|
|
||||||
<HARD-GATE>
|
|
||||||
Before taking any implementation action, including invoking an
|
|
||||||
implementation skill, writing product code, scaffolding, installing
|
|
||||||
product dependencies, or creating an external project, complete the
|
|
||||||
selected path's prerequisites:
|
|
||||||
|
|
||||||
- Spike: the human partner approves the question and probe.
|
|
||||||
- Bounded: the human partner approves the short in-chat design.
|
|
||||||
- Architectural: the human partner reviews and approves the written spec,
|
|
||||||
then reviews the written implementation plan and selects its execution
|
|
||||||
method. Conversational design approval only permits writing the spec;
|
|
||||||
written-spec approval only permits invoking writing-plans.
|
|
||||||
|
|
||||||
A reply approves the stage actually presented. Approval of an idea or
|
|
||||||
feature scope does not approve artifacts that do not exist yet. Resume
|
|
||||||
at the earliest incomplete stage; do not turn one approval into permission
|
|
||||||
to skip the rest of the selected path. Read-only project exploration is
|
|
||||||
allowed while those prerequisites remain incomplete.
|
|
||||||
</HARD-GATE>
|
|
||||||
|
|
||||||
## Three Paths
|
|
||||||
|
|
||||||
Before your first question, classify the request and say the
|
|
||||||
classification out loud — "this looks bounded, so I'll present a short
|
|
||||||
design here rather than write a spec" — so your human partner can
|
|
||||||
override it:
|
|
||||||
|
|
||||||
- **Spike** — a feasibility question ("can we...", "is it possible...",
|
|
||||||
"quick and dirty is fine") whose output is an answer, not code you
|
|
||||||
keep. Present the question and what you'll try in 2-3 sentences, get
|
|
||||||
a nod, then find out as cheaply as correctness allows. No design
|
|
||||||
doc, no spec file. Report findings as a recommendation; anything you
|
|
||||||
built stays labeled throwaway.
|
|
||||||
- **Bounded** — a well-scoped change to code that already exists in
|
|
||||||
this repo: a new flag, a small endpoint, a one-file fix.
|
|
||||||
Understanding the kind of app is not enough — bounded means the flow
|
|
||||||
you are changing is already here to read. If there is no existing
|
|
||||||
flow to change, the task is not bounded. Ask the clarifying
|
|
||||||
questions that matter, present a short design IN CHAT (a few
|
|
||||||
sentences to a few short paragraphs), and STOP. Implementation
|
|
||||||
starts only after your human partner says yes to that design — a
|
|
||||||
bounded task's approval is as hard a gate as an architectural
|
|
||||||
one. No spec file, no implementation plan document.
|
|
||||||
- **Architectural** — new projects, new subsystems, changes that
|
|
||||||
restructure how components fit together or alter interfaces others
|
|
||||||
depend on. Follow the full process: questions, approaches, sectioned
|
|
||||||
design, written spec, then the writing-plans skill.
|
|
||||||
|
|
||||||
When in doubt between two paths, take the heavier one. The ratchet is
|
|
||||||
one-way: hidden complexity discovered mid-task upgrades the path —
|
|
||||||
stop, say so, and step up. Nothing downgrades mid-task.
|
|
||||||
|
|
||||||
## Anti-Pattern: "Too Simple To Need Approval"
|
|
||||||
|
|
||||||
Every path ends with your human partner approving the required design
|
|
||||||
before implementation. A bounded change may need only two sentences in
|
|
||||||
chat. A new todo-list project is architectural and requires the written
|
|
||||||
spec and planning handoffs. Scale the artifact to the selected path;
|
|
||||||
complete that path's reviews before implementation.
|
|
||||||
|
|
||||||
## Red Flags
|
|
||||||
|
|
||||||
| Thought | Reality |
|
|
||||||
|---------|---------|
|
|
||||||
| "This is too simple to need a design" | Follow the selected path: a bounded change gets a short chat design; an architectural change gets the written spec and planning handoffs. |
|
|
||||||
| "I'll call it bounded and skip the spec" | Reaching for a label to skip work IS the doubt — take the heavier path. |
|
|
||||||
| "It's bounded and the design is obvious — I'll start while they read it" | The gate is the approval, not the design's length. Present, then stop until you hear yes. |
|
|
||||||
| "I understand this kind of app, so it's bounded" | Bounded measures the repo, not your familiarity. A new project has no existing flow — it is architectural. |
|
|
||||||
| "The spike works, so I'll keep the code" | A spike's output is an answer. Keeping the code is a new request — classify it. |
|
|
||||||
| "It grew, but I'm almost done — no need to re-classify" | Hidden complexity upgrades the path mid-task. Stop and say so. |
|
|
||||||
| "They approved the spike, so the follow-up change is approved too" | Each task gets its own classification and its own approval. |
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
Classify first, announce the path, then create a task for each item on
|
|
||||||
your path and complete them in order.
|
|
||||||
|
|
||||||
**Spike:**
|
|
||||||
1. **Explore project context** — enough to frame the probe
|
|
||||||
2. **Present question + probe plan** — 2-3 sentences
|
|
||||||
3. **Get approval** — a nod is enough
|
|
||||||
4. **Investigate** — as cheaply as correctness allows
|
|
||||||
5. **Report findings** — a recommendation; label anything built as throwaway
|
|
||||||
|
|
||||||
**Bounded:**
|
|
||||||
1. **Explore project context** — check files, docs, recent commits
|
|
||||||
2. **Ask clarifying questions** — one at a time, the ones that matter
|
|
||||||
3. **Present short design in chat** — approach, files touched, testing
|
|
||||||
4. **Get approval** — STOP and wait for an explicit yes; presenting the design and starting in the same breath is skipping the gate
|
|
||||||
5. **Implement** — proceed with the normal development workflow (TDD applies); no plan document
|
|
||||||
|
|
||||||
**Architectural:**
|
|
||||||
1. **Explore project context** — check files, docs, recent commits
|
|
||||||
2. **Offer the visual companion just-in-time** — NOT upfront. The first time a question would genuinely be clearer shown than described, offer it then (its own message); on approval its browser tab opens for you. If no visual question ever arises, never offer it. See the Visual Companion section below.
|
|
||||||
3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
|
|
||||||
4. **Propose 2-3 approaches** — with trade-offs and your recommendation
|
|
||||||
5. **Present design** — in sections scaled to their complexity, get user approval after each section
|
|
||||||
6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
|
|
||||||
7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
|
|
||||||
8. **User reviews written spec** — ask user to review the spec file before proceeding
|
|
||||||
9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
|
|
||||||
|
|
||||||
## Process Flow
|
|
||||||
|
|
||||||
```dot
|
|
||||||
digraph brainstorming {
|
|
||||||
"Classify: spike / bounded / architectural" [shape=diamond];
|
|
||||||
"Present question + probe (2-3 sentences)" [shape=box];
|
|
||||||
"Ask clarifying questions (bounded)" [shape=box];
|
|
||||||
"Present short design in chat" [shape=box];
|
|
||||||
"Human approves?" [shape=diamond];
|
|
||||||
"Investigate; report recommendation" [shape=doublecircle];
|
|
||||||
"Implement via normal workflow (no plan doc)" [shape=doublecircle];
|
|
||||||
"Explore project context" [shape=box];
|
|
||||||
"Ask clarifying questions" [shape=box];
|
|
||||||
"Propose 2-3 approaches" [shape=box];
|
|
||||||
"Present design sections" [shape=box];
|
|
||||||
"User approves design?" [shape=diamond];
|
|
||||||
"Write design doc" [shape=box];
|
|
||||||
"Spec self-review\n(fix inline)" [shape=box];
|
|
||||||
"User reviews spec?" [shape=diamond];
|
|
||||||
"Invoke writing-plans skill" [shape=doublecircle];
|
|
||||||
"Hidden complexity? Upgrade path" [shape=box];
|
|
||||||
|
|
||||||
"Classify: spike / bounded / architectural" -> "Present question + probe (2-3 sentences)" [label="spike"];
|
|
||||||
"Classify: spike / bounded / architectural" -> "Ask clarifying questions (bounded)" [label="bounded"];
|
|
||||||
"Classify: spike / bounded / architectural" -> "Explore project context" [label="architectural"];
|
|
||||||
"Present question + probe (2-3 sentences)" -> "Human approves?";
|
|
||||||
"Ask clarifying questions (bounded)" -> "Present short design in chat";
|
|
||||||
"Present short design in chat" -> "Human approves?";
|
|
||||||
"Human approves?" -> "Investigate; report recommendation" [label="spike: yes"];
|
|
||||||
"Human approves?" -> "Implement via normal workflow (no plan doc)" [label="bounded: yes"];
|
|
||||||
"Hidden complexity? Upgrade path" -> "Classify: spike / bounded / architectural";
|
|
||||||
"Explore project context" -> "Ask clarifying questions";
|
|
||||||
"Ask clarifying questions" -> "Propose 2-3 approaches";
|
|
||||||
"Propose 2-3 approaches" -> "Present design sections";
|
|
||||||
"Present design sections" -> "User approves design?";
|
|
||||||
"User approves design?" -> "Present design sections" [label="no, revise"];
|
|
||||||
"User approves design?" -> "Write design doc" [label="yes"];
|
|
||||||
"Write design doc" -> "Spec self-review\n(fix inline)";
|
|
||||||
"Spec self-review\n(fix inline)" -> "User reviews spec?";
|
|
||||||
"User reviews spec?" -> "Write design doc" [label="changes requested"];
|
|
||||||
"User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Terminal states are path-bound.** Architectural: the ONLY skill you
|
|
||||||
invoke after brainstorming is writing-plans — never frontend-design,
|
|
||||||
mcp-builder, or any other implementation skill. Bounded: after
|
|
||||||
approval, implementation proceeds directly through the normal
|
|
||||||
development workflow; no plan document. Spike: the terminal state is a
|
|
||||||
reported recommendation.
|
|
||||||
|
|
||||||
## The Process
|
|
||||||
|
|
||||||
The subsections below serve the bounded and architectural paths (a
|
|
||||||
spike stops at "present the probe, get a nod"). Sections from
|
|
||||||
**Exploring approaches** onward are architectural-path depth — for
|
|
||||||
bounded work, context plus a few questions plus a short in-chat design
|
|
||||||
is the whole process.
|
|
||||||
|
|
||||||
**Understanding the idea:**
|
|
||||||
|
|
||||||
- Check out the current project state first (files, docs, recent commits)
|
|
||||||
- Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
|
|
||||||
- If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
|
|
||||||
- For appropriately-scoped projects, ask questions one at a time to refine the idea
|
|
||||||
- Prefer multiple choice questions when possible, but open-ended is fine too
|
|
||||||
- Only one question per message - if a topic needs more exploration, break it into multiple questions
|
|
||||||
- Focus on understanding: purpose, constraints, success criteria
|
|
||||||
|
|
||||||
**Exploring approaches:**
|
|
||||||
|
|
||||||
- Propose 2-3 different approaches with trade-offs
|
|
||||||
- Present options conversationally with your recommendation and reasoning
|
|
||||||
- Lead with your recommended option and explain why
|
|
||||||
- YAGNI ruthlessly - remove unnecessary features from every approach and design
|
|
||||||
|
|
||||||
**Presenting the design:**
|
|
||||||
|
|
||||||
- Once you believe you understand what you're building, present the design
|
|
||||||
- Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
|
|
||||||
- Ask after each section whether it looks right so far
|
|
||||||
- Cover: architecture, components, data flow, error handling, testing
|
|
||||||
- Be ready to go back and clarify if something doesn't make sense
|
|
||||||
|
|
||||||
**Design for isolation and clarity:**
|
|
||||||
|
|
||||||
- Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
|
|
||||||
- For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
|
|
||||||
- Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
|
|
||||||
- Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
|
|
||||||
|
|
||||||
**Working in existing codebases:**
|
|
||||||
|
|
||||||
- Explore the current structure before proposing changes. Follow existing patterns.
|
|
||||||
- Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
|
|
||||||
- Don't propose unrelated refactoring. Stay focused on what serves the current goal.
|
|
||||||
|
|
||||||
## After the Design (architectural path)
|
|
||||||
|
|
||||||
**Documentation:**
|
|
||||||
|
|
||||||
- Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
|
|
||||||
- (User preferences for spec location override this default)
|
|
||||||
- Use elements-of-style:writing-clearly-and-concisely skill if available
|
|
||||||
- Commit the design document to git
|
|
||||||
|
|
||||||
**Spec Self-Review:**
|
|
||||||
After writing the spec document, look at it with fresh eyes:
|
|
||||||
|
|
||||||
1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
|
|
||||||
2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
|
|
||||||
3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
|
|
||||||
4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
|
|
||||||
|
|
||||||
Fix any issues inline. No need to re-review — just fix and move on.
|
|
||||||
|
|
||||||
**User Review Gate:**
|
|
||||||
After the spec review loop passes, ask the user to review the written spec before proceeding:
|
|
||||||
|
|
||||||
> "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."
|
|
||||||
|
|
||||||
Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.
|
|
||||||
|
|
||||||
**Implementation:**
|
|
||||||
|
|
||||||
- Invoke the writing-plans skill to create a detailed implementation plan
|
|
||||||
- Do NOT invoke any other skill. writing-plans is the next step.
|
|
||||||
|
|
||||||
## Visual Companion
|
|
||||||
|
|
||||||
A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.
|
|
||||||
|
|
||||||
**Offering the companion (just-in-time):** Do NOT offer it upfront. Wait until a question would genuinely be clearer shown than told — a real mockup / layout / diagram question, not merely a UI *topic*. The first time that happens, offer it then, as its own message:
|
|
||||||
> "This next part might be easier if I show you — I can put together mockups, diagrams, and comparisons in a browser tab as we go. It's still new and can be token-intensive. Want me to? I'll open it for you."
|
|
||||||
|
|
||||||
**This offer MUST be its own message.** Only the offer — no clarifying question, summary, or other content. Wait for the user's response. If they accept, start the server with `--open` so their browser opens to the first screen automatically. If they decline, continue text-only and don't offer again unless they raise it.
|
|
||||||
|
|
||||||
**Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?**
|
|
||||||
|
|
||||||
- **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
|
|
||||||
- **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
|
|
||||||
|
|
||||||
A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser.
|
|
||||||
|
|
||||||
If they agree to the companion, read the detailed guide before proceeding:
|
|
||||||
`skills/brainstorming/visual-companion.md`
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Superpowers Brainstorming</title>
|
|
||||||
<style>
|
|
||||||
/*
|
|
||||||
* BRAINSTORM COMPANION FRAME TEMPLATE
|
|
||||||
*
|
|
||||||
* This template provides a consistent frame with:
|
|
||||||
* - OS-aware light/dark theming
|
|
||||||
* - Header branding and connection status
|
|
||||||
* - Scrollable main content area
|
|
||||||
* - CSS helpers for common UI patterns
|
|
||||||
*
|
|
||||||
* Content is injected via placeholder comment in #frame-content.
|
|
||||||
*/
|
|
||||||
|
|
||||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
||||||
html, body { height: 100%; overflow: hidden; }
|
|
||||||
|
|
||||||
/* ===== THEME VARIABLES ===== */
|
|
||||||
:root {
|
|
||||||
--bg-primary: #f5f5f7;
|
|
||||||
--bg-secondary: #ffffff;
|
|
||||||
--bg-tertiary: #e5e5e7;
|
|
||||||
--border: #d1d1d6;
|
|
||||||
--text-primary: #1d1d1f;
|
|
||||||
--text-secondary: #86868b;
|
|
||||||
--text-tertiary: #aeaeb2;
|
|
||||||
--accent: #0071e3;
|
|
||||||
--accent-hover: #0077ed;
|
|
||||||
--success: #34c759;
|
|
||||||
--warning: #ff9f0a;
|
|
||||||
--error: #ff3b30;
|
|
||||||
--selected-bg: #e8f4fd;
|
|
||||||
--selected-border: #0071e3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--bg-primary: #1d1d1f;
|
|
||||||
--bg-secondary: #2d2d2f;
|
|
||||||
--bg-tertiary: #3d3d3f;
|
|
||||||
--border: #424245;
|
|
||||||
--text-primary: #f5f5f7;
|
|
||||||
--text-secondary: #86868b;
|
|
||||||
--text-tertiary: #636366;
|
|
||||||
--accent: #0a84ff;
|
|
||||||
--accent-hover: #409cff;
|
|
||||||
--selected-bg: rgba(10, 132, 255, 0.15);
|
|
||||||
--selected-border: #0a84ff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
||||||
background: var(--bg-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===== FRAME STRUCTURE ===== */
|
|
||||||
.brand { display: flex; align-items: center; min-width: 0; overflow: hidden; color: var(--text-secondary); line-height: 1; }
|
|
||||||
.brand a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1; }
|
|
||||||
.brand-copy { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; transform: translateY(-1px); }
|
|
||||||
.brand-logo { display: block; height: 1em; width: auto; max-width: 180px; flex-shrink: 0; filter: invert(1); }
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.brand-logo { filter: none; }
|
|
||||||
}
|
|
||||||
.status { font-size: 0.7rem; color: var(--status-color, var(--success)); display: flex; align-items: center; gap: 0.4rem; justify-self: end; white-space: nowrap; line-height: 1; }
|
|
||||||
.status::before { content: ''; width: 6px; height: 6px; background: var(--status-color, var(--success)); border-radius: 50%; }
|
|
||||||
|
|
||||||
.main { flex: 1; overflow-y: auto; }
|
|
||||||
#frame-content { padding: 2rem; min-height: 100%; }
|
|
||||||
|
|
||||||
.header {
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
padding: 0.5rem 1.5rem;
|
|
||||||
flex-shrink: 0;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: minmax(0, 1fr) auto;
|
|
||||||
align-items: center;
|
|
||||||
gap: 1rem;
|
|
||||||
min-height: 42px;
|
|
||||||
}
|
|
||||||
.header .brand { justify-self: start; width: 100%; font-size: 0.75rem; line-height: 1; }
|
|
||||||
.header .status { grid-column: 2; line-height: 1; }
|
|
||||||
.header span {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
|
||||||
.header .selected-text {
|
|
||||||
color: var(--accent);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===== TYPOGRAPHY ===== */
|
|
||||||
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
|
|
||||||
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
|
|
||||||
.subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
|
|
||||||
.section { margin-bottom: 2rem; }
|
|
||||||
.label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
|
|
||||||
|
|
||||||
/* ===== OPTIONS (for A/B/C choices) ===== */
|
|
||||||
.options { display: flex; flex-direction: column; gap: 0.75rem; }
|
|
||||||
.option {
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
border: 2px solid var(--border);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 1rem 1.25rem;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.15s ease;
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
.option:hover { border-color: var(--accent); }
|
|
||||||
.option.selected { background: var(--selected-bg); border-color: var(--selected-border); }
|
|
||||||
.option .letter {
|
|
||||||
background: var(--bg-tertiary);
|
|
||||||
color: var(--text-secondary);
|
|
||||||
width: 1.75rem; height: 1.75rem;
|
|
||||||
border-radius: 6px;
|
|
||||||
display: flex; align-items: center; justify-content: center;
|
|
||||||
font-weight: 600; font-size: 0.85rem; flex-shrink: 0;
|
|
||||||
}
|
|
||||||
.option.selected .letter { background: var(--accent); color: white; }
|
|
||||||
.option .content { flex: 1; }
|
|
||||||
.option .content h3 { font-size: 0.95rem; margin-bottom: 0.15rem; }
|
|
||||||
.option .content p { color: var(--text-secondary); font-size: 0.85rem; margin: 0; }
|
|
||||||
|
|
||||||
/* ===== CARDS (for showing designs/mockups) ===== */
|
|
||||||
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
|
|
||||||
.card {
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 12px;
|
|
||||||
overflow: hidden;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.15s ease;
|
|
||||||
}
|
|
||||||
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
|
|
||||||
.card.selected { border-color: var(--selected-border); border-width: 2px; }
|
|
||||||
.card-image { background: var(--bg-tertiary); aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; }
|
|
||||||
.card-body { padding: 1rem; }
|
|
||||||
.card-body h3 { margin-bottom: 0.25rem; }
|
|
||||||
.card-body p { color: var(--text-secondary); font-size: 0.85rem; }
|
|
||||||
|
|
||||||
/* ===== MOCKUP CONTAINER ===== */
|
|
||||||
.mockup {
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 12px;
|
|
||||||
overflow: hidden;
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
}
|
|
||||||
.mockup-header {
|
|
||||||
background: var(--bg-tertiary);
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
.mockup-body { padding: 1.5rem; }
|
|
||||||
|
|
||||||
/* ===== SPLIT VIEW (side-by-side comparison) ===== */
|
|
||||||
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
|
|
||||||
@media (max-width: 700px) { .split { grid-template-columns: 1fr; } }
|
|
||||||
|
|
||||||
/* ===== PROS/CONS ===== */
|
|
||||||
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
|
|
||||||
.pros, .cons { background: var(--bg-secondary); border-radius: 8px; padding: 1rem; }
|
|
||||||
.pros h4 { color: var(--success); font-size: 0.85rem; margin-bottom: 0.5rem; }
|
|
||||||
.cons h4 { color: var(--error); font-size: 0.85rem; margin-bottom: 0.5rem; }
|
|
||||||
.pros ul, .cons ul { margin-left: 1.25rem; font-size: 0.85rem; color: var(--text-secondary); }
|
|
||||||
.pros li, .cons li { margin-bottom: 0.25rem; }
|
|
||||||
|
|
||||||
/* ===== PLACEHOLDER (for mockup areas) ===== */
|
|
||||||
.placeholder {
|
|
||||||
background: var(--bg-tertiary);
|
|
||||||
border: 2px dashed var(--border);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 2rem;
|
|
||||||
text-align: center;
|
|
||||||
color: var(--text-tertiary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===== INLINE MOCKUP ELEMENTS ===== */
|
|
||||||
.mock-nav { background: var(--accent); color: white; padding: 0.75rem 1rem; display: flex; gap: 1.5rem; font-size: 0.9rem; }
|
|
||||||
.mock-sidebar { background: var(--bg-tertiary); padding: 1rem; min-width: 180px; }
|
|
||||||
.mock-content { padding: 1.5rem; flex: 1; }
|
|
||||||
.mock-button { background: var(--accent); color: white; border: none; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; }
|
|
||||||
.mock-input { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; width: 100%; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="header">
|
|
||||||
<!-- BRANDING -->
|
|
||||||
<div class="status">Connecting…</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="main">
|
|
||||||
<div id="frame-content">
|
|
||||||
<!-- CONTENT -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,167 +0,0 @@
|
|||||||
(function() {
|
|
||||||
const MIN_RECONNECT_MS = 500;
|
|
||||||
const MAX_RECONNECT_MS = 30000;
|
|
||||||
const TOMBSTONE_AFTER_MS = 15000; // show the "paused" overlay after this long disconnected
|
|
||||||
|
|
||||||
// Pure: next backoff delay (doubles, capped). Exported for unit tests.
|
|
||||||
function nextReconnectDelay(current, max) {
|
|
||||||
return Math.min(current * 2, max);
|
|
||||||
}
|
|
||||||
if (typeof module !== 'undefined' && module.exports) {
|
|
||||||
module.exports = { nextReconnectDelay, MIN_RECONNECT_MS, MAX_RECONNECT_MS, TOMBSTONE_AFTER_MS };
|
|
||||||
}
|
|
||||||
|
|
||||||
// Everything below is browser-only; bail out when loaded in Node (tests).
|
|
||||||
if (typeof window === 'undefined') return;
|
|
||||||
|
|
||||||
let ws = null;
|
|
||||||
let eventQueue = [];
|
|
||||||
let reconnectDelay = MIN_RECONNECT_MS;
|
|
||||||
let reconnectTimer = null;
|
|
||||||
let disconnectedSince = null;
|
|
||||||
let everConnected = false;
|
|
||||||
let tombstoneShown = false;
|
|
||||||
|
|
||||||
function sessionKey() {
|
|
||||||
try {
|
|
||||||
return window.sessionStorage && window.sessionStorage.getItem('brainstorm-session-key');
|
|
||||||
} catch (e) {}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function websocketUrl() {
|
|
||||||
const key = sessionKey();
|
|
||||||
return 'ws://' + window.location.host + (key ? '/?key=' + encodeURIComponent(key) : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadAfterRecovery() {
|
|
||||||
const key = sessionKey();
|
|
||||||
if (key) {
|
|
||||||
window.location.replace('/?key=' + encodeURIComponent(key));
|
|
||||||
} else {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reflect connection state in the frame's status pill (absent on full-doc screens).
|
|
||||||
function setStatus(state) {
|
|
||||||
const el = document.querySelector('.status');
|
|
||||||
if (!el) return;
|
|
||||||
const map = {
|
|
||||||
connecting: ['Connecting…', 'var(--text-tertiary)'],
|
|
||||||
connected: ['Connected', 'var(--success)'],
|
|
||||||
reconnecting: ['Reconnecting…', 'var(--warning)'],
|
|
||||||
disconnected: ['Disconnected', 'var(--error)']
|
|
||||||
};
|
|
||||||
const [text, color] = map[state] || map.disconnected;
|
|
||||||
el.textContent = text;
|
|
||||||
el.style.setProperty('--status-color', color);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Self-styled so it works on framed and full-document screens alike.
|
|
||||||
function showTombstone() {
|
|
||||||
if (tombstoneShown) return;
|
|
||||||
tombstoneShown = true;
|
|
||||||
const el = document.createElement('div');
|
|
||||||
el.id = 'bs-tombstone';
|
|
||||||
el.style.cssText = 'position:fixed;inset:0;z-index:99999;display:flex;' +
|
|
||||||
'align-items:center;justify-content:center;padding:2rem;text-align:center;' +
|
|
||||||
'background:rgba(20,20,22,0.92);color:#f5f5f7;font-family:system-ui,sans-serif';
|
|
||||||
el.innerHTML = '<div style="max-width:480px">' +
|
|
||||||
'<h2 style="margin:0 0 .5rem;font-weight:600">Companion paused</h2>' +
|
|
||||||
'<p style="margin:0;opacity:.85">This brainstorm companion has stopped. ' +
|
|
||||||
'Ask your coding agent to bring it back — this page reconnects automatically.</p></div>';
|
|
||||||
if (document.body) document.body.appendChild(el);
|
|
||||||
}
|
|
||||||
|
|
||||||
function connect() {
|
|
||||||
if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }
|
|
||||||
setStatus(everConnected ? 'reconnecting' : 'connecting');
|
|
||||||
ws = new WebSocket(websocketUrl());
|
|
||||||
|
|
||||||
ws.onopen = () => {
|
|
||||||
const recovered = tombstoneShown;
|
|
||||||
everConnected = true;
|
|
||||||
disconnectedSince = null;
|
|
||||||
reconnectDelay = MIN_RECONNECT_MS;
|
|
||||||
tombstoneShown = false;
|
|
||||||
setStatus('connected');
|
|
||||||
eventQueue.forEach(e => ws.send(JSON.stringify(e)));
|
|
||||||
eventQueue = [];
|
|
||||||
// Recovered from a tombstoned outage (e.g. the server restarted on the same
|
|
||||||
// port) — reload through the keyed bootstrap when possible so the cookie is
|
|
||||||
// refreshed before the visible URL returns to bare /.
|
|
||||||
if (recovered) reloadAfterRecovery();
|
|
||||||
};
|
|
||||||
|
|
||||||
ws.onmessage = (msg) => {
|
|
||||||
let data;
|
|
||||||
try { data = JSON.parse(msg.data); } catch (e) { return; }
|
|
||||||
if (data.type === 'reload') window.location.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
ws.onclose = () => {
|
|
||||||
ws = null;
|
|
||||||
if (disconnectedSince === null) disconnectedSince = Date.now();
|
|
||||||
if (Date.now() - disconnectedSince >= TOMBSTONE_AFTER_MS) {
|
|
||||||
setStatus('disconnected');
|
|
||||||
showTombstone();
|
|
||||||
} else {
|
|
||||||
setStatus('reconnecting');
|
|
||||||
}
|
|
||||||
reconnectTimer = setTimeout(connect, reconnectDelay);
|
|
||||||
reconnectDelay = nextReconnectDelay(reconnectDelay, MAX_RECONNECT_MS);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Let onclose own reconnection so we don't schedule it twice.
|
|
||||||
ws.onerror = () => { try { ws.close(); } catch (e) {} };
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendEvent(event) {
|
|
||||||
event.timestamp = Date.now();
|
|
||||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
||||||
ws.send(JSON.stringify(event));
|
|
||||||
} else {
|
|
||||||
eventQueue.push(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Capture clicks on choice elements
|
|
||||||
document.addEventListener('click', (e) => {
|
|
||||||
const target = e.target.closest('[data-choice]');
|
|
||||||
if (!target) return;
|
|
||||||
|
|
||||||
sendEvent({
|
|
||||||
type: 'click',
|
|
||||||
text: target.textContent.trim(),
|
|
||||||
choice: target.dataset.choice,
|
|
||||||
id: target.id || null
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Frame UI: selection tracking
|
|
||||||
window.selectedChoice = null;
|
|
||||||
|
|
||||||
window.toggleSelect = function(el) {
|
|
||||||
const container = el.closest('.options') || el.closest('.cards');
|
|
||||||
const multi = container && container.dataset.multiselect !== undefined;
|
|
||||||
if (container && !multi) {
|
|
||||||
container.querySelectorAll('.option, .card').forEach(o => o.classList.remove('selected'));
|
|
||||||
}
|
|
||||||
if (multi) {
|
|
||||||
el.classList.toggle('selected');
|
|
||||||
} else {
|
|
||||||
el.classList.add('selected');
|
|
||||||
}
|
|
||||||
window.selectedChoice = el.dataset.choice;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Expose API for explicit use
|
|
||||||
window.brainstorm = {
|
|
||||||
send: sendEvent,
|
|
||||||
choice: (value, metadata = {}) => sendEvent({ type: 'choice', value, ...metadata })
|
|
||||||
};
|
|
||||||
|
|
||||||
connect();
|
|
||||||
})();
|
|
||||||
@@ -1,723 +0,0 @@
|
|||||||
const crypto = require('crypto');
|
|
||||||
const http = require('http');
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
// ========== WebSocket Protocol (RFC 6455) ==========
|
|
||||||
|
|
||||||
const OPCODES = { TEXT: 0x01, CLOSE: 0x08, PING: 0x09, PONG: 0x0A };
|
|
||||||
const WS_MAGIC = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
|
|
||||||
const MAX_FRAME_PAYLOAD_BYTES = 10 * 1024 * 1024;
|
|
||||||
|
|
||||||
function computeAcceptKey(clientKey) {
|
|
||||||
return crypto.createHash('sha1').update(clientKey + WS_MAGIC).digest('base64');
|
|
||||||
}
|
|
||||||
|
|
||||||
function encodeFrame(opcode, payload) {
|
|
||||||
const fin = 0x80;
|
|
||||||
const len = payload.length;
|
|
||||||
let header;
|
|
||||||
|
|
||||||
if (len < 126) {
|
|
||||||
header = Buffer.alloc(2);
|
|
||||||
header[0] = fin | opcode;
|
|
||||||
header[1] = len;
|
|
||||||
} else if (len < 65536) {
|
|
||||||
header = Buffer.alloc(4);
|
|
||||||
header[0] = fin | opcode;
|
|
||||||
header[1] = 126;
|
|
||||||
header.writeUInt16BE(len, 2);
|
|
||||||
} else {
|
|
||||||
header = Buffer.alloc(10);
|
|
||||||
header[0] = fin | opcode;
|
|
||||||
header[1] = 127;
|
|
||||||
header.writeBigUInt64BE(BigInt(len), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Buffer.concat([header, payload]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function decodeFrame(buffer) {
|
|
||||||
if (buffer.length < 2) return null;
|
|
||||||
|
|
||||||
const secondByte = buffer[1];
|
|
||||||
const opcode = buffer[0] & 0x0F;
|
|
||||||
const masked = (secondByte & 0x80) !== 0;
|
|
||||||
let payloadLen = secondByte & 0x7F;
|
|
||||||
let offset = 2;
|
|
||||||
|
|
||||||
if (!masked) throw new Error('Client frames must be masked');
|
|
||||||
|
|
||||||
if (payloadLen === 126) {
|
|
||||||
if (buffer.length < 4) return null;
|
|
||||||
payloadLen = buffer.readUInt16BE(2);
|
|
||||||
offset = 4;
|
|
||||||
} else if (payloadLen === 127) {
|
|
||||||
if (buffer.length < 10) return null;
|
|
||||||
const extendedLen = buffer.readBigUInt64BE(2);
|
|
||||||
if (extendedLen > BigInt(MAX_FRAME_PAYLOAD_BYTES)) {
|
|
||||||
throw new Error('WebSocket frame payload exceeds maximum allowed size');
|
|
||||||
}
|
|
||||||
payloadLen = Number(extendedLen);
|
|
||||||
offset = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (payloadLen > MAX_FRAME_PAYLOAD_BYTES) {
|
|
||||||
throw new Error('WebSocket frame payload exceeds maximum allowed size');
|
|
||||||
}
|
|
||||||
|
|
||||||
const maskOffset = offset;
|
|
||||||
const dataOffset = offset + 4;
|
|
||||||
const totalLen = dataOffset + payloadLen;
|
|
||||||
if (buffer.length < totalLen) return null;
|
|
||||||
|
|
||||||
const mask = buffer.slice(maskOffset, dataOffset);
|
|
||||||
const data = Buffer.alloc(payloadLen);
|
|
||||||
for (let i = 0; i < payloadLen; i++) {
|
|
||||||
data[i] = buffer[dataOffset + i] ^ mask[i % 4];
|
|
||||||
}
|
|
||||||
|
|
||||||
return { opcode, payload: data, bytesConsumed: totalLen };
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== Configuration ==========
|
|
||||||
|
|
||||||
const PORT_FILE = process.env.BRAINSTORM_PORT_FILE || null;
|
|
||||||
const randomPort = () => 49152 + Math.floor(Math.random() * 16383);
|
|
||||||
// Prefer an explicit port, else the port this session last bound (so a restart
|
|
||||||
// reuses it and an already-open browser tab reconnects), else a random high port.
|
|
||||||
function preferredPort() {
|
|
||||||
if (process.env.BRAINSTORM_PORT) return Number(process.env.BRAINSTORM_PORT);
|
|
||||||
if (PORT_FILE) {
|
|
||||||
try {
|
|
||||||
const p = Number(fs.readFileSync(PORT_FILE, 'utf-8').trim());
|
|
||||||
if (Number.isInteger(p) && p > 1023 && p < 65536) return p;
|
|
||||||
} catch (e) { /* no prior port recorded */ }
|
|
||||||
}
|
|
||||||
return randomPort();
|
|
||||||
}
|
|
||||||
let PORT = preferredPort();
|
|
||||||
const HOST = process.env.BRAINSTORM_HOST || '127.0.0.1';
|
|
||||||
const URL_HOST = process.env.BRAINSTORM_URL_HOST || (HOST === '127.0.0.1' ? 'localhost' : HOST);
|
|
||||||
const SESSION_DIR = process.env.BRAINSTORM_DIR || '/tmp/brainstorm';
|
|
||||||
const CONTENT_DIR = path.join(SESSION_DIR, 'content');
|
|
||||||
const STATE_DIR = path.join(SESSION_DIR, 'state');
|
|
||||||
const SUPERPOWERS_VERSION = readSuperpowersVersion();
|
|
||||||
const SUPERPOWERS_BRAND_IMAGE_URL = 'https://primeradiant.com/brand/superpowers-visual-brainstorming-logo.png';
|
|
||||||
const TELEMETRY_DISABLE_ENV_VARS = [
|
|
||||||
'SUPERPOWERS_DISABLE_TELEMETRY',
|
|
||||||
'DISABLE_TELEMETRY',
|
|
||||||
'CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC'
|
|
||||||
];
|
|
||||||
const SUPERPOWERS_TELEMETRY_DISABLED = TELEMETRY_DISABLE_ENV_VARS.some(name => isTruthyEnv(process.env[name]));
|
|
||||||
let ownerPid = process.env.BRAINSTORM_OWNER_PID ? Number(process.env.BRAINSTORM_OWNER_PID) : null;
|
|
||||||
|
|
||||||
// Per-session secret key. The companion is reachable by any local browser tab
|
|
||||||
// and, when bound to a non-loopback host, by any host that can route to it.
|
|
||||||
// The key authenticates the real client uniformly across loopback, tunnel, and
|
|
||||||
// remote binds — and defeats DNS rebinding — where a Host/Origin allowlist
|
|
||||||
// cannot. It rides the served URL as ?key= and is mirrored into a cookie on
|
|
||||||
// first load so same-origin subresources and the WebSocket carry it for free.
|
|
||||||
// Persisted alongside the port (BRAINSTORM_TOKEN_FILE) so a restart keeps the
|
|
||||||
// same key and an already-open tab's cookie still validates.
|
|
||||||
const TOKEN_FILE = process.env.BRAINSTORM_TOKEN_FILE || null;
|
|
||||||
function generateToken() {
|
|
||||||
return crypto.randomBytes(32).toString('hex');
|
|
||||||
}
|
|
||||||
|
|
||||||
function chmodOwnerOnly(file) {
|
|
||||||
try { fs.chmodSync(file, 0o600); } catch (e) { /* best effort */ }
|
|
||||||
}
|
|
||||||
|
|
||||||
function initialToken() {
|
|
||||||
if (process.env.BRAINSTORM_TOKEN) {
|
|
||||||
return { value: process.env.BRAINSTORM_TOKEN, source: 'env' };
|
|
||||||
}
|
|
||||||
if (TOKEN_FILE) {
|
|
||||||
try {
|
|
||||||
const t = fs.readFileSync(TOKEN_FILE, 'utf-8').trim();
|
|
||||||
if (/^[0-9a-f]{32,}$/i.test(t)) {
|
|
||||||
chmodOwnerOnly(TOKEN_FILE);
|
|
||||||
return { value: t, source: 'file' };
|
|
||||||
}
|
|
||||||
} catch (e) { /* no prior token recorded */ }
|
|
||||||
}
|
|
||||||
return { value: generateToken(), source: 'generated' };
|
|
||||||
}
|
|
||||||
|
|
||||||
const tokenInfo = initialToken();
|
|
||||||
let TOKEN = tokenInfo.value;
|
|
||||||
let tokenSource = tokenInfo.source;
|
|
||||||
let COOKIE_NAME = 'brainstorm-key-' + PORT; // refined to the actual bound port in onListen
|
|
||||||
|
|
||||||
const MIME_TYPES = {
|
|
||||||
'.html': 'text/html', '.css': 'text/css', '.js': 'application/javascript',
|
|
||||||
'.json': 'application/json', '.png': 'image/png', '.jpg': 'image/jpeg',
|
|
||||||
'.jpeg': 'image/jpeg', '.gif': 'image/gif', '.svg': 'image/svg+xml'
|
|
||||||
};
|
|
||||||
|
|
||||||
// ========== Templates and Constants ==========
|
|
||||||
|
|
||||||
function waitingPage() {
|
|
||||||
return renderBranding(`<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head><meta charset="utf-8"><title>Brainstorm Companion</title>
|
|
||||||
<style>
|
|
||||||
body { font-family: system-ui, sans-serif; padding: 2rem; max-width: 800px; margin: 0 auto; }
|
|
||||||
h1 { color: #333; } p { color: #666; }
|
|
||||||
.brand { display: flex; align-items: center; min-width: 0; overflow: hidden; margin-bottom: 1.5rem; color: #666; font-size: 0.9rem; line-height: 1; }
|
|
||||||
.brand a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1; }
|
|
||||||
.brand-copy { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; transform: translateY(-1px); }
|
|
||||||
.brand-logo { display: block; height: 1em; width: auto; max-width: 180px; filter: invert(1); }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body><!-- BRANDING --><h1>Brainstorm Companion</h1>
|
|
||||||
<p>Waiting for the agent to push a screen...</p></body></html>`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const FORBIDDEN_PAGE = `<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head><meta charset="utf-8"><title>Session key required</title>
|
|
||||||
<style>body { font-family: system-ui, sans-serif; padding: 2rem; max-width: 800px; margin: 0 auto; }
|
|
||||||
h1 { color: #333; } p { color: #666; } code { background: #f0f0f0; padding: 0.1em 0.3em; border-radius: 4px; }</style>
|
|
||||||
</head>
|
|
||||||
<body><h1>Session key required</h1>
|
|
||||||
<p>This page needs the full URL your coding agent gave you, including the
|
|
||||||
<code>?key=…</code> part. Copy the complete URL and open it again.</p></body></html>`;
|
|
||||||
|
|
||||||
function bootstrapPage(key) {
|
|
||||||
const jsonKey = JSON.stringify(String(key));
|
|
||||||
return `<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head><meta charset="utf-8"><title>Opening Brainstorm Companion</title></head>
|
|
||||||
<body>
|
|
||||||
<script>
|
|
||||||
try { sessionStorage.setItem('brainstorm-session-key', ${jsonKey}); } catch (e) {}
|
|
||||||
location.replace('/');
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const frameTemplate = fs.readFileSync(path.join(__dirname, 'frame-template.html'), 'utf-8');
|
|
||||||
const helperScript = fs.readFileSync(path.join(__dirname, 'helper.js'), 'utf-8');
|
|
||||||
const helperInjection = '<script>\n' + helperScript + '\n</script>';
|
|
||||||
|
|
||||||
// ========== Helper Functions ==========
|
|
||||||
|
|
||||||
function readSuperpowersVersion() {
|
|
||||||
const root = path.join(__dirname, '../../..');
|
|
||||||
const manifests = [
|
|
||||||
path.join(root, 'package.json'),
|
|
||||||
path.join(root, '.codex-plugin/plugin.json')
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const manifest of manifests) {
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(fs.readFileSync(manifest, 'utf-8'));
|
|
||||||
if (data.version) return String(data.version);
|
|
||||||
} catch (e) {
|
|
||||||
// Packaged Codex plugins omit package.json; try the next manifest.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'unknown';
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTruthyEnv(value) {
|
|
||||||
if (!value) return false;
|
|
||||||
const normalized = String(value).trim().toLowerCase();
|
|
||||||
if (!normalized) return false;
|
|
||||||
return !['0', 'false', 'no', 'off'].includes(normalized);
|
|
||||||
}
|
|
||||||
|
|
||||||
function escapeHtmlText(value) {
|
|
||||||
return String(value)
|
|
||||||
.replace(/&/g, '&')
|
|
||||||
.replace(/</g, '<')
|
|
||||||
.replace(/>/g, '>')
|
|
||||||
.replace(/"/g, '"');
|
|
||||||
}
|
|
||||||
|
|
||||||
function brandMarkup() {
|
|
||||||
const version = escapeHtmlText(SUPERPOWERS_VERSION);
|
|
||||||
const text = SUPERPOWERS_TELEMETRY_DISABLED
|
|
||||||
? 'Prime Radiant Superpowers v' + version
|
|
||||||
: 'Superpowers v' + version;
|
|
||||||
const logo = SUPERPOWERS_TELEMETRY_DISABLED
|
|
||||||
? ''
|
|
||||||
: '<img class="brand-logo" src="' + SUPERPOWERS_BRAND_IMAGE_URL + '?v=' + encodeURIComponent(SUPERPOWERS_VERSION) + '" alt="Prime Radiant" referrerpolicy="no-referrer" decoding="async">';
|
|
||||||
|
|
||||||
return '<div class="brand"><a href="https://github.com/obra/superpowers">' + logo + '<span class="brand-copy">' + text + '</span></a></div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderBranding(html) {
|
|
||||||
return html.split('<!-- BRANDING -->').join(brandMarkup());
|
|
||||||
}
|
|
||||||
|
|
||||||
function isFullDocument(html) {
|
|
||||||
const trimmed = html.trimStart().toLowerCase();
|
|
||||||
return trimmed.startsWith('<!doctype') || trimmed.startsWith('<html');
|
|
||||||
}
|
|
||||||
|
|
||||||
function wrapInFrame(content) {
|
|
||||||
return renderBranding(frameTemplate).replace('<!-- CONTENT -->', content);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNewestScreen() {
|
|
||||||
const files = fs.readdirSync(CONTENT_DIR)
|
|
||||||
.filter(f => !f.startsWith('.') && f.endsWith('.html'))
|
|
||||||
.map(f => {
|
|
||||||
const fp = path.join(CONTENT_DIR, f);
|
|
||||||
if (!isRegularFileInsideContentDir(fp)) return null;
|
|
||||||
return { path: fp, mtime: fs.statSync(fp).mtime.getTime() };
|
|
||||||
})
|
|
||||||
.filter(Boolean)
|
|
||||||
.sort((a, b) => b.mtime - a.mtime);
|
|
||||||
return files.length > 0 ? files[0].path : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function urlHostForHttp(host) {
|
|
||||||
const h = String(host);
|
|
||||||
if (h.startsWith('[') && h.endsWith(']')) return h;
|
|
||||||
return h.includes(':') ? '[' + h + ']' : h;
|
|
||||||
}
|
|
||||||
|
|
||||||
function companionUrl() {
|
|
||||||
return 'http://' + urlHostForHttp(URL_HOST) + ':' + PORT + '/?key=' + TOKEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
function browserLauncherForPlatform(url, {
|
|
||||||
platform = process.platform,
|
|
||||||
osRelease = require('os').release(),
|
|
||||||
env = process.env
|
|
||||||
} = {}) {
|
|
||||||
const isWSL = platform === 'linux' && /microsoft/i.test(osRelease);
|
|
||||||
if (platform === 'darwin') return { bin: 'open', args: [url] };
|
|
||||||
if (platform === 'win32' || isWSL) {
|
|
||||||
return { bin: 'rundll32.exe', args: ['url.dll,FileProtocolHandler', url] };
|
|
||||||
}
|
|
||||||
if (env.DISPLAY || env.WAYLAND_DISPLAY) return { bin: 'xdg-open', args: [url] };
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isRegularFileInsideContentDir(filePath) {
|
|
||||||
let stat, realContentDir, realFilePath;
|
|
||||||
try {
|
|
||||||
stat = fs.lstatSync(filePath);
|
|
||||||
if (stat.isSymbolicLink()) return false;
|
|
||||||
if (!stat.isFile()) return false;
|
|
||||||
if (stat.nlink !== 1) return false;
|
|
||||||
realContentDir = fs.realpathSync(CONTENT_DIR);
|
|
||||||
realFilePath = fs.realpathSync(filePath);
|
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return realFilePath.startsWith(realContentDir + path.sep);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== Authentication ==========
|
|
||||||
|
|
||||||
function timingSafeEqualStr(a, b) {
|
|
||||||
const ab = Buffer.from(String(a));
|
|
||||||
const bb = Buffer.from(String(b));
|
|
||||||
if (ab.length !== bb.length) return false;
|
|
||||||
return crypto.timingSafeEqual(ab, bb);
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseCookies(header) {
|
|
||||||
const out = {};
|
|
||||||
if (!header) return out;
|
|
||||||
for (const part of header.split(';')) {
|
|
||||||
const eq = part.indexOf('=');
|
|
||||||
if (eq < 0) continue;
|
|
||||||
out[part.slice(0, eq).trim()] = part.slice(eq + 1).trim();
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A request is authorized if it carries the session key as ?key= or as the
|
|
||||||
// session cookie. Both are compared in constant time.
|
|
||||||
function isAuthorized(req) {
|
|
||||||
const q = req.url.indexOf('?');
|
|
||||||
if (q >= 0) {
|
|
||||||
const params = new URLSearchParams(req.url.slice(q + 1));
|
|
||||||
if (params.has('key')) {
|
|
||||||
const key = params.get('key');
|
|
||||||
return Boolean(key && timingSafeEqualStr(key, TOKEN));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const cookie = parseCookies(req.headers['cookie'])[COOKIE_NAME];
|
|
||||||
if (cookie && timingSafeEqualStr(cookie, TOKEN)) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pathnameOf(url) {
|
|
||||||
const q = url.indexOf('?');
|
|
||||||
return q >= 0 ? url.slice(0, q) : url;
|
|
||||||
}
|
|
||||||
|
|
||||||
function queryKey(url) {
|
|
||||||
const q = url.indexOf('?');
|
|
||||||
if (q < 0) return null;
|
|
||||||
return new URLSearchParams(url.slice(q + 1)).get('key');
|
|
||||||
}
|
|
||||||
|
|
||||||
function securityHeaders(headers = {}) {
|
|
||||||
return {
|
|
||||||
'Referrer-Policy': 'no-referrer',
|
|
||||||
'Cache-Control': 'no-store',
|
|
||||||
'X-Frame-Options': 'DENY',
|
|
||||||
'Content-Security-Policy': "frame-ancestors 'none'",
|
|
||||||
'Cross-Origin-Resource-Policy': 'same-origin',
|
|
||||||
...headers
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function isAllowedWebSocketOrigin(req) {
|
|
||||||
const origin = req.headers.origin;
|
|
||||||
if (!origin) return true;
|
|
||||||
const host = req.headers.host;
|
|
||||||
if (!host) return false;
|
|
||||||
return origin === 'http://' + host;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== HTTP Request Handler ==========
|
|
||||||
|
|
||||||
function handleRequest(req, res) {
|
|
||||||
if (!isAuthorized(req)) {
|
|
||||||
res.writeHead(403, securityHeaders({ 'Content-Type': 'text/html; charset=utf-8' }));
|
|
||||||
res.end(FORBIDDEN_PAGE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
touchActivity(); // only authorized requests count as activity
|
|
||||||
|
|
||||||
// Mirror the key into a cookie so same-origin subresources (/files/*) can
|
|
||||||
// authenticate after bootstrap. HttpOnly keeps it away from page scripts; the
|
|
||||||
// WebSocket Origin check below is what blocks cross-origin localhost injection.
|
|
||||||
res.setHeader('Set-Cookie',
|
|
||||||
COOKIE_NAME + '=' + TOKEN + '; HttpOnly; SameSite=Strict; Path=/');
|
|
||||||
|
|
||||||
const pathname = pathnameOf(req.url);
|
|
||||||
const keyFromQuery = queryKey(req.url);
|
|
||||||
if (req.method === 'GET' && pathname === '/' && keyFromQuery && timingSafeEqualStr(keyFromQuery, TOKEN)) {
|
|
||||||
res.writeHead(200, securityHeaders({ 'Content-Type': 'text/html; charset=utf-8' }));
|
|
||||||
res.end(bootstrapPage(keyFromQuery));
|
|
||||||
} else if (req.method === 'GET' && pathname === '/') {
|
|
||||||
const screenFile = getNewestScreen();
|
|
||||||
let html = screenFile
|
|
||||||
? (raw => isFullDocument(raw) ? raw : wrapInFrame(raw))(fs.readFileSync(screenFile, 'utf-8'))
|
|
||||||
: waitingPage();
|
|
||||||
|
|
||||||
if (html.includes('</body>')) {
|
|
||||||
html = html.replace('</body>', helperInjection + '\n</body>');
|
|
||||||
} else {
|
|
||||||
html += helperInjection;
|
|
||||||
}
|
|
||||||
|
|
||||||
res.writeHead(200, securityHeaders({ 'Content-Type': 'text/html; charset=utf-8' }));
|
|
||||||
res.end(html);
|
|
||||||
} else if (req.method === 'GET' && pathname.startsWith('/files/')) {
|
|
||||||
const fileName = path.basename(pathname.slice(7));
|
|
||||||
const filePath = path.join(CONTENT_DIR, fileName);
|
|
||||||
// Reject empty/dotfile names and anything that isn't a regular file —
|
|
||||||
// `/files/` would otherwise resolve to CONTENT_DIR and crash readFileSync (EISDIR).
|
|
||||||
if (!fileName || fileName.startsWith('.') || !isRegularFileInsideContentDir(filePath)) {
|
|
||||||
res.writeHead(404, securityHeaders());
|
|
||||||
res.end('Not found');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const ext = path.extname(filePath).toLowerCase();
|
|
||||||
const contentType = MIME_TYPES[ext] || 'application/octet-stream';
|
|
||||||
res.writeHead(200, securityHeaders({ 'Content-Type': contentType }));
|
|
||||||
res.end(fs.readFileSync(filePath));
|
|
||||||
} else {
|
|
||||||
res.writeHead(404, securityHeaders());
|
|
||||||
res.end('Not found');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== WebSocket Connection Handling ==========
|
|
||||||
|
|
||||||
const clients = new Set();
|
|
||||||
|
|
||||||
function handleUpgrade(req, socket) {
|
|
||||||
if (!isAuthorized(req) || !isAllowedWebSocketOrigin(req)) { socket.destroy(); return; }
|
|
||||||
|
|
||||||
const key = req.headers['sec-websocket-key'];
|
|
||||||
if (!key) { socket.destroy(); return; }
|
|
||||||
|
|
||||||
const accept = computeAcceptKey(key);
|
|
||||||
socket.write(
|
|
||||||
'HTTP/1.1 101 Switching Protocols\r\n' +
|
|
||||||
'Upgrade: websocket\r\n' +
|
|
||||||
'Connection: Upgrade\r\n' +
|
|
||||||
'Sec-WebSocket-Accept: ' + accept + '\r\n\r\n'
|
|
||||||
);
|
|
||||||
|
|
||||||
let buffer = Buffer.alloc(0);
|
|
||||||
clients.add(socket);
|
|
||||||
|
|
||||||
socket.on('data', (chunk) => {
|
|
||||||
buffer = Buffer.concat([buffer, chunk]);
|
|
||||||
while (buffer.length > 0) {
|
|
||||||
let result;
|
|
||||||
try {
|
|
||||||
result = decodeFrame(buffer);
|
|
||||||
} catch (e) {
|
|
||||||
socket.end(encodeFrame(OPCODES.CLOSE, Buffer.alloc(0)));
|
|
||||||
clients.delete(socket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!result) break;
|
|
||||||
buffer = buffer.slice(result.bytesConsumed);
|
|
||||||
|
|
||||||
switch (result.opcode) {
|
|
||||||
case OPCODES.TEXT:
|
|
||||||
handleMessage(result.payload.toString());
|
|
||||||
break;
|
|
||||||
case OPCODES.CLOSE:
|
|
||||||
socket.end(encodeFrame(OPCODES.CLOSE, Buffer.alloc(0)));
|
|
||||||
clients.delete(socket);
|
|
||||||
return;
|
|
||||||
case OPCODES.PING:
|
|
||||||
socket.write(encodeFrame(OPCODES.PONG, result.payload));
|
|
||||||
break;
|
|
||||||
case OPCODES.PONG:
|
|
||||||
break;
|
|
||||||
default: {
|
|
||||||
const closeBuf = Buffer.alloc(2);
|
|
||||||
closeBuf.writeUInt16BE(1003);
|
|
||||||
socket.end(encodeFrame(OPCODES.CLOSE, closeBuf));
|
|
||||||
clients.delete(socket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('close', () => clients.delete(socket));
|
|
||||||
socket.on('error', () => clients.delete(socket));
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleMessage(text) {
|
|
||||||
let event;
|
|
||||||
try {
|
|
||||||
event = JSON.parse(text);
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Failed to parse WebSocket message:', e.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
touchActivity();
|
|
||||||
console.log(JSON.stringify({ source: 'user-event', ...event }));
|
|
||||||
if (event && event.choice) {
|
|
||||||
const eventsFile = path.join(STATE_DIR, 'events');
|
|
||||||
fs.appendFileSync(eventsFile, JSON.stringify(event) + '\n');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function broadcast(msg) {
|
|
||||||
const frame = encodeFrame(OPCODES.TEXT, Buffer.from(JSON.stringify(msg)));
|
|
||||||
for (const socket of clients) {
|
|
||||||
try { socket.write(frame); } catch (e) { clients.delete(socket); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Best-effort: open the user's browser the first time a screen is actually ready
|
|
||||||
// to show. Skips when disabled, on a non-loopback (remote) bind, or when a
|
|
||||||
// browser is already connected. Override the launcher with BRAINSTORM_OPEN_CMD.
|
|
||||||
let browserOpened = false;
|
|
||||||
function maybeOpenBrowser() {
|
|
||||||
if (browserOpened) return;
|
|
||||||
browserOpened = true;
|
|
||||||
if (!process.env.BRAINSTORM_OPEN) return; // opt-in: only after the user approves the companion
|
|
||||||
if (HOST !== '127.0.0.1' && HOST !== 'localhost') return;
|
|
||||||
if (clients.size > 0) return; // the user already opened it
|
|
||||||
const url = companionUrl(); // must carry the key or the gate 403s it
|
|
||||||
const cp = require('child_process');
|
|
||||||
// Operator-provided launcher: run as given (this env var is trusted operator input).
|
|
||||||
if (process.env.BRAINSTORM_OPEN_CMD) {
|
|
||||||
try { cp.exec(process.env.BRAINSTORM_OPEN_CMD + ' ' + JSON.stringify(url), () => {}); } catch (e) { /* best effort */ }
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Platform launchers: pass the URL as an argv element via execFile (no shell),
|
|
||||||
// so a url-host containing shell metacharacters can't inject a command.
|
|
||||||
const launcher = browserLauncherForPlatform(url);
|
|
||||||
if (!launcher) return; // headless: nothing to open
|
|
||||||
try { cp.execFile(launcher.bin, launcher.args, () => {}); } catch (e) { /* best effort */ }
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== Activity Tracking ==========
|
|
||||||
|
|
||||||
// Idle timeout: shut down after this long with no activity. Default 4 hours;
|
|
||||||
// override with BRAINSTORM_IDLE_TIMEOUT_MS (start-server.sh: --idle-timeout-minutes).
|
|
||||||
const IDLE_TIMEOUT_MS = (() => {
|
|
||||||
const ms = Number(process.env.BRAINSTORM_IDLE_TIMEOUT_MS);
|
|
||||||
return Number.isFinite(ms) && ms > 0 ? ms : 4 * 60 * 60 * 1000;
|
|
||||||
})();
|
|
||||||
// How often the watchdog checks for owner-death / idleness. Configurable mainly
|
|
||||||
// so tests can run fast; production default is 60s.
|
|
||||||
const LIFECYCLE_CHECK_MS = (() => {
|
|
||||||
const ms = Number(process.env.BRAINSTORM_LIFECYCLE_CHECK_MS);
|
|
||||||
return Number.isFinite(ms) && ms > 0 ? ms : 60 * 1000;
|
|
||||||
})();
|
|
||||||
let lastActivity = Date.now();
|
|
||||||
|
|
||||||
function touchActivity() {
|
|
||||||
lastActivity = Date.now();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== File Watching ==========
|
|
||||||
|
|
||||||
const debounceTimers = new Map();
|
|
||||||
|
|
||||||
// ========== Server Startup ==========
|
|
||||||
|
|
||||||
function startServer() {
|
|
||||||
if (!fs.existsSync(CONTENT_DIR)) fs.mkdirSync(CONTENT_DIR, { recursive: true });
|
|
||||||
if (!fs.existsSync(STATE_DIR)) fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
||||||
|
|
||||||
// Track known files to distinguish new screens from updates.
|
|
||||||
// macOS fs.watch reports 'rename' for both new files and overwrites,
|
|
||||||
// so we can't rely on eventType alone.
|
|
||||||
const knownFiles = new Set(
|
|
||||||
fs.readdirSync(CONTENT_DIR).filter(f => !f.startsWith('.') && f.endsWith('.html'))
|
|
||||||
);
|
|
||||||
|
|
||||||
const server = http.createServer(handleRequest);
|
|
||||||
server.on('upgrade', handleUpgrade);
|
|
||||||
|
|
||||||
const watcher = fs.watch(CONTENT_DIR, (eventType, filename) => {
|
|
||||||
if (!filename || filename.startsWith('.') || !filename.endsWith('.html')) return;
|
|
||||||
|
|
||||||
if (debounceTimers.has(filename)) clearTimeout(debounceTimers.get(filename));
|
|
||||||
debounceTimers.set(filename, setTimeout(() => {
|
|
||||||
debounceTimers.delete(filename);
|
|
||||||
const filePath = path.join(CONTENT_DIR, filename);
|
|
||||||
|
|
||||||
if (!fs.existsSync(filePath)) return; // file was deleted
|
|
||||||
touchActivity();
|
|
||||||
|
|
||||||
if (!knownFiles.has(filename)) {
|
|
||||||
knownFiles.add(filename);
|
|
||||||
const eventsFile = path.join(STATE_DIR, 'events');
|
|
||||||
if (fs.existsSync(eventsFile)) fs.unlinkSync(eventsFile);
|
|
||||||
console.log(JSON.stringify({ type: 'screen-added', file: filePath }));
|
|
||||||
maybeOpenBrowser();
|
|
||||||
} else {
|
|
||||||
console.log(JSON.stringify({ type: 'screen-updated', file: filePath }));
|
|
||||||
}
|
|
||||||
|
|
||||||
broadcast({ type: 'reload' });
|
|
||||||
}, 100));
|
|
||||||
});
|
|
||||||
watcher.on('error', (err) => console.error('fs.watch error:', err.message));
|
|
||||||
|
|
||||||
function shutdown(reason) {
|
|
||||||
console.log(JSON.stringify({ type: 'server-stopped', reason }));
|
|
||||||
const infoFile = path.join(STATE_DIR, 'server-info');
|
|
||||||
if (fs.existsSync(infoFile)) fs.unlinkSync(infoFile);
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.join(STATE_DIR, 'server-stopped'),
|
|
||||||
JSON.stringify({ reason, timestamp: Date.now() }) + '\n'
|
|
||||||
);
|
|
||||||
watcher.close();
|
|
||||||
clearInterval(lifecycleCheck);
|
|
||||||
// Close any upgraded WebSocket sockets so server.close() can complete and
|
|
||||||
// the process actually exits instead of lingering on an open connection.
|
|
||||||
for (const socket of clients) {
|
|
||||||
try { socket.destroy(); } catch (e) { /* already gone */ }
|
|
||||||
}
|
|
||||||
server.close(() => process.exit(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
function ownerAlive() {
|
|
||||||
if (!ownerPid) return true;
|
|
||||||
try { process.kill(ownerPid, 0); return true; } catch (e) { return e.code === 'EPERM'; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Periodically exit if the owner process died or we've been idle too long.
|
|
||||||
const lifecycleCheck = setInterval(() => {
|
|
||||||
if (!ownerAlive()) shutdown('owner process exited');
|
|
||||||
else if (Date.now() - lastActivity > IDLE_TIMEOUT_MS) shutdown('idle timeout');
|
|
||||||
}, LIFECYCLE_CHECK_MS);
|
|
||||||
lifecycleCheck.unref();
|
|
||||||
|
|
||||||
// Validate owner PID at startup. If it's already dead, the PID resolution
|
|
||||||
// was wrong (common on WSL, Tailscale SSH, and cross-user scenarios).
|
|
||||||
// Disable monitoring and rely on the idle timeout instead.
|
|
||||||
if (ownerPid) {
|
|
||||||
try { process.kill(ownerPid, 0); }
|
|
||||||
catch (e) {
|
|
||||||
if (e.code !== 'EPERM') {
|
|
||||||
console.log(JSON.stringify({ type: 'owner-pid-invalid', pid: ownerPid, reason: 'dead at startup' }));
|
|
||||||
ownerPid = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the preferred port is already taken (e.g. a previous server is still
|
|
||||||
// alive), fall back to a random port once instead of failing.
|
|
||||||
let triedFallback = false;
|
|
||||||
|
|
||||||
function onListen() {
|
|
||||||
// Cookie name keys on the ACTUAL bound port (may differ from the preferred
|
|
||||||
// one after an EADDRINUSE fallback) so it can't collide with another server's
|
|
||||||
// cookie in the shared localhost jar.
|
|
||||||
COOKIE_NAME = 'brainstorm-key-' + PORT;
|
|
||||||
// Record the bound port AND token so the next restart of this session reuses
|
|
||||||
// them — but ONLY when we got our preferred port. On a fallback we bound a
|
|
||||||
// *different* port because someone else holds the preferred one; persisting
|
|
||||||
// would overwrite the shared files and strand that other session's open tab.
|
|
||||||
if (PORT_FILE && !triedFallback) {
|
|
||||||
try { fs.writeFileSync(PORT_FILE, String(PORT)); } catch (e) { /* best effort */ }
|
|
||||||
if (TOKEN_FILE) {
|
|
||||||
try {
|
|
||||||
fs.writeFileSync(TOKEN_FILE, TOKEN, { mode: 0o600 });
|
|
||||||
chmodOwnerOnly(TOKEN_FILE);
|
|
||||||
} catch (e) { /* best effort */ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const info = JSON.stringify({
|
|
||||||
type: 'server-started', port: Number(PORT), host: HOST,
|
|
||||||
url_host: URL_HOST, url: companionUrl(),
|
|
||||||
screen_dir: CONTENT_DIR, state_dir: STATE_DIR, idle_timeout_ms: IDLE_TIMEOUT_MS
|
|
||||||
});
|
|
||||||
console.log(info);
|
|
||||||
// server-info embeds the key — keep it owner-only.
|
|
||||||
fs.writeFileSync(path.join(STATE_DIR, 'server-info'), info + '\n', { mode: 0o600 });
|
|
||||||
}
|
|
||||||
|
|
||||||
server.on('error', (err) => {
|
|
||||||
if (err.code === 'EADDRINUSE' && !triedFallback) {
|
|
||||||
if (tokenSource === 'env') {
|
|
||||||
console.error('Server failed to bind: preferred port is in use and BRAINSTORM_TOKEN is set; refusing fallback with explicit token');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
triedFallback = true;
|
|
||||||
PORT = randomPort();
|
|
||||||
if (tokenSource === 'file') {
|
|
||||||
TOKEN = generateToken();
|
|
||||||
tokenSource = 'generated-fallback';
|
|
||||||
}
|
|
||||||
server.listen(PORT, HOST, onListen);
|
|
||||||
} else {
|
|
||||||
console.error('Server failed to bind:', err.message);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
server.listen(PORT, HOST, onListen);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (require.main === module) {
|
|
||||||
startServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
computeAcceptKey,
|
|
||||||
encodeFrame,
|
|
||||||
decodeFrame,
|
|
||||||
browserLauncherForPlatform,
|
|
||||||
OPCODES,
|
|
||||||
MAX_FRAME_PAYLOAD_BYTES
|
|
||||||
};
|
|
||||||
@@ -1,209 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Start the brainstorm server and output connection info
|
|
||||||
# Usage: start-server.sh [--project-dir <path>] [--host <bind-host>] [--url-host <display-host>] [--foreground] [--background]
|
|
||||||
#
|
|
||||||
# Starts server on a random high port, outputs JSON with URL.
|
|
||||||
# Each session gets its own directory to avoid conflicts.
|
|
||||||
#
|
|
||||||
# Options:
|
|
||||||
# --project-dir <path> Store session files under <path>/.superpowers/brainstorm/
|
|
||||||
# instead of /tmp. Files persist after server stops.
|
|
||||||
# --host <bind-host> Host/interface to bind (default: 127.0.0.1).
|
|
||||||
# Use 0.0.0.0 in remote/containerized environments.
|
|
||||||
# --url-host <host> Hostname shown in returned URL JSON.
|
|
||||||
# --idle-timeout-minutes <n> Shut down after n minutes idle (default 240 = 4h).
|
|
||||||
# --open Auto-open the browser on the first screen (use only
|
|
||||||
# after the user approves the visual companion).
|
|
||||||
# --foreground Run server in the current terminal (no backgrounding).
|
|
||||||
# --background Force background mode (overrides Codex auto-foreground).
|
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
||||||
|
|
||||||
# Parse arguments
|
|
||||||
PROJECT_DIR=""
|
|
||||||
FOREGROUND="false"
|
|
||||||
FORCE_BACKGROUND="false"
|
|
||||||
BIND_HOST="127.0.0.1"
|
|
||||||
URL_HOST=""
|
|
||||||
IDLE_TIMEOUT_MINUTES=""
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case "$1" in
|
|
||||||
--project-dir)
|
|
||||||
PROJECT_DIR="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
--host)
|
|
||||||
BIND_HOST="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
--url-host)
|
|
||||||
URL_HOST="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
--idle-timeout-minutes)
|
|
||||||
IDLE_TIMEOUT_MINUTES="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
--open)
|
|
||||||
export BRAINSTORM_OPEN=1
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--foreground|--no-daemon)
|
|
||||||
FOREGROUND="true"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--background|--daemon)
|
|
||||||
FORCE_BACKGROUND="true"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "{\"error\": \"Unknown argument: $1\"}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -z "$URL_HOST" ]]; then
|
|
||||||
if [[ "$BIND_HOST" == "127.0.0.1" || "$BIND_HOST" == "localhost" ]]; then
|
|
||||||
URL_HOST="localhost"
|
|
||||||
else
|
|
||||||
URL_HOST="$BIND_HOST"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$IDLE_TIMEOUT_MINUTES" ]]; then
|
|
||||||
if ! [[ "$IDLE_TIMEOUT_MINUTES" =~ ^[0-9]+$ ]] || [[ "$IDLE_TIMEOUT_MINUTES" -lt 1 ]]; then
|
|
||||||
echo "{\"error\": \"--idle-timeout-minutes must be a positive integer\"}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export BRAINSTORM_IDLE_TIMEOUT_MS=$(( IDLE_TIMEOUT_MINUTES * 60 * 1000 ))
|
|
||||||
fi
|
|
||||||
|
|
||||||
is_windows_like_shell() {
|
|
||||||
case "${OSTYPE:-}" in
|
|
||||||
msys*|cygwin*|mingw*) return 0 ;;
|
|
||||||
esac
|
|
||||||
if [[ -n "${MSYSTEM:-}" ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
local uname_s
|
|
||||||
uname_s="$(uname -s 2>/dev/null || true)"
|
|
||||||
case "$uname_s" in
|
|
||||||
MSYS*|MINGW*|CYGWIN*) return 0 ;;
|
|
||||||
esac
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Some environments reap detached/background processes. Auto-foreground when detected.
|
|
||||||
if [[ -n "${CODEX_CI:-}" && "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "true" ]]; then
|
|
||||||
FOREGROUND="true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Windows/Git Bash reaps nohup background processes. Auto-foreground when detected.
|
|
||||||
if [[ "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "true" ]]; then
|
|
||||||
if is_windows_like_shell; then
|
|
||||||
FOREGROUND="true"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Session files (server.log, server-info, .last-token) embed the session key —
|
|
||||||
# keep everything this script and the server create owner-only.
|
|
||||||
umask 077
|
|
||||||
|
|
||||||
# Generate unique session directory
|
|
||||||
SESSION_ID="$$-$(date +%s)"
|
|
||||||
|
|
||||||
if [[ -n "$PROJECT_DIR" ]]; then
|
|
||||||
SESSION_DIR="${PROJECT_DIR}/.superpowers/brainstorm/${SESSION_ID}"
|
|
||||||
# Persist the bound port and key per project so a restart reuses them and an
|
|
||||||
# already-open browser tab reconnects to the same URL with a valid cookie.
|
|
||||||
export BRAINSTORM_PORT_FILE="${PROJECT_DIR}/.superpowers/brainstorm/.last-port"
|
|
||||||
export BRAINSTORM_TOKEN_FILE="${PROJECT_DIR}/.superpowers/brainstorm/.last-token"
|
|
||||||
else
|
|
||||||
SESSION_DIR="/tmp/brainstorm-${SESSION_ID}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
STATE_DIR="${SESSION_DIR}/state"
|
|
||||||
PID_FILE="${STATE_DIR}/server.pid"
|
|
||||||
LOG_FILE="${STATE_DIR}/server.log"
|
|
||||||
SERVER_ID_FILE="${STATE_DIR}/server-instance-id"
|
|
||||||
|
|
||||||
# Create fresh session directory with content and state peers
|
|
||||||
mkdir -p "${SESSION_DIR}/content" "$STATE_DIR"
|
|
||||||
|
|
||||||
SERVER_ID=""
|
|
||||||
if [[ -r /dev/urandom ]]; then
|
|
||||||
SERVER_ID="$(od -An -N24 -tx1 /dev/urandom 2>/dev/null | tr -d ' \n' || true)"
|
|
||||||
fi
|
|
||||||
if ! [[ "$SERVER_ID" =~ ^[A-Za-z0-9_-]{32,64}$ ]]; then
|
|
||||||
SERVER_ID="$(printf '%08x%08x%08x%08x' "$$" "$(date +%s)" "${RANDOM:-0}" "${RANDOM:-0}")"
|
|
||||||
fi
|
|
||||||
printf '%s\n' "$SERVER_ID" > "$SERVER_ID_FILE"
|
|
||||||
chmod 600 "$SERVER_ID_FILE" 2>/dev/null || true
|
|
||||||
|
|
||||||
# Kill any existing server
|
|
||||||
if [[ -f "$PID_FILE" ]]; then
|
|
||||||
old_pid=$(cat "$PID_FILE")
|
|
||||||
kill "$old_pid" 2>/dev/null
|
|
||||||
rm -f "$PID_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$SCRIPT_DIR" || exit 1
|
|
||||||
|
|
||||||
# Resolve the harness PID (grandparent of this script).
|
|
||||||
# $PPID is the ephemeral shell the harness spawned to run us — it dies
|
|
||||||
# when this script exits. The harness itself is $PPID's parent.
|
|
||||||
OWNER_PID="$(ps -o ppid= -p "$PPID" 2>/dev/null | tr -d ' ')"
|
|
||||||
if [[ -z "$OWNER_PID" || "$OWNER_PID" == "1" ]]; then
|
|
||||||
OWNER_PID="$PPID"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Windows/MSYS2: Node.js cannot see POSIX PIDs from the MSYS2 namespace.
|
|
||||||
# Passing a PID node cannot verify causes server to log owner-pid-invalid
|
|
||||||
# and self-terminate at the 60-second lifecycle check. Clear it so the
|
|
||||||
# watchdog is disabled and the idle timeout becomes the only shutdown trigger.
|
|
||||||
if is_windows_like_shell; then
|
|
||||||
OWNER_PID=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Foreground mode for environments that reap detached/background processes.
|
|
||||||
if [[ "$FOREGROUND" == "true" ]]; then
|
|
||||||
env BRAINSTORM_DIR="$SESSION_DIR" BRAINSTORM_HOST="$BIND_HOST" BRAINSTORM_URL_HOST="$URL_HOST" BRAINSTORM_OWNER_PID="$OWNER_PID" node server.cjs "--brainstorm-server-id=$SERVER_ID" &
|
|
||||||
SERVER_PID=$!
|
|
||||||
echo "$SERVER_PID" > "$PID_FILE"
|
|
||||||
wait "$SERVER_PID"
|
|
||||||
exit $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start server, capturing output to log file
|
|
||||||
# Use nohup to survive shell exit; disown to remove from job table
|
|
||||||
nohup env BRAINSTORM_DIR="$SESSION_DIR" BRAINSTORM_HOST="$BIND_HOST" BRAINSTORM_URL_HOST="$URL_HOST" BRAINSTORM_OWNER_PID="$OWNER_PID" node server.cjs "--brainstorm-server-id=$SERVER_ID" > "$LOG_FILE" 2>&1 &
|
|
||||||
SERVER_PID=$!
|
|
||||||
disown "$SERVER_PID" 2>/dev/null
|
|
||||||
echo "$SERVER_PID" > "$PID_FILE"
|
|
||||||
|
|
||||||
# Wait for server-started message (check log file)
|
|
||||||
for _ in {1..50}; do
|
|
||||||
if grep -q "server-started" "$LOG_FILE" 2>/dev/null; then
|
|
||||||
# Verify server is still alive after a short window (catches process reapers)
|
|
||||||
alive="true"
|
|
||||||
for _ in {1..20}; do
|
|
||||||
if ! kill -0 "$SERVER_PID" 2>/dev/null; then
|
|
||||||
alive="false"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
if [[ "$alive" != "true" ]]; then
|
|
||||||
echo "{\"error\": \"Server started but was killed. Retry in a persistent terminal with: $SCRIPT_DIR/start-server.sh${PROJECT_DIR:+ --project-dir $PROJECT_DIR} --host $BIND_HOST --url-host $URL_HOST --foreground\"}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
grep "server-started" "$LOG_FILE" | head -1
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
|
|
||||||
# Timeout - server didn't start
|
|
||||||
echo '{"error": "Server failed to start within 5 seconds"}'
|
|
||||||
exit 1
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Stop the brainstorm server and clean up
|
|
||||||
# Usage: stop-server.sh <session_dir>
|
|
||||||
#
|
|
||||||
# Kills the server process. Only deletes session directory if it's
|
|
||||||
# under /tmp (ephemeral). Persistent directories (.superpowers/) are
|
|
||||||
# kept so mockups can be reviewed later.
|
|
||||||
|
|
||||||
SESSION_DIR="$1"
|
|
||||||
|
|
||||||
if [[ -z "$SESSION_DIR" ]]; then
|
|
||||||
echo '{"error": "Usage: stop-server.sh <session_dir>"}'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
STATE_DIR="${SESSION_DIR}/state"
|
|
||||||
PID_FILE="${STATE_DIR}/server.pid"
|
|
||||||
SERVER_ID_FILE="${STATE_DIR}/server-instance-id"
|
|
||||||
|
|
||||||
mark_stopped() {
|
|
||||||
local reason="$1"
|
|
||||||
rm -f "${STATE_DIR}/server-info"
|
|
||||||
printf '{"reason":"%s","timestamp":%s}\n' "$reason" "$(date +%s)" > "${STATE_DIR}/server-stopped"
|
|
||||||
}
|
|
||||||
|
|
||||||
read_expected_server_id() {
|
|
||||||
[[ -f "$SERVER_ID_FILE" ]] || return 1
|
|
||||||
local id
|
|
||||||
id="$(tr -d '\r\n' < "$SERVER_ID_FILE" 2>/dev/null || true)"
|
|
||||||
[[ "$id" =~ ^[A-Za-z0-9_-]{32,64}$ ]] || return 1
|
|
||||||
printf '%s\n' "$id"
|
|
||||||
}
|
|
||||||
|
|
||||||
command_line_for_pid() {
|
|
||||||
local pid="$1"
|
|
||||||
if [[ -r "/proc/$pid/cmdline" ]]; then
|
|
||||||
tr '\0' '\n' < "/proc/$pid/cmdline" 2>/dev/null || true
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
ps -ww -p "$pid" -o command= 2>/dev/null || ps -f -p "$pid" 2>/dev/null | sed '1d' || true
|
|
||||||
}
|
|
||||||
|
|
||||||
command_has_server_id() {
|
|
||||||
local pid="$1"
|
|
||||||
local expected="$2"
|
|
||||||
local expected_arg="--brainstorm-server-id=$expected"
|
|
||||||
if [[ -r "/proc/$pid/cmdline" ]]; then
|
|
||||||
local arg
|
|
||||||
while IFS= read -r -d '' arg || [[ -n "$arg" ]]; do
|
|
||||||
[[ "$arg" == "$expected_arg" ]] && return 0
|
|
||||||
done < "/proc/$pid/cmdline"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
local command_line
|
|
||||||
command_line="$(command_line_for_pid "$pid")"
|
|
||||||
[[ -n "$command_line" ]] || return 1
|
|
||||||
case " $command_line " in
|
|
||||||
*" $expected_arg "*) return 0 ;;
|
|
||||||
*) return 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# Confirm a PID has this session's per-start instance id, not just a familiar
|
|
||||||
# process name. Ambiguous or legacy metadata fails closed as stale_pid.
|
|
||||||
is_brainstorm_server() {
|
|
||||||
kill -0 "$1" 2>/dev/null || return 1
|
|
||||||
local expected_id
|
|
||||||
expected_id="$(read_expected_server_id)" || return 1
|
|
||||||
command_has_server_id "$1" "$expected_id" || return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ -f "$PID_FILE" ]]; then
|
|
||||||
pid=$(cat "$PID_FILE")
|
|
||||||
|
|
||||||
# Refuse to signal a PID we can't prove is our server. A stale pid file may
|
|
||||||
# point at an unrelated process after a reboot/PID wraparound.
|
|
||||||
if ! is_brainstorm_server "$pid"; then
|
|
||||||
rm -f "$PID_FILE" "$SERVER_ID_FILE"
|
|
||||||
mark_stopped "stale_pid"
|
|
||||||
echo '{"status": "stale_pid"}'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try to stop gracefully, fallback to force if still alive
|
|
||||||
kill "$pid" 2>/dev/null || true
|
|
||||||
|
|
||||||
# Wait for graceful shutdown (up to ~2s)
|
|
||||||
for _ in {1..20}; do
|
|
||||||
if ! kill -0 "$pid" 2>/dev/null; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
|
|
||||||
# If still running, escalate to SIGKILL
|
|
||||||
if kill -0 "$pid" 2>/dev/null; then
|
|
||||||
kill -9 "$pid" 2>/dev/null || true
|
|
||||||
|
|
||||||
# Give SIGKILL a moment to take effect
|
|
||||||
sleep 0.1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if kill -0 "$pid" 2>/dev/null; then
|
|
||||||
echo '{"status": "failed", "error": "process still running"}'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f "$PID_FILE" "$SERVER_ID_FILE" "${STATE_DIR}/server.log"
|
|
||||||
mark_stopped "stop-server.sh"
|
|
||||||
|
|
||||||
# Only delete ephemeral /tmp directories
|
|
||||||
if [[ "$SESSION_DIR" == /tmp/* ]]; then
|
|
||||||
rm -rf "$SESSION_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo '{"status": "stopped"}'
|
|
||||||
else
|
|
||||||
echo '{"status": "not_running"}'
|
|
||||||
fi
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# Spec Document Reviewer Prompt Template
|
|
||||||
|
|
||||||
Use this template when dispatching a spec document reviewer subagent.
|
|
||||||
|
|
||||||
**Purpose:** Verify the spec is complete, consistent, and ready for implementation planning.
|
|
||||||
|
|
||||||
**Dispatch after:** Spec document is written to docs/superpowers/specs/
|
|
||||||
|
|
||||||
```
|
|
||||||
Subagent (general-purpose):
|
|
||||||
description: "Review spec document"
|
|
||||||
prompt: |
|
|
||||||
You are a spec document reviewer. Verify this spec is complete and ready for planning.
|
|
||||||
|
|
||||||
**Spec to review:** [SPEC_FILE_PATH]
|
|
||||||
|
|
||||||
## What to Check
|
|
||||||
|
|
||||||
| Category | What to Look For |
|
|
||||||
|----------|------------------|
|
|
||||||
| Completeness | TODOs, placeholders, "TBD", incomplete sections |
|
|
||||||
| Consistency | Internal contradictions, conflicting requirements |
|
|
||||||
| Clarity | Requirements ambiguous enough to cause someone to build the wrong thing |
|
|
||||||
| Scope | Focused enough for a single plan — not covering multiple independent subsystems |
|
|
||||||
| YAGNI | Unrequested features, over-engineering |
|
|
||||||
|
|
||||||
## Calibration
|
|
||||||
|
|
||||||
**Only flag issues that would cause real problems during implementation planning.**
|
|
||||||
A missing section, a contradiction, or a requirement so ambiguous it could be
|
|
||||||
interpreted two different ways — those are issues. Minor wording improvements,
|
|
||||||
stylistic preferences, and "sections less detailed than others" are not.
|
|
||||||
|
|
||||||
Approve unless there are serious gaps that would lead to a flawed plan.
|
|
||||||
|
|
||||||
## Output Format
|
|
||||||
|
|
||||||
## Spec Review
|
|
||||||
|
|
||||||
**Status:** Approved | Issues Found
|
|
||||||
|
|
||||||
**Issues (if any):**
|
|
||||||
- [Section X]: [specific issue] - [why it matters for planning]
|
|
||||||
|
|
||||||
**Recommendations (advisory, do not block approval):**
|
|
||||||
- [suggestions for improvement]
|
|
||||||
```
|
|
||||||
|
|
||||||
**Reviewer returns:** Status, Issues (if any), Recommendations
|
|
||||||
@@ -1,299 +0,0 @@
|
|||||||
# Visual Companion Guide
|
|
||||||
|
|
||||||
Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
|
|
||||||
|
|
||||||
**Use the browser** when the content itself is visual:
|
|
||||||
|
|
||||||
- **UI mockups** — wireframes, layouts, navigation structures, component designs
|
|
||||||
- **Architecture diagrams** — system components, data flow, relationship maps
|
|
||||||
- **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
|
|
||||||
- **Design polish** — when the question is about look and feel, spacing, visual hierarchy
|
|
||||||
- **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
|
|
||||||
|
|
||||||
**Use the terminal** when the content is text or tabular:
|
|
||||||
|
|
||||||
- **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
|
|
||||||
- **Conceptual A/B/C choices** — picking between approaches described in words
|
|
||||||
- **Tradeoff lists** — pros/cons, comparison tables
|
|
||||||
- **Technical decisions** — API design, data modeling, architectural approach selection
|
|
||||||
- **Clarifying questions** — anything where the answer is words, not a visual preference
|
|
||||||
|
|
||||||
A question *about* a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual — use the terminal. "Which of these wizard layouts feels right?" is visual — use the browser.
|
|
||||||
|
|
||||||
## How It Works
|
|
||||||
|
|
||||||
The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content to `screen_dir`, the user sees it in their browser and can click to select options. Selections are recorded to `state_dir/events` that you read on your next turn.
|
|
||||||
|
|
||||||
**Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, connection status, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
|
|
||||||
|
|
||||||
## Starting a Session
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Start AFTER the user approves the companion. --open auto-opens their browser on
|
|
||||||
# the first screen; --project-dir persists mockups and enables same-port restart.
|
|
||||||
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
||||||
|
|
||||||
# Returns: {"type":"server-started","port":52341,
|
|
||||||
# "url":"http://localhost:52341/?key=ab12…",
|
|
||||||
# "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content",
|
|
||||||
# "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"}
|
|
||||||
```
|
|
||||||
|
|
||||||
Save `screen_dir` and `state_dir` from the response. With `--open`, the browser opens itself when you push the first screen — you don't need to ask the user to open it, but still share the URL as a fallback (headless/remote setups won't auto-open).
|
|
||||||
|
|
||||||
**The URL contains a session key (`?key=…`).** The server rejects any request
|
|
||||||
without it, so always give the user the **complete** URL from the `url` field —
|
|
||||||
never strip the query string, and never hand out a bare `http://host:port`. The
|
|
||||||
key gates HTTP and WebSocket access so a stray browser tab or another machine on
|
|
||||||
the network can't read the screens or inject events. After the first load the
|
|
||||||
browser remembers the key via a cookie, so reloads and `/files/*` assets work
|
|
||||||
without repeating it.
|
|
||||||
|
|
||||||
**Finding connection info:** The server writes its startup JSON to `$STATE_DIR/server-info`. If you launched the server in the background and didn't capture stdout, read that file to get the URL and port. When using `--project-dir`, check `<project>/.superpowers/brainstorm/` for the session directory.
|
|
||||||
|
|
||||||
**Note:** Pass the project root as `--project-dir` so mockups persist in `.superpowers/brainstorm/` and survive server restarts. Without it, files go to `/tmp` and get cleaned up. Remind the user to add `.superpowers/` to `.gitignore` if it's not already there.
|
|
||||||
|
|
||||||
**Launching the server by platform:**
|
|
||||||
|
|
||||||
**Claude Code:**
|
|
||||||
```bash
|
|
||||||
# Default mode works — the script backgrounds the server itself.
|
|
||||||
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
||||||
```
|
|
||||||
|
|
||||||
On Windows, the script auto-detects and switches to foreground mode (which blocks the tool call). Use `run_in_background: true` on the Bash tool call so the server survives across conversation turns, then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
|
|
||||||
|
|
||||||
**Codex:**
|
|
||||||
```bash
|
|
||||||
# Codex reaps background processes. The script auto-detects CODEX_CI and
|
|
||||||
# switches to foreground mode. Run it normally — no extra flags needed.
|
|
||||||
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
||||||
```
|
|
||||||
|
|
||||||
**Gemini CLI:**
|
|
||||||
```bash
|
|
||||||
# Use --foreground and set is_background: true on your shell tool call
|
|
||||||
# so the process survives across turns
|
|
||||||
bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
|
|
||||||
```
|
|
||||||
|
|
||||||
**Copilot CLI:**
|
|
||||||
```bash
|
|
||||||
# Start it with Copilot CLI's non-blocking/background shell mechanism so the
|
|
||||||
# server survives across turns. Keep --foreground so the harness, not the
|
|
||||||
# script, owns backgrounding. The launcher is a .sh, so invoke it via bash
|
|
||||||
# (on Windows, call Git Bash's bash.exe from the PowerShell tool).
|
|
||||||
bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
|
|
||||||
```
|
|
||||||
|
|
||||||
**Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
|
|
||||||
|
|
||||||
If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bash scripts/start-server.sh \
|
|
||||||
--project-dir /path/to/project \
|
|
||||||
--host 0.0.0.0 \
|
|
||||||
--url-host localhost
|
|
||||||
```
|
|
||||||
|
|
||||||
Use `--url-host` to control what hostname is printed in the returned URL JSON.
|
|
||||||
|
|
||||||
## The Loop
|
|
||||||
|
|
||||||
1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
|
|
||||||
- **Required: confirm the server is alive before referring to the URL or pushing a screen.** Check that `$STATE_DIR/server-info` exists and `$STATE_DIR/server-stopped` does not. If it has shut down, restart it with `start-server.sh` using the **same `--project-dir`** — it reuses the same port, so the user's open tab reconnects on its own (it shows a "paused" overlay while the server is down) and you don't need to send a new URL. The server auto-exits after 4 hours idle (configurable with `--idle-timeout-minutes`).
|
|
||||||
- Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
|
|
||||||
- **Never reuse filenames** — each screen gets a fresh file
|
|
||||||
- Use your file-creation tool — **never use cat/heredoc** (dumps noise into terminal)
|
|
||||||
- Server automatically serves the newest file
|
|
||||||
|
|
||||||
2. **Tell user what to expect and end your turn:**
|
|
||||||
- Remind them of the URL (every step, not just first)
|
|
||||||
- Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
|
|
||||||
- Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
|
|
||||||
|
|
||||||
3. **On your next turn** — after the user responds in the terminal:
|
|
||||||
- Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
|
|
||||||
- Merge with the user's terminal text to get the full picture
|
|
||||||
- The terminal message is the primary feedback; `state_dir/events` provides structured interaction data
|
|
||||||
|
|
||||||
4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
|
|
||||||
|
|
||||||
5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<!-- filename: waiting.html (or waiting-2.html, etc.) -->
|
|
||||||
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
|
|
||||||
<p class="subtitle">Continuing in terminal...</p>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual.
|
|
||||||
|
|
||||||
6. Repeat until done.
|
|
||||||
|
|
||||||
## Writing Content Fragments
|
|
||||||
|
|
||||||
Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, connection status, and all interactive infrastructure).
|
|
||||||
|
|
||||||
**Minimal example:**
|
|
||||||
|
|
||||||
```html
|
|
||||||
<h2>Which layout works better?</h2>
|
|
||||||
<p class="subtitle">Consider readability and visual hierarchy</p>
|
|
||||||
|
|
||||||
<div class="options">
|
|
||||||
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
||||||
<div class="letter">A</div>
|
|
||||||
<div class="content">
|
|
||||||
<h3>Single Column</h3>
|
|
||||||
<p>Clean, focused reading experience</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="option" data-choice="b" onclick="toggleSelect(this)">
|
|
||||||
<div class="letter">B</div>
|
|
||||||
<div class="content">
|
|
||||||
<h3>Two Column</h3>
|
|
||||||
<p>Sidebar navigation with main content</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
|
|
||||||
|
|
||||||
## CSS Classes Available
|
|
||||||
|
|
||||||
The frame template provides these CSS classes for your content:
|
|
||||||
|
|
||||||
### Options (A/B/C choices)
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="options">
|
|
||||||
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
||||||
<div class="letter">A</div>
|
|
||||||
<div class="content">
|
|
||||||
<h3>Title</h3>
|
|
||||||
<p>Description</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
**Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item's selected styling.
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="options" data-multiselect>
|
|
||||||
<!-- same option markup — users can select/deselect multiple -->
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cards (visual designs)
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="cards">
|
|
||||||
<div class="card" data-choice="design1" onclick="toggleSelect(this)">
|
|
||||||
<div class="card-image"><!-- mockup content --></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<h3>Name</h3>
|
|
||||||
<p>Description</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mockup container
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="mockup">
|
|
||||||
<div class="mockup-header">Preview: Dashboard Layout</div>
|
|
||||||
<div class="mockup-body"><!-- your mockup HTML --></div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Split view (side-by-side)
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="split">
|
|
||||||
<div class="mockup"><!-- left --></div>
|
|
||||||
<div class="mockup"><!-- right --></div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pros/Cons
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="pros-cons">
|
|
||||||
<div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
|
|
||||||
<div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Mock elements (wireframe building blocks)
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="mock-nav">Logo | Home | About | Contact</div>
|
|
||||||
<div style="display: flex;">
|
|
||||||
<div class="mock-sidebar">Navigation</div>
|
|
||||||
<div class="mock-content">Main content area</div>
|
|
||||||
</div>
|
|
||||||
<button class="mock-button">Action Button</button>
|
|
||||||
<input class="mock-input" placeholder="Input field">
|
|
||||||
<div class="placeholder">Placeholder area</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Typography and sections
|
|
||||||
|
|
||||||
- `h2` — page title
|
|
||||||
- `h3` — section heading
|
|
||||||
- `.subtitle` — secondary text below title
|
|
||||||
- `.section` — content block with bottom margin
|
|
||||||
- `.label` — small uppercase label text
|
|
||||||
|
|
||||||
## Browser Events Format
|
|
||||||
|
|
||||||
When the user clicks options in the browser, their interactions are recorded to `$STATE_DIR/events` (one JSON object per line). The file is cleared automatically when you push a new screen.
|
|
||||||
|
|
||||||
```jsonl
|
|
||||||
{"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
|
|
||||||
{"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
|
|
||||||
{"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
|
|
||||||
```
|
|
||||||
|
|
||||||
The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
|
|
||||||
|
|
||||||
If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
|
|
||||||
|
|
||||||
## Design Tips
|
|
||||||
|
|
||||||
- **Scale fidelity to the question** — wireframes for layout, polish for polish questions
|
|
||||||
- **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
|
|
||||||
- **Iterate before advancing** — if feedback changes current screen, write a new version
|
|
||||||
- **2-4 options max** per screen
|
|
||||||
- **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
|
|
||||||
- **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
|
|
||||||
|
|
||||||
## File Naming
|
|
||||||
|
|
||||||
- Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
|
|
||||||
- Never reuse filenames — each screen must be a new file
|
|
||||||
- For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
|
|
||||||
- Server serves newest file by modification time
|
|
||||||
|
|
||||||
## Cleaning Up
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bash scripts/stop-server.sh $SESSION_DIR
|
|
||||||
```
|
|
||||||
|
|
||||||
If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
|
|
||||||
|
|
||||||
## Reference
|
|
||||||
|
|
||||||
- Frame template (CSS reference): `scripts/frame-template.html`
|
|
||||||
- Helper script (client-side): `scripts/helper.js`
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
# Standing order for talk (copy into the project's AGENTS.md)
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
## Voice notifications (talk)
|
|
||||||
Speak via `talk "<1-2 sentences>"` when a task ran longer than ~30 s and is
|
|
||||||
done, when you are blocked and need me (then `talk --now`), or when something
|
|
||||||
failed. Content: status, next step, what you need me for; never the answer
|
|
||||||
itself. `muted` and `discarded` are my decision: respect them, do not work
|
|
||||||
around them.
|
|
||||||
```
|
|
||||||
|
|
||||||
Without this block (and without a request in the session) an agent does not
|
|
||||||
speak; talk is strict opt-in.
|
|
||||||
Vendored
-83
@@ -1,83 +0,0 @@
|
|||||||
---
|
|
||||||
name: talk
|
|
||||||
description: "Use when the user has asked for voice notifications, either explicitly in this session or as a standing order in the project's AGENTS.md, and (1) a long-running task finishes (build, tests, deploy, data job), (2) the agent is blocked and needs the user's decision or approval, or (3) something failed that the user should know about now. Triggers: talk, say it, sag Bescheid, melde dich, notify me, let me know when done, voice, Ansage. Strict opt-in: never speak without the user's trigger or standing order."
|
|
||||||
compatibility: opencode, claude-code, codex
|
|
||||||
---
|
|
||||||
|
|
||||||
# talk: voice notifications for agents
|
|
||||||
|
|
||||||
`talk "Build done"` speaks a short announcement through the local talk daemon
|
|
||||||
(queue, rate limit, mute, quiet hours). One binary; it starts the daemon
|
|
||||||
itself on the first call. Nothing to install except `talk` in the PATH.
|
|
||||||
|
|
||||||
## When to Use: strict opt-in
|
|
||||||
|
|
||||||
Speak **only** if one of these holds:
|
|
||||||
|
|
||||||
1. The user asked for it in this session ("let me know when the build is
|
|
||||||
through", "tell me when you need me"). That then applies
|
|
||||||
**session-sticky until revoked**; do not ask again with every reply.
|
|
||||||
2. The project's AGENTS.md contains a standing order (see
|
|
||||||
`AGENTS-snippet.md`).
|
|
||||||
|
|
||||||
Then speak on: completion of long tasks (> ~30 s), blockers that need the
|
|
||||||
user (decision, approval, password), failures that matter right now.
|
|
||||||
|
|
||||||
## When NOT to Use
|
|
||||||
|
|
||||||
- Without a trigger or standing order. Never chatter on your own.
|
|
||||||
- For short replies, intermediate status, or any tool output.
|
|
||||||
- To read the long answer aloud. The daemon truncates at 400 characters,
|
|
||||||
but the goal is 1 to 2 sentences.
|
|
||||||
- When `talk` returns `muted` or `discarded: quiet_hours`: that is the
|
|
||||||
user's decision. Do not work around it, do not follow up with `--now`.
|
|
||||||
|
|
||||||
## What makes a good announcement
|
|
||||||
|
|
||||||
**Status, next step, what the user is needed for.** Never the answer
|
|
||||||
itself.
|
|
||||||
|
|
||||||
| good | bad |
|
|
||||||
| --- | --- |
|
|
||||||
| "Tests green, PR is ready for review." | "I ran the tests and all 247 tests passed successfully, and I also ..." |
|
|
||||||
| "Deploy failed, code 1. I need your decision on the migration." | "Error." |
|
|
||||||
| "I need your sudo password in the terminal." | (waiting silently) |
|
|
||||||
|
|
||||||
Language: write in the user's language. talk speaks English by default and
|
|
||||||
German when the configured language is `de` or when detection says so
|
|
||||||
(`--lang` forces it).
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```bash
|
|
||||||
talk "Tests green, PR ready for review." # non-blocking, item ID on stdout
|
|
||||||
talk --wait "Deploy finished." # return only once spoken
|
|
||||||
talk --priority high "Build red, code 2." # may break the rate limit
|
|
||||||
talk --now "I need you: approval in the terminal." # jumps the queue, also in quiet hours; blockers only
|
|
||||||
echo "Import finished" | talk # stdin works too
|
|
||||||
talk wrap -- make test # run a command, announce success/failure and duration
|
|
||||||
```
|
|
||||||
|
|
||||||
Replies on stdout: an item ID (accepted), `muted`, or
|
|
||||||
`discarded: rate_limit|quiet_hours`. Exit 0 in all three cases; a discard
|
|
||||||
is not an error. Non-zero exit only on real problems (no text, invalid
|
|
||||||
flags, broken config); then do not retry, tell the user instead.
|
|
||||||
|
|
||||||
## Etiquette towards the daemon
|
|
||||||
|
|
||||||
- **Rate limit** (default 1 announcement / 30 s): `normal` waits, `low` is
|
|
||||||
discarded, `high` may pass. Not everything is `high`.
|
|
||||||
- **`--now`** is for blockers that need the user, not for "done". It breaks
|
|
||||||
out of quiet hours and the rate limit; that is a deliberate interruption.
|
|
||||||
- **Mute and quiet hours** are user decisions. Respect them, do not work
|
|
||||||
around them. The daemon enforces them anyway.
|
|
||||||
- Several things at once? **One** announcement that summarises, not five.
|
|
||||||
|
|
||||||
## Pitfalls
|
|
||||||
|
|
||||||
- `talk` not found: do not improvise (no `say`, `espeak`, `notify-send`).
|
|
||||||
Tell the user that talk is missing.
|
|
||||||
- No sound on the user's side: suggest `talk doctor`; do not fiddle with
|
|
||||||
keys or config yourself.
|
|
||||||
- Keys come from `TALK_ELEVENLABS_KEY` / `TALK_OPENAI_KEY` (env). Never
|
|
||||||
write them to files, never print them in announcements or logs.
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# MCP-Fragment: Zoll-Tarifnummer-Recherche — dokumentierte Ausnahme mit statischem
|
|
||||||
# API-Key (Server bietet kein OAuth). Der echte Key liegt im Vault des Fleet-Repos
|
|
||||||
# und wird erst beim Merge auf dem Controller substituiert — im Repo steht nur der
|
|
||||||
# Platzhalter gemäß Namensschema <server-name>-<verwendungszweck>.
|
|
||||||
#az-zoll-service:
|
|
||||||
# type: remote
|
|
||||||
# url: https://mcp.example.az.local/zoll
|
|
||||||
# headers:
|
|
||||||
# Authorization: Bearer ${VAULT:az-zoll-service-api-key}
|
|
||||||
# enabled: true
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# OpenCode browse (github.com/anomalyco/browse): steuert den echten Browser
|
|
||||||
# des Nutzers (Chrome/Edge/Vivaldi) über die browse-Extension. browse.exe
|
|
||||||
# rollt az-fleet versionsgepinnt nach C:\Program Files\browse aus (Machine-
|
|
||||||
# PATH), die Extension per Browser-Policy (az-fleet-ehf). Server-Key bleibt
|
|
||||||
# "browser", damit die Fleet-Allowlist browser_* weiter greift.
|
|
||||||
# Erst mergen, wenn browse.exe fleetweit ausgerollt ist — sonst startet der
|
|
||||||
# Server nicht.
|
|
||||||
browser:
|
|
||||||
type: local
|
|
||||||
command: ["browse", "mcp"]
|
|
||||||
environment:
|
|
||||||
OPENCODE_BROWSER_AUTO_UPDATE: "off"
|
|
||||||
codemode: false
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
metabase:
|
|
||||||
type: remote
|
|
||||||
url: https://kpi.az-gruppe.com/api/metabase-mcp
|
|
||||||
enabled: true
|
|
||||||
# Tools auf die native Tool-Liste des Modells legen, NICHT über Code Mode
|
|
||||||
# exposed werden: opencode V2 defaultet mcp-Server auf codemode: true
|
|
||||||
# (Erreichbarkeit nur via execute/Code Mode) — die Fleet sperrt execute
|
|
||||||
# fleetweit (ADR-0004). Ohne dieses Flag ist der Server verbunden und
|
|
||||||
# authentifiziert, aber der Agent sieht die Tools nicht (Vorfall 06.10.).
|
|
||||||
codemode: false
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
outline_wiki:
|
|
||||||
type: remote
|
|
||||||
url: https://wiki.az-gruppe.com/mcp
|
|
||||||
enabled: true
|
|
||||||
# Siehe mcp/metabase.yaml: Fleet sperrt execute (Code Mode) — ohne
|
|
||||||
# codemode: false erreicht der Agent die Tools des Servers nicht.
|
|
||||||
codemode: false
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
raynet:
|
|
||||||
type: remote
|
|
||||||
url: https://app.raynet.cz/api/mcp
|
|
||||||
headers:
|
|
||||||
Authorization: Bearer {env:AZ_USER_RAYNET_MCP}
|
|
||||||
codemode: false
|
|
||||||
enabled: true
|
|
||||||
# Zielgruppen-Scoping (ADR-0017): Nur Hosts, deren Zielnutzer die Rolle
|
|
||||||
# "vertrieb" tragen, erhalten diesen Server im gemergten Bestand. Ohne
|
|
||||||
# dieses Metadatum wäre raynet Base-Set für alle Hosts. Der Fleet-Merge
|
|
||||||
# stript x-fleet-*-Schlüssel vor dem Merge aus dem Server-Body heraus.
|
|
||||||
x-fleet-audience: [vertrieb]
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
sally_notetaker:
|
|
||||||
type: remote
|
|
||||||
url: https://app.sally.io/api/v1/McpExternal
|
|
||||||
enabled: true
|
|
||||||
# Siehe mcp/metabase.yaml: Fleet sperrt execute (Code Mode) — ohne
|
|
||||||
# codemode: false erreicht der Agent die Tools des Servers nicht.
|
|
||||||
codemode: false
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
websearch:
|
|
||||||
type: remote
|
|
||||||
url: https://mcp.exa.ai/mcp
|
|
||||||
headers:
|
|
||||||
Authorization: x-api-key {env:AZ_FLEET_EXA_KEY}
|
|
||||||
enabled: true
|
|
||||||
codemode: false
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
---
|
|
||||||
name: az-datenanalyse
|
|
||||||
description: Datenanalyse mit dem AZ-Python-Datenstack (pandas/NumPy/openpyxl) — greift bei jeder Aufgabe, Excel- oder CSV-Dateien auszuwerten, umzuformen, zusammenzufassen oder Kennzahlen zu berechnen und das Ergebnis als Datei zurückzugeben. Bringt dem Agenten den zentralen Datenstack-Interpreter, den korrekten Ausführungsweg und die Sackgassen-Vermeidung bei (python aus dem PATH hat KEINE Datenpakete; pip/uv-Paketbefehle sind gesperrt).
|
|
||||||
---
|
|
||||||
|
|
||||||
# Datenanalyse mit dem AZ-Datenstack
|
|
||||||
|
|
||||||
Du arbeitest auf einer AZ-Agenten-Workstation. Für Datenanalyse steht dir ein
|
|
||||||
zentral ausgerollter Python-Datenstack bereit — aber nur über den Weg unten.
|
|
||||||
Die üblichen Verfahren (einfach `python` aufrufen, fehlende Pakete per pip
|
|
||||||
nachinstallieren) funktionieren hier bewusst nicht.
|
|
||||||
|
|
||||||
## Der zentrale Datenstack
|
|
||||||
|
|
||||||
- **Interpreter (IMMER diesen verwenden):**
|
|
||||||
`C:\ProgramData\az-fleet\datastack-venv\Scripts\python.exe`
|
|
||||||
- **Enthaltene Pakete:** pandas, NumPy, openpyxl (Excel lesen/schreiben —
|
|
||||||
`.xlsx`, nicht `.xls`).
|
|
||||||
- Der Datenstack wird zentral vom Fleet gepflegt und versioniert. Es gibt
|
|
||||||
keine anderen Datenpakete — plane deine Lösung mit genau diesen.
|
|
||||||
|
|
||||||
## So führst du eine Analyse aus
|
|
||||||
|
|
||||||
1. Skript mit dem Edit-Tool **im Arbeitsordner des Nutzers** schreiben
|
|
||||||
(z. B. `analyse.py`).
|
|
||||||
2. Ausführen per Bash — PowerShell-Form mit absolutem Interpreter-Pfad:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
& 'C:\ProgramData\az-fleet\datastack-venv\Scripts\python.exe' .\analyse.py
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Ergebnis prüfen und dem Nutzer als Datei zurückgeben (z. B. Ergebnis-
|
|
||||||
Excel in den Arbeitsordner schreiben und den Pfad nennen).
|
|
||||||
|
|
||||||
**Wichtig:** Dieser Aufruf löst EINEN Bestätigungsdialog beim Nutzer aus.
|
|
||||||
Das ist beabsichtigt (Sicherheitskontrolle der AZ-Fleet-Konfiguration) und
|
|
||||||
kein Fehler. Fahre normal fort.
|
|
||||||
|
|
||||||
## Sackgassen vermeiden
|
|
||||||
|
|
||||||
- **`python` / `py` aus dem PATH sind das System-Python — OHNE pandas.**
|
|
||||||
`import pandas` scheitert dort. Nutze niemals das System-Python für
|
|
||||||
Datenanalyse.
|
|
||||||
- **Paketbefehle sind gesperrt und werden still blockiert.** Versuche
|
|
||||||
NIEMALS: `pip install …`, `python -m pip …`, `uv pip install …`, `uv add`,
|
|
||||||
`bun install` oder ähnliches. Das ist zentrale Fleet-Kontrolle — kein
|
|
||||||
Workaround, kein `--user`, kein `ensurepip`.
|
|
||||||
- **Fehlt ein Paket** (z. B. matplotlib): Löse die Aufgabe mit den
|
|
||||||
vorhandenen Mitteln (pandas kann rechnen, filtern, aggregieren; openpyxl
|
|
||||||
schreibt Excel inklusive einfacher Formatierung) oder sage dem Nutzer
|
|
||||||
klar, dass die IT das Paket zentral nachliefern muss (Fleet-Antrag).
|
|
||||||
Suche nicht nach Installationswegen.
|
|
||||||
|
|
||||||
## Typisches Muster (Excel rein → Kennzahlen → Excel raus)
|
|
||||||
|
|
||||||
```python
|
|
||||||
import pandas as pd
|
|
||||||
|
|
||||||
quelle = r"C:\Pfad\Zum\Arbeitsordner\eingabe.xlsx"
|
|
||||||
ziel = r"C:\Pfad\Zum\Arbeitsordner\ergebnis.xlsx"
|
|
||||||
|
|
||||||
df = pd.read_excel(quelle, sheet_name=0)
|
|
||||||
ergebnis = df.groupby("Kategorie")["Betrag"].agg(["sum", "mean", "count"])
|
|
||||||
|
|
||||||
with pd.ExcelWriter(ziel, engine="openpyxl") as writer:
|
|
||||||
ergebnis.to_excel(writer, sheet_name="Kennzahlen")
|
|
||||||
df.to_excel(writer, sheet_name="Rohdaten", index=False)
|
|
||||||
|
|
||||||
print(ergebnis)
|
|
||||||
print("Geschrieben:", ziel)
|
|
||||||
```
|
|
||||||
|
|
||||||
Pfade immer vom Nutzer erfragen oder aus dem Arbeitsordner ableiten — nie
|
|
||||||
raten.
|
|
||||||
|
|
||||||
## Datenschutz-Kurzregel
|
|
||||||
|
|
||||||
In Skripten, Prompts und Ergebnissen gelten die Regeln der AZ-Datenleitlinie:
|
|
||||||
keine personenbezogenen Daten (Namen, Adressen, Telefonnummern, E-Mail von
|
|
||||||
Menschen) — Menschen anonymisieren oder weglassen; keine Zugangsdaten; keine
|
|
||||||
besonders schützenswerten Kunden- und Rüstungsdaten. Im Zweifel: nachfragen
|
|
||||||
statt raten.
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
---
|
|
||||||
name: az-hilfe
|
|
||||||
description: Einstiegs- und Orientierungshilfe für die Agenten-Workstation der AZ-Gruppe — greift, wenn ein Anwender fragt, was sein Agent kann, welches Artefakt wofür da ist, wie man etwas beiträgt oder an wen man sich bei Problemen wendet.
|
|
||||||
---
|
|
||||||
|
|
||||||
# AZ-Agent — Hilfe & Onboarding
|
|
||||||
|
|
||||||
Du bist der Guide für Anwender der AZ-Agenten-Workstation. Wer diesen Skill
|
|
||||||
aufruft, will orientiert werden — nicht mit Technik-Details überschüttet
|
|
||||||
werden. Antworte freundlich, in kurzen Schritten und in der Sprache der
|
|
||||||
Anfrage.
|
|
||||||
|
|
||||||
## Was kann mein Agent? — nur aufzählen, was wirklich da ist
|
|
||||||
|
|
||||||
Die Ausstattung ist **nicht auf jedem Rechner gleich**: Sie richtet sich nach
|
|
||||||
Abteilung und Rolle des Nutzers. Zähle deshalb nur auf, was dir **in dieser
|
|
||||||
Sitzung tatsächlich zur Verfügung steht**:
|
|
||||||
|
|
||||||
1. **Spezialisierte Helfer** — die Subagents, die dir das Task-Tool anbietet.
|
|
||||||
2. **Fachwissen** — die Skills in deiner Skill-Liste.
|
|
||||||
3. **Anbindungen** — die Werkzeuge externer Dienste in deiner Tool-Liste
|
|
||||||
(MCP-Server; ihr Präfix vor dem `_` ist der Dienst, z. B. `websearch_…`).
|
|
||||||
4. **Kurzbefehle** — Commands wie `/az-hilfe`, die der Nutzer selbst tippt.
|
|
||||||
|
|
||||||
Beschreibe alles in **Alltagssprache**: „Websuche“, „Basecamp-Projekte und
|
|
||||||
To-dos“, „Word-, Excel- und PowerPoint-Dateien bearbeiten“ — nicht
|
|
||||||
`websearch_web_search_exa` oder `officecli-docx`. Technische Namen nur, wenn
|
|
||||||
der Nutzer ausdrücklich danach fragt.
|
|
||||||
|
|
||||||
Nenne **nie** Fähigkeiten, die nicht in deinen Listen stehen — auch nicht,
|
|
||||||
wenn du sie aus Beispielen oder von anderen Rechnern kennst.
|
|
||||||
|
|
||||||
## Was ist was? — die vier Artefakt-Arten
|
|
||||||
|
|
||||||
| Frage des Anwenders | Artefakt-Art |
|
|
||||||
|---|---|
|
|
||||||
| „Der Agent soll immer X tun, wenn Y“ — Verhalten beibringen | Skill |
|
|
||||||
| Wiederkehrender Prompt als Kurzbefehl (`/name`) | Command |
|
|
||||||
| Spezialisierter Helfer für ein Fachgebiet | Agent (Subagent) |
|
|
||||||
| Zugriff auf ein Werkzeug oder System (API, Datenquelle) | MCP-Anbindung |
|
|
||||||
|
|
||||||
## Typische Anfragen und gute Antworten
|
|
||||||
|
|
||||||
- **„Was kann mein Agent überhaupt?“** → Liste nach dem Abschnitt oben, kurz
|
|
||||||
und in Alltagssprache, mit je einem Beispielsatz, den der Nutzer sagen
|
|
||||||
kann.
|
|
||||||
- **„Mein Kollege kann X, ich nicht.“** → Ausstattung hängt von Abteilung
|
|
||||||
und Rolle ab. Braucht der Nutzer X für seine Arbeit, wendet er sich an die
|
|
||||||
IT — dort wird die Zuordnung gepflegt.
|
|
||||||
- **„Ich will, dass der Agent immer X tut, wenn Y.“** → Das ist ein
|
|
||||||
**Skill**. Wunsch mit Beispiel aufnehmen und an die IT bzw. den
|
|
||||||
KI-Ansprechpartner der Abteilung weitergeben.
|
|
||||||
- **„Ich tippe jeden Tag dasselbe …“** → Kandidat für einen **Command**;
|
|
||||||
Wunsch genauso weitergeben.
|
|
||||||
- **„Kann der Agent auch auf Tool Z zugreifen?“** → Das wäre eine
|
|
||||||
**MCP-Anbindung** — sicherheitsrelevant, wird nur von der IT eingerichtet.
|
|
||||||
|
|
||||||
## Selbst beitragen
|
|
||||||
|
|
||||||
Neue oder geänderte Skills, Commands, Agenten und Anbindungen laufen
|
|
||||||
**zentral** über das Repository `az-agent-defaults` der IT:
|
|
||||||
|
|
||||||
1. Die README des Repos sagt, wohin ein Beitrag gehört und welche Regeln er
|
|
||||||
erfüllen muss — mit je einem Minimalbeispiel.
|
|
||||||
2. Beitrag einreichen; die IT prüft ihn.
|
|
||||||
3. Nach der Freigabe kommt er automatisch auf die Rechner (Abgleich alle
|
|
||||||
paar Stunden und bei der Anmeldung) — bei Inhalten für bestimmte
|
|
||||||
Abteilungen nur dort.
|
|
||||||
|
|
||||||
**Lokale Änderungen** an ausgelieferten Skills oder Agenten bleiben
|
|
||||||
erhalten, blockieren aber künftige Updates dieses Artefakts — Windows meldet
|
|
||||||
das mit einem Hinweis. Wer dauerhaft etwas anders braucht, reicht es zentral
|
|
||||||
ein, statt lokal zu basteln.
|
|
||||||
|
|
||||||
## Bei Problemen
|
|
||||||
|
|
||||||
- Fähigkeit fehlt oder verhält sich falsch → IT kontaktieren, mit Name der
|
|
||||||
Fähigkeit (in Alltagssprache reicht) und kurzem Ablauf des Problems.
|
|
||||||
- Hinweis „lokale Änderungen blockieren Updates“ → IT kontaktieren; sie
|
|
||||||
setzt das Artefakt auf den zentralen Stand zurück.
|
|
||||||
|
|
||||||
Führe darüber hinaus keine Aktionen aus. Dieser Skill orientiert — er
|
|
||||||
verändert nichts.
|
|
||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
---
|
|
||||||
description: Hilft bei Basecamp-Themen und unterstützt das Team bei der Verwaltung von Projekten und To-dos.
|
|
||||||
mode: subagent
|
|
||||||
model: az-litellm/claude-haiku-4-5
|
|
||||||
temperature: 0.2
|
|
||||||
tools:
|
|
||||||
bash: true
|
|
||||||
read: true
|
|
||||||
---
|
|
||||||
|
|
||||||
Du bist ein Basecamp-Helfer. Wenn dich jemand ruft, bearbeitest du
|
|
||||||
Basecamp-Anfragen mit dem CLI.
|
|
||||||
|
|
||||||
## Arbeitsweise
|
|
||||||
|
|
||||||
1. **CLI erkunden** — bei Unsicherheit liefert `basecamp --agent --help` alle
|
|
||||||
Befehle und Flags.
|
|
||||||
2. **Anfrage ausführen** — setze die Anfrage mit dem CLI um.
|
|
||||||
|
|
||||||
## Grenzen
|
|
||||||
|
|
||||||
- Du installierst nichts — das CLI ist Fleet-verwaltet. Fehlt es, melde das
|
|
||||||
dem Auftraggeber.
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
mode: primary
|
|
||||||
---
|
|
||||||
|
|
||||||
Dieses Frontmatter enthält einen `mode`, aber das Pflichtfeld `description`
|
|
||||||
fehlt. Der Guard muss rot abbrechen.
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
description: Testgegenstand — Agent ohne Pflichtfeld mode.
|
|
||||||
temperature: 0.3
|
|
||||||
---
|
|
||||||
|
|
||||||
Dieses Frontmatter enthält eine description, aber das Pflichtfeld `mode`
|
|
||||||
(`primary` oder `subagent`) fehlt. Der Guard muss rot abbrechen.
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
description: Testgegenstand — mode mit ungültigem Wert.
|
|
||||||
mode: sideload
|
|
||||||
---
|
|
||||||
|
|
||||||
Der Wert von `mode` ist weder `primary` noch `subagent`. Der Guard muss rot
|
|
||||||
abbrechen.
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
description:
|
|
||||||
---
|
|
||||||
|
|
||||||
Arbeite das Ticket $ARGUMENTS ab.
|
|
||||||
|
|
||||||
(Testgegenstand: das `description`-Feld existiert, ist aber leer. Der Guard muss
|
|
||||||
rot abbrechen.)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
agent: build
|
|
||||||
---
|
|
||||||
|
|
||||||
Arbeite das Ticket $ARGUMENTS ab.
|
|
||||||
|
|
||||||
(Testgegenstand: Frontmatter vorhanden, aber das Pflichtfeld `description` fehlt.
|
|
||||||
Der Guard muss rot abbrechen.)
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
Arbeite das Ticket $ARGUMENTS ab: zeige es mir, claime es, setze es um und
|
|
||||||
schließ es nach meiner Freigabe.
|
|
||||||
|
|
||||||
(Testgegenstand: dieser Command hat kein YAML-Frontmatter — die Pflicht-`description`
|
|
||||||
fehlt damit zwangsläufig. Der Guard muss rot abbrechen.)
|
|
||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
description: Testgegenstand — Dateiname mit Umlaut, der später zum /slash-Namen würde.
|
|
||||||
---
|
|
||||||
|
|
||||||
Dieser Command-Inhalt ist formal in Ordnung: Frontmatter mit `description`,
|
|
||||||
Template-Body mit $ARGUMENTS.
|
|
||||||
|
|
||||||
(Testgegenstand: der Dateiname enthält einen Umlaut — aus `prüfung.md` würde der
|
|
||||||
/slash-Befehl `/prüfung`, was den Namensregeln widerspricht. Der Guard muss am
|
|
||||||
Dateinamen rot abbrechen.)
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# Testgegenstand: Platzhalter in falscher Syntax — erlaubt ist nur ${VAULT:...}.
|
|
||||||
falscher-platzhalter-service:
|
|
||||||
type: remote
|
|
||||||
url: https://mcp.example.az.local/alt
|
|
||||||
headers:
|
|
||||||
Authorization: Bearer ${SECRET:veraltete-syntax}
|
|
||||||
enabled: true
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
# Testgegenstand: statischer Key im Klartext statt ${VAULT:...}-Platzhalter.
|
|
||||||
# Der Guard muss rot abbrechen — auch Beispiel-/Fake-Werte zählen als Secret.
|
|
||||||
wetter-service:
|
|
||||||
type: remote
|
|
||||||
url: https://mcp.example.az.local/wetter
|
|
||||||
headers:
|
|
||||||
Authorization: Bearer sk-live-a1b2c3d4e5f6
|
|
||||||
enabled: true
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Testgegenstand: keine Fragment-Struktur — der Server-Name fehlt als Schlüssel,
|
|
||||||
# die Felder stehen auf Root-Ebene statt unter genau einem Server-Namen.
|
|
||||||
type: remote
|
|
||||||
url: https://mcp.example.az.local/ohne-namen
|
|
||||||
enabled: true
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
# Testgegenstand: remote-Server ohne type-Feld.
|
|
||||||
az-ohne-type-service:
|
|
||||||
url: https://mcp.example.az.local/ohne-type
|
|
||||||
enabled: true
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
# Testgegenstand: remote-Server ohne Pflichtfeld url.
|
|
||||||
az-ohne-url-service:
|
|
||||||
type: remote
|
|
||||||
enabled: true
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill mit leerem Frontmatter
|
|
||||||
|
|
||||||
Diese SKILL.md enthält einen Frontmatter-Block, aber keine Felder — weder
|
|
||||||
`name` noch `description`. Der Guard muss dieses Artefakt rot abbrechen.
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
name: total-anderer-name
|
|
||||||
description: Testgegenstand — Frontmatter-Name passt nicht zum Ordner.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill mit abweichendem Namen
|
|
||||||
|
|
||||||
Der Frontmatter-Name `total-anderer-name` passt nicht zum Ordnernamen
|
|
||||||
`name-ungleich-ordner`. Der Guard muss dieses Artefakt rot abbrechen.
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
name: ohne-description
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill ohne Description
|
|
||||||
|
|
||||||
Dieses Frontmatter enthält `name`, aber das Pflichtfeld `description` fehlt.
|
|
||||||
Der Guard muss dieses Artefakt rot abbrechen.
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# Skill ohne Frontmatter-Öffner
|
|
||||||
|
|
||||||
Diese SKILL.md beginnt direkt mit einer Überschrift statt mit dem
|
|
||||||
YAML-Frontmatter-Öffner. Der Guard muss dieses Artefakt rot abbrechen.
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user