Move the npm package to @myrtechnology/cli, since npm's @myr is another account's, and keep @myr/cli/rules as a name the Lander and the local check resolve to the sdk, so a project made before the move still bundles; the leak check now finds the scope's spelling too, and the examples' config folders import from the new name, pinned to 0.2.2, with datekit's layer the known-bad commits the changed tree makes
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by oscabriel · committed by oscabriel · parent 5a67ee9 · Browse files · 16 files·+79 added−25 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
16 files+79 added−25 removed
- tests:+42 added−1 removed
- other:+37 added−24 removed
Provenance
- Commit
192230d- Tree
c90a9a0- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent
5a67ee9
16 files changed+79 added−25 removed
modified:apps/cli/src/local/local-policy.ts+3 added-4 removed
120 unmodified lines121 dir,122 "tsconfig.json",123 JSON.stringify({124 compilerOptions: {125- paths: {126- [`${Brand.cliPackage}/rules`]: [sdk],127- "@repo/sdk": [sdk],128- },125+ paths: Object.fromEntries(126+ [...Brand.sdkImports, "@repo/sdk"].map((name) => [name, [sdk]])127+ ),128 },129 })130 );131 263 unmodified linesmodified:apps/sandbox/src/lander/script.ts+3 added-1 removed
407 unmodified lines408 export const resolution = (sdk: string) =>409 `${JSON.stringify(410 {411 compilerOptions: {412- paths: { [`${Brand.cliPackage}/rules`]: [sdk], "@repo/sdk": [sdk] },412+ paths: Object.fromEntries(413+ [...Brand.sdkImports, "@repo/sdk"].map((name) => [name, [sdk]])414+ ),415 },416 },417 null,418 2191 unmodified linesmodified:apps/sandbox/test/lander.test.ts+42 added-1 removed
232 unmodified lines233 234 return yield* Effect.promise((): Promise<Imported> => import(target));235 });236 237-const SDK_NAMES = [`"${Brand.cliPackage}/rules"`, '"@repo/sdk"'];237+const SDK_NAMES = [238+ ...Brand.sdkImports.map((name) => JSON.stringify(name)),239+ '"@repo/sdk"',240+];241 242 const pointedAtSdk = (source: string) => {243 let pointed = source;244 462 unmodified lines707 }).pipe(Effect.scoped, Effect.provide(TestServices))708 );709 710 it.live(711+ "bundles a folder that imports the sdk by a name it had before, as a project made then still does",712+ () =>713+ Effect.gen(function* () {714+ const [current, former] = Brand.sdkImports;715+ const repos = yield* world;716+717+ const formerly = Object.fromEntries(718+ Object.entries(configFolder).map(([file, source]) => [719+ file,720+ source === null ? null : source.replaceAll(current, former),721+ ])722+ );723+724+ expect(formerly[config("project.ts")]).toContain(former);725+726+ const at = yield* startedWith(repos, formerly);727+728+ const bundled = yield* bundleRules(bundleWire(repos, at)).pipe(729+ Effect.provide(box(repos.work))730+ );731+732+ const projectModule = yield* importedFrom(733+ bundled.modules,734+ config("project.ts")735+ );736+737+ const projectAsCommitted = yield* importedFrom(738+ asCommitted(configFolder),739+ config("project.ts")740+ );741+742+ expect(dataOf(projectModule)).toStrictEqual(743+ dataOf(projectAsCommitted)744+ );745+ }).pipe(Effect.scoped, Effect.provide(TestServices))746+ );747+748+ it.live(749 "gives no modules for a repo with no config folder, so the project runs on the defaults",750 () =>751 Effect.gen(function* () {752 const repos = yield* world;485 unmodified linesmodified:examples/burrow/.myr/asks/drop-legacy-fetch.ask.ts+1 added-1 removed
1123458 unmodified linesimport { kinds, territory } from "@myr/cli/rules";import { kinds, territory } from "@myrtechnology/cli/rules";
export default kinds.migrate.ask({ context: [ "http.get hands back a failed request as a value, where legacyFetch threw, so each caller decides what a failure means",8 unmodified linesmodified:examples/burrow/.myr/package.json+1 added-1 removed
12345567{ "private": true, "type": "module", "devDependencies": { "@myr/cli": "0.2.1" "@myrtechnology/cli": "0.2.2" }}modified:examples/burrow/.myr/project.ts+1 added-1 removed
11234527 unmodified linesimport { check, kinds, project, territory } from "@myr/cli/rules";import { check, kinds, project, territory } from "@myrtechnology/cli/rules";
// The run block `myr init` found in this repo's own files, each command with// where it was found; deciders, kinds and the ratchet added since.export default project({27 unmodified linesmodified:examples/datekit/.myr/asks/add-months-clamp.ask.ts+1 added-1 removed
1123458 unmodified linesimport { kinds, territory } from "@myr/cli/rules";import { kinds, territory } from "@myrtechnology/cli/rules";
export default kinds.fix.ask({ context: [ "addYears adds twelve months, so it follows: February 29 plus a year becomes February 28.",8 unmodified linesmodified:examples/datekit/.myr/asks/format-ordinal.ask.ts+1 added-1 removed
1123456 unmodified linesimport { kinds, territory } from "@myr/cli/rules";import { kinds, territory } from "@myrtechnology/cli/rules";
export default kinds.fix.ask({ current: "The 11th, 12th and 13th of a month print as 11st, 12nd and 13rd.", mentor: "okonkwo",6 unmodified linesmodified:examples/datekit/.myr/asks/parse-iso-week.ask.ts+1 added-1 removed
1-import { kinds, territory } from "@myr/cli/rules";1+import { kinds, territory } from "@myrtechnology/cli/rules";2 3 export default kinds.fix.ask({4 current:5 "parseISO gives an invalid date for every week date, so a payroll week or a sprint stored as 2026-W41 can't be read back.",8 unmodified linesmodified:examples/datekit/.myr/package.json+1 added-1 removed
1 {2 "private": true,3 "type": "module",4 "devDependencies": {5- "@myr/cli": "0.2.1"5+ "@myrtechnology/cli": "0.2.2"6 }7 }modified:examples/datekit/.myr/project.ts+1 added-1 removed
1-import { kinds, project } from "@myr/cli/rules";1+import { kinds, project } from "@myrtechnology/cli/rules";2 3 /**4 * How datekit takes changes. Each change we want is an ask in asks/, with a5 * test that fails on main; an answer lands when that test passes and the18 unmodified linesmodified:examples/datekit/.myr/visibility.ts+1 added-1 removed
1-import { flows, layer, sealedChecks, visibility } from "@myr/cli/rules";1+import { flows, layer, sealedChecks, visibility } from "@myrtechnology/cli/rules";2 3 /**4 * What datekit keeps out of its public tree, and why. The maintainers hold5 * checks for how dates are shown (export) and read (parser) in a layer of21 unmodified linesmodified:examples/datekit/layers/maintainers/.myr/layer.json+2 added-2 removed
110 unmodified lines111 "path": "checks/held-back/parser/fraction-digits.test.ts"112 }113 ],114 "knownBad": [115- "038860d9115139e3d23ce9c7a5814a5f67ef8416",116- "bee4f59771f2c1297bb4896dc495ee669be7d2f7"115+ "dbaee401dfda08e13c16ce9066727e2adb99ceca",116+ "af5d85ab3e43a2809ff19559f397028dbf3e86bf"117 ],118 "layer": "maintainers"119 }modified:examples/datekit/layers/maintainers/.myr/layer.ts+4 added-4 removed
1-import { layerManifest } from "@myr/cli/rules";2-import type { AreaOf } from "@myr/cli/rules";1+import { layerManifest } from "@myrtechnology/cli/rules";2+import type { AreaOf } from "@myrtechnology/cli/rules";3 4 // The public config sits beside this file in a maintainer's work tree, where5 // the layer is overlaid on main at the same paths.6 import type policy from "./visibility.ts";128 unmodified lines135 },136 ],137 knownBad: [138 // known-bad/export: unescapes only the first pair of quotes.139- "038860d9115139e3d23ce9c7a5814a5f67ef8416",139+ "dbaee401dfda08e13c16ce9066727e2adb99ceca",140 // known-bad/parser: rounds the digits past the millisecond.141- "bee4f59771f2c1297bb4896dc495ee669be7d2f7",141+ "af5d85ab3e43a2809ff19559f397028dbf3e86bf",142 ],143 layer: "maintainers",144 });modified:packages/brand/src/index.ts+10 added-2 removed
4 unmodified lines5 // The platform's own host on prod: where the CLI signs in and reads when6 // nothing names another platform.7 const platformHost = `git.${domain}`;8 9+// npm's `@myr` is another account's, so the package's scope spells the domain.10+const npmScope = `@${slug}technology`;11+12+const cliPackage = `${npmScope}/cli`;13+14 export const Brand = {15 cli: slug,11- cliPackage: `@${slug}/cli`,16+ cliPackage,17 configDir: `.${slug}`,18 domain,19 gitCredentialHelper: `git-credential-${slug}`,20 gitRemoteHelper: `git-remote-${slug}`,21 githubOrg: `get${slug}`,22 name: "Myr",18- npmScope: `@${slug}`,23+ npmScope,24 platformHost,25 platformUrl: `https://${platformHost}`,26 refsPrefix: `refs/${slug}/`,27+ // Each name a config folder imports the sdk by: the package's own, then28+ // the one it had before its scope moved, which projects made then keep.29+ sdkImports: [`${cliPackage}/rules`, `@${slug}/cli/rules`],30 slug,31 urlScheme: `${slug}://`,32 } as const;modified:packages/brand/src/leaks.ts+6 added-2 removed
29 unmodified lines30 (dir === "layers" && layerDir === Brand.configDir))31 );32 };33 34-// Letters on either side make it another word ("myriad"), not the name.35-const NAME = new RegExp(`(?<![a-z])${Brand.slug}(?![a-z])`, "iu");34+// Letters on either side make it another word ("myriad"), not the name; the35+// npm scope spells it with the domain's word joined on.36+const NAME = new RegExp(37+ `(?<![a-z])(?:${Brand.slug}|${Brand.npmScope.slice(1)})(?![a-z])`,38+ "iu"39+);40 41 const mayNameTheBrand = (path: string) =>42 path.startsWith(HOME) || PROSE.test(path) || inExampleConfig(path);43 26 unmodified lines