squadfoundry 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +76 -0
- package/PROJECT.md +79 -0
- package/README.md +255 -0
- package/dist/orchestrator/adapters/context/IContextAdapter.d.ts +65 -0
- package/dist/orchestrator/adapters/context/IContextAdapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/context/IContextAdapter.js +12 -0
- package/dist/orchestrator/adapters/context/IContextAdapter.js.map +1 -0
- package/dist/orchestrator/adapters/context/filesystem.context-adapter.d.ts +33 -0
- package/dist/orchestrator/adapters/context/filesystem.context-adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/context/filesystem.context-adapter.js +179 -0
- package/dist/orchestrator/adapters/context/filesystem.context-adapter.js.map +1 -0
- package/dist/orchestrator/adapters/deploy/IDeployAdapter.d.ts +78 -0
- package/dist/orchestrator/adapters/deploy/IDeployAdapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/deploy/IDeployAdapter.js +14 -0
- package/dist/orchestrator/adapters/deploy/IDeployAdapter.js.map +1 -0
- package/dist/orchestrator/adapters/deploy/vercel.adapter.d.ts +31 -0
- package/dist/orchestrator/adapters/deploy/vercel.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/deploy/vercel.adapter.js +83 -0
- package/dist/orchestrator/adapters/deploy/vercel.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/host/IHostAdapter.d.ts +89 -0
- package/dist/orchestrator/adapters/host/IHostAdapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/IHostAdapter.js +10 -0
- package/dist/orchestrator/adapters/host/IHostAdapter.js.map +1 -0
- package/dist/orchestrator/adapters/host/anthropic.adapter.d.ts +27 -0
- package/dist/orchestrator/adapters/host/anthropic.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/anthropic.adapter.js +118 -0
- package/dist/orchestrator/adapters/host/anthropic.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/host/antigravity.adapter.d.ts +53 -0
- package/dist/orchestrator/adapters/host/antigravity.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/antigravity.adapter.js +148 -0
- package/dist/orchestrator/adapters/host/antigravity.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/host/claude-code.adapter.d.ts +13 -0
- package/dist/orchestrator/adapters/host/claude-code.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/claude-code.adapter.js +27 -0
- package/dist/orchestrator/adapters/host/claude-code.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/host/command-model-invoker.d.ts +8 -0
- package/dist/orchestrator/adapters/host/command-model-invoker.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/command-model-invoker.js +46 -0
- package/dist/orchestrator/adapters/host/command-model-invoker.js.map +1 -0
- package/dist/orchestrator/adapters/host/ide.adapter.d.ts +61 -0
- package/dist/orchestrator/adapters/host/ide.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/ide.adapter.js +173 -0
- package/dist/orchestrator/adapters/host/ide.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/host/local.adapter.d.ts +26 -0
- package/dist/orchestrator/adapters/host/local.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/local.adapter.js +82 -0
- package/dist/orchestrator/adapters/host/local.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/host/openai.adapter.d.ts +26 -0
- package/dist/orchestrator/adapters/host/openai.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/openai.adapter.js +77 -0
- package/dist/orchestrator/adapters/host/openai.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/host/opencode.adapter.d.ts +13 -0
- package/dist/orchestrator/adapters/host/opencode.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/host/opencode.adapter.js +27 -0
- package/dist/orchestrator/adapters/host/opencode.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/model/IModelAdapter.d.ts +68 -0
- package/dist/orchestrator/adapters/model/IModelAdapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/model/IModelAdapter.js +11 -0
- package/dist/orchestrator/adapters/model/IModelAdapter.js.map +1 -0
- package/dist/orchestrator/adapters/publishing/ISocialMediaAdapter.d.ts +93 -0
- package/dist/orchestrator/adapters/publishing/ISocialMediaAdapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/publishing/ISocialMediaAdapter.js +10 -0
- package/dist/orchestrator/adapters/publishing/ISocialMediaAdapter.js.map +1 -0
- package/dist/orchestrator/adapters/publishing/instagram.adapter.d.ts +34 -0
- package/dist/orchestrator/adapters/publishing/instagram.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/publishing/instagram.adapter.js +105 -0
- package/dist/orchestrator/adapters/publishing/instagram.adapter.js.map +1 -0
- package/dist/orchestrator/adapters/tools/IToolAdapter.d.ts +52 -0
- package/dist/orchestrator/adapters/tools/IToolAdapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/tools/IToolAdapter.js +10 -0
- package/dist/orchestrator/adapters/tools/IToolAdapter.js.map +1 -0
- package/dist/orchestrator/adapters/vcs/IVCSAdapter.d.ts +89 -0
- package/dist/orchestrator/adapters/vcs/IVCSAdapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/vcs/IVCSAdapter.js +11 -0
- package/dist/orchestrator/adapters/vcs/IVCSAdapter.js.map +1 -0
- package/dist/orchestrator/adapters/vcs/github.adapter.d.ts +36 -0
- package/dist/orchestrator/adapters/vcs/github.adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/vcs/github.adapter.js +110 -0
- package/dist/orchestrator/adapters/vcs/github.adapter.js.map +1 -0
- package/dist/orchestrator/artifacts/artifact-store.d.ts +47 -0
- package/dist/orchestrator/artifacts/artifact-store.d.ts.map +1 -0
- package/dist/orchestrator/artifacts/artifact-store.js +135 -0
- package/dist/orchestrator/artifacts/artifact-store.js.map +1 -0
- package/dist/orchestrator/builder/domain-classifier.d.ts +24 -0
- package/dist/orchestrator/builder/domain-classifier.d.ts.map +1 -0
- package/dist/orchestrator/builder/domain-classifier.js +156 -0
- package/dist/orchestrator/builder/domain-classifier.js.map +1 -0
- package/dist/orchestrator/builder/interview-questions.d.ts +13 -0
- package/dist/orchestrator/builder/interview-questions.d.ts.map +1 -0
- package/dist/orchestrator/builder/interview-questions.js +127 -0
- package/dist/orchestrator/builder/interview-questions.js.map +1 -0
- package/dist/orchestrator/builder/squad-builder.d.ts +53 -0
- package/dist/orchestrator/builder/squad-builder.d.ts.map +1 -0
- package/dist/orchestrator/builder/squad-builder.js +107 -0
- package/dist/orchestrator/builder/squad-builder.js.map +1 -0
- package/dist/orchestrator/builder/squad-generator.d.ts +33 -0
- package/dist/orchestrator/builder/squad-generator.d.ts.map +1 -0
- package/dist/orchestrator/builder/squad-generator.js +360 -0
- package/dist/orchestrator/builder/squad-generator.js.map +1 -0
- package/dist/orchestrator/cli/index.d.ts +3 -0
- package/dist/orchestrator/cli/index.d.ts.map +1 -0
- package/dist/orchestrator/cli/index.js +8 -0
- package/dist/orchestrator/cli/index.js.map +1 -0
- package/dist/orchestrator/context/context-index.d.ts +48 -0
- package/dist/orchestrator/context/context-index.d.ts.map +1 -0
- package/dist/orchestrator/context/context-index.js +116 -0
- package/dist/orchestrator/context/context-index.js.map +1 -0
- package/dist/orchestrator/context/context-loader.d.ts +49 -0
- package/dist/orchestrator/context/context-loader.d.ts.map +1 -0
- package/dist/orchestrator/context/context-loader.js +111 -0
- package/dist/orchestrator/context/context-loader.js.map +1 -0
- package/dist/orchestrator/core/guardrails.d.ts +33 -0
- package/dist/orchestrator/core/guardrails.d.ts.map +1 -0
- package/dist/orchestrator/core/guardrails.js +272 -0
- package/dist/orchestrator/core/guardrails.js.map +1 -0
- package/dist/orchestrator/core/state-machine.d.ts +65 -0
- package/dist/orchestrator/core/state-machine.d.ts.map +1 -0
- package/dist/orchestrator/core/state-machine.js +227 -0
- package/dist/orchestrator/core/state-machine.js.map +1 -0
- package/dist/orchestrator/core/types.d.ts +364 -0
- package/dist/orchestrator/core/types.d.ts.map +1 -0
- package/dist/orchestrator/core/types.js +10 -0
- package/dist/orchestrator/core/types.js.map +1 -0
- package/dist/orchestrator/index.d.ts +75 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +64 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/mcp/server.d.ts +35 -0
- package/dist/orchestrator/mcp/server.d.ts.map +1 -0
- package/dist/orchestrator/mcp/server.js +378 -0
- package/dist/orchestrator/mcp/server.js.map +1 -0
- package/dist/orchestrator/runtime/agent-dispatcher.d.ts +25 -0
- package/dist/orchestrator/runtime/agent-dispatcher.d.ts.map +1 -0
- package/dist/orchestrator/runtime/agent-dispatcher.js +82 -0
- package/dist/orchestrator/runtime/agent-dispatcher.js.map +1 -0
- package/dist/orchestrator/runtime/approval-gate.d.ts +55 -0
- package/dist/orchestrator/runtime/approval-gate.d.ts.map +1 -0
- package/dist/orchestrator/runtime/approval-gate.js +104 -0
- package/dist/orchestrator/runtime/approval-gate.js.map +1 -0
- package/dist/orchestrator/runtime/handoff-manager.d.ts +29 -0
- package/dist/orchestrator/runtime/handoff-manager.d.ts.map +1 -0
- package/dist/orchestrator/runtime/handoff-manager.js +80 -0
- package/dist/orchestrator/runtime/handoff-manager.js.map +1 -0
- package/dist/orchestrator/runtime/job-manager.d.ts +39 -0
- package/dist/orchestrator/runtime/job-manager.d.ts.map +1 -0
- package/dist/orchestrator/runtime/job-manager.js +132 -0
- package/dist/orchestrator/runtime/job-manager.js.map +1 -0
- package/dist/orchestrator/runtime/squad-runtime.d.ts +70 -0
- package/dist/orchestrator/runtime/squad-runtime.d.ts.map +1 -0
- package/dist/orchestrator/runtime/squad-runtime.js +249 -0
- package/dist/orchestrator/runtime/squad-runtime.js.map +1 -0
- package/dist/orchestrator/shell/cli.d.ts +4 -0
- package/dist/orchestrator/shell/cli.d.ts.map +1 -0
- package/dist/orchestrator/shell/cli.js +27 -0
- package/dist/orchestrator/shell/cli.js.map +1 -0
- package/dist/orchestrator/shell/commands/create.command.d.ts +3 -0
- package/dist/orchestrator/shell/commands/create.command.d.ts.map +1 -0
- package/dist/orchestrator/shell/commands/create.command.js +41 -0
- package/dist/orchestrator/shell/commands/create.command.js.map +1 -0
- package/dist/orchestrator/shell/commands/edit.command.d.ts +3 -0
- package/dist/orchestrator/shell/commands/edit.command.d.ts.map +1 -0
- package/dist/orchestrator/shell/commands/edit.command.js +49 -0
- package/dist/orchestrator/shell/commands/edit.command.js.map +1 -0
- package/dist/orchestrator/shell/commands/hosts.command.d.ts +3 -0
- package/dist/orchestrator/shell/commands/hosts.command.d.ts.map +1 -0
- package/dist/orchestrator/shell/commands/hosts.command.js +27 -0
- package/dist/orchestrator/shell/commands/hosts.command.js.map +1 -0
- package/dist/orchestrator/shell/commands/init.command.d.ts +3 -0
- package/dist/orchestrator/shell/commands/init.command.d.ts.map +1 -0
- package/dist/orchestrator/shell/commands/init.command.js +13 -0
- package/dist/orchestrator/shell/commands/init.command.js.map +1 -0
- package/dist/orchestrator/shell/commands/list.command.d.ts +3 -0
- package/dist/orchestrator/shell/commands/list.command.d.ts.map +1 -0
- package/dist/orchestrator/shell/commands/list.command.js +18 -0
- package/dist/orchestrator/shell/commands/list.command.js.map +1 -0
- package/dist/orchestrator/shell/commands/run.command.d.ts +3 -0
- package/dist/orchestrator/shell/commands/run.command.d.ts.map +1 -0
- package/dist/orchestrator/shell/commands/run.command.js +71 -0
- package/dist/orchestrator/shell/commands/run.command.js.map +1 -0
- package/dist/orchestrator/shell/commands/status.command.d.ts +3 -0
- package/dist/orchestrator/shell/commands/status.command.d.ts.map +1 -0
- package/dist/orchestrator/shell/commands/status.command.js +29 -0
- package/dist/orchestrator/shell/commands/status.command.js.map +1 -0
- package/dist/orchestrator/shell/services/active-host-detector.service.d.ts +25 -0
- package/dist/orchestrator/shell/services/active-host-detector.service.d.ts.map +1 -0
- package/dist/orchestrator/shell/services/active-host-detector.service.js +128 -0
- package/dist/orchestrator/shell/services/active-host-detector.service.js.map +1 -0
- package/dist/orchestrator/shell/services/host-resolution.service.d.ts +42 -0
- package/dist/orchestrator/shell/services/host-resolution.service.d.ts.map +1 -0
- package/dist/orchestrator/shell/services/host-resolution.service.js +108 -0
- package/dist/orchestrator/shell/services/host-resolution.service.js.map +1 -0
- package/dist/orchestrator/shell/services/host-runtime.service.d.ts +23 -0
- package/dist/orchestrator/shell/services/host-runtime.service.d.ts.map +1 -0
- package/dist/orchestrator/shell/services/host-runtime.service.js +167 -0
- package/dist/orchestrator/shell/services/host-runtime.service.js.map +1 -0
- package/dist/orchestrator/shell/services/interview-host-bridge.service.d.ts +14 -0
- package/dist/orchestrator/shell/services/interview-host-bridge.service.d.ts.map +1 -0
- package/dist/orchestrator/shell/services/interview-host-bridge.service.js +16 -0
- package/dist/orchestrator/shell/services/interview-host-bridge.service.js.map +1 -0
- package/dist/orchestrator/shell/services/job-execution.service.d.ts +22 -0
- package/dist/orchestrator/shell/services/job-execution.service.d.ts.map +1 -0
- package/dist/orchestrator/shell/services/job-execution.service.js +39 -0
- package/dist/orchestrator/shell/services/job-execution.service.js.map +1 -0
- package/dist/orchestrator/shell/services/project-bootstrap.service.d.ts +6 -0
- package/dist/orchestrator/shell/services/project-bootstrap.service.d.ts.map +1 -0
- package/dist/orchestrator/shell/services/project-bootstrap.service.js +111 -0
- package/dist/orchestrator/shell/services/project-bootstrap.service.js.map +1 -0
- package/dist/orchestrator/shell/services/squad-scaffold.service.d.ts +3 -0
- package/dist/orchestrator/shell/services/squad-scaffold.service.d.ts.map +1 -0
- package/dist/orchestrator/shell/services/squad-scaffold.service.js +30 -0
- package/dist/orchestrator/shell/services/squad-scaffold.service.js.map +1 -0
- package/dist/tests/integration/instagram-squad.test.d.ts +8 -0
- package/dist/tests/integration/instagram-squad.test.d.ts.map +1 -0
- package/dist/tests/integration/instagram-squad.test.js +187 -0
- package/dist/tests/integration/instagram-squad.test.js.map +1 -0
- package/dist/tests/integration/shell/cli-run-host-native.test.d.ts +2 -0
- package/dist/tests/integration/shell/cli-run-host-native.test.d.ts.map +1 -0
- package/dist/tests/integration/shell/cli-run-host-native.test.js +42 -0
- package/dist/tests/integration/shell/cli-run-host-native.test.js.map +1 -0
- package/dist/tests/integration/software-squad.test.d.ts +8 -0
- package/dist/tests/integration/software-squad.test.d.ts.map +1 -0
- package/dist/tests/integration/software-squad.test.js +207 -0
- package/dist/tests/integration/software-squad.test.js.map +1 -0
- package/dist/tests/unit/artifact-store.test.d.ts +2 -0
- package/dist/tests/unit/artifact-store.test.d.ts.map +1 -0
- package/dist/tests/unit/artifact-store.test.js +137 -0
- package/dist/tests/unit/artifact-store.test.js.map +1 -0
- package/dist/tests/unit/context-loader.test.d.ts +2 -0
- package/dist/tests/unit/context-loader.test.d.ts.map +1 -0
- package/dist/tests/unit/context-loader.test.js +109 -0
- package/dist/tests/unit/context-loader.test.js.map +1 -0
- package/dist/tests/unit/docs/host-native-docs.test.d.ts +2 -0
- package/dist/tests/unit/docs/host-native-docs.test.d.ts.map +1 -0
- package/dist/tests/unit/docs/host-native-docs.test.js +18 -0
- package/dist/tests/unit/docs/host-native-docs.test.js.map +1 -0
- package/dist/tests/unit/guardrails.test.d.ts +2 -0
- package/dist/tests/unit/guardrails.test.d.ts.map +1 -0
- package/dist/tests/unit/guardrails.test.js +202 -0
- package/dist/tests/unit/guardrails.test.js.map +1 -0
- package/dist/tests/unit/host/host-adapter-contract.test.d.ts +2 -0
- package/dist/tests/unit/host/host-adapter-contract.test.d.ts.map +1 -0
- package/dist/tests/unit/host/host-adapter-contract.test.js +53 -0
- package/dist/tests/unit/host/host-adapter-contract.test.js.map +1 -0
- package/dist/tests/unit/host/ide.adapter.test.d.ts +2 -0
- package/dist/tests/unit/host/ide.adapter.test.d.ts.map +1 -0
- package/dist/tests/unit/host/ide.adapter.test.js +17 -0
- package/dist/tests/unit/host/ide.adapter.test.js.map +1 -0
- package/dist/tests/unit/host/native-ide-adapters.test.d.ts +2 -0
- package/dist/tests/unit/host/native-ide-adapters.test.d.ts.map +1 -0
- package/dist/tests/unit/host/native-ide-adapters.test.js +26 -0
- package/dist/tests/unit/host/native-ide-adapters.test.js.map +1 -0
- package/dist/tests/unit/runtime/squad-runtime-host-metadata.test.d.ts +2 -0
- package/dist/tests/unit/runtime/squad-runtime-host-metadata.test.d.ts.map +1 -0
- package/dist/tests/unit/runtime/squad-runtime-host-metadata.test.js +128 -0
- package/dist/tests/unit/runtime/squad-runtime-host-metadata.test.js.map +1 -0
- package/dist/tests/unit/shell/active-host-detector.test.d.ts +2 -0
- package/dist/tests/unit/shell/active-host-detector.test.d.ts.map +1 -0
- package/dist/tests/unit/shell/active-host-detector.test.js +85 -0
- package/dist/tests/unit/shell/active-host-detector.test.js.map +1 -0
- package/dist/tests/unit/shell/host-resolution.service.test.d.ts +2 -0
- package/dist/tests/unit/shell/host-resolution.service.test.d.ts.map +1 -0
- package/dist/tests/unit/shell/host-resolution.service.test.js +252 -0
- package/dist/tests/unit/shell/host-resolution.service.test.js.map +1 -0
- package/dist/tests/unit/shell/interview-host-bridge.test.d.ts +2 -0
- package/dist/tests/unit/shell/interview-host-bridge.test.d.ts.map +1 -0
- package/dist/tests/unit/shell/interview-host-bridge.test.js +58 -0
- package/dist/tests/unit/shell/interview-host-bridge.test.js.map +1 -0
- package/dist/tests/unit/shell/project-bootstrap.service.test.d.ts +2 -0
- package/dist/tests/unit/shell/project-bootstrap.service.test.d.ts.map +1 -0
- package/dist/tests/unit/shell/project-bootstrap.service.test.js +58 -0
- package/dist/tests/unit/shell/project-bootstrap.service.test.js.map +1 -0
- package/dist/tests/unit/shell/squad-scaffold.service.test.d.ts +2 -0
- package/dist/tests/unit/shell/squad-scaffold.service.test.d.ts.map +1 -0
- package/dist/tests/unit/shell/squad-scaffold.service.test.js +40 -0
- package/dist/tests/unit/shell/squad-scaffold.service.test.js.map +1 -0
- package/dist/tests/unit/squad-builder.test.d.ts +2 -0
- package/dist/tests/unit/squad-builder.test.d.ts.map +1 -0
- package/dist/tests/unit/squad-builder.test.js +126 -0
- package/dist/tests/unit/squad-builder.test.js.map +1 -0
- package/dist/tests/unit/state-machine.test.d.ts +2 -0
- package/dist/tests/unit/state-machine.test.d.ts.map +1 -0
- package/dist/tests/unit/state-machine.test.js +133 -0
- package/dist/tests/unit/state-machine.test.js.map +1 -0
- package/docs/architecture/overview.md +115 -0
- package/docs/development/adding-agents.md +75 -0
- package/docs/development/adding-hosts.md +104 -0
- package/docs/development/adding-integrations.md +83 -0
- package/docs/development/host-detection-and-resolution.md +59 -0
- package/docs/squads/how-to-create.md +85 -0
- package/docs/squads/how-to-execute.md +139 -0
- package/docs/superpowers/plans/2026-04-01-host-native-cli-shell-implementation.md +617 -0
- package/docs/superpowers/specs/2026-04-01-host-native-cli-shell-design.md +253 -0
- package/package.json +103 -0
- package/squads/examples/instagram-content/AGENTS.md +63 -0
- package/squads/examples/instagram-content/POLICIES.md +45 -0
- package/squads/examples/instagram-content/SQUAD.md +63 -0
- package/squads/examples/instagram-content/WORKFLOW.md +58 -0
- package/squads/examples/instagram-content/config/squad.json +474 -0
- package/squads/examples/software-development/AGENTS.md +88 -0
- package/squads/examples/software-development/POLICIES.md +44 -0
- package/squads/examples/software-development/SQUAD.md +65 -0
- package/squads/examples/software-development/WORKFLOW.md +78 -0
- package/squads/examples/software-development/config/squad.json +442 -0
- package/templates/AGENTS.md +46 -0
- package/templates/POLICIES.md +24 -0
- package/templates/PROJECT.md +52 -0
- package/templates/SQUAD.md +52 -0
- package/templates/TASKS.md +31 -0
- package/templates/WORKFLOW.md +35 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration test: Software Development Squad
|
|
3
|
+
*
|
|
4
|
+
* Tests the full squad runtime with the software-development squad config.
|
|
5
|
+
* Uses stub host adapter — no real LLM calls.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
8
|
+
import { mkdirSync, rmSync, existsSync } from 'node:fs';
|
|
9
|
+
import { createSquadRuntime } from '../../orchestrator/runtime/squad-runtime.js';
|
|
10
|
+
import { ArtifactStore } from '../../orchestrator/artifacts/artifact-store.js';
|
|
11
|
+
import { LocalHostAdapter } from '../../orchestrator/adapters/host/local.adapter.js';
|
|
12
|
+
const TEST_DIR = '/tmp/sf-integration-sw';
|
|
13
|
+
// Minimal software-development squad for testing
|
|
14
|
+
const TEST_SQUAD = {
|
|
15
|
+
id: 'test-software-dev',
|
|
16
|
+
name: 'Test Software Dev Squad',
|
|
17
|
+
domain: 'software-development',
|
|
18
|
+
objective: 'Integration test squad',
|
|
19
|
+
description: 'Test squad with two sequential steps',
|
|
20
|
+
context: '',
|
|
21
|
+
agents: [
|
|
22
|
+
{
|
|
23
|
+
id: 'agent-a',
|
|
24
|
+
name: 'Agent A',
|
|
25
|
+
role: 'Implementor',
|
|
26
|
+
domain: 'software-development',
|
|
27
|
+
objective: 'Implement',
|
|
28
|
+
instructions: 'Do the implementation',
|
|
29
|
+
inputs: [],
|
|
30
|
+
outputs: [],
|
|
31
|
+
allowedTools: [],
|
|
32
|
+
constraints: [],
|
|
33
|
+
successCriteria: [],
|
|
34
|
+
failureCriteria: [],
|
|
35
|
+
allowedStates: ['READY_FOR_EXECUTION', 'RUNNING_STEP'],
|
|
36
|
+
blockingConditions: [],
|
|
37
|
+
handoffRules: [{ condition: 'done', targetAgentId: 'agent-b', description: 'pass', requiresApproval: false }],
|
|
38
|
+
responseFormat: 'markdown',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'agent-b',
|
|
42
|
+
name: 'Agent B',
|
|
43
|
+
role: 'Reviewer',
|
|
44
|
+
domain: 'software-development',
|
|
45
|
+
objective: 'Review',
|
|
46
|
+
instructions: 'Review the work',
|
|
47
|
+
inputs: [],
|
|
48
|
+
outputs: [],
|
|
49
|
+
allowedTools: [],
|
|
50
|
+
constraints: [],
|
|
51
|
+
successCriteria: [],
|
|
52
|
+
failureCriteria: [],
|
|
53
|
+
allowedStates: ['READY_FOR_EXECUTION', 'RUNNING_STEP'],
|
|
54
|
+
blockingConditions: [],
|
|
55
|
+
handoffRules: [],
|
|
56
|
+
responseFormat: 'markdown',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
workflow: {
|
|
60
|
+
id: 'wf-test',
|
|
61
|
+
name: 'Test Workflow',
|
|
62
|
+
description: 'Two steps',
|
|
63
|
+
entryStepId: 'step-a',
|
|
64
|
+
steps: [
|
|
65
|
+
{
|
|
66
|
+
id: 'step-a',
|
|
67
|
+
name: 'Step A',
|
|
68
|
+
agentId: 'agent-a',
|
|
69
|
+
description: 'First step',
|
|
70
|
+
dependsOn: [],
|
|
71
|
+
guardrails: [],
|
|
72
|
+
requiresApprovalBefore: false,
|
|
73
|
+
requiresApprovalAfter: false,
|
|
74
|
+
requiredArtifacts: [],
|
|
75
|
+
producedArtifacts: ['output-a'],
|
|
76
|
+
nextStepId: 'step-b',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'step-b',
|
|
80
|
+
name: 'Step B',
|
|
81
|
+
agentId: 'agent-b',
|
|
82
|
+
description: 'Second step',
|
|
83
|
+
dependsOn: ['step-a'],
|
|
84
|
+
guardrails: [],
|
|
85
|
+
requiresApprovalBefore: false,
|
|
86
|
+
requiresApprovalAfter: false,
|
|
87
|
+
requiredArtifacts: [],
|
|
88
|
+
producedArtifacts: ['output-b'],
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
policy: {
|
|
93
|
+
id: 'policy-test',
|
|
94
|
+
name: 'Test Policy',
|
|
95
|
+
description: '',
|
|
96
|
+
guardrails: [],
|
|
97
|
+
prohibitedActions: [],
|
|
98
|
+
requiredApprovals: [],
|
|
99
|
+
},
|
|
100
|
+
expectedArtifacts: [],
|
|
101
|
+
allowedIntegrations: [],
|
|
102
|
+
templates: [],
|
|
103
|
+
successCriteria: ['All steps completed'],
|
|
104
|
+
failureCriteria: ['Any step fails'],
|
|
105
|
+
metadata: {
|
|
106
|
+
version: '1.0.0',
|
|
107
|
+
createdAt: new Date().toISOString(),
|
|
108
|
+
updatedAt: new Date().toISOString(),
|
|
109
|
+
tags: ['test'],
|
|
110
|
+
hostCompatibility: ['any'],
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
describe('Software Squad Integration', () => {
|
|
114
|
+
beforeEach(() => {
|
|
115
|
+
mkdirSync(TEST_DIR, { recursive: true });
|
|
116
|
+
});
|
|
117
|
+
afterEach(() => {
|
|
118
|
+
if (existsSync(TEST_DIR)) {
|
|
119
|
+
rmSync(TEST_DIR, { recursive: true, force: true });
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
it('creates a job and advances through all steps', async () => {
|
|
123
|
+
const hostAdapter = new LocalHostAdapter();
|
|
124
|
+
await hostAdapter.initialize();
|
|
125
|
+
const runtime = createSquadRuntime({
|
|
126
|
+
artifactsDir: TEST_DIR,
|
|
127
|
+
hostAdapter,
|
|
128
|
+
contextRootPath: TEST_DIR,
|
|
129
|
+
});
|
|
130
|
+
const job = await runtime.startJob(TEST_SQUAD, 'Test objective', 'Implement feature X');
|
|
131
|
+
expect(job.id).toMatch(/^job-/);
|
|
132
|
+
expect(job.status).toBe('READY_FOR_EXECUTION');
|
|
133
|
+
await runtime.runAll(TEST_SQUAD, job);
|
|
134
|
+
// Both steps should have run — job should be COMPLETED
|
|
135
|
+
expect(job.status).toBe('COMPLETED');
|
|
136
|
+
});
|
|
137
|
+
it('persists job state to disk', async () => {
|
|
138
|
+
const hostAdapter = new LocalHostAdapter();
|
|
139
|
+
await hostAdapter.initialize();
|
|
140
|
+
const runtime = createSquadRuntime({
|
|
141
|
+
artifactsDir: TEST_DIR,
|
|
142
|
+
hostAdapter,
|
|
143
|
+
contextRootPath: TEST_DIR,
|
|
144
|
+
});
|
|
145
|
+
const job = await runtime.startJob(TEST_SQUAD, 'Persist test', 'input');
|
|
146
|
+
await runtime.runAll(TEST_SQUAD, job);
|
|
147
|
+
const store = new ArtifactStore(TEST_DIR);
|
|
148
|
+
const loaded = store.loadJob(TEST_SQUAD.id, job.id);
|
|
149
|
+
expect(loaded).not.toBeNull();
|
|
150
|
+
expect(loaded?.id).toBe(job.id);
|
|
151
|
+
expect(loaded?.status).toBe('COMPLETED');
|
|
152
|
+
});
|
|
153
|
+
it('records history events', async () => {
|
|
154
|
+
const hostAdapter = new LocalHostAdapter();
|
|
155
|
+
await hostAdapter.initialize();
|
|
156
|
+
const runtime = createSquadRuntime({
|
|
157
|
+
artifactsDir: TEST_DIR,
|
|
158
|
+
hostAdapter,
|
|
159
|
+
contextRootPath: TEST_DIR,
|
|
160
|
+
});
|
|
161
|
+
const job = await runtime.startJob(TEST_SQUAD, 'History test', 'input');
|
|
162
|
+
await runtime.runAll(TEST_SQUAD, job);
|
|
163
|
+
expect(job.history.length).toBeGreaterThan(0);
|
|
164
|
+
expect(job.history.some((e) => e.type === 'state_transition')).toBe(true);
|
|
165
|
+
});
|
|
166
|
+
it('blocks step requiring approval without it', async () => {
|
|
167
|
+
const squadWithApproval = {
|
|
168
|
+
...TEST_SQUAD,
|
|
169
|
+
id: 'test-approval-squad',
|
|
170
|
+
workflow: {
|
|
171
|
+
...TEST_SQUAD.workflow,
|
|
172
|
+
steps: [
|
|
173
|
+
{
|
|
174
|
+
...TEST_SQUAD.workflow.steps[0],
|
|
175
|
+
requiresApprovalBefore: true,
|
|
176
|
+
},
|
|
177
|
+
...TEST_SQUAD.workflow.steps.slice(1),
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
const hostAdapter = new LocalHostAdapter();
|
|
182
|
+
await hostAdapter.initialize();
|
|
183
|
+
const runtime = createSquadRuntime({
|
|
184
|
+
artifactsDir: TEST_DIR,
|
|
185
|
+
hostAdapter,
|
|
186
|
+
contextRootPath: TEST_DIR,
|
|
187
|
+
});
|
|
188
|
+
const job = await runtime.startJob(squadWithApproval, 'Approval test', 'input');
|
|
189
|
+
await runtime.runAll(squadWithApproval, job);
|
|
190
|
+
expect(job.status).toBe('WAITING_APPROVAL');
|
|
191
|
+
expect(job.approvals.some((a) => a.status === 'pending')).toBe(true);
|
|
192
|
+
});
|
|
193
|
+
it('lists jobs after execution', async () => {
|
|
194
|
+
const hostAdapter = new LocalHostAdapter();
|
|
195
|
+
await hostAdapter.initialize();
|
|
196
|
+
const runtime = createSquadRuntime({
|
|
197
|
+
artifactsDir: TEST_DIR,
|
|
198
|
+
hostAdapter,
|
|
199
|
+
contextRootPath: TEST_DIR,
|
|
200
|
+
});
|
|
201
|
+
const job = await runtime.startJob(TEST_SQUAD, 'List test', 'input');
|
|
202
|
+
await runtime.runAll(TEST_SQUAD, job);
|
|
203
|
+
const jobs = runtime.listJobs(TEST_SQUAD.id);
|
|
204
|
+
expect(jobs).toContain(job.id);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
//# sourceMappingURL=software-squad.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"software-squad.test.js","sourceRoot":"","sources":["../../../tests/integration/software-squad.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAA;AAGpF,MAAM,QAAQ,GAAG,wBAAwB,CAAA;AAEzC,iDAAiD;AACjD,MAAM,UAAU,GAAoB;IAClC,EAAE,EAAE,mBAAmB;IACvB,IAAI,EAAE,yBAAyB;IAC/B,MAAM,EAAE,sBAAsB;IAC9B,SAAS,EAAE,wBAAwB;IACnC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C1C,MAAM,WAAW,CAAC,UAAU,EAAE,CAAA;QAE9B,MAAM,OAAO,GAAG,kBAAkB,CAAC;YACjC,YAAY,EAAE,QAAQ;YACtB,WAAW;YACX,eAAe,EAAE,QAAQ;SAC1B,CAAC,CAAA;QAEF,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;QACpE,MAAM,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;QAErC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;QAC5C,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-store.test.d.ts","sourceRoot":"","sources":["../../../tests/unit/artifact-store.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { mkdirSync, rmSync, existsSync } from 'node:fs';
|
|
3
|
+
import { ArtifactStore } from '../../orchestrator/artifacts/artifact-store.js';
|
|
4
|
+
const TEST_DIR = '/tmp/squad-foundry-test-artifacts';
|
|
5
|
+
function makeJob() {
|
|
6
|
+
return {
|
|
7
|
+
id: 'job-test-001',
|
|
8
|
+
squadId: 'squad-test',
|
|
9
|
+
status: 'RUNNING_STEP',
|
|
10
|
+
objective: 'Test job',
|
|
11
|
+
initialInput: 'test',
|
|
12
|
+
loadedContext: { docs: [], specs: [], playbooks: [], policies: [], templates: [], custom: [] },
|
|
13
|
+
artifacts: [],
|
|
14
|
+
approvals: [],
|
|
15
|
+
currentStepId: 'step-1',
|
|
16
|
+
currentAgentId: 'agent-1',
|
|
17
|
+
history: [],
|
|
18
|
+
startedAt: new Date().toISOString(),
|
|
19
|
+
updatedAt: new Date().toISOString(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
describe('ArtifactStore', () => {
|
|
23
|
+
let store;
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
mkdirSync(TEST_DIR, { recursive: true });
|
|
26
|
+
store = new ArtifactStore(TEST_DIR);
|
|
27
|
+
});
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
if (existsSync(TEST_DIR)) {
|
|
30
|
+
rmSync(TEST_DIR, { recursive: true, force: true });
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
it('saves and loads a job', () => {
|
|
34
|
+
const job = makeJob();
|
|
35
|
+
store.saveJob(job);
|
|
36
|
+
const loaded = store.loadJob('squad-test', 'job-test-001');
|
|
37
|
+
expect(loaded).not.toBeNull();
|
|
38
|
+
expect(loaded?.id).toBe('job-test-001');
|
|
39
|
+
expect(loaded?.status).toBe('RUNNING_STEP');
|
|
40
|
+
});
|
|
41
|
+
it('returns null for missing jobs', () => {
|
|
42
|
+
const loaded = store.loadJob('nonexistent', 'job-x');
|
|
43
|
+
expect(loaded).toBeNull();
|
|
44
|
+
});
|
|
45
|
+
it('lists jobs for a squad', () => {
|
|
46
|
+
const job = makeJob();
|
|
47
|
+
store.saveJob(job);
|
|
48
|
+
const list = store.listJobs('squad-test');
|
|
49
|
+
expect(list).toContain('job-test-001');
|
|
50
|
+
});
|
|
51
|
+
it('returns empty list for squad with no jobs', () => {
|
|
52
|
+
const list = store.listJobs('empty-squad');
|
|
53
|
+
expect(list).toHaveLength(0);
|
|
54
|
+
});
|
|
55
|
+
it('appends and loads handoffs', () => {
|
|
56
|
+
const job = makeJob();
|
|
57
|
+
store.saveJob(job);
|
|
58
|
+
const handoff = {
|
|
59
|
+
id: 'handoff-1',
|
|
60
|
+
jobId: job.id,
|
|
61
|
+
fromAgentId: 'agent-a',
|
|
62
|
+
toAgentId: 'agent-b',
|
|
63
|
+
fromStepId: 'step-1',
|
|
64
|
+
toStepId: 'step-2',
|
|
65
|
+
condition: 'complete',
|
|
66
|
+
payload: { summary: 'done', artifacts: [] },
|
|
67
|
+
timestamp: new Date().toISOString(),
|
|
68
|
+
requiresApproval: false,
|
|
69
|
+
approved: true,
|
|
70
|
+
};
|
|
71
|
+
store.appendHandoff('squad-test', 'job-test-001', handoff);
|
|
72
|
+
const loaded = store.loadHandoffs('squad-test', 'job-test-001');
|
|
73
|
+
expect(loaded).toHaveLength(1);
|
|
74
|
+
expect(loaded[0]?.id).toBe('handoff-1');
|
|
75
|
+
});
|
|
76
|
+
it('appends multiple events', () => {
|
|
77
|
+
const job = makeJob();
|
|
78
|
+
store.saveJob(job);
|
|
79
|
+
const event1 = {
|
|
80
|
+
timestamp: new Date().toISOString(),
|
|
81
|
+
type: 'info',
|
|
82
|
+
message: 'Event 1',
|
|
83
|
+
};
|
|
84
|
+
const event2 = {
|
|
85
|
+
timestamp: new Date().toISOString(),
|
|
86
|
+
type: 'state_transition',
|
|
87
|
+
message: 'Event 2',
|
|
88
|
+
fromStatus: 'RUNNING_STEP',
|
|
89
|
+
toStatus: 'COMPLETED',
|
|
90
|
+
};
|
|
91
|
+
store.appendEvent('squad-test', 'job-test-001', event1);
|
|
92
|
+
store.appendEvent('squad-test', 'job-test-001', event2);
|
|
93
|
+
const events = store.loadEvents('squad-test', 'job-test-001');
|
|
94
|
+
expect(events).toHaveLength(2);
|
|
95
|
+
});
|
|
96
|
+
it('saves and loads approvals', () => {
|
|
97
|
+
const job = makeJob();
|
|
98
|
+
store.saveJob(job);
|
|
99
|
+
store.saveApprovals('squad-test', 'job-test-001', [
|
|
100
|
+
{
|
|
101
|
+
id: 'approval-1',
|
|
102
|
+
stepId: 'step-deploy',
|
|
103
|
+
requiredFor: 'deploy',
|
|
104
|
+
status: 'pending',
|
|
105
|
+
requestedAt: new Date().toISOString(),
|
|
106
|
+
},
|
|
107
|
+
]);
|
|
108
|
+
const approvals = store.loadApprovals('squad-test', 'job-test-001');
|
|
109
|
+
expect(approvals).toHaveLength(1);
|
|
110
|
+
expect(approvals[0]?.status).toBe('pending');
|
|
111
|
+
});
|
|
112
|
+
it('persists an artifact and returns a ref', () => {
|
|
113
|
+
const job = makeJob();
|
|
114
|
+
store.saveJob(job);
|
|
115
|
+
const ref = store.persistArtifact('squad-test', 'job-test-001', { name: 'prd', content: '# PRD Content', format: 'markdown' }, 'product-agent', 'step-product');
|
|
116
|
+
expect(ref.name).toBe('prd');
|
|
117
|
+
expect(ref.path).toContain('prd');
|
|
118
|
+
expect(ref.producedByAgentId).toBe('product-agent');
|
|
119
|
+
expect(existsSync(ref.path)).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
it('lists artifacts in the outputs directory', () => {
|
|
122
|
+
const job = makeJob();
|
|
123
|
+
store.saveJob(job);
|
|
124
|
+
store.persistArtifact('squad-test', 'job-test-001', { name: 'doc1', content: 'c1', format: 'text' }, 'a', 's');
|
|
125
|
+
store.persistArtifact('squad-test', 'job-test-001', { name: 'doc2', content: 'c2', format: 'text' }, 'a', 's');
|
|
126
|
+
const list = store.listArtifacts('squad-test', 'job-test-001');
|
|
127
|
+
expect(list.length).toBe(2);
|
|
128
|
+
});
|
|
129
|
+
it('saves a report to the reports directory', () => {
|
|
130
|
+
const job = makeJob();
|
|
131
|
+
store.saveJob(job);
|
|
132
|
+
const path = store.saveReport('squad-test', 'job-test-001', 'final-report', '# Final Report\nAll done.');
|
|
133
|
+
expect(existsSync(path)).toBe(true);
|
|
134
|
+
expect(path).toContain('final-report.md');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=artifact-store.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-store.test.js","sourceRoot":"","sources":["../../../tests/unit/artifact-store.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACp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,CAAC,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,2BAA2B,CAAC,CAAA;QACxG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;IAC3C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-loader.test.d.ts","sourceRoot":"","sources":["../../../tests/unit/context-loader.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { ContextLoader } from '../../orchestrator/context/context-loader.js';
|
|
3
|
+
import { ContextIndex } from '../../orchestrator/context/context-index.js';
|
|
4
|
+
function makeContext(overrides = {}) {
|
|
5
|
+
return {
|
|
6
|
+
docs: [],
|
|
7
|
+
specs: [],
|
|
8
|
+
playbooks: [],
|
|
9
|
+
policies: [],
|
|
10
|
+
templates: [],
|
|
11
|
+
custom: [],
|
|
12
|
+
...overrides,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
describe('ContextLoader static helpers', () => {
|
|
16
|
+
it('formats empty context gracefully', () => {
|
|
17
|
+
const ctx = makeContext();
|
|
18
|
+
const result = ContextLoader.formatContextForPrompt(ctx);
|
|
19
|
+
expect(result).toContain('_(No context files found)_');
|
|
20
|
+
});
|
|
21
|
+
it('includes PROJECT.md in formatted output', () => {
|
|
22
|
+
const ctx = makeContext({ projectMd: '# My Project\nDetails here.' });
|
|
23
|
+
const result = ContextLoader.formatContextForPrompt(ctx);
|
|
24
|
+
expect(result).toContain('PROJECT.md');
|
|
25
|
+
expect(result).toContain('My Project');
|
|
26
|
+
});
|
|
27
|
+
it('includes TASKS.md in formatted output', () => {
|
|
28
|
+
const ctx = makeContext({ tasksMd: '# Tasks\n- [ ] Task 1' });
|
|
29
|
+
const result = ContextLoader.formatContextForPrompt(ctx);
|
|
30
|
+
expect(result).toContain('TASKS.md');
|
|
31
|
+
expect(result).toContain('Task 1');
|
|
32
|
+
});
|
|
33
|
+
it('includes docs files in formatted output', () => {
|
|
34
|
+
const ctx = makeContext({
|
|
35
|
+
docs: [{ path: 'docs/api.md', content: '# API Docs', loadedAt: new Date().toISOString() }],
|
|
36
|
+
});
|
|
37
|
+
const result = ContextLoader.formatContextForPrompt(ctx);
|
|
38
|
+
expect(result).toContain('docs/api.md');
|
|
39
|
+
expect(result).toContain('API Docs');
|
|
40
|
+
});
|
|
41
|
+
it('describes context accurately', () => {
|
|
42
|
+
const ctx = makeContext({
|
|
43
|
+
projectMd: '# Project',
|
|
44
|
+
tasksMd: '# Tasks',
|
|
45
|
+
docs: [{ path: 'docs/x.md', content: 'x', loadedAt: '' }],
|
|
46
|
+
});
|
|
47
|
+
const desc = ContextLoader.describeContext(ctx);
|
|
48
|
+
expect(desc).toContain('PROJECT.md');
|
|
49
|
+
expect(desc).toContain('TASKS.md');
|
|
50
|
+
expect(desc).toContain('1 doc(s)');
|
|
51
|
+
});
|
|
52
|
+
it('returns none for completely empty context', () => {
|
|
53
|
+
const ctx = makeContext();
|
|
54
|
+
const desc = ContextLoader.describeContext(ctx);
|
|
55
|
+
expect(desc).toBe('none');
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe('ContextIndex', () => {
|
|
59
|
+
it('indexes project and tasks files', () => {
|
|
60
|
+
const ctx = makeContext({
|
|
61
|
+
projectMd: '# Project Content',
|
|
62
|
+
tasksMd: '# Tasks Content',
|
|
63
|
+
});
|
|
64
|
+
const index = new ContextIndex(ctx);
|
|
65
|
+
expect(index.getProjectMd()).toBe('# Project Content');
|
|
66
|
+
expect(index.getTasksMd()).toBe('# Tasks Content');
|
|
67
|
+
});
|
|
68
|
+
it('returns files by category', () => {
|
|
69
|
+
const ctx = makeContext({
|
|
70
|
+
docs: [
|
|
71
|
+
{ path: 'docs/a.md', content: 'doc a', loadedAt: '' },
|
|
72
|
+
{ path: 'docs/b.md', content: 'doc b', loadedAt: '' },
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
const index = new ContextIndex(ctx);
|
|
76
|
+
const docs = index.byCategory('docs');
|
|
77
|
+
expect(docs).toHaveLength(2);
|
|
78
|
+
});
|
|
79
|
+
it('searches across all content', () => {
|
|
80
|
+
const ctx = makeContext({
|
|
81
|
+
projectMd: '# My Special Project',
|
|
82
|
+
docs: [{ path: 'docs/api.md', content: 'API endpoints', loadedAt: '' }],
|
|
83
|
+
});
|
|
84
|
+
const index = new ContextIndex(ctx);
|
|
85
|
+
const results = index.search('Special');
|
|
86
|
+
expect(results.some((f) => f.path === 'PROJECT.md')).toBe(true);
|
|
87
|
+
const apiResults = index.search('API');
|
|
88
|
+
expect(apiResults.some((f) => f.path === 'docs/api.md')).toBe(true);
|
|
89
|
+
});
|
|
90
|
+
it('reports isEmpty correctly', () => {
|
|
91
|
+
expect(new ContextIndex(makeContext()).isEmpty()).toBe(true);
|
|
92
|
+
expect(new ContextIndex(makeContext({ projectMd: '# P' })).isEmpty()).toBe(false);
|
|
93
|
+
});
|
|
94
|
+
it('reports hasCoreContext correctly', () => {
|
|
95
|
+
expect(new ContextIndex(makeContext()).hasCoreContext()).toBe(false);
|
|
96
|
+
expect(new ContextIndex(makeContext({ projectMd: '# P' })).hasCoreContext()).toBe(true);
|
|
97
|
+
});
|
|
98
|
+
it('returns stats', () => {
|
|
99
|
+
const ctx = makeContext({
|
|
100
|
+
projectMd: 'p',
|
|
101
|
+
docs: [{ path: 'd.md', content: 'd', loadedAt: '' }],
|
|
102
|
+
});
|
|
103
|
+
const stats = new ContextIndex(ctx).stats();
|
|
104
|
+
expect(stats['total']).toBe(2);
|
|
105
|
+
expect(stats['project']).toBe(1);
|
|
106
|
+
expect(stats['docs']).toBe(1);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=context-loader.test.js.map
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C,WAAW,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACpE,MAAM,CAAC,IAAI,YAAY,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACzF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;QACvB,MAAM,GAAG,GAAG,WAAW,CAAC;YACtB,SAAS,EAAE,GAAG;YACd,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;SACrD,CAAC,CAAA;QACF,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;QAC3C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAC9B,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-native-docs.test.d.ts","sourceRoot":"","sources":["../../../../tests/unit/docs/host-native-docs.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
describe('host-native documentation', () => {
|
|
5
|
+
it('documents init command and host-native resolution in README', () => {
|
|
6
|
+
const readme = readFileSync(join(process.cwd(), 'README.md'), 'utf-8');
|
|
7
|
+
expect(readme).toContain('squad-foundry init');
|
|
8
|
+
expect(readme.toLowerCase()).toContain('host-native');
|
|
9
|
+
});
|
|
10
|
+
it('documents detection and resolution reference doc', () => {
|
|
11
|
+
const doc = readFileSync(join(process.cwd(), 'docs', 'development', 'host-detection-and-resolution.md'), 'utf-8');
|
|
12
|
+
expect(doc).toContain('ActiveHostDetector');
|
|
13
|
+
expect(doc).toContain('HostResolutionService');
|
|
14
|
+
expect(doc).toContain('runtime-metadata.json');
|
|
15
|
+
expect(doc).toContain('SQUAD_FOUNDRY_ADAPTER');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=host-native-docs.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-native-docs.test.js","sourceRoot":"","sources":["../../../../tests/unit/docs/host-native-docs.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,CAAA;QACtE,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAA;QAC9C,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;IACvD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,GAAG,GAAG,YAAY,CACtB,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,kCAAkC,CAAC,EAC9E,OAAO,CACR,CAAA;QACD,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAA;QAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAA;QAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAA;QAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrails.test.d.ts","sourceRoot":"","sources":["../../../tests/unit/guardrails.test.ts"],"names":[],"mappings":""}
|