synarcx 0.1.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.
- package/LICENSE +23 -0
- package/README.md +90 -0
- package/bin/synarcx.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +474 -0
- package/dist/commands/change.d.ts +35 -0
- package/dist/commands/change.js +278 -0
- package/dist/commands/completion.d.ts +72 -0
- package/dist/commands/completion.js +264 -0
- package/dist/commands/config.d.ts +36 -0
- package/dist/commands/config.js +552 -0
- package/dist/commands/feedback.d.ts +9 -0
- package/dist/commands/feedback.js +170 -0
- package/dist/commands/schema.d.ts +6 -0
- package/dist/commands/schema.js +870 -0
- package/dist/commands/show.d.ts +14 -0
- package/dist/commands/show.js +132 -0
- package/dist/commands/spec.d.ts +15 -0
- package/dist/commands/spec.js +226 -0
- package/dist/commands/validate.d.ts +24 -0
- package/dist/commands/validate.js +295 -0
- package/dist/commands/workflow/index.d.ts +17 -0
- package/dist/commands/workflow/index.js +12 -0
- package/dist/commands/workflow/instructions.d.ts +29 -0
- package/dist/commands/workflow/instructions.js +327 -0
- package/dist/commands/workflow/new-change.d.ts +11 -0
- package/dist/commands/workflow/new-change.js +45 -0
- package/dist/commands/workflow/schemas.d.ts +10 -0
- package/dist/commands/workflow/schemas.js +34 -0
- package/dist/commands/workflow/shared.d.ts +57 -0
- package/dist/commands/workflow/shared.js +117 -0
- package/dist/commands/workflow/status.d.ts +14 -0
- package/dist/commands/workflow/status.js +75 -0
- package/dist/commands/workflow/templates.d.ts +16 -0
- package/dist/commands/workflow/templates.js +69 -0
- package/dist/commands/workspace/open.d.ts +29 -0
- package/dist/commands/workspace/open.js +84 -0
- package/dist/commands/workspace/operations.d.ts +18 -0
- package/dist/commands/workspace/operations.js +461 -0
- package/dist/commands/workspace/selection.d.ts +5 -0
- package/dist/commands/workspace/selection.js +90 -0
- package/dist/commands/workspace/types.d.ts +83 -0
- package/dist/commands/workspace/types.js +36 -0
- package/dist/commands/workspace.d.ts +3 -0
- package/dist/commands/workspace.js +635 -0
- package/dist/core/archive.d.ts +11 -0
- package/dist/core/archive.js +319 -0
- package/dist/core/artifact-graph/graph.d.ts +56 -0
- package/dist/core/artifact-graph/graph.js +141 -0
- package/dist/core/artifact-graph/index.d.ts +8 -0
- package/dist/core/artifact-graph/index.js +14 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +143 -0
- package/dist/core/artifact-graph/instruction-loader.js +217 -0
- package/dist/core/artifact-graph/outputs.d.ts +14 -0
- package/dist/core/artifact-graph/outputs.js +39 -0
- package/dist/core/artifact-graph/resolver.d.ts +81 -0
- package/dist/core/artifact-graph/resolver.js +258 -0
- package/dist/core/artifact-graph/schema.d.ts +13 -0
- package/dist/core/artifact-graph/schema.js +108 -0
- package/dist/core/artifact-graph/state.d.ts +12 -0
- package/dist/core/artifact-graph/state.js +31 -0
- package/dist/core/artifact-graph/types.d.ts +45 -0
- package/dist/core/artifact-graph/types.js +43 -0
- package/dist/core/available-tools.d.ts +17 -0
- package/dist/core/available-tools.js +43 -0
- package/dist/core/command-generation/adapters/amazon-q.d.ts +13 -0
- package/dist/core/command-generation/adapters/amazon-q.js +26 -0
- package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
- package/dist/core/command-generation/adapters/antigravity.js +26 -0
- package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
- package/dist/core/command-generation/adapters/auggie.js +27 -0
- package/dist/core/command-generation/adapters/bob.d.ts +14 -0
- package/dist/core/command-generation/adapters/bob.js +45 -0
- package/dist/core/command-generation/adapters/claude.d.ts +13 -0
- package/dist/core/command-generation/adapters/claude.js +50 -0
- package/dist/core/command-generation/adapters/cline.d.ts +14 -0
- package/dist/core/command-generation/adapters/cline.js +27 -0
- package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
- package/dist/core/command-generation/adapters/codebuddy.js +28 -0
- package/dist/core/command-generation/adapters/codex.d.ts +16 -0
- package/dist/core/command-generation/adapters/codex.js +39 -0
- package/dist/core/command-generation/adapters/continue.d.ts +13 -0
- package/dist/core/command-generation/adapters/continue.js +28 -0
- package/dist/core/command-generation/adapters/costrict.d.ts +13 -0
- package/dist/core/command-generation/adapters/costrict.js +27 -0
- package/dist/core/command-generation/adapters/crush.d.ts +13 -0
- package/dist/core/command-generation/adapters/crush.js +30 -0
- package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
- package/dist/core/command-generation/adapters/cursor.js +44 -0
- package/dist/core/command-generation/adapters/factory.d.ts +13 -0
- package/dist/core/command-generation/adapters/factory.js +27 -0
- package/dist/core/command-generation/adapters/gemini.d.ts +13 -0
- package/dist/core/command-generation/adapters/gemini.js +26 -0
- package/dist/core/command-generation/adapters/github-copilot.d.ts +13 -0
- package/dist/core/command-generation/adapters/github-copilot.js +26 -0
- package/dist/core/command-generation/adapters/iflow.d.ts +13 -0
- package/dist/core/command-generation/adapters/iflow.js +29 -0
- package/dist/core/command-generation/adapters/index.d.ts +32 -0
- package/dist/core/command-generation/adapters/index.js +32 -0
- package/dist/core/command-generation/adapters/junie.d.ts +13 -0
- package/dist/core/command-generation/adapters/junie.js +26 -0
- package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/kilocode.js +23 -0
- package/dist/core/command-generation/adapters/kiro.d.ts +13 -0
- package/dist/core/command-generation/adapters/kiro.js +26 -0
- package/dist/core/command-generation/adapters/lingma.d.ts +13 -0
- package/dist/core/command-generation/adapters/lingma.js +30 -0
- package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
- package/dist/core/command-generation/adapters/opencode.js +27 -0
- package/dist/core/command-generation/adapters/pi.d.ts +18 -0
- package/dist/core/command-generation/adapters/pi.js +55 -0
- package/dist/core/command-generation/adapters/qoder.d.ts +13 -0
- package/dist/core/command-generation/adapters/qoder.js +30 -0
- package/dist/core/command-generation/adapters/qwen.d.ts +13 -0
- package/dist/core/command-generation/adapters/qwen.js +26 -0
- package/dist/core/command-generation/adapters/roocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/roocode.js +27 -0
- package/dist/core/command-generation/adapters/windsurf.d.ts +14 -0
- package/dist/core/command-generation/adapters/windsurf.js +51 -0
- package/dist/core/command-generation/generator.d.ts +21 -0
- package/dist/core/command-generation/generator.js +27 -0
- package/dist/core/command-generation/index.d.ts +22 -0
- package/dist/core/command-generation/index.js +24 -0
- package/dist/core/command-generation/registry.d.ts +36 -0
- package/dist/core/command-generation/registry.js +98 -0
- package/dist/core/command-generation/types.d.ts +56 -0
- package/dist/core/command-generation/types.js +8 -0
- package/dist/core/completions/command-registry.d.ts +7 -0
- package/dist/core/completions/command-registry.js +596 -0
- package/dist/core/completions/completion-provider.d.ts +71 -0
- package/dist/core/completions/completion-provider.js +129 -0
- package/dist/core/completions/factory.d.ts +64 -0
- package/dist/core/completions/factory.js +75 -0
- package/dist/core/completions/generators/bash-generator.d.ts +35 -0
- package/dist/core/completions/generators/bash-generator.js +230 -0
- package/dist/core/completions/generators/fish-generator.d.ts +32 -0
- package/dist/core/completions/generators/fish-generator.js +160 -0
- package/dist/core/completions/generators/powershell-generator.d.ts +36 -0
- package/dist/core/completions/generators/powershell-generator.js +266 -0
- package/dist/core/completions/generators/zsh-generator.d.ts +47 -0
- package/dist/core/completions/generators/zsh-generator.js +274 -0
- package/dist/core/completions/installers/bash-installer.d.ts +87 -0
- package/dist/core/completions/installers/bash-installer.js +318 -0
- package/dist/core/completions/installers/fish-installer.d.ts +43 -0
- package/dist/core/completions/installers/fish-installer.js +143 -0
- package/dist/core/completions/installers/powershell-installer.d.ts +102 -0
- package/dist/core/completions/installers/powershell-installer.js +387 -0
- package/dist/core/completions/installers/zsh-installer.d.ts +117 -0
- package/dist/core/completions/installers/zsh-installer.js +421 -0
- package/dist/core/completions/templates/bash-templates.d.ts +6 -0
- package/dist/core/completions/templates/bash-templates.js +30 -0
- package/dist/core/completions/templates/fish-templates.d.ts +7 -0
- package/dist/core/completions/templates/fish-templates.js +45 -0
- package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
- package/dist/core/completions/templates/powershell-templates.js +34 -0
- package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
- package/dist/core/completions/templates/zsh-templates.js +45 -0
- package/dist/core/completions/types.d.ts +101 -0
- package/dist/core/completions/types.js +2 -0
- package/dist/core/config-prompts.d.ts +9 -0
- package/dist/core/config-prompts.js +34 -0
- package/dist/core/config-schema.d.ts +86 -0
- package/dist/core/config-schema.js +213 -0
- package/dist/core/config.d.ts +19 -0
- package/dist/core/config.js +38 -0
- package/dist/core/converters/json-converter.d.ts +6 -0
- package/dist/core/converters/json-converter.js +51 -0
- package/dist/core/global-config.d.ts +49 -0
- package/dist/core/global-config.js +124 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +4 -0
- package/dist/core/init.d.ts +37 -0
- package/dist/core/init.js +585 -0
- package/dist/core/legacy-cleanup.d.ts +169 -0
- package/dist/core/legacy-cleanup.js +578 -0
- package/dist/core/list.d.ts +9 -0
- package/dist/core/list.js +172 -0
- package/dist/core/migration.d.ts +23 -0
- package/dist/core/migration.js +108 -0
- package/dist/core/parsers/change-parser.d.ts +13 -0
- package/dist/core/parsers/change-parser.js +197 -0
- package/dist/core/parsers/markdown-parser.d.ts +26 -0
- package/dist/core/parsers/markdown-parser.js +227 -0
- package/dist/core/parsers/requirement-blocks.d.ts +37 -0
- package/dist/core/parsers/requirement-blocks.js +201 -0
- package/dist/core/parsers/spec-structure.d.ts +9 -0
- package/dist/core/parsers/spec-structure.js +88 -0
- package/dist/core/profile-sync-drift.d.ts +38 -0
- package/dist/core/profile-sync-drift.js +197 -0
- package/dist/core/profiles.d.ts +26 -0
- package/dist/core/profiles.js +37 -0
- package/dist/core/project-config.d.ts +64 -0
- package/dist/core/project-config.js +224 -0
- package/dist/core/schemas/base.schema.d.ts +13 -0
- package/dist/core/schemas/base.schema.js +13 -0
- package/dist/core/schemas/change.schema.d.ts +73 -0
- package/dist/core/schemas/change.schema.js +31 -0
- package/dist/core/schemas/index.d.ts +4 -0
- package/dist/core/schemas/index.js +4 -0
- package/dist/core/schemas/spec.schema.d.ts +18 -0
- package/dist/core/schemas/spec.schema.js +15 -0
- package/dist/core/shared/index.d.ts +8 -0
- package/dist/core/shared/index.js +8 -0
- package/dist/core/shared/skill-generation.d.ts +49 -0
- package/dist/core/shared/skill-generation.js +90 -0
- package/dist/core/shared/tool-detection.d.ts +71 -0
- package/dist/core/shared/tool-detection.js +152 -0
- package/dist/core/specs-apply.d.ts +73 -0
- package/dist/core/specs-apply.js +393 -0
- package/dist/core/styles/palette.d.ts +7 -0
- package/dist/core/styles/palette.js +8 -0
- package/dist/core/templates/index.d.ts +8 -0
- package/dist/core/templates/index.js +9 -0
- package/dist/core/templates/skill-templates.d.ts +15 -0
- package/dist/core/templates/skill-templates.js +14 -0
- package/dist/core/templates/types.d.ts +19 -0
- package/dist/core/templates/types.js +5 -0
- package/dist/core/templates/workflows/analyze.d.ts +4 -0
- package/dist/core/templates/workflows/analyze.js +101 -0
- package/dist/core/templates/workflows/apply-change.d.ts +10 -0
- package/dist/core/templates/workflows/apply-change.js +308 -0
- package/dist/core/templates/workflows/archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/archive-change.js +271 -0
- package/dist/core/templates/workflows/clarify.d.ts +4 -0
- package/dist/core/templates/workflows/clarify.js +108 -0
- package/dist/core/templates/workflows/debug.d.ts +4 -0
- package/dist/core/templates/workflows/debug.js +117 -0
- package/dist/core/templates/workflows/explore.d.ts +10 -0
- package/dist/core/templates/workflows/explore.js +479 -0
- package/dist/core/templates/workflows/propose.d.ts +10 -0
- package/dist/core/templates/workflows/propose.js +216 -0
- package/dist/core/templates/workflows/sync.d.ts +4 -0
- package/dist/core/templates/workflows/sync.js +108 -0
- package/dist/core/update.d.ts +82 -0
- package/dist/core/update.js +555 -0
- package/dist/core/validation/constants.d.ts +34 -0
- package/dist/core/validation/constants.js +40 -0
- package/dist/core/validation/types.d.ts +18 -0
- package/dist/core/validation/types.js +2 -0
- package/dist/core/validation/validator.d.ts +33 -0
- package/dist/core/validation/validator.js +418 -0
- package/dist/core/view.d.ts +8 -0
- package/dist/core/view.js +169 -0
- package/dist/core/workspace/foundation.d.ts +79 -0
- package/dist/core/workspace/foundation.js +367 -0
- package/dist/core/workspace/index.d.ts +5 -0
- package/dist/core/workspace/index.js +5 -0
- package/dist/core/workspace/link-input.d.ts +9 -0
- package/dist/core/workspace/link-input.js +32 -0
- package/dist/core/workspace/open-surface.d.ts +24 -0
- package/dist/core/workspace/open-surface.js +137 -0
- package/dist/core/workspace/openers.d.ts +21 -0
- package/dist/core/workspace/openers.js +119 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/prompts/searchable-multi-select.d.ts +28 -0
- package/dist/prompts/searchable-multi-select.js +159 -0
- package/dist/ui/ascii-patterns.d.ts +25 -0
- package/dist/ui/ascii-patterns.js +140 -0
- package/dist/ui/welcome-screen.d.ts +10 -0
- package/dist/ui/welcome-screen.js +144 -0
- package/dist/utils/change-metadata.d.ts +51 -0
- package/dist/utils/change-metadata.js +147 -0
- package/dist/utils/change-utils.d.ts +62 -0
- package/dist/utils/change-utils.js +122 -0
- package/dist/utils/command-references.d.ts +18 -0
- package/dist/utils/command-references.js +20 -0
- package/dist/utils/file-system.d.ts +41 -0
- package/dist/utils/file-system.js +301 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/interactive.d.ts +18 -0
- package/dist/utils/interactive.js +21 -0
- package/dist/utils/item-discovery.d.ts +4 -0
- package/dist/utils/item-discovery.js +73 -0
- package/dist/utils/match.d.ts +3 -0
- package/dist/utils/match.js +22 -0
- package/dist/utils/shell-detection.d.ts +20 -0
- package/dist/utils/shell-detection.js +41 -0
- package/dist/utils/task-progress.d.ts +8 -0
- package/dist/utils/task-progress.js +36 -0
- package/package.json +76 -0
- package/schemas/synarcx/schema.yaml +153 -0
- package/schemas/synarcx/templates/design.md +19 -0
- package/schemas/synarcx/templates/proposal.md +23 -0
- package/schemas/synarcx/templates/spec.md +8 -0
- package/schemas/synarcx/templates/tasks.md +9 -0
- package/scripts/postinstall.js +83 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WorkspacePreferredOpener, WorkspaceSupportedOpenerValue } from './foundation.js';
|
|
2
|
+
export interface WorkspaceOpenerChoice {
|
|
3
|
+
value: WorkspaceSupportedOpenerValue;
|
|
4
|
+
label: string;
|
|
5
|
+
opener: WorkspacePreferredOpener;
|
|
6
|
+
executable: string;
|
|
7
|
+
available: boolean;
|
|
8
|
+
unavailableNote: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function isWorkspaceExecutableAvailable(executable: string, options?: {
|
|
11
|
+
env?: NodeJS.ProcessEnv;
|
|
12
|
+
platform?: NodeJS.Platform;
|
|
13
|
+
}): boolean;
|
|
14
|
+
export declare function getWorkspaceOpenerExecutable(opener: WorkspacePreferredOpener): string;
|
|
15
|
+
export declare function getWorkspaceOpenerLabel(opener: WorkspacePreferredOpener): string;
|
|
16
|
+
export declare function listWorkspaceOpenerChoices(options?: {
|
|
17
|
+
env?: NodeJS.ProcessEnv;
|
|
18
|
+
platform?: NodeJS.Platform;
|
|
19
|
+
}): WorkspaceOpenerChoice[];
|
|
20
|
+
export declare function getDefaultWorkspaceOpenerChoiceValue(choices: WorkspaceOpenerChoice[]): WorkspaceSupportedOpenerValue;
|
|
21
|
+
//# sourceMappingURL=openers.d.ts.map
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as nodeFs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { parseWorkspacePreferredOpenerValue, } from './foundation.js';
|
|
4
|
+
const fs = nodeFs;
|
|
5
|
+
const WORKSPACE_OPENER_CHOICE_DEFINITIONS = [
|
|
6
|
+
{
|
|
7
|
+
value: 'editor',
|
|
8
|
+
label: 'VS Code editor',
|
|
9
|
+
executable: 'code',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: 'codex',
|
|
13
|
+
label: 'Codex',
|
|
14
|
+
executable: 'codex',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: 'claude',
|
|
18
|
+
label: 'Claude',
|
|
19
|
+
executable: 'claude',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: 'github-copilot',
|
|
23
|
+
label: 'GitHub Copilot in VS Code',
|
|
24
|
+
executable: 'code',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
function getPathValue(env) {
|
|
28
|
+
return env.PATH ?? env.Path ?? env.path ?? '';
|
|
29
|
+
}
|
|
30
|
+
function getPathExts(env, platform) {
|
|
31
|
+
if (platform !== 'win32') {
|
|
32
|
+
return [''];
|
|
33
|
+
}
|
|
34
|
+
const pathExt = env.PATHEXT ?? '.COM;.EXE;.BAT;.CMD';
|
|
35
|
+
return pathExt
|
|
36
|
+
.split(';')
|
|
37
|
+
.map((extension) => extension.trim())
|
|
38
|
+
.filter((extension) => extension.length > 0);
|
|
39
|
+
}
|
|
40
|
+
function isExecutableFile(candidatePath, platform) {
|
|
41
|
+
try {
|
|
42
|
+
const stats = fs.statSync(candidatePath);
|
|
43
|
+
if (!stats.isFile()) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (platform === 'win32') {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
fs.accessSync(candidatePath, fs.constants.X_OK);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function isWorkspaceExecutableAvailable(executable, options = {}) {
|
|
57
|
+
const env = options.env ?? process.env;
|
|
58
|
+
const platform = options.platform ?? process.platform;
|
|
59
|
+
if (executable.includes('/') || executable.includes('\\')) {
|
|
60
|
+
return isExecutableFile(executable, platform);
|
|
61
|
+
}
|
|
62
|
+
const pathEntries = getPathValue(env)
|
|
63
|
+
.split(path.delimiter)
|
|
64
|
+
.filter((entry) => entry.length > 0);
|
|
65
|
+
const pathExts = getPathExts(env, platform);
|
|
66
|
+
for (const entry of pathEntries) {
|
|
67
|
+
for (const extension of pathExts) {
|
|
68
|
+
const candidate = path.join(entry, executable + extension);
|
|
69
|
+
if (isExecutableFile(candidate, platform)) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
export function getWorkspaceOpenerExecutable(opener) {
|
|
77
|
+
if (opener.kind === 'editor') {
|
|
78
|
+
return 'code';
|
|
79
|
+
}
|
|
80
|
+
if (opener.id === 'github-copilot') {
|
|
81
|
+
return 'code';
|
|
82
|
+
}
|
|
83
|
+
return opener.id;
|
|
84
|
+
}
|
|
85
|
+
export function getWorkspaceOpenerLabel(opener) {
|
|
86
|
+
if (opener.kind === 'editor') {
|
|
87
|
+
return 'VS Code editor';
|
|
88
|
+
}
|
|
89
|
+
if (opener.id === 'github-copilot') {
|
|
90
|
+
return 'GitHub Copilot in VS Code';
|
|
91
|
+
}
|
|
92
|
+
if (opener.id === 'codex') {
|
|
93
|
+
return 'Codex';
|
|
94
|
+
}
|
|
95
|
+
return 'Claude';
|
|
96
|
+
}
|
|
97
|
+
export function listWorkspaceOpenerChoices(options = {}) {
|
|
98
|
+
const choices = WORKSPACE_OPENER_CHOICE_DEFINITIONS.map((definition) => {
|
|
99
|
+
const available = isWorkspaceExecutableAvailable(definition.executable, options);
|
|
100
|
+
return {
|
|
101
|
+
value: definition.value,
|
|
102
|
+
label: definition.label,
|
|
103
|
+
opener: parseWorkspacePreferredOpenerValue(definition.value),
|
|
104
|
+
executable: definition.executable,
|
|
105
|
+
available,
|
|
106
|
+
unavailableNote: available ? null : `${definition.executable} not found on PATH`,
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
return choices.sort((a, b) => {
|
|
110
|
+
if (a.available !== b.available) {
|
|
111
|
+
return a.available ? -1 : 1;
|
|
112
|
+
}
|
|
113
|
+
return 0;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
export function getDefaultWorkspaceOpenerChoiceValue(choices) {
|
|
117
|
+
return choices.find((choice) => choice.available)?.value ?? 'editor';
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=openers.js.map
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface Choice {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
configured?: boolean;
|
|
6
|
+
detected?: boolean;
|
|
7
|
+
configuredLabel?: string;
|
|
8
|
+
preSelected?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface Config {
|
|
11
|
+
message: string;
|
|
12
|
+
choices: Choice[];
|
|
13
|
+
pageSize?: number;
|
|
14
|
+
validate?: (selected: string[]) => boolean | string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A searchable multi-select prompt with visible search box,
|
|
18
|
+
* selected items display, and intuitive keyboard navigation.
|
|
19
|
+
*
|
|
20
|
+
* - Type to filter choices
|
|
21
|
+
* - ↑↓ to navigate
|
|
22
|
+
* - Space to toggle highlighted item selection
|
|
23
|
+
* - Backspace to remove last selected item (or delete search char)
|
|
24
|
+
* - Enter to confirm selections
|
|
25
|
+
*/
|
|
26
|
+
export declare function searchableMultiSelect(config: Config): Promise<string[]>;
|
|
27
|
+
export default searchableMultiSelect;
|
|
28
|
+
//# sourceMappingURL=searchable-multi-select.d.ts.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Create the searchable multi-select prompt.
|
|
4
|
+
* Uses dynamic import to prevent pre-commit hook hangs (see #367).
|
|
5
|
+
*/
|
|
6
|
+
async function createSearchableMultiSelect() {
|
|
7
|
+
const { createPrompt, useState, useKeypress, useMemo, usePrefix, isEnterKey, isBackspaceKey, isUpKey, isDownKey, } = await import('@inquirer/core');
|
|
8
|
+
return createPrompt((config, done) => {
|
|
9
|
+
const { message, choices, pageSize = 15, validate } = config;
|
|
10
|
+
const [searchText, setSearchText] = useState('');
|
|
11
|
+
const [selectedValues, setSelectedValues] = useState(() => choices.filter(c => c.preSelected).map(c => c.value));
|
|
12
|
+
const [cursor, setCursor] = useState(0);
|
|
13
|
+
const [status, setStatus] = useState('idle');
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
const prefix = usePrefix({ status });
|
|
16
|
+
// Filter choices by search
|
|
17
|
+
const filteredChoices = useMemo(() => {
|
|
18
|
+
if (!searchText.trim())
|
|
19
|
+
return choices;
|
|
20
|
+
const term = searchText.toLowerCase();
|
|
21
|
+
return choices.filter((c) => c.name.toLowerCase().includes(term) ||
|
|
22
|
+
c.value.toLowerCase().includes(term));
|
|
23
|
+
}, [searchText, choices]);
|
|
24
|
+
const selectedSet = useMemo(() => new Set(selectedValues), [selectedValues]);
|
|
25
|
+
const choiceMap = useMemo(() => new Map(choices.map((c) => [c.value, c])), [choices]);
|
|
26
|
+
useKeypress((key) => {
|
|
27
|
+
if (status === 'done')
|
|
28
|
+
return;
|
|
29
|
+
// Enter to confirm/submit
|
|
30
|
+
if (isEnterKey(key)) {
|
|
31
|
+
if (validate) {
|
|
32
|
+
const result = validate(selectedValues);
|
|
33
|
+
if (result !== true) {
|
|
34
|
+
setError(typeof result === 'string' ? result : 'Invalid');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
setStatus('done');
|
|
39
|
+
done(selectedValues);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Space to toggle selection
|
|
43
|
+
if (key.name === 'space') {
|
|
44
|
+
const choice = filteredChoices[cursor];
|
|
45
|
+
if (choice) {
|
|
46
|
+
if (selectedSet.has(choice.value)) {
|
|
47
|
+
setSelectedValues(selectedValues.filter(v => v !== choice.value));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
setSelectedValues([...selectedValues, choice.value]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Backspace to remove or delete search char
|
|
56
|
+
if (isBackspaceKey(key)) {
|
|
57
|
+
if (searchText === '' && selectedValues.length > 0) {
|
|
58
|
+
setSelectedValues(selectedValues.slice(0, -1));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
setSearchText(searchText.slice(0, -1));
|
|
62
|
+
setCursor(0);
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// Navigation
|
|
67
|
+
if (isUpKey(key)) {
|
|
68
|
+
setCursor(Math.max(0, cursor - 1));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (isDownKey(key)) {
|
|
72
|
+
setCursor(Math.min(filteredChoices.length - 1, cursor + 1));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Character input - handle printable characters
|
|
76
|
+
if (key.name && key.name.length === 1 && !key.ctrl) {
|
|
77
|
+
setSearchText(searchText + key.name);
|
|
78
|
+
setCursor(0);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
// Render done state
|
|
82
|
+
if (status === 'done') {
|
|
83
|
+
const names = selectedValues
|
|
84
|
+
.map((v) => choiceMap.get(v)?.name ?? v)
|
|
85
|
+
.join(', ');
|
|
86
|
+
return `${prefix} ${chalk.bold(message)} ${chalk.cyan(names || '(none)')}`;
|
|
87
|
+
}
|
|
88
|
+
// Render active state
|
|
89
|
+
const lines = [];
|
|
90
|
+
lines.push(`${prefix} ${chalk.bold(message)}`);
|
|
91
|
+
// Selected chips
|
|
92
|
+
const chips = selectedValues.length > 0
|
|
93
|
+
? selectedValues
|
|
94
|
+
.map((v) => chalk.bgCyan.black(` ${choiceMap.get(v)?.name} `))
|
|
95
|
+
.join(' ')
|
|
96
|
+
: chalk.dim('(none selected)');
|
|
97
|
+
lines.push(` Selected: ${chips}`);
|
|
98
|
+
// Search box
|
|
99
|
+
lines.push(` Search: ${chalk.yellow('[')}${searchText || chalk.dim('type to filter')}${chalk.yellow(']')}`);
|
|
100
|
+
// Instructions
|
|
101
|
+
lines.push(` ${chalk.cyan('↑↓')} navigate • ${chalk.cyan('Space')} toggle • ${chalk.cyan('Backspace')} remove • ${chalk.cyan('Enter')} confirm`);
|
|
102
|
+
// List
|
|
103
|
+
if (filteredChoices.length === 0) {
|
|
104
|
+
lines.push(chalk.yellow(' No matches'));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
// Calculate pagination
|
|
108
|
+
const startIndex = Math.max(0, Math.min(cursor - Math.floor(pageSize / 2), filteredChoices.length - pageSize));
|
|
109
|
+
const endIndex = Math.min(startIndex + pageSize, filteredChoices.length);
|
|
110
|
+
const visibleChoices = filteredChoices.slice(startIndex, endIndex);
|
|
111
|
+
for (let i = 0; i < visibleChoices.length; i++) {
|
|
112
|
+
const item = visibleChoices[i];
|
|
113
|
+
const actualIndex = startIndex + i;
|
|
114
|
+
const isActive = actualIndex === cursor;
|
|
115
|
+
const selected = selectedSet.has(item.value);
|
|
116
|
+
const icon = selected ? chalk.green('◉') : chalk.dim('○');
|
|
117
|
+
const arrow = isActive ? chalk.cyan('›') : ' ';
|
|
118
|
+
const name = isActive ? chalk.cyan(item.name) : item.name;
|
|
119
|
+
const isRefresh = selected && item.configured;
|
|
120
|
+
const statusLabel = !selected
|
|
121
|
+
? item.configured
|
|
122
|
+
? ' (configured)'
|
|
123
|
+
: item.detected
|
|
124
|
+
? ' (detected)'
|
|
125
|
+
: ''
|
|
126
|
+
: '';
|
|
127
|
+
const suffix = selected
|
|
128
|
+
? chalk.dim(isRefresh ? ' (refresh)' : ' (selected)')
|
|
129
|
+
: chalk.dim(statusLabel);
|
|
130
|
+
lines.push(` ${arrow} ${icon} ${name}${suffix}`);
|
|
131
|
+
}
|
|
132
|
+
// Show pagination indicator if needed
|
|
133
|
+
if (filteredChoices.length > pageSize) {
|
|
134
|
+
const currentPage = Math.floor(cursor / pageSize) + 1;
|
|
135
|
+
const totalPages = Math.ceil(filteredChoices.length / pageSize);
|
|
136
|
+
lines.push(chalk.dim(` (${currentPage}/${totalPages})`));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (error)
|
|
140
|
+
lines.push(chalk.red(` ${error}`));
|
|
141
|
+
return lines.join('\n');
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A searchable multi-select prompt with visible search box,
|
|
146
|
+
* selected items display, and intuitive keyboard navigation.
|
|
147
|
+
*
|
|
148
|
+
* - Type to filter choices
|
|
149
|
+
* - ↑↓ to navigate
|
|
150
|
+
* - Space to toggle highlighted item selection
|
|
151
|
+
* - Backspace to remove last selected item (or delete search char)
|
|
152
|
+
* - Enter to confirm selections
|
|
153
|
+
*/
|
|
154
|
+
export async function searchableMultiSelect(config) {
|
|
155
|
+
const prompt = await createSearchableMultiSelect();
|
|
156
|
+
return prompt(config);
|
|
157
|
+
}
|
|
158
|
+
export default searchableMultiSelect;
|
|
159
|
+
//# sourceMappingURL=searchable-multi-select.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ASCII art animation patterns for the welcome screen.
|
|
3
|
+
* SynArcX snowflake animation — grows from center outward,
|
|
4
|
+
* then the nucleus goes hollow (like a real snowflake crystal).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 9-column grid (rows 3-9 active), shifted right by 1 column:
|
|
8
|
+
*
|
|
9
|
+
* Col: 0 1 2 3 4 5 6 7 8
|
|
10
|
+
* Row 3: . . . . F F . . . top arm tip
|
|
11
|
+
* Row 4: . . F . F F . F . branches off arm
|
|
12
|
+
* Row 5: . . . F F F F . . arm widens
|
|
13
|
+
* Row 6: . F F F F F F F F full horizontal arm
|
|
14
|
+
* Row 7: . . . F F F F . . arm widens
|
|
15
|
+
* Row 8: . . F . F F . F . branches off arm
|
|
16
|
+
* Row 9: . . . . F F . . . bottom arm tip
|
|
17
|
+
*
|
|
18
|
+
* Frame 8 — hollow center: cols 4-5 on rows 5-7 go dark,
|
|
19
|
+
* leaving the crystal arms and a hollow nucleus.
|
|
20
|
+
*/
|
|
21
|
+
export declare const WELCOME_ANIMATION: {
|
|
22
|
+
interval: number;
|
|
23
|
+
frames: string[][];
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=ascii-patterns.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ASCII art animation patterns for the welcome screen.
|
|
3
|
+
* SynArcX snowflake animation — grows from center outward,
|
|
4
|
+
* then the nucleus goes hollow (like a real snowflake crystal).
|
|
5
|
+
*/
|
|
6
|
+
// Detect if full Unicode is supported
|
|
7
|
+
const supportsUnicode = process.platform !== 'win32' ||
|
|
8
|
+
!!process.env.WT_SESSION || // Windows Terminal
|
|
9
|
+
!!process.env.TERM_PROGRAM; // Modern terminal
|
|
10
|
+
const CHARS = supportsUnicode
|
|
11
|
+
? { full: '██', dim: '░░', empty: ' ' }
|
|
12
|
+
: { full: '##', dim: '++', empty: ' ' };
|
|
13
|
+
const _ = CHARS.empty;
|
|
14
|
+
const F = CHARS.full;
|
|
15
|
+
const D = CHARS.dim;
|
|
16
|
+
/**
|
|
17
|
+
* 9-column grid (rows 3-9 active), shifted right by 1 column:
|
|
18
|
+
*
|
|
19
|
+
* Col: 0 1 2 3 4 5 6 7 8
|
|
20
|
+
* Row 3: . . . . F F . . . top arm tip
|
|
21
|
+
* Row 4: . . F . F F . F . branches off arm
|
|
22
|
+
* Row 5: . . . F F F F . . arm widens
|
|
23
|
+
* Row 6: . F F F F F F F F full horizontal arm
|
|
24
|
+
* Row 7: . . . F F F F . . arm widens
|
|
25
|
+
* Row 8: . . F . F F . F . branches off arm
|
|
26
|
+
* Row 9: . . . . F F . . . bottom arm tip
|
|
27
|
+
*
|
|
28
|
+
* Frame 8 — hollow center: cols 4-5 on rows 5-7 go dark,
|
|
29
|
+
* leaving the crystal arms and a hollow nucleus.
|
|
30
|
+
*/
|
|
31
|
+
export const WELCOME_ANIMATION = {
|
|
32
|
+
interval: 130,
|
|
33
|
+
frames: [
|
|
34
|
+
// Frame 1: Empty
|
|
35
|
+
[
|
|
36
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
37
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
38
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
39
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
40
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
41
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
42
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
43
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
44
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
45
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
46
|
+
],
|
|
47
|
+
// Frame 2: Nucleus glows dim
|
|
48
|
+
[
|
|
49
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
50
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
51
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
52
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
53
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
54
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
55
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
56
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
57
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
58
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
59
|
+
],
|
|
60
|
+
// Frame 3: Nucleus solid, first arm stubs dim
|
|
61
|
+
[
|
|
62
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
63
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
64
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
65
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
66
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
67
|
+
`${_}${_}${_}${_}${F}${F}${_}${_}${_}`,
|
|
68
|
+
`${_}${_}${_}${D}${F}${F}${D}${_}${_}`,
|
|
69
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
70
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
71
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
72
|
+
],
|
|
73
|
+
// Frame 4: Arms grow outward (dim)
|
|
74
|
+
[
|
|
75
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
76
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
77
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
78
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
79
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
80
|
+
`${_}${_}${_}${D}${F}${F}${D}${_}${_}`,
|
|
81
|
+
`${_}${_}${D}${F}${F}${F}${F}${D}${_}`,
|
|
82
|
+
`${_}${_}${_}${D}${F}${F}${D}${_}${_}`,
|
|
83
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
84
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
85
|
+
],
|
|
86
|
+
// Frame 5: Inner arms solid, outer ring dim
|
|
87
|
+
[
|
|
88
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
89
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
90
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
91
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
92
|
+
`${_}${_}${D}${_}${F}${F}${_}${D}${_}`,
|
|
93
|
+
`${_}${_}${_}${F}${F}${F}${F}${_}${_}`,
|
|
94
|
+
`${_}${D}${F}${F}${F}${F}${F}${F}${D}`,
|
|
95
|
+
`${_}${_}${_}${F}${F}${F}${F}${_}${_}`,
|
|
96
|
+
`${_}${_}${D}${_}${F}${F}${_}${D}${_}`,
|
|
97
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
98
|
+
],
|
|
99
|
+
// Frame 6: Outer arms solid, tips dim
|
|
100
|
+
[
|
|
101
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
102
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
103
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
104
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
105
|
+
`${_}${_}${D}${_}${F}${F}${_}${D}${_}`,
|
|
106
|
+
`${_}${_}${_}${F}${F}${F}${F}${_}${_}`,
|
|
107
|
+
`${_}${F}${F}${F}${F}${F}${F}${F}${F}`,
|
|
108
|
+
`${_}${_}${_}${F}${F}${F}${F}${_}${_}`,
|
|
109
|
+
`${_}${_}${D}${_}${F}${F}${_}${D}${_}`,
|
|
110
|
+
`${_}${_}${_}${_}${D}${D}${_}${_}${_}`,
|
|
111
|
+
],
|
|
112
|
+
// Frame 7: Full snowflake — all solid
|
|
113
|
+
[
|
|
114
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
115
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
116
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
117
|
+
`${_}${_}${_}${_}${F}${F}${_}${_}${_}`,
|
|
118
|
+
`${_}${_}${F}${_}${F}${F}${_}${F}${_}`,
|
|
119
|
+
`${_}${_}${_}${F}${F}${F}${F}${_}${_}`,
|
|
120
|
+
`${_}${F}${F}${F}${F}${F}${F}${F}${F}`,
|
|
121
|
+
`${_}${_}${_}${F}${F}${F}${F}${_}${_}`,
|
|
122
|
+
`${_}${_}${F}${_}${F}${F}${_}${F}${_}`,
|
|
123
|
+
`${_}${_}${_}${_}${F}${F}${_}${_}${_}`,
|
|
124
|
+
],
|
|
125
|
+
// Frame 8: Hollow center — nucleus (cols 4-5, rows 5-7) goes dark
|
|
126
|
+
[
|
|
127
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
128
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
129
|
+
`${_}${_}${_}${_}${_}${_}${_}${_}${_}`,
|
|
130
|
+
`${_}${_}${_}${_}${F}${F}${_}${_}${_}`,
|
|
131
|
+
`${_}${_}${F}${_}${F}${F}${_}${F}${_}`,
|
|
132
|
+
`${_}${_}${_}${F}${_}${_}${F}${_}${_}`,
|
|
133
|
+
`${_}${F}${F}${F}${_}${_}${F}${F}${F}`,
|
|
134
|
+
`${_}${_}${_}${F}${_}${_}${F}${_}${_}`,
|
|
135
|
+
`${_}${_}${F}${_}${F}${F}${_}${F}${_}`,
|
|
136
|
+
`${_}${_}${_}${_}${F}${F}${_}${_}${_}`,
|
|
137
|
+
],
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=ascii-patterns.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animated welcome screen for the experimental artifact workflow setup.
|
|
3
|
+
* Shows side-by-side layout with animated ASCII art on left and welcome text on right.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Shows the animated welcome screen.
|
|
7
|
+
* Returns when user presses Enter.
|
|
8
|
+
*/
|
|
9
|
+
export declare function showWelcomeScreen(): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=welcome-screen.d.ts.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animated welcome screen for the experimental artifact workflow setup.
|
|
3
|
+
* Shows side-by-side layout with animated ASCII art on left and welcome text on right.
|
|
4
|
+
*/
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { WELCOME_ANIMATION } from './ascii-patterns.js';
|
|
7
|
+
// Minimum terminal width for side-by-side layout
|
|
8
|
+
const MIN_WIDTH = 60;
|
|
9
|
+
// Width of the ASCII art column (with padding)
|
|
10
|
+
const ART_COLUMN_WIDTH = 24;
|
|
11
|
+
/**
|
|
12
|
+
* Welcome text content (right column)
|
|
13
|
+
*/
|
|
14
|
+
function getWelcomeText() {
|
|
15
|
+
return [
|
|
16
|
+
chalk.white.bold('Welcome to SynArcX'),
|
|
17
|
+
chalk.dim('Spec-driven development, extended'),
|
|
18
|
+
'',
|
|
19
|
+
chalk.white('This setup will configure:'),
|
|
20
|
+
chalk.dim(' • Agent Skills for AI tools'),
|
|
21
|
+
chalk.dim(' • /syn:* slash commands'),
|
|
22
|
+
` ${chalk.yellow('/syn:propose')} ${chalk.dim('Propose a change')}`,
|
|
23
|
+
` ${chalk.yellow('/syn:explore')} ${chalk.dim('Explore & think')}`,
|
|
24
|
+
` ${chalk.yellow('/syn:apply')} ${chalk.dim('Implement tasks')}`,
|
|
25
|
+
'',
|
|
26
|
+
chalk.cyan('Press Enter to select tools...'),
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Renders a single frame with side-by-side layout
|
|
31
|
+
*/
|
|
32
|
+
function renderFrame(artLines, textLines) {
|
|
33
|
+
const maxLines = Math.max(artLines.length, textLines.length);
|
|
34
|
+
const lines = [];
|
|
35
|
+
for (let i = 0; i < maxLines; i++) {
|
|
36
|
+
const artLine = artLines[i] || '';
|
|
37
|
+
const textLine = textLines[i] || '';
|
|
38
|
+
// Pad the art column to fixed width
|
|
39
|
+
const paddedArt = artLine.padEnd(ART_COLUMN_WIDTH);
|
|
40
|
+
// Color the ASCII art with cyan for visual appeal
|
|
41
|
+
const coloredArt = chalk.cyan(paddedArt);
|
|
42
|
+
// Clear line before writing to prevent residual characters
|
|
43
|
+
lines.push(`\x1b[2K${coloredArt}${textLine}`);
|
|
44
|
+
}
|
|
45
|
+
return lines.join('\n');
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks if the terminal supports animation
|
|
49
|
+
*/
|
|
50
|
+
function canAnimate() {
|
|
51
|
+
// Must be TTY
|
|
52
|
+
if (!process.stdout.isTTY)
|
|
53
|
+
return false;
|
|
54
|
+
// Respect NO_COLOR
|
|
55
|
+
if (process.env.NO_COLOR)
|
|
56
|
+
return false;
|
|
57
|
+
// Check terminal width
|
|
58
|
+
const columns = process.stdout.columns || 80;
|
|
59
|
+
if (columns < MIN_WIDTH)
|
|
60
|
+
return false;
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Wait for Enter key press
|
|
65
|
+
*/
|
|
66
|
+
function waitForEnter() {
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
const { stdin } = process;
|
|
69
|
+
// Handle non-TTY gracefully
|
|
70
|
+
if (!stdin.isTTY) {
|
|
71
|
+
resolve();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const wasRaw = stdin.isRaw;
|
|
75
|
+
stdin.setRawMode(true);
|
|
76
|
+
stdin.resume();
|
|
77
|
+
const onData = (data) => {
|
|
78
|
+
const char = data.toString();
|
|
79
|
+
// Enter key or Ctrl+C
|
|
80
|
+
if (char === '\r' || char === '\n' || char === '\u0003') {
|
|
81
|
+
stdin.removeListener('data', onData);
|
|
82
|
+
stdin.setRawMode(wasRaw);
|
|
83
|
+
stdin.pause();
|
|
84
|
+
// Handle Ctrl+C
|
|
85
|
+
if (char === '\u0003') {
|
|
86
|
+
process.stdout.write('\n');
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
resolve();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
stdin.on('data', onData);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Shows the animated welcome screen.
|
|
97
|
+
* Returns when user presses Enter.
|
|
98
|
+
*/
|
|
99
|
+
export async function showWelcomeScreen() {
|
|
100
|
+
const textLines = getWelcomeText();
|
|
101
|
+
if (!canAnimate()) {
|
|
102
|
+
// Fallback: show static welcome
|
|
103
|
+
const frame = WELCOME_ANIMATION.frames[3]; // Peak frame
|
|
104
|
+
process.stdout.write('\n' + renderFrame(frame, textLines) + '\n\n');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
let frameIndex = 0;
|
|
108
|
+
let running = true;
|
|
109
|
+
let isFirstRender = true;
|
|
110
|
+
// Content height for cursor movement between frames
|
|
111
|
+
const numContentLines = Math.max(WELCOME_ANIMATION.frames[0].length, textLines.length);
|
|
112
|
+
const frameHeight = numContentLines + 1; // internal newlines (11) + trailing newlines (2) = 13
|
|
113
|
+
// Total height including initial newline (for cleanup)
|
|
114
|
+
const totalHeight = frameHeight + 1; // 14
|
|
115
|
+
// Initial render
|
|
116
|
+
process.stdout.write('\n');
|
|
117
|
+
// Animation loop
|
|
118
|
+
const interval = setInterval(() => {
|
|
119
|
+
if (!running)
|
|
120
|
+
return;
|
|
121
|
+
const frame = WELCOME_ANIMATION.frames[frameIndex];
|
|
122
|
+
// Move cursor up to overwrite previous frame (always after first render)
|
|
123
|
+
if (!isFirstRender) {
|
|
124
|
+
process.stdout.write(`\x1b[${frameHeight}A`);
|
|
125
|
+
}
|
|
126
|
+
isFirstRender = false;
|
|
127
|
+
// Render current frame
|
|
128
|
+
process.stdout.write(renderFrame(frame, textLines) + '\n\n');
|
|
129
|
+
// Advance to next frame
|
|
130
|
+
frameIndex = (frameIndex + 1) % WELCOME_ANIMATION.frames.length;
|
|
131
|
+
}, WELCOME_ANIMATION.interval);
|
|
132
|
+
// Wait for Enter
|
|
133
|
+
await waitForEnter();
|
|
134
|
+
// Stop animation
|
|
135
|
+
running = false;
|
|
136
|
+
clearInterval(interval);
|
|
137
|
+
// Clear the welcome screen and move on
|
|
138
|
+
process.stdout.write(`\x1b[${totalHeight}A`);
|
|
139
|
+
for (let i = 0; i < totalHeight; i++) {
|
|
140
|
+
process.stdout.write('\x1b[2K\n'); // Clear line
|
|
141
|
+
}
|
|
142
|
+
process.stdout.write(`\x1b[${totalHeight}A`); // Move back up
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=welcome-screen.js.map
|