@workflow-cannon/workspace-kit 0.2.0 → 0.4.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.
Files changed (36) hide show
  1. package/README.md +3 -3
  2. package/dist/cli.js +168 -2
  3. package/dist/contracts/index.d.ts +1 -1
  4. package/dist/contracts/module-contract.d.ts +14 -0
  5. package/dist/core/index.d.ts +2 -0
  6. package/dist/core/index.js +2 -0
  7. package/dist/core/policy.d.ts +24 -0
  8. package/dist/core/policy.js +102 -0
  9. package/dist/core/workspace-kit-config.d.ts +49 -0
  10. package/dist/core/workspace-kit-config.js +218 -0
  11. package/dist/modules/documentation/index.d.ts +1 -1
  12. package/dist/modules/documentation/index.js +63 -38
  13. package/dist/modules/documentation/runtime.d.ts +5 -1
  14. package/dist/modules/documentation/runtime.js +87 -4
  15. package/dist/modules/documentation/types.d.ts +14 -0
  16. package/dist/modules/index.d.ts +3 -1
  17. package/dist/modules/index.js +2 -1
  18. package/dist/modules/task-engine/generator.d.ts +2 -0
  19. package/dist/modules/task-engine/generator.js +101 -0
  20. package/dist/modules/task-engine/importer.d.ts +8 -0
  21. package/dist/modules/task-engine/importer.js +157 -0
  22. package/dist/modules/task-engine/index.d.ts +7 -0
  23. package/dist/modules/task-engine/index.js +237 -2
  24. package/dist/modules/task-engine/service.d.ts +21 -0
  25. package/dist/modules/task-engine/service.js +105 -0
  26. package/dist/modules/task-engine/store.d.ts +16 -0
  27. package/dist/modules/task-engine/store.js +88 -0
  28. package/dist/modules/task-engine/suggestions.d.ts +2 -0
  29. package/dist/modules/task-engine/suggestions.js +51 -0
  30. package/dist/modules/task-engine/transitions.d.ts +23 -0
  31. package/dist/modules/task-engine/transitions.js +109 -0
  32. package/dist/modules/task-engine/types.d.ts +82 -0
  33. package/dist/modules/task-engine/types.js +1 -0
  34. package/dist/modules/workspace-config/index.d.ts +2 -0
  35. package/dist/modules/workspace-config/index.js +72 -0
  36. package/package.json +1 -1
@@ -0,0 +1,82 @@
1
+ export type TaskStatus = "proposed" | "ready" | "in_progress" | "blocked" | "completed" | "cancelled";
2
+ export type TaskPriority = "P1" | "P2" | "P3";
3
+ export type TaskEntity = {
4
+ id: string;
5
+ status: TaskStatus;
6
+ type: string;
7
+ title: string;
8
+ createdAt: string;
9
+ updatedAt: string;
10
+ priority?: TaskPriority;
11
+ dependsOn?: string[];
12
+ unblocks?: string[];
13
+ phase?: string;
14
+ metadata?: Record<string, unknown>;
15
+ ownership?: string;
16
+ approach?: string;
17
+ technicalScope?: string[];
18
+ acceptanceCriteria?: string[];
19
+ };
20
+ export type GuardResult = {
21
+ allowed: boolean;
22
+ guardName: string;
23
+ code?: string;
24
+ message?: string;
25
+ };
26
+ export type TransitionContext = {
27
+ allTasks: TaskEntity[];
28
+ timestamp: string;
29
+ actor?: string;
30
+ };
31
+ export type TransitionGuard = {
32
+ name: string;
33
+ canTransition: (task: TaskEntity, targetState: TaskStatus, context: TransitionContext) => GuardResult;
34
+ };
35
+ export type TransitionEvidence = {
36
+ transitionId: string;
37
+ taskId: string;
38
+ fromState: TaskStatus;
39
+ toState: TaskStatus;
40
+ action: string;
41
+ guardResults: GuardResult[];
42
+ dependentsUnblocked: string[];
43
+ timestamp: string;
44
+ actor?: string;
45
+ };
46
+ export type TaskStoreDocument = {
47
+ schemaVersion: 1;
48
+ tasks: TaskEntity[];
49
+ transitionLog: TransitionEvidence[];
50
+ lastUpdated: string;
51
+ };
52
+ export type TaskEngineError = {
53
+ code: TaskEngineErrorCode;
54
+ message: string;
55
+ };
56
+ export type TaskEngineErrorCode = "invalid-transition" | "guard-rejected" | "dependency-unsatisfied" | "task-not-found" | "duplicate-task-id" | "invalid-task-schema" | "storage-read-error" | "storage-write-error" | "invalid-adapter" | "import-parse-error";
57
+ export type TaskAdapter = {
58
+ name: string;
59
+ supports: () => TaskAdapterCapability[];
60
+ load: () => Promise<TaskEntity[]>;
61
+ save?: (tasks: TaskEntity[]) => Promise<void>;
62
+ };
63
+ export type TaskAdapterCapability = "read" | "write" | "watch";
64
+ export type NextActionSuggestion = {
65
+ readyQueue: TaskEntity[];
66
+ suggestedNext: TaskEntity | null;
67
+ stateSummary: {
68
+ proposed: number;
69
+ ready: number;
70
+ in_progress: number;
71
+ blocked: number;
72
+ completed: number;
73
+ cancelled: number;
74
+ total: number;
75
+ };
76
+ blockingAnalysis: BlockingAnalysisEntry[];
77
+ };
78
+ export type BlockingAnalysisEntry = {
79
+ taskId: string;
80
+ blockedBy: string[];
81
+ blockingCount: number;
82
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { WorkflowModule } from "../../contracts/module-contract.js";
2
+ export declare const workspaceConfigModule: WorkflowModule;
@@ -0,0 +1,72 @@
1
+ import { explainConfigPath, resolveWorkspaceConfigWithLayers } from "../../core/workspace-kit-config.js";
2
+ async function handleExplainConfig(args, ctx) {
3
+ const pathArg = typeof args.path === "string" ? args.path.trim() : "";
4
+ if (!pathArg) {
5
+ return {
6
+ ok: false,
7
+ code: "invalid-config-path",
8
+ message: "explain-config requires string 'path' (dot-separated, e.g. tasks.storeRelativePath)"
9
+ };
10
+ }
11
+ const invocationConfig = typeof args.config === "object" && args.config !== null && !Array.isArray(args.config)
12
+ ? args.config
13
+ : {};
14
+ const { layers } = await resolveWorkspaceConfigWithLayers({
15
+ workspacePath: ctx.workspacePath,
16
+ registry: ctx.registry,
17
+ invocationConfig
18
+ });
19
+ const explained = explainConfigPath(pathArg, layers);
20
+ return {
21
+ ok: true,
22
+ code: "config-explained",
23
+ data: explained
24
+ };
25
+ }
26
+ export const workspaceConfigModule = {
27
+ registration: {
28
+ id: "workspace-config",
29
+ version: "0.4.0",
30
+ contractVersion: "1",
31
+ capabilities: ["diagnostics"],
32
+ dependsOn: [],
33
+ enabledByDefault: true,
34
+ config: {
35
+ path: "src/modules/workspace-config/config.md",
36
+ format: "md",
37
+ description: "Workspace config registry and explain surface."
38
+ },
39
+ state: {
40
+ path: "src/modules/workspace-config/state.md",
41
+ format: "md",
42
+ description: "Workspace config module runtime state (none)."
43
+ },
44
+ instructions: {
45
+ directory: "src/modules/workspace-config/instructions",
46
+ entries: [
47
+ {
48
+ name: "explain-config",
49
+ file: "explain-config.md",
50
+ description: "Agent-first JSON: effective config value and winning layer for a dotted path."
51
+ }
52
+ ]
53
+ }
54
+ },
55
+ async onCommand(command, ctx) {
56
+ if (command.name !== "explain-config") {
57
+ return { ok: false, code: "unknown-command", message: "workspace-config only implements explain-config" };
58
+ }
59
+ const reg = ctx.moduleRegistry;
60
+ if (!reg) {
61
+ return {
62
+ ok: false,
63
+ code: "internal-error",
64
+ message: "explain-config requires moduleRegistry on context (CLI wiring)"
65
+ };
66
+ }
67
+ return handleExplainConfig(command.args ?? {}, {
68
+ workspacePath: ctx.workspacePath,
69
+ registry: reg
70
+ });
71
+ }
72
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workflow-cannon/workspace-kit",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "packageManager": "pnpm@10.0.0",
6
6
  "license": "MIT",