@thiagodiogo/pastelsdd 1.0.0-beta.1
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 +22 -0
- package/README.md +3 -0
- package/bin/pastelsdd.js +5 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.js +526 -0
- package/dist/commands/change.d.ts +35 -0
- package/dist/commands/change.js +277 -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 +611 -0
- package/dist/commands/context-store.d.ts +3 -0
- package/dist/commands/context-store.js +282 -0
- package/dist/commands/feedback.d.ts +9 -0
- package/dist/commands/feedback.js +183 -0
- package/dist/commands/initiative.d.ts +13 -0
- package/dist/commands/initiative.js +318 -0
- package/dist/commands/schema.d.ts +6 -0
- package/dist/commands/schema.js +869 -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 +225 -0
- package/dist/commands/validate.d.ts +24 -0
- package/dist/commands/validate.js +294 -0
- package/dist/commands/workflow/index.d.ts +19 -0
- package/dist/commands/workflow/index.js +13 -0
- package/dist/commands/workflow/initiative-link.d.ts +24 -0
- package/dist/commands/workflow/initiative-link.js +47 -0
- package/dist/commands/workflow/instructions.d.ts +29 -0
- package/dist/commands/workflow/instructions.js +344 -0
- package/dist/commands/workflow/new-change.d.ts +17 -0
- package/dist/commands/workflow/new-change.js +141 -0
- package/dist/commands/workflow/schemas.d.ts +10 -0
- package/dist/commands/workflow/schemas.js +34 -0
- package/dist/commands/workflow/set-change.d.ts +13 -0
- package/dist/commands/workflow/set-change.js +87 -0
- package/dist/commands/workflow/shared.d.ts +59 -0
- package/dist/commands/workflow/shared.js +116 -0
- package/dist/commands/workflow/status.d.ts +14 -0
- package/dist/commands/workflow/status.js +90 -0
- package/dist/commands/workflow/templates.d.ts +16 -0
- package/dist/commands/workflow/templates.js +69 -0
- package/dist/commands/workspace/context-status.d.ts +4 -0
- package/dist/commands/workspace/context-status.js +59 -0
- package/dist/commands/workspace/open-view.d.ts +62 -0
- package/dist/commands/workspace/open-view.js +228 -0
- package/dist/commands/workspace/open.d.ts +37 -0
- package/dist/commands/workspace/open.js +102 -0
- package/dist/commands/workspace/opener-selection.d.ts +11 -0
- package/dist/commands/workspace/opener-selection.js +93 -0
- package/dist/commands/workspace/operations.d.ts +28 -0
- package/dist/commands/workspace/operations.js +543 -0
- package/dist/commands/workspace/prompt-theme.d.ts +29 -0
- package/dist/commands/workspace/prompt-theme.js +24 -0
- package/dist/commands/workspace/registration.d.ts +13 -0
- package/dist/commands/workspace/registration.js +84 -0
- package/dist/commands/workspace/selection.d.ts +6 -0
- package/dist/commands/workspace/selection.js +122 -0
- package/dist/commands/workspace/types.d.ts +103 -0
- package/dist/commands/workspace/types.js +36 -0
- package/dist/commands/workspace.d.ts +6 -0
- package/dist/commands/workspace.js +678 -0
- package/dist/core/archive.d.ts +11 -0
- package/dist/core/archive.js +318 -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 +9 -0
- package/dist/core/artifact-graph/index.js +14 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +183 -0
- package/dist/core/artifact-graph/instruction-loader.js +256 -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 +257 -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 +40 -0
- package/dist/core/artifact-graph/types.js +29 -0
- package/dist/core/available-tools.d.ts +17 -0
- package/dist/core/available-tools.js +43 -0
- package/dist/core/change-metadata/index.d.ts +2 -0
- package/dist/core/change-metadata/index.js +2 -0
- package/dist/core/change-metadata/schema.d.ts +18 -0
- package/dist/core/change-metadata/schema.js +28 -0
- package/dist/core/change-status-policy.d.ts +50 -0
- package/dist/core/change-status-policy.js +70 -0
- package/dist/core/collections/index.d.ts +3 -0
- package/dist/core/collections/index.js +3 -0
- package/dist/core/collections/initiatives/collection.d.ts +4 -0
- package/dist/core/collections/initiatives/collection.js +17 -0
- package/dist/core/collections/initiatives/index.d.ts +6 -0
- package/dist/core/collections/initiatives/index.js +6 -0
- package/dist/core/collections/initiatives/operations.d.ts +49 -0
- package/dist/core/collections/initiatives/operations.js +175 -0
- package/dist/core/collections/initiatives/resolution.d.ts +87 -0
- package/dist/core/collections/initiatives/resolution.js +374 -0
- package/dist/core/collections/initiatives/schema.d.ts +41 -0
- package/dist/core/collections/initiatives/schema.js +134 -0
- package/dist/core/collections/initiatives/templates.d.ts +12 -0
- package/dist/core/collections/initiatives/templates.js +90 -0
- package/dist/core/collections/runtime.d.ts +46 -0
- package/dist/core/collections/runtime.js +194 -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 +29 -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 +3 -0
- package/dist/core/completions/command-registry.js +939 -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/shared-flags.d.ts +12 -0
- package/dist/core/completions/shared-flags.js +28 -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 +18 -0
- package/dist/core/config.js +38 -0
- package/dist/core/context-store/binding.d.ts +53 -0
- package/dist/core/context-store/binding.js +197 -0
- package/dist/core/context-store/errors.d.ts +20 -0
- package/dist/core/context-store/errors.js +22 -0
- package/dist/core/context-store/foundation.d.ts +54 -0
- package/dist/core/context-store/foundation.js +318 -0
- package/dist/core/context-store/index.d.ts +6 -0
- package/dist/core/context-store/index.js +6 -0
- package/dist/core/context-store/operations.d.ts +62 -0
- package/dist/core/context-store/operations.js +352 -0
- package/dist/core/context-store/registry.d.ts +35 -0
- package/dist/core/context-store/registry.js +158 -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 +6 -0
- package/dist/core/index.js +7 -0
- package/dist/core/init.d.ts +37 -0
- package/dist/core/init.js +593 -0
- package/dist/core/legacy-cleanup.d.ts +162 -0
- package/dist/core/legacy-cleanup.js +514 -0
- package/dist/core/list.d.ts +9 -0
- package/dist/core/list.js +171 -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/planning-home.d.ts +21 -0
- package/dist/core/planning-home.js +108 -0
- package/dist/core/profile-sync-drift.d.ts +38 -0
- package/dist/core/profile-sync-drift.js +200 -0
- package/dist/core/profiles.d.ts +26 -0
- package/dist/core/profiles.js +40 -0
- package/dist/core/project-config.d.ts +64 -0
- package/dist/core/project-config.js +223 -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 +96 -0
- package/dist/core/shared/tool-detection.d.ts +71 -0
- package/dist/core/shared/tool-detection.js +158 -0
- package/dist/core/specs-apply.d.ts +73 -0
- package/dist/core/specs-apply.js +392 -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 +19 -0
- package/dist/core/templates/skill-templates.js +18 -0
- package/dist/core/templates/types.d.ts +19 -0
- package/dist/core/templates/types.js +5 -0
- package/dist/core/templates/workflows/apply-change.d.ts +10 -0
- package/dist/core/templates/workflows/apply-change.js +314 -0
- package/dist/core/templates/workflows/archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/archive-change.js +277 -0
- package/dist/core/templates/workflows/bulk-archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/bulk-archive-change.js +492 -0
- package/dist/core/templates/workflows/continue-change.d.ts +10 -0
- package/dist/core/templates/workflows/continue-change.js +234 -0
- package/dist/core/templates/workflows/explore.d.ts +10 -0
- package/dist/core/templates/workflows/explore.js +459 -0
- package/dist/core/templates/workflows/feedback.d.ts +9 -0
- package/dist/core/templates/workflows/feedback.js +108 -0
- package/dist/core/templates/workflows/ff-change.d.ts +10 -0
- package/dist/core/templates/workflows/ff-change.js +200 -0
- package/dist/core/templates/workflows/new-change.d.ts +10 -0
- package/dist/core/templates/workflows/new-change.js +143 -0
- package/dist/core/templates/workflows/onboard.d.ts +10 -0
- package/dist/core/templates/workflows/onboard.js +563 -0
- package/dist/core/templates/workflows/propose.d.ts +10 -0
- package/dist/core/templates/workflows/propose.js +218 -0
- package/dist/core/templates/workflows/sync-specs.d.ts +10 -0
- package/dist/core/templates/workflows/sync-specs.js +290 -0
- package/dist/core/templates/workflows/verify-change.d.ts +10 -0
- package/dist/core/templates/workflows/verify-change.js +338 -0
- package/dist/core/update.d.ts +82 -0
- package/dist/core/update.js +557 -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 +168 -0
- package/dist/core/workspace/foundation.d.ts +62 -0
- package/dist/core/workspace/foundation.js +274 -0
- package/dist/core/workspace/index.d.ts +8 -0
- package/dist/core/workspace/index.js +8 -0
- package/dist/core/workspace/legacy-state.d.ts +28 -0
- package/dist/core/workspace/legacy-state.js +200 -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 +43 -0
- package/dist/core/workspace/open-surface.js +214 -0
- package/dist/core/workspace/openers.d.ts +21 -0
- package/dist/core/workspace/openers.js +119 -0
- package/dist/core/workspace/registry.d.ts +24 -0
- package/dist/core/workspace/registry.js +146 -0
- package/dist/core/workspace/skills.d.ts +57 -0
- package/dist/core/workspace/skills.js +334 -0
- package/dist/core/workspace/state-io.d.ts +10 -0
- package/dist/core/workspace/state-io.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/telemetry/config.d.ts +38 -0
- package/dist/telemetry/config.js +136 -0
- package/dist/telemetry/index.d.ts +31 -0
- package/dist/telemetry/index.js +164 -0
- package/dist/ui/ascii-patterns.d.ts +16 -0
- package/dist/ui/ascii-patterns.js +133 -0
- package/dist/ui/welcome-screen.d.ts +10 -0
- package/dist/ui/welcome-screen.js +146 -0
- package/dist/utils/change-metadata.d.ts +54 -0
- package/dist/utils/change-metadata.js +141 -0
- package/dist/utils/change-utils.d.ts +71 -0
- package/dist/utils/change-utils.js +123 -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 +72 -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 +84 -0
- package/schemas/spec-driven/schema.yaml +153 -0
- package/schemas/spec-driven/templates/design.md +19 -0
- package/schemas/spec-driven/templates/proposal.md +23 -0
- package/schemas/spec-driven/templates/spec.md +8 -0
- package/schemas/spec-driven/templates/tasks.md +9 -0
- package/schemas/workspace-planning/schema.yaml +72 -0
- package/schemas/workspace-planning/templates/design.md +33 -0
- package/schemas/workspace-planning/templates/proposal.md +28 -0
- package/schemas/workspace-planning/templates/spec.md +9 -0
- package/schemas/workspace-planning/templates/tasks.md +15 -0
- package/scripts/postinstall.js +83 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type ContextStoreBinding, type ContextStoreSelector } from '../context-store/index.js';
|
|
2
|
+
export declare const WORKSPACE_METADATA_DIR_NAME = ".pastelsdd-workspace";
|
|
3
|
+
export declare const WORKSPACE_VIEW_STATE_FILE_NAME = "workspace.yaml";
|
|
4
|
+
export declare const WORKSPACE_CHANGES_DIR_NAME = "changes";
|
|
5
|
+
export declare const WORKSPACE_CODE_WORKSPACE_EXTENSION = ".code-workspace";
|
|
6
|
+
export declare const WORKSPACE_SUPPORTED_OPENER_VALUES: readonly ["codex", "claude", "github-copilot", "editor"];
|
|
7
|
+
export declare const WORKSPACE_AGENT_OPENER_IDS: readonly ["codex", "claude", "github-copilot"];
|
|
8
|
+
export declare const WORKSPACE_EDITOR_OPENER_IDS: readonly ["vscode"];
|
|
9
|
+
export type WorkspaceSupportedOpenerValue = typeof WORKSPACE_SUPPORTED_OPENER_VALUES[number];
|
|
10
|
+
export type WorkspaceAgentOpenerId = typeof WORKSPACE_AGENT_OPENER_IDS[number];
|
|
11
|
+
export type WorkspaceEditorOpenerId = typeof WORKSPACE_EDITOR_OPENER_IDS[number];
|
|
12
|
+
export type WorkspacePreferredOpener = {
|
|
13
|
+
kind: 'agent';
|
|
14
|
+
id: WorkspaceAgentOpenerId;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'editor';
|
|
17
|
+
id: WorkspaceEditorOpenerId;
|
|
18
|
+
};
|
|
19
|
+
export interface WorkspaceContextState {
|
|
20
|
+
kind: 'initiative';
|
|
21
|
+
store: ContextStoreBinding;
|
|
22
|
+
initiative: {
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface WorkspaceViewState {
|
|
27
|
+
version: 1;
|
|
28
|
+
name: string;
|
|
29
|
+
context: WorkspaceContextState | null;
|
|
30
|
+
links: Record<string, string | null>;
|
|
31
|
+
preferred_opener?: WorkspacePreferredOpener;
|
|
32
|
+
tools?: string[];
|
|
33
|
+
workspace_skills?: WorkspaceSkillState;
|
|
34
|
+
}
|
|
35
|
+
export interface WorkspaceSkillState {
|
|
36
|
+
selected_agents: string[];
|
|
37
|
+
last_applied_profile?: 'core' | 'custom';
|
|
38
|
+
last_applied_delivery?: 'both' | 'skills' | 'commands';
|
|
39
|
+
last_applied_workflow_ids?: string[];
|
|
40
|
+
last_applied_at?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function getWorkspaceMetadataDir(workspaceRoot: string): string;
|
|
43
|
+
export declare function getWorkspaceViewStatePath(workspaceRoot: string): string;
|
|
44
|
+
export declare function getWorkspaceChangesDir(workspaceRoot: string): string;
|
|
45
|
+
export declare function getWorkspaceCodeWorkspaceFileName(workspaceName: string): string;
|
|
46
|
+
export declare function getWorkspaceCodeWorkspacePath(workspaceRoot: string, workspaceName: string): string;
|
|
47
|
+
export declare function getWorkspacePortableIgnorePatterns(workspaceName?: string): string[];
|
|
48
|
+
export declare function validateWorkspaceName(name: string): string;
|
|
49
|
+
export declare function validateWorkspaceLinkName(name: string): string;
|
|
50
|
+
export declare function isValidWorkspaceName(name: string): boolean;
|
|
51
|
+
export declare function isValidWorkspaceLinkName(name: string): boolean;
|
|
52
|
+
export declare function isWorkspaceAgentOpenerId(value: string): value is WorkspaceAgentOpenerId;
|
|
53
|
+
export declare function isWorkspaceSupportedOpenerValue(value: string): value is WorkspaceSupportedOpenerValue;
|
|
54
|
+
export declare function parseWorkspacePreferredOpenerValue(value: string): WorkspacePreferredOpener;
|
|
55
|
+
export declare function validateWorkspacePreferredOpener(opener: WorkspacePreferredOpener): WorkspacePreferredOpener;
|
|
56
|
+
export declare function createWorkspaceInitiativeContext(store: ContextStoreBinding, initiativeId: string): WorkspaceContextState;
|
|
57
|
+
export declare function getWorkspaceContextStoreId(context: WorkspaceContextState): string;
|
|
58
|
+
export declare function getWorkspaceContextStoreSelector(context: WorkspaceContextState): ContextStoreSelector;
|
|
59
|
+
export declare function getWorkspaceContextInitiativeId(context: WorkspaceContextState): string;
|
|
60
|
+
export declare function parseWorkspaceViewState(content: string): WorkspaceViewState;
|
|
61
|
+
export declare function serializeWorkspaceViewState(state: WorkspaceViewState): string;
|
|
62
|
+
//# sourceMappingURL=foundation.d.ts.map
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { normalizeContextStoreBinding, } from '../context-store/index.js';
|
|
4
|
+
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
5
|
+
export const WORKSPACE_METADATA_DIR_NAME = '.pastelsdd-workspace';
|
|
6
|
+
export const WORKSPACE_VIEW_STATE_FILE_NAME = 'workspace.yaml';
|
|
7
|
+
export const WORKSPACE_CHANGES_DIR_NAME = 'changes';
|
|
8
|
+
export const WORKSPACE_CODE_WORKSPACE_EXTENSION = '.code-workspace';
|
|
9
|
+
export const WORKSPACE_SUPPORTED_OPENER_VALUES = [
|
|
10
|
+
'codex',
|
|
11
|
+
'claude',
|
|
12
|
+
'github-copilot',
|
|
13
|
+
'editor',
|
|
14
|
+
];
|
|
15
|
+
export const WORKSPACE_AGENT_OPENER_IDS = [
|
|
16
|
+
'codex',
|
|
17
|
+
'claude',
|
|
18
|
+
'github-copilot',
|
|
19
|
+
];
|
|
20
|
+
export const WORKSPACE_EDITOR_OPENER_IDS = ['vscode'];
|
|
21
|
+
function joinWorkspacePath(basePath, ...segments) {
|
|
22
|
+
return FileSystemUtils.joinPath(basePath, ...segments);
|
|
23
|
+
}
|
|
24
|
+
export function getWorkspaceMetadataDir(workspaceRoot) {
|
|
25
|
+
return joinWorkspacePath(workspaceRoot, WORKSPACE_METADATA_DIR_NAME);
|
|
26
|
+
}
|
|
27
|
+
export function getWorkspaceViewStatePath(workspaceRoot) {
|
|
28
|
+
return joinWorkspacePath(workspaceRoot, WORKSPACE_VIEW_STATE_FILE_NAME);
|
|
29
|
+
}
|
|
30
|
+
export function getWorkspaceChangesDir(workspaceRoot) {
|
|
31
|
+
return joinWorkspacePath(workspaceRoot, WORKSPACE_CHANGES_DIR_NAME);
|
|
32
|
+
}
|
|
33
|
+
export function getWorkspaceCodeWorkspaceFileName(workspaceName) {
|
|
34
|
+
validateWorkspaceName(workspaceName);
|
|
35
|
+
return `${workspaceName}${WORKSPACE_CODE_WORKSPACE_EXTENSION}`;
|
|
36
|
+
}
|
|
37
|
+
export function getWorkspaceCodeWorkspacePath(workspaceRoot, workspaceName) {
|
|
38
|
+
return joinWorkspacePath(workspaceRoot, getWorkspaceCodeWorkspaceFileName(workspaceName));
|
|
39
|
+
}
|
|
40
|
+
export function getWorkspacePortableIgnorePatterns(workspaceName) {
|
|
41
|
+
return workspaceName ? [getWorkspaceCodeWorkspaceFileName(workspaceName)] : [];
|
|
42
|
+
}
|
|
43
|
+
function validateFolderStyleName(name, label) {
|
|
44
|
+
if (name.length === 0) {
|
|
45
|
+
throw new Error(`${label} must not be empty`);
|
|
46
|
+
}
|
|
47
|
+
if (name === '.' || name === '..') {
|
|
48
|
+
throw new Error(`${label} must not be '${name}'`);
|
|
49
|
+
}
|
|
50
|
+
if (/[\\/]/u.test(name)) {
|
|
51
|
+
throw new Error(`${label} must not contain path separators`);
|
|
52
|
+
}
|
|
53
|
+
return name;
|
|
54
|
+
}
|
|
55
|
+
export function validateWorkspaceName(name) {
|
|
56
|
+
validateFolderStyleName(name, 'Workspace name');
|
|
57
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(name)) {
|
|
58
|
+
throw new Error('Workspace name must be kebab-case with lowercase letters, numbers, and single hyphen separators');
|
|
59
|
+
}
|
|
60
|
+
return name;
|
|
61
|
+
}
|
|
62
|
+
export function validateWorkspaceLinkName(name) {
|
|
63
|
+
return validateFolderStyleName(name, 'Workspace link name');
|
|
64
|
+
}
|
|
65
|
+
export function isValidWorkspaceName(name) {
|
|
66
|
+
try {
|
|
67
|
+
validateWorkspaceName(name);
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function isValidWorkspaceLinkName(name) {
|
|
75
|
+
try {
|
|
76
|
+
validateWorkspaceLinkName(name);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const ContextStoreSelectorSchema = z.union([
|
|
84
|
+
z
|
|
85
|
+
.object({
|
|
86
|
+
kind: z.literal('registry'),
|
|
87
|
+
id: z.string(),
|
|
88
|
+
})
|
|
89
|
+
.strict(),
|
|
90
|
+
z
|
|
91
|
+
.object({
|
|
92
|
+
kind: z.literal('path'),
|
|
93
|
+
path: z.string(),
|
|
94
|
+
observed_id: z.string().optional(),
|
|
95
|
+
})
|
|
96
|
+
.strict(),
|
|
97
|
+
]);
|
|
98
|
+
const ContextStoreBindingSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
id: z.string(),
|
|
101
|
+
selector: ContextStoreSelectorSchema,
|
|
102
|
+
})
|
|
103
|
+
.strict();
|
|
104
|
+
const WorkspaceInitiativeContextSchema = z
|
|
105
|
+
.object({
|
|
106
|
+
kind: z.literal('initiative'),
|
|
107
|
+
store: ContextStoreBindingSchema,
|
|
108
|
+
initiative: z
|
|
109
|
+
.object({
|
|
110
|
+
id: z.string(),
|
|
111
|
+
})
|
|
112
|
+
.strict(),
|
|
113
|
+
})
|
|
114
|
+
.strict();
|
|
115
|
+
const WorkspaceContextSchema = WorkspaceInitiativeContextSchema;
|
|
116
|
+
const WorkspaceSkillStateSchema = z
|
|
117
|
+
.object({
|
|
118
|
+
selected_agents: z.array(z.string()),
|
|
119
|
+
last_applied_profile: z.enum(['core', 'custom']).optional(),
|
|
120
|
+
last_applied_delivery: z.enum(['both', 'skills', 'commands']).optional(),
|
|
121
|
+
last_applied_workflow_ids: z.array(z.string()).optional(),
|
|
122
|
+
last_applied_at: z.string().optional(),
|
|
123
|
+
})
|
|
124
|
+
.strict();
|
|
125
|
+
const PreferredOpenerSchema = z
|
|
126
|
+
.object({
|
|
127
|
+
kind: z.enum(['agent', 'editor']),
|
|
128
|
+
id: z.string(),
|
|
129
|
+
})
|
|
130
|
+
.strict();
|
|
131
|
+
const ViewStateSchema = z
|
|
132
|
+
.object({
|
|
133
|
+
version: z.literal(1),
|
|
134
|
+
name: z.string(),
|
|
135
|
+
context: WorkspaceContextSchema.nullable(),
|
|
136
|
+
links: z.record(z.string(), z.string().nullable()),
|
|
137
|
+
preferred_opener: PreferredOpenerSchema.optional(),
|
|
138
|
+
tools: z.array(z.string()).optional(),
|
|
139
|
+
workspace_skills: WorkspaceSkillStateSchema.optional(),
|
|
140
|
+
})
|
|
141
|
+
.strict();
|
|
142
|
+
function formatZodIssues(error) {
|
|
143
|
+
return error.issues
|
|
144
|
+
.map((issue) => {
|
|
145
|
+
const location = issue.path.length > 0 ? issue.path.join('.') : 'root';
|
|
146
|
+
return `${location}: ${issue.message}`;
|
|
147
|
+
})
|
|
148
|
+
.join('; ');
|
|
149
|
+
}
|
|
150
|
+
function parseYamlObject(content, label) {
|
|
151
|
+
try {
|
|
152
|
+
return parseYaml(content);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
156
|
+
throw new Error(`Invalid ${label}: ${message}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function assertValidMapKeys(keys, validator, label) {
|
|
160
|
+
for (const key of keys) {
|
|
161
|
+
try {
|
|
162
|
+
validator(key);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
166
|
+
throw new Error(`Invalid ${label} '${key}': ${message}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function formatSupportedOpenerValues() {
|
|
171
|
+
return WORKSPACE_SUPPORTED_OPENER_VALUES.join(', ');
|
|
172
|
+
}
|
|
173
|
+
export function isWorkspaceAgentOpenerId(value) {
|
|
174
|
+
return WORKSPACE_AGENT_OPENER_IDS.includes(value);
|
|
175
|
+
}
|
|
176
|
+
export function isWorkspaceSupportedOpenerValue(value) {
|
|
177
|
+
return WORKSPACE_SUPPORTED_OPENER_VALUES.includes(value);
|
|
178
|
+
}
|
|
179
|
+
export function parseWorkspacePreferredOpenerValue(value) {
|
|
180
|
+
if (value === 'editor') {
|
|
181
|
+
return {
|
|
182
|
+
kind: 'editor',
|
|
183
|
+
id: 'vscode',
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if (isWorkspaceAgentOpenerId(value)) {
|
|
187
|
+
return {
|
|
188
|
+
kind: 'agent',
|
|
189
|
+
id: value,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
throw new Error(`Unsupported workspace opener '${value}'. Supported values: ${formatSupportedOpenerValues()}`);
|
|
193
|
+
}
|
|
194
|
+
export function validateWorkspacePreferredOpener(opener) {
|
|
195
|
+
if (opener.kind === 'editor' && opener.id === 'vscode') {
|
|
196
|
+
return opener;
|
|
197
|
+
}
|
|
198
|
+
if (opener.kind === 'agent' && isWorkspaceAgentOpenerId(opener.id)) {
|
|
199
|
+
return opener;
|
|
200
|
+
}
|
|
201
|
+
throw new Error(`Unsupported workspace opener '${opener.kind}:${opener.id}'. Supported values: ${formatSupportedOpenerValues()}`);
|
|
202
|
+
}
|
|
203
|
+
function normalizeWorkspaceContextState(context) {
|
|
204
|
+
return createWorkspaceInitiativeContext(normalizeContextStoreBinding(context.store), context.initiative.id);
|
|
205
|
+
}
|
|
206
|
+
function normalizeOptionalWorkspaceContextState(context) {
|
|
207
|
+
return context ? normalizeWorkspaceContextState(context) : null;
|
|
208
|
+
}
|
|
209
|
+
export function createWorkspaceInitiativeContext(store, initiativeId) {
|
|
210
|
+
if (initiativeId.length === 0) {
|
|
211
|
+
throw new Error('Workspace initiative id must not be empty.');
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
kind: 'initiative',
|
|
215
|
+
store: normalizeContextStoreBinding(store),
|
|
216
|
+
initiative: {
|
|
217
|
+
id: initiativeId,
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
export function getWorkspaceContextStoreId(context) {
|
|
222
|
+
return context.store.id;
|
|
223
|
+
}
|
|
224
|
+
export function getWorkspaceContextStoreSelector(context) {
|
|
225
|
+
return context.store.selector;
|
|
226
|
+
}
|
|
227
|
+
export function getWorkspaceContextInitiativeId(context) {
|
|
228
|
+
return context.initiative.id;
|
|
229
|
+
}
|
|
230
|
+
export function parseWorkspaceViewState(content) {
|
|
231
|
+
const raw = parseYamlObject(content, 'workspace state');
|
|
232
|
+
const result = ViewStateSchema.safeParse(raw);
|
|
233
|
+
if (!result.success) {
|
|
234
|
+
throw new Error(`Invalid workspace state: ${formatZodIssues(result.error)}`);
|
|
235
|
+
}
|
|
236
|
+
validateWorkspaceName(result.data.name);
|
|
237
|
+
assertValidMapKeys(Object.keys(result.data.links), validateWorkspaceLinkName, 'workspace link name');
|
|
238
|
+
const preferredOpener = result.data.preferred_opener
|
|
239
|
+
? validateWorkspacePreferredOpener(result.data.preferred_opener)
|
|
240
|
+
: undefined;
|
|
241
|
+
return {
|
|
242
|
+
version: 1,
|
|
243
|
+
name: result.data.name,
|
|
244
|
+
context: normalizeOptionalWorkspaceContextState(result.data.context),
|
|
245
|
+
links: result.data.links,
|
|
246
|
+
...(preferredOpener ? { preferred_opener: preferredOpener } : {}),
|
|
247
|
+
...(result.data.tools ? { tools: result.data.tools } : {}),
|
|
248
|
+
...(result.data.workspace_skills
|
|
249
|
+
? { workspace_skills: result.data.workspace_skills }
|
|
250
|
+
: {}),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
export function serializeWorkspaceViewState(state) {
|
|
254
|
+
validateWorkspaceName(state.name);
|
|
255
|
+
assertValidMapKeys(Object.keys(state.links), validateWorkspaceLinkName, 'workspace link name');
|
|
256
|
+
for (const [linkName, localPath] of Object.entries(state.links)) {
|
|
257
|
+
if (localPath !== null && typeof localPath !== 'string') {
|
|
258
|
+
throw new Error(`Invalid workspace link '${linkName}': path must be a string or null`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const preferredOpener = state.preferred_opener
|
|
262
|
+
? validateWorkspacePreferredOpener(state.preferred_opener)
|
|
263
|
+
: undefined;
|
|
264
|
+
return stringifyYaml({
|
|
265
|
+
version: 1,
|
|
266
|
+
name: state.name,
|
|
267
|
+
context: state.context ? normalizeWorkspaceContextState(state.context) : null,
|
|
268
|
+
links: state.links,
|
|
269
|
+
...(preferredOpener ? { preferred_opener: preferredOpener } : {}),
|
|
270
|
+
...(state.tools ? { tools: state.tools } : {}),
|
|
271
|
+
...(state.workspace_skills ? { workspace_skills: state.workspace_skills } : {}),
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=foundation.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './foundation.js';
|
|
2
|
+
export * from './link-input.js';
|
|
3
|
+
export * from './openers.js';
|
|
4
|
+
export * from './open-surface.js';
|
|
5
|
+
export * from './registry.js';
|
|
6
|
+
export * from './skills.js';
|
|
7
|
+
export * from './state-io.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './foundation.js';
|
|
2
|
+
export * from './link-input.js';
|
|
3
|
+
export * from './openers.js';
|
|
4
|
+
export * from './open-surface.js';
|
|
5
|
+
export * from './registry.js';
|
|
6
|
+
export * from './skills.js';
|
|
7
|
+
export * from './state-io.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type WorkspaceContextState, type WorkspacePreferredOpener, type WorkspaceSkillState, type WorkspaceViewState } from './foundation.js';
|
|
2
|
+
export declare const WORKSPACE_LEGACY_SHARED_STATE_FILE_NAME = "workspace.yaml";
|
|
3
|
+
export declare const WORKSPACE_LEGACY_LOCAL_STATE_FILE_NAME = "local.yaml";
|
|
4
|
+
export declare const WORKSPACE_LEGACY_LOCAL_STATE_IGNORE_PATTERN = ".pastelsdd-workspace/local.yaml";
|
|
5
|
+
export type WorkspaceLinkState = Record<string, unknown>;
|
|
6
|
+
export interface WorkspaceSharedState {
|
|
7
|
+
version: 1;
|
|
8
|
+
name: string;
|
|
9
|
+
context: WorkspaceContextState | null;
|
|
10
|
+
links: Record<string, WorkspaceLinkState>;
|
|
11
|
+
}
|
|
12
|
+
export interface WorkspaceLocalState {
|
|
13
|
+
version: 1;
|
|
14
|
+
paths: Record<string, string>;
|
|
15
|
+
preferred_opener?: WorkspacePreferredOpener;
|
|
16
|
+
tools?: string[];
|
|
17
|
+
workspace_skills?: WorkspaceSkillState;
|
|
18
|
+
}
|
|
19
|
+
export declare function getWorkspaceLegacySharedStatePath(workspaceRoot: string): string;
|
|
20
|
+
export declare function getWorkspaceLegacyLocalStatePath(workspaceRoot: string): string;
|
|
21
|
+
export declare function workspaceViewToSharedState(state: WorkspaceViewState): WorkspaceSharedState;
|
|
22
|
+
export declare function workspaceViewToLocalState(state: WorkspaceViewState): WorkspaceLocalState;
|
|
23
|
+
export declare function workspaceStatePartsToViewState(sharedState: WorkspaceSharedState, localState: WorkspaceLocalState | null): WorkspaceViewState;
|
|
24
|
+
export declare function parseWorkspaceSharedState(content: string): WorkspaceSharedState;
|
|
25
|
+
export declare function parseWorkspaceLocalState(content: string): WorkspaceLocalState;
|
|
26
|
+
export declare function serializeWorkspaceSharedState(state: WorkspaceSharedState): string;
|
|
27
|
+
export declare function serializeWorkspaceLocalState(state: WorkspaceLocalState): string;
|
|
28
|
+
//# sourceMappingURL=legacy-state.d.ts.map
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { WORKSPACE_METADATA_DIR_NAME, WORKSPACE_VIEW_STATE_FILE_NAME, getWorkspaceMetadataDir, parseWorkspaceViewState, validateWorkspaceLinkName, validateWorkspaceName, validateWorkspacePreferredOpener, } from './foundation.js';
|
|
4
|
+
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
5
|
+
export const WORKSPACE_LEGACY_SHARED_STATE_FILE_NAME = WORKSPACE_VIEW_STATE_FILE_NAME;
|
|
6
|
+
export const WORKSPACE_LEGACY_LOCAL_STATE_FILE_NAME = 'local.yaml';
|
|
7
|
+
export const WORKSPACE_LEGACY_LOCAL_STATE_IGNORE_PATTERN = `${WORKSPACE_METADATA_DIR_NAME}/${WORKSPACE_LEGACY_LOCAL_STATE_FILE_NAME}`;
|
|
8
|
+
function joinWorkspacePath(basePath, ...segments) {
|
|
9
|
+
return FileSystemUtils.joinPath(basePath, ...segments);
|
|
10
|
+
}
|
|
11
|
+
export function getWorkspaceLegacySharedStatePath(workspaceRoot) {
|
|
12
|
+
return joinWorkspacePath(getWorkspaceMetadataDir(workspaceRoot), WORKSPACE_LEGACY_SHARED_STATE_FILE_NAME);
|
|
13
|
+
}
|
|
14
|
+
export function getWorkspaceLegacyLocalStatePath(workspaceRoot) {
|
|
15
|
+
return joinWorkspacePath(getWorkspaceMetadataDir(workspaceRoot), WORKSPACE_LEGACY_LOCAL_STATE_FILE_NAME);
|
|
16
|
+
}
|
|
17
|
+
function isPlainObject(value) {
|
|
18
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
const PlainObjectSchema = z.custom(isPlainObject, {
|
|
21
|
+
message: 'must be an object',
|
|
22
|
+
});
|
|
23
|
+
const PreferredOpenerSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
kind: z.enum(['agent', 'editor']),
|
|
26
|
+
id: z.string(),
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
const WorkspaceSkillStateSchema = z
|
|
30
|
+
.object({
|
|
31
|
+
selected_agents: z.array(z.string()),
|
|
32
|
+
last_applied_profile: z.enum(['core', 'custom']).optional(),
|
|
33
|
+
last_applied_delivery: z.enum(['both', 'skills', 'commands']).optional(),
|
|
34
|
+
last_applied_workflow_ids: z.array(z.string()).optional(),
|
|
35
|
+
last_applied_at: z.string().optional(),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
const SharedStateSchema = z.object({
|
|
39
|
+
version: z.literal(1),
|
|
40
|
+
name: z.string(),
|
|
41
|
+
context: z.unknown().optional(),
|
|
42
|
+
links: z.record(z.string(), PlainObjectSchema),
|
|
43
|
+
}).strict();
|
|
44
|
+
const LocalStateSchema = z.object({
|
|
45
|
+
version: z.literal(1),
|
|
46
|
+
paths: z.record(z.string(), z.string()),
|
|
47
|
+
preferred_opener: PreferredOpenerSchema.optional(),
|
|
48
|
+
tools: z.array(z.string()).optional(),
|
|
49
|
+
workspace_skills: WorkspaceSkillStateSchema.optional(),
|
|
50
|
+
}).strict();
|
|
51
|
+
function formatZodIssues(error) {
|
|
52
|
+
return error.issues
|
|
53
|
+
.map((issue) => {
|
|
54
|
+
const location = issue.path.length > 0 ? issue.path.join('.') : 'root';
|
|
55
|
+
return `${location}: ${issue.message}`;
|
|
56
|
+
})
|
|
57
|
+
.join('; ');
|
|
58
|
+
}
|
|
59
|
+
function parseYamlObject(content, label) {
|
|
60
|
+
try {
|
|
61
|
+
return parseYaml(content);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
65
|
+
throw new Error(`Invalid ${label}: ${message}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function assertValidMapKeys(keys, validator, label) {
|
|
69
|
+
for (const key of keys) {
|
|
70
|
+
try {
|
|
71
|
+
validator(key);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
75
|
+
throw new Error(`Invalid ${label} '${key}': ${message}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function normalizeLegacyWorkspaceContext(name, context) {
|
|
80
|
+
return parseWorkspaceViewState(stringifyYaml({
|
|
81
|
+
version: 1,
|
|
82
|
+
name,
|
|
83
|
+
context: context ?? null,
|
|
84
|
+
links: {},
|
|
85
|
+
})).context;
|
|
86
|
+
}
|
|
87
|
+
export function workspaceViewToSharedState(state) {
|
|
88
|
+
return {
|
|
89
|
+
version: 1,
|
|
90
|
+
name: state.name,
|
|
91
|
+
context: state.context,
|
|
92
|
+
links: Object.fromEntries(Object.keys(state.links).map((linkName) => [linkName, {}])),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export function workspaceViewToLocalState(state) {
|
|
96
|
+
return {
|
|
97
|
+
version: 1,
|
|
98
|
+
paths: Object.fromEntries(Object.entries(state.links).filter((entry) => typeof entry[1] === 'string')),
|
|
99
|
+
...(state.preferred_opener ? { preferred_opener: state.preferred_opener } : {}),
|
|
100
|
+
...(state.tools ? { tools: state.tools } : {}),
|
|
101
|
+
...(state.workspace_skills ? { workspace_skills: state.workspace_skills } : {}),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export function workspaceStatePartsToViewState(sharedState, localState) {
|
|
105
|
+
const linkNames = new Set([
|
|
106
|
+
...Object.keys(sharedState.links),
|
|
107
|
+
...Object.keys(localState?.paths ?? {}),
|
|
108
|
+
]);
|
|
109
|
+
const links = Object.fromEntries([...linkNames]
|
|
110
|
+
.sort((a, b) => a.localeCompare(b))
|
|
111
|
+
.map((linkName) => [linkName, localState?.paths[linkName] ?? null]));
|
|
112
|
+
return {
|
|
113
|
+
version: 1,
|
|
114
|
+
name: sharedState.name,
|
|
115
|
+
context: sharedState.context,
|
|
116
|
+
links,
|
|
117
|
+
...(localState?.preferred_opener ? { preferred_opener: localState.preferred_opener } : {}),
|
|
118
|
+
...(localState?.tools ? { tools: localState.tools } : {}),
|
|
119
|
+
...(localState?.workspace_skills ? { workspace_skills: localState.workspace_skills } : {}),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export function parseWorkspaceSharedState(content) {
|
|
123
|
+
const raw = parseYamlObject(content, 'workspace shared state');
|
|
124
|
+
try {
|
|
125
|
+
return workspaceViewToSharedState(parseWorkspaceViewState(content));
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Fall through to the legacy shared schema.
|
|
129
|
+
}
|
|
130
|
+
const result = SharedStateSchema.safeParse(raw);
|
|
131
|
+
if (!result.success) {
|
|
132
|
+
throw new Error(`Invalid workspace shared state: ${formatZodIssues(result.error)}`);
|
|
133
|
+
}
|
|
134
|
+
validateWorkspaceName(result.data.name);
|
|
135
|
+
assertValidMapKeys(Object.keys(result.data.links), validateWorkspaceLinkName, 'workspace link name');
|
|
136
|
+
return {
|
|
137
|
+
version: 1,
|
|
138
|
+
name: result.data.name,
|
|
139
|
+
context: normalizeLegacyWorkspaceContext(result.data.name, result.data.context),
|
|
140
|
+
links: result.data.links,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export function parseWorkspaceLocalState(content) {
|
|
144
|
+
const raw = parseYamlObject(content, 'workspace local state');
|
|
145
|
+
try {
|
|
146
|
+
return workspaceViewToLocalState(parseWorkspaceViewState(content));
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// Fall through to the legacy local schema.
|
|
150
|
+
}
|
|
151
|
+
const result = LocalStateSchema.safeParse(raw);
|
|
152
|
+
if (!result.success) {
|
|
153
|
+
throw new Error(`Invalid workspace local state: ${formatZodIssues(result.error)}`);
|
|
154
|
+
}
|
|
155
|
+
assertValidMapKeys(Object.keys(result.data.paths), validateWorkspaceLinkName, 'workspace local path name');
|
|
156
|
+
const preferredOpener = result.data.preferred_opener
|
|
157
|
+
? validateWorkspacePreferredOpener(result.data.preferred_opener)
|
|
158
|
+
: undefined;
|
|
159
|
+
return {
|
|
160
|
+
version: 1,
|
|
161
|
+
paths: result.data.paths,
|
|
162
|
+
...(preferredOpener ? { preferred_opener: preferredOpener } : {}),
|
|
163
|
+
...(result.data.tools ? { tools: result.data.tools } : {}),
|
|
164
|
+
...(result.data.workspace_skills ? { workspace_skills: result.data.workspace_skills } : {}),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export function serializeWorkspaceSharedState(state) {
|
|
168
|
+
validateWorkspaceName(state.name);
|
|
169
|
+
assertValidMapKeys(Object.keys(state.links), validateWorkspaceLinkName, 'workspace link name');
|
|
170
|
+
for (const [linkName, linkState] of Object.entries(state.links)) {
|
|
171
|
+
if (!isPlainObject(linkState)) {
|
|
172
|
+
throw new Error(`Invalid workspace link '${linkName}': link state must be an object`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return stringifyYaml({
|
|
176
|
+
version: 1,
|
|
177
|
+
name: state.name,
|
|
178
|
+
context: state.context,
|
|
179
|
+
links: state.links,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
export function serializeWorkspaceLocalState(state) {
|
|
183
|
+
assertValidMapKeys(Object.keys(state.paths), validateWorkspaceLinkName, 'workspace local path name');
|
|
184
|
+
for (const [linkName, localPath] of Object.entries(state.paths)) {
|
|
185
|
+
if (typeof localPath !== 'string') {
|
|
186
|
+
throw new Error(`Invalid workspace local path '${linkName}': path must be a string`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const preferredOpener = state.preferred_opener
|
|
190
|
+
? validateWorkspacePreferredOpener(state.preferred_opener)
|
|
191
|
+
: undefined;
|
|
192
|
+
return stringifyYaml({
|
|
193
|
+
version: 1,
|
|
194
|
+
paths: state.paths,
|
|
195
|
+
...(preferredOpener ? { preferred_opener: preferredOpener } : {}),
|
|
196
|
+
...(state.tools ? { tools: state.tools } : {}),
|
|
197
|
+
...(state.workspace_skills ? { workspace_skills: state.workspace_skills } : {}),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=legacy-state.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface WorkspaceParsedLinkInput {
|
|
2
|
+
name?: string;
|
|
3
|
+
pathInput: string;
|
|
4
|
+
}
|
|
5
|
+
export interface WorkspaceLinkInputParseOptions {
|
|
6
|
+
cwd?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseWorkspaceSetupLinkInput(value: string, options?: WorkspaceLinkInputParseOptions): Promise<WorkspaceParsedLinkInput>;
|
|
9
|
+
//# sourceMappingURL=link-input.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as nodeFs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
const fs = nodeFs.promises;
|
|
4
|
+
async function directoryExists(inputPath, cwd) {
|
|
5
|
+
if (inputPath.length === 0) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const resolvedPath = path.isAbsolute(inputPath)
|
|
9
|
+
? path.resolve(inputPath)
|
|
10
|
+
: path.resolve(cwd, inputPath);
|
|
11
|
+
try {
|
|
12
|
+
return (await fs.stat(resolvedPath)).isDirectory();
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export async function parseWorkspaceSetupLinkInput(value, options = {}) {
|
|
19
|
+
const cwd = options.cwd ?? process.cwd();
|
|
20
|
+
if (await directoryExists(value, cwd)) {
|
|
21
|
+
return { pathInput: value };
|
|
22
|
+
}
|
|
23
|
+
const separatorIndex = value.indexOf('=');
|
|
24
|
+
if (separatorIndex === -1) {
|
|
25
|
+
return { pathInput: value };
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
name: value.slice(0, separatorIndex),
|
|
29
|
+
pathInput: value.slice(separatorIndex + 1),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=link-input.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { WorkspaceViewState } from './foundation.js';
|
|
2
|
+
export declare const WORKSPACE_GUIDANCE_START_MARKER = "<!-- PASTELSDD:WORKSPACE-GUIDANCE:START -->";
|
|
3
|
+
export declare const WORKSPACE_GUIDANCE_END_MARKER = "<!-- PASTELSDD:WORKSPACE-GUIDANCE:END -->";
|
|
4
|
+
export declare const WORKSPACE_GUIDANCE_BODY = "# Pastelsdd Workspace Guidance\n\nThis directory is an Pastelsdd workspace: a local working view over context stores, initiatives, repos, and folders.\n\n- Use this workspace to open the local view of coordinated work.\n- Use initiatives for durable cross-team or cross-repo intent, decisions, requirements, and coordination context.\n- Use repo-local Pastelsdd changes for implementation plans owned by a repo or team.\n- Use linked repos and folders to inspect context, understand ownership, and make edits in the place that owns the work.\n- Keep workspace-local files focused on local paths, opener state, agent setup, and other machine-specific view state.\n- Use Pastelsdd workspace commands instead of hand-editing `workspace.yaml`.\n- If this workspace contains legacy or beta workspace-level planning files, treat them as compatibility context unless the user explicitly asks to use that beta flow.";
|
|
5
|
+
export interface WorkspaceOpenResolvedContext {
|
|
6
|
+
contextStore: {
|
|
7
|
+
id: string;
|
|
8
|
+
root: string;
|
|
9
|
+
};
|
|
10
|
+
initiative: {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
root: string;
|
|
14
|
+
metadataPath: string;
|
|
15
|
+
storePath: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface WorkspaceOpenLink {
|
|
19
|
+
name: string;
|
|
20
|
+
path: string;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkspaceSkippedOpenLink {
|
|
23
|
+
name: string;
|
|
24
|
+
path: string | null;
|
|
25
|
+
reason: 'missing-local-path' | 'path-missing';
|
|
26
|
+
}
|
|
27
|
+
export interface WorkspaceOpenSurfaceLinks {
|
|
28
|
+
links: WorkspaceOpenLink[];
|
|
29
|
+
skipped: WorkspaceSkippedOpenLink[];
|
|
30
|
+
}
|
|
31
|
+
export interface WorkspaceOpenSurfaceGeneration {
|
|
32
|
+
agentsPath: string;
|
|
33
|
+
codeWorkspacePath: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function buildWorkspaceGuidanceBlock(viewState?: WorkspaceViewState, resolvedContext?: WorkspaceOpenResolvedContext | null): string;
|
|
36
|
+
export declare function applyWorkspaceGuidanceBlock(existingContent: string, viewState?: WorkspaceViewState, resolvedContext?: WorkspaceOpenResolvedContext | null): string;
|
|
37
|
+
export declare function buildWorkspaceCodeWorkspaceContent(links: WorkspaceOpenLink[], resolvedContext?: WorkspaceOpenResolvedContext | null): string;
|
|
38
|
+
export declare function writeWorkspaceCodeWorkspaceFile(codeWorkspacePath: string, links: WorkspaceOpenLink[], resolvedContext?: WorkspaceOpenResolvedContext | null): Promise<void>;
|
|
39
|
+
export declare function resolveWorkspaceOpenLinks(viewState: WorkspaceViewState): Promise<WorkspaceOpenSurfaceLinks>;
|
|
40
|
+
export declare function syncWorkspaceOpenSurface(workspaceRoot: string, viewState: WorkspaceViewState, resolvedContext?: WorkspaceOpenResolvedContext | null): Promise<WorkspaceOpenSurfaceLinks & {
|
|
41
|
+
generated: WorkspaceOpenSurfaceGeneration;
|
|
42
|
+
}>;
|
|
43
|
+
//# sourceMappingURL=open-surface.d.ts.map
|