@monte3l/groundwork 0.1.0-next.0 → 1.0.0-rc.2

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 CHANGED
@@ -7,10 +7,10 @@ existing project and writes only a report (**adopt** mode, which never touches a
7
7
  project file).
8
8
 
9
9
  ```bash
10
- # 0.x is a prerelease and ships on the `next` dist-tag
11
- npx @monte3l/groundwork@next my-new-project
12
- npx @monte3l/groundwork@next my-new-project --pack statusline
13
- npx @monte3l/groundwork@next ../existing-project
10
+ # currently a 1.0.0 release candidate, shipping on the `rc` dist-tag
11
+ npx @monte3l/groundwork@rc my-new-project
12
+ npx @monte3l/groundwork@rc my-new-project --pack statusline
13
+ npx @monte3l/groundwork@rc ../existing-project
14
14
  ```
15
15
 
16
16
  Requires Node 24+. No prompts, and no network call beyond the `pnpm install` a
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import process from "node:process";
3
- import { main } from "../dist/main.js";
3
+ import { main, CliUsageError } from "../dist/main.js";
4
4
 
5
5
  try {
6
6
  main(process.argv.slice(2));
7
7
  } catch (error) {
8
8
  console.error(error instanceof Error ? error.message : String(error));
9
- process.exitCode = 1;
9
+ process.exitCode = error instanceof CliUsageError ? 2 : 1;
10
10
  }
@@ -26,6 +26,7 @@ export const CURRENT_MODELS = [
26
26
  "haiku",
27
27
  "fable",
28
28
  "claude-opus-5",
29
+ "claude-opus-5-5",
29
30
  "claude-sonnet-5",
30
31
  "claude-fable-5-1",
31
32
  "claude-haiku-4-5",
package/dist/main.d.ts CHANGED
@@ -11,6 +11,21 @@ export interface CliOptions {
11
11
  listPacks: boolean;
12
12
  packs: string[];
13
13
  }
14
+ /**
15
+ * Thrown for a bad invocation (unknown flag, missing target dir, missing flag
16
+ * value, contradictory mode flags) -- distinguished from a runtime error so the
17
+ * CLI exits 2, not 1.
18
+ *
19
+ * @example
20
+ * ```sh
21
+ * npx @monte3l/groundwork@next ./my-app --bogus
22
+ * # stderr: unrecognized option: --bogus (followed by the usage text)
23
+ * echo $? # 2 -- a runtime failure exits 1 instead
24
+ * ```
25
+ */
26
+ export declare class CliUsageError extends Error {
27
+ readonly name = "CliUsageError";
28
+ }
14
29
  /** Parses argv into structured options. Throws with USAGE on a missing target dir, unless --help/--version/--list-packs is present. */
15
30
  export declare function parseArgs(argv: string[]): CliOptions;
16
31
  /** Resolves `templates/core` for a source checkout or a published tarball -- see `assets.ts`. */
package/dist/main.js CHANGED
@@ -37,8 +37,8 @@ const USAGE = [
37
37
  " --fresh Force fresh-bootstrap mode, even if the target looks pre-existing",
38
38
  " --pack <name> Install an opt-in pack from templates/packs/ (fresh mode only; repeatable)",
39
39
  " --list-packs Print every available pack and exit",
40
- " --help Print this message",
41
- " --version Print the CLI's version",
40
+ " --help, -h Print this message",
41
+ " --version, -v Print the CLI's version",
42
42
  "",
43
43
  "With no --adopt/--fresh override, the target directory is inspected: an",
44
44
  "empty or missing directory bootstraps fresh; a directory that already",
@@ -56,6 +56,30 @@ const REPEATABLE_VALUE_FLAGS = new Set(["--pack"]);
56
56
  const HELP_FLAGS = new Set(["--help", "-h"]);
57
57
  const VERSION_FLAGS = new Set(["--version", "-v"]);
58
58
  const LIST_PACKS_FLAGS = new Set(["--list-packs"]);
59
+ const BOOLEAN_FLAGS = new Set([
60
+ "--skip-install",
61
+ "--force",
62
+ "--adopt",
63
+ "--fresh",
64
+ ...LIST_PACKS_FLAGS,
65
+ ...HELP_FLAGS,
66
+ ...VERSION_FLAGS,
67
+ ]);
68
+ /**
69
+ * Thrown for a bad invocation (unknown flag, missing target dir, missing flag
70
+ * value, contradictory mode flags) -- distinguished from a runtime error so the
71
+ * CLI exits 2, not 1.
72
+ *
73
+ * @example
74
+ * ```sh
75
+ * npx @monte3l/groundwork@next ./my-app --bogus
76
+ * # stderr: unrecognized option: --bogus (followed by the usage text)
77
+ * echo $? # 2 -- a runtime failure exits 1 instead
78
+ * ```
79
+ */
80
+ export class CliUsageError extends Error {
81
+ name = "CliUsageError";
82
+ }
59
83
  /** Splits argv into positionals, boolean flags, and value-flag pairs -- a value-flag's value is never mistaken for a positional. */
60
84
  function tokenizeArgv(argv) {
61
85
  const positional = [];
@@ -72,22 +96,27 @@ function tokenizeArgv(argv) {
72
96
  }
73
97
  if (REPEATABLE_VALUE_FLAGS.has(arg)) {
74
98
  const value = argv[i + 1];
75
- if (value !== undefined) {
76
- const existing = repeatableValues.get(arg) ?? [];
77
- existing.push(value);
78
- repeatableValues.set(arg, existing);
79
- i++;
99
+ if (value === undefined || value.startsWith("-")) {
100
+ throw new CliUsageError(`${arg} requires a value\n\n${USAGE}`);
80
101
  }
102
+ const existing = repeatableValues.get(arg) ?? [];
103
+ existing.push(value);
104
+ repeatableValues.set(arg, existing);
105
+ i++;
81
106
  continue;
82
107
  }
83
108
  if (VALUE_FLAGS.has(arg)) {
84
109
  const value = argv[i + 1];
85
- if (value !== undefined) {
86
- values.set(arg, value);
87
- i++;
110
+ if (value === undefined || value.startsWith("-")) {
111
+ throw new CliUsageError(`${arg} requires a value\n\n${USAGE}`);
88
112
  }
113
+ values.set(arg, value);
114
+ i++;
89
115
  continue;
90
116
  }
117
+ if (!BOOLEAN_FLAGS.has(arg)) {
118
+ throw new CliUsageError(`unrecognized option: ${arg}\n\n${USAGE}`);
119
+ }
91
120
  flags.add(arg);
92
121
  }
93
122
  return { positional, flags, values, repeatableValues };
@@ -112,9 +141,15 @@ export function parseArgs(argv) {
112
141
  packs: [],
113
142
  };
114
143
  }
144
+ if (flags.has("--adopt") && flags.has("--fresh")) {
145
+ throw new CliUsageError(`--adopt and --fresh are mutually exclusive\n\n${USAGE}`);
146
+ }
115
147
  const targetArg = positional[0];
116
148
  if (targetArg === undefined) {
117
- throw new Error(USAGE);
149
+ throw new CliUsageError(USAGE);
150
+ }
151
+ if (positional.length > 1) {
152
+ throw new CliUsageError(`unexpected argument(s): ${positional.slice(1).join(" ")}\n\n${USAGE}`);
118
153
  }
119
154
  const targetDir = resolve(targetArg);
120
155
  const explicitName = values.get("--name");
package/dist/report.js CHANGED
@@ -280,7 +280,7 @@ export function renderReport(inventory) {
280
280
  const sections = [
281
281
  "# Adoption report",
282
282
  "",
283
- `Generated ${inventory.generatedAt} by m3l-groundwork ${inventory.cliVersion}.`,
283
+ `Generated ${inventory.generatedAt} by m3l-groundwork ${inventory.cliVersion} (inventory schema ${inventory.schemaVersion}).`,
284
284
  "",
285
285
  `**Mode:** adopt -- ${inventory.modeSignal}`,
286
286
  "",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@monte3l/groundwork",
3
- "version": "0.1.0-next.0",
4
- "description": "Deterministic Phase A bootstrapper: writes the m3l-groundwork baseline (toolchain + Claude Code harness) into a new directory, or surveys an existing project read-only. No prompts, no network beyond the package install.",
3
+ "version": "1.0.0-rc.2",
4
+ "description": "Deterministic bootstrapper: writes the m3l-groundwork baseline (toolchain + Claude Code harness) into a new directory, or surveys an existing project read-only. No prompts, no network beyond the package install.",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "claude-code",
@@ -27,13 +27,7 @@
27
27
  "bin": {
28
28
  "m3l-groundwork": "bin/m3l-groundwork.mjs"
29
29
  },
30
- "main": "./dist/main.js",
31
- "types": "./dist/main.d.ts",
32
30
  "exports": {
33
- ".": {
34
- "types": "./dist/main.d.ts",
35
- "import": "./dist/main.js"
36
- },
37
31
  "./package.json": "./package.json"
38
32
  },
39
33
  "files": [
@@ -27,6 +27,7 @@ export const CURRENT_MODELS = [
27
27
  "haiku",
28
28
  "fable",
29
29
  "claude-opus-5",
30
+ "claude-opus-5-5",
30
31
  "claude-sonnet-5",
31
32
  "claude-fable-5-1",
32
33
  "claude-haiku-4-5",