@arjunkhera/atlas 0.4.36 → 0.4.37
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.
|
@@ -23,7 +23,7 @@ export const TOOLING_LABEL = 'atlas-helper';
|
|
|
23
23
|
|
|
24
24
|
// The only files the tooling writer may write: the check, its workflow, and
|
|
25
25
|
// the pull request template when the repo has none.
|
|
26
|
-
export const TOOLING_PATHS = Object.freeze([CHECK_PATH, WORKFLOW_PATH, '.github/workflows/atlas-jobs.yml', '.github/workflows/atlas-upkeep.yml', '.github/pull_request_template.md']);
|
|
26
|
+
export const TOOLING_PATHS = Object.freeze([CHECK_PATH, WORKFLOW_PATH, '.github/workflows/atlas-jobs.yml', '.github/workflows/atlas-upkeep.yml', '.github/workflows/atlas-procedures.yml', '.github/pull_request_template.md']);
|
|
27
27
|
// The only files the tooling writer may remove: the workflow of check versions
|
|
28
28
|
// 1 to 5, which the gate workflow replaces (roadmap R7).
|
|
29
29
|
export const TOOLING_REMOVALS = Object.freeze([OLD_WORKFLOW_PATH]);
|
package/door/lib/tooling.mjs
CHANGED
|
@@ -47,8 +47,14 @@ export const PACKAGE_JOBS_SOURCE = 'door/templates/atlas-jobs.yml';
|
|
|
47
47
|
// master and has no pin, so the writer keeps it and Atlas runs one upkeep job.
|
|
48
48
|
export const UPKEEP_PATH = '.github/workflows/atlas-upkeep.yml';
|
|
49
49
|
export const PACKAGE_UPKEEP_SOURCE = 'door/templates/atlas-upkeep.yml';
|
|
50
|
+
// The tagged procedure steps on each pull request that changes a skill
|
|
51
|
+
// (roadmap R40). The same pin rule holds. The Atlas repo runs these steps in
|
|
52
|
+
// its own package gates job, so the writer never writes this file there.
|
|
53
|
+
export const PROCEDURES_PATH = '.github/workflows/atlas-procedures.yml';
|
|
54
|
+
export const PACKAGE_PROCEDURES_SOURCE = 'door/templates/atlas-procedures.yml';
|
|
50
55
|
// The workflows the writer pins, in the order of its rows.
|
|
51
|
-
const PINNED = Object.freeze([[JOBS_PATH, PACKAGE_JOBS_SOURCE], [UPKEEP_PATH, PACKAGE_UPKEEP_SOURCE]]);
|
|
56
|
+
const PINNED = Object.freeze([[JOBS_PATH, PACKAGE_JOBS_SOURCE], [UPKEEP_PATH, PACKAGE_UPKEEP_SOURCE], [PROCEDURES_PATH, PACKAGE_PROCEDURES_SOURCE]]);
|
|
57
|
+
const pinnedFor = (root, packageRoot) => (isPackageRepo(root, packageRoot) ? PINNED.filter(([path]) => path !== PROCEDURES_PATH) : PINNED);
|
|
52
58
|
const VERSION_SLOT = '__ATLAS_VERSION__';
|
|
53
59
|
function packagedPinned(packageRoot, source) {
|
|
54
60
|
const full = join(packageRoot, source);
|
|
@@ -56,6 +62,7 @@ function packagedPinned(packageRoot, source) {
|
|
|
56
62
|
}
|
|
57
63
|
export const packagedJobsWorkflow = (packageRoot) => packagedPinned(packageRoot, PACKAGE_JOBS_SOURCE);
|
|
58
64
|
export const packagedUpkeepWorkflow = (packageRoot) => packagedPinned(packageRoot, PACKAGE_UPKEEP_SOURCE);
|
|
65
|
+
export const packagedProceduresWorkflow = (packageRoot) => packagedPinned(packageRoot, PACKAGE_PROCEDURES_SOURCE);
|
|
59
66
|
const pinOf = (text) => /@arjunkhera\/atlas@(\d+)\.(\d+)\.(\d+)\b/.exec(text)?.slice(1).map(Number) ?? null;
|
|
60
67
|
const older = (a, b) => { for (let i = 0; i < 3; i += 1) if (a[i] !== b[i]) return a[i] < b[i]; return false; };
|
|
61
68
|
// written, refreshed, unchanged or kept: what the writer does with one pinned workflow.
|
|
@@ -69,7 +76,7 @@ function pinnedState(root, packageRoot, path, source) {
|
|
|
69
76
|
const have = pinOf(was);
|
|
70
77
|
return have && older(have, pinOf(wanted)) ? 'refreshed' : 'kept';
|
|
71
78
|
}
|
|
72
|
-
const pinnedNeedWrite = (root, packageRoot) =>
|
|
79
|
+
const pinnedNeedWrite = (root, packageRoot) => pinnedFor(root, packageRoot).some(([path, source]) => ['written', 'refreshed'].includes(pinnedState(root, packageRoot, path, source)));
|
|
73
80
|
|
|
74
81
|
// The pull request template (roadmap R8). The writer puts it into a repo that
|
|
75
82
|
// has none, and never replaces a template the repo keeps.
|
|
@@ -154,7 +161,7 @@ export function write(root, packageRoot, { dryRun = false, replaceUnknown = fals
|
|
|
154
161
|
if (!dryRun) rmSync(join(root, OLD_WORKFLOW_PATH));
|
|
155
162
|
rows.push({ path: OLD_WORKFLOW_PATH, state: 'removed', sha256: null, was: sha256(was) });
|
|
156
163
|
}
|
|
157
|
-
for (const [path, source] of workflowOnly ? [] :
|
|
164
|
+
for (const [path, source] of workflowOnly ? [] : pinnedFor(root, packageRoot)) {
|
|
158
165
|
const state = pinnedState(root, packageRoot, path, source);
|
|
159
166
|
if (state === null) continue;
|
|
160
167
|
const contents = packagedPinned(packageRoot, source);
|
|
@@ -190,7 +197,7 @@ export function changes(root, packageRoot, { replaceUnknown = false, workflowOnl
|
|
|
190
197
|
if (rows.every((row) => row.state === 'unchanged' || row.state === 'kept')) {
|
|
191
198
|
throw new ToolingRefusal('this repo is already current: its Atlas files match the package, so there is nothing to open.', { current: true });
|
|
192
199
|
}
|
|
193
|
-
const wanted = { ...packagedFiles(packageRoot), [JOBS_PATH]: packagedJobsWorkflow(packageRoot), [UPKEEP_PATH]: packagedUpkeepWorkflow(packageRoot), [PR_TEMPLATE_PATH]: packagedTemplate(packageRoot) };
|
|
200
|
+
const wanted = { ...packagedFiles(packageRoot), [JOBS_PATH]: packagedJobsWorkflow(packageRoot), [UPKEEP_PATH]: packagedUpkeepWorkflow(packageRoot), [PROCEDURES_PATH]: packagedProceduresWorkflow(packageRoot), [PR_TEMPLATE_PATH]: packagedTemplate(packageRoot) };
|
|
194
201
|
return rows
|
|
195
202
|
.filter((row) => row.state !== 'unchanged' && row.state !== 'kept')
|
|
196
203
|
.map((row) => (row.state === 'removed' ? {
|
|
@@ -206,8 +213,8 @@ export function changes(root, packageRoot, { replaceUnknown = false, workflowOnl
|
|
|
206
213
|
? `copied byte for byte from ${PACKAGE_CHECK_SOURCE}, check version ${CHECK_VERSION}, in Atlas ${version}`
|
|
207
214
|
: row.path === PR_TEMPLATE_PATH
|
|
208
215
|
? `copied from ${PACKAGE_TEMPLATE_SOURCE}, Atlas ${version}; the repo had no pull request template`
|
|
209
|
-
:
|
|
210
|
-
? `written from ${
|
|
216
|
+
: PINNED.some(([path]) => path === row.path)
|
|
217
|
+
? `written from ${PINNED.find(([path]) => path === row.path)[1]}, with its pin set to Atlas ${version}`
|
|
211
218
|
: `written from the WORKFLOW_TEMPLATE constant in ${PACKAGE_CHECK_SOURCE}, Atlas ${version}`,
|
|
212
219
|
},
|
|
213
220
|
}));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: atlas-procedures
|
|
2
|
+
# The Atlas procedure steps (roadmap R40). `atlas tooling` wrote this file from
|
|
3
|
+
# the Atlas package; do not edit it by hand.
|
|
4
|
+
#
|
|
5
|
+
# A procedure is a skill that atlas.yaml names under `procedures:`. A step a
|
|
6
|
+
# clean machine can run sits in a fenced block tagged `atlas-run`. This job
|
|
7
|
+
# runs those blocks for each procedure that a pull request changes: the
|
|
8
|
+
# procedure folder, or a path its `sources:` names. A block tagged
|
|
9
|
+
# `needs=secret/<name>`, `needs=device/<name>` or `needs=network/<name>` is
|
|
10
|
+
# listed "not run here".
|
|
11
|
+
#
|
|
12
|
+
# The path filter starts the job only when a skill or atlas.yaml changes, so
|
|
13
|
+
# most pull requests start nothing. A change to a path that a procedure names
|
|
14
|
+
# in `sources:` alone does not start it; the upkeep check lists that procedure
|
|
15
|
+
# instead. The steps run the code of the pull request, so the job holds a
|
|
16
|
+
# token that can only read and no repo secret, also for a pull request from a
|
|
17
|
+
# fork. npx runs outside the checkout, so an .npmrc in the pull request cannot
|
|
18
|
+
# pick the registry of Atlas itself.
|
|
19
|
+
on:
|
|
20
|
+
pull_request:
|
|
21
|
+
paths:
|
|
22
|
+
- ".claude/skills/**"
|
|
23
|
+
- "atlas.yaml"
|
|
24
|
+
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
|
|
28
|
+
concurrency:
|
|
29
|
+
group: atlas-procedures-${{ github.event.pull_request.number }}
|
|
30
|
+
cancel-in-progress: true
|
|
31
|
+
|
|
32
|
+
jobs:
|
|
33
|
+
procedures:
|
|
34
|
+
name: procedures · tagged steps
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
timeout-minutes: 10
|
|
37
|
+
steps:
|
|
38
|
+
# actions/checkout v7.0.1
|
|
39
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
40
|
+
with:
|
|
41
|
+
fetch-depth: 0
|
|
42
|
+
persist-credentials: false
|
|
43
|
+
# actions/setup-node v7.0.0
|
|
44
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
|
45
|
+
with:
|
|
46
|
+
node-version: "22.22.0"
|
|
47
|
+
- name: Run the tagged steps of each procedure this pull request changes
|
|
48
|
+
env:
|
|
49
|
+
BASE_REF: ${{ github.base_ref }}
|
|
50
|
+
run: |
|
|
51
|
+
set -euo pipefail
|
|
52
|
+
cd "$RUNNER_TEMP"
|
|
53
|
+
npx --yes --ignore-scripts @arjunkhera/atlas@__ATLAS_VERSION__ upkeep procedures --root "$GITHUB_WORKSPACE" --base "origin/$BASE_REF" | tee -a "$GITHUB_STEP_SUMMARY"
|
package/package.json
CHANGED