kcg-code 0.1.0 → 0.2.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 (82) hide show
  1. package/README.md +2 -0
  2. package/package.json +2 -1
  3. package/src/cli/__tests__/daemon.test.ts +84 -0
  4. package/src/cli/__tests__/dashboard.test.ts +170 -8
  5. package/src/cli/__tests__/keep-awake.test.ts +44 -0
  6. package/src/cli/__tests__/port.test.ts +86 -0
  7. package/src/cli/args.ts +69 -6
  8. package/src/cli/attach.ts +154 -0
  9. package/src/cli/commands.ts +174 -21
  10. package/src/cli/daemon.ts +275 -0
  11. package/src/cli/dashboard.tsx +876 -159
  12. package/src/cli/index.ts +10 -0
  13. package/src/cli/keep-awake.ts +148 -0
  14. package/src/cli/port.ts +92 -0
  15. package/src/cli/theme.ts +6 -6
  16. package/src/components/layout/AppShell.tsx +8 -3
  17. package/src/components/projects/HomeChat.tsx +85 -48
  18. package/src/components/projects/HomeRecentSessions.tsx +90 -0
  19. package/src/components/projects/ProjectInstructions.tsx +27 -38
  20. package/src/components/projects/ProjectSidePanel.tsx +382 -316
  21. package/src/components/sessions/AgentLogo.tsx +42 -0
  22. package/src/components/sessions/AgentPicker.tsx +13 -4
  23. package/src/components/sessions/ConfirmSessionDeleteDialog.tsx +27 -7
  24. package/src/components/sessions/ContextPanel.tsx +159 -59
  25. package/src/components/sessions/ModelPicker.tsx +65 -27
  26. package/src/components/sessions/ModelSearchList.tsx +137 -57
  27. package/src/components/sessions/NewSessionDialog.tsx +100 -117
  28. package/src/components/sessions/SessionComposer.tsx +2 -1
  29. package/src/components/sessions/SessionHeader.tsx +1 -0
  30. package/src/components/sessions/SessionList.tsx +173 -66
  31. package/src/components/sessions/SessionRow.tsx +176 -76
  32. package/src/components/sessions/SessionView.tsx +17 -13
  33. package/src/components/sessions/__tests__/ContextPanel.test.tsx +36 -0
  34. package/src/components/settings/LhrRemoteAccess.tsx +20 -25
  35. package/src/components/settings/RemoteAccessGroup.tsx +242 -267
  36. package/src/components/settings/prefs.tsx +69 -1
  37. package/src/components/skills/InstallNotifications.tsx +4 -3
  38. package/src/components/skills/InstallSkillDialog.tsx +256 -99
  39. package/src/components/skills/SkillCards.tsx +52 -8
  40. package/src/components/ui/adw-dialog.tsx +114 -0
  41. package/src/components/ui/adw-toggle-group.tsx +75 -0
  42. package/src/components/ui/search-entry.tsx +70 -0
  43. package/src/config.ts +32 -3
  44. package/src/hooks/useAgentPicker.ts +6 -2
  45. package/src/hooks/useSessionList.ts +95 -2
  46. package/src/lib/__tests__/project-extensions.test.ts +32 -1
  47. package/src/lib/__tests__/project-overview.test.ts +15 -0
  48. package/src/lib/__tests__/routes.test.ts +2 -2
  49. package/src/lib/__tests__/session-selection.test.ts +41 -0
  50. package/src/lib/__tests__/skill-installs.test.ts +1 -0
  51. package/src/lib/__tests__/skills-catalog.test.ts +36 -8
  52. package/src/lib/agent-types.ts +49 -0
  53. package/src/lib/project-extensions.ts +66 -4
  54. package/src/lib/project-overview.ts +14 -8
  55. package/src/lib/routes.ts +13 -4
  56. package/src/lib/session-selection.ts +40 -0
  57. package/src/lib/skill-installs.ts +3 -1
  58. package/src/lib/skills-catalog.ts +56 -17
  59. package/src/pages/projects/ProjectDetailPage.tsx +13 -12
  60. package/src/pages/settings/SettingsPage.tsx +212 -145
  61. package/src/pages/settings/__tests__/SettingsPage.test.ts +11 -4
  62. package/src/pages/skills/SkillsPage.tsx +89 -45
  63. package/src/server/__tests__/app.test.ts +15 -2
  64. package/src/server/app.ts +13 -1
  65. package/src/server/routes/projects.routes.ts +14 -4
  66. package/src/server/routes/sessions.routes.ts +1 -1
  67. package/src/server/routes/skills.routes.ts +24 -5
  68. package/src/server/services/__tests__/claude-code.test.ts +609 -0
  69. package/src/server/services/__tests__/claude-mcp.test.ts +90 -0
  70. package/src/server/services/__tests__/claude-skills.test.ts +63 -0
  71. package/src/server/services/__tests__/session-manager.test.ts +40 -0
  72. package/src/server/services/__tests__/skill-install-jobs.test.ts +22 -3
  73. package/src/server/services/__tests__/skills-registry.test.ts +6 -0
  74. package/src/server/services/claude-code-client.ts +1093 -0
  75. package/src/server/services/claude-code-translate.ts +370 -0
  76. package/src/server/services/claude-mcp.ts +122 -0
  77. package/src/server/services/claude-skills.ts +102 -0
  78. package/src/server/services/session-manager.ts +117 -52
  79. package/src/server/services/skill-install-jobs.ts +21 -8
  80. package/src/server/services/skills-registry.ts +18 -6
  81. package/src/types/message.ts +1 -1
  82. package/src/components/projects/PanelSection.tsx +0 -102
@@ -1,15 +1,16 @@
1
1
  /**
2
- * Custom instruction Project — seksi di panel samping + dialog editor.
2
+ * Custom instruction Project — grup di panel samping (gaya libadwaita:
3
+ * judul grup + satu baris yang membuka editor) + dialog editor.
3
4
  *
4
5
  * Instruksi disimpan lewat `PATCH /api/projects/:id` dan dikirim server
5
6
  * sebagai `system` di setiap prompt Session milik Project ini (ditambahkan
6
7
  * di atas AGENTS.md / instruksi bawaan opencode). Perubahan langsung berlaku
7
8
  * untuk prompt berikutnya, termasuk di Session yang sudah berjalan.
8
9
  */
9
- import { PencilIcon, PlusIcon, ScrollTextIcon } from "lucide-react";
10
+ import { ScrollTextIcon } from "lucide-react";
10
11
  import { useEffect, useId, useState } from "react";
11
12
  import { toast } from "sonner";
12
- import { PanelBody, PanelSection } from "@/components/projects/PanelSection";
13
+ import { ActionRow, PrefsGroup } from "@/components/settings/prefs";
13
14
  import { Alert, AlertDescription } from "@/components/ui/alert";
14
15
  import { Button } from "@/components/ui/button";
15
16
  import {
@@ -41,38 +42,26 @@ export function ProjectInstructions({ project, onSaved }: ProjectInstructionsPro
41
42
  const hasInstructions = instructions.length > 0;
42
43
 
43
44
  return (
44
- <PanelSection
45
- id="instructions"
46
- title="Instructions"
47
- icon={<ScrollTextIcon />}
48
- meta={hasInstructions ? `${instructions.length.toLocaleString()} characters` : "Not set"}
49
- >
50
- {hasInstructions ? (
51
- <button
52
- type="button"
53
- onClick={() => setOpen(true)}
54
- className="group flex w-full flex-col gap-2 px-3.5 py-3 text-left transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:outline-none"
55
- >
56
- <span className="line-clamp-4 text-[13px] leading-relaxed whitespace-pre-line text-foreground/85">
57
- {instructions}
58
- </span>
59
- <span className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground group-hover:text-foreground">
60
- <PencilIcon className="size-3.5" aria-hidden />
61
- Edit
62
- </span>
63
- </button>
64
- ) : (
65
- <PanelBody className="flex flex-col items-start gap-2.5">
66
- <p className="text-xs leading-relaxed text-muted-foreground">
67
- Tell the agent how to work in this project, like the language to reply in or tools to
68
- prefer.
69
- </p>
70
- <Button type="button" variant="outline" size="sm" onClick={() => setOpen(true)}>
71
- <PlusIcon data-icon="inline-start" />
72
- Add instructions
73
- </Button>
74
- </PanelBody>
75
- )}
45
+ <>
46
+ {/* AdwPreferencesGroup + satu AdwActionRow yang bisa diaktifkan:
47
+ klik baris membuka editor. */}
48
+ <PrefsGroup
49
+ title="Instructions"
50
+ description="Sent with every prompt in this project, for both OpenCode and Claude Code."
51
+ >
52
+ <ActionRow
53
+ prefix={<ScrollTextIcon className="size-[18px] text-muted-foreground" aria-hidden />}
54
+ title={hasInstructions ? "Custom instructions" : "Add instructions"}
55
+ subtitle={
56
+ hasInstructions ? (
57
+ <span className="line-clamp-2 whitespace-pre-line">{instructions}</span>
58
+ ) : (
59
+ "Like the language to reply in or tools to prefer"
60
+ )
61
+ }
62
+ onActivate={() => setOpen(true)}
63
+ />
64
+ </PrefsGroup>
76
65
 
77
66
  <InstructionsDialog
78
67
  open={open}
@@ -83,7 +72,7 @@ export function ProjectInstructions({ project, onSaved }: ProjectInstructionsPro
83
72
  setOpen(false);
84
73
  }}
85
74
  />
86
- </PanelSection>
75
+ </>
87
76
  );
88
77
  }
89
78
 
@@ -138,8 +127,8 @@ function InstructionsDialog({
138
127
  <DialogHeader>
139
128
  <DialogTitle>Custom instructions</DialogTitle>
140
129
  <DialogDescription>
141
- Sent to the agent with every prompt in {project.name}, on top of AGENTS.md. Changes
142
- apply from the next message.
130
+ Sent to the agent with every prompt in {project.name}, on top of AGENTS.md / CLAUDE.md.
131
+ Changes apply from the next message.
143
132
  </DialogDescription>
144
133
  </DialogHeader>
145
134