@elevasis/sdk 0.5.15 → 0.5.16
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/cli.cjs +151 -172
- package/dist/templates.js +89 -109
- package/dist/worker/index.js +4 -1
- package/package.json +1 -1
- package/reference/framework/agent.mdx +7 -7
- package/reference/framework/index.mdx +10 -10
- package/reference/framework/project-structure.mdx +3 -3
- package/reference/getting-started.mdx +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -43851,7 +43851,7 @@ async function apiDelete(endpoint, apiUrl = resolveApiUrl()) {
|
|
|
43851
43851
|
// package.json
|
|
43852
43852
|
var package_default = {
|
|
43853
43853
|
name: "@elevasis/sdk",
|
|
43854
|
-
version: "0.5.
|
|
43854
|
+
version: "0.5.16",
|
|
43855
43855
|
description: "SDK for building Elevasis organization resources",
|
|
43856
43856
|
type: "module",
|
|
43857
43857
|
bin: {
|
|
@@ -44753,6 +44753,7 @@ function registerCheckCommand(program3) {
|
|
|
44753
44753
|
}
|
|
44754
44754
|
|
|
44755
44755
|
// src/cli/commands/exec.ts
|
|
44756
|
+
var import_node_fs = require("node:fs");
|
|
44756
44757
|
var POLL_INTERVAL_MS = 3e3;
|
|
44757
44758
|
async function pollForCompletion(resourceId, executionId, apiUrl) {
|
|
44758
44759
|
const pollSpinner = ora("Waiting for completion...").start();
|
|
@@ -44771,10 +44772,7 @@ async function pollForCompletion(resourceId, executionId, apiUrl) {
|
|
|
44771
44772
|
const elapsed = Math.round((Date.now() - startTime) / 1e3);
|
|
44772
44773
|
pollSpinner.text = `Waiting for completion... (${elapsed}s)`;
|
|
44773
44774
|
try {
|
|
44774
|
-
const detail = await apiGet(
|
|
44775
|
-
`/api/external/executions/${resourceId}/${executionId}`,
|
|
44776
|
-
apiUrl
|
|
44777
|
-
);
|
|
44775
|
+
const detail = await apiGet(`/api/external/executions/${resourceId}/${executionId}`, apiUrl);
|
|
44778
44776
|
if (detail.status === "completed" || detail.status === "failed") {
|
|
44779
44777
|
process.removeListener("SIGINT", cleanup);
|
|
44780
44778
|
if (detail.status === "completed") {
|
|
@@ -44807,70 +44805,71 @@ async function pollForCompletion(resourceId, executionId, apiUrl) {
|
|
|
44807
44805
|
}
|
|
44808
44806
|
function registerExecCommand(program3) {
|
|
44809
44807
|
program3.command("exec <resourceId>").description(`Execute a deployed resource
|
|
44810
|
-
Example: elevasis-sdk exec my-workflow -i '{"key":"value"}'`).option("-i, --input <json>", "Input data as JSON string").option("--async", "Execute asynchronously with polling").option("--api-url <url>", "API URL").action(
|
|
44811
|
-
|
|
44812
|
-
|
|
44813
|
-
|
|
44814
|
-
|
|
44815
|
-
|
|
44816
|
-
|
|
44817
|
-
|
|
44818
|
-
|
|
44819
|
-
|
|
44820
|
-
|
|
44821
|
-
console.log(source_default.gray(" Execution ID:"), source_default.cyan(asyncResult.executionId));
|
|
44822
|
-
console.log("");
|
|
44823
|
-
await pollForCompletion(resourceId, asyncResult.executionId, apiUrl);
|
|
44824
|
-
return;
|
|
44825
|
-
}
|
|
44826
|
-
const spinner = ora(`Executing ${resourceId}...`).start();
|
|
44827
|
-
try {
|
|
44828
|
-
const result = await apiPost(
|
|
44829
|
-
"/api/external/execute",
|
|
44830
|
-
{ resourceId, input },
|
|
44831
|
-
apiUrl
|
|
44832
|
-
);
|
|
44833
|
-
if (result.success) {
|
|
44834
|
-
spinner.succeed(source_default.green("Execution complete"));
|
|
44835
|
-
console.log(source_default.gray(" Execution ID:"), source_default.cyan(result.executionId));
|
|
44836
|
-
console.log("");
|
|
44837
|
-
console.log(source_default.green(" Output:"));
|
|
44838
|
-
console.log(JSON.stringify(result.data, null, 2));
|
|
44839
|
-
} else {
|
|
44840
|
-
spinner.fail(source_default.red("Execution failed"));
|
|
44841
|
-
console.log(source_default.gray(" Execution ID:"), source_default.cyan(result.executionId));
|
|
44842
|
-
}
|
|
44843
|
-
} catch (error46) {
|
|
44844
|
-
const message = error46 instanceof Error ? error46.message : String(error46);
|
|
44845
|
-
const isConnectionFailure = message.includes("fetch failed") || message.includes("ECONNRESET") || message.includes("socket hang up") || message.includes("network");
|
|
44846
|
-
if (isConnectionFailure) {
|
|
44847
|
-
spinner.warn("Connection lost -- execution may still be running");
|
|
44848
|
-
console.log();
|
|
44849
|
-
try {
|
|
44850
|
-
const recoverSpinner = ora("Recovering execution...").start();
|
|
44851
|
-
const listResult = await apiGet(
|
|
44852
|
-
`/api/external/executions/${resourceId}?limit=1`,
|
|
44808
|
+
Example: elevasis-sdk exec my-workflow -i '{"key":"value"}'`).option("-i, --input <json>", "Input data as JSON string").option("-f, --input-file <path>", "Read input from a JSON file (avoids shell escaping issues)").option("--async", "Execute asynchronously with polling").option("--api-url <url>", "API URL").action(
|
|
44809
|
+
wrapAction(
|
|
44810
|
+
"exec",
|
|
44811
|
+
async (resourceId, options2) => {
|
|
44812
|
+
const input = options2.inputFile ? JSON.parse((0, import_node_fs.readFileSync)(options2.inputFile, "utf8")) : options2.input ? JSON.parse(options2.input) : {};
|
|
44813
|
+
const apiUrl = resolveApiUrl(options2.apiUrl);
|
|
44814
|
+
if (options2.async) {
|
|
44815
|
+
const asyncSpinner = ora(`Starting async execution of ${resourceId}...`).start();
|
|
44816
|
+
const asyncResult = await apiPost(
|
|
44817
|
+
"/api/external/execute-async",
|
|
44818
|
+
{ resourceId, input },
|
|
44853
44819
|
apiUrl
|
|
44854
44820
|
);
|
|
44855
|
-
|
|
44856
|
-
|
|
44857
|
-
|
|
44858
|
-
|
|
44859
|
-
|
|
44821
|
+
asyncSpinner.succeed(source_default.green("Execution started"));
|
|
44822
|
+
console.log(source_default.gray(" Execution ID:"), source_default.cyan(asyncResult.executionId));
|
|
44823
|
+
console.log("");
|
|
44824
|
+
await pollForCompletion(resourceId, asyncResult.executionId, apiUrl);
|
|
44825
|
+
return;
|
|
44826
|
+
}
|
|
44827
|
+
const spinner = ora(`Executing ${resourceId}...`).start();
|
|
44828
|
+
try {
|
|
44829
|
+
const result = await apiPost("/api/external/execute", { resourceId, input }, apiUrl);
|
|
44830
|
+
if (result.success) {
|
|
44831
|
+
spinner.succeed(source_default.green("Execution complete"));
|
|
44832
|
+
console.log(source_default.gray(" Execution ID:"), source_default.cyan(result.executionId));
|
|
44833
|
+
console.log("");
|
|
44834
|
+
console.log(source_default.green(" Output:"));
|
|
44835
|
+
console.log(JSON.stringify(result.data, null, 2));
|
|
44860
44836
|
} else {
|
|
44861
|
-
|
|
44862
|
-
console.log(source_default.
|
|
44837
|
+
spinner.fail(source_default.red("Execution failed"));
|
|
44838
|
+
console.log(source_default.gray(" Execution ID:"), source_default.cyan(result.executionId));
|
|
44863
44839
|
}
|
|
44864
|
-
} catch {
|
|
44865
|
-
|
|
44866
|
-
|
|
44840
|
+
} catch (error46) {
|
|
44841
|
+
const message = error46 instanceof Error ? error46.message : String(error46);
|
|
44842
|
+
const isConnectionFailure = message.includes("fetch failed") || message.includes("ECONNRESET") || message.includes("socket hang up") || message.includes("network");
|
|
44843
|
+
if (isConnectionFailure) {
|
|
44844
|
+
spinner.warn("Connection lost -- execution may still be running");
|
|
44845
|
+
console.log();
|
|
44846
|
+
try {
|
|
44847
|
+
const recoverSpinner = ora("Recovering execution...").start();
|
|
44848
|
+
const listResult = await apiGet(
|
|
44849
|
+
`/api/external/executions/${resourceId}?limit=1`,
|
|
44850
|
+
apiUrl
|
|
44851
|
+
);
|
|
44852
|
+
const running = listResult.executions.find((e) => e.status === "running");
|
|
44853
|
+
if (running) {
|
|
44854
|
+
recoverSpinner.succeed(`Found running execution: ${running.id}`);
|
|
44855
|
+
console.log();
|
|
44856
|
+
await pollForCompletion(resourceId, running.id, apiUrl);
|
|
44857
|
+
} else {
|
|
44858
|
+
recoverSpinner.info("No running execution found -- it may have already completed");
|
|
44859
|
+
console.log(source_default.dim(" Check status manually or re-run with --async"));
|
|
44860
|
+
}
|
|
44861
|
+
} catch {
|
|
44862
|
+
console.log(source_default.yellow("Could not recover. The execution may still be running on the server."));
|
|
44863
|
+
console.log(source_default.dim(" Check status manually or re-run with --async"));
|
|
44864
|
+
}
|
|
44865
|
+
process.exit(0);
|
|
44866
|
+
}
|
|
44867
|
+
spinner.fail(source_default.red("Execution failed"));
|
|
44868
|
+
throw error46;
|
|
44867
44869
|
}
|
|
44868
|
-
process.exit(0);
|
|
44869
44870
|
}
|
|
44870
|
-
|
|
44871
|
-
|
|
44872
|
-
}
|
|
44873
|
-
}));
|
|
44871
|
+
)
|
|
44872
|
+
);
|
|
44874
44873
|
}
|
|
44875
44874
|
|
|
44876
44875
|
// src/cli/commands/resources.ts
|
|
@@ -45180,7 +45179,7 @@ var import_path3 = require("path");
|
|
|
45180
45179
|
var import_promises2 = require("fs/promises");
|
|
45181
45180
|
|
|
45182
45181
|
// src/cli/commands/templates/core/workspace.ts
|
|
45183
|
-
var TEMPLATE_VERSION =
|
|
45182
|
+
var TEMPLATE_VERSION = 29;
|
|
45184
45183
|
function configTemplate() {
|
|
45185
45184
|
return `import type { ElevasConfig } from '@elevasis/sdk'
|
|
45186
45185
|
|
|
@@ -45410,8 +45409,8 @@ process.stdin.on('end', () => {
|
|
|
45410
45409
|
function claudeSdkBoundaryHookTemplate() {
|
|
45411
45410
|
return String.raw`#!/usr/bin/env node
|
|
45412
45411
|
// enforce-sdk-boundary.mjs
|
|
45413
|
-
// Blocks
|
|
45414
|
-
//
|
|
45412
|
+
// Blocks file modifications (Write, Edit, MultiEdit, destructive Bash) outside the project root.
|
|
45413
|
+
// Git, gh, and other CLI tools are NOT blocked -- the agent can use them freely.
|
|
45415
45414
|
|
|
45416
45415
|
import { resolve, normalize } from "node:path";
|
|
45417
45416
|
import { appendFileSync, mkdirSync } from "node:fs";
|
|
@@ -45456,44 +45455,6 @@ try {
|
|
|
45456
45455
|
if (input.tool_name === "Bash") {
|
|
45457
45456
|
const cmd = input.tool_input?.command ?? "";
|
|
45458
45457
|
|
|
45459
|
-
// GitHub CLI -- blocked (affects shared remote state, user-initiated only)
|
|
45460
|
-
if (/\bgh\b/.test(cmd)) {
|
|
45461
|
-
deny(
|
|
45462
|
-
"BLOCKED: GitHub CLI (gh) command detected.\n" +
|
|
45463
|
-
"WHY: GitHub CLI operations affect shared remote state (PRs, issues, releases). These must be user-initiated.\n" +
|
|
45464
|
-
"INSTEAD: Ask the user to run this gh command manually."
|
|
45465
|
-
);
|
|
45466
|
-
process.exit(0);
|
|
45467
|
-
}
|
|
45468
|
-
|
|
45469
|
-
// Destructive git -- blocked
|
|
45470
|
-
if (/(?<!-)\bgit\s+reset\b/.test(cmd) && /--hard/.test(cmd)) {
|
|
45471
|
-
deny(
|
|
45472
|
-
"BLOCKED: git reset --hard detected.\n" +
|
|
45473
|
-
"WHY: Hard resets destroy uncommitted work and cannot be undone. This must be user-initiated.\n" +
|
|
45474
|
-
"INSTEAD: Ask the user to run this git command manually."
|
|
45475
|
-
);
|
|
45476
|
-
process.exit(0);
|
|
45477
|
-
}
|
|
45478
|
-
|
|
45479
|
-
if (/(?<!-)\bgit\s+clean\b/.test(cmd) && /-[a-zA-Z]*f/.test(cmd)) {
|
|
45480
|
-
deny(
|
|
45481
|
-
"BLOCKED: git clean -f detected.\n" +
|
|
45482
|
-
"WHY: Force-cleaning the working tree permanently removes untracked files. This must be user-initiated.\n" +
|
|
45483
|
-
"INSTEAD: Ask the user to run this git command manually."
|
|
45484
|
-
);
|
|
45485
|
-
process.exit(0);
|
|
45486
|
-
}
|
|
45487
|
-
|
|
45488
|
-
if (/(?<!-)\bgit\s+(rebase|merge)\b/.test(cmd)) {
|
|
45489
|
-
deny(
|
|
45490
|
-
"BLOCKED: git rebase/merge detected.\n" +
|
|
45491
|
-
"WHY: Rebase and merge rewrite history or combine branches in ways that require user judgment.\n" +
|
|
45492
|
-
"INSTEAD: Ask the user to run this git command manually."
|
|
45493
|
-
);
|
|
45494
|
-
process.exit(0);
|
|
45495
|
-
}
|
|
45496
|
-
|
|
45497
45458
|
// Path-scoped blocks -- destructive commands or redirects outside project root
|
|
45498
45459
|
const winPaths = cmd.match(/(?<![A-Za-z])[A-Za-z]:[/\\][^\s"'|;&)]+/g) || [];
|
|
45499
45460
|
const unixPaths = cmd.match(/(?<=\s|^|"|')\/[^\s"'|;&)]+/g) || [];
|
|
@@ -45676,7 +45637,7 @@ For detailed per-dimension adaptation rules, read
|
|
|
45676
45637
|
| --- | --- |
|
|
45677
45638
|
| \`/meta\` | Project lifecycle: init, status, fix, deploy, health |
|
|
45678
45639
|
| \`/docs\` | Browse, create, and verify permanent documentation |
|
|
45679
|
-
| \`/work\` | Task tracking: create, save, resume
|
|
45640
|
+
| \`/work\` | Task tracking: auto-detects intent (create, save, resume); suggests complete |
|
|
45680
45641
|
| \`/tutorial\` | Progressive learning path (21 items across 4 sections) |
|
|
45681
45642
|
|
|
45682
45643
|
## Skills
|
|
@@ -45908,43 +45869,46 @@ Observation focus: full lifecycle coverage, pipeline internals.
|
|
|
45908
45869
|
**Item 4: /work and /docs**
|
|
45909
45870
|
|
|
45910
45871
|
When automation is none:
|
|
45911
|
-
"You can ask the assistant to track work across conversations.
|
|
45912
|
-
|
|
45913
|
-
you
|
|
45914
|
-
|
|
45915
|
-
|
|
45916
|
-
|
|
45917
|
-
|
|
45872
|
+
"You can ask the assistant to track work across conversations. Just say /work and tell it
|
|
45873
|
+
what you're working on -- it figures out the rest. It'll save your progress automatically,
|
|
45874
|
+
and next session you just say /work to pick up where you left off." Walk through the
|
|
45875
|
+
concept without deep command details. Then introduce /docs:
|
|
45876
|
+
"When a task is done, the assistant will ask if you want to finalize it -- that moves it
|
|
45877
|
+
to docs/ permanently. /docs helps you find and read what's there -- like a notebook for
|
|
45878
|
+
your project." Run /docs (no args) to show the docs/ overview together.
|
|
45879
|
+
Verify: Run \`/work\` and describe "practice task", see it created automatically.
|
|
45918
45880
|
Then run /docs to see the docs/ structure.
|
|
45919
45881
|
Observation focus: persistence concept, cross-session continuity, docs as permanent notes.
|
|
45920
45882
|
|
|
45921
45883
|
When automation is low-code:
|
|
45922
|
-
Show /work
|
|
45923
|
-
|
|
45924
|
-
|
|
45884
|
+
Show /work as intent-driven: the agent detects whether to create, resume, or save based
|
|
45885
|
+
on context. Create happens when you describe new work, resume when you pick an existing
|
|
45886
|
+
task, save happens automatically when progress is made. Complete is the only action that
|
|
45887
|
+
asks permission first.
|
|
45925
45888
|
Then introduce /docs: "/docs is for permanent knowledge -- things that don't expire. Use
|
|
45926
45889
|
/docs create to document a workflow or integration. Use /docs verify to check if your
|
|
45927
45890
|
docs match the current code." Explain the boundary: /work manages in-progress/, /docs
|
|
45928
45891
|
manages permanent docs/.
|
|
45929
|
-
Verify:
|
|
45930
|
-
|
|
45931
|
-
Observation focus: task tracking
|
|
45892
|
+
Verify: Run \`/work\` and describe "practice task", see auto-create. Make some changes,
|
|
45893
|
+
then notice auto-save. Then run /docs to browse docs/.
|
|
45894
|
+
Observation focus: intent-driven task tracking, /work vs /docs separation.
|
|
45932
45895
|
|
|
45933
45896
|
When automation is custom:
|
|
45934
45897
|
Read \`.claude/commands/work.md\`. Full /work coverage:
|
|
45935
|
-
|
|
45936
|
-
|
|
45937
|
-
|
|
45898
|
+
Intent detection table (list, create, resume, save auto-invoked; complete always suggests).
|
|
45899
|
+
Task doc anatomy: kebab-case filename, frontmatter with status, Objective/Plan/Progress/
|
|
45900
|
+
Resume Context sections. Auto-save behavior: triggers on heavy context, wrap-up signals,
|
|
45901
|
+
2+ steps completed. Resolution order for resume: number, keyword match, single in-progress.
|
|
45938
45902
|
Then read \`.claude/commands/docs.md\`. Cover /docs operations:
|
|
45939
45903
|
/docs (default): browse permanent docs/, categorized with read-only auto-generated files
|
|
45940
45904
|
separate; /docs create: interview-driven, resource-aware doc creation from src/ code
|
|
45941
45905
|
analysis; /docs verify: cross-references resource IDs, schema fields, platform tools in
|
|
45942
45906
|
docs against src/ -- standalone analog of /meta fix step 5.
|
|
45943
|
-
Explain the relationship: /work owns docs/in-progress/ (task lifecycle),
|
|
45907
|
+
Explain the relationship: /work owns docs/in-progress/ (task lifecycle), completing a task
|
|
45944
45908
|
moves docs to permanent location, /docs browses and verifies what's there.
|
|
45945
|
-
Verify: Create a task
|
|
45946
|
-
to see it in the permanent docs/ listing.
|
|
45947
|
-
Observation focus:
|
|
45909
|
+
Verify: Create a task via /work, make progress, observe auto-save, then run /work complete
|
|
45910
|
+
to move it. Run /docs to see it in the permanent docs/ listing.
|
|
45911
|
+
Observation focus: intent detection, auto-save behavior, /work-to-/docs handoff, docs verification.
|
|
45948
45912
|
|
|
45949
45913
|
**Item 5: Your First Custom Workflow**
|
|
45950
45914
|
|
|
@@ -46478,6 +46442,8 @@ function claudeWorkCommandTemplate() {
|
|
|
46478
46442
|
|
|
46479
46443
|
You are a task tracking assistant for this Elevasis workspace. \`/work\` is the primary command for managing all work and projects.
|
|
46480
46444
|
|
|
46445
|
+
Your job is to **intelligently manage tasks without requiring the user to know subcommands**. Detect what the user needs from context and act accordingly.
|
|
46446
|
+
|
|
46481
46447
|
## Context
|
|
46482
46448
|
|
|
46483
46449
|
Read \`docs/priorities.mdx\` if it exists for current priorities.
|
|
@@ -46497,9 +46463,25 @@ When scanning, treat \`index.mdx\` as the primary task doc for a directory.
|
|
|
46497
46463
|
|
|
46498
46464
|
Enforce exactly three values in frontmatter: \`planned\`, \`in-progress\`, \`complete\`.
|
|
46499
46465
|
|
|
46500
|
-
##
|
|
46466
|
+
## Intent Detection
|
|
46467
|
+
|
|
46468
|
+
When \`/work\` is invoked (with or without arguments), detect intent from context:
|
|
46469
|
+
|
|
46470
|
+
| Signal | Action |
|
|
46471
|
+
|--------|--------|
|
|
46472
|
+
| No arguments, no active conversation context | **List** tasks, then let user pick |
|
|
46473
|
+
| User picks a number or names a task | **Resume** that task automatically |
|
|
46474
|
+
| User describes new work (not matching existing tasks) | **Create** a task doc automatically |
|
|
46475
|
+
| \`/work\` with a description that matches no existing task | **Create** automatically |
|
|
46476
|
+
| \`/work\` with a keyword/name matching an existing task | **Resume** automatically |
|
|
46477
|
+
| Conversation is getting heavy, user wrapping up, or 2+ steps completed | **Save** automatically |
|
|
46478
|
+
| All plan steps are COMPLETE | **Suggest** \`/work complete\` (never auto-invoke) |
|
|
46501
46479
|
|
|
46502
|
-
|
|
46480
|
+
**Key principle:** Create, save, and resume are auto-invoked. Complete always asks permission first.
|
|
46481
|
+
|
|
46482
|
+
## Behaviors
|
|
46483
|
+
|
|
46484
|
+
### List and Pick (default when no context)
|
|
46503
46485
|
|
|
46504
46486
|
1. Scan \`docs/in-progress/\` recursively for \`.mdx\` files with \`status\` frontmatter
|
|
46505
46487
|
2. For directories, read \`index.mdx\` as the primary task doc
|
|
@@ -46518,30 +46500,25 @@ Active Tasks
|
|
|
46518
46500
|
3. [complete] CRM Integration
|
|
46519
46501
|
Completed: 2026-03-03
|
|
46520
46502
|
|
|
46521
|
-
Pick a task by number or name
|
|
46522
|
-
- "create" to start new work
|
|
46523
|
-
- "complete <name>" to finish a task
|
|
46503
|
+
Pick a task by number or name, or describe new work to start.
|
|
46524
46504
|
\`\`\`
|
|
46525
46505
|
|
|
46526
46506
|
4. Cross-reference with \`docs/priorities.mdx\` if it exists
|
|
46527
|
-
5. When the user picks a number or describes a task
|
|
46528
|
-
6. If no tasks found,
|
|
46507
|
+
5. When the user picks a number or describes a task, auto-invoke the appropriate flow (resume or create)
|
|
46508
|
+
6. If no tasks found, ask: "What are you trying to accomplish?"
|
|
46529
46509
|
|
|
46530
|
-
###
|
|
46510
|
+
### Create (auto-invoked when new work detected)
|
|
46531
46511
|
|
|
46532
|
-
|
|
46533
|
-
|
|
46534
|
-
1. If no description given, ask: "What are you trying to accomplish?"
|
|
46535
|
-
2. Ask 2-3 focused questions:
|
|
46512
|
+
1. If the user's intent is clear, skip the interview and create directly
|
|
46513
|
+
2. If ambiguous, ask 1-2 focused questions:
|
|
46536
46514
|
- "What does success look like?" (acceptance criteria)
|
|
46537
|
-
- "
|
|
46538
|
-
|
|
46539
|
-
|
|
46540
|
-
- Scan \`docs/in-progress/\` for existing directories related to the topic
|
|
46515
|
+
- "Do we need to investigate anything first, or is the path clear?"
|
|
46516
|
+
3. Scan \`docs/in-progress/\` for existing directories related to the topic
|
|
46517
|
+
4. Determine directory placement:
|
|
46541
46518
|
- If related to existing directory, create as a file within it
|
|
46542
46519
|
- If new concept that may grow, create \`docs/in-progress/<slug>/index.mdx\`
|
|
46543
46520
|
- If small/standalone, create \`docs/in-progress/<slug>.mdx\`
|
|
46544
|
-
|
|
46521
|
+
5. Create the doc with \`status: planned\` and structured sections:
|
|
46545
46522
|
|
|
46546
46523
|
\`\`\`yaml
|
|
46547
46524
|
---
|
|
@@ -46553,15 +46530,20 @@ status: planned
|
|
|
46553
46530
|
|
|
46554
46531
|
Sections: Objective (what and why), Plan (numbered steps), Progress (per-step tracking with PENDING markers), Resume Context (current state, key docs, "To continue" prompt).
|
|
46555
46532
|
|
|
46556
|
-
|
|
46557
|
-
|
|
46533
|
+
6. Update \`docs/priorities.mdx\` if it exists
|
|
46534
|
+
7. Report what was created with location and step count
|
|
46558
46535
|
|
|
46559
|
-
###
|
|
46536
|
+
### Save (auto-invoked when progress detected)
|
|
46560
46537
|
|
|
46561
|
-
|
|
46538
|
+
Auto-save triggers (do NOT ask, just save):
|
|
46539
|
+
- The conversation context is getting heavy (many tool calls, large file reads)
|
|
46540
|
+
- The user appears to be wrapping up (thanks, goodbye, switching topics)
|
|
46541
|
+
- Significant progress has been made (2+ steps completed without saving)
|
|
46542
|
+
- Before a context reset
|
|
46562
46543
|
|
|
46563
|
-
|
|
46564
|
-
|
|
46544
|
+
Save flow:
|
|
46545
|
+
1. Identify the current task from conversation context
|
|
46546
|
+
2. If not working on a tracked task, offer to create a new one
|
|
46565
46547
|
3. Update Progress section:
|
|
46566
46548
|
- Mark completed steps as \`COMPLETE\` with: what was done, key decisions, files changed
|
|
46567
46549
|
- Mark current step as \`IN PROGRESS\` with current state
|
|
@@ -46571,15 +46553,13 @@ Update the current task doc's Progress and Resume Context:
|
|
|
46571
46553
|
- Files Modified: table of file paths and descriptions of changes
|
|
46572
46554
|
- Key docs to read on resume: file paths with why they matter
|
|
46573
46555
|
- To continue: copy-pasteable prompt for the next session
|
|
46574
|
-
5. Set \`status\` appropriately (\`in-progress\` if ongoing
|
|
46575
|
-
6.
|
|
46556
|
+
5. Set \`status\` appropriately (\`in-progress\` if ongoing)
|
|
46557
|
+
6. Briefly confirm: "Progress saved to {path}."
|
|
46576
46558
|
|
|
46577
|
-
###
|
|
46578
|
-
|
|
46579
|
-
Resume in-progress work. Designed for non-technical users who may not know file paths.
|
|
46559
|
+
### Resume (auto-invoked when existing task detected)
|
|
46580
46560
|
|
|
46581
46561
|
**Resolution order:**
|
|
46582
|
-
1. If a number is given
|
|
46562
|
+
1. If a number is given, map to the numbered list from the task list
|
|
46583
46563
|
2. If a name/keyword is given, substring match against task titles and filenames in \`docs/in-progress/\`
|
|
46584
46564
|
3. If no argument, scan for \`status: in-progress\` docs -- if one found, use it; if multiple, list and ask
|
|
46585
46565
|
4. If multiple matches, list them and ask which to resume
|
|
@@ -46605,35 +46585,32 @@ Key context loaded:
|
|
|
46605
46585
|
Ready to continue. {Copy of "To continue" prompt}
|
|
46606
46586
|
\`\`\`
|
|
46607
46587
|
|
|
46608
|
-
###
|
|
46588
|
+
### Complete (NEVER auto-invoked -- always suggest)
|
|
46589
|
+
|
|
46590
|
+
When all plan steps are COMPLETE, suggest: "All steps for '{task}' look done. Want me to finalize it?"
|
|
46609
46591
|
|
|
46610
|
-
|
|
46592
|
+
Only proceed after explicit user confirmation. Then:
|
|
46611
46593
|
|
|
46612
|
-
1.
|
|
46613
|
-
2. **
|
|
46614
|
-
3. **Clean up the doc:**
|
|
46594
|
+
1. **Validate readiness:** Check that all plan steps are marked COMPLETE. If not, warn and ask for confirmation.
|
|
46595
|
+
2. **Clean up the doc:**
|
|
46615
46596
|
- Strip \`## Resume Context\` section entirely (header through next \`##\` or EOF)
|
|
46616
46597
|
- Strip progress markers: \`COMPLETE\`, \`IN PROGRESS\`, \`PENDING\` from step headings
|
|
46617
46598
|
- Remove steps still marked PENDING entirely (header + body) -- they were never done
|
|
46618
46599
|
- Remove \`status\` from frontmatter (keep \`title\` and \`description\`)
|
|
46619
46600
|
- Target 200-400 lines; flag if result exceeds 500 lines
|
|
46620
|
-
|
|
46601
|
+
3. **Determine destination:**
|
|
46621
46602
|
- Scan \`docs/\` (excluding \`docs/in-progress/\`) for existing directories related to this work
|
|
46622
46603
|
- If a related directory exists, propose merging into it
|
|
46623
46604
|
- If no related directory, propose \`docs/<slug>/\` or \`docs/<slug>.mdx\`
|
|
46624
46605
|
- Present the proposed destination and ask user to confirm
|
|
46625
|
-
|
|
46606
|
+
4. **Move the doc(s):**
|
|
46626
46607
|
- Single file: move from \`docs/in-progress/\` to destination
|
|
46627
46608
|
- Directory: move entire directory
|
|
46628
|
-
|
|
46609
|
+
5. **Verify and report:**
|
|
46629
46610
|
- Confirm destination exists, source removed
|
|
46630
46611
|
- Check no leftover \`status:\` or \`## Resume Context\` in moved files
|
|
46631
46612
|
- Update \`docs/priorities.mdx\` if it exists
|
|
46632
46613
|
- Report: task title, cleanup stats (lines before/after), destination path
|
|
46633
|
-
|
|
46634
|
-
## Completion Suggestions
|
|
46635
|
-
|
|
46636
|
-
When the agent observes that all plan steps for a task are marked COMPLETE and the user seems to be moving on, proactively suggest: "All steps for '{task}' are complete. Run \`/work complete\` to finalize it."
|
|
46637
46614
|
`;
|
|
46638
46615
|
}
|
|
46639
46616
|
function claudeDocsCommandTemplate() {
|
|
@@ -46699,7 +46676,7 @@ Steps:
|
|
|
46699
46676
|
|
|
46700
46677
|
### \`create [description]\` -- Reference Doc Creation
|
|
46701
46678
|
|
|
46702
|
-
Interview-driven creation for permanent documentation. Task docs go through \`/work
|
|
46679
|
+
Interview-driven creation for permanent documentation. Task docs go through \`/work\`.
|
|
46703
46680
|
|
|
46704
46681
|
1. If no description given, ask: "What do you want to document?"
|
|
46705
46682
|
2. Determine doc type (infer or ask):
|
|
@@ -47069,17 +47046,19 @@ Exactly three values for frontmatter \`status\`: \`planned\`, \`in-progress\`, \
|
|
|
47069
47046
|
- IN PROGRESS -> COMPLETE (finishing a step)
|
|
47070
47047
|
- Do NOT update on every action -- only on step transitions
|
|
47071
47048
|
|
|
47072
|
-
## Save
|
|
47049
|
+
## Auto-Save Behavior
|
|
47073
47050
|
|
|
47074
|
-
|
|
47051
|
+
The agent auto-saves progress (no user action needed) when:
|
|
47075
47052
|
- The conversation context is getting heavy (many tool calls, large file reads)
|
|
47076
47053
|
- The user appears to be wrapping up (thanks, goodbye, switching topics)
|
|
47077
47054
|
- Significant progress has been made (2+ steps completed without saving)
|
|
47078
|
-
- Before a
|
|
47055
|
+
- Before a context reset
|
|
47056
|
+
|
|
47057
|
+
Auto-save updates the task doc's Progress and Resume Context sections silently, then briefly confirms.
|
|
47079
47058
|
|
|
47080
47059
|
## Completion Suggestions
|
|
47081
47060
|
|
|
47082
|
-
When all plan steps are marked COMPLETE, suggest
|
|
47061
|
+
When all plan steps are marked COMPLETE, **suggest** completing the task -- never auto-invoke. Ask: "All steps for '{task}' look done. Want me to finalize it?"
|
|
47083
47062
|
|
|
47084
47063
|
## Directory Conventions
|
|
47085
47064
|
|
|
@@ -47204,7 +47183,7 @@ const RECOVERY_TABLE = [
|
|
|
47204
47183
|
test: r => /boundary hook/i.test(r) && /block|denied/i.test(r),
|
|
47205
47184
|
advice: 'Command blocked by SDK boundary hook.',
|
|
47206
47185
|
fix: 'Ask the user to run this command manually.',
|
|
47207
|
-
why: 'The boundary hook blocks
|
|
47186
|
+
why: 'The boundary hook blocks file modifications (Write, Edit, destructive Bash) outside the project boundary.',
|
|
47208
47187
|
see: 'CLAUDE.md',
|
|
47209
47188
|
},
|
|
47210
47189
|
{
|
package/dist/templates.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
|
|
3
3
|
// src/cli/commands/templates/core/workspace.ts
|
|
4
|
-
var TEMPLATE_VERSION =
|
|
4
|
+
var TEMPLATE_VERSION = 29;
|
|
5
5
|
function configTemplate() {
|
|
6
6
|
return `import type { ElevasConfig } from '@elevasis/sdk'
|
|
7
7
|
|
|
@@ -104,8 +104,8 @@ process.stdin.on('end', () => {
|
|
|
104
104
|
function claudeSdkBoundaryHookTemplate() {
|
|
105
105
|
return String.raw`#!/usr/bin/env node
|
|
106
106
|
// enforce-sdk-boundary.mjs
|
|
107
|
-
// Blocks
|
|
108
|
-
//
|
|
107
|
+
// Blocks file modifications (Write, Edit, MultiEdit, destructive Bash) outside the project root.
|
|
108
|
+
// Git, gh, and other CLI tools are NOT blocked -- the agent can use them freely.
|
|
109
109
|
|
|
110
110
|
import { resolve, normalize } from "node:path";
|
|
111
111
|
import { appendFileSync, mkdirSync } from "node:fs";
|
|
@@ -150,44 +150,6 @@ try {
|
|
|
150
150
|
if (input.tool_name === "Bash") {
|
|
151
151
|
const cmd = input.tool_input?.command ?? "";
|
|
152
152
|
|
|
153
|
-
// GitHub CLI -- blocked (affects shared remote state, user-initiated only)
|
|
154
|
-
if (/\bgh\b/.test(cmd)) {
|
|
155
|
-
deny(
|
|
156
|
-
"BLOCKED: GitHub CLI (gh) command detected.\n" +
|
|
157
|
-
"WHY: GitHub CLI operations affect shared remote state (PRs, issues, releases). These must be user-initiated.\n" +
|
|
158
|
-
"INSTEAD: Ask the user to run this gh command manually."
|
|
159
|
-
);
|
|
160
|
-
process.exit(0);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Destructive git -- blocked
|
|
164
|
-
if (/(?<!-)\bgit\s+reset\b/.test(cmd) && /--hard/.test(cmd)) {
|
|
165
|
-
deny(
|
|
166
|
-
"BLOCKED: git reset --hard detected.\n" +
|
|
167
|
-
"WHY: Hard resets destroy uncommitted work and cannot be undone. This must be user-initiated.\n" +
|
|
168
|
-
"INSTEAD: Ask the user to run this git command manually."
|
|
169
|
-
);
|
|
170
|
-
process.exit(0);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (/(?<!-)\bgit\s+clean\b/.test(cmd) && /-[a-zA-Z]*f/.test(cmd)) {
|
|
174
|
-
deny(
|
|
175
|
-
"BLOCKED: git clean -f detected.\n" +
|
|
176
|
-
"WHY: Force-cleaning the working tree permanently removes untracked files. This must be user-initiated.\n" +
|
|
177
|
-
"INSTEAD: Ask the user to run this git command manually."
|
|
178
|
-
);
|
|
179
|
-
process.exit(0);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (/(?<!-)\bgit\s+(rebase|merge)\b/.test(cmd)) {
|
|
183
|
-
deny(
|
|
184
|
-
"BLOCKED: git rebase/merge detected.\n" +
|
|
185
|
-
"WHY: Rebase and merge rewrite history or combine branches in ways that require user judgment.\n" +
|
|
186
|
-
"INSTEAD: Ask the user to run this git command manually."
|
|
187
|
-
);
|
|
188
|
-
process.exit(0);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
153
|
// Path-scoped blocks -- destructive commands or redirects outside project root
|
|
192
154
|
const winPaths = cmd.match(/(?<![A-Za-z])[A-Za-z]:[/\\][^\s"'|;&)]+/g) || [];
|
|
193
155
|
const unixPaths = cmd.match(/(?<=\s|^|"|')\/[^\s"'|;&)]+/g) || [];
|
|
@@ -370,7 +332,7 @@ For detailed per-dimension adaptation rules, read
|
|
|
370
332
|
| --- | --- |
|
|
371
333
|
| \`/meta\` | Project lifecycle: init, status, fix, deploy, health |
|
|
372
334
|
| \`/docs\` | Browse, create, and verify permanent documentation |
|
|
373
|
-
| \`/work\` | Task tracking: create, save, resume
|
|
335
|
+
| \`/work\` | Task tracking: auto-detects intent (create, save, resume); suggests complete |
|
|
374
336
|
| \`/tutorial\` | Progressive learning path (21 items across 4 sections) |
|
|
375
337
|
|
|
376
338
|
## Skills
|
|
@@ -602,43 +564,46 @@ Observation focus: full lifecycle coverage, pipeline internals.
|
|
|
602
564
|
**Item 4: /work and /docs**
|
|
603
565
|
|
|
604
566
|
When automation is none:
|
|
605
|
-
"You can ask the assistant to track work across conversations.
|
|
606
|
-
|
|
607
|
-
you
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
567
|
+
"You can ask the assistant to track work across conversations. Just say /work and tell it
|
|
568
|
+
what you're working on -- it figures out the rest. It'll save your progress automatically,
|
|
569
|
+
and next session you just say /work to pick up where you left off." Walk through the
|
|
570
|
+
concept without deep command details. Then introduce /docs:
|
|
571
|
+
"When a task is done, the assistant will ask if you want to finalize it -- that moves it
|
|
572
|
+
to docs/ permanently. /docs helps you find and read what's there -- like a notebook for
|
|
573
|
+
your project." Run /docs (no args) to show the docs/ overview together.
|
|
574
|
+
Verify: Run \`/work\` and describe "practice task", see it created automatically.
|
|
612
575
|
Then run /docs to see the docs/ structure.
|
|
613
576
|
Observation focus: persistence concept, cross-session continuity, docs as permanent notes.
|
|
614
577
|
|
|
615
578
|
When automation is low-code:
|
|
616
|
-
Show /work
|
|
617
|
-
|
|
618
|
-
|
|
579
|
+
Show /work as intent-driven: the agent detects whether to create, resume, or save based
|
|
580
|
+
on context. Create happens when you describe new work, resume when you pick an existing
|
|
581
|
+
task, save happens automatically when progress is made. Complete is the only action that
|
|
582
|
+
asks permission first.
|
|
619
583
|
Then introduce /docs: "/docs is for permanent knowledge -- things that don't expire. Use
|
|
620
584
|
/docs create to document a workflow or integration. Use /docs verify to check if your
|
|
621
585
|
docs match the current code." Explain the boundary: /work manages in-progress/, /docs
|
|
622
586
|
manages permanent docs/.
|
|
623
|
-
Verify:
|
|
624
|
-
|
|
625
|
-
Observation focus: task tracking
|
|
587
|
+
Verify: Run \`/work\` and describe "practice task", see auto-create. Make some changes,
|
|
588
|
+
then notice auto-save. Then run /docs to browse docs/.
|
|
589
|
+
Observation focus: intent-driven task tracking, /work vs /docs separation.
|
|
626
590
|
|
|
627
591
|
When automation is custom:
|
|
628
592
|
Read \`.claude/commands/work.md\`. Full /work coverage:
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
593
|
+
Intent detection table (list, create, resume, save auto-invoked; complete always suggests).
|
|
594
|
+
Task doc anatomy: kebab-case filename, frontmatter with status, Objective/Plan/Progress/
|
|
595
|
+
Resume Context sections. Auto-save behavior: triggers on heavy context, wrap-up signals,
|
|
596
|
+
2+ steps completed. Resolution order for resume: number, keyword match, single in-progress.
|
|
632
597
|
Then read \`.claude/commands/docs.md\`. Cover /docs operations:
|
|
633
598
|
/docs (default): browse permanent docs/, categorized with read-only auto-generated files
|
|
634
599
|
separate; /docs create: interview-driven, resource-aware doc creation from src/ code
|
|
635
600
|
analysis; /docs verify: cross-references resource IDs, schema fields, platform tools in
|
|
636
601
|
docs against src/ -- standalone analog of /meta fix step 5.
|
|
637
|
-
Explain the relationship: /work owns docs/in-progress/ (task lifecycle),
|
|
602
|
+
Explain the relationship: /work owns docs/in-progress/ (task lifecycle), completing a task
|
|
638
603
|
moves docs to permanent location, /docs browses and verifies what's there.
|
|
639
|
-
Verify: Create a task
|
|
640
|
-
to see it in the permanent docs/ listing.
|
|
641
|
-
Observation focus:
|
|
604
|
+
Verify: Create a task via /work, make progress, observe auto-save, then run /work complete
|
|
605
|
+
to move it. Run /docs to see it in the permanent docs/ listing.
|
|
606
|
+
Observation focus: intent detection, auto-save behavior, /work-to-/docs handoff, docs verification.
|
|
642
607
|
|
|
643
608
|
**Item 5: Your First Custom Workflow**
|
|
644
609
|
|
|
@@ -1172,6 +1137,8 @@ function claudeWorkCommandTemplate() {
|
|
|
1172
1137
|
|
|
1173
1138
|
You are a task tracking assistant for this Elevasis workspace. \`/work\` is the primary command for managing all work and projects.
|
|
1174
1139
|
|
|
1140
|
+
Your job is to **intelligently manage tasks without requiring the user to know subcommands**. Detect what the user needs from context and act accordingly.
|
|
1141
|
+
|
|
1175
1142
|
## Context
|
|
1176
1143
|
|
|
1177
1144
|
Read \`docs/priorities.mdx\` if it exists for current priorities.
|
|
@@ -1191,9 +1158,25 @@ When scanning, treat \`index.mdx\` as the primary task doc for a directory.
|
|
|
1191
1158
|
|
|
1192
1159
|
Enforce exactly three values in frontmatter: \`planned\`, \`in-progress\`, \`complete\`.
|
|
1193
1160
|
|
|
1194
|
-
##
|
|
1161
|
+
## Intent Detection
|
|
1162
|
+
|
|
1163
|
+
When \`/work\` is invoked (with or without arguments), detect intent from context:
|
|
1164
|
+
|
|
1165
|
+
| Signal | Action |
|
|
1166
|
+
|--------|--------|
|
|
1167
|
+
| No arguments, no active conversation context | **List** tasks, then let user pick |
|
|
1168
|
+
| User picks a number or names a task | **Resume** that task automatically |
|
|
1169
|
+
| User describes new work (not matching existing tasks) | **Create** a task doc automatically |
|
|
1170
|
+
| \`/work\` with a description that matches no existing task | **Create** automatically |
|
|
1171
|
+
| \`/work\` with a keyword/name matching an existing task | **Resume** automatically |
|
|
1172
|
+
| Conversation is getting heavy, user wrapping up, or 2+ steps completed | **Save** automatically |
|
|
1173
|
+
| All plan steps are COMPLETE | **Suggest** \`/work complete\` (never auto-invoke) |
|
|
1195
1174
|
|
|
1196
|
-
|
|
1175
|
+
**Key principle:** Create, save, and resume are auto-invoked. Complete always asks permission first.
|
|
1176
|
+
|
|
1177
|
+
## Behaviors
|
|
1178
|
+
|
|
1179
|
+
### List and Pick (default when no context)
|
|
1197
1180
|
|
|
1198
1181
|
1. Scan \`docs/in-progress/\` recursively for \`.mdx\` files with \`status\` frontmatter
|
|
1199
1182
|
2. For directories, read \`index.mdx\` as the primary task doc
|
|
@@ -1212,30 +1195,25 @@ Active Tasks
|
|
|
1212
1195
|
3. [complete] CRM Integration
|
|
1213
1196
|
Completed: 2026-03-03
|
|
1214
1197
|
|
|
1215
|
-
Pick a task by number or name
|
|
1216
|
-
- "create" to start new work
|
|
1217
|
-
- "complete <name>" to finish a task
|
|
1198
|
+
Pick a task by number or name, or describe new work to start.
|
|
1218
1199
|
\`\`\`
|
|
1219
1200
|
|
|
1220
1201
|
4. Cross-reference with \`docs/priorities.mdx\` if it exists
|
|
1221
|
-
5. When the user picks a number or describes a task
|
|
1222
|
-
6. If no tasks found,
|
|
1202
|
+
5. When the user picks a number or describes a task, auto-invoke the appropriate flow (resume or create)
|
|
1203
|
+
6. If no tasks found, ask: "What are you trying to accomplish?"
|
|
1223
1204
|
|
|
1224
|
-
###
|
|
1205
|
+
### Create (auto-invoked when new work detected)
|
|
1225
1206
|
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
1. If no description given, ask: "What are you trying to accomplish?"
|
|
1229
|
-
2. Ask 2-3 focused questions:
|
|
1207
|
+
1. If the user's intent is clear, skip the interview and create directly
|
|
1208
|
+
2. If ambiguous, ask 1-2 focused questions:
|
|
1230
1209
|
- "What does success look like?" (acceptance criteria)
|
|
1231
|
-
- "
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
- Scan \`docs/in-progress/\` for existing directories related to the topic
|
|
1210
|
+
- "Do we need to investigate anything first, or is the path clear?"
|
|
1211
|
+
3. Scan \`docs/in-progress/\` for existing directories related to the topic
|
|
1212
|
+
4. Determine directory placement:
|
|
1235
1213
|
- If related to existing directory, create as a file within it
|
|
1236
1214
|
- If new concept that may grow, create \`docs/in-progress/<slug>/index.mdx\`
|
|
1237
1215
|
- If small/standalone, create \`docs/in-progress/<slug>.mdx\`
|
|
1238
|
-
|
|
1216
|
+
5. Create the doc with \`status: planned\` and structured sections:
|
|
1239
1217
|
|
|
1240
1218
|
\`\`\`yaml
|
|
1241
1219
|
---
|
|
@@ -1247,15 +1225,20 @@ status: planned
|
|
|
1247
1225
|
|
|
1248
1226
|
Sections: Objective (what and why), Plan (numbered steps), Progress (per-step tracking with PENDING markers), Resume Context (current state, key docs, "To continue" prompt).
|
|
1249
1227
|
|
|
1250
|
-
|
|
1251
|
-
|
|
1228
|
+
6. Update \`docs/priorities.mdx\` if it exists
|
|
1229
|
+
7. Report what was created with location and step count
|
|
1252
1230
|
|
|
1253
|
-
###
|
|
1231
|
+
### Save (auto-invoked when progress detected)
|
|
1254
1232
|
|
|
1255
|
-
|
|
1233
|
+
Auto-save triggers (do NOT ask, just save):
|
|
1234
|
+
- The conversation context is getting heavy (many tool calls, large file reads)
|
|
1235
|
+
- The user appears to be wrapping up (thanks, goodbye, switching topics)
|
|
1236
|
+
- Significant progress has been made (2+ steps completed without saving)
|
|
1237
|
+
- Before a context reset
|
|
1256
1238
|
|
|
1257
|
-
|
|
1258
|
-
|
|
1239
|
+
Save flow:
|
|
1240
|
+
1. Identify the current task from conversation context
|
|
1241
|
+
2. If not working on a tracked task, offer to create a new one
|
|
1259
1242
|
3. Update Progress section:
|
|
1260
1243
|
- Mark completed steps as \`COMPLETE\` with: what was done, key decisions, files changed
|
|
1261
1244
|
- Mark current step as \`IN PROGRESS\` with current state
|
|
@@ -1265,15 +1248,13 @@ Update the current task doc's Progress and Resume Context:
|
|
|
1265
1248
|
- Files Modified: table of file paths and descriptions of changes
|
|
1266
1249
|
- Key docs to read on resume: file paths with why they matter
|
|
1267
1250
|
- To continue: copy-pasteable prompt for the next session
|
|
1268
|
-
5. Set \`status\` appropriately (\`in-progress\` if ongoing
|
|
1269
|
-
6.
|
|
1251
|
+
5. Set \`status\` appropriately (\`in-progress\` if ongoing)
|
|
1252
|
+
6. Briefly confirm: "Progress saved to {path}."
|
|
1270
1253
|
|
|
1271
|
-
###
|
|
1272
|
-
|
|
1273
|
-
Resume in-progress work. Designed for non-technical users who may not know file paths.
|
|
1254
|
+
### Resume (auto-invoked when existing task detected)
|
|
1274
1255
|
|
|
1275
1256
|
**Resolution order:**
|
|
1276
|
-
1. If a number is given
|
|
1257
|
+
1. If a number is given, map to the numbered list from the task list
|
|
1277
1258
|
2. If a name/keyword is given, substring match against task titles and filenames in \`docs/in-progress/\`
|
|
1278
1259
|
3. If no argument, scan for \`status: in-progress\` docs -- if one found, use it; if multiple, list and ask
|
|
1279
1260
|
4. If multiple matches, list them and ask which to resume
|
|
@@ -1299,35 +1280,32 @@ Key context loaded:
|
|
|
1299
1280
|
Ready to continue. {Copy of "To continue" prompt}
|
|
1300
1281
|
\`\`\`
|
|
1301
1282
|
|
|
1302
|
-
###
|
|
1283
|
+
### Complete (NEVER auto-invoked -- always suggest)
|
|
1284
|
+
|
|
1285
|
+
When all plan steps are COMPLETE, suggest: "All steps for '{task}' look done. Want me to finalize it?"
|
|
1303
1286
|
|
|
1304
|
-
|
|
1287
|
+
Only proceed after explicit user confirmation. Then:
|
|
1305
1288
|
|
|
1306
|
-
1.
|
|
1307
|
-
2. **
|
|
1308
|
-
3. **Clean up the doc:**
|
|
1289
|
+
1. **Validate readiness:** Check that all plan steps are marked COMPLETE. If not, warn and ask for confirmation.
|
|
1290
|
+
2. **Clean up the doc:**
|
|
1309
1291
|
- Strip \`## Resume Context\` section entirely (header through next \`##\` or EOF)
|
|
1310
1292
|
- Strip progress markers: \`COMPLETE\`, \`IN PROGRESS\`, \`PENDING\` from step headings
|
|
1311
1293
|
- Remove steps still marked PENDING entirely (header + body) -- they were never done
|
|
1312
1294
|
- Remove \`status\` from frontmatter (keep \`title\` and \`description\`)
|
|
1313
1295
|
- Target 200-400 lines; flag if result exceeds 500 lines
|
|
1314
|
-
|
|
1296
|
+
3. **Determine destination:**
|
|
1315
1297
|
- Scan \`docs/\` (excluding \`docs/in-progress/\`) for existing directories related to this work
|
|
1316
1298
|
- If a related directory exists, propose merging into it
|
|
1317
1299
|
- If no related directory, propose \`docs/<slug>/\` or \`docs/<slug>.mdx\`
|
|
1318
1300
|
- Present the proposed destination and ask user to confirm
|
|
1319
|
-
|
|
1301
|
+
4. **Move the doc(s):**
|
|
1320
1302
|
- Single file: move from \`docs/in-progress/\` to destination
|
|
1321
1303
|
- Directory: move entire directory
|
|
1322
|
-
|
|
1304
|
+
5. **Verify and report:**
|
|
1323
1305
|
- Confirm destination exists, source removed
|
|
1324
1306
|
- Check no leftover \`status:\` or \`## Resume Context\` in moved files
|
|
1325
1307
|
- Update \`docs/priorities.mdx\` if it exists
|
|
1326
1308
|
- Report: task title, cleanup stats (lines before/after), destination path
|
|
1327
|
-
|
|
1328
|
-
## Completion Suggestions
|
|
1329
|
-
|
|
1330
|
-
When the agent observes that all plan steps for a task are marked COMPLETE and the user seems to be moving on, proactively suggest: "All steps for '{task}' are complete. Run \`/work complete\` to finalize it."
|
|
1331
1309
|
`;
|
|
1332
1310
|
}
|
|
1333
1311
|
function claudeDocsCommandTemplate() {
|
|
@@ -1393,7 +1371,7 @@ Steps:
|
|
|
1393
1371
|
|
|
1394
1372
|
### \`create [description]\` -- Reference Doc Creation
|
|
1395
1373
|
|
|
1396
|
-
Interview-driven creation for permanent documentation. Task docs go through \`/work
|
|
1374
|
+
Interview-driven creation for permanent documentation. Task docs go through \`/work\`.
|
|
1397
1375
|
|
|
1398
1376
|
1. If no description given, ask: "What do you want to document?"
|
|
1399
1377
|
2. Determine doc type (infer or ask):
|
|
@@ -1727,17 +1705,19 @@ Exactly three values for frontmatter \`status\`: \`planned\`, \`in-progress\`, \
|
|
|
1727
1705
|
- IN PROGRESS -> COMPLETE (finishing a step)
|
|
1728
1706
|
- Do NOT update on every action -- only on step transitions
|
|
1729
1707
|
|
|
1730
|
-
## Save
|
|
1708
|
+
## Auto-Save Behavior
|
|
1731
1709
|
|
|
1732
|
-
|
|
1710
|
+
The agent auto-saves progress (no user action needed) when:
|
|
1733
1711
|
- The conversation context is getting heavy (many tool calls, large file reads)
|
|
1734
1712
|
- The user appears to be wrapping up (thanks, goodbye, switching topics)
|
|
1735
1713
|
- Significant progress has been made (2+ steps completed without saving)
|
|
1736
|
-
- Before a
|
|
1714
|
+
- Before a context reset
|
|
1715
|
+
|
|
1716
|
+
Auto-save updates the task doc's Progress and Resume Context sections silently, then briefly confirms.
|
|
1737
1717
|
|
|
1738
1718
|
## Completion Suggestions
|
|
1739
1719
|
|
|
1740
|
-
When all plan steps are marked COMPLETE, suggest
|
|
1720
|
+
When all plan steps are marked COMPLETE, **suggest** completing the task -- never auto-invoke. Ask: "All steps for '{task}' look done. Want me to finalize it?"
|
|
1741
1721
|
|
|
1742
1722
|
## Directory Conventions
|
|
1743
1723
|
|
|
@@ -1862,7 +1842,7 @@ const RECOVERY_TABLE = [
|
|
|
1862
1842
|
test: r => /boundary hook/i.test(r) && /block|denied/i.test(r),
|
|
1863
1843
|
advice: 'Command blocked by SDK boundary hook.',
|
|
1864
1844
|
fix: 'Ask the user to run this command manually.',
|
|
1865
|
-
why: 'The boundary hook blocks
|
|
1845
|
+
why: 'The boundary hook blocks file modifications (Write, Edit, destructive Bash) outside the project boundary.',
|
|
1866
1846
|
see: 'CLAUDE.md',
|
|
1867
1847
|
},
|
|
1868
1848
|
{
|
package/dist/worker/index.js
CHANGED
|
@@ -4908,7 +4908,10 @@ var scheduler = createAdapter("scheduler", [
|
|
|
4908
4908
|
|
|
4909
4909
|
// src/worker/adapters/llm.ts
|
|
4910
4910
|
var llm = {
|
|
4911
|
-
generate: (params) =>
|
|
4911
|
+
generate: async (params) => {
|
|
4912
|
+
const result = await platform.call({ tool: "llm", method: "generate", params });
|
|
4913
|
+
return { output: result };
|
|
4914
|
+
}
|
|
4912
4915
|
};
|
|
4913
4916
|
|
|
4914
4917
|
// src/worker/adapters/storage.ts
|
package/package.json
CHANGED
|
@@ -73,15 +73,15 @@ The `/docs` command manages the permanent `docs/` tree -- everything except `doc
|
|
|
73
73
|
|
|
74
74
|
### `/work` Command
|
|
75
75
|
|
|
76
|
-
The `/work` command manages in-progress task tracking across sessions. It uses `docs/in-progress/` for task documents with standardized frontmatter (`status: planned | in-progress | complete`).
|
|
76
|
+
The `/work` command manages in-progress task tracking across sessions. It uses `docs/in-progress/` for task documents with standardized frontmatter (`status: planned | in-progress | complete`).
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
- **`/work create`** -- Guided interview (5 questions) covering objective, acceptance criteria, relation to existing work, investigation needed, and placement. New docs start with `status: planned`. Placement is determined intelligently: related directory, new directory for multi-file tasks, flat file for small tasks.
|
|
80
|
-
- **`/work save`** -- Comprehensive snapshot: progress markers, files modified table, key docs to read on resume, and a copy-pasteable "To continue" prompt. Proactively suggested before context pressure builds.
|
|
81
|
-
- **`/work resume [<name>]`** -- Load a task by number, keyword, or auto-detect. Loads key docs in parallel and verifies referenced files exist. No file paths required.
|
|
82
|
-
- **`/work complete`** -- Seven-step pipeline: resolve target, validate readiness, clean doc (strip resume context, remove progress markers, target 200-400 lines), determine destination in `docs/`, confirm with user, move, verify.
|
|
78
|
+
`/work` is intent-driven -- the agent detects what to do from context rather than requiring explicit subcommands:
|
|
83
79
|
|
|
84
|
-
|
|
80
|
+
- **`/work`** (no arguments) -- Lists tasks sorted by status (`in-progress` first) with last-saved date and current step. Pick by number or name to auto-resume, or describe new work to auto-create a task.
|
|
81
|
+
- **Auto-create** -- When the user describes work that doesn't match an existing task, the agent creates a task doc automatically. If intent is clear, it skips the interview; if ambiguous, it asks 1-2 focused questions.
|
|
82
|
+
- **Auto-save** -- The agent saves progress silently when the conversation context is getting heavy, the user is wrapping up, or 2+ steps have been completed without saving. Updates progress markers, files modified, and resume context.
|
|
83
|
+
- **Auto-resume** -- When the user picks an existing task (by number, name, or keyword), the agent loads context and resumes automatically.
|
|
84
|
+
- **Suggest complete** -- When all plan steps are marked COMPLETE, the agent suggests finalizing: "All steps for '{task}' look done. Want me to finalize it?" It never auto-invokes completion. The complete flow validates readiness, cleans the doc (strips resume context, removes progress markers, targets 200-400 lines), determines destination in `docs/`, confirms with user, moves, and verifies.
|
|
85
85
|
|
|
86
86
|
**Directory conventions for `docs/in-progress/`:**
|
|
87
87
|
|
|
@@ -21,7 +21,7 @@ Running `elevasis-sdk init my-project` produces the following agent infrastructu
|
|
|
21
21
|
│ ├── tutorial.md # Progressive learning path (3 tracks)
|
|
22
22
|
│ └── work.md # Task tracking
|
|
23
23
|
├── hooks/
|
|
24
|
-
│ └── enforce-sdk-boundary.mjs # Blocks
|
|
24
|
+
│ └── enforce-sdk-boundary.mjs # Blocks file modifications outside project boundary
|
|
25
25
|
├── skills/
|
|
26
26
|
│ └── creds/SKILL.md # Credential management (auto-triggers)
|
|
27
27
|
└── rules/
|
|
@@ -167,15 +167,15 @@ Section templates by doc type:
|
|
|
167
167
|
|
|
168
168
|
**Command Routing Reference:**
|
|
169
169
|
|
|
170
|
-
| Scenario | Command
|
|
171
|
-
| --------------------------------------- |
|
|
172
|
-
| Starting new work | `/work
|
|
173
|
-
| Resuming yesterday's work | `/work
|
|
174
|
-
| Browsing what docs exist | `/docs`
|
|
175
|
-
| Creating a reference doc (not a task) | `/docs create`
|
|
176
|
-
| Checking if docs match current code | `/docs verify`
|
|
177
|
-
| Full maintenance pipeline (8 steps) | `/meta fix`
|
|
178
|
-
| Deploying code and auto-generating maps | `/meta deploy`
|
|
170
|
+
| Scenario | Command |
|
|
171
|
+
| --------------------------------------- | ----------------------------------------------------- |
|
|
172
|
+
| Starting new work | `/work` (auto-detects new work from your description) |
|
|
173
|
+
| Resuming yesterday's work | `/work` (auto-resumes if one task is in-progress) |
|
|
174
|
+
| Browsing what docs exist | `/docs` |
|
|
175
|
+
| Creating a reference doc (not a task) | `/docs create` |
|
|
176
|
+
| Checking if docs match current code | `/docs verify` |
|
|
177
|
+
| Full maintenance pipeline (8 steps) | `/meta fix` |
|
|
178
|
+
| Deploying code and auto-generating maps | `/meta deploy` |
|
|
179
179
|
|
|
180
180
|
---
|
|
181
181
|
|
|
@@ -96,7 +96,7 @@ This file is NOT scaffolded by default. The agent creates it the first time you
|
|
|
96
96
|
|
|
97
97
|
### `docs/in-progress/`
|
|
98
98
|
|
|
99
|
-
Work-in-progress task documents
|
|
99
|
+
Work-in-progress task documents managed by `/work`. Each file represents an active work item with objective, plan, progress markers, and resume context. When all steps are complete, the agent suggests finalizing the task, which moves finished items to their permanent location in `docs/`.
|
|
100
100
|
|
|
101
101
|
This directory is NOT deployed -- it is filtered out during the doc scan in `elevasis-sdk deploy`.
|
|
102
102
|
|
|
@@ -112,7 +112,7 @@ Only `src/` and `docs/` are scaffolded by `elevasis-sdk init`. The following dir
|
|
|
112
112
|
| `src/example/` | `elevasis-sdk init` (default) | Always -- echo starter workflow lives here (replace with your own) |
|
|
113
113
|
| `src/shared/` | `elevasis-sdk init` (default) | Always -- cross-domain shared utilities (starts empty) |
|
|
114
114
|
| `docs/` | `elevasis-sdk init` (default) | Always |
|
|
115
|
-
| `docs/in-progress/` | Agent (on first `/work
|
|
115
|
+
| `docs/in-progress/` | Agent (on first `/work`) | When you create a task doc for in-progress work |
|
|
116
116
|
| `docs/project-map.mdx` | `elevasis-sdk deploy` | Auto-generated on every deploy |
|
|
117
117
|
| `docs/priorities.mdx` | Agent (on first goal discussion) | When you discuss project goals or priorities |
|
|
118
118
|
| `data/` | Agent (on demand) | When you connect a database |
|
|
@@ -224,7 +224,7 @@ The `.claude/commands/` directory contains four commands covering the core devel
|
|
|
224
224
|
|
|
225
225
|
- **`/meta`** -- Project lifecycle: init, status, fix, deploy, health
|
|
226
226
|
- **`/docs`** -- Browse, create, and verify permanent documentation
|
|
227
|
-
- **`/work`** -- Task tracking across sessions:
|
|
227
|
+
- **`/work`** -- Task tracking across sessions: auto-detects intent (create, save, resume); suggests complete
|
|
228
228
|
- **`/tutorial`** -- Progressive learning path adapted to your skill profile
|
|
229
229
|
|
|
230
230
|
For detailed command documentation, see [Agent System](agent).
|
|
@@ -31,7 +31,7 @@ my-project/
|
|
|
31
31
|
│ │ ├── tutorial.md # Progressive learning
|
|
32
32
|
│ │ └── work.md # Task tracking
|
|
33
33
|
│ ├── hooks/
|
|
34
|
-
│ │ └── enforce-sdk-boundary.mjs # Blocks
|
|
34
|
+
│ │ └── enforce-sdk-boundary.mjs # Blocks file modifications outside project (auto-loaded)
|
|
35
35
|
│ ├── scripts/
|
|
36
36
|
│ │ └── statusline-command.js # Dynamic status line script
|
|
37
37
|
│ ├── skills/
|