@produck/agent-toolkit 0.8.0 → 0.8.1
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/bin/command/sync-lint/index.mjs +35 -11
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { spawnSync } from 'node:child_process';
|
|
4
3
|
import { fileURLToPath } from 'node:url';
|
|
5
4
|
|
|
6
5
|
import { getSingle, hasFlag } from '../shared/args.mjs';
|
|
@@ -9,7 +8,12 @@ import { printTextResource } from '../shared/text-resource.mjs';
|
|
|
9
8
|
const COMMAND_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
10
9
|
const HELP_FILE = path.resolve(COMMAND_DIR, 'help.txt');
|
|
11
10
|
const PACKAGE_ROOT = path.resolve(COMMAND_DIR, '../../..');
|
|
12
|
-
const
|
|
11
|
+
const REPO_ROOT = path.resolve(PACKAGE_ROOT, '../..');
|
|
12
|
+
const TOOLING_BASELINE_CANDIDATE_PATHS = [
|
|
13
|
+
path.resolve(REPO_ROOT, '.github/distribution/produck/tooling-version-baseline.json'),
|
|
14
|
+
path.resolve(PACKAGE_ROOT, 'publish-assets/instructions/produck/tooling-version-baseline.json'),
|
|
15
|
+
];
|
|
16
|
+
const ESLINT_RULES_PACKAGE_NAME = '@produck/eslint-rules';
|
|
13
17
|
const ESLINT_CONFIG_FILE = 'eslint.config.mjs';
|
|
14
18
|
|
|
15
19
|
const REQUIRED_LINT_SCRIPT_KEY = 'produck:lint';
|
|
@@ -51,21 +55,41 @@ function readFileIfExists(filePath) {
|
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
function getRequiredEslintRulesDevDependency() {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
// Prefer the in-tree source of truth: when sync-lint runs from inside the
|
|
59
|
+
// monorepo, the eslint-rules package.json is the authoritative version. When
|
|
60
|
+
// sync-lint runs as an installed dependency, fall back to the publish-assets
|
|
61
|
+
// tooling baseline (which build-publish-assets injects at prepack time from
|
|
62
|
+
// the same package.json).
|
|
63
|
+
const inTreeEslintRulesPkgPath = path.resolve(REPO_ROOT, 'packages/eslint-rules/package.json');
|
|
64
|
+
if (fs.existsSync(inTreeEslintRulesPkgPath)) {
|
|
65
|
+
const eslintRulesPkg = parseJsonFile(inTreeEslintRulesPkgPath, 'eslint-rules package.json');
|
|
66
|
+
const version = typeof eslintRulesPkg.version === 'string' ? eslintRulesPkg.version.trim() : '';
|
|
67
|
+
if (version) {
|
|
68
|
+
return version;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const toolingBaselinePath = TOOLING_BASELINE_CANDIDATE_PATHS.find((candidatePath) => {
|
|
73
|
+
return fs.existsSync(candidatePath);
|
|
57
74
|
});
|
|
58
75
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
if (!toolingBaselinePath) {
|
|
77
|
+
console.error('Cannot resolve @produck/eslint-rules version. Looked at:');
|
|
78
|
+
console.error(`- ${inTreeEslintRulesPkgPath}`);
|
|
79
|
+
for (const candidatePath of TOOLING_BASELINE_CANDIDATE_PATHS) {
|
|
80
|
+
console.error(`- ${candidatePath}`);
|
|
81
|
+
}
|
|
82
|
+
process.exit(2);
|
|
62
83
|
}
|
|
63
84
|
|
|
64
|
-
const
|
|
65
|
-
const
|
|
85
|
+
const baseline = parseJsonFile(toolingBaselinePath, 'Tooling baseline file');
|
|
86
|
+
const entry = baseline?.tools?.[ESLINT_RULES_PACKAGE_NAME];
|
|
87
|
+
const version = typeof entry?.version === 'string' ? entry.version.trim() : '';
|
|
66
88
|
|
|
67
89
|
if (!version) {
|
|
68
|
-
console.error(
|
|
90
|
+
console.error(
|
|
91
|
+
`Tooling baseline tools["${ESLINT_RULES_PACKAGE_NAME}"].version must be a non-empty string: ${toolingBaselinePath}`,
|
|
92
|
+
);
|
|
69
93
|
process.exit(2);
|
|
70
94
|
}
|
|
71
95
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@produck/agent-toolkit",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Central CLI toolkit for organization AI execution workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"c8": "11.0.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "86c4556d03847ded3d7876777e778cc16a800775"
|
|
34
34
|
}
|