@bradygaster/squad-sdk 0.9.1 → 0.9.2-insider.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/README.md +340 -296
- package/dist/agents/history-shadow.d.ts +7 -5
- package/dist/agents/history-shadow.d.ts.map +1 -1
- package/dist/agents/history-shadow.js +69 -78
- package/dist/agents/history-shadow.js.map +1 -1
- package/dist/agents/index.d.ts +12 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +62 -9
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/lifecycle.d.ts +4 -0
- package/dist/agents/lifecycle.d.ts.map +1 -1
- package/dist/agents/lifecycle.js +6 -7
- package/dist/agents/lifecycle.js.map +1 -1
- package/dist/agents/onboarding.d.ts +4 -2
- package/dist/agents/onboarding.d.ts.map +1 -1
- package/dist/agents/onboarding.js +26 -16
- package/dist/agents/onboarding.js.map +1 -1
- package/dist/agents/personal.d.ts +2 -1
- package/dist/agents/personal.d.ts.map +1 -1
- package/dist/agents/personal.js +11 -12
- package/dist/agents/personal.js.map +1 -1
- package/dist/build/bundle.d.ts.map +1 -1
- package/dist/build/bundle.js +6 -6
- package/dist/build/bundle.js.map +1 -1
- package/dist/build/github-dist.js +42 -42
- package/dist/build/release.d.ts.map +1 -1
- package/dist/build/release.js +7 -5
- package/dist/build/release.js.map +1 -1
- package/dist/casting/index.d.ts.map +1 -1
- package/dist/casting/index.js +4 -3
- package/dist/casting/index.js.map +1 -1
- package/dist/config/agent-source.d.ts +5 -1
- package/dist/config/agent-source.d.ts.map +1 -1
- package/dist/config/agent-source.js +85 -41
- package/dist/config/agent-source.js.map +1 -1
- package/dist/config/init.d.ts +4 -3
- package/dist/config/init.d.ts.map +1 -1
- package/dist/config/init.js +257 -236
- package/dist/config/init.js.map +1 -1
- package/dist/config/legacy-fallback.d.ts +3 -2
- package/dist/config/legacy-fallback.d.ts.map +1 -1
- package/dist/config/legacy-fallback.js +16 -14
- package/dist/config/legacy-fallback.js.map +1 -1
- package/dist/config/models.d.ts +9 -6
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js +35 -25
- package/dist/config/models.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/marketplace/packaging.d.ts.map +1 -1
- package/dist/marketplace/packaging.js +18 -16
- package/dist/marketplace/packaging.js.map +1 -1
- package/dist/multi-squad.d.ts.map +1 -1
- package/dist/multi-squad.js +10 -9
- package/dist/multi-squad.js.map +1 -1
- package/dist/platform/comms-file-log.d.ts.map +1 -1
- package/dist/platform/comms-file-log.js +7 -6
- package/dist/platform/comms-file-log.js.map +1 -1
- package/dist/platform/comms.d.ts.map +1 -1
- package/dist/platform/comms.js +6 -5
- package/dist/platform/comms.js.map +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js +4 -3
- package/dist/platform/index.js.map +1 -1
- package/dist/ralph/capabilities.d.ts +30 -1
- package/dist/ralph/capabilities.d.ts.map +1 -1
- package/dist/ralph/capabilities.js +51 -6
- package/dist/ralph/capabilities.js.map +1 -1
- package/dist/ralph/index.d.ts +1 -1
- package/dist/ralph/index.d.ts.map +1 -1
- package/dist/ralph/index.js +4 -3
- package/dist/ralph/index.js.map +1 -1
- package/dist/ralph/rate-limiting.d.ts.map +1 -1
- package/dist/ralph/rate-limiting.js +4 -4
- package/dist/ralph/rate-limiting.js.map +1 -1
- package/dist/remote/bridge.d.ts.map +1 -1
- package/dist/remote/bridge.js +2 -2
- package/dist/remote/bridge.js.map +1 -1
- package/dist/resolution.d.ts +9 -0
- package/dist/resolution.d.ts.map +1 -1
- package/dist/resolution.js +39 -16
- package/dist/resolution.js.map +1 -1
- package/dist/roles/catalog.d.ts +1 -1
- package/dist/runtime/config.d.ts.map +1 -1
- package/dist/runtime/config.js +8 -7
- package/dist/runtime/config.js.map +1 -1
- package/dist/runtime/cross-squad.d.ts.map +1 -1
- package/dist/runtime/cross-squad.js +8 -7
- package/dist/runtime/cross-squad.js.map +1 -1
- package/dist/runtime/scheduler.d.ts.map +1 -1
- package/dist/runtime/scheduler.js +8 -8
- package/dist/runtime/scheduler.js.map +1 -1
- package/dist/runtime/squad-observer.d.ts.map +1 -1
- package/dist/runtime/squad-observer.js +7 -4
- package/dist/runtime/squad-observer.js.map +1 -1
- package/dist/sharing/consult.d.ts +1 -1
- package/dist/sharing/consult.d.ts.map +1 -1
- package/dist/sharing/consult.js +144 -142
- package/dist/sharing/consult.js.map +1 -1
- package/dist/sharing/export.d.ts.map +1 -1
- package/dist/sharing/export.js +16 -16
- package/dist/sharing/export.js.map +1 -1
- package/dist/sharing/import.d.ts.map +1 -1
- package/dist/sharing/import.js +13 -12
- package/dist/sharing/import.js.map +1 -1
- package/dist/skills/skill-loader.d.ts.map +1 -1
- package/dist/skills/skill-loader.js +10 -9
- package/dist/skills/skill-loader.js.map +1 -1
- package/dist/skills/skill-script-loader.d.ts.map +1 -1
- package/dist/skills/skill-script-loader.js +6 -4
- package/dist/skills/skill-script-loader.js.map +1 -1
- package/dist/skills/skill-source.d.ts +3 -1
- package/dist/skills/skill-source.d.ts.map +1 -1
- package/dist/skills/skill-source.js +18 -16
- package/dist/skills/skill-source.js.map +1 -1
- package/dist/state/collection-map.d.ts +43 -0
- package/dist/state/collection-map.d.ts.map +1 -0
- package/dist/state/collection-map.js +9 -0
- package/dist/state/collection-map.js.map +1 -0
- package/dist/state/collections.d.ts +102 -0
- package/dist/state/collections.d.ts.map +1 -0
- package/dist/state/collections.js +317 -0
- package/dist/state/collections.js.map +1 -0
- package/dist/state/domain-types.d.ts +122 -0
- package/dist/state/domain-types.d.ts.map +1 -0
- package/dist/state/domain-types.js +54 -0
- package/dist/state/domain-types.js.map +1 -0
- package/dist/state/handles.d.ts +16 -0
- package/dist/state/handles.d.ts.map +1 -0
- package/dist/state/handles.js +161 -0
- package/dist/state/handles.js.map +1 -0
- package/dist/state/index.d.ts +17 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +15 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/io/charter-io.d.ts +28 -0
- package/dist/state/io/charter-io.d.ts.map +1 -0
- package/dist/state/io/charter-io.js +94 -0
- package/dist/state/io/charter-io.js.map +1 -0
- package/dist/state/io/decisions-io.d.ts +42 -0
- package/dist/state/io/decisions-io.d.ts.map +1 -0
- package/dist/state/io/decisions-io.js +66 -0
- package/dist/state/io/decisions-io.js.map +1 -0
- package/dist/state/io/history-io.d.ts +37 -0
- package/dist/state/io/history-io.d.ts.map +1 -0
- package/dist/state/io/history-io.js +102 -0
- package/dist/state/io/history-io.js.map +1 -0
- package/dist/state/io/index.d.ts +19 -0
- package/dist/state/io/index.d.ts.map +1 -0
- package/dist/state/io/index.js +19 -0
- package/dist/state/io/index.js.map +1 -0
- package/dist/state/io/routing-io.d.ts +37 -0
- package/dist/state/io/routing-io.d.ts.map +1 -0
- package/dist/state/io/routing-io.js +99 -0
- package/dist/state/io/routing-io.js.map +1 -0
- package/dist/state/io/team-io.d.ts +46 -0
- package/dist/state/io/team-io.d.ts.map +1 -0
- package/dist/state/io/team-io.js +82 -0
- package/dist/state/io/team-io.js.map +1 -0
- package/dist/state/schema.d.ts +24 -0
- package/dist/state/schema.d.ts.map +1 -0
- package/dist/state/schema.js +41 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/state/squad-state.d.ts +42 -0
- package/dist/state/squad-state.d.ts.map +1 -0
- package/dist/state/squad-state.js +68 -0
- package/dist/state/squad-state.js.map +1 -0
- package/dist/storage/fs-storage-provider.d.ts +60 -0
- package/dist/storage/fs-storage-provider.d.ts.map +1 -0
- package/dist/storage/fs-storage-provider.js +377 -0
- package/dist/storage/fs-storage-provider.js.map +1 -0
- package/dist/storage/in-memory-storage-provider.d.ts +46 -0
- package/dist/storage/in-memory-storage-provider.d.ts.map +1 -0
- package/dist/storage/in-memory-storage-provider.js +264 -0
- package/dist/storage/in-memory-storage-provider.js.map +1 -0
- package/dist/storage/index.d.ts +6 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +5 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/sqlite-storage-provider.d.ts +95 -0
- package/dist/storage/sqlite-storage-provider.d.ts.map +1 -0
- package/dist/storage/sqlite-storage-provider.js +383 -0
- package/dist/storage/sqlite-storage-provider.js.map +1 -0
- package/dist/storage/storage-error.d.ts +28 -0
- package/dist/storage/storage-error.d.ts.map +1 -0
- package/dist/storage/storage-error.js +35 -0
- package/dist/storage/storage-error.js.map +1 -0
- package/dist/storage/storage-provider.d.ts +161 -0
- package/dist/storage/storage-provider.d.ts.map +1 -0
- package/dist/storage/storage-provider.js +18 -0
- package/dist/storage/storage-provider.js.map +1 -0
- package/dist/streams/resolver.d.ts.map +1 -1
- package/dist/streams/resolver.js +6 -5
- package/dist/streams/resolver.js.map +1 -1
- package/dist/tools/index.d.ts +5 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +54 -15
- package/dist/tools/index.js.map +1 -1
- package/dist/upstream/resolver.d.ts +3 -2
- package/dist/upstream/resolver.d.ts.map +1 -1
- package/dist/upstream/resolver.js +33 -32
- package/dist/upstream/resolver.js.map +1 -1
- package/package.json +33 -1
- package/templates/casting/Futurama.json +9 -9
- package/templates/casting-history.json +4 -4
- package/templates/casting-policy.json +37 -37
- package/templates/casting-reference.md +104 -104
- package/templates/casting-registry.json +3 -3
- package/templates/ceremonies.md +41 -41
- package/templates/charter.md +53 -53
- package/templates/constraint-tracking.md +38 -38
- package/templates/cooperative-rate-limiting.md +229 -229
- package/templates/copilot-instructions.md +46 -46
- package/templates/history.md +10 -10
- package/templates/identity/now.md +9 -9
- package/templates/identity/wisdom.md +15 -15
- package/templates/issue-lifecycle.md +412 -412
- package/templates/keda-scaler.md +164 -164
- package/templates/machine-capabilities.md +74 -74
- package/templates/mcp-config.md +90 -90
- package/templates/multi-agent-format.md +28 -28
- package/templates/plugin-marketplace.md +49 -49
- package/templates/ralph-circuit-breaker.md +313 -313
- package/templates/raw-agent-output.md +37 -37
- package/templates/roster.md +60 -60
- package/templates/routing.md +39 -39
- package/templates/run-output.md +50 -50
- package/templates/schedule.json +19 -19
- package/templates/scribe-charter.md +123 -119
- package/templates/skill.md +24 -24
- package/templates/skills/agent-collaboration/SKILL.md +42 -42
- package/templates/skills/agent-conduct/SKILL.md +24 -24
- package/templates/skills/architectural-proposals/SKILL.md +151 -151
- package/templates/skills/ci-validation-gates/SKILL.md +84 -84
- package/templates/skills/cli-wiring/SKILL.md +47 -47
- package/templates/skills/client-compatibility/SKILL.md +89 -89
- package/templates/skills/cross-machine-coordination/SKILL.md +434 -0
- package/templates/skills/cross-squad/SKILL.md +114 -114
- package/templates/skills/distributed-mesh/SKILL.md +287 -287
- package/templates/skills/distributed-mesh/mesh.json.example +30 -30
- package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -111
- package/templates/skills/distributed-mesh/sync-mesh.sh +104 -104
- package/templates/skills/docs-standards/SKILL.md +71 -71
- package/templates/skills/economy-mode/SKILL.md +114 -114
- package/templates/skills/error-recovery/SKILL.md +99 -0
- package/templates/skills/external-comms/SKILL.md +329 -329
- package/templates/skills/gh-auth-isolation/SKILL.md +183 -183
- package/templates/skills/git-workflow/SKILL.md +204 -204
- package/templates/skills/github-multi-account/SKILL.md +95 -95
- package/templates/skills/history-hygiene/SKILL.md +36 -36
- package/templates/skills/humanizer/SKILL.md +105 -105
- package/templates/skills/init-mode/SKILL.md +102 -102
- package/templates/skills/iterative-retrieval/SKILL.md +165 -0
- package/templates/skills/model-selection/SKILL.md +117 -117
- package/templates/skills/nap/SKILL.md +24 -24
- package/templates/skills/notification-routing/SKILL.md +105 -0
- package/templates/skills/personal-squad/SKILL.md +57 -57
- package/templates/skills/pr-screenshots/SKILL.md +149 -0
- package/templates/skills/project-conventions/SKILL.md +56 -56
- package/templates/skills/ralph-two-pass-scan/SKILL.md +35 -0
- package/templates/skills/reflect/SKILL.md +229 -0
- package/templates/skills/release-process/SKILL.md +131 -423
- package/templates/skills/reskill/SKILL.md +92 -92
- package/templates/skills/retro-enforcement/SKILL.md +148 -0
- package/templates/skills/reviewer-protocol/SKILL.md +79 -79
- package/templates/skills/secret-handling/SKILL.md +200 -200
- package/templates/skills/session-recovery/SKILL.md +155 -155
- package/templates/skills/squad-conventions/SKILL.md +69 -69
- package/templates/skills/test-discipline/SKILL.md +37 -37
- package/templates/skills/tiered-memory/SKILL.md +234 -0
- package/templates/skills/windows-compatibility/SKILL.md +98 -74
- package/templates/{squad.agent.md → squad.agent.md.template} +57 -28
- package/templates/workflows/squad-ci.yml +24 -24
- package/templates/workflows/squad-docs.yml +54 -54
- package/templates/workflows/squad-heartbeat.yml +167 -171
- package/templates/workflows/squad-insider-release.yml +61 -61
- package/templates/workflows/squad-issue-assign.yml +161 -161
- package/templates/workflows/squad-label-enforce.yml +181 -181
- package/templates/workflows/squad-preview.yml +55 -55
- package/templates/workflows/squad-promote.yml +120 -120
- package/templates/workflows/squad-release.yml +77 -77
- package/templates/workflows/squad-triage.yml +260 -260
- package/templates/workflows/sync-squad-labels.yml +169 -169
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decisions Markdown I/O — parse and serialize decisions.md files.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing `parseDecisionsMarkdown()` from markdown-migration.ts
|
|
5
|
+
* and adds serialization for round-trip support.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io/decisions-io
|
|
8
|
+
*/
|
|
9
|
+
import { parseDecisionsMarkdown } from '../../config/markdown-migration.js';
|
|
10
|
+
/**
|
|
11
|
+
* Parse decisions markdown into typed decision entries.
|
|
12
|
+
* Delegates to the existing `parseDecisionsMarkdown()`.
|
|
13
|
+
*/
|
|
14
|
+
export function parseDecisions(markdown) {
|
|
15
|
+
const { decisions } = parseDecisionsMarkdown(markdown);
|
|
16
|
+
return decisions;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Serialize a single decision entry to markdown.
|
|
20
|
+
*
|
|
21
|
+
* Format:
|
|
22
|
+
* ```
|
|
23
|
+
* ### YYYY-MM-DD: Title
|
|
24
|
+
* **By:** author
|
|
25
|
+
* body content
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function serializeDecision(decision) {
|
|
29
|
+
const level = decision.headingLevel ?? 3;
|
|
30
|
+
const hashes = '#'.repeat(level);
|
|
31
|
+
// Heading with optional date prefix
|
|
32
|
+
const datePrefix = decision.date ? `${decision.date}: ` : '';
|
|
33
|
+
const lines = [`${hashes} ${datePrefix}${decision.title}`];
|
|
34
|
+
// Body — author line is already embedded in body from the parser,
|
|
35
|
+
// but if body doesn't contain **By:** and author is set, prepend it
|
|
36
|
+
const bodyHasAuthor = /\*\*By:\*\*/i.test(decision.body);
|
|
37
|
+
if (decision.author && !bodyHasAuthor) {
|
|
38
|
+
lines.push(`**By:** ${decision.author}`);
|
|
39
|
+
}
|
|
40
|
+
if (decision.body) {
|
|
41
|
+
lines.push(decision.body);
|
|
42
|
+
}
|
|
43
|
+
return lines.join('\n');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Serialize an array of decisions to a full decisions.md file.
|
|
47
|
+
*
|
|
48
|
+
* Produces:
|
|
49
|
+
* ```
|
|
50
|
+
* # Decisions
|
|
51
|
+
*
|
|
52
|
+
* ### 2026-01-15: First Decision
|
|
53
|
+
* ...
|
|
54
|
+
*
|
|
55
|
+
* ### 2026-02-01: Second Decision
|
|
56
|
+
* ...
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export function serializeDecisions(decisions) {
|
|
60
|
+
if (decisions.length === 0) {
|
|
61
|
+
return '# Decisions\n';
|
|
62
|
+
}
|
|
63
|
+
const sections = decisions.map((d) => serializeDecision(d));
|
|
64
|
+
return `# Decisions\n\n${sections.join('\n\n')}\n`;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=decisions-io.js.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ACH,MAAM,UAAU,kBAAkB,CAAC,SAA2B;IAC5D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,OAAO,kBAAkB,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* History Markdown I/O — parse and serialize history.md files.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing section-parsing logic from history-shadow.ts
|
|
5
|
+
* and adds serialization for round-trip support.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io/history-io
|
|
8
|
+
*/
|
|
9
|
+
import type { ParsedHistory, HistorySection } from '../../agents/history-shadow.js';
|
|
10
|
+
export type { ParsedHistory, HistorySection };
|
|
11
|
+
/**
|
|
12
|
+
* Parse history markdown into typed sections.
|
|
13
|
+
*
|
|
14
|
+
* Mirrors the section-extraction logic in `readHistory()` from
|
|
15
|
+
* history-shadow.ts but operates purely on a string (no filesystem).
|
|
16
|
+
*
|
|
17
|
+
* Note: the original regex uses `\Z` which is not a valid JS anchor.
|
|
18
|
+
* We use an explicit section-split approach to correctly handle the
|
|
19
|
+
* last section in the file.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseHistory(markdown: string): ParsedHistory;
|
|
22
|
+
/**
|
|
23
|
+
* Serialize a ParsedHistory back to markdown.
|
|
24
|
+
*
|
|
25
|
+
* Reconstructs the history.md with `# AgentName` header and `## Section` blocks.
|
|
26
|
+
*/
|
|
27
|
+
export declare function serializeHistory(history: ParsedHistory): string;
|
|
28
|
+
/**
|
|
29
|
+
* Produce a string fragment for appending a new entry to a history section.
|
|
30
|
+
*
|
|
31
|
+
* @param section - Target section name (e.g., 'Learnings')
|
|
32
|
+
* @param entry - Content to append (without date header)
|
|
33
|
+
* @param date - Optional ISO date string (defaults to today)
|
|
34
|
+
* @returns Formatted entry string including `### YYYY-MM-DD` sub-header
|
|
35
|
+
*/
|
|
36
|
+
export declare function serializeHistoryAppend(section: HistorySection, entry: string, date?: string): string;
|
|
37
|
+
//# sourceMappingURL=history-io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-io.d.ts","sourceRoot":"","sources":["../../../src/state/io/history-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGpF,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;AAY9C;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAsC5D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAyB/D;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAGR"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* History Markdown I/O — parse and serialize history.md files.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing section-parsing logic from history-shadow.ts
|
|
5
|
+
* and adds serialization for round-trip support.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io/history-io
|
|
8
|
+
*/
|
|
9
|
+
import { normalizeEol } from '../../utils/normalize-eol.js';
|
|
10
|
+
/** Standard sections in order of appearance. */
|
|
11
|
+
const SECTION_ORDER = [
|
|
12
|
+
{ header: 'Context', key: 'context' },
|
|
13
|
+
{ header: 'Learnings', key: 'learnings' },
|
|
14
|
+
{ header: 'Decisions', key: 'decisions' },
|
|
15
|
+
{ header: 'Patterns', key: 'patterns' },
|
|
16
|
+
{ header: 'Issues', key: 'issues' },
|
|
17
|
+
{ header: 'References', key: 'references' },
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Parse history markdown into typed sections.
|
|
21
|
+
*
|
|
22
|
+
* Mirrors the section-extraction logic in `readHistory()` from
|
|
23
|
+
* history-shadow.ts but operates purely on a string (no filesystem).
|
|
24
|
+
*
|
|
25
|
+
* Note: the original regex uses `\Z` which is not a valid JS anchor.
|
|
26
|
+
* We use an explicit section-split approach to correctly handle the
|
|
27
|
+
* last section in the file.
|
|
28
|
+
*/
|
|
29
|
+
export function parseHistory(markdown) {
|
|
30
|
+
const content = normalizeEol(markdown);
|
|
31
|
+
const parsed = { fullContent: content };
|
|
32
|
+
if (!content || content.trim().length === 0) {
|
|
33
|
+
return parsed;
|
|
34
|
+
}
|
|
35
|
+
// Build a map of h2 section name → content by splitting at ## headers.
|
|
36
|
+
// Uses header start positions as boundaries (avoids the broken \Z anchor
|
|
37
|
+
// in the original readHistory regex).
|
|
38
|
+
const headerRegex = /^##\s+(.+?)\s*$/gm;
|
|
39
|
+
const headers = [];
|
|
40
|
+
let m;
|
|
41
|
+
while ((m = headerRegex.exec(content)) !== null) {
|
|
42
|
+
headers.push({ name: m[1], start: m.index, contentStart: m.index + m[0].length });
|
|
43
|
+
}
|
|
44
|
+
const sectionMap = new Map();
|
|
45
|
+
for (let i = 0; i < headers.length; i++) {
|
|
46
|
+
const hdr = headers[i];
|
|
47
|
+
const nextHdr = headers[i + 1];
|
|
48
|
+
const start = hdr.contentStart;
|
|
49
|
+
const end = nextHdr ? nextHdr.start : content.length;
|
|
50
|
+
const sectionContent = content.substring(start, end).trim();
|
|
51
|
+
if (sectionContent.length > 0) {
|
|
52
|
+
sectionMap.set(hdr.name, sectionContent);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
for (const { header, key } of SECTION_ORDER) {
|
|
56
|
+
const value = sectionMap.get(header);
|
|
57
|
+
if (value !== undefined) {
|
|
58
|
+
parsed[key] = value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return parsed;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Serialize a ParsedHistory back to markdown.
|
|
65
|
+
*
|
|
66
|
+
* Reconstructs the history.md with `# AgentName` header and `## Section` blocks.
|
|
67
|
+
*/
|
|
68
|
+
export function serializeHistory(history) {
|
|
69
|
+
// If fullContent has a title line, extract it; otherwise use a generic header
|
|
70
|
+
const titleMatch = history.fullContent.match(/^#\s+(.+)$/m);
|
|
71
|
+
const lines = [];
|
|
72
|
+
if (titleMatch) {
|
|
73
|
+
lines.push(titleMatch[0]);
|
|
74
|
+
lines.push('');
|
|
75
|
+
}
|
|
76
|
+
for (const { header, key } of SECTION_ORDER) {
|
|
77
|
+
const value = history[key];
|
|
78
|
+
if (value !== undefined && value.length > 0) {
|
|
79
|
+
lines.push(`## ${header}`);
|
|
80
|
+
lines.push('');
|
|
81
|
+
lines.push(value);
|
|
82
|
+
lines.push('');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (lines.length === 0) {
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
return lines.join('\n').trimEnd() + '\n';
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Produce a string fragment for appending a new entry to a history section.
|
|
92
|
+
*
|
|
93
|
+
* @param section - Target section name (e.g., 'Learnings')
|
|
94
|
+
* @param entry - Content to append (without date header)
|
|
95
|
+
* @param date - Optional ISO date string (defaults to today)
|
|
96
|
+
* @returns Formatted entry string including `### YYYY-MM-DD` sub-header
|
|
97
|
+
*/
|
|
98
|
+
export function serializeHistoryAppend(section, entry, date) {
|
|
99
|
+
const dateStr = date ?? new Date().toISOString().split('T')[0];
|
|
100
|
+
return `### ${dateStr}\n\n${entry}\n`;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=history-io.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AE3B,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,aAAa,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAuB,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAuB,EACvB,KAAa,EACb,IAAa;IAEb,MAAM,OAAO,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,OAAO,OAAO,OAAO,OAAO,KAAK,IAAI,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State I/O barrel — Markdown parsers and serializers for .squad/ domain files.
|
|
3
|
+
*
|
|
4
|
+
* Each module handles round-trip I/O for a single document type:
|
|
5
|
+
* parse(markdown) → typed object → serialize(object) → markdown.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io
|
|
8
|
+
*/
|
|
9
|
+
export { parseCharter, serializeCharter } from './charter-io.js';
|
|
10
|
+
export type { ParsedCharter } from './charter-io.js';
|
|
11
|
+
export { parseHistory, serializeHistory, serializeHistoryAppend } from './history-io.js';
|
|
12
|
+
export type { ParsedHistory, HistorySection } from './history-io.js';
|
|
13
|
+
export { parseDecisions, serializeDecision, serializeDecisions } from './decisions-io.js';
|
|
14
|
+
export type { ParsedDecision } from './decisions-io.js';
|
|
15
|
+
export { parseRouting, serializeRouting } from './routing-io.js';
|
|
16
|
+
export type { ParsedRoutingRule, ParsedRouting } from './routing-io.js';
|
|
17
|
+
export { parseTeam, serializeTeam } from './team-io.js';
|
|
18
|
+
export type { ParsedAgent, TeamMetadata, ParsedTeam } from './team-io.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/state/io/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACjE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzF,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC1F,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACjE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGxE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State I/O barrel — Markdown parsers and serializers for .squad/ domain files.
|
|
3
|
+
*
|
|
4
|
+
* Each module handles round-trip I/O for a single document type:
|
|
5
|
+
* parse(markdown) → typed object → serialize(object) → markdown.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io
|
|
8
|
+
*/
|
|
9
|
+
// Charter I/O
|
|
10
|
+
export { parseCharter, serializeCharter } from './charter-io.js';
|
|
11
|
+
// History I/O
|
|
12
|
+
export { parseHistory, serializeHistory, serializeHistoryAppend } from './history-io.js';
|
|
13
|
+
// Decisions I/O
|
|
14
|
+
export { parseDecisions, serializeDecision, serializeDecisions } from './decisions-io.js';
|
|
15
|
+
// Routing I/O
|
|
16
|
+
export { parseRouting, serializeRouting } from './routing-io.js';
|
|
17
|
+
// Team I/O
|
|
18
|
+
export { parseTeam, serializeTeam } from './team-io.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/state/io/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGjE,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAGzF,gBAAgB;AAChB,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1F,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGjE,WAAW;AACX,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing Markdown I/O — parse and serialize routing.md files.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing `parseRoutingRulesMarkdown()` from markdown-migration.ts
|
|
5
|
+
* and adds serialization for round-trip support.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io/routing-io
|
|
8
|
+
*/
|
|
9
|
+
import { type ParsedRoutingRule } from '../../config/markdown-migration.js';
|
|
10
|
+
export type { ParsedRoutingRule };
|
|
11
|
+
/** Result of parsing a routing.md file. */
|
|
12
|
+
export interface ParsedRouting {
|
|
13
|
+
rules: ParsedRoutingRule[];
|
|
14
|
+
moduleOwnership: Map<string, string>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse routing markdown into typed routing rules and module ownership.
|
|
18
|
+
* Delegates rule parsing to `parseRoutingRulesMarkdown()` and also
|
|
19
|
+
* extracts the optional `## Module Ownership` section.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseRouting(markdown: string): ParsedRouting;
|
|
22
|
+
/**
|
|
23
|
+
* Serialize routing rules to a full routing.md file.
|
|
24
|
+
*
|
|
25
|
+
* Produces:
|
|
26
|
+
* ```
|
|
27
|
+
* # Routing Rules
|
|
28
|
+
*
|
|
29
|
+
* ## Routing Table
|
|
30
|
+
*
|
|
31
|
+
* | Work Type | Agent | Examples |
|
|
32
|
+
* |-----------|-------|----------|
|
|
33
|
+
* | feature-dev | Lead | New features |
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function serializeRouting(rules: ParsedRoutingRule[]): string;
|
|
37
|
+
//# sourceMappingURL=routing-io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-io.d.ts","sourceRoot":"","sources":["../../../src/state/io/routing-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvG,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,2CAA2C;AAC3C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAwDD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAI5D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAkBnE"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing Markdown I/O — parse and serialize routing.md files.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing `parseRoutingRulesMarkdown()` from markdown-migration.ts
|
|
5
|
+
* and adds serialization for round-trip support.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io/routing-io
|
|
8
|
+
*/
|
|
9
|
+
import { parseRoutingRulesMarkdown } from '../../config/markdown-migration.js';
|
|
10
|
+
import { normalizeEol } from '../../utils/normalize-eol.js';
|
|
11
|
+
/**
|
|
12
|
+
* Parse a `## Module Ownership` table into a Map<module, owner>.
|
|
13
|
+
*
|
|
14
|
+
* Expected format:
|
|
15
|
+
* ```markdown
|
|
16
|
+
* ## Module Ownership
|
|
17
|
+
*
|
|
18
|
+
* | Module | Owner |
|
|
19
|
+
* |--------|-------|
|
|
20
|
+
* | src/storage/ | EECOM |
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function parseModuleOwnership(markdown) {
|
|
24
|
+
const map = new Map();
|
|
25
|
+
const lines = normalizeEol(markdown).split('\n');
|
|
26
|
+
let inSection = false;
|
|
27
|
+
let headerPassed = false;
|
|
28
|
+
for (const line of lines) {
|
|
29
|
+
const trimmed = line.trim();
|
|
30
|
+
if (/^##\s+module\s+ownership/i.test(trimmed)) {
|
|
31
|
+
inSection = true;
|
|
32
|
+
headerPassed = false;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
// Another ## heading ends the section
|
|
36
|
+
if (inSection && /^##\s+/.test(trimmed) && !/module\s+ownership/i.test(trimmed)) {
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
if (!inSection || !trimmed.startsWith('|'))
|
|
40
|
+
continue;
|
|
41
|
+
// Detect header row (contains "module" or "owner")
|
|
42
|
+
if (!headerPassed && /module|owner/i.test(trimmed)) {
|
|
43
|
+
headerPassed = true;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
// Skip separator row
|
|
47
|
+
if (/^[|:\-\s]+$/.test(trimmed))
|
|
48
|
+
continue;
|
|
49
|
+
if (!headerPassed)
|
|
50
|
+
continue;
|
|
51
|
+
const cells = trimmed.split('|').map((c) => c.trim()).filter(Boolean);
|
|
52
|
+
if (cells.length >= 2 && cells[0] && cells[1]) {
|
|
53
|
+
map.set(cells[0], cells[1]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return map;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse routing markdown into typed routing rules and module ownership.
|
|
60
|
+
* Delegates rule parsing to `parseRoutingRulesMarkdown()` and also
|
|
61
|
+
* extracts the optional `## Module Ownership` section.
|
|
62
|
+
*/
|
|
63
|
+
export function parseRouting(markdown) {
|
|
64
|
+
const { rules } = parseRoutingRulesMarkdown(markdown);
|
|
65
|
+
const moduleOwnership = parseModuleOwnership(markdown);
|
|
66
|
+
return { rules, moduleOwnership };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Serialize routing rules to a full routing.md file.
|
|
70
|
+
*
|
|
71
|
+
* Produces:
|
|
72
|
+
* ```
|
|
73
|
+
* # Routing Rules
|
|
74
|
+
*
|
|
75
|
+
* ## Routing Table
|
|
76
|
+
*
|
|
77
|
+
* | Work Type | Agent | Examples |
|
|
78
|
+
* |-----------|-------|----------|
|
|
79
|
+
* | feature-dev | Lead | New features |
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export function serializeRouting(rules) {
|
|
83
|
+
const lines = [
|
|
84
|
+
'# Routing Rules',
|
|
85
|
+
'',
|
|
86
|
+
'## Routing Table',
|
|
87
|
+
'',
|
|
88
|
+
'| Work Type | Agent | Examples |',
|
|
89
|
+
'|-----------|-------|----------|',
|
|
90
|
+
];
|
|
91
|
+
for (const rule of rules) {
|
|
92
|
+
const agents = rule.agents.join(', ');
|
|
93
|
+
const examples = rule.examples ? rule.examples.join(', ') : '';
|
|
94
|
+
lines.push(`| ${rule.workType} | ${agents} | ${examples} |`);
|
|
95
|
+
}
|
|
96
|
+
lines.push('');
|
|
97
|
+
return lines.join('\n');
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=routing-io.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing-io.js","sourceRoot":"","sources":["../../../src/state/io/routing-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,yBAAyB,EAA0B,MAAM,oCAAoC,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAU5D;;;;;;;;;;;GAWG;AACH,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAE5B,IAAI,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9C,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,GAAG,KAAK,CAAC;YACrB,SAAS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UAAU,gBAAgB,CAAC,KAA0B;IACzD,MAAM,KAAK,GAAa;QACtB,iBAAiB;QACjB,EAAE;QACF,kBAAkB;QAClB,EAAE;QACF,kCAAkC;QAClC,kCAAkC;KACnC,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,MAAM,MAAM,MAAM,QAAQ,IAAI,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Team Markdown I/O — parse and serialize team.md files.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing `parseTeamMarkdown()` from markdown-migration.ts
|
|
5
|
+
* and adds serialization for round-trip support.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io/team-io
|
|
8
|
+
*/
|
|
9
|
+
import { type ParsedAgent } from '../../config/markdown-migration.js';
|
|
10
|
+
export type { ParsedAgent };
|
|
11
|
+
/**
|
|
12
|
+
* Optional metadata for the team.md file header.
|
|
13
|
+
*/
|
|
14
|
+
export interface TeamMetadata {
|
|
15
|
+
/** Team name displayed in the title */
|
|
16
|
+
teamName?: string;
|
|
17
|
+
/** Tagline shown below the title */
|
|
18
|
+
tagline?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Result of parsing a team.md file. */
|
|
21
|
+
export interface ParsedTeam {
|
|
22
|
+
agents: ParsedAgent[];
|
|
23
|
+
projectContext: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Parse team markdown into typed agent entries and project context.
|
|
27
|
+
* Delegates agent parsing to `parseTeamMarkdown()` and also extracts
|
|
28
|
+
* the project context section above the members table.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseTeam(markdown: string): ParsedTeam;
|
|
31
|
+
/**
|
|
32
|
+
* Serialize agents to a full team.md file.
|
|
33
|
+
*
|
|
34
|
+
* Produces the canonical table format:
|
|
35
|
+
* ```
|
|
36
|
+
* # Team Name
|
|
37
|
+
*
|
|
38
|
+
* ## Members
|
|
39
|
+
*
|
|
40
|
+
* | Name | Role | Charter | Status |
|
|
41
|
+
* |------|------|---------|--------|
|
|
42
|
+
* | Agent | Developer | `.squad/agents/agent/charter.md` | ✅ Active |
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function serializeTeam(agents: ParsedAgent[], metadata?: TeamMetadata): string;
|
|
46
|
+
//# sourceMappingURL=team-io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-io.d.ts","sourceRoot":"","sources":["../../../src/state/io/team-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGzF,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAiCD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAItD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,MAAM,CAyBpF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Team Markdown I/O — parse and serialize team.md files.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing `parseTeamMarkdown()` from markdown-migration.ts
|
|
5
|
+
* and adds serialization for round-trip support.
|
|
6
|
+
*
|
|
7
|
+
* @module state/io/team-io
|
|
8
|
+
*/
|
|
9
|
+
import { parseTeamMarkdown } from '../../config/markdown-migration.js';
|
|
10
|
+
import { normalizeEol } from '../../utils/normalize-eol.js';
|
|
11
|
+
/**
|
|
12
|
+
* Extract project context: everything between the `# Title` line and
|
|
13
|
+
* the `## Members` heading. The title line itself is excluded.
|
|
14
|
+
*/
|
|
15
|
+
function extractProjectContext(markdown) {
|
|
16
|
+
const lines = normalizeEol(markdown).split('\n');
|
|
17
|
+
const contextLines = [];
|
|
18
|
+
let pastTitle = false;
|
|
19
|
+
for (const line of lines) {
|
|
20
|
+
const trimmed = line.trim();
|
|
21
|
+
// Skip the title line
|
|
22
|
+
if (!pastTitle) {
|
|
23
|
+
if (/^#\s+/.test(trimmed)) {
|
|
24
|
+
pastTitle = true;
|
|
25
|
+
}
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
// Stop at ## Members or any ## heading that signals the table section
|
|
29
|
+
if (/^##\s+members/i.test(trimmed)) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
contextLines.push(line);
|
|
33
|
+
}
|
|
34
|
+
return contextLines.join('\n').trim();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parse team markdown into typed agent entries and project context.
|
|
38
|
+
* Delegates agent parsing to `parseTeamMarkdown()` and also extracts
|
|
39
|
+
* the project context section above the members table.
|
|
40
|
+
*/
|
|
41
|
+
export function parseTeam(markdown) {
|
|
42
|
+
const { agents } = parseTeamMarkdown(markdown);
|
|
43
|
+
const projectContext = extractProjectContext(markdown);
|
|
44
|
+
return { agents, projectContext };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Serialize agents to a full team.md file.
|
|
48
|
+
*
|
|
49
|
+
* Produces the canonical table format:
|
|
50
|
+
* ```
|
|
51
|
+
* # Team Name
|
|
52
|
+
*
|
|
53
|
+
* ## Members
|
|
54
|
+
*
|
|
55
|
+
* | Name | Role | Charter | Status |
|
|
56
|
+
* |------|------|---------|--------|
|
|
57
|
+
* | Agent | Developer | `.squad/agents/agent/charter.md` | ✅ Active |
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export function serializeTeam(agents, metadata) {
|
|
61
|
+
const teamName = metadata?.teamName ?? 'Team';
|
|
62
|
+
const lines = [`# ${teamName}`];
|
|
63
|
+
if (metadata?.tagline) {
|
|
64
|
+
lines.push('');
|
|
65
|
+
lines.push(`> ${metadata.tagline}`);
|
|
66
|
+
}
|
|
67
|
+
lines.push('');
|
|
68
|
+
lines.push('## Members');
|
|
69
|
+
lines.push('');
|
|
70
|
+
lines.push('| Name | Role | Charter | Status |');
|
|
71
|
+
lines.push('|------|------|---------|--------|');
|
|
72
|
+
for (const agent of agents) {
|
|
73
|
+
const name = agent.name;
|
|
74
|
+
const role = agent.role;
|
|
75
|
+
const charter = `.squad/agents/${agent.name}/charter.md`;
|
|
76
|
+
const status = agent.status ?? '✅ Active';
|
|
77
|
+
lines.push(`| ${name} | ${role} | \`${charter}\` | ${status} |`);
|
|
78
|
+
}
|
|
79
|
+
lines.push('');
|
|
80
|
+
return lines.join('\n');
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=team-io.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-io.js","sourceRoot":"","sources":["../../../src/state/io/team-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAoB,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAA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,OAAO,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IACjD,KAAK,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IAEjD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,MAAM,OAAO,GAAG,iBAAiB,KAAK,CAAC,IAAI,aAAa,CAAC;QACzD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,UAAU,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,MAAM,IAAI,QAAQ,OAAO,QAAQ,MAAM,IAAI,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State Module — Storage Layout Schema
|
|
3
|
+
*
|
|
4
|
+
* Maps collection names to their `.squad/` file paths.
|
|
5
|
+
* Single-entity collections use a static string; multi-entity
|
|
6
|
+
* collections use a function that derives the path from an entity id.
|
|
7
|
+
*/
|
|
8
|
+
import type { CollectionName } from './collection-map.js';
|
|
9
|
+
/** Either a static path or a function deriving a path from an entity id. */
|
|
10
|
+
export type CollectionPathResolver = string | ((id: string) => string);
|
|
11
|
+
/**
|
|
12
|
+
* Canonical mapping from collection names to `.squad/` relative paths.
|
|
13
|
+
*
|
|
14
|
+
* Static paths point to a single file (e.g. `decisions.md`).
|
|
15
|
+
* Function paths resolve per-entity directories (e.g. `agents/<name>`).
|
|
16
|
+
*/
|
|
17
|
+
export declare const COLLECTION_PATHS: Record<CollectionName, CollectionPathResolver>;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the storage path for a collection, optionally with an entity id.
|
|
20
|
+
*
|
|
21
|
+
* @throws {Error} if the collection requires an id but none was provided.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveCollectionPath(collection: CollectionName, id?: string): string;
|
|
24
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/state/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,4EAA4E;AAC5E,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAIvE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,cAAc,EAAE,sBAAsB,CAS3E,CAAC;AAIF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,cAAc,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CASrF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State Module — Storage Layout Schema
|
|
3
|
+
*
|
|
4
|
+
* Maps collection names to their `.squad/` file paths.
|
|
5
|
+
* Single-entity collections use a static string; multi-entity
|
|
6
|
+
* collections use a function that derives the path from an entity id.
|
|
7
|
+
*/
|
|
8
|
+
// ── Collection → Path Mapping ──────────────────────────────────────────────
|
|
9
|
+
/**
|
|
10
|
+
* Canonical mapping from collection names to `.squad/` relative paths.
|
|
11
|
+
*
|
|
12
|
+
* Static paths point to a single file (e.g. `decisions.md`).
|
|
13
|
+
* Function paths resolve per-entity directories (e.g. `agents/<name>`).
|
|
14
|
+
*/
|
|
15
|
+
export const COLLECTION_PATHS = {
|
|
16
|
+
agents: (id) => `.squad/agents/${id}`,
|
|
17
|
+
decisions: '.squad/decisions.md',
|
|
18
|
+
routing: '.squad/routing.md',
|
|
19
|
+
team: '.squad/team.md',
|
|
20
|
+
skills: (id) => `.squad/skills/${id}`,
|
|
21
|
+
templates: (id) => `.squad/templates/${id}`,
|
|
22
|
+
log: '.squad/log',
|
|
23
|
+
config: '.squad/config.json',
|
|
24
|
+
};
|
|
25
|
+
// ── Helpers ────────────────────────────────────────────────────────────────
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the storage path for a collection, optionally with an entity id.
|
|
28
|
+
*
|
|
29
|
+
* @throws {Error} if the collection requires an id but none was provided.
|
|
30
|
+
*/
|
|
31
|
+
export function resolveCollectionPath(collection, id) {
|
|
32
|
+
const resolver = COLLECTION_PATHS[collection];
|
|
33
|
+
if (typeof resolver === 'function') {
|
|
34
|
+
if (!id) {
|
|
35
|
+
throw new Error(`Collection "${collection}" requires an entity id to resolve its path`);
|
|
36
|
+
}
|
|
37
|
+
return resolver(id);
|
|
38
|
+
}
|
|
39
|
+
return resolver;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/state/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAmD;IAC9E,MAAM,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,iBAAiB,EAAE,EAAE;IAC7C,SAAS,EAAE,qBAAqB;IAChC,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,iBAAiB,EAAE,EAAE;IAC7C,SAAS,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,oBAAoB,EAAE,EAAE;IACnD,GAAG,EAAE,YAAY;IACjB,MAAM,EAAE,oBAAoB;CAC7B,CAAC;AAEF,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAA0B,EAAE,EAAW;IAC3E,MAAM,QAAQ,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC9C,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,eAAe,UAAU,6CAA6C,CAAC,CAAC;QAC1F,CAAC;QACD,OAAO,QAAQ,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|