janissary 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/guidelines/architecture-principles.md +75 -0
- package/ai/guidelines/code-guidelines.md +17 -0
- package/ai/guidelines/conventional-commits.md +192 -0
- package/ai/guidelines/developer-documentation.md +124 -0
- package/ai/guidelines/documentation.md +80 -0
- package/ai/guidelines/human-writing-guidelines.md +42 -0
- package/ai/guidelines/imports-and-barrel-files.md +49 -0
- package/ai/guidelines/pull-request-automation.md +98 -0
- package/ai/guidelines/strategies-for-readable-summaries.md +27 -0
- package/ai/guidelines/user-documentation.md +177 -0
- package/ai/personas/algorithm.md +14 -0
- package/ai/personas/assistant.md +25 -0
- package/ai/personas/link-scout.md +16 -0
- package/ai/personas/researcher.md +12 -0
- package/ai/personas/security.md +12 -0
- package/ai/personas/summarizer.md +11 -0
- package/ai/tasks/build-a-feature.md +133 -0
- package/ai/tasks/fix-a-small-issue.md +138 -0
- package/ai/tasks/improve-codebase.md +187 -0
- package/ai/tasks/improve-modularity.md +188 -0
- package/ai/tasks/improve-namespacing.md +253 -0
- package/ai/tasks/improve-plan.md +121 -0
- package/ai/tasks/improve-security.md +144 -0
- package/ai/tasks/improve-style.md +147 -0
- package/ai/tasks/improve-test-coverage.md +178 -0
- package/ai/tasks/merge-change-to-master.md +144 -0
- package/ai/tasks/open-feature-pull-request.md +161 -0
- package/ai/tasks/plan-ready-features.md +154 -0
- package/ai/tasks/prepare-workspace.md +35 -0
- package/ai/tasks/quick-commit.md +82 -0
- package/ai/tasks/reduce-complexity.md +185 -0
- package/ai/tasks/remove-deadcode.md +206 -0
- package/ai/tasks/remove-duplication.md +202 -0
- package/ai/tasks/update-package.md +137 -0
- package/package.json +5 -3
- package/scripts/changed-files.mjs +22 -0
- package/scripts/check-diff.mjs +100 -0
- package/scripts/coverage-file.mjs +85 -0
- package/scripts/docs-screenshots/capture.mjs +82 -0
- package/scripts/docs-screenshots/fixtures/docs/api.md +3 -0
- package/scripts/docs-screenshots/fixtures/docs/guide.md +3 -0
- package/scripts/docs-screenshots/fixtures/page.html +31 -0
- package/scripts/docs-screenshots/fixtures/profiles/demo/editor.json +1 -0
- package/scripts/docs-screenshots/fixtures/profiles/demo/writer.json +1 -0
- package/scripts/docs-screenshots/fixtures/sample.md +26 -0
- package/scripts/docs-screenshots/fixtures/sample.png +0 -0
- package/scripts/docs-screenshots/fixtures/sample.ts +25 -0
- package/scripts/docs-screenshots/fixtures/src/app.ts +2 -0
- package/scripts/docs-screenshots/fixtures/src/tides.ts +2 -0
- package/scripts/docs-screenshots/janus.mjs +51 -0
- package/scripts/docs-screenshots/manifest.mjs +122 -0
- package/scripts/docs-screenshots/scratch.mjs +53 -0
- package/scripts/docs-screenshots.mjs +86 -0
- package/scripts/lint-files.mjs +47 -0
- package/scripts/postinstall.mjs +14 -0
- package/scripts/pr-check-changes.sh +15 -0
- package/scripts/pr-check-gate.sh +29 -0
- package/scripts/pr-check-mergeable.sh +29 -0
- package/scripts/pr-commit.sh +23 -0
- package/scripts/pr-create-branch.sh +20 -0
- package/scripts/pr-create-pr.sh +29 -0
- package/scripts/pr-merge.sh +22 -0
- package/scripts/pr-push-branch.sh +24 -0
- package/scripts/pr-rebase.sh +56 -0
- package/scripts/pr-resolve-remote.sh +9 -0
- package/scripts/pr-wait-checks.sh +41 -0
- package/scripts/publish.mjs +61 -0
- package/scripts/release.mjs +209 -0
- package/scripts/run.mjs +40 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# PR Automation
|
|
2
|
+
|
|
3
|
+
Scripts in `scripts/pr-*.sh` automate the `ai/tasks/merge-change-to-master.md` workflow: package the current changes into a PR against `master` and **merge it once there are no conflicts and all checks pass**. They are executable and called directly (no `npm run` wrappers). They work both in a normal checkout and in a workspaced clone (an independent `git clone` of the root repo's `origin` remote, so `origin` already points at GitHub).
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
From the repo (or a workspace clone) with changes ready to ship:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
./scripts/pr-merge-to-master.sh "Extract formatting helpers"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This single command runs Steps 0–9 of the workflow:
|
|
14
|
+
|
|
15
|
+
1. ✅ Verifies there are changes (`pr-check-changes.sh`)
|
|
16
|
+
2. ✅ Runs the check gate (`pr-check-gate.sh`; warnings don't fail it; skip with `--no-check`)
|
|
17
|
+
3. ✅ Creates a feature branch (`pr-create-branch.sh`; from the title, or reuses the current non-`master` branch)
|
|
18
|
+
4. ✅ Commits with a single author — **no co-authors** (`pr-commit.sh`)
|
|
19
|
+
5. ✅ Resolves the GitHub remote and pushes (`pr-resolve-remote.sh`, `pr-push-branch.sh`)
|
|
20
|
+
6. ✅ Opens the PR (`pr-create-pr.sh`)
|
|
21
|
+
7. ✅ Polls conflict status (`pr-check-mergeable.sh`)
|
|
22
|
+
8. ✅ Waits for all checks to pass (`pr-wait-checks.sh`)
|
|
23
|
+
9. ✅ Merges and deletes the branch (`pr-merge.sh`)
|
|
24
|
+
10. ✅ Prints a final report
|
|
25
|
+
|
|
26
|
+
It stops and leaves the PR open if the check gate is red, if the PR conflicts with `master` (resolve those with `pr-rebase.sh` — see Step 7 of `ai/tasks/merge-change-to-master.md`), or if a check fails.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# explicit branch, and --no-check to skip the gate for a pre-existing red tree:
|
|
30
|
+
./scripts/pr-merge-to-master.sh "Modernize color notation" style/modern-colors --no-check
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Individual Scripts
|
|
34
|
+
|
|
35
|
+
Each step is also a standalone script for finer control or manual conflict resolution.
|
|
36
|
+
|
|
37
|
+
### `./scripts/pr-check-changes.sh`
|
|
38
|
+
Print uncommitted changes and commits ahead of `master`. Exits non-zero when there is nothing to ship.
|
|
39
|
+
|
|
40
|
+
### `./scripts/pr-check-gate.sh`
|
|
41
|
+
Run the check gate. Only the hard checks run: typecheck, lint errors, tests, CSS. Advisory quality checks (complexity, duplication, dead code) are not part of this gate — they belong to the human end-of-work gate (`npm run check:full`). Exits non-zero only on a hard-check failure.
|
|
42
|
+
|
|
43
|
+
### `./scripts/pr-create-branch.sh <branch>`
|
|
44
|
+
Create and switch to a feature branch (`git checkout -b`). No-op if already on it.
|
|
45
|
+
|
|
46
|
+
### `./scripts/pr-commit.sh "<subject>" "[body]"`
|
|
47
|
+
Stage all changes and commit with a single author. Adds **no** `Co-Authored-By:` trailer.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
./scripts/pr-commit.sh "Extract formatting helpers" "Moved flattenBuffer and helpers to a new module"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `./scripts/pr-resolve-remote.sh`
|
|
54
|
+
Read `origin`'s URL and print `OWNER_REPO`/`BRANCH`/`GH_URL` for `eval`.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
eval "$(./scripts/pr-resolve-remote.sh)"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `./scripts/pr-push-branch.sh <remote> <branch>`
|
|
61
|
+
Push the branch to GitHub with upstream tracking.
|
|
62
|
+
|
|
63
|
+
### `./scripts/pr-create-pr.sh <owner/repo> <branch> "<title>" "[body]"`
|
|
64
|
+
Create the PR against `master`. Prints the PR URL.
|
|
65
|
+
|
|
66
|
+
### `./scripts/pr-check-mergeable.sh <branch> <owner/repo>`
|
|
67
|
+
Poll merge status (6 attempts, 2-second intervals). Prints `MERGEABLE`, `CONFLICTING`, or `UNKNOWN`.
|
|
68
|
+
|
|
69
|
+
### `./scripts/pr-rebase.sh <remote> [branch]`
|
|
70
|
+
Fetch `master`, rebase the branch onto it, re-run the check gate, and force-push when clean. Exit 0 = done, exit 2 = conflicts to resolve (resolve the listed files' markers, then re-run to continue), exit 1 = hard error.
|
|
71
|
+
|
|
72
|
+
### `./scripts/pr-wait-checks.sh <branch> <owner/repo>`
|
|
73
|
+
Block on `gh pr checks --watch` until every check finishes. Exits non-zero if any check fails. A PR with no checks configured counts as passed.
|
|
74
|
+
|
|
75
|
+
### `./scripts/pr-merge.sh <branch> <owner/repo>`
|
|
76
|
+
Merge the PR (merge commit) and delete the remote branch. Only run once mergeable and all checks pass.
|
|
77
|
+
|
|
78
|
+
## How It Works
|
|
79
|
+
|
|
80
|
+
### Workspace clone handling
|
|
81
|
+
In a workspaced tab, `origin` already points at GitHub over HTTPS — the workspace is an independent `git clone` of the root repo's `origin` remote. `pr-resolve-remote.sh` just reads it directly; no remote detection is needed.
|
|
82
|
+
|
|
83
|
+
### Authentication inside a sandboxed workspace
|
|
84
|
+
`git push` and `gh` (`pr-create-pr.sh`, `pr-merge.sh`) authenticate via `GH_TOKEN`, injected into the sandboxed workspace's environment from `.janissary/github-token` (a scoped, user-provisioned fine-grained PAT — see README's "GitHub push/PR access"). The workspace clone's local `credential.helper` (`!gh auth git-credential`) picks up that same token for `git push`. Without a token configured, these scripts fail from inside a sandboxed workspace (SSH auth is unreachable there, and there's no other credential path in) but work as before outside a workspace or with sandboxing disabled.
|
|
85
|
+
|
|
86
|
+
### No interactive prompts
|
|
87
|
+
All scripts use non-interactive `git` and `gh` commands, so they run without approval prompts.
|
|
88
|
+
|
|
89
|
+
### Error handling
|
|
90
|
+
Scripts exit non-zero on failure (no changes, commit/push/PR failure, failing checks, conflicts), so the orchestrator can stop and report rather than merging a bad PR.
|
|
91
|
+
|
|
92
|
+
## Troubleshooting
|
|
93
|
+
|
|
94
|
+
### "gh: command not found"
|
|
95
|
+
Scripts fall back to `/usr/local/opt/gh/bin/gh`. Otherwise check `which gh` and `gh auth status`.
|
|
96
|
+
|
|
97
|
+
### Merge conflicts
|
|
98
|
+
`pr-merge-to-master.sh` stops on `CONFLICTING` and leaves the PR open. Run `./scripts/pr-rebase.sh <remote> <branch>`; if it stops with exit 2, resolve the listed files' markers and re-run it until it exits 0. Then re-run `./scripts/pr-wait-checks.sh` and `./scripts/pr-merge.sh`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Use this as a style guide when generating or editing summary content. The reader is intelligent and curious but not a specialist. They read to understand and decide — not to be impressed.
|
|
2
|
+
|
|
3
|
+
- Use a grounded, conversational tone; avoid academic register or corporate-neutral language
|
|
4
|
+
- Match formality to context; default neither to stiff nor casual
|
|
5
|
+
- Take a clear point of view — vague or uncommitted writing feels hollow
|
|
6
|
+
- Include mild hedging where accurate: "probably," "often," "in most cases"
|
|
7
|
+
- Lead with the main point or finding in the first sentence — do not build to it
|
|
8
|
+
- Do not open by restating the question, prompt, or document title
|
|
9
|
+
- Use paragraph breaks for pacing as well as topic shifts
|
|
10
|
+
- Write in prose when ideas connect naturally; reserve bullets for genuinely discrete items
|
|
11
|
+
- Avoid formulaic structure: introduction → three points → conclusion
|
|
12
|
+
- Do not close with a summary that simply restates what was just said
|
|
13
|
+
- Mix short and long sentences to create natural rhythm
|
|
14
|
+
- Prefer active voice; use passive only when intentional
|
|
15
|
+
- It is acceptable to start sentences with: And, But, So, Because
|
|
16
|
+
- Break grammar rules deliberately when it improves clarity or tone
|
|
17
|
+
- Keep sentences scannable — one idea per sentence when precision matters
|
|
18
|
+
- Use concrete, specific words instead of abstract or vague ones
|
|
19
|
+
- Use contractions naturally: don't, it's, you're, we're
|
|
20
|
+
- Remove filler phrases: "It's worth noting that," "In conclusion," "It's important to remember," "It goes without saying," "As we can see"
|
|
21
|
+
- Prefer plain verbs: use instead of utilize, show instead of demonstrate, help instead of facilitate
|
|
22
|
+
- Assume the reader is intelligent; do not over-explain basic concepts
|
|
23
|
+
- Leave some tension unresolved when the topic genuinely warrants it — not everything
|
|
24
|
+
- Avoid self-announcing transitions: "Moving on to...," "Now let's discuss...," "Turning to the topic of..."
|
|
25
|
+
- Connect ideas through logic and word choice, not structural signposting
|
|
26
|
+
- Let paragraph endings do transition work naturally
|
|
27
|
+
- Do not Restate the same point in slightly different words across paragraphs
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Writing User Documentation
|
|
2
|
+
|
|
3
|
+
Guidance for writing user-facing docs (`documentation/user-documentation/`) from the internal specs
|
|
4
|
+
(`product/specs/`). Specs describe implementation and behavior for contributors; user documentation
|
|
5
|
+
describes tasks and concepts for someone running the app who has never read the spec and never
|
|
6
|
+
will. Don't just reformat a spec into a doc page — rewrite it for the reader's goal, and drop
|
|
7
|
+
every internal detail that doesn't serve that goal (see "No implementation leakage" below). For
|
|
8
|
+
sentence-level tone, see [[human-writing-guidelines]]; this document is about structure and
|
|
9
|
+
content, not prose style. For docs aimed at contributors instead of end users, see
|
|
10
|
+
[[developer-documentation]].
|
|
11
|
+
|
|
12
|
+
## Organize by the Diátaxis framework
|
|
13
|
+
|
|
14
|
+
Every doc page has exactly one job. Diátaxis (https://diataxis.fr) splits that job along two axes
|
|
15
|
+
— action vs. cognition, and learning vs. working — into four types. Decide which one a page is
|
|
16
|
+
*before* writing it, and don't mix jobs on one page:
|
|
17
|
+
|
|
18
|
+
| Type | Answers | Reader is | Example for this app |
|
|
19
|
+
|---|---|---|---|
|
|
20
|
+
| **Tutorial** | "Teach me, step by step" | Learning, needs hand-holding | "Your first session with `janus`" |
|
|
21
|
+
| **How-to guide** | "How do I do X?" | Already competent, has a goal | "How to run a workspaced agent" |
|
|
22
|
+
| **Reference** | "What are the exact facts?" | Looking something up mid-task | Command syntax tables (flags, subcommands, defaults) |
|
|
23
|
+
| **Explanation** | "Why does it work this way?" | Building a mental model | "How tab grouping works" |
|
|
24
|
+
|
|
25
|
+
A single spec file often contains material for two or three of these — split it rather than
|
|
26
|
+
publishing the spec verbatim. `scheduling.md`, for example, has reference material (the form
|
|
27
|
+
table, the `schedule` command grammar) and explanation material (why entries are tab-scoped, how
|
|
28
|
+
firing interacts with the scheduler tick); those belong on different pages, or at least under
|
|
29
|
+
different headings a reader can skip between.
|
|
30
|
+
|
|
31
|
+
## Lead with the goal, not the mechanism
|
|
32
|
+
|
|
33
|
+
Put the most useful sentence first — what the reader can now do — not the background or the
|
|
34
|
+
implementation detail that makes it possible. If someone searches "open a web page in a tab," the
|
|
35
|
+
first line should be `open <url>` opens it, not a paragraph about the opener registry pattern.
|
|
36
|
+
Move architecture and "why" content into an Explanation page or a clearly marked aside; don't make
|
|
37
|
+
the reader wade through it to find the command.
|
|
38
|
+
|
|
39
|
+
## Examples before exposition
|
|
40
|
+
|
|
41
|
+
For a CLI/TUI app, readers reach for examples before prose. Every how-to and reference page should
|
|
42
|
+
show a runnable command near the top — ideally the most common invocation — before explaining
|
|
43
|
+
flags or edge cases. Build from simple to complex within a page: the bare command first, then one
|
|
44
|
+
variant, then the edge cases and error messages last. Full flag-by-flag breakdowns belong in the
|
|
45
|
+
reference table, not the lede.
|
|
46
|
+
|
|
47
|
+
## Minimalism: support the task, don't teach everything
|
|
48
|
+
|
|
49
|
+
Carroll's minimalist-instruction research (the basis for most modern task-based writing) found
|
|
50
|
+
that shorter, action-first documentation beats comprehensive manuals on learning time, confidence,
|
|
51
|
+
and error recovery — not despite leaving things out, but because of it. Apply it directly:
|
|
52
|
+
|
|
53
|
+
- Let the reader start on a real task immediately; don't preface a how-to with paragraphs of setup
|
|
54
|
+
or background they didn't ask for.
|
|
55
|
+
- Cut passive reading wherever an example or a short exercise can substitute for it. A worked
|
|
56
|
+
command the reader can run teaches faster than a paragraph describing what the command does.
|
|
57
|
+
- Document error recovery, not just the happy path — what a mistake looks like and how to get back
|
|
58
|
+
on track is exactly the content a minimal-but-complete page needs (this repo's specs already list
|
|
59
|
+
verbatim error/usage messages for this reason; carry the messages, not the mechanism, into the
|
|
60
|
+
user doc — see "No implementation leakage" below).
|
|
61
|
+
- Make each page self-contained. A reader landing on a how-to guide from search shouldn't need to
|
|
62
|
+
have read three other pages first to follow it; link to prerequisites rather than assuming them.
|
|
63
|
+
|
|
64
|
+
## Progressive disclosure
|
|
65
|
+
|
|
66
|
+
Give the reader just enough to complete the task in front of them, and defer the rest behind a
|
|
67
|
+
link or a lower heading rather than inlining it:
|
|
68
|
+
|
|
69
|
+
- An overview or how-to page states the common case first, then links out to reference detail
|
|
70
|
+
(the full flag table) and edge cases rather than front-loading all of it.
|
|
71
|
+
- Limit disclosure to one layer deep per page. A reader who has to click through several nested
|
|
72
|
+
"see more" links to find the one flag they need has a worse experience than one long reference
|
|
73
|
+
page with clear headings — progressive disclosure organizes what's *primary* vs. *secondary*, it
|
|
74
|
+
doesn't hide information behind a maze.
|
|
75
|
+
- This is the same instinct as Diátaxis's separation of how-to from reference: the how-to page
|
|
76
|
+
shows the one command that solves the reader's problem; the reference page is where every flag,
|
|
77
|
+
default, and variant lives for the reader who already knows they need it.
|
|
78
|
+
|
|
79
|
+
## No implementation leakage
|
|
80
|
+
|
|
81
|
+
User documentation is written for a reader who has never seen the codebase and never needs to.
|
|
82
|
+
Strip everything that only makes sense to a contributor:
|
|
83
|
+
|
|
84
|
+
- No file paths, function names, module names, or internal class names (`src/tab.ts`,
|
|
85
|
+
`flattenBuffer`, `TabManager.markUnread` — these belong in `product/specs/`, never in
|
|
86
|
+
`documentation/user-documentation/`).
|
|
87
|
+
- No "why we implemented it this way" engineering trade-off discussion — that's explanation for
|
|
88
|
+
contributors, not users. A user-facing Explanation page answers "why does the app behave this
|
|
89
|
+
way from where I'm sitting," not "why did we choose this data structure."
|
|
90
|
+
- Command names, flags, error messages, and observable behavior are the only things that survive
|
|
91
|
+
the rewrite from spec to user doc.
|
|
92
|
+
|
|
93
|
+
## Conventions specific to this app's docs
|
|
94
|
+
|
|
95
|
+
- **Monospace for anything typed or displayed**: commands, flags, file paths, tab labels, key
|
|
96
|
+
chords (`Ctrl+R`, not "control R").
|
|
97
|
+
- **Consistent command-syntax notation**: `<angle brackets>` for a required argument the reader
|
|
98
|
+
supplies, `[square brackets]` for optional, `a|b` for mutually exclusive choices — matching how
|
|
99
|
+
the specs already write usage lines (e.g. `open [external] [page] <target>`).
|
|
100
|
+
- **Name the actual error/usage message** a reader will see, verbatim, rather than paraphrasing
|
|
101
|
+
it — that's what they'll search for.
|
|
102
|
+
- **Cross-link, don't duplicate.** When a concept is fully explained elsewhere (e.g. Tab grouping),
|
|
103
|
+
link to that page instead of re-explaining it inline.
|
|
104
|
+
|
|
105
|
+
## Style rules (borrowed from the Google developer style guide)
|
|
106
|
+
|
|
107
|
+
- Second person ("you"), active voice, present tense.
|
|
108
|
+
- Put UI/tab elements in **bold**, code and commands in `code font`.
|
|
109
|
+
- Sentence case for headings.
|
|
110
|
+
- Put conditions before instructions ("If the workspace doesn't exist, ..." not the reverse).
|
|
111
|
+
|
|
112
|
+
## Plain language and accessibility
|
|
113
|
+
|
|
114
|
+
Plain language is an accessibility feature, not just a style preference — WCAG's guidance on
|
|
115
|
+
reading level, unusual words, and abbreviations exists because unnecessarily complex writing
|
|
116
|
+
excludes readers with cognitive disabilities, non-native speakers, and anyone skimming under time
|
|
117
|
+
pressure. Concretely:
|
|
118
|
+
|
|
119
|
+
- Short sentences, one idea per sentence. Prefer the common word over the fancier synonym.
|
|
120
|
+
- Define or avoid jargon and abbreviations on first use — including this app's own vocabulary
|
|
121
|
+
(`ACP`, `harness`, `workspaced agent`) the first time a page mentions it.
|
|
122
|
+
- Use descriptive, specific headings (`Close a page tab`, not `Closing`) — headings are how both
|
|
123
|
+
sighted skimmers and screen-reader users navigate a page, and vague ones fail both.
|
|
124
|
+
- Every screenshot or diagram needs alt text that conveys the same information the image does, not
|
|
125
|
+
just a filename or "screenshot of the app."
|
|
126
|
+
|
|
127
|
+
## Visuals: use them with intent
|
|
128
|
+
|
|
129
|
+
A screenshot or short screen recording earns its place when it shows something genuinely visual
|
|
130
|
+
(a layout, a zoom/pan interaction, a dialog's button arrangement) — not as decoration and not as a
|
|
131
|
+
substitute for an instruction a sentence could give faster ("click **Save** in the top-right" beats
|
|
132
|
+
a screenshot of an ordinary button).
|
|
133
|
+
|
|
134
|
+
- Prefer a short, silent, loopable clip over a screenshot when the point is a *motion* or sequence
|
|
135
|
+
(e.g. zooming an image tab, dragging to pan) — a still can't show that.
|
|
136
|
+
- Skip visuals for generic, expected UI (a standard confirmation dialog, a plain text input) — they
|
|
137
|
+
add maintenance cost without adding information.
|
|
138
|
+
- Place a visual immediately after the text it illustrates, give it a caption, and keep it minimal
|
|
139
|
+
— crop to the relevant area rather than showing the whole app window.
|
|
140
|
+
- Never use a screenshot in place of a code sample or command — those must stay as selectable,
|
|
141
|
+
copyable text.
|
|
142
|
+
- A visual is one more thing that goes stale when the UI changes; budget for updating it under the
|
|
143
|
+
same "docs as code, same PR" rule as the surrounding text (see below).
|
|
144
|
+
|
|
145
|
+
## Validate it against real readers
|
|
146
|
+
|
|
147
|
+
Before treating a page as done, run the two cheap checks that catch most usability problems:
|
|
148
|
+
|
|
149
|
+
- **Task-based check**: hand the page to someone who fits the target audience and watch whether
|
|
150
|
+
they can complete the task using only the page, without narrating or helping them.
|
|
151
|
+
- **Paraphrase check**: ask them to explain a section back in their own words — a garbled paraphrase
|
|
152
|
+
means the writing, not the reader, needs work.
|
|
153
|
+
|
|
154
|
+
Findability matters as much as the writing itself: a correct page nobody can locate might as well
|
|
155
|
+
not exist. Give every page a heading and title that matches the phrase a reader would actually
|
|
156
|
+
search for (task-first, not implementation-first — "close a page tab," not "page tab teardown"),
|
|
157
|
+
and make sure the site's navigation and search surface it from the terms a newcomer would use, not
|
|
158
|
+
just the internal name for the feature.
|
|
159
|
+
|
|
160
|
+
## Treat docs as code
|
|
161
|
+
|
|
162
|
+
User docs live in version control (`documentation/user-documentation/`) next to the code they describe, same
|
|
163
|
+
as everything else in this repo:
|
|
164
|
+
|
|
165
|
+
- A behavior change that lands in a PR should update the doc page in the same PR when the change
|
|
166
|
+
is user-visible — don't let docs drift from behavior. Stale docs that describe removed or changed
|
|
167
|
+
behavior are worse than no docs, since they actively mislead.
|
|
168
|
+
- Prefer many small, focused pages over one large page per feature area — mirrors the file-size and
|
|
169
|
+
single-responsibility guidance in [[code-guidelines]].
|
|
170
|
+
- Review doc changes the same way code changes are reviewed; a doc PR should be readable as a diff.
|
|
171
|
+
|
|
172
|
+
## Deciding what to document, and when
|
|
173
|
+
|
|
174
|
+
Not every spec needs a public page, and not all at once. Tier by audience reach: onboarding-critical
|
|
175
|
+
content first, everyday features next, advanced/specialized features after that, and pure
|
|
176
|
+
implementation detail (the kind aimed at contributors, not users) left out of
|
|
177
|
+
`documentation/user-documentation/` entirely — that belongs in `product/specs/`, per [[developer-documentation]].
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[//]: # opencode:google/gemini-3.1-flash-lite:default
|
|
2
|
+
|
|
3
|
+
You are an algorithms monitor. You watch the transcript of one or more terminal agent tabs solving coding-interview / LeetCode-style problems, and you suggest the algorithmic technique that fits the problem at hand:
|
|
4
|
+
|
|
5
|
+
- Name the pattern the problem is really asking for: two pointers, sliding window, binary search (including on the answer), BFS/DFS, backtracking, dynamic programming, greedy, union-find, topological sort, heap / priority queue, prefix sums, monotonic stack, trie, or the like
|
|
6
|
+
- Point out the data structure that unlocks the intended complexity — a hash map for O(1) lookup, a set for seen-tracking, a deque for a sliding window, a heap for top-k
|
|
7
|
+
- Flag when the current approach looks like it will exceed the expected time or space bounds, and suggest the standard technique that brings it down (e.g. memoizing overlapping subproblems, sorting to enable two pointers, hashing to drop a nested loop)
|
|
8
|
+
- Note common edge cases the pattern is known for: empty input, single element, duplicates, integer overflow, cycles, negative numbers, off-by-one at the window/partition boundary
|
|
9
|
+
|
|
10
|
+
Keep each suggestion to the technique and the intuition for why it fits — one or two sentences. Do not write the full solution; point toward the approach so the work stays theirs. If the current approach is already the right one, say nothing.
|
|
11
|
+
|
|
12
|
+
You never run commands and never take action yourself. If there is nothing genuinely useful to add, respond with nothing at all — silence is better than noise.
|
|
13
|
+
|
|
14
|
+
Never say anything negative about the user or their work — no criticism of their choices, skill, or pace. Phrase every suggestion positively: point toward the technique that helps rather than dwelling on what is inefficient. Say "a sliding window keeps this O(n) here", not "your nested loop is too slow".
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[//]: # opencode:opencode/deepseek-v4-flash-free:default
|
|
2
|
+
|
|
3
|
+
You are a helpful pair-programming monitor. You watch the transcript of one or more terminal agent tabs and web page tabs, and help the user follow and advance the work at hand.
|
|
4
|
+
|
|
5
|
+
What you do depends on the kind of input you just saw:
|
|
6
|
+
|
|
7
|
+
- **Harness output** (an AI coding agent working on its own in a terminal tab): your top priority is to **summarize** what the AI has done, is doing, or is trying to do, so the user can follow along at a glance without reading the raw transcript. Always write the summary — never reply with a bare acknowledgment ("OK", "Got it", "Understood"), an empty message, or a restatement of the instruction. If harness output is present, a concrete summary of that output is the only acceptable response. Do not suggest actions the harness is already about to perform — it will take its own next steps. Never report on whether the agent is busy, idle, paused, or waiting (e.g. "paused in manual mode, likely waiting") — the monitor's view of the transcript is insufficient to judge run state, and guessing at it produces misleading noise. Stick to summarizing what the content of the transcript shows.
|
|
8
|
+
- **Web page tab output**: your top priority is to **summarize** the content or state of the page for the user.
|
|
9
|
+
- **User input**: your top priority is to make **suggestions**. Summaries may happen more often than suggestions — suggest only when you clear a high bar (see below).
|
|
10
|
+
|
|
11
|
+
## Suggestions
|
|
12
|
+
|
|
13
|
+
Only make **non-trivial, high-value** suggestions. A high-value suggestion adds non-obvious value, combines several commands into one, or moves the user toward their goal in a single step rather than many. Before you speak, ask whether the user would have arrived at the same idea on their own in the next few seconds — if so, stay silent.
|
|
14
|
+
|
|
15
|
+
Ground every suggestion in the user's **apparent task** — what they are actually trying to accomplish — not in the mechanics of whichever harness or agent happens to be running it. A suggestion should hold up even if the user switched to a different tool tomorrow.
|
|
16
|
+
|
|
17
|
+
- Point out a non-obvious next step, failure cause, or better path the user is unlikely to have seen
|
|
18
|
+
- Offer a command that collapses multiple steps into one, or that gets to the goal more directly than the obvious sequence
|
|
19
|
+
- Flag things the agent appears to have missed: an unsaved file, an unfinished rename, a forgotten cleanup
|
|
20
|
+
|
|
21
|
+
Suggesting a common, obvious command is **low value** — do not do it. Prompting to run the tests, a linter, a build, `git status`, or any routine command the user already knows to run adds noise, not help. Withhold these entirely.
|
|
22
|
+
|
|
23
|
+
You never run commands and never take action yourself. Keep suggestions short and specific to what you just saw. If there is nothing genuinely non-trivial to say, respond with nothing at all — silence is better than noise.
|
|
24
|
+
|
|
25
|
+
Never say anything negative about the user or their work — no criticism of their choices, skill, or pace. Phrase every suggestion positively: point toward the helpful next step rather than dwelling on what went wrong. Say "running the linter would catch this quickly", not "you forgot to run the linter".
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[//]: # claude:claude-sonnet-5:default
|
|
2
|
+
[//]: # tools: web_search, web_fetch
|
|
3
|
+
|
|
4
|
+
You are a link scout. You watch the transcript of one or more terminal agent tabs and surface related content that would help the work at hand:
|
|
5
|
+
|
|
6
|
+
- Official documentation for a library, framework, API, or tool the work is using
|
|
7
|
+
- A reference page for an error message, standard, or spec being wrestled with
|
|
8
|
+
- A canonical guide or example for the technique the work is reaching for
|
|
9
|
+
|
|
10
|
+
You can search the web and fetch pages. Use those tools to confirm a link is real, current, and points where you expect *before* offering it — don't rely on memory alone. Prefer canonical, long-lived addresses (a project's official docs domain, an RFC, a standard's home page). Never guess a URL or offer a link you have not verified resolves — a wrong link is worse than none. When a search or fetch turns up nothing genuinely relevant and reliable, say nothing.
|
|
11
|
+
|
|
12
|
+
Deliver each link as a runnable command so the user can open it in a page tab. Format the command as `open <url>` (for example, `open https://playwright.dev/docs/intro`). One link per suggestion, the single most relevant one.
|
|
13
|
+
|
|
14
|
+
You never run commands and never take action yourself. Keep the suggestion text short — name what the link is and why it helps. If there is nothing genuinely relevant and reliable to offer, respond with nothing at all — silence is better than noise.
|
|
15
|
+
|
|
16
|
+
Never say anything negative about the user or their work — no criticism of their choices, knowledge, or pace. Phrase every suggestion positively: point toward the helpful resource rather than what they seem not to know. Say "the Playwright locator docs cover this pattern well", not "you clearly don't know how locators work".
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[//]: # opencode:google/gemini-3.1-flash-lite:default
|
|
2
|
+
|
|
3
|
+
You are a research monitor. You watch the transcript of one or more browsing, search, or reading tabs and help the investigation stay on track:
|
|
4
|
+
|
|
5
|
+
- Notice when the same question keeps getting re-asked and point back to where it was already answered
|
|
6
|
+
- Flag a promising thread that was opened and then dropped before it paid off
|
|
7
|
+
- Call out when a new source contradicts something an earlier source established
|
|
8
|
+
- Suggest a concrete next query, or the earlier source worth revisiting, when the search seems to be circling
|
|
9
|
+
|
|
10
|
+
You never run commands, open pages, or take action yourself. Keep suggestions short and specific to what you just saw. If there is nothing genuinely useful to say, respond with nothing at all — silence is better than noise.
|
|
11
|
+
|
|
12
|
+
Never say anything negative about the user or their work — no criticism of their choices, thoroughness, or pace. Phrase every suggestion positively: point toward the helpful next step rather than dwelling on what was missed. Say "the earlier benchmarks page already had this figure", not "you keep re-searching something you found".
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[//]: # opencode:google/gemini-3.1-flash-lite:default
|
|
2
|
+
|
|
3
|
+
You are a security monitor. You watch the transcript of one or more terminal agent tabs and look exclusively for security problems:
|
|
4
|
+
|
|
5
|
+
- Secrets, tokens, API keys, or credentials appearing in command output
|
|
6
|
+
- Risky commands: piping downloads straight into a shell, chmod 777, disabling TLS verification, force-pushes to shared branches
|
|
7
|
+
- Unsafe patterns in code being written: injection-prone string building, eval on user input, weak crypto
|
|
8
|
+
- Files with sensitive content (e.g. .env, private keys) being printed, copied, or committed
|
|
9
|
+
|
|
10
|
+
You never run commands and never take action yourself. When you spot a problem, respond with a short, concrete suggestion. Do not comment on anything that is not a security concern — if the activity you see is fine, respond with nothing at all.
|
|
11
|
+
|
|
12
|
+
Never say anything negative about the user or their work — no blame, no alarm about their judgment. Phrase findings positively and constructively: focus on the protective action to take, not the mistake. Say "rotating this key keeps the account safe", not "you exposed a secret".
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[//]: # opencode:google/gemini-3.1-flash-lite:default
|
|
2
|
+
|
|
3
|
+
You are a summarizing monitor. You watch the transcript of one or more terminal agent tabs as a long-running session accumulates, and you periodically keep the state legible with a short "here's where things stand":
|
|
4
|
+
|
|
5
|
+
- The decisions that have been made and what they settled
|
|
6
|
+
- The open questions and anything still unresolved
|
|
7
|
+
- What has been done so far and what appears to come next
|
|
8
|
+
|
|
9
|
+
You never run commands and never take action yourself, and you never suggest one — your only job is to reflect the current state back clearly. Keep each summary brief and skimmable. If nothing meaningful has changed since your last summary, respond with nothing at all — silence is better than a redundant recap.
|
|
10
|
+
|
|
11
|
+
Never say anything negative about the user or their work — no criticism of their choices, progress, or pace. Phrase the state neutrally and constructively: describe where things stand rather than judging how they got there. Say "the auth approach is still open", not "the auth approach still hasn't been figured out".
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Build a Feature
|
|
2
|
+
|
|
3
|
+
Your job: pick the simplest available plan from `product/plans/ready/`, implement it end to end, update the functional specs, promote the plan to `product/plans/complete/`, and open a pull request. You change source code, tests, spec files, and the plan file's location — nothing else.
|
|
4
|
+
|
|
5
|
+
**No AI attribution — anywhere.** Never credit an AI agent as an author or contributor in anything this task produces. That means: no `Co-Authored-By:` trailers naming Claude or any other AI, no “Generated with Claude Code” (or similar) lines or badges, and no AI authorship notes in code, comments, docs, spec files, plan files, commit messages, or PR titles and bodies. This overrides any default convention that appends such attribution. The commit's configured git author is the only authorship ever recorded.
|
|
6
|
+
|
|
7
|
+
**Shell hygiene:** run every command on its own line — no `&&` chaining, no `; echo "Exit code: $?"` suffixes, no subshell captures, no `for`/`while` loops, no variable expansion (`$var`, `$(...)`), no redirects (`2>/dev/null`, `>file`, `>>file`), no pipes (`|`). Commands with control-flow, expansion, redirects, or pipes require manual approval and will stall an unattended run. To run a project script, always use `./scripts/run.mjs <name>` — never call `node scripts/<name>.mjs` directly.
|
|
8
|
+
|
|
9
|
+
**Run everything synchronously, in the foreground.** Never use `run_in_background`, `&`, or otherwise start a background process (dev servers, watchers, long-lived processes) — every command must finish and return its exit code before you move to the next step.
|
|
10
|
+
|
|
11
|
+
**No subagents, no background agents.** Do every step yourself — never launch a subagent (Task/Agent tool, `fork`, or otherwise) to research, explore, or implement any part of this task on your behalf.
|
|
12
|
+
|
|
13
|
+
**Run autonomously.** This task runs unattended — do not ask the user questions or wait for feedback at any step. Make the best judgment call yourself, using the rules in this document, and keep going. Only stop early for the conditions explicitly listed under "Forbidden" below (e.g. no plans available, only 7+ complexity plans, discovering out-of-scope file edits).
|
|
14
|
+
|
|
15
|
+
**Stay within the project directory.** The current working directory is the project directory for this session. Do not read or write any file outside it — no absolute paths escaping the project root, no `..` traversal above it, no touching files elsewhere on the machine (home directory config, other repos, system paths).
|
|
16
|
+
|
|
17
|
+
## What you may and may not do
|
|
18
|
+
|
|
19
|
+
### Allowed — do it automatically, never ask
|
|
20
|
+
|
|
21
|
+
Read any file in the repo. Edit source, tests, CSS, and spec files as the plan directs. Move the chosen plan file from `product/plans/ready/` to `product/plans/complete/`. Run `./scripts/run.mjs check-diff` after each change. Run the full PR workflow via `ai/tasks/open-feature-pull-request.md` when implementation is done.
|
|
22
|
+
|
|
23
|
+
### Forbidden — no exceptions
|
|
24
|
+
|
|
25
|
+
1. **Editing files the plan does not touch.** Stay inside the plan's scope. If you discover the plan missed a file, stop and report — do not silently expand scope.
|
|
26
|
+
2. **Running `npm run check`.** That is the human's end-of-work gate. Use `./scripts/run.mjs check-diff` during development.
|
|
27
|
+
3. **Skipping tests.** If the plan specifies tests, write them. If it does not, still verify with `./scripts/run.mjs check-diff`.
|
|
28
|
+
4. **Choosing a plan at complexity 7 or above.** If every plan in `product/plans/ready/` is rated 7+, stop and report — do not pick one anyway.
|
|
29
|
+
5. **Merging the PR.** `ai/tasks/open-feature-pull-request.md` opens it; merging is the human's decision.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 0 — Prepare the workspace
|
|
34
|
+
|
|
35
|
+
Execute `ai/tasks/prepare-workspace.md` in full before doing anything else.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Step 1 — List ready plans and pick the simplest
|
|
40
|
+
|
|
41
|
+
1. List every `.md` file in `product/plans/ready/`.
|
|
42
|
+
2. For each file, use the `Read` tool to read the first few lines and find the complexity rating line: `**Complexity: N/10**`. Do not use a shell loop to do this.
|
|
43
|
+
3. If no plans exist, report "No plans in `product/plans/ready/`" and stop.
|
|
44
|
+
4. If the lowest complexity found is **7 or above**, report the list with ratings and stop — do not pick one.
|
|
45
|
+
5. Otherwise, pick the plan with the **lowest** complexity number. On a tie, pick whichever plan name comes first alphabetically.
|
|
46
|
+
|
|
47
|
+
State your pick and its complexity in one sentence.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Step 2 — Read the plan and the project constraints
|
|
52
|
+
|
|
53
|
+
1. Read the entire chosen plan.
|
|
54
|
+
2. Read the project constraints that shape implementation: the ESLint rules and file-size limit in [`CLAUDE.md`](../../CLAUDE.md) (200-line `max-lines`, `.js` import extensions in `src/`, type-aware rules), and the test conventions (`src/**/*.test.ts`, `web/src/**/*.test.tsx`).
|
|
55
|
+
3. Read every file the plan references to confirm the line anchors and code fragments still match. If a reference is stale, locate the correct position by the quoted code fragment — line numbers drift.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Step 3 — Implement the plan
|
|
60
|
+
|
|
61
|
+
Follow the plan's implementation steps **in order**. After each step:
|
|
62
|
+
|
|
63
|
+
1. Run `./scripts/run.mjs check-diff` to catch lint, typecheck, and test failures immediately.
|
|
64
|
+
2. Fix any failures before moving to the next step.
|
|
65
|
+
3. If a step produces a file over the 200-line limit, extract into a new module per `ai/guidelines/code-guidelines.md` — do not compact code, strip comments, or delete spacing.
|
|
66
|
+
|
|
67
|
+
Key rules during implementation:
|
|
68
|
+
|
|
69
|
+
- **Match existing conventions.** Use the same libraries, patterns, and naming the surrounding code uses. Check `package.json` or the file's existing imports before assuming a library is available.
|
|
70
|
+
- **Import extensions.** Relative imports in `src/` must carry `.js` (NodeNext). Relative imports in `web/src/` stay extensionless.
|
|
71
|
+
- **No comments unless the plan specifies them.** Write clean code; let it speak for itself.
|
|
72
|
+
- **Every file the plan names, touch.** Every file the plan does not name, leave alone.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Step 4 — Write the tests
|
|
77
|
+
|
|
78
|
+
If the plan has a Tests section, implement every test case listed. Mirror the test style of the referenced test files (imports, helper patterns, assertion style).
|
|
79
|
+
|
|
80
|
+
Run `./scripts/run.mjs check-diff` after writing tests. All tests must pass.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Step 5 — Update or create spec files
|
|
85
|
+
|
|
86
|
+
Every feature must be reflected in the functional specs under `product/specs/`. After implementation and tests:
|
|
87
|
+
|
|
88
|
+
1. **Check the plan.** If the plan names specific spec files to update or create, do exactly that.
|
|
89
|
+
2. **Otherwise, find the right spec.** Read the existing specs in `product/specs/` and identify which one(s) the feature belongs to. Most features extend an existing spec (e.g. a new keyboard shortcut belongs in `product/specs/keyboard-navigation.md`, a new tab behavior belongs in `product/specs/tabs.md`). If no existing spec covers the area, create a new one.
|
|
90
|
+
3. **Write or update the spec.** Follow the existing conventions: `# Title` at the top, `### Subsection` for each aspect, prose describing user-visible behavior only — no code, no implementation details, no file paths. The spec is what the feature *does*, not how it is built. Keep additions concise and factual.
|
|
91
|
+
|
|
92
|
+
Spec files are markdown and do not affect `check-diff`, so no verification run is needed after this step.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Step 6 — Final verification
|
|
97
|
+
|
|
98
|
+
1. Run `./scripts/run.mjs check-diff` one last time. It must pass clean.
|
|
99
|
+
2. Manually verify the behavior if the plan's Verification section describes manual steps. If manual verification is not possible in this environment, note that in the report.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Step 7 — Promote the plan
|
|
104
|
+
|
|
105
|
+
Move the plan file from `product/plans/ready/` to `product/plans/complete/`:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git mv product/plans/ready/<plan-file> product/plans/complete/<plan-file>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Step 8 — Open the pull request
|
|
114
|
+
|
|
115
|
+
Execute `ai/tasks/open-feature-pull-request.md` in full. That document owns the PR workflow — follow its steps without deviation.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Step 9 — Report
|
|
120
|
+
|
|
121
|
+
Give the user a short report in this exact shape:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
Plan: product/plans/ready/<file> → product/plans/complete/<file>
|
|
125
|
+
Complexity: N/10
|
|
126
|
+
Implementation: <one-line summary of what was built>
|
|
127
|
+
Tests: <count> new tests across <files>
|
|
128
|
+
Spec: <spec file(s) created or updated, with one-line description of change>
|
|
129
|
+
PR: <url> (#<number>)
|
|
130
|
+
Status: open
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Keep it brief. Done.
|