@orkestrel/scaffold 0.0.75 → 0.0.76

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.
@@ -39,7 +39,8 @@ SCSS mirrors TypeScript centralization. Concrete token prefixes are project-spec
39
39
  - Check `_tokens.scss` before inventing a token.
40
40
  - Put global tokens in `_tokens.scss`; put truly component-scoped custom properties on the component selector.
41
41
  - Never bury tokens in unrelated partials.
42
- - Never use literal colors. Use `var(--token)` or `color-mix()` over tokens.
42
+ - Never use literal colors. Use `var(--token)` or `color-mix()` over tokens. The one file a
43
+ literal color may appear in is `_tokens.scss`, where the token itself is declared.
43
44
  - Never repeat per-color/per-variant blocks; drive shared structure with one `@each` over a shared list.
44
45
  - If a pattern appears in at least two partials, move it to `_mixins.scss`.
45
46
  - A one-partial pattern stays inline; do not create a mixin for one caller.
@@ -454,7 +454,7 @@
454
454
  "storage": "claude/rules/styles.md",
455
455
  "destination": ".claude/rules/styles.md",
456
456
  "executable": false,
457
- "digest": "5d0a8b9d36f0cff90e6cd4296ea1055c5a835c81b430c67b16d802c7adc2b6fc"
457
+ "digest": "9393ce28750e93f790da32e991e2edc7ca3d8cc1c527f40a43aeaabb202d52bc"
458
458
  },
459
459
  {
460
460
  "storage": "claude/rules/tests.md",
@@ -1048,7 +1048,7 @@
1048
1048
  "storage": "tests/setupPolicy.ts",
1049
1049
  "destination": "tests/setupPolicy.ts",
1050
1050
  "executable": false,
1051
- "digest": "9065dde1bc5ef6541a36dfb9b478d990102f804af9e5c78e0ed6b44521678974"
1051
+ "digest": "3600093f5ea69b236df634aadf9a67ea73aec4bdcd799ae5178a2d1d26797f10"
1052
1052
  }
1053
1053
  ],
1054
1054
  "roots": [
@@ -2001,5 +2001,5 @@
2001
2001
  ]
2002
2002
  }
2003
2003
  ],
2004
- "digest": "6e8e2b0524717bfc2b648acba0de5901c7c267a9c189155b45e3cb681b14bf6d"
2004
+ "digest": "88c796ee06464183378d3918ab25854ad2c5b0211f072f3b904e00d49bcdf26c"
2005
2005
  }
@@ -96,6 +96,13 @@ export const POLICY_SURFACE_EXPORT_CASES = Object.freeze([
96
96
  export const POLICY_SURFACE_BARREL_PATTERN =
97
97
  /^\s*export\s+\*\s+from\s+(?:'(\.\.?\/[^']+\.js)'|"(\.\.?\/[^"]+\.js)")\s*;?\s*$/u
98
98
 
99
+ /** Names the workspace-relative styles side-effect entry the workspace rule prescribes. */
100
+ export const POLICY_SURFACE_STYLES_ENTRY = 'src/styles/index.ts'
101
+
102
+ /** Names the violation reported when the styles side-effect entry does not import `./index.scss` alone. */
103
+ export const POLICY_SURFACE_STYLES_MESSAGE =
104
+ 'surface population incomplete: styles entry must import ./index.scss and nothing else'
105
+
99
106
  /**
100
107
  * Creates a guide whose surface claims the supplied fixture names.
101
108
  *
@@ -2233,15 +2240,46 @@ export function collectPolicyDeclarations(
2233
2240
  *
2234
2241
  * @param root - The workspace root to inspect.
2235
2242
  * @returns The parsed declarations and incomplete-population violations.
2243
+ * @remarks
2244
+ * The `src/styles/index.ts` side-effect entry is excluded from barrel validation and instead
2245
+ * requires exactly one bare `./index.scss` import.
2236
2246
  */
2237
2247
  export function readPolicySurface(root: string): PolicySurfacePopulation {
2238
2248
  const files: Record<string, string> = {}
2239
2249
  for (const path of globSync('src/**/*.ts', { cwd: root }).map(normalizePolicyPath).sort()) {
2240
2250
  files[path] = readFileSync(join(root, path), 'utf8')
2241
2251
  }
2242
- const barrels = Object.keys(files).filter((path) => path.endsWith('/index.ts'))
2252
+ const barrels = Object.keys(files).filter(
2253
+ (path) => path.endsWith('/index.ts') && path !== POLICY_SURFACE_STYLES_ENTRY,
2254
+ )
2243
2255
  const targets = new Set<string>()
2244
2256
  const violations: PolicyViolation[] = []
2257
+ const stylesEntry = files[POLICY_SURFACE_STYLES_ENTRY]
2258
+ if (stylesEntry !== undefined) {
2259
+ const stylesSource = parseSync(POLICY_SURFACE_STYLES_ENTRY, stylesEntry)
2260
+ const stylesStatement =
2261
+ stylesSource.errors.length === 0 ? stylesSource.program.body[0] : undefined
2262
+ const stylesValid =
2263
+ stylesSource.errors.length === 0 &&
2264
+ stylesSource.program.body.length === 1 &&
2265
+ stylesStatement?.type === 'ImportDeclaration' &&
2266
+ stylesStatement.specifiers.length === 0 &&
2267
+ stylesStatement.source.value === './index.scss'
2268
+ if (!stylesValid) {
2269
+ const line =
2270
+ stylesStatement === undefined
2271
+ ? 1
2272
+ : stylesEntry.slice(0, stylesStatement.start).split(/\r\n|\n/u).length
2273
+ violations.push(
2274
+ createPolicyViolation(
2275
+ 'surface',
2276
+ POLICY_SURFACE_STYLES_ENTRY,
2277
+ POLICY_SURFACE_STYLES_MESSAGE,
2278
+ line,
2279
+ ),
2280
+ )
2281
+ }
2282
+ }
2245
2283
  for (const path of barrels) {
2246
2284
  const text = files[path]
2247
2285
  if (text === undefined) continue
@@ -4,7 +4,7 @@ let _orkestrel_template = require("@orkestrel/template");
4
4
  let _orkestrel_emitter = require("@orkestrel/emitter");
5
5
  var package_default = {
6
6
  name: "@orkestrel/scaffold",
7
- version: "0.0.75",
7
+ version: "0.0.76",
8
8
  description: "Scaffold workspaces with commands: new, audit, repair, catalog, and overwrite.",
9
9
  keywords: [
10
10
  "audit",