@freetesh/canon 0.0.0-stage → 0.16.0
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/.claude-plugin/marketplace.json +15 -0
- package/.claude-plugin/plugin.json +5 -0
- package/LICENSE +21 -0
- package/README.md +161 -2
- package/cli/dist/api.d.ts +3 -0
- package/cli/dist/api.js +4 -0
- package/cli/dist/check.d.ts +19 -0
- package/cli/dist/check.js +40 -0
- package/cli/dist/checks/architecture.d.ts +23 -0
- package/cli/dist/checks/architecture.js +135 -0
- package/cli/dist/checks/canonical-values.d.ts +2 -0
- package/cli/dist/checks/canonical-values.js +48 -0
- package/cli/dist/checks/commands.d.ts +7 -0
- package/cli/dist/checks/commands.js +33 -0
- package/cli/dist/checks/context-layout.d.ts +5 -0
- package/cli/dist/checks/context-layout.js +83 -0
- package/cli/dist/checks/context-size.d.ts +2 -0
- package/cli/dist/checks/context-size.js +46 -0
- package/cli/dist/checks/features.d.ts +2 -0
- package/cli/dist/checks/features.js +38 -0
- package/cli/dist/checks/index.d.ts +2 -0
- package/cli/dist/checks/index.js +34 -0
- package/cli/dist/checks/listing.d.ts +2 -0
- package/cli/dist/checks/listing.js +51 -0
- package/cli/dist/checks/metrics-definitions.d.ts +2 -0
- package/cli/dist/checks/metrics-definitions.js +14 -0
- package/cli/dist/checks/pipeline.d.ts +8 -0
- package/cli/dist/checks/pipeline.js +34 -0
- package/cli/dist/checks/refs.d.ts +2 -0
- package/cli/dist/checks/refs.js +92 -0
- package/cli/dist/checks/shared-files.d.ts +22 -0
- package/cli/dist/checks/shared-files.js +84 -0
- package/cli/dist/checks/sources.d.ts +2 -0
- package/cli/dist/checks/sources.js +40 -0
- package/cli/dist/checks/stale-copies.d.ts +2 -0
- package/cli/dist/checks/stale-copies.js +18 -0
- package/cli/dist/checks/standards-copies.d.ts +2 -0
- package/cli/dist/checks/standards-copies.js +57 -0
- package/cli/dist/checks/tasks.d.ts +2 -0
- package/cli/dist/checks/tasks.js +66 -0
- package/cli/dist/checks/types.d.ts +23 -0
- package/cli/dist/checks/types.js +1 -0
- package/cli/dist/checks/wiki-frontmatter.d.ts +3 -0
- package/cli/dist/checks/wiki-frontmatter.js +84 -0
- package/cli/dist/commands/add.d.ts +3 -0
- package/cli/dist/commands/add.js +24 -0
- package/cli/dist/commands/approve.d.ts +2 -0
- package/cli/dist/commands/approve.js +20 -0
- package/cli/dist/commands/check.d.ts +3 -0
- package/cli/dist/commands/check.js +19 -0
- package/cli/dist/commands/copies.d.ts +3 -0
- package/cli/dist/commands/copies.js +23 -0
- package/cli/dist/commands/doctor.d.ts +2 -0
- package/cli/dist/commands/doctor.js +16 -0
- package/cli/dist/commands/hooks.d.ts +6 -0
- package/cli/dist/commands/hooks.js +55 -0
- package/cli/dist/commands/init.d.ts +3 -0
- package/cli/dist/commands/init.js +78 -0
- package/cli/dist/commands/learn.d.ts +3 -0
- package/cli/dist/commands/learn.js +36 -0
- package/cli/dist/commands/mcp.d.ts +2 -0
- package/cli/dist/commands/mcp.js +11 -0
- package/cli/dist/commands/pipeline.d.ts +3 -0
- package/cli/dist/commands/pipeline.js +26 -0
- package/cli/dist/commands/search.d.ts +2 -0
- package/cli/dist/commands/search.js +13 -0
- package/cli/dist/commands/standards.d.ts +3 -0
- package/cli/dist/commands/standards.js +26 -0
- package/cli/dist/commands/status.d.ts +3 -0
- package/cli/dist/commands/status.js +11 -0
- package/cli/dist/commands/sync.d.ts +3 -0
- package/cli/dist/commands/sync.js +23 -0
- package/cli/dist/commands/ui.d.ts +3 -0
- package/cli/dist/commands/ui.js +64 -0
- package/cli/dist/commands/weigh.d.ts +2 -0
- package/cli/dist/commands/weigh.js +16 -0
- package/cli/dist/config/load.d.ts +23 -0
- package/cli/dist/config/load.js +116 -0
- package/cli/dist/config/schema.d.ts +200 -0
- package/cli/dist/config/schema.js +116 -0
- package/cli/dist/doctor.d.ts +12 -0
- package/cli/dist/doctor.js +31 -0
- package/cli/dist/format.d.ts +6 -0
- package/cli/dist/format.js +35 -0
- package/cli/dist/index.d.ts +2 -0
- package/cli/dist/index.js +48 -0
- package/cli/dist/init.d.ts +46 -0
- package/cli/dist/init.js +119 -0
- package/cli/dist/learn.d.ts +44 -0
- package/cli/dist/learn.js +80 -0
- package/cli/dist/lib/env.d.ts +7 -0
- package/cli/dist/lib/env.js +6 -0
- package/cli/dist/lib/files.d.ts +3 -0
- package/cli/dist/lib/files.js +23 -0
- package/cli/dist/lib/frontmatter.d.ts +6 -0
- package/cli/dist/lib/frontmatter.js +16 -0
- package/cli/dist/lib/qmd.d.ts +9 -0
- package/cli/dist/lib/qmd.js +13 -0
- package/cli/dist/lib/system.d.ts +4 -0
- package/cli/dist/lib/system.js +19 -0
- package/cli/dist/packs.d.ts +40 -0
- package/cli/dist/packs.js +85 -0
- package/cli/dist/pipeline.d.ts +20 -0
- package/cli/dist/pipeline.js +30 -0
- package/cli/dist/standards.d.ts +14 -0
- package/cli/dist/standards.js +42 -0
- package/cli/dist/status.d.ts +3 -0
- package/cli/dist/status.js +26 -0
- package/cli/dist/sync.d.ts +19 -0
- package/cli/dist/sync.js +30 -0
- package/cli/dist/ui.d.ts +15 -0
- package/cli/dist/ui.js +69 -0
- package/package.json +54 -4
- package/packs/expo/pack.yaml +5 -0
- package/packs/firebase/pack.yaml +5 -0
- package/packs/nextjs/pack.yaml +5 -0
- package/packs/react/pack.yaml +5 -0
- package/packs/revenuecat/pack.yaml +5 -0
- package/packs/uniwind/pack.yaml +5 -0
- package/scripts/log-verdict.mjs +56 -0
- package/skills/ask/SKILL.md +40 -0
- package/skills/decision/SKILL.md +36 -0
- package/skills/ingest/SKILL.md +45 -0
- package/skills/standards/SKILL.md +16 -0
- package/skills/weigh/SKILL.md +160 -0
- package/skills/wiki-lint/SKILL.md +67 -0
- package/standards/README.md +14 -0
- package/standards/agent-contract.md +47 -0
- package/standards/constitution.md +104 -0
- package/standards/context-layout.md +129 -0
- package/standards/dev-methods.md +29 -0
- package/standards/wiki-schema.md +71 -0
- package/templates/dependency-cruiser/app.cjs +23 -0
- package/templates/dependency-cruiser/base.cjs +52 -0
- package/templates/dependency-cruiser/package.cjs +31 -0
- package/templates/dependency-cruiser/root.cjs +15 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* global module, require */
|
|
2
|
+
// Managed by canon — `canon sync` rewrites this file from canon's template, so edits here are lost.
|
|
3
|
+
// Put this repo's own rules in the .dependency-cruiser.cjs files that extend it.
|
|
4
|
+
// Each workspace runs on its own because apps map `@/` to their own src, and
|
|
5
|
+
// dependency-cruiser reads one tsconfig per run.
|
|
6
|
+
|
|
7
|
+
const { existsSync } = require("node:fs");
|
|
8
|
+
|
|
9
|
+
// recommended's no-orphans exceptions (dot files, .d.ts, tsconfig, babel/webpack configs),
|
|
10
|
+
// restated because the package does not export its rule files…
|
|
11
|
+
const KNOWN_CONFIG_FILES = [
|
|
12
|
+
"(^|/)\\.[^/]+\\.(js|cjs|mjs|ts|json)$",
|
|
13
|
+
"\\.d\\.(c|m)?ts$",
|
|
14
|
+
"(^|/)tsconfig\\.json$",
|
|
15
|
+
"(^|/)(?:babel|webpack)\\.config\\.(?:js|cjs|mjs|ts|json)$",
|
|
16
|
+
];
|
|
17
|
+
// …plus files a framework or tool loads by convention, so nothing imports them.
|
|
18
|
+
const ENTRY_POINTS = [
|
|
19
|
+
"(^|/)src/app/[^.]*(page|layout|route|loading|error|not-found|template|default)\\.tsx?$", // Next.js app router
|
|
20
|
+
"(^|/)src/pages/[^.]+\\.tsx?$", // Next.js pages router
|
|
21
|
+
"^src/app/[^.]+\\.tsx?$", // Expo Router: every file under app/ is a route
|
|
22
|
+
"^src/(instrumentation|middleware)\\.ts$", // Next.js hooks
|
|
23
|
+
"^(scripts|plugins|eslint|e2e|public)/", // run by a tool, not imported
|
|
24
|
+
"(^|/)__mocks__/", // jest mocks
|
|
25
|
+
"^(src/)?index\\.ts$", // a package's entry
|
|
26
|
+
"(^|/)codegen\\.ts$", // GraphQL codegen script
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
/** @type {import('dependency-cruiser').IConfiguration} */
|
|
30
|
+
module.exports = {
|
|
31
|
+
extends: "dependency-cruiser/configs/recommended",
|
|
32
|
+
forbidden: [
|
|
33
|
+
{
|
|
34
|
+
name: "no-orphans",
|
|
35
|
+
comment: "Nothing imports this file: use it or delete it. Add a real entry point to ENTRY_POINTS instead.",
|
|
36
|
+
severity: "warn",
|
|
37
|
+
from: { orphan: true, pathNot: [...KNOWN_CONFIG_FILES, ...ENTRY_POINTS] },
|
|
38
|
+
to: {},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
options: {
|
|
42
|
+
// Record imports into a sibling workspace, but leave cruising it to that workspace's own run.
|
|
43
|
+
doNotFollow: { path: ["node_modules", "^\\.\\./"] },
|
|
44
|
+
// Specs and tooling configs are not app code.
|
|
45
|
+
exclude: { path: "^(dist|build|out|generated|coverage|\\.next|\\.expo|\\.turbo)/|^tests/|\\.(spec|test)\\.tsx?$|(^|/)[^/]+\\.config\\.(c|m)?(j|t)s$|(^|/)\\.dependency-cruiser" },
|
|
46
|
+
tsPreCompilationDeps: true,
|
|
47
|
+
// Each run starts in its workspace, so this is that workspace's tsconfig (if it has one).
|
|
48
|
+
...(existsSync("tsconfig.json") ? { tsConfig: { fileName: "tsconfig.json" } } : {}),
|
|
49
|
+
// Packages like uuid 13 export only `node`/`default` conditions.
|
|
50
|
+
enhancedResolveOptions: { exportsFields: ["exports"], conditionNames: ["import", "require", "node", "default", "types"] },
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* global module */
|
|
2
|
+
// This package's architecture rules, enforced by `canon check` (architecture module).
|
|
3
|
+
// canon wrote this starter once; it is yours now.
|
|
4
|
+
|
|
5
|
+
/** @type {import('dependency-cruiser').IConfiguration} */
|
|
6
|
+
module.exports = {
|
|
7
|
+
extends: "../../.dependency-cruiser.base.cjs",
|
|
8
|
+
forbidden: [
|
|
9
|
+
{
|
|
10
|
+
name: "no-package-to-app",
|
|
11
|
+
comment: "packages/ are shared; they never depend on an app.",
|
|
12
|
+
severity: "error",
|
|
13
|
+
from: {},
|
|
14
|
+
to: { path: "^\\.\\./\\.\\./apps/" },
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "no-orphans",
|
|
18
|
+
comment: "Off here: apps import a package's files through subpath exports, which a run inside the package cannot see.",
|
|
19
|
+
severity: "ignore",
|
|
20
|
+
from: { orphan: true },
|
|
21
|
+
to: {},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "no-duplicate-dep-types",
|
|
25
|
+
comment: "Off here: a shared package lists react and friends as both peer and dev dependency on purpose.",
|
|
26
|
+
severity: "ignore",
|
|
27
|
+
from: {},
|
|
28
|
+
to: {},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* global module */
|
|
2
|
+
// This repo's architecture rules, enforced by `canon check` (architecture module).
|
|
3
|
+
// canon wrote this starter once; it is yours now. Add the layers this product has
|
|
4
|
+
// (see the rule reference below) and keep the why in a wiki concept page.
|
|
5
|
+
// Rule reference: https://github.com/sverweij/dependency-cruiser/blob/main/doc/rules-reference.md
|
|
6
|
+
|
|
7
|
+
/** @type {import('dependency-cruiser').IConfiguration} */
|
|
8
|
+
module.exports = {
|
|
9
|
+
extends: "./.dependency-cruiser.base.cjs",
|
|
10
|
+
forbidden: [],
|
|
11
|
+
options: {
|
|
12
|
+
// The level `canon ui` draws the architecture graph at: one box per match.
|
|
13
|
+
reporterOptions: { archi: { collapsePattern: "^src/[^/]+|^[^/]+" } },
|
|
14
|
+
},
|
|
15
|
+
};
|