@monte3l/groundwork 0.1.0-next.1 → 1.0.0-rc.3
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/README.md +16 -8
- package/bin/m3l-groundwork.mjs +36 -2
- package/dist/assets.d.ts +10 -0
- package/dist/assets.js +14 -0
- package/dist/baseline-stage.d.ts +173 -0
- package/dist/baseline-stage.js +215 -0
- package/dist/caps.d.ts +4 -1
- package/dist/caps.js +17 -3
- package/dist/conflicts.d.ts +23 -2
- package/dist/conflicts.js +89 -11
- package/dist/customize-paths.d.ts +92 -0
- package/dist/customize-paths.js +115 -0
- package/dist/emit.d.ts +50 -1
- package/dist/emit.js +121 -13
- package/dist/fatal.d.ts +70 -0
- package/dist/fatal.js +132 -0
- package/dist/format-error.d.ts +113 -0
- package/dist/format-error.js +553 -0
- package/dist/fs-guard.d.ts +142 -0
- package/dist/fs-guard.js +222 -0
- package/dist/git.js +10 -1
- package/dist/harness/conformance.js +2 -0
- package/dist/harness/frontmatter.js +2 -13
- package/dist/harness/grade.js +37 -8
- package/dist/harness/rules.d.ts +20 -3
- package/dist/harness/rules.js +108 -6
- package/dist/harness/types.d.ts +13 -0
- package/dist/harness/types.js +3 -0
- package/dist/inventory.d.ts +77 -3
- package/dist/inventory.js +103 -12
- package/dist/jsonc.d.ts +49 -2
- package/dist/jsonc.js +140 -7
- package/dist/main.d.ts +62 -3
- package/dist/main.js +538 -67
- package/dist/merge-json.d.ts +47 -4
- package/dist/merge-json.js +120 -8
- package/dist/mode.js +12 -2
- package/dist/pack-stage.d.ts +210 -0
- package/dist/pack-stage.js +287 -0
- package/dist/packs.d.ts +19 -13
- package/dist/packs.js +231 -28
- package/dist/palette.d.ts +23 -0
- package/dist/palette.js +22 -0
- package/dist/plugin.d.ts +122 -6
- package/dist/plugin.js +687 -47
- package/dist/report.d.ts +21 -2
- package/dist/report.js +93 -5
- package/dist/staging.d.ts +176 -0
- package/dist/staging.js +375 -0
- package/dist/survey/fs-walk.d.ts +34 -2
- package/dist/survey/fs-walk.js +70 -5
- package/dist/survey/internal/blocked-path.d.ts +27 -0
- package/dist/survey/internal/blocked-path.js +129 -0
- package/dist/survey/internal/package-json.d.ts +13 -0
- package/dist/survey/internal/package-json.js +37 -0
- package/dist/survey/internal/read-guard.d.ts +178 -0
- package/dist/survey/internal/read-guard.js +276 -0
- package/dist/survey/survey-docs.d.ts +17 -2
- package/dist/survey/survey-docs.js +61 -21
- package/dist/survey/survey-harness.d.ts +20 -2
- package/dist/survey/survey-harness.js +87 -46
- package/dist/survey/survey-shape.d.ts +17 -2
- package/dist/survey/survey-shape.js +60 -46
- package/dist/survey/survey-toolchain.d.ts +16 -1
- package/dist/survey/survey-toolchain.js +69 -66
- package/dist/survey/survey.js +6 -4
- package/dist/survey/types.d.ts +79 -0
- package/dist/survey/types.js +2 -6
- package/dist/term.d.ts +80 -0
- package/dist/term.js +145 -0
- package/dist/tokens.js +2 -0
- package/dist/toolchain/conformance.js +2 -0
- package/dist/toolchain/grade.js +26 -8
- package/dist/toolchain/rules.d.ts +13 -4
- package/dist/toolchain/rules.js +16 -0
- package/dist/toolchain/tsconfig-chain.d.ts +2 -0
- package/dist/toolchain/tsconfig-chain.js +32 -8
- package/dist/toolchain/types.d.ts +16 -4
- package/dist/toolchain/types.js +3 -0
- package/package.json +4 -3
- package/plugin/skills/customize/SKILL.md +292 -18
- package/plugin/src/domain-map.ts +39 -14
- package/plugin/src/index.ts +5 -1
- package/plugin/src/kind-facet-map.ts +25 -8
- package/plugin/src/pack-map.ts +147 -25
- package/plugin/src/plugin-map.ts +236 -0
- package/templates/core/.claude/agents/Explore.md +0 -1
- package/templates/core/.claude/agents/code-implementer.md +4 -4
- package/templates/core/.claude/agents/code-reviewer.md +4 -4
- package/templates/core/.claude/agents/silent-failure-hunter.md +2 -2
- package/templates/core/.claude/agents/test-author.md +7 -5
- package/templates/core/.claude/hooks/guard-branch-isolation.mjs +56 -10
- package/templates/core/.claude/hooks/guard-double-background.mjs +13 -8
- package/templates/core/.claude/hooks/guard-git-push-signed.mjs +12 -9
- package/templates/core/.claude/hooks/guard-hub-src-writes.mjs +1890 -38
- package/templates/core/.claude/hooks/guard-js-extension.mjs +2 -1
- package/templates/core/.claude/hooks/guard-no-commonjs.mjs +7 -5
- package/templates/core/.claude/hooks/guard-secret-writes.mjs +7 -5
- package/templates/core/.claude/hooks/inject-decision-gate.mjs +12 -9
- package/templates/core/.claude/hooks/post-edit-verify.mjs +276 -98
- package/templates/core/.claude/rules/agent-dispatch.md +7 -0
- package/templates/core/.claude/rules/tests.md +2 -2
- package/templates/core/.claude/settings.json +5 -0
- package/templates/core/.claude/skills/finishing-work/SKILL.md +58 -10
- package/templates/core/.claude/skills/harness-guidance/SKILL.md +16 -7
- package/templates/core/.claude/skills/starting-work/SKILL.md +5 -0
- package/templates/core/.claude/skills/triaging-ci/SKILL.md +9 -8
- package/templates/core/.claude/skills/typescript-guidance/SKILL.md +137 -20
- package/templates/core/.claude/skills/typescript-guidance/references/area-catalog.md +135 -0
- package/templates/core/.claude/skills/typescript-guidance/references/tooling-sources.md +113 -0
- package/templates/core/.claude/skills/writing-commits/SKILL.md +2 -2
- package/templates/core/.github/dependabot.yml +18 -0
- package/templates/core/.github/workflows/ci.yml +15 -15
- package/templates/core/.github/workflows/dependency-review.yml +2 -2
- package/templates/core/.github/workflows/security-audit.yml +10 -4
- package/templates/core/.prettierignore +4 -0
- package/templates/core/CLAUDE.md +53 -3
- package/templates/core/README.md +30 -10
- package/templates/core/_gitignore +17 -0
- package/templates/core/bin/check-exports.mjs +11 -5
- package/templates/core/bin/lib/agent-roster.mjs +1 -1
- package/templates/core/bin/lib/frontmatter.mjs +4 -2
- package/templates/core/bin/lib/harness-rules.mjs +169 -20
- package/templates/core/bin/lib/protected-paths.mjs +93 -5
- package/templates/core/bin/lib/toolchain-rules.mjs +187 -26
- package/templates/core/bin/lib/verify-steps.mjs +29 -11
- package/templates/core/bin/verify.mjs +12 -0
- package/templates/core/eslint.config.js +5 -0
- package/templates/core/package.json +7 -7
- package/templates/core/vitest.config.ts +8 -1
- package/templates/packs/README.md +35 -24
- package/templates/packs/github/files/.claude/skills/reviewing-dependabot-prs/SKILL.md +133 -0
- package/templates/packs/github/files/.claude/skills/triaging-scan-alerts/SKILL.md +88 -0
- package/templates/packs/github/files/.claude/skills/watching-pr-checks/SKILL.md +94 -0
- package/templates/packs/github/files/.github/workflows/claude-pr-review.yml +267 -0
- package/templates/packs/github/files/.github/workflows/claude.yml +106 -0
- package/templates/packs/github/pack.json +19 -0
- package/templates/packs/harness-extras/files/.claude/hooks/guard-readonly-bash.mjs +1122 -65
- package/templates/packs/harness-extras/files/.claude/hooks/reinject-compact-handoff.mjs +147 -13
- package/templates/packs/{statusline → harness-extras}/files/.claude/hooks/statusline.mjs +6 -2
- package/templates/packs/harness-extras/files/.claude/hooks/write-compact-handoff.mjs +227 -44
- package/templates/packs/harness-extras/pack.json +18 -13
- package/templates/packs/publishing/files/.changeset/README.md +25 -0
- package/templates/packs/publishing/files/.changeset/config.json +7 -0
- package/templates/packs/publishing/files/.github/release-tools/package.json +9 -0
- package/templates/packs/publishing/files/.github/workflows/release.yml +293 -0
- package/templates/packs/publishing/files/REUSE.toml +28 -0
- package/templates/packs/publishing/files/bin/check-dts-deps.mjs +234 -0
- package/templates/packs/publishing/files/bin/check-license-headers.mjs +217 -0
- package/templates/packs/publishing/files/bin/check-publish-version.mjs +149 -0
- package/templates/packs/publishing/files/bin/lib/npm-publish-args.mjs +86 -0
- package/templates/packs/publishing/files/bin/pnpm-publish-shim.mjs +86 -0
- package/templates/packs/publishing/pack.json +35 -0
- package/templates/packs/{harness-extras → quality}/files/bin/check-file-budget.mjs +6 -4
- package/templates/packs/quality/pack.json +29 -0
- package/templates/packs/supply-chain/files/.github/workflows/gitleaks.yml +52 -0
- package/templates/packs/supply-chain/files/.github/workflows/scorecard.yml +48 -0
- package/templates/packs/supply-chain/files/.gitleaks.toml +2 -0
- package/templates/packs/supply-chain/pack.json +19 -0
- package/templates/packs/worktrees/files/.claude/hooks/ensure-worktree-deps.mjs +283 -0
- package/templates/packs/worktrees/files/.claude/hooks/guard-worktree-only.mjs +245 -0
- package/templates/packs/worktrees/files/.claude/hooks/repair-core-bare.mjs +335 -0
- package/templates/packs/worktrees/files/.claude/skills/working-in-worktrees/SKILL.md +139 -0
- package/templates/packs/worktrees/files/.worktreeinclude +11 -0
- package/templates/packs/worktrees/pack.json +64 -0
- package/templates/packs/statusline/pack.json +0 -31
- /package/templates/packs/{statusline → harness-extras}/files/.claude/hooks/statusline-layout.mjs +0 -0
- /package/templates/packs/{statusline → harness-extras}/files/.claude/hooks/subagent-statusline.mjs +0 -0
- /package/templates/packs/{harness-extras → quality}/files/.claude/agents/type-design-analyzer.md +0 -0
- /package/templates/packs/{harness-extras → quality}/files/bin/file-budget-baseline.json +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE -- do not hand-edit. Run `node bin/build-design-tokens.mjs`
|
|
3
|
+
* to regenerate from design/source/dtcg (the vendored m3l-design tokens).
|
|
4
|
+
* `--check` (used by `pnpm verify`) fails instead of writing on drift.
|
|
5
|
+
* Source of truth: design/source/dtcg (DTCG 2025.10). See design/README.md.
|
|
6
|
+
*/
|
|
7
|
+
/** One role's resolved terminal color, per theme -- see term.ts's `paint()`. */
|
|
8
|
+
export interface PaletteRoleColors {
|
|
9
|
+
readonly success: string;
|
|
10
|
+
readonly info: string;
|
|
11
|
+
readonly warning: string;
|
|
12
|
+
readonly danger: string;
|
|
13
|
+
readonly accent: string;
|
|
14
|
+
readonly secondary: string;
|
|
15
|
+
}
|
|
16
|
+
/** {@link PaletteRoleColors} for each theme -- see term.ts's `resolveThemeId()`. */
|
|
17
|
+
export interface Palette {
|
|
18
|
+
readonly light: PaletteRoleColors;
|
|
19
|
+
readonly dark: PaletteRoleColors;
|
|
20
|
+
}
|
|
21
|
+
/** The resolved terminal palette, light and dark -- see term.ts's `paint()`. */
|
|
22
|
+
export declare const PALETTE: Palette;
|
|
23
|
+
//# sourceMappingURL=palette.d.ts.map
|
package/dist/palette.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright the m3l-groundwork contributors
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
/** The resolved terminal palette, light and dark -- see term.ts's `paint()`. */
|
|
4
|
+
export const PALETTE = {
|
|
5
|
+
light: {
|
|
6
|
+
success: "#086d31",
|
|
7
|
+
info: "#065da0",
|
|
8
|
+
warning: "#7d4f0a",
|
|
9
|
+
danger: "#963730",
|
|
10
|
+
accent: "#692746",
|
|
11
|
+
secondary: "#554d50",
|
|
12
|
+
},
|
|
13
|
+
dark: {
|
|
14
|
+
success: "#89d298",
|
|
15
|
+
info: "#8ac3fe",
|
|
16
|
+
warning: "#ebb16c",
|
|
17
|
+
danger: "#fda297",
|
|
18
|
+
accent: "#d1789e",
|
|
19
|
+
secondary: "#cdc5c8",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=palette.js.map
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,22 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an install wrote.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { installCustomizeSkill } from "./plugin.js";
|
|
7
|
+
*
|
|
8
|
+
* const { filesWritten } = installCustomizeSkill("/work/app");
|
|
9
|
+
* filesWritten.at(-1); // ".claude/skills/customize/SKILL.md"
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
1
12
|
export interface InstallPluginResult {
|
|
13
|
+
/** Paths relative to the project root, in write order (`SKILL.md` last); empty when the destination already held this exact payload. */
|
|
2
14
|
filesWritten: string[];
|
|
3
15
|
}
|
|
4
16
|
/**
|
|
5
17
|
* Installs the skill into `<targetDir>/.claude/skills/customize/`. Used by
|
|
6
|
-
* fresh-bootstrap mode, where the directory is
|
|
18
|
+
* fresh-bootstrap mode, where the directory is normally new (`--force` may
|
|
19
|
+
* point it at a non-empty one or an earlier install). An earlier install
|
|
20
|
+
* that is already byte-identical to this payload is left untouched
|
|
21
|
+
* (`filesWritten` is empty); otherwise any existing `SKILL.md` is removed
|
|
22
|
+
* first, then each payload file is removed and recreated. A symlinked
|
|
23
|
+
* `.claude`, `.claude/skills` or `.claude/skills/customize` is refused, not
|
|
24
|
+
* routed around.
|
|
25
|
+
*
|
|
26
|
+
* @throws `Error` ("could not install the /customize skill ...", raw error
|
|
27
|
+
* as `cause`) on a missing or unreadable source file, a directory at any
|
|
28
|
+
* payload name, a payload name or existing file that cannot be `lstat`ed,
|
|
29
|
+
* or an existing regular file whose read fails with anything other than
|
|
30
|
+
* `EACCES`/`EPERM` (all before anything is removed or written), a symlinked
|
|
31
|
+
* or non-directory directory component, any fs failure, or a failed write
|
|
32
|
+
* -- after removing every file this call wrote. An existing regular file
|
|
33
|
+
* whose read fails with `EACCES` or `EPERM` is not a failure: it is replaced
|
|
34
|
+
* like any stale copy. Entries it replaced before the failure are not
|
|
35
|
+
* restored; the error names them. A failure to locate the default
|
|
36
|
+
* `sourceDir` is thrown the same way. The message ends, once, by saying to
|
|
37
|
+
* fix the cause (for a symlink: remove it), then retry
|
|
38
|
+
* the same command with `--fresh --force` added -- a plain re-run would
|
|
39
|
+
* adopt the now-non-empty target -- and nowhere in the error chain gives
|
|
40
|
+
* adopt mode's bare "re-run the CLI" advice.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { installCustomizeSkill } from "./plugin.js";
|
|
45
|
+
*
|
|
46
|
+
* installCustomizeSkill("/work/app").filesWritten.length; // 5
|
|
47
|
+
* ```
|
|
7
48
|
*/
|
|
8
49
|
export declare function installCustomizeSkill(targetDir: string, sourceDir?: string): InstallPluginResult;
|
|
9
50
|
type InstallLocation = "claude" | "groundwork" | "already-present";
|
|
51
|
+
/**
|
|
52
|
+
* What the adopt-mode install did, and where.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { installCustomizeSkillGuarded } from "./plugin.js";
|
|
57
|
+
*
|
|
58
|
+
* const result = installCustomizeSkillGuarded("/work/app");
|
|
59
|
+
* if (result.fallbackReason !== undefined) console.log(result.fallbackReason);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
10
62
|
export interface GuardedInstallResult {
|
|
63
|
+
/** Paths relative to the project root, in write order (`SKILL.md` last); empty for `"already-present"`. */
|
|
11
64
|
filesWritten: string[];
|
|
12
65
|
location: InstallLocation;
|
|
66
|
+
/**
|
|
67
|
+
* Set on every `"groundwork"` result, and only then: why
|
|
68
|
+
* `.claude/skills/customize/` could not be used, naming the path
|
|
69
|
+
* responsible -- a symlinked or non-directory component, or the existing
|
|
70
|
+
* project entry under one of the skill's payload names.
|
|
71
|
+
*/
|
|
72
|
+
fallbackReason?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Set exactly when `fallbackReason` is: `"component"` when a
|
|
75
|
+
* `.claude`/`.claude/skills`/`.claude/skills/customize` component is a
|
|
76
|
+
* symlink or not a directory (no project-local copy of the skill exists),
|
|
77
|
+
* `"entry"` when a project-owned entry sits under one of the skill's
|
|
78
|
+
* payload names (a project copy exists, and is what a user would replace).
|
|
79
|
+
*/
|
|
80
|
+
fallbackCause?: "entry" | "component";
|
|
13
81
|
}
|
|
14
82
|
/**
|
|
15
|
-
* Adopt-mode install: purely additive, never overwrites
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
83
|
+
* Adopt-mode install: purely additive, never overwrites or removes a project
|
|
84
|
+
* entry under `.claude/skills/customize/`.
|
|
85
|
+
*
|
|
86
|
+
* - If `.claude`, `.claude/skills` or `.claude/skills/customize` is a
|
|
87
|
+
* symlink or not a directory, the skill is written to
|
|
88
|
+
* `.groundwork/customize/` instead, `fallbackReason` names that path and
|
|
89
|
+
* `fallbackCause` is `"component"` -- the entry (and any link target) is
|
|
90
|
+
* left untouched.
|
|
91
|
+
* - Otherwise, if every payload file already there is a regular file
|
|
92
|
+
* matching what this CLI ships byte-for-byte: with all five present the
|
|
93
|
+
* result is `"already-present"` (nothing written); with no `SKILL.md` file
|
|
94
|
+
* (none at all, or an install interrupted before writing it) the missing
|
|
95
|
+
* files are written into `.claude/skills/customize/`, `SKILL.md` last,
|
|
96
|
+
* never rewriting or removing the correct ones.
|
|
97
|
+
* - Anything else under a payload name (a differing file, a regular file
|
|
98
|
+
* that cannot be read, a symlink -- dangling or not -- a directory, a
|
|
99
|
+
* `SKILL.md` without its data; detected by `lstat`) is kept as the
|
|
100
|
+
* project's own: the skill is written to `.groundwork/customize/` instead,
|
|
101
|
+
* `fallbackReason` names that entry (saying so when it could not be read)
|
|
102
|
+
* and `fallbackCause` is `"entry"`. Adopt mode never guesses at a project
|
|
103
|
+
* entry it cannot compare, and the fallback does not guess either: it
|
|
104
|
+
* leaves that entry exactly as it was. Claude Code does not load a skill
|
|
105
|
+
* from there; the caller must say so.
|
|
106
|
+
*
|
|
107
|
+
* Writes into `.claude/skills/customize/` use `"wx"` only, so an entry that
|
|
108
|
+
* appears there mid-install fails the run (rolled back) rather than being
|
|
109
|
+
* replaced. Writes into the CLI-owned `.groundwork/customize/` replace that
|
|
110
|
+
* directory's payload files (any `SKILL.md` removed first, then each file
|
|
111
|
+
* removed and recreated with `"wx"`); a symlinked `.groundwork` or
|
|
112
|
+
* `.groundwork/customize`, or a directory at any payload name there, is
|
|
113
|
+
* refused, never routed around.
|
|
114
|
+
*
|
|
115
|
+
* @throws `Error` ("could not install the /customize skill ...", raw error
|
|
116
|
+
* as `cause`) on a missing or unreadable source file (before anything is
|
|
117
|
+
* written), a payload name under `.claude/skills/customize/` that cannot be
|
|
118
|
+
* `lstat`ed or read (a regular file there whose read is refused with
|
|
119
|
+
* `EACCES`/`EPERM` falls back instead; any other read failure throws before
|
|
120
|
+
* anything is written), any other fs failure while probing or writing, a
|
|
121
|
+
* symlinked `.groundwork`/`.groundwork/customize`, or a directory at a
|
|
122
|
+
* payload name there -- after removing every file this call wrote. A failed
|
|
123
|
+
* `.groundwork/customize/` install also names why the fallback was taken.
|
|
124
|
+
* A failure to locate the default `sourceDir` is thrown the same way. The
|
|
125
|
+
* message ends by
|
|
126
|
+
* saying to fix the cause (for a symlink: remove it) and re-run the CLI,
|
|
127
|
+
* once.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* import { installCustomizeSkillGuarded } from "./plugin.js";
|
|
132
|
+
*
|
|
133
|
+
* const { location } = installCustomizeSkillGuarded("/work/app");
|
|
134
|
+
* // "claude" | "groundwork" | "already-present"
|
|
135
|
+
* ```
|
|
20
136
|
*/
|
|
21
137
|
export declare function installCustomizeSkillGuarded(targetDir: string, sourceDir?: string): GuardedInstallResult;
|
|
22
138
|
export {};
|