@ankhorage/devtools 2.0.116 → 2.1.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/README.md +1 -1
- package/dist/owner/synchronizeRenovateOwnerAsync.js +3 -4
- package/dist/policy/applyBunRuntimePolicy.d.ts +1 -1
- package/dist/policy/applyBunRuntimePolicy.js +6 -4
- package/dist/policy/renderBunPolicyDocumentation.d.ts +1 -1
- package/dist/policy/renderBunPolicyDocumentation.js +6 -5
- package/dist/policy/resolvePkgvizAuditPolicyAsync.js +2 -2
- package/dist/tools/package/index.js +10 -11
- package/dist/tools/skills/assets/ankhorage-coding-rules/SKILL.md +1 -1
- package/dist/tools/workflows/index.js +5 -6
- package/dist/tools/workflows/renderWorkflowAsync.js +4 -4
- package/package.json +6 -6
- package/dist/policy/bunRuntimePolicy.d.ts +0 -5
- package/dist/policy/bunRuntimePolicy.js +0 -5
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/devtools
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects
|
|
9
9
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { dirname, resolve } from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { REPOSITORY_RULE_METADATA } from '@ankhorage/rules-repository';
|
|
5
5
|
import { resolveApmReleaseCommandAsync } from '../features/apm-release-validation/adapters/outbound/resolveApmReleaseCommandAsync.js';
|
|
6
6
|
import { resolveStructureReleaseCommandAsync } from '../features/structure-descriptor-generation/adapters/outbound/resolveStructureReleaseCommandAsync.js';
|
|
7
7
|
import { applyBunRuntimePolicy } from '../policy/applyBunRuntimePolicy.js';
|
|
8
|
-
import { DEVTOOLS_BUN_RUNTIME_POLICY } from '../policy/bunRuntimePolicy.js';
|
|
9
8
|
import { readCurrentDoctorVersion } from '../tools/workflows/readCurrentDoctorVersion.js';
|
|
10
9
|
import { renderRenovateWorkflowAsync } from '../tools/workflows/renderRenovateWorkflowAsync.js';
|
|
11
10
|
import { renderWorkflowAsync, } from '../tools/workflows/renderWorkflowAsync.js';
|
|
@@ -61,9 +60,9 @@ async function createWorkflowPolicyAsync(targetDirectory) {
|
|
|
61
60
|
return {
|
|
62
61
|
apmReleaseCommand: await resolveApmReleaseCommandAsync(targetDirectory),
|
|
63
62
|
structureReleaseCommand: await resolveStructureReleaseCommandAsync(targetDirectory),
|
|
64
|
-
bunVersion:
|
|
63
|
+
bunVersion: REPOSITORY_RULE_METADATA.runtime.bun.version,
|
|
65
64
|
doctorVersion: readCurrentDoctorVersion(),
|
|
66
|
-
nodeVersion:
|
|
65
|
+
nodeVersion: REPOSITORY_RULE_METADATA.runtime.node.setupVersion,
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
68
|
/*** Return owner-managed artifact paths whose current bytes differ from policy output. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*** Apply the
|
|
1
|
+
/*** Apply the Rules-owned Bun runtime contract to one package manifest. */
|
|
2
2
|
export declare function applyBunRuntimePolicy(manifest: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/*** Apply the
|
|
1
|
+
import { REPOSITORY_RULE_METADATA } from '@ankhorage/rules-repository';
|
|
2
|
+
/*** Apply the Rules-owned Bun runtime contract to one package manifest. */
|
|
3
3
|
export function applyBunRuntimePolicy(manifest) {
|
|
4
4
|
const devDependencies = toRecord(manifest.devDependencies);
|
|
5
|
-
devDependencies['@types/bun'] =
|
|
5
|
+
devDependencies['@types/bun'] = REPOSITORY_RULE_METADATA.runtime.bun.typesRange;
|
|
6
6
|
return {
|
|
7
7
|
...manifest,
|
|
8
|
-
packageManager:
|
|
8
|
+
packageManager: REPOSITORY_RULE_METADATA.runtime.bun.packageManager,
|
|
9
9
|
devDependencies,
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
+
/*** Narrow an unknown JSON-like value to a non-array record. */
|
|
12
13
|
function isRecord(value) {
|
|
13
14
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
14
15
|
}
|
|
16
|
+
/*** Copy a JSON-like value to a mutable record or return an empty record. */
|
|
15
17
|
function toRecord(value) {
|
|
16
18
|
return isRecord(value) ? { ...value } : {};
|
|
17
19
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*** Render the managed Bun
|
|
1
|
+
/*** Render the managed Bun Rules section while preserving the surrounding guide. */
|
|
2
2
|
export declare function renderBunPolicyDocumentation(readme: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/*** Render the managed Bun
|
|
1
|
+
import { REPOSITORY_RULE_METADATA } from '@ankhorage/rules-repository';
|
|
2
|
+
/*** Render the managed Bun Rules section while preserving the surrounding guide. */
|
|
3
3
|
export function renderBunPolicyDocumentation(readme) {
|
|
4
4
|
const startIndex = readme.indexOf(README_POLICY_START);
|
|
5
5
|
const endIndex = readme.indexOf(README_POLICY_END);
|
|
@@ -15,10 +15,11 @@ export function renderBunPolicyDocumentation(readme) {
|
|
|
15
15
|
}
|
|
16
16
|
/*** Format canonical runtime and type-package versions for the guide. */
|
|
17
17
|
function renderReadmePolicy() {
|
|
18
|
+
const { packageManager, typesRange, version } = REPOSITORY_RULE_METADATA.runtime.bun;
|
|
18
19
|
return `\`\`\`text
|
|
19
|
-
Bun runtime ${
|
|
20
|
-
packageManager ${
|
|
21
|
-
@types/bun ${
|
|
20
|
+
Bun runtime ${version}
|
|
21
|
+
packageManager ${packageManager}
|
|
22
|
+
@types/bun ${typesRange}
|
|
22
23
|
\`\`\``;
|
|
23
24
|
}
|
|
24
25
|
const README_POLICY_END = '<!-- devtools-bun-policy:end -->';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { stat } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { REPOSITORY_RULE_METADATA } from '@ankhorage/rules-repository';
|
|
4
4
|
/*** Resolve the central PKGViz CI audit for repositories with analyzable source. */
|
|
5
5
|
export async function resolvePkgvizAuditPolicyAsync(targetDirectory) {
|
|
6
6
|
if (!(await hasSourceDirectoryAsync(targetDirectory)))
|
|
7
7
|
return undefined;
|
|
8
|
-
const { artifactName, artifactPath, command } =
|
|
8
|
+
const { artifactName, artifactPath, command } = REPOSITORY_RULE_METADATA.pkgvizAudit;
|
|
9
9
|
return { artifactName, artifactPath, command };
|
|
10
10
|
}
|
|
11
11
|
/*** Detect whether the managed repository has a source tree that PKGViz can inspect. */
|
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
import { existsSync, readFileSync } from 'node:fs';
|
|
21
21
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
22
22
|
import { resolve } from 'node:path';
|
|
23
|
-
import {
|
|
23
|
+
import { REPOSITORY_RULE_METADATA } from '@ankhorage/rules-repository';
|
|
24
24
|
import { applyBunRuntimePolicy } from '../../policy/applyBunRuntimePolicy.js';
|
|
25
|
-
import { DEVTOOLS_BUN_RUNTIME_POLICY } from '../../policy/bunRuntimePolicy.js';
|
|
26
25
|
const PACKAGE_PATH = 'package.json';
|
|
27
26
|
const DEVTOOLS_PACKAGE_NAME = '@ankhorage/devtools';
|
|
28
27
|
const BUN_TYPES_PACKAGE_NAME = '@types/bun';
|
|
@@ -93,12 +92,12 @@ export function applyManagedPackageContract(manifest, devtoolsVersion, changeset
|
|
|
93
92
|
delete scripts.knip;
|
|
94
93
|
Object.assign(scripts, STANDARD_SCRIPTS);
|
|
95
94
|
if (changesetsEnabled) {
|
|
96
|
-
Object.assign(scripts,
|
|
95
|
+
Object.assign(scripts, REPOSITORY_RULE_METADATA.changesets.packageScripts);
|
|
97
96
|
}
|
|
98
97
|
const devDependencies = removeOwnedDependencies(toRecord(manifest.devDependencies));
|
|
99
98
|
const dependencies = toRecord(manifest.dependencies);
|
|
100
|
-
delete dependencies[
|
|
101
|
-
delete devDependencies[
|
|
99
|
+
delete dependencies[REPOSITORY_RULE_METADATA.changesets.packageName];
|
|
100
|
+
delete devDependencies[REPOSITORY_RULE_METADATA.changesets.packageName];
|
|
102
101
|
applyDevtoolsDependencyPlacement(dependencies, devDependencies, devtoolsVersion);
|
|
103
102
|
return applyBunRuntimePolicy({
|
|
104
103
|
...manifest,
|
|
@@ -121,8 +120,8 @@ export function isManagedPackageContractCurrent(manifest, devtoolsVersion, chang
|
|
|
121
120
|
const changesetsEnabled = isChangesetsEnabled(scripts, changesetsConfigExists);
|
|
122
121
|
return (hasStandardScripts(scripts) &&
|
|
123
122
|
DEVTOOLS_OWNED_DEV_DEPENDENCIES.every((name) => devDependencies[name] === undefined) &&
|
|
124
|
-
dependencies[
|
|
125
|
-
devDependencies[
|
|
123
|
+
dependencies[REPOSITORY_RULE_METADATA.changesets.packageName] === undefined &&
|
|
124
|
+
devDependencies[REPOSITORY_RULE_METADATA.changesets.packageName] === undefined &&
|
|
126
125
|
hasCurrentChangesetsScripts(scripts, changesetsEnabled) &&
|
|
127
126
|
hasCurrentDevtoolsDependencyPlacement(dependencies, devDependencies, devtoolsVersion));
|
|
128
127
|
}
|
|
@@ -155,8 +154,8 @@ async function readPackageManifest(targetDirectory) {
|
|
|
155
154
|
/*** Check the Bun package manager and Bun type dependency contract. */
|
|
156
155
|
function hasCurrentBunRuntimePolicy(manifest) {
|
|
157
156
|
const devDependencies = toRecord(manifest.devDependencies);
|
|
158
|
-
return (manifest.packageManager ===
|
|
159
|
-
devDependencies[BUN_TYPES_PACKAGE_NAME] ===
|
|
157
|
+
return (manifest.packageManager === REPOSITORY_RULE_METADATA.runtime.bun.packageManager &&
|
|
158
|
+
devDependencies[BUN_TYPES_PACKAGE_NAME] === REPOSITORY_RULE_METADATA.runtime.bun.typesRange);
|
|
160
159
|
}
|
|
161
160
|
/*** Place Devtools in development dependencies for every consuming repository. */
|
|
162
161
|
function applyDevtoolsDependencyPlacement(dependencies, devDependencies, devtoolsVersion) {
|
|
@@ -189,12 +188,12 @@ function hasStandardScripts(scripts) {
|
|
|
189
188
|
/*** Check Changesets scripts when the repository participates in Changesets. */
|
|
190
189
|
function hasCurrentChangesetsScripts(scripts, changesetsEnabled) {
|
|
191
190
|
return (!changesetsEnabled ||
|
|
192
|
-
Object.entries(
|
|
191
|
+
Object.entries(REPOSITORY_RULE_METADATA.changesets.packageScripts).every(([name, command]) => scripts[name] === command));
|
|
193
192
|
}
|
|
194
193
|
/*** Determine whether the repository participates in Changesets synchronization. */
|
|
195
194
|
function isChangesetsEnabled(scripts, changesetsConfigExists) {
|
|
196
195
|
return (changesetsConfigExists ||
|
|
197
|
-
Object.keys(
|
|
196
|
+
Object.keys(REPOSITORY_RULE_METADATA.changesets.packageScripts).some((scriptName) => scripts[scriptName] !== undefined));
|
|
198
197
|
}
|
|
199
198
|
/*** Serialize a package manifest using the repository formatting contract. */
|
|
200
199
|
function serializePackageManifest(manifest) {
|
|
@@ -53,7 +53,7 @@ exceptions or replaced by generic preferences from this skill.
|
|
|
53
53
|
reason behind a decision. Do not narrate self-explanatory code or duplicate what names and types
|
|
54
54
|
already express.
|
|
55
55
|
- Paradox documentation metadata belongs only inside `/*** ... */` comments. The canonical tag
|
|
56
|
-
vocabulary is owned by `@ankhorage/
|
|
56
|
+
vocabulary is owned by `@ankhorage/rules-documentation`: `@readme`, `@usage`, `@config`, `@title`,
|
|
57
57
|
`@see`, and `@security`. Unsupported tag-shaped lines are invalid; `@example` does not exist.
|
|
58
58
|
Do not use JSDoc-only tags such as `@param` or `@returns` as Paradox metadata.
|
|
59
59
|
- Paradox comments contain documentation prose and metadata only. Fenced or indented code blocks are
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { access } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { REPOSITORY_RULE_METADATA } from '@ankhorage/rules-repository';
|
|
4
4
|
import { resolveApmReleaseCommandAsync } from '../../features/apm-release-validation/adapters/outbound/resolveApmReleaseCommandAsync.js';
|
|
5
5
|
import { resolveStructureReleaseCommandAsync } from '../../features/structure-descriptor-generation/adapters/outbound/resolveStructureReleaseCommandAsync.js';
|
|
6
|
-
import { DEVTOOLS_BUN_RUNTIME_POLICY } from '../../policy/bunRuntimePolicy.js';
|
|
7
6
|
import { resolvePkgvizAuditPolicyAsync } from '../../policy/resolvePkgvizAuditPolicyAsync.js';
|
|
8
7
|
import { readCurrentDoctorVersion } from './readCurrentDoctorVersion.js';
|
|
9
8
|
import { renderRenovateConfigAsync } from './renderRenovateConfigAsync.js';
|
|
@@ -39,9 +38,9 @@ function createWorkflowDefinition(relativePath, sourcePath) {
|
|
|
39
38
|
render: async (targetDirectory) => await renderWorkflowAsync(sourceUrl, {
|
|
40
39
|
apmReleaseCommand: await resolveApmReleaseCommandAsync(targetDirectory),
|
|
41
40
|
structureReleaseCommand: await resolveStructureReleaseCommandAsync(targetDirectory),
|
|
42
|
-
bunVersion:
|
|
41
|
+
bunVersion: REPOSITORY_RULE_METADATA.runtime.bun.version,
|
|
43
42
|
doctorVersion: readCurrentDoctorVersion(),
|
|
44
|
-
nodeVersion:
|
|
43
|
+
nodeVersion: REPOSITORY_RULE_METADATA.runtime.node.setupVersion,
|
|
45
44
|
pkgvizAudit: await resolvePkgvizAuditPolicyAsync(targetDirectory),
|
|
46
45
|
}),
|
|
47
46
|
};
|
|
@@ -54,9 +53,9 @@ function createRenovateWorkflowDefinition() {
|
|
|
54
53
|
render: async (targetDirectory) => await renderRenovateWorkflowAsync(sourceUrl, targetDirectory, {
|
|
55
54
|
apmReleaseCommand: await resolveApmReleaseCommandAsync(targetDirectory),
|
|
56
55
|
structureReleaseCommand: await resolveStructureReleaseCommandAsync(targetDirectory),
|
|
57
|
-
bunVersion:
|
|
56
|
+
bunVersion: REPOSITORY_RULE_METADATA.runtime.bun.version,
|
|
58
57
|
doctorVersion: readCurrentDoctorVersion(),
|
|
59
|
-
nodeVersion:
|
|
58
|
+
nodeVersion: REPOSITORY_RULE_METADATA.runtime.node.setupVersion,
|
|
60
59
|
}),
|
|
61
60
|
};
|
|
62
61
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import {
|
|
2
|
+
import { REPOSITORY_RULE_METADATA } from '@ankhorage/rules-repository';
|
|
3
3
|
/*** Renders one workflow template with the canonical runtime, Doctor, and Changesets policy. */
|
|
4
4
|
export async function renderWorkflowAsync(sourceUrl, policy) {
|
|
5
5
|
const template = await readFile(sourceUrl, 'utf8');
|
|
6
6
|
const rendered = template
|
|
7
7
|
.replaceAll(BUN_VERSION_TOKEN, policy.bunVersion)
|
|
8
8
|
.replaceAll(PKGVIZ_AUDIT_STEPS_TOKEN, renderPkgvizAuditSteps(policy))
|
|
9
|
-
.replaceAll(CHANGESETS_PUBLISH_COMMAND_TOKEN,
|
|
10
|
-
.replaceAll(CHANGESETS_STATUS_COMMAND_TOKEN,
|
|
11
|
-
.replaceAll(CHANGESETS_VERSION_COMMAND_TOKEN,
|
|
9
|
+
.replaceAll(CHANGESETS_PUBLISH_COMMAND_TOKEN, REPOSITORY_RULE_METADATA.changesets.workflowCommands.publish)
|
|
10
|
+
.replaceAll(CHANGESETS_STATUS_COMMAND_TOKEN, REPOSITORY_RULE_METADATA.changesets.workflowCommands.status)
|
|
11
|
+
.replaceAll(CHANGESETS_VERSION_COMMAND_TOKEN, REPOSITORY_RULE_METADATA.changesets.workflowCommands.version)
|
|
12
12
|
.replaceAll(DOCTOR_VERSION_TOKEN, policy.doctorVersion)
|
|
13
13
|
.replaceAll('__ANKH_APM_RELEASE_COMMAND__', policy.apmReleaseCommand ?? './node_modules/.bin/ankhorage-apm-release')
|
|
14
14
|
.replaceAll('__ANKH_STRUCTURE_RELEASE_COMMAND__', policy.structureReleaseCommand ?? './node_modules/.bin/ankhorage-structure')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/devtools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/devtools#readme",
|
|
@@ -122,7 +122,9 @@
|
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
124
|
"@ankhorage/apm": "^0.8.13",
|
|
125
|
+
"@ankhorage/contracts": "^22.8.93",
|
|
125
126
|
"@ankhorage/project-detector": "^0.3.3",
|
|
127
|
+
"@ankhorage/rules-repository": "^0.2.0",
|
|
126
128
|
"@ankhorage/utility": "^0.5.5",
|
|
127
129
|
"@changesets/cli": "^3.0.3",
|
|
128
130
|
"@eslint/compat": "^2.1.1",
|
|
@@ -140,15 +142,13 @@
|
|
|
140
142
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
141
143
|
"knip": "^6.39.0",
|
|
142
144
|
"prettier": "^3.9.9",
|
|
143
|
-
"typescript-eslint": "^8.71.0",
|
|
144
|
-
"@ankhorage/contracts": "^22.8.93",
|
|
145
145
|
"typescript": "~6.0.3",
|
|
146
|
-
"
|
|
146
|
+
"typescript-eslint": "^8.71.0"
|
|
147
147
|
},
|
|
148
148
|
"devDependencies": {
|
|
149
|
-
"@ankhorage/paradox": "^0.2.
|
|
149
|
+
"@ankhorage/paradox": "^0.2.26",
|
|
150
150
|
"@ankhorage/ankh": "^0.10.80",
|
|
151
|
-
"@ankhorage/doctor": "0.
|
|
151
|
+
"@ankhorage/doctor": "0.12.0",
|
|
152
152
|
"@techstark/opencv-js": "^5.0.0-release.1",
|
|
153
153
|
"@types/bun": "^1.4.2",
|
|
154
154
|
"@types/node": "^26.6.4",
|