@orkestrel/scaffold 0.0.82 → 0.0.83

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.
@@ -19,6 +19,9 @@ const RUNTIME_FIELDS = ['dependencies', 'peerDependencies'];
19
19
  const RANGE_FIELDS = [...RUNTIME_FIELDS, 'devDependencies'];
20
20
  const CATALOG = '.claude/agents/orkestrel.md';
21
21
  const OFFLINE_REFUSAL = "'catalog' does not take --offline";
22
+ // The vendored host is staged from this package's checkout, so overwriting it from the host deletes
23
+ // and replaces its own canon.
24
+ const SCAFFOLD = '@orkestrel/scaffold';
22
25
  const VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u;
23
26
  // The checkout runs the `.ts` sources and a built twin under `dist/agents` runs `.js` siblings.
24
27
  const EXTENSION = extname(fileURLToPath(import.meta.url));
@@ -223,10 +226,14 @@ function runOverwrite(runner, scaffoldFile, scaffoldPrefix, offline) {
223
226
  runStep(runner, 'overwrite', scaffoldFile, [...scaffoldPrefix, 'audit', ...offline], runner.target);
224
227
  }
225
228
  }
226
- function runVerify(runner, scaffoldFile, scaffoldPrefix, offline) {
229
+ function runVerify(runner, scaffoldFile, scaffoldPrefix, offline, own) {
227
230
  const audit = runStep(runner, 'verify', scaffoldFile, [...scaffoldPrefix, 'audit', '--json', ...offline], runner.target);
228
231
  if (audit === undefined)
229
232
  return;
233
+ // The audit reads the canonical sources of scaffold's own checkout as foreign paths and exits 1.
234
+ if (own && audit.status === 1) {
235
+ replaceLastStep(runner, 0, 'foreign-path findings are expected on the scaffold checkout');
236
+ }
230
237
  const releases = readReleases(audit.stdout);
231
238
  if (releases === undefined) {
232
239
  replaceLastStep(runner, audit.status === null || audit.status === 0 ? 2 : audit.status, 'the audit printed no releases envelope');
@@ -327,10 +334,14 @@ function runVisit(argv) {
327
334
  if (selected.has('commit') && !failed(runner))
328
335
  runCommit(runner);
329
336
  if (selected.has('overwrite') && !failed(runner)) {
330
- runOverwrite(runner, scaffoldFile, scaffoldPrefix, offline);
337
+ if (name === SCAFFOLD) {
338
+ recordStep(runner, 'overwrite', describeCommand(scaffoldFile, [...scaffoldPrefix, 'overwrite', '--json', ...offline]), `skipped with its audit: ${SCAFFOLD} is the package whose checkout the vendored host is staged from`);
339
+ }
340
+ else
341
+ runOverwrite(runner, scaffoldFile, scaffoldPrefix, offline);
331
342
  }
332
343
  if (selected.has('verify') && !failed(runner)) {
333
- runVerify(runner, scaffoldFile, scaffoldPrefix, offline);
344
+ runVerify(runner, scaffoldFile, scaffoldPrefix, offline, name === SCAFFOLD);
334
345
  }
335
346
  if (selected.has('install') && !failed(runner))
336
347
  runNpmStep(runner, 'install', ['install']);
package/dist/bin/main.js CHANGED
@@ -8,6 +8,124 @@ import { createSession } from "@orkestrel/process/server";
8
8
  import { readdirSync } from "node:fs";
9
9
  import { normalize } from "node:path";
10
10
  import { parseArgs } from "node:util";
11
+ var package_default = {
12
+ name: "@orkestrel/scaffold",
13
+ version: "0.0.83",
14
+ description: "Scaffold workspaces with commands: new, audit, repair, catalog, and overwrite.",
15
+ keywords: [
16
+ "audit",
17
+ "catalog",
18
+ "new",
19
+ "overwrite",
20
+ "repair"
21
+ ],
22
+ homepage: "https://github.com/orkestrel/scaffold#readme",
23
+ bugs: "https://github.com/orkestrel/scaffold/issues",
24
+ license: "MIT",
25
+ repository: {
26
+ "type": "git",
27
+ "url": "git+https://github.com/orkestrel/scaffold.git"
28
+ },
29
+ bin: { "scaffold": "dist/bin/main.js" },
30
+ files: [
31
+ "dist/src",
32
+ "dist/bin",
33
+ "dist/host",
34
+ "dist/agents",
35
+ "README.md"
36
+ ],
37
+ type: "module",
38
+ sideEffects: ["./src/bin/main.ts", "./dist/bin/main.js"],
39
+ main: "./dist/src/core/index.cjs",
40
+ module: "./dist/src/core/index.js",
41
+ exports: {
42
+ ".": {
43
+ "import": {
44
+ "types": "./dist/src/core/index.d.ts",
45
+ "default": "./dist/src/core/index.js"
46
+ },
47
+ "require": {
48
+ "types": "./dist/src/core/index.d.cts",
49
+ "default": "./dist/src/core/index.cjs"
50
+ }
51
+ },
52
+ "./server": {
53
+ "import": {
54
+ "types": "./dist/src/server/index.d.ts",
55
+ "default": "./dist/src/server/index.js"
56
+ },
57
+ "require": {
58
+ "types": "./dist/src/server/index.d.cts",
59
+ "default": "./dist/src/server/index.cjs"
60
+ }
61
+ },
62
+ "./package.json": "./package.json"
63
+ },
64
+ publishConfig: { "access": "public" },
65
+ scripts: {
66
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
67
+ "copy": "node -e \"const fs=require('node:fs'),p=require('node:path'),a=process.argv[1],b=process.argv[2];fs.mkdirSync(p.dirname(b),{recursive:true});fs.cpSync(a,b,{force:true});console.log('Copied: '+a+' to '+b)\"",
68
+ "scaffold": "node ./dist/bin/main.js",
69
+ "lint": "oxlint --config .oxlintrc.json --fix .",
70
+ "check": "tsc --noEmit --project tsconfig.json && npm run check:src && npm run check:skills",
71
+ "check:src": "npm run check:src:core && npm run check:src:server && npm run check:src:bin",
72
+ "check:src:core": "tsc --noEmit -p configs/src/tsconfig.core.json",
73
+ "check:src:server": "tsc --noEmit -p configs/src/tsconfig.server.json",
74
+ "check:src:bin": "tsc --noEmit -p configs/src/tsconfig.bin.json",
75
+ "check:skills": "tsc --noEmit -p configs/agents/tsconfig.skills.json",
76
+ "format": "oxfmt --config .oxfmtrc.json --write .",
77
+ "format:check": "oxfmt --config .oxfmtrc.json --check .",
78
+ "lint:check": "oxlint --config .oxlintrc.json --deny-warnings .",
79
+ "test": "npm run test:src:core && npm run test:src:server && npm run test:src:bin && npm run test:policy && npm run test:config && npm run test:setup && npm run test:skills && npm run test:guides",
80
+ "test:src:core": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:core",
81
+ "test:src:server": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:server",
82
+ "test:src:bin": "vitest run --config vite.config.ts --no-cache --reporter=dot --project src:bin",
83
+ "test:policy": "vitest run --config vite.config.ts --no-cache --reporter=dot --project policy",
84
+ "test:config": "vitest run --config vite.config.ts --no-cache --reporter=dot --project config",
85
+ "test:guides": "node --experimental-strip-types tests/guides.test.ts",
86
+ "test:skills": "vitest run --config vite.config.ts --no-cache --reporter=dot --project skills",
87
+ "test:distribution": "vitest run --config vite.config.ts --no-cache --reporter=dot --project distribution",
88
+ "test:probe": "vitest run --config vite.config.ts --no-cache --reporter=verbose --project probe",
89
+ "test:bench": "vitest bench --config vite.config.ts --no-cache --project probe",
90
+ "test:setup": "vitest run --config vite.config.ts --no-cache --reporter=dot --project setup",
91
+ "build": "npm run clean && npm run build:src && npm run build:host && npm run build:skills && npm run build:inventory",
92
+ "build:src": "npm run build:src:core && npm run build:src:server && npm run build:src:bin",
93
+ "build:src:core": "vite build --config configs/src/vite.core.config.ts && npm run copy dist/src/core/index.d.ts dist/src/core/index.d.cts",
94
+ "build:src:server": "vite build --config configs/src/vite.server.config.ts && npm run copy dist/src/server/index.d.ts dist/src/server/index.d.cts",
95
+ "build:src:bin": "vite build --config configs/src/vite.bin.config.ts",
96
+ "build:host": "node -e \"import('./dist/src/server/index.js').then((m)=>{const n=m.stageHost(process.cwd(),'dist/host',{report: (message) => console.error(message)}).length;console.log('build-host: staged '+n+' file(s) into dist/host')})\"",
97
+ "build:inventory": "node -e \"import('./dist/src/server/index.js').then((m)=>{const p=process.argv[1]??'host.json',n=m.stageInventory(process.cwd(),p).entries.length;console.log('build-inventory: staged '+n+' file(s) into '+p)})\"",
98
+ "build:skills": "tsc -p configs/agents/tsconfig.skills.json --noEmit false --allowImportingTsExtensions false --rewriteRelativeImportExtensions --declaration false --sourceMap false --rootDir .agents/skills --outDir dist/agents/skills && npm run copy .agents/templates/brief.md dist/agents/templates/brief.md",
99
+ "prepack": "npm run build",
100
+ "prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run build && npm test && npm run test:distribution -- --mode release"
101
+ },
102
+ dependencies: {
103
+ "@orkestrel/console": "^0.0.15",
104
+ "@orkestrel/contract": "^0.0.19",
105
+ "@orkestrel/emitter": "^0.0.11",
106
+ "@orkestrel/markdown": "^0.0.17",
107
+ "@orkestrel/process": "^0.0.14",
108
+ "@orkestrel/template": "^0.0.9"
109
+ },
110
+ devDependencies: {
111
+ "@microsoft/api-extractor": "^7.59.3",
112
+ "@orkestrel/browser": "^0.0.20",
113
+ "@orkestrel/guide": "^0.0.22",
114
+ "@orkestrel/html": "^0.0.12",
115
+ "@orkestrel/probe": "^0.0.19",
116
+ "@orkestrel/test": "^0.0.24",
117
+ "@types/node": "^26.6.3",
118
+ "@vitest/browser-playwright": "^4.1.11",
119
+ "oxfmt": "^0.71.0",
120
+ "oxlint": "^1.86.0",
121
+ "playwright": "^1.63.0",
122
+ "typescript": "^6.0.3",
123
+ "vite": "^8.3.2",
124
+ "vitest": "^4.1.11"
125
+ },
126
+ engines: { "node": ">=22.18.0" }
127
+ };
128
+ //#endregion
11
129
  //#region src/bin/constants.ts
12
130
  /**
13
131
  * Names the command the executable installs as.
@@ -19,6 +137,15 @@ import { parseArgs } from "node:util";
19
137
  */
20
138
  var EXECUTABLE_NAME = "scaffold";
21
139
  /**
140
+ * Names the package this executable ships in, as its manifest declares it.
141
+ *
142
+ * @remarks
143
+ * A target declaring this name is the checkout the vendored host is staged
144
+ * from, so `repair` and `overwrite` refuse it: a write from the host would
145
+ * replace that checkout's canon with the copy staged from it.
146
+ */
147
+ var PACKAGE_NAME = package_default.name;
148
+ /**
22
149
  * Lists the {@link Verb} values in usage order, frozen.
23
150
  *
24
151
  * @remarks
@@ -2299,6 +2426,7 @@ var CLI = class {
2299
2426
  };
2300
2427
  }
2301
2428
  #assertTarget(target, blueprint, groups) {
2429
+ if (manifestToName(this.#manifest(target)) === PACKAGE_NAME) throw new ScaffoldError("TARGET", `The target at ${target} is the ${PACKAGE_NAME} package, whose canon the vendored host is staged from. Run repair and overwrite against a workspace that consumes it.`, { target });
2302
2430
  const questions = this.#targetQuestions(target, blueprint, groups, true);
2303
2431
  if (questions.length === 0) return;
2304
2432
  throw new ScaffoldError("TARGET", questions.map((question) => question.message).join(" "), { target });