cli-usereq 0.68.0__py3-none-any.whl
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.
- cli_usereq-0.68.0.dist-info/METADATA +1134 -0
- cli_usereq-0.68.0.dist-info/RECORD +37 -0
- cli_usereq-0.68.0.dist-info/WHEEL +5 -0
- cli_usereq-0.68.0.dist-info/entry_points.txt +4 -0
- cli_usereq-0.68.0.dist-info/licenses/LICENSE +674 -0
- cli_usereq-0.68.0.dist-info/top_level.txt +1 -0
- usereq/__init__.py +62 -0
- usereq/__main__.py +17 -0
- usereq/cli.py +4963 -0
- usereq/compress.py +393 -0
- usereq/compress_files.py +134 -0
- usereq/doxygen_parser.py +172 -0
- usereq/find_constructs.py +394 -0
- usereq/generate_markdown.py +158 -0
- usereq/resources/docs/Document_Source_Code_in_Doxygen_Style.md +130 -0
- usereq/resources/docs/HDT_Test_Authoring_Guide.md +318 -0
- usereq/resources/docs/Requirements_Template.md +78 -0
- usereq/resources/prompts/analyze.md +191 -0
- usereq/resources/prompts/change.md +279 -0
- usereq/resources/prompts/check.md +190 -0
- usereq/resources/prompts/cover.md +271 -0
- usereq/resources/prompts/create.md +134 -0
- usereq/resources/prompts/fix.md +273 -0
- usereq/resources/prompts/flowchart.md +272 -0
- usereq/resources/prompts/implement.md +194 -0
- usereq/resources/prompts/new.md +278 -0
- usereq/resources/prompts/readme.md +234 -0
- usereq/resources/prompts/recreate.md +265 -0
- usereq/resources/prompts/refactor.md +265 -0
- usereq/resources/prompts/references.md +131 -0
- usereq/resources/prompts/renumber.md +150 -0
- usereq/resources/prompts/workflow.md +254 -0
- usereq/resources/prompts/write.md +129 -0
- usereq/resources/prompts-version.txt +1 -0
- usereq/source_analyzer.py +2280 -0
- usereq/static_check.py +812 -0
- usereq/token_counter.py +123 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Implement a new requirement and make the corresponding source code changes"
|
|
3
|
+
argument-hint: "Description of the new requirement/feature to implement"
|
|
4
|
+
usage: >
|
|
5
|
+
Use when the user asks to add a strictly additive, backward-compatible feature and implement it. Append new requirement IDs to REQUIREMENTS.md, then implement and verify the corresponding code and tests under the project source directories and the project test directory. Preserve existing requirements and public behavior. Use /req-change if existing requirements must change or compatibility cannot be preserved; /req-cover or /req-implement if the feature is already required by the SRS. Do not select for requirements drafting alone.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Implement a new requirement and make the corresponding source code changes
|
|
9
|
+
|
|
10
|
+
## Pre-Flight: Context Keyword Resolution
|
|
11
|
+
- **CRITICAL**: Complete this read-only gate before any path-dependent action or numbered Step. Immediate-start directives apply only after success; autonomous disambiguation MUST NOT guess `{{PRJ_BASE}}` or `{{GIT_BASE}}`.
|
|
12
|
+
- Runtime keywords: resolve exactly two LLM-resolved path keywords in fixed order: `{{PRJ_BASE}}` first, `{{GIT_BASE}}` second. Installation has already supplied the documentation, source, and test paths; use them as fixed relative suffixes, not values to discover or replace.
|
|
13
|
+
- Project base: `{{PRJ_BASE}}` is the absolute base directory of the unique target project containing its installation-supplied `%%DOC_PATH%%`, `%%SRC_PATHS%%`, and `%%TEST_PATH%%` directories.
|
|
14
|
+
- Git base: `{{GIT_BASE}}` is the absolute base directory of the git repository containing `{{PRJ_BASE}}`. One git repository can contain multiple projects; repository identity alone never identifies the project.
|
|
15
|
+
- Resolution order: identify `{{PRJ_BASE}}` first and uniquely from current invocation routing and explicit task scope; use uniquely corroborated project path metadata only for missing evidence. The current directory is a candidate, not a default. Conflicting bindings, multiple plausible projects, or stale cross-project values fail resolution. Source-free workflows inspect path metadata only. After `{{PRJ_BASE}}` is bound, derive `{{GIT_BASE}}` as the git repository root containing the bound project base.
|
|
16
|
+
- Binding: retain `{{PRJ_BASE}}`, `{{GIT_BASE}}`, active worktree root, project identity, evidence, directory existence states, and document provenance throughout this invocation. Start fresh for each invocation; replace the bindings only after a validated context transition.
|
|
17
|
+
- Paths: substitute the resolved base in each prefixed path. For an installation-supplied source list, apply the base separately to every entry; preserve order and explicit list boundaries, never split on spaces or commas. Treat paths as data and quote each resulting literal argument separately, with option termination where supported.
|
|
18
|
+
- Containment: validate the base and resulting paths inside the active worktree, including symlink targets and existing ancestors of prospective paths. Accept absent directories only for authorized creation or explicitly unused source/test scopes; absence is not an unresolved base. Create nothing during pre-flight.
|
|
19
|
+
- Document contract below: filenames are relative to the installation-supplied documentation path under `{{PRJ_BASE}}`. Required inputs MUST exist; creatable targets MAY be absent. Load exactly the listed existing documents in full before Steps, including existing targets; defer reads of absent creatable targets until generated. Unlisted canonical documents are not prerequisites.
|
|
20
|
+
- Required inputs: REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md.
|
|
21
|
+
- Creatable targets: none.
|
|
22
|
+
- Load when present: REQUIREMENTS.md, WORKFLOW.md, REFERENCES.md.
|
|
23
|
+
- Context reuse: treat injected or previously read content as loaded only when repository, worktree, project-area, path, and revision provenance match this binding. Current runtime attestation or unchanged-file evidence can establish a match; a basename alone cannot. Refresh stale or unverified content from the resolved path; reuse matching content without re-reading. After an edit, retain the verified updated content and invalidate superseded evidence.
|
|
24
|
+
- Operation scope: run cwd-sensitive commands and configured tools from `{{PRJ_BASE}}` only when their effective scope matches the target project; otherwise use a documented explicit-path equivalent or fail resolution.
|
|
25
|
+
- Activity routing: reference all project-modification and requirements-modification activities exclusively to `{{PRJ_BASE}}`; reference only working-tree creation and git-management activities to `{{GIT_BASE}}`.
|
|
26
|
+
- Context transitions: after an authorized worktree change, rebase `{{PRJ_BASE}}` to the same project-relative location in the new worktree and rebase `{{GIT_BASE}}` to the new worktree's repository root. Revalidate containment and document provenance before project operations; discard old absolute paths. Reuse document contents only with verified unchanged-file evidence. A different target project requires a fresh invocation.
|
|
27
|
+
- **CRITICAL**: If `{{PRJ_BASE}}` or `{{GIT_BASE}}`, required document, containment check, or effective tool scope remains unresolved or conflicting, OUTPUT exactly "ERROR: Unable to resolve context keywords!". Before isolation, terminate without cleanup; after successful isolation, follow the context-resolution failure cleanup in the isolation Step before terminating.
|
|
28
|
+
|
|
29
|
+
## Purpose
|
|
30
|
+
Introduce a new, backwards-compatible capability by first extending the normative SRS (`{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`) with the new requirement(s), then implementing and verifying the corresponding code/test changes with strict traceability to requirement IDs so downstream LLM Agents MUST reason over the new feature deterministically.
|
|
31
|
+
|
|
32
|
+
## Scope
|
|
33
|
+
In scope: patch-style updates to `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md` that add the new feature requirements, an implementation plan, code/test changes under {{PRJ_BASE}}/%%SRC_PATHS%% and {{PRJ_BASE}}/%%TEST_PATH%%, verification via static analysis (`req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --static-check`), requirements evidence checks, and conditional execution of existing unit tests using language-specific test-suite priority policy, updates to `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md` and `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md`, and a clean git commit. Out of scope: breaking changes, migrations/compatibility conversions, or any feature work not captured as explicit requirements (report conflicts and terminate per prompt rules).
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Professional Personas
|
|
37
|
+
- **Act as a Prompt Engineer and LLM Optimization Specialist** whenever you design, write, modify, or analyze prompts, agents, skills, or documents whose target audience is an LLM Agent instead of a human reader.
|
|
38
|
+
- **Act as a Business Analyst** when generating **Requirement Delta** and during requirements analysis and update: your priority is requirement integrity, atomic description of changes, and ensuring no logical conflicts in `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`.
|
|
39
|
+
- **Act as a Senior System Architect** when generating the **Implementation Delta**: translate requirements into a robust, modular, and non-breaking technical implementation plan.
|
|
40
|
+
- **Act as a Senior Software Developer** during implementation: implement the planned changes with high-quality, idiomatic code that maps strictly to Requirement IDs.
|
|
41
|
+
- **Act as a QA Engineer** during verification and testing: verify compliance with zero leniency, using mandatory code evidence and strict fix loops based on static-analysis findings to ensure stability.
|
|
42
|
+
- **Act as an Expert GitOps Engineer** when executing git workflows, especially when creating/removing/managing git worktrees to isolate changes safely.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Iteration and Context Economy
|
|
46
|
+
- **CRITICAL**: Plan every Step to complete in the minimum number of iterations; batch independent reads, searches, and edits into a single response and dispatch parallel tool calls whenever no dependency forces sequencing.
|
|
47
|
+
- **CRITICAL**: Reuse injected or previously read file evidence only when repository, worktree, project-area, path, and revision identity match the active binding; do not re-read matching content. Refresh stale or unverified evidence under the pre-flight context-reuse rules.
|
|
48
|
+
- **CRITICAL**: MUST NOT restate requirement text, prior tool output, or unchanged file contents into the context; cite them by file path, symbol, and line range, quoting only the minimal changed snippet.
|
|
49
|
+
- **CRITICAL**: MUST add only information required by the active Step, a requirement ID, or explicit user-request text; omit narration, filler, restatements, and speculative commentary.
|
|
50
|
+
- **CRITICAL**: MUST choose the most token-efficient evidence path in order: `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`, `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md`, `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md`, then `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --find`/`req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --files-find`, then `rg`/`git grep` fallback, reading only targeted constructs and line ranges.
|
|
51
|
+
- **CRITICAL**: MUST gather all evidence a Step needs before producing its output and MUST NOT split a single logical operation across multiple iterations when one suffices.
|
|
52
|
+
- **CRITICAL**: MUST pause and wait for a tool response only when a Step explicitly depends on it; otherwise proceed autonomously to the next Step without requesting confirmation.
|
|
53
|
+
- **CRITICAL**: These rules MUST govern how the agent organizes and sequences the work described in the `## Steps` section.
|
|
54
|
+
|
|
55
|
+
## Pre-requisite: Execution Context
|
|
56
|
+
- **CRITICAL**: All information declared in this `Pre-requisite: Execution Context` section MUST remain continuously available in the active execution context for the entire workflow and MUST NEVER be dropped, forgotten, or overwritten.
|
|
57
|
+
- Generate <WORKTREE_NAME> with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-name`, retain the literal result for later steps, and use simple sequential execution with only linear shell commands compatible with restrictive filtering systems for all worktree operations in this workflow.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Absolute Rules, Non-Negotiable
|
|
61
|
+
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `git grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
62
|
+
- **CRITICAL**: Every `req` invocation MUST carry the mandatory parameters `--prj-base={{PRJ_BASE}}` and `--git-base={{GIT_BASE}}` with the resolved values; the removed `--base` parameter MUST NOT be used.
|
|
63
|
+
- **CRITICAL**: NEVER write, modify, edit, or delete files outside of the active git worktree directory, except under `/tmp`, and except for worktree operations executed through `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-create <WORKTREE_NAME>` and `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`.
|
|
64
|
+
- You can read, write, or edit `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`.
|
|
65
|
+
- Treat static analysis as safe. Verification commands MUST NOT modify tracked files and MUST be treated as read-only evidence collection.
|
|
66
|
+
- **CRITICAL**: GIT operations and GIT rules:
|
|
67
|
+
- Do not run any shell/git commands and do not modify any files before starting Step 1 (including creating/modifying files, installing deps, formatting, etc.), except the read-only repository checks required by the `## Pre-Flight: Context Keyword Resolution` section: **CRITICAL**: Check GIT Status.
|
|
68
|
+
- Step 1 may run only the git commands `git rev-parse --is-inside-work-tree`, `git rev-parse --verify HEAD`, `git status --porcelain`, and `git symbolic-ref -q HEAD` (plus minimal shell built-ins to combine their outputs into a single cleanliness check).
|
|
69
|
+
- If the repository is NOT clean (modified files, staged changes, OR untracked files), exit immediately without changing anything.
|
|
70
|
+
- At the end you MUST commit only the intended changes with a unique identifier and change description in the commit message.
|
|
71
|
+
- Leave the working tree AND index clean (git `status --porcelain` must be empty).
|
|
72
|
+
- Do NOT “fix” a dirty repo by force (no `git reset --hard`, no `git clean -fd`, no stash) unless explicitly requested. If dirty: abort.
|
|
73
|
+
- **CRITICAL**: Generate, update, and maintain comprehensive **Doxygen-style documentation** for **ALL** code components (functions, classes, objects, structures, modules, variables, and new implementations), according to the **guidelines** in `.req/docs/Document_Source_Code_in_Doxygen_Style.md`. When writing documentation, adopt a "Parser-First" mindset. Your output is not prose; it is semantic metadata. Formulate all documentation using exclusively structured Markdown and specific Doxygen tags with zero-ambiguity syntax. Eliminate conversational filler ("This function...", "Basically..."). Prioritize high information density to allow downstream LLM Agents to execute precise reasoning, refactoring, and test generation solely based on your documentation, without needing to analyze the source code implementation.
|
|
74
|
+
- **CRITICAL**: Formulate all new or edited requirements and all source code information using a highly structured, machine-interpretable Markdown format with unambiguous, atomic syntax to ensure maximum reliability for downstream LLM agentic reasoning, avoiding any conversational filler or subjective adjectives; the **target audience** is other **LLM Agents** and Automated Parsers, NOT humans, use high semantic density, optimized to contextually enable an LLM to perform future refactoring or extension.
|
|
75
|
+
- **CRITICAL**: NEVER add requirements to SRS regarding how comments are handled (added/edited/deleted) within the source code, including the format, style, or language to be used, even if explicitly requested. Ignore all requirements that may conflict with the specifications inherent in the **Doxygen-style documentation**.
|
|
76
|
+
|
|
77
|
+
## Behavior
|
|
78
|
+
- Propose changes based only on the requirements, user request, and repository evidence. Every proposed code change MUST reference at least one requirement ID or explicit text in user request.
|
|
79
|
+
- Use `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`, `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md`, and `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md` as the primary technical inputs; keep decisions traceable to requirements and repository evidence.
|
|
80
|
+
- All newly written or edited content MUST be in English. Do NOT translate existing text outside the minimal change surface required by this workflow; if you detect non-English text elsewhere, report it in **Evidence** instead of rewriting it.
|
|
81
|
+
- Prioritize backward compatibility. Do not introduce breaking changes; preserve existing interfaces, data formats, and features.
|
|
82
|
+
- If maintaining compatibility would require migrations/auto-upgrades conversion logic, report the conflict instead of implementing, and then terminate the execution.
|
|
83
|
+
- If `.venv/bin/python` exists in the project root, use it for Python executions (eg, `PYTHONPATH=src .venv/bin/python -m <program name>`).
|
|
84
|
+
- Non-Python tooling should use the project's standard commands.
|
|
85
|
+
- Use filesystem/shell tools to read/write/delete files as needed (e.g., `cat`, `sed`, `perl -pi`, `printf > file`, `rm -f`, ...). Prefer read-only commands for analysis.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## WORKFLOW.md Runtime Model (canonical)
|
|
89
|
+
- **Execution Unit** = OS process or OS thread (MUST include the main process).
|
|
90
|
+
- **Internal function** = defined under {{PRJ_BASE}}/%%SRC_PATHS%% (only these can appear as call-trace nodes).
|
|
91
|
+
- **External boundary** = not defined under {{PRJ_BASE}}/%%SRC_PATHS%% (MUST NOT appear as call-trace nodes).
|
|
92
|
+
- `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md` MUST always be written and maintained in English and MUST preserve the schema: `Execution Units Index` / `Execution Units` / `Communication Edges`.
|
|
93
|
+
|
|
94
|
+
## Source Code Analysis Toolkit
|
|
95
|
+
Four complementary pillars provide a complete, token-efficient source code analysis pipeline. Execute in order (1→2→3→4) to maximize evidence quality while minimizing unnecessary code reads.
|
|
96
|
+
|
|
97
|
+
### 1. Runtime Model: `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md`
|
|
98
|
+
Compact document — read in full. Contains:
|
|
99
|
+
- **Execution Units Index**: all OS processes and threads with roles and entrypoints.
|
|
100
|
+
- **Execution Units**: per-unit internal call-trace trees showing function call order, defining file paths, and external boundaries.
|
|
101
|
+
- **Communication Edges**: inter-unit data flow (direction, mechanism, payload).
|
|
102
|
+
|
|
103
|
+
Use to: identify which execution units (processes/threads) are involved, trace call-order through internal functions, understand data flow between components. Build a runtime mental model before reading any code.
|
|
104
|
+
|
|
105
|
+
### 2. Symbol Index: `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md`
|
|
106
|
+
Structured index of all source-defined symbols (functions, classes, structs, objects, data structures) with file paths and line numbers. Per-symbol Doxygen-style fields may include:
|
|
107
|
+
- `@brief`: single-line technical description of the symbol's action.
|
|
108
|
+
- `@details`: high-density algorithmic summary (LLM-optimized, not prose).
|
|
109
|
+
- `@param` / `@param[out]`: input parameters with type constraints; mutated reference/pointer arguments.
|
|
110
|
+
- `@return` / `@retval`: output data structure or specific return values.
|
|
111
|
+
- `@exception` / `@throws`: error states and specific exception classes.
|
|
112
|
+
- `@satisfies`: linked requirement IDs (e.g., `@satisfies REQ-026, REQ-045`).
|
|
113
|
+
- `@pre` / `@post`: pre-conditions and post-conditions.
|
|
114
|
+
- `@warning`: critical usage hazards.
|
|
115
|
+
- `@note`: vital implementation details.
|
|
116
|
+
- `@see` / `@sa`: related symbols for context linkage.
|
|
117
|
+
- `@deprecated`: replacement API link.
|
|
118
|
+
|
|
119
|
+
Use to: identify candidate symbols by name, description, or `@satisfies` link; obtain exact file paths and line ranges; understand function signatures and contracts before extracting code. Cross-reference with WORKFLOW.md call-traces to narrow scope.
|
|
120
|
+
|
|
121
|
+
### 3. Code Extraction: `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --find` / `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --files-find`
|
|
122
|
+
Extract actual source constructs as structured markdown with signatures, line ranges, and optional line-numbered code. Use after pillars 1-2 to extract only the targeted constructs identified during analysis.
|
|
123
|
+
#### What these commands do (and what they don't)
|
|
124
|
+
- Extract named constructs (e.g., CLASS, FUNCTION, STRUCT, INTERFACE, IMPORT, …) filtered by TAG and name-regex.
|
|
125
|
+
- Regex (PATTERN) matches construct name only (not body). For body-content search, use rg/git grep (pillar 4).
|
|
126
|
+
- Output per file: header `@@@ <filepath> | <language>`, per-construct blocks with:
|
|
127
|
+
- `### <TAG>: <name>` + optional Signature + `Lines: <start>-<end>`
|
|
128
|
+
- optional extracted Doxygen fields (if present in/around the construct)
|
|
129
|
+
- fenced code block with the complete construct slice (comments stripped, strings preserved)
|
|
130
|
+
#### Choose the right mode
|
|
131
|
+
- Project-wide scan: use --find (the mandatory `--prj-base`/`--git-base` prefix is required; `--base` is forbidden)
|
|
132
|
+
- Syntax: `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --find <TAG_FILTER> <NAME_REGEX>`
|
|
133
|
+
- Note: --find scans all files under configured source dirs; does not take a filename.
|
|
134
|
+
- Target specific files: use --files-find (standalone with the mandatory `--prj-base`/`--git-base` prefix)
|
|
135
|
+
- Syntax: `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --files-find <TAG_FILTER> <NAME_REGEX> <FILE1> [FILE2 ...]`
|
|
136
|
+
#### Enable line-numbered code for evidence citation
|
|
137
|
+
Add --enable-line-numbers (code lines prefixed as `<n>:`):
|
|
138
|
+
- `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --enable-line-numbers --find "<TAG_FILTER>" "<NAME_REGEX>"`
|
|
139
|
+
- `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --enable-line-numbers --files-find "<TAG_FILTER>" "<NAME_REGEX>" <FILE...>`
|
|
140
|
+
#### TAGs and filters
|
|
141
|
+
- TAG_FILTER: pipe-separated, case-insensitive (e.g., `CLASS|FUNCTION|IMPORT`).
|
|
142
|
+
- Tags are language-dependent; unsupported tags are ignored. Run `req -h` for supported TAGs per language.
|
|
143
|
+
- Broad cross-language TAG_FILTER: `CLASS|STRUCT|ENUM|INTERFACE|TRAIT|IMPL|FUNCTION|METHOD|MODULE|NAMESPACE|TYPE_ALIAS|TYPEDEF|IMPORT|CONSTANT|VARIABLE|MACRO|DECORATOR|COMPONENT|PROPERTY|PROTOCOL|EXTENSION|UNION`
|
|
144
|
+
#### Regex rules (NAME_REGEX)
|
|
145
|
+
- Regex matching follows `re.search()` semantics against construct names (tool behavior, independent of repository language).
|
|
146
|
+
- Prefer anchored patterns: exact `^Foo$`, prefix `^parse_`, suffix `Service$`. Use `.*` only when scope is already constrained by files/TAGs.
|
|
147
|
+
#### Failure modes you must handle
|
|
148
|
+
- "No constructs found": adjust TAGs (supported?), file paths, or NAME_REGEX (valid regex?).
|
|
149
|
+
- Regex-based extractor (not full AST): treat results as evidence pointers; confirm edge cases by opening referenced file/lines.
|
|
150
|
+
|
|
151
|
+
### 4. Supplementary Search: `rg` / `git grep`
|
|
152
|
+
Use for: string/pattern searches inside code bodies, cross-file references, configuration values, error messages, or any content not captured by construct-name-based extraction.
|
|
153
|
+
|
|
154
|
+
### Recommended Analysis Workflow
|
|
155
|
+
1. **Read `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md`** (full read) → identify execution units, call-trace paths, and function names relevant to the task.
|
|
156
|
+
2. **Read `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md`** (full read or targeted search) → locate candidate symbols by name/description/`@satisfies`, obtain file paths and line ranges, understand function contracts.
|
|
157
|
+
3. **Extract code** via `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --find`/`req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --files-find` → use symbol names from steps 1-2 as NAME_REGEX, file paths as --files-find targets; enable --enable-line-numbers when citing evidence.
|
|
158
|
+
4. **Search code bodies** via `rg`/`git grep` → find patterns, references, or values not captured by construct-level extraction.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
## Execution Protocol (Global vs Local)
|
|
162
|
+
You must manage the execution flow using two distinct methods:
|
|
163
|
+
- **Global Roadmap** (*check-list*):
|
|
164
|
+
- You MUST maintain a *check-list* internally with `11` Steps (one item per Step).
|
|
165
|
+
- **Do NOT** use the *task-list tool* for this high-level roadmap.
|
|
166
|
+
- **Local Sub-tasks** (Tool Usage):
|
|
167
|
+
- If a *task-list tool* is available, use it **exclusively** to manage granular sub-tasks *within* a specific step (e.g., in Step X: "1. Edit file A", "2. Edit file B"; or in Step Y: "1. Fix test K", "2. Fix test L").
|
|
168
|
+
- Clear or reset the tool's state when transitioning between high-level steps.
|
|
169
|
+
|
|
170
|
+
## Execution Directives (absolute rules, non-negotiable)
|
|
171
|
+
During the execution flow you MUST follow these directives:
|
|
172
|
+
- **CRITICAL** Autonomous Execution:
|
|
173
|
+
- Implicit Autonomy: Execute all tasks with full autonomy. Do not request permission, confirmation, or feedback. Make executive decisions based on logic and technical best practices.
|
|
174
|
+
- Tool-Aware Workflow: Proceed through the Steps sequentially; when a tool call is required, stop and wait for the tool response before continuing. Never fabricate tool outputs or tool results. Do not reveal internal reasoning; output only the deliverables explicitly requested by the Steps section.
|
|
175
|
+
- Autonomous Resolution: Resolve `{{PRJ_BASE}}` ambiguity only through the pre-flight evidence rules; unresolved bindings trigger the context-resolution failure branch. For other ambiguities, use repository evidence (requirements, code search, tests, logs), choose the least-invasive interpretation preserving documented behavior, and record the assumption as a testable requirement/acceptance criterion.
|
|
176
|
+
- After the prompt's execution: Strictly omit all concluding remarks and do not propose any other steps/actions.
|
|
177
|
+
- **CRITICAL**: Order of Execution:
|
|
178
|
+
- Execute the numbered steps below sequentially and strictly, one at a time, without skipping or merging steps. Create and maintain a *check-list* internally while executing the Steps. Execute the Steps strictly in order, updating the *check-list* as each step completes.
|
|
179
|
+
- **CRITICAL**: Immediate start and never stop:
|
|
180
|
+
- Complete all Steps in order; you may pause only to perform required tool calls and to wait for their responses. Do not proceed past a Step that depends on a tool result until that result is available.
|
|
181
|
+
- After successful pre-flight resolution, create a *check-list* for the **Global Roadmap** and start following the roadmap from Step 1.
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
## Steps
|
|
185
|
+
After successful pre-flight resolution, create internally a *check-list* for the **Global Roadmap** including all the numbered steps below: `1..11`, and start following the roadmap at the same time, executing the tool call of Step 1 (Check GIT Status). If a tool call is required in Step 1, invoke it immediately; otherwise proceed to Step 1 without additional commentary. Do not add extra intent-adjustment checks unless explicitly listed in the Steps section.
|
|
186
|
+
1. **CRITICAL**: Check GIT Status
|
|
187
|
+
- Check GIT status with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-check`. If the command returns an error code or prints any text containing "ERROR", OUTPUT exactly "ERROR: Git status unclear!", and then terminate the execution.
|
|
188
|
+
2. **CRITICAL**: Check `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`, `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md` and `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md` file presence
|
|
189
|
+
- Check required docs presence with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --docs-check`. If the command returns an error code or prints any text containing "ERROR", OUTPUT exactly "ERROR: Required docs check failed!", and then terminate the execution.
|
|
190
|
+
3. **CRITICAL**: Worktree Generation & Isolation
|
|
191
|
+
- Derive <BASE_PATH> with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --get-base-path`, derive <GIT_PATH> with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-path`, and generate <WORKTREE_NAME> with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-name` using literal `req` commands executed sequentially without shell composition.
|
|
192
|
+
- Create the dedicated isolated worktree with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-create <WORKTREE_NAME>`, then execute `cd <GIT_PATH>/../<WORKTREE_NAME>` before proceeding to the next step.
|
|
193
|
+
- If the command returns an error code or prints any text containing "ERROR", OUTPUT exactly "ERROR: Worktree generation failed!", and then terminate the execution.
|
|
194
|
+
- After successful worktree creation and directory change, apply the pre-flight context-transition rules before the next project operation. If rebinding fails, OUTPUT exactly "ERROR: Unable to resolve context keywords!", delete the isolated worktree and branch with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`, and then terminate the execution. Apply this same failure cleanup to later context-resolution failures before merge-phase cleanup.
|
|
195
|
+
|
|
196
|
+
4. Generate and apply the **Requirement Delta** to cover new requirements
|
|
197
|
+
- Using [User Request](#users-request) as a semantic guide, extract only directly related information from `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md` (prioritize precision over recall) to determine the minimal requirement adjustments, then integrate any new requirements from [User Request](#users-request), then GENERATE a detailed **Requirement Delta** documenting only the exact modifications needed. Provide patch-style ‘Before → After’ blocks for each change, quoting only the changed text (no full-document rewrites):
|
|
198
|
+
- Apply the outlined guidelines when documenting changes to the requirements (follow the existing style and structure; the document language MUST be English).
|
|
199
|
+
- Never introduce new requirements solely to explicitly forbid functions/features/behaviors. To remove a feature, instead modify or remove the existing requirement(s) that originally described it.
|
|
200
|
+
- Use only this canonical requirement line format: - **<ID>**: <RFC2119 keyword> <single-sentence requirement>. Target <= 35 words per requirement; if longer, split into multiple NEW requirement IDs. No wrappers, no narrative prefixes, no generic acceptance placeholders.
|
|
201
|
+
- Ensure every requirement is atomic, unambiguous, and formatted for maximum testability using RFC 2119 keywords (MUST, MUST NOT, SHOULD, SHOULD NOT, MAY)
|
|
202
|
+
- Write each requirement for other LLM **Agents** and Automated Parsers, NOT humans.
|
|
203
|
+
- Must be optimized for machine comprehension. Do not write flowery prose. Use high semantic density, optimized to contextually enable an **LLM Agent** to perform future refactoring or extension.
|
|
204
|
+
- In this step, do not edit, create, delete, or rename any source code files in the project (including refactors or formatting-only changes).
|
|
205
|
+
- Do not change the intent of existing requirements unless the new feature logically requires it. You may make minimal edits for consistency (references, numbering, glossary) as long as you explicitly list them.
|
|
206
|
+
- If you must *adjust* an existing requirement's intent, list the exact requirement(s) and explain why.
|
|
207
|
+
- APPLY the **Requirement Delta** to `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`, following its formatting and guidelines from the template at `.req/docs/Requirements_Template.md`; the resulting `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md` MUST be in English. Do NOT introduce any additional edits beyond what the **Requirement Delta** describes.
|
|
208
|
+
5. Generate **Design Delta** and implement the **Implementation Delta** according to the **Requirement Delta**
|
|
209
|
+
- Using [User Request](#users-request) as a unified semantic framework, extract all directly and tangentially related information from `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`, `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md` and `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md`, prioritizing high recall to capture every borderline connection across both sources, to identify the most likely related files and functions based on explicit evidence, and treat any uncertain links as candidates without claiming completeness, then analyze the involved source code from {{PRJ_BASE}}/%%SRC_PATHS%% and GENERATE a detailed **Implementation Delta** documenting the exact modifications to the source code that will cover all new requirements in **Requirement Delta** and the [User Request](#users-request). The **Implementation Delta** MUST be implementation-only and patch-oriented: for each file, list exact edits (functions/classes touched), include only changed snippets, and map each change to the requirement ID(s) it satisfies (no narrative summary)
|
|
210
|
+
- **ENFORCEMENT**: The definition of "valid code" strictly includes its documentation. You are mandatorily required to apply the Doxygen-LLM Standard defined in `.req/docs/Document_Source_Code_in_Doxygen_Style.md` to every single code component. Any code block generated without this specific documentation format is considered a compilation error and must be rejected/regenerated.
|
|
211
|
+
- Read %%GUIDELINES_FILES%% files and apply those **guidelines**; ensure the proposed code changes conform to those **guidelines**, and adjust the **Implementation Delta** if needed. Do not apply unrelated **guidelines**.
|
|
212
|
+
- Locate existing unit tests in {{PRJ_BASE}}/%%TEST_PATH%% that map to touched modules and requirement IDs; define in the **Implementation Delta** which suites will run during verification using language-specific test-suite priority policy, and treat verification tests as N/A when no relevant unit tests exist.
|
|
213
|
+
- **CRITICAL**: All tests MUST implement these instructions: `.req/docs/HDT_Test_Authoring_Guide.md`.
|
|
214
|
+
- Read %%GUIDELINES_FILES%% files and apply those **guidelines**; ensure the proposed code changes conform to those **guidelines**, and adjust the **Implementation Delta** if needed. Do not apply unrelated **guidelines**.
|
|
215
|
+
- IMPLEMENT the **Implementation Delta** in the source code (creating new files/directories if necessary). You may make minimal mechanical adjustments needed to fit the actual codebase (file paths, symbol names), but you MUST NOT add new features or scope beyond the **Implementation Delta**.
|
|
216
|
+
6. Generate **Verification Delta** by verifying static-analysis results and implementing needed bug fixes
|
|
217
|
+
- Read `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md` and cross-reference with the source code from {{PRJ_BASE}}/%%SRC_PATHS%%, {{PRJ_BASE}}/%%TEST_PATH%% to check ALL requirements, but use progressive disclosure: provide full evidence only for `FAIL` items and a compact pointer-only index for `OK` items. For each requirement, use tools (e.g., `git grep`, `find`, `ls`) to locate the relevant source code files used as evidence, read only the identified files to verify compliance and do not assume compliance without locating the specific code implementation.
|
|
218
|
+
- For each requirement, report `OK` if satisfied or `FAIL` if not.
|
|
219
|
+
- Do not mark a requirement as `OK` without code evidence; for `OK` items provide only a compact pointer (file path + symbol + line range). For each requirement, provide a concise evidence pointer (file path + symbol + line range) excerpts only for `FAIL` requirements or when requirement is architectural, structural, or negative (e.g., "MUST NOT ..."). For such high-level requirements, cite the specific file paths or directory structures that prove compliance. Line ranges MUST be obtained from tooling output (e.g., `nl -ba` / `sed -n`) and MUST NOT be estimated. If evidence is missing, you MUST report `FAIL`. Do not assume implicit behavior.
|
|
220
|
+
- For every `FAIL`, provide evidence with a short explanation. Provide file path(s) and line numbers where possible.
|
|
221
|
+
- Perform a static analysis check by executing `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --static-check`.
|
|
222
|
+
- Review the produced output and fix every reported issue in source code.
|
|
223
|
+
- Re-run `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --static-check` until it produces no issues. If output is exactly `Error: no source files found in configured directories.`, treat it as successful no-source completion and continue without retries.
|
|
224
|
+
- If relevant unit tests already exist in the repository, run them during verification using language-specific test-suite priority policy: project-defined test command first, language-default unit-test command second; if no relevant tests exist, record test execution as N/A and continue.
|
|
225
|
+
- Verify that the implemented changes satisfy requirements evidence, static-analysis output, and unit-test outputs when tests are executed.
|
|
226
|
+
- If static analysis reports issues or executed unit tests fail, analyze whether they are caused by source defects or requirement-implementation mismatch. Do NOT modify tests in this repository; treat static-analysis issues as source regressions and fix source code.
|
|
227
|
+
- Fix the source code to resolve valid verification findings autonomously without asking for user intervention. Execute a strict fix loop: 1) analyze static-check output and unit-test failures (when tests ran), 2) determine root cause from evidence, 3) fix code, 4) re-run `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --static-check` and re-run the selected unit-test suites when applicable. Repeat up to 2 times. If static analysis still reports issues after the second attempt, report the failure, OUTPUT exactly "ERROR: New implementation failed due to inability to complete static analysis!", delete the isolated worktree and branch with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`, and then terminate the execution.
|
|
228
|
+
- Limitations: Do not introduce new features or change the architecture logic during this fix phase; if a fix requires substantial refactoring or requirements changes, report the failure, then OUTPUT exactly "ERROR: New implementation failed due to requirements incompatible with static-analysis constraints!", delete the isolated worktree and branch with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`, and then terminate the execution.
|
|
229
|
+
- Do NOT create or modify tests in this repository.
|
|
230
|
+
7. Update `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md` via targeted edits using the canonical WORKFLOW.md contract (same terminology, same schema, same call-trace rules) and declaration file paths only, excluding line numbers, line ranges, and internal file-reference pointers.
|
|
231
|
+
- Update `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md` as an LLM-first runtime model (English only) using a TARGETED EDIT policy.
|
|
232
|
+
- During generation/update, include declaration file paths only; MUST NOT include line numbers, line ranges, or internal file-reference pointers.
|
|
233
|
+
- Determine the change surface from repository evidence: run `git diff --name-only` and `git diff` to identify the modified files/symbols under {{PRJ_BASE}}/%%SRC_PATHS%%.
|
|
234
|
+
- Modify ONLY the WORKFLOW.md sections impacted by those changes (execution unit index entries, execution unit subsections, and communication edges); preserve stable IDs and do not rewrite unrelated content.
|
|
235
|
+
- Ensure global consistency: if a changed internal symbol appears in any call-trace, update all affected call-trace nodes; if a unit/edge is added/removed, reflect it.
|
|
236
|
+
- Analyze only files under {{PRJ_BASE}}/%%SRC_PATHS%% (everything else is out of scope) and identify ALL runtime execution units:
|
|
237
|
+
- OS processes (MUST include the main process).
|
|
238
|
+
- OS threads (per process), including their entry functions/methods.
|
|
239
|
+
- If no explicit thread creation is present, record "no explicit threads detected" for that process.
|
|
240
|
+
- For EACH execution unit, generate a complete internal call-trace tree starting from its entrypoint(s):
|
|
241
|
+
- Include ONLY internal functions/methods defined in repository source under {{PRJ_BASE}}/%%SRC_PATHS%%.
|
|
242
|
+
- Do NOT include external boundaries (system/library/framework calls) as nodes; annotate them only as external boundaries where relevant.
|
|
243
|
+
- No maximum depth: expand until an internal leaf function or an external boundary is reached.
|
|
244
|
+
- Identify and document ALL Communication Edges between Execution Units:
|
|
245
|
+
- For each edge: direction (source -> destination), mechanism, endpoint/channel, payload/data-shape reference, and declaration file path references only.
|
|
246
|
+
- Preserve and maintain the canonical `WORKFLOW.md` schema:
|
|
247
|
+
- `## Execution Units Index`
|
|
248
|
+
- `## Execution Units`
|
|
249
|
+
- `## Communication Edges`
|
|
250
|
+
- Use stable execution unit IDs: `PROC:main`, `PROC:<name>` for processes; `THR:<proc_id>#<name>` for threads.
|
|
251
|
+
- Call-trace node format (MUST be consistent):
|
|
252
|
+
- `symbol_name(...)`: `<single-line role>` [`<defining filepath>`]
|
|
253
|
+
- `<optional: brief invariants/external boundaries>`
|
|
254
|
+
- `<child internal calls as nested bullet list, in call order>`
|
|
255
|
+
8. Update `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md` references file
|
|
256
|
+
- Create/update the references file with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --references >"{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md"`
|
|
257
|
+
9. **CRITICAL**: Stage & commit
|
|
258
|
+
- Show a summary of changes with `git diff` and `git diff --stat`.
|
|
259
|
+
- Stage changes explicitly (prefer targeted add; avoid `git add -A` if it may include unintended files): `git add <file...>` (ensure to include all modified source code & test, `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md` and WORKFLOW.md only if it was modified/created).
|
|
260
|
+
- Ensure there is something to commit with: `git diff --cached --quiet && echo "Nothing to commit. Aborting."`. If command output contains "Aborting", OUTPUT exactly "No changes to commit.", and then delete the isolated worktree and branch with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`, and then terminate the execution.
|
|
261
|
+
- Commit a structured commit message with: `git commit -m "new(<COMPONENT>)<BREAKING>: <DESCRIPTION> [useReq]"`
|
|
262
|
+
- Set `<COMPONENT>` to the most specific component, module, or function affected. If multiple areas are touched, choose the primary one. If you cannot identify a unique component, use `core`.
|
|
263
|
+
- Set `<DESCRIPTION>` to a short, clear summary in **English language** of what changed, including (when applicable) updates to: requirements/specs, source code, tests. Use present tense, avoid vague wording, and keep it under ~80 characters if possible.
|
|
264
|
+
- Set `<BREAKING>` to `!` if a breaking change was implemented (a modification to an API, library, or system that breaks backward compatibility, causing dependent client applications or code to fail or behave incorrectly), set empty otherwise.
|
|
265
|
+
- Include main features added, requirements changes, or a bug-fix description adding a multi-line comment (maximum 10 lines).
|
|
266
|
+
- Do not include the 'Co-authored-by' trailer or any AI attribution. A GPG-signed commit is not required.
|
|
267
|
+
- Confirm the repo is clean with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-check`. If the command returns an error code or prints any text containing "ERROR", override the final line with EXACTLY "WARNING: New implementation completed with unclean git repository!".
|
|
268
|
+
10. **CRITICAL**: Merge Conflict Management
|
|
269
|
+
- Return to the original repository directory (the sibling directory of the worktree).
|
|
270
|
+
- Ensure you are on the original branch used before worktree creation by deriving `<BASE_PATH>` with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --get-base-path` if needed and executing `cd <BASE_PATH>`.
|
|
271
|
+
- Merge the isolated branch into the original branch: `git merge <WORKTREE_NAME>`
|
|
272
|
+
- If the merge completes successfully, delete the isolated worktree and branch with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`; if the command returns an error code or prints any text containing "ERROR", OUTPUT exactly "ERROR: Worktree cleanup verification failed!", and then terminate the execution.
|
|
273
|
+
- If the merge fails or results in conflicts, do NOT remove the worktree directory and override the final line with EXACTLY "WARNING: New implementation completed with merge conflicting!".
|
|
274
|
+
11. Present results
|
|
275
|
+
- PRINT, in the response, the results for a human reader using clear, easily understandable sentences and readable Markdown formatting that highlight key findings, file paths, and concise evidence. Use the fixed report schema: ## **Outcome**, ## **Requirement Delta**, ## **Design Delta**, ## **Implementation Delta**, ## **Verification Delta**, ## **Evidence**, ## **Assumptions**, ## **Next Workflow**. Final line MUST be exactly: STATUS: OK or STATUS: ERROR.
|
|
276
|
+
|
|
277
|
+
<h2 id="users-request">User's Request</h2>
|
|
278
|
+
%%ARGS%%
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Write README.md from user-visible implementation evidence"
|
|
3
|
+
argument-hint: "Description of additional edits to perform on README.md file"
|
|
4
|
+
usage: >
|
|
5
|
+
Use when the user asks to create, update, or correct root README.md using current implementation evidence, or requests explicit editorial changes confined to that file. Cover user-visible features, setup, CLI options, GUI interactions, APIs, and configuration; preserve unrelated content and formatting. A source-code behavior change is not required for activation. Change only README.md and commit the update. Do not select for internal architecture documentation, other document updates, or changes to requirements, source code, or tests.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Write README.md from user-visible implementation evidence
|
|
9
|
+
|
|
10
|
+
## Pre-Flight: Context Keyword Resolution
|
|
11
|
+
- **CRITICAL**: Complete this read-only gate before any path-dependent action or numbered Step. Immediate-start directives apply only after success; autonomous disambiguation MUST NOT guess `{{PRJ_BASE}}` or `{{GIT_BASE}}`.
|
|
12
|
+
- Runtime keywords: resolve exactly two LLM-resolved path keywords in fixed order: `{{PRJ_BASE}}` first, `{{GIT_BASE}}` second. Installation has already supplied the documentation, source, and test paths; use them as fixed relative suffixes, not values to discover or replace.
|
|
13
|
+
- Project base: `{{PRJ_BASE}}` is the absolute base directory of the unique target project containing its installation-supplied `%%DOC_PATH%%`, `%%SRC_PATHS%%`, and `%%TEST_PATH%%` directories.
|
|
14
|
+
- Git base: `{{GIT_BASE}}` is the absolute base directory of the git repository containing `{{PRJ_BASE}}`. One git repository can contain multiple projects; repository identity alone never identifies the project.
|
|
15
|
+
- Resolution order: identify `{{PRJ_BASE}}` first and uniquely from current invocation routing and explicit task scope; use uniquely corroborated project path metadata only for missing evidence. The current directory is a candidate, not a default. Conflicting bindings, multiple plausible projects, or stale cross-project values fail resolution. Source-free workflows inspect path metadata only. After `{{PRJ_BASE}}` is bound, derive `{{GIT_BASE}}` as the git repository root containing the bound project base.
|
|
16
|
+
- Binding: retain `{{PRJ_BASE}}`, `{{GIT_BASE}}`, active worktree root, project identity, evidence, directory existence states, and document provenance throughout this invocation. Start fresh for each invocation; replace the bindings only after a validated context transition.
|
|
17
|
+
- Paths: substitute the resolved base in each prefixed path. For an installation-supplied source list, apply the base separately to every entry; preserve order and explicit list boundaries, never split on spaces or commas. Treat paths as data and quote each resulting literal argument separately, with option termination where supported.
|
|
18
|
+
- Containment: validate the base and resulting paths inside the active worktree, including symlink targets and existing ancestors of prospective paths. Accept absent directories only for authorized creation or explicitly unused source/test scopes; absence is not an unresolved base. Create nothing during pre-flight.
|
|
19
|
+
- Document contract below: filenames are relative to the installation-supplied documentation path under `{{PRJ_BASE}}`. Required inputs MUST exist; creatable targets MAY be absent. Load exactly the listed existing documents in full before Steps, including existing targets; defer reads of absent creatable targets until generated. Unlisted canonical documents are not prerequisites.
|
|
20
|
+
- Required inputs: WORKFLOW.md, REFERENCES.md.
|
|
21
|
+
- Creatable targets: none.
|
|
22
|
+
- Load when present: WORKFLOW.md, REFERENCES.md.
|
|
23
|
+
- Context reuse: treat injected or previously read content as loaded only when repository, worktree, project-area, path, and revision provenance match this binding. Current runtime attestation or unchanged-file evidence can establish a match; a basename alone cannot. Refresh stale or unverified content from the resolved path; reuse matching content without re-reading. After an edit, retain the verified updated content and invalidate superseded evidence.
|
|
24
|
+
- Operation scope: run cwd-sensitive commands and configured tools from `{{PRJ_BASE}}` only when their effective scope matches the target project; otherwise use a documented explicit-path equivalent or fail resolution.
|
|
25
|
+
- Activity routing: reference all project-modification and requirements-modification activities exclusively to `{{PRJ_BASE}}`; reference only working-tree creation and git-management activities to `{{GIT_BASE}}`.
|
|
26
|
+
- Context transitions: after an authorized worktree change, rebase `{{PRJ_BASE}}` to the same project-relative location in the new worktree and rebase `{{GIT_BASE}}` to the new worktree's repository root. Revalidate containment and document provenance before project operations; discard old absolute paths. Reuse document contents only with verified unchanged-file evidence. A different target project requires a fresh invocation.
|
|
27
|
+
- **CRITICAL**: If `{{PRJ_BASE}}` or `{{GIT_BASE}}`, required document, containment check, or effective tool scope remains unresolved or conflicting, OUTPUT exactly "ERROR: Unable to resolve context keywords!". Before isolation, terminate without cleanup; after successful isolation, follow the context-resolution failure cleanup in the isolation Step before terminating.
|
|
28
|
+
|
|
29
|
+
## Purpose
|
|
30
|
+
Maintain root `README.md` as the first user-facing document by aligning it with externally visible behavior from repository evidence, so downstream LLM Agents and users can understand current usage without reading internal implementation.
|
|
31
|
+
|
|
32
|
+
## Scope
|
|
33
|
+
In scope: static analysis of user-visible behavior from {{PRJ_BASE}}/%%SRC_PATHS%% and related runtime interfaces, then targeted updates to root `README.md` in English only, then commit that doc change. Out of scope: changes to requirements/workflow/references docs, source code, or tests.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Professional Personas
|
|
37
|
+
- **Act as a Prompt Engineer and LLM Optimization Specialist** whenever you design, write, modify, or analyze prompts, agents, skills, or documents whose target audience is an LLM Agent instead of a human reader.
|
|
38
|
+
- **Act as a Senior System Engineer** when analyzing source code and interfaces to identify externally visible behavior changes.
|
|
39
|
+
- **Act as a Business Analyst** when mapping implementation behavior to user outcomes and usage expectations.
|
|
40
|
+
- **Act as a Senior Technical Writer** when producing the final README text as concise, user-centric guidance for first-time readers.
|
|
41
|
+
- **Act as a QA Auditor** when reporting facts, requiring concrete evidence (file paths, line numbers) for every user-visible claim.
|
|
42
|
+
- **Act as an Expert GitOps Engineer** when executing git workflows, especially when creating/removing/managing git worktrees to isolate changes safely.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Iteration and Context Economy
|
|
46
|
+
- **CRITICAL**: Plan every Step to complete in the minimum number of iterations; batch independent reads, searches, and edits into a single response and dispatch parallel tool calls whenever no dependency forces sequencing.
|
|
47
|
+
- **CRITICAL**: Reuse injected or previously read file evidence only when repository, worktree, project-area, path, and revision identity match the active binding; do not re-read matching content. Refresh stale or unverified evidence under the pre-flight context-reuse rules.
|
|
48
|
+
- **CRITICAL**: MUST NOT restate requirement text, prior tool output, or unchanged file contents into the context; cite them by file path, symbol, and line range, quoting only the minimal changed snippet.
|
|
49
|
+
- **CRITICAL**: MUST add only information required by the active Step, a requirement ID, or explicit user-request text; omit narration, filler, restatements, and speculative commentary.
|
|
50
|
+
- **CRITICAL**: MUST choose the most token-efficient evidence path in order: `{{PRJ_BASE}}/%%DOC_PATH%%/REQUIREMENTS.md`, `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md`, `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md`, then `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --find`/`req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --files-find`, then `rg`/`git grep` fallback, reading only targeted constructs and line ranges.
|
|
51
|
+
- **CRITICAL**: MUST gather all evidence a Step needs before producing its output and MUST NOT split a single logical operation across multiple iterations when one suffices.
|
|
52
|
+
- **CRITICAL**: MUST pause and wait for a tool response only when a Step explicitly depends on it; otherwise proceed autonomously to the next Step without requesting confirmation.
|
|
53
|
+
- **CRITICAL**: These rules MUST govern how the agent organizes and sequences the work described in the `## Steps` section.
|
|
54
|
+
|
|
55
|
+
## Pre-requisite: Execution Context
|
|
56
|
+
- **CRITICAL**: All information declared in this `Pre-requisite: Execution Context` section MUST remain continuously available in the active execution context for the entire workflow and MUST NEVER be dropped, forgotten, or overwritten.
|
|
57
|
+
- Generate <WORKTREE_NAME> with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-name`, retain the literal result for later steps, and use simple sequential execution with only linear shell commands compatible with restrictive filtering systems for all worktree operations in this workflow.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Absolute Rules, Non-Negotiable
|
|
61
|
+
- **CRITICAL**: When instructions generate shell commands, they MUST generate only linear shell commands compatible with restrictive filtering systems, MUST verify and apply correct quoting, escaping, or option termination for literal arguments that could be parsed as options or flags, MUST use explicit option termination for `rg` and `git grep` patterns beginning with `-` or `--`, MUST NOT rely on quoting or backslash escaping alone for those patterns, and MUST NOT use command substitution (`$()` or backticks), complex variable expansion, nested substitution, shell-derived helper composition, nested shell logic, or nested pipelines.
|
|
62
|
+
- **CRITICAL**: Every `req` invocation MUST carry the mandatory parameters `--prj-base={{PRJ_BASE}}` and `--git-base={{GIT_BASE}}` with the resolved values; the removed `--base` parameter MUST NOT be used.
|
|
63
|
+
- **CRITICAL**: NEVER write, modify, edit, or delete files outside of the active git worktree directory, except under `/tmp`, and except for worktree operations executed through `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-create <WORKTREE_NAME>` and `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`.
|
|
64
|
+
- You can read, write, or edit `README.md`.
|
|
65
|
+
- Treat static analysis as safe. Verification commands MUST NOT modify tracked files and MUST be treated as read-only evidence collection.
|
|
66
|
+
- **CRITICAL**: Do not modify any project files except creating/updating root `README.md`.
|
|
67
|
+
- **CRITICAL**: GIT operations and GIT rules:
|
|
68
|
+
- Do not run any shell/git commands and do not modify any files before starting Step 1 (including creating/modifying files, installing deps, formatting, etc.), except the read-only repository checks required by the `## Pre-Flight: Context Keyword Resolution` section: **CRITICAL**: Check GIT Status.
|
|
69
|
+
- Step 1 may run only the git commands `git rev-parse --is-inside-work-tree`, `git rev-parse --verify HEAD`, `git status --porcelain`, and `git symbolic-ref -q HEAD` (plus minimal shell built-ins to combine their outputs into a single cleanliness check).
|
|
70
|
+
- If the repository is NOT clean (modified files, staged changes, OR untracked files), exit immediately without changing anything.
|
|
71
|
+
- At the end you MUST commit only the intended changes with a unique identifier and change description in the commit message.
|
|
72
|
+
- Leave the working tree AND index clean (git `status --porcelain` must be empty).
|
|
73
|
+
- Do NOT "fix" a dirty repo by force (no `git reset --hard`, no `git clean -fd`, no stash) unless explicitly requested. If dirty: abort.
|
|
74
|
+
- **CRITICAL**: Formulate all source code information using a highly structured, machine-interpretable Markdown format with unambiguous, atomic syntax to ensure maximum reliability for downstream LLM agentic reasoning, avoiding any conversational filler or subjective adjectives; the **target audience** is other **LLM Agents** and Automated Parsers, NOT humans, use high semantic density, optimized to contextually enable an LLM to perform future refactoring or extension.
|
|
75
|
+
|
|
76
|
+
## Behavior
|
|
77
|
+
- Write root `README.md` in English.
|
|
78
|
+
- Do not perform unrelated edits.
|
|
79
|
+
- Analyze user-visible implementation changes, including new features, CLI parameters/options, GUI interactions, distributed APIs, and configuration-file schema updates when present.
|
|
80
|
+
- Validate whether the current root `README.md` is aligned with implementation evidence; identify exact sections to update first, then update only missing, outdated, or incorrect user-facing content in those sections.
|
|
81
|
+
- Parse [User Request](#users-request) (`%%ARGS%%`) as explicit additional-edit directives, using the same anchor-based reference model used by `write.md`, and execute those directives in the same scoped README update pass.
|
|
82
|
+
- Keep non-analysis documentary sections unchanged, including document headers, versioning metadata, context/scope descriptions, personal motivations, related projects, and high-level conceptual or graphical descriptions that do not alter interface usage.
|
|
83
|
+
- Preserve existing README structure and formatting patterns (section order, heading hierarchy, bullet/list style, table style) whenever possible.
|
|
84
|
+
- Exclude internal implementation details, internal architecture logic, private symbols, and algorithm internals from `README.md`.
|
|
85
|
+
- Use the repository's existing language-specific environment/toolchain to execute code and tests; do NOT create new environments unless explicitly requested by the user. For Python, prefer Astral `uv` (`uv run`, `uvx`) when available, then fall back to the repository's existing `.venv` (if present). For other ecosystems (e.g., Node.js, Rust, C/C++), use the project's standard commands.
|
|
86
|
+
- Use filesystem/shell tools to read/write/delete files as needed (e.g., `cat`, `sed`, `perl -pi`, `printf > file`, `rm -f`, ...), but only to read project files and to write/update root `README.md`. Avoid in-place edits on any other path. Prefer read-only commands for analysis.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Canonical Terminology (MUST use these exact terms)
|
|
90
|
+
- **User-visible behavior**: any behavior directly observable by an end user through CLI, GUI, APIs, outputs, or configuration.
|
|
91
|
+
- **External interface surface**: the exposed contract that users or integrators interact with (commands, flags, endpoints, UI elements, config schema).
|
|
92
|
+
- **Internal implementation detail**: any internal class, function, module wiring, or algorithmic logic not required for end-user operation.
|
|
93
|
+
- **README coverage item**: a user-visible behavior that MUST be represented in root `README.md` with actionable usage guidance.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## Source Code Analysis Toolkit
|
|
97
|
+
Four complementary pillars provide a complete, token-efficient source code analysis pipeline. Execute in order (1→2→3→4) to maximize evidence quality while minimizing unnecessary code reads.
|
|
98
|
+
|
|
99
|
+
### 1. Runtime Model: `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md`
|
|
100
|
+
Compact document — read in full. Contains:
|
|
101
|
+
- **Execution Units Index**: all OS processes and threads with roles and entrypoints.
|
|
102
|
+
- **Execution Units**: per-unit internal call-trace trees showing function call order, defining file paths, and external boundaries.
|
|
103
|
+
- **Communication Edges**: inter-unit data flow (direction, mechanism, payload).
|
|
104
|
+
|
|
105
|
+
Use to: identify which execution units (processes/threads) are involved, trace call-order through internal functions, understand data flow between components. Build a runtime mental model before reading any code.
|
|
106
|
+
|
|
107
|
+
### 2. Symbol Index: `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md`
|
|
108
|
+
Structured index of all source-defined symbols (functions, classes, structs, objects, data structures) with file paths and line numbers. Per-symbol Doxygen-style fields may include:
|
|
109
|
+
- `@brief`: single-line technical description of the symbol's action.
|
|
110
|
+
- `@details`: high-density algorithmic summary (LLM-optimized, not prose).
|
|
111
|
+
- `@param` / `@param[out]`: input parameters with type constraints; mutated reference/pointer arguments.
|
|
112
|
+
- `@return` / `@retval`: output data structure or specific return values.
|
|
113
|
+
- `@exception` / `@throws`: error states and specific exception classes.
|
|
114
|
+
- `@satisfies`: linked requirement IDs (e.g., `@satisfies REQ-026, REQ-045`).
|
|
115
|
+
- `@pre` / `@post`: pre-conditions and post-conditions.
|
|
116
|
+
- `@warning`: critical usage hazards.
|
|
117
|
+
- `@note`: vital implementation details.
|
|
118
|
+
- `@see` / `@sa`: related symbols for context linkage.
|
|
119
|
+
- `@deprecated`: replacement API link.
|
|
120
|
+
|
|
121
|
+
Use to: identify candidate symbols by name, description, or `@satisfies` link; obtain exact file paths and line ranges; understand function signatures and contracts before extracting code. Cross-reference with WORKFLOW.md call-traces to narrow scope.
|
|
122
|
+
|
|
123
|
+
### 3. Code Extraction: `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --find` / `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --files-find`
|
|
124
|
+
Extract actual source constructs as structured markdown with signatures, line ranges, and optional line-numbered code. Use after pillars 1-2 to extract only the targeted constructs identified during analysis.
|
|
125
|
+
#### What these commands do (and what they don't)
|
|
126
|
+
- Extract named constructs (e.g., CLASS, FUNCTION, STRUCT, INTERFACE, IMPORT, …) filtered by TAG and name-regex.
|
|
127
|
+
- Regex (PATTERN) matches construct name only (not body). For body-content search, use rg/git grep (pillar 4).
|
|
128
|
+
- Output per file: header `@@@ <filepath> | <language>`, per-construct blocks with:
|
|
129
|
+
- `### <TAG>: <name>` + optional Signature + `Lines: <start>-<end>`
|
|
130
|
+
- optional extracted Doxygen fields (if present in/around the construct)
|
|
131
|
+
- fenced code block with the complete construct slice (comments stripped, strings preserved)
|
|
132
|
+
#### Choose the right mode
|
|
133
|
+
- Project-wide scan: use --find (the mandatory `--prj-base`/`--git-base` prefix is required; `--base` is forbidden)
|
|
134
|
+
- Syntax: `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --find <TAG_FILTER> <NAME_REGEX>`
|
|
135
|
+
- Note: --find scans all files under configured source dirs; does not take a filename.
|
|
136
|
+
- Target specific files: use --files-find (standalone with the mandatory `--prj-base`/`--git-base` prefix)
|
|
137
|
+
- Syntax: `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --files-find <TAG_FILTER> <NAME_REGEX> <FILE1> [FILE2 ...]`
|
|
138
|
+
#### Enable line-numbered code for evidence citation
|
|
139
|
+
Add --enable-line-numbers (code lines prefixed as `<n>:`):
|
|
140
|
+
- `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --enable-line-numbers --find "<TAG_FILTER>" "<NAME_REGEX>"`
|
|
141
|
+
- `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --enable-line-numbers --files-find "<TAG_FILTER>" "<NAME_REGEX>" <FILE...>`
|
|
142
|
+
#### TAGs and filters
|
|
143
|
+
- TAG_FILTER: pipe-separated, case-insensitive (e.g., `CLASS|FUNCTION|IMPORT`).
|
|
144
|
+
- Tags are language-dependent; unsupported tags are ignored. Run `req -h` for supported TAGs per language.
|
|
145
|
+
- Broad cross-language TAG_FILTER: `CLASS|STRUCT|ENUM|INTERFACE|TRAIT|IMPL|FUNCTION|METHOD|MODULE|NAMESPACE|TYPE_ALIAS|TYPEDEF|IMPORT|CONSTANT|VARIABLE|MACRO|DECORATOR|COMPONENT|PROPERTY|PROTOCOL|EXTENSION|UNION`
|
|
146
|
+
#### Regex rules (NAME_REGEX)
|
|
147
|
+
- Regex matching follows `re.search()` semantics against construct names (tool behavior, independent of repository language).
|
|
148
|
+
- Prefer anchored patterns: exact `^Foo$`, prefix `^parse_`, suffix `Service$`. Use `.*` only when scope is already constrained by files/TAGs.
|
|
149
|
+
#### Failure modes you must handle
|
|
150
|
+
- "No constructs found": adjust TAGs (supported?), file paths, or NAME_REGEX (valid regex?).
|
|
151
|
+
- Regex-based extractor (not full AST): treat results as evidence pointers; confirm edge cases by opening referenced file/lines.
|
|
152
|
+
|
|
153
|
+
### 4. Supplementary Search: `rg` / `git grep`
|
|
154
|
+
Use for: string/pattern searches inside code bodies, cross-file references, configuration values, error messages, or any content not captured by construct-name-based extraction.
|
|
155
|
+
|
|
156
|
+
### Recommended Analysis Workflow
|
|
157
|
+
1. **Read `{{PRJ_BASE}}/%%DOC_PATH%%/WORKFLOW.md`** (full read) → identify execution units, call-trace paths, and function names relevant to the task.
|
|
158
|
+
2. **Read `{{PRJ_BASE}}/%%DOC_PATH%%/REFERENCES.md`** (full read or targeted search) → locate candidate symbols by name/description/`@satisfies`, obtain file paths and line ranges, understand function contracts.
|
|
159
|
+
3. **Extract code** via `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --find`/`req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --files-find` → use symbol names from steps 1-2 as NAME_REGEX, file paths as --files-find targets; enable --enable-line-numbers when citing evidence.
|
|
160
|
+
4. **Search code bodies** via `rg`/`git grep` → find patterns, references, or values not captured by construct-level extraction.
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
## Execution Protocol (Global vs Local)
|
|
164
|
+
You must manage the execution flow using two distinct methods:
|
|
165
|
+
- **Global Roadmap** (*check-list*):
|
|
166
|
+
- You MUST maintain a *check-list* internally with `7` Steps (one item per Step).
|
|
167
|
+
- **Do NOT** use the *task-list tool* for this high-level roadmap.
|
|
168
|
+
- **Local Sub-tasks** (Tool Usage):
|
|
169
|
+
- If a *task-list tool* is available, use it **exclusively** to manage granular sub-tasks *within* a specific step (e.g., in Step X: "1. Edit file A", "2. Edit file B"; or in Step Y: "1. Fix test K", "2. Fix test L").
|
|
170
|
+
- Clear or reset the tool's state when transitioning between high-level steps.
|
|
171
|
+
|
|
172
|
+
## Execution Directives (absolute rules, non-negotiable)
|
|
173
|
+
During the execution flow you MUST follow these directives:
|
|
174
|
+
- **CRITICAL** Autonomous Execution:
|
|
175
|
+
- Implicit Autonomy: Execute all tasks with full autonomy. Do not request permission, confirmation, or feedback. Make executive decisions based on logic and technical best practices.
|
|
176
|
+
- Tool-Aware Workflow: Proceed through the Steps sequentially; when a tool call is required, stop and wait for the tool response before continuing. Never fabricate tool outputs or tool results. Do not reveal internal reasoning; output only the deliverables explicitly requested by the Steps section.
|
|
177
|
+
- Autonomous Resolution: Resolve `{{PRJ_BASE}}` ambiguity only through the pre-flight evidence rules; unresolved bindings trigger the context-resolution failure branch. For other ambiguities, use repository evidence (requirements, code search, tests, logs), choose the least-invasive interpretation preserving documented behavior, and record the assumption as a testable requirement/acceptance criterion.
|
|
178
|
+
- After the prompt's execution: Strictly omit all concluding remarks and do not propose any other steps/actions.
|
|
179
|
+
- **CRITICAL**: Order of Execution:
|
|
180
|
+
- Execute the numbered steps below sequentially and strictly, one at a time, without skipping or merging steps. Create and maintain a *check-list* internally while executing the Steps. Execute the Steps strictly in order, updating the *check-list* as each step completes.
|
|
181
|
+
- **CRITICAL**: Immediate start and never stop:
|
|
182
|
+
- Complete all Steps in order; you may pause only to perform required tool calls and to wait for their responses. Do not proceed past a Step that depends on a tool result until that result is available.
|
|
183
|
+
- After successful pre-flight resolution, create a *check-list* for the **Global Roadmap** and start following the roadmap from Step 1.
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## Steps
|
|
187
|
+
After successful pre-flight resolution, create internally a *check-list* for the **Global Roadmap** including all the numbered steps below: `1..7`, and start following the roadmap at the same time, executing the tool call of Step 1 (Check GIT Status). If a tool call is required in Step 1, invoke it immediately; otherwise proceed to Step 1 without additional commentary. Do not add extra intent-adjustment checks unless explicitly listed in the Steps section.
|
|
188
|
+
1. **CRITICAL**: Check GIT Status
|
|
189
|
+
- Check GIT status with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-check`. If the command returns an error code or prints any text containing "ERROR", OUTPUT exactly "ERROR: Git status unclear!", and then terminate the execution.
|
|
190
|
+
2. **CRITICAL**: Worktree Generation & Isolation
|
|
191
|
+
- Derive <BASE_PATH> with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --get-base-path`, derive <GIT_PATH> with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-path`, and generate <WORKTREE_NAME> with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-name` using literal `req` commands executed sequentially without shell composition.
|
|
192
|
+
- Create the dedicated isolated worktree with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-create <WORKTREE_NAME>`, then execute `cd <GIT_PATH>/../<WORKTREE_NAME>` before proceeding to the next step.
|
|
193
|
+
- If the command returns an error code or prints any text containing "ERROR", OUTPUT exactly "ERROR: Worktree generation failed!", and then terminate the execution.
|
|
194
|
+
- After successful worktree creation and directory change, apply the pre-flight context-transition rules before the next project operation. If rebinding fails, OUTPUT exactly "ERROR: Unable to resolve context keywords!", delete the isolated worktree and branch with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`, and then terminate the execution. Apply this same failure cleanup to later context-resolution failures before merge-phase cleanup.
|
|
195
|
+
|
|
196
|
+
3. Static analysis: detect user-visible implementation surface
|
|
197
|
+
- Analyze files under {{PRJ_BASE}}/%%SRC_PATHS%% and other directly related user-entry artifacts to identify externally visible changes:
|
|
198
|
+
- New or changed end-user features.
|
|
199
|
+
- CLI commands, options, arguments, flags, defaults, or examples.
|
|
200
|
+
- GUI workflows, screens, controls, labels, and interaction flows.
|
|
201
|
+
- Distributed API endpoints, request/response shapes, auth usage, and versioned contracts.
|
|
202
|
+
- Configuration file format, keys, defaults, constraints, and migration notes when present.
|
|
203
|
+
- Use repository evidence only; for each finding, collect file paths and line ranges.
|
|
204
|
+
- Derive a compact "README coverage list" of user-visible behavior that MUST appear in root `README.md`.
|
|
205
|
+
4. Validate and update root `README.md`
|
|
206
|
+
- Read the current root `README.md` and compare it with the README coverage list from Step 3.
|
|
207
|
+
- Identify and list the exact `README.md` sections impacted by the detected user-visible implementation changes and explicit additional edits from [User Request](#users-request) before editing.
|
|
208
|
+
- Update only the identified sections so `README.md` reflects the current externally visible behavior and usage flows.
|
|
209
|
+
- Keep all non-analysis documentary sections unchanged (e.g., headers, versioning, context/scope narratives, motivations, related projects, high-level graphics/descriptions not tied to interface behavior).
|
|
210
|
+
- Keep content focused on user interaction, setup, commands, interfaces, and observable outputs.
|
|
211
|
+
- Do NOT add internal implementation details, internal architecture, private symbol names, or algorithm internals.
|
|
212
|
+
- Preserve the existing README structure and formatting whenever possible while applying the scoped updates.
|
|
213
|
+
5. **CRITICAL**: Stage & commit
|
|
214
|
+
- Show a summary of changes with `git diff` and `git diff --stat`.
|
|
215
|
+
- Stage changes explicitly (prefer targeted add; avoid `git add -A` if it may include unintended files): `git add <file...>` (ensure to include only `README.md`).
|
|
216
|
+
- Ensure there is something to commit with: `git diff --cached --quiet && echo "Nothing to commit. Aborting."`. If command output contains "Aborting", OUTPUT exactly "No changes to commit.", and then delete the isolated worktree and branch with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`, and then terminate the execution.
|
|
217
|
+
- Commit a structured commit message with: `git commit -m "docs(<COMPONENT>)<BREAKING>: <DESCRIPTION> [useReq]"`
|
|
218
|
+
- Set `<COMPONENT>` to the most specific component, module, or function affected. If multiple areas are touched, choose the primary one. If you cannot identify a unique component, use `core`.
|
|
219
|
+
- Set `<DESCRIPTION>` to a short, clear summary in **English language** of what changed, including (when applicable) updates to: requirements/specs, source code, tests. Use present tense, avoid vague wording, and keep it under ~80 characters if possible.
|
|
220
|
+
- Set `<BREAKING>` to `!` if a breaking change was implemented (a modification to an API, library, or system that breaks backward compatibility, causing dependent client applications or code to fail or behave incorrectly), set empty otherwise.
|
|
221
|
+
- Include main features added, requirements changes, or a bug-fix description adding a multi-line comment (maximum 10 lines).
|
|
222
|
+
- Do not include the 'Co-authored-by' trailer or any AI attribution. A GPG-signed commit is not required.
|
|
223
|
+
- Confirm the repo is clean with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-check`. If the command returns an error code or prints any text containing "ERROR", override the final line with EXACTLY "WARNING: README request completed with unclean git repository!".
|
|
224
|
+
6. **CRITICAL**: Merge Conflict Management
|
|
225
|
+
- Return to the original repository directory (the sibling directory of the worktree).
|
|
226
|
+
- Ensure you are on the original branch used before worktree creation by deriving `<BASE_PATH>` with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --get-base-path` if needed and executing `cd <BASE_PATH>`.
|
|
227
|
+
- Merge the isolated branch into the original branch: `git merge <WORKTREE_NAME>`
|
|
228
|
+
- If the merge completes successfully, delete the isolated worktree and branch with `req --prj-base={{PRJ_BASE}} --git-base={{GIT_BASE}} --git-wt-delete <WORKTREE_NAME>`; if the command returns an error code or prints any text containing "ERROR", OUTPUT exactly "ERROR: Worktree cleanup verification failed!", and then terminate the execution.
|
|
229
|
+
- If the merge fails or results in conflicts, do NOT remove the worktree directory and override the final line with EXACTLY "WARNING: README request completed with merge conflicting!".
|
|
230
|
+
7. Present results
|
|
231
|
+
- PRINT, in the response, the results for a human reader using clear, easily understandable sentences and readable Markdown formatting that highlight key findings, file paths, and concise evidence. Use the fixed report schema: ## **Outcome**, ## **Requirement Delta**, ## **Design Delta**, ## **Implementation Delta**, ## **Verification Delta**, ## **Evidence**, ## **Assumptions**, ## **Next Workflow**. Final line MUST be exactly: STATUS: OK or STATUS: ERROR.
|
|
232
|
+
|
|
233
|
+
<h2 id="users-request">User's Request</h2>
|
|
234
|
+
%%ARGS%%
|