@ankhorage/devtools 1.21.1 → 1.21.3
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/tools/skills/assets/ankhorage-project-structure/SKILL.md +7 -1
- package/dist/tools/workflows/files/release.yml +2 -1
- package/dist/tools/workflows/files/renovate.json5 +3 -1
- package/dist/tools/workflows/index.js +2 -2
- package/dist/tools/workflows/renderRenovateConfigAsync.d.ts +2 -0
- package/dist/tools/workflows/renderRenovateConfigAsync.js +35 -0
- package/package.json +1 -1
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, runtime policies, and agent standards for Ankhorage TypeScript projects
|
|
9
9
|
|
|
@@ -163,7 +163,13 @@ belong together in `ankhorage/navigator/src/constants/navigator.ts`.
|
|
|
163
163
|
`utils/` is the only utility directory name. Do not create `shared/`, `helper/`, `helpers/`,
|
|
164
164
|
`common/`, or equivalent catch-all folders. It is not a destination for every pure function or type.
|
|
165
165
|
|
|
166
|
-
Apply **reuse before implementation** and **shared by default** before choosing a local owner.
|
|
166
|
+
Apply **reuse before implementation** and **shared by default** before choosing a local owner.
|
|
167
|
+
|
|
168
|
+
Treat the **second equivalent generic implementation as the duplication threshold**. When the same
|
|
169
|
+
general-purpose regex, parser pattern, formatter, validator, algorithm, or static policy appears in
|
|
170
|
+
two places, stop copying it and resolve its canonical shared owner. For runtime-neutral reusable
|
|
171
|
+
behavior or patterns, inspect and extend `@ankhorage/utility` first. Do not wait for a third copy,
|
|
172
|
+
and do not create repo-local aliases around the shared implementation. For
|
|
167
173
|
every function that could reasonably be reused across repositories, you MUST first inspect the
|
|
168
174
|
published `@ankhorage/utility` public API and its owning topic. Reuse the existing export when its
|
|
169
175
|
semantics match. If the function is missing and is generic without product, manifest, or framework
|
|
@@ -372,7 +372,8 @@ jobs:
|
|
|
372
372
|
};
|
|
373
373
|
if (
|
|
374
374
|
!/^@ankhorage\/[a-z0-9][a-z0-9-]*$/.test(release.name ?? '') ||
|
|
375
|
-
|
|
375
|
+
typeof release.version !== 'string' ||
|
|
376
|
+
release.version.length === 0 ||
|
|
376
377
|
!/^ankhorage\/[a-z0-9-]+$/.test(release.sourceRepository ?? '')
|
|
377
378
|
) {
|
|
378
379
|
throw new Error(
|
|
@@ -5,6 +5,7 @@ import { resolveStructureReleaseCommandAsync } from '../../features/structure-de
|
|
|
5
5
|
import { bunRuntimePolicy, nodeRuntimePolicy } from '../../policy/bunRuntimePolicy.js';
|
|
6
6
|
import { resolvePkgvizAuditPolicyAsync } from '../../policy/resolvePkgvizAuditPolicyAsync.js';
|
|
7
7
|
import { readCurrentDoctorVersion } from './readCurrentDoctorVersion.js';
|
|
8
|
+
import { renderRenovateConfigAsync } from './renderRenovateConfigAsync.js';
|
|
8
9
|
import { renderRenovateWorkflowAsync } from './renderRenovateWorkflowAsync.js';
|
|
9
10
|
import { renderWorkflowAsync } from './renderWorkflowAsync.js';
|
|
10
11
|
export const workflowManagedFiles = [
|
|
@@ -26,8 +27,7 @@ export const workflowManagedFiles = [
|
|
|
26
27
|
createRenovateWorkflowDefinition(),
|
|
27
28
|
{
|
|
28
29
|
relativePath: 'renovate.json5',
|
|
29
|
-
|
|
30
|
-
mode: 'create-only',
|
|
30
|
+
render: renderRenovateConfigAsync,
|
|
31
31
|
},
|
|
32
32
|
];
|
|
33
33
|
/*** Create a managed workflow definition rendered from current shared runtime policies. */
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const TEMPLATE_URL = new URL('./files/renovate.json5', import.meta.url);
|
|
4
|
+
const LEGACY_HEADER_PATTERN = /^\/\*\*\*([\s\S]*?)\*\/\n/u;
|
|
5
|
+
/*** Render Renovate config while preserving repository-owned rules and removing obsolete Paradox metadata. */
|
|
6
|
+
export async function renderRenovateConfigAsync(targetDirectory) {
|
|
7
|
+
const targetPath = join(targetDirectory, 'renovate.json5');
|
|
8
|
+
let current;
|
|
9
|
+
try {
|
|
10
|
+
current = await readFile(targetPath, 'utf8');
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
14
|
+
return await readFile(TEMPLATE_URL, 'utf8');
|
|
15
|
+
}
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
return migrateLegacyRenovateHeader(current);
|
|
19
|
+
}
|
|
20
|
+
/*** Convert the historical managed Paradox header to an ordinary comment without changing config data. */
|
|
21
|
+
function migrateLegacyRenovateHeader(contents) {
|
|
22
|
+
const match = LEGACY_HEADER_PATTERN.exec(contents);
|
|
23
|
+
if (match === null)
|
|
24
|
+
return contents;
|
|
25
|
+
const [header, body = ''] = match;
|
|
26
|
+
if (!body.includes('Repository configuration'))
|
|
27
|
+
return contents;
|
|
28
|
+
if (!body.includes('@usage') && !body.includes('@readme'))
|
|
29
|
+
return contents;
|
|
30
|
+
const migratedBody = body
|
|
31
|
+
.split('\n')
|
|
32
|
+
.filter((line) => !/^\s*\*\s+@(usage|readme)\s*$/u.test(line))
|
|
33
|
+
.join('\n');
|
|
34
|
+
return `/**${migratedBody}*/\n${contents.slice(header.length)}`;
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/devtools",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.3",
|
|
4
4
|
"description": "Shared tooling, repository automation, runtime policies, and agent standards for Ankhorage TypeScript projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/devtools#readme",
|