maestro-flow 0.3.22 → 0.3.24
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/.claude/commands/maestro-analyze.md +1 -1
- package/.claude/commands/maestro-brainstorm.md +1 -1
- package/.claude/commands/maestro-composer.md +3 -3
- package/.claude/commands/maestro-init.md +4 -4
- package/.claude/commands/maestro-roadmap.md +164 -108
- package/.claude/commands/maestro.md +19 -10
- package/.claude/commands/quality-business-test.md +2 -2
- package/.claude/skills/team-quality-assurance/roles/scout/role.md +1 -1
- package/.claude/skills/team-review/roles/reviewer/role.md +1 -1
- package/.claude/skills/team-review/roles/scanner/role.md +1 -1
- package/.claude/skills/team-tech-debt/roles/scanner/role.md +3 -3
- package/.codex/skills/maestro/SKILL.md +12 -9
- package/.codex/skills/maestro-brainstorm/SKILL.md +1 -1
- package/.codex/skills/maestro-composer/SKILL.md +3 -3
- package/.codex/skills/maestro-init/SKILL.md +1 -1
- package/.codex/skills/maestro-link-coordinate/SKILL.md +1 -1
- package/.codex/skills/maestro-player/SKILL.md +2 -2
- package/.codex/skills/maestro-roadmap/SKILL.md +443 -332
- package/.codex/skills/quality-business-test/SKILL.md +2 -2
- package/.codex/skills/team-coordinate/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-lifecycle-v4/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-quality-assurance/roles/scout/role.md +1 -1
- package/.codex/skills/team-review/roles/reviewer/role.md +1 -1
- package/.codex/skills/team-review/roles/scanner/role.md +1 -1
- package/.codex/skills/team-tech-debt/roles/scanner/role.md +3 -3
- package/chains/singles/spec-generate.json +3 -3
- package/chains/spec-driven.json +2 -2
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +2 -2
- package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/install-utils.d.ts +5 -12
- package/dashboard/dist-server/dashboard/src/server/routes/install-utils.js +10 -65
- package/dashboard/dist-server/dashboard/src/server/routes/install-utils.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/install.js +17 -11
- package/dashboard/dist-server/dashboard/src/server/routes/install.js.map +1 -1
- package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +4 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -2
- package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
- package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
- package/dashboard/dist-server/src/commands/delegate.js +20 -4
- package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
- package/dashboard/dist-server/src/config/cli-tools-config.d.ts +68 -3
- package/dashboard/dist-server/src/config/cli-tools-config.js +248 -9
- package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
- package/dist/src/agents/cli-agent-runner.d.ts +4 -0
- package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.js +4 -2
- package/dist/src/agents/cli-agent-runner.js.map +1 -1
- package/dist/src/cli.js +2 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/cli.d.ts.map +1 -1
- package/dist/src/commands/cli.js +21 -4
- package/dist/src/commands/cli.js.map +1 -1
- package/dist/src/commands/delegate.d.ts +2 -0
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +20 -4
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/commands/install-backend.d.ts +5 -16
- package/dist/src/commands/install-backend.d.ts.map +1 -1
- package/dist/src/commands/install-backend.js +8 -104
- package/dist/src/commands/install-backend.js.map +1 -1
- package/dist/src/commands/install-ui/ExecutionView.js +1 -1
- package/dist/src/commands/install-ui/ExecutionView.js.map +1 -1
- package/dist/src/commands/install-ui/InstallExecution.d.ts +1 -0
- package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallExecution.js +19 -4
- package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
- package/dist/src/commands/install-ui/InstallResult.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallResult.js +1 -1
- package/dist/src/commands/install-ui/InstallResult.js.map +1 -1
- package/dist/src/commands/install.d.ts.map +1 -1
- package/dist/src/commands/install.js +28 -3
- package/dist/src/commands/install.js.map +1 -1
- package/dist/src/commands/tools-ui/CommandReference.d.ts +7 -0
- package/dist/src/commands/tools-ui/CommandReference.d.ts.map +1 -0
- package/dist/src/commands/tools-ui/CommandReference.js +33 -0
- package/dist/src/commands/tools-ui/CommandReference.js.map +1 -0
- package/dist/src/commands/tools-ui/ConfigSources.d.ts +6 -0
- package/dist/src/commands/tools-ui/ConfigSources.d.ts.map +1 -0
- package/dist/src/commands/tools-ui/ConfigSources.js +27 -0
- package/dist/src/commands/tools-ui/ConfigSources.js.map +1 -0
- package/dist/src/commands/tools-ui/RegisterSettings.d.ts +8 -0
- package/dist/src/commands/tools-ui/RegisterSettings.d.ts.map +1 -0
- package/dist/src/commands/tools-ui/RegisterSettings.js +125 -0
- package/dist/src/commands/tools-ui/RegisterSettings.js.map +1 -0
- package/dist/src/commands/tools-ui/RoleMappings.d.ts +9 -0
- package/dist/src/commands/tools-ui/RoleMappings.d.ts.map +1 -0
- package/dist/src/commands/tools-ui/RoleMappings.js +104 -0
- package/dist/src/commands/tools-ui/RoleMappings.js.map +1 -0
- package/dist/src/commands/tools-ui/ToolsDashboard.d.ts +8 -0
- package/dist/src/commands/tools-ui/ToolsDashboard.d.ts.map +1 -0
- package/dist/src/commands/tools-ui/ToolsDashboard.js +60 -0
- package/dist/src/commands/tools-ui/ToolsDashboard.js.map +1 -0
- package/dist/src/commands/tools-ui/ToolsOverview.d.ts +9 -0
- package/dist/src/commands/tools-ui/ToolsOverview.d.ts.map +1 -0
- package/dist/src/commands/tools-ui/ToolsOverview.js +84 -0
- package/dist/src/commands/tools-ui/ToolsOverview.js.map +1 -0
- package/dist/src/commands/tools.d.ts +3 -0
- package/dist/src/commands/tools.d.ts.map +1 -0
- package/dist/src/commands/tools.js +78 -0
- package/dist/src/commands/tools.js.map +1 -0
- package/dist/src/config/cli-tools-config.d.ts +68 -3
- package/dist/src/config/cli-tools-config.d.ts.map +1 -1
- package/dist/src/config/cli-tools-config.js +248 -9
- package/dist/src/config/cli-tools-config.js.map +1 -1
- package/dist/src/core/component-defs.d.ts +16 -0
- package/dist/src/core/component-defs.d.ts.map +1 -0
- package/dist/src/core/component-defs.js +142 -0
- package/dist/src/core/component-defs.js.map +1 -0
- package/dist/src/core/manifest.d.ts +8 -1
- package/dist/src/core/manifest.d.ts.map +1 -1
- package/dist/src/core/manifest.js +29 -40
- package/dist/src/core/manifest.js.map +1 -1
- package/dist/src/core/tag-injector.d.ts +72 -0
- package/dist/src/core/tag-injector.d.ts.map +1 -0
- package/dist/src/core/tag-injector.js +228 -0
- package/dist/src/core/tag-injector.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
- package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +1 -1
- package/templates/cli/prompts/workflow-skill-lessons-learned.txt +1 -1
- package/templates/search-tools.md +1 -1
- package/templates/workflows/specs/node-catalog.md +1 -1
- package/workflows/brainstorm.md +1 -1
- package/{.claude/CLAUDE.md → workflows/claude-instructions.md} +25 -26
- package/workflows/cli-tools-usage.md +16 -2
- package/workflows/codex-instructions.md +150 -0
- package/workflows/delegate-usage.md +16 -2
- package/workflows/execute.md +28 -14
- package/workflows/init.md +2 -2
- package/workflows/issue-discover.md +2 -2
- package/workflows/maestro-super.md +120 -0
- package/workflows/maestro.codex.md +4 -4
- package/workflows/maestro.md +5 -5
- package/workflows/roadmap-common.md +197 -0
- package/workflows/roadmap.md +190 -355
- package/workflows/spec-generate.md +457 -544
- package/.claude/commands/maestro-spec-generate.md +0 -78
- package/.codex/skills/maestro-spec-generate/SKILL.md +0 -355
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Component Definitions — single source of truth for CLI and Dashboard.
|
|
3
|
+
//
|
|
4
|
+
// Both `maestro install` (CLI) and the Dashboard wizard import from here.
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { homedir } from 'node:os';
|
|
8
|
+
import { paths } from '../config/paths.js';
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Definitions
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
export const COMPONENT_DEFS = [
|
|
13
|
+
{
|
|
14
|
+
id: 'workflows',
|
|
15
|
+
label: 'Workflows',
|
|
16
|
+
description: 'Workflow definitions (~/.maestro/workflows/)',
|
|
17
|
+
sourcePath: 'workflows',
|
|
18
|
+
target: () => join(paths.home, 'workflows'),
|
|
19
|
+
alwaysGlobal: true,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'templates',
|
|
23
|
+
label: 'Templates',
|
|
24
|
+
description: 'Prompt & task templates (~/.maestro/templates/)',
|
|
25
|
+
sourcePath: 'templates',
|
|
26
|
+
target: () => join(paths.home, 'templates'),
|
|
27
|
+
alwaysGlobal: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'chains',
|
|
31
|
+
label: 'Chains',
|
|
32
|
+
description: 'Coordinate chain graphs (~/.maestro/chains/)',
|
|
33
|
+
sourcePath: 'chains',
|
|
34
|
+
target: () => join(paths.home, 'chains'),
|
|
35
|
+
alwaysGlobal: true,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'overlays',
|
|
39
|
+
label: 'Overlays',
|
|
40
|
+
description: 'Command overlay packs (~/.maestro/overlays/_shipped/)',
|
|
41
|
+
sourcePath: join('overlays', '_shipped'),
|
|
42
|
+
target: () => join(paths.home, 'overlays', '_shipped'),
|
|
43
|
+
alwaysGlobal: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'commands',
|
|
47
|
+
label: 'Commands',
|
|
48
|
+
description: 'Claude Code slash commands',
|
|
49
|
+
sourcePath: join('.claude', 'commands'),
|
|
50
|
+
target: (mode, projectPath) => mode === 'global'
|
|
51
|
+
? join(homedir(), '.claude', 'commands')
|
|
52
|
+
: join(projectPath, '.claude', 'commands'),
|
|
53
|
+
alwaysGlobal: false,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'agents',
|
|
57
|
+
label: 'Agents',
|
|
58
|
+
description: 'Agent definitions',
|
|
59
|
+
sourcePath: join('.claude', 'agents'),
|
|
60
|
+
target: (mode, projectPath) => mode === 'global'
|
|
61
|
+
? join(homedir(), '.claude', 'agents')
|
|
62
|
+
: join(projectPath, '.claude', 'agents'),
|
|
63
|
+
alwaysGlobal: false,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'skills',
|
|
67
|
+
label: 'Skills',
|
|
68
|
+
description: 'Claude Code skills',
|
|
69
|
+
sourcePath: join('.claude', 'skills'),
|
|
70
|
+
target: (mode, projectPath) => mode === 'global'
|
|
71
|
+
? join(homedir(), '.claude', 'skills')
|
|
72
|
+
: join(projectPath, '.claude', 'skills'),
|
|
73
|
+
alwaysGlobal: false,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'claude-md',
|
|
77
|
+
label: 'CLAUDE.md',
|
|
78
|
+
description: 'Project instructions file',
|
|
79
|
+
sourcePath: join('workflows', 'claude-instructions.md'),
|
|
80
|
+
target: (mode, projectPath) => mode === 'global'
|
|
81
|
+
? join(homedir(), '.claude', 'CLAUDE.md')
|
|
82
|
+
: join(projectPath, '.claude', 'CLAUDE.md'),
|
|
83
|
+
alwaysGlobal: false,
|
|
84
|
+
inject: true,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'codex-agents-md',
|
|
88
|
+
label: 'Codex AGENTS.md',
|
|
89
|
+
description: 'Codex project instructions file',
|
|
90
|
+
sourcePath: join('workflows', 'codex-instructions.md'),
|
|
91
|
+
target: (mode, projectPath) => mode === 'global'
|
|
92
|
+
? join(homedir(), '.codex', 'AGENTS.md')
|
|
93
|
+
: join(projectPath, '.codex', 'AGENTS.md'),
|
|
94
|
+
alwaysGlobal: false,
|
|
95
|
+
inject: true,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'claude-md-chinese',
|
|
99
|
+
label: 'Chinese Response (Claude)',
|
|
100
|
+
description: 'Chinese response guidelines → CLAUDE.md',
|
|
101
|
+
sourcePath: join('workflows', 'chinese-response.md'),
|
|
102
|
+
target: (mode, projectPath) => mode === 'global'
|
|
103
|
+
? join(homedir(), '.claude', 'CLAUDE.md')
|
|
104
|
+
: join(projectPath, '.claude', 'CLAUDE.md'),
|
|
105
|
+
alwaysGlobal: false,
|
|
106
|
+
inject: true,
|
|
107
|
+
section: 'chinese',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'codex-md-chinese',
|
|
111
|
+
label: 'Chinese Response (Codex)',
|
|
112
|
+
description: 'Chinese response guidelines → AGENTS.md',
|
|
113
|
+
sourcePath: join('workflows', 'chinese-response.md'),
|
|
114
|
+
target: (mode, projectPath) => mode === 'global'
|
|
115
|
+
? join(homedir(), '.codex', 'AGENTS.md')
|
|
116
|
+
: join(projectPath, '.codex', 'AGENTS.md'),
|
|
117
|
+
alwaysGlobal: false,
|
|
118
|
+
inject: true,
|
|
119
|
+
section: 'chinese',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'codex-agents',
|
|
123
|
+
label: 'Codex Agents',
|
|
124
|
+
description: 'Codex agent definitions',
|
|
125
|
+
sourcePath: join('.codex', 'agents'),
|
|
126
|
+
target: (mode, projectPath) => mode === 'global'
|
|
127
|
+
? join(homedir(), '.codex', 'agents')
|
|
128
|
+
: join(projectPath, '.codex', 'agents'),
|
|
129
|
+
alwaysGlobal: false,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: 'codex-skills',
|
|
133
|
+
label: 'Codex Skills',
|
|
134
|
+
description: 'Codex skill definitions',
|
|
135
|
+
sourcePath: join('.codex', 'skills'),
|
|
136
|
+
target: (mode, projectPath) => mode === 'global'
|
|
137
|
+
? join(homedir(), '.codex', 'skills')
|
|
138
|
+
: join(projectPath, '.codex', 'skills'),
|
|
139
|
+
alwaysGlobal: false,
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
//# sourceMappingURL=component-defs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-defs.js","sourceRoot":"","sources":["../../../src/core/component-defs.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wEAAwE;AACxE,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAE9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAqB3C,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,8CAA8C;QAC3D,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC;QAC3C,YAAY,EAAE,IAAI;KACnB;IACD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,iDAAiD;QAC9D,UAAU,EAAE,WAAW;QACvB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EA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AW,EAAE,QAAQ,EAAE,QAAQ,CAAC;QAC3C,YAAY,EAAE,KAAK;KACpB;IACD;QACE,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,yBAAyB;QACtC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;QACpC,MAAM,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,CAC5B,IAAI,KAAK,QAAQ;YACf,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC;YACrC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC;QAC3C,YAAY,EAAE,KAAK;KACpB;CACF,CAAC"}
|
|
@@ -24,7 +24,14 @@ export declare function saveManifest(manifest: Manifest): string;
|
|
|
24
24
|
export declare function findManifest(scope: 'global' | 'project', targetPath: string): Manifest | null;
|
|
25
25
|
export declare function getAllManifests(): Manifest[];
|
|
26
26
|
export declare function deleteManifest(manifest: Manifest): void;
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @param skipContentManaged If true, skip CONTENT_MANAGED files (CLAUDE.md, AGENTS.md).
|
|
29
|
+
* Use during re-install — tag injection updates in-place, so no cleanup needed.
|
|
30
|
+
* Default false (full cleanup, used by uninstall).
|
|
31
|
+
*/
|
|
32
|
+
export declare function cleanManifestFiles(manifest: Manifest, opts?: {
|
|
33
|
+
skipContentManaged?: boolean;
|
|
34
|
+
}): {
|
|
28
35
|
removed: number;
|
|
29
36
|
skipped: number;
|
|
30
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/core/manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/core/manifest.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC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AAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAgDtC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, unlinkSync, rmSync, } from 'node:fs';
|
|
8
8
|
import { paths } from '../config/paths.js';
|
|
9
|
+
import { hasAnyMarkers, removeAllSections } from './tag-injector.js';
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
10
11
|
// Paths
|
|
11
12
|
// ---------------------------------------------------------------------------
|
|
@@ -107,56 +108,40 @@ export function deleteManifest(manifest) {
|
|
|
107
108
|
// ---------------------------------------------------------------------------
|
|
108
109
|
/** Files to preserve even during cleanup. */
|
|
109
110
|
const PRESERVE = new Set(['settings.json', 'settings.local.json']);
|
|
110
|
-
/** Files that should have maestro content removed instead of being deleted entirely. */
|
|
111
|
-
const CONTENT_MANAGED = new Set(['CLAUDE.md']);
|
|
112
|
-
/** Maestro-specific line patterns in CLAUDE.md */
|
|
113
|
-
const MAESTRO_LINE_PATTERNS = [
|
|
114
|
-
/^#\s*Maestro\s*$/i,
|
|
115
|
-
/maestro/i,
|
|
116
|
-
/~\/\.maestro\//,
|
|
117
|
-
/mcp__ide__getDiagnostics/,
|
|
118
|
-
/cli-tools\.json/,
|
|
119
|
-
];
|
|
111
|
+
/** Files that should have maestro content removed via tag injection instead of being deleted entirely. */
|
|
112
|
+
const CONTENT_MANAGED = new Set(['CLAUDE.md', 'AGENTS.md']);
|
|
120
113
|
/**
|
|
121
|
-
* Remove maestro-
|
|
114
|
+
* Remove maestro-injected content from a doc file using `<!-- maestro:start/end -->` markers.
|
|
122
115
|
*
|
|
123
|
-
*
|
|
124
|
-
* -
|
|
125
|
-
* -
|
|
126
|
-
* - If file matches maestro source content → safe to delete
|
|
127
|
-
* - If file has user additions → remove only maestro-originated lines
|
|
116
|
+
* - If the file has markers, removes only the marked section.
|
|
117
|
+
* - If nothing remains after removal, deletes the file entirely.
|
|
118
|
+
* - Returns true if any content was removed.
|
|
128
119
|
*/
|
|
129
|
-
function
|
|
120
|
+
function cleanInjectedDoc(filePath) {
|
|
130
121
|
if (!existsSync(filePath))
|
|
131
122
|
return false;
|
|
132
123
|
const content = readFileSync(filePath, 'utf-8');
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const filteredLines = lines.filter(line => {
|
|
136
|
-
const trimmed = line.trim();
|
|
137
|
-
if (trimmed.length === 0)
|
|
138
|
-
return true; // keep blank lines
|
|
139
|
-
return !MAESTRO_LINE_PATTERNS.some(p => p.test(trimmed));
|
|
140
|
-
});
|
|
141
|
-
// Check if remaining content is empty (only whitespace/blank lines)
|
|
142
|
-
const meaningful = filteredLines.filter(l => l.trim().length > 0);
|
|
143
|
-
if (meaningful.length === 0) {
|
|
144
|
-
// File only had maestro content — safe to delete
|
|
124
|
+
if (!hasAnyMarkers(content)) {
|
|
125
|
+
// No markers — this is a legacy install or user-only file, delete entirely
|
|
145
126
|
unlinkSync(filePath);
|
|
146
127
|
return true;
|
|
147
128
|
}
|
|
148
|
-
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
.trimEnd() + '\n';
|
|
129
|
+
const cleaned = removeAllSections(content);
|
|
130
|
+
if (!cleaned || cleaned.trim() === '') {
|
|
131
|
+
// Nothing left after removing all maestro sections — delete the file
|
|
132
|
+
unlinkSync(filePath);
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
// User content remains — write back without maestro sections
|
|
156
136
|
writeFileSync(filePath, cleaned, 'utf-8');
|
|
157
137
|
return true;
|
|
158
138
|
}
|
|
159
|
-
|
|
139
|
+
/**
|
|
140
|
+
* @param skipContentManaged If true, skip CONTENT_MANAGED files (CLAUDE.md, AGENTS.md).
|
|
141
|
+
* Use during re-install — tag injection updates in-place, so no cleanup needed.
|
|
142
|
+
* Default false (full cleanup, used by uninstall).
|
|
143
|
+
*/
|
|
144
|
+
export function cleanManifestFiles(manifest, opts) {
|
|
160
145
|
let removed = 0;
|
|
161
146
|
let skipped = 0;
|
|
162
147
|
// Remove files first (deepest paths first)
|
|
@@ -169,10 +154,14 @@ export function cleanManifestFiles(manifest) {
|
|
|
169
154
|
skipped++;
|
|
170
155
|
continue;
|
|
171
156
|
}
|
|
172
|
-
// Content-managed files:
|
|
157
|
+
// Content-managed files: skip during re-install, clean during uninstall
|
|
173
158
|
if (CONTENT_MANAGED.has(name)) {
|
|
159
|
+
if (opts?.skipContentManaged) {
|
|
160
|
+
skipped++;
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
174
163
|
try {
|
|
175
|
-
if (
|
|
164
|
+
if (cleanInjectedDoc(entry.path))
|
|
176
165
|
removed++;
|
|
177
166
|
}
|
|
178
167
|
catch { /* skip */ }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/core/manifest.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wBAAwB;AACxB,4DAA4D;AAC5D,qDAAqD;AACrD,8EAA8E;AAE9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,MAAM,GAEP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/core/manifest.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wBAAwB;AACxB,4DAA4D;AAC5D,qDAAqD;AACrD,8EAA8E;AAE9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,MAAM,GAEP,MAAM,SAAS,CAAC;AACjB,OAAO,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ACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type Manifest } from './manifest.js';
|
|
2
|
+
/** Default section name when none specified (backward compat). */
|
|
3
|
+
export declare const DEFAULT_SECTION = "core";
|
|
4
|
+
export declare function markerStart(section: string): string;
|
|
5
|
+
export declare function markerEnd(section: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Detect whether the text contains markers for a specific section.
|
|
8
|
+
*/
|
|
9
|
+
export declare function hasSection(text: string, section: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Detect whether the text contains any maestro markers at all.
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasAnyMarkers(text: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Compute bidirectional line-level similarity (Jaccard-like).
|
|
16
|
+
* Returns 0..1 where 1 = existing and source have identical line sets.
|
|
17
|
+
* Uses intersection / union to avoid false positives when one is a superset.
|
|
18
|
+
*/
|
|
19
|
+
export declare function computeSimilarity(existing: string, source: string): number;
|
|
20
|
+
export type MigrateAction = 'created' | 'updated' | 'migrated' | 'injected';
|
|
21
|
+
export interface MigrateResult {
|
|
22
|
+
/** What action was taken */
|
|
23
|
+
action: MigrateAction;
|
|
24
|
+
/** Final file content */
|
|
25
|
+
content: string;
|
|
26
|
+
/** Warning message for user (legacy content needs manual cleanup) */
|
|
27
|
+
warning?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Migrate legacy or update existing doc file content with section-based tag injection.
|
|
31
|
+
*
|
|
32
|
+
* Handles scenarios:
|
|
33
|
+
* 1. No existing file → create with markers (`created`)
|
|
34
|
+
* 2. Has this section → replace between markers (`updated`)
|
|
35
|
+
* 3. Legacy ≥99% similar (core section only, no markers at all) → replace entire content (`migrated`)
|
|
36
|
+
* 4. Legacy ≥80% similar (core section only) → inject + warn (`injected` + warning)
|
|
37
|
+
* 5. Otherwise → append markers normally (`injected`)
|
|
38
|
+
*/
|
|
39
|
+
export declare function migrateAndInject(existingContent: string, sourceContent: string, targetPath: string, section?: string): MigrateResult;
|
|
40
|
+
/**
|
|
41
|
+
* Inject or update content for a specific section.
|
|
42
|
+
*
|
|
43
|
+
* - If section markers exist, replaces everything between them.
|
|
44
|
+
* - If no section markers, appends section block at the end.
|
|
45
|
+
* - If the file is empty/missing, creates with section block.
|
|
46
|
+
*
|
|
47
|
+
* Returns the updated text.
|
|
48
|
+
*/
|
|
49
|
+
export declare function injectContent(existingContent: string, content: string, section?: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Remove a specific section's markers and content.
|
|
52
|
+
* Returns the cleaned text, or the original text if section not found.
|
|
53
|
+
*/
|
|
54
|
+
export declare function removeContent(text: string, section?: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Remove ALL maestro sections from text.
|
|
57
|
+
* Also cleans up any orphaned markers (start without matching end).
|
|
58
|
+
*/
|
|
59
|
+
export declare function removeAllSections(text: string): string;
|
|
60
|
+
export interface CopyStats {
|
|
61
|
+
files: number;
|
|
62
|
+
dirs: number;
|
|
63
|
+
skipped: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Inject source content into a target doc file using sectioned markers.
|
|
67
|
+
* Handles legacy migration with similarity detection.
|
|
68
|
+
*
|
|
69
|
+
* Returns migration result with optional warning.
|
|
70
|
+
*/
|
|
71
|
+
export declare function injectDocFile(src: string, dest: string, stats: CopyStats, manifest: Manifest, section?: string): MigrateResult;
|
|
72
|
+
//# sourceMappingURL=tag-injector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-injector.d.ts","sourceRoot":"","sources":["../../../src/core/tag-injector.ts"],"names":[],"mappings":"AAsBA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AAEvB,kEAAkE;AAClE,eA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AAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,aAAa,CAgBf"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Tag Injector — injects/updates/removes content in doc files using
|
|
3
|
+
// HTML comment markers with section attributes for non-destructive,
|
|
4
|
+
// idempotent, multi-section installation.
|
|
5
|
+
//
|
|
6
|
+
// Marker format:
|
|
7
|
+
// <!-- maestro:start section="core" -->
|
|
8
|
+
// ...injected content...
|
|
9
|
+
// <!-- maestro:end section="core" -->
|
|
10
|
+
//
|
|
11
|
+
// <!-- maestro:start section="chinese" -->
|
|
12
|
+
// ...chinese response content...
|
|
13
|
+
// <!-- maestro:end section="chinese" -->
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, } from 'node:fs';
|
|
16
|
+
import { dirname } from 'node:path';
|
|
17
|
+
import { addFile, addDir, } from './manifest.js';
|
|
18
|
+
/** Default section name when none specified (backward compat). */
|
|
19
|
+
export const DEFAULT_SECTION = 'core';
|
|
20
|
+
export function markerStart(section) {
|
|
21
|
+
return `<!-- maestro:start section="${section}" -->`;
|
|
22
|
+
}
|
|
23
|
+
export function markerEnd(section) {
|
|
24
|
+
return `<!-- maestro:end section="${section}" -->`;
|
|
25
|
+
}
|
|
26
|
+
function startRe(section) {
|
|
27
|
+
return new RegExp(`^<!-- maestro:start section="${escapeRe(section)}" -->$`, 'm');
|
|
28
|
+
}
|
|
29
|
+
function endRe(section) {
|
|
30
|
+
return new RegExp(`^<!-- maestro:end section="${escapeRe(section)}" -->$`, 'm');
|
|
31
|
+
}
|
|
32
|
+
/** Match any maestro section marker (for generic detection). */
|
|
33
|
+
const ANY_START_RE = /^<!-- maestro:start section="[^"]*" -->$/m;
|
|
34
|
+
function escapeRe(s) {
|
|
35
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Detect whether the text contains markers for a specific section.
|
|
39
|
+
*/
|
|
40
|
+
export function hasSection(text, section) {
|
|
41
|
+
return startRe(section).test(text) && endRe(section).test(text);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Detect whether the text contains any maestro markers at all.
|
|
45
|
+
*/
|
|
46
|
+
export function hasAnyMarkers(text) {
|
|
47
|
+
return ANY_START_RE.test(text);
|
|
48
|
+
}
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
// Legacy migration — similarity detection
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
/** Normalize text for comparison: trim lines, collapse blanks, lowercase. */
|
|
53
|
+
function normalizeForCompare(text) {
|
|
54
|
+
return text
|
|
55
|
+
.replace(/\r\n/g, '\n')
|
|
56
|
+
.split('\n')
|
|
57
|
+
.map(l => l.trim())
|
|
58
|
+
.filter(l => l.length > 0)
|
|
59
|
+
.map(l => l.toLowerCase());
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compute bidirectional line-level similarity (Jaccard-like).
|
|
63
|
+
* Returns 0..1 where 1 = existing and source have identical line sets.
|
|
64
|
+
* Uses intersection / union to avoid false positives when one is a superset.
|
|
65
|
+
*/
|
|
66
|
+
export function computeSimilarity(existing, source) {
|
|
67
|
+
const existingLines = normalizeForCompare(existing);
|
|
68
|
+
const sourceLines = normalizeForCompare(source);
|
|
69
|
+
if (sourceLines.length === 0 && existingLines.length === 0)
|
|
70
|
+
return 1;
|
|
71
|
+
if (sourceLines.length === 0 || existingLines.length === 0)
|
|
72
|
+
return 0;
|
|
73
|
+
const existingSet = new Set(existingLines);
|
|
74
|
+
const sourceSet = new Set(sourceLines);
|
|
75
|
+
const intersection = sourceLines.filter(l => existingSet.has(l)).length;
|
|
76
|
+
const union = new Set([...existingLines, ...sourceLines]).size;
|
|
77
|
+
return intersection / union;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Migrate legacy or update existing doc file content with section-based tag injection.
|
|
81
|
+
*
|
|
82
|
+
* Handles scenarios:
|
|
83
|
+
* 1. No existing file → create with markers (`created`)
|
|
84
|
+
* 2. Has this section → replace between markers (`updated`)
|
|
85
|
+
* 3. Legacy ≥99% similar (core section only, no markers at all) → replace entire content (`migrated`)
|
|
86
|
+
* 4. Legacy ≥80% similar (core section only) → inject + warn (`injected` + warning)
|
|
87
|
+
* 5. Otherwise → append markers normally (`injected`)
|
|
88
|
+
*/
|
|
89
|
+
export function migrateAndInject(existingContent, sourceContent, targetPath, section = DEFAULT_SECTION) {
|
|
90
|
+
const trimmedSource = sourceContent.replace(/\r\n/g, '\n').replace(/\n+$/, '');
|
|
91
|
+
const block = `${markerStart(section)}\n${trimmedSource}\n${markerEnd(section)}`;
|
|
92
|
+
// Case 1: no existing file
|
|
93
|
+
if (!existingContent || existingContent.trim() === '') {
|
|
94
|
+
return { action: 'created', content: block + '\n' };
|
|
95
|
+
}
|
|
96
|
+
const text = existingContent.replace(/\r\n/g, '\n');
|
|
97
|
+
// Case 2: already has this section — just update
|
|
98
|
+
if (hasSection(text, section)) {
|
|
99
|
+
return { action: 'updated', content: injectContent(text, sourceContent, section) };
|
|
100
|
+
}
|
|
101
|
+
// If file already has other maestro sections, just append this new section
|
|
102
|
+
if (hasAnyMarkers(text)) {
|
|
103
|
+
const normalized = text.replace(/\n+$/, '');
|
|
104
|
+
return { action: 'injected', content: normalized + '\n\n' + block + '\n' };
|
|
105
|
+
}
|
|
106
|
+
// Case 3-5: legacy file without any markers — check similarity (only for core section)
|
|
107
|
+
if (section === DEFAULT_SECTION) {
|
|
108
|
+
// Exact content match → safe to wrap entirely in markers
|
|
109
|
+
const normExisting = normalizeForCompare(text);
|
|
110
|
+
const normSource = normalizeForCompare(sourceContent);
|
|
111
|
+
const isExactMatch = normExisting.length === normSource.length &&
|
|
112
|
+
normExisting.every((line, i) => line === normSource[i]);
|
|
113
|
+
if (isExactMatch) {
|
|
114
|
+
return { action: 'migrated', content: block + '\n' };
|
|
115
|
+
}
|
|
116
|
+
// Check how much of the source is present in existing (one-directional)
|
|
117
|
+
const existingSet = new Set(normExisting);
|
|
118
|
+
const matched = normSource.filter(l => existingSet.has(l)).length;
|
|
119
|
+
const forwardSimilarity = normSource.length > 0 ? matched / normSource.length : 0;
|
|
120
|
+
if (forwardSimilarity >= 0.8) {
|
|
121
|
+
const normalized = text.replace(/\n+$/, '');
|
|
122
|
+
return {
|
|
123
|
+
action: 'injected',
|
|
124
|
+
content: normalized + '\n\n' + block + '\n',
|
|
125
|
+
warning: `${targetPath}: legacy maestro content detected (${Math.round(forwardSimilarity * 100)}% match). ` +
|
|
126
|
+
`New content injected with markers. Please manually remove the old untagged content above the ${markerStart(section)} marker.`,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Case 5: just append
|
|
131
|
+
const normalized = text.replace(/\n+$/, '');
|
|
132
|
+
return { action: 'injected', content: normalized + '\n\n' + block + '\n' };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Inject or update content for a specific section.
|
|
136
|
+
*
|
|
137
|
+
* - If section markers exist, replaces everything between them.
|
|
138
|
+
* - If no section markers, appends section block at the end.
|
|
139
|
+
* - If the file is empty/missing, creates with section block.
|
|
140
|
+
*
|
|
141
|
+
* Returns the updated text.
|
|
142
|
+
*/
|
|
143
|
+
export function injectContent(existingContent, content, section = DEFAULT_SECTION) {
|
|
144
|
+
const trimmedContent = content.replace(/\r\n/g, '\n').replace(/\n+$/, '');
|
|
145
|
+
const block = `${markerStart(section)}\n${trimmedContent}\n${markerEnd(section)}`;
|
|
146
|
+
if (!existingContent || existingContent.trim() === '') {
|
|
147
|
+
return block + '\n';
|
|
148
|
+
}
|
|
149
|
+
const text = existingContent.replace(/\r\n/g, '\n');
|
|
150
|
+
if (hasSection(text, section)) {
|
|
151
|
+
const start = markerStart(section);
|
|
152
|
+
const end = markerEnd(section);
|
|
153
|
+
const startIdx = text.indexOf(start);
|
|
154
|
+
const endIdx = text.indexOf(end);
|
|
155
|
+
if (startIdx === -1 || endIdx === -1) {
|
|
156
|
+
return text + '\n\n' + block + '\n';
|
|
157
|
+
}
|
|
158
|
+
const before = text.slice(0, startIdx);
|
|
159
|
+
const after = text.slice(endIdx + end.length);
|
|
160
|
+
return before + block + after;
|
|
161
|
+
}
|
|
162
|
+
// No section markers — append with a blank line separator
|
|
163
|
+
const normalized = text.replace(/\n+$/, '');
|
|
164
|
+
return normalized + '\n\n' + block + '\n';
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Remove a specific section's markers and content.
|
|
168
|
+
* Returns the cleaned text, or the original text if section not found.
|
|
169
|
+
*/
|
|
170
|
+
export function removeContent(text, section = DEFAULT_SECTION) {
|
|
171
|
+
if (!hasSection(text, section))
|
|
172
|
+
return text;
|
|
173
|
+
const normalized = text.replace(/\r\n/g, '\n');
|
|
174
|
+
const start = markerStart(section);
|
|
175
|
+
const end = markerEnd(section);
|
|
176
|
+
const startIdx = normalized.indexOf(start);
|
|
177
|
+
const endIdx = normalized.indexOf(end);
|
|
178
|
+
if (startIdx === -1 || endIdx === -1)
|
|
179
|
+
return text;
|
|
180
|
+
const before = normalized.slice(0, startIdx);
|
|
181
|
+
const after = normalized.slice(endIdx + end.length);
|
|
182
|
+
// Clean up extra blank lines at the junction
|
|
183
|
+
const result = (before.replace(/\n+$/, '') + after.replace(/^\n+/, '\n')).replace(/\n+$/, '');
|
|
184
|
+
return result ? result + '\n' : '';
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Remove ALL maestro sections from text.
|
|
188
|
+
* Also cleans up any orphaned markers (start without matching end).
|
|
189
|
+
*/
|
|
190
|
+
export function removeAllSections(text) {
|
|
191
|
+
const sectionRe = /<!-- maestro:start section="([^"]*)" -->/g;
|
|
192
|
+
let result = text;
|
|
193
|
+
let match;
|
|
194
|
+
// Collect all section names
|
|
195
|
+
const sections = [];
|
|
196
|
+
while ((match = sectionRe.exec(text)) !== null) {
|
|
197
|
+
sections.push(match[1]);
|
|
198
|
+
}
|
|
199
|
+
// Remove each complete section
|
|
200
|
+
for (const s of sections) {
|
|
201
|
+
result = removeContent(result, s);
|
|
202
|
+
}
|
|
203
|
+
// Clean up orphaned start markers (no matching end)
|
|
204
|
+
result = result.replace(/^<!-- maestro:start section="[^"]*" -->\n?/gm, '');
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Inject source content into a target doc file using sectioned markers.
|
|
209
|
+
* Handles legacy migration with similarity detection.
|
|
210
|
+
*
|
|
211
|
+
* Returns migration result with optional warning.
|
|
212
|
+
*/
|
|
213
|
+
export function injectDocFile(src, dest, stats, manifest, section) {
|
|
214
|
+
const destDir = dirname(dest);
|
|
215
|
+
if (!existsSync(destDir)) {
|
|
216
|
+
mkdirSync(destDir, { recursive: true });
|
|
217
|
+
stats.dirs++;
|
|
218
|
+
addDir(manifest, destDir);
|
|
219
|
+
}
|
|
220
|
+
const sourceContent = readFileSync(src, 'utf-8');
|
|
221
|
+
const existingContent = existsSync(dest) ? readFileSync(dest, 'utf-8') : '';
|
|
222
|
+
const result = migrateAndInject(existingContent, sourceContent, dest, section);
|
|
223
|
+
writeFileSync(dest, result.content, 'utf-8');
|
|
224
|
+
stats.files++;
|
|
225
|
+
addFile(manifest, dest);
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=tag-injector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-injector.js","sourceRoot":"","sources":["../../../src/core/tag-injector.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oEAAoE;AACpE,oEAAoE;AACpE,0CAA0C;AAC1C,EAAE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