ai-workflow-init 1.2.2 → 1.2.4

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.
@@ -1,5 +1,9 @@
1
1
  Compare current implementation against planning and implementation notes.
2
2
 
3
+ ## Workflow Alignment
4
+ - Provide brief status updates (1–3 sentences) before/after important actions.
5
+ - Provide a high-signal summary at completion highlighting key mismatches and next steps.
6
+
3
7
  1) Ask me for:
4
8
  - Feature name (if not provided)
5
9
  - Then locate docs by feature name:
@@ -1,5 +1,9 @@
1
1
  You are helping me perform a local code review **before** I push changes. This review is restricted to standards conformance only.
2
2
 
3
+ ## Workflow Alignment
4
+ - Provide brief status updates (1–3 sentences) before/after important actions.
5
+ - Provide a high-signal summary at completion highlighting key findings and impact.
6
+
3
7
  ## Step 1: Gather Context (minimal)
4
8
  - Ask for feature name if not provided (must be kebab-case).
5
9
  - Then locate and read:
@@ -14,6 +18,15 @@ You are helping me perform a local code review **before** I push changes. This r
14
18
  - **Do NOT** provide design opinions, performance guesses, or alternative architectures.
15
19
  - **Do NOT** infer requirements beyond what standards explicitly state.
16
20
 
21
+ ### Automated Checks (recommended)
22
+ - Detect tools from project config and run non-interactive checks:
23
+ - JS/TS: `npx eslint .` (or `pnpm eslint .`), consider `--max-warnings=0`; type checks with `npx tsc --noEmit`
24
+ - Python: `ruff .` or `flake8 .`; type checks with `mypy .` or `pyright`
25
+ - Go: `golangci-lint run` or `go vet ./...`
26
+ - Rust: `cargo clippy -- -D warnings`
27
+ - Java: `./gradlew check` or `mvn -q -DskipTests=false -Dspotbugs.failOnError=true verify`
28
+ - Use results to focus the review; still report only clear violations per standards.
29
+
17
30
  ## Step 3: File-by-File Review (standards violations only)
18
31
  For every relevant file, report ONLY standards violations per the two docs above. Do not assess broader design or run git commands.
19
32
 
@@ -2,6 +2,11 @@
2
2
  ## Goal
3
3
  Generate a planning doc at `docs/ai/planning/feature-{name}.md` using the template, with minimal, actionable content aligned to the 4-phase workflow.
4
4
 
5
+ ## Workflow Alignment
6
+ - Provide brief status updates (1–3 sentences) before/after important actions.
7
+ - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
8
+ - Update todos immediately after progress; mark completed upon finish.
9
+
5
10
  ## Step 1: Clarify Scope (Focused Q&A Guidelines)
6
11
  Purpose: the agent MUST generate a short, numbered Q&A for the user to clarify scope; keep it relevant, avoid off-topic, and do not build a static question bank.
7
12
 
@@ -68,3 +73,7 @@ Produce a Markdown doc following the template structure:
68
73
  ## Step 4: Next Actions
69
74
  Suggest running `execute-plan` to begin task execution.
70
75
  Note: Test documentation will be created separately using the `writing-test` command.
76
+
77
+ ## Notes
78
+ - This command creates planning docs only; does not modify unrelated existing files.
79
+ - Idempotent: safe to re-run; auto-appends numeric suffix if file exists.
@@ -1,6 +1,12 @@
1
1
  ## Goal
2
2
  Execute the feature plan by implementing tasks and persisting notes to docs.
3
3
 
4
+ ## Workflow Alignment
5
+ - Provide brief status updates (1–3 sentences) before each operation.
6
+ - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
7
+ - Update todos immediately after progress; mark completed upon finish.
8
+ - Perform edits via file editing tools, not by printing code for copy-paste.
9
+
4
10
  ### Prerequisites
5
11
  - Feature name (kebab-case, e.g., `user-authentication`)
6
12
  - Planning doc exists: `docs/ai/planning/feature-{name}.md`
@@ -18,25 +24,26 @@ Execute the feature plan by implementing tasks and persisting notes to docs.
18
24
 
19
25
  ## Step 3: Implement Iteratively (per task)
20
26
  For each task in queue:
21
- 1. Plan minimal change set:
27
+ 1. **Status update**: Brief note (1–3 sentences) on what will be done.
28
+ 2. Plan minimal change set:
22
29
  - Identify files/regions to modify
23
30
  - Map changes to acceptance criteria from plan
24
- 2. Implement changes:
31
+ 3. Implement changes:
25
32
  - Write/edit code according to the plan
26
33
  - Keep changes minimal and incremental
27
34
  - Avoid speculative changes beyond plan scope
28
- 3. Quick validation:
35
+ 4. Quick validation:
29
36
  - Run build/compile if available
30
37
  - Run fast unit/smoke tests if available
31
38
  - Fix immediate issues before proceeding
32
- 4. Persist notes to implementation doc:
39
+ 5. Persist notes to implementation doc:
33
40
  - File: `docs/ai/implementation/feature-{name}.md`
34
41
  - Append entry per completed task:
35
42
  - Files touched: `path/to/file.ext` (lines: x–y)
36
43
  - Approach/pattern used: brief description
37
44
  - Edge cases handled: list if any
38
45
  - Risks/notes: any concerns
39
- 5. Update planning doc:
46
+ 6. Update planning doc:
40
47
  - Mark completed tasks `[x]` with brief note
41
48
  - Mark blocked tasks with reason
42
49
 
@@ -56,9 +63,19 @@ If creating implementation doc for first task:
56
63
 
57
64
  ## Step 5: Quality Checks
58
65
  After completing Step 4 for each task batch:
59
- - Run linting on changed files (e.g., `eslint` if JavaScript/TypeScript project).
60
- - Run type checks if applicable (e.g., `tsc --noEmit`).
61
- - Fix issues (up to 3 attempts) before proceeding to the next task.
66
+ - Detect available tools from project config (e.g., `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, build files) and run the appropriate non-interactive checks.
67
+ - Linting on changed files (prefer non-interactive):
68
+ - JavaScript/TypeScript: `npx eslint .` or `pnpm eslint .` (add `--max-warnings=0` if desired)
69
+ - Python: `ruff .` or `flake8 .`
70
+ - Go: `golangci-lint run` or `go vet ./...`
71
+ - Rust: `cargo clippy -- -D warnings`
72
+ - Java: `./gradlew check` or `mvn -q -DskipTests=false -Dspotbugs.failOnError=true verify`
73
+ - Scope to changed files when possible for speed
74
+ - Type checks (non-emitting where applicable):
75
+ - TypeScript: `npx tsc --noEmit`
76
+ - Python: `mypy .` (if configured) or `pyright` if present
77
+ - Go/Rust/Java: rely on compiler/type system via build step
78
+ - Parallelize lint and type-check when safe; fix issues (up to 3 attempts) before proceeding.
62
79
 
63
80
  ## Step 6: Next Actions
64
81
  After completing tasks:
@@ -70,3 +87,5 @@ After completing tasks:
70
87
  - Keep code changes minimal and focused on plan tasks
71
88
  - Document all changes in implementation doc for later review/refactor
72
89
  - Avoid implementing features not in the plan
90
+ - Modifies source code per plan scope; updates `docs/ai/implementation/feature-{name}.md` and checkboxes in `docs/ai/planning/feature-{name}.md`. Does not modify unrelated files.
91
+ - Idempotent: safe to re-run; appends entries or updates checkboxes deterministically.
@@ -90,8 +90,9 @@ Use these exact markers to wrap generated content:
90
90
  ### Generated Content Order (for CODE_CONVENTIONS)
91
91
  - Merge templates in preload order (when present):
92
92
  1) `docs/ai/project/template-convention/common.md`
93
- 2) `docs/ai/project/template-convention/javascript.md` (when JS/TS repo)
93
+ 2) `docs/ai/project/template-convention/javascript.md` (when JS/TS detected)
94
94
  3) `docs/ai/project/template-convention/react.md` (when React is detected)
95
+ 4) `docs/ai/project/template-convention/typescript.md.md` (when TS is detected)
95
96
  - After the merged templates, append auto-discovered rules from the codebase analysis.
96
97
 
97
98
  ## Step 5: Next Actions
@@ -9,7 +9,7 @@ Initialize a new chat by loading and aligning to `AGENTS.md` so the AI agent con
9
9
 
10
10
  ## Steps
11
11
  1) Open and read `AGENTS.md` (project root).
12
- 2) Detect project languages/frameworks/libraries from repository metadata (e.g., `package.json`, `pyproject.toml`, lockfiles, config files). Update `docs/ai/project/CODE_CONVENTIONS.md` to include any missing key coding conventions (only important items like React, TypeScript, TailwindCSS, etc.).
12
+ 2) Detect project languages/frameworks/libraries from repository metadata (e.g., `package.json`, `pyproject.toml`, lockfiles, config files). If `docs/ai/project/CODE_CONVENTIONS.md` is missing, create a minimal generated stub capturing key conventions (e.g., React, TypeScript, TailwindCSS). If it already exists, do not modify; instead, report any detected gaps and suggest running the standards generator.
13
13
  3) Read files in `docs/ai/project/` to understand project context and standards.
14
14
  4) Produce a short confirmation in the chat including:
15
15
  - Workflow alignment: Plan → Implement → Test → Review
@@ -26,5 +26,5 @@ Initialize a new chat by loading and aligning to `AGENTS.md` so the AI agent con
26
26
 
27
27
  ## Notes
28
28
  - This command is idempotent—safe to re-run at the start of any chat.
29
- - It does not modify files; it only sets expectations for subsequent commands.
29
+ - It does not modify existing files; it only sets expectations for subsequent commands and may create missing metadata files (e.g., initial `CODE_CONVENTIONS.md`) if required.
30
30
 
@@ -1,12 +1,18 @@
1
1
  Use `docs/ai/testing/feature-{name}.md` as the source of truth.
2
2
 
3
+ ## Workflow Alignment
4
+ - Provide brief status updates (1–3 sentences) before/after important actions.
5
+ - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
6
+ - Update todos immediately after progress; mark completed upon finish.
7
+ - Default to parallel execution for independent operations; use sequential steps only when dependencies exist.
8
+
3
9
  ## Step 1: Gather Context (minimal)
4
10
  - Ask for feature name if not provided (must be kebab-case).
5
11
  - **Load template:** Read `docs/ai/testing/feature-template.md` to understand required structure.
6
12
  - Then locate docs by convention:
7
13
  - Planning: `docs/ai/planning/feature-{name}.md`
8
14
  - Implementation (optional): `docs/ai/implementation/feature-{name}.md`
9
- - **Detect test framework:** Check `package.json` and project structure to identify test framework (Vitest, Jest, Mocha, pytest, etc.)
15
+ - **Detect test framework:** Check `package.json` and project structure to identify test framework (Vitest, Jest, Mocha, pytest, etc.). Auto-detect from `package.json` first; if no test runner found, create skeleton test and report missing runner.
10
16
  - **Load standards:** Read `docs/ai/project/PROJECT_STRUCTURE.md` for test file placement rules
11
17
  - **Load conventions:** Read `docs/ai/project/CODE_CONVENTIONS.md` for coding standards
12
18
 
@@ -115,12 +121,12 @@ describe('functionToTest', () => {
115
121
  ## Step 5: Run Tests with Logging (automatic)
116
122
  After generating test code:
117
123
 
118
- 1. **Execute test command** based on detected framework:
119
- - Vitest: `npm test` or `npx vitest run`
120
- - Jest: `npm test` or `npx jest`
121
- - Mocha: `npm test` or `npx mocha`
122
- - pytest: `pytest` or `python -m pytest`
123
- - Other: detect from `package.json` scripts
124
+ 1. **Execute test command** based on detected framework (use non-interactive flags):
125
+ - Vitest: `npm test` or `npx vitest run --run`
126
+ - Jest: `npm test` or `npx jest --ci`
127
+ - Mocha: `npm test` or `npx mocha --reporter spec`
128
+ - pytest: `pytest` or `python -m pytest -v`
129
+ - Other: detect from `package.json` scripts, add `--no-interactive` or equivalent flags
124
130
 
125
131
  2. **Capture and display output** in terminal with detailed logging:
126
132
  - Show test execution progress (which tests are running)
@@ -214,3 +220,5 @@ Ensure all required sections from template are present. Keep the document brief
214
220
  - Test execution must show clear, detailed logging in terminal
215
221
  - AI excels at: edge case generation, parameter combinations, property-based testing, coverage analysis
216
222
  - Keep tests deterministic (avoid external dependencies, random values without seeds, time-dependent logic)
223
+ - Creates test files only; does not edit non-test source files.
224
+ - Idempotent: safe to re-run; appends entries or updates test doc deterministically.
@@ -2,40 +2,60 @@
2
2
 
3
3
  > These rules are preloaded by the standards generator before analyzing the codebase. They establish non-negotiable, high-signal conventions. The generator should merge these rules first, then append auto-discovered patterns.
4
4
 
5
+ ## Principles — The "Why"
6
+ - DRY (Don't Repeat Yourself): Avoid duplicating code. Abstract common logic into reusable functions, classes, or modules.
7
+ - KISS (Keep It Simple, Stupid): Prefer simple, straightforward solutions over clever or unnecessarily complex ones. Code should be as simple as possible, but no simpler.
8
+ - YAGNI (You Ain't Gonna Need It): Do not add functionality or create abstractions until they are actually needed. Avoid premature optimization.
9
+
5
10
  ## Naming — Clarity & Descriptiveness
6
11
  - Prefer meaningful, verbose names over abbreviations.
7
- - Avoid 1–2 character identifiers (except conventional counters in very small scopes).
12
+ - Avoid 1–2 character identifiers (except conventional counters like `i`, `j`, `k` in very small loop scopes).
13
+ - Be consistent. If you use `getUser` in one place, use `getProduct` in another, not `fetchProduct`.
14
+ - Function names should be verbs; variables and classes should be nouns. (e.g., `calculateTotal()`, `const user`, `class Order`).
15
+
16
+ ## Functions / Methods
17
+ - Single Responsibility Principle: A function should do one thing and do it well. If you can't describe what a function does in one simple sentence, it's likely doing too much.
18
+ - Limit Arguments: Prefer 0-2 arguments per function. If you need more than two, consider passing a single configuration object.
19
+ - Avoid Side Effects: Functions should be predictable. They should avoid modifying external state, global variables, or their own input arguments whenever possible. A function `calculateTotal(items)` should return a new value, not modify the original `items` array.
8
20
 
9
21
  ## Control Flow
10
22
  - Prefer guard clauses (early returns) to reduce nesting depth.
11
23
  - Handle errors and edge cases first.
12
- - Avoid deep nesting beyond 2–3 levels.
24
+ - Avoid deep nesting beyond 2–3 levels. Refactor deeply nested logic into smaller, well-named functions.
25
+
26
+ ## Variables & Data Structures
27
+ - Minimize Scope: Declare variables in the smallest possible scope (e.g., inside a loop or conditional block if they are only used there).
28
+ - Avoid Magic Values: Do not use "magic" strings or numbers directly in code. Define them as named constants to provide context and avoid typos.
29
+ - *Bad:* `if (status === 2) { ... }`
30
+ - *Good:* `const STATUS_APPROVED = 2; if (status === STATUS_APPROVED) { ... }`
31
+ - Prefer Immutability:** Do not reassign variables or mutate data structures if it can be avoided. Creating new data structures instead of changing existing ones leads to more predictable code.
13
32
 
14
33
  ## Error Handling
15
34
  - Throw errors with clear, actionable messages.
16
- - Do not catch errors without meaningful handling.
35
+ - Do not catch errors without meaningful handling (e.g., logging, retrying, or re-throwing a more specific error). Swallowing exceptions silently is a major source of bugs.
17
36
 
18
37
  ## Comments
19
- - Add comments only for complex or non-obvious logic; explain "why", not "how".
38
+ - Add comments only for complex or non-obvious logic; explain **"why"**, not **"how"**. Well-written code should explain the "how" by itself.
20
39
  - Place comments above code blocks or use language-specific docstrings.
21
- - Avoid trailing inline comments.
40
+ - Avoid trailing inline comments as they can clutter code.
41
+ - Remove Dead Code: Do not leave commented-out code in the codebase. Source control (like Git) is the history.
22
42
 
23
43
  ## Formatting
24
- - Match existing repository formatting tools and styles.
25
- - Prefer multi-line over long one-liners or complex ternaries.
26
- - Wrap long lines and do not reformat unrelated code.
44
+ - Match existing repository formatting tools and styles (e.g., Prettier, Black, gofmt). Consistency is key.
45
+ - Prefer multi-line over long one-liners or complex ternaries for readability.
46
+ - Wrap long lines and do not reformat unrelated code in a change that is focused on logic.
27
47
 
28
48
  ## Types (for statically typed languages)
29
49
  - Explicitly annotate public APIs and function signatures.
30
- - Avoid unsafe casts or overly broad types (e.g., `any`).
50
+ - Avoid unsafe casts or overly broad types (e.g., `any`, `Object`). Be as specific as possible.
31
51
 
32
52
  ## Change Discipline
33
53
  - Perform changes via file editing tools; avoid pasting large code blobs in reviews.
34
54
  - Re-read target files before editing to ensure accurate context.
35
55
  - After edits, run only fast, non-interactive validation on changed files:
36
- - If ESLint is configured, run ESLint on changed paths (e.g., `eslint --max-warnings=0 <changed-paths>`). Use `--fix` when safe to auto-fix.
37
- - If TypeScript is used, run type-check only (e.g., `tsc --noEmit` or `tsc -p . --noEmit`).
56
+ - If a linter is configured, run it on changed paths (e.g., `eslint --max-warnings=0 <changed-paths>`). Use `--fix` when safe to auto-fix.
57
+ - If a type checker is used, run type-check only (e.g., `tsc --noEmit` or `mypy <changed-paths>`).
38
58
  - Do NOT run Prettier as part of validation (formatting is enforced separately by tooling/CI).
39
- - Do NOT run full build or dev server (to avoid unnecessary time cost).
59
+ - Do NOT run a full build or dev server (to avoid unnecessary time cost).
40
60
  - Attempt auto-fixes up to 3 times for linter issues before requesting help.
41
61
 
@@ -6,17 +6,23 @@
6
6
  - Use strict equality `===`/`!==`.
7
7
  - Prefer optional chaining `?.` and nullish coalescing `??` over `||` when `0/''/false` are valid values.
8
8
 
9
+ ## Syntax & Readability
10
+ - Use destructuring to access properties from objects and arrays.
11
+ - Use the spread syntax (`...`) for creating shallow copies of arrays and objects.
12
+ - Prefer array methods (`.map`, `.filter`, `.reduce`) over `for` loops for data transformation.
13
+ - Use `for...of` for simple iterations over iterables.
14
+
9
15
  ## Functions & Data
10
16
  - Keep functions small and single-purpose.
17
+ - Use arrow functions (`=>`) for callbacks and to preserve `this` context.
11
18
  - Avoid mutations; prefer immutable updates for objects/arrays.
12
19
  - Return early (guard clauses) to reduce nesting.
13
20
 
14
21
  ## Errors & Async
15
22
  - Use `async/await`; avoid unhandled promises (no floating promises).
16
- - Throw Errors with clear messages; catch only to handle meaningfully.
23
+ - Throw `Error` objects with clear messages; catch only to handle meaningfully.
17
24
 
18
25
  ## Style & Safety
19
26
  - Avoid implicit globals; module scope only.
20
27
  - Prefer explicit returns over side effects.
21
- - Keep imports minimal and ordered (std/third-party/internal).
22
-
28
+ - Keep imports minimal and ordered (std/third-party/internal).
@@ -0,0 +1,25 @@
1
+ # TypeScript Conventions (Essential)
2
+
3
+ ## Types & Interfaces
4
+ - Use `interface` for public APIs and object shapes, as they are easily extended.
5
+ - Use `type` for unions (`|`), intersections (`&`), tuples, or complex type aliases.
6
+
7
+ ## Naming Conventions
8
+ - Use `PascalCase` for all type-level identifiers (Types, Interfaces, Classes, Enums, Generics).
9
+ - Use `camelCase` for all value-level identifiers (variables, functions, properties).
10
+ - Avoid the `I` prefix for interfaces (e.g., `User`, not `IUser`).
11
+ - Use the `private` keyword instead of an underscore (`_`) prefix for private members.
12
+
13
+ ## Type Safety
14
+ - Avoid `any`. It disables type-checking and defeats the purpose of TypeScript.
15
+ - Prefer `unknown` over `any`. It is a type-safe alternative that forces type-checking before use.
16
+ - Use `readonly` for properties that should not be mutated after initialization to enforce immutability.
17
+ - Explicitly type all public function signatures to ensure a clear and stable API.
18
+
19
+ ## Modules & Organization
20
+ - Always use ES Modules (`import`/`export`).
21
+ - Prefer named exports over `default` exports. They improve consistency and refactorability.
22
+ - Avoid `namespace`. ES Modules provide superior encapsulation and are the language standard.
23
+
24
+ ## Documentation
25
+ - Use JSDoc (`/** ... */`) for all exported members (functions, classes, types). This provides context and enables rich editor tooltips.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-workflow-init",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Initialize AI workflow docs & commands into any repo with one command",
5
5
  "bin": {
6
6
  "ai-workflow-init": "./cli.js"