@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,183 @@
|
|
|
1
|
+
import { ArtifactGraph } from './graph.js';
|
|
2
|
+
import { type ActionContext, type AffectedAreasSummary, type PlanningHomeSummary } from '../change-status-policy.js';
|
|
3
|
+
import type { PlanningHome } from '../planning-home.js';
|
|
4
|
+
import type { ChangeMetadata, InitiativeLink } from '../change-metadata/index.js';
|
|
5
|
+
import type { CompletedSet } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Error thrown when loading a template fails.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TemplateLoadError extends Error {
|
|
10
|
+
readonly templatePath: string;
|
|
11
|
+
constructor(message: string, templatePath: string);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Change context containing graph, completion state, and metadata.
|
|
15
|
+
*/
|
|
16
|
+
export interface ChangeContext {
|
|
17
|
+
/** The artifact dependency graph */
|
|
18
|
+
graph: ArtifactGraph;
|
|
19
|
+
/** Set of completed artifact IDs */
|
|
20
|
+
completed: CompletedSet;
|
|
21
|
+
/** Schema name being used */
|
|
22
|
+
schemaName: string;
|
|
23
|
+
/** Change name */
|
|
24
|
+
changeName: string;
|
|
25
|
+
/** Path to the change directory */
|
|
26
|
+
changeDir: string;
|
|
27
|
+
/** Project root directory */
|
|
28
|
+
projectRoot: string;
|
|
29
|
+
/** Resolved planning home for this change */
|
|
30
|
+
planningHome?: PlanningHome;
|
|
31
|
+
/** Parsed change metadata, when present */
|
|
32
|
+
metadata?: ChangeMetadata;
|
|
33
|
+
/** Stored initiative link, when this change is linked to shared context */
|
|
34
|
+
initiative?: InitiativeLink;
|
|
35
|
+
}
|
|
36
|
+
export interface LoadChangeContextOptions {
|
|
37
|
+
changeDir?: string;
|
|
38
|
+
planningHome?: PlanningHome;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Enriched instructions for creating an artifact.
|
|
42
|
+
*/
|
|
43
|
+
export interface ArtifactInstructions {
|
|
44
|
+
/** Change name */
|
|
45
|
+
changeName: string;
|
|
46
|
+
/** Artifact ID */
|
|
47
|
+
artifactId: string;
|
|
48
|
+
/** Schema name */
|
|
49
|
+
schemaName: string;
|
|
50
|
+
/** Full path to change directory */
|
|
51
|
+
changeDir: string;
|
|
52
|
+
/** Resolved planning home for this change */
|
|
53
|
+
planningHome?: PlanningHomeSummary;
|
|
54
|
+
/** Stored initiative link, when this change is linked to shared context */
|
|
55
|
+
initiative?: InitiativeLink;
|
|
56
|
+
/** Output path pattern (e.g., "proposal.md") */
|
|
57
|
+
outputPath: string;
|
|
58
|
+
/** Absolute output path or glob pattern resolved under the change directory */
|
|
59
|
+
resolvedOutputPath: string;
|
|
60
|
+
/** Existing concrete output files for this artifact */
|
|
61
|
+
existingOutputPaths: string[];
|
|
62
|
+
/** Artifact description */
|
|
63
|
+
description: string;
|
|
64
|
+
/** Guidance on how to create this artifact (from schema instruction field) */
|
|
65
|
+
instruction: string | undefined;
|
|
66
|
+
/** Project context from config (constraints/background for AI, not to be included in output) */
|
|
67
|
+
context: string | undefined;
|
|
68
|
+
/** Artifact-specific rules from config (constraints for AI, not to be included in output) */
|
|
69
|
+
rules: string[] | undefined;
|
|
70
|
+
/** Template content (structure to follow - this IS the output format) */
|
|
71
|
+
template: string;
|
|
72
|
+
/** Dependencies with completion status and paths */
|
|
73
|
+
dependencies: DependencyInfo[];
|
|
74
|
+
/** Artifacts that become available after completing this one */
|
|
75
|
+
unlocks: string[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Dependency information including path and description.
|
|
79
|
+
*/
|
|
80
|
+
export interface DependencyInfo {
|
|
81
|
+
/** Artifact ID */
|
|
82
|
+
id: string;
|
|
83
|
+
/** Whether the dependency is completed */
|
|
84
|
+
done: boolean;
|
|
85
|
+
/** Relative output path of the dependency (e.g., "proposal.md") */
|
|
86
|
+
path: string;
|
|
87
|
+
/** Description of the dependency artifact */
|
|
88
|
+
description: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Status of a single artifact in the workflow.
|
|
92
|
+
*/
|
|
93
|
+
export interface ArtifactStatus {
|
|
94
|
+
/** Artifact ID */
|
|
95
|
+
id: string;
|
|
96
|
+
/** Output path pattern */
|
|
97
|
+
outputPath: string;
|
|
98
|
+
/** Status: done, ready, or blocked */
|
|
99
|
+
status: 'done' | 'ready' | 'blocked';
|
|
100
|
+
/** Missing dependencies (only for blocked) */
|
|
101
|
+
missingDeps?: string[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Formatted change status.
|
|
105
|
+
*/
|
|
106
|
+
export interface ChangeStatus {
|
|
107
|
+
/** Change name */
|
|
108
|
+
changeName: string;
|
|
109
|
+
/** Schema name */
|
|
110
|
+
schemaName: string;
|
|
111
|
+
/** Resolved planning home for this change */
|
|
112
|
+
planningHome?: PlanningHomeSummary;
|
|
113
|
+
/** Stored initiative link, when this change is linked to shared context */
|
|
114
|
+
initiative?: InitiativeLink;
|
|
115
|
+
/** Full path to the change root */
|
|
116
|
+
changeRoot: string;
|
|
117
|
+
/** Absolute artifact path details keyed by artifact ID */
|
|
118
|
+
artifactPaths: Record<string, ArtifactPathSummary>;
|
|
119
|
+
/** Workspace affected-area summary, when available */
|
|
120
|
+
affectedAreas?: AffectedAreasSummary;
|
|
121
|
+
/** Plain-language next steps for users and agents */
|
|
122
|
+
nextSteps: string[];
|
|
123
|
+
/** Machine-readable action constraints for agents */
|
|
124
|
+
actionContext: ActionContext;
|
|
125
|
+
/** Whether all artifacts are complete */
|
|
126
|
+
isComplete: boolean;
|
|
127
|
+
/** Artifact IDs required before apply phase (from schema's apply.requires) */
|
|
128
|
+
applyRequires: string[];
|
|
129
|
+
/** Status of each artifact */
|
|
130
|
+
artifacts: ArtifactStatus[];
|
|
131
|
+
}
|
|
132
|
+
export interface ArtifactPathSummary {
|
|
133
|
+
outputPath: string;
|
|
134
|
+
resolvedOutputPath: string;
|
|
135
|
+
existingOutputPaths: string[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Loads a template from a schema's templates directory.
|
|
139
|
+
*
|
|
140
|
+
* @param schemaName - Schema name (e.g., "spec-driven")
|
|
141
|
+
* @param templatePath - Relative path within the templates directory (e.g., "proposal.md")
|
|
142
|
+
* @param projectRoot - Optional project root for project-local schema resolution
|
|
143
|
+
* @returns The template content
|
|
144
|
+
* @throws TemplateLoadError if the template cannot be loaded
|
|
145
|
+
*/
|
|
146
|
+
export declare function loadTemplate(schemaName: string, templatePath: string, projectRoot?: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* Loads change context combining graph and completion state.
|
|
149
|
+
*
|
|
150
|
+
* Schema resolution order:
|
|
151
|
+
* 1. Explicit schemaName parameter (if provided)
|
|
152
|
+
* 2. Schema from .pastelsdd.yaml metadata (if exists in change directory)
|
|
153
|
+
* 3. Default 'spec-driven'
|
|
154
|
+
*
|
|
155
|
+
* @param projectRoot - Project root directory
|
|
156
|
+
* @param changeName - Change name
|
|
157
|
+
* @param schemaName - Optional schema name override. If not provided, auto-detected from metadata.
|
|
158
|
+
* @returns Change context with graph, completed set, and metadata
|
|
159
|
+
*/
|
|
160
|
+
export declare function loadChangeContext(projectRoot: string, changeName: string, schemaName?: string, options?: LoadChangeContextOptions): ChangeContext;
|
|
161
|
+
/**
|
|
162
|
+
* Generates enriched instructions for creating an artifact.
|
|
163
|
+
*
|
|
164
|
+
* Instruction injection order:
|
|
165
|
+
* 1. <context> - Project context from config (if present)
|
|
166
|
+
* 2. <rules> - Artifact-specific rules from config (if present)
|
|
167
|
+
* 3. <template> - Schema's template content
|
|
168
|
+
*
|
|
169
|
+
* @param context - Change context
|
|
170
|
+
* @param artifactId - Artifact ID to generate instructions for
|
|
171
|
+
* @param projectRoot - Project root directory (for reading config)
|
|
172
|
+
* @returns Enriched artifact instructions
|
|
173
|
+
* @throws Error if artifact not found
|
|
174
|
+
*/
|
|
175
|
+
export declare function generateInstructions(context: ChangeContext, artifactId: string, projectRoot?: string): ArtifactInstructions;
|
|
176
|
+
/**
|
|
177
|
+
* Formats the status of all artifacts in a change.
|
|
178
|
+
*
|
|
179
|
+
* @param context - Change context
|
|
180
|
+
* @returns Formatted change status
|
|
181
|
+
*/
|
|
182
|
+
export declare function formatChangeStatus(context: ChangeContext): ChangeStatus;
|
|
183
|
+
//# sourceMappingURL=instruction-loader.d.ts.map
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { getSchemaDir, resolveSchema } from './resolver.js';
|
|
4
|
+
import { ArtifactGraph } from './graph.js';
|
|
5
|
+
import { detectCompleted } from './state.js';
|
|
6
|
+
import { resolveArtifactOutputs } from './outputs.js';
|
|
7
|
+
import { readChangeMetadata, resolveSchemaForChange } from '../../utils/change-metadata.js';
|
|
8
|
+
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
9
|
+
import { buildActionContext, buildNextSteps, summarizeAffectedAreas, summarizePlanningHome, } from '../change-status-policy.js';
|
|
10
|
+
import { readProjectConfig, validateConfigRules } from '../project-config.js';
|
|
11
|
+
// Session-level cache for validation warnings (avoid repeating same warnings)
|
|
12
|
+
const shownWarnings = new Set();
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when loading a template fails.
|
|
15
|
+
*/
|
|
16
|
+
export class TemplateLoadError extends Error {
|
|
17
|
+
templatePath;
|
|
18
|
+
constructor(message, templatePath) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.templatePath = templatePath;
|
|
21
|
+
this.name = 'TemplateLoadError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Loads a template from a schema's templates directory.
|
|
26
|
+
*
|
|
27
|
+
* @param schemaName - Schema name (e.g., "spec-driven")
|
|
28
|
+
* @param templatePath - Relative path within the templates directory (e.g., "proposal.md")
|
|
29
|
+
* @param projectRoot - Optional project root for project-local schema resolution
|
|
30
|
+
* @returns The template content
|
|
31
|
+
* @throws TemplateLoadError if the template cannot be loaded
|
|
32
|
+
*/
|
|
33
|
+
export function loadTemplate(schemaName, templatePath, projectRoot) {
|
|
34
|
+
const schemaDir = getSchemaDir(schemaName, projectRoot);
|
|
35
|
+
if (!schemaDir) {
|
|
36
|
+
throw new TemplateLoadError(`Schema '${schemaName}' not found`, templatePath);
|
|
37
|
+
}
|
|
38
|
+
const templatePathOnDisk = path.join(schemaDir, 'templates', templatePath);
|
|
39
|
+
if (!fs.existsSync(templatePathOnDisk)) {
|
|
40
|
+
throw new TemplateLoadError(`Template not found: ${templatePathOnDisk}`, templatePathOnDisk);
|
|
41
|
+
}
|
|
42
|
+
const fullPath = FileSystemUtils.canonicalizeExistingPath(templatePathOnDisk);
|
|
43
|
+
try {
|
|
44
|
+
return fs.readFileSync(fullPath, 'utf-8');
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
const ioError = err instanceof Error ? err : new Error(String(err));
|
|
48
|
+
throw new TemplateLoadError(`Failed to read template: ${ioError.message}`, fullPath);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Loads change context combining graph and completion state.
|
|
53
|
+
*
|
|
54
|
+
* Schema resolution order:
|
|
55
|
+
* 1. Explicit schemaName parameter (if provided)
|
|
56
|
+
* 2. Schema from .pastelsdd.yaml metadata (if exists in change directory)
|
|
57
|
+
* 3. Default 'spec-driven'
|
|
58
|
+
*
|
|
59
|
+
* @param projectRoot - Project root directory
|
|
60
|
+
* @param changeName - Change name
|
|
61
|
+
* @param schemaName - Optional schema name override. If not provided, auto-detected from metadata.
|
|
62
|
+
* @returns Change context with graph, completed set, and metadata
|
|
63
|
+
*/
|
|
64
|
+
export function loadChangeContext(projectRoot, changeName, schemaName, options = {}) {
|
|
65
|
+
const changeDir = FileSystemUtils.canonicalizeExistingPath(options.changeDir ?? path.join(projectRoot, 'pastelsdd', 'changes', changeName));
|
|
66
|
+
const metadata = readChangeMetadata(changeDir, projectRoot) ?? undefined;
|
|
67
|
+
const resolvedSchemaName = resolveSchemaForChange(changeDir, schemaName, projectRoot, {
|
|
68
|
+
metadata: metadata ?? null,
|
|
69
|
+
});
|
|
70
|
+
const schema = resolveSchema(resolvedSchemaName, projectRoot);
|
|
71
|
+
const graph = ArtifactGraph.fromSchema(schema);
|
|
72
|
+
const completed = detectCompleted(graph, changeDir);
|
|
73
|
+
return {
|
|
74
|
+
graph,
|
|
75
|
+
completed,
|
|
76
|
+
schemaName: resolvedSchemaName,
|
|
77
|
+
changeName,
|
|
78
|
+
changeDir,
|
|
79
|
+
projectRoot,
|
|
80
|
+
...(options.planningHome ? { planningHome: options.planningHome } : {}),
|
|
81
|
+
...(metadata ? { metadata } : {}),
|
|
82
|
+
...(metadata?.initiative ? { initiative: metadata.initiative } : {}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Generates enriched instructions for creating an artifact.
|
|
87
|
+
*
|
|
88
|
+
* Instruction injection order:
|
|
89
|
+
* 1. <context> - Project context from config (if present)
|
|
90
|
+
* 2. <rules> - Artifact-specific rules from config (if present)
|
|
91
|
+
* 3. <template> - Schema's template content
|
|
92
|
+
*
|
|
93
|
+
* @param context - Change context
|
|
94
|
+
* @param artifactId - Artifact ID to generate instructions for
|
|
95
|
+
* @param projectRoot - Project root directory (for reading config)
|
|
96
|
+
* @returns Enriched artifact instructions
|
|
97
|
+
* @throws Error if artifact not found
|
|
98
|
+
*/
|
|
99
|
+
export function generateInstructions(context, artifactId, projectRoot) {
|
|
100
|
+
const artifact = context.graph.getArtifact(artifactId);
|
|
101
|
+
if (!artifact) {
|
|
102
|
+
throw new Error(`Artifact '${artifactId}' not found in schema '${context.schemaName}'`);
|
|
103
|
+
}
|
|
104
|
+
const templateContent = loadTemplate(context.schemaName, artifact.template, context.projectRoot);
|
|
105
|
+
const dependencies = getDependencyInfo(artifact, context.graph, context.completed);
|
|
106
|
+
const unlocks = getUnlockedArtifacts(context.graph, artifactId);
|
|
107
|
+
// Use projectRoot from context if not explicitly provided
|
|
108
|
+
const effectiveProjectRoot = projectRoot ?? context.projectRoot;
|
|
109
|
+
// Try to read project config for context and rules
|
|
110
|
+
let projectConfig = null;
|
|
111
|
+
if (effectiveProjectRoot) {
|
|
112
|
+
try {
|
|
113
|
+
projectConfig = readProjectConfig(effectiveProjectRoot);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// If config read fails, continue without config
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Validate rules artifact IDs if config has rules (only once per session)
|
|
120
|
+
if (projectConfig?.rules) {
|
|
121
|
+
const validArtifactIds = new Set(context.graph.getAllArtifacts().map((a) => a.id));
|
|
122
|
+
const warnings = validateConfigRules(projectConfig.rules, validArtifactIds, context.schemaName);
|
|
123
|
+
// Show each unique warning only once per session
|
|
124
|
+
for (const warning of warnings) {
|
|
125
|
+
if (!shownWarnings.has(warning)) {
|
|
126
|
+
console.warn(warning);
|
|
127
|
+
shownWarnings.add(warning);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Extract context and rules as separate fields (not prepended to template)
|
|
132
|
+
const configContext = projectConfig?.context?.trim() || undefined;
|
|
133
|
+
const rulesForArtifact = projectConfig?.rules?.[artifactId];
|
|
134
|
+
const configRules = rulesForArtifact && rulesForArtifact.length > 0 ? rulesForArtifact : undefined;
|
|
135
|
+
return {
|
|
136
|
+
changeName: context.changeName,
|
|
137
|
+
artifactId: artifact.id,
|
|
138
|
+
schemaName: context.schemaName,
|
|
139
|
+
changeDir: context.changeDir,
|
|
140
|
+
planningHome: summarizePlanningHome(context.planningHome),
|
|
141
|
+
...(context.initiative ? { initiative: context.initiative } : {}),
|
|
142
|
+
outputPath: artifact.generates,
|
|
143
|
+
resolvedOutputPath: path.join(context.changeDir, artifact.generates),
|
|
144
|
+
existingOutputPaths: resolveArtifactOutputs(context.changeDir, artifact.generates),
|
|
145
|
+
description: artifact.description,
|
|
146
|
+
instruction: artifact.instruction,
|
|
147
|
+
context: configContext,
|
|
148
|
+
rules: configRules,
|
|
149
|
+
template: templateContent,
|
|
150
|
+
dependencies,
|
|
151
|
+
unlocks,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Gets dependency info including paths and descriptions.
|
|
156
|
+
*/
|
|
157
|
+
function getDependencyInfo(artifact, graph, completed) {
|
|
158
|
+
return artifact.requires.map(id => {
|
|
159
|
+
const depArtifact = graph.getArtifact(id);
|
|
160
|
+
return {
|
|
161
|
+
id,
|
|
162
|
+
done: completed.has(id),
|
|
163
|
+
path: depArtifact?.generates ?? id,
|
|
164
|
+
description: depArtifact?.description ?? '',
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Gets artifacts that become available after completing the given artifact.
|
|
170
|
+
*/
|
|
171
|
+
function getUnlockedArtifacts(graph, artifactId) {
|
|
172
|
+
const unlocks = [];
|
|
173
|
+
for (const artifact of graph.getAllArtifacts()) {
|
|
174
|
+
if (artifact.requires.includes(artifactId)) {
|
|
175
|
+
unlocks.push(artifact.id);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return unlocks.sort();
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Formats the status of all artifacts in a change.
|
|
182
|
+
*
|
|
183
|
+
* @param context - Change context
|
|
184
|
+
* @returns Formatted change status
|
|
185
|
+
*/
|
|
186
|
+
export function formatChangeStatus(context) {
|
|
187
|
+
// Load schema to get apply phase configuration
|
|
188
|
+
const schema = resolveSchema(context.schemaName, context.projectRoot);
|
|
189
|
+
const applyRequires = schema.apply?.requires ?? schema.artifacts.map(a => a.id);
|
|
190
|
+
const artifacts = context.graph.getAllArtifacts();
|
|
191
|
+
const ready = new Set(context.graph.getNextArtifacts(context.completed));
|
|
192
|
+
const blocked = context.graph.getBlocked(context.completed);
|
|
193
|
+
const artifactPaths = {};
|
|
194
|
+
const artifactStatuses = artifacts.map(artifact => {
|
|
195
|
+
artifactPaths[artifact.id] = {
|
|
196
|
+
outputPath: artifact.generates,
|
|
197
|
+
resolvedOutputPath: path.join(context.changeDir, artifact.generates),
|
|
198
|
+
existingOutputPaths: resolveArtifactOutputs(context.changeDir, artifact.generates),
|
|
199
|
+
};
|
|
200
|
+
if (context.completed.has(artifact.id)) {
|
|
201
|
+
return {
|
|
202
|
+
id: artifact.id,
|
|
203
|
+
outputPath: artifact.generates,
|
|
204
|
+
status: 'done',
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (ready.has(artifact.id)) {
|
|
208
|
+
return {
|
|
209
|
+
id: artifact.id,
|
|
210
|
+
outputPath: artifact.generates,
|
|
211
|
+
status: 'ready',
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
id: artifact.id,
|
|
216
|
+
outputPath: artifact.generates,
|
|
217
|
+
status: 'blocked',
|
|
218
|
+
missingDeps: blocked[artifact.id] ?? [],
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
// Sort by build order for consistent output
|
|
222
|
+
const buildOrder = context.graph.getBuildOrder();
|
|
223
|
+
const orderMap = new Map(buildOrder.map((id, idx) => [id, idx]));
|
|
224
|
+
artifactStatuses.sort((a, b) => (orderMap.get(a.id) ?? 0) - (orderMap.get(b.id) ?? 0));
|
|
225
|
+
const affectedAreas = summarizeAffectedAreas({
|
|
226
|
+
planningHome: context.planningHome,
|
|
227
|
+
metadata: context.metadata,
|
|
228
|
+
});
|
|
229
|
+
const isComplete = context.graph.isComplete(context.completed);
|
|
230
|
+
const artifactIds = artifactStatuses.map((artifact) => artifact.id);
|
|
231
|
+
return {
|
|
232
|
+
changeName: context.changeName,
|
|
233
|
+
schemaName: context.schemaName,
|
|
234
|
+
planningHome: summarizePlanningHome(context.planningHome),
|
|
235
|
+
...(context.initiative ? { initiative: context.initiative } : {}),
|
|
236
|
+
changeRoot: context.changeDir,
|
|
237
|
+
artifactPaths,
|
|
238
|
+
affectedAreas,
|
|
239
|
+
isComplete,
|
|
240
|
+
applyRequires,
|
|
241
|
+
nextSteps: buildNextSteps({
|
|
242
|
+
changeName: context.changeName,
|
|
243
|
+
planningHome: context.planningHome,
|
|
244
|
+
artifactStatuses,
|
|
245
|
+
affectedAreas,
|
|
246
|
+
allArtifactsComplete: isComplete,
|
|
247
|
+
}),
|
|
248
|
+
actionContext: buildActionContext({
|
|
249
|
+
planningHome: context.planningHome,
|
|
250
|
+
projectRoot: context.projectRoot,
|
|
251
|
+
artifactIds,
|
|
252
|
+
}),
|
|
253
|
+
artifacts: artifactStatuses,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=instruction-loader.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a path contains glob pattern characters.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isGlobPattern(pattern: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves an artifact's output path(s) to concrete files that currently exist.
|
|
7
|
+
* Returns absolute file paths. Glob matches are sorted for deterministic output.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveArtifactOutputs(changeDir: string, generates: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Checks if an artifact has at least one resolved output file.
|
|
12
|
+
*/
|
|
13
|
+
export declare function artifactOutputExists(changeDir: string, generates: string): boolean;
|
|
14
|
+
//# sourceMappingURL=outputs.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import fg from 'fast-glob';
|
|
4
|
+
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a path contains glob pattern characters.
|
|
7
|
+
*/
|
|
8
|
+
export function isGlobPattern(pattern) {
|
|
9
|
+
return pattern.includes('*') || pattern.includes('?') || pattern.includes('[');
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolves an artifact's output path(s) to concrete files that currently exist.
|
|
13
|
+
* Returns absolute file paths. Glob matches are sorted for deterministic output.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveArtifactOutputs(changeDir, generates) {
|
|
16
|
+
if (!isGlobPattern(generates)) {
|
|
17
|
+
const fullPath = path.join(changeDir, generates);
|
|
18
|
+
try {
|
|
19
|
+
return fs.statSync(fullPath).isFile()
|
|
20
|
+
? [FileSystemUtils.canonicalizeExistingPath(fullPath)]
|
|
21
|
+
: [];
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const normalizedPattern = FileSystemUtils.toPosixPath(generates);
|
|
28
|
+
const matches = fg
|
|
29
|
+
.sync(normalizedPattern, { cwd: changeDir, onlyFiles: true, absolute: true })
|
|
30
|
+
.map((match) => FileSystemUtils.canonicalizeExistingPath(path.normalize(match)));
|
|
31
|
+
return Array.from(new Set(matches)).sort();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Checks if an artifact has at least one resolved output file.
|
|
35
|
+
*/
|
|
36
|
+
export function artifactOutputExists(changeDir, generates) {
|
|
37
|
+
return resolveArtifactOutputs(changeDir, generates).length > 0;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=outputs.js.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { SchemaYaml } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when loading a schema fails.
|
|
4
|
+
*/
|
|
5
|
+
export declare class SchemaLoadError extends Error {
|
|
6
|
+
readonly schemaPath: string;
|
|
7
|
+
readonly cause?: Error | undefined;
|
|
8
|
+
constructor(message: string, schemaPath: string, cause?: Error | undefined);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Gets the package's built-in schemas directory path.
|
|
12
|
+
* Uses import.meta.url to resolve relative to the current module.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getPackageSchemasDir(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the user's schema override directory path.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getUserSchemasDir(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the project-local schemas directory path.
|
|
21
|
+
* @param projectRoot - The project root directory
|
|
22
|
+
* @returns The path to the project's schemas directory
|
|
23
|
+
*/
|
|
24
|
+
export declare function getProjectSchemasDir(projectRoot: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves a schema name to its directory path.
|
|
27
|
+
*
|
|
28
|
+
* Resolution order (when projectRoot is provided):
|
|
29
|
+
* 1. Project-local: <projectRoot>/pastelsdd/schemas/<name>/schema.yaml
|
|
30
|
+
* 2. User override: ${XDG_DATA_HOME}/pastelsdd/schemas/<name>/schema.yaml
|
|
31
|
+
* 3. Package built-in: <package>/schemas/<name>/schema.yaml
|
|
32
|
+
*
|
|
33
|
+
* When projectRoot is not provided, only user override and package built-in are checked
|
|
34
|
+
* (backward compatible behavior).
|
|
35
|
+
*
|
|
36
|
+
* @param name - Schema name (e.g., "spec-driven")
|
|
37
|
+
* @param projectRoot - Optional project root directory for project-local schema resolution
|
|
38
|
+
* @returns The path to the schema directory, or null if not found
|
|
39
|
+
*/
|
|
40
|
+
export declare function getSchemaDir(name: string, projectRoot?: string): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a schema name to a SchemaYaml object.
|
|
43
|
+
*
|
|
44
|
+
* Resolution order (when projectRoot is provided):
|
|
45
|
+
* 1. Project-local: <projectRoot>/pastelsdd/schemas/<name>/schema.yaml
|
|
46
|
+
* 2. User override: ${XDG_DATA_HOME}/pastelsdd/schemas/<name>/schema.yaml
|
|
47
|
+
* 3. Package built-in: <package>/schemas/<name>/schema.yaml
|
|
48
|
+
*
|
|
49
|
+
* When projectRoot is not provided, only user override and package built-in are checked
|
|
50
|
+
* (backward compatible behavior).
|
|
51
|
+
*
|
|
52
|
+
* @param name - Schema name (e.g., "spec-driven")
|
|
53
|
+
* @param projectRoot - Optional project root directory for project-local schema resolution
|
|
54
|
+
* @returns The resolved schema object
|
|
55
|
+
* @throws Error if schema is not found in any location
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveSchema(name: string, projectRoot?: string): SchemaYaml;
|
|
58
|
+
/**
|
|
59
|
+
* Lists all available schema names.
|
|
60
|
+
* Combines project-local, user override, and package built-in schemas.
|
|
61
|
+
*
|
|
62
|
+
* @param projectRoot - Optional project root directory for project-local schema resolution
|
|
63
|
+
*/
|
|
64
|
+
export declare function listSchemas(projectRoot?: string): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Schema info with metadata (name, description, artifacts).
|
|
67
|
+
*/
|
|
68
|
+
export interface SchemaInfo {
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
artifacts: string[];
|
|
72
|
+
source: 'project' | 'user' | 'package';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Lists all available schemas with their descriptions and artifact lists.
|
|
76
|
+
* Useful for agent skills to present schema selection to users.
|
|
77
|
+
*
|
|
78
|
+
* @param projectRoot - Optional project root directory for project-local schema resolution
|
|
79
|
+
*/
|
|
80
|
+
export declare function listSchemasWithInfo(projectRoot?: string): SchemaInfo[];
|
|
81
|
+
//# sourceMappingURL=resolver.d.ts.map
|