maiass 5.12.9 → 5.14.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.
@@ -11,6 +11,14 @@ import { getSingleCharInput } from './input-utils.js';
11
11
  import fs from 'fs';
12
12
  import path from 'path';
13
13
 
14
+ /**
15
+ * Flags accepted by `maiass account-info` (and the `--account-info` shortcut).
16
+ * Consumed by the global flag validator in maiass.mjs — see MAI-43.
17
+ */
18
+ export const FLAGS = [
19
+ '--json',
20
+ ];
21
+
14
22
  /**
15
23
  * Mask a sensitive token (show start and end only)
16
24
  * @param {string} token - Token to mask
@@ -0,0 +1,54 @@
1
+ // Pure argv parsing helpers shared between maiass.mjs and unit tests.
2
+ //
3
+ // Kept dependency-free and side-effect-free so it can be imported in a unit
4
+ // test without triggering maiass.mjs's top-level CLI bootstrap.
5
+
6
+ /**
7
+ * Extract the -m / --message commit-message value from argv (MAI-51 parity).
8
+ *
9
+ * Supported forms (single value only — NOT git-style repeated -m):
10
+ * -m <value>
11
+ * --message <value>
12
+ * --message=<value>
13
+ *
14
+ * The value is taken VERBATIM (no escape-sequence interpretation, no newline
15
+ * collapsing). Only the whole-string leading/trailing whitespace is trimmed,
16
+ * and that trimming happens at the point of use (lib/commit.js) so that empty /
17
+ * whitespace-only values still fall through to the "No commit message provided"
18
+ * path. Here we return the raw string.
19
+ *
20
+ * Last occurrence wins if the flag appears more than once.
21
+ *
22
+ * @param {string[]} argv
23
+ * @returns {{ message: string|null, valueIndices: Set<number> }}
24
+ * message — the raw message string, or null if -m/--message not present.
25
+ * valueIndices — argv positions of the VALUE token only (the space-separated
26
+ * form's value). The flag tokens (-m/--message) are NOT included
27
+ * because (a) they start with '-' so command derivation already
28
+ * skips them, and (b) the flag-validator still needs to validate
29
+ * them against the allow-list. The value token is recorded so
30
+ * command derivation doesn't mistake it for a command/bump type
31
+ * and so the validator skips it if it happens to start with '-'.
32
+ */
33
+ export function extractMessageFlag(argv) {
34
+ let message = null;
35
+ const valueIndices = new Set();
36
+ for (let i = 0; i < argv.length; i++) {
37
+ const arg = argv[i];
38
+ if (arg === '-m' || arg === '--message') {
39
+ if (i + 1 < argv.length) {
40
+ message = argv[i + 1];
41
+ valueIndices.add(i + 1);
42
+ } else {
43
+ // Flag given with no following token — treat as empty so it falls
44
+ // through to the "No commit message provided" error rather than
45
+ // silently consuming nothing.
46
+ message = '';
47
+ }
48
+ } else if (arg.startsWith('--message=')) {
49
+ message = arg.slice('--message='.length);
50
+ valueIndices.add(i);
51
+ }
52
+ }
53
+ return { message, valueIndices };
54
+ }
package/lib/bootstrap.js CHANGED
@@ -612,6 +612,11 @@ MAIASS_STAGINGBRANCH=${config.branches.staging}
612
612
 
613
613
  # Example: Personal debug settings
614
614
  #MAIASS_DEBUG=true
615
+
616
+ # Example: devlog tagging (optional)
617
+ #MAIASS_DEVLOG_CLIENT="yourclient"
618
+ #MAIASS_DEVLOG_SUBCLIENT=""
619
+ #MAIASS_DEVLOG_PROJECT="yourproject"
615
620
  `;
616
621
  fs.writeFileSync('.env.maiass.local', localContent, 'utf8');
617
622
  log.success(SYMBOLS.CHECKMARK, 'Created .env.maiass.local for personal settings');