maestro-flow 0.3.17 → 0.3.18

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 (48) hide show
  1. package/.claude/commands/spec-add.md +13 -11
  2. package/dashboard/dist-server/dashboard/src/server/routes/install-utils.js +2 -2
  3. package/dashboard/dist-server/dashboard/src/server/routes/install-utils.js.map +1 -1
  4. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +3 -1
  5. package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
  6. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +1 -0
  7. package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
  8. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +2 -0
  9. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  10. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +5 -0
  11. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +106 -32
  12. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  13. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +6 -0
  14. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +9 -1
  15. package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
  16. package/dashboard/dist-server/src/config/paths.d.ts +1 -0
  17. package/dashboard/dist-server/src/config/paths.js +1 -0
  18. package/dashboard/dist-server/src/config/paths.js.map +1 -1
  19. package/dist/src/commands/install-backend.d.ts.map +1 -1
  20. package/dist/src/commands/install-backend.js +9 -4
  21. package/dist/src/commands/install-backend.js.map +1 -1
  22. package/dist/src/commands/install.d.ts.map +1 -1
  23. package/dist/src/commands/install.js +9 -3
  24. package/dist/src/commands/install.js.map +1 -1
  25. package/dist/src/commands/spec.d.ts.map +1 -1
  26. package/dist/src/commands/spec.js +82 -17
  27. package/dist/src/commands/spec.js.map +1 -1
  28. package/dist/src/commands/update.d.ts.map +1 -1
  29. package/dist/src/commands/update.js +49 -28
  30. package/dist/src/commands/update.js.map +1 -1
  31. package/dist/src/commands/wiki.d.ts.map +1 -1
  32. package/dist/src/commands/wiki.js +5 -0
  33. package/dist/src/commands/wiki.js.map +1 -1
  34. package/dist/src/config/paths.d.ts +1 -0
  35. package/dist/src/config/paths.d.ts.map +1 -1
  36. package/dist/src/config/paths.js +1 -0
  37. package/dist/src/config/paths.js.map +1 -1
  38. package/dist/src/tools/spec-init.d.ts +5 -1
  39. package/dist/src/tools/spec-init.d.ts.map +1 -1
  40. package/dist/src/tools/spec-init.js +6 -2
  41. package/dist/src/tools/spec-init.js.map +1 -1
  42. package/dist/src/tools/spec-loader.d.ts +23 -6
  43. package/dist/src/tools/spec-loader.d.ts.map +1 -1
  44. package/dist/src/tools/spec-loader.js +122 -20
  45. package/dist/src/tools/spec-loader.js.map +1 -1
  46. package/package.json +1 -1
  47. package/workflows/specs-add.md +44 -16
  48. package/workflows/specs-load.md +21 -11
@@ -5,9 +5,10 @@
5
5
  * Reads .workflow/specs/*.md, filters by category via static mapping,
6
6
  * returns concatenated content.
7
7
  */
8
- import { readFileSync, existsSync, readdirSync } from 'node:fs';
8
+ import { readFileSync, existsSync, readdirSync, mkdirSync, writeFileSync } from 'node:fs';
9
9
  import { join } from 'node:path';
10
10
  import { parseSpecEntries, formatSpecEntries } from './spec-entry-parser.js';
11
+ import { paths } from '../config/paths.js';
11
12
  // ============================================================================
12
13
  // Filename → Category mapping (single source of truth)
13
14
  // ============================================================================
@@ -24,6 +25,7 @@ const SPECS_DIR = '.workflow/specs';
24
25
  export const TEAM_SPECS_DIR = '.workflow/collab/specs';
25
26
  /** Layer labels used as section headers when multi-directory scanning is active. */
26
27
  const LAYER_LABELS = {
28
+ global: '# Global Specs',
27
29
  baseline: '# Baseline Specs',
28
30
  team: '# Team Specs',
29
31
  // personal label is dynamic — includes uid
@@ -31,32 +33,67 @@ const LAYER_LABELS = {
31
33
  // ============================================================================
32
34
  // Public API
33
35
  // ============================================================================
36
+ /**
37
+ * Resolve the directory for a given spec scope.
38
+ *
39
+ * | scope | directory |
40
+ * |------------|-------------------------------------|
41
+ * | project | .workflow/specs/ |
42
+ * | global | ~/.maestro/specs/ |
43
+ * | team | .workflow/collab/specs/ |
44
+ * | personal | .workflow/collab/specs/{uid}/ |
45
+ */
46
+ export function resolveSpecDir(projectPath, scope, uid) {
47
+ switch (scope) {
48
+ case 'global': return paths.specs;
49
+ case 'team': return join(projectPath, TEAM_SPECS_DIR);
50
+ case 'personal': {
51
+ if (!uid)
52
+ throw new Error('personal scope requires uid');
53
+ return join(projectPath, TEAM_SPECS_DIR, uid);
54
+ }
55
+ case 'project':
56
+ default: return join(projectPath, SPECS_DIR);
57
+ }
58
+ }
34
59
  /**
35
60
  * Load spec files from one or more directories.
36
61
  *
37
- * When `uid` is provided, scans three directories in order:
62
+ * Layer scanning order (lowest highest priority):
63
+ * 0. ~/.maestro/specs/ (global — when `scope` includes global)
38
64
  * 1. .workflow/specs/ (baseline)
39
- * 2. .workflow/collab/specs/ (team shared)
40
- * 3. .workflow/collab/specs/{uid}/ (personal)
65
+ * 2. .workflow/collab/specs/ (team shared — when `uid` is provided)
66
+ * 3. .workflow/collab/specs/{uid}/ (personal — when `uid` is provided)
41
67
  *
42
68
  * Content from later layers is appended (never replaces earlier content).
43
69
  * Each layer's content is prefixed with a header for clarity.
44
70
  *
45
- * When `uid` is absent, only the baseline directory is scanned — identical
46
- * to the original single-directory behavior.
71
+ * @param scope Controls which extra layers to include beyond baseline.
72
+ * - 'project': baseline only (default)
73
+ * - 'global': global + baseline
74
+ * - 'team': baseline + team shared
75
+ * - 'personal': baseline + team shared + personal (requires uid)
76
+ * - undefined: same as 'project'; uid alone still triggers team+personal for backward compat
47
77
  */
48
- export function loadSpecs(projectPath, category, uid, keyword) {
78
+ export function loadSpecs(projectPath, category, uid, keyword, scope) {
49
79
  // Build ordered list of (directory, label) pairs to scan
50
- const layers = buildLayers(projectPath, uid);
80
+ const layers = buildLayers(projectPath, uid, scope);
81
+ // Auto-init only baseline and global layers.
82
+ // Team/personal are per-user — auto-creating them for arbitrary uids is wrong.
83
+ autoInitSeeds(join(projectPath, SPECS_DIR));
84
+ if (scope === 'global') {
85
+ autoInitSeeds(paths.specs);
86
+ }
51
87
  const allSections = [];
52
88
  const allMatched = [];
53
89
  let totalCount = 0;
90
+ const multiLayer = layers.length > 1;
54
91
  for (const { dir, label } of layers) {
55
92
  const { sections, matched } = loadFromDir(dir, category, keyword);
56
93
  if (sections.length === 0)
57
94
  continue;
58
- // Only add layer headers when multi-layer mode is active (uid provided)
59
- if (uid) {
95
+ // Add layer headers when multi-layer mode is active (global or uid)
96
+ if (multiLayer) {
60
97
  allSections.push(`${label}\n\n${sections.join('\n\n---\n\n')}`);
61
98
  }
62
99
  else {
@@ -73,18 +110,26 @@ export function loadSpecs(projectPath, category, uid, keyword) {
73
110
  totalLoaded: totalCount,
74
111
  };
75
112
  }
76
- function buildLayers(projectPath, uid) {
77
- const baseline = {
113
+ function buildLayers(projectPath, uid, scope) {
114
+ const layers = [];
115
+ // Global layer — lowest priority
116
+ if (scope === 'global') {
117
+ layers.push({ dir: paths.specs, label: LAYER_LABELS.global });
118
+ }
119
+ // Baseline — always included
120
+ layers.push({
78
121
  dir: join(projectPath, SPECS_DIR),
79
122
  label: LAYER_LABELS.baseline,
80
- };
81
- if (!uid)
82
- return [baseline];
83
- return [
84
- baseline,
85
- { dir: join(projectPath, TEAM_SPECS_DIR), label: LAYER_LABELS.team },
86
- { dir: join(projectPath, TEAM_SPECS_DIR, uid), label: `# Personal Specs (${uid})` },
87
- ];
123
+ });
124
+ // Team + personal layers
125
+ // Activated by scope='team'|'personal', or by uid (backward compat)
126
+ if (scope === 'team' || scope === 'personal' || uid) {
127
+ layers.push({ dir: join(projectPath, TEAM_SPECS_DIR), label: LAYER_LABELS.team });
128
+ if (uid) {
129
+ layers.push({ dir: join(projectPath, TEAM_SPECS_DIR, uid), label: `# Personal Specs (${uid})` });
130
+ }
131
+ }
132
+ return layers;
88
133
  }
89
134
  /**
90
135
  * Load spec files from a single directory. Returns empty arrays if the
@@ -174,4 +219,61 @@ function stripFrontmatter(raw) {
174
219
  return raw;
175
220
  return trimmed.substring(endIdx + 4).trim();
176
221
  }
222
+ // ============================================================================
223
+ // Auto-init seed files
224
+ // ============================================================================
225
+ /** Directories already checked this process — skip re-checking. */
226
+ const autoInitChecked = new Set();
227
+ /** Minimal seed files (filename + header). */
228
+ const AUTO_INIT_SEEDS = [
229
+ ['coding-conventions.md', '# Coding Conventions\n\n## Entries\n\n'],
230
+ ['architecture-constraints.md', '# Architecture Constraints\n\n## Entries\n\n'],
231
+ ['learnings.md', '# Learnings\n\n## Entries\n\n'],
232
+ ['quality-rules.md', '# Quality Rules\n\n## Entries\n\n'],
233
+ ['debug-notes.md', '# Debug Notes\n\n## Entries\n\n'],
234
+ ['test-conventions.md', '# Test Conventions\n\n## Entries\n\n'],
235
+ ['review-standards.md', '# Review Standards\n\n## Entries\n\n'],
236
+ ];
237
+ /**
238
+ * Auto-create a specs directory with seed files if it does not exist.
239
+ * Applies to every layer (global, baseline, team, personal).
240
+ *
241
+ * For project-local dirs: only runs when `.workflow/` already exists
242
+ * (i.e. the project is maestro-managed).
243
+ * For global (`~/.maestro/specs/`): always creates — the home dir exists by definition.
244
+ *
245
+ * Synchronous, per-directory dedup, best-effort — never throws.
246
+ */
247
+ function autoInitSeeds(specsDir) {
248
+ if (autoInitChecked.has(specsDir))
249
+ return;
250
+ autoInitChecked.add(specsDir);
251
+ if (existsSync(specsDir))
252
+ return;
253
+ // For project-local paths, only auto-init when .workflow/ already exists.
254
+ // Global path (under ~/.maestro/) always qualifies.
255
+ const isGlobal = specsDir === paths.specs;
256
+ if (!isGlobal) {
257
+ // Walk up to check if .workflow/ parent exists
258
+ // specsDir patterns: <project>/.workflow/specs, <project>/.workflow/collab/specs[/<uid>]
259
+ const workflowIdx = specsDir.replace(/\\/g, '/').indexOf('.workflow/');
260
+ if (workflowIdx !== -1) {
261
+ const workflowDir = specsDir.substring(0, workflowIdx + '.workflow'.length);
262
+ if (!existsSync(workflowDir))
263
+ return;
264
+ }
265
+ }
266
+ try {
267
+ mkdirSync(specsDir, { recursive: true });
268
+ for (const [filename, content] of AUTO_INIT_SEEDS) {
269
+ const filePath = join(specsDir, filename);
270
+ if (!existsSync(filePath)) {
271
+ writeFileSync(filePath, content, 'utf-8');
272
+ }
273
+ }
274
+ }
275
+ catch {
276
+ // Best-effort — don't block loading
277
+ }
278
+ }
177
279
  //# sourceMappingURL=spec-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spec-loader.js","sourceRoot":"","sources":["../../../src/tools/spec-loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAwB,MAAM,wBAAwB,CAAC;AAcnG,+EAA+E;AAC/E,uDAAuD;AACvD,+EAA+E;AAE/E,MAAM,CAAC,MAAM,YAAY,GAAiC;IACxD,uBAAuB,EAAO,QAAQ;IACtC,6BAA6B,EAAE,MAAM;IACrC,kBAAkB,EAAY,SAAS;IACvC,gBAAgB,EAAc,OAAO;IACrC,qBAAqB,EAAS,MAAM;IACpC,qBAAqB,EAAS,QAAQ;IACtC,cAAc,EAAgB,UAAU;CACzC,CAAC;AAEF,MAAM,SAAS,GAAG,iBAAiB,CAAC;AACpC,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEvD,oFAAoF;AACpF,MAAM,YAAY,GAA2B;IAC3C,QAAQ,EAAE,kBAAkB;IAC5B,IAAI,EAAE,cAAc;IACpB,2CAA2C;CAC5C,CAAC;AAEF,+EAA+E;AAC/E,aAAa;AACb,+EAA+E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,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,+CAA+C;QAC/C,yFAAyF;QACzF,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACvE,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,CAAC;YACvB,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;YAC5E,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;gBAAE,OAAO;QACvC,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC;YAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC1C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1B,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,oCAAoC;IACtC,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "description": "Workflow orchestration CLI with MCP endpoint support and extensible architecture",
5
5
  "type": "module",
6
6
  "imports": {
@@ -5,45 +5,70 @@ Add a `<spec-entry>` closed-tag entry to a single target spec file by category.
5
5
  ## Arguments
6
6
 
7
7
  ```
8
- $ARGUMENTS: "<category> <content>"
8
+ $ARGUMENTS: "[--scope <scope>] [--uid <uid>] <category> <content>"
9
9
 
10
+ --scope -- target scope: project (default) | global | team | personal
11
+ --uid -- user id for personal scope (auto-detected from git if omitted)
10
12
  category -- one of: coding, arch, quality, debug, test, review, learning
11
13
  content -- free-text description of the entry
12
14
  ```
13
15
 
14
- ## Category-to-File Mapping (1:1)
16
+ ## Scope-to-Directory Mapping
17
+
18
+ | Scope | Target directory | uid needed |
19
+ |-------|-----------------|------------|
20
+ | `project` (default) | `.workflow/specs/` | no |
21
+ | `global` | `~/.maestro/specs/` | no |
22
+ | `team` | `.workflow/collab/specs/` | no |
23
+ | `personal` | `.workflow/collab/specs/{uid}/` | yes (auto or `--uid`) |
24
+
25
+ ## Category-to-File Mapping (1:1, same filename in every scope)
15
26
 
16
27
  | Category | Target file |
17
28
  |----------|------------|
18
- | `coding` | `.workflow/specs/coding-conventions.md` |
19
- | `arch` | `.workflow/specs/architecture-constraints.md` |
20
- | `quality` | `.workflow/specs/quality-rules.md` |
21
- | `debug` | `.workflow/specs/debug-notes.md` |
22
- | `test` | `.workflow/specs/test-conventions.md` |
23
- | `review` | `.workflow/specs/review-standards.md` |
24
- | `learning` | `.workflow/specs/learnings.md` |
29
+ | `coding` | `coding-conventions.md` |
30
+ | `arch` | `architecture-constraints.md` |
31
+ | `quality` | `quality-rules.md` |
32
+ | `debug` | `debug-notes.md` |
33
+ | `test` | `test-conventions.md` |
34
+ | `review` | `review-standards.md` |
35
+ | `learning` | `learnings.md` |
25
36
 
26
37
  ## Prerequisites
27
38
 
28
- - `.workflow/specs/` directory must exist (run `/spec-setup` first if missing)
39
+ - Target specs directory must exist:
40
+ - `project`: `.workflow/specs/` (run `/spec-setup` or `maestro spec init`)
41
+ - `global`: `~/.maestro/specs/` (run `maestro spec init --scope global`)
42
+ - `team`: `.workflow/collab/specs/` (run `maestro spec init --scope team`)
43
+ - `personal`: `.workflow/collab/specs/{uid}/` (run `maestro spec init --scope personal`)
29
44
 
30
45
  ## Execution Steps
31
46
 
32
47
  ### Step 1: Parse Arguments
33
48
 
34
49
  ```
35
- Parse: category = first word, content = remaining text
36
- Validate: category {coding, arch, quality, debug, test, review, learning}, content non-empty
37
- On failure: show usage `/spec-add <category> <content>` with valid categories, exit
50
+ Parse $ARGUMENTS:
51
+ 1. Extract --scope <value> (default: project)
52
+ 2. Extract --uid <value> if present
53
+ 3. category = first remaining word
54
+ 4. content = remaining text
55
+ Validate:
56
+ - scope ∈ {project, global, team, personal}
57
+ - category ∈ {coding, arch, quality, debug, test, review, learning}
58
+ - content non-empty
59
+ - personal scope requires uid (resolve from `maestro collab whoami` if --uid not given)
60
+ On failure: show usage `/spec-add [--scope <scope>] <category> <content>`, exit
38
61
  ```
39
62
 
40
63
  ### Step 2: Resolve Target File
41
64
 
42
- Map category to file path. If file does not exist, create it with a basic header.
65
+ Resolve directory from scope (see table above), then append `<target_file>` from category mapping.
66
+
67
+ If file does not exist, create it with a basic header.
43
68
 
44
69
  Check for near-duplicate entries:
45
70
  ```bash
46
- grep -i "<content_first_10_words>" .workflow/specs/<target_file> | tail -5
71
+ grep -i "<content_first_10_words>" <resolved_dir>/<target_file> | tail -5
47
72
  ```
48
73
 
49
74
  ### Step 3: Extract Keywords
@@ -70,7 +95,10 @@ Read target file. Append the formatted `<spec-entry>` block at the end. Write fi
70
95
 
71
96
  ### Step 6: Confirm
72
97
 
73
- Display: category, target file, keywords, and verify command (`/spec-load --keyword <kw1>`).
98
+ Display: category, scope, target file path, keywords, and verify command:
99
+ ```
100
+ maestro spec load --scope <scope> --keyword <kw1>
101
+ ```
74
102
 
75
103
  ## Output
76
104
 
@@ -1,20 +1,22 @@
1
1
  # Workflow: specs-load
2
2
 
3
- Load spec files from `.workflow/specs/`, filtered by category.
3
+ Load spec files filtered by category. Supports project, global, team, and personal scopes.
4
4
 
5
5
  ## Arguments
6
6
 
7
7
  ```
8
- $ARGUMENTS: "[--category <type>] [keyword]"
8
+ $ARGUMENTS: "[--scope <scope>] [--uid <uid>] [--category <type>] [keyword]"
9
9
 
10
+ --scope -- load scope: project (default) | global | team | personal
11
+ --uid -- user id for personal scope (auto-detected from git if omitted)
10
12
  --category -- filter by category (1:1 mapping to file):
11
13
  coding | arch | quality | debug | test | review | learning | all
12
14
  keyword -- optional, grep within loaded specs for matching sections
13
15
  ```
14
16
 
15
- ## Category File Mapping (1:1)
17
+ ## Category -> File Mapping (1:1)
16
18
 
17
- Each category loads exactly one file. Same mapping as spec-add.
19
+ Each category loads exactly one file per layer. Same mapping as spec-add.
18
20
 
19
21
  | Category | File loaded |
20
22
  |----------|------------|
@@ -27,22 +29,30 @@ Each category loads exactly one file. Same mapping as spec-add.
27
29
  | `learning` | `learnings.md` |
28
30
  | `all` (default) | All `.md` files in specs/ |
29
31
 
32
+ ## Layer Order by Scope
33
+
34
+ | Scope | Layers loaded (lowest -> highest priority) |
35
+ |-------|-------------------------------------------|
36
+ | `project` | baseline only |
37
+ | `global` | global + baseline |
38
+ | `team` | baseline + team shared |
39
+ | `personal` | baseline + team shared + personal (requires uid) |
40
+
41
+ Each layer is prefixed with a section header when multi-layer.
42
+
30
43
  ## Execution Steps
31
44
 
32
45
  ### Step 1: Parse Arguments
33
46
 
34
- Extract `--category <type>` (filter) and remaining text (keyword for grep).
47
+ Extract `--scope`, `--uid`, `--category <type>` and remaining text (keyword for grep).
35
48
 
36
49
  ### Step 2: Load Specs via CLI
37
50
 
38
51
  ```bash
39
- maestro spec load --category <category>
52
+ maestro spec load --scope <scope> [--uid <uid>] [--category <category>] [--keyword <word>]
40
53
  ```
41
54
 
42
- If `maestro spec load` CLI is unavailable, read files directly:
43
- ```bash
44
- cat .workflow/specs/<matched-file>
45
- ```
55
+ If `maestro spec load` CLI is unavailable, read files directly from the resolved directory.
46
56
 
47
57
  ### Step 3: Keyword Filter (optional)
48
58
 
@@ -55,5 +65,5 @@ grep -n -i -C 3 "$KEYWORD" <loaded content>
55
65
 
56
66
  Output loaded specs content. If no specs found, show:
57
67
  ```
58
- (No specs found. Run "maestro spec init" or "/spec-setup" to initialize.)
68
+ (No specs found. Run "maestro spec init --scope <scope>" to initialize.)
59
69
  ```