@bitmagic/cli 0.1.53-dev.2 → 0.1.53-dev.4

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.
Files changed (46) hide show
  1. package/README.md +37 -12
  2. package/dist/cli.d.ts +16 -0
  3. package/dist/cli.js +16 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/cover.d.ts +5 -0
  6. package/dist/commands/cover.js +3 -0
  7. package/dist/commands/cover.js.map +1 -1
  8. package/dist/commands/forge.d.ts +4 -0
  9. package/dist/commands/forge.js +9 -0
  10. package/dist/commands/forge.js.map +1 -1
  11. package/dist/commands/generate.d.ts +3 -0
  12. package/dist/commands/generate.js +21 -7
  13. package/dist/commands/generate.js.map +1 -1
  14. package/dist/commands/init.d.ts +4 -0
  15. package/dist/commands/init.js +12 -1
  16. package/dist/commands/init.js.map +1 -1
  17. package/dist/commands/publish.d.ts +12 -0
  18. package/dist/commands/publish.js +15 -0
  19. package/dist/commands/publish.js.map +1 -1
  20. package/dist/generate/model.d.ts +2 -0
  21. package/dist/generate/model.js +6 -1
  22. package/dist/generate/model.js.map +1 -1
  23. package/dist/generate/prop.d.ts +2 -0
  24. package/dist/generate/prop.js +2 -2
  25. package/dist/generate/prop.js.map +1 -1
  26. package/dist/generate/vehicle.d.ts +2 -0
  27. package/dist/generate/vehicle.js +1 -0
  28. package/dist/generate/vehicle.js.map +1 -1
  29. package/dist/render/qr-terminal.d.ts +56 -0
  30. package/dist/render/qr-terminal.js +135 -0
  31. package/dist/render/qr-terminal.js.map +1 -0
  32. package/dist/render/qr.d.ts +51 -0
  33. package/dist/render/qr.js +516 -0
  34. package/dist/render/qr.js.map +1 -0
  35. package/dist/scaffold/project-files.js +8 -0
  36. package/dist/scaffold/project-files.js.map +1 -1
  37. package/dist/scaffold/suggest-template.d.ts +2 -0
  38. package/dist/scaffold/suggest-template.js +2 -1
  39. package/dist/scaffold/suggest-template.js.map +1 -1
  40. package/dist/telemetry/command-context.d.ts +12 -0
  41. package/dist/telemetry/command-context.js +7 -0
  42. package/dist/telemetry/command-context.js.map +1 -1
  43. package/dist/telemetry/creator-prompt.d.ts +35 -0
  44. package/dist/telemetry/creator-prompt.js +45 -0
  45. package/dist/telemetry/creator-prompt.js.map +1 -0
  46. package/package.json +4 -4
@@ -54,11 +54,23 @@ export interface CommandContext {
54
54
  startedAt: number;
55
55
  /** See the module header: the stored access token at start, for the one command that removes it. */
56
56
  tokenSnapshot: TokenSnapshot | null;
57
+ /**
58
+ * The creator's own request, once, for the whole command — `null` when the flag was absent or
59
+ * the creator opted out of telemetry.
60
+ *
61
+ * It is one value per invocation, so it is captured where every other per-invocation fact is
62
+ * captured rather than being handed down through each request builder. Threading it meant
63
+ * sixteen call sites had to remember to pass it, and the three that built their bodies through
64
+ * their own runners had already been given their own copy of the guard.
65
+ */
66
+ creatorPrompt: string | null;
57
67
  }
58
68
  export interface BeginCommandInput {
59
69
  name: string;
60
70
  json: boolean;
61
71
  explicitEnv?: string;
72
+ /** `--original-prompt`, as typed. See `creator-prompt.ts`. */
73
+ creatorPrompt?: string;
62
74
  env?: Record<string, string | undefined>;
63
75
  isTTY?: boolean;
64
76
  now?: () => number;
@@ -100,6 +100,13 @@ export function beginCommand(input) {
100
100
  environment,
101
101
  startedAt: (input.now ?? Date.now)(),
102
102
  tokenSnapshot: collect ? snapshotToken(environment, input.baseDir) : null,
103
+ // Gated on `collect` like the snapshots above: this is the one field the CLI sends that is a
104
+ // human's own prose rather than a fact about a command, so an opted-out creator must not have
105
+ // it forwarded. Dropping it HERE rather than at each request builder is what makes that true
106
+ // for every command at once, including any added later.
107
+ creatorPrompt: collect && typeof input.creatorPrompt === 'string' && input.creatorPrompt.trim().length > 0
108
+ ? input.creatorPrompt.trim()
109
+ : null,
103
110
  };
104
111
  return current;
105
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"command-context.js","sourceRoot":"","sources":["../../src/telemetry/command-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QACpG,WAAW;QACX,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE;QACpC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;QACzE,6FAA6F;QAC7F,8FAA8F;QAC9F,6FAA6F;QAC7F,wDAAwD;QACxD,aAAa,EAAE,OAAO,IAAI,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YACxG,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE;YAC5B,CAAC,CAAC,IAAI;KACT,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,2BAA2B;IACzC,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `--original-prompt`: the creator's request in their own words.
3
+ *
4
+ * Every command that takes it — `init`, `forge`, `cover`, and the ten
5
+ * `generate` subcommands — declares the flag from here and builds the wire
6
+ * field with the one function below, because the four hand-rolled copies this
7
+ * replaced had already drifted: three disagreed with the other seven about
8
+ * whether an empty string counts, and none of them honoured `DO_NOT_TRACK`.
9
+ *
10
+ * The wire field is `creatorPrompt`, deliberately NOT `originalUserPrompt`.
11
+ * That name already means something on the forge lane —
12
+ * `ForgeJobInput.originalUserPrompt` is fed to the director and the designer
13
+ * and is persisted onto the level asset as `worldForgerUserPrompt` — so
14
+ * reusing it made a flag documented as inert change what got built. One name,
15
+ * one meaning: `creatorPrompt` is analytics-only on every lane.
16
+ */
17
+ export declare const ORIGINAL_PROMPT_FLAG: {
18
+ readonly type: "string";
19
+ readonly description: string;
20
+ };
21
+ /**
22
+ * The creator's own words as the wire field, or nothing.
23
+ *
24
+ * Reads the running command rather than taking the value from its caller: `--original-prompt` is
25
+ * one value per invocation, captured once in `beginCommand` (which is also where `DO_NOT_TRACK`
26
+ * drops it), so a request builder does not need to be handed it. `override` exists for tests and
27
+ * for the one caller that has a value but no running command.
28
+ *
29
+ * Returns nothing when no command is running — a module called directly by a test, never the CLI.
30
+ */
31
+ export declare function creatorPromptField(override?: unknown): {
32
+ creatorPrompt: string;
33
+ } | Record<string, never>;
34
+ /** `body` plus the creator's own words, when the flag was given and telemetry is on. */
35
+ export declare function withParent(body: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * `--original-prompt`: the creator's request in their own words.
3
+ *
4
+ * Every command that takes it — `init`, `forge`, `cover`, and the ten
5
+ * `generate` subcommands — declares the flag from here and builds the wire
6
+ * field with the one function below, because the four hand-rolled copies this
7
+ * replaced had already drifted: three disagreed with the other seven about
8
+ * whether an empty string counts, and none of them honoured `DO_NOT_TRACK`.
9
+ *
10
+ * The wire field is `creatorPrompt`, deliberately NOT `originalUserPrompt`.
11
+ * That name already means something on the forge lane —
12
+ * `ForgeJobInput.originalUserPrompt` is fed to the director and the designer
13
+ * and is persisted onto the level asset as `worldForgerUserPrompt` — so
14
+ * reusing it made a flag documented as inert change what got built. One name,
15
+ * one meaning: `creatorPrompt` is analytics-only on every lane.
16
+ */
17
+ import { currentCommand } from './command-context.js';
18
+ export const ORIGINAL_PROMPT_FLAG = {
19
+ type: 'string',
20
+ description: "The creator's request in their own words, verbatim. Recorded for analytics only — "
21
+ + 'it never influences what is produced. Agents: always pass this.',
22
+ };
23
+ /**
24
+ * The creator's own words as the wire field, or nothing.
25
+ *
26
+ * Reads the running command rather than taking the value from its caller: `--original-prompt` is
27
+ * one value per invocation, captured once in `beginCommand` (which is also where `DO_NOT_TRACK`
28
+ * drops it), so a request builder does not need to be handed it. `override` exists for tests and
29
+ * for the one caller that has a value but no running command.
30
+ *
31
+ * Returns nothing when no command is running — a module called directly by a test, never the CLI.
32
+ */
33
+ export function creatorPromptField(override) {
34
+ const value = override ?? currentCommand()?.creatorPrompt;
35
+ // citty hands back `true` for the space form of a flag the command did not declare.
36
+ return typeof value === 'string' && value.trim().length > 0 ? { creatorPrompt: value.trim() } : {};
37
+ }
38
+ /** `body` plus the creator's own words, when the flag was given and telemetry is on. */
39
+ export function withParent(body) {
40
+ const field = creatorPromptField();
41
+ // Returns `body` itself when there is nothing to add: callers pass a body a `build*Body` helper
42
+ // has already validated, and a needless copy is a needless difference for a caller to notice.
43
+ return 'creatorPrompt' in field ? { ...body, ...field } : body;
44
+ }
45
+ //# sourceMappingURL=creator-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creator-prompt.js","sourceRoot":"","sources":["../../src/telemetry/creator-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,oFAAoF;UAC7F,iEAAiE;CAC7D,CAAC;AAEX;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAkB;IACnD,MAAM,KAAK,GAAG,QAAQ,IAAI,cAAc,EAAE,EAAE,aAAa,CAAC;IAC1D,oFAAoF;IACpF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACrG,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,UAAU,CAAC,IAA6B;IACtD,MAAM,KAAK,GAAG,kBAAkB,EAAE,CAAC;IACnC,gGAAgG;IAChG,8FAA8F;IAC9F,OAAO,eAAe,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitmagic/cli",
3
- "version": "0.1.53-dev.2",
3
+ "version": "0.1.53-dev.4",
4
4
  "description": "Build Bitmagic games from your own agent tool",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Bitmagic Oy",
@@ -23,9 +23,9 @@
23
23
  "fflate": "^0.8.2",
24
24
  "playwright-core": "^1.59.1",
25
25
  "tar": "^7.4.3",
26
- "@bitmagic/animation-forger": "0.1.8-dev.2",
27
- "@bitmagic/asset-core": "0.2.8-dev.2",
28
- "@bitmagic/world-forger": "0.1.13-dev.2"
26
+ "@bitmagic/animation-forger": "0.1.8-dev.4",
27
+ "@bitmagic/asset-core": "0.2.8-dev.4",
28
+ "@bitmagic/world-forger": "0.1.13-dev.4"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@eslint/js": "^9.38.0",