eslint-plugin-traceability 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci-cd.yml +15 -0
- package/.voder/history.md +170 -140
- package/.voder/implementation-progress.md +113 -112
- package/.voder/last-action.md +118 -85
- package/.voder/plan.md +7 -10
- package/.voder/progress-chart.png +0 -0
- package/.voder/progress-log-areas.csv +1 -0
- package/.voder/progress-log.csv +1 -0
- package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +165 -0
- package/lib/tests/basic.test.js +1 -1
- package/lib/tests/index.test.js +5 -1
- package/lib/tests/integration/file-validation.test.js +16 -5
- package/lib/tests/integration/plugin-validation.test.js +64 -58
- package/lib/tests/maintenance/detect-isolated.test.js +6 -1
- package/lib/tests/rules/require-branch-annotation.test.js +5 -3
- package/lib/tests/rules/require-story-annotation.test.js +1 -0
- package/package.json +1 -1
- package/tests/basic.test.ts +1 -1
- package/tests/index.test.ts +5 -1
- package/tests/integration/file-validation.test.ts +16 -5
- package/tests/integration/plugin-validation.test.ts +68 -63
- package/tests/maintenance/detect-isolated.test.ts +7 -3
- package/tests/rules/require-branch-annotation.test.ts +5 -3
- package/tests/rules/require-story-annotation.test.ts +1 -0
|
@@ -39,6 +39,9 @@ jobs:
|
|
|
39
39
|
- name: Run tests with coverage
|
|
40
40
|
run: npm run test
|
|
41
41
|
|
|
42
|
+
- name: Run CLI Integration Tests
|
|
43
|
+
run: node cli-integration.js
|
|
44
|
+
|
|
42
45
|
- name: Check code formatting
|
|
43
46
|
run: npm run format:check
|
|
44
47
|
|
|
@@ -76,3 +79,15 @@ jobs:
|
|
|
76
79
|
run: npm publish --access public
|
|
77
80
|
env:
|
|
78
81
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
82
|
+
|
|
83
|
+
smoke-test:
|
|
84
|
+
name: Post-Deployment Smoke Test
|
|
85
|
+
needs: publish
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
steps:
|
|
88
|
+
- name: Checkout code
|
|
89
|
+
uses: actions/checkout@v4
|
|
90
|
+
- name: Install dependencies
|
|
91
|
+
run: npm ci
|
|
92
|
+
- name: Smoke Test Published Package
|
|
93
|
+
run: node cli-integration.js
|
package/.voder/history.md
CHANGED
|
@@ -1,164 +1,194 @@
|
|
|
1
|
-
Here’s a concise
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
• Removed “.voder/” from .gitignore and committed the .voder directory (tracking internal state/history)
|
|
55
|
-
• Lowered ESLint thresholds: max-lines-per-function from 120→100, max-lines from 600→500 in eslint.config.js
|
|
56
|
-
• Ran full quality suite (build, lint, type-check, duplication, tests, format-check, audit) locally—zero errors or warnings—and pushed all changes; CI is green.
|
|
1
|
+
Here’s a concise recap of everything we’ve done so far, in chronological order:
|
|
2
|
+
|
|
3
|
+
• Project Bootstrap
|
|
4
|
+
– Initialized an npm-based TypeScript ESLint plugin (ES2020/CommonJS/strict) with `src/` and `tests/`
|
|
5
|
+
– Configured ESLint (flat), Prettier, Jest, `tsconfig.json` and npm scripts for build, type-check, lint, test, format, duplicate-code check and audit
|
|
6
|
+
|
|
7
|
+
• Security & Code-Quality Hardening
|
|
8
|
+
– Applied an npm-audit override for the js-yaml prototype-pollution issue
|
|
9
|
+
– Enforced ESLint complexity limits and integrated jscpd for duplicate-code detection
|
|
10
|
+
– Added `.env.example` and tightened `package.json` (peerDependencies, engines)
|
|
11
|
+
|
|
12
|
+
• Custom ESLint Rules
|
|
13
|
+
– Built `require-story` and `branch-annotation` rules covering all control flows
|
|
14
|
+
– Scaffolded `valid-annotation-format` with RuleTester unit tests
|
|
15
|
+
– Later implemented `valid-story-reference` and `valid-req-reference` (with existence checks, path-traversal protection, caching) and registered them in plugin configs
|
|
16
|
+
|
|
17
|
+
• Build Artifacts & Git Hooks
|
|
18
|
+
– Committed compiled `lib/` artifacts
|
|
19
|
+
– Set up Husky + lint-staged: pre-commit runs format & lint; pre-push runs full build, checks, tests
|
|
20
|
+
|
|
21
|
+
• Documentation
|
|
22
|
+
– Authored `docs/rules/*.md` for each rule
|
|
23
|
+
– Overhauled `README` (install, usage, examples, rule list)
|
|
24
|
+
– Added `CONTRIBUTING.md`, CLI-integration and config-presets guides, ESLint-9 setup guide
|
|
25
|
+
– Tuned Jest coverage thresholds and `.prettierignore`
|
|
26
|
+
|
|
27
|
+
• CI & Plugin Infrastructure
|
|
28
|
+
– Defined “recommended” and “strict” plugin configs
|
|
29
|
+
– Configured GitHub Actions to run jscpd, build, type-check, lint, tests, format-check, audit
|
|
30
|
+
– Added unit tests for index exports, registry, configs and end-to-end ESLint-CLI integration
|
|
31
|
+
|
|
32
|
+
• Release Preparation & Ongoing Maintenance
|
|
33
|
+
– Refined ESLint overrides, lint-staged patterns, Prettier ignores; limited CI node matrix to 18.x & 20.x
|
|
34
|
+
– Prepared v0.1.0: created `CHANGELOG.md`, documented key rules, updated README’s “Available Rules,” tightened pre-commit hooks
|
|
35
|
+
|
|
36
|
+
• Maintenance-Tools Module
|
|
37
|
+
– Scaffolded utilities (`detectStaleAnnotations`, `updateAnnotationReferences`, etc.) with unit tests and shared file-traversal helpers
|
|
38
|
+
|
|
39
|
+
• CLI Fixes & Emergency CI Patches
|
|
40
|
+
– Adjusted CLI loader for dynamic paths and experimental-vm-modules support
|
|
41
|
+
– Enhanced GitHub Actions with a release job, packaging verification, threshold ratcheting and ADR updates
|
|
42
|
+
– Fixed CI failures (plugin resolution, Prettier, Codecov inputs), removed stray files, updated `.gitignore`
|
|
43
|
+
|
|
44
|
+
• Emergency Pipeline Failure Resolutions
|
|
45
|
+
– Diagnosed and fixed integration-test breakages by tweaking experimental flags
|
|
46
|
+
– Restricted release-job triggers to tags only and enforced audit failures as build blockers
|
|
47
|
+
– Ignored `.voder/` directory, aligned Husky pre-push hook with CI, verified all local quality checks
|
|
48
|
+
|
|
49
|
+
• Most Recent Changes
|
|
50
|
+
– Committed `.voder/` directory to track internal state/history
|
|
51
|
+
– Lowered ESLint thresholds (max-lines-per-function 120→100, max-lines 600→500)
|
|
52
|
+
– Further tightened to 90 lines/function & 400 lines/file, refactored maintenance tests to use OS temp directories for isolation, enabled trailing commas in Prettier
|
|
53
|
+
– Ran full quality suite (build, lint, type-check, duplication, tests, format-check, audit) locally and on CI—no errors or warnings, all pipelines green.
|
|
57
54
|
|
|
58
55
|
**Most recently we've executed the following action:**
|
|
59
56
|
|
|
60
57
|
---
|
|
61
|
-
Used tool: run_command with input: {"command":"npm","args":["run","lint","--","--format=json"]}
|
|
62
|
-
Used tool: list_directory with input: {"dirPath":""}
|
|
63
58
|
Used tool: list_directory with input: {"dirPath":"."}
|
|
64
|
-
Used tool:
|
|
65
|
-
Used tool: read_file with input: {"filePath":"tests/maintenance/detect.test.ts"}
|
|
66
|
-
Used tool: search_file_content with input: {"filePath":"","pattern":"tests/fixtures"}
|
|
67
|
-
Used tool: find_files with input: {"pattern":"detect*.test.ts","directory":"tests/maintenance"}
|
|
68
|
-
Used tool: list_directory with input: {"dirPath":"tests/maintenance"}
|
|
69
|
-
Used tool: read_file with input: {"filePath":"tests/maintenance/update.test.ts"}
|
|
70
|
-
Used tool: read_file with input: {"filePath":"tests/maintenance/detect-isolated.test.ts"}
|
|
71
|
-
Used tool: list_directory with input: {"dirPath":"tests/fixtures"}
|
|
72
|
-
Used tool: read_file with input: {"filePath":"src/maintenance/batch.ts"}
|
|
73
|
-
Used tool: modify_file with input: {"filePath":"eslint.config.js","instruction":"In ESLint configuration, update the max-lines-per-function and max-lines rules: change max-lines-per-function max from 100 to 90 and max-lines from 500 to 400 in both TS and JS rule blocks."}
|
|
74
|
-
Used tool: run_command with input: {"command":"npm","args":["run","lint","--","--format=json"]}
|
|
75
|
-
Used tool: search_file_content with input: {"filePath":".","pattern":"no-stale"}
|
|
76
|
-
Used tool: check_file_exists with input: {"filePath":"tests/fixtures/no-stale"}
|
|
77
|
-
Used tool: list_directory with input: {"dirPath":"tests/fixtures/update"}
|
|
78
|
-
Used tool: read_file with input: {"filePath":"tests/maintenance/batch.test.ts"}
|
|
79
|
-
Used tool: read_file with input: {"filePath":"tests/maintenance/report.test.ts"}
|
|
59
|
+
Used tool: list_directory with input: {"dirPath":".github/workflows"}
|
|
80
60
|
Used tool: read_file with input: {"filePath":"package.json"}
|
|
81
|
-
Used tool:
|
|
82
|
-
Used tool:
|
|
83
|
-
Used tool:
|
|
84
|
-
Used tool:
|
|
85
|
-
Used tool:
|
|
86
|
-
Used tool:
|
|
87
|
-
Used tool:
|
|
88
|
-
Used tool:
|
|
89
|
-
Used tool:
|
|
90
|
-
Used tool: read_file with input: {"filePath":"
|
|
91
|
-
Used tool: read_file with input: {"filePath":"
|
|
61
|
+
Used tool: list_directory with input: {"dirPath":"src"}
|
|
62
|
+
Used tool: read_file with input: {"filePath":"src/index.ts"}
|
|
63
|
+
Used tool: read_file with input: {"filePath":".github/workflows/ci.yml"}
|
|
64
|
+
Used tool: create_directory with input: {"dirPath":"user-docs"}
|
|
65
|
+
Used tool: list_directory with input: {"dirPath":"docs"}
|
|
66
|
+
Used tool: list_directory with input: {"dirPath":"docs/rules"}
|
|
67
|
+
Used tool: read_file with input: {"filePath":"README.md"}
|
|
68
|
+
Used tool: generate_file with input: {"filePath":"user-docs/api-reference.md","content":"# API Reference\n\n## Rules\n\nThe following ESLint rules are exposed by this plugin:\n\n- traceability/require-story-annotation\n- traceability/require-req-annotation\n- traceability/require-branch-annotation\n- traceability/valid-annotation-format\n- traceability/valid-story-reference\n- traceability/valid-req-reference\n\n## Configuration Presets\n\nThe plugin exposes two configuration presets:\n\n- `recommended`\n- `strict`\n"}
|
|
69
|
+
Used tool: read_file with input: {"filePath":"docs/rules/require-story-annotation.md"}
|
|
70
|
+
Used tool: read_file with input: {"filePath":"docs/config-presets.md"}
|
|
71
|
+
Used tool: read_file with input: {"filePath":"docs/rules/require-branch-annotation.md"}
|
|
72
|
+
Used tool: read_file with input: {"filePath":".github/workflows/deploy.yml"}
|
|
73
|
+
Used tool: git_add_all with input: {}
|
|
74
|
+
Used tool: git_commit with input: {"message":"chore: add skeleton user-docs/api-reference.md"}
|
|
75
|
+
Used tool: read_file with input: {"filePath":"user-docs/api-reference.md"}
|
|
76
|
+
Used tool: generate_file with input: {"filePath":"user-docs/api-reference.md","overwrite":true,"content":"# API Reference\n\nCreated autonomously by [voder.ai](https://voder.ai).\n\n## Rules\n\nEach rule enforces traceability conventions in your code. Below is a summary of each rule exposed by this plugin.\n\n### traceability/require-story-annotation\nDescription: Ensures every function declaration has a JSDoc comment with an `@story` annotation referencing the related user story.\nOptions: None\nDefault Severity: `error`\nExample:\n```javascript\n/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ANNOTATION-REQUIRED\n */\nfunction initAuth() {\n // authentication logic\n}\n```\n\n### traceability/require-req-annotation\nDescription: Ensures every function declaration has an `@req` annotation in its JSDoc, linking to the specific requirement.\nOptions: None\nDefault Severity: `error`\nExample:\n```javascript\n/**\n * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md\n * @req REQ-ANNOTATION-REQUIRED\n */\nfunction initAuth() {\n // authentication logic\n}\n```\n\n### traceability/require-branch-annotation\nDescription: Ensures significant code branches (if/else, loops, switch cases, try/catch) have both `@story` and `@req` annotations in preceding comments.\nOptions: None\nDefault Severity: `error`\nExample:\n```javascript\n// @story docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md\n// @req REQ-BRANCH-DETECTION\nif (error) {\n handleError();\n}\n```\n\n### traceability/valid-annotation-format\nDescription: Validates that all traceability annotations (`@story`, `@req`) follow the correct JSDoc or inline comment format.\nOptions: None\nDefault Severity: `error`\nExample:\n```javascript\n/**\n * @story docs/stories/005.0-DEV-VALIDATION.story.md\n * @req REQ-FORMAT-VALIDATION\n */\nfunction example() {\n // ...\n}\n```\n\n### traceability/valid-story-reference\nDescription: Checks that the file paths in `@story` annotations point to existing story markdown files.\nOptions: None\nDefault Severity: `error`\nExample:\n```javascript\n/**\n * @story docs/stories/006.0-DEV-STORY-EXISTS.story.md\n * @req REQ-STORY-EXISTS\n */\nfunction example() {\n // ...\n}\n```\n\n### traceability/valid-req-reference\nDescription: Verifies that the IDs used in `@req` annotations match known requirement identifiers.\nOptions: None\nDefault Severity: `error`\nExample:\n```javascript\n/**\n * @story docs/stories/007.0-DEV-REQ-REFERENCE.story.md\n * @req REQ-VALID-REFERENCE\n */\nfunction example() {\n // ...\n}\n```\n\n## Configuration Presets\n\nThe plugin provides two built-in presets for easy configuration:\n\n### recommended\nEnables the core traceability rules at the `error` level.\nUsage:\n```javascript\nimport js from \"@eslint/js\";\nimport traceability from \"eslint-plugin-traceability\";\n\nexport default [\n js.configs.recommended,\n traceability.configs.recommended,\n];\n```\n\n### strict\nCurrently mirrors the **recommended** preset, reserved for future stricter policies.\nUsage:\n```javascript\nimport js from \"@eslint/js\";\nimport traceability from \"eslint-plugin-traceability\";\n\nexport default [\n js.configs.recommended,\n traceability.configs.strict,\n];\n```\n"}
|
|
77
|
+
Used tool: git_add_all with input: {}
|
|
78
|
+
Used tool: git_commit with input: {"message":"docs: add detailed API reference in user-docs/api-reference.md"}
|
|
79
|
+
Used tool: modify_file with input: {"filePath":"README.md","instruction":"Insert links to user-docs/api-reference.md under documentation section; update README to reference the API reference and examples in user-docs directory. Add `## API Reference` section below `## Quick Start` with link, and `## Examples` section linking to user-docs/examples.md."}
|
|
92
80
|
Used tool: git_add_all with input: {}
|
|
93
|
-
Used tool: git_commit with input: {"message":"
|
|
94
|
-
Used tool:
|
|
81
|
+
Used tool: git_commit with input: {"message":"docs: update README with links to API Reference and Examples"}
|
|
82
|
+
Used tool: generate_file with input: {"filePath":"user-docs/examples.md","content":"# Examples\n\nCreated autonomously by [voder.ai](https://voder.ai).\n\nThis document provides runnable examples demonstrating how to use the `eslint-plugin-traceability` plugin in real-world scenarios.\n\n## 1. ESLint Flat Config with Recommended Preset\n\nCreate an ESLint config file (`eslint.config.js`) at your project root:\n\n```javascript\n// eslint.config.js\nimport js from \"@eslint/js\";\nimport traceability from \"eslint-plugin-traceability\";\n\nexport default [\n js.configs.recommended,\n traceability.configs.recommended,\n];\n```\n\nThen run ESLint on your source files:\n\n```bash\nnpx eslint \"src/**/*.ts\"\n```\n\n## 2. Using the Strict Preset\n\nIf you want to enforce all traceability rules (strict mode), update your config:\n\n```javascript\n// eslint.config.js\nimport js from \"@eslint/js\";\nimport traceability from \"eslint-plugin-traceability\";\n\nexport default [\n js.configs.recommended,\n traceability.configs.strict,\n];\n```\n\nRun ESLint the same way:\n\n```bash\nnpx eslint \"src/**/*.js\"\n```\n\n## 3. CLI Invocation Example\n\nYou can use the plugin without a config file by specifying rules inline:\n\n```bash\nnpx eslint --no-eslintrc \\\n --rule \"traceability/require-story-annotation:error\" \\\n --rule \"traceability/require-req-annotation:error\" \\\n sample.js\n```\n\n- `--no-eslintrc` tells ESLint to ignore user configs.\n- `--rule` options enable the traceability rules you need.\n\nReplace `sample.js` with your JavaScript or TypeScript file.\n\n## 4. Linting a Specific Directory\n\nAdd an npm script in your `package.json`:\n\n```json\n\"scripts\": {\n \"lint:trace\": \"eslint \\\"src/**/*.{js,ts}\\\" --config eslint.config.js\"\n}\n```\n\nThen run:\n\n```bash\nnpm run lint:trace\n```\n"}
|
|
83
|
+
Used tool: git_add_all with input: {}
|
|
84
|
+
Used tool: git_commit with input: {"message":"docs: add user-docs/examples.md with usage examples"}
|
|
85
|
+
Used tool: list_directory with input: {"dirPath":".github/workflows"}
|
|
86
|
+
Used tool: generate_file with input: {"filePath":".github/workflows/ci-cd.yml","content":"name: CI/CD Pipeline\n\non:\n push:\n branches: [main]\n\njobs:\n quality-and-deploy:\n runs-on: ubuntu-latest\n strategy:\n matrix:\n node-version: [18.x, 20.x]\n\n steps:\n - name: Checkout code\n uses: actions/checkout@v4\n\n - name: Setup Node.js ${{ matrix.node-version }}\n uses: actions/setup-node@v4\n with:\n node-version: ${{ matrix.node-version }}\n cache: npm\n\n - name: Install dependencies\n run: npm ci\n\n - name: Build project\n run: npm run build\n\n - name: Run type checking\n run: npm run type-check\n\n - name: Run linting\n run: npm run lint -- --max-warnings=0\n\n - name: Run duplication check\n run: npm run duplication\n\n - name: Run tests with coverage\n run: npm run test\n\n - name: Check code formatting\n run: npm run format:check\n\n - name: Run security audit\n run: npm audit --audit-level=high\n\n - name: Configure npm for publish\n run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n\n - name: Publish package to npm\n run: npm publish --access public\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n"}
|
|
87
|
+
Used tool: remove_file with input: {"filePath":".github/workflows/deploy.yml"}
|
|
88
|
+
Used tool: remove_file with input: {"filePath":".github/workflows/ci.yml"}
|
|
89
|
+
Used tool: git_add_all with input: {}
|
|
90
|
+
Used tool: git_commit with input: {"message":"ci: consolidate CI and deploy into unified ci-cd.yml and remove ci.yml and deploy.yml"}
|
|
95
91
|
Used tool: run_command with input: {"command":"npm","args":["run","build"]}
|
|
92
|
+
Used tool: run_command with input: {"command":"npm","args":["run","type-check"]}
|
|
93
|
+
Used tool: run_command with input: {"command":"npm","args":["run","lint","--","--max-warnings=0"]}
|
|
94
|
+
Used tool: run_command with input: {"command":"npm","args":["run","duplication"]}
|
|
96
95
|
Used tool: run_command with input: {"command":"npm","args":["run","test"]}
|
|
97
|
-
Used tool: search_file_content with input: {"filePath":"tests","pattern":"tests/fixtures"}
|
|
98
|
-
Used tool: read_file with input: {"filePath":"src/maintenance/utils.ts"}
|
|
99
|
-
Used tool: list_directory with input: {"dirPath":"tests/fixtures/no-stale"}
|
|
100
|
-
Used tool: modify_file with input: {"filePath":"tests/maintenance/detect.test.ts","instruction":"Refactor test to use OS temp dirs instead of fixed fixtures. Add imports for fs, path, os. Create a tmpDir via fs.mkdtempSync, call detectStaleAnnotations on it, then cleanup. Remove reference to tests/fixtures/no-stale."}
|
|
101
|
-
Used tool: run_command with input: {"command":"npm","args":["run","test"]}
|
|
102
|
-
Used tool: read_file with input: {"filePath":"tsconfig.json"}
|
|
103
|
-
Used tool: modify_file with input: {"filePath":"tests/maintenance/update.test.ts","instruction":"Refactor this test to use OS temp directory. Import fs, path, os. Create tmpDir via fs.mkdtempSync, call updateAnnotationReferences(tmpDir,...). Remove fixed fixture. Cleanup tmpDir."}
|
|
104
|
-
Used tool: run_command with input: {"command":"npm","args":["run","test"]}
|
|
105
|
-
Used tool: read_file with input: {"filePath":"tests/fixtures/valid-annotations/example.ts"}
|
|
106
|
-
Used tool: modify_file with input: {"filePath":"tests/maintenance/batch.test.ts","instruction":"Refactor tests to use OS temp directories instead of fixed fixtures. Use fs, path, os to create tmpDir, write needed files for 'valid' scenario, and cleanup. For no-batch, use empty tmpDir. For verifyAnnotations, create a ts file and a dummy story file in tmpDir to make annotations valid. Remove fixed 'tests/fixtures' references."}
|
|
107
|
-
Used tool: run_command with input: {"command":"npm","args":["run","test"]}
|
|
108
|
-
Used tool: modify_file with input: {"filePath":"tests/maintenance/report.test.ts","instruction":"Refactor tests to use OS temp directories. Remove references to fixed fixtures. Use fs, path, os to create tmpDir in beforeAll or inside each test. For empty scenario, use fresh tmpDir. For stale annotation scenario, create a file with '@story non-existent.md'. Cleanup tmpDir after test(s). Add imports fs, path, os. Maintain traceability annotations."}
|
|
109
|
-
Used tool: run_command with input: {"command":"npm","args":["run","test"]}
|
|
110
|
-
Used tool: get_git_status with input: {}
|
|
111
96
|
Used tool: list_directory with input: {"dirPath":"tests"}
|
|
112
|
-
Used tool:
|
|
97
|
+
Used tool: read_file with input: {"filePath":"jest.config.js"}
|
|
98
|
+
Used tool: list_directory with input: {"dirPath":"tests/integration"}
|
|
99
|
+
Used tool: run_command with input: {"command":"npm","args":["test","--","--coverage=false"]}
|
|
100
|
+
Used tool: search_file_content with input: {"filePath":"tests","pattern":".only"}
|
|
101
|
+
Used tool: read_file with input: {"filePath":"tests/basic.test.ts"}
|
|
102
|
+
Used tool: read_file with input: {"filePath":"tests/index.test.ts"}
|
|
103
|
+
Used tool: read_file with input: {"filePath":"tsconfig.json"}
|
|
104
|
+
Used tool: read_file with input: {"filePath":"tests/integration/file-validation.test.ts"}
|
|
105
|
+
Used tool: read_file with input: {"filePath":"cli-integration.js"}
|
|
106
|
+
Used tool: list_directory with input: {"dirPath":"tests/maintenance"}
|
|
107
|
+
Used tool: list_directory with input: {"dirPath":"tests/rules"}
|
|
108
|
+
Used tool: read_file with input: {"filePath":"tests/integration/plugin-validation.test.ts"}
|
|
109
|
+
Used tool: run_command with input: {"command":"npm","args":["run","format:check"]}
|
|
110
|
+
Used tool: run_command with input: {"command":"npm","args":["run","test","--","--runInBand"]}
|
|
111
|
+
Used tool: run_command with input: {"command":"npm","args":["audit","--audit-level=high"]}
|
|
112
|
+
Used tool: git_push with input: {"comment":""}
|
|
113
|
+
Used tool: wait_for_github_workflow with input: {"workflowName":"CI/CD Pipeline"}
|
|
114
|
+
Used tool: get_github_run_details with input: {"runId":19413139128}
|
|
115
|
+
Used tool: get_github_run_details with input: {"runId":19413139128}
|
|
116
|
+
Used tool: get_github_workflow_logs with input: {"runId":19413139128}
|
|
117
|
+
Used tool: modify_file with input: {"filePath":".github/workflows/ci-cd.yml","instruction":"Add conditional 'if: matrix.node-version == '20.x' && secrets.NPM_TOKEN != ''' to the 'Configure npm for publish' and 'Publish package to npm' steps to prevent duplicate publishes on older Node versions."}
|
|
113
118
|
Used tool: git_add_all with input: {}
|
|
114
|
-
Used tool: git_commit with input: {"message":"
|
|
119
|
+
Used tool: git_commit with input: {"message":"ci: publish package only once on Node 20.x to avoid npm publish conflicts"}
|
|
120
|
+
Used tool: run_command with input: {"command":"npm","args":["run","test","--","--runInBand"]}
|
|
115
121
|
Used tool: run_command with input: {"command":"npm","args":["run","build"]}
|
|
116
|
-
Used tool: run_command with input: {"command":"npm","args":["run","lint"]}
|
|
117
122
|
Used tool: run_command with input: {"command":"npm","args":["run","type-check"]}
|
|
118
|
-
Used tool: run_command with input: {"command":"npm","args":["run","
|
|
119
|
-
Used tool:
|
|
123
|
+
Used tool: run_command with input: {"command":"npm","args":["run","lint","--","--max-warnings=0"]}
|
|
124
|
+
Used tool: run_command with input: {"command":"npm","args":["run","duplication"]}
|
|
125
|
+
Used tool: git_push with input: {"comment":""}
|
|
126
|
+
Used tool: git_push with input: {"comment":""}
|
|
127
|
+
Used tool: wait_for_github_workflow with input: {"workflowName":"CI/CD Pipeline"}
|
|
120
128
|
Used tool: get_github_pipeline_status with input: {}
|
|
121
|
-
Used tool:
|
|
122
|
-
Used tool: read_file with input: {"filePath":".github/workflows/ci.yml"}
|
|
123
|
-
Used tool: read_file with input: {"filePath":"cli-integration.js"}
|
|
124
|
-
Used tool: get_github_run_details with input: {"runId":19412224943}
|
|
125
|
-
Used tool: read_file with input: {"filePath":".prettierrc"}
|
|
126
|
-
Used tool: run_command with input: {"command":"npm","args":["run","format"]}
|
|
127
|
-
Used tool: run_command with input: {"command":"npm","args":["run","format:check"]}
|
|
128
|
-
Used tool: git_push with input: {}
|
|
129
|
-
Used tool: wait_for_github_workflow with input: {"workflowName":"CI"}
|
|
130
|
-
Used tool: read_file with input: {"filePath":".prettierignore"}
|
|
131
|
-
Used tool: read_file with input: {"filePath":"tests/fixtures/story_bullet.md"}
|
|
132
|
-
Used tool: get_github_workflow_logs with input: {"runId":19412224943}
|
|
133
|
-
Used tool: run_command with input: {"command":"npx","args":["prettier","--list-different","tests/maintenance/batch.test.ts","tests/maintenance/detect.test.ts","tests/maintenance/report.test.ts","tests/maintenance/update.test.ts"]}
|
|
134
|
-
Used tool: run_command with input: {"command":"npx","args":["prettier","--write","tests/maintenance/batch.test.ts","tests/maintenance/detect.test.ts","tests/maintenance/report.test.ts","tests/maintenance/update.test.ts"]}
|
|
135
|
-
Used tool: read_file with input: {"filePath":"tests/maintenance/batch.test.ts","startLine":1,"endLine":200}
|
|
136
|
-
Used tool: modify_file with input: {"filePath":".prettierrc","instruction":"Add trailingComma: 'all' to .prettierrc"}
|
|
137
|
-
Used tool: run_command with input: {"command":"npm","args":["run","format"]}
|
|
138
|
-
Used tool: run_command with input: {"command":"npm","args":["run","format:check"]}
|
|
129
|
+
Used tool: modify_file with input: {"filePath":".github/workflows/ci-cd.yml","instruction":"Replace the if conditions on the publish steps with proper GitHub Actions expression syntax using ${{ }}. Specifically, change both:\n\nif: \"matrix.node-version == '20.x' && secrets.NPM_TOKEN != ''\"\n\nto\n\nif: ${{ matrix.node-version == '20.x' && secrets.NPM_TOKEN != '' }}"}
|
|
139
130
|
Used tool: git_add_all with input: {}
|
|
140
|
-
Used tool: git_commit with input: {"message":"
|
|
141
|
-
Used tool: git_push with input: {}
|
|
142
|
-
Used tool: run_command with input: {"command":"eslint","args":["src/**/*.{js,ts}","tests/**/*.{js,ts}","--max-warnings=0","--format=json"]}
|
|
143
|
-
Used tool: run_command with input: {"command":"npx","args":["prettier","--version"]}
|
|
144
|
-
Used tool: search_file_content with input: {"filePath":"tests/maintenance/detect.test.ts","pattern":" $","isRegex":true}
|
|
145
|
-
Used tool: run_command with input: {"command":"npx","args":["prettier","--check","tests/maintenance"]}
|
|
131
|
+
Used tool: git_commit with input: {"message":"ci: correct conditional syntax for publish steps"}
|
|
132
|
+
Used tool: git_push with input: {"comment":""}
|
|
146
133
|
Used tool: get_github_pipeline_status with input: {}
|
|
134
|
+
Used tool: read_file with input: {"filePath":".github/workflows/ci-cd.yml"}
|
|
135
|
+
Used tool: get_github_run_details with input: {"runId":19413186235}
|
|
136
|
+
Used tool: modify_file with input: {"filePath":".github/workflows/ci-cd.yml","instruction":"Use bracket notation in conditionals: change matrix.node-version to matrix['node-version'] for both publish steps. Ensure no quotes around if expression."}
|
|
137
|
+
Used tool: git_add_all with input: {}
|
|
138
|
+
Used tool: git_commit with input: {"message":"ci: fix matrix variable access in publish condition"}
|
|
139
|
+
Used tool: git_push with input: {"comment":""}
|
|
140
|
+
Used tool: read_file with input: {"filePath":"CHANGELOG.md"}
|
|
141
|
+
Used tool: generate_file with input: {"filePath":".github/workflows/ci-cd.yml","overwrite":true,"content":"name: CI/CD Pipeline\n\non:\n push:\n branches: [main]\n\njobs:\n quality-checks:\n name: Quality Checks\n runs-on: ubuntu-latest\n strategy:\n matrix:\n node-version: [18.x, 20.x]\n steps:\n - name: Checkout code\n uses: actions/checkout@v4\n\n - name: Setup Node.js ${{ matrix['node-version'] }}\n uses: actions/setup-node@v4\n with:\n node-version: ${{ matrix['node-version'] }}\n cache: npm\n\n - name: Install dependencies\n run: npm ci\n\n - name: Build project\n run: npm run build\n\n - name: Run type checking\n run: npm run type-check\n\n - name: Run linting\n run: npm run lint -- --max-warnings=0\n\n - name: Run duplication check\n run: npm run duplication\n\n - name: Run tests with coverage\n run: npm run test\n\n - name: Check code formatting\n run: npm run format:check\n\n - name: Run security audit\n run: npm audit --audit-level=high\n\n publish:\n name: Publish Package\n needs: quality-checks\n runs-on: ubuntu-latest\n if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}\n steps:\n - name: Checkout code\n uses: actions/checkout@v4\n\n - name: Setup Node.js 20.x\n uses: actions/setup-node@v4\n with:\n node-version: '20.x'\n cache: npm\n\n - name: Install dependencies\n run: npm ci\n\n - name: Build project\n run: npm run build\n\n - name: Configure npm for publish\n run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n\n - name: Publish package to npm\n run: npm publish --access public\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n"}
|
|
142
|
+
Used tool: remove_file with input: {"filePath":".github/workflows/ci-cd.yml"}
|
|
143
|
+
Used tool: generate_file with input: {"filePath":".github/workflows/ci-pipeline.yml","content":"name: CI/CD Pipeline\n\non:\n push:\n branches: [main]\n\njobs:\n quality-and-deploy:\n runs-on: ubuntu-latest\n strategy:\n matrix:\n node-version: [18.x, 20.x]\n\n steps:\n - name: Checkout code\n uses: actions/checkout@v4\n\n - name: Setup Node.js ${{ matrix['node-version'] }}\n uses: actions/setup-node@v4\n with:\n node-version: ${{ matrix['node-version'] }}\n cache: npm\n\n - name: Install dependencies\n run: npm ci\n\n - name: Build project\n run: npm run build\n\n - name: Run type checking\n run: npm run type-check\n\n - name: Run linting\n run: npm run lint -- --max-warnings=0\n\n - name: Run duplication check\n run: npm run duplication\n\n - name: Run tests with coverage\n run: npm run test\n\n - name: Check code formatting\n run: npm run format:check\n\n - name: Run security audit\n run: npm audit --audit-level=high\n\n - name: Configure npm for publish\n if: ${{ matrix['node-version'] == '20.x' && secrets.NPM_TOKEN != '' }}\n run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n\n - name: Publish package to npm\n if: ${{ matrix['node-version'] == '20.x' && secrets.NPM_TOKEN != '' }}\n run: npm publish --access public\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n"}
|
|
144
|
+
Used tool: list_directory with input: {"dirPath":".github/workflows"}
|
|
145
|
+
Used tool: remove_file with input: {"filePath":".github/workflows/ci-pipeline.yml"}
|
|
146
|
+
Used tool: generate_file with input: {"filePath":".github/workflows/ci-cd.yml","content":"name: CI/CD Pipeline\n\non:\n push:\n branches: [main]\n\njobs:\n quality-and-deploy:\n runs-on: ubuntu-latest\n strategy:\n matrix:\n node-version: ['18.x', '20.x']\n\n steps:\n - name: Checkout code\n uses: actions/checkout@v4\n\n - name: Setup Node.js ${{ matrix['node-version'] }}\n uses: actions/setup-node@v4\n with:\n node-version: ${{ matrix['node-version'] }}\n cache: 'npm'\n\n - name: Install dependencies\n run: npm ci\n\n - name: Build project\n run: npm run build\n\n - name: Run type checking\n run: npm run type-check\n\n - name: Run linting\n run: npm run lint -- --max-warnings=0\n\n - name: Run duplication check\n run: npm run duplication\n\n - name: Run tests\n run: npm run test\n\n - name: Check code formatting\n run: npm run format:check\n\n - name: Run security audit\n run: npm audit --audit-level=high\n\n - name: Configure npm for publish\n if: ${{ matrix['node-version'] == '20.x' && secrets.NPM_TOKEN != '' }}\n run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n\n - name: Publish package to npm\n if: ${{ matrix['node-version'] == '20.x' && secrets.NPM_TOKEN != '' }}\n run: npm publish --access public\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n"}
|
|
147
|
+
Used tool: list_directory with input: {"dirPath":".github/workflows"}
|
|
148
|
+
Used tool: generate_file with input: {"filePath":".github/workflows/ci-cd.yml","overwrite":true,"content":"name: CI/CD Pipeline\n\non:\n push:\n branches: [main]\n\njobs:\n quality-checks:\n name: Quality Checks\n runs-on: ubuntu-latest\n strategy:\n matrix:\n node-version: ['18.x', '20.x']\n steps:\n - name: Checkout code\n uses: actions/checkout@v4\n\n - name: Setup Node.js ${{ matrix['node-version'] }}\n uses: actions/setup-node@v4\n with:\n node-version: ${{ matrix['node-version'] }}\n cache: npm\n\n - name: Install dependencies\n run: npm ci\n\n - name: Build project\n run: npm run build\n\n - name: Run type checking\n run: npm run type-check\n\n - name: Run linting\n run: npm run lint -- --max-warnings=0\n\n - name: Run duplication check\n run: npm run duplication\n\n - name: Run tests with coverage\n run: npm run test\n\n - name: Check code formatting\n run: npm run format:check\n\n - name: Run security audit\n run: npm audit --audit-level=high\n\n publish:\n name: Publish Package\n needs: quality-checks\n runs-on: ubuntu-latest\n if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}\n steps:\n - name: Checkout code\n uses: actions/checkout@v4\n\n - name: Setup Node.js for publish\n uses: actions/setup-node@v4\n with:\n node-version: '20.x'\n registry-url: 'https://registry.npmjs.org/'\n always-auth: true\n\n - name: Install dependencies\n run: npm ci\n\n - name: Build project\n run: npm run build\n\n - name: Configure npm for publish\n run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n\n - name: Publish package to npm\n run: npm publish --access public\n env:\n NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n"}
|
|
149
|
+
Used tool: get_git_status with input: {}
|
|
150
|
+
Used tool: modify_file with input: {"filePath":"package.json","instruction":"Update version from \"1.0.0\" to \"1.0.1\""}
|
|
151
|
+
Used tool: git_add_all with input: {}
|
|
152
|
+
Used tool: git_commit with input: {"message":"build: bump package version to 1.0.1"}
|
|
153
|
+
Used tool: git_add_all with input: {}
|
|
154
|
+
Used tool: git_commit with input: {"message":"docs: update CHANGELOG for version 1.0.1"}
|
|
155
|
+
Used tool: modify_file with input: {"filePath":"CHANGELOG.md","instruction":"Add section for version 1.0.1 at top with date and changes for detailed API docs, examples, README updates, and CI consolidation."}
|
|
156
|
+
Used tool: modify_file with input: {"filePath":"CHANGELOG.md","instruction":"Correct file paths for version 1.0.1 entry: change 'docs/api.md' to 'user-docs/api-reference.md' and 'docs/examples/' to 'user-docs/examples.md'"}
|
|
157
|
+
Used tool: git_add_all with input: {}
|
|
158
|
+
Used tool: git_commit with input: {"message":"docs: update CHANGELOG for version 1.0.1"}
|
|
159
|
+
Used tool: run_command with input: {"command":"npm","args":["run","build"]}
|
|
160
|
+
Used tool: run_command with input: {"command":"npm","args":["run","type-check"]}
|
|
161
|
+
Used tool: run_command with input: {"command":"npm","args":["run","lint","--","--max-warnings=0"]}
|
|
162
|
+
Used tool: run_command with input: {"command":"npm","args":["run","duplicaiton"]}
|
|
163
|
+
Used tool: run_command with input: {"command":"npm","args":["run","duplication"]}
|
|
164
|
+
Used tool: run_command with input: {"command":"npm","args":["run","format:check"]}
|
|
165
|
+
Used tool: run_command with input: {"command":"npm","args":["run","test","--","--runInBand"]}
|
|
166
|
+
Used tool: git_push with input: {"comment":""}
|
|
167
|
+
Used tool: list_directory with input: {"dirPath":".github/workflows"}
|
|
168
|
+
Used tool: read_file with input: {"filePath":".github/workflows/ci-cd.yml"}
|
|
169
|
+
Used tool: list_directory with input: {"dirPath":".github/workflows"}
|
|
170
|
+
Used tool: wait_for_github_workflow with input: {"workflowName":"CI/CD Pipeline","timeout":600000}
|
|
147
171
|
---
|
|
148
172
|
|
|
149
173
|
**This was the result:**
|
|
150
174
|
---
|
|
151
|
-
I
|
|
175
|
+
I have completed the ##NOW and ##NEXT tasks:
|
|
176
|
+
|
|
177
|
+
- Created `user-docs/api-reference.md` with detailed API documentation.
|
|
178
|
+
- Created `user-docs/examples.md` with practical usage examples.
|
|
179
|
+
- Updated `README.md` to link to the new user-docs files under API Reference and Examples.
|
|
180
|
+
- Consolidated CI and deploy workflows into a single unified `.github/workflows/ci-cd.yml` pipeline:
|
|
181
|
+
- Separated quality-checks and publish jobs.
|
|
182
|
+
- Publish runs only once on Node 20.x after quality checks on main branch.
|
|
183
|
+
- Updated `CHANGELOG.md` for version 1.0.1 with correct file paths.
|
|
184
|
+
- Bumped `package.json` version to 1.0.1.
|
|
152
185
|
|
|
153
|
-
|
|
154
|
-
- Ran `npm run lint -- --format=json` to gather all size‐rule violations (none were flagged under the current 100‐line/500‐line thresholds).
|
|
155
|
-
- Committed an ESLint config bump to tighten to 90‐line‐per‐function and 400‐lines-per-file.
|
|
186
|
+
All local quality checks (build, type-check, lint, duplication, tests, format, security audit) passed. The unified CI/CD pipeline on GitHub Actions has completed successfully. Continuous deployment is now configured so every push to main that passes quality gates triggers publishing automatically.
|
|
156
187
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
- Pushed both commits to remote; CI has now green-lit the changes on Node.js 18.x and 20.x.
|
|
188
|
+
Next steps (for later):
|
|
189
|
+
- Add smoke tests post-publish to verify the package.
|
|
190
|
+
- Record CI and documentation consolidation in ADRs.
|
|
191
|
+
- Consider semantic-release for automated versioning.
|
|
162
192
|
|
|
163
|
-
|
|
193
|
+
Task complete.
|
|
164
194
|
---
|