@produck/agent-toolkit 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,293 @@
1
+ ---
2
+ applyTo: '**'
3
+ ---
4
+
5
+ <!-- managed-by: @produck/agent-toolkit -->
6
+ <!-- source: .github/distribution/produck/15-produck-workspace.instructions.md -->
7
+
8
+ # Workspace Shared Configuration Guide
9
+
10
+ ## Overview
11
+
12
+ The Produck monorepo provides unified configuration across all packages for consistency and ease of maintenance.
13
+
14
+ ## Distribution classification
15
+
16
+ This document is maintained directly as a downstream-distributable source.
17
+
18
+ - Authoritative path:
19
+ `.github/distribution/produck/15-produck-workspace.instructions.md`
20
+
21
+ ## Shared Configurations
22
+
23
+ ### 1. ESLint Configuration (`eslint.config.mjs`)
24
+
25
+ **Location:** Root `eslint.config.mjs`
26
+
27
+ **Applies to:** All JavaScript, TypeScript files
28
+
29
+ **Rules:**
30
+
31
+ - Indentation: 2 spaces (error)
32
+ - Quotes: Single quotes (error)
33
+ - Line endings: Unix (LF) (error)
34
+ - Semicolons: Always required (error)
35
+ - Trailing commas: Always in multiline (error)
36
+ - No inline config allowed: `noInlineConfig: true`
37
+
38
+ **Usage in packages:**
39
+
40
+ ```javascript
41
+ // packages/my-package/eslint.config.mjs
42
+ import rootConfig from '../../eslint.config.mjs';
43
+
44
+ export default [
45
+ ...rootConfig,
46
+ // Package-specific overrides here
47
+ ];
48
+ ```
49
+
50
+ ### 2. TypeScript Configuration (`tsconfig.json`)
51
+
52
+ **Location:** Root `tsconfig.json`
53
+
54
+ **Applies to:** All TypeScript packages
55
+
56
+ **Key settings:**
57
+
58
+ - Target: ES2022
59
+ - Strict mode: enabled
60
+ - Module resolution: node
61
+ - Source maps: enabled
62
+ - Declaration files: generated
63
+
64
+ **Usage in packages:**
65
+
66
+ ```json
67
+ {
68
+ "extends": "../../tsconfig.json",
69
+ "compilerOptions": {
70
+ "outDir": "./dist"
71
+ },
72
+ "include": ["src/**/*"],
73
+ "exclude": ["node_modules", "dist", "test"]
74
+ }
75
+ ```
76
+
77
+ ### 3. Prettier Configuration (`.prettierrc`)
78
+
79
+ **Location:** Root `.prettierrc`
80
+
81
+ **Applies to:** All source files
82
+
83
+ **Rules:**
84
+
85
+ - Print width: 100 characters
86
+ - Tab width: 2 spaces
87
+ - Single quotes: true
88
+ - Trailing commas: es5
89
+ - Arrow parens: always
90
+ - Semicolons: true
91
+
92
+ **Ignored files:** `.prettierignore`
93
+
94
+ ### 4. Git Ignore Configuration (`.gitignore`)
95
+
96
+ **Location:** Root `.gitignore` (centralized, no package-level overrides)
97
+
98
+ **Applies to:** All files in the monorepo
99
+
100
+ **Strategy:** Single source of truth at repository root per monorepo convention
101
+
102
+ **Rules:**
103
+
104
+ - Dependencies: `node_modules/`, npm logs
105
+ - Coverage: `coverage/`, `.nyc_output/`
106
+ - Environment: `.env`, `.env.local`, `.env.*.local`
107
+ - Build: `dist/`, `build/`, `out/`, `*.tsbuildinfo`
108
+ - OS/Editor: `.DS_Store`, `Thumbs.db`, `.vscode/settings.json`, `.idea/`
109
+ - Temporary: `logs/`, `tmp/`, `temp/`
110
+ - Generated: `*.gen`, `*.ign` (organization team extensions)
111
+
112
+ **Why centralized?**
113
+
114
+ - All packages automatically inherit root patterns
115
+ - Single maintenance point
116
+ - No package-level overrides allowed
117
+ - Per organization baseline: keep ignore rules centralized at repository root whenever possible
118
+
119
+ ## Root Workspace Scripts
120
+
121
+ ### Verification & Quality
122
+
123
+ ```bash
124
+ # Type check all packages
125
+ npm run type-check
126
+
127
+ # Format check without writing
128
+ npm run format:check
129
+
130
+ # Format and write
131
+ npm run format
132
+
133
+ # Lint (requires root eslint.config.mjs)
134
+ npm run lint
135
+
136
+ # Run all package tests
137
+ npm run test
138
+
139
+ # Check coverage across packages
140
+ npm run coverage
141
+ ```
142
+
143
+ ### Package-Specific Commands
144
+
145
+ ```bash
146
+ # Verify toolkit package
147
+ npm run toolkit:verify
148
+
149
+ # Verify eslint-rules package
150
+ npm run eslint-rules:verify
151
+
152
+ # Check package distributions
153
+ npm run toolkit:pack-check
154
+ npm run eslint-rules:pack-check
155
+ ```
156
+
157
+ ## Package Integration
158
+
159
+ ### Adding a New Package
160
+
161
+ 1. Create `packages/my-package/` directory
162
+ 2. Create `packages/my-package/package.json` with workspace configuration
163
+ 3. Inherit root configs:
164
+ - ESLint: extend `../../eslint.config.mjs`
165
+ - TypeScript: extend `../../tsconfig.json`
166
+ - Prettier: uses root `.prettierrc` automatically
167
+
168
+ ### Package-Level Overrides
169
+
170
+ Each package can extend/override shared config:
171
+
172
+ **ESLint example:**
173
+
174
+ ```javascript
175
+ import rootConfig from '../../eslint.config.mjs';
176
+ import onlyWarn from 'eslint-plugin-only-warn';
177
+
178
+ export default [
179
+ ...rootConfig,
180
+ {
181
+ plugins: { 'only-warn': onlyWarn },
182
+ rules: {
183
+ 'custom-rule': 'warn', // package-specific override
184
+ },
185
+ },
186
+ ];
187
+ ```
188
+
189
+ ## .editorconfig
190
+
191
+ **Location:** Root `.editorconfig`
192
+
193
+ Applies to all editors supporting EditorConfig (VSCode, Vim, Sublime, etc.):
194
+
195
+ - Charset: utf-8
196
+ - Indent: 2 spaces
197
+ - Line endings: Unix (LF)
198
+ - Trim trailing whitespace
199
+
200
+ ## Dependencies
201
+
202
+ ### Shared devDependencies (Root)
203
+
204
+ - `@eslint/config-helpers`: ESLint configuration utilities
205
+ - `@eslint/js`: ESLint recommended config for JavaScript
206
+ - `eslint`: Core linter
207
+ - `typescript-eslint`: TypeScript linting support
208
+ - `globals`: Global variables (browser, node)
209
+ - `prettier`: Code formatter
210
+ - `typescript`: TypeScript compiler
211
+ - `@types/node`: Node.js type definitions
212
+
213
+ ### Peer Dependencies (Packages)
214
+
215
+ Each package declares peer dependencies for features it uses:
216
+
217
+ ```json
218
+ {
219
+ "peerDependencies": {
220
+ "eslint": ">=10.3.0",
221
+ "@eslint/config-helpers": ">=0.6.0"
222
+ }
223
+ }
224
+ ```
225
+
226
+ ## CI/CD Integration
227
+
228
+ Root scripts are designed for CI pipelines:
229
+
230
+ ```bash
231
+ # Pre-commit checks
232
+ npm run format:check
233
+ npm run type-check
234
+ npm run lint
235
+
236
+ # Testing
237
+ npm run test
238
+ npm run coverage
239
+
240
+ # Package verification
241
+ npm run toolkit:verify
242
+ npm run eslint-rules:verify
243
+ ```
244
+
245
+ ## Best Practices
246
+
247
+ 1. **Always extend shared config** instead of duplicating
248
+ 2. **Use workspace lint/format scripts** for consistency
249
+ 3. **Keep package-level overrides minimal** - justify in comments
250
+ 4. **Update root config** when org-wide rule changes needed
251
+ 5. **Test configuration changes** with all packages before committing
252
+ 6. **Do NOT add package-level `.gitignore`** - only root `.gitignore` is allowed; all packages inherit from it
253
+
254
+ ## Troubleshooting
255
+
256
+ ### ESLint complains about missing peer deps
257
+
258
+ ```bash
259
+ # Install missing peer dependencies
260
+ npm install
261
+ ```
262
+
263
+ ### Prettier conflicts with ESLint
264
+
265
+ Root `.prettierrc` and `eslint.config.mjs` are synchronized. If conflict occurs:
266
+
267
+ 1. Check both configs have matching rules
268
+ 2. Run `npm run format` first, then `npm run lint`
269
+
270
+ ### TypeScript includes too many files
271
+
272
+ Update `tsconfig.json` `include` and `exclude` patterns:
273
+
274
+ ```json
275
+ {
276
+ "include": ["packages/*/src/**/*.ts"],
277
+ "exclude": ["node_modules", "dist", "**/*.test.ts"]
278
+ }
279
+ ```
280
+
281
+ ### Files are being tracked by git that should be ignored
282
+
283
+ Verify `.gitignore` patterns:
284
+
285
+ ```bash
286
+ # Check if file matches any gitignore pattern
287
+ git check-ignore -v <file-or-directory>
288
+
289
+ # Update only root .gitignore - no package-level .gitignore allowed
290
+ # All packages inherit patterns from root
291
+ ```
292
+
293
+ Do NOT create package-level `.gitignore` files - they will be removed per organization policy.
@@ -0,0 +1,175 @@
1
+ ---
2
+ applyTo: '**'
3
+ ---
4
+
5
+ <!-- managed-by: @produck/agent-toolkit -->
6
+ <!-- source: .github/distribution/produck/20-produck-commit.instructions.md -->
7
+
8
+ # Commit Convention
9
+
10
+ Repositories in the `produck` organization use a bracketed TAG style for commit
11
+ messages.
12
+
13
+ ## Format
14
+
15
+ Use this format:
16
+
17
+ - `[TAG] summary`
18
+
19
+ Multi-line commit message rule:
20
+
21
+ - Every non-empty line in the commit message must start with `[TAG]`.
22
+ - Empty lines are not allowed in commit message body.
23
+ - Do not use untagged bullet lines in commit message body.
24
+ - If body details are needed, repeat tagged lines instead of raw bullets.
25
+ - `summary` cannot appear as a standalone untagged line.
26
+
27
+ Monorepo format (required for multi-package repositories):
28
+
29
+ - Package/workspace labels appear as **section headers** followed by a colon
30
+ (format: `package-name:` or `@scope/package:`).
31
+ - All lines under a package header belong to that package.
32
+ - Every line under a package header must start with `[TAG]`.
33
+ - No empty lines between tagged lines within a package section.
34
+ - Multiple packages follow the same pattern (each with its own header).
35
+
36
+ Example monorepo format:
37
+
38
+ ```
39
+ foo:
40
+ [FIX] race condition in auth handler
41
+ [ADD] <test>: cover edge case for concurrent login
42
+ bar:
43
+ [REFACTOR] <docs>: rewrite installation guide
44
+ ```
45
+
46
+ Standalone repository format:
47
+
48
+ - Do not use package/workspace section headers.
49
+ - Write commit messages directly as `[TAG] summary`.
50
+ - All tagged lines belong to the repository globally.
51
+
52
+ Allowed tags (fixed whitelist):
53
+
54
+ - `[INIT]`
55
+ - `[ADD]`
56
+ - `[REMOVE]`
57
+ - `[FIX]`
58
+ - `[REFACTOR]`
59
+ - `[UPGRADE]`
60
+ - `[PUBLISH]`
61
+
62
+ Legacy-to-canonical mapping (for migration):
63
+
64
+ - `[ADDED]` -> `[ADD]`
65
+ - `[REMOVED]` -> `[REMOVE]`
66
+ - `[FIXED]` -> `[FIX]`
67
+
68
+ When using this style:
69
+
70
+ - `TAG` must be uppercase and must be one of the allowed tags above.
71
+ - Summary must be in English.
72
+ - Keep summaries specific and behavior-oriented.
73
+ - Summary may include a target noun prefix to express content domain.
74
+ - Mention concrete areas when useful (route, endpoint, helper, file, test,
75
+ constraint).
76
+ - Prefer one clear tagged change per line when writing grouped summaries.
77
+ - `[REFACTOR]` implies potentially breaking updates and should explicitly
78
+ describe impact.
79
+ - Special rule for `[UPGRADE]`: use `[UPGRADE] deps` for pure dependency
80
+ upgrades.
81
+ - If `[UPGRADE]` also includes IFF artifacts or IPC-related artifacts/calls, the
82
+ summary must explicitly name the updated artifact/call.
83
+ - Special rule for `[PUBLISH]`: use `[PUBLISH]` for release and package
84
+ publishing commits managed by lerna or similar tools. No target required.
85
+
86
+ Summary target extension (optional):
87
+
88
+ - Format: `[TAG] <target>: <summary>`
89
+ - Allowed targets (fixed whitelist):
90
+ - `docs`: documentation content, guides, comments, and usage notes
91
+ - `test`: test cases, fixtures, assertions, and test tooling
92
+ - `ci`: continuous integration workflows, pipeline steps, and automation jobs
93
+ - `deps`: dependency declarations, lockfiles, and dependency management scripts
94
+ - `api`: externally visible interfaces, route contracts, and client/server API
95
+ behavior
96
+ - `schema`: data model definitions, migration schemas, and validation schema
97
+ changes
98
+ - `infra`: infrastructure and environment provisioning/configuration
99
+ - `fmt`: code formatting, style, and linter configuration changes
100
+ - When target syntax is used, `target` must be one of the allowed values above.
101
+ - Target must be wrapped in angle brackets (`<target>`) to distinguish it from
102
+ namespace-like identifiers inside summary text.
103
+ - Targets are nouns in summary context, not tags.
104
+
105
+ ## Examples
106
+
107
+ - `[FIX] race conditions in createTeam/acceptInvitation/acceptRequest by
108
+ wrapping checks and writes in one transaction`
109
+ - `[FIX] <infra>: enforce node-first execution`
110
+ - `[FIX] <infra>: remove repo-local ignore for transient logs`
111
+ - `[FIX] <infra>: add policy-repo exception for local agent output`
112
+ - `[ADD] shared helper src/Web/Student/Router/Team/membership.mjs for
113
+ student-side team mutation routes`
114
+ - `[REFACTOR] remove c8 ignore on Screenshot.mjs response.ok (covered by
115
+ integration test)`
116
+ - `[INIT] initialize @tjuamt/eer-score-field-ai-kitchen debug tool`
117
+ - `[REMOVE] deprecated score-field prompt template`
118
+ - `[UPGRADE] deps`
119
+ - `[ADD] <docs>: onboarding section for monorepo mode`
120
+ - `[FIX] <test>: stabilize screenshot upload retry assertion`
121
+ - `[REFACTOR] <ci>: split lint and test jobs for faster feedback`
122
+
123
+ Monorepo examples:
124
+
125
+ ```
126
+ foo:
127
+ [FIX] a
128
+ [FIX] b
129
+ [FIX] c
130
+ ```
131
+
132
+ ```
133
+ core:
134
+ [ADD] <api>: new user authentication endpoint
135
+ [REFACTOR] <test>: restructure session management tests
136
+ utils:
137
+ [UPGRADE] <deps>: update lodash to v4.17.21
138
+ [FIX] <docs>: clarify error handling in README
139
+ ```
140
+
141
+ ## Avoid
142
+
143
+ Avoid vague or low-signal messages such as:
144
+
145
+ - `[ADD] update things`
146
+ - `[FIX] issue`
147
+ - `[UPGRADE] dependencies` when artifact/call updates exist but are not named
148
+ - `[ADD] docs: ...` (target syntax without angle brackets)
149
+ - `[ADD] <feature>: ...` (target outside allowed whitelist)
150
+ - `[added] ...` (non-uppercase tag)
151
+ - `[CHANGED] ...` (tag outside whitelist)
152
+ - `- remove old script` (untagged body line)
153
+ - `summary without tag` (untagged standalone line)
154
+ - empty lines between tagged lines
155
+ - Monorepo mistakes:
156
+ - `foo: [FIX] a` (package header and tag on same line)
157
+ - `@produck/foo: [FIX] a` (package name in every tag line instead of
158
+ section header)
159
+ - `foo:\n\n[FIX] a` (empty line after package header)
160
+ - `foo:` without any tagged lines below (orphaned section header)
161
+
162
+ ## Validation
163
+
164
+ Use the local validator before commit:
165
+
166
+ - `npm exec --package=@produck/agent-toolkit@latest agent-toolkit
167
+ validate-commit-msg --file <message-file>`
168
+
169
+ If validation fails, fix the message and rerun until it passes.
170
+
171
+ ## Notes
172
+
173
+ - Keep the summary concise and specific.
174
+ - Prefer imperative phrasing.
175
+ - This document does not restrict PR title format.
@@ -1,8 +1,11 @@
1
1
  Usage:
2
2
  agent-toolkit sync-instructions [--cwd <dir>] [--out <file>]
3
- [--source <file>] [--force] [--dry-run]
3
+ [--source <file-or-dir>] [--force] [--prune] [--dry-run]
4
4
 
5
5
  Behavior:
6
- - Writes organization instruction entrypoint template to target file.
7
- - Defaults to <cwd>/.instructions.md when --out is not provided.
8
- - If target exists, command fails unless --force is set.
6
+ - Syncs one or multiple .instructions.md files to target path.
7
+ - Defaults to <cwd>/.github/instructions/produck when --out is not provided.
8
+ - If --source is a directory, all *.instructions.md files in that directory are synced.
9
+ - If --source is omitted, built-in namespaced assets are used.
10
+ - Existing changed files require --force.
11
+ - --prune deletes unmanaged leftovers only when file contains managed marker.
@@ -0,0 +1,14 @@
1
+ # Repository AI Instructions
2
+
3
+ This repository uses organization baseline instructions from:
4
+
5
+ - {{NAMESPACE_GLOB}}
6
+
7
+ Repository-specific rules should be written in this file.
8
+ Keep organization baseline rules in the produck namespace files above.
9
+
10
+ Recommended usage:
11
+
12
+ - Add local constraints and exceptions here.
13
+ - Do not copy organization baseline content into this file.
14
+ - Keep this file focused on repository-only behavior.
@@ -1,21 +0,0 @@
1
- # Organization Collaboration Instructions
2
-
3
- This repository follows organization-level AI and engineering rules.
4
-
5
- ## Required Rules
6
-
7
- - Commit message format must follow bracketed TAG policy.
8
- - Keep root .editorconfig aligned with organization baseline:
9
- - If missing, create from organization sample.
10
- - If present, add missing required keys only (minimal merge).
11
- - Repository owners generate and own eslint.config.mjs.
12
- - AI must not rewrite full eslint config; only add missing
13
- @produck/eslint-rules integration as minimal patch.
14
- - Repository-specific ESLint overrides must layer on top of
15
- @produck/eslint-rules.
16
-
17
- ## References
18
-
19
- - docs/ai-collaboration.md
20
- - docs/commit-convention.md
21
- - docs/nodejs-initialization.md