@doriandev/devcc 0.1.2 → 0.3.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.
- package/README.md +589 -389
- package/bin/devcc.mjs +50 -23
- package/dist/devcc/agents/agents.d.ts +119 -0
- package/dist/devcc/agents/agents.d.ts.map +1 -0
- package/dist/devcc/agents/agents.js +182 -0
- package/dist/devcc/agents/agents.js.map +1 -0
- package/dist/devcc/app/App.d.ts +23 -0
- package/dist/devcc/app/App.d.ts.map +1 -1
- package/dist/devcc/app/App.js +451 -19
- package/dist/devcc/app/App.js.map +1 -1
- package/dist/devcc/app/controlPlaneCommands.d.ts +14 -0
- package/dist/devcc/app/controlPlaneCommands.d.ts.map +1 -0
- package/dist/devcc/app/controlPlaneCommands.js +204 -0
- package/dist/devcc/app/controlPlaneCommands.js.map +1 -0
- package/dist/devcc/app/keymap.d.ts.map +1 -1
- package/dist/devcc/app/keymap.js +25 -3
- package/dist/devcc/app/keymap.js.map +1 -1
- package/dist/devcc/automation.d.ts +52 -0
- package/dist/devcc/automation.d.ts.map +1 -0
- package/dist/devcc/automation.js +339 -0
- package/dist/devcc/automation.js.map +1 -0
- package/dist/devcc/cli.d.ts.map +1 -1
- package/dist/devcc/cli.js +73 -3
- package/dist/devcc/cli.js.map +1 -1
- package/dist/devcc/components/Sidebar.d.ts.map +1 -1
- package/dist/devcc/components/Sidebar.js +1 -0
- package/dist/devcc/components/Sidebar.js.map +1 -1
- package/dist/devcc/components/primitives.d.ts.map +1 -1
- package/dist/devcc/components/primitives.js +3 -0
- package/dist/devcc/components/primitives.js.map +1 -1
- package/dist/devcc/core/commands.d.ts +33 -0
- package/dist/devcc/core/commands.d.ts.map +1 -1
- package/dist/devcc/core/commands.js.map +1 -1
- package/dist/devcc/core/config.d.ts +71 -3
- package/dist/devcc/core/config.d.ts.map +1 -1
- package/dist/devcc/core/config.js +189 -5
- package/dist/devcc/core/config.js.map +1 -1
- package/dist/devcc/core/state.d.ts +19 -1
- package/dist/devcc/core/state.d.ts.map +1 -1
- package/dist/devcc/core/state.js +6 -0
- package/dist/devcc/core/state.js.map +1 -1
- package/dist/devcc/environment/EnvironmentService.d.ts +58 -0
- package/dist/devcc/environment/EnvironmentService.d.ts.map +1 -0
- package/dist/devcc/environment/EnvironmentService.js +159 -0
- package/dist/devcc/environment/EnvironmentService.js.map +1 -0
- package/dist/devcc/environment/integrations.d.ts +52 -0
- package/dist/devcc/environment/integrations.d.ts.map +1 -0
- package/dist/devcc/environment/integrations.js +94 -0
- package/dist/devcc/environment/integrations.js.map +1 -0
- package/dist/devcc/environment/tools.d.ts +51 -0
- package/dist/devcc/environment/tools.d.ts.map +1 -0
- package/dist/devcc/environment/tools.js +99 -0
- package/dist/devcc/environment/tools.js.map +1 -0
- package/dist/devcc/git/GitService.d.ts +26 -0
- package/dist/devcc/git/GitService.d.ts.map +1 -1
- package/dist/devcc/git/GitService.js +71 -2
- package/dist/devcc/git/GitService.js.map +1 -1
- package/dist/devcc/git/worktrees.d.ts +88 -0
- package/dist/devcc/git/worktrees.d.ts.map +1 -0
- package/dist/devcc/git/worktrees.js +226 -0
- package/dist/devcc/git/worktrees.js.map +1 -0
- package/dist/devcc/index.d.ts +15 -3
- package/dist/devcc/index.d.ts.map +1 -1
- package/dist/devcc/index.js +14 -2
- package/dist/devcc/index.js.map +1 -1
- package/dist/devcc/init/detect.d.ts +55 -0
- package/dist/devcc/init/detect.d.ts.map +1 -0
- package/dist/devcc/init/detect.js +207 -0
- package/dist/devcc/init/detect.js.map +1 -0
- package/dist/devcc/init/prompt.d.ts +25 -0
- package/dist/devcc/init/prompt.d.ts.map +1 -0
- package/dist/devcc/init/prompt.js +156 -0
- package/dist/devcc/init/prompt.js.map +1 -0
- package/dist/devcc/platform/launch.d.ts +30 -0
- package/dist/devcc/platform/launch.d.ts.map +1 -0
- package/dist/devcc/platform/launch.js +93 -0
- package/dist/devcc/platform/launch.js.map +1 -0
- package/dist/devcc/services/ServiceManager.d.ts +10 -2
- package/dist/devcc/services/ServiceManager.d.ts.map +1 -1
- package/dist/devcc/services/ServiceManager.js +18 -4
- package/dist/devcc/services/ServiceManager.js.map +1 -1
- package/dist/devcc/services/node.d.ts +11 -0
- package/dist/devcc/services/node.d.ts.map +1 -1
- package/dist/devcc/services/node.js +20 -18
- package/dist/devcc/services/node.js.map +1 -1
- package/dist/devcc/services/ollama.d.ts +64 -5
- package/dist/devcc/services/ollama.d.ts.map +1 -1
- package/dist/devcc/services/ollama.js +118 -17
- package/dist/devcc/services/ollama.js.map +1 -1
- package/dist/devcc/services/remote.d.ts +90 -0
- package/dist/devcc/services/remote.d.ts.map +1 -0
- package/dist/devcc/services/remote.js +233 -0
- package/dist/devcc/services/remote.js.map +1 -0
- package/dist/devcc/services/types.d.ts +8 -1
- package/dist/devcc/services/types.d.ts.map +1 -1
- package/dist/devcc/services/types.js.map +1 -1
- package/dist/devcc/utils/exec.d.ts +6 -0
- package/dist/devcc/utils/exec.d.ts.map +1 -1
- package/dist/devcc/utils/exec.js +12 -2
- package/dist/devcc/utils/exec.js.map +1 -1
- package/dist/devcc/verify/verify.d.ts +107 -0
- package/dist/devcc/verify/verify.d.ts.map +1 -0
- package/dist/devcc/verify/verify.js +203 -0
- package/dist/devcc/verify/verify.js.map +1 -0
- package/dist/devcc/views/OverviewView.d.ts.map +1 -1
- package/dist/devcc/views/OverviewView.js +58 -2
- package/dist/devcc/views/OverviewView.js.map +1 -1
- package/dist/devcc/views/ServicesView.d.ts +2 -0
- package/dist/devcc/views/ServicesView.d.ts.map +1 -1
- package/dist/devcc/views/ServicesView.js +15 -0
- package/dist/devcc/views/ServicesView.js.map +1 -1
- package/dist/devcc/views/SystemView.d.ts +10 -1
- package/dist/devcc/views/SystemView.d.ts.map +1 -1
- package/dist/devcc/views/SystemView.js +127 -19
- package/dist/devcc/views/SystemView.js.map +1 -1
- package/dist/devcc/views/WorktreesView.d.ts +48 -0
- package/dist/devcc/views/WorktreesView.d.ts.map +1 -0
- package/dist/devcc/views/WorktreesView.js +235 -0
- package/dist/devcc/views/WorktreesView.js.map +1 -0
- package/package.json +1 -1
- package/src/devcc/agents/agents.ts +292 -0
- package/src/devcc/app/App.ts +529 -22
- package/src/devcc/app/controlPlaneCommands.ts +227 -0
- package/src/devcc/app/keymap.ts +25 -3
- package/src/devcc/automation.ts +409 -0
- package/src/devcc/cli.ts +77 -3
- package/src/devcc/components/Sidebar.ts +1 -0
- package/src/devcc/components/primitives.ts +3 -0
- package/src/devcc/core/commands.ts +34 -0
- package/src/devcc/core/config.ts +275 -11
- package/src/devcc/core/state.ts +25 -0
- package/src/devcc/environment/EnvironmentService.ts +215 -0
- package/src/devcc/environment/integrations.ts +133 -0
- package/src/devcc/environment/tools.ts +151 -0
- package/src/devcc/git/GitService.ts +104 -2
- package/src/devcc/git/worktrees.ts +256 -0
- package/src/devcc/index.ts +66 -2
- package/src/devcc/init/detect.ts +268 -0
- package/src/devcc/init/prompt.ts +179 -0
- package/src/devcc/platform/launch.ts +125 -0
- package/src/devcc/services/ServiceManager.ts +15 -3
- package/src/devcc/services/node.ts +17 -14
- package/src/devcc/services/ollama.ts +162 -19
- package/src/devcc/services/remote.ts +306 -0
- package/src/devcc/services/types.ts +9 -1
- package/src/devcc/utils/exec.ts +26 -2
- package/src/devcc/verify/verify.ts +316 -0
- package/src/devcc/views/OverviewView.ts +84 -2
- package/src/devcc/views/ServicesView.ts +17 -0
- package/src/devcc/views/SystemView.ts +144 -22
- package/src/devcc/views/WorktreesView.ts +270 -0
package/dist/devcc/index.js
CHANGED
|
@@ -6,16 +6,25 @@
|
|
|
6
6
|
* git parsing) without the UI.
|
|
7
7
|
*/
|
|
8
8
|
export { App } from "./app/App.js";
|
|
9
|
+
export { createControlPlaneCommands } from "./app/controlPlaneCommands.js";
|
|
10
|
+
export { AgentManager, BUILTIN_AGENTS, createAgentAdapters, } from "./agents/agents.js";
|
|
11
|
+
export { configCheckCommand, envCommand, initCommand, verifyCommand, worktreeListCommand, } from "./automation.js";
|
|
12
|
+
export { detectProject, renderStarterConfig, starterConfig } from "./init/detect.js";
|
|
13
|
+
export { buildSetupPrompt, extractConfigFromOutput } from "./init/prompt.js";
|
|
9
14
|
export { createBuiltinCommands, createConfigCommands, createScriptCommands } from "./app/builtinCommands.js";
|
|
10
15
|
export { HELP_SECTIONS, VIEW_SHORTCUTS } from "./app/keymap.js";
|
|
11
16
|
export { theme, glyphs, processStatusStyle, serviceStateStyle } from "./app/theme.js";
|
|
12
17
|
export { CommandRegistry } from "./core/commands.js";
|
|
13
|
-
export { defineConfig, loadConfig, validateConfig, findConfigFile, CONFIG_FILENAMES, DEFAULT_REFRESH, } from "./core/config.js";
|
|
18
|
+
export { defineConfig, loadConfig, validateConfig, findConfigFile, loadConfigFile, CONFIG_FILENAMES, DEFAULT_REFRESH, } from "./core/config.js";
|
|
14
19
|
export { TypedEmitter, Subscriptions } from "./core/events.js";
|
|
15
20
|
export { Store, VIEW_IDS, createInitialState, } from "./core/state.js";
|
|
16
21
|
export { DependencyService, updateArgs } from "./deps/DependencyService.js";
|
|
17
22
|
export { outdatedArgs, parseOutdated, severityBetween, sortOutdated, summariseOutdated, supportsOutdatedJson, } from "./deps/parse.js";
|
|
23
|
+
export { EnvironmentService } from "./environment/EnvironmentService.js";
|
|
24
|
+
export { parseDirenvStatus, parseMiseLs, } from "./environment/integrations.js";
|
|
25
|
+
export { DEFAULT_TOOLS, detectTool, findExecutable, } from "./environment/tools.js";
|
|
18
26
|
export { GitService } from "./git/GitService.js";
|
|
27
|
+
export { defaultWorktreePath, parseWorktreeList, removalBlocker, validateBranchName, worktreeAddArgs, worktreeRemoveArgs, } from "./git/worktrees.js";
|
|
19
28
|
export { parseCommits, parsePorcelainV2, summariseStatus, summariseTracking, } from "./git/parse.js";
|
|
20
29
|
export { LogBuffer, LogStore, MAX_LOG_LINES, } from "./logs/LogBuffer.js";
|
|
21
30
|
export { canTransition, crashBackoffDelay, shouldAutoRestart, DEFAULT_CRASH_POLICY, createManagedProcess, describeCommand, isActive, } from "./processes/ManagedProcess.js";
|
|
@@ -25,7 +34,9 @@ export { buildProjectList, discoverProjects, isProjectDirectory, readRecents, re
|
|
|
25
34
|
export { ServiceManager } from "./services/ServiceManager.js";
|
|
26
35
|
export { DockerService, findComposeFile, parseComposePs } from "./services/docker.js";
|
|
27
36
|
export { PortService, detectNodeServices } from "./services/node.js";
|
|
28
|
-
export { OllamaService } from "./services/ollama.js";
|
|
37
|
+
export { mergeOllamaModels, OllamaService } from "./services/ollama.js";
|
|
38
|
+
export { parseTailscaleStatus, RemoteMachineService, TailscaleService, } from "./services/remote.js";
|
|
39
|
+
export { editorCommand, launchDetached, sshCommand, terminalCommand } from "./platform/launch.js";
|
|
29
40
|
export { PostgresService, parsePostgresUrl } from "./services/postgres.js";
|
|
30
41
|
export { RedisService, parseRedisUrl } from "./services/redis.js";
|
|
31
42
|
export { SystemMonitor, cpuUsageBetween, sampleCpu } from "./system/SystemMonitor.js";
|
|
@@ -33,4 +44,5 @@ export { DevccError, errorMessage, toDevccError } from "./utils/errors.js";
|
|
|
33
44
|
export { Logger, createLogger } from "./utils/logger.js";
|
|
34
45
|
export { detectPackageManager, readPackageJson, readScripts, runScriptArgs, } from "./utils/packageManager.js";
|
|
35
46
|
export { findProjectRoot } from "./utils/paths.js";
|
|
47
|
+
export { createSpawnExecutor, resolveVerifySteps, runVerification, } from "./verify/verify.js";
|
|
36
48
|
//# sourceMappingURL=index.js.map
|
package/dist/devcc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/devcc/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAmB,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC5G,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AA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AAsB,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAoB,MAAM,sBAAsB,CAAA;AACzF,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,GAEjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACjG,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAAsB,MAAM,2BAA2B,CAAA;AAEzG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,YAAY,EAAiB,MAAM,mBAAmB,CAAA;AACvE,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,aAAa,GAEd,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,GAIhB,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ProcessDefinition } from "../processes/ManagedProcess.js";
|
|
2
|
+
import { type PackageManagerDetection, type PackageScript } from "../utils/packageManager.js";
|
|
3
|
+
import type { VerifyEntry } from "../verify/verify.js";
|
|
4
|
+
/**
|
|
5
|
+
* Project detection for `devcc init` and the agent setup prompt.
|
|
6
|
+
*
|
|
7
|
+
* Only facts that can be read from the repository are collected - nothing is
|
|
8
|
+
* executed and nothing is guessed. The starter config built from them is
|
|
9
|
+
* deliberately conservative: a script is only used when it exists.
|
|
10
|
+
*/
|
|
11
|
+
export interface ProjectFacts {
|
|
12
|
+
rootDir: string;
|
|
13
|
+
name: string;
|
|
14
|
+
/** Existing config file, if any. */
|
|
15
|
+
configPath: string | null;
|
|
16
|
+
hasGit: boolean;
|
|
17
|
+
/** Null when there is no package.json. */
|
|
18
|
+
packageManager: PackageManagerDetection | null;
|
|
19
|
+
scripts: PackageScript[];
|
|
20
|
+
frameworks: {
|
|
21
|
+
name: string;
|
|
22
|
+
dependency: string;
|
|
23
|
+
port: number;
|
|
24
|
+
}[];
|
|
25
|
+
/** Script chosen to run the app in development. */
|
|
26
|
+
devScript?: string;
|
|
27
|
+
/** Scripts suitable for `verify`, in the order they should run. */
|
|
28
|
+
verifyScripts: string[];
|
|
29
|
+
/** Scripts that look like verification but were left out, with the reason. */
|
|
30
|
+
skippedScripts: {
|
|
31
|
+
name: string;
|
|
32
|
+
reason: string;
|
|
33
|
+
}[];
|
|
34
|
+
monorepo: string | null;
|
|
35
|
+
languages: ("node" | "rust" | "go" | "python")[];
|
|
36
|
+
/** Notable files present at the root (compose file, .envrc, mise.toml, Makefile, ...). */
|
|
37
|
+
files: string[];
|
|
38
|
+
}
|
|
39
|
+
type Exists = (path: string) => boolean;
|
|
40
|
+
/** Why a script cannot be a verify step, or null when it can. */
|
|
41
|
+
export declare function unsuitableForVerify(command: string): string | null;
|
|
42
|
+
export declare function detectProject(rootDir: string, exists?: Exists): ProjectFacts;
|
|
43
|
+
export interface StarterConfig {
|
|
44
|
+
processes: ProcessDefinition[];
|
|
45
|
+
verify: VerifyEntry[];
|
|
46
|
+
}
|
|
47
|
+
export declare function starterConfig(facts: ProjectFacts): StarterConfig;
|
|
48
|
+
/** Render the starter as a `.devcc.ts` file. Plain object: no dependency on devcc is required. */
|
|
49
|
+
export declare function renderStarterConfig(facts: ProjectFacts, date?: Date): string;
|
|
50
|
+
/** A TypeScript object literal: identifier keys unquoted, values JSON-encoded. */
|
|
51
|
+
export declare function literal(value: unknown, indent?: number): string;
|
|
52
|
+
/** Short file contents for the prompt, so the agent starts from real data. */
|
|
53
|
+
export declare function readSnippet(path: string, maxLength?: number): string | null;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../src/devcc/init/detect.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,EAML,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,oCAAoC;IACpC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;IACf,0CAA0C;IAC1C,cAAc,EAAE,uBAAuB,GAAG,IAAI,CAAA;IAC9C,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAChE,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,8EAA8E;IAC9E,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAClD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,EAAE,CAAA;IAChD,0FAA0F;IAC1F,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;AAqCvC,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKlE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAmB,GAAG,YAAY,CAgExF;AAsBD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,iBAAiB,EAAE,CAAA;IAC9B,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa,CAchE;AAED,kGAAkG;AAClG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,OAAa,GAAG,MAAM,CAmClF;AAED,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,SAAI,GAAG,MAAM,CAoB1D;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,SAAQ,GAAG,MAAM,GAAG,IAAI,CAO1E"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { basename, join } from "node:path";
|
|
3
|
+
import { findConfigFile } from "../core/config.js";
|
|
4
|
+
import { detectFrameworks } from "../services/node.js";
|
|
5
|
+
import { detectPackageManager, readPackageJson, readScripts, runScriptArgs, } from "../utils/packageManager.js";
|
|
6
|
+
const DEV_SCRIPTS = ["dev", "start:dev", "develop", "serve"];
|
|
7
|
+
/** Verify categories in run order; the first matching script name in each wins. */
|
|
8
|
+
const VERIFY_CATEGORIES = [
|
|
9
|
+
["format:check", "format-check", "fmt:check", "prettier:check", "check:format", "lint:format"],
|
|
10
|
+
["lint"],
|
|
11
|
+
["typecheck", "type-check", "check-types", "types:check", "tsc"],
|
|
12
|
+
["test:ci", "test:run", "test:unit", "test"],
|
|
13
|
+
["build"],
|
|
14
|
+
];
|
|
15
|
+
/** Aggregate scripts used only when no individual checks exist. */
|
|
16
|
+
const AGGREGATE_SCRIPTS = ["verify", "ci", "check", "validate"];
|
|
17
|
+
const NOTABLE_FILES = [
|
|
18
|
+
"compose.yaml",
|
|
19
|
+
"compose.yml",
|
|
20
|
+
"docker-compose.yml",
|
|
21
|
+
"docker-compose.yaml",
|
|
22
|
+
".envrc",
|
|
23
|
+
"mise.toml",
|
|
24
|
+
".mise.toml",
|
|
25
|
+
".tool-versions",
|
|
26
|
+
".env.example",
|
|
27
|
+
"Makefile",
|
|
28
|
+
"turbo.json",
|
|
29
|
+
"nx.json",
|
|
30
|
+
"pnpm-workspace.yaml",
|
|
31
|
+
"Cargo.toml",
|
|
32
|
+
"go.mod",
|
|
33
|
+
"pyproject.toml",
|
|
34
|
+
"AGENTS.md",
|
|
35
|
+
"CLAUDE.md",
|
|
36
|
+
];
|
|
37
|
+
/** Why a script cannot be a verify step, or null when it can. */
|
|
38
|
+
export function unsuitableForVerify(command) {
|
|
39
|
+
if (/--watch\b|\bwatch\b/u.test(command))
|
|
40
|
+
return "runs in watch mode";
|
|
41
|
+
if (/no test specified/u.test(command))
|
|
42
|
+
return "is npm's placeholder";
|
|
43
|
+
if (/--fix\b|--write\b/u.test(command))
|
|
44
|
+
return "modifies files";
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
export function detectProject(rootDir, exists = existsSync) {
|
|
48
|
+
const packageJson = readPackageJson(rootDir);
|
|
49
|
+
const scripts = readScripts(packageJson);
|
|
50
|
+
const byName = new Map(scripts.map((script) => [script.name, script.command]));
|
|
51
|
+
const verifyScripts = [];
|
|
52
|
+
const skippedScripts = [];
|
|
53
|
+
for (const category of VERIFY_CATEGORIES) {
|
|
54
|
+
for (const name of category) {
|
|
55
|
+
const command = byName.get(name);
|
|
56
|
+
if (command === undefined)
|
|
57
|
+
continue;
|
|
58
|
+
const reason = unsuitableForVerify(command);
|
|
59
|
+
if (reason) {
|
|
60
|
+
skippedScripts.push({ name, reason });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
verifyScripts.push(name);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (verifyScripts.length === 0) {
|
|
68
|
+
const aggregate = AGGREGATE_SCRIPTS.find((name) => {
|
|
69
|
+
const command = byName.get(name);
|
|
70
|
+
return command !== undefined && unsuitableForVerify(command) === null;
|
|
71
|
+
});
|
|
72
|
+
if (aggregate)
|
|
73
|
+
verifyScripts.push(aggregate);
|
|
74
|
+
}
|
|
75
|
+
const files = NOTABLE_FILES.filter((file) => exists(join(rootDir, file)));
|
|
76
|
+
const languages = [];
|
|
77
|
+
if (packageJson)
|
|
78
|
+
languages.push("node");
|
|
79
|
+
if (files.includes("Cargo.toml"))
|
|
80
|
+
languages.push("rust");
|
|
81
|
+
if (files.includes("go.mod"))
|
|
82
|
+
languages.push("go");
|
|
83
|
+
if (files.includes("pyproject.toml"))
|
|
84
|
+
languages.push("python");
|
|
85
|
+
const monorepo = files.includes("pnpm-workspace.yaml")
|
|
86
|
+
? "pnpm workspaces"
|
|
87
|
+
: files.includes("turbo.json")
|
|
88
|
+
? "Turborepo"
|
|
89
|
+
: files.includes("nx.json")
|
|
90
|
+
? "Nx"
|
|
91
|
+
: packageJson?.workspaces
|
|
92
|
+
? "package.json workspaces"
|
|
93
|
+
: null;
|
|
94
|
+
return {
|
|
95
|
+
rootDir,
|
|
96
|
+
name: typeof packageJson?.name === "string" ? packageJson.name : basename(rootDir),
|
|
97
|
+
configPath: findConfigFile(rootDir, exists),
|
|
98
|
+
hasGit: exists(join(rootDir, ".git")),
|
|
99
|
+
packageManager: packageJson ? detectPackageManager({ rootDir, packageJson, fileExists: exists }) : null,
|
|
100
|
+
scripts,
|
|
101
|
+
frameworks: detectFrameworks(packageJson).map((hint) => ({
|
|
102
|
+
name: hint.name,
|
|
103
|
+
dependency: hint.dependency,
|
|
104
|
+
port: hint.port,
|
|
105
|
+
})),
|
|
106
|
+
devScript: DEV_SCRIPTS.find((name) => byName.has(name)),
|
|
107
|
+
verifyScripts,
|
|
108
|
+
skippedScripts,
|
|
109
|
+
monorepo,
|
|
110
|
+
languages,
|
|
111
|
+
files,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Inline verify steps for non-Node projects, using each toolchain's standard commands. */
|
|
115
|
+
function toolchainVerify(facts) {
|
|
116
|
+
if (facts.verifyScripts.length > 0)
|
|
117
|
+
return facts.verifyScripts;
|
|
118
|
+
if (facts.languages.includes("rust")) {
|
|
119
|
+
return [
|
|
120
|
+
{ id: "fmt", name: "cargo fmt", command: "cargo", args: ["fmt", "--check"] },
|
|
121
|
+
{ id: "clippy", name: "cargo clippy", command: "cargo", args: ["clippy", "--all-targets"] },
|
|
122
|
+
{ id: "test", name: "cargo test", command: "cargo", args: ["test"] },
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
if (facts.languages.includes("go")) {
|
|
126
|
+
return [
|
|
127
|
+
{ id: "vet", name: "go vet", command: "go", args: ["vet", "./..."] },
|
|
128
|
+
{ id: "test", name: "go test", command: "go", args: ["test", "./..."] },
|
|
129
|
+
{ id: "build", name: "go build", command: "go", args: ["build", "./..."] },
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
export function starterConfig(facts) {
|
|
135
|
+
const processes = [];
|
|
136
|
+
const manager = facts.packageManager?.manager;
|
|
137
|
+
if (manager && facts.devScript) {
|
|
138
|
+
const framework = facts.frameworks[0];
|
|
139
|
+
processes.push({
|
|
140
|
+
id: "dev",
|
|
141
|
+
name: framework?.name ?? `${manager} ${facts.devScript}`,
|
|
142
|
+
command: manager,
|
|
143
|
+
args: runScriptArgs(manager, facts.devScript),
|
|
144
|
+
...(framework ? { url: `localhost:${framework.port}`, readiness: { port: framework.port } } : {}),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return { processes, verify: toolchainVerify(facts) };
|
|
148
|
+
}
|
|
149
|
+
/** Render the starter as a `.devcc.ts` file. Plain object: no dependency on devcc is required. */
|
|
150
|
+
export function renderStarterConfig(facts, date = new Date()) {
|
|
151
|
+
const starter = starterConfig(facts);
|
|
152
|
+
const lines = [
|
|
153
|
+
`/**`,
|
|
154
|
+
` * devcc configuration for ${facts.name}, generated by \`devcc init\` on ${date.toISOString().slice(0, 10)}.`,
|
|
155
|
+
` *`,
|
|
156
|
+
` * Everything here is optional. Check it with \`devcc config check\`; refine it with`,
|
|
157
|
+
` * \`devcc init --agent claude\` (or codex). Reference: https://www.npmjs.com/package/@doriandev/devcc`,
|
|
158
|
+
` */`,
|
|
159
|
+
`export default {`,
|
|
160
|
+
];
|
|
161
|
+
if (starter.processes.length > 0) {
|
|
162
|
+
lines.push(` processes: ${literal(starter.processes, 2)},`, ``);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
lines.push(` // processes: [{ id: "web", command: "pnpm", args: ["dev"], readiness: { port: 3000 } }],`, ``);
|
|
166
|
+
}
|
|
167
|
+
if (starter.verify.length > 0) {
|
|
168
|
+
lines.push(` // \`devcc verify\` runs these in order and exits 0 only if all pass.`);
|
|
169
|
+
lines.push(` verify: ${literal(starter.verify, 2)},`, ``);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
lines.push(` // verify: ["lint", "test"],`, ``);
|
|
173
|
+
}
|
|
174
|
+
lines.push(` // editor: { command: "code" },`, ` // agents: { claude: { args: ["--permission-mode", "acceptEdits"] } },`, `}`, ``);
|
|
175
|
+
return lines.join("\n");
|
|
176
|
+
}
|
|
177
|
+
/** A TypeScript object literal: identifier keys unquoted, values JSON-encoded. */
|
|
178
|
+
export function literal(value, indent = 0) {
|
|
179
|
+
const pad = " ".repeat(indent);
|
|
180
|
+
const inner = " ".repeat(indent + 2);
|
|
181
|
+
if (Array.isArray(value)) {
|
|
182
|
+
if (value.every((item) => typeof item !== "object" || item === null)) {
|
|
183
|
+
return `[${value.map((item) => literal(item)).join(", ")}]`;
|
|
184
|
+
}
|
|
185
|
+
return `[\n${value.map((item) => `${inner}${literal(item, indent + 2)},`).join("\n")}\n${pad}]`;
|
|
186
|
+
}
|
|
187
|
+
if (typeof value === "object" && value !== null) {
|
|
188
|
+
const entries = Object.entries(value).filter(([, entry]) => entry !== undefined);
|
|
189
|
+
const rendered = entries.map(([key, entry]) => `${/^[A-Za-z_$][\w$]*$/u.test(key) ? key : JSON.stringify(key)}: ${literal(entry, indent + 2)}`);
|
|
190
|
+
const oneLine = `{ ${rendered.join(", ")} }`;
|
|
191
|
+
if (oneLine.length + indent <= 100 && !oneLine.includes("\n"))
|
|
192
|
+
return oneLine;
|
|
193
|
+
return `{\n${rendered.map((entry) => `${inner}${entry},`).join("\n")}\n${pad}}`;
|
|
194
|
+
}
|
|
195
|
+
return JSON.stringify(value);
|
|
196
|
+
}
|
|
197
|
+
/** Short file contents for the prompt, so the agent starts from real data. */
|
|
198
|
+
export function readSnippet(path, maxLength = 2_000) {
|
|
199
|
+
try {
|
|
200
|
+
const text = readFileSync(path, "utf8");
|
|
201
|
+
return text.length > maxLength ? `${text.slice(0, maxLength)}\n…` : text;
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../../src/devcc/init/detect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EACL,oBAAoB,E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IAAI,CAAA;QAC5C,IAAI,OAAO,CAAC,MAAM,GAAG,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,OAAO,CAAA;QAC7E,OAAO,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAA;IACjF,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,SAAS,GAAG,KAAK;IACzD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACvC,OAAO,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ProjectFacts } from "./detect.js";
|
|
2
|
+
/**
|
|
3
|
+
* The prompt that lets a coding agent set up devcc for a project.
|
|
4
|
+
*
|
|
5
|
+
* It carries what devcc already detected (so the agent verifies rather than
|
|
6
|
+
* rediscovers), a draft to start from, the config reference, and firm rules:
|
|
7
|
+
* never invent commands, never guess hosts, keep verify non-interactive.
|
|
8
|
+
*
|
|
9
|
+
* Two delivery modes:
|
|
10
|
+
* - `write`: an interactive agent edits `.devcc.ts` itself and checks its work
|
|
11
|
+
* with `devcc config check` (used by `devcc init --agent`).
|
|
12
|
+
* - `print`: a headless agent prints the file between markers; devcc validates
|
|
13
|
+
* it and asks before writing (used from the dashboard, where the agent has no
|
|
14
|
+
* permission to edit files).
|
|
15
|
+
*/
|
|
16
|
+
export type SetupPromptMode = "write" | "print";
|
|
17
|
+
export declare const CONFIG_BEGIN_MARKER = "----- BEGIN .devcc.ts -----";
|
|
18
|
+
export declare const CONFIG_END_MARKER = "----- END .devcc.ts -----";
|
|
19
|
+
export declare function buildSetupPrompt(facts: ProjectFacts, mode: SetupPromptMode): string;
|
|
20
|
+
/**
|
|
21
|
+
* Pull the config out of a headless agent's output: the last block between the
|
|
22
|
+
* markers, with a surrounding code fence removed. Null when there is none.
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractConfigFromOutput(output: string): string | null;
|
|
25
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/devcc/init/prompt.ts"],"names":[],"mappings":"AACA,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAEjF;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,CAAA;AAE/C,eAAO,MAAM,mBAAmB,gCAAgC,CAAA;AAChE,eAAO,MAAM,iBAAiB,8BAA8B,CAAA;AA4D5D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,CAgFnF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWrE"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
import { readSnippet, renderStarterConfig } from "./detect.js";
|
|
3
|
+
export const CONFIG_BEGIN_MARKER = "----- BEGIN .devcc.ts -----";
|
|
4
|
+
export const CONFIG_END_MARKER = "----- END .devcc.ts -----";
|
|
5
|
+
const REFERENCE = `
|
|
6
|
+
## .devcc.ts reference (all fields optional)
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name?: string, // header label
|
|
10
|
+
processes?: [{ // long-running things devcc starts/stops
|
|
11
|
+
id, name?, command, args?: string[], cwd?, env?: Record<string, string>,
|
|
12
|
+
kind?: "service" | "task", autoStart?: boolean, url?: string, port?: number,
|
|
13
|
+
dependsOn?: string[], // ids that must be ready first
|
|
14
|
+
readiness?: { port?: number, host?: string, logPattern?: string, timeoutMs?: number },
|
|
15
|
+
restartOnCrash?: boolean,
|
|
16
|
+
}],
|
|
17
|
+
commands?: [{ // palette actions
|
|
18
|
+
id, title, category?, command, args?, cwd?, keywords?: string[],
|
|
19
|
+
confirm?: true | { title, message }, // REQUIRED for anything destructive
|
|
20
|
+
}],
|
|
21
|
+
verify?: (string | { id, name?, command, args?, cwd? })[],
|
|
22
|
+
// strings = command ids, then package.json script names
|
|
23
|
+
services?: [ // extra things to watch
|
|
24
|
+
{ id, name?, port, host?, healthPath? } |
|
|
25
|
+
{ id, name?, type: "ollama", baseUrl: "http://host:11434" },
|
|
26
|
+
],
|
|
27
|
+
agents?: { claude?: { command?, args? }, codex?: { command?, args? } },
|
|
28
|
+
editor?: { command: "code" | "zed" | "cursor" | "webstorm" } | { application: "WebStorm" },
|
|
29
|
+
terminal?: { application: "iTerm" } | { command, args?, execArgs? },
|
|
30
|
+
worktrees?: { directory?: string }, // relative to the main worktree, default ".."
|
|
31
|
+
remoteMachines?: [{ id, name?, host, transport: "ssh", port?, user?, services?: string[] }],
|
|
32
|
+
refresh?: { system?, services?, git?, clock? },
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Everything is spawned as command + args with no shell: never put pipes, &&, env assignments or
|
|
36
|
+
quotes inside a single string. \`command: "pnpm", args: ["run", "dev"]\` is right;
|
|
37
|
+
\`command: "pnpm run dev"\` is wrong.`;
|
|
38
|
+
function factsSection(facts) {
|
|
39
|
+
const lines = [
|
|
40
|
+
`- root: ${facts.rootDir}`,
|
|
41
|
+
`- name: ${facts.name}`,
|
|
42
|
+
`- git repository: ${facts.hasGit ? "yes" : "no"}`,
|
|
43
|
+
`- languages: ${facts.languages.join(", ") || "none detected"}`,
|
|
44
|
+
`- package manager: ${facts.packageManager ? `${facts.packageManager.manager} (from ${facts.packageManager.source})` : "none (no package.json)"}`,
|
|
45
|
+
`- monorepo: ${facts.monorepo ?? "no"}`,
|
|
46
|
+
`- frameworks (by dependency): ${facts.frameworks.map((framework) => `${framework.name} (default port ${framework.port})`).join(", ") || "none recognised"}`,
|
|
47
|
+
`- notable files: ${facts.files.join(", ") || "none"}`,
|
|
48
|
+
`- existing devcc config: ${facts.configPath ? basename(facts.configPath) : "none"}`,
|
|
49
|
+
];
|
|
50
|
+
if (facts.scripts.length > 0) {
|
|
51
|
+
lines.push(`- package.json scripts:`);
|
|
52
|
+
for (const script of facts.scripts)
|
|
53
|
+
lines.push(` - ${script.name}: ${script.command}`);
|
|
54
|
+
}
|
|
55
|
+
if (facts.skippedScripts.length > 0) {
|
|
56
|
+
lines.push(`- left out of verify: ${facts.skippedScripts.map((script) => `${script.name} (${script.reason})`).join(", ")}`);
|
|
57
|
+
}
|
|
58
|
+
return lines.join("\n");
|
|
59
|
+
}
|
|
60
|
+
export function buildSetupPrompt(facts, mode) {
|
|
61
|
+
const existing = facts.configPath ? readSnippet(facts.configPath, 6_000) : null;
|
|
62
|
+
const draft = renderStarterConfig(facts);
|
|
63
|
+
const output = mode === "write"
|
|
64
|
+
? `## Deliver
|
|
65
|
+
|
|
66
|
+
1. ${facts.configPath ? `Update \`${basename(facts.configPath)}\` in place, keeping anything the user wrote that is still correct.` : "Create `.devcc.ts` in the project root."}
|
|
67
|
+
2. Run \`devcc config check\` and fix every issue it reports. Do not stop until it exits 0.
|
|
68
|
+
3. If you added \`verify\`, run \`devcc verify\`. A step that fails because the project itself is broken
|
|
69
|
+
stays in the list - report it; do not delete checks to make the gate pass.
|
|
70
|
+
4. Finish with a short summary: what you configured, what you deliberately left out, and why.`
|
|
71
|
+
: `## Deliver
|
|
72
|
+
|
|
73
|
+
You cannot edit files in this session. Print the complete file, and nothing else between the markers,
|
|
74
|
+
exactly like this:
|
|
75
|
+
|
|
76
|
+
${CONFIG_BEGIN_MARKER}
|
|
77
|
+
export default {
|
|
78
|
+
...
|
|
79
|
+
}
|
|
80
|
+
${CONFIG_END_MARKER}
|
|
81
|
+
|
|
82
|
+
devcc validates it and asks the user before writing it${facts.configPath ? ` over \`${basename(facts.configPath)}\`` : ""}. After the markers, add
|
|
83
|
+
a short summary: what you configured, what you left out, and why.`;
|
|
84
|
+
return `Set up devcc for this project: produce a solid .devcc.ts.
|
|
85
|
+
|
|
86
|
+
devcc (@doriandev/devcc) is a keyboard-driven terminal dashboard for local development. Its config
|
|
87
|
+
tells it which dev processes it may start, which checks \`devcc verify\` runs as the quality gate, and
|
|
88
|
+
which commands appear in its palette. You are configuring it for the repository in your working
|
|
89
|
+
directory.
|
|
90
|
+
|
|
91
|
+
## What devcc already detected
|
|
92
|
+
|
|
93
|
+
${factsSection(facts)}
|
|
94
|
+
|
|
95
|
+
## Draft from \`devcc init\`
|
|
96
|
+
|
|
97
|
+
Start from this, but verify every line against the repository - it only knows script names.
|
|
98
|
+
|
|
99
|
+
\`\`\`ts
|
|
100
|
+
${draft.trimEnd()}
|
|
101
|
+
\`\`\`
|
|
102
|
+
${existing ? `\n## Current config (${basename(facts.configPath ?? "")})\n\n\`\`\`ts\n${existing.trimEnd()}\n\`\`\`\n` : ""}
|
|
103
|
+
## Investigate before writing
|
|
104
|
+
|
|
105
|
+
- Read package.json (every workspace package in a monorepo), the README, CONTRIBUTING, AGENTS.md or
|
|
106
|
+
CLAUDE.md, CI workflows (.github/workflows), Makefile/justfile, docker compose files, framework
|
|
107
|
+
configs (next.config.*, vite.config.*, etc.) and .env.example.
|
|
108
|
+
- Find the real dev servers and their ports. Ports come from scripts, framework config or
|
|
109
|
+
.env.example - not from defaults when the project overrides them.
|
|
110
|
+
- CI shows what the team treats as the quality gate; mirror it in \`verify\` where it can run locally.
|
|
111
|
+
|
|
112
|
+
## Rules
|
|
113
|
+
|
|
114
|
+
- Only use commands that exist in this repository or are the standard CLI of a toolchain it uses. Never
|
|
115
|
+
invent scripts, binaries or ports.
|
|
116
|
+
- \`processes\`: long-running dev servers, watchers and local infra the developer starts by hand. Use
|
|
117
|
+
\`readiness\` with the real port (or a \`logPattern\` from the server's actual output) and \`dependsOn\`
|
|
118
|
+
when one service needs another. In a monorepo, one process per app with \`cwd\`. Do not set
|
|
119
|
+
\`autoStart\` unless the README says the project is always run that way.
|
|
120
|
+
- \`verify\`: fast to slow (format check, lint, typecheck, tests, build). Every step must be
|
|
121
|
+
non-interactive, exit on its own, and not modify files (no --watch, --fix or --write). Prefer
|
|
122
|
+
package.json script names over inline steps.
|
|
123
|
+
- \`commands\`: useful project tasks that are not already scripts devcc shows (migrations, seeding,
|
|
124
|
+
codegen, docker compose profiles). Anything that deletes, resets, migrates or deploys needs
|
|
125
|
+
\`confirm: true\`.
|
|
126
|
+
- Never add secrets, tokens, credentials or values from .env files. Never add \`remoteMachines\`,
|
|
127
|
+
hostnames or IP addresses unless the repository documents them for local development.
|
|
128
|
+
- Leave out \`editor\`, \`terminal\` and \`agents\` unless the repository states a preference; they are
|
|
129
|
+
personal. Leave out anything you are unsure of rather than guessing - a small correct config beats a
|
|
130
|
+
large wrong one.
|
|
131
|
+
- Use a plain \`export default { ... }\` object. Import \`defineConfig\` from "@doriandev/devcc" only if that
|
|
132
|
+
package is already a dependency of this project.
|
|
133
|
+
${REFERENCE}
|
|
134
|
+
|
|
135
|
+
${output}
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Pull the config out of a headless agent's output: the last block between the
|
|
140
|
+
* markers, with a surrounding code fence removed. Null when there is none.
|
|
141
|
+
*/
|
|
142
|
+
export function extractConfigFromOutput(output) {
|
|
143
|
+
const end = output.lastIndexOf(CONFIG_END_MARKER);
|
|
144
|
+
if (end === -1)
|
|
145
|
+
return null;
|
|
146
|
+
const begin = output.lastIndexOf(CONFIG_BEGIN_MARKER, end);
|
|
147
|
+
if (begin === -1)
|
|
148
|
+
return null;
|
|
149
|
+
const body = output
|
|
150
|
+
.slice(begin + CONFIG_BEGIN_MARKER.length, end)
|
|
151
|
+
.replace(/^\s*```[a-z]*\s*\n/u, "")
|
|
152
|
+
.replace(/\n\s*```\s*$/u, "")
|
|
153
|
+
.trim();
|
|
154
|
+
return body === "" ? null : `${body}\n`;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/devcc/init/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAqB,MAAM,aAAa,CAAA;AAmBjF,MAAM,CAAC,MAAM,mBAAmB,GAAG,6BAA6B,CAAA;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG,2BAA2B,CAAA;AAE5D,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAgCoB,CAAA;AAEtC,SAAS,YAAY,CAAC,KAAmB;IACvC,MAAM,KAAK,GAAG;QACZ,WAAW,KAAK,CAAC,OAAO,EAAE;QAC1B,WAAW,KAAK,CAAC,IAAI,EAAE;QACvB,qBAAqB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE;QAClD,gBAAgB,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe,EAAE;QAC/D,sBAAsB,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,wBAAwB,EAAE;QACjJ,eAAe,KAAK,CAAC,QAAQ,IAAI,IAAI,EAA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OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;SAC5B,IAAI,EAAE,CAAA;IACT,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EditorConfig, RemoteMachineConfig, TerminalConfig } from "../core/config.js";
|
|
2
|
+
/**
|
|
3
|
+
* Opening things outside devcc: editors, terminals, SSH sessions.
|
|
4
|
+
*
|
|
5
|
+
* Every launch is an executable plus an argv array, detached from devcc so
|
|
6
|
+
* closing the dashboard never closes your editor. macOS conventions (`open`,
|
|
7
|
+
* `open -a`) are used only when running on macOS; elsewhere a configured
|
|
8
|
+
* command is required.
|
|
9
|
+
*/
|
|
10
|
+
export interface LaunchCommand {
|
|
11
|
+
command: string;
|
|
12
|
+
args: string[];
|
|
13
|
+
}
|
|
14
|
+
export type Platform = NodeJS.Platform;
|
|
15
|
+
/** Replace `{path}` inside individual arguments. Never joins arguments into a string. */
|
|
16
|
+
export declare function substitutePath(args: readonly string[], path: string): string[];
|
|
17
|
+
export declare function editorCommand(path: string, editor: EditorConfig | undefined, platform?: Platform): LaunchCommand;
|
|
18
|
+
export declare function terminalCommand(path: string, terminal: TerminalConfig | undefined, platform?: Platform): LaunchCommand;
|
|
19
|
+
/**
|
|
20
|
+
* An interactive SSH session needs a terminal. On macOS `open ssh://host`
|
|
21
|
+
* hands the URL to the default terminal, which runs `ssh` with the user's own
|
|
22
|
+
* config for that alias. Elsewhere the configured terminal runs `ssh`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function sshCommand(machine: Pick<RemoteMachineConfig, "host" | "user" | "port">, terminal: TerminalConfig | undefined, platform?: Platform): LaunchCommand;
|
|
25
|
+
/**
|
|
26
|
+
* Start a GUI or launcher process detached from devcc. Resolves once it has
|
|
27
|
+
* spawned (not when it exits); rejects with a readable error if it cannot start.
|
|
28
|
+
*/
|
|
29
|
+
export declare function launchDetached(launch: LaunchCommand, cwd?: string): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=launch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../../src/devcc/platform/launch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAI1F;;;;;;;GAOG;AAEH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;AAEtC,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9E;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,GAAG,SAAS,EAChC,QAAQ,GAAE,QAA2B,GACpC,aAAa,CAgBf;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,cAAc,GAAG,SAAS,EACpC,QAAQ,GAAE,QAA2B,GACpC,aAAa,CAaf;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAC5D,QAAQ,EAAE,cAAc,GAAG,SAAS,EACpC,QAAQ,GAAE,QAA2B,GACpC,aAAa,CAkBf;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAejF"}
|