@mindfoldhq/trellis 0.6.0-beta.16 → 0.6.0-beta.17
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/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +33 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/channel/index.d.ts.map +1 -1
- package/dist/commands/channel/index.js +3 -1
- package/dist/commands/channel/index.js.map +1 -1
- package/dist/commands/channel/messages.js +12 -0
- package/dist/commands/channel/messages.js.map +1 -1
- package/dist/commands/channel/spawn.d.ts +2 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -1
- package/dist/commands/channel/spawn.js +1 -0
- package/dist/commands/channel/spawn.js.map +1 -1
- package/dist/commands/channel/store/events.d.ts +2 -2
- package/dist/commands/channel/store/events.d.ts.map +1 -1
- package/dist/commands/channel/store/events.js +1 -1
- package/dist/commands/channel/store/events.js.map +1 -1
- package/dist/commands/channel/supervisor/warning.d.ts +48 -0
- package/dist/commands/channel/supervisor/warning.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/warning.js +77 -0
- package/dist/commands/channel/supervisor/warning.js.map +1 -0
- package/dist/commands/channel/supervisor.d.ts +2 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -1
- package/dist/commands/channel/supervisor.js +14 -0
- package/dist/commands/channel/supervisor.js.map +1 -1
- package/dist/commands/channel/wait.js +2 -2
- package/dist/commands/channel/wait.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +27 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/workflow.d.ts +35 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +219 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/configurators/workflow.d.ts +8 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +3 -2
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/migrations/manifests/0.6.0-beta.17.json +9 -0
- package/dist/templates/cursor/hooks.json +0 -6
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +0 -1
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/session-start.py +6 -2
- package/dist/utils/workflow-resolver.d.ts +86 -0
- package/dist/utils/workflow-resolver.d.ts.map +1 -0
- package/dist/utils/workflow-resolver.js +265 -0
- package/dist/utils/workflow-resolver.js.map +1 -0
- package/package.json +2 -2
|
@@ -32,14 +32,15 @@ export async function createWorkflowStructure(cwd, options) {
|
|
|
32
32
|
const skipSpecTemplates = options?.skipSpecTemplates ?? false;
|
|
33
33
|
const packages = options?.packages;
|
|
34
34
|
const remoteSpecPackages = options?.remoteSpecPackages;
|
|
35
|
+
const workflowMd = options?.workflowMdOverride ?? workflowMdTemplate;
|
|
35
36
|
// Create base .trellis directory
|
|
36
37
|
ensureDir(path.join(cwd, DIR_NAMES.WORKFLOW));
|
|
37
38
|
// Copy scripts/ directory from templates
|
|
38
39
|
await copyTrellisDir("scripts", path.join(cwd, PATHS.SCRIPTS), {
|
|
39
40
|
executable: true,
|
|
40
41
|
});
|
|
41
|
-
// Copy workflow.md
|
|
42
|
-
await writeFile(path.join(cwd, PATHS.WORKFLOW_GUIDE_FILE), replacePythonCommandLiterals(
|
|
42
|
+
// Copy workflow.md (native bundled template or selected marketplace variant)
|
|
43
|
+
await writeFile(path.join(cwd, PATHS.WORKFLOW_GUIDE_FILE), replacePythonCommandLiterals(workflowMd));
|
|
43
44
|
// Copy .gitignore from templates
|
|
44
45
|
await writeFile(path.join(cwd, DIR_NAMES.WORKFLOW, ".gitignore"), gitignoreTemplate);
|
|
45
46
|
// Copy config.yaml from templates
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/configurators/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CA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GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,kBAAkB,EAAE,GAAG,CAAC,OAAO,CAAC;gBAAE,SAAS;YAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC;YAC/D,SAAS,CAAC,WAAW,CAAC,CAAC;YACvB,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;YAChE,MAAM,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,mBAAmB;QACnB,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;IAClE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.6.0-beta.17",
|
|
3
|
+
"description": "Beta patch: add workflow template switching, worker inbox core APIs, supervisor warning controls, wait kind unions, and Cursor sessionStart schema output.",
|
|
4
|
+
"breaking": false,
|
|
5
|
+
"recommendMigrate": false,
|
|
6
|
+
"changelog": "**Enhancements:**\n- feat(workflow): `trellis init --workflow` and `trellis workflow` can select `native`, `tdd`, `channel-driven-subagent-dispatch`, or marketplace workflow templates for `.trellis/workflow.md`.\n- feat(channel): `trellis channel wait --kind` accepts CSV kind unions such as `done,killed`; supervisors emit `supervisor_warning`, and `trellis channel spawn --warn-before` configures or disables the warning lead time.\n- feat(core): `@mindfoldhq/trellis-core/channel` exports `readWorkerInbox()`, `watchWorkerInbox()`, and `WorkerInboxError` for durable worker inbox consumers.\n\n**Bug Fixes:**\n- fix(hooks): Cursor `sessionStart` hooks now emit top-level `additional_context` and no longer install the unsupported `beforeSubmitPrompt` workflow injector.",
|
|
7
|
+
"migrations": [],
|
|
8
|
+
"notes": "Run `npm install -g @mindfoldhq/trellis@beta` and `trellis update` to refresh CLI templates. No file migration is required."
|
|
9
|
+
}
|
|
@@ -14,12 +14,6 @@
|
|
|
14
14
|
"timeout": 30
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
|
-
"beforeSubmitPrompt": [
|
|
18
|
-
{
|
|
19
|
-
"command": "{{PYTHON_CMD}} .cursor/hooks/inject-workflow-state.py",
|
|
20
|
-
"timeout": 15
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
17
|
"beforeShellExecution": [
|
|
24
18
|
{
|
|
25
19
|
"command": "{{PYTHON_CMD}} .cursor/hooks/inject-shell-session-context.py",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB,iCAAiC,GACjC,0BAA0B,GAC1B,4BAA4B,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAC3C,kBAAkB,EAClB,SAAS,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,gEAA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AAO,GAAiB,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC;SACjC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChC,IAAI,EAAE,CAAC;IAEV,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAC7C,QAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,OAAO,oBAAoB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -812,11 +812,15 @@ Trellis compact SessionStart context. Use it to orient the session; load details
|
|
|
812
812
|
Context loaded. Follow <task-status>. Load workflow/spec/task details only when needed.
|
|
813
813
|
</ready>""")
|
|
814
814
|
|
|
815
|
+
context_text = output.getvalue()
|
|
815
816
|
result = {
|
|
817
|
+
# Claude Code / Qoder / CodeBuddy / Droid / Gemini / Copilot format
|
|
816
818
|
"hookSpecificOutput": {
|
|
817
819
|
"hookEventName": "SessionStart",
|
|
818
|
-
"additionalContext":
|
|
819
|
-
}
|
|
820
|
+
"additionalContext": context_text,
|
|
821
|
+
},
|
|
822
|
+
# Cursor sessionStart format (top-level snake_case per Cursor docs)
|
|
823
|
+
"additional_context": context_text,
|
|
820
824
|
}
|
|
821
825
|
|
|
822
826
|
# Output JSON - stdout is already configured for UTF-8
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow template resolver.
|
|
3
|
+
*
|
|
4
|
+
* Centralizes how `trellis init --workflow` and `trellis workflow` discover and
|
|
5
|
+
* fetch workflow.md content. Reuses `template-fetcher` helpers for registry
|
|
6
|
+
* parsing, index probing, and git/http transport. The `native` workflow is a
|
|
7
|
+
* virtual entry resolved directly from the bundled `workflowMdTemplate` to
|
|
8
|
+
* avoid a duplicate file on disk that could drift out of sync.
|
|
9
|
+
*
|
|
10
|
+
* Boundary: command-layer callers (init.ts, commands/workflow.ts) should NOT
|
|
11
|
+
* touch raw marketplace structures. They go through `resolveWorkflowTemplate`
|
|
12
|
+
* and `listWorkflowTemplates` only.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The id used to refer to the bundled native workflow.
|
|
16
|
+
*
|
|
17
|
+
* Treated as Trellis-managed for hash-tracking: when this id is selected by
|
|
18
|
+
* `init --workflow` or `trellis workflow`, `.trellis/workflow.md` stays in
|
|
19
|
+
* `.template-hashes.json`. Any other id is user-managed local workflow and
|
|
20
|
+
* must be removed from the hash file (the durable-state contract in
|
|
21
|
+
* design.md "Durable-state contract").
|
|
22
|
+
*/
|
|
23
|
+
export declare const NATIVE_WORKFLOW_ID = "native";
|
|
24
|
+
/**
|
|
25
|
+
* Resolved workflow template entry.
|
|
26
|
+
*
|
|
27
|
+
* `content` is the workflow.md body bytes (LF-normalized in storage).
|
|
28
|
+
* `path` is the marketplace-relative path for remote entries, or
|
|
29
|
+
* `bundled:trellis/workflow.md` for the native virtual entry.
|
|
30
|
+
*/
|
|
31
|
+
export interface ResolvedWorkflowTemplate {
|
|
32
|
+
id: string;
|
|
33
|
+
type: "workflow";
|
|
34
|
+
name: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
path: string;
|
|
37
|
+
content: string;
|
|
38
|
+
/** Where the content came from (for error messages). */
|
|
39
|
+
source: "bundled" | "marketplace";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Workflow template listing (metadata only, no content).
|
|
43
|
+
*/
|
|
44
|
+
export interface WorkflowTemplateListing {
|
|
45
|
+
id: string;
|
|
46
|
+
type: "workflow";
|
|
47
|
+
name: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
path: string;
|
|
50
|
+
source: "bundled" | "marketplace";
|
|
51
|
+
}
|
|
52
|
+
export interface WorkflowResolveOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Optional marketplace source (giget-style or HTTPS URL).
|
|
55
|
+
* Omitted = use the default marketplace via TEMPLATE_INDEX_URL.
|
|
56
|
+
*/
|
|
57
|
+
source?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare class WorkflowResolveError extends Error {
|
|
60
|
+
constructor(message: string);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* List available workflow templates from the default marketplace (or a
|
|
64
|
+
* user-supplied source). The bundled native entry is always included first.
|
|
65
|
+
*
|
|
66
|
+
* Returns metadata only — no content is fetched. Use `resolveWorkflowTemplate`
|
|
67
|
+
* to fetch the actual workflow.md bytes for a chosen id.
|
|
68
|
+
*
|
|
69
|
+
* Network errors are surfaced as `errorMessage`. The native entry is still
|
|
70
|
+
* returned so callers can fall back to it offline.
|
|
71
|
+
*/
|
|
72
|
+
export declare function listWorkflowTemplates(options?: WorkflowResolveOptions): Promise<{
|
|
73
|
+
templates: WorkflowTemplateListing[];
|
|
74
|
+
errorMessage?: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve a workflow id to its content.
|
|
78
|
+
*
|
|
79
|
+
* - `native` → bundled `workflowMdTemplate` (offline, never errors).
|
|
80
|
+
* - other id → fetch index via `template-fetcher`, find the matching
|
|
81
|
+
* `type: "workflow"` entry, then fetch its single file content.
|
|
82
|
+
*
|
|
83
|
+
* Errors are workflow-specific (do NOT reuse "spec template not found" copy).
|
|
84
|
+
*/
|
|
85
|
+
export declare function resolveWorkflowTemplate(id: string, options?: WorkflowResolveOptions): Promise<ResolvedWorkflowTemplate>;
|
|
86
|
+
//# sourceMappingURL=workflow-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/workflow-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkBH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,MAAM,EAAE,SAAS,GAAG,aAAa,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,aAAa,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AA+DD;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC;IACT,SAAS,EAAE,uBAAuB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC,CA6BD;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,wBAAwB,CAAC,CAoDnC"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow template resolver.
|
|
3
|
+
*
|
|
4
|
+
* Centralizes how `trellis init --workflow` and `trellis workflow` discover and
|
|
5
|
+
* fetch workflow.md content. Reuses `template-fetcher` helpers for registry
|
|
6
|
+
* parsing, index probing, and git/http transport. The `native` workflow is a
|
|
7
|
+
* virtual entry resolved directly from the bundled `workflowMdTemplate` to
|
|
8
|
+
* avoid a duplicate file on disk that could drift out of sync.
|
|
9
|
+
*
|
|
10
|
+
* Boundary: command-layer callers (init.ts, commands/workflow.ts) should NOT
|
|
11
|
+
* touch raw marketplace structures. They go through `resolveWorkflowTemplate`
|
|
12
|
+
* and `listWorkflowTemplates` only.
|
|
13
|
+
*/
|
|
14
|
+
import fs from "node:fs";
|
|
15
|
+
import os from "node:os";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { workflowMdTemplate } from "../templates/trellis/index.js";
|
|
18
|
+
import { TIMEOUTS, TEMPLATE_INDEX_URL, RegistryBackendError, parseRegistrySource, probeRegistryIndex, } from "./template-fetcher.js";
|
|
19
|
+
/**
|
|
20
|
+
* The id used to refer to the bundled native workflow.
|
|
21
|
+
*
|
|
22
|
+
* Treated as Trellis-managed for hash-tracking: when this id is selected by
|
|
23
|
+
* `init --workflow` or `trellis workflow`, `.trellis/workflow.md` stays in
|
|
24
|
+
* `.template-hashes.json`. Any other id is user-managed local workflow and
|
|
25
|
+
* must be removed from the hash file (the durable-state contract in
|
|
26
|
+
* design.md "Durable-state contract").
|
|
27
|
+
*/
|
|
28
|
+
export const NATIVE_WORKFLOW_ID = "native";
|
|
29
|
+
export class WorkflowResolveError extends Error {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "WorkflowResolveError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Bundled native workflow entry — virtual, resolved without network access.
|
|
37
|
+
*/
|
|
38
|
+
function nativeListingEntry() {
|
|
39
|
+
return {
|
|
40
|
+
id: NATIVE_WORKFLOW_ID,
|
|
41
|
+
type: "workflow",
|
|
42
|
+
name: "Native Trellis Workflow",
|
|
43
|
+
description: "Default Trellis Plan / Execute / Finish workflow bundled with the CLI",
|
|
44
|
+
path: "bundled:trellis/workflow.md",
|
|
45
|
+
source: "bundled",
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function nativeResolvedEntry() {
|
|
49
|
+
return {
|
|
50
|
+
...nativeListingEntry(),
|
|
51
|
+
content: workflowMdTemplate,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function parseSourceOrThrow(source) {
|
|
55
|
+
try {
|
|
56
|
+
return parseRegistrySource(source);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
throw new WorkflowResolveError(`Invalid workflow marketplace source "${source}": ${err instanceof Error ? err.message : String(err)}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function fetchWorkflowEntries(registry, indexUrl) {
|
|
63
|
+
const probe = await probeRegistryIndex(indexUrl, registry);
|
|
64
|
+
if (probe.error) {
|
|
65
|
+
return {
|
|
66
|
+
templates: [],
|
|
67
|
+
backend: probe.backend,
|
|
68
|
+
errorMessage: probe.error.message,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (probe.isNotFound) {
|
|
72
|
+
return {
|
|
73
|
+
templates: [],
|
|
74
|
+
backend: probe.backend,
|
|
75
|
+
errorMessage: "No marketplace index.json found at the configured source. Workflow templates require an index.json.",
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return { templates: probe.templates, backend: probe.backend };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* List available workflow templates from the default marketplace (or a
|
|
82
|
+
* user-supplied source). The bundled native entry is always included first.
|
|
83
|
+
*
|
|
84
|
+
* Returns metadata only — no content is fetched. Use `resolveWorkflowTemplate`
|
|
85
|
+
* to fetch the actual workflow.md bytes for a chosen id.
|
|
86
|
+
*
|
|
87
|
+
* Network errors are surfaced as `errorMessage`. The native entry is still
|
|
88
|
+
* returned so callers can fall back to it offline.
|
|
89
|
+
*/
|
|
90
|
+
export async function listWorkflowTemplates(options = {}) {
|
|
91
|
+
const result = [nativeListingEntry()];
|
|
92
|
+
let registry;
|
|
93
|
+
let indexUrl = TEMPLATE_INDEX_URL;
|
|
94
|
+
if (options.source) {
|
|
95
|
+
registry = parseSourceOrThrow(options.source);
|
|
96
|
+
indexUrl = `${registry.rawBaseUrl}/index.json`;
|
|
97
|
+
}
|
|
98
|
+
const fetched = await fetchWorkflowEntries(registry, indexUrl);
|
|
99
|
+
if (fetched.errorMessage) {
|
|
100
|
+
return { templates: result, errorMessage: fetched.errorMessage };
|
|
101
|
+
}
|
|
102
|
+
for (const t of fetched.templates) {
|
|
103
|
+
if (t.type !== "workflow")
|
|
104
|
+
continue;
|
|
105
|
+
if (t.id === NATIVE_WORKFLOW_ID)
|
|
106
|
+
continue;
|
|
107
|
+
result.push({
|
|
108
|
+
id: t.id,
|
|
109
|
+
type: "workflow",
|
|
110
|
+
name: t.name,
|
|
111
|
+
...(t.description ? { description: t.description } : {}),
|
|
112
|
+
path: t.path,
|
|
113
|
+
source: "marketplace",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return { templates: result };
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Resolve a workflow id to its content.
|
|
120
|
+
*
|
|
121
|
+
* - `native` → bundled `workflowMdTemplate` (offline, never errors).
|
|
122
|
+
* - other id → fetch index via `template-fetcher`, find the matching
|
|
123
|
+
* `type: "workflow"` entry, then fetch its single file content.
|
|
124
|
+
*
|
|
125
|
+
* Errors are workflow-specific (do NOT reuse "spec template not found" copy).
|
|
126
|
+
*/
|
|
127
|
+
export async function resolveWorkflowTemplate(id, options = {}) {
|
|
128
|
+
if (id === NATIVE_WORKFLOW_ID) {
|
|
129
|
+
return nativeResolvedEntry();
|
|
130
|
+
}
|
|
131
|
+
let registry;
|
|
132
|
+
let indexUrl = TEMPLATE_INDEX_URL;
|
|
133
|
+
if (options.source) {
|
|
134
|
+
registry = parseSourceOrThrow(options.source);
|
|
135
|
+
indexUrl = `${registry.rawBaseUrl}/index.json`;
|
|
136
|
+
}
|
|
137
|
+
const fetched = await fetchWorkflowEntries(registry, indexUrl);
|
|
138
|
+
if (fetched.errorMessage) {
|
|
139
|
+
throw new WorkflowResolveError(`Could not fetch workflow template index: ${fetched.errorMessage}`);
|
|
140
|
+
}
|
|
141
|
+
const entry = fetched.templates.find((t) => t.id === id && t.type === "workflow");
|
|
142
|
+
if (!entry) {
|
|
143
|
+
const available = fetched.templates
|
|
144
|
+
.filter((t) => t.type === "workflow")
|
|
145
|
+
.map((t) => t.id);
|
|
146
|
+
const hint = available.length > 0
|
|
147
|
+
? ` Available workflow templates: ${available.join(", ")}`
|
|
148
|
+
: "";
|
|
149
|
+
throw new WorkflowResolveError(`Workflow template "${id}" not found in marketplace index.${hint}`);
|
|
150
|
+
}
|
|
151
|
+
if (!entry.path?.endsWith(".md")) {
|
|
152
|
+
throw new WorkflowResolveError(`Workflow template "${id}" has invalid path "${entry.path}" — must point to a workflow.md file.`);
|
|
153
|
+
}
|
|
154
|
+
const backend = fetched.backend;
|
|
155
|
+
const content = await fetchWorkflowFile(entry.path, registry, backend);
|
|
156
|
+
return {
|
|
157
|
+
id: entry.id,
|
|
158
|
+
type: "workflow",
|
|
159
|
+
name: entry.name,
|
|
160
|
+
...(entry.description ? { description: entry.description } : {}),
|
|
161
|
+
path: entry.path,
|
|
162
|
+
content,
|
|
163
|
+
source: "marketplace",
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function fetchWorkflowFile(relativePath, registry, backend) {
|
|
167
|
+
validateWorkflowPath(relativePath);
|
|
168
|
+
const useGit = registry?.preferGit ?? backend === "git";
|
|
169
|
+
if (registry && useGit) {
|
|
170
|
+
return fetchWorkflowFileGit(registry, relativePath);
|
|
171
|
+
}
|
|
172
|
+
const rawBase = registry
|
|
173
|
+
? registry.rawBaseUrl
|
|
174
|
+
: TEMPLATE_INDEX_URL.replace(/\/index\.json$/, "");
|
|
175
|
+
return fetchWorkflowFileHttp(rawBase, relativePath);
|
|
176
|
+
}
|
|
177
|
+
async function fetchWorkflowFileHttp(rawBaseUrl, relativePath) {
|
|
178
|
+
const url = `${rawBaseUrl.replace(/\/$/, "")}/${relativePath}`;
|
|
179
|
+
try {
|
|
180
|
+
const res = await fetch(url, {
|
|
181
|
+
signal: AbortSignal.timeout(TIMEOUTS.DOWNLOAD_MS),
|
|
182
|
+
});
|
|
183
|
+
if (res.status === 404) {
|
|
184
|
+
throw new WorkflowResolveError(`Workflow template file not found at ${url}.`);
|
|
185
|
+
}
|
|
186
|
+
if (!res.ok) {
|
|
187
|
+
throw new WorkflowResolveError(`Could not fetch workflow template (HTTP ${res.status}) from ${url}.`);
|
|
188
|
+
}
|
|
189
|
+
return await res.text();
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
if (err instanceof WorkflowResolveError)
|
|
193
|
+
throw err;
|
|
194
|
+
throw new WorkflowResolveError(`Workflow template download failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function validateWorkflowPath(relativePath) {
|
|
198
|
+
const normalized = relativePath.replace(/\\/g, "/");
|
|
199
|
+
if (normalized.startsWith("/") ||
|
|
200
|
+
normalized.split("/").some((part) => part === "..")) {
|
|
201
|
+
throw new WorkflowResolveError(`Workflow template path "${relativePath}" must stay inside the marketplace root.`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
async function fetchWorkflowFileGit(registry, relativePath) {
|
|
205
|
+
// Single shallow clone of the registry ref, then read one file. We don't
|
|
206
|
+
// share clone state with template-fetcher's downloadGitRegistryPath because
|
|
207
|
+
// workflow resolution is a single-file fetch (not a directory copy).
|
|
208
|
+
const { execFile } = await import("node:child_process");
|
|
209
|
+
const dir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "trellis-workflow-"));
|
|
210
|
+
function run(args) {
|
|
211
|
+
return new Promise((resolve, reject) => {
|
|
212
|
+
execFile("git", args, {
|
|
213
|
+
encoding: "utf-8",
|
|
214
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
215
|
+
timeout: TIMEOUTS.DOWNLOAD_MS,
|
|
216
|
+
}, (error) => {
|
|
217
|
+
if (error)
|
|
218
|
+
reject(error);
|
|
219
|
+
else
|
|
220
|
+
resolve();
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
try {
|
|
226
|
+
await run([
|
|
227
|
+
"clone",
|
|
228
|
+
"--filter=blob:none",
|
|
229
|
+
"--no-checkout",
|
|
230
|
+
registry.gitUrl,
|
|
231
|
+
dir,
|
|
232
|
+
]);
|
|
233
|
+
await run(["-C", dir, "fetch", "--depth", "1", "origin", registry.ref]);
|
|
234
|
+
await run(["-C", dir, "checkout", "--detach", "FETCH_HEAD"]);
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
throw new RegistryBackendError("network", `Could not clone registry ${registry.gitUrl}#${registry.ref}: ${err instanceof Error ? err.message : String(err)}`);
|
|
238
|
+
}
|
|
239
|
+
const subdir = registry.subdir.length > 0 ? registry.subdir : ".";
|
|
240
|
+
const sourceRoot = path.resolve(dir, subdir);
|
|
241
|
+
const candidatePath = path.resolve(sourceRoot, relativePath);
|
|
242
|
+
const rel = path.relative(sourceRoot, candidatePath);
|
|
243
|
+
if (rel.startsWith("..") || path.isAbsolute(rel)) {
|
|
244
|
+
throw new WorkflowResolveError(`Workflow template path "${relativePath}" escapes the marketplace root.`);
|
|
245
|
+
}
|
|
246
|
+
if (!fs.existsSync(candidatePath)) {
|
|
247
|
+
throw new WorkflowResolveError(`Workflow template file "${relativePath}" not found in ${registry.gitUrl}#${registry.ref}.`);
|
|
248
|
+
}
|
|
249
|
+
return await fs.promises.readFile(candidatePath, "utf-8");
|
|
250
|
+
}
|
|
251
|
+
catch (err) {
|
|
252
|
+
if (err instanceof WorkflowResolveError)
|
|
253
|
+
throw err;
|
|
254
|
+
if (err instanceof RegistryBackendError) {
|
|
255
|
+
throw new WorkflowResolveError(err.message);
|
|
256
|
+
}
|
|
257
|
+
throw new WorkflowResolveError(`Workflow template download failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
258
|
+
}
|
|
259
|
+
finally {
|
|
260
|
+
await fs.promises.rm(dir, { recursive: true, force: true }).catch(() => {
|
|
261
|
+
// best-effort cleanup; the OS will reap tmp dirs eventually
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=workflow-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-resolver.js","sourceRoot":"","sources":["../../src/utils/workflow-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GAInB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAwC3C,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED;;GAEG;AACH,SAAS,kBAAkB;IACzB,OAAO;QACL,EAAE,EAAE,kBAAkB;QACtB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EACT,uEAAuE;QACzE,IAAI,EAAE,6BAA6B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T,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YACrE,4DAA4D;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindfoldhq/trellis",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.17",
|
|
4
4
|
"description": "AI capabilities grow like ivy — Trellis provides the structure to guide them along a disciplined path",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"inquirer": "^9.3.7",
|
|
35
35
|
"undici": "^6.21.0",
|
|
36
36
|
"zod": "^4.4.2",
|
|
37
|
-
"@mindfoldhq/trellis-core": "0.6.0-beta.
|
|
37
|
+
"@mindfoldhq/trellis-core": "0.6.0-beta.17"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@eslint/js": "^9.18.0",
|