@tidegap/core 0.29.0 → 0.29.1
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/agent-snippet.d.ts +10 -3
- package/dist/agent-snippet.js +31 -19
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/agent-snippet.d.ts
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
* Tidegap instead of cron, and the per-host files that carry it (jobs U15,
|
|
4
4
|
* R33-R36, KTD15). One source: `tidegap jobs snippet`, `tidegap install` and
|
|
5
5
|
* the site's install box (a static copy, checked by docs-drift) render it.
|
|
6
|
+
* Three variants: MCP hosts, Claude Code, and shell hosts that run the CLI (`--cli`).
|
|
6
7
|
*/
|
|
7
8
|
/** The `AGENTS.md` block for a host that runs the Tidegap MCP server. */
|
|
8
9
|
export declare const AGENTS_BLOCK: string;
|
|
10
|
+
/** The block for a host whose agent runs shell commands and uses the tidegap CLI, not the MCP server. */
|
|
11
|
+
export declare const CLI_AGENTS_BLOCK: string;
|
|
9
12
|
/** The hosts `tidegap jobs snippet --host` knows, in display order. */
|
|
10
13
|
export declare const AGENT_HOSTS: readonly ["generic", "claude", "opencode", "codex", "cursor", "gemini"];
|
|
11
14
|
export type AgentHost = (typeof AGENT_HOSTS)[number];
|
|
@@ -23,8 +26,12 @@ export interface AgentSnippet {
|
|
|
23
26
|
intro: string;
|
|
24
27
|
files: AgentSnippetFile[];
|
|
25
28
|
}
|
|
29
|
+
export interface AgentSnippetOptions {
|
|
30
|
+
/** The CLI variant: the block tells the agent to run the tidegap CLI, and no MCP server entry is printed. */
|
|
31
|
+
cli?: boolean;
|
|
32
|
+
}
|
|
26
33
|
/** The intro and files for one host. */
|
|
27
|
-
export declare function agentSnippet(host: AgentHost): AgentSnippet;
|
|
28
|
-
/** The text `tidegap jobs snippet --host <host
|
|
29
|
-
export declare function renderAgentSnippet(host: AgentHost): string;
|
|
34
|
+
export declare function agentSnippet(host: AgentHost, opts?: AgentSnippetOptions): AgentSnippet;
|
|
35
|
+
/** The text `tidegap jobs snippet --host <host> [--cli]` prints. */
|
|
36
|
+
export declare function renderAgentSnippet(host: AgentHost, opts?: AgentSnippetOptions): string;
|
|
30
37
|
//# sourceMappingURL=agent-snippet.d.ts.map
|
package/dist/agent-snippet.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Tidegap instead of cron, and the per-host files that carry it (jobs U15,
|
|
4
4
|
* R33-R36, KTD15). One source: `tidegap jobs snippet`, `tidegap install` and
|
|
5
5
|
* the site's install box (a static copy, checked by docs-drift) render it.
|
|
6
|
+
* Three variants: MCP hosts, Claude Code, and shell hosts that run the CLI (`--cli`).
|
|
6
7
|
*/
|
|
7
8
|
/** The rules block, at most 12 lines (R35), Markdown; `promptJob` is step 3, how to queue a prompt job. */
|
|
8
9
|
const rulesBlock = (promptJob) => `## Scheduling (Tidegap)
|
|
@@ -20,6 +21,10 @@ Write a crontab, launchd plist or systemd timer only when the user says "cron an
|
|
|
20
21
|
export const AGENTS_BLOCK = rulesBlock("Prompt job: call the schedule_task MCP tool with repeat (daily | weekdays | weekly) and window, or every_n_hours with every_hours (no window).");
|
|
21
22
|
const CLAUDE_CODE_BLOCK = rulesBlock("Prompt job: run /tidegap:defer <task> --repeat daily (or weekdays, weekly) --window <HH:MM-HH:MM>, or --repeat every_n_hours --every <N>h.\n" +
|
|
22
23
|
" Without the Tidegap plugin, run \"tidegap jobs add --prompt '<task>' --daily --window 22:00-08:00\" in Bash.");
|
|
24
|
+
/** The block for a host whose agent runs shell commands and uses the tidegap CLI, not the MCP server. */
|
|
25
|
+
export const CLI_AGENTS_BLOCK = rulesBlock("Prompt job: run \"tidegap jobs add --provider <p> --prompt - --daily --window 22:00-08:00 <<'TIDEGAP_TEXT'\", the prompt, then TIDEGAP_TEXT\n" +
|
|
26
|
+
" (or --weekdays, --weekly <days>; --every <N>h takes no window). One-off task: \"tidegap queue add --runner <p> --by <when> - <<'TIDEGAP_TEXT'\".\n" +
|
|
27
|
+
" <p>: the user's provider, anthropic, openai, gemini, ollama or claude-code. Read results with \"tidegap queue show <id>\" and \"tidegap queue list\". Never queue a command task yourself.");
|
|
23
28
|
/** The hosts `tidegap jobs snippet --host` knows, in display order. */
|
|
24
29
|
export const AGENT_HOSTS = ["generic", "claude", "opencode", "codex", "cursor", "gemini"];
|
|
25
30
|
export function isAgentHost(name) {
|
|
@@ -32,7 +37,6 @@ const DESCRIPTION = 'Schedule recurring work through Tidegap, not cron. Use when
|
|
|
32
37
|
const MCP_ARGS = ["-y", "@tidegap/mcp"];
|
|
33
38
|
const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
34
39
|
const mcpServers = json({ mcpServers: { tidegap: { command: "npx", args: MCP_ARGS } } });
|
|
35
|
-
const markdown = (path, content = AGENTS_BLOCK) => ({ path, format: "markdown", content });
|
|
36
40
|
const ASK = "ask";
|
|
37
41
|
/** OpenCode bash rules: last match wins, so the catch-all comes first (opencode.ai/docs/permissions). */
|
|
38
42
|
const OPENCODE_BASH = {
|
|
@@ -44,14 +48,22 @@ const OPENCODE_BASH = {
|
|
|
44
48
|
"launchctl bootstrap *": ASK,
|
|
45
49
|
"systemctl --user enable *": ASK,
|
|
46
50
|
};
|
|
51
|
+
/** Ends every CLI-variant intro but Claude Code's. */
|
|
52
|
+
const CLI_NOTE = " The agent runs the tidegap CLI in its shell: npm install -g @tidegap/cli.";
|
|
47
53
|
/** The intro and files for one host. */
|
|
48
|
-
export function agentSnippet(host) {
|
|
54
|
+
export function agentSnippet(host, opts = {}) {
|
|
55
|
+
const cli = opts.cli === true;
|
|
56
|
+
const block = cli ? CLI_AGENTS_BLOCK : AGENTS_BLOCK;
|
|
57
|
+
const markdown = (path) => ({ path, format: "markdown", content: block });
|
|
58
|
+
/** An MCP config file: printed only without --cli. */
|
|
59
|
+
const mcpFile = (file) => (cli ? [] : [file]);
|
|
60
|
+
const intro = (mcp, shell) => (cli ? shell + CLI_NOTE : mcp);
|
|
49
61
|
switch (host) {
|
|
50
62
|
case "generic":
|
|
51
63
|
return {
|
|
52
64
|
host,
|
|
53
|
-
intro: "Add this block to the instructions file your agent reads (AGENTS.md, GEMINI.md). The MCP server is npx -y @tidegap/mcp. " +
|
|
54
|
-
"For Claude Code, run tidegap jobs snippet --host claude.",
|
|
65
|
+
intro: intro("Add this block to the instructions file your agent reads (AGENTS.md, GEMINI.md). The MCP server is npx -y @tidegap/mcp. " +
|
|
66
|
+
"For an agent that runs shell commands, tidegap jobs snippet --cli prints the CLI variant.", "Add this block to the instructions file your agent reads (AGENTS.md, GEMINI.md).") + " For Claude Code, run tidegap jobs snippet --host claude.",
|
|
55
67
|
files: [markdown("AGENTS.md")],
|
|
56
68
|
};
|
|
57
69
|
case "claude":
|
|
@@ -60,24 +72,24 @@ export function agentSnippet(host) {
|
|
|
60
72
|
intro: "The Tidegap plugin already does this (skill text, a prompt hint, and a guard that asks before crontab): " +
|
|
61
73
|
"/plugin marketplace add tidegap/tidegap, then /plugin install tidegap. Without the plugin, add the block to CLAUDE.md " +
|
|
62
74
|
"(~/.claude/CLAUDE.md for every project).",
|
|
63
|
-
files: [
|
|
75
|
+
files: [{ path: "CLAUDE.md", format: "markdown", content: CLAUDE_CODE_BLOCK }],
|
|
64
76
|
};
|
|
65
77
|
case "opencode":
|
|
66
78
|
return {
|
|
67
79
|
host,
|
|
68
|
-
intro: "Create the skill, then merge the MCP entry and the bash rules into opencode.json (keep your own \"*\" rule if you have one).",
|
|
80
|
+
intro: intro("Create the skill, then merge the MCP entry and the bash rules into opencode.json (keep your own \"*\" rule if you have one).", "Create the skill, then merge the bash rules into opencode.json (keep your own \"*\" rule if you have one)."),
|
|
69
81
|
files: [
|
|
70
82
|
{
|
|
71
83
|
path: "~/.config/opencode/skills/tidegap/SKILL.md",
|
|
72
84
|
format: "markdown",
|
|
73
|
-
content: `---\nname: tidegap\ndescription: ${DESCRIPTION}\n---\n\n${
|
|
85
|
+
content: `---\nname: tidegap\ndescription: ${DESCRIPTION}\n---\n\n${block}`,
|
|
74
86
|
},
|
|
75
87
|
{
|
|
76
88
|
path: "~/.config/opencode/opencode.json",
|
|
77
89
|
format: "json",
|
|
78
90
|
content: json({
|
|
79
91
|
$schema: "https://opencode.ai/config.json",
|
|
80
|
-
mcp: { tidegap: { type: "local", command: ["npx", ...MCP_ARGS], enabled: true } },
|
|
92
|
+
...(cli ? {} : { mcp: { tidegap: { type: "local", command: ["npx", ...MCP_ARGS], enabled: true } } }),
|
|
81
93
|
permission: { bash: OPENCODE_BASH },
|
|
82
94
|
}),
|
|
83
95
|
},
|
|
@@ -86,40 +98,40 @@ export function agentSnippet(host) {
|
|
|
86
98
|
case "codex":
|
|
87
99
|
return {
|
|
88
100
|
host,
|
|
89
|
-
intro: "Add the block to AGENTS.md and the MCP table to config.toml.",
|
|
101
|
+
intro: intro("Add the block to AGENTS.md and the MCP table to config.toml.", "Add the block to AGENTS.md."),
|
|
90
102
|
files: [
|
|
91
103
|
markdown("~/.codex/AGENTS.md"),
|
|
92
|
-
{
|
|
104
|
+
...mcpFile({
|
|
93
105
|
path: "~/.codex/config.toml",
|
|
94
106
|
format: "toml",
|
|
95
107
|
content: `[mcp_servers.tidegap]\ncommand = "npx"\nargs = ${JSON.stringify(MCP_ARGS).replace(/,/g, ", ")}\n`,
|
|
96
|
-
},
|
|
108
|
+
}),
|
|
97
109
|
],
|
|
98
110
|
};
|
|
99
111
|
case "cursor":
|
|
100
112
|
return {
|
|
101
113
|
host,
|
|
102
|
-
intro: "Create the rule in your project and add the MCP entry to .cursor/mcp.json.",
|
|
114
|
+
intro: intro("Create the rule in your project and add the MCP entry to .cursor/mcp.json.", "Create the rule in your project."),
|
|
103
115
|
files: [
|
|
104
116
|
{
|
|
105
117
|
path: ".cursor/rules/tidegap.mdc",
|
|
106
118
|
format: "markdown",
|
|
107
|
-
content: `---\ndescription: ${DESCRIPTION}\nalwaysApply: false\n---\n\n${
|
|
119
|
+
content: `---\ndescription: ${DESCRIPTION}\nalwaysApply: false\n---\n\n${block}`,
|
|
108
120
|
},
|
|
109
|
-
{ path: ".cursor/mcp.json", format: "json", content: mcpServers },
|
|
121
|
+
...mcpFile({ path: ".cursor/mcp.json", format: "json", content: mcpServers }),
|
|
110
122
|
],
|
|
111
123
|
};
|
|
112
124
|
case "gemini":
|
|
113
125
|
return {
|
|
114
126
|
host,
|
|
115
|
-
intro: "Add the block to GEMINI.md and merge the MCP entry into settings.json.",
|
|
116
|
-
files: [markdown("~/.gemini/GEMINI.md"), { path: "~/.gemini/settings.json", format: "json", content: mcpServers }],
|
|
127
|
+
intro: intro("Add the block to GEMINI.md and merge the MCP entry into settings.json.", "Add the block to GEMINI.md."),
|
|
128
|
+
files: [markdown("~/.gemini/GEMINI.md"), ...mcpFile({ path: "~/.gemini/settings.json", format: "json", content: mcpServers })],
|
|
117
129
|
};
|
|
118
130
|
}
|
|
119
131
|
}
|
|
120
|
-
/** The text `tidegap jobs snippet --host <host
|
|
121
|
-
export function renderAgentSnippet(host) {
|
|
122
|
-
const s = agentSnippet(host);
|
|
132
|
+
/** The text `tidegap jobs snippet --host <host> [--cli]` prints. */
|
|
133
|
+
export function renderAgentSnippet(host, opts = {}) {
|
|
134
|
+
const s = agentSnippet(host, opts);
|
|
123
135
|
return [s.intro, ...s.files.map((f) => `${f.path}:\n\n${f.content.trimEnd()}`)].join("\n\n");
|
|
124
136
|
}
|
|
125
137
|
//# sourceMappingURL=agent-snippet.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,6 @@ export { canonicalize, defaultSigningKeyPath, loadOrCreateSigningKey, signReceip
|
|
|
108
108
|
export type { SigningKeyOptions, SigningKeyPair, VerifyOutcome, VerifyResult, } from "./sign.js";
|
|
109
109
|
export { TIDEGAP_HOME_DIR, resolveTidegapHome, tidegapPath, } from "./paths.js";
|
|
110
110
|
export type { ResolveHomeOptions } from "./paths.js";
|
|
111
|
-
export { AGENT_HOSTS, AGENTS_BLOCK, agentSnippet, isAgentHost, renderAgentSnippet, } from "./agent-snippet.js";
|
|
112
|
-
export type { AgentHost, AgentSnippet, AgentSnippetFile } from "./agent-snippet.js";
|
|
111
|
+
export { AGENT_HOSTS, AGENTS_BLOCK, agentSnippet, CLI_AGENTS_BLOCK, isAgentHost, renderAgentSnippet, } from "./agent-snippet.js";
|
|
112
|
+
export type { AgentHost, AgentSnippet, AgentSnippetFile, AgentSnippetOptions } from "./agent-snippet.js";
|
|
113
113
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -91,5 +91,5 @@ export { ALL_TOOL_HOSTS, TOOL_SURFACE, getToolDef, getToolDefOrThrow, toolsForHo
|
|
|
91
91
|
export { commandJobRefusal, QUEUE_ADD_COMMAND_LINE, endJobOfTask, isJobRepeat, JOB_ONLY_PARAMS, JOB_REPEATS, jobParamsRefusal, jobToolsFor, jobToolView, jobUnsupportedRefusal, jobWakeArgs, llmTimeoutArg, retryCapsArgs, scheduleJobInput, } from "./schedule-job.js";
|
|
92
92
|
export { canonicalize, defaultSigningKeyPath, loadOrCreateSigningKey, signReceipt, verifyReceipt, } from "./sign.js";
|
|
93
93
|
export { TIDEGAP_HOME_DIR, resolveTidegapHome, tidegapPath, } from "./paths.js";
|
|
94
|
-
export { AGENT_HOSTS, AGENTS_BLOCK, agentSnippet, isAgentHost, renderAgentSnippet, } from "./agent-snippet.js";
|
|
94
|
+
export { AGENT_HOSTS, AGENTS_BLOCK, agentSnippet, CLI_AGENTS_BLOCK, isAgentHost, renderAgentSnippet, } from "./agent-snippet.js";
|
|
95
95
|
//# sourceMappingURL=index.js.map
|