@abhinav2203/codeflow-canvas 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.
Files changed (134) hide show
  1. package/abhinav2203-codeflow-canvas-0.1.0.tgz +0 -0
  2. package/dist/bin/cli.d.ts +3 -0
  3. package/dist/bin/cli.d.ts.map +1 -0
  4. package/dist/bin/cli.js +84 -0
  5. package/dist/bin/cli.js.map +1 -0
  6. package/dist/components/blueprint-workbench.d.ts +2 -0
  7. package/dist/components/blueprint-workbench.d.ts.map +1 -0
  8. package/dist/components/blueprint-workbench.js +144 -0
  9. package/dist/components/blueprint-workbench.js.map +1 -0
  10. package/dist/components/code-diff-editor.d.ts +12 -0
  11. package/dist/components/code-diff-editor.d.ts.map +1 -0
  12. package/dist/components/code-diff-editor.js +39 -0
  13. package/dist/components/code-diff-editor.js.map +1 -0
  14. package/dist/components/code-editor.d.ts +25 -0
  15. package/dist/components/code-editor.d.ts.map +1 -0
  16. package/dist/components/code-editor.js +264 -0
  17. package/dist/components/code-editor.js.map +1 -0
  18. package/dist/components/file-tabs.d.ts +5 -0
  19. package/dist/components/file-tabs.d.ts.map +1 -0
  20. package/dist/components/file-tabs.js +164 -0
  21. package/dist/components/file-tabs.js.map +1 -0
  22. package/dist/components/file-tree.d.ts +7 -0
  23. package/dist/components/file-tree.d.ts.map +1 -0
  24. package/dist/components/file-tree.js +176 -0
  25. package/dist/components/file-tree.js.map +1 -0
  26. package/dist/components/graph-canvas.d.ts +25 -0
  27. package/dist/components/graph-canvas.d.ts.map +1 -0
  28. package/dist/components/graph-canvas.js +224 -0
  29. package/dist/components/graph-canvas.js.map +1 -0
  30. package/dist/components/ide-layout.d.ts +10 -0
  31. package/dist/components/ide-layout.d.ts.map +1 -0
  32. package/dist/components/ide-layout.js +40 -0
  33. package/dist/components/ide-layout.js.map +1 -0
  34. package/dist/components/ide-workbench.d.ts +4 -0
  35. package/dist/components/ide-workbench.d.ts.map +1 -0
  36. package/dist/components/ide-workbench.js +6 -0
  37. package/dist/components/ide-workbench.js.map +1 -0
  38. package/dist/components/index.d.ts +13 -0
  39. package/dist/components/index.d.ts.map +1 -0
  40. package/dist/components/index.js +13 -0
  41. package/dist/components/index.js.map +1 -0
  42. package/dist/components/monaco-setup.d.ts +4 -0
  43. package/dist/components/monaco-setup.d.ts.map +1 -0
  44. package/dist/components/monaco-setup.js +34 -0
  45. package/dist/components/monaco-setup.js.map +1 -0
  46. package/dist/components/opencode-settings.d.ts +8 -0
  47. package/dist/components/opencode-settings.d.ts.map +1 -0
  48. package/dist/components/opencode-settings.js +33 -0
  49. package/dist/components/opencode-settings.js.map +1 -0
  50. package/dist/components/policy-workbench.d.ts +2 -0
  51. package/dist/components/policy-workbench.d.ts.map +1 -0
  52. package/dist/components/policy-workbench.js +102 -0
  53. package/dist/components/policy-workbench.js.map +1 -0
  54. package/dist/components/ts-language-service.d.ts +14 -0
  55. package/dist/components/ts-language-service.d.ts.map +1 -0
  56. package/dist/components/ts-language-service.js +123 -0
  57. package/dist/components/ts-language-service.js.map +1 -0
  58. package/dist/index.d.ts +23 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +22 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/lib/browser/storage.d.ts +16 -0
  63. package/dist/lib/browser/storage.d.ts.map +1 -0
  64. package/dist/lib/browser/storage.js +18 -0
  65. package/dist/lib/browser/storage.js.map +1 -0
  66. package/dist/lib/edit.d.ts +14 -0
  67. package/dist/lib/edit.d.ts.map +1 -0
  68. package/dist/lib/edit.js +57 -0
  69. package/dist/lib/edit.js.map +1 -0
  70. package/dist/lib/flow-view.d.ts +80 -0
  71. package/dist/lib/flow-view.d.ts.map +1 -0
  72. package/dist/lib/flow-view.js +850 -0
  73. package/dist/lib/flow-view.js.map +1 -0
  74. package/dist/lib/heatmap.d.ts +28 -0
  75. package/dist/lib/heatmap.d.ts.map +1 -0
  76. package/dist/lib/heatmap.js +61 -0
  77. package/dist/lib/heatmap.js.map +1 -0
  78. package/dist/lib/index.d.ts +9 -0
  79. package/dist/lib/index.d.ts.map +1 -0
  80. package/dist/lib/index.js +6 -0
  81. package/dist/lib/index.js.map +1 -0
  82. package/dist/lib/node-navigation.d.ts +36 -0
  83. package/dist/lib/node-navigation.d.ts.map +1 -0
  84. package/dist/lib/node-navigation.js +52 -0
  85. package/dist/lib/node-navigation.js.map +1 -0
  86. package/dist/lib/traces.d.ts +3 -0
  87. package/dist/lib/traces.d.ts.map +1 -0
  88. package/dist/lib/traces.js +64 -0
  89. package/dist/lib/traces.js.map +1 -0
  90. package/dist/lib/types.d.ts +57 -0
  91. package/dist/lib/types.d.ts.map +1 -0
  92. package/dist/lib/types.js +7 -0
  93. package/dist/lib/types.js.map +1 -0
  94. package/dist/store/blueprint-store.d.ts +35 -0
  95. package/dist/store/blueprint-store.d.ts.map +1 -0
  96. package/dist/store/blueprint-store.js +79 -0
  97. package/dist/store/blueprint-store.js.map +1 -0
  98. package/dist/store/index.d.ts +3 -0
  99. package/dist/store/index.d.ts.map +1 -0
  100. package/dist/store/index.js +2 -0
  101. package/dist/store/index.js.map +1 -0
  102. package/package.json +52 -0
  103. package/scripts/wrap-cli.mjs +15 -0
  104. package/src/bin/cli.ts +128 -0
  105. package/src/components/blueprint-workbench.tsx +305 -0
  106. package/src/components/code-diff-editor.tsx +80 -0
  107. package/src/components/code-editor.tsx +389 -0
  108. package/src/components/file-tabs.tsx +288 -0
  109. package/src/components/file-tree.tsx +301 -0
  110. package/src/components/graph-canvas.tsx +404 -0
  111. package/src/components/ide-layout.tsx +104 -0
  112. package/src/components/ide-workbench.tsx +5 -0
  113. package/src/components/index.ts +12 -0
  114. package/src/components/monaco-setup.ts +67 -0
  115. package/src/components/opencode-settings.tsx +82 -0
  116. package/src/components/policy-workbench.tsx +233 -0
  117. package/src/components/ts-language-service.ts +170 -0
  118. package/src/index.ts +54 -0
  119. package/src/lib/browser/storage.ts +19 -0
  120. package/src/lib/edit.ts +74 -0
  121. package/src/lib/flow-view.ts +1176 -0
  122. package/src/lib/heatmap.ts +103 -0
  123. package/src/lib/index.ts +41 -0
  124. package/src/lib/node-navigation.ts +76 -0
  125. package/src/lib/traces.ts +79 -0
  126. package/src/lib/types.ts +79 -0
  127. package/src/store/blueprint-store.ts +136 -0
  128. package/src/store/index.ts +2 -0
  129. package/test-fixtures/minimal-blueprint.json +34 -0
  130. package/test-fixtures/sample-blueprint.json +184 -0
  131. package/tsconfig.build.json +9 -0
  132. package/tsconfig.json +22 -0
  133. package/tsconfig.tsbuildinfo +1 -0
  134. package/vitest.config.ts +9 -0
package/src/index.ts ADDED
@@ -0,0 +1,54 @@
1
+ // Store exports
2
+ export { useBlueprintStore } from "./store/blueprint-store.js";
3
+ export type { BlueprintStore, FloatingGraphPanel, WorkbenchMode } from "./store/blueprint-store.js";
4
+
5
+ // Component exports
6
+ export { IdeLayout } from "./components/ide-layout.js";
7
+ export { FileTree } from "./components/file-tree.js";
8
+ export { FileTabs } from "./components/file-tabs.js";
9
+ export { GraphCanvas } from "./components/graph-canvas.js";
10
+ export { CodeEditor } from "./components/code-editor.js";
11
+ export { CodeDiffEditor } from "./components/code-diff-editor.js";
12
+ export { BlueprintWorkbench } from "./components/blueprint-workbench.js";
13
+ export { PolicyWorkbench } from "./components/policy-workbench.js";
14
+ export { IdeWorkbench } from "./components/ide-workbench.js";
15
+ export { OpencodeSettings } from "./components/opencode-settings.js";
16
+ export { prepareMonaco, toMonacoPath } from "./components/monaco-setup.js";
17
+ export { TypeScriptLanguageService, getTypeScriptLanguageService } from "./components/ts-language-service.js";
18
+
19
+ // Library exports
20
+ export { computeHeatmap, heatColor, heatGlow } from "./lib/heatmap.js";
21
+ export type { HeatmapData, HeatmapNodeMetric } from "./lib/heatmap.js";
22
+
23
+ export { applyTraceOverlay } from "./lib/traces.js";
24
+
25
+ export {
26
+ getNavigationTarget,
27
+ getNodesWithNavigation,
28
+ formatNavigationTarget,
29
+ hasNavigationMetadata,
30
+ isValidNavigationTarget
31
+ } from "./lib/node-navigation.js";
32
+ export type { NavigationTarget } from "./lib/node-navigation.js";
33
+
34
+ export { addNodeToGraph, addEdgeToGraph, deleteNodeFromGraph } from "./lib/edit.js";
35
+
36
+ export {
37
+ buildFlowNodes,
38
+ buildFlowEdges,
39
+ buildGhostFlowNodes,
40
+ buildDetailFlow,
41
+ indexRuntimeExecutionResult,
42
+ buildExecutionProjection
43
+ } from "./lib/flow-view.js";
44
+ export type {
45
+ NodeHealthState,
46
+ FlowExecutionStatus,
47
+ FlowExecutionState,
48
+ FlowExecutionIndex,
49
+ FlowExecutionProjection,
50
+ FlowNodeData,
51
+ InspectorSection,
52
+ DetailFlowItem,
53
+ DetailFlowGraph
54
+ } from "./lib/flow-view.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Type stubs for storage utilities.
3
+ * These are browser-specific and should be provided by the consumer.
4
+ */
5
+
6
+ // Storage key constants
7
+ export const AUTO_IMPLEMENT_STORAGE_KEY = "codeflow:auto-implement";
8
+ export const LIVE_COMPLETIONS_STORAGE_KEY = "codeflow:live-completions";
9
+ export const THEME_STORAGE_KEY = "codeflow:theme";
10
+
11
+ // Placeholder implementations - consumer should override
12
+ export const loadSessionApiKey = (): string => "";
13
+ export const storeSessionApiKey = (_key: string): void => {};
14
+ export const readLocalBooleanPreference = (_key: string, _defaultValue: boolean): boolean => _defaultValue;
15
+ export const readLocalPreference = (_key: string, _defaultValue: string): string => _defaultValue;
16
+ export const writeLocalBooleanPreference = (_key: string, _value: boolean): void => {};
17
+ export const writeLocalPreference = (_key: string, _value: string): void => {};
18
+ export const readRepoPath = (): string => "";
19
+ export const writeRepoPath = (_path: string): void => {};
@@ -0,0 +1,74 @@
1
+ import type {
2
+ BlueprintEdge,
3
+ BlueprintGraph,
4
+ BlueprintNode,
5
+ BlueprintNodeKind
6
+ } from "@abhinav2203/codeflow-core/schema";
7
+ import { emptyContract } from "@abhinav2203/codeflow-core/schema";
8
+
9
+ // Utility functions inlined from @abhinav2203/codeflow-core
10
+ const createNodeId = (kind: BlueprintNodeKind, name: string): string => {
11
+ const slug = name.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
12
+ return `${kind}:${slug}`;
13
+ };
14
+
15
+ const dedupeEdges = (edges: BlueprintEdge[]): BlueprintEdge[] => {
16
+ const seen = new Set<string>();
17
+ return edges.filter((edge) => {
18
+ const key = `${edge.from}:${edge.to}:${edge.kind}`;
19
+ if (seen.has(key)) return false;
20
+ seen.add(key);
21
+ return true;
22
+ });
23
+ };
24
+
25
+ // Draft management - inlined from phases
26
+ const withSpecDrafts = (graph: BlueprintGraph): BlueprintGraph => graph;
27
+
28
+ export const addNodeToGraph = (
29
+ graph: BlueprintGraph,
30
+ input: { kind: BlueprintNodeKind; name: string; summary?: string }
31
+ ): BlueprintGraph => {
32
+ const node: BlueprintNode = {
33
+ id: createNodeId(input.kind, input.name),
34
+ kind: input.kind,
35
+ name: input.name,
36
+ summary: input.summary ?? `${input.kind} ${input.name}`,
37
+ contract: {
38
+ ...emptyContract(),
39
+ summary: input.summary ?? `${input.kind} ${input.name}`
40
+ },
41
+ sourceRefs: [{ kind: "generated", detail: "Added in workbench" }],
42
+ generatedRefs: [],
43
+ traceRefs: []
44
+ };
45
+
46
+ return withSpecDrafts({
47
+ ...graph,
48
+ nodes: [...graph.nodes.filter((existing) => existing.id !== node.id), node]
49
+ });
50
+ };
51
+
52
+ export const addEdgeToGraph = (
53
+ graph: BlueprintGraph,
54
+ input: { from: string; to: string; kind: BlueprintEdge["kind"]; label?: string }
55
+ ): BlueprintGraph => ({
56
+ ...graph,
57
+ edges: dedupeEdges([
58
+ ...graph.edges,
59
+ {
60
+ from: input.from,
61
+ to: input.to,
62
+ kind: input.kind,
63
+ label: input.label,
64
+ required: true,
65
+ confidence: 1
66
+ }
67
+ ])
68
+ });
69
+
70
+ export const deleteNodeFromGraph = (graph: BlueprintGraph, nodeId: string): BlueprintGraph => ({
71
+ ...graph,
72
+ nodes: graph.nodes.filter((node) => node.id !== nodeId),
73
+ edges: graph.edges.filter((edge) => edge.from !== nodeId && edge.to !== nodeId)
74
+ });